Changeset 2546:e9b5815be220
- Timestamp:
- 11/14/13 14:05:49 (12 years ago)
- Branch:
- 2.6
- Files:
-
- 6 edited
Legend:
- Unmodified
- Added
- Removed
-
admin/js/meta-editor.js
r2545 r2546 1 1 //~ metaEditor & metaEditor.prototype should go to the core. 2 function metaEditor(target,meta_field,meta_type ) {2 function metaEditor(target,meta_field,meta_type,meta_options) { 3 3 this.target = target; 4 4 5 this.meta_field = meta_field; 5 6 this.meta_type = meta_type; 7 this.meta_url = meta_options.meta_url || this.meta_url; 8 this.list_type = meta_options.list_type || this.list_type; 9 this.text_confirm_remove = meta_options.text_confirm_remove || this.text_confirm_remove; 10 this.text_add_meta = meta_options.text_add_meta || this.text_add_meta; 11 this.text_choose = meta_options.text_choose || this.text_choose; 12 this.text_all = meta_options.text_all || this.text_all; 13 this.text_separation = meta_options.text_separation || this.text_separation; 6 14 }; 7 15 … … 13 21 text_all: 'all', 14 22 text_separation: 'Separate each %s by comas', 23 list_type: 'more', 15 24 16 25 target: null, … … 124 133 } 125 134 126 this.showMetaList( metaEditor.prototype.meta_type,this.target);127 128 }, 129 130 showMetaList: function( type,target) {135 this.showMetaList(this.list_type,this.target); 136 137 }, 138 139 showMetaList: function(list_type,target) { 131 140 132 141 var params = { … … 136 145 }; 137 146 138 if ( type == 'more') {147 if (list_type == 'more') { 139 148 params.limit = '30'; 140 149 } … … 167 176 }); 168 177 169 if ( type == 'more') {178 if (list_type == 'more') { 170 179 var a_more = $('<a href="#" class="metaGetMore"></a>'); 171 180 a_more.append(This.text_all + String.fromCharCode(160)+String.fromCharCode(187)); … … 177 186 } 178 187 179 if ( type != 'more-all') {188 if (list_type != 'more-all') { 180 189 pl.addClass('hide'); 181 190 -
locales/fr/plugins.po
r2509 r2546 1639 1639 1640 1640 #, php-format 1641 msgid "Are you sure you want to remove this %s?"1642 msgstr "Êtes-vous sûr de vouloir supprimer ce %s?"1643 1644 #, php-format 1645 msgid "Add a %sto this entry"1646 msgstr "Ajouter %sà ce billet"1641 msgid "Are you sure you want to remove this tag?" 1642 msgstr "Êtes-vous sûr de vouloir supprimer ce mot-clé ?" 1643 1644 #, php-format 1645 msgid "Add a tag to this entry" 1646 msgstr "Ajouter un mot-clé à ce billet" 1647 1647 1648 1648 msgid "Choose from list" … … 1653 1653 1654 1654 msgid "Enter tags separated by coma" 1655 msgstr " Entrez les mots-clés séparés par des virgules"1655 msgstr "Séparez les mot-clés par des virgules" 1656 1656 1657 1657 msgid "used in %e - frequency %p%" -
plugins/tags/_admin.php
r2322 r2546 73 73 $wiki2xhtml->registerFunction('url:tag',array('tagsBehaviors','wiki2xhtmlTag')); 74 74 } 75 75 76 76 public static function wiki2xhtmlTag($url,$content) 77 77 { … … 80 80 $content = substr($content,4); 81 81 } 82 83 82 83 84 84 $tag_url = html::stripHostURL($GLOBALS['core']->blog->url.$GLOBALS['core']->url->getURLFor('tag')); 85 85 $res['url'] = $tag_url.'/'.rawurlencode(dcMeta::sanitizeMetaID($url)); 86 86 $res['content'] = $content; 87 87 88 88 return $res; 89 89 } 90 90 91 91 public static function tagsField($main,$sidebar,$post) 92 92 { 93 93 $meta =& $GLOBALS['core']->meta; 94 94 95 95 if (!empty($_POST['post_tags'])) { 96 96 $value = $_POST['post_tags']; … … 102 102 '<div class="p s-tags" id="tags-edit">'.form::textarea('post_tags',20,3,$value,'maximal').'</div>'; 103 103 } 104 104 105 105 public static function setTags($cur,$post_id) 106 106 { 107 107 $post_id = (integer) $post_id; 108 108 109 109 if (isset($_POST['post_tags'])) { 110 110 $tags = $_POST['post_tags']; 111 111 $meta =& $GLOBALS['core']->meta; 112 112 $meta->delPostMeta($post_id,'tag'); 113 113 114 114 foreach ($meta->splitMetaValues($tags) as $tag) { 115 115 $meta->setPostMeta($post_id,'tag',$tag); … … 117 117 } 118 118 } 119 120 119 120 121 121 public static function adminPostsActionsPage($core,$ap) 122 122 { … … 125 125 array('tagsBehaviors','adminAddTags') 126 126 ); 127 127 128 128 if ($core->auth->check('delete,contentadmin',$core->blog->id)) { 129 129 $ap->addAction( … … 133 133 } 134 134 } 135 135 136 136 public static function adminAddTags($core, dcPostsActionsPage $ap, $post) 137 137 { … … 165 165 ); 166 166 $ap->redirect(true); 167 } 168 else 167 } 168 else 169 169 { 170 170 $tag_url = $core->blog->url.$core->url->getURLFor('tag'); … … 173 173 $type = isset($opts['tag_list_format']) ? $opts['tag_list_format'] : 'more'; 174 174 175 175 176 176 $ap->beginPage( 177 177 dcPage::breadcrumb( … … 183 183 dcPage::jsLoad('js/jquery/jquery.autocomplete.js'). 184 184 dcPage::jsMetaEditor(). 185 '<script type="text/javascript">'."\n". 186 "//<![CDATA[\n". 187 "var editor_tags_options = {\n". 188 "meta_url : 'plugin.php?p=tags&m=tag_posts&tag=',\n". 189 "list_type : '".html::escapeJS($type)."',\n". 190 "text_confirm_remove : '".html::escapeJS(__('Are you sure you want to remove this tag?'))."',\n". 191 "text_add_meta : '".html::escapeJS(__('Add a tag to this entry'))."',\n". 192 "text_choose : '".html::escapeJS(__('Choose from list'))."',\n". 193 "text_all : '".html::escapeJS(__('all'))."',\n". 194 "text_separation : '".html::escapeJS(__('Enter tags separated by coma'))."',\n". 195 "};\n". 196 "\n//]]>\n". 197 "</script>\n". 185 198 '<script type="text/javascript" src="index.php?pf=tags/js/jquery.autocomplete.js"></script>'. 186 199 '<script type="text/javascript" src="index.php?pf=tags/js/posts_actions.js"></script>'. 187 200 '<script type="text/javascript">'."\n". 188 201 "//<![CDATA[\n". 189 "metaEditor.prototype.meta_url = 'plugin.php?p=tags&m=tag_posts&tag=';\n".190 "metaEditor.prototype.meta_type = '".html::escapeJS($type)."';\n".191 "metaEditor.prototype.text_confirm_remove = '".html::escapeJS(__('Are you sure you want to remove this %s?'))."';\n".192 "metaEditor.prototype.text_add_meta = '".html::escapeJS(__('Add a %s to this entry'))."';\n".193 "metaEditor.prototype.text_choose = '".html::escapeJS(__('Choose from list'))."';\n".194 "metaEditor.prototype.text_all = '".html::escapeJS(__('all'))."';\n".195 "metaEditor.prototype.text_separation = '".html::escapeJS(__('Enter tags separated by coma'))."';\n".196 202 "dotclear.msg.tags_autocomplete = '".html::escapeJS(__('used in %e - frequency %p%'))."';\n". 197 203 "dotclear.msg.entry = '".html::escapeJS(__('entry'))."';\n". … … 217 223 public static function adminRemoveTags($core, dcPostsActionsPage $ap, $post) 218 224 { 219 if (!empty($post['meta_id']) && 225 if (!empty($post['meta_id']) && 220 226 $core->auth->check('delete,contentadmin',$core->blog->id)) 221 227 { … … 242 248 $meta =& $core->meta; 243 249 $tags = array(); 244 250 245 251 foreach ($ap->getIDS() as $id) { 246 252 $post_tags = $meta->getMetadata(array( … … 257 263 if (empty($tags)) { 258 264 throw new Exception(__('No tags for selected entries')); 259 } 265 } 260 266 $ap->beginPage( 261 267 dcPage::breadcrumb( … … 266 272 ))); 267 273 $posts_count = count($_POST['entries']); 268 274 269 275 echo 270 276 '<form action="'.$ap->getURI().'" method="post">'. 271 277 $ap->getCheckboxes(). 272 278 '<div><p>'.__('Following tags have been found in selected entries:').'</p>'; 273 279 274 280 foreach ($tags as $k => $n) { 275 281 $label = '<label class="classic">%s %s</label>'; … … 282 288 '</p>'; 283 289 } 284 290 285 291 echo 286 292 '<p><input type="submit" value="'.__('ok').'" />'. 287 293 288 294 $core->formNonce().$ap->getHiddenFields(). 289 295 form::hidden(array('action'),'tags_remove'). … … 291 297 $ap->endPage(); 292 298 } 293 294 } 295 299 300 } 301 296 302 public static function postHeaders() 297 303 { 298 304 $tag_url = $GLOBALS['core']->blog->url.$GLOBALS['core']->url->getURLFor('tag'); 299 305 300 306 $opts = $GLOBALS['core']->auth->getOptions(); 301 307 $type = isset($opts['tag_list_format']) ? $opts['tag_list_format'] : 'more'; 302 303 return 308 309 return 310 '<script type="text/javascript">'."\n". 311 "//<![CDATA[\n". 312 "var editor_tags_options = {\n". 313 "meta_url : 'plugin.php?p=tags&m=tag_posts&tag=',\n". 314 "list_type : '".html::escapeJS($type)."',\n". 315 "text_confirm_remove : '".html::escapeJS(__('Are you sure you want to remove this tag?'))."',\n". 316 "text_add_meta : '".html::escapeJS(__('Add a tag to this entry'))."',\n". 317 "text_choose : '".html::escapeJS(__('Choose from list'))."',\n". 318 "text_all : '".html::escapeJS(__('all'))."',\n". 319 "text_separation : '".html::escapeJS(__('Enter tags separated by coma'))."',\n". 320 "};\n". 321 "\n//]]>\n". 322 "</script>\n". 304 323 '<script type="text/javascript" src="index.php?pf=tags/js/jquery.autocomplete.js"></script>'. 305 324 '<script type="text/javascript" src="index.php?pf=tags/js/post.js"></script>'. 306 325 '<script type="text/javascript">'."\n". 307 326 "//<![CDATA[\n". 308 "metaEditor.prototype.meta_url = 'plugin.php?p=tags&m=tag_posts&tag=';\n".309 "metaEditor.prototype.meta_type = '".html::escapeJS($type)."';\n".310 "metaEditor.prototype.text_confirm_remove = '".html::escapeJS(__('Are you sure you want to remove this %s?'))."';\n".311 "metaEditor.prototype.text_add_meta = '".html::escapeJS(__('Add a %s to this entry'))."';\n".312 "metaEditor.prototype.text_choose = '".html::escapeJS(__('Choose from list'))."';\n".313 "metaEditor.prototype.text_all = '".html::escapeJS(__('all'))."';\n".314 "metaEditor.prototype.text_separation = '';\n".315 327 "jsToolBar.prototype.elements.tag.title = '".html::escapeJS(__('Tag'))."';\n". 316 328 "jsToolBar.prototype.elements.tag.url = '".html::escapeJS($tag_url)."';\n". … … 322 334 '<link rel="stylesheet" type="text/css" href="index.php?pf=tags/style.css" />'; 323 335 } 324 336 325 337 public static function adminUserForm($args) 326 338 { … … 334 346 $opts = array(); 335 347 } 336 348 337 349 $combo = array(); 338 350 $combo[__('Short')] = 'more'; 339 351 $combo[__('Extended')] = 'all'; 340 352 341 353 $value = array_key_exists('tag_list_format',$opts) ? $opts['tag_list_format'] : 'more'; 342 354 343 355 echo 344 356 '<p><label for="user_tag_list_format" class="classic">'.__('Tags list format:').'</label> '. … … 346 358 '</p>'; 347 359 } 348 360 349 361 public static function setTagListFormat($cur,$user_id = null) 350 362 { -
plugins/tags/_define.php
r2257 r2546 16 16 /* Description*/ "Tags for posts", 17 17 /* Author */ "Olivier Meunier", 18 /* Version */ '1.2 ',18 /* Version */ '1.2.1', 19 19 array( 20 20 'permissions' => 'usage,contentadmin', -
plugins/tags/js/post.js
r2180 r2546 4 4 var post_id = $('#id'); 5 5 var meta_field = null; 6 6 7 7 if (tags_edit.length > 0) { 8 8 post_id = (post_id.length > 0) ? post_id.get(0).value : false; … … 11 11 meta_field.val($('#post_tags').val()); 12 12 } 13 var mEdit = new metaEditor(tags_edit,meta_field,'tag' );13 var mEdit = new metaEditor(tags_edit,meta_field,'tag',editor_tags_options); 14 14 mEdit.meta_url = 'plugin.php?p=tags&m=tag_posts&tag='; 15 15 mEdit.displayMeta('tag',post_id); 16 16 17 17 // mEdit object reference for toolBar 18 18 window.dc_tag_editor = mEdit; 19 19 } 20 20 21 21 $('#post_meta_input').autocomplete(mEdit.service_uri, { 22 22 extraParams: { … … 29 29 matchSubset: false, 30 30 matchContains: true, 31 parse: function(xml) { 31 parse: function(xml) { 32 32 var results = []; 33 33 $(xml).find('meta').each(function(){ … … 39 39 }, 40 40 result: $(this).text() 41 }; 41 }; 42 42 }); 43 43 return results; … … 69 69 // Toolbar button for tags 70 70 jsToolBar.prototype.elements.tagSpace = { 71 type: 'space', 71 type: 'space', 72 72 format:{ 73 73 wysiwyg:true, … … 105 105 jsToolBar.prototype.elements.tag.fn.wysiwyg = function() { 106 106 var t = this.getSelectedText(); 107 107 108 108 if (t == '') { window.alert(dotclear.msg.no_selection); return; } 109 109 if (t.indexOf(',') != -1) { return; } 110 110 111 111 var n = this.getSelectedNode(); 112 112 var a = document.createElement('a'); -
plugins/tags/js/posts_actions.js
r1112 r2546 1 1 $(function() { 2 2 var tag_field = $('#new_tags'); 3 3 4 4 tag_field.after('<div id="tags_list"></div>'); 5 5 tag_field.hide(); 6 7 var target = $('#tags_list'); 8 var mEdit = new metaEditor(target,tag_field,'tag' );6 7 var target = $('#tags_list'); 8 var mEdit = new metaEditor(target,tag_field,'tag',editor_tags_options); 9 9 mEdit.meta_url = 'plugin.php?p=tags&m=tag_posts&tag='; 10 10 11 11 mEdit.meta_dialog = $('<input type="text" />'); 12 12 mEdit.meta_dialog.attr('title',mEdit.text_add_meta.replace(/%s/,mEdit.meta_type)); 13 13 mEdit.meta_dialog.attr('id','post_meta_input'); 14 14 mEdit.meta_dialog.css('width','90%'); 15 15 16 16 mEdit.addMetaDialog(); 17 17 18 18 $('input[name="save_tags"]').click(function() { 19 19 tag_field.val($('#post_meta_input').val()); 20 20 }); 21 21 22 22 $('#post_meta_input').autocomplete(mEdit.service_uri, { 23 23 extraParams: { … … 29 29 matchSubset: false, 30 30 matchContains: true, 31 parse: function(xml) { 31 parse: function(xml) { 32 32 var results = []; 33 33 $(xml).find('meta').each(function(){ … … 39 39 }, 40 40 result: $(this).text() 41 }; 41 }; 42 42 }); 43 43 return results; … … 54 54 ')</em>'; 55 55 }, 56 formatResult: function(tag) { 57 return tag.result; 56 formatResult: function(tag) { 57 return tag.result; 58 58 } 59 59 });
Note: See TracChangeset
for help on using the changeset viewer.