30 | | This needs a table to store the module's menu options in: |
31 | | {{{ |
32 | | module = 'name' |
33 | | |
34 | | # Menu Options |
35 | | db.define_table('%s_menu_option' % module, |
36 | | db.Field('name'), |
37 | | db.Field('function'), |
38 | | db.Field('description', length=256), |
39 | | db.Field('priority', 'integer'), |
40 | | db.Field('enabled', 'boolean', default='True')) |
41 | | db['%s_menu_option' % module].name.requires = [IS_NOT_EMPTY(), IS_NOT_IN_DB(db, '%s_menu_option.name' % module)] |
42 | | db['%s_menu_option' % module].name.requires = IS_NOT_EMPTY() |
43 | | db['%s_menu_option' % module].priority.requires = [IS_NOT_EMPTY(), IS_NOT_IN_DB(db, '%s_menu_option.priority' % module)] |
44 | | }}} |
45 | | Populate this table with the functions that you wish to expose to the module's front page & left-hand navigation bar: |
46 | | {{{ |
47 | | if not len(db().select(db['%s' % table].ALL)): |
48 | | db[table].insert( |
49 | | name="Home", |
50 | | function="index", |
51 | | priority=0, |
52 | | description="Home", |
53 | | enabled='True' |
54 | | ) |
55 | | db[table].insert( |
56 | | name="Add Vehicle", |
57 | | function="vehicle/create", |
58 | | priority=1, |
59 | | description="Add a vehicle to the database", |
60 | | enabled='True' |
61 | | ) |
62 | | db[table].insert( |
63 | | name="List Vehicles", |
64 | | function="vehicle", |
65 | | priority=2, |
66 | | description="List information of all vehicles", |
67 | | enabled='True' |
68 | | ) |
69 | | db[table].insert( |
70 | | name="Search Vehicles", |
71 | | function="vehicle/search", |
72 | | priority=3, |
73 | | description="List information of all vehicles", |
74 | | enabled='True' |
75 | | ) |
76 | | }}} |
77 | | |
78 | | Add additional tables to this file, as-required for your resources.[[BR]] |
| 30 | Add tables to this file, as-required for your resources.[[BR]] |