Site navigation


Last Edit

Page last modified 18:30, 2 Dec 2010 by Dadeo
Template:SelectAddTag >

Template:SelectAddTag

    Table of contents
    No headers
    // History
    //   2010/07/22 - Mindtouch guys changed the Javascript behaviour (naming) on Mindtouch v10, changed the code to suport it.
    
    var TagName = String.Split($0,","); 
    var prefix = $1 ?? '';
    var TagId = $2 ?? 'TagSelector';
    
    var actual = '';
    
    <SELECT id=(TagId)>
    <OPTION VALUE=('')>&nbsp;</OPTION>
    var selected;
    foreach(var tag in TagName) {
      let selected = false;
      foreach(var tt in page.tags) {
        if (String.ToLower(tt.value)==String.ToLower(tag)) { let selected=true; let actual = tag;} 
       }
      if (selected) {   <OPTION VALUE=(tag) SELECTED='SELECTED'>(String.Replace(tag,prefix,''))</OPTION> }
       else { <OPTION VALUE=(tag)>(String.Replace(tag,prefix,''))</OPTION> }
     }
    </SELECT>
    
    <span id=("TagSelector_loading"..TagId)
        style="display:none;margin:auto;width:40px;height:40px;background-repeat: no-repeat; align: left; background-image:url('/skins/common/icons/anim-wait-circle.gif');">
    &nbsp; ;
    &nbsp; ;
    &nbsp; ;
    </span>
    <script type="text/jem">"
     var previous"..TagId.." = \""..actual.."\".toLowerCase();
     function TagSelectorControls"..TagId.."() {
        Deki.$('#"..TagId.."').bind('change', function() {
            var error;
            var actualTag = Deki.$('#"..TagId.."').val().toLowerCase();
            $('#"..TagId.."').hide();
            $('#TagSelector_loading"..TagId.."').show();
            if (previous"..TagId.."!='') {
               $('#' + Deki.Plugin.PageTags.ID).find('ul.tags a[class!=tag-delete]').each(function(index) {
                  if ($(this).attr('title').toLowerCase() == previous"..TagId..") {
                     var callback = null;
                     if (actualTag=='') { callback = callbackTagSelector"..TagId.."; }
                     Deki.Plugin.PageTags.Delete([ $(this).attr('tagid') ],callback,error);
                    }
                });
              }
            previous"..TagId.." = actualTag;
            if (previous"..TagId.."!='') {
               Deki.Plugin.PageTags.Save([ previous"..TagId.." ],callbackTagSelector"..TagId..",error);
              }
    
            return false;
        });
       }
    
     TagSelectorControls"..TagId.."();
     function callbackTagSelector"..TagId.."(obj) {
        // -- Mindtouch v10 Previous: Deki.Tags.RefreshView(); 
        Deki.Plugin.PageTags.Refresh();
        $('#TagSelector_loading"..TagId.."').hide();
        $('#"..TagId.."').show();
       }
    
    "</script>
    



    Tag page (Edit tags)
    • No tags

    Running the latest version?

    V1.12.0 - released July 2015
    Releasenews | Download
    Changelog
    | Requirements

    MediaPortal RSS Feeds

    windows media centerNews & Blogs
    htpcP&S: New
    htpcDocumentation

    Team-MediaPortal

    HTPCAbout
    Contact | Press
    Partners