Default documents dir for upload. Ref #49
parent
1aced0433c
commit
ad8c163436
@ -0,0 +1,38 @@
|
||||
<?php
|
||||
|
||||
/**
|
||||
* ownCloud - Documents 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\Documents;
|
||||
|
||||
\OCP\JSON::callCheck();
|
||||
\OCP\JSON::checkLoggedIn();
|
||||
|
||||
$savePath = isset($_POST['savePath']) ? $_POST['savePath'] : null;
|
||||
if (!is_null($savePath)){
|
||||
if (\OC\Files\Filesystem::file_exists($savePath) ===false ){
|
||||
if(!\OC\Files\Filesystem::mkdir($savePath)){
|
||||
\OCP\JSON::error(
|
||||
array(
|
||||
'data' => array('message'=>'')
|
||||
)
|
||||
);
|
||||
}
|
||||
}
|
||||
\OCP\Config::setUserValue(\OCP\User::getUser(), 'documents', 'save_path', $savePath);
|
||||
\OCP\JSON::success(
|
||||
array(
|
||||
'data' => array('message'=>'')
|
||||
)
|
||||
);
|
||||
exit();
|
||||
}
|
||||
|
||||
exit();
|
@ -0,0 +1,15 @@
|
||||
$(document).ready(function(){
|
||||
var documentsSettings = {
|
||||
save : function() {
|
||||
var data = {
|
||||
savePath : $('#documents-default-path').val()
|
||||
};
|
||||
OC.msg.startSaving('#documents-personal .msg');
|
||||
$.post(OC.filePath('documents', 'ajax', 'personal.php'), data, documentsSettings.afterSave);
|
||||
},
|
||||
afterSave : function(data){
|
||||
OC.msg.finishedSaving('#documents-personal .msg', data);
|
||||
}
|
||||
};
|
||||
$('#documents-default-path').blur(documentsSettings.save);
|
||||
});
|
@ -0,0 +1,21 @@
|
||||
<?php
|
||||
|
||||
/**
|
||||
* ownCloud - Documents 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\Documents;
|
||||
|
||||
\OCP\Util::addScript('documents', 'personal');
|
||||
|
||||
$tmpl = new \OCP\Template('documents', 'personal');
|
||||
$savePath = \OCP\Config::getUserValue(\OCP\User::getUser(), 'documents', 'save_path', '/');
|
||||
$tmpl->assign('savePath', $savePath);
|
||||
|
||||
return $tmpl->fetchPage();
|
@ -0,0 +1,7 @@
|
||||
<fieldset class="personalblock" id="documents-personal">
|
||||
<legend><strong><?php p($l->t('Documents')); ?></strong></legend>
|
||||
<div>
|
||||
<label for="documents-default-path"><strong><?php p($l->t('Save new documents to')) ?></strong></label>
|
||||
<input type="text" id="documents-default-path" value="<?php p($_['savePath']) ?>" /><span class="msg"></span>
|
||||
</div>
|
||||
</fieldset>
|
Loading…
Reference in New Issue