Changeset 2889
- Timestamp:
- 09/30/09 16:20:20 (2 years ago)
- Files:
-
- trunk/LearningResource.py (modified) (1 diff)
- trunk/skins/lemill/manage_translations.pt (modified) (3 diffs)
Legend:
- Unmodified
- Added
- Removed
- Modified
- Copied
- Moved
trunk/LearningResource.py
r2887 r2889 328 328 return REQUEST.RESPONSE.redirect('%s/manage_translations' % self.absolute_url()) 329 329 330 security.declareProtected(MANAGE_PORTAL, 'manage_form_ setTranslations')331 def manage_form_ setTranslations(self, REQUEST):330 security.declareProtected(MANAGE_PORTAL, 'manage_form_removeTranslations') 331 def manage_form_removeTranslations(self, REQUEST): 332 332 """ Allows managers to reorganize which is translated by whom """ 333 333 lt = getToolByName(self, "lemill_tool") 334 oldlist=self.getTranslations() 335 folder = self.getSectionFolder() 336 337 for n in range(len(oldlist)): 338 new_id = REQUEST.get('obj_translation%s' % n) 339 old_id = REQUEST.get('obj_translation_old%s' % n) 340 if new_id != old_id: 341 new=getattr(folder, new_id, None) 342 old=getattr(folder, old_id, None) 343 if new: 344 if new.portal_type == self.portal_type: 345 self.addToTranslations(new.UID()) 346 new.setTranslation_of(self.UID()) 347 else: 348 lt.addPortalMessage("text_message_type_mismatch_cant_translate", default="Type mismatch, cannot be translation of that kind of object.") 349 elif new_id: 350 lt.addPortalMessage("Object not found.") 351 if new and old: 352 self.removeFromTranslations(old.UID()) 353 old.setTranslation_of('') 354 334 oldlist=self.getTranslations() 335 for n, obj in enumerate(oldlist): 336 checked = REQUEST.get('obj_translation%s' % n) 337 if checked: 338 self.removeFromTranslations(obj.UID()) 339 obj.setTranslation_of('') 355 340 return REQUEST.RESPONSE.redirect('%s/manage_translations' % self.absolute_url()) 356 341 trunk/skins/lemill/manage_translations.pt
r1995 r2889 55 55 56 56 <tal:cond condition="obj_translations"> 57 <form name=" assign_translations"57 <form name="remove_translations" 58 58 method="post" 59 59 class="enableUnloadProtection" 60 tal:attributes="action string:${here/absolute_url}/manage_form_ setTranslations"61 action="manage_form_ setTranslations">60 tal:attributes="action string:${here/absolute_url}/manage_form_removeTranslations" 61 action="manage_form_removeTranslations"> 62 62 63 63 64 64 <ul tal:repeat="trans obj_translations"> 65 65 <li tal:define="index repeat/trans/index" > 66 <input type=" text" tal:attributes="value trans/id; name python:'obj_translation%s' % index" />66 <input type="checkbox" tal:attributes="value trans/id; name python:'obj_translation%s' % index" /> <span tal:replace="trans/id" /> 67 67 <a href="" tal:content="trans/title" tal:attributes="href string:${trans/absolute_url}/manage_translations" /> 68 68 <input type="hidden" tal:attributes="value trans/id; name python:'obj_translation_old%s' % index" /> … … 76 76 <input class="context" 77 77 type="submit" 78 name="form.button. assign_translations"79 value=" Change translations"78 name="form.button.remove_translations" 79 value="Remove translations" 80 80 tal:attributes="tabindex tabindex/next" 81 81 /> 82 82 </div> 83 83 84 <p> You can remove translations by setting the field blank or change translation by writing other objects id in place.</p>84 <p>Select translations you wish to disconnect from this resource or write an id of a new translation to add. </p> 85 85 <p tal:condition="mother"><b>This is a translation of resource <span tal:replace="mother/id" />, but seems to have translations of its own. These translations should also point to <span tal:replace="mother/id" />.</b></p> 86 86 … … 104 104 type="submit" 105 105 name="form.button.add_translation" 106 value="Add t his as translation"106 value="Add translation" 107 107 tal:attributes="tabindex tabindex/next" 108 108 />
