|
Revision 2105, 1.1 kB
(checked in by taher, 2 months ago)
|
--
|
| Line | |
|---|
| 1 |
from Form import * |
|---|
| 2 |
from Table import * |
|---|
| 3 |
from Module import * |
|---|
| 4 |
import validations |
|---|
| 5 |
|
|---|
| 6 |
NOTE_DIRECTORY = "Public Web Directory to which content the configuration will be applied." |
|---|
| 7 |
|
|---|
| 8 |
class ModuleDirectory (Module, FormHelper): |
|---|
| 9 |
validation = [('tmp!new_rule!value', validations.is_dir_formated)] |
|---|
| 10 |
|
|---|
| 11 |
def __init__ (self, cfg, prefix, submit_url): |
|---|
| 12 |
FormHelper.__init__ (self, 'directory', cfg) |
|---|
| 13 |
Module.__init__ (self, 'directory', cfg, prefix, submit_url) |
|---|
| 14 |
|
|---|
| 15 |
def _op_render (self): |
|---|
| 16 |
table = TableProps() |
|---|
| 17 |
if self._prefix.startswith('tmp!'): |
|---|
| 18 |
self.AddPropEntry (table, 'Web Directory', '%s!value'%(self._prefix), NOTE_DIRECTORY) |
|---|
| 19 |
else: |
|---|
| 20 |
self.AddPropEntry (table, 'Web Directory', '%s!directory'%(self._prefix), NOTE_DIRECTORY) |
|---|
| 21 |
return str(table) |
|---|
| 22 |
|
|---|
| 23 |
def apply_cfg (self, values): |
|---|
| 24 |
if values.has_key('value'): |
|---|
| 25 |
dir_name = values['value'] |
|---|
| 26 |
self._cfg['%s!match!directory'%(self._prefix)] = dir_name |
|---|
| 27 |
|
|---|
| 28 |
def get_name (self): |
|---|
| 29 |
return self._cfg.get_val ('%s!match!directory'%(self._prefix)) |
|---|
| 30 |
|
|---|
| 31 |
def get_type_name (self): |
|---|
| 32 |
return self._id.capitalize() |
|---|