Compare commits
2 Commits
main
...
wip/72817-
Author | SHA1 | Date |
---|---|---|
Frédéric Péters | f5be3e100b | |
Frédéric Péters | 90ffd83192 |
|
@ -4,8 +4,6 @@ from wcs.qommon import _
|
|||
from wcs.qommon.publisher import get_publisher_class, get_request
|
||||
from wcs.qommon.misc import get_cfg
|
||||
|
||||
from modules import backoffice
|
||||
from modules import categories_admin
|
||||
from modules import formpage
|
||||
from modules import template
|
||||
from modules import root
|
||||
|
@ -14,17 +12,3 @@ from modules import connectors
|
|||
|
||||
get_publisher_class().register_translation_domain('auquotidien')
|
||||
get_publisher_class().default_configuration_path = 'au-quotidien-wcs-settings.xml'
|
||||
|
||||
rdb = get_publisher_class().backoffice_directory_class
|
||||
|
||||
rdb.items = []
|
||||
|
||||
import wcs.admin.forms
|
||||
|
||||
wcs.admin.forms.FormsDirectory.categories = categories_admin.CategoriesDirectory()
|
||||
|
||||
import wcs.categories
|
||||
|
||||
if ('homepage_position', 'str') not in wcs.categories.Category.XML_NODES:
|
||||
wcs.categories.Category.XML_NODES.append(('homepage_position', 'str'))
|
||||
wcs.categories.Category.XML_NODES.append(('limit', 'int'))
|
||||
|
|
|
@ -1,34 +0,0 @@
|
|||
import os
|
||||
|
||||
from quixote import get_publisher, redirect
|
||||
from quixote.directory import Directory
|
||||
from quixote.html import TemplateIO, htmltext
|
||||
|
||||
from wcs.qommon import _
|
||||
from wcs.qommon.publisher import get_publisher_class
|
||||
|
||||
import wcs.backoffice.management
|
||||
import wcs.root
|
||||
from wcs.categories import Category
|
||||
from wcs.formdef import FormDef
|
||||
|
||||
from wcs.qommon import get_cfg, errors
|
||||
from wcs.qommon.form import *
|
||||
|
||||
CURRENT_USER = object()
|
||||
|
||||
|
||||
class BackofficeRootDirectory(wcs.backoffice.root.RootDirectory):
|
||||
def get_intro_text(self):
|
||||
return _('Welcome on Publik back office interface')
|
||||
|
||||
def _q_index(self):
|
||||
if len(self.get_menu_items()) == 1:
|
||||
return redirect(self.get_menu_items()[0]['url'])
|
||||
return wcs.backoffice.root.RootDirectory._q_index(self)
|
||||
|
||||
def home(self):
|
||||
return redirect('management/')
|
||||
|
||||
|
||||
get_publisher_class().backoffice_directory_class = BackofficeRootDirectory
|
|
@ -1,73 +0,0 @@
|
|||
# w.c.s. - web application for online forms
|
||||
# Copyright (C) 2005-2010 Entr'ouvert
|
||||
#
|
||||
# This program is free software; you can redistribute it and/or modify
|
||||
# it under the terms of the GNU General Public License as published by
|
||||
# the Free Software Foundation; either version 2 of the License, or
|
||||
# (at your option) any later version.
|
||||
#
|
||||
# This program is distributed in the hope that it will be useful,
|
||||
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
# GNU General Public License for more details.
|
||||
#
|
||||
# You should have received a copy of the GNU General Public License
|
||||
# along with this program; if not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
from quixote import redirect
|
||||
from quixote.directory import Directory
|
||||
from quixote.html import TemplateIO, htmltext
|
||||
|
||||
from wcs.qommon import _, N_
|
||||
from wcs.qommon import misc
|
||||
from wcs.categories import Category
|
||||
from wcs.qommon.form import *
|
||||
from wcs.qommon.backoffice.menu import html_top
|
||||
from wcs.qommon.admin.menu import command_icon, error_page
|
||||
import wcs.admin.categories
|
||||
|
||||
|
||||
class CategoryUI(wcs.admin.categories.CategoryUI):
|
||||
def get_form(self, **kwargs):
|
||||
form = super().get_form(**kwargs)
|
||||
homepage_redirect_url = get_cfg('misc', {}).get('homepage-redirect-url')
|
||||
if not homepage_redirect_url:
|
||||
form.add(
|
||||
SingleSelectWidget,
|
||||
'homepage_position',
|
||||
title=_('Position on homepage'),
|
||||
value=self.category.get_homepage_position(),
|
||||
options=[
|
||||
('1st', _('First Column')),
|
||||
('2nd', _('Second Column')),
|
||||
('side', _('Sidebar')),
|
||||
('none', _('None')),
|
||||
],
|
||||
)
|
||||
form.add(
|
||||
IntWidget,
|
||||
'limit',
|
||||
title=_('Limit number of items displayed on homepage'),
|
||||
value=self.category.get_limit(),
|
||||
)
|
||||
return form
|
||||
|
||||
def submit_form(self, form):
|
||||
super().submit_form(form)
|
||||
|
||||
homepage_redirect_url = get_cfg('misc', {}).get('homepage-redirect-url')
|
||||
if not homepage_redirect_url:
|
||||
self.category.homepage_position = form.get_widget('homepage_position').parse()
|
||||
self.category.limit = form.get_widget('limit').parse()
|
||||
|
||||
self.category.store()
|
||||
|
||||
|
||||
class CategoryPage(wcs.admin.categories.CategoryPage):
|
||||
category_ui_class = CategoryUI
|
||||
|
||||
|
||||
class CategoriesDirectory(wcs.admin.categories.CategoriesDirectory):
|
||||
label = N_('Categories')
|
||||
category_ui_class = CategoryUI
|
||||
category_page_class = CategoryPage
|
Reference in New Issue