Changeset 3602


Ignore:
Timestamp:
04/21/09 13:15:32 (3 years ago)
Author:
SvenDowideit
Message:

Item1484: port WebPermissionsPlugin - i'll start...

Location:
trunk/WebPermissionsPlugin
Files:
7 edited

Legend:

Unmodified
Added
Removed
  • trunk/WebPermissionsPlugin/data/System/WebPermissionsPlugin.txt

    r788 r3602  
    99   * Set N = <input type="checkbox" /> 
    1010--> 
    11 This plugin provides a centralised interface to TWiki permissions. 
     11This plugin provides a centralised interface to Foswiki permissions. 
    1212 
    1313Web permissions are presented as a matrix that has columns of webs and rows of users. For each web, you can control which users can view or change that web. All user webs, every registered user (except admin users), and every group (except admin groups) are shown in the matrix. 
     
    1717---++++ Web Permissions 
    1818This interface allows you to control  
    19 <table class="twikiTable"> 
     19<table class="foswikiTable"> 
    2020<tr><th width="50%"> Viewing </th><th width="50%"> Editing </th></tr> 
    2121<tr><td> 
    2222VIEW = %V% CHANGE = %C% 
    23 <table class="twikiTable"> 
     23<table class="foswikiTable"> 
    2424<tr><th></th><th>Albums</th><th>Singles</th><th>Reviews</th><th>Statistics</th></tr> 
    2525<tr><th>AnnieLennox<td>%V%%C%</td><td>%V%%C%</td><td>%V%%C%</td><td>%V%</td></tr> 
     
    3232</td><td> 
    3333VIEW = %V% CHANGE = %C% 
    34 <table class="twikiTable" border="1"> 
     34<table class="foswikiTable" border="1"> 
    3535<tr><th></th><th>Albums</th><th>Singles</th><th>Reviews</th><th>Statistics</th></tr> 
    3636<tr><th> AnnieLennox </th><td>%V%%Y% %C%%Y%</td><td>%V%%Y%%C%%Y%</td><td>%V%%Y%%C%%Y%</td><td>%V%%Y%%C%%N%</td></tr> 
     
    6464                                         <optgroup label="Users"><option>ProjectContributor</option><option>WikiGuest</option></optgroup></select> 
    6565                  </td><td align="center" width="100"> 
    66                                 <button type="button" style="width: 100%;" class="twikiSubmit" name="action_save" id="save">%LEFT% Remove</button> 
    67                                 <button type="button" style="width: 100%;" class="twikiSubmit" name="action_cancel" id="cancel">Add %RIGHT%</button></td> 
     66                                <button type="button" style="width: 100%;" class="foswikiSubmit" name="action_save" id="save">%LEFT% Remove</button> 
     67                                <button type="button" style="width: 100%;" class="foswikiSubmit" name="action_cancel" id="cancel">Add %RIGHT%</button></td> 
    6868                  <td width="40%"> 
    6969<h4><a name="Editors"></a> Editors </h4> 
     
    7878         <tr><td></td> 
    7979                  <td align="center" valign="center"> 
    80                                 <button type="button" style="height: 20px; width: 30%;" class="twikiSubmit" name="action_save" id="save">%DOWN%</button> 
    81                                 <button type="button" style="height: 20px; width: 30%;" class="twikiSubmit" name="action_cancel" id="cancel">%UP%</button> 
     80                                <button type="button" style="height: 20px; width: 30%;" class="foswikiSubmit" name="action_save" id="save">%DOWN%</button> 
     81                                <button type="button" style="height: 20px; width: 30%;" class="foswikiSubmit" name="action_cancel" id="cancel">%UP%</button> 
    8282                  </td> 
    8383         </tr> 
    8484         <tr><td align="center"> 
    85                                 <button type="button" style="width: 100%;"class="twikiSubmit" name="action_save" id="save">%LEFT% Remove</button> 
    86                                 <button type="button" style="width: 100%;" class="twikiSubmit" name="action_cancel" id="cancel">Add %RIGHT%</button></td> 
     85                                <button type="button" style="width: 100%;"class="foswikiSubmit" name="action_save" id="save">%LEFT% Remove</button> 
     86                                <button type="button" style="width: 100%;" class="foswikiSubmit" name="action_cancel" id="cancel">Add %RIGHT%</button></td> 
    8787                  <td><h4><a name="Viewers"></a> Viewers </h4> 
    8888                                <select size="5" name="topicviewers" multiple="multiple" style="width: 100%;"> 
     
    9595         </tr><tr> 
    9696                  <td colspan="3" align="right"> 
    97                                 <input class="twikiSubmit" name="topic_permissions_action" id="save" value="Save" > 
    98                                 <input class="twikiSubmit" name="topic_permissions_action" id="cancel" value="Cancel"> &nbsp; &nbsp; &nbsp; &nbsp; 
     97                                <input class="foswikiSubmit" name="topic_permissions_action" id="save" value="Save" > 
     98                                <input class="foswikiSubmit" name="topic_permissions_action" id="cancel" value="Cancel"> &nbsp; &nbsp; &nbsp; &nbsp; 
    9999                        </td> 
    100100         </tr> 
     
    102102</form> 
    103103<hr /> 
    104  
    105 *THIS PLUGIN REQUIRES TWiki-4.0.0 or later* 
    106104 
    107105---++ Syntax Rules 
     
    115113 
    116114---+++ =WEBPERMISSIONS= 
    117 The =WEBPERMISSIONS= TWiki variable accepts the following parameters: 
     115The =WEBPERMISSIONS= TML variable accepts the following parameters: 
    118116   * =repeatheads= - if set to a number, headings will be repeated every this number of rows. This is very useful when you have a lot of users and groups. 
    119117   * =webs= - a comma-separated list of webs to show. Default is to show all webs. 
     
    153151By default, the plugin only supports VIEW and CHANGE permissions on webs. You can change the set of access modes handled by the plugin by defining a configuration variable (in !LocalSite.cfg) to be a comma-separated list of access modes. For example, 
    154152<verbatim> 
    155 $TWiki::cfg{Plugins}{WebPermissionsPlugin}{modes} = 'VIEW,CHANGE,RENAME'; 
     153$Foswiki::cfg{Plugins}{WebPermissionsPlugin}{modes} = 'VIEW,CHANGE,RENAME'; 
    156154</verbatim> 
    157155See %SYSTEMWEB%.AccessControl for more information on what access modes can be used to control. 
     
    167165---++ Plugin Info 
    168166 
    169 Another great TWiki extension from the <a style="text-decoration:none" href="http://wikiring.com"><img src="%ATTACHURLPATH%/wikiringlogo20x20.png" alt="" /> *WikiRing* </a> - working together to improve your wiki experience! 
     167Another great Foswiki extension from the <a style="text-decoration:none" href="http://wikiring.com"><img src="%ATTACHURLPATH%/wikiringlogo20x20.png" alt="" /> *WikiRing* </a> - working together to improve your wiki experience! 
    170168 
    171169Many thanks to the following sponsors for supporting this work: 
     
    173171   * Further work supported by [[http://www.spanlink.com/][Spanlink Communications]] 
    174172 
    175 |  Plugin Author: | TWiki:Main.CrawfordCurrie & TWiki:Main.SvenDowideit, http://wikiring.com | 
     173|  Plugin Author: | Foswiki:Main.CrawfordCurrie & :Main.SvenDowideit, http://wikiring.com | 
    176174|  Copyright: | &copy; 2006, Evolved Media Network, Spanlink Communications and WikiRing | 
    177175|  License: | GPL ([[http://www.gnu.org/copyleft/gpl.html][GNU General Public License]]) | 
    178176|  Plugin Version: | %$VERSION% | 
    179177|  Change History: | | 
     178| March 2009 | ported to Foswiki | 
    180179|  4 Dec 2007 | TWikibug:Item4901 fixed templates TWikibug:Item5072 added users parameter to select a subset of users/groups in the web permissions interface | 
    181180|  8 Sep 2007 | Updated for TWiki-4.2.0 | 
     
    185184|  8877 | TWikibug:Item1701 - first release | 
    186185|  Dependencies: | %$DEPENDENCIES% | 
    187 |  Demo Url: | http://demo.wikiring.com/twiki/bin/view/Demo/TopicPermissionsDemo | 
    188186|  Plugin Home: | http://foswiki.org/Extensions/%TOPIC% | 
    189187|  Feedback: | http://foswiki.org/Extensions/%TOPIC%Dev | 
  • trunk/WebPermissionsPlugin/lib/Foswiki/Plugins/WebPermissionsPlugin.pm

    r3601 r3602  
    1717# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. 
    1818# 
    19 # For licensing info read LICENSE file in the TWiki root. 
     19# For licensing info read LICENSE file in the Foswiki root. 
    2020# 
    2121# Author: Crawford Currie http://c-dot.co.uk 
  • trunk/WebPermissionsPlugin/lib/Foswiki/Plugins/WebPermissionsPlugin/Core.pm

    r3601 r3602  
    1717# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. 
    1818# 
    19 # For licensing info read LICENSE file in the TWiki root. 
     19# For licensing info read LICENSE file in the Foswiki root. 
    2020# 
    2121# Author: Crawford Currie http://c-dot.co.uk 
     22# Author: Sven Dowideit http://fosiki.com 
    2223# Author: Eugen Mayer http://impressimpressive-media.de 
    2324# 
     
    3132# BUGO: because WEBPERMISSIONS is using the same view to change and display, 
    3233# updated ACL's do not apply to this view. 
    33 # TWiki has already loaded the permissions that it is using, and some 
     34# Foswiki has already loaded the permissions that it is using, and some 
    3435# random plugins have already processed things based on the ACLs prior to 
    3536# the users change. THIS IS HORRIGIBILE 
     
    108109    } 
    109110 
    110     $tab .= CGI::start_table( { border => 1, class => 'twikiTable' } ); 
     111    $tab .= CGI::start_table( { border => 1, class => 'foswikiTable' } ); 
    111112 
    112113    my $repeat_heads = $params->{repeatheads} || 0; 
     
    143144 
    144145    if( $editing ) { 
    145         $tab .= CGI::submit( -name => 'web_permissions_action', -value => 'Save',  -class => 'twikiSubmit'); 
    146         $tab .= CGI::submit( -name => 'web_permissions_action', -value => 'Cancel',  -class => 'twikiSubmit' ); 
     146        $tab .= CGI::submit( -name => 'web_permissions_action', -value => 'Save',  -class => 'foswikiSubmit'); 
     147        $tab .= CGI::submit( -name => 'web_permissions_action', -value => 'Cancel',  -class => 'foswikiSubmit' ); 
    147148    } else { 
    148         $tab .= CGI::submit( -name => 'web_permissions_action', -value => 'Edit',  -class => 'twikiSubmit' ); 
     149        $tab .= CGI::submit( -name => 'web_permissions_action', -value => 'Edit',  -class => 'foswikiSubmit' ); 
    149150    } 
    150151    my $page = CGI::start_form( 
     
    390391              @{$session->{users}->getAllGroups()}; 
    391392        } else { 
    392             # This code assumes we are using TWiki topic based Group mapping 
     393            # This code assumes we are using Foswiki topic based Group mapping 
    393394            $session->{search}->searchWeb( 
    394395                _callback     => sub { 
  • trunk/WebPermissionsPlugin/lib/Foswiki/Plugins/WebPermissionsPlugin/DEPENDENCIES

    r388 r3602  
    1 TWiki::Plugins,>=1.10,perl,TWiki-4 
    21 
    32 
  • trunk/WebPermissionsPlugin/pub/System/WebPermissionsPlugin/WebPermissionsPlugin.js

    r1050 r3602  
    1717*/ 
    1818 
    19 //create the TWiki namespace if needed 
    20 if ( typeof( TWiki ) == "undefined" ) { 
    21     TWiki = {}; 
     19//create the Fowsiki namespace if needed 
     20if ( typeof( ) == "undefined" ) { 
     21    = {}; 
    2222} 
    2323 
    2424/**********************************************************************************/ 
    25 //create the TWiki.WebPermissionsPlugin namespace if needed 
    26 if ( typeof( TWiki.WebPermissionsPlugin ) == "undefined" ) { 
    27     TWiki.WebPermissionsPlugin = {}; 
     25//create the Foswiki.WebPermissionsPlugin namespace if needed 
     26if ( typeof( Foswiki.WebPermissionsPlugin ) == "undefined" ) { 
     27    Foswiki.WebPermissionsPlugin = {}; 
    2828} 
    2929 
    3030 
    3131//moveSelectionTo(event, 'topiceditors', 'allusersandgroups') 
    32 TWiki.WebPermissionsPlugin.moveSelectionTo = function(event, fromSelectName, toSelectName) { 
     32Foswiki.WebPermissionsPlugin.moveSelectionTo = function(event, fromSelectName, toSelectName) { 
    3333    var buttonTarget = (event.target) ? event.target : event.srcElement; 
    3434 
     
    5555} 
    5656 
    57 //the namespace makes TWiki decide its a web.topic to be rendered as a url 
     57//the namespace makes Foswiki decide its a web.topic to be rendered as a url 
    5858prepareForSave = function(event) { 
    59     return TWiki.WebPermissionsPlugin.prepareForSave(event); 
     59    return Foswiki.WebPermissionsPlugin.prepareForSave(event); 
    6060} 
    6161 
    6262//return false cancels the submit 
    63 TWiki.WebPermissionsPlugin.prepareForSave = function(event) { 
     63Foswiki.WebPermissionsPlugin.prepareForSave = function(event) { 
    6464//, 'topiceditors', 'topicviewers', 'disallowedusers' 
    6565    var buttonTarget = (event.target) ? event.target : event.srcElement; 
     
    6868    var selectObj = buttonTarget.form.elements.namedItem('topiceditors'); 
    6969    for (i=0; i< selectObj.options.length; i++) { 
    70         if (selectObj.options[i].value == TWiki.UsersWikiName) { 
     70        if (selectObj.options[i].value == Foswiki.UsersWikiName) { 
    7171            userInEditorsList = true; 
    7272        } 
  • trunk/WebPermissionsPlugin/templates/webpermissionsplugin.topichtml.tmpl

    r1340 r3602  
    1717        </td> 
    1818        <td align="center" width="100px"> 
    19             <button type="button" style="width:100%;" onclick="TWiki.WebPermissionsPlugin.moveSelectionTo(event, 'topiceditors', 'disallowedusers');" class="twikiSubmit" > 
     19            <button type="button" style="width:100%;" onclick="Foswiki.WebPermissionsPlugin.moveSelectionTo(event, 'topiceditors', 'disallowedusers');" class="foswikiSubmit" > 
    2020                <IMG src="%PUBURL%/%SYSTEMWEB%/%PLUGINNAME%/leftarrow.png" alt="<-"> Remove 
    2121            </button> 
    22             <button type="button"  style="width: 100%;" onclick="TWiki.WebPermissionsPlugin.moveSelectionTo(event, 'disallowedusers', 'topiceditors');" class="twikiSubmit" > 
     22            <button type="button"  style="width: 100%;" onclick="Foswiki.WebPermissionsPlugin.moveSelectionTo(event, 'disallowedusers', 'topiceditors');" class="foswikiSubmit" > 
    2323                Add <IMG src="%PUBURL%/%SYSTEMWEB%/%PLUGINNAME%/rightarrow.png" alt="->"> 
    2424            </button> 
     
    4040        </td> 
    4141        <td align="center" valign="center"> 
    42             <button type="button" style="height: 20px;width:30%;" onclick="TWiki.WebPermissionsPlugin.moveSelectionTo(event, 'topiceditors', 'topicviewers');" class="twikiSubmit" > 
     42            <button type="button" style="height: 20px;width:30%;" onclick="Foswiki.WebPermissionsPlugin.moveSelectionTo(event, 'topiceditors', 'topicviewers');" class="foswikiSubmit" > 
    4343                <IMG src="%PUBURL%/%SYSTEMWEB%/%PLUGINNAME%/downarrow.png" alt="V"> 
    4444            </button> 
    45             <button type="button" style="height: 20px;width:30%;" onclick="TWiki.WebPermissionsPlugin.moveSelectionTo(event, 'topicviewers', 'topiceditors');" class="twikiSubmit" > 
     45            <button type="button" style="height: 20px;width:30%;" onclick="Foswiki.WebPermissionsPlugin.moveSelectionTo(event, 'topicviewers', 'topiceditors');" class="foswikiSubmit" > 
    4646                <IMG src="%PUBURL%/%SYSTEMWEB%/%PLUGINNAME%/uparrow.png" alt="^"> 
    4747            </button> 
     
    5050    <tr> 
    5151        <td align="center"> 
    52             <button type="button" style="width: 100%;" onclick="TWiki.WebPermissionsPlugin.moveSelectionTo(event, 'topicviewers', 'disallowedusers');" class="twikiSubmit" > 
     52            <button type="button" style="width: 100%;" onclick="Foswiki.WebPermissionsPlugin.moveSelectionTo(event, 'topicviewers', 'disallowedusers');" class="foswikiSubmit" > 
    5353                <IMG src="%PUBURL%/%SYSTEMWEB%/%PLUGINNAME%/leftarrow.png" alt="<-"> Remove 
    5454            </button> 
    55             <button type="button" style="width: 100%;" onclick="TWiki.WebPermissionsPlugin.moveSelectionTo(event, 'disallowedusers', 'topicviewers');" class="twikiSubmit" > 
     55            <button type="button" style="width: 100%;" onclick="Foswiki.WebPermissionsPlugin.moveSelectionTo(event, 'disallowedusers', 'topicviewers');" class="foswikiSubmit" > 
    5656                Add <IMG src="%PUBURL%/%SYSTEMWEB%/%PLUGINNAME%/rightarrow.png" alt="->"> 
    5757            </button> 
     
    7373    <tr> 
    7474        <td align="right" colspan="3"> 
    75             <input type="submit" %DISABLESAVE% class="twikiSubmit%DISABLESAVE%" name="topic_permissions_action" id="save" value='Save' onclick="return prepareForSave(event);" /> 
    76             <input type="submit" class="twikiSubmit" name="topic_permissions_action" id="cancel" value='Cancel' accesskey='c' /> &nbsp; &nbsp; &nbsp; &nbsp; 
     75            <input type="submit" %DISABLESAVE% class="foswikiSubmit%DISABLESAVE%" name="topic_permissions_action" id="save" value='Save' onclick="return prepareForSave(event);" /> 
     76            <input type="submit" class="foswikiSubmit" name="topic_permissions_action" id="cancel" value='Cancel' accesskey='c' /> &nbsp; &nbsp; &nbsp; &nbsp; 
    7777         </td> 
    7878    </tr> 
  • trunk/WebPermissionsPlugin/templates/webpermissionsplugin.topicjavascript.tmpl

    r1340 r3602  
    22<script language="JavaScript" type="text/javascript" src="%PLUGINPUBURL%/WebPermissionsPlugin.js"></script> 
    33<script language="JavaScript" type="text/javascript"> 
    4 TWiki.UsersWikiName = '%USERINFO{format="$wikiname"}%'; 
     4Foswiki.UsersWikiName = '%USERINFO{format="$wikiname"}%'; 
    55</script> 
Note: See TracChangeset for help on using the changeset viewer.