Exemplo n.º 1
0
    def __init__(self, request):
        super(MainViewer, self).__init__(request)
        self.route = self.request.matched_route.name
        self.layout.main_menu = make_main_menu(self.request)
        self._user_query = self.request.db.query(User)
        self.context = self.request.matchdict['context']

        self.venues = VenueManager(self.request.db)

        menu = BaseMenu()
        menu.set_header("Actions")
        url = self.url(context='add', id='fff')
        menu.append_new_entry('Add Venue', url)
        self.layout.options_menus = dict(actions=menu)
        
        

        # make dispatch table
        self._cntxt_meth = dict(
            main=self.main_view,
            add=self.add_venue,
            )

        if self.context in self._cntxt_meth:
            self._cntxt_meth[self.context]()
        else:
            msg = 'Undefined Context: %s' % self.context
            self.layout.content = '<b>%s</b>' % msg
Exemplo n.º 2
0
    def __init__(self, request):
        BaseViewer.__init__(self, request)
        self.context = None
        if 'context' in self.request.matchdict:
            self.context = self.request.matchdict['context']
        prepare_main_data(self.request)
        self.dbsession = self.request.db
        self.manager = ModelManager(self.dbsession)
        # make left menu
        entries = []
        url = self.url(context='main', id='calendar')
        entries.append(('Main View', url))
        url = self.url(context='dbmeetings', id=None)
        entries.append(('Meetings', url))
        url = self.url(context='items', id=None)
        url = self.url(context='viewdepts', id=None)
        entries.append(('View Departments', url))
        url = self.url(context='viewpeople', id=None)
        entries.append(('View People', url))
        url = self.url(context='tagitems', id=None)
        entries.append(('Tag Items', url))
        url = self.url(context='viewtags', id=None)
        entries.append(('View Tags', url))

        if self.context in ['viewfeed']:
            url = self.url(context='deletefeed',
                           feed=self.request.matchdict['feed'])
            entries.append(('Delete Feed', url))
        header = 'Hubby Menu'
        menu = BaseMenu()
        menu.set_new_entries(entries, header=header)
        self.layout.options_menus = dict(actions=menu)
        
        

        # make dispatch table
        self._cntxt_meth = dict(
            main=self.main_calendar_view,
            dbmeetings=self.view_db_meetings,
            viewmeeting=self.view_meeting,
            viewdepts=self.view_departments,
            viewpeople=self.view_people,
            viewdepartment=self.view_dept_meetings,
            tagitems=self.view_tag_items,
            viewtags=self.view_tags,
            viewtaggeditem=self.view_items_with_tag,
            )
                
        
        # dispatch context request
        if self.context in self._cntxt_meth:
            self._cntxt_meth[self.context]()
        else:
            msg = 'Undefined Context: %s' % self.context
            self.layout.content = '<b>%s</b>' % msg
Exemplo n.º 3
0
    def __init__(self, request):
        super(MainViewer, self).__init__(request)
        self.users = UserManager(self.request.db)
        # make default config for user, if needed
        user = self.get_current_user()
        if user.config is None:
            self.users.Make_default_config(user.id)
        self.context = self.request.matchdict['context']
        self.layout.header = "User Preferences"
        self.layout.title = "User Preferences"
        #self.layout.ctx_menu = None
        if self.layout.ctx_menu is not None:
            self.layout.subheader = str(self.layout.ctx_menu)
        # make left menu
        menu = BaseMenu()
        entries = []
        url = request.route_url('user', context='chpasswd')
        entries.append(('Change Password', url))
        url = request.route_url('user', context='status')
        entries.append(('Status', url))
        url = request.route_url('user', context='mainprefs')
        entries.append(('Main Prefs', url))
        url = request.route_url('user', context='tktprefs')
        entries.append(('Ticket Prefs', url))
        url = request.route_url('user', context='phonecallprefs')
        entries.append(('Phone Call Prefs', url))
        url = request.route_url('user', context='caseprefs')
        entries.append(('Case Prefs', url))
        menu.set_new_entries(entries, header='Preferences')
        self.layout.options_menus = dict(prefs=menu)

        # make dispatch table
        self._cntxt_meth = dict(
            chpasswd=self.change_password,
            mainprefs=self.main_preferences,
            tktprefs=self.ticket_preferences,
            phonecallprefs=self.phone_call_preferences,
            caseprefs=self.case_preferences,
            preferences=self.preferences_view,
            )
        

        # dispatch context request
        if self.context in self._cntxt_meth:
            self._cntxt_meth[self.context]()
        else:
            msg = 'Undefined Context: %s' % self.context
            self.layout.content = '<b>%s</b>' % msg
Exemplo n.º 4
0
    def _set_options_menu(self):
        menu = BaseMenu()
        menu.set_header('Site Text Actions')

        url = self.url(context='list', id='all')
        menu.append_new_entry('List Entries', url)

        url = self.url(context='create', id='new')
        menu.append_new_entry('Create New Entry', url)        

        url = self.url(context='download_wiki_archive', id='all')
        menu.append_new_entry('Download Wiki Archive', url)
        self.layout.options_menus = dict(actions=menu)
