Changes between Initial Version and Version 1 of CustomFieldAdminPlugin


Ignore:
Timestamp:
May 21, 2007, 12:06:22 PM (17 years ago)
Author:
osimons
Comment:

New hack CustomFieldAdminPlugin, created by osimons

Legend:

Unmodified
Added
Removed
Modified
  • CustomFieldAdminPlugin

    v1 v1  
     1= Trac Custom Field Admin plugin =
     2
     3== Description ==
     4
     5This plugin is a Web Admin page for administrating custom fields - adding, modifying and deleting them without editing the `trac.ini` file directly.
     6
     7The plugin is developed and tested for Trac 0.10.x (should work on 0.9.x). No plans yet for converting it to 0.11.
     8
     9This plugin is a cooperation between !CodeResort.com and Optaros.com, and is made freely available under a BSD license.
     10
     11Known issues:
     12 * If your web server runs multiple processes, the other processes will not be able to delete custom fields - see [trac:ticket:3833] and [trac:ticket:5135] for progress on this issue.
     13
     14== Bugs/Feature Requests ==
     15
     16Existing bugs and feature requests for CustomFieldAdminPlugin are
     17[report:9?COMPONENT=CustomFieldAdminPlugin here].
     18
     19If you have any issues, create a
     20[http://trac-hacks.org/newticket?component=CustomFieldAdminPlugin&owner=osimons new ticket].
     21
     22== Download ==
     23
     24Download the zipped source from [download:customfieldadminplugin here].
     25
     26== Source ==
     27
     28You can check out CustomFieldAdminPlugin from [http://trac-hacks.org/svn/customfieldadminplugin here] using Subversion, or [source:customfieldadminplugin browse the source] with Trac.
     29
     30== Example ==
     31
     32This plugin requires Web Admin plugin ([trac:wiki:WebAdmin]).
     33
     34Enable the plugin in trac.ini:
     35{{{
     36[components]
     37customfieldadmin.* = enabled
     38}}}
     39
     40The plugin also has an API that can be called from other code if you need to create or modify custom fields. Here is an interactive session as example:
     41{{{
     42#!python
     43from trac.env import Environment
     44from customfieldadmin.api import CustomFields
     45
     46myenv = Environment('/path/to/env')
     47mycfcomp = CustomFields(myenv)
     48
     49# Get Cusom fields (list of dicts)
     50myfields = mycfcomp.get_custom_fields(myenv)
     51for item in myfields: print item
     52
     53# Create a custom field - text box
     54mycfdict = {                # a template dictionary
     55    'name': 'test01',       # name of field (alphanumeric only)
     56    'type': 'text',         # text|checkbox|select|radio|textarea
     57    'label': 'Test 01',     # description
     58    'value': 'first test',  # default value for field content
     59    'options': None,        # options for select and radio types (list, leave first empty for optional)
     60    'cols': None,           # number of columns for text area
     61    'rows': None,           # number of rows for text area
     62    'order': 0 }            # specify sort order for field, 0 for last
     63mycfcomp.update_custom_field(myenv, mycfdict, create=True)
     64
     65# Updating
     66mycfdict['type'] = 'select'
     67mycfdict['options'] = ['', 'one', 'two', 'three']
     68mycfdict['value'] = None
     69mycfcomp.update_custom_field(myenv, mycfdict)
     70
     71# And deleting an existing custom field
     72mycfcomp.delete_custom_field(myenv, mycfdict)
     73}}}
     74
     75== Recent Changes ==
     76
     77[[ChangeLog(customfieldadminplugin, 3)]]
     78
     79== Author/Contributors ==
     80
     81'''Author:''' [wiki:osimons] [[BR]]
     82'''Contributors:'''