org_mod = ContentModule('organization', __name__) # ############################################################################## # main menu org_mod.add_menu('About Us', 'organization.default' ) # ############################################################################## # side panel menu org_mod.add_side_menu( 'Organization/Officers', # Side panel title [ ( 'Update Offices', 'organization.update_offices' ), ( 'Update Officers', 'organization.edit_officer' ), ( 'Edit About Us', 'organization.edit_aboutus') ], 'admin' ) # ############################################################################## # Load the module implementation import models # filename: models.py import views # filename: views.py # attach module to website add_content_module( org_mod ) # register our data models
# ######################################################################3####### # imports from base import base_app, add_content_module, register_data_models, url_for from base.module import ContentModule # ######################################################################3####### # Initialization newsMod = ContentModule('news', __name__) newsMod.add_menu('News', 'news.default' ) newsMod.add_side_menu( 'News', [ ('Add Post', 'news.add_post'), ('List Posts', 'news.admin_list_posts') ], 'admin' ) import models import views # ######################################################################3####### # Hooking into main website add_content_module( newsMod ) # ######################################################################3####### # Register data models
seminar_mod = ContentModule('seminars', __name__) # ############################################################################## # Add a main menu entry seminar_mod.add_menu('Seminars', 'seminars.default') # ############################################################################## # Add a side panel menu seminar_mod.add_side_menu( 'Seminars', # Side panel title [ ( 'Add Seminar', 'seminars.add_seminar' ), ( 'Edit Seminars', 'seminars.update_seminars' ), ( 'Edit Talks', 'seminars.update_talks' ) ], 'seminar-organizer' ) # ############################################################################## # Load the module implementation import models # filename: models.py import views # filename: views.py # attach module to website add_content_module( seminar_mod ) # register our data models
# ######################################################################3####### # imports from base import base_app, add_content_module, register_data_models, url_for from base import register_user_role from base.module import ContentModule # ######################################################################3####### # Initialization articles_mod = ContentModule('articles', __name__) articles_mod.add_menu('Articles', 'articles.default' ) articles_mod.add_side_menu( 'Articles', [ ('Add Article', 'articles.add_article'), ('Edit Articles', 'articles.update_articles') ], 'contributor' ) import models import views # ######################################################################3####### # Hooking into main website add_content_module( articles_mod ) # ######################################################################3####### # Register data models
# ############################################################################## # define aux objects #templates_obj = AutoIndex(admin_mod, browse_root="static" ) # ############################################################################## # Add admin side panel menu admin_mod.add_side_menu( 'Administration', # Side panel title [ # A link which will be in the side-menu # the format is: ([Name], [target]) ( 'Database', 'ifadmin.database_admin' ), ( 'Users', 'ifadmin.user_admin' ), ( 'Modules', 'ifadmin.modules_admin' ), ( 'Templates', 'ifadmin.templates_admin' ), ( 'Static Files', 'ifadmin.static_admin' ) ], 'admin' ) # ############################################################################## # Load views import views # filename: views.py # ############################################################################## # Finally we hook the module into the main website add_content_module( admin_mod )
example_mod.add_menu('Example', 'example.default') # ############################################################################## # Add a side panel menu # At this point it seems like a decent idea to give a user which has loggedin # a list of newly accessible functions they can use. # We accomplish this by using the add_side_menu function from ContentModule # where the first argument is the title of the side panel section, and the # second is a list of links which will be injected into the panel example_mod.add_side_menu( 'Example Menu One', # Side panel title [ # A link which will be in the side-menu # the format is: ([Name], [target]) ( 'Item 1', 'example.callback' ), ( 'Item 2', 'example.callback' ), ( 'Item 3', 'example.another_callback' ), ( 'Item 4', 'example.another_callback' ) ] ) # ############################################################################## # Load the module implementation # Here we have split the module into two parts models and views. The # views will govern how the user interacts with the content, and will determine # how we extend the main template: layout.html. In addition, the models consist of # database objects which this module implements and uses. # import models # filename: models.py
# ############################################################################## # Module: usertools # Synop: A collection of views which allow the user to update his/her profile # and provides a sidepane menu including links for logout, and others # actions # Menus: # Main menu: none # Side menu: user info access, and logout # from base import add_content_module, register_data_models, url_for from base.module import ContentModule from base.user import Role, User usertools_mod = ContentModule('usertools', __name__) usertools_mod.add_side_menu( 'User', # Side panel title [ ( 'Update Information', 'user_update' ), ( 'Logout', 'auth_logout' ) ] ) # attach module to website add_content_module( usertools_mod ) register_data_models([User, Role])