[Zapp-cvs-commit] ZApp/skins/zapp_generic getClipboard.py,NONE,1.1 getApplication.py,1.1,1.2 getCurr
Brought to you by:
sspickle
|
From: <ssp...@us...> - 2003-08-12 13:49:37
|
Update of /cvsroot/zapp/ZApp/skins/zapp_generic
In directory sc8-pr-cvs1:/tmp/cvs-serv3404/skins/zapp_generic
Modified Files:
getApplication.py getCurrentStack.py getTopNamespace.py
manage_edit_stack_levels.py manage_session_stack.pt
setCurrentStack.py
Added Files:
getClipboard.py
Removed Files:
setupRequest.py
Log Message:
fixed bug in removeObjectRelations if there are none..
--- NEW FILE: getClipboard.py ---
## Script (Python) "getClipboard"
##bind container=container
##bind context=context
##bind namespace=
##bind script=script
##bind subpath=traverse_subpath
##parameters=
##title=Get the Clipboard
##
sessionID = context.browser_id_manager.getBrowserId(create=1)
system_app = context.getApplication()
userSessions = system_app.getUserSessions(browserID=sessionID, create=1)
userSession = userSessions and userSessions[0]
if userSession:
SESSION = context.REQUEST.SESSION
clipboard = SESSION.get('ZAPP_CLIPBOARD',{})
return clipboard
else:
raise RuntimeError, "Can setup session!"
Index: getApplication.py
===================================================================
RCS file: /cvsroot/zapp/ZApp/skins/zapp_generic/getApplication.py,v
retrieving revision 1.1
retrieving revision 1.2
diff -C2 -d -r1.1 -r1.2
*** getApplication.py 25 Jun 2003 11:45:53 -0000 1.1
--- getApplication.py 12 Aug 2003 13:32:13 -0000 1.2
***************
*** 9,12 ****
##
! return getattr(context, getattr(context, 'hec_app_id', 'HTheatre'))
--- 9,12 ----
##
! return getattr(context, getattr(context, 'zapp_app_id'))
Index: getCurrentStack.py
===================================================================
RCS file: /cvsroot/zapp/ZApp/skins/zapp_generic/getCurrentStack.py,v
retrieving revision 1.1
retrieving revision 1.2
diff -C2 -d -r1.1 -r1.2
*** getCurrentStack.py 25 Jun 2003 11:45:53 -0000 1.1
--- getCurrentStack.py 12 Aug 2003 13:32:13 -0000 1.2
***************
*** 11,20 ****
sessionID = context.browser_id_manager.getBrowserId(create=1)
system_app = context.getApplication()
! SESSION = context.REQUEST.SESSION
! currStack = SESSION.get('HEC_STACK',[{}])
! if not len(currStack) :
! currStack = [{}]
!
! return currStack
!
--- 11,30 ----
sessionID = context.browser_id_manager.getBrowserId(create=1)
system_app = context.getApplication()
+ userSessions = system_app.getUserSessions(browserID=sessionID, create=1)
+ userSession = userSessions and userSessions[0]
! if userSession:
! SESSION = context.REQUEST.SESSION
! currStack = SESSION.get('ZAPP_STACK',[{}])
! if not len(currStack) :
! currStack = [{}]
!
! topLevel = currStack[-1]
! if (same_type(topLevel,{})):
! topLevel.update({'app_session_id':userSession.id})
! else:
! raise RuntimeError, "Ack.. top level is " + `topLevel`
!
! return currStack
! else:
! raise RuntimeError, "Can setup session!"
Index: getTopNamespace.py
===================================================================
RCS file: /cvsroot/zapp/ZApp/skins/zapp_generic/getTopNamespace.py,v
retrieving revision 1.1
retrieving revision 1.2
diff -C2 -d -r1.1 -r1.2
*** getTopNamespace.py 25 Jun 2003 11:45:53 -0000 1.1
--- getTopNamespace.py 12 Aug 2003 13:32:13 -0000 1.2
***************
*** 15,19 ****
result = currStack[-1]
! result.update({'hec_v_stackSize':len(currStack)})
return result
--- 15,19 ----
result = currStack[-1]
! result.update({'zapp_v_stackSize':len(currStack)})
return result
Index: manage_edit_stack_levels.py
===================================================================
RCS file: /cvsroot/zapp/ZApp/skins/zapp_generic/manage_edit_stack_levels.py,v
retrieving revision 1.1
retrieving revision 1.2
diff -C2 -d -r1.1 -r1.2
*** manage_edit_stack_levels.py 25 Jun 2003 11:45:53 -0000 1.1
--- manage_edit_stack_levels.py 12 Aug 2003 13:32:13 -0000 1.2
***************
*** 1,3 ****
! ## Script (Python) "getCurrentStack"
##bind container=container
##bind context=context
--- 1,3 ----
! ## Script (Python) "manage_edit_stack_levels"
##bind container=container
##bind context=context
***************
*** 5,20 ****
##bind script=script
##bind subpath=traverse_subpath
! ##parameters=sessionLevels=None, submit=None, indexes=None
##title=Get the Current Stack
##
if submit == 'EDIT':
indexes = []
! if submit in ['EDIT','DELETE']:
newStack = []
for i in range(len(sessionLevels)):
level = sessionLevels[i]
if level.index not in indexes:
--- 5,34 ----
##bind script=script
##bind subpath=traverse_subpath
! ##parameters=sessionLevels=None, submit=None, indexes=None, newKey='', newType='', newValue=''
##title=Get the Current Stack
##
+ for lev in sessionLevels:
+ #print lev
+ #print "XXXXXXXX"
+ pass
+ import string
+ if indexes is None:
+ indexes = []
+
if submit == 'EDIT':
indexes = []
! #print "indexes:", indexes
! #print "submit:", submit
!
! oldLevels = context.getCurrentStack()
!
! if submit in ['EDIT','DELETE','ADD']:
newStack = []
for i in range(len(sessionLevels)):
level = sessionLevels[i]
+ oldLevel = oldLevels[i]
if level.index not in indexes:
***************
*** 22,32 ****
newStack.append(newLevel)
! for k in level.keys():
! newLevel[k] = level[k]
context.setCurrentStack(newStack)
!
else:
raise RuntimeError, "I don't know that one!: " + `submit` + ":" + `indexes`
context.REQUEST.RESPONSE.redirect( context.REQUEST.URL1 + '/manage_session_stack')
--- 36,66 ----
newStack.append(newLevel)
! for k in oldLevel.keys():
! oldValue = oldLevel.get(k,level.get(k,None))
! itemType = context.guess_type(oldValue)
! if itemType not in ['unknown','structure','list']:
! newLevel[k] = level.get(k, oldValue)
! else:
! newLevel[k] = oldValue
!
! if (submit=='ADD') and newKey:
! if newType != 'string':
! if newType == 'int':
! newValue = string.atoi(newValue)
! elif newType == 'float':
! newValue = string.atof(newValue)
! elif newType == 'list':
! newValue = newValue.split()
! else:
! raise RuntimeError, "I don't know that tupe!: " + `newType` + ":" + `indexes`
!
! newLevel[newKey] = newValue
context.setCurrentStack(newStack)
! #print "newStack:",newStack
!
else:
raise RuntimeError, "I don't know that one!: " + `submit` + ":" + `indexes`
+ #return printed
context.REQUEST.RESPONSE.redirect( context.REQUEST.URL1 + '/manage_session_stack')
Index: manage_session_stack.pt
===================================================================
RCS file: /cvsroot/zapp/ZApp/skins/zapp_generic/manage_session_stack.pt,v
retrieving revision 1.1
retrieving revision 1.2
diff -C2 -d -r1.1 -r1.2
*** manage_session_stack.pt 25 Jun 2003 11:45:53 -0000 1.1
--- manage_session_stack.pt 12 Aug 2003 13:32:13 -0000 1.2
***************
*** 28,35 ****
<table>
<tr tal:repeat="itemKey itemKeys">
! <tal:block tal:omit-tag="" tal:define="itemValue python:stackLevel[itemKey];
itemType python:here.guess_type(itemValue)">
! <td tal:content="string:${itemKey} (${itemType})"/><td><input size="20" tal:attributes="name string:sessionLevels.${itemKey}:${itemType}:records;
! value itemValue"></td>
</tal:block>
</tr>
--- 28,36 ----
<table>
<tr tal:repeat="itemKey itemKeys">
! <tal:block tal:condition="python:itemKey != 'index'" tal:omit-tag="" tal:define="itemValue python:stackLevel[itemKey];
itemType python:here.guess_type(itemValue)">
! <span tal:condition="python:itemType not in ['unknown','structure','list']" tal:omit-tag=""><td tal:content="string:${itemKey} (${itemType})"/><td><input size="20" tal:attributes="name string:sessionLevels.${itemKey}:${itemType}:records;
! value itemValue"></td></span>
! <span tal:condition="python:itemType in ['unknown','structure','list']" tal:omit-tag=""><td tal:content="string:${itemKey} (${itemType})"/><td><span tal:content="itemValue"/></td></span>
</tal:block>
</tr>
***************
*** 38,45 ****
</td>
</tr>
</table>
<input type="submit" value="EDIT" name="submit">
<input type="submit" value="DELETE" name="submit">
! </form>
</div>
</div>
--- 39,56 ----
</td>
</tr>
+ <tr><td>New Field</td><td><input name="newKey"><select name="newType">
+ <option value="string">string</option>
+ <option value="int">int</option>
+ <option value="float">float</option>
+ <option value="list">tokens</option>
+ </select> <input name="newValue"></td></tr>
+
</table>
<input type="submit" value="EDIT" name="submit">
<input type="submit" value="DELETE" name="submit">
! <input type="submit" value="ADD" name="submit">
! </form>
!
! <div tal:content="python:'Clipboard = ' + `here.getClipboard()`"/>
</div>
</div>
Index: setCurrentStack.py
===================================================================
RCS file: /cvsroot/zapp/ZApp/skins/zapp_generic/setCurrentStack.py,v
retrieving revision 1.1
retrieving revision 1.2
diff -C2 -d -r1.1 -r1.2
*** setCurrentStack.py 25 Jun 2003 11:45:53 -0000 1.1
--- setCurrentStack.py 12 Aug 2003 13:32:13 -0000 1.2
***************
*** 9,12 ****
##
SESSION = context.REQUEST.SESSION
! SESSION['BSM_STACK'] = currStack
return "OK!"
--- 9,12 ----
##
SESSION = context.REQUEST.SESSION
! SESSION['ZAPP_STACK'] = currStack
return "OK!"
--- setupRequest.py DELETED ---
|