customfieldadminplugin/ 0000755 0001750 0001750 00000000000 12745255020 013762 5 ustar wmb wmb customfieldadminplugin/0.10/ 0000755 0001750 0001750 00000000000 12003722137 014333 5 ustar wmb wmb customfieldadminplugin/0.10/customfieldadmin/ 0000755 0001750 0001750 00000000000 10774445204 017674 5 ustar wmb wmb customfieldadminplugin/0.10/customfieldadmin/templates/ 0000755 0001750 0001750 00000000000 10774445204 021672 5 ustar wmb wmb customfieldadminplugin/0.10/customfieldadmin/templates/customfieldadmin.cs 0000644 0001750 0001750 00000011504 10774445204 025551 0 ustar wmb wmb
No Custom Fields defined for this project.
customfieldadminplugin/0.10/customfieldadmin/__init__.py 0000644 0001750 0001750 00000000000 10624306774 021775 0 ustar wmb wmb customfieldadminplugin/0.10/customfieldadmin/customfieldadmin.py 0000644 0001750 0001750 00000011762 10675324756 023614 0 ustar wmb wmb # -*- coding: utf-8 -*- """ Trac WebAdmin plugin for administration of custom fields. License: BSD (c) 2005-2007 ::: www.CodeResort.com - BV Network AS (simon-code@bvnetwork.no) (c) 2007 ::: www.Optaros.com (.....) """ from trac.core import * from trac.web.chrome import ITemplateProvider, add_stylesheet, add_script from webadmin.web_ui import IAdminPageProvider from api import CustomFields from trac.util.text import to_unicode class CustomFieldAdminPage(Component): implements(ITemplateProvider, IAdminPageProvider) # IAdminPageProvider methods def get_admin_pages(self, req): if req.perm.has_permission('TRAC_ADMIN'): yield ('ticket', 'Ticket System', 'customfields', 'Custom Fields') def process_admin_request(self, req, cat, page, customfield): #assert req.perm.has_permission('TRAC_ADMIN') req.perm.assert_permission('TRAC_ADMIN') add_script(req, 'customfieldadmin/js/CustomFieldAdminPage_actions.js') def _customfield_from_req(self, req): cfdict = {'name': to_unicode(req.args.get('name')), 'label': to_unicode(req.args.get('label')), 'type': to_unicode(req.args.get('type')), 'value': to_unicode(req.args.get('value')), 'options': [x.strip() for x in to_unicode(req.args.get('options')).split("\n")], 'cols': to_unicode(req.args.get('cols')), 'rows': to_unicode(req.args.get('rows')), 'order': req.args.get('order', 0)} return cfdict cfapi = CustomFields(self.env) # Detail view? if customfield: exists = [True for cf in cfapi.get_custom_fields(self.env) if cf['name'] == customfield] if not exists: raise TracError("Custom field %s does not exist." % customfield) if req.method == 'POST': if req.args.get('save'): cfdict = _customfield_from_req(self, req) cfapi.update_custom_field(self.env, cfdict) req.redirect(req.href.admin(cat, page)) elif req.args.get('cancel'): req.redirect(req.href.admin(cat, page)) currentcf = cfapi.get_custom_fields(self.env, {'name': customfield}) if currentcf.has_key('options'): optional_line = '' if currentcf.get('optional', False): optional_line = "\n" currentcf['options'] = optional_line + "\n".join(currentcf['options']) req.hdf['admin.customfield'] = currentcf else: if req.method == 'POST': # Add Custom Field if req.args.get('add') and req.args.get('name'): cfdict = _customfield_from_req(self, req) cfapi.update_custom_field(self.env, cfdict, create=True) req.redirect(req.href.admin(cat, page)) # Remove Custom Field elif req.args.get('remove') and req.args.get('sel'): sel = req.args.get('sel') sel = isinstance(sel, list) and sel or [sel] if not sel: raise TracError, 'No custom field selected' for name in sel: cfdict = {'name': name} cfapi.delete_custom_field(self.env, cfdict) req.redirect(req.href.admin(cat, page)) elif req.args.get('apply'): # Change order order = dict([(key[6:], req.args.get(key)) for key in req.args.keys() if key.startswith('order_')]) values = dict([(val, True) for val in order.values()]) if len(order) != len(values): raise TracError, 'Order numbers must be unique.' cf = cfapi.get_custom_fields(self.env) for cur_cf in cf: cur_cf['order'] = order[cur_cf['name']] cfapi.update_custom_field(self.env, cur_cf) req.redirect(req.href.admin(cat, page)) hdf_list = [] for item in cfapi.get_custom_fields(self.env): item['href'] = req.href.admin(cat, page, item['name']) hdf_list.append(item) req.hdf['admin.customfields'] = hdf_list return 'customfieldadmin.cs', None # ITemplateProvider methods def get_templates_dirs(self): from pkg_resources import resource_filename return [resource_filename(__name__, 'templates')] def get_htdocs_dirs(self): from pkg_resources import resource_filename return [('customfieldadmin', resource_filename(__name__, 'htdocs'))] customfieldadminplugin/0.10/customfieldadmin/htdocs/ 0000755 0001750 0001750 00000000000 10624306774 021162 5 ustar wmb wmb customfieldadminplugin/0.10/customfieldadmin/htdocs/js/ 0000755 0001750 0001750 00000000000 10624306774 021576 5 ustar wmb wmb customfieldadminplugin/0.10/customfieldadmin/htdocs/js/CustomFieldAdminPage_actions.js 0000755 0001750 0001750 00000003521 10624306774 027644 0 ustar wmb wmb /********** * User Interface function for Trac Custom Field Admin plugin. * License: BSD * (c) 2007 ::: www.Optaros.com (.....) **********/ /** * */ function addcfType_validate( ){ function getLabel( id ){ var labelElements = document.getElementById('addcf').getElementsByTagName("LABEL"); for( var i=0; i