diff --git a/modules/installed/apps/apps.py b/modules/installed/apps/apps.py index 2706110ce..efb99ea1a 100644 --- a/modules/installed/apps/apps.py +++ b/modules/installed/apps/apps.py @@ -3,7 +3,6 @@ from gettext import gettext as _ from modules.auth import require from plugin_mount import PagePlugin from forms import Form -from privilegedactions import privilegedaction_run import cfg class Apps(PagePlugin): @@ -12,7 +11,6 @@ class Apps(PagePlugin): self.register_page("apps") self.menu = cfg.main_menu.add_item("Apps", "icon-download-alt", "/apps", 80) self.menu.add_item("Photo Gallery", "icon-picture", "/apps/photos", 35) - self.menu.add_item("Owncloud", "icon-picture", "/apps/owncloud", 35) @cherrypy.expose def index(self): @@ -38,46 +36,3 @@ photos local, backed up, easily accessed and free from the whims of some other websites business model.

""") - @cherrypy.expose - @require() - def owncloud(self, submitted=False, **kwargs): - checkedinfo = { - 'enable' : False, - } - - if submitted: - opts = [] - for k in kwargs.keys(): - if 'on' == kwargs[k]: - shortk = k.split("owncloud_").pop() - checkedinfo[shortk] = True - - for key in checkedinfo.keys(): - if checkedinfo[key]: - opts.append(key) - else: - opts.append('no'+key) - privilegedaction_run("owncloud-setup", opts) - - output, error = privilegedaction_run("owncloud-setup", ['status']) - if error: - raise Exception("something is wrong: " + error) - for option in output.split(): - checkedinfo[option] = True - - main=""" -""" - form = Form(title="Configuration", - action=cfg.server_dir + "/apps/owncloud", - name="configure_owncloud", - message='') - form.checkbox(_("Enable Owncloud"), name="owncloud_enable", id="owncloud_enable", checked=checkedinfo['enable']) - form.hidden(name="submitted", value="True") - form.html(_("

When enabled, the owncloud installation will be available from /owncloud/ on the web server.

")) - form.submit(_("Update setup")) - main += form.render() - sidebar_right=""" -Owncloud

gives you universal access to your files through a web interface or WebDAV. It also provides a platform to easily view & sync your contacts, calendars and bookmarks across all your devices and enables basic editing right on the web. Installation has minimal server requirements, doesn't need special permissions and is quick. ownCloud is extendable via a simple but powerful API for applications and plugins. -

-""" - return self.fill_template(title="Owncloud", main=main, sidebar_right=sidebar_right) diff --git a/modules/installed/apps/owncloud.py b/modules/installed/apps/owncloud.py new file mode 100644 index 000000000..a7a0ffe8a --- /dev/null +++ b/modules/installed/apps/owncloud.py @@ -0,0 +1,60 @@ +import cherrypy +from gettext import gettext as _ +from modules.auth import require +from plugin_mount import PagePlugin +from forms import Form +from privilegedactions import privilegedaction_run +import cfg + +class Owncloud(PagePlugin): + order = 90 + + def __init__(self, *args, **kwargs): + PagePlugin.__init__(self, *args, **kwargs) + self.register_page("apps.owncloud") + cfg.html_root.apps.menu.add_item("Owncloud", "icon-picture", "/apps/owncloud", 35) + + @cherrypy.expose + @require() + def index(self, submitted=False, **kwargs): + checkedinfo = { + 'enable' : False, + } + + if submitted: + opts = [] + for k in kwargs.keys(): + if 'on' == kwargs[k]: + shortk = k.split("owncloud_").pop() + checkedinfo[shortk] = True + + for key in checkedinfo.keys(): + if checkedinfo[key]: + opts.append(key) + else: + opts.append('no'+key) + privilegedaction_run("owncloud-setup", opts) + + output, error = privilegedaction_run("owncloud-setup", ['status']) + if error: + raise Exception("something is wrong: " + error) + for option in output.split(): + checkedinfo[option] = True + + main=""" +""" + form = Form(title="Configuration", + action=cfg.server_dir + "/apps/owncloud", + name="configure_owncloud", + message='') + form.checkbox(_("Enable Owncloud"), name="owncloud_enable", id="owncloud_enable", checked=checkedinfo['enable']) + form.hidden(name="submitted", value="True") + form.html(_("

When enabled, the owncloud installation will be available from /owncloud/ on the web server.

")) + form.submit(_("Update setup")) + main += form.render() + sidebar_right=""" +Owncloud

gives you universal access to your files through a web interface or WebDAV. It also provides a platform to easily view & sync your contacts, calendars and bookmarks across all your devices and enables basic editing right on the web. Installation has minimal server requirements, doesn't need special permissions and is quick. ownCloud is extendable via a simple but powerful API for applications and plugins. +

+""" + return self.fill_template(title="Owncloud", main=main, sidebar_right=sidebar_right) + diff --git a/modules/owncloud.py b/modules/owncloud.py new file mode 120000 index 000000000..4ae17c8be --- /dev/null +++ b/modules/owncloud.py @@ -0,0 +1 @@ +installed/apps/owncloud.py \ No newline at end of file