Exemplo n.º 5
0
def prepare_main_data(request):
    layout = request.layout_manager.layout
    layout.main_menu = make_main_menu(request)
    
    menu = BaseMenu()
    menu.set_header('Actions')
    route = 'admin_users'
    url = request.route_url(route, context='list', id='all')
    menu.append_new_entry('List Users', url)
    url = request.route_url(route, context='add', id='somebody')
    menu.append_new_entry('Add User', url)
    url = request.route_url(route, context='listgroups', id='all')
    menu.append_new_entry('List Groups', url)
    layout.title = 'Manage Users'
    layout.header = 'Manage Users' 
    layout.options_menus = dict(actions=menu)
Exemplo n.º 6
0
    def _set_menu(self):
        menu = BaseMenu()
        menu.set_header('Site Text Menu')

        url = self.url(context='list', id='all')
        menu.append_new_entry('List Entries', url)

        url = self.url(context='create', id='new')
        menu.append_new_entry('Create New Entry', url)        
        self.layout.options_menus = dict(actions=menu)
Exemplo n.º 7
0
def prepare_user_menu(request):
    user = None
    menu = BaseMenu()
    if 'user' in request.session and request.session['user']:
        user = request.session['user']
    header = 'Guest User'
    if user is not None:
        header = user.username
    menu = BaseMenu(header=header)
    if user is not None:
        url = request.route_url('user', context='status')
        menu.append_new_entry('Preferences', url)
        if 'admin' in user.groups:
            #url = request.route_url('admin', context='main')
            url = request.route_url('admin', resource='main', traverse=[])
            menu.append_new_entry('Admin', url)
        url = request.route_url('logout')
        menu.append_new_entry('Log Out', url)
    else:
        login_url = request.route_url('login')
        menu.append_new_entry('Sign In', login_url)
    return menu
Exemplo n.º 8
0
    def __init__(self, request):
        BaseViewer.__init__(self, request)
        prepare_main_layout(self.request)
        self.clients = ClientManager(self.request.db)
        self.contacts = ContactManager(self.request.db)
        self._dispatch_table = dict(
            list=self.list_clients,
            add=self.add_client,
            delete=self.delete_client,
            confirmdelete=self.confirm_delete_client,
            editclient=self.edit_client,
            viewclient=self.view_client,)
        self.context = self.request.matchdict['context']
        self._view = self.context

        menu = BaseMenu()
        menu.set_header('Actions')
        url = self.url(context='add', id='somebody')
        menu.append_new_entry("Add Client", url)
        self.layout.options_menus = dict(actions=menu)
        
        self.dispatch()
Exemplo n.º 9
0
def prepare_main_data(request):
    layout = request.layout_manager.layout
    layout.main_menu = make_main_menu(request)
    menu = BaseMenu()
    menu.set_header('Image Actions')
    imgroute = 'admin_images'
    url = request.route_url(imgroute, context='list', id=None)
    menu.append_new_entry('List Images', url)
    url = request.route_url(imgroute, context='add', id=None)
    menu.append_new_entry('Add Image', url)
    layout.options_menus = dict(actions=menu)
    layout.title = 'Manage Images'
    layout.header = 'Manage Images' 
Exemplo n.º 10
0
def make_main_menuOrig(request):
    menu = BaseMenu()
    menu.set_header('Admin Menu')
    url = request.route_url('admin_users', context='list', id='all')
    menu.append_new_entry('Manage Users', url)
    url = request.route_url('admin_sitetext', context='list', id=None)
    menu.append_new_entry('Manage Text', url)
    url = request.route_url('admin_images', context='list', id=None)
    menu.append_new_entry('Manage Images', url)
    url = request.route_url('admin_dbadmin', context='main', id='main')
    menu.append_new_entry('Manage Database', url)
    
    url = request.route_url('admin_site_templates',
                            context='list', id='all')
    menu.append_new_entry('Site Templates', url)
    url = request.route_url('admin_sitecontent_mgr',
                            context='listpaths', id='all')
    menu.append_new_entry('Site Content', url)
    return menu
Exemplo n.º 11
0
def make_main_menu(request):
    menu = BaseMenu()
    menu.set_header('Admin Menu')
    #url = request.route_url('admin_users', context='list', id='all')
    url = request.route_url('admin', traverse='users')
    menu.append_new_entry('Manage Users', url)
    url = request.route_url('admin', resource='sitetext', context='list',
                            traverse=[])
    menu.append_new_entry('Manage Text', url)
    url = request.route_url('admin', resource='images', context='list',
                            traverse=[])
    menu.append_new_entry('Manage Images', url)
    url = request.route_url('admin', resource='dbadmin', context='main',
                            traverse=[])
    menu.append_new_entry('Manage Database', url)
    
    url = request.route_url('admin', resource='site_templates',
                            context='list', traverse=[])
    menu.append_new_entry('Site Templates', url)
    url = request.route_url('admin', resource='sitecontent_mgr',
                            context='listpaths', traverse=[])
    menu.append_new_entry('Site Content', url)
    return menu