[CMF-checkins] CVS: CMF/CMFDefault/skins/content - document_edit.py:1.2 file_edit.py:1.2 image_edit.py:1.2 link_edit.py:1.2 newsitem_edit.py:1.2

Tres Seaver tseaver@zope.com
Sat, 6 Oct 2001 19:06:48 -0400


Update of /cvs-repository/CMF/CMFDefault/skins/content
In directory cvs.zope.org:/tmp/cvs-serv14257/CMFDefault/skins/content

Modified Files:
	document_edit.py file_edit.py image_edit.py link_edit.py 
	newsitem_edit.py 
Log Message:


 - Enable "Change and View" option on edit forms (also removes hard-wired
   dependency on view action URL).


=== CMF/CMFDefault/skins/content/document_edit.py 1.1 => 1.2 ===
-##parameters=text_format, text, file='', SafetyBelt=''
+##parameters=text_format, text, file='', SafetyBelt='', choice=' Change '
 ##title=Edit a document
  
-context.edit(text_format,
-             text,
-             file,
-             safety_belt=SafetyBelt)
+context.edit( text_format
+            , text
+            , file
+            , safety_belt=SafetyBelt
+            )
 
-qst='?portal_status_message=Document+changed.'
+qst='portal_status_message=Document+changed.'
 
-context.REQUEST.RESPONSE.redirect( context.absolute_url() + '/document_edit_form' + qst )
+if choice == ' Change and View ':
+    target_action = context.getTypeInfo().getActionById( 'view' )
+else:
+    target_action = context.getTypeInfo().getActionById( 'edit' )
+
+context.REQUEST.RESPONSE.redirect( '%s/%s?%s' % ( context.absolute_url()
+                                                , target_action
+                                                , qst
+                                                ) )
 


=== CMF/CMFDefault/skins/content/file_edit.py 1.1 => 1.2 ===
-##parameters=precondition='', file=''
+##parameters=precondition='', file='', choice=' Change '
 ##title=Edit a file
  
 context.edit(
      precondition=precondition,
      file=file)
 
-qst='?portal_status_message=File+changed.'
- 
-context.REQUEST.RESPONSE.redirect( context.absolute_url() + '/file_edit_form' + qst )
+qst='portal_status_message=File+changed.'
+
+if choice == ' Change and View ':
+    target_action = context.getTypeInfo().getActionById( 'view' )
+else:
+    target_action = context.getTypeInfo().getActionById( 'edit' )
 
+context.REQUEST.RESPONSE.redirect( '%s/%s?%s' % ( context.absolute_url()
+                                                , target_action
+                                                , qst
+                                                ) )


=== CMF/CMFDefault/skins/content/image_edit.py 1.1 => 1.2 ===
-##parameters=precondition='', file=''
+##parameters=precondition='', file='', choice=' Change '
 ##title=Edit an image
  
 context.edit(
      precondition=precondition,
      file=file)
 
-qst='?portal_status_message=Image+changed.'
- 
-context.REQUEST.RESPONSE.redirect( context.absolute_url() + '/image_edit_form' + qst )
+qst='portal_status_message=Image+changed.'
+
+if choice == ' Change and View ':
+    target_action = context.getTypeInfo().getActionById( 'view' )
+else:
+    target_action = context.getTypeInfo().getActionById( 'edit' )
 
+context.REQUEST.RESPONSE.redirect( '%s/%s?%s' % ( context.absolute_url()
+                                                , target_action
+                                                , qst
+                                                ) )


=== CMF/CMFDefault/skins/content/link_edit.py 1.1 => 1.2 ===
-##parameters=remote_url
+##parameters=remote_url, choice=' Change '
 ##title=Edit a link
  
 context.edit(remote_url=remote_url)
 
-qst='?portal_status_message=Link+changed.'
- 
-context.REQUEST.RESPONSE.redirect( context.absolute_url() + '/link_edit_form' + qst )
+qst='portal_status_message=Link+changed.'
+
+if choice == ' Change and View ':
+    target_action = context.getTypeInfo().getActionById( 'view' )
+else:
+    target_action = context.getTypeInfo().getActionById( 'edit' )
 
+context.REQUEST.RESPONSE.redirect( '%s/%s?%s' % ( context.absolute_url()
+                                                , target_action
+                                                , qst
+                                                ) )


=== CMF/CMFDefault/skins/content/newsitem_edit.py 1.1 => 1.2 ===
-##parameters=text, description
+##parameters=text, description, choice=' Change '
 ##title=Edit a news item
  
 context.edit(text, description)
 
-qst='?portal_status_message=News+Item+changed.'
- 
-context.REQUEST.RESPONSE.redirect( context.absolute_url() + '/newsitem_edit_form' + qst )
+qst='portal_status_message=News+Item+changed.'
+
+if choice == ' Change and View ':
+    target_action = context.getTypeInfo().getActionById( 'view' )
+else:
+    target_action = context.getTypeInfo().getActionById( 'edit' )
 
+context.REQUEST.RESPONSE.redirect( '%s/%s?%s' % ( context.absolute_url()
+                                                , target_action
+                                                , qst
+                                                ) )