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 select menu for predifined expiration dates
- add some more hooks - add some more hooks
- add list of currently logged in users in menu - 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 - merged changes from 5.0.12
-------------------------------------------------------------------------------- --------------------------------------------------------------------------------

View File

@ -404,7 +404,7 @@ class SeedDMS_Core_DMS {
static function filterDocumentFiles($user, $files) { /* {{{ */ static function filterDocumentFiles($user, $files) { /* {{{ */
$tmp = array(); $tmp = array();
foreach ($files as $file) 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); array_push($tmp, $file);
return $tmp; 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> <license uri="http://opensource.org/licenses/gpl-license">GPL License</license>
<notes> <notes>
- all changes from 5.0.12 merged - 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> </notes>
</release> </release>
<release> <release>

View File

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

View File

@ -48,6 +48,7 @@ class SeedDMS_ExtExample extends SeedDMS_ExtBase {
function init() { /* {{{ */ function init() { /* {{{ */
$GLOBALS['SEEDDMS_HOOKS']['view']['addDocument'][] = new SeedDMS_ExtExample_AddDocument; $GLOBALS['SEEDDMS_HOOKS']['view']['addDocument'][] = new SeedDMS_ExtExample_AddDocument;
$GLOBALS['SEEDDMS_HOOKS']['view']['viewFolder'][] = new SeedDMS_ExtExample_ViewFolder; $GLOBALS['SEEDDMS_HOOKS']['view']['viewFolder'][] = new SeedDMS_ExtExample_ViewFolder;
$GLOBALS['SEEDDMS_SCHEDULER']['tasks']['example']['example'] = new SeedDMS_ExtExample_Task;
} /* }}} */ } /* }}} */
function main() { /* {{{ */ 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', 'title'=>'Example check box',
'type'=>'checkbox', '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( 'constraints' => array(
'depends' => array('php' => '5.4.4-', 'seeddms' => '4.3.0-'), 'depends' => array('php' => '5.4.4-', 'seeddms' => '4.3.0-'),

View File

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

View File

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

View File

@ -4,7 +4,12 @@ Caution when you update an sqlite database
The database changes for this version will require to change the The database changes for this version will require to change the
definition of various columns. This is not easily possible when using definition of various columns. This is not easily possible when using
sqlite. Therefore, the affected tables are first renamed, than sqlite. Therefore, the affected tables are first renamed, than
new tables with the modified columns are created in the old table new tables with the modified columns are created and the old table
content will be copied into the new table. The old tables will not contents will be copied into the new tables. The old tables will
be removed and are prefixed with '__'. You may manunally remove them be removed afterwards.
once you have successfully checked the update.
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']) { $prefix = 'userfile';
$uuids = explode(';', $_POST['fineuploaderuuids']); if(isset($_POST[$prefix.'-fine-uploader-uuids']) && $_POST[$prefix.'-fine-uploader-uuids']) {
$names = explode(';', $_POST['fineuploadernames']); $uuids = explode(';', $_POST[$prefix.'-fine-uploader-uuids']);
$names = explode(';', $_POST[$prefix.'-fine-uploader-names']);
foreach($uuids as $i=>$uuid) { foreach($uuids as $i=>$uuid) {
$fullfile = $settings->_stagingDir.'/'.utf8_basename($uuid); $fullfile = $settings->_stagingDir.'/'.utf8_basename($uuid);
if(file_exists($fullfile)) { if(file_exists($fullfile)) {

View File

@ -141,17 +141,42 @@ if (($oldcomment = $document->getComment()) != $comment) {
} }
} }
$expires = false; switch($_POST["presetexpdate"]) {
if (!isset($_POST["expires"]) || $_POST["expires"] != "false") { case "date":
if(isset($_POST["expdate"]) && $_POST["expdate"]) {
$tmp = explode('-', $_POST["expdate"]); $tmp = explode('-', $_POST["expdate"]);
$expires = mktime(0,0,0, $tmp[1], $tmp[2], $tmp[0]); $expires = mktime(0,0,0, $tmp[1], $tmp[2], $tmp[0]);
} else { break;
$expires = mktime(0,0,0, $_POST["expmonth"], $_POST["expday"], $_POST["expyear"]); 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 ($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($document->setExpires($expires)) {
if($notifier) { if($notifier) {
$notifyList = $document->getNotifyList(); $notifyList = $document->getNotifyList();
@ -180,16 +205,43 @@ if ($expires != $document->getExpires()) {
} else { } else {
UI::exitError(getMLText("document_title", array("documentname" => $document->getName())),getMLText("error_occured")); 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 (($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)) { if($document->setKeywords($keywords)) {
} }
else { else {
UI::exitError(getMLText("document_title", array("documentname" => $document->getName())),getMLText("error_occured")); 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) { if($categories) {
$categoriesarr = array(); $categoriesarr = array();
foreach($categories as $catid) { foreach($categories as $catid) {
@ -198,23 +250,50 @@ if($categories) {
} }
} }
$oldcategories = $document->getCategories();
$oldcatsids = array(); $oldcatsids = array();
foreach($oldcategories as $oldcategory) foreach($oldcategories as $oldcategory)
$oldcatsids[] = $oldcategory->getID(); $oldcatsids[] = $oldcategory->getID();
if (count($categoriesarr) != count($oldcategories) || if (count($categoriesarr) != count($oldcategories) ||
array_diff($categories, $oldcatsids)) { 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)) { if($document->setCategories($categoriesarr)) {
} else { } else {
UI::exitError(getMLText("document_title", array("documentname" => $document->getName())),getMLText("error_occured")); 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())) { if($document->setCategories(array())) {
} else { } else {
UI::exitError(getMLText("document_title", array("documentname" => $document->getName())),getMLText("error_occured")); 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(); $oldattributes = $document->getAttributes();

View File

@ -85,6 +85,7 @@ if ($action == "saveSettings")
$settings->_enableClipboard = getBoolValue("enableClipboard"); $settings->_enableClipboard = getBoolValue("enableClipboard");
$settings->_enableMenuTasks = getBoolValue("enableMenuTasks"); $settings->_enableMenuTasks = getBoolValue("enableMenuTasks");
$settings->_enableDropUpload = getBoolValue("enableDropUpload"); $settings->_enableDropUpload = getBoolValue("enableDropUpload");
$settings->_enableMultiUpload = getBoolValue("enableMultiUpload");
$settings->_enableFolderTree = getBoolValue("enableFolderTree"); $settings->_enableFolderTree = getBoolValue("enableFolderTree");
$settings->_enableRecursiveCount = getBoolValue("enableRecursiveCount"); $settings->_enableRecursiveCount = getBoolValue("enableRecursiveCount");
$settings->_maxRecursiveCount = intval($_POST["maxRecursiveCount"]); $settings->_maxRecursiveCount = intval($_POST["maxRecursiveCount"]);
@ -206,7 +207,7 @@ if ($action == "saveSettings")
$settings->_converters['fulltext'] = $_POST["converters"]["fulltext"]; $settings->_converters['fulltext'] = $_POST["converters"]["fulltext"];
else else
$settings->_converters['fulltext'] = $_POST["converters"]; $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'])) if($newmimetype && trim($settings->_converters['fulltext']['newcmd']))
$settings->_converters['fulltext'][$newmimetype] = trim($settings->_converters['fulltext']['newcmd']); $settings->_converters['fulltext'][$newmimetype] = trim($settings->_converters['fulltext']['newcmd']);
unset($settings->_converters['fulltext']['newmimetype']); unset($settings->_converters['fulltext']['newmimetype']);

View File

@ -260,7 +260,7 @@ if ($_FILES['userfile']['error'] == 0) {
if(isset($GLOBALS['SEEDDMS_HOOKS']['updateDocument'])) { if(isset($GLOBALS['SEEDDMS_HOOKS']['updateDocument'])) {
foreach($GLOBALS['SEEDDMS_HOOKS']['updateDocument'] as $hookObj) { foreach($GLOBALS['SEEDDMS_HOOKS']['updateDocument'] as $hookObj) {
if (method_exists($hookObj, 'preUpdateDocument')) { 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'])) { if(isset($GLOBALS['SEEDDMS_HOOKS']['updateDocument'])) {
foreach($GLOBALS['SEEDDMS_HOOKS']['updateDocument'] as $hookObj) { foreach($GLOBALS['SEEDDMS_HOOKS']['updateDocument'] as $hookObj) {
if (method_exists($hookObj, 'postUpdateDocument')) { 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('folder', $folder);
$view->setParam('strictformcheck', $settings->_strictFormCheck); $view->setParam('strictformcheck', $settings->_strictFormCheck);
$view->setParam('enablelargefileupload', $settings->_enableLargeFileUpload); $view->setParam('enablelargefileupload', $settings->_enableLargeFileUpload);
$view->setParam('enablemultiupload', $settings->_enableMultiUpload);
$view->setParam('enableadminrevapp', $settings->_enableAdminRevApp); $view->setParam('enableadminrevapp', $settings->_enableAdminRevApp);
$view->setParam('enableownerrevapp', $settings->_enableOwnerRevApp); $view->setParam('enableownerrevapp', $settings->_enableOwnerRevApp);
$view->setParam('enableselfrevapp', $settings->_enableSelfRevApp); $view->setParam('enableselfrevapp', $settings->_enableSelfRevApp);

View File

@ -347,7 +347,7 @@ $(document).ready( function() {
input.trigger('fileselect', [numFiles, label]); 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'), var input = $(this).parents('.input-append').find(':text'),
log = numFiles > 1 ? numFiles + ' files selected' : label; 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']; $partitionsize = $this->params['partitionsize'];
$maxuploadsize = $this->params['maxuploadsize']; $maxuploadsize = $this->params['maxuploadsize'];
$enablelargefileupload = $this->params['enablelargefileupload']; $enablelargefileupload = $this->params['enablelargefileupload'];
$enablemultiupload = $this->params['enablemultiupload'];
header('Content-Type: application/javascript; charset=UTF-8'); header('Content-Type: application/javascript; charset=UTF-8');
if($enablelargefileupload) if($enablelargefileupload) {
$this->printFineUploaderJs('../op/op.UploadChunks.php', $partitionsize, $maxuploadsize); $this->printFineUploaderJs('../op/op.UploadChunks.php', $partitionsize, $maxuploadsize, $enablemultiupload);
}
?> ?>
$(document).ready(function() { $(document).ready(function() {
$('#new-file').click(function(event) { $('#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) { jQuery.validator.addMethod("alternatives", function(value, element, params) {
if(value != '') if(value != '')
return true; return true;
@ -90,7 +93,7 @@ $(document).ready(function() {
if($enablelargefileupload) { if($enablelargefileupload) {
?> ?>
submitHandler: function(form) { submitHandler: function(form) {
manualuploader.uploadStoredFiles(); userfileuploader.uploadStoredFiles();
}, },
<?php <?php
} }
@ -99,8 +102,8 @@ $(document).ready(function() {
<?php <?php
if($enablelargefileupload) { if($enablelargefileupload) {
?> ?>
fineuploaderuuids: { 'userfile-fine-uploader-uuids': {
fineuploader: [ manualuploader, $('#dropfolderfileform1') ] fineuploader: [ userfileuploader, $('#dropfolderfileform1') ]
} }
<?php <?php
} else { } else {
@ -150,6 +153,7 @@ $(document).ready(function() {
$user = $this->params['user']; $user = $this->params['user'];
$folder = $this->params['folder']; $folder = $this->params['folder'];
$enablelargefileupload = $this->params['enablelargefileupload']; $enablelargefileupload = $this->params['enablelargefileupload'];
$enablemultiupload = $this->params['enablemultiupload'];
$enableadminrevapp = $this->params['enableadminrevapp']; $enableadminrevapp = $this->params['enableadminrevapp'];
$enableownerrevapp = $this->params['enableownerrevapp']; $enableownerrevapp = $this->params['enableownerrevapp'];
$enableselfrevapp = $this->params['enableselfrevapp']; $enableselfrevapp = $this->params['enableselfrevapp'];
@ -174,9 +178,6 @@ $(document).ready(function() {
$this->pageNavigation($this->getFolderPathHTML($folder, true), "view_folder", $folder); $this->pageNavigation($this->getFolderPathHTML($folder, true), "view_folder", $folder);
$msg = getMLText("max_upload_size").": ".ini_get( "upload_max_filesize"); $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->warningMsg($msg);
$this->contentHeading(getMLText("add_document")); $this->contentHeading(getMLText("add_document"));
$this->contentContainerStart(); $this->contentContainerStart();
@ -316,21 +317,17 @@ $(document).ready(function() {
<tr> <tr>
<td><?php printMLText("local_file");?>:</td> <td><?php printMLText("local_file");?>:</td>
<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 <?php
if($enablelargefileupload) if($enablelargefileupload)
$this->printFineUploaderHtml(); $this->printFineUploaderHtml();
else { else {
$this->printFileChooser('userfile[]', false); $this->printFileChooser('userfile[]', false);
if($enablemultiupload) {
?> ?>
<a class="" id="new-file"><?php printMLtext("add_multiple_files") ?></a> <a class="" id="new-file"><?php printMLtext("add_multiple_files") ?></a>
<?php <?php
} }
}
?> ?>
</td> </td>
</tr> </tr>
@ -355,7 +352,7 @@ $(document).ready(function() {
$attrdefs = $dms->getAllAttributeDefinitions(array(SeedDMS_Core_AttributeDefinition::objtype_documentcontent, SeedDMS_Core_AttributeDefinition::objtype_all)); $attrdefs = $dms->getAllAttributeDefinitions(array(SeedDMS_Core_AttributeDefinition::objtype_documentcontent, SeedDMS_Core_AttributeDefinition::objtype_all));
if($attrdefs) { if($attrdefs) {
foreach($attrdefs as $attrdef) { foreach($attrdefs as $attrdef) {
$arr = $this->callHook('editDocumentAttribute', null, $attrdef); $arr = $this->callHook('editDocumentContentAttribute', null, $attrdef);
if(is_array($arr)) { if(is_array($arr)) {
echo "<tr>"; echo "<tr>";
echo "<td>".$arr[0].":</td>"; 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') { if($workflowmode == 'advanced') {
?> ?>
<tr> <tr>

View File

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

View File

@ -88,6 +88,12 @@ $(document).ready( function() {
keywords: "<?php printMLText("js_no_keywords");?>" keywords: "<?php printMLText("js_no_keywords");?>"
} }
}); });
$('#presetexpdate').on('change', function(ev){
if($(this).val() == 'date')
$('#control_expdate').show();
else
$('#control_expdate').hide();
});
}); });
<?php <?php
} /* }}} */ } /* }}} */
@ -154,13 +160,23 @@ $(document).ready( function() {
<tr> <tr>
<td><?php printMLText("expires");?>:</td> <td><?php printMLText("expires");?>:</td>
<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"> <select class="span3" name="presetexpdate" id="presetexpdate">
<input class="span3" size="16" name="expdate" type="text" value="<?php echo $expdate; ?>"> <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 class="add-on"><i class="icon-calendar"></i></span>
</span><br /> </span>
<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>
</td> </td>
</tr> </tr>
<?php <?php

View File

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