######## display the stable interface
Index: /media/work/XWiki-Work/Eclipse_Workspace_Tests/xwiki-web-1.1/standard/src/main/webapp/skins/albatross/adminspacerights.vm
===================================================================
--- /media/work/XWiki-Work/Eclipse_Workspace_Tests/xwiki-web-1.1/standard/src/main/webapp/skins/albatross/adminspacerights.vm (revision 5758)
+++ /media/work/XWiki-Work/Eclipse_Workspace_Tests/xwiki-web-1.1/standard/src/main/webapp/skins/albatross/adminspacerights.vm (working copy)
@@ -17,6 +17,44 @@
#end
### url to get the users and groups for the ajax-table
#set($url = "?xpage=getusersandgroups")
+
+#set($saveUrl = $doc.getURL("view", "xpage=saverights&clsname=${clsname}&fullname=XWiki.XWikiGuest&uorg=users"))
+
+## get the rights for XWikiGuest
+#set($r1 = 0) #set($r2 = 0) #set($r3 = 0) #set($r4 = 0) #set($r5 = 0) #set($r6 = 0) #set($r7 = 0)
+
+#set($guest = "XWiki.XWikiGuest")
+#foreach($obj in $doc.getObjects($clsname)) ## XWiki.XWikiGlobalRights or XWiki.XWikiRights
+ #set($pers = "$!obj.getProperty('users').getValue()")
+
+ #if($pers != "" && $pers.matches("^(.*,)?${guest}(,.*)?$"))
+ #if($obj.getProperty('allow').getValue() == 1)
+ #set($allows = "$!obj.getProperty('levels').getValue()")
+ #else
+ #set($denys = "$!obj.getProperty('levels').getValue()")
+ #end
+
+ #if($allows && $allows.indexOf("view") > -1) #set($r1 = 1) #end
+ #if($allows && $allows.indexOf("comment") > -1) #set($r2 = 1) #end
+ #if($allows && $allows.indexOf("edit") > -1) #set($r3 = 1) #end
+ #if($allows && $allows.indexOf("delete") > -1) #set($r4 = 1) #end
+ #if($allows && $allows.indexOf("register") > -1) #set($r5 = 1) #end
+ #if($allows && $allows.indexOf("admin") > -1) #set($r6 = 1) #end
+ #if($allows && $allows.indexOf("programming") > -1) #set($r7 = 1) #end
+
+ #if($denys && $denys.indexOf("view") > -1) #set($r1 = 2) #end
+ #if($denys && $denys.indexOf("comment") > -1) #set($r2 = 2) #end
+ #if($denys && $denys.indexOf("edit") > -1) #set($r3 = 2) #end
+ #if($denys && $denys.indexOf("delete") > -1) #set($r4 = 2) #end
+ #if($denys && $denys.indexOf("register") > -1) #set($r5 = 2) #end
+ #if($denys && $denys.indexOf("admin") > -1) #set($r6 = 2) #end
+ #if($denys && $denys.indexOf("programming") > -1) #set($r7 = 2) #end
+
+ #if($denys && $denys == "") #set($r1 = 0) #set($r2 = 0) #set($r3 = 0) #set($r4 = 0) #set($r5 = 0) #set($r6 = 0) #set($r7 = 0) #end
+ #if($allows && $allows == "") #set($r1 = 0) #set($r2 = 0) #set($r3 = 0) #set($r4 = 0) #set($r5 = 0) #set($r6 = 0) #set($r7 = 0) #end
+ #end
+#end
+
Loading...
@@ -31,7 +69,35 @@
#end
-
+
+
+
+
+
+
+ $msg.get("rightsmanager.unregisteredusers")
+
+
+
+
+
+
+ #if($hasPrgr) #end
+
+
+
+
@@ -43,17 +109,16 @@
######### display the stable interface
Index: /media/work/XWiki-Work/Eclipse_Workspace_Tests/xwiki-web-1.1/standard/src/main/webapp/skins/albatross/editrights.vm
===================================================================
--- /media/work/XWiki-Work/Eclipse_Workspace_Tests/xwiki-web-1.1/standard/src/main/webapp/skins/albatross/editrights.vm (revision 5758)
+++ /media/work/XWiki-Work/Eclipse_Workspace_Tests/xwiki-web-1.1/standard/src/main/webapp/skins/albatross/editrights.vm (working copy)
@@ -7,20 +7,61 @@
########## display the new interface
#if($interface == "new")
#if($doc.fullName == "XWiki.XWikiPreferences")
-#if($request.editor == "globalrights")
-#set($clsname = "XWiki.XWikiGlobalRights")
-#else
-#set($clsname = "XWiki.XWikiRights")
-#end
+ #if($request.editor == "globalrights")
+ #set($clsname = "XWiki.XWikiGlobalRights")
+ #else
+ #set($clsname = "XWiki.XWikiRights")
+ #end
#elseif($doc.name == "WebPreferences")
-#if($request.editor == "spacerights")
-#set($clsname = "XWiki.XWikiGlobalRights")
+ #if($request.editor == "spacerights")
+ #set($clsname = "XWiki.XWikiGlobalRights")
+ #else
+ #set($clsname = "XWiki.XWikiRights")
+ #end
#else
-#set($clsname = "XWiki.XWikiRights")
+ #set($clsname = "XWiki.XWikiRights")
#end
-#end
+
### url to get the users and groups to display in the ajax-based table
#set($url = "?xpage=getusersandgroups")
+
+#set($saveUrl = $doc.getURL("view", "xpage=saverights&clsname=${clsname}&fullname=XWiki.XWikiGuest&uorg=users"))
+
+## get the rights for XWikiGuest
+#set($r1 = 0) #set($r2 = 0) #set($r3 = 0) #set($r4 = 0) #set($r5 = 0) #set($r6 = 0) #set($r7 = 0)
+
+#set($guest = "XWiki.XWikiGuest")
+#foreach($obj in $doc.getObjects($clsname)) ## XWiki.XWikiGlobalRights or XWiki.XWikiRights
+ #set($pers = "$!obj.getProperty('users').getValue()")
+
+ #if($pers != "" && $pers.matches("^(.*,)?${guest}(,.*)?$"))
+ #if($obj.getProperty('allow').getValue() == 1)
+ #set($allows = "$!obj.getProperty('levels').getValue()")
+ #else
+ #set($denys = "$!obj.getProperty('levels').getValue()")
+ #end
+
+ #if($allows && $allows.indexOf("view") > -1) #set($r1 = 1) #end
+ #if($allows && $allows.indexOf("comment") > -1) #set($r2 = 1) #end
+ #if($allows && $allows.indexOf("edit") > -1) #set($r3 = 1) #end
+ #if($allows && $allows.indexOf("delete") > -1) #set($r4 = 1) #end
+ #if($allows && $allows.indexOf("register") > -1) #set($r5 = 1) #end
+ #if($allows && $allows.indexOf("admin") > -1) #set($r6 = 1) #end
+ #if($allows && $allows.indexOf("programming") > -1) #set($r7 = 1) #end
+
+ #if($denys && $denys.indexOf("view") > -1) #set($r1 = 2) #end
+ #if($denys && $denys.indexOf("comment") > -1) #set($r2 = 2) #end
+ #if($denys && $denys.indexOf("edit") > -1) #set($r3 = 2) #end
+ #if($denys && $denys.indexOf("delete") > -1) #set($r4 = 2) #end
+ #if($denys && $denys.indexOf("register") > -1) #set($r5 = 2) #end
+ #if($denys && $denys.indexOf("admin") > -1) #set($r6 = 2) #end
+ #if($denys && $denys.indexOf("programming") > -1) #set($r7 = 2) #end
+
+ #if($denys && $denys == "") #set($r1 = 0) #set($r2 = 0) #set($r3 = 0) #set($r4 = 0) #set($r5 = 0) #set($r6 = 0) #set($r7 = 0) #end
+ #if($allows && $allows == "") #set($r1 = 0) #set($r2 = 0) #set($r3 = 0) #set($r4 = 0) #set($r5 = 0) #set($r6 = 0) #set($r7 = 0) #end
+ #end
+#end
+
Loading...
@@ -25,11 +66,36 @@
+
+
+
+
+
+
+ $msg.get("rightsmanager.unregisteredusers")
+
+
+
+
+ #if($hasPrgr) #end
+
+
+
+
- Groups
- Users
+ $msg.get("Groups")
+ $msg.get("Users")
@@ -36,15 +102,14 @@
############ display the old interface
Index: /media/work/XWiki-Work/Eclipse_Workspace_Tests/xwiki-web-1.1/standard/src/main/webapp/skins/albatross/getusersandgroups.vm
===================================================================
--- /media/work/XWiki-Work/Eclipse_Workspace_Tests/xwiki-web-1.1/standard/src/main/webapp/skins/albatross/getusersandgroups.vm (revision 5758)
+++ /media/work/XWiki-Work/Eclipse_Workspace_Tests/xwiki-web-1.1/standard/src/main/webapp/skins/albatross/getusersandgroups.vm (working copy)
@@ -97,19 +97,18 @@
#if($wikiname != "xwiki" || $wikiname == $context.database) #set($wikiname = "local") #end
#set($allows = "")
#set($denys = "")
- #if( $velocityCount > 1 ) , #end
+ #if( $velocityCount > 1 ) , #end
## get the rights for that user or group
- #foreach($obj in $doc.getObjects($clsname)) ## XWiki.XWikiGlobalRights or XWiki.XWikiRights
- #set($pers = $obj.getProperty($uorg).getValue())
- #set($fullnamecomma = $user.fullName + ",")
- #if($pers.matches("^(.*,)?${user.fullName}(,.*)?$"))
- #if($obj.getProperty('allow').getValue() == 1)
- #set($allows = $obj.getProperty('levels').getValue())
- #else
- #set($denys = $obj.getProperty('levels').getValue())
+ #foreach($obj in $doc.getObjects($clsname)) ## $clsname = XWiki.XWikiGlobalRights or XWiki.XWikiRights
+ #set($pers = "$!obj.getProperty($uorg).getValue()")
+ #if(($pers != "") && ($pers.matches("^(.*,)?${user.fullName}(,.*)?$")) )
+ #if($obj.getProperty('allow').getValue() == 1)
+ #set($allows = "$!obj.getProperty('levels').getValue()")
+ #else
+ #set($denys = "$!obj.getProperty('levels').getValue()")
+ #end
#end
- #end
- #end
+ #end ## second foreach
{"username" : "$user.name",
"fullname" : "$user.fullName",
"wikiname" : "$wikiname",
@@ -114,8 +113,8 @@
"fullname" : "$user.fullName",
"wikiname" : "$wikiname",
"userurl" : "$xwiki.getURL($user.fullName)",
- "allows" : "$!allows",
- "denys" : "$!denys"
+ "allows" : "$allows",
+ "denys" : "$denys"
}
#end
]}
Index: /media/work/XWiki-Work/Eclipse_Workspace_Tests/xwiki-web-1.1/standard/src/main/webapp/skins/albatross/saverights.vm
===================================================================
--- /media/work/XWiki-Work/Eclipse_Workspace_Tests/xwiki-web-1.1/standard/src/main/webapp/skins/albatross/saverights.vm (revision 5758)
+++ /media/work/XWiki-Work/Eclipse_Workspace_Tests/xwiki-web-1.1/standard/src/main/webapp/skins/albatross/saverights.vm (working copy)
@@ -1,9 +1,9 @@
#set($fullname = $request.get("fullname"))
#set($uorg = $request.get("uorg"))
-#set($allows = "$!request.get('allows')")
-#set($denys = "$!request.get('denys')")
+#set($right = $request.get("right")) ## right name: edit, view, comment...
+#set($action = $request.get("action")) ## can be allow, deny or clear(delete) that right
#set($clsname = $request.get("clsname"))
-## found the user or group
+## found allow or deny for the user or group
#set($founda = false)
#set($foundd = false)
@@ -8,26 +8,102 @@
#set($foundd = false)
#foreach($obj in $doc.getObjects($clsname)) ## XWiki.XWikiGlobalRights or XWiki.XWikiRights
- #set($pers = $obj.getProperty($uorg).getValue())
- ## TO DO: regular expression
- #if($pers.matches("${fullname},?"))
- #if($obj.getProperty('allow').getValue() == 1)
- #set($founda = true) ## found allows -> set the new levels
- #if($allows != "") $obj.set('levels', $allows)
- #else $doc.removeObject($obj) #end
- #else
- #set($foundd = true)## found denys -> set the new levels
- #if($denys != "") $obj.set('levels', $denys)
- #else $doc.removeObject($obj) #end
- #end
- #elseif($pers.matches("^(.*,)?${fullname}(,.*)?$"))
+ #set($pers = "$!obj.getProperty($uorg).getValue()")
+
+ #if($pers != "" && $pers.matches("${fullname},?")) ## found the rule containing that person
+ #set($levels = "$obj.getProperty('levels').getValue()") ## get the levels
+
+ #if($obj.getProperty('allow').getValue() == 1) ## found allow rule
+ ### if action = allow, add the right it it does not exist;
+ ### if action = deny, delete the right from allow rule, if exists
+ ## if action = clear, remove the right from allow levels
+ #set($founda = true)
+
+ #if($action == "allow")
+
+ #if($levels.indexOf($right) == -1) ## the right is not in the allow list, add it
+ #set($right = "," + $right)
+ #set($levels = $levels + $right)
+
+ person: $pers rule: allow action: allow levels: $levels
+
+ $obj.set('levels', $levels) ## set the new levels
+ #end
+
+ #else ## deny or clean action
+
+ #set($i = $levels.indexOf($right))
+
+ #if($i > -1) ## the right was found in the allow levels, remove it
+ #if($i == 0)
+ #set($levels = $levels.replaceAll("${right}(,|$)", ""))
+ #else
+ #set($levels = $levels.replaceAll(",${right}", ""))
+ #end
+ #end
+
+ person: $pers rule: allow action: deny/clean levels: $levels
+
+ #if($levels != "")
+ $obj.set('levels', $levels) ## set the new levels
+ #else ## no other righs in the levels, remove the rule completely
+ $doc.removeObject($obj)
+ #end
+
+ #end
+
+ #else ## found deny rule
+
+ #set($foundd = true)
+
+ ### if action = allow, delete the right from the deny levels, if exists;
+ ### if action = deny, add the right to deny levels, if not exists
+ ## if action = clear, remove the right from deny levels
+
+ #if($action == "deny")
+
+ #if($levels.indexOf($right) == -1) ## the right is not in the allow list, add it
+ #set($right = "," + $right)
+ #set($levels = $levels + $right)
+
+ pers: $pers rule: deny action:deny levels: $levels
+
+ $obj.set('levels', $levels) ## set the new levels
+ #end
+
+ #else ## allow or clean action
+
+ #set($i = $levels.indexOf($right))
+ #if($i > -1) ## the right was found in the allow levels, remove it
+ #if($i == 0)
+ #set($levels = $levels.replaceAll("${right}(,|$)", ""))
+ #else
+ #set($levels = $levels.replaceAll(",${right}", ""))
+ #end
+ #end
+
+ pers: $pers rule: deny action: allow/clean levels: $levels
+
+ #if($levels != "")
+ $obj.set('levels', $levels) ## set the new levels
+ #else ## no other righs in the levels, remove the rule completely
+ $doc.removeObject($obj)
+ #end
+
+ #end
+
+ #end ## end get property
+
+ #elseif($pers.matches("^(.*,)?${fullname}(,.*)?$")) ## could not find the first pattern
+
#set($pers = $pers.replaceAll("^${fullname}(,|$)", ""))
#set($pers = $pers.replaceAll("(^|,)${fullname}(,|$)", "$2"))
$obj.set($uorg, $pers)
+
#end
-#end
+#end ## end foreach
-#if(($founda == false) && ($allows != ""))
+#if(($founda == false) && ($action == "allow"))
## could not find the rule -> create one
#set($obj = $doc.newObject($clsname))
## set the new rules
@@ -32,10 +108,13 @@
#set($obj = $doc.newObject($clsname))
## set the new rules
$obj.set($uorg, $fullname)
-$obj.set('levels', $allows)
+$obj.set('levels', $right)
+
+pers: $pers rule: allow action: allow levels: $right
+
$obj.set('allow', '1')
#end
-#if(($foundd == false) && ($denys != ""))
+#if(($foundd == false) && ($action == "deny"))
## could not find the rule -> create one
#set($obj = $doc.newObject($clsname))
## set the new rules
@@ -40,7 +119,10 @@
#set($obj = $doc.newObject($clsname))
## set the new rules
$obj.set($uorg, $fullname)
-$obj.set('levels', $denys)
+$obj.set('levels', $right)
+
+pers: $pers rule: deny action: deny levels: $right
+
$obj.set('allow', '0')
#end
#set($discard = $doc.save())
\ No newline at end of file
Index: /media/work/XWiki-Work/Eclipse_Workspace_Tests/xwiki-web-1.1/standard/src/main/webapp/skins/albatross/usersandgroups.css
===================================================================
--- /media/work/XWiki-Work/Eclipse_Workspace_Tests/xwiki-web-1.1/standard/src/main/webapp/skins/albatross/usersandgroups.css (revision 5758)
+++ /media/work/XWiki-Work/Eclipse_Workspace_Tests/xwiki-web-1.1/standard/src/main/webapp/skins/albatross/usersandgroups.css (working copy)
@@ -84,6 +84,23 @@
left: 8px;
}
+#specialusersandgroups {
+ border-collapse: collapse;
+ border: 1px solid #d4dee8;
+ width: 100%;
+}
+
+#specialusersandgroups td {
+ border: 1px solid #d4dee8;
+}
+
+.suorg {
+ color: #1f66ab;
+ font-weight: bold;
+ font-size: 13px;
+ padding-left: 10px;
+}
+
#display1 td {
padding-left: 11px;
}
@@ -127,3 +144,10 @@
font-size: 12px;
font-weight: bold;
}
+
+#XWikiGuestSpecial {
+ background-color: #ACBFD2;
+ font-size: 12px;
+ font-weight: bold;
+ color: #000;
+}
\ No newline at end of file
Index: /media/work/XWiki-Work/Eclipse_Workspace_Tests/xwiki-web-1.1/standard/src/main/webapp/skins/albatross/usersandgroups.js
===================================================================
--- /media/work/XWiki-Work/Eclipse_Workspace_Tests/xwiki-web-1.1/standard/src/main/webapp/skins/albatross/usersandgroups.js (revision 5758)
+++ /media/work/XWiki-Work/Eclipse_Workspace_Tests/xwiki-web-1.1/standard/src/main/webapp/skins/albatross/usersandgroups.js (working copy)
@@ -9,7 +9,7 @@
this.domNode = $( domNode );
this.scroller = new ASSScroller( this, scrollNode );
if(hasFilters)
- this.filter = new ASSFilter( this, filterNode );
+ this.filter = new ASSFilter( this, filterNode );
this.hasFilters = hasFilters;
this.filters = "";
this.getHandler = getHandler;
@@ -414,10 +414,11 @@
MSCheckbox.prototype = {
- initialize: function( domNode, childId, defaultState )
+ initialize: function( domNode, right, saveUrl, defaultState )
{
this.domNode = $(domNode);
- this.childId = childId;
+ this.right = right;
+ this.saveUrl = saveUrl;
this.defaultState = defaultState;
this.state = defaultState;
this.states = [0,1,2]; // 0 = none; 1 = allow, 2 == deny
@@ -424,8 +425,6 @@
this.nrstates = this.states.length;
this.images = ["$xwiki.getSkinFile("icons/rights-manager/none.png")","$xwiki.getSkinFile("icons/rights-manager/allow.png")","$xwiki.getSkinFile("icons/rights-manager/deny1.png")"];
this.labels = ['','',''];
- // buttons with actions upon checkboxes
- this.buttons = new Array();
this.draw(this.state);
this.attachEvents();
@@ -433,16 +432,16 @@
draw: function(state)
{
- //remove image
+ //remove image
if(this.domNode.childNodes.length > 0)
- this.domNode.removeChild( this.domNode.firstChild );
+ this.domNode.removeChild( this.domNode.firstChild );
//remove label
if(this.domNode.childNodes.length > 0)
- this.domNode.removeChild( this.domNode.lastChild );
+ this.domNode.removeChild( this.domNode.lastChild );
//add new image
var img = document.createElement('img');
img.src = this.images[ state ];
- img.id = this.childId;
+
this.domNode.appendChild( img );
//add label
if( this.labels[ state ] != '')
@@ -468,22 +467,29 @@
{
return function()
{
- pivot.next();
- for(var i = 0; i < pivot.buttons.length; i++)
- pivot.buttons[i].notifyChange();
- }
- },
+ //put $msg.get() messages!!!!!
+
+ var nxtst = (pivot.state + 1) % pivot.nrstates;
+ if(pivot.right == "admin" && nxtst == 2)
+ confirm("You are about to deny the admin right for this user. Continue?");
+ else if(pivot.right == "admin" && nxtst == 0)
+ confirm("You are about to clear the admin right for this user. Continue?");
+ pivot.next(); // go to next state
+
+ //compute the complete url
+ var action = "";
+ if(pivot.state == 0) action = "clear";
+ else if(pivot.state == 1) action = "allow";
+ else action = "deny";
- equalize: function()
- {
- this.defaultState = this.state;
- this.notifyButtons();
- },
-
- notifyButtons : function()
- {
- for(var i = 0; i < this.buttons.length; i++)
- this.buttons[i].notifyChange();
+ var url = pivot.saveUrl + "&action=" + action + "&right=" + pivot.right;
+
+ new Ajax.Request(url,
+ {
+ method: 'get',
+ onSuccess: function() {}
+ });
+ }
},
attachEvents: function()
@@ -489,61 +495,6 @@
attachEvents: function()
{
Event.observe( this.domNode, 'click', this.createClickHandler(this));
- },
-
- attachButton : function(b)
- {
- this.buttons.push(b);
- }
-}
-
-////////////////////////////////////////////////////////////////////////
-/* class that represents an 'action' button */
-MButton = Class.create();
-
-MButton.prototype = {
- initialize : function() {
- //
- },
-
- init: function(domNode, type, table, indx, checkboxes)
- {
- this.domNode = $(domNode);
- this.type = type;
- this.table = table;
- this.indx = indx;
- this.checkboxes = checkboxes;
-
- this.draw();
- this.attachCheckboxes();
- this.attachHandler();
- },
-
- attachHandler : function()
- {
- Event.observe(this.domNode.firstChild, 'click', this.createHandler(this));
- },
-
- attachCheckboxes : function()
- {
- for(var i = 0; i < this.checkboxes.length; i++)
- this.checkboxes[i].attachButton(this);
- },
-
- checkEqual : function()
- {
- for(var i = 0; i < this.checkboxes.length; i++)
- if(this.checkboxes[i].state != this.checkboxes[i].defaultState)
- return false;
- return true;
- },
-
- checkClear : function()
- {
- for(var i = 0; i < this.checkboxes.length; i++)
- if(this.checkboxes[i].state != 0)
- return false;
- return true;
}
}
@@ -548,193 +499,6 @@
}
-MSaveButton = Class.create();
-
-MSaveButton.prototype = Object.extend(new MButton(), {
-
- initialize : function(domNode, table, indx, checkboxes)
- {
- this.ready = false;
- this.init(domNode, 'save', table, indx, checkboxes);
- },
-
- draw : function()
- {
- var img = document.createElement('img');
- img.src = '$xwiki.getSkinFile("icons/rights-manager/saveg.png")';
- img.alt = "";
- img.className = "icon-manage";
- this.domNode.appendChild(img);
- },
-
- createHandler : function(pivot)
- {
- return function()
- {
- if(pivot.ready)
- {
- var allows = "";
- var denys = "";
- var j = 0, k = 0;
- for(var i = 0; i < pivot.checkboxes.length; i++)
- {
- if(pivot.checkboxes[i].state == 1)
- {
- if(j > 0) allows += ",";
- allows += pivot.checkboxes[i].childId.substring(0, pivot.checkboxes[i].childId.indexOf('_'));
- j++;
- }
-
- else if(pivot.checkboxes[i].state == 2)
- {
- if(k > 0) denys += ",";
- denys += pivot.checkboxes[i].childId.substring(0, pivot.checkboxes[i].childId.indexOf('_'));
- k++;
- }
- }
-
- var url = "?xpage=saverights";
- url += "&fullname=" + pivot.table.fetchedRows[pivot.indx].fullname + "&clsname=" + pivot.table.json.clsname + "&uorg=" + pivot.table.json.uorg + "&allows=" + allows + "&denys=" + denys;
-
- new Ajax.Request(url,
- {
- method: 'get',
- onSuccess: function()
- {
- pivot.table.fetchedRows[pivot.indx].allows = allows;
- pivot.table.fetchedRows[pivot.indx].denys = denys;
- for(var i = 0; i < pivot.checkboxes.length; i++)
- pivot.checkboxes[i].equalize();
- }
- });
- }
- }
- },
-
- notifyChange : function()
- {
- if(! this.checkEqual())
- {
- this.ready = true;
- this.domNode.firstChild.src = '$xwiki.getSkinFile("icons/rights-manager/save.png")';
- //icon-manage-enabled
- }
- else
- {
- this.ready = false;
- this.domNode.firstChild.src = '$xwiki.getSkinFile("icons/rights-manager/saveg.png")';
- //icon-manage-disabled
- }
- }
-});
-
-
-MRevertButton = Class.create();
-
-MRevertButton.prototype = Object.extend(new MButton(), {
-
- initialize : function(domNode, table, indx, checkboxes)
- {
- this.ready = false;
- this.init(domNode, 'revert', table, indx, checkboxes);
- },
-
- draw : function()
- {
- var img = document.createElement('img');
- img.src = '$xwiki.getSkinFile("icons/rights-manager/revertg.png")';
- img.alt = "";
- img.className = "icon-manage";
- this.domNode.appendChild(img);
- },
-
- createHandler : function(pivot)
- {
- return function()
- {
- if(pivot.ready)
- {
- for(var i = 0; i < pivot.checkboxes.length; i++)
- {
- pivot.checkboxes[i].state = pivot.checkboxes[i].defaultState;
- pivot.checkboxes[i].draw(pivot.checkboxes[i].state);
- pivot.checkboxes[i].notifyButtons();
- }
- }
- }
- },
-
- notifyChange : function()
- {
- if(! this.checkEqual())
- {
- this.ready = true;
- this.domNode.firstChild.src = '$xwiki.getSkinFile("icons/rights-manager/revert.png")';
- //icon-manage-enabled
- }
- else
- {
- this.ready = false;
- this.domNode.firstChild.src = '$xwiki.getSkinFile("icons/rights-manager/revertg.png")';
- //icon-manage-disabled
- }
- }
-});
-
-
-MClearButton = Class.create();
-
-MClearButton.prototype = Object.extend(new MButton(), {
-
- initialize : function(domNode, table, indx, checkboxes)
- {
- this.ready = true;
- this.init(domNode, 'clear', table, indx, checkboxes);
- this.notifyChange(); // verify if all checkboxes are clear to disable the clear button
- },
-
- draw : function()
- {
- var img = document.createElement('img');
- img.src = '$xwiki.getSkinFile("icons/rights-manager/clear.png")';
- img.alt = "";
- img.className = "icon-manage";
- this.domNode.appendChild(img);
- },
-
- createHandler : function(pivot)
- {
- return function()
- {
- if(pivot.ready)
- {
- for(var i = 0; i < pivot.checkboxes.length; i++)
- {
- pivot.checkboxes[i].state = 0;
- pivot.checkboxes[i].draw(pivot.checkboxes[i].state);
- }
- pivot.checkboxes[pivot.checkboxes.length - 1].notifyButtons();
- }
- }
- },
-
- notifyChange : function()
- {
- if(this.checkClear())
- {
- this.ready = false;
- this.domNode.firstChild.src = '$xwiki.getSkinFile("icons/rights-manager/clearg.png")';
- //icon-manage-disabled
- }
- else
- {
- this.ready = true;
- this.domNode.firstChild.src = '$xwiki.getSkinFile("icons/rights-manager/clear.png")';
- //icon-manage-disabled
- }
- }
-});
-
/** user list element creator **/
function displayUsers( row, i, table)
@@ -899,6 +663,8 @@
var uorg = table.json.uorg;
var allows = row.allows;
var denys = row.denys;
+ var saveUrl = "?xpage=saverights&clsname=" + table.json.clsname + "&fullname=" + row.fullname + "&uorg=" + uorg;
+
var objs = new Array(); //array with checkboxes objects
var tr = document.createElement('tr');
@@ -923,9 +689,8 @@
var r = 0;
if(allows.indexOf("view") >= 0) r = 1;
else if(denys.indexOf("view") >= 0) r = 2;
- var chbx1 = new MSCheckbox(view, "view_"+i, r);
+ var chbx1 = new MSCheckbox(view, "view", saveUrl, r);
tr.appendChild(view);
- objs.push(chbx1);
var comment = document.createElement('td');
comment.className = "rights";
@@ -932,9 +697,8 @@
r = 0;
if(allows.indexOf("comment") >= 0) r = 1;
else if(denys.indexOf("comment") >= 0) r = 2;
- var chbx2 = new MSCheckbox(comment, "comment_"+i, r);
+ var chbx2 = new MSCheckbox(comment, "comment", saveUrl, r);
tr.appendChild(comment);
- objs.push(chbx2);
var edit = document.createElement('td');
edit.className = "rights";
@@ -941,9 +705,8 @@
r = 0;
if(allows.indexOf("edit") >= 0) r = 1;
else if(denys.indexOf("edit") >= 0) r = 2;
- var chbx3 = new MSCheckbox(edit, "edit_"+i, r);
+ var chbx3 = new MSCheckbox(edit, "edit", saveUrl, r);
tr.appendChild(edit);
- objs.push(chbx3);
var del = document.createElement('td');
del.className = "rights";
@@ -950,9 +713,8 @@
r = 0;
if(allows.indexOf("delete") >= 0) r = 1;
else if(denys.indexOf("delete") >= 0) r = 2;
- var chbx4 = new MSCheckbox(del, "delete_"+i, r);
+ var chbx4 = new MSCheckbox(del, "delete", saveUrl, r);
tr.appendChild(del);
- objs.push(chbx4);
if(table.json.reg == true)
{
@@ -961,9 +723,8 @@
r = 0;
if(allows.indexOf("register") >= 0) r = 1;
else if(denys.indexOf("register") >= 0) r = 2;
- var chbx5 = new MSCheckbox(register, "register_"+i, r);
+ var chbx5 = new MSCheckbox(register, "register", saveUrl, r);
tr.appendChild(register);
- objs.push(chbx5);
}
if(table.json.admin == true)
@@ -973,9 +734,8 @@
r = 0;
if(allows.indexOf("admin") >= 0) r = 1;
else if(denys.indexOf("admin") >= 0) r = 2;
- var chbx6 = new MSCheckbox(admin, "admin_"+i, r);
+ var chbx6 = new MSCheckbox(admin, "admin", saveUrl, r);
tr.appendChild(admin);
- objs.push(chbx6);
}
if(table.json.progr == true)
@@ -985,29 +745,10 @@
r = 0;
if(allows.indexOf("programming") >= 0) r = 1;
else if(denys.indexOf("programming") >= 0) r = 2;
- var chbx7 = new MSCheckbox(progr, "programming_"+i, r);
+ var chbx7 = new MSCheckbox(progr, "programming", saveUrl, r);
tr.appendChild(progr);
- objs.push(chbx7);
}
- var manage = document.createElement('td');
- manage.className = "manage";
-
- var spansave = document.createElement('span');
- var spanrevert = document.createElement('span');
- var spanclear = document.createElement('span');
-
- manage.appendChild(spansave);
- manage.appendChild(spanrevert);
- manage.appendChild(spanclear);
-
- //save rights
- var save = new MSaveButton(spansave, table, i, objs);
- var revert = new MRevertButton(spanrevert, table, i, objs);
- var clear = new MClearButton(spanclear, table, i, objs);
-
- tr.appendChild(manage);
-
return tr;
}