Changeset 6568


Ignore:
Timestamp:
02/28/10 09:11:35 (2 years ago)
Author:
PaulHarvey
Message:

Item8445: Cleaning up JQuery UI in TagMePlugin for release.
Item3867: This commit provides a way to directly add tags without selection.
Item8288: This commit provides a way for admin users, users with topic CHANGE permissions, or everybody (configurable) to remove tags from a topic regardless of vote count.
Item5153: This commit provides a way to add multiple tags without leaving the topic being tagged.
Item8365: This commit fixes the MANIFEST to address missing styleblog files.
Item8343: This commit fixes the MANIFEST to address missing styleblog files.
Item8531: This commit removes minified/compressed files from svn.

Location:
trunk/TagMePlugin
Files:
4 deleted
8 edited

Legend:

Unmodified
Added
Removed
  • trunk/TagMePlugin/data/System/TagMeAjaxHelper.txt

    r6270 r6568  
    88}% 
    99%ENDSECTION{"tagquery"}% 
    10 %STARTSECTION{"jqui"}%%JQREQUIRE{"textboxlist"}%%JQREQUIRE{"autocomplete"}%%JQREQUIRE{"simplemodal"}%%JQREQUIRE{"hoverintent"}%%JQREQUIRE{"queryobject"}%%ADDTOHEAD{ 
    11    "TAGMEPLUGIN::JQUI" 
    12    text="<meta name='foswiki.TagMePlugin.jquitags' 
    13        content='%TAGME{tpaction="%URLPARAM{"tpaction" default="showalltags"}%" 
    14          tag="%URLPARAM{"tptag"}%" web="%BASEWEB%" topic="%BASETOPIC%" separator=","}%' 
    15      /><script type='text/javascript' src='%PUBURLPATH%/%SYSTEMWEB%/%TOPIC%/jquery.tagmeui.js'></script> 
    16      <link rel='stylesheet' href='%PUBURLPATH%/%SYSTEMWEB%/TagMeAjaxHelper/jquery.tagmeui.css' 
    17      type='text/css' media='all'/>"  
    18    requires="JQUERYPLUGIN::TEXTBOXLIST, JQUERYPLUGIN::AUTOCOMPLETE, JQUERYPLUGIN::SIMPLEMODAL, JQUERYPLUGIN::HOVERINTENT, JQUERYPLUGIN::QUERYOBJECT" 
    19 }%<div id='tagmejqcontainer'><span id="tagmejqtagstatus">&nbsp;</span> 
     10%STARTSECTION{"jqui"}%%JQREQUIRE{"textboxlist"}%%JQREQUIRE{"autocomplete"}%%JQREQUIRE{"simplemodal"}%%JQREQUIRE{"hoverintent"}%%JQREQUIRE{"queryobject"}%%ADDTOZONE{"head"  
     11  tag="TAGMEPLUGIN::JQUI:CSS"  
     12  text="<meta name='foswiki.TagMePlugin.jquitags' content='%TAGME{tpaction="%URLPARAM{"tpaction" default="showalltags"}%" tag="%URLPARAM{"tptag"}%" web="%BASEWEB%" topic="%BASETOPIC%" separator=","}%' /> 
     13     <meta name='foswiki.TagMePlugin.remove' content='%IF{"($TAGMEPLUGIN_JQUIREMOVEALL='everybody') OR ($TAGMEPLUGIN_JQUIREMOVEALL='topicchange' AND '%BASEWEB%.%BASETOPIC%' allows 'CHANGE') OR ('%USERNAME%' ingroup 'AdminGroup')" then="all"}%' /> 
     14     <link rel='stylesheet' href='%PUBURLPATH%/%SYSTEMWEB%/TagMeAjaxHelper/jquery.tagmeui.css' type='text/css' media='all'/>"  
     15  requires="JQUERYPLUGIN::TEXTBOXLIST, JQUERYPLUGIN::AUTOCOMPLETE, JQUERYPLUGIN::SIMPLEMODAL, JQUERYPLUGIN::HOVERINTENT, JQUERYPLUGIN::QUERYOBJECT, JQUERYPLUGIN" 
     16}%%ADDTOZONE{"body" 
     17  tag="TAGMEPLUGIN::JQUI::JS"  
     18  text="<script type='text/javascript' src='%PUBURLPATH%/%SYSTEMWEB%/%TOPIC%/jquery.tagmeui.js'></script>"  
     19  requires="JQUERYPLUGIN::TEXTBOXLIST, JQUERYPLUGIN::AUTOCOMPLETE, JQUERYPLUGIN::SIMPLEMODAL, JQUERYPLUGIN::HOVERINTENT, JQUERYPLUGIN::QUERYOBJECT, JQUERYPLUGIN" 
     20}%<div id='tagmejqcontainer'> 
    2021<div id="tagmejqcloud" style="display:none"></div> 
    21 <span id="tagmejqtag" title="%MAKETEXT{"Click for tag cloud pop-up"}%"> 
     22<form id="tagmejqtaglistform" name="tagmeshow" method="post" action="%SCRIPTURLPATH{"viewauth"}%/%WEB%/%TOPIC%"> 
     23<span id="tagmejqtagstatus">&nbsp;</span> 
     24<span id="tagmejqtagbutton" title="%MAKETEXT{"Click for tag cloud pop-up"}%"> 
    2225%MAKETEXT{"Tags"}%&nbsp;</span> 
    23 <form name="tagmeshow" method="post" action="%SCRIPTURLPATH{"viewauth"}%/%WEB%/%TOPIC%"> 
    2426   <input type="text" name="add" id="tagmejqinputfield" title="%MAKETEXT{"Enter a tag name to apply to this topic"}%" size="15" value="%TAGME{ tpaction="showalltags" web="%BASEWEB%" topic="%BASETOPIC%"}%"/>  
    2527</form></div>%ENDSECTION{"jqui"}% 
     
    3032  else="%MAKETEXT{"[[[_1].WebHome][[_1]]] web" args="%URLPARAM{"tpweb"}%"}%" 
    3133}% 
    32 <form id="tagmeWebSelect" method="post" action="%SCRIPTURLPATH{"view"}%/%WEB%/%TOPIC%"> 
    33   <input type="checkbox" id="tagmeCheckboxJustThisWeb" name="tpweb"\ 
     34<br/> 
     35<form id="tagmejqWebSelect" method="post" action="%SCRIPTURLPATH{"view"}%/%WEB%/%TOPIC%"> 
     36  <input type="checkbox" id="tagmejqCheckboxJustThisWeb" name="tpweb"\ 
    3437    value="%URLPARAM{"tpweb"}%" %IF{"'%URLPARAM{"tpweb"}%'=''" then="checked='checked'"}%\ 
    3538        title="%MAKETEXT{"Show tags from all webs"}%"\ 
    3639  /> 
    3740  <label for="tpweb">%MAKETEXT{"all webs"}%</label> | 
    38   <input type="checkbox" id="tagmeCheckboxJustMe" name="tpuser" value="me" \ 
     41  <input type="checkbox" id="tagmejqCheckboxJustMe" name="tpuser" value="me" \ 
    3942    %IF{"'%URLPARAM{"tpuser"}%'='me'" then="checked='checked'"}%\ 
    4043        title="%MAKETEXT{"Show tags used by me"}%"\ 
     
    4649    title="%MAKETEXT{"Delete tags"}%">%MAKETEXT{"delete..."}%</a> 
    4750</form> 
    48 <div id="tagmeTagCloud" style="line-height:2em;"> 
     51<div id="tagmejqTagCloud" style="line-height:2em;"> 
    4952%TAGME{tpaction="showalltags" 
    5053  web="%URLPARAM{"tpweb"}%" 
     
    6063   * Set NOWYSIWYG = 1 
    6164--> 
    62  
  • trunk/TagMePlugin/data/System/TagMePlugin.txt

    r6270 r6568  
    6565All features work without having to re-load the topic: 
    6666   * Auto-complete tag names. Saves newly selected tags immediately 
    67    * If auto-complete fails to match the entered tag and the user submits 
    68      it, the tag is immediately created and applied 
     67   * The entered tag is created and added even if the tag did not 
     68     previously exist. 
    6969   * Access tag cloud in a modal dialogue at the click of a button. Check-box 
    7070     toggles are applied immediately (show cloud for just this web/all webs, 
     
    7474     from the originating web (avoids reliance on browser back button 
    7575     when exploring a web via tag cloud) 
     76   * Removing a tag may optionally clear the tag from the current topic 
     77     regardless of vote count (default for members of Main.AdminGroup).  
     78      * =Set TAGMEPLUGIN_JQUIREMOVEALL &#61; everybody= <br/> 
     79        will allow any logged-in user to remove a tag, or 
     80      * =Set TAGMEPLUGIN_JQUIREMOVEALL &#61; topicchange= <br/>to only give this 
     81        ability to those users who have CHANGE permission on the current 
     82        topic (everbody else will still be able to vote down tags as 
     83        usual)<br/> 
     84      * %ICON{"warning"}% 
     85        jqui uses an undocumented feature of TagMePlugin to access the 
     86        removeall feature, which does not appear to follow any access 
     87        controls internally. 
    7688 
    7789Include it into your WebTopBar (See WebTopBarExample) or any part of your skin that has horizontal space to spare, as follows: 
    7890<verbatim class="tml">%INCLUDE{"%SYSTEMWEB%.TagMeAjaxHelper" section="jqui"}%</verbatim> 
    7991 
    80 <div class="foswikiImage"><img src="%ATTACHURLPATH%/jquery.tagmeui.png" alt="Screenshot of experimental jQuery UI"  width="522" height="156" /></div> 
     92<div class="foswikiImage"><img src="%ATTACHURLPATH%/jquery.tagmeui.png" alt="Screenshot of experimental jQuery UI"  width="493" height="205" /></div> 
    8193 
    8294Dependencies: 
     
    199211          | =nostatus="on"= | Turn off status text shown when a tag is added or voted on | (show status text) | 
    200212 
    201         * =%<nop>TAGME{ tpaction="newtagandadd" ... }%= - create new tag and add tag to topic 
     213        * =%<nop>TAGME{ tpaction="newtagsandadd" ... }%= - create new tag and add tag to topic 
    202214          | *Parameter* | *Comment* | *Default* | 
    203215          | =tag="..."= | Name of tag. Accepts alphanumeric and underscore characters only (unless =NORMALIZE_TAG_INPUT= is set to 0 to allow any user input) | (required) | 
     
    374386|  Release: | %$RELEASE% | 
    375387|  Change History: | <!-- versions below in reverse order -->&nbsp; | 
    376 |  31 Jan 2010: | Foswiki:Main.PaulHarvey: Added an interactive user interface implemented with JQuery | 
     388|  31 Jan 2010: | Foswiki:Main.PaulHarvey: Added an interactive user interface implemented with JQuery; ship missing blog style tmpl files; fix docs/implementation of newtagsandadd | 
    377389|  11 Jun 2009: | Foswiki port, and moved settings out of this topic | 
    378390|  30 Aug 2008: | Foswiki:Main.ColasNahaboo: enhancements to the "blog" style: Bundles, count of known tags, option to delete tags | 
     
    414426__Related Topics:__ %SYSTEMWEB%.TagMeViewAllTags, %SYSTEMWEB%.TagMeViewMyTags, %SYSTEMWEB%.TagMeSearch, %SYSTEMWEB%.TagMeDebugViewTags, %SYSTEMWEB%.TagMeDebugSearch, %SYSTEMWEB%.TagMeAjaxHelper, [[%SYSTEMWEB%.Plugins][Plugins]], %SYSTEMWEB%.DeveloperDocumentationCategory, %SYSTEMWEB%.AdminDocumentationCategory, %SYSTEMWEB%.DefaultPreferences, %USERSWEB%.SitePreferences 
    415427 
    416 %META:FILEATTACHMENT{name="jquery.tagmeui.png" attr="h" comment="Screenshot of experimental jQuery UI" date="1264982400" path="jquery.tagmeui.png" size="16289" user="ProjectContributor" version="1.1"}% 
     428%META:FILEATTACHMENT{name="jquery.tagmeui.png" attr="h" comment="Screenshot of experimental jQuery UI" date="1264982400" path="jquery.tagmeui.png" size="27644" user="ProjectContributor" version="1.1"}% 
    417429%META:FILEATTACHMENT{name="tag_add.gif" attr="h" comment="Button: add tag" date="1141691885" path="tag_add.gif" size="857" user="ProjectContributor" version="1.1"}% 
    418430%META:FILEATTACHMENT{name="tag_remove.gif" attr="h" comment="Button: remove tag" date="1141697484" path="tag_remove.gif" size="862" user="ProjectContributor" version="1.1"}% 
  • trunk/TagMePlugin/lib/Foswiki/Plugins/TagMePlugin.pm

    r6196 r6568  
    3636 
    3737our $VERSION           = '$Rev$'; 
    38 our $RELEASE           = '01 Feb 2010'; 
     38our $RELEASE           = '28 Feb 2010'; 
    3939our $NO_PREFS_IN_TOPIC = 1; 
    4040our $SHORTDESCRIPTION = 
     
    11841184        $tag = _makeSafeTag($tag); 
    11851185        if ($tag) { 
    1186             $args = 'tag="' . $tag . '"'; 
     1186            $args = {tag => $tag}; 
    11871187            $text = _newTag($args); 
    11881188            $text = _addTag($args) unless $text =~ /foswikiAlert/; 
  • trunk/TagMePlugin/lib/Foswiki/Plugins/TagMePlugin/DEPENDENCIES

    r342 r6568  
     1Foswiki::Plugins::JQueryPlugin,>=6308,perl,optional 
     2Foswiki::Plugins::FilterPlugin,>=3491,perl,optional 
  • trunk/TagMePlugin/lib/Foswiki/Plugins/TagMePlugin/MANIFEST

    r6196 r6568  
     1data/System/TagMeAjaxHelper.txt 0644 
     2data/System/TagMeChangeRequests.txt 0644 
     3data/System/TagMeCreateNewTag.txt 0644 
    14data/System/TagMeDebugSearch.txt 0644 
    25data/System/TagMeDebugViewTags.txt 0644 
    3 data/System/TagMePlugin.txt 0644 
     6data/System/TagMeDeleteTag.txt 0644 
     7data/System/TagMeRenameTag.txt 0644 
    48data/System/TagMeSearch.txt 0644 
    59data/System/TagMeViewAllTags.txt 0644 
    610data/System/TagMeViewMyTags.txt 0644 
    7 data/System/TagMeCreateNewTag.txt 0644 
    8 data/System/TagMeRenameTag.txt 0644 
    9 data/System/TagMeDeleteTag.txt 0644 
    10 data/System/TagMeChangeRequests.txt 0644 
    11 lib/Foswiki/Plugins/TagMePlugin.pm 0444 
     11lib/Foswiki/Plugins/TagMePlugin.pm 0644 
     12pub/System/TagMeAjaxHelper/Makefile 0644 
     13pub/System/TagMeAjaxHelper/cloudspinner.gif 0644 From http://www.ajaxload.info 
     14pub/System/TagMeAjaxHelper/jquery.tagmeui.uncompressed.css 0644 
     15pub/System/TagMeAjaxHelper/jquery.tagmeui.css 0644 
     16pub/System/TagMeAjaxHelper/jquery.tagmeui.css.gz 0644 
     17pub/System/TagMeAjaxHelper/jquery.tagmeui.uncompressed.js 0644 
     18pub/System/TagMeAjaxHelper/jquery.tagmeui.js 0644 
     19pub/System/TagMeAjaxHelper/jquery.tagmeui.js.gz 0644 
     20pub/System/TagMeAjaxHelper/spinner.gif 0644 From http://www.ajaxload.info 
     21pub/System/TagMeAjaxHelper/tag.png 0644 From FamFamFamSilkIcons 
    1222pub/System/TagMePlugin/alltagcloud.gif 0644 
     23#pub/System/TagMePlugin/buttons_gradient.psd 0644 
     24pub/System/TagMePlugin/jquery.tagmeui.png 0644 
    1325pub/System/TagMePlugin/tag_add.gif 0644 
    1426pub/System/TagMePlugin/tag_addnew.gif 0644 
     
    1628pub/System/TagMePlugin/tagme.css 0644 
    1729pub/System/TagMePlugin/topictags.gif 0644 
    18 pub/System/TagMePlugin/jqui.png 0644 
     30pub/System/TagMePlugin/topictags_styleblog.gif 0644 
     31pub/System/TagMePlugin/topictags_styleblog_open.gif 0644 
    1932templates/view.tagme.tmpl 0644 
     33templates/view.tagme_styleblog.tmpl 0644 
    2034templates/view.tagme_styleblogbutton.tmpl 0644 
    21 templates/view.tagme_styleblog.tmpl 0644 
    2235templates/view.tagmejquiajax.tmpl 0644 
    23 pub/System/TagMeAjaxHelper/jqui.js 0644 
    24 pub/System/TagMeAjaxHelper/jqui.css 0644 
    25 pub/System/TagMeAjaxHelper/tag.png 0644 From FamFamFamSilkIcons 
    26 pub/System/TagMeAjaxHelper/spinner.gif 0644 From http://www.ajaxload.info 
    27 pub/System/TagMeAjaxHelper/cloudspinner.gif 0644 From http://www.ajaxload.info 
    28 data/System/TagMeAjaxHelper.txt 0644 
  • trunk/TagMePlugin/pub/System/TagMeAjaxHelper/jquery.tagmeui.uncompressed.css

    r6270 r6568  
    1 #tagmeTagCloud { 
     1#tagmejqTagCloud { 
    22  padding-top: 1em; 
    33} 
    4 #tagmejqtagstatus, #tagmejqtag { 
    5   float: left; 
     4.jqTextboxListContainer { 
     5  display: inline; 
    66} 
    7 #tagmejqtag { 
     7#tagmejqtagbutton { 
    88        text-decoration: underline; 
    99} 
    10 #tagmejqtag:hover { 
     10#tagmejqtagbutton:hover { 
    1111  color: #C0FFC0;  
    1212        background-color: #778899; 
     
    2323  background-image: url('cloudspinner.gif'); 
    2424} 
    25 #tagmejqtag { 
     25#tagmejqtagbutton { 
    2626        background-image: url('tag.png'); 
    2727        background-position: right; 
  • trunk/TagMePlugin/pub/System/TagMeAjaxHelper/jquery.tagmeui.uncompressed.js

    r6270 r6568  
    2323'use strict'; 
    2424jQuery(document).ready(function () { 
    25         (function ($) { 
    26                 $.fn.tagmeui = function (options) { 
     25    (function ($) { 
     26        $.fn.tagmeui = function (options) { 
    2727            /* TODO:  
    2828             * - Prevent multiple instantiations on DOM elements. 
     
    3030             *   jquery metadata plugin, and so opts can be extracted from DOM  
    3131             *   element. Eg: $('#myTagMeDivWithMetaData').tagmeui({extra: 'opts'}); 
    32              * - Modify TagMePlugin itself to support hard removal of tags, 
    33              *   instead of the bogus vote count subtraction currently  
    3432             * - There is no meaningful feedback to user if ajax calls fail  
    3533             *   (auth/permissions, etc) */ 
    36                         $(this).each(function () { 
    37                                 var tagmeui = new TagMeUI($(this), options); 
    38                                  
    39                                 tagmeui.initTagField(); 
    40                         }); 
    41                          
    42                         return this; 
    43                 }; 
    44                  
    45                 function TagMeUI(caller, options) { 
    46                         var that = this; 
    47                          
    48                         this.caller = caller; 
    49                         this.urlQuery = $.query; 
    50                         this.cloudQuery = this.urlQuery.copy(); 
    51                         this.cloudQuery.SET('skin', 'text'); 
    52                         this.cloudQuery.SET('contenttype', 'text/plain'); 
    53                         this.cloudQuery.SET('section', 'cloud'); 
    54                         /* Convert comma separated list of tags (from html meta) to array */ 
    55                         this.tags = foswiki.TagMePlugin.jquitags.split(','); 
    56                         if (!this.cloudQuery.get('qcallingweb')) { 
    57                                 this.cloudQuery.SET('qcallingweb', foswiki.web); 
    58                         } 
    59                         this.settings = { 
    60                                 cloudSpinner: '#tagmejqtag', 
    61                                 cloudContainer: '#tagmejqcloud', 
    62                                 cloudWeb: (function () { 
    63                                         var web = that.cloudQuery.get('qcallingweb'); 
    64                                          
    65                                         if (!web) { 
    66                                                 web = foswiki.web; 
    67                                         } 
    68                                          
    69                                         if (!that.cloudQuery.get('tpweb')) { 
    70                                                 that.cloudQuery.SET('tpweb', web); 
    71                                         } 
    72                                          
    73                                         return web; 
    74                                 }()), 
    75                                 cloudGetUrl: foswiki.scriptUrlPath + '/view/' +  
    76                                         foswiki.systemWebName + '/TagMeAjaxHelper', 
    77                                 cloudUiJustThisWeb: '#tagmeCheckboxJustThisWeb', 
    78                                 cloudUiJustMe: '#tagmeCheckboxJustMe', 
    79                                 cloudModalOpts: { 
    80                                         opacity: 7, 
    81                                         position: ['50px', null], 
    82                                         maxWidth: (document.width - 50), 
    83                                         persist: true, 
    84                                         onShow: function () { 
    85                                                 $('#simplemodal-overlay').click( 
    86  
    87                                                 function () { 
    88                                                         $.modal.close(); 
    89                                                 }); 
    90                                         } 
    91                                 }, 
    92                                 taglistSpinner: '#tagmejqtagstatus', 
    93                                 taglistContainer: '#tagmejqcontainer', 
    94                                 taglistInputField: '#tagmejqinputfield', 
    95                                 tagLinkUrl: foswiki.scriptUrlPath + '/view/' +  
    96                                         foswiki.systemWebName + '/TagMeSearch', 
     34            $(this).each(function () { 
     35                var tagmeui = new TagMeUI($(this), options); 
     36                 
     37                tagmeui.initTagField(); 
     38            }); 
     39             
     40            return this; 
     41        }; 
     42         
     43        function TagMeUI(caller, options) { 
     44            var that = this; 
     45             
     46            this.caller = caller; 
     47            this.urlQuery = $.query; 
     48            this.cloudQuery = this.urlQuery.copy(); 
     49            this.cloudQuery.SET('skin', 'text'); 
     50            this.cloudQuery.SET('contenttype', 'text/plain'); 
     51            this.cloudQuery.SET('section', 'cloud'); 
     52            /* Convert comma separated list of tags (from html meta) to array */ 
     53            this.tags = foswiki.TagMePlugin.jquitags.split(','); 
     54            if (!this.cloudQuery.get('qcallingweb')) { 
     55                this.cloudQuery.SET('qcallingweb', foswiki.web); 
     56            } 
     57            this.settings = { 
     58                cloudSpinner: '#tagmejqtagbutton', 
     59                cloudContainer: '#tagmejqcloud', 
     60                cloudWeb: (function () { 
     61                    var web = that.cloudQuery.get('qcallingweb'); 
     62                     
     63                    if (!web) { 
     64                        web = foswiki.web; 
     65                    } 
     66                     
     67                    if (!that.cloudQuery.get('tpweb')) { 
     68                        that.cloudQuery.SET('tpweb', web); 
     69                    } 
     70                     
     71                    return web; 
     72                }()), 
     73                cloudGetUrl: foswiki.scriptUrlPath + '/view/' +  
     74                    foswiki.systemWebName + '/TagMeAjaxHelper', 
     75                cloudUiJustThisWeb: '#tagmejqCheckboxJustThisWeb', 
     76                cloudUiJustMe: '#tagmejqCheckboxJustMe', 
     77                cloudModalOpts: { 
     78                    opacity: 7, 
     79                    position: ['70px', null], 
     80                    maxWidth: (document.width - 50), 
     81                    persist: true, 
     82                    onShow: function () { 
     83                        $('#simplemodal-overlay').click( 
     84 
     85                        function () { 
     86                            $.modal.close(); 
     87                        }); 
     88                    } 
     89                }, 
     90                taglistSpinner: '#tagmejqtagstatus', 
     91                taglistContainer: '#tagmejqcontainer', 
     92                taglistInputField: '#tagmejqinputfield', 
     93                tagLinkUrl: foswiki.scriptUrlPath + '/view/' +  
     94                    foswiki.systemWebName + '/TagMeSearch', 
    9795                tagLinkTitle: 'Other topics with this tag', 
    98                                 tagPostUrl: foswiki.scriptUrlPath + '/viewauth/' + foswiki.web +  
    99                                         '/' + foswiki.topic, 
    100                                 autocompleteUrl: foswiki.scriptUrlPath + '/view/' +  
    101                                         foswiki.systemWebName + '/TagMeAjaxHelper', 
    102                                 autocompleteOpts: { 
    103                                         extraParams: { 
    104                                                 section: 'tagquery', 
    105                                                 contenttype: 'text/plain', 
    106                                                 skin: 'text' 
    107                                         }, 
    108                                         autoFill: true, 
    109                                         matchCase: false, 
    110                                         multiple: false, 
    111                                         max: 0, 
    112                                         mustMatch: false 
    113                                 } 
    114                         }; 
    115                         $.extend(this.settings, options);     
    116                 } 
    117                  
    118                 /* Check that tagName exists inList, and if not, POST the action and execute 
    119                 ** the finishHandler(tagName) */ 
    120                 TagMeUI.prototype.actOnMissingTag = function (tagName, inList, action, finishHandler) { 
    121                         var didModify = false, 
    122                                 that = this; 
    123  
    124                         if ($.inArray(tagName, inList) === -1) { 
    125                                 $(this.settings.taglistSpinner).addClass('spinning'); 
    126                                 $.post(this.settings.postUrl, { 
    127                                         tpaction: action, 
    128                                         tptag: tagName, 
    129                                         contenttype: 'text/plain', 
    130                                         skin: 'tagmejquiajax' 
    131                                 }, 
    132  
    133                                 function (data) { 
    134                                         that.linkifyTagText(that.settings.taglistContainer); 
    135                                         $(that.settings.taglistSpinner).removeClass('spinning'); 
    136                                         finishHandler(tagName); 
    137                                 }); 
    138                                 didModify = true; 
    139                         } 
    140  
    141                         return didModify; 
    142                 }; 
    143  
    144                 /* By default, textboxlist doesn't handle hyperlinks in the list items. 
    145                 ** This would be much better implemented using some sort of callback, but 
    146                 ** textboxlist didn't seem to implement a suitable hook. */ 
    147                 TagMeUI.prototype.linkifyTagText = function (selector) { 
    148                         var that = this; 
    149                         $(selector + ' > form > div.jqTextboxListContainer > span:not(.linkified)').each( 
    150                                 function (index, tagSpan) { 
    151                                         var tagQuery = $.query.copy(), 
     96                tagPostUrl: foswiki.scriptUrlPath + '/viewauth/' + foswiki.web +  
     97                    '/' + foswiki.topic, 
     98                autocompleteUrl: foswiki.scriptUrlPath + '/view/' +  
     99                    foswiki.systemWebName + '/TagMeAjaxHelper', 
     100                autocompleteOpts: { 
     101                    extraParams: { 
     102                        section: 'tagquery', 
     103                        contenttype: 'text/plain', 
     104                        skin: 'text' 
     105                    }, 
     106                    autoFill: true, 
     107                    matchCase: false, 
     108                    multiple: false, 
     109                    max: 0, 
     110                    mustMatch: false 
     111                } 
     112            }; 
     113            $.extend(this.settings, options);     
     114        } 
     115         
     116        /* Check that tagName exists inList, and if not, POST the action and execute 
     117        ** the finishHandler(tagName) */ 
     118        TagMeUI.prototype.actOnMissingTag = function (tagName, inList, action, finishHandler) { 
     119            var didModify = false, 
     120                that = this; 
     121 
     122            if ($.inArray(tagName, inList) === -1) { 
     123                $(this.settings.taglistSpinner).addClass('spinning'); 
     124                $.post(this.settings.postUrl, { 
     125                    tpaction: action, 
     126                    tptag: tagName, 
     127                    contenttype: 'text/plain', 
     128                    skin: 'tagmejquiajax' 
     129                }, 
     130 
     131                function (data) { 
     132                    that.linkifyTagText(that.settings.taglistContainer); 
     133                    $(that.settings.taglistSpinner).removeClass('spinning'); 
     134                    finishHandler(tagName); 
     135                }); 
     136                didModify = true; 
     137            } 
     138 
     139            return didModify; 
     140        }; 
     141 
     142        /* By default, textboxlist doesn't handle hyperlinks in the list items. 
     143        ** This would be much better implemented using some sort of callback, but 
     144        ** textboxlist didn't seem to implement a suitable hook. */ 
     145        TagMeUI.prototype.linkifyTagText = function (selector) { 
     146            var that = this; 
     147            $(selector + ' > form > div.jqTextboxListContainer > span:not(.linkified)').each( 
     148                function (index, tagSpan) { 
     149                    var tagQuery = $.query.copy(), 
    152150                        theTag = $(tagSpan).text(); 
    153                                          
    154                                         /* There must be an easier way to remove the textNode from a span; but 
    155                                         ** I don't know it... yet. .text('') destroys child elements we want to 
    156                                         ** keep. */ 
    157                                         function removeTextNodes(element) { 
    158                                                 $(element).contents().filter( 
    159                                                         function () { 
    160                                                                 if (this.nodeType === Node.TEXT_NODE) { 
    161                                                                         this.textContent = ''; 
    162                                                                 } 
    163                                                         } 
    164                                                 ); 
    165  
    166                                                 return; 
    167                                         } 
    168  
    169                                         tagQuery.SET('tag', theTag); 
    170                                         tagQuery.SET('qcallingweb', foswiki.web); 
    171                                         removeTextNodes(tagSpan); 
    172                                         $(tagSpan).append('<a href="' + that.settings.tagLinkUrl +  
    173                                                 tagQuery.toString() + '" title="' +  
     151                     
     152                    /* There must be an easier way to remove the textNode from a span; but 
     153                    ** I don't know it... yet. .text('') destroys child elements we want to 
     154                    ** keep. */ 
     155                    function removeTextNodes(element) { 
     156                        $(element).contents().filter( 
     157                            function () { 
     158                                if (this.nodeType === Node.TEXT_NODE) { 
     159                                    this.textContent = ''; 
     160                                } 
     161                            } 
     162                        ); 
     163 
     164                        return; 
     165                    } 
     166 
     167                    tagQuery.SET('tag', theTag); 
     168                    tagQuery.SET('qcallingweb', foswiki.web); 
     169                    removeTextNodes(tagSpan); 
     170                    $(tagSpan).append('<a href="' + that.settings.tagLinkUrl +  
     171                        tagQuery.toString() + '" title="' +  
    174172                        that.settings.tagLinkTitle + '">' + theTag + '</a>'); 
    175                                         $(tagSpan).addClass('linkified'); 
    176                                 } 
    177                         ); 
    178  
    179                         return; 
    180                 }; 
     173                    $(tagSpan).addClass('linkified'); 
     174                } 
     175            ); 
     176 
     177            return; 
     178        }; 
    181179         
    182180        /* Populates a hidden div with the tag cloud and then displays it  
    183181         * with simplemodal. Some messiness to bind events on the cloud modal */ 
    184                 TagMeUI.prototype.loadCloud = function () { 
    185                         var that = this; 
    186                  
    187                         function initDialogue() { 
    188                                 function setQueryWithCheckbox(qkey, qvalue, checkbox, sense) { 
    189                                         if ($(checkbox).is(':checked') === sense) { 
    190                                                 that.cloudQuery.SET(qkey, qvalue); 
    191                                         } else { 
    192                                                 that.cloudQuery = that.cloudQuery.remove(qkey); 
    193                                         } 
    194                                 } 
    195                                  
     182        TagMeUI.prototype.loadCloud = function () { 
     183            var that = this; 
     184         
     185            function initDialogue() { 
     186                function setQueryWithCheckbox(qkey, qvalue, checkbox, sense) { 
     187                    if ($(checkbox).is(':checked') === sense) { 
     188                        that.cloudQuery.SET(qkey, qvalue); 
     189                    } else { 
     190                        that.cloudQuery = that.cloudQuery.remove(qkey); 
     191                    } 
     192                } 
     193                 
    196194                /* Would be nice if simplemodal had more sensible autosizing  
    197195                 * with content. */ 
    198                                 if ($('#simplemodal-container').width() > $(document).width() - 50) { 
    199                                         $('#simplemodal-container').width($(document).width() - 50); 
    200                                 } 
    201                                 $(that.settings.cloudUiJustThisWeb).click(function () { 
    202                                         setQueryWithCheckbox('tpweb', that.settings.cloudWeb,  
    203                                                 that.settings.cloudUiJustThisWeb, false); 
    204                                         that.loadCloud(); 
    205                                 }); 
    206                                 $(that.settings.cloudUiJustMe).click(function () { 
    207                                         setQueryWithCheckbox('tpuser', 'me',  
    208                                                 that.settings.cloudUiJustMe, true); 
    209                                         that.loadCloud(); 
    210                                 }); 
    211                         } 
    212  
    213                         $(this.settings.cloudSpinner).addClass('spinning'); 
    214                         $(this.settings.cloudContainer).load(this.settings.cloudGetUrl +  
    215                                 this.cloudQuery.toString(), function () { 
    216                                 $(that.settings.cloudSpinner).removeClass('spinning'); 
    217                                 $(that.settings.cloudContainer).modal(that.settings.cloudModalOpts); 
    218                                 initDialogue(); 
    219                         }); 
    220                 }; 
    221  
    222                 TagMeUI.prototype.initTagField = function () { 
    223                         /* MD's textboxlist jq plugin allows the user to easily work on tags */ 
    224                         var that = this; 
    225                          
    226                         $(this.settings.taglistInputField).textboxlist({ 
    227                                 onSelect: function (input) { 
    228                                         /* The logic here is a bit odd, started out anticipating a batch rather than 
    229                                         ** one-by-one POST to updated a modified selection of tags... */ 
    230                                         var selectedTags = input.currentValues,  
    231                                                 didAdd = false; 
    232  
    233                                         /* If there's a selected tag that isn't in the list of stored tags, 
    234                                         ** it needs to be added. */ 
    235                                         $.each(selectedTags, function (index, tagName) { 
    236                                                 if (that.actOnMissingTag(tagName, that.tags, 'add',  
    237                                                         function (tagName) { 
    238                                                                 that.tags.push(tagName); 
    239                                                         }) 
    240                                                 ) { 
    241                                                         didAdd = true; 
    242                                                 } 
    243                                         }); 
    244  
    245                                         if (!didAdd) { 
    246                                                 /* If there's a stored tag that isn't in the list of selected tags,  
    247                                                 ** it needs to be removed. */ 
    248                                                 $.each(that.tags, function (index, tagName) { 
    249                                                         if (!that.actOnMissingTag(tagName, selectedTags, 'remove',  
    250                                                                 function (tagName) { 
    251                                                                         that.tags.pop(tagName); 
    252                                                                 }) 
    253                                                         ) { 
    254                                                                 that.linkifyTagText(that.settings.taglistContainer); 
    255                                                         } 
    256                                                 }); 
    257                                         } 
    258                                 }, 
    259  
    260                                 autocomplete: this.settings.autocompleteUrl, 
    261                                 autocompleteOpts: this.settings.autocompleteOpts 
    262                         }); 
    263                          
    264                         this.linkifyTagText(this.settings.taglistContainer); 
    265  
    266                         $(this.settings.cloudSpinner).click(function () { 
    267                                 that.loadCloud(); 
    268                         }); 
    269                 }; 
    270                  
    271         }(jQuery)); 
     196                if ($('#simplemodal-container').width() > $(document).width() - 50) { 
     197                    $('#simplemodal-container').width($(document).width() - 50); 
     198                } 
     199                $(that.settings.cloudUiJustThisWeb).click(function () { 
     200                    setQueryWithCheckbox('tpweb', that.settings.cloudWeb,  
     201                        that.settings.cloudUiJustThisWeb, false); 
     202                    that.loadCloud(); 
     203                }); 
     204                $(that.settings.cloudUiJustMe).click(function () { 
     205                    setQueryWithCheckbox('tpuser', 'me',  
     206                        that.settings.cloudUiJustMe, true); 
     207                    that.loadCloud(); 
     208                }); 
     209            } 
     210 
     211            $(this.settings.cloudSpinner).addClass('spinning'); 
     212            $(this.settings.cloudContainer).load(this.settings.cloudGetUrl +  
     213                this.cloudQuery.toString(), function () { 
     214                $(that.settings.cloudSpinner).removeClass('spinning'); 
     215                $(that.settings.cloudContainer).modal(that.settings.cloudModalOpts); 
     216                initDialogue(); 
     217            }); 
     218        }; 
     219 
     220        TagMeUI.prototype.initTagField = function () { 
     221            /* MD's textboxlist jq plugin allows the user to easily work on tags */ 
     222            var that = this; 
     223             
     224            $(this.settings.taglistInputField).textboxlist({ 
     225                onSelect: function (input) { 
     226                    /* The logic here is a bit odd, started out anticipating a batch rather than 
     227                    ** one-by-one POST to updated a modified selection of tags... */ 
     228                    var selectedTags = input.currentValues,  
     229                        didAdd = false; 
     230 
     231                    /* If there's a selected tag that isn't in the list of stored tags, 
     232                    ** it needs to be added. */ 
     233                    $.each(selectedTags, function (index, tagName) { 
     234                        if (that.actOnMissingTag(tagName, that.tags, 'newtagsandadd',  
     235                            function (tagName) { 
     236                                that.tags.push(tagName); 
     237                            }) 
     238                        ) { 
     239                            didAdd = true; 
     240                        } 
     241                    }); 
     242 
     243                    if (!didAdd) { 
     244                        /* If there's a stored tag that isn't in the list of selected tags,  
     245                        ** it needs to be removed. */ 
     246                        $.each(that.tags, function (index, tagName) { 
     247                            var removeAction = 'remove'; 
     248                            if ( (typeof(foswiki.TagMePlugin) !== 'undefined') && (foswiki.TagMePlugin.remove === 'all') ) { 
     249                                removeAction = 'removeall'; 
     250                            } 
     251                            if (!that.actOnMissingTag(tagName, selectedTags, removeAction,  
     252                                function (tagName) { 
     253                                    that.tags.pop(tagName); 
     254                                }) 
     255                            ) { 
     256                                that.linkifyTagText(that.settings.taglistContainer); 
     257                            } 
     258                        }); 
     259                    } 
     260                     
     261                }, 
     262 
     263                autocomplete: this.settings.autocompleteUrl, 
     264                autocompleteOpts: this.settings.autocompleteOpts 
     265            }); 
     266            this.linkifyTagText(this.settings.taglistContainer); 
     267 
     268            $(this.settings.cloudSpinner).click(function () { 
     269                that.loadCloud(); 
     270            }); 
     271        }; 
     272         
     273    }(jQuery)); 
    272274     
    273275    /* Install tagmeui using default options */ 
Note: See TracChangeset for help on using the changeset viewer.