From 0d6d3a5d22c7081ee0f981089f79d9bc58d60b0e Mon Sep 17 00:00:00 2001 From: Victor Dubiniuk Date: Sun, 18 Aug 2013 12:54:57 +0300 Subject: [PATCH] App settings --- ajax/settings.php | 30 ++++++++++++++++++++++++++++++ appinfo/routes.php | 5 +++++ css/style.css | 16 ++++++++++++++-- js/office.js | 15 +++++++++++++++ js/settings.js | 16 ++++++++++++++++ settings.php | 17 +++++++++++++++++ templates/documents.php | 11 +++++++++++ templates/settings.php | 10 ++++++++++ 8 files changed, 118 insertions(+), 2 deletions(-) create mode 100644 ajax/settings.php create mode 100644 js/settings.js create mode 100644 settings.php create mode 100644 templates/settings.php diff --git a/ajax/settings.php b/ajax/settings.php new file mode 100644 index 00000000..05206184 --- /dev/null +++ b/ajax/settings.php @@ -0,0 +1,30 @@ + \OCP\Config::getAppValue('office', 'unstable', 'false') + )); +} +exit(); \ No newline at end of file diff --git a/appinfo/routes.php b/appinfo/routes.php index 8df3bf0e..58fdb2c8 100644 --- a/appinfo/routes.php +++ b/appinfo/routes.php @@ -36,6 +36,11 @@ $this->create('office_session_list', 'ajax/session/list') ->action('\OCA\Office\Controller', 'listSessions') ; +$this->create('office_session_for', 'ajax/session/listFor') + ->post() + ->action('\OCA\Office\Controller', 'listSessions') +; + $this->create('office_session_listhtml', 'ajax/session/listHtml') ->get() ->action('\OCA\Office\Controller', 'listSessionsHtml') diff --git a/css/style.css b/css/style.css index 1b8006a8..5bcc4673 100755 --- a/css/style.css +++ b/css/style.css @@ -56,8 +56,20 @@ float:left; background: url('%webroot%/core/img/actions/delete.svg') 0 50% no-repeat; } - - #mainContainer{ position:absolute; +} + +#office-appsettings #appsettings_popup{ + right:0; +} + +.office-settings-btn{ + position:fixed; + right:1.5em; +} + +.claro .office-settings-btn, +.claro #office-appsettings{ + display:none; } \ No newline at end of file diff --git a/js/office.js b/js/office.js index b4ecf122..65d31bb1 100644 --- a/js/office.js +++ b/js/office.js @@ -1,5 +1,6 @@ /*globals $,OC,fileDownloadPath,t,document,odf,webodfEditor,alert,require,dojo,runtime */ var officeMain = { + useUnstable : false, onStartup: function() { "use strict"; OC.addScript('office', 'webodf_bootstrap', function() { @@ -140,6 +141,12 @@ var officeMain = { $(document).ready(function() { "use strict"; + + $.get(OC.filePath('office', 'ajax', 'settings.php'), {unstable:''}, function(response){ + if (response && response.value){ + officeMain.useUnstable = response.value; + } + }); $('.documentslist tr').click(function(event) { event.preventDefault(); officeMain.startSession($(this).attr('data-file')); @@ -187,5 +194,13 @@ $(document).ready(function() { } }); + $('#settingsbtn').on('click keydown', function() { + try { + OC.appSettings({appid:'office', loadJS:true, cache:false}); + } catch(e) { + console.log(e); + } + }); + OC.addScript('office', 'dojo-amalgamation', officeMain.onStartup); }); diff --git a/js/settings.js b/js/settings.js new file mode 100644 index 00000000..483e70b4 --- /dev/null +++ b/js/settings.js @@ -0,0 +1,16 @@ +$(document).ready(function(){ + $('#appsettings_popup').wrap('
'); + + var officeSettings = { + save : function() { + var data = { + unstable : $('#webodf-unstable').attr('checked')==="checked" + }; + $.post(OC.filePath('office', 'ajax', 'settings.php'), data, officeSettings.afterSave); + }, + afterSave : function(){ + officeMain.useUnstable = $('#webodf-unstable').attr('checked')==="checked" + } + }; + $('#webodf-unstable').change(officeSettings.save); +}); \ No newline at end of file diff --git a/settings.php b/settings.php new file mode 100644 index 00000000..6fdbdca2 --- /dev/null +++ b/settings.php @@ -0,0 +1,17 @@ +assign('unstable', false); +$tmpl->printPage(); diff --git a/templates/documents.php b/templates/documents.php index 2f0627be..0515ab67 100755 --- a/templates/documents.php +++ b/templates/documents.php @@ -1,4 +1,12 @@ +
+ + + + +
+ + + \ No newline at end of file diff --git a/templates/settings.php b/templates/settings.php new file mode 100644 index 00000000..d0bdc63d --- /dev/null +++ b/templates/settings.php @@ -0,0 +1,10 @@ + \ No newline at end of file