def setup(app, plugin): # Add our privileges for priv in PLUGIN_PRIVILEGES.values(): app.add_privilege(priv) # init new tables init_database(app) # Add our template path app.add_template_searchpath(TEMPLATE_FILES) # Add shared data path app.add_shared_exports('bulletin_board', SHARED_FILES) # Register frontend views app.add_url_rule('/board/', endpoint='board/index', view=views.board_index) app.add_url_rule('/board/forum/<int:forum_id>', endpoint='board/topics', defaults={'page': 1}, view=views.topic_list) app.add_url_rule('/board/forum/<int:forum_id>/page/<int:page>', endpoint='board/topics') app.add_url_rule('/board/topic/<int:topic_id>', endpoint='board/topic_detail', defaults={'page': 1}, view=views.topic_detail) app.add_url_rule('/board/topic/<int:topic_id>/page/<int:page>', endpoint='board/topic_detail') app.add_url_rule('/board/post/<int:post_id>', endpoint='board/post_find', view=views.topic_by_post) app.add_url_rule('/board/post/<int:post_id>/edit', endpoint='board/post_edit', view=views.post_edit) app.add_url_rule('/board/post/<int:post_id>/delete', endpoint='board/post_delete', view=views.post_delete) # Register our admin views add_admin_urls(app, 'board/categories', 'category_id', views.categories_list, views.category_edit, views.category_delete) add_admin_urls(app, 'board/forums', 'forum_id', views.forum_list, views.forum_edit, views.forum_delete) # Add admin views to navigation bar signals.modify_admin_navigation_bar.connect(add_admin_links) # Inject our js for post quoting signals.before_metadata_assembled.connect(inject_js) # convert posts to guestposts upon user deletion signals.before_user_deleted.connect(convert_to_guestpost) # Add JSON services app.add_servicepoint('bulletin_board/get_post', do_get_post)
def setup(app, plugin): """Init our needed stuff""" # Setup tables init_database() # Add our privileges for priv in PLUGIN_PRIVILEGES.values(): app.add_privilege(priv) # Add our template path app.add_template_searchpath(TEMPLATE_FILES) # Register news main page app.add_url_rule('/news/', endpoint='news/index', view=views.index) app.add_url_rule('/news/page/<int:page>', endpoint='news/index') # Register news detail page app.add_url_rule('/news/<int:news_id>', endpoint='news/detail', view=views.detail) # Register news archive along with archive # sub-urls to filter by year, month and day app.add_url_rule('/news/archive', endpoint='news/archive', view=views.archive) tmp = '/news/archive/' for digits, part in zip((0, 0, 0), ('year', 'month', 'day')): tmp += '<int(fixed_digits=%d):%s>/' % (digits, part) app.add_url_rule(tmp, defaults={'page': 1}, endpoint='news/archive') app.add_url_rule(tmp + 'page/<int:page>', endpoint='news/archive') # Register our admin views add_admin_urls(app, 'news', 'news_id', views.news_list, views.edit_news, views.delete_news) # Add admin views to navigation bar signals.modify_admin_navigation_bar.connect(add_admin_links) # Add newsitems to frontpage signals.frontpage_context_collect.connect(add_frontpage_contents)
def setup(app, plugin): # Setup tables init_database(app) # Register repository for schema updates app.register_upgrade_repository(plugin, dirname(__file__)) # Add our privileges for priv in PLUGIN_PRIVILEGES.values(): app.add_privilege(priv) # Add our template path app.add_template_searchpath(TEMPLATE_FILES) # war related pages app.add_url_rule('/wars/', endpoint='wars/index', defaults={'page': 1}, view=views.war_index) app.add_url_rule('/wars/page/<int:page>', endpoint='wars/index') app.add_url_rule('/wars/<int:war_id>', endpoint='wars/detail', view=views.war_detail) app.add_url_rule('/wars/fightus', endpoint='wars/fightus', view=views.war_fightus) # Admin views add_admin_urls(app, 'wars', 'war_id', views.war_list, views.war_edit, views.war_delete) app.add_url_rule('/wars/<int:war_id>/result', prefix='admin', endpoint='admin/warresult_edit', view=views.warresult_edit) add_admin_urls(app, 'warmaps', 'warmap_id', views.warmap_list, views.warmap_edit, views.warmap_delete) add_admin_urls(app, 'warmodes', 'warmode_id', views.warmode_list, views.warmode_edit, views.warmode_delete) # Add admin views to navigation bar signals.modify_admin_navigation_bar.connect(add_admin_links) # create warmaps folder if not already there map_path = join(app.instance_folder, 'warmaps') if not exists(map_path): makedirs(map_path)
def setup(app, plugin): """Init our needed stuff""" # Setup tables init_database(app) # Add our privileges for priv in PLUGIN_PRIVILEGES.values(): app.add_privilege(priv) # Add our template path app.add_template_searchpath(TEMPLATE_FILES) # Register pages page app.add_url_rule('/games/', endpoint='game/index', defaults={'page': 1}, view=views.game_index) app.add_url_rule('/games/page/<int:page>', endpoint='game/index', view=views.game_index) app.add_url_rule('/games/<int:game_id>', endpoint='game/detail', view=views.game_detail) app.add_url_rule('/squads/<int:squad_id>', endpoint='squad/detail', view=views.squad_detail) # Register our admin views # Games add_admin_urls(app, 'games', 'game_id', views.game_list, views.edit_game, views.delete_game) # Squads add_admin_urls(app, 'squads', 'squad_id', views.squad_list, views.edit_squad, views.delete_squad) # Levels add_admin_urls(app, 'levels', 'level_id', views.level_list, views.edit_level, views.delete_level) # Squadmembers app.add_url_rule('/squads/<int:squad_id>/members', prefix='admin', defaults={'page': 1}, endpoint='admin/squadmembers', view=views.list_squadmembers) app.add_url_rule('/squads/<int:squad_id>/members/page/<int:page>', prefix='admin', endpoint='admin/squadembers') app.add_url_rule('/squads/<int:squad_id>/members/<int:user_id>/edit', prefix='admin', endpoint='admin/squadmembers/edit', view=views.edit_squadmember) app.add_url_rule('/squads/<int:squad_id>/members/new', prefix='admin', endpoint='admin/squadmembers/new', view=views.edit_squadmember) app.add_url_rule('/squads/<int:squad_id>/members/<int:user_id>/delete', prefix='admin', endpoint='admin/squadmembers/delete', view=views.delete_squadmember) # Admin views: Gameaccounts app.add_url_rule('/gameaccounts/<int:account_id>/delete', prefix='admin', endpoint='admin/gameaccounts/delete', view=views.adm_delete_gameaccount) # Account views: Gameaccounts add_account_urls(app, 'gameaccounts', 'account_id', views.gameaccount_list, views.gameaccount_edit, views.acc_delete_gameaccount) # Delete squadmember entries while a user is being deleted signals.before_user_deleted.connect(user_deleted_memberships) # Add admin views to navigation bar signals.modify_admin_navigation_bar.connect(add_admin_links) # Add account views to navigation bar signals.modify_account_navigation_bar.connect(add_account_links)