From: rmccabe@sourceware.org <rmccabe@sourceware.org>
To: cluster-devel.redhat.com
Subject: [Cluster-devel] conga/luci homebase/form-macros site/luci/Exte ...
Date: 30 Jun 2006 21:39:52 -0000 [thread overview]
Message-ID: <20060630213952.30847.qmail@sourceware.org> (raw)
CVSROOT: /cvs/cluster
Module name: conga
Changes by: rmccabe at sourceware.org 2006-06-30 21:39:51
Modified files:
luci/homebase : form-macros
luci/site/luci/Extensions: homebase_adapters.py
Log message:
fix blank page homebase bug
Patches:
http://sourceware.org/cgi-bin/cvsweb.cgi/conga/luci/homebase/form-macros.diff?cvsroot=cluster&r1=1.25&r2=1.26
http://sourceware.org/cgi-bin/cvsweb.cgi/conga/luci/site/luci/Extensions/homebase_adapters.py.diff?cvsroot=cluster&r1=1.9&r2=1.10
--- conga/luci/homebase/form-macros 2006/06/30 18:06:10 1.25
+++ conga/luci/homebase/form-macros 2006/06/30 21:39:51 1.26
@@ -1,7 +1,7 @@
<html>
<tal:comment replace="nothing">
- $Id: form-macros,v 1.25 2006/06/30 18:06:10 rmccabe Exp $
+ $Id: form-macros,v 1.26 2006/06/30 21:39:51 rmccabe Exp $
</tal:comment>
<head>
@@ -67,10 +67,12 @@
</select>
<input name="pagetype" type="hidden"
- tal:attributes="value request/pagetype | request/form/pagetype | nothing" />
+ tal:attributes="value request/form/pagetype | request/pagetype | nothing" />
<input name="absoluteURL" type="hidden"
tal:attributes="value python:data['children'][data['curIndex']]['absolute_url']" />
+ <input name="baseURL" type="hidden"
+ tal:attributes="value python:data['children'][data['curIndex']]['base_url']" />
<div class="hbSubmit" tal:condition="python:userList" id="hbSubmit">
<input class="hbSubmit" name="Submit" type="button" value="Submit" onClick="validateForm(document.adminform);" />
@@ -129,10 +131,12 @@
</table>
<input name="pagetype" type="hidden"
- tal:attributes="value request/pagetype | request/form/pagetype | nothing" />
+ tal:attributes="value request/form/pagetype | request/pagetype | nothing" />
<input name="absoluteURL" type="hidden"
tal:attributes="value python:data['children'][data['curIndex']]['absolute_url']" />
+ <input name="baseURL" type="hidden"
+ tal:attributes="value python:data['children'][data['curIndex']]['base_url']" />
<div class="hbSubmit" id="hbSubmit">
<input class="hbSubmit" name="Submit" type="button" value="Submit" onClick="validateForm(document.adminform);" />
@@ -180,13 +184,15 @@
<input name="absoluteURL" type="hidden"
tal:attributes="value python:data['children'][data['curIndex']]['absolute_url']" />
+ <input name="baseURL" type="hidden"
+ tal:attributes="value python:data['children'][data['curIndex']]['base_url']" />
<input name="pagetype" type="hidden"
- tal:attributes="value request/pagetype | request/form/pagetype | nothing" />
+ tal:attributes="value request/form/pagetype | request/pagetype | nothing" />
<span tal:condition="python:perms" tal:content="string:Select a User" /><br/>
- <select tal:omit-tag="python: not perms" class="homebase" name="userList" onChange="document.location = adminform.absoluteURL.value + '&user=' + adminform.userList.options[adminform.userList.selectedIndex].text">
+ <select tal:omit-tag="python: not perms" class="homebase" name="userList" onChange="document.location = adminform.baseURL.value + '&user=' + adminform.userList.options[adminform.userList.selectedIndex].text">
<tal:block tal:repeat="user python:perms">
<option class="homebase"
tal:content="python:user"
@@ -307,7 +313,7 @@
</h2>
<input type="hidden" name="pagetype"
- tal:attributes="value request/pagetype | request/form/pagetype | nothing" />
+ tal:attributes="value request/form/pagetype | request/pagetype | nothing" />
<h3 class="homebase" tal:condition="python: systems[0] and len(systems[0]) > 0">
Clusters
@@ -419,12 +425,14 @@
<h2 class="homebase">Add a Storage System</h2>
<input name="pagetype" type="hidden"
- tal:attributes="value request/pagetype | request/form/pagetype | nothing" />
+ tal:attributes="value request/form/pagetype | request/pagetype | nothing" />
<input name="numStorage" id="numStorage" type="hidden" value="1" />
<input name="absoluteURL" type="hidden"
tal:attributes="value python:data['children'][data['curIndex']]['absolute_url']" />
+ <input name="baseURL" type="hidden"
+ tal:attributes="value python:data['children'][data['curIndex']]['base_url']" />
<table id="systemsTable" class="systemsTable" border="0" cellspacing="0">
@@ -493,12 +501,14 @@
tal:define="global clusters python:here.getClusters()" />
<input name="pagetype" type="hidden"
- tal:attributes="value request/pagetype | request/form/pagetype | nothing" />
+ tal:attributes="value request/form/pagetype | request/pagetype | nothing" />
<input name="numStorage" id="numStorage" type="hidden" value="3" />
<input name="absoluteURL" type="hidden"
tal:attributes="value python:data['children'][data['curIndex']]['absolute_url']" />
+ <input name="baseURL" type="hidden"
+ tal:attributes="value python:data['children'][data['curIndex']]['base_url']" />
<h2 class="homebase">Add Cluster</h2>
@@ -566,6 +576,5 @@
</form>
</div>
-
</body>
</html>
--- conga/luci/site/luci/Extensions/homebase_adapters.py 2006/06/27 20:53:12 1.9
+++ conga/luci/site/luci/Extensions/homebase_adapters.py 2006/06/30 21:39:51 1.10
@@ -5,6 +5,7 @@
from AccessControl import getSecurityManager
from ZPublisher import HTTPRequest
import xml.dom
+import cgi
from ricci_defines import *
from ricci_communicator import RicciCommunicator
@@ -133,7 +134,7 @@
return (False, {'errors': [ 'Unable to add new user \"' + user + '\"'] })
messages.append('Added new user \"' + user + '\" successfully')
- return (True, {'messages': messages, 'user': user, 'dest': HOMEBASE_PERMS })
+ return (True, {'messages': messages, 'params': { 'user': user }})
def validateAddCluster(self, request):
errors = list()
@@ -237,11 +238,11 @@
try:
userId = request.form['userList']
except:
- return (False, {'errors': [ 'No user specified' ], 'user': userId })
+ return (False, {'errors': [ 'No user specified' ], 'params': { 'user': userId }})
user = self.portal_membership.getMemberById(userId)
if not user:
- return (False, {'errors': [ 'Invalid user specified' ], 'user': userId })
+ return (False, {'errors': [ 'Invalid user specified' ], 'params': { 'user': userId }})
userId = user.getUserId()
@@ -332,7 +333,7 @@
else:
returnCode = True
- return (returnCode, {'errors': errors, 'messages': messages, 'user': userId })
+ return (returnCode, {'errors': errors, 'messages': messages, 'params': {'user': userId }})
formValidators = [
validateAddUser,
@@ -364,12 +365,8 @@
return False
def homebaseControlPost(self, request):
- if 'absoluteURL' in request.form:
- url = request.form['absoluteURL']
- elif 'ACTUAL_URL' in request:
+ if 'ACTUAL_URL' in request:
url = request['ACTUAL_URL']
- elif 'URL' in request:
- url = request['URL']
else:
url = '.'
@@ -385,7 +382,10 @@
ret = validatorFn(self, request)
request.SESSION.set('checkRet', ret[1])
- return homebasePortal(self, request, url, pagetype, ret[1])
+ params = None
+ if 'params' in ret[1]:
+ params = ret[1]['params']
+ return homebasePortal(self, request, url, pagetype, params)
def homebaseControl(self, request):
try:
@@ -396,17 +396,14 @@
if request.REQUEST_METHOD == 'POST':
return homebaseControlPost(self, request)
- try:
- url = request.form['absoluteURL']
- except:
- try:
- url = request['URL']
- except:
- url = '.'
+ if 'ACTUAL_URL' in request:
+ url = request['ACTUAL_URL']
+ else:
+ url = '.'
- try:
- pagetype = request.form['pagetype']
- except:
+ if 'pagetype' in request:
+ pagetype = request['pagetype']
+ else:
pagetype = '0'
return homebasePortal(self, request, url, pagetype)
@@ -415,6 +412,7 @@
ret = {}
temp = list()
index = 0
+ cur = None
try:
if havePermAddUser(self):
@@ -425,6 +423,7 @@
if pagetype == HOMEBASE_ADD_USER:
addUser['currentItem'] = True
ret['curIndex'] = index
+ cur = addUser
else:
addUser['currentItem'] = False
index += 1
@@ -440,6 +439,7 @@
if pagetype == HOMEBASE_DEL_USER:
delUser['currentItem'] = True
ret['curIndex'] = index
+ cur = delUser
else:
delUser['currentItem'] = False
index += 1
@@ -457,6 +457,7 @@
addSystem['absolute_url'] = url + '?pagetype=' + HOMEBASE_ADD_SYSTEM
addSystem['Description'] = 'Add a System'
if pagetype == HOMEBASE_ADD_SYSTEM:
+ cur = addSystem
addSystem['currentItem'] = True
ret['curIndex'] = index
else:
@@ -474,6 +475,7 @@
if pagetype == HOMEBASE_ADD_CLUSTER:
addCluster['currentItem'] = True
ret['curIndex'] = index
+ cur = addCluster
else:
addCluster['currentItem'] = False
index += 1
@@ -493,6 +495,7 @@
if pagetype == HOMEBASE_DEL_SYSTEM:
remSystem['currentItem'] = True
ret['curIndex'] = index
+ cur = remSystem
else:
remSystem['currentItem'] = False
index += 1
@@ -509,10 +512,9 @@
userPerm['absolute_url'] = url + '?pagetype=' + HOMEBASE_PERMS
userPerm['Description'] = 'Set permissions for users'
if pagetype == HOMEBASE_PERMS:
- if params and 'user' in params:
- userPerm['curUser'] += params['user']
userPerm['currentItem'] = True
ret['curIndex'] = index
+ cur = userPerm
else:
userPerm['currentItem'] = False
index += 1
@@ -522,6 +524,11 @@
if not 'curIndex' in ret:
ret['curIndex'] = 0
+ if cur and 'absolute_url' in cur and params:
+ cur['baseurl'] = cur['absolute_url']
+ for i in params:
+ cur['absolute_url'] += '&' + cgi.escape(i) + '=' + cgi.escape(params[i])
+
ret['children'] = temp
return ret
@@ -591,7 +598,7 @@
def createSystem(self, host, passwd):
try:
exists = self.restrictedTraverse(PLONE_ROOT +'/systems/storage/' + host)
- return 'Storage system \"' + host + '\" is already managed.'
+ return 'Storage system \"' + host + '\" is already managed.'
except:
pass
@@ -617,7 +624,7 @@
try:
exists = self.restrictedTraverse(PLONE_ROOT +'/systems/storage/' + host)
- return 'Storage system \"' + host + '\" is already managed.'
+ return 'Storage system \"' + host + '\" is already managed.'
except:
pass
@@ -696,7 +703,7 @@
# host = rhost
cluster_info = rc.cluster_info()
- if len(cluster_info) > 0 and cluster_info[0] != '' and cluster_info[0] != cluster:
+ if len(cluster_info) > 0 and cluster_info[0] != '' and cluster_info[0] != cluster:
return 'The host \"' + host + '\" is already a member of the cluster \"' + cluster_info[0] + '\"'
try:
next reply other threads:[~2006-06-30 21:39 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2006-06-30 21:39 rmccabe [this message]
-- strict thread matches above, loose matches on Subject: below --
2006-07-31 17:46 [Cluster-devel] conga/luci homebase/form-macros site/luci/Exte rmccabe
2006-10-13 17:04 rmccabe
2006-10-31 19:09 rmccabe
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20060630213952.30847.qmail@sourceware.org \
--to=rmccabe@sourceware.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).