App settings
This commit is contained in:
parent
243c6c56d2
commit
0d6d3a5d22
30
ajax/settings.php
Normal file
30
ajax/settings.php
Normal file
@ -0,0 +1,30 @@
|
||||
<?php
|
||||
|
||||
/**
|
||||
* ownCloud - Office App
|
||||
*
|
||||
* @author Victor Dubiniuk
|
||||
* @copyright 2013 Victor Dubiniuk victor.dubiniuk@gmail.com
|
||||
*
|
||||
* This file is licensed under the Affero General Public License version 3 or
|
||||
* later.
|
||||
*/
|
||||
|
||||
namespace OCA\Office;
|
||||
|
||||
\OCP\JSON::callCheck();
|
||||
|
||||
$unstable = isset($_POST['unstable']) ? $_POST['unstable'] : null;
|
||||
if (!is_null($unstable)){
|
||||
\OCP\JSON::checkAdminUser();
|
||||
\OCP\Config::setAppValue('office', 'unstable', $unstable);
|
||||
\OCP\JSON::success();
|
||||
exit();
|
||||
}
|
||||
|
||||
if (isset($_GET['unstable'])){
|
||||
\OCP\JSON::success(array(
|
||||
'value' => \OCP\Config::getAppValue('office', 'unstable', 'false')
|
||||
));
|
||||
}
|
||||
exit();
|
@ -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')
|
||||
|
@ -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;
|
||||
}
|
15
js/office.js
15
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);
|
||||
});
|
||||
|
16
js/settings.js
Normal file
16
js/settings.js
Normal file
@ -0,0 +1,16 @@
|
||||
$(document).ready(function(){
|
||||
$('#appsettings_popup').wrap('<div id="office-appsettings"></div>');
|
||||
|
||||
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);
|
||||
});
|
17
settings.php
Normal file
17
settings.php
Normal file
@ -0,0 +1,17 @@
|
||||
<?php
|
||||
|
||||
/**
|
||||
* ownCloud - Office App
|
||||
*
|
||||
* @author Victor Dubiniuk
|
||||
* @copyright 2013 Victor Dubiniuk victor.dubiniuk@gmail.com
|
||||
*
|
||||
* This file is licensed under the Affero General Public License version 3 or
|
||||
* later.
|
||||
*/
|
||||
|
||||
namespace OCA\Office;
|
||||
|
||||
$tmpl = new \OCP\Template('office', 'settings');
|
||||
$tmpl->assign('unstable', false);
|
||||
$tmpl->printPage();
|
@ -1,4 +1,12 @@
|
||||
<?php $isAdmin = \OC_User::isAdminUser(\OCP\User::getUser()); ?>
|
||||
<div id="controls">
|
||||
|
||||
<?php if ($isAdmin){ ?>
|
||||
<?php $src = OCP\Util::imagePath('core', 'actions/settings.png'); ?>
|
||||
<button id="settingsbtn" class="office-settings-btn" title="<?php p($l->t('Settings')); ?>">
|
||||
<img class="svg" src="<?php print_unescaped($src); ?>" alt="<?php p($l->t('Settings')); ?>" />
|
||||
</button>
|
||||
<?php } ?>
|
||||
<div id="invite-block" style="display:none">
|
||||
<input id="inivite-input" type="text" />
|
||||
<ul id="invitee-list"></ul>
|
||||
@ -33,3 +41,6 @@
|
||||
</div>
|
||||
<?php } ?>
|
||||
</div>
|
||||
<?php if ($isAdmin){ ?>
|
||||
<div id="appsettings" class="popup hidden topright"></div>
|
||||
<?php } ?>
|
10
templates/settings.php
Normal file
10
templates/settings.php
Normal file
@ -0,0 +1,10 @@
|
||||
<ul>
|
||||
<li>
|
||||
<input id="webodf-unstable" type ="checkbox"
|
||||
<?php if (\OCP\Config::getAppValue('office', 'unstable', 'false') === 'true'){?>
|
||||
checked="checked"
|
||||
<?php } ?>
|
||||
value="<?php p($_['unstable']); ?>" />
|
||||
<label for="webodf-unstable"><?php p($l->t('Unstable WebODF Features')); ?></label>
|
||||
</li>
|
||||
</ul>
|
Loading…
x
Reference in New Issue
Block a user