Merge branch 'seeddms-5.1.x' into seeddms-6.0.x

This commit is contained in:
Uwe Steinmann 2017-05-02 06:47:42 +02:00
commit 3cc572a1cd
19 changed files with 319 additions and 86 deletions

View File

@ -37,6 +37,8 @@
- add select menu for predifined expiration dates
- add some more hooks
- add list of currently logged in users in menu
- the owner of a document can see even none public attachments
- uploading multiple files can be turned off
- merged changes from 5.0.12
--------------------------------------------------------------------------------

View File

@ -404,7 +404,7 @@ class SeedDMS_Core_DMS {
static function filterDocumentFiles($user, $files) { /* {{{ */
$tmp = array();
foreach ($files as $file)
if ($file->isPublic() || ($file->getUser()->getID() == $user->getID()) || $user->isAdmin())
if ($file->isPublic() || ($file->getUser()->getID() == $user->getID()) || $user->isAdmin() || ($file->getDocument()->getOwner()->getID() == $user->getID()))
array_push($tmp, $file);
return $tmp;
} /* }}} */

View File

@ -1424,6 +1424,8 @@ SeedDMS_Core_DMS::getDuplicateDocumentContent() returns complete document
<license uri="http://opensource.org/licenses/gpl-license">GPL License</license>
<notes>
- all changes from 5.0.12 merged
- SeedDMS_Core_DMS::filterDocumentFiles() returns also documents which are not public
if the owner tries to access them
</notes>
</release>
<release>

View File

@ -22,7 +22,7 @@
*/
class SeedDMS_Controller_AddDocument extends SeedDMS_Controller_Common {
public function run() {
public function run() { /* {{{ */
$name = $this->getParam('name');
$comment = $this->getParam('comment');
@ -114,6 +114,6 @@ class SeedDMS_Controller_AddDocument extends SeedDMS_Controller_Common {
}
return $result;
}
} /* }}} */
}

View File

@ -48,6 +48,7 @@ class SeedDMS_ExtExample extends SeedDMS_ExtBase {
function init() { /* {{{ */
$GLOBALS['SEEDDMS_HOOKS']['view']['addDocument'][] = new SeedDMS_ExtExample_AddDocument;
$GLOBALS['SEEDDMS_HOOKS']['view']['viewFolder'][] = new SeedDMS_ExtExample_ViewFolder;
$GLOBALS['SEEDDMS_SCHEDULER']['tasks']['example']['example'] = new SeedDMS_ExtExample_Task;
} /* }}} */
function main() { /* {{{ */
@ -112,4 +113,16 @@ class SeedDMS_ExtExample_ViewFolder {
}
/**
* Class containing methods for running a scheduled task
*
* @author Uwe Steinmann <uwe@steinmann.cx>
* @package SeedDMS
* @subpackage example
*/
class SeedDMS_ExtExample_Task {
public function execute() {
}
}
?>

View File

@ -16,6 +16,37 @@ $EXT_CONF['example'] = array(
'title'=>'Example check box',
'type'=>'checkbox',
),
'list' => array(
'title'=>'Example select menu from options',
'type'=>'select',
'options' => array('Option 1', 'Option 2', 'Option 3'),
'multiple' => true,
'size' => 2,
),
'categories' => array(
'title'=>'Example select menu from categories',
'type'=>'select',
'internal'=>'categories',
'multiple' => true,
),
'users' => array(
'title'=>'Example select menu from users',
'type'=>'select',
'internal'=>'users',
'multiple' => true,
),
'groups' => array(
'title'=>'Example select menu from groups',
'type'=>'select',
'internal'=>'groups',
'multiple' => true,
),
'attributedefinitions' => array(
'title'=>'Example select menu from attribute definitions',
'type'=>'select',
'internal'=>'attributedefinitions',
'multiple' => true,
),
),
'constraints' => array(
'depends' => array('php' => '5.4.4-', 'seeddms' => '4.3.0-'),

View File

@ -74,7 +74,10 @@ class SeedDMS_EmailNotify extends SeedDMS_Notify {
$lang = $recipient->getLanguage();
} elseif(is_string($recipient) && trim($recipient) != "") {
$to = $recipient;
$lang = 'en_GB';
if(isset($params['__lang__']))
$lang = $params['__lang__'];
else
$lang = 'en_GB';
} else {
return false;
}

View File

@ -186,7 +186,7 @@ class Settings { /* {{{ */
var $_logFileEnable = true;
// the log file rotation
var $_logFileRotation = "d";
// Enable file upload by jumploader
// Enable file upload by fine-uploader (was 'jumploader')
var $_enableLargeFileUpload = false;
// size of partitions for file uploaded by fine-loader
var $_partitionSize = 2000000;
@ -208,6 +208,8 @@ class Settings { /* {{{ */
var $_enableSessionList = false;
// enable/disable display of the drop zone for file upload
var $_enableDropUpload = true;
// Enable multiple file upload
var $_enableMultiUpload = false;
// enable/disable display of the folder tree
var $_enableFolderTree = true;
// count documents and folders for folderview recursively
@ -442,6 +444,7 @@ class Settings { /* {{{ */
$this->_enableClipboard = Settings::boolVal($tab["enableClipboard"]);
$this->_enableMenuTasks = Settings::boolVal($tab["enableMenuTasks"]);
$this->_enableDropUpload = Settings::boolVal($tab["enableDropUpload"]);
$this->_enableMultiUpload = Settings::boolVal($tab["enableMultiUpload"]);
$this->_enableFolderTree = Settings::boolVal($tab["enableFolderTree"]);
$this->_enableRecursiveCount = Settings::boolVal($tab["enableRecursiveCount"]);
$this->_maxRecursiveCount = intval($tab["maxRecursiveCount"]);
@ -763,6 +766,7 @@ class Settings { /* {{{ */
$this->setXMLAttributValue($node, "enableClipboard", $this->_enableClipboard);
$this->setXMLAttributValue($node, "enableMenuTasks", $this->_enableMenuTasks);
$this->setXMLAttributValue($node, "enableDropUpload", $this->_enableDropUpload);
$this->setXMLAttributValue($node, "enableMultiUpload", $this->_enableMultiUpload);
$this->setXMLAttributValue($node, "enableFolderTree", $this->_enableFolderTree);
$this->setXMLAttributValue($node, "enableRecursiveCount", $this->_enableRecursiveCount);
$this->setXMLAttributValue($node, "maxRecursiveCount", $this->_maxRecursiveCount);
@ -991,7 +995,7 @@ class Settings { /* {{{ */
$extnodes = $xml->addChild("extensions");
}
foreach($this->_extensions as $name => $extension)
{
{
// search XML node
$extnode = $extnodes->addChild('extension');
$this->setXMLAttributValue($extnode, 'name', $name);

View File

@ -4,7 +4,12 @@ Caution when you update an sqlite database
The database changes for this version will require to change the
definition of various columns. This is not easily possible when using
sqlite. Therefore, the affected tables are first renamed, than
new tables with the modified columns are created in the old table
content will be copied into the new table. The old tables will not
be removed and are prefixed with '__'. You may manunally remove them
once you have successfully checked the update.
new tables with the modified columns are created and the old table
contents will be copied into the new tables. The old tables will
be removed afterwards.
Because sqlite does not support transactions on alter, create and drop
table these changes cannot not be undone in case of an error. Backup
your database before and consider to do the update manually by running
cat install/update-5.1.0/update-sqlite.sql | sqlite data/content.db

View File

@ -292,9 +292,10 @@ if($settings->_dropFolderDir) {
}
}
if(isset($_POST['fineuploaderuuids']) && $_POST['fineuploaderuuids']) {
$uuids = explode(';', $_POST['fineuploaderuuids']);
$names = explode(';', $_POST['fineuploadernames']);
$prefix = 'userfile';
if(isset($_POST[$prefix.'-fine-uploader-uuids']) && $_POST[$prefix.'-fine-uploader-uuids']) {
$uuids = explode(';', $_POST[$prefix.'-fine-uploader-uuids']);
$names = explode(';', $_POST[$prefix.'-fine-uploader-names']);
foreach($uuids as $i=>$uuid) {
$fullfile = $settings->_stagingDir.'/'.utf8_basename($uuid);
if(file_exists($fullfile)) {

View File

@ -141,17 +141,42 @@ if (($oldcomment = $document->getComment()) != $comment) {
}
}
$expires = false;
if (!isset($_POST["expires"]) || $_POST["expires"] != "false") {
if(isset($_POST["expdate"]) && $_POST["expdate"]) {
$tmp = explode('-', $_POST["expdate"]);
$expires = mktime(0,0,0, $tmp[1], $tmp[2], $tmp[0]);
} else {
$expires = mktime(0,0,0, $_POST["expmonth"], $_POST["expday"], $_POST["expyear"]);
}
switch($_POST["presetexpdate"]) {
case "date":
$tmp = explode('-', $_POST["expdate"]);
$expires = mktime(0,0,0, $tmp[1], $tmp[2], $tmp[0]);
break;
case "1w":
$tmp = explode('-', date('Y-m-d'));
$expires = mktime(0,0,0, $tmp[1], $tmp[2]+7, $tmp[0]);
break;
case "1m":
$tmp = explode('-', date('Y-m-d'));
$expires = mktime(0,0,0, $tmp[1]+1, $tmp[2], $tmp[0]);
break;
case "1y":
$tmp = explode('-', date('Y-m-d'));
$expires = mktime(0,0,0, $tmp[1], $tmp[2], $tmp[0]+1);
break;
case "2y":
$tmp = explode('-', date('Y-m-d'));
$expires = mktime(0,0,0, $tmp[1], $tmp[2], $tmp[0]+2);
break;
case "never":
default:
$expires = null;
break;
}
if ($expires != $document->getExpires()) {
if(isset($GLOBALS['SEEDDMS_HOOKS']['editDocument'])) {
foreach($GLOBALS['SEEDDMS_HOOKS']['editDocument'] as $hookObj) {
if (method_exists($hookObj, 'preSetExpires')) {
$hookObj->preSetExpires(null, array('document'=>$document, 'expires'=>&$expires));
}
}
}
if($document->setExpires($expires)) {
if($notifier) {
$notifyList = $document->getNotifyList();
@ -180,16 +205,43 @@ if ($expires != $document->getExpires()) {
} else {
UI::exitError(getMLText("document_title", array("documentname" => $document->getName())),getMLText("error_occured"));
}
$document->verifyLastestContentExpriry();
if(isset($GLOBALS['SEEDDMS_HOOKS']['editDocument'])) {
foreach($GLOBALS['SEEDDMS_HOOKS']['editDocument'] as $hookObj) {
if (method_exists($hookObj, 'postSetExpires')) {
$hookObj->postSetExpires(null, array('document'=>$document, 'expires'=>$expires));
}
}
}
}
if (($oldkeywords = $document->getKeywords()) != $keywords) {
if(isset($GLOBALS['SEEDDMS_HOOKS']['editDocument'])) {
foreach($GLOBALS['SEEDDMS_HOOKS']['editDocument'] as $hookObj) {
if (method_exists($hookObj, 'preSetKeywords')) {
$hookObj->preSetKeywords(null, array('document'=>$document, 'keywords'=>&$keywords, 'oldkeywords'=>&$oldkeywords));
}
}
}
if($document->setKeywords($keywords)) {
}
else {
UI::exitError(getMLText("document_title", array("documentname" => $document->getName())),getMLText("error_occured"));
}
if(isset($GLOBALS['SEEDDMS_HOOKS']['editDocument'])) {
foreach($GLOBALS['SEEDDMS_HOOKS']['editDocument'] as $hookObj) {
if (method_exists($hookObj, 'postSetKeywords')) {
$hookObj->postSetKeywords(null, array('document'=>$document, 'keywords'=>&$keywords, 'oldkeywords'=>&$oldkeywords));
}
}
}
}
$oldcategories = $document->getCategories();
if($categories) {
$categoriesarr = array();
foreach($categories as $catid) {
@ -198,23 +250,50 @@ if($categories) {
}
}
$oldcategories = $document->getCategories();
$oldcatsids = array();
foreach($oldcategories as $oldcategory)
$oldcatsids[] = $oldcategory->getID();
if (count($categoriesarr) != count($oldcategories) ||
array_diff($categories, $oldcatsids)) {
if(isset($GLOBALS['SEEDDMS_HOOKS']['editDocument'])) {
foreach($GLOBALS['SEEDDMS_HOOKS']['editDocument'] as $hookObj) {
if (method_exists($hookObj, 'preSetCategories')) {
$hookObj->preSetCategories(null, array('document'=>$document, 'categories'=>&$categoriesarr, 'oldcategories'=>&$oldcategories));
}
}
}
if($document->setCategories($categoriesarr)) {
} else {
UI::exitError(getMLText("document_title", array("documentname" => $document->getName())),getMLText("error_occured"));
}
if(isset($GLOBALS['SEEDDMS_HOOKS']['editDocument'])) {
foreach($GLOBALS['SEEDDMS_HOOKS']['editDocument'] as $hookObj) {
if (method_exists($hookObj, 'postSetCategories')) {
$hookObj->postSetCategories(null, array('document'=>$document, 'categories'=>&$categoriesarr, 'oldcategories'=>&$oldcategories));
}
}
}
}
} elseif($oldcategories) {
if(isset($GLOBALS['SEEDDMS_HOOKS']['editDocument'])) {
foreach($GLOBALS['SEEDDMS_HOOKS']['editDocument'] as $hookObj) {
if (method_exists($hookObj, 'preSetCategories')) {
$hookObj->preSetCategories(null, array('document'=>$document, 'categories'=>array(), 'oldcategories'=>&$oldcategories));
}
}
}
} else {
if($document->setCategories(array())) {
} else {
UI::exitError(getMLText("document_title", array("documentname" => $document->getName())),getMLText("error_occured"));
}
if(isset($GLOBALS['SEEDDMS_HOOKS']['editDocument'])) {
foreach($GLOBALS['SEEDDMS_HOOKS']['editDocument'] as $hookObj) {
if (method_exists($hookObj, 'postSetCategories')) {
$hookObj->postSetCategories(null, array('document'=>$document, 'categories'=>array(), 'oldcategories'=>&$oldcategories));
}
}
}
}
$oldattributes = $document->getAttributes();

View File

@ -85,6 +85,7 @@ if ($action == "saveSettings")
$settings->_enableClipboard = getBoolValue("enableClipboard");
$settings->_enableMenuTasks = getBoolValue("enableMenuTasks");
$settings->_enableDropUpload = getBoolValue("enableDropUpload");
$settings->_enableMultiUpload = getBoolValue("enableMultiUpload");
$settings->_enableFolderTree = getBoolValue("enableFolderTree");
$settings->_enableRecursiveCount = getBoolValue("enableRecursiveCount");
$settings->_maxRecursiveCount = intval($_POST["maxRecursiveCount"]);
@ -206,7 +207,7 @@ if ($action == "saveSettings")
$settings->_converters['fulltext'] = $_POST["converters"]["fulltext"];
else
$settings->_converters['fulltext'] = $_POST["converters"];
$newmimetype = preg_replace('#[^A-Za-z0-9_/+.-*]+#', '', $settings->_converters["fulltext"]["newmimetype"]);
$newmimetype = preg_replace('#[^A-Za-z0-9_/+.*-]+#', '', $settings->_converters["fulltext"]["newmimetype"]);
if($newmimetype && trim($settings->_converters['fulltext']['newcmd']))
$settings->_converters['fulltext'][$newmimetype] = trim($settings->_converters['fulltext']['newcmd']);
unset($settings->_converters['fulltext']['newmimetype']);

View File

@ -260,7 +260,7 @@ if ($_FILES['userfile']['error'] == 0) {
if(isset($GLOBALS['SEEDDMS_HOOKS']['updateDocument'])) {
foreach($GLOBALS['SEEDDMS_HOOKS']['updateDocument'] as $hookObj) {
if (method_exists($hookObj, 'preUpdateDocument')) {
$hookObj->preUpdateDocument(null, array('name'=>&$name, 'comment'=>&$comment));
$hookObj->preUpdateDocument(null, $document, array('name'=>&$name, 'comment'=>&$comment));
}
}
}
@ -274,7 +274,7 @@ if ($_FILES['userfile']['error'] == 0) {
if(isset($GLOBALS['SEEDDMS_HOOKS']['updateDocument'])) {
foreach($GLOBALS['SEEDDMS_HOOKS']['updateDocument'] as $hookObj) {
if (method_exists($hookObj, 'postUpdateDocument')) {
$hookObj->postUpdateDocument(null, $document);
$hookObj->postUpdateDocument(null, $document, $contentResult->getContent());
}
}
}

View File

@ -73,6 +73,7 @@ if($view) {
$view->setParam('folder', $folder);
$view->setParam('strictformcheck', $settings->_strictFormCheck);
$view->setParam('enablelargefileupload', $settings->_enableLargeFileUpload);
$view->setParam('enablemultiupload', $settings->_enableMultiUpload);
$view->setParam('enableadminrevapp', $settings->_enableAdminRevApp);
$view->setParam('enableownerrevapp', $settings->_enableOwnerRevApp);
$view->setParam('enableselfrevapp', $settings->_enableSelfRevApp);

View File

@ -347,7 +347,7 @@ $(document).ready( function() {
input.trigger('fileselect', [numFiles, label]);
});
$(document).on('fileselect', '#upload-file .btn-file :file', function(event, numFiles, label) {
$(document).on('fileselect', '.upload-file .btn-file :file', function(event, numFiles, label) {
var input = $(this).parents('.input-append').find(':text'),
log = numFiles > 1 ? numFiles + ' files selected' : label;

View File

@ -37,16 +37,19 @@ class SeedDMS_View_AddDocument extends SeedDMS_Bootstrap_Style {
$partitionsize = $this->params['partitionsize'];
$maxuploadsize = $this->params['maxuploadsize'];
$enablelargefileupload = $this->params['enablelargefileupload'];
$enablemultiupload = $this->params['enablemultiupload'];
header('Content-Type: application/javascript; charset=UTF-8');
if($enablelargefileupload)
$this->printFineUploaderJs('../op/op.UploadChunks.php', $partitionsize, $maxuploadsize);
if($enablelargefileupload) {
$this->printFineUploaderJs('../op/op.UploadChunks.php', $partitionsize, $maxuploadsize, $enablemultiupload);
}
?>
$(document).ready(function() {
$('#new-file').click(function(event) {
$("#upload-file").clone().appendTo("#upload-files").removeAttr("id").children('div').children('input').val('');
tttttt = $("#userfile-upload-file").clone().appendTo("#userfile-upload-files").removeAttr("id");
tttttt.children('div').children('input').val('');
tttttt.children('div').children('span').children('input').val('');
});
jQuery.validator.addMethod("alternatives", function(value, element, params) {
if(value != '')
return true;
@ -90,7 +93,7 @@ $(document).ready(function() {
if($enablelargefileupload) {
?>
submitHandler: function(form) {
manualuploader.uploadStoredFiles();
userfileuploader.uploadStoredFiles();
},
<?php
}
@ -99,8 +102,8 @@ $(document).ready(function() {
<?php
if($enablelargefileupload) {
?>
fineuploaderuuids: {
fineuploader: [ manualuploader, $('#dropfolderfileform1') ]
'userfile-fine-uploader-uuids': {
fineuploader: [ userfileuploader, $('#dropfolderfileform1') ]
}
<?php
} else {
@ -150,6 +153,7 @@ $(document).ready(function() {
$user = $this->params['user'];
$folder = $this->params['folder'];
$enablelargefileupload = $this->params['enablelargefileupload'];
$enablemultiupload = $this->params['enablemultiupload'];
$enableadminrevapp = $this->params['enableadminrevapp'];
$enableownerrevapp = $this->params['enableownerrevapp'];
$enableselfrevapp = $this->params['enableselfrevapp'];
@ -174,9 +178,6 @@ $(document).ready(function() {
$this->pageNavigation($this->getFolderPathHTML($folder, true), "view_folder", $folder);
$msg = getMLText("max_upload_size").": ".ini_get( "upload_max_filesize");
if(0 && $enablelargefileupload) {
$msg .= "<p>".sprintf(getMLText('link_alt_updatedocument'), "out.AddMultiDocument.php?folderid=".$folderid."&showtree=".showtree())."</p>";
}
$this->warningMsg($msg);
$this->contentHeading(getMLText("add_document"));
$this->contentContainerStart();
@ -316,20 +317,16 @@ $(document).ready(function() {
<tr>
<td><?php printMLText("local_file");?>:</td>
<td>
<!--
<a href="javascript:addFiles()"><?php printMLtext("add_multiple_files") ?></a>
<ol id="files">
<li><input type="file" name="userfile[]" size="60"></li>
</ol>
-->
<?php
if($enablelargefileupload)
$this->printFineUploaderHtml();
else {
$this->printFileChooser('userfile[]', false);
if($enablemultiupload) {
?>
<a class="" id="new-file"><?php printMLtext("add_multiple_files") ?></a>
<?php
}
}
?>
</td>
@ -355,7 +352,7 @@ $(document).ready(function() {
$attrdefs = $dms->getAllAttributeDefinitions(array(SeedDMS_Core_AttributeDefinition::objtype_documentcontent, SeedDMS_Core_AttributeDefinition::objtype_all));
if($attrdefs) {
foreach($attrdefs as $attrdef) {
$arr = $this->callHook('editDocumentAttribute', null, $attrdef);
$arr = $this->callHook('editDocumentContentAttribute', null, $attrdef);
if(is_array($arr)) {
echo "<tr>";
echo "<td>".$arr[0].":</td>";
@ -371,6 +368,17 @@ $(document).ready(function() {
}
}
}
$arrs = $this->callHook('addDocumentContentAttributes', $folder);
if(is_array($arrs)) {
foreach($arrs as $arr) {
echo "<tr>";
echo "<td>".$arr[0].":</td>";
echo "<td>".$arr[1]."</td>";
echo "</tr>";
}
}
if($workflowmode == 'advanced') {
?>
<tr>

View File

@ -1029,14 +1029,34 @@ background-image: linear-gradient(to bottom, #882222, #111111);;
}
} /* }}} */
function printFileChooser($varname='userfile', $multiple=false, $accept='') { /* {{{ */
?>
<div id="upload-files">
<div id="upload-file">
function getFileChooser($varname='userfile', $multiple=false, $accept='') { /* {{{ */
$id = preg_replace('/[^A-Za-z]/', '', $varname);
$html = '
<div id="'.$id.'-upload-files">
<div id="'.$id.'-upload-file" class="upload-file">
<div class="input-append">
<input type="text" class="form-control" readonly>
<span class="btn btn-default btn-file">
<?php printMLText("browse");?>&hellip; <input id="<?php echo $varname; ?>" type="file" name="<?php echo $varname; ?>"<?php if($multiple) echo " multiple"; ?><?php if($accept) echo " accept=\"".$accept."\""; ?>>
'.getMLText("browse").'&hellip; <input _id="'.$id.'" type="file" name="'.$varname.'"'.($multiple ? " multiple" : "").($accept ? ' accept="'.$accept.'"' : "").'">
</span>
</div>
</div>
</div>
';
return $html;
} /* }}} */
function printFileChooser($varname='userfile', $multiple=false, $accept='') { /* {{{ */
echo $this->getFileChooser($varname, $multiple, $accept);
return;
$id = preg_replace('/[^A-Za-z]/', '', $varname);
?>
<div id="<?php echo $id; ?>-upload-files">
<div id="<?php echo $id; ?>-upload-file" class="upload-file">
<div class="input-append">
<input type="text" class="form-control" readonly>
<span class="btn btn-default btn-file">
<?php printMLText("browse");?>&hellip; <input id="<?php echo $id; ?>" type="file" name="<?php echo $varname; ?>"<?php if($multiple) echo " multiple"; ?><?php if($accept) echo " accept=\"".$accept."\""; ?>>
</span>
</div>
</div>
@ -2560,11 +2580,11 @@ mayscript>
* @param integer $maxfiles maximum number of files allowed to upload
* @param array $fields list of post fields
*/
function printFineUploaderHtml() { /* {{{ */
function printFineUploaderHtml($prefix='userfile') { /* {{{ */
?>
<div id="manual-fine-uploader"></div>
<input type="hidden" class="do_validate" id="fineuploaderuuids" name="fineuploaderuuids" value="" />
<input type="hidden" id="fineuploadernames" name="fineuploadernames" value="" />
<div id="<?php echo $prefix; ?>-fine-uploader"></div>
<input type="hidden" <?php echo ($prefix=='userfile' ? 'class="do_validate"' : ''); ?> id="<?php echo $prefix; ?>-fine-uploader-uuids" name="<?php echo $prefix; ?>-fine-uploader-uuids" value="" />
<input type="hidden" id="<?php echo $prefix; ?>-fine-uploader-names" name="<?php echo $prefix; ?>-fine-uploader-names" value="" />
<?php
} /* }}} */
@ -2576,14 +2596,14 @@ mayscript>
* @param integer $maxfiles maximum number of files allowed to upload
* @param array $fields list of post fields
*/
function printFineUploaderJs($uploadurl, $partsize=0, $maxuploadsize=0, $multiple=true) { /* {{{ */
function printFineUploaderJs($uploadurl, $partsize=0, $maxuploadsize=0, $multiple=true, $prefix='userfile') { /* {{{ */
?>
$(document).ready(function() {
manualuploader = new qq.FineUploader({
<?php echo $prefix; ?>uploader = new qq.FineUploader({
debug: false,
autoUpload: false,
multiple: <?php echo ($multiple ? 'true' : 'false'); ?>,
element: $('#manual-fine-uploader')[0],
element: $('#<?php echo $prefix; ?>-fine-uploader')[0],
template: 'qq-template',
request: {
endpoint: '<?php echo $uploadurl; ?>'
@ -2611,8 +2631,8 @@ $(document).ready(function() {
uuids.push(this.getUuid(succeeded[i]))
names.push(this.getName(succeeded[i]))
}
$('#fineuploaderuuids').val(uuids.join(';'));
$('#fineuploadernames').val(names.join(';'));
$('#<?php echo $prefix; ?>-fine-uploader-uuids').val(uuids.join(';'));
$('#<?php echo $prefix; ?>-fine-uploader-names').val(names.join(';'));
/* Run upload only if all files could be uploaded */
if(succeeded.length > 0 && failed.length == 0)
document.getElementById('form1').submit();

View File

@ -88,6 +88,12 @@ $(document).ready( function() {
keywords: "<?php printMLText("js_no_keywords");?>"
}
});
$('#presetexpdate').on('change', function(ev){
if($(this).val() == 'date')
$('#control_expdate').show();
else
$('#control_expdate').hide();
});
});
<?php
} /* }}} */
@ -154,13 +160,23 @@ $(document).ready( function() {
<tr>
<td><?php printMLText("expires");?>:</td>
<td>
<span class="input-append date span12" id="expirationdate" data-date="<?php echo $expdate; ?>" data-date-format="yyyy-mm-dd" data-date-language="<?php echo str_replace('_', '-', $this->params['session']->getLanguage()); ?>" data-checkbox="#expires">
<input class="span3" size="16" name="expdate" type="text" value="<?php echo $expdate; ?>">
<select class="span3" name="presetexpdate" id="presetexpdate">
<option value="never"><?php printMLText('does_not_expire');?></option>
<option value="date"<?php echo ($expdate != '' ? " selected" : ""); ?>><?php printMLText('expire_by_date');?></option>
<option value="1w"><?php printMLText('expire_in_1w');?></option>
<option value="1m"><?php printMLText('expire_in_1m');?></option>
<option value="1y"><?php printMLText('expire_in_1y');?></option>
<option value="2y"><?php printMLText('expire_in_2y');?></option>
</select>
</td>
</tr>
<tr id="control_expdate" <?php echo (!$expdate ? 'style="display: none;"' : ''); ?>>
<td><?php printMLText("expires");?>:</td>
<td>
<span class="input-append date span6" id="expirationdate" data-date="<?php echo ($expdate ? $expdate : ''); ?>" data-date-format="yyyy-mm-dd" data-date-language="<?php echo str_replace('_', '-', $this->params['session']->getLanguage()); ?>" data-checkbox="#expires">
<input class="span3" size="16" name="expdate" type="text" value="<?php echo ($expdate ? $expdate : ''); ?>">
<span class="add-on"><i class="icon-calendar"></i></span>
</span><br />
<label class="checkbox inline">
<input type="checkbox" id="expires" name="expires" value="false"<?php if (!$document->expires()) print " checked";?>><?php printMLText("does_not_expire");?><br>
</label>
</span>
</td>
</tr>
<?php

View File

@ -280,6 +280,10 @@ if(!is_writeable($settings->_configFilePath)) {
<tr title="<?php printMLText("settings_enableDropUpload_desc");?>">
<td><?php printMLText("settings_enableDropUpload");?>:</td>
<td><input name="enableDropUpload" type="checkbox" <?php if ($settings->_enableDropUpload) echo "checked" ?> /></td>
</tr>
<tr title="<?php printMLText("settings_enableMultiUpload_desc");?>">
<td><?php printMLText("settings_enableMultiUpload");?>:</td>
<td><input name="enableMultiUpload" type="checkbox" <?php if ($settings->_enableMultiUpload) echo "checked" ?> /></td>
</tr>
<tr title="<?php printMLText("settings_enableFolderTree_desc");?>">
<td><?php printMLText("settings_enableFolderTree");?>:</td>
@ -828,30 +832,73 @@ if(!is_writeable($settings->_configFilePath)) {
<input type="checkbox" name="<?php echo "extensions[".$extname."][".$confkey."]"; ?>" value="1" <?php if(isset($settings->_extensions[$extname][$confkey]) && $settings->_extensions[$extname][$confkey]) echo 'checked'; ?> />
<?php
break;
case 'database':
switch($conf['table']) {
case 'users':
if(isset($settings->_extensions[$extname][$confkey]))
$selusers = explode(',', $settings->_extensions[$extname][$confkey]);
else
$selusers = array();
echo '<select class="chzn-select" multiple="multiple" name="extensions['.$extname.']['.$confkey.'][]" data-placeholder="'.getMLText('select_users').'">';
foreach($users as $user) {
echo '<option value="'.$user->getID().'"'.(in_array($user->getID(), $selusers) ? ' selected' : '').'>'.$user->getLogin().'</option>';
case 'select':
if(!empty($conf['options'])) {
$selections = explode(",", $settings->_extensions[$extname][$confkey]);
echo "<select class=\"chzn-select\" name=\"extensions[".$extname."][".$confkey."][]\"".(!empty($conf['multiple']) ? " multiple" : "").(!empty($conf['size']) ? " size=\"".$conf['size']."\"" : "").">";
foreach($conf['options'] as $key=>$opt) {
echo "<option value=\"".$key."\"";
if(in_array($key, $selections))
echo " selected";
echo ">".htmlspecialchars($opt)."</option>";
}
echo '</select>';
break;
case 'groups':
if(isset($settings->_extensions[$extname][$confkey]))
$selgroups = explode(',', $settings->_extensions[$extname][$confkey]);
else
$selgroups = array();
echo '<select class="chzn-select" multiple="multiple" name="extensions['.$extname.']['.$confkey.'][]" data-placeholder="'.getMLText('select_groups').'">';
foreach($groups as $group) {
echo '<option value="'.$group->getID().'"'.(in_array($group->getID(), $selgroups) ? ' selected' : '').'>'.$group->getName().'</option>';
echo "</select>";
} elseif(!empty($conf['internal'])) {
$selections = empty($settings->_extensions[$extname][$confkey]) ? array() : explode(",", $settings->_extensions[$extname][$confkey]);
switch($conf['internal']) {
case "categories":
$categories = $dms->getDocumentCategories();
if($categories) {
echo "<select class=\"chzn-select\" name=\"extensions[".$extname."][".$confkey."][]\"".(!empty($conf['multiple']) ? " multiple" : "").(!empty($conf['size']) ? " size=\"".$conf['size']."\"" : "").">";
foreach($categories as $category) {
echo "<option value=\"".$category->getID()."\"";
if(in_array($category->getID(), $selections))
echo " selected";
echo ">".htmlspecialchars($category->getName())."</option>";
}
echo "</select>";
}
break;
case "users":
$users = $dms->getAllUsers();
if($users) {
echo "<select class=\"chzn-select\" name=\"extensions[".$extname."][".$confkey."][]\"".(!empty($conf['multiple']) ? " multiple" : "").(!empty($conf['size']) ? " size=\"".$conf['size']."\"" : "").">";
foreach($users as $curuser) {
echo "<option value=\"".$curuser->getID()."\"";
if(in_array($curuser->getID(), $selections))
echo " selected";
echo ">".htmlspecialchars($curuser->getLogin()." - ".$curuser->getFullName())."</option>";
}
echo "</select>";
}
break;
case "groups":
$recs = $dms->getAllGroups();
if($recs) {
echo "<select class=\"chzn-select\" name=\"extensions[".$extname."][".$confkey."][]\"".(!empty($conf['multiple']) ? " multiple" : "").(!empty($conf['size']) ? " size=\"".$conf['size']."\"" : "").">";
foreach($recs as $rec) {
echo "<option value=\"".$rec->getID()."\"";
if(in_array($rec->getID(), $selections))
echo " selected";
echo ">".htmlspecialchars($rec->getName())."</option>";
}
echo "</select>";
}
break;
case "attributedefinitions":
$recs = $dms->getAllAttributeDefinitions();
if($recs) {
echo "<select class=\"chzn-select\" name=\"extensions[".$extname."][".$confkey."][]\"".(!empty($conf['multiple']) ? " multiple" : "").(!empty($conf['size']) ? " size=\"".$conf['size']."\"" : "").">";
foreach($recs as $rec) {
echo "<option value=\"".$rec->getID()."\"";
if(in_array($rec->getID(), $selections))
echo " selected";
echo ">".htmlspecialchars($rec->getName())."</option>";
}
echo "</select>";
}
break;
}
echo '</select>';
break;
}
break;
default: