cleanup tls-sprint
authorsylvain.thenault@logilab.fr
Wed, 11 Mar 2009 23:27:10 +0100
branchtls-sprint
changeset 1083 343698c0863d
parent 1082 07c21784787b
child 1084 98cd7c5cea4c
cleanup
web/views/editviews.py
--- a/web/views/editviews.py	Wed Mar 11 23:26:39 2009 +0100
+++ b/web/views/editviews.py	Wed Mar 11 23:27:10 2009 +0100
@@ -191,113 +191,8 @@
         by default
         """
         self.wview('textoutofcontext', self.rset, row=row, col=col)
-            
-            
-# class EditRelationView(EntityView):
-#     """Note: This is work in progress
-
-#     This view is part of the edition view refactoring.
-#     It is still too big and cluttered with strange logic, but it's a start
-
-#     The main idea is to be able to call an edition view for a specific
-#     relation. For example :
-#        self.wview('editrelation', person_rset, rtype='firstname')
-#        self.wview('editrelation', person_rset, rtype='works_for')
-#     """
-#     id = 'editrelation'
-
-#     __select__ = match_form_params('rtype')
-    
-#     # TODO: inlineview, multiple edit, (widget view ?)
-#     def cell_call(self, row, col, rtype=None, role='subject', targettype=None,
-#                  showlabel=True):
-#         self.req.add_js( ('cubicweb.ajax.js', 'cubicweb.edition.js') )
-#         entity = self.entity(row, col)
-#         rtype = self.req.form.get('rtype', rtype)
-#         showlabel = self.req.form.get('showlabel', showlabel)
-#         assert rtype is not None, "rtype is mandatory for 'edirelation' view"
-#         targettype = self.req.form.get('targettype', targettype)
-#         role = self.req.form.get('role', role)
-#         category = entity.rtags.get_category(rtype, targettype, role)
-#         if category in ('primary', 'secondary') or self.schema.rschema(rtype).is_final():
-#             if hasattr(entity, '%s_format' % rtype):
-#                 formatwdg = entity.get_widget('%s_format' % rtype, role)
-#                 self.w(formatwdg.edit_render(entity))
-#                 self.w(u'<br/>')
-#             wdg = entity.get_widget(rtype, role)
-#             if showlabel:
-#                 self.w(u'%s' % wdg.render_label(entity))
-#             self.w(u'%s %s %s' %
-#                    (wdg.render_error(entity), wdg.edit_render(entity),
-#                     wdg.render_help(entity),))
-#         else:
-#             self._render_generic_relation(entity, rtype, role)
-
-#     def _render_generic_relation(self, entity, relname, role):
-#         text = self.req.__('add %s %s %s' % (entity.e_schema, relname, role))
-#         # pending operations
-#         operations = self.req.get_pending_operations(entity, relname, role)
-#         if operations['insert'] or operations['delete'] or 'unfold' in self.req.form:
-#             self.w(u'<h3>%s</h3>' % text)
-#             self._render_generic_relation_form(operations, entity, relname, role)
-#         else:
-#             divid = "%s%sreledit" % (relname, role)
-#             url = ajax_replace_url(divid, rql_for_eid(entity.eid), 'editrelation',
-#                                    {'unfold' : 1, 'relname' : relname, 'role' : role})
-#             self.w(u'<a href="%s">%s</a>' % (url, text))
-#             self.w(u'<div id="%s"></div>' % divid)
         
 
-#     def _build_opvalue(self, entity, relname, target, role):
-#         if role == 'subject':
-#             return '%s:%s:%s' % (entity.eid, relname, target)
-#         else:
-#             return '%s:%s:%s' % (target, relname, entity.eid)
-        
-    
-#     def _render_generic_relation_form(self, operations, entity, relname, role):
-#         rqlexec = self.req.execute
-#         for optype, targets in operations.items():
-#             for target in targets:
-#                 self._render_pending(optype, entity, relname, target, role)
-#                 opvalue = self._build_opvalue(entity, relname, target, role)
-#                 self.w(u'<a href="javascript: addPendingDelete(\'%s\', %s);">-</a> '
-#                        % (opvalue, entity.eid))
-#                 rset = rqlexec('Any X WHERE X eid %(x)s', {'x': target}, 'x')
-#                 self.wview('oneline', rset)
-#         # now, unrelated ones
-#         self._render_unrelated_selection(entity, relname, role)
-
-#     def _render_pending(self, optype, entity, relname, target, role):
-#         opvalue = self._build_opvalue(entity, relname, target, role)
-#         self.w(u'<input type="hidden" name="__%s" value="%s" />'
-#                % (optype, opvalue))
-#         if optype == 'insert':
-#             checktext = '-'
-#         else:
-#             checktext = '+'
-#         rset = self.req.execute('Any X WHERE X eid %(x)s', {'x': target}, 'x')
-#         self.w(u"""[<a href="javascript: cancelPending%s('%s:%s:%s')">%s</a>"""
-#                % (optype.capitalize(), relname, target, role,
-#                   self.view('oneline', rset)))
-
-#     def _render_unrelated_selection(self, entity, relname, role):
-#         rschema = self.schema.rschema(relname)
-#         if role == 'subject':
-#             targettypes = rschema.objects(entity.e_schema)
-#         else:
-#             targettypes = rschema.subjects(entity.e_schema)
-#         self.w(u'<select onselect="addPendingInsert(this.selected.value);">')
-#         for targettype in targettypes:
-#             unrelated = entity.unrelated(relname, targettype, role) # XXX limit
-#             for rowindex, row in enumerate(unrelated):
-#                 teid = row[0]
-#                 opvalue = self._build_opvalue(entity, relname, teid, role)
-#                 self.w(u'<option name="__insert" value="%s>%s</option>'
-#                        % (opvalue, self.view('text', unrelated, row=rowindex)))
-#         self.w(u'</select>')
-
-
 class EditableFinalView(FinalView):
     """same as FinalView but enables inplace-edition when possible"""
     id = 'editable-final'