annotate src/browser/sat_browser/constants.py @ 980:bcacf970f970

core (pages redirection): inverted redirection + getSubPageURL: - page redirection now also work in other redirection meaning that if "/redirecting_url" => "/page_name/arg_1/arg_2" is used, a getURL(page_name, arg_1, arg_2) will return the redirecting_url. query_args are not handled yet by getURL. - page redirection dict now use path_args and query_args insteand of args and kwargs, which show the relation with URL. - new getSubPageURL return absolute URL to a subpage, which is more solid than relative URL and allows to use it in sub-hierarchy.
author Goffi <goffi@goffi.org>
date Tue, 14 Nov 2017 08:35:17 +0100
parents fd4eae654182
children f2170536ba23
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
449
981ed669d3b3 /!\ reorganize all the file hierarchy, move the code and launching script to src:
souliane <souliane@mailoo.org>
parents:
diff changeset
1 #!/usr/bin/python
981ed669d3b3 /!\ reorganize all the file hierarchy, move the code and launching script to src:
souliane <souliane@mailoo.org>
parents:
diff changeset
2 # -*- coding: utf-8 -*-
981ed669d3b3 /!\ reorganize all the file hierarchy, move the code and launching script to src:
souliane <souliane@mailoo.org>
parents:
diff changeset
3
981ed669d3b3 /!\ reorganize all the file hierarchy, move the code and launching script to src:
souliane <souliane@mailoo.org>
parents:
diff changeset
4 # Libervia: a SAT frontend
964
fd4eae654182 misc: date update (yes it's a bit late :p )
Goffi <goffi@goffi.org>
parents: 818
diff changeset
5 # Copyright (C) 2009-2017 Jérôme Poisson (goffi@goffi.org)
449
981ed669d3b3 /!\ reorganize all the file hierarchy, move the code and launching script to src:
souliane <souliane@mailoo.org>
parents:
diff changeset
6
981ed669d3b3 /!\ reorganize all the file hierarchy, move the code and launching script to src:
souliane <souliane@mailoo.org>
parents:
diff changeset
7 # This program is free software: you can redistribute it and/or modify
981ed669d3b3 /!\ reorganize all the file hierarchy, move the code and launching script to src:
souliane <souliane@mailoo.org>
parents:
diff changeset
8 # it under the terms of the GNU Affero General Public License as published by
981ed669d3b3 /!\ reorganize all the file hierarchy, move the code and launching script to src:
souliane <souliane@mailoo.org>
parents:
diff changeset
9 # the Free Software Foundation, either version 3 of the License, or
981ed669d3b3 /!\ reorganize all the file hierarchy, move the code and launching script to src:
souliane <souliane@mailoo.org>
parents:
diff changeset
10 # (at your option) any later version.
981ed669d3b3 /!\ reorganize all the file hierarchy, move the code and launching script to src:
souliane <souliane@mailoo.org>
parents:
diff changeset
11
981ed669d3b3 /!\ reorganize all the file hierarchy, move the code and launching script to src:
souliane <souliane@mailoo.org>
parents:
diff changeset
12 # This program is distributed in the hope that it will be useful,
981ed669d3b3 /!\ reorganize all the file hierarchy, move the code and launching script to src:
souliane <souliane@mailoo.org>
parents:
diff changeset
13 # but WITHOUT ANY WARRANTY; without even the implied warranty of
981ed669d3b3 /!\ reorganize all the file hierarchy, move the code and launching script to src:
souliane <souliane@mailoo.org>
parents:
diff changeset
14 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
981ed669d3b3 /!\ reorganize all the file hierarchy, move the code and launching script to src:
souliane <souliane@mailoo.org>
parents:
diff changeset
15 # GNU Affero General Public License for more details.
981ed669d3b3 /!\ reorganize all the file hierarchy, move the code and launching script to src:
souliane <souliane@mailoo.org>
parents:
diff changeset
16
981ed669d3b3 /!\ reorganize all the file hierarchy, move the code and launching script to src:
souliane <souliane@mailoo.org>
parents:
diff changeset
17 # You should have received a copy of the GNU Affero General Public License
981ed669d3b3 /!\ reorganize all the file hierarchy, move the code and launching script to src:
souliane <souliane@mailoo.org>
parents:
diff changeset
18 # along with this program. If not, see <http://www.gnu.org/licenses/>.
981ed669d3b3 /!\ reorganize all the file hierarchy, move the code and launching script to src:
souliane <souliane@mailoo.org>
parents:
diff changeset
19
462
07433bd892ee server and browser sides: fixes UI parameters initialisation with user values + small refactoring
souliane <souliane@mailoo.org>
parents: 449
diff changeset
20 from libervia.common.constants import Const as C
07433bd892ee server and browser sides: fixes UI parameters initialisation with user values + small refactoring
souliane <souliane@mailoo.org>
parents: 449
diff changeset
21
07433bd892ee server and browser sides: fixes UI parameters initialisation with user values + small refactoring
souliane <souliane@mailoo.org>
parents: 449
diff changeset
22
07433bd892ee server and browser sides: fixes UI parameters initialisation with user values + small refactoring
souliane <souliane@mailoo.org>
parents: 449
diff changeset
23 # Auxiliary functions
07433bd892ee server and browser sides: fixes UI parameters initialisation with user values + small refactoring
souliane <souliane@mailoo.org>
parents: 449
diff changeset
24 param_to_bool = lambda value: value == 'true'
449
981ed669d3b3 /!\ reorganize all the file hierarchy, move the code and launching script to src:
souliane <souliane@mailoo.org>
parents:
diff changeset
25
981ed669d3b3 /!\ reorganize all the file hierarchy, move the code and launching script to src:
souliane <souliane@mailoo.org>
parents:
diff changeset
26
462
07433bd892ee server and browser sides: fixes UI parameters initialisation with user values + small refactoring
souliane <souliane@mailoo.org>
parents: 449
diff changeset
27 class Const(C):
449
981ed669d3b3 /!\ reorganize all the file hierarchy, move the code and launching script to src:
souliane <souliane@mailoo.org>
parents:
diff changeset
28 """Add here the constants that are only used by the browser side."""
462
07433bd892ee server and browser sides: fixes UI parameters initialisation with user values + small refactoring
souliane <souliane@mailoo.org>
parents: 449
diff changeset
29
478
992b900ab876 browser side: rename and refactor constant UI_PARAMS to CACHED_PARAMS, from a dict of dict to a list of 2-tuple
souliane <souliane@mailoo.org>
parents: 477
diff changeset
30 # Cached parameters, e.g those that have an incidence on UI display/refresh:
462
07433bd892ee server and browser sides: fixes UI parameters initialisation with user values + small refactoring
souliane <souliane@mailoo.org>
parents: 449
diff changeset
31 # - they can be any parameter (not necessarily specific to Libervia)
478
992b900ab876 browser side: rename and refactor constant UI_PARAMS to CACHED_PARAMS, from a dict of dict to a list of 2-tuple
souliane <souliane@mailoo.org>
parents: 477
diff changeset
32 # - list them as a couple (category, name)
696
c2f22ca12e23 browser and server side: remove unibox
souliane <souliane@mailoo.org>
parents: 685
diff changeset
33 CACHED_PARAMS = [('General', C.SHOW_OFFLINE_CONTACTS),
567
ee9c7bd266ad browser_side: implements "Show offline contacts" and "Show empty groups" parameters
souliane <souliane@mailoo.org>
parents: 483
diff changeset
34 ('General', C.SHOW_EMPTY_GROUPS),
ee9c7bd266ad browser_side: implements "Show offline contacts" and "Show empty groups" parameters
souliane <souliane@mailoo.org>
parents: 483
diff changeset
35 ]
477
fac8e8bc9a1a browser side: changed default avatar
souliane <souliane@mailoo.org>
parents: 467
diff changeset
36
589
a5019e62c3e9 browser side: big refactoring to base Libervia on QuickFrontend, first draft:
Goffi <goffi@goffi.org>
parents: 567
diff changeset
37 WEB_PANEL_DEFAULT_URL = "http://salut-a-toi.org"
612
5983d6be4f07 browser side (web panel): schemes are now checked, if no scheme is given (or a not accepted one), http:// is used
Goffi <goffi@goffi.org>
parents: 606
diff changeset
38 WEB_PANEL_SCHEMES = {'http', 'https', 'ftp', 'file'}
660
267761bf7f08 browser side (contact list): ContactPanels is used instead of OccupantsList in MUC:
Goffi <goffi@goffi.org>
parents: 612
diff changeset
39
267761bf7f08 browser side (contact list): ContactPanels is used instead of OccupantsList in MUC:
Goffi <goffi@goffi.org>
parents: 612
diff changeset
40 CONTACT_DEFAULT_DISPLAY=('bare', 'nick')