Dotclear

Changeset 310:0346fd2599eb for plugins


Ignore:
Timestamp:
05/23/11 15:52:58 (14 years ago)
Author:
Tomtom33 <tbouron@…>
Branch:
wysiwyg
Message:

Updated tag plugin for the new toolbar integration

Location:
plugins/tags
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • plugins/tags/_admin.php

    r217 r310  
    119119          "metaEditor.prototype.text_all = '".html::escapeJS(__('all'))."';\n". 
    120120          "metaEditor.prototype.text_separation = '';\n". 
    121           "jsToolBar.prototype.elements.tag.title = '".html::escapeJS(__('Tag'))."';\n". 
    122           "jsToolBar.prototype.elements.tag.url = '".html::escapeJS($tag_url)."';\n". 
    123121          "dotclear.msg.tags_autocomplete = '".html::escapeJS(__('used in %e - frequency %p%'))."';\n". 
    124122          "dotclear.msg.entry = '".html::escapeJS(__('entry'))."';\n". 
    125123          "dotclear.msg.entries = '".html::escapeJS(__('entries'))."';\n". 
     124          "dcToolBarManager.fn.wiki.push(function() {\n". 
     125               "jsToolBar.prototype.elements.tag.title = '".html::escapeJS(__('Tag'))."';\n". 
     126               "jsToolBar.prototype.elements.tag.url = '".html::escapeJS($tag_url)."';\n". 
     127          "});\n". 
    126128          "\n//]]>\n". 
    127129          "</script>\n". 
  • plugins/tags/js/post.js

    r0 r310  
    6060 
    6161// Toolbar button for tags 
    62 jsToolBar.prototype.elements.tagSpace = {type: 'space'}; 
    63  
    64 jsToolBar.prototype.elements.tag = {type: 'button', title: 'Keyword', fn:{} }; 
    65 jsToolBar.prototype.elements.tag.context = 'post'; 
    66 jsToolBar.prototype.elements.tag.icon = 'index.php?pf=tags/img/tag-add.png'; 
    67 jsToolBar.prototype.elements.tag.fn.wiki = function() { 
    68      this.encloseSelection('','',function(str) { 
    69           if (str == '') { window.alert(dotclear.msg.no_selection); return ''; } 
    70           if (str.indexOf(',') != -1) { 
    71                return str; 
    72           } else { 
    73                window.dc_tag_editor.addMeta(str); 
    74                return '['+str+'|tag:'+str+']'; 
    75           } 
    76      }); 
    77 }; 
    78 jsToolBar.prototype.elements.tag.fn.xhtml = function() { 
    79      var url = this.elements.tag.url; 
    80      this.encloseSelection('','',function(str) { 
    81           if (str == '') { window.alert(dotclear.msg.no_selection); return ''; } 
    82           if (str.indexOf(',') != -1) { 
    83                return str; 
    84           } else { 
    85                window.dc_tag_editor.addMeta(str); 
    86                return '<a href="'+this.stripBaseURL(url+'/'+str)+'">'+str+'</a>'; 
    87           } 
    88      }); 
    89 }; 
    90 jsToolBar.prototype.elements.tag.fn.wysiwyg = function() { 
    91      var t = this.getSelectedText(); 
     62dcToolBarManager.fn.wiki.push(function() { 
     63     jsToolBar.prototype.elements.tagSpace = {type: 'space'}; 
    9264      
    93      if (t == '') { window.alert(dotclear.msg.no_selection); return; } 
    94      if (t.indexOf(',') != -1) { return; } 
    95       
    96      var n = this.getSelectedNode(); 
    97      var a = document.createElement('a'); 
    98      a.href = this.stripBaseURL(this.elements.tag.url+'/'+t); 
    99      a.appendChild(n); 
    100      this.insertNode(a); 
    101      window.dc_tag_editor.addMeta(t); 
    102 }; 
     65     jsToolBar.prototype.elements.tag = {type: 'button', title: 'Keyword', fn:{} }; 
     66     jsToolBar.prototype.elements.tag.context = 'post'; 
     67     jsToolBar.prototype.elements.tag.icon = 'index.php?pf=tags/img/tag-add.png'; 
     68     jsToolBar.prototype.elements.tag.fn.wiki = function() { 
     69          this.encloseSelection('','',function(str) { 
     70               if (str == '') { window.alert(dotclear.msg.no_selection); return ''; } 
     71               if (str.indexOf(',') != -1) { 
     72                    return str; 
     73               } else { 
     74                    window.dc_tag_editor.addMeta(str); 
     75                    return '['+str+'|tag:'+str+']'; 
     76               } 
     77          }); 
     78     }; 
     79     jsToolBar.prototype.elements.tag.fn.xhtml = function() { 
     80          var url = this.elements.tag.url; 
     81          this.encloseSelection('','',function(str) { 
     82               if (str == '') { window.alert(dotclear.msg.no_selection); return ''; } 
     83               if (str.indexOf(',') != -1) { 
     84                    return str; 
     85               } else { 
     86                    window.dc_tag_editor.addMeta(str); 
     87                    return '<a href="'+this.stripBaseURL(url+'/'+str)+'">'+str+'</a>'; 
     88               } 
     89          }); 
     90     }; 
     91     jsToolBar.prototype.elements.tag.fn.wysiwyg = function() { 
     92          var t = this.getSelectedText(); 
     93           
     94          if (t == '') { window.alert(dotclear.msg.no_selection); return; } 
     95          if (t.indexOf(',') != -1) { return; } 
     96           
     97          var n = this.getSelectedNode(); 
     98          var a = document.createElement('a'); 
     99          a.href = this.stripBaseURL(this.elements.tag.url+'/'+t); 
     100          a.appendChild(n); 
     101          this.insertNode(a); 
     102          window.dc_tag_editor.addMeta(t); 
     103     }; 
     104}); 
Note: See TracChangeset for help on using the changeset viewer.

Sites map