[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]

[Cluster-devel] conga/luci homebase/form-macros homebase/valid ...



CVSROOT:	/cvs/cluster
Module name:	conga
Changes by:	rmccabe sourceware org	2006-06-30 23:07:32

Modified files:
	luci/homebase  : form-macros validate_perm.js 
	luci/site/luci/Extensions: homebase_adapters.py 

Log message:
	fix case where you want to remove all permissions for a user, select the current user after performing an action on the permissions page

Patches:
http://sourceware.org/cgi-bin/cvsweb.cgi/conga/luci/homebase/form-macros.diff?cvsroot=cluster&r1=1.26&r2=1.27
http://sourceware.org/cgi-bin/cvsweb.cgi/conga/luci/homebase/validate_perm.js.diff?cvsroot=cluster&r1=1.1&r2=1.2
http://sourceware.org/cgi-bin/cvsweb.cgi/conga/luci/site/luci/Extensions/homebase_adapters.py.diff?cvsroot=cluster&r1=1.10&r2=1.11

--- conga/luci/homebase/form-macros	2006/06/30 21:39:51	1.26
+++ conga/luci/homebase/form-macros	2006/06/30 23:07:32	1.27
@@ -1,7 +1,7 @@
 <html>
 
 <tal:comment replace="nothing">
-	$Id: form-macros,v 1.26 2006/06/30 21:39:51 rmccabe Exp $
+	$Id: form-macros,v 1.27 2006/06/30 23:07:32 rmccabe Exp $
 </tal:comment>
 
 <head>
@@ -173,7 +173,7 @@
 					global num_clusters python:-1;
 					global num_systems python:-1;
 					global blankForm python:1;
-					global curUser request/form/user | request/user | python:here.getDefaultUser()" />
+					global curUser python:here.getDefaultUser(request)" />
 
 	<form name="adminform" method="post" action=""
 		tal:condition="python: curUser and perms and systems and ((systems[0] and len(systems[0]) > 0) or (systems[1] and len(systems[1]) > 0))">
--- conga/luci/homebase/validate_perm.js	2006/06/30 18:06:10	1.1
+++ conga/luci/homebase/validate_perm.js	2006/06/30 23:07:32	1.2
@@ -11,6 +11,7 @@
 	if (error_dialog(errors))
 		return (-1);
 
+	var username = form.userList.options[userIdx].value;
 	var selected_clusters = new Array();
 	var selected_storage = new Array();
 
@@ -33,13 +34,15 @@
 		selected_storage.push(element.value);
 	}
 
-	if (selected_clusters.length + selected_storage.length < 1)
-		return (0);
-
 	if (error_dialog(errors))
 		return (-1);
 
-	if (confirm('Modify permissions for ' + form.userList.options[userIdx].value + '?'))
+	if (selected_clusters.length + selected_storage.length < 1)
+		confirm_str = 'Remove all permissions for ' + username + '?';
+	else
+		confirm_str = 'Modify permissions for ' + username + '?';
+
+	if (confirm(confirm_str))
 		form.submit();
 	return (0);
 }
--- conga/luci/site/luci/Extensions/homebase_adapters.py	2006/06/30 21:39:51	1.10
+++ conga/luci/site/luci/Extensions/homebase_adapters.py	2006/06/30 23:07:32	1.11
@@ -381,10 +381,11 @@
 		return homebasePortal(self, request, '.', '0')
 
 	ret = validatorFn(self, request)
-	request.SESSION.set('checkRet', ret[1])
 	params = None
 	if 'params' in ret[1]:
 		params = ret[1]['params']
+
+	request.SESSION.set('checkRet', ret[1])
 	return homebasePortal(self, request, url, pagetype, params)
 
 def homebaseControl(self, request):
@@ -525,9 +526,11 @@
 		ret['curIndex'] = 0
 
 	if cur and 'absolute_url' in cur and params:
-		cur['baseurl'] = cur['absolute_url']
+		cur['base_url'] = cur['absolute_url']
 		for i in params:
 			cur['absolute_url'] += '&' + cgi.escape(i) + '=' + cgi.escape(params[i])
+	else:
+		cur['base_url'] = cur['absolute_url']
 
 	ret['children'] = temp
 	return ret
@@ -821,11 +824,19 @@
 
 	return errors
 
-def getDefaultUser(self):
+def getDefaultUser(self, request):
 	try:
-		return self.portal_membership.listMembers()[0].getUserName()
+		user = request.form['userList']
 	except:
-		return None
+		try:
+			user = request['user']
+		except:
+			try:
+				user = self.portal_membership.listMembers()[0].getUserName()
+			except:
+				user = None
+
+	return user
 
 def getUserPerms(self):
 	perms = {}


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]