Work in progress: form for assigning parent and child concepts
git-svn-id: svn://svn.cy55.de/Zope3/src/loops/trunk@1079 fd906abe-77d9-0310-91a1-e0d9ade77398
This commit is contained in:
		
							parent
							
								
									1ded8434db
								
							
						
					
					
						commit
						da52ecc17c
					
				
					 4 changed files with 97 additions and 25 deletions
				
			
		|  | @ -54,7 +54,13 @@ class ConceptView(BaseView): | ||||||
|         for token in tokens: |         for token in tokens: | ||||||
|             concept = self.loopsRoot.loopsTraverse(token) |             concept = self.loopsRoot.loopsTraverse(token) | ||||||
|             if action == 'assign': |             if action == 'assign': | ||||||
|  |                 assignAs = self.request.get('assignAs', 'child') | ||||||
|  |                 if assignAs == 'child': | ||||||
|                     self.context.assignChild(removeSecurityProxy(concept)) |                     self.context.assignChild(removeSecurityProxy(concept)) | ||||||
|  |                 elif assignAs == 'parent': | ||||||
|  |                     self.context.assignParent(removeSecurityProxy(concept)) | ||||||
|  |                 else: | ||||||
|  |                     raise(BadRequest, 'Illegal assignAs parameter: %s.' % assignAs) | ||||||
|             elif action == 'remove': |             elif action == 'remove': | ||||||
|                 qualifier = self.request.get('qualifier', None) |                 qualifier = self.request.get('qualifier', None) | ||||||
|                 if qualifier == 'parents': |                 if qualifier == 'parents': | ||||||
|  |  | ||||||
|  | @ -26,14 +26,30 @@ | ||||||
|         <metal:children use-macro="views/relation_macros/listing" /> |         <metal:children use-macro="views/relation_macros/listing" /> | ||||||
|       </tal:block> |       </tal:block> | ||||||
| 
 | 
 | ||||||
|  |       <tal:block> | ||||||
|  |         <metal:create use-macro="views/relation_macros/create" /> | ||||||
|  |       </tal:block> | ||||||
|  |        | ||||||
|       <tal:block define="items view/getVocabularyForRelated; |       <tal:block define="items view/getVocabularyForRelated; | ||||||
|                          action string:assign; |                          action string:assign; | ||||||
|                          qualifier nothing; |                          qualifier nothing; | ||||||
|                          summary string:Assignment candidates; |                          summary string:Assignment candidates; | ||||||
|                          legend string:Assign as Children; |                          legend string:Search Results; | ||||||
|                          buttonText string:Assign Object(s); |                          buttonText string:Assign; | ||||||
|                          "> |                          "> | ||||||
|         <metal:assign use-macro="views/relation_macros/listing" /> |         <metal:assign use-macro="views/relation_macros/listing"> | ||||||
|  |           <metal:search fill-slot="topActions"> | ||||||
|  |             <metal:block use-macro="views/relation_macros/search" /> | ||||||
|  |           </metal:search> | ||||||
|  |           <metal:special fill-slot="specialButtons"> | ||||||
|  |             as | ||||||
|  |             <select name="assignAs"> | ||||||
|  |               <option value="child" selected i18n:translate="">child</option> | ||||||
|  |               <option value="parent" i18n:translate="">parent</option> | ||||||
|  |             </select> | ||||||
|  |             object(s) | ||||||
|  |           </metal:special> | ||||||
|  |         </metal:assign> | ||||||
|       </tal:block> |       </tal:block> | ||||||
|        |        | ||||||
|     </div> |     </div> | ||||||
|  |  | ||||||
|  | @ -96,15 +96,6 @@ | ||||||
|       view="AddLoopsConcept.html" |       view="AddLoopsConcept.html" | ||||||
|       /> |       /> | ||||||
| 
 | 
 | ||||||
|   <editform |  | ||||||
|       label="Edit Concept" |  | ||||||
|       name="edit.html" |  | ||||||
|       schema="loops.interfaces.IConcept" |  | ||||||
|       for="loops.interfaces.IConcept" |  | ||||||
|       permission="zope.ManageContent" |  | ||||||
|       menu="zmi_views" title="Edit" |  | ||||||
|       /> |  | ||||||
| 
 |  | ||||||
|   <pages |   <pages | ||||||
|       for="loops.interfaces.IConcept" |       for="loops.interfaces.IConcept" | ||||||
|       class=".concept.ConceptView" |       class=".concept.ConceptView" | ||||||
|  | @ -118,6 +109,15 @@ | ||||||
|      |      | ||||||
|   </pages> |   </pages> | ||||||
|      |      | ||||||
|  |   <editform | ||||||
|  |       label="Edit Concept" | ||||||
|  |       name="edit.html" | ||||||
|  |       schema="loops.interfaces.IConcept" | ||||||
|  |       for="loops.interfaces.IConcept" | ||||||
|  |       permission="zope.ManageContent" | ||||||
|  |       menu="zmi_views" title="Edit" | ||||||
|  |       /> | ||||||
|  | 
 | ||||||
|   <page |   <page | ||||||
|       name="concept.html" |       name="concept.html" | ||||||
|       for="loops.interfaces.IConcept" |       for="loops.interfaces.IConcept" | ||||||
|  |  | ||||||
|  | @ -2,6 +2,10 @@ | ||||||
| 
 | 
 | ||||||
| 
 | 
 | ||||||
| <metal:assignments define-macro="listing"> | <metal:assignments define-macro="listing"> | ||||||
|  |   <fieldset> | ||||||
|  |     <legend tal:content="legend" | ||||||
|  |               i18n:translate="">Parent Concepts</legend> | ||||||
|  |     <metal:top define-slot="topActions" /> | ||||||
|     <form method="post" name="listing" action="." |     <form method="post" name="listing" action="." | ||||||
|           tal:attributes="action request/URL" |           tal:attributes="action request/URL" | ||||||
|           tal:condition="items"> |           tal:condition="items"> | ||||||
|  | @ -10,9 +14,6 @@ | ||||||
|       <input type="hidden" name="qualifier" value="parents" |       <input type="hidden" name="qualifier" value="parents" | ||||||
|              tal:condition="qualifier" |              tal:condition="qualifier" | ||||||
|              tal:attributes="value qualifier" /> |              tal:attributes="value qualifier" /> | ||||||
|     <fieldset> |  | ||||||
|       <legend tal:content="legend" |  | ||||||
|               i18n:translate="">Parent Concepts</legend> |  | ||||||
|       <table class="listing" summary="Currently assigned objects" |       <table class="listing" summary="Currently assigned objects" | ||||||
|              i18n:attributes="summary" |              i18n:attributes="summary" | ||||||
|              tal:attributes="summary summary"> |              tal:attributes="summary summary"> | ||||||
|  | @ -31,7 +32,9 @@ | ||||||
|             </td> |             </td> | ||||||
|             <td> |             <td> | ||||||
|               <a tal:content="item/title" href="#" |               <a tal:content="item/title" href="#" | ||||||
|                  tal:attributes="href item/url">Title</a> |                  tal:attributes="href string:${item/url}/@@SelectedManagementView.html"> | ||||||
|  |                 Title | ||||||
|  |               </a> | ||||||
|             </td> |             </td> | ||||||
|           </tr> |           </tr> | ||||||
|         </tbody> |         </tbody> | ||||||
|  | @ -41,10 +44,57 @@ | ||||||
|                value="Remove Assignment(s)" |                value="Remove Assignment(s)" | ||||||
|                i18n:attributes="value" |                i18n:attributes="value" | ||||||
|                tal:attributes="value buttonText" /> |                tal:attributes="value buttonText" /> | ||||||
|  |         <metal:buttons define-slot="specialButtons" /> | ||||||
|       </div> |       </div> | ||||||
|     </fieldset> |  | ||||||
|   </form> |   </form> | ||||||
|  |     </fieldset> | ||||||
| </metal:assignments> | </metal:assignments> | ||||||
| 
 | 
 | ||||||
| 
 | 
 | ||||||
|  | <metal:create define-macro="create"> | ||||||
|  |   <fieldset> | ||||||
|  |     <legend i18n:translate="">Create Object</legend> | ||||||
|  |     <form method="post" name="listing" action="." | ||||||
|  |         tal:attributes="action request/URL"> | ||||||
|  |       <div class="row"> | ||||||
|  |         <span i18n:translate="">Name</span> | ||||||
|  |         <input /> | ||||||
|  |         <span i18n:translate="">Title</span> | ||||||
|  |         <input /> | ||||||
|  |         <span i18n:translate="">Type</span> | ||||||
|  |         <select> | ||||||
|  |           <option>Topic</option> | ||||||
|  |         </select> | ||||||
|  |       </div> | ||||||
|  |       <div class="formControls"> | ||||||
|  |         <input class="context" type="submit" name="form.button.submit" | ||||||
|  |                value="Create Object" | ||||||
|  |                i18n:attributes="value" /> | ||||||
|  |             and assign as | ||||||
|  |             <select name="assignAs"> | ||||||
|  |               <option value="child" selected i18n:translate="">child</option> | ||||||
|  |               <option value="parent" i18n:translate="">parent</option> | ||||||
|  |             </select> | ||||||
|  |       </div> | ||||||
|  |     </form> | ||||||
|  |   </fieldset> | ||||||
|  | </metal:create> | ||||||
|  | 
 | ||||||
|  | 
 | ||||||
|  | <metal:search define-macro="search"> | ||||||
|  |   <form method="post" name="listing" action="." | ||||||
|  |         tal:attributes="action request/URL"> | ||||||
|  |       <div class="row"> | ||||||
|  |         <span i18n:translate="">Search Term</span> | ||||||
|  |         <input /> | ||||||
|  |       </div> | ||||||
|  |       <div class="formControls"> | ||||||
|  |         <input class="context" type="submit" name="form.button.submit" | ||||||
|  |                value="Search" | ||||||
|  |                i18n:attributes="value" /> | ||||||
|  |       </div> | ||||||
|  |   </form> | ||||||
|  | </metal:search> | ||||||
|  | 
 | ||||||
|  | 
 | ||||||
| </html> | </html> | ||||||
|  |  | ||||||
		Loading…
	
	Add table
		
		Reference in a new issue
	
	 helmutm
						helmutm