Map id the same for items in a list

8 posts, 1 answers
  1. Luc
    Luc avatar
    4 posts
    Member since:
    Jun 2009

    Posted 08 Apr 2010 Link to this post

    Dear,

    I show a picture in a listitem using the telerik radeditor lite (SharePoint). Using mapeditor I identify several areas to make clickable maps. The problem is that the map id for all the maps is the same for all list items. This is not an issue when showing only one item (because then there is only one map to refer to), but if I show multiple items on a page, the same map is always referred to (because all maps have the same map id.).
    I can manually change this in html, but I hoped there would be a cleaner solution.

    Thanks for the feedback.

    Kind Regards,
    Luc
  2. Stanimir
    Admin
    Stanimir avatar
    1653 posts

    Posted 08 Apr 2010 Link to this post

    Hello Luc,

    Could you confirm, which version of RadEditor for MOSS you are using? Is it Lite RadEditor for MOSS or the Full ASP.NET AJAX version?


    Regards,
    Stanimir
    the Telerik team

    Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items.

  3. Luc
    Luc avatar
    4 posts
    Member since:
    Jun 2009

    Posted 08 Apr 2010 Link to this post

    Hello Stanimir,

    If I'm correct it is the Lite version for MOSS.

    Regards,
    Luc
  4. Stanimir
    Admin
    Stanimir avatar
    1653 posts

    Posted 09 Apr 2010 Link to this post

    Hi Luc,

    This problem is fixed in the Full version of RadEditor for MOSS, so the best solution is upgrade to it. You can find the upgrade instructions in the following online help article http://www.telerik.com/help/aspnet-ajax/upgrade-instructions-from-v4-to-v5.html.

    What I can do though is to provide you with the code, which is creating the map element in the classic RadEditor for ASP.NET:
    RadEditorNamespace.radEditorSetImageMapProperties = function(MapProps, params)
    {
        if (!MapProps) {
            return;
        }
     
        var NewMapHtml = MapProps.MapHtml;
        var NewImageSrc = MapProps.ImageSrc;
        var editor = params.editor;
     
        var oSelElem = editor.GetSelectedElement();
        var Image;
        if (oSelElem && oSelElem.tagName == "IMG" )
        {
            Image = oSelElem;
            if (NewImageSrc != Image.src) {
                Image.src = NewImageSrc;
            }
     
        } else {
     
            // insert the new image into the content
            if (!NewImageSrc) {
                return;
            }
     
            var Html = '<img src="' + NewImageSrc + '" id = "__tmp__">';
            editor.PasteHtml(Html);
            Image = editor.Document.getElementById('__tmp__');
            Image.removeAttribute('id');
            if (document.all)
            {
                // select the image as text in order to remove the image handlers
                var oRng = editor.Document.body.createTextRange();
                oRng.collapse();
                oRng.moveToElementText(Image);
                oRng.select();
            }
     
        }
     
        var _tmp = document.createElement('SPAN');
        _tmp.innerHTML = NewMapHtml;
        var _tmp_maps = _tmp.getElementsByTagName('map');
        if (_tmp_maps.length == 0) { // this is unusual
            return;
        }
     
        var MapAreasHtml    = _tmp_maps[0].innerHTML;
        _tmp = null;
     
        if (MapAreasHtml)
        {
     
            var MapName = '';
            var Map     = null;
     
            var UseMapAttr = Image.getAttribute('useMap');
            if (UseMapAttr) // reuse the old image map
            {
                MapName = UseMapAttr.substr(1);
                Map     = RadEditorNamespace.GetImageMapByName(editor, MapName);
            }
     
            if (Map == null)
            {
     
                // create new image map
                var _cnt = 0;
     
                var ImageMapPreffix = 'rade_img_map_' + editor.Id + '_';
                var ImageMapName    = ImageMapPreffix + _cnt;
                 
                //here you can modify the original ImageMapName
                ImageMapName += '_your_custom_unique_code';
                 
                 
                 
                while (RadEditorNamespace.GetImageMapByName(editor, ImageMapName) != null)
                {
                    _cnt ++;
                    ImageMapName = ImageMapPreffix + _cnt;
                }
     
                Map      = editor.Document.createElement('map');
                Map.id   = ImageMapName;
                Map.name = ImageMapName;
     
                MapName = ImageMapName;
     
                Map = editor.Document.body.appendChild(Map);
     
                Image.setAttribute('useMap', '#' + ImageMapName);
                Image.setAttribute('border', '0'); // to be consistent with the link applying
            }
     
            if (document.all) { // IE doesn't preserve the name attr.
                Map.outerHTML = '<map id="' + MapName + '" name="' + MapName + '">' + MapAreasHtml + '</map>';
            } else {
                Map.innerHTML = MapAreasHtml;
            }
        }
        else
        {
            // no map areas defined
            Image.removeAttribute('useMap');
        }
     
    };

    Find the following part in it. This is were you can set your custom unique name.
    //here you can modify the original ImageMapName
    ImageMapName += '_your_custom_unique_code';

    Just make sure that you call this code at the end of the page. This way you can be sure that it overwrites the original one.

    Greetings,
    Stanimir
    the Telerik team

    Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items.
  5. Luc
    Luc avatar
    4 posts
    Member since:
    Jun 2009

    Posted 28 Apr 2010 Link to this post

    Hello Stanimir,

    The version 5 is a paid version (in contradiction with the free MOSS editor Lite)? Where can I find the download (to test in our dev environment)?

    Thanks for your feedback!

    Regards,
    Luc
  6. Answer
    Stanimir
    Admin
    Stanimir avatar
    1653 posts

    Posted 28 Apr 2010 Link to this post

    Hello Luc,

    You can download the trial from the RadControls for ASP.NET AJAX trials page on our site. Click on the DLLs, Scripts, Source Code, DNN and MOSS wrappers ... link and then download RadEditor for MOSS 2007   (zip, 14 MB)

    All the best,
    Stanimir
    the Telerik team

    Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items.
  7. Luc
    Luc avatar
    4 posts
    Member since:
    Jun 2009

    Posted 28 Apr 2010 Link to this post

    Hello Stanimir,

    This means we have to buy the complete ASP.NET Ajax controls suite?

    Regards,
    Luc
  8. Stanimir
    Admin
    Stanimir avatar
    1653 posts

    Posted 28 Apr 2010 Link to this post

    Hello Luc,

    This means we have to buy the complete ASP.NET Ajax controls suite? - The answer is yes. We do not sell RadEditor for MOSS separately.


    Sincerely yours,
    Stanimir
    the Telerik team

    Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items.
Back to Top