diff --git a/SABnzbd.py b/SABnzbd.py
index e8670da..036acd8 100755
--- a/SABnzbd.py
+++ b/SABnzbd.py
@@ -321,7 +321,8 @@ def Web_Template(key, defweb, wdir):
wdir = ''
if not wdir:
wdir = defweb
- key.set(wdir)
+ if key:
+ key.set(wdir)
if not wdir:
# No default value defined, accept empty path
return ''
@@ -331,6 +332,10 @@ def Web_Template(key, defweb, wdir):
logging.info("Web dir is %s", full_dir)
if not os.path.exists(full_main):
+ # Temporarily fix that allows missing Config
+ if defweb == DEF_STDCONFIG:
+ return ''
+ # end temp fix
logging.warning(Ta('Cannot find web template: %s, trying standard template'), full_main)
full_dir = real_path(sabnzbd.DIR_INTERFACES, DEF_STDINTF)
full_main = real_path(full_dir, DEF_MAIN_TMPL)
@@ -360,12 +365,14 @@ def fix_webname(name):
xname = name.title()
else:
xname = ''
- if xname in ('Default',):
+ if xname in ('Default', ):
return 'Classic'
elif xname in ('Classic', 'Plush', 'Mobile'):
return xname
elif xname in ('Smpl', 'Wizard'):
return name.lower()
+ elif xname in ('Config',):
+ return 'Plush'
else:
return name
@@ -1267,12 +1274,14 @@ def main():
web_dir = Web_Template(sabnzbd.cfg.web_dir, DEF_STDINTF, fix_webname(web_dir))
web_dir2 = Web_Template(sabnzbd.cfg.web_dir2, '', fix_webname(web_dir2))
+ web_dirc = Web_Template(None, DEF_STDCONFIG, '')
wizard_dir = os.path.join(sabnzbd.DIR_INTERFACES, 'wizard')
#sabnzbd.lang.install_language(os.path.join(wizard_dir, DEF_INT_LANGUAGE), sabnzbd.cfg.language(), 'wizard')
sabnzbd.WEB_DIR = web_dir
sabnzbd.WEB_DIR2 = web_dir2
+ sabnzbd.WEB_DIRC = web_dirc
sabnzbd.WIZARD_DIR = wizard_dir
sabnzbd.WEB_COLOR = CheckColor(sabnzbd.cfg.web_color(), web_dir)
@@ -1386,6 +1395,8 @@ def main():
static = {'tools.staticdir.on': True, 'tools.staticdir.dir': os.path.join(web_dir, 'static')}
+ if web_dirc:
+ staticcfg = {'tools.staticdir.on': True, 'tools.staticdir.dir': os.path.join(web_dirc, 'staticcfg')}
wizard_static = {'tools.staticdir.on': True, 'tools.staticdir.dir': os.path.join(wizard_dir, 'static')}
appconfig = {'/sabnzbd/api' : {'tools.basic_auth.on' : False},
@@ -1400,6 +1411,9 @@ def main():
'/sabnzbd/wizard/static': wizard_static,
'/wizard/static': wizard_static
}
+ if web_dirc:
+ appconfig['/sabnzbd/staticcfg'] = staticcfg
+ appconfig['/staticcfg'] = staticcfg
if web_dir2:
static2 = {'tools.staticdir.on': True, 'tools.staticdir.dir': os.path.join(web_dir2, 'static')}
@@ -1410,8 +1424,11 @@ def main():
appconfig['/m/static'] = static2
appconfig['/sabnzbd/m/wizard/static'] = wizard_static
appconfig['/m/wizard/static'] = wizard_static
+ if web_dirc:
+ appconfig['/sabnzbd/m/staticcfg'] = staticcfg
+ appconfig['/m/staticcfg'] = staticcfg
- login_page = sabnzbd.interface.MainPage(web_dir, '/', web_dir2, '/m/', first=2)
+ login_page = sabnzbd.interface.MainPage(web_dir, '/', web_dir2, '/m/', web_dirc, first=2)
cherrypy.tree.mount(login_page, '/', config=appconfig)
# Set authentication for CherryPy
diff --git a/interfaces/smpl/templates/main.tmpl b/interfaces/smpl/templates/main.tmpl
index 7d06cad..478b96a 100644
--- a/interfaces/smpl/templates/main.tmpl
+++ b/interfaces/smpl/templates/main.tmpl
@@ -1121,16 +1121,21 @@ function loadingJSON(){
$T('smpl-dualView2')
$T('menu-config')
$T('menu-cons')
$T('smpl-warnings')($have_warnings)
diff --git a/sabnzbd/__init__.py b/sabnzbd/__init__.py
index f69f8cb..6ca27cc 100644
--- a/sabnzbd/__init__.py
+++ b/sabnzbd/__init__.py
@@ -119,6 +119,7 @@ CMDLINE = '' # Rendering of original command line arguments
WEB_DIR = None
WEB_DIR2 = None
+WEB_DIRC = None
WIZARD_DIR = None
WEB_COLOR = None
WEB_COLOR2 = None
diff --git a/sabnzbd/api.py b/sabnzbd/api.py
index 95fddd5..839cf39 100644
--- a/sabnzbd/api.py
+++ b/sabnzbd/api.py
@@ -961,7 +961,7 @@ def handle_cat_api(output, kwargs):
#------------------------------------------------------------------------------
-def build_queue(web_dir=None, root=None, verbose=False, prim=True, verbose_list=None,
+def build_queue(web_dir=None, root=None, verbose=False, prim=True, webdir='', verbose_list=None,
dictionary=None, history=False, start=None, limit=None, dummy2=None, trans=False, output=None):
if output:
converter = unicoder
@@ -975,7 +975,7 @@ def build_queue(web_dir=None, root=None, verbose=False, prim=True, verbose_list=
else:
dictn = []
#build up header full of basic information
- info, pnfo_list, bytespersec = build_header(prim)
+ info, pnfo_list, bytespersec = build_header(prim, webdir)
info['isverbose'] = verbose
cookie = cherrypy.request.cookie
if cookie.has_key('queue_details'):
@@ -1473,7 +1473,7 @@ def check_trans():
global _SKIN_CACHE
return bool(_SKIN_CACHE)
-def build_header(prim):
+def build_header(prim, webdir=''):
try:
uptime = calc_age(sabnzbd.START)
except:
@@ -1504,10 +1504,7 @@ def build_header(prim):
header['have_warnings'] = str(sabnzbd.GUIHANDLER.count())
header['last_warning'] = sabnzbd.GUIHANDLER.last().replace('WARNING', Ta('WARNING:')).replace('ERROR', Ta('ERROR:'))
header['active_lang'] = cfg.language()
- if prim:
- header['webdir'] = sabnzbd.WEB_DIR
- else:
- header['webdir'] = sabnzbd.WEB_DIR2
+ header['webdir'] = webdir
header['finishaction'] = sabnzbd.QUEUECOMPLETE
header['nt'] = sabnzbd.WIN32
@@ -1515,6 +1512,7 @@ def build_header(prim):
header['power_options'] = sabnzbd.WIN32 or sabnzbd.DARWIN or sabnzbd.LINUX_POWER
header['session'] = cfg.api_key()
+ header['uniconfig'] = cfg.uniconfig() and sabnzbd.WEB_DIRC
bytespersec = BPSMeter.do.get_bps()
qnfo = NzbQueue.do.queue_info()
diff --git a/sabnzbd/cfg.py b/sabnzbd/cfg.py
index e8384a8..905c7a9 100644
--- a/sabnzbd/cfg.py
+++ b/sabnzbd/cfg.py
@@ -230,6 +230,7 @@ quota_period = OptionStr('misc', 'quota_period', 'm')
osx_menu = OptionBool('misc', 'osx_menu', True)
osx_speed = OptionBool('misc', 'osx_speed', True)
win_menu = OptionBool('misc', 'win_menu', True)
+uniconfig = OptionBool('misc', 'uniconfig', False)
#------------------------------------------------------------------------------
# Set root folders for Folder config-items
diff --git a/sabnzbd/constants.py b/sabnzbd/constants.py
index 8ff94b5..a9006cb 100644
--- a/sabnzbd/constants.py
+++ b/sabnzbd/constants.py
@@ -82,6 +82,7 @@ DEF_LANGUAGE = 'locale'
DEF_INTERFACES = 'interfaces'
DEF_INT_LANGUAGE = 'locale'
DEF_EMAIL_TMPL = 'email'
+DEF_STDCONFIG = 'Config'
DEF_STDINTF = 'Plush'
DEF_SKIN_COLORS = {'smpl':'white', 'classic':'darkblue', 'mobile':'light', 'plush' : 'gold'}
DEF_MAIN_TMPL = 'templates/main.tmpl'
diff --git a/sabnzbd/interface.py b/sabnzbd/interface.py
index 102763b..d452525 100644
--- a/sabnzbd/interface.py
+++ b/sabnzbd/interface.py
@@ -226,18 +226,23 @@ class NoPage(object):
class MainPage(object):
- def __init__(self, web_dir, root, web_dir2=None, root2=None, prim=True, first=0):
+ def __init__(self, web_dir, root, web_dir2=None, root2=None, web_dirc=None, prim=True, first=0):
self.__root = root
self.__web_dir = web_dir
self.__prim = prim
if first >= 1 and web_dir2:
- self.m = MainPage(web_dir2, root2, prim=False)
+ # Setup addresses for secondary skin
+ self.m = MainPage(web_dir2, root2, web_dirc=web_dirc, prim=False)
if first == 2:
- self.sabnzbd = MainPage(web_dir, '/sabnzbd/', web_dir2, '/sabnzbd/m/', prim=True, first=1)
+ # Setup addresses with /sabnzbd prefix for primary and secondary skin
+ self.sabnzbd = MainPage(web_dir, '/sabnzbd/', web_dir2, '/sabnzbd/m/', web_dirc=web_dirc, prim=True, first=1)
self.queue = QueuePage(web_dir, root+'queue/', prim)
self.history = HistoryPage(web_dir, root+'history/', prim)
self.status = Status(web_dir, root+'status/', prim)
- self.config = ConfigPage(web_dir, root+'config/', prim)
+ if cfg.uniconfig() and web_dirc:
+ self.config = ConfigPage(web_dirc, root+'config/', prim)
+ else:
+ self.config = ConfigPage(web_dir, root+'config/', prim)
self.nzb = NzoPage(web_dir, root+'nzb/', prim)
self.wizard = sabnzbd.wizard.Wizard(web_dir, root+'wizard/', prim)
@@ -250,7 +255,7 @@ class MainPage(object):
return panic_old_queue()
if kwargs.get('skip_wizard') or config.get_servers():
- info, pnfo_list, bytespersec = build_header(self.__prim)
+ info, pnfo_list, bytespersec = build_header(self.__prim, self.__web_dir)
if cfg.newzbin_username() and cfg.newzbin_password.get_stars():
info['newzbinDetails'] = True
@@ -453,7 +458,7 @@ class NzoPage(object):
# /nzb/SABnzbd_nzo_xxxxx/bulk_operation
# /nzb/SABnzbd_nzo_xxxxx/save
- info, pnfo_list, bytespersec = build_header(self.__prim)
+ info, pnfo_list, bytespersec = build_header(self.__prim, self.__web_dir)
nzo_id = None
for a in args:
@@ -626,7 +631,7 @@ class QueuePage(object):
dummy2 = kwargs.get('dummy2')
info, pnfo_list, bytespersec, self.__verbose_list, self.__dict__ = build_queue(self.__web_dir, self.__root, self.__verbose,\
- self.__prim, self.__verbose_list, self.__dict__, start=start, limit=limit, dummy2=dummy2, trans=True)
+ self.__prim, self.__web_dir, self.__verbose_list, self.__dict__, start=start, limit=limit, dummy2=dummy2, trans=True)
template = Template(file=os.path.join(self.__web_dir, 'queue.tmpl'),
filter=FILTER, searchList=[info], compilerSettings=DIRECTIVES)
@@ -844,7 +849,7 @@ class HistoryPage(object):
if failed_only is None:
failed_only = self.__failed_only
- history, pnfo_list, bytespersec = build_header(self.__prim)
+ history, pnfo_list, bytespersec = build_header(self.__prim, self.__web_dir)
history['isverbose'] = self.__verbose
history['failed_only'] = failed_only
@@ -1001,7 +1006,7 @@ class ConfigPage(object):
@cherrypy.expose
def index(self, **kwargs):
- conf, pnfo_list, bytespersec = build_header(self.__prim)
+ conf, pnfo_list, bytespersec = build_header(self.__prim, self.__web_dir)
conf['configfn'] = config.get_filename()
conf['cmdline'] = sabnzbd.CMDLINE
@@ -1085,7 +1090,7 @@ class ConfigFolders(object):
if cfg.configlock():
return Protected()
- conf, pnfo_list, bytespersec = build_header(self.__prim)
+ conf, pnfo_list, bytespersec = build_header(self.__prim, self.__web_dir)
for kw in LIST_DIRPAGE:
conf[kw] = config.get_config('misc', kw)()
@@ -1144,7 +1149,7 @@ class ConfigSwitches(object):
if cfg.configlock():
return Protected()
- conf, pnfo_list, bytespersec = build_header(self.__prim)
+ conf, pnfo_list, bytespersec = build_header(self.__prim, self.__web_dir)
conf['nt'] = sabnzbd.WIN32
conf['have_nice'] = bool(sabnzbd.newsunpack.NICE_COMMAND)
@@ -1182,7 +1187,7 @@ SPECIAL_BOOL_LIST = \
( 'no_penalties', 'ignore_wrong_unrar', 'create_group_folders',
'queue_complete_pers', 'api_warnings', 'allow_64bit_tools',
'never_repair', 'allow_streaming', 'ignore_unrar_dates', 'rss_filenames',
- 'osx_menu', 'osx_speed', 'win_menu',
+ 'osx_menu', 'osx_speed', 'win_menu', 'uniconfig'
)
SPECIAL_VALUE_LIST = \
( 'size_limit', 'folder_max_length', 'fsys_type', 'movie_rename_limit'
@@ -1199,7 +1204,7 @@ class ConfigSpecial(object):
if cfg.configlock():
return Protected()
- conf, pnfo_list, bytespersec = build_header(self.__prim)
+ conf, pnfo_list, bytespersec = build_header(self.__prim, self.__web_dir)
conf['nt'] = sabnzbd.WIN32
@@ -1267,7 +1272,7 @@ class ConfigGeneral(object):
if cfg.configlock():
return Protected()
- conf, pnfo_list, bytespersec = build_header(self.__prim)
+ conf, pnfo_list, bytespersec = build_header(self.__prim, self.__web_dir)
conf['configfn'] = config.get_filename()
@@ -1442,7 +1447,7 @@ class ConfigServer(object):
if cfg.configlock():
return Protected()
- conf, pnfo_list, bytespersec = build_header(self.__prim)
+ conf, pnfo_list, bytespersec = build_header(self.__prim, self.__web_dir)
new = {}
servers = config.get_servers()
@@ -1580,7 +1585,7 @@ class ConfigRss(object):
if cfg.configlock():
return Protected()
- conf, pnfo_list, bytespersec = build_header(self.__prim)
+ conf, pnfo_list, bytespersec = build_header(self.__prim, self.__web_dir)
conf['script_list'] = list_scripts(default=True)
pick_script = conf['script_list'] != []
@@ -1875,7 +1880,7 @@ class ConfigScheduling(object):
if cfg.configlock():
return Protected()
- conf, pnfo_list, bytespersec = build_header(self.__prim)
+ conf, pnfo_list, bytespersec = build_header(self.__prim, self.__web_dir)
actions = []
actions.extend(_SCHED_ACTIONS)
@@ -1995,7 +2000,7 @@ class ConfigIndexers(object):
if cfg.configlock():
return Protected()
- conf, pnfo_list, bytespersec = build_header(self.__prim)
+ conf, pnfo_list, bytespersec = build_header(self.__prim, self.__web_dir)
conf['username_newzbin'] = cfg.newzbin_username()
conf['password_newzbin'] = cfg.newzbin_password.get_stars()
@@ -2078,7 +2083,7 @@ class ConfigCats(object):
if cfg.configlock():
return Protected()
- conf, pnfo_list, bytespersec = build_header(self.__prim)
+ conf, pnfo_list, bytespersec = build_header(self.__prim, self.__web_dir)
if cfg.newzbin_username() and cfg.newzbin_password():
conf['newzbinDetails'] = True
@@ -2152,7 +2157,7 @@ class ConfigSorting(object):
if cfg.configlock():
return Protected()
- conf, pnfo_list, bytespersec = build_header(self.__prim)
+ conf, pnfo_list, bytespersec = build_header(self.__prim, self.__web_dir)
conf['complete_dir'] = cfg.complete_dir.get_path()
for kw in SORT_LIST:
@@ -2202,7 +2207,7 @@ class Status(object):
@cherrypy.expose
def index(self, **kwargs):
- header, pnfo_list, bytespersec = build_header(self.__prim)
+ header, pnfo_list, bytespersec = build_header(self.__prim, self.__web_dir)
header['logfile'] = sabnzbd.LOGFILE
header['weblogfile'] = sabnzbd.WEBLOGFILE
@@ -2554,7 +2559,7 @@ class ConfigNotify(object):
if cfg.configlock():
return Protected()
- conf, pnfo_list, bytespersec = build_header(self.__prim)
+ conf, pnfo_list, bytespersec = build_header(self.__prim, self.__web_dir)
conf['my_home'] = sabnzbd.DIR_HOME
conf['my_lcldata'] = sabnzbd.DIR_LCLDATA