mirror of
https://git.code.sf.net/p/seeddms/code
synced 2024-11-26 15:32:13 +00:00
Merge branch 'seeddms-5.1.x' into seeddms-6.0.x
This commit is contained in:
commit
0b22b8d657
|
@ -52,7 +52,7 @@ class SeedDMS_Controller_EditDocument extends SeedDMS_Controller_Common {
|
|||
$expires = $this->params['expires'];
|
||||
$oldexpires = $document->getExpires();
|
||||
if ($expires != $oldexpires) {
|
||||
if(!$this->callHook('preSetExpires', $document, $expires)) {
|
||||
if(false === $this->callHook('preSetExpires', $document, $expires)) {
|
||||
}
|
||||
|
||||
if(!$document->setExpires($expires)) {
|
||||
|
@ -61,21 +61,21 @@ class SeedDMS_Controller_EditDocument extends SeedDMS_Controller_Common {
|
|||
|
||||
$document->verifyLastestContentExpriry();
|
||||
|
||||
if(!$this->callHook('postSetExpires', $document, $expires)) {
|
||||
if(false === $this->callHook('postSetExpires', $document, $expires)) {
|
||||
}
|
||||
}
|
||||
|
||||
$keywords = $this->params['keywords'];
|
||||
$oldkeywords = $document->getKeywords();
|
||||
if ($oldkeywords != $keywords) {
|
||||
if(!$this->callHook('preSetKeywords', $document, $keywords, $oldkeywords)) {
|
||||
if(false === $this->callHook('preSetKeywords', $document, $keywords, $oldkeywords)) {
|
||||
}
|
||||
|
||||
if(!$document->setKeywords($keywords)) {
|
||||
return false;
|
||||
}
|
||||
|
||||
if(!$this->callHook('postSetKeywords', $document, $keywords, $oldkeywords)) {
|
||||
if(false === $this->callHook('postSetKeywords', $document, $keywords, $oldkeywords)) {
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -95,21 +95,21 @@ class SeedDMS_Controller_EditDocument extends SeedDMS_Controller_Common {
|
|||
|
||||
if (count($categoriesarr) != count($oldcategories) ||
|
||||
array_diff($categories, $oldcatsids)) {
|
||||
if(!$this->callHook('preSetCategories', $document, $categoriesarr, $oldcategories)) {
|
||||
if(false === $this->callHook('preSetCategories', $document, $categoriesarr, $oldcategories)) {
|
||||
}
|
||||
if(!$document->setCategories($categoriesarr)) {
|
||||
return false;
|
||||
}
|
||||
if(!$this->callHook('postSetCategories', $document, $categoriesarr, $oldcategories)) {
|
||||
if(false === $this->callHook('postSetCategories', $document, $categoriesarr, $oldcategories)) {
|
||||
}
|
||||
}
|
||||
} elseif($oldcategories) {
|
||||
if(!$this->callHook('preSetCategories', $document, array(), $oldcategories)) {
|
||||
if(false === $this->callHook('preSetCategories', $document, array(), $oldcategories)) {
|
||||
}
|
||||
if(!$document->setCategories(array())) {
|
||||
return false;
|
||||
}
|
||||
if(!$this->callHook('postSetCategories', $document, array(), $oldcategories)) {
|
||||
if(false === $this->callHook('postSetCategories', $document, array(), $oldcategories)) {
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -180,7 +180,7 @@ class SeedDMS_Controller_EditDocument extends SeedDMS_Controller_Common {
|
|||
return false;
|
||||
}
|
||||
|
||||
if(!$this->callHook('postEditDocument')) {
|
||||
if(false === $this->callHook('postEditDocument')) {
|
||||
}
|
||||
|
||||
return true;
|
||||
|
|
|
@ -108,7 +108,7 @@ class SeedDMS_Controller_EditFolder extends SeedDMS_Controller_Common {
|
|||
return false;
|
||||
}
|
||||
|
||||
if(!$this->callHook('postEditFolder')) {
|
||||
if(false === $this->callHook('postEditFolder')) {
|
||||
}
|
||||
|
||||
return true;
|
||||
|
|
|
@ -68,7 +68,7 @@ class SeedDMS_Controller_EmptyFolder extends SeedDMS_Controller_Common {
|
|||
return false;
|
||||
}
|
||||
|
||||
if(!$this->callHook('postEmptyFolder')) {
|
||||
if(false === $this->callHook('postEmptyFolder')) {
|
||||
}
|
||||
|
||||
return true;
|
||||
|
|
|
@ -68,7 +68,7 @@ class SeedDMS_Controller_RemoveDocument extends SeedDMS_Controller_Common {
|
|||
}
|
||||
}
|
||||
|
||||
if(!$this->callHook('postRemoveDocument')) {
|
||||
if(false === $this->callHook('postRemoveDocument')) {
|
||||
}
|
||||
|
||||
return true;
|
||||
|
|
|
@ -91,7 +91,7 @@ class SeedDMS_Controller_RemoveFolder extends SeedDMS_Controller_Common {
|
|||
return false;
|
||||
}
|
||||
|
||||
if(!$this->callHook('postRemoveFolder')) {
|
||||
if(false === $this->callHook('postRemoveFolder')) {
|
||||
}
|
||||
|
||||
return true;
|
||||
|
|
|
@ -42,7 +42,7 @@ class SeedDMS_Controller_TransferDocument extends SeedDMS_Controller_Common {
|
|||
if (!$document->transferToUser($newuser)) {
|
||||
return false;
|
||||
} else {
|
||||
if(!$this->callHook('postTransferDocument')) {
|
||||
if(false === $this->callHook('postTransferDocument')) {
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -105,7 +105,7 @@ class SeedDMS_Controller_UpdateDocument extends SeedDMS_Controller_Common {
|
|||
}
|
||||
}
|
||||
|
||||
if(!$this->callHook('postUpdateDocument', $document, $content)) {
|
||||
if(false === $this->callHook('postUpdateDocument', $document, $content)) {
|
||||
}
|
||||
|
||||
return $content;
|
||||
|
|
|
@ -158,6 +158,5 @@ if($settings->_enable2FactorAuthentication && $settings->_guestID != $user->getI
|
|||
/* Update cookie lifetime */
|
||||
if($settings->_cookieLifetime) {
|
||||
$lifetime = time() + intval($settings->_cookieLifetime);
|
||||
/* Turn off http only cookies if jumploader is enabled */
|
||||
setcookie("mydms_session", $dms_session, $lifetime, $settings->_httpRoot, null, null, !$settings->_enableLargeFileUpload);
|
||||
setcookie("mydms_session", $dms_session, $lifetime, $settings->_httpRoot, null, false, true);
|
||||
}
|
||||
|
|
|
@ -231,6 +231,7 @@ class SeedDMS_Controller_Common {
|
|||
*/
|
||||
function callHook($hook) { /* {{{ */
|
||||
$tmps = $this->getHookClassNames();
|
||||
$ret = null;
|
||||
foreach($tmps as $tmp)
|
||||
if(isset($GLOBALS['SEEDDMS_HOOKS']['controller'][lcfirst($tmp)])) {
|
||||
$this->lasthookresult = null;
|
||||
|
@ -238,29 +239,35 @@ class SeedDMS_Controller_Common {
|
|||
if (method_exists($hookObj, $hook)) {
|
||||
switch(func_num_args()) {
|
||||
case 4:
|
||||
$result = $hookObj->$hook($this, func_get_arg(1), func_get_arg(2), func_get_arg(3));
|
||||
$tmpret = $hookObj->$hook($this, func_get_arg(1), func_get_arg(2), func_get_arg(3));
|
||||
break;
|
||||
case 3:
|
||||
$result = $hookObj->$hook($this, func_get_arg(1), func_get_arg(2));
|
||||
$tmpret = $hookObj->$hook($this, func_get_arg(1), func_get_arg(2));
|
||||
break;
|
||||
case 2:
|
||||
$result = $hookObj->$hook($this, func_get_arg(1));
|
||||
$tmpret = $hookObj->$hook($this, func_get_arg(1));
|
||||
break;
|
||||
case 1:
|
||||
default:
|
||||
$result = $hookObj->$hook($this);
|
||||
$tmpret = $hookObj->$hook($this);
|
||||
}
|
||||
if($result === false) {
|
||||
return $result;
|
||||
if($tmpret === false) {
|
||||
return $tmpret;
|
||||
}
|
||||
if($result !== null) {
|
||||
$this->lasthookresult = $result;
|
||||
if($tmpret !== null) {
|
||||
$this->lasthookresult = $tmpret;
|
||||
if(is_string($tmpret)) {
|
||||
$ret = ($ret === null) ? $tmpret : (is_string($ret) ? $ret.$tmpret : array_merge($ret, array($tmpret)));
|
||||
} elseif(is_array($tmpret)) { // || is_object($tmpret)) {
|
||||
$ret = ($ret === null) ? $tmpret : (is_string($ret) ? array_merge(array($ret), $tmpret) : array_merge($ret, $tmpret));
|
||||
} else
|
||||
$ret = $tmpret;
|
||||
}
|
||||
}
|
||||
}
|
||||
return $this->lasthookresult;
|
||||
// return $this->lasthookresult;
|
||||
}
|
||||
return null;
|
||||
return $ret;
|
||||
} /* }}} */
|
||||
|
||||
/**
|
||||
|
@ -273,13 +280,15 @@ class SeedDMS_Controller_Common {
|
|||
*/
|
||||
function hasHook($hook) { /* {{{ */
|
||||
$tmps = $this->getHookClassNames();
|
||||
if(isset($GLOBALS['SEEDDMS_HOOKS']['controller'][lcfirst($tmp[2])])) {
|
||||
foreach($GLOBALS['SEEDDMS_HOOKS']['controller'][lcfirst($tmp[2])] as $hookObj) {
|
||||
foreach($tmps as $tmp) {
|
||||
if(isset($GLOBALS['SEEDDMS_HOOKS']['controller'][lcfirst($tmp)])) {
|
||||
foreach($GLOBALS['SEEDDMS_HOOKS']['controller'][lcfirst($tmp)] as $hookObj) {
|
||||
if (method_exists($hookObj, $hook)) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
return false;
|
||||
} /* }}} */
|
||||
|
||||
|
|
|
@ -291,25 +291,43 @@ if (isset($_POST["grpIndRecipients"])) {
|
|||
}
|
||||
}
|
||||
|
||||
$docsource = 'upload';
|
||||
function reArrayFiles(&$file_post) {
|
||||
$file_ary = array();
|
||||
$file_count = count($file_post['name']);
|
||||
$file_keys = array_keys($file_post);
|
||||
|
||||
for ($i=0; $i<$file_count; $i++) {
|
||||
if($file_post['error'][$i] != 4) { // no file uploaded
|
||||
foreach ($file_keys as $key) {
|
||||
$file_ary[$i][$key] = $file_post[$key][$i];
|
||||
}
|
||||
$file_ary[$i]['source'] = 'upload';
|
||||
}
|
||||
}
|
||||
|
||||
return $file_ary;
|
||||
}
|
||||
|
||||
if ($_FILES['userfile']) {
|
||||
$file_ary = reArrayFiles($_FILES['userfile']);
|
||||
} else {
|
||||
$file_ary = array();
|
||||
}
|
||||
|
||||
if($settings->_dropFolderDir) {
|
||||
if(isset($_POST["dropfolderfileadddocform"]) && $_POST["dropfolderfileadddocform"]) {
|
||||
$fullfile = $settings->_dropFolderDir.'/'.$user->getLogin().'/'.$_POST["dropfolderfileadddocform"];
|
||||
if(file_exists($fullfile)) {
|
||||
$docsource = 'dropfolder';
|
||||
/* Check if a local file is uploaded as well */
|
||||
if(isset($_FILES["userfile"]['error'][0])) {
|
||||
if($_FILES["userfile"]['error'][0] != 0)
|
||||
$_FILES["userfile"] = array();
|
||||
}
|
||||
$finfo = finfo_open(FILEINFO_MIME_TYPE);
|
||||
$mimetype = finfo_file($finfo, $fullfile);
|
||||
$_FILES["userfile"]['tmp_name'][] = $fullfile;
|
||||
$_FILES["userfile"]['type'][] = $mimetype;
|
||||
$_FILES["userfile"]['name'][] = $_POST["dropfolderfileadddocform"];
|
||||
$_FILES["userfile"]['size'][] = filesize($fullfile);
|
||||
$_FILES["userfile"]['error'][] = 0;
|
||||
$file_ary[] = array(
|
||||
'tmp_name' => $fullfile,
|
||||
'type' => $mimetype,
|
||||
'name' => $_POST["dropfolderfileadddocform"],
|
||||
'size' => filesize($fullfile),
|
||||
'error' => 0,
|
||||
'source' => 'dropfolder'
|
||||
);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -323,11 +341,14 @@ if(isset($_POST[$prefix.'-fine-uploader-uuids']) && $_POST[$prefix.'-fine-upload
|
|||
if(file_exists($fullfile)) {
|
||||
$finfo = finfo_open(FILEINFO_MIME_TYPE);
|
||||
$mimetype = finfo_file($finfo, $fullfile);
|
||||
$_FILES["userfile"]['tmp_name'][] = $fullfile;
|
||||
$_FILES["userfile"]['type'][] = $mimetype;
|
||||
$_FILES["userfile"]['name'][] = isset($names[$i]) ? $names[$i] : $uuid;
|
||||
$_FILES["userfile"]['size'][] = filesize($fullfile);
|
||||
$_FILES["userfile"]['error'][] = 0;
|
||||
$file_ary[] = array(
|
||||
'tmp_name' => $fullfile,
|
||||
'type' => $mimetype,
|
||||
'name' => isset($names[$i]) ? $names[$i] : $uuid,
|
||||
'size' => filesize($fullfile),
|
||||
'error' => 0,
|
||||
'source' => 'upload',
|
||||
);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -339,21 +360,26 @@ if($settings->_libraryFolder) {
|
|||
$docsource = 'library';
|
||||
$fullfile = tempnam(sys_get_temp_dir(), '');
|
||||
if(SeedDMS_Core_File::copyFile($dms->contentDir . $content->getPath(), $fullfile)) {
|
||||
/* Check if a local file is uploaded as well */
|
||||
if(isset($_FILES["userfile"]['error'][0])) {
|
||||
if($_FILES["userfile"]['error'][0] != 0)
|
||||
$_FILES["userfile"] = array();
|
||||
}
|
||||
$_FILES["userfile"]['tmp_name'][] = $fullfile;
|
||||
$_FILES["userfile"]['type'][] = $content->getMimeType();
|
||||
$_FILES["userfile"]['name'][] = $content->getOriginalFileName();
|
||||
$_FILES["userfile"]['size'][] = $content->getFileSize();
|
||||
$_FILES["userfile"]['error'][] = 0;
|
||||
$file_ary[] = array(
|
||||
'tmp_name' => $fullfile,
|
||||
'type' => $content->getMimeType(),
|
||||
'name' => $content->getOriginalFileName(),
|
||||
'size' => $content->getFileSize(),
|
||||
'error' => 0,
|
||||
'source' => 'library',
|
||||
);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
if($controller->hasHook('getDocument')) {
|
||||
$file_ary = array_merge($file_ary, $controller->callHook('getDocument', $_POST));
|
||||
}
|
||||
|
||||
if(!$file_ary) {
|
||||
UI::exitError(getMLText("folder_title", array("foldername" => $folder->getName())),getMLText("uploading_failed"));
|
||||
}
|
||||
|
||||
/* Check if additional notification shall be added */
|
||||
$notusers = array();
|
||||
|
@ -377,22 +403,22 @@ if(!empty($_POST['notification_groups'])) {
|
|||
|
||||
/* Check files for Errors first */
|
||||
$maxuploadsize = SeedDMS_Core_File::parse_filesize($settings->_maxUploadSize);
|
||||
for ($file_num=0;$file_num<count($_FILES["userfile"]["tmp_name"]);$file_num++){
|
||||
if ($_FILES["userfile"]["size"][$file_num]==0) {
|
||||
foreach($file_ary as $file) {
|
||||
if ($file["size"]==0) {
|
||||
UI::exitError(getMLText("folder_title", array("foldername" => $folder->getName())),getMLText("uploading_zerosize"));
|
||||
}
|
||||
if ($maxuploadsize && $_FILES["userfile"]["size"][$file_num] > $maxuploadsize) {
|
||||
if ($maxuploadsize && $file["size"] > $maxuploadsize) {
|
||||
UI::exitError(getMLText("folder_title", array("foldername" => $folder->getName())),getMLText("uploading_maxsize"));
|
||||
}
|
||||
if (/* is_uploaded_file($_FILES["userfile"]["tmp_name"][$file_num]) && */$_FILES['userfile']['error'][$file_num]!=0){
|
||||
if($file['error']!=0) {
|
||||
UI::exitError(getMLText("folder_title", array("foldername" => $folder->getName())),getMLText("uploading_failed"));
|
||||
}
|
||||
}
|
||||
|
||||
for ($file_num=0;$file_num<count($_FILES["userfile"]["tmp_name"]);$file_num++){
|
||||
$userfiletmp = $_FILES["userfile"]["tmp_name"][$file_num];
|
||||
$userfiletype = $_FILES["userfile"]["type"][$file_num];
|
||||
$userfilename = $_FILES["userfile"]["name"][$file_num];
|
||||
foreach($file_ary as $file) {
|
||||
$userfiletmp = $file["tmp_name"];
|
||||
$userfiletype = $file["type"];
|
||||
$userfilename = $file["name"];
|
||||
|
||||
$fileType = ".".pathinfo($userfilename, PATHINFO_EXTENSION);
|
||||
|
||||
|
@ -403,7 +429,7 @@ for ($file_num=0;$file_num<count($_FILES["userfile"]["tmp_name"]);$file_num++){
|
|||
$userfiletype = $tmpfiletype;
|
||||
}
|
||||
|
||||
if ((count($_FILES["userfile"]["tmp_name"])==1)&&($_POST["name"]!=""))
|
||||
if (!$file["tmp_name"] && ($_POST["name"]!=""))
|
||||
$name = trim($_POST["name"]);
|
||||
else $name = utf8_basename($userfilename);
|
||||
|
||||
|
@ -414,7 +440,7 @@ for ($file_num=0;$file_num<count($_FILES["userfile"]["tmp_name"]);$file_num++){
|
|||
}
|
||||
}
|
||||
|
||||
$controller->setParam('documentsource', $docsource);
|
||||
$controller->setParam('documentsource', $file['source']);
|
||||
$controller->setParam('folder', $folder);
|
||||
$controller->setParam('fulltextservice', $fulltextservice);
|
||||
$controller->setParam('name', $name);
|
||||
|
|
|
@ -71,6 +71,38 @@ if ($document->isLocked()) {
|
|||
else $document->setLocked(false);
|
||||
}
|
||||
|
||||
function reArrayFiles(&$file_post) {
|
||||
$file_post['source'] = 'upload';
|
||||
if($file_post['error'] != 4) // no file uploaded
|
||||
return array($file_post);
|
||||
else
|
||||
return array();
|
||||
}
|
||||
|
||||
if ($_FILES['userfile']) {
|
||||
$file_ary = reArrayFiles($_FILES['userfile']);
|
||||
} else {
|
||||
$file_ary = array();
|
||||
}
|
||||
|
||||
if($settings->_dropFolderDir) {
|
||||
if(isset($_POST["dropfolderfileform1"]) && $_POST["dropfolderfileform1"]) {
|
||||
$fullfile = $settings->_dropFolderDir.'/'.$user->getLogin().'/'.$_POST["dropfolderfileform1"];
|
||||
if(file_exists($fullfile)) {
|
||||
$finfo = finfo_open(FILEINFO_MIME_TYPE);
|
||||
$mimetype = finfo_file($finfo, $fullfile);
|
||||
$file_ary[] = array(
|
||||
'tmp_name' => $fullfile,
|
||||
'type' => $mimetype,
|
||||
'name' => $_POST["dropfolderfileform1"],
|
||||
'size' => filesize($fullfile),
|
||||
'error' => 0,
|
||||
'source' => 'dropfolder'
|
||||
);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
$prefix = 'userfile';
|
||||
if(isset($_POST[$prefix.'-fine-uploader-uuids']) && $_POST[$prefix.'-fine-uploader-uuids']) {
|
||||
$uuids = explode(';', $_POST[$prefix.'-fine-uploader-uuids']);
|
||||
|
@ -80,29 +112,38 @@ if(isset($_POST[$prefix.'-fine-uploader-uuids']) && $_POST[$prefix.'-fine-upload
|
|||
if(file_exists($fullfile)) {
|
||||
$finfo = finfo_open(FILEINFO_MIME_TYPE);
|
||||
$mimetype = finfo_file($finfo, $fullfile);
|
||||
$_FILES["userfile"]['tmp_name'] = $fullfile;
|
||||
$_FILES["userfile"]['type'] = $mimetype;
|
||||
$_FILES["userfile"]['name'] = isset($names[0]) ? $names[0] : $uuid;
|
||||
$_FILES["userfile"]['size'] = filesize($fullfile);
|
||||
$_FILES["userfile"]['error'] = 0;
|
||||
$file_ary[] = array(
|
||||
'tmp_name' => $fullfile,
|
||||
'type' => $mimetype,
|
||||
'name' => isset($names[0]) ? $names[0] : $uuid,
|
||||
'size' => filesize($fullfile),
|
||||
'error' => 0,
|
||||
'source' => 'upload',
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
if (isset($_FILES['userfile']) && $_FILES['userfile']['error'] == 0) {
|
||||
// if(!is_uploaded_file($_FILES["userfile"]["tmp_name"]))
|
||||
// UI::exitError(getMLText("document_title", array("documentname" => $document->getName())),getMLText("error_occured")."lsajdflk");
|
||||
if($controller->hasHook('getDocument')) {
|
||||
$file_ary = array_merge($file_ary, $controller->callHook('getDocument', $_POST));
|
||||
}
|
||||
|
||||
if($_FILES["userfile"]["size"] == 0)
|
||||
if(!$file_ary) {
|
||||
UI::exitError(getMLText("folder_title", array("foldername" => $folder->getName())),getMLText("uploading_failed"));
|
||||
}
|
||||
|
||||
$file = $file_ary[0];
|
||||
if ($file['error'] == 0) {
|
||||
if ($file["size"]==0) {
|
||||
UI::exitError(getMLText("document_title", array("documentname" => $document->getName())),getMLText("uploading_zerosize"));
|
||||
|
||||
}
|
||||
$maxuploadsize = SeedDMS_Core_File::parse_filesize($settings->_maxUploadSize);
|
||||
if ($maxuploadsize && $_FILES["userfile"]["size"] > $maxuploadsize) {
|
||||
if ($maxuploadsize && $file["size"] > $maxuploadsize) {
|
||||
UI::exitError(getMLText("document_title", array("documentname" => $document->getName())),getMLText("uploading_maxsize"));
|
||||
}
|
||||
|
||||
$userfiletmp = $_FILES["userfile"]["tmp_name"];
|
||||
$userfiletype = $_FILES["userfile"]["type"];
|
||||
$userfilename = $_FILES["userfile"]["name"];
|
||||
$userfiletmp = $file["tmp_name"];
|
||||
$userfiletype = $file["type"];
|
||||
$userfilename = $file["name"];
|
||||
|
||||
if($settings->_overrideMimeType) {
|
||||
$finfo = finfo_open(FILEINFO_MIME_TYPE);
|
||||
|
@ -110,23 +151,6 @@ if (isset($_FILES['userfile']) && $_FILES['userfile']['error'] == 0) {
|
|||
if($tmpfiletype != 'application/octet-stream')
|
||||
$userfiletype = $tmpfiletype;
|
||||
}
|
||||
} elseif($settings->_dropFolderDir) {
|
||||
if($_POST['dropfolderfileform1']) {
|
||||
$fullfile = $settings->_dropFolderDir.'/'.$user->getLogin().'/'.$_POST["dropfolderfileform1"];
|
||||
if(file_exists($fullfile)) {
|
||||
$finfo = finfo_open(FILEINFO_MIME_TYPE);
|
||||
$mimetype = finfo_file($finfo, $fullfile);
|
||||
$userfiletmp = $fullfile;
|
||||
$userfiletype = $mimetype;
|
||||
$userfilename= $_POST["dropfolderfileform1"];
|
||||
} else {
|
||||
UI::exitError(getMLText("document_title", array("documentname" => $document->getName())),getMLText("error_occured"));
|
||||
}
|
||||
} else {
|
||||
UI::exitError(getMLText("document_title", array("documentname" => $document->getName())),getMLText("error_occured"));
|
||||
}
|
||||
} else {
|
||||
UI::exitError(getMLText("document_title", array("documentname" => $document->getName())),getMLText("uploading_failed"));
|
||||
}
|
||||
|
||||
/* Check if the uploaded file is identical to last version */
|
||||
|
|
|
@ -64,9 +64,11 @@ $(document).ready(function() {
|
|||
/* The fineuploader validation is actually checking all fields that can contain
|
||||
* a file to be uploaded. First checks if an alternative input field is set,
|
||||
* second loops through the list of scheduled uploads, checking if at least one
|
||||
* file will be submitted.
|
||||
* file will be submitted. param[0] is the fineuploader, param[1] is the
|
||||
* field from the dropfolder
|
||||
*/
|
||||
jQuery.validator.addMethod("fineuploader", function(value, element, params) {
|
||||
console.log(params);
|
||||
if(params[1].val() != '')
|
||||
return true;
|
||||
uploader = params[0];
|
||||
|
@ -104,10 +106,12 @@ $(document).ready(function() {
|
|||
} else {
|
||||
?>
|
||||
'userfile[]': {
|
||||
alternatives: [$('#dropfolderfileadddocform'), $('#choosedocsearch<?= md5('librarydoc'.'adddocform') ?>')]
|
||||
require_from_group: [1, ".fileupload-group"]
|
||||
// alternatives: [$('#dropfolderfileadddocform'), $('#choosedocsearch<?= md5('librarydoc'.'adddocform') ?>')]
|
||||
},
|
||||
dropfolderfileadddocform: {
|
||||
alternatives: [$("#userfile"), $('#choosedocsearch<?= md5('librarydoc'.'adddocform') ?>')]
|
||||
require_from_group: [1, ".fileupload-group"]
|
||||
// alternatives: [$("#userfile"), $('#choosedocsearch<?= md5('librarydoc'.'adddocform') ?>')]
|
||||
}
|
||||
<?php
|
||||
}
|
||||
|
@ -170,6 +174,7 @@ $(document).ready(function() {
|
|||
$accessop = $this->params['accessobject'];
|
||||
|
||||
$this->htmlAddHeader('<script type="text/javascript" src="../views/'.$this->theme.'/vendors/jquery-validation/jquery.validate.js"></script>'."\n", 'js');
|
||||
$this->htmlAddHeader('<script type="text/javascript" src="../views/'.$this->theme.'/vendors/jquery-validation/additional-methods.js"></script>'."\n", 'js');
|
||||
$this->htmlAddHeader('<script type="text/javascript" src="../views/'.$this->theme.'/styles/validation-default.js"></script>'."\n", 'js');
|
||||
if($enablelargefileupload) {
|
||||
$this->htmlAddHeader('<script type="text/javascript" src="../views/'.$this->theme.'/vendors/fine-uploader/jquery.fine-uploader.min.js"></script>'."\n", 'js');
|
||||
|
@ -412,6 +417,13 @@ $(document).ready(function() {
|
|||
$this->getDocumentChooserHtml("adddocform", M_READ, -1, null, 'librarydoc', $libraryfolder, 1)
|
||||
);
|
||||
}
|
||||
if($arr = $this->callHook('addDocumentContentFile')) {
|
||||
if(is_array($arr)) {
|
||||
$this->formField($arr[0], $arr[1], isset($arr[2]) ? $arr[2] : null);
|
||||
} elseif(is_string($arr)) {
|
||||
echo $arr;
|
||||
}
|
||||
}
|
||||
if(!$nodocumentformfields || !in_array('version_comment', $nodocumentformfields)) {
|
||||
$this->formField(
|
||||
getMLText("comment_for_current_version"),
|
||||
|
|
|
@ -1497,7 +1497,7 @@ $(document).ready(function() {
|
|||
<div id="'.$id.'-upload-files">
|
||||
<div id="'.$id.'-upload-file" class="upload-file">
|
||||
<div class="input-append">
|
||||
<input type="text" class="form-control" id="kkll'.$id.'" readonly>
|
||||
<input type="text" class="form-control fileupload-group" id="kkll'.$id.'" readonly>
|
||||
<span class="btn btn-secondary btn-file">
|
||||
'.getMLText("browse").'… <input id="'.$id.'" type="file" name="'.$varname.'"'.($multiple ? " multiple" : "").($accept ? ' accept="'.$accept.'"' : "").' data-target-highlight="kkll'.$id.'">
|
||||
</span>
|
||||
|
@ -2000,7 +2000,7 @@ $(document).ready(function() {
|
|||
|
||||
function getDropFolderChooserHtml($formName, $dropfolderfile="", $showfolders=0) { /* {{{ */
|
||||
$content = "<div class=\"input-append\">\n";
|
||||
$content .= "<input readonly type=\"text\" id=\"dropfolderfile".$formName."\" name=\"dropfolderfile".$formName."\" value=\"".htmlspecialchars($dropfolderfile)."\">";
|
||||
$content .= "<input readonly type=\"text\" class=\"fileupload-group\" id=\"dropfolderfile".$formName."\" name=\"dropfolderfile".$formName."\" value=\"".htmlspecialchars($dropfolderfile)."\">";
|
||||
$content .= "<button type=\"button\" class=\"btn\" id=\"clearfilename".$formName."\"><i class=\"fa fa-remove\"></i></button>";
|
||||
$content .= $this->getModalBoxLink(
|
||||
array(
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
<?php
|
||||
/**
|
||||
* Implementation of CategoryChooser view
|
||||
* Implementation of DropFolderChooser view
|
||||
*
|
||||
* @category DMS
|
||||
* @package SeedDMS
|
||||
|
@ -24,7 +24,7 @@
|
|||
require_once("SeedDMS/Preview.php");
|
||||
|
||||
/**
|
||||
* Class which outputs the html page for CategoryChooser view
|
||||
* Class which outputs the html page for DropFolderChooser view
|
||||
*
|
||||
* @category DMS
|
||||
* @package SeedDMS
|
||||
|
@ -158,7 +158,7 @@ $('.folderselect').click(function(ev) {
|
|||
echo "</table>\n";
|
||||
echo '<script src="../out/out.DropFolderChooser.php?action=js&'.$_SERVER['QUERY_STRING'].'"></script>'."\n";
|
||||
} else {
|
||||
echo "<div class=\"alert alert-danger\">".getMLText('invalid_dropfolder_folder')."</div>";
|
||||
echo $this->errorMsg(getMLText('invalid_dropfolder_folder'));
|
||||
}
|
||||
}
|
||||
} /* }}} */
|
||||
|
|
|
@ -96,10 +96,12 @@ $(document).ready( function() {
|
|||
} else {
|
||||
?>
|
||||
userfile: {
|
||||
alternatives: $('#dropfolderfileform1')
|
||||
require_from_group: [1, ".fileupload-group"]
|
||||
// alternatives: $('#dropfolderfileform1')
|
||||
},
|
||||
dropfolderfileform1: {
|
||||
alternatives: $('#userfile')
|
||||
require_from_group: [1, ".fileupload-group"]
|
||||
// alternatives: $('#userfile')
|
||||
}
|
||||
<?php
|
||||
}
|
||||
|
@ -147,6 +149,7 @@ console.log(element);
|
|||
$documentid = $document->getId();
|
||||
|
||||
$this->htmlAddHeader('<script type="text/javascript" src="../views/'.$this->theme.'/vendors/jquery-validation/jquery.validate.js"></script>'."\n", 'js');
|
||||
$this->htmlAddHeader('<script type="text/javascript" src="../views/'.$this->theme.'/vendors/jquery-validation/additional-methods.js"></script>'."\n", 'js');
|
||||
$this->htmlAddHeader('<script type="text/javascript" src="../views/'.$this->theme.'/styles/validation-default.js"></script>'."\n", 'js');
|
||||
if($enablelargefileupload) {
|
||||
$this->htmlAddHeader('<script type="text/javascript" src="../views/'.$this->theme.'/vendors/fine-uploader/jquery.fine-uploader.min.js"></script>'."\n", 'js');
|
||||
|
@ -238,6 +241,13 @@ console.log(element);
|
|||
$this->getDropFolderChooserHtml("form1")
|
||||
);
|
||||
}
|
||||
if($arr = $this->callHook('addDocumentContentFile')) {
|
||||
if(is_array($arr)) {
|
||||
$this->formField($arr[0], $arr[1], isset($arr[2]) ? $arr[2] : null);
|
||||
} elseif(is_string($arr)) {
|
||||
echo $arr;
|
||||
}
|
||||
}
|
||||
if(!$nodocumentformfields || !in_array('version_comment', $nodocumentformfields)) {
|
||||
$this->formField(
|
||||
getMLText("comment"),
|
||||
|
|
|
@ -1436,7 +1436,7 @@ $(document).ready(function() {
|
|||
<div id="'.$id.'-upload-files">
|
||||
<div id="'.$id.'-upload-file" class="upload-file">
|
||||
<div class="input-group">
|
||||
<input type="text" class="form-control" id="kkll'.$id.'" readonly>
|
||||
<input type="text" class="form-control fileupload-group" id="kkll'.$id.'" readonly>
|
||||
<div class="input-group-append">
|
||||
<button class="btn btn-secondary btn-file">
|
||||
'.getMLText("browse").'… <input id="'.$id.'" type="file" name="'.$varname.'"'.($multiple ? " multiple" : "").($accept ? ' accept="'.$accept.'"' : "").' data-target-highlight="kkll'.$id.'">
|
||||
|
@ -1960,7 +1960,7 @@ $(document).ready(function() {
|
|||
|
||||
function getDropFolderChooserHtml($formName, $dropfolderfile="", $showfolders=0) { /* {{{ */
|
||||
$content = "<div class=\"input-group\">\n";
|
||||
$content .= "<input class=\"form-control\" readonly type=\"text\" id=\"dropfolderfile".$formName."\" name=\"dropfolderfile".$formName."\" value=\"".htmlspecialchars($dropfolderfile)."\">";
|
||||
$content .= "<input class=\"form-control fileupload-group\" readonly type=\"text\" id=\"dropfolderfile".$formName."\" name=\"dropfolderfile".$formName."\" value=\"".htmlspecialchars($dropfolderfile)."\">";
|
||||
$content .= '<div class="input-group-append">';
|
||||
$content .= "<button type=\"button\" class=\"btn btn-secondary\" id=\"clearfilename".$formName."\"><i class=\"fa fa-remove\"></i></button>";
|
||||
$content .= $this->getModalBoxLink(
|
||||
|
|
Loading…
Reference in New Issue
Block a user