mirror of
https://git.code.sf.net/p/seeddms/code
synced 2025-02-06 15:14:58 +00:00
Merge branch 'seeddms-5.1.x' into seeddms-6.0.x
This commit is contained in:
commit
7b1835774d
|
@ -121,8 +121,11 @@
|
||||||
Changes in version 5.1.14
|
Changes in version 5.1.14
|
||||||
--------------------------------------------------------------------------------
|
--------------------------------------------------------------------------------
|
||||||
- allow mimetype to specify documents which can be edited online
|
- allow mimetype to specify documents which can be edited online
|
||||||
- show number of indexing tasks in bar
|
- show number of indexing tasks in progress bar
|
||||||
- fix comparison of last indexing time with creation date of document content
|
- fix comparison of last indexing time with creation date of document content
|
||||||
|
- new hooks leftContentPre and leftContentPost
|
||||||
|
- minimize sql queries when fetching sub folders and documents of a folder
|
||||||
|
- custom attributes can be validated in a hook
|
||||||
|
|
||||||
--------------------------------------------------------------------------------
|
--------------------------------------------------------------------------------
|
||||||
Changes in version 5.1.13
|
Changes in version 5.1.13
|
||||||
|
|
|
@ -292,6 +292,22 @@ class SeedDMS_Core_Document extends SeedDMS_Core_Object { /* {{{ */
|
||||||
return $searchFields;
|
return $searchFields;
|
||||||
} /* }}} */
|
} /* }}} */
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Return a folder by its database record
|
||||||
|
*
|
||||||
|
* @param array $resArr array of folder data as returned by database
|
||||||
|
* @param SeedDMS_Core_DMS $dms
|
||||||
|
* @return SeedDMS_Core_Folder|bool instance of SeedDMS_Core_Folder if document exists
|
||||||
|
*/
|
||||||
|
public static function getInstanceByData($resArr, $dms) { /* {{{ */
|
||||||
|
$classname = $dms->getClassname('document');
|
||||||
|
/** @var SeedDMS_Core_Document $document */
|
||||||
|
$document = new $classname($resArr["id"], $resArr["name"], $resArr["comment"], $resArr["date"], $resArr["expires"], $resArr["owner"], $resArr["folder"], $resArr["inheritAccess"], $resArr["defaultAccess"], $resArr['lock'], $resArr["keywords"], $resArr["sequence"]);
|
||||||
|
$document->setDMS($dms);
|
||||||
|
$document = $document->applyDecorators();
|
||||||
|
return $document;
|
||||||
|
} /* }}} */
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Return an document by its id
|
* Return an document by its id
|
||||||
*
|
*
|
||||||
|
@ -303,7 +319,8 @@ class SeedDMS_Core_Document extends SeedDMS_Core_Object { /* {{{ */
|
||||||
public static function getInstance($id, $dms) { /* {{{ */
|
public static function getInstance($id, $dms) { /* {{{ */
|
||||||
$db = $dms->getDB();
|
$db = $dms->getDB();
|
||||||
|
|
||||||
$queryStr = "SELECT * FROM `tblDocuments` WHERE `id` = " . (int) $id;
|
// $queryStr = "SELECT * FROM `tblDocuments` WHERE `id` = " . (int) $id;
|
||||||
|
$queryStr = "SELECT `tblDocuments`.*, `tblDocumentLocks`.`userID` as `lock` FROM `tblDocuments` LEFT JOIN `tblDocumentLocks` ON `tblDocuments`.`id` = `tblDocumentLocks`.`document` WHERE `id` = " . (int) $id;
|
||||||
$resArr = $db->getResultArray($queryStr);
|
$resArr = $db->getResultArray($queryStr);
|
||||||
if (is_bool($resArr) && $resArr == false)
|
if (is_bool($resArr) && $resArr == false)
|
||||||
return false;
|
return false;
|
||||||
|
@ -312,20 +329,26 @@ class SeedDMS_Core_Document extends SeedDMS_Core_Object { /* {{{ */
|
||||||
$resArr = $resArr[0];
|
$resArr = $resArr[0];
|
||||||
|
|
||||||
// New Locking mechanism uses a separate table to track the lock.
|
// New Locking mechanism uses a separate table to track the lock.
|
||||||
|
/*
|
||||||
$queryStr = "SELECT * FROM `tblDocumentLocks` WHERE `document` = " . (int) $id;
|
$queryStr = "SELECT * FROM `tblDocumentLocks` WHERE `document` = " . (int) $id;
|
||||||
$lockArr = $db->getResultArray($queryStr);
|
$lockArr = $db->getResultArray($queryStr);
|
||||||
if ((is_bool($lockArr) && $lockArr==false) || (count($lockArr)==0)) {
|
if ((is_bool($lockArr) && $lockArr==false) || (count($lockArr)==0)) {
|
||||||
// Could not find a lock on the selected document.
|
// Could not find a lock on the selected document.
|
||||||
$lock = -1;
|
$resArr['lock'] = -1;
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
// A lock has been identified for this document.
|
// A lock has been identified for this document.
|
||||||
$lock = $lockArr[0]["userID"];
|
$resArr['lock'] = $lockArr[0]["userID"];
|
||||||
}
|
}
|
||||||
|
*/
|
||||||
|
$resArr['lock'] = !$resArr['lock'] ? -1 : $resArr['lock'];
|
||||||
|
// print_r($resArr);exit;
|
||||||
|
|
||||||
|
return self::getInstanceByData($resArr, $dms);
|
||||||
|
|
||||||
$classname = $dms->getClassname('document');
|
$classname = $dms->getClassname('document');
|
||||||
/** @var SeedDMS_Core_Document $document */
|
/** @var SeedDMS_Core_Document $document */
|
||||||
$document = new $classname($resArr["id"], $resArr["name"], $resArr["comment"], $resArr["date"], $resArr["expires"], $resArr["owner"], $resArr["folder"], $resArr["inheritAccess"], $resArr["defaultAccess"], $lock, $resArr["keywords"], $resArr["sequence"]);
|
$document = new $classname($resArr["id"], $resArr["name"], $resArr["comment"], $resArr["date"], $resArr["expires"], $resArr["owner"], $resArr["folder"], $resArr["inheritAccess"], $resArr["defaultAccess"], $resArr['lock'], $resArr["keywords"], $resArr["sequence"]);
|
||||||
$document->setDMS($dms);
|
$document->setDMS($dms);
|
||||||
$document = $document->applyDecorators();
|
$document = $document->applyDecorators();
|
||||||
return $document;
|
return $document;
|
||||||
|
|
|
@ -177,6 +177,22 @@ class SeedDMS_Core_Folder extends SeedDMS_Core_Object {
|
||||||
return $sql;
|
return $sql;
|
||||||
} /* }}} */
|
} /* }}} */
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Return a folder by its database record
|
||||||
|
*
|
||||||
|
* @param array $resArr array of folder data as returned by database
|
||||||
|
* @param SeedDMS_Core_DMS $dms
|
||||||
|
* @return SeedDMS_Core_Folder|bool instance of SeedDMS_Core_Folder if document exists
|
||||||
|
*/
|
||||||
|
public static function getInstanceByData($resArr, $dms) { /* {{{ */
|
||||||
|
$classname = $dms->getClassname('folder');
|
||||||
|
/** @var SeedDMS_Core_Folder $folder */
|
||||||
|
$folder = new $classname($resArr["id"], $resArr["name"], $resArr["parent"], $resArr["comment"], $resArr["date"], $resArr["owner"], $resArr["inheritAccess"], $resArr["defaultAccess"], $resArr["sequence"]);
|
||||||
|
$folder->setDMS($dms);
|
||||||
|
$folder = $folder->applyDecorators();
|
||||||
|
return $folder;
|
||||||
|
} /* }}} */
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Return a folder by its id
|
* Return a folder by its id
|
||||||
*
|
*
|
||||||
|
@ -195,6 +211,8 @@ class SeedDMS_Core_Folder extends SeedDMS_Core_Object {
|
||||||
else if (count($resArr) != 1)
|
else if (count($resArr) != 1)
|
||||||
return null;
|
return null;
|
||||||
|
|
||||||
|
return self::getInstanceByData($resArr[0], $dms);
|
||||||
|
|
||||||
$resArr = $resArr[0];
|
$resArr = $resArr[0];
|
||||||
$classname = $dms->getClassname('folder');
|
$classname = $dms->getClassname('folder');
|
||||||
/** @var SeedDMS_Core_Folder $folder */
|
/** @var SeedDMS_Core_Folder $folder */
|
||||||
|
@ -601,9 +619,11 @@ class SeedDMS_Core_Folder extends SeedDMS_Core_Object {
|
||||||
if (is_bool($resArr) && $resArr == false)
|
if (is_bool($resArr) && $resArr == false)
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
|
$classname = $this->_dms->getClassname('folder');
|
||||||
$this->_subFolders = array();
|
$this->_subFolders = array();
|
||||||
for ($i = 0; $i < count($resArr); $i++)
|
for ($i = 0; $i < count($resArr); $i++)
|
||||||
$this->_subFolders[$i] = $this->_dms->getFolder($resArr[$i]["id"]);
|
// $this->_subFolders[$i] = $this->_dms->getFolder($resArr[$i]["id"]);
|
||||||
|
$this->_subFolders[$i] = $classname::getInstanceByData($resArr[$i], $this->_dms);
|
||||||
}
|
}
|
||||||
|
|
||||||
return $this->_subFolders;
|
return $this->_subFolders;
|
||||||
|
@ -784,7 +804,7 @@ class SeedDMS_Core_Folder extends SeedDMS_Core_Object {
|
||||||
$db = $this->_dms->getDB();
|
$db = $this->_dms->getDB();
|
||||||
|
|
||||||
if (!isset($this->_documents)) {
|
if (!isset($this->_documents)) {
|
||||||
$queryStr = "SELECT * FROM `tblDocuments` WHERE `folder` = " . $this->_id;
|
$queryStr = "SELECT `tblDocuments`.*, `tblDocumentLocks`.`userID` as `lock` FROM `tblDocuments` LEFT JOIN `tblDocumentLocks` ON `tblDocuments`.`id` = `tblDocumentLocks`.`document` WHERE `folder` = " . $this->_id;
|
||||||
if ($orderby && $orderby[0]=="n") $queryStr .= " ORDER BY `name`";
|
if ($orderby && $orderby[0]=="n") $queryStr .= " ORDER BY `name`";
|
||||||
elseif($orderby && $orderby[0]=="s") $queryStr .= " ORDER BY `sequence`";
|
elseif($orderby && $orderby[0]=="s") $queryStr .= " ORDER BY `sequence`";
|
||||||
elseif($orderby && $orderby[0]=="d") $queryStr .= " ORDER BY `date`";
|
elseif($orderby && $orderby[0]=="d") $queryStr .= " ORDER BY `date`";
|
||||||
|
@ -801,9 +821,11 @@ class SeedDMS_Core_Folder extends SeedDMS_Core_Object {
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
$this->_documents = array();
|
$this->_documents = array();
|
||||||
|
$classname = $this->_dms->getClassname('document');
|
||||||
foreach ($resArr as $row) {
|
foreach ($resArr as $row) {
|
||||||
// array_push($this->_documents, new SeedDMS_Core_Document($row["id"], $row["name"], $row["comment"], $row["date"], $row["expires"], $row["owner"], $row["folder"], $row["inheritAccess"], $row["defaultAccess"], isset($row["lockUser"])?$row["lockUser"]:NULL, $row["keywords"], $row["sequence"]));
|
$row['lock'] = !$row['lock'] ? -1 : $row['lock'];
|
||||||
array_push($this->_documents, $this->_dms->getDocument($row["id"]));
|
// array_push($this->_documents, $this->_dms->getDocument($row["id"]));
|
||||||
|
array_push($this->_documents, $classname::getInstanceByData($row, $this->_dms));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return $this->_documents;
|
return $this->_documents;
|
||||||
|
|
|
@ -1716,6 +1716,22 @@ add method SeedDMS_Core_DatabaseAccess::setLogFp()
|
||||||
- skip a fileType with just a '.'
|
- skip a fileType with just a '.'
|
||||||
</notes>
|
</notes>
|
||||||
</release>
|
</release>
|
||||||
|
<release>
|
||||||
|
<date>2019-12-13</date>
|
||||||
|
<time>07:31:17</time>
|
||||||
|
<version>
|
||||||
|
<release>5.1.14</release>
|
||||||
|
<api>5.1.14</api>
|
||||||
|
</version>
|
||||||
|
<stability>
|
||||||
|
<release>stable</release>
|
||||||
|
<api>stable</api>
|
||||||
|
</stability>
|
||||||
|
<license uri="http://opensource.org/licenses/gpl-license">GPL License</license>
|
||||||
|
<notes>
|
||||||
|
- speed up SeedDMS_Core_Folder::getSubFolders() SeedDMS_Core_Folder::getDocuments() by minimizing the number of sql queries.
|
||||||
|
</notes>
|
||||||
|
</release>
|
||||||
<release>
|
<release>
|
||||||
<date>2017-02-28</date>
|
<date>2017-02-28</date>
|
||||||
<time>06:34:50</time>
|
<time>06:34:50</time>
|
||||||
|
|
|
@ -57,7 +57,40 @@ class SeedDMS_Controller_AddDocument extends SeedDMS_Controller_Common {
|
||||||
$reqversion = $this->getParam('reqversion');
|
$reqversion = $this->getParam('reqversion');
|
||||||
$version_comment = $this->getParam('versioncomment');
|
$version_comment = $this->getParam('versioncomment');
|
||||||
$attributes = $this->getParam('attributes');
|
$attributes = $this->getParam('attributes');
|
||||||
|
foreach($attributes as $attrdefid=>$attribute) {
|
||||||
|
if($attrdef = $dms->getAttributeDefinition($attrdefid)) {
|
||||||
|
if(null === ($ret = $this->callHook('validateAttribute', $attrdef, $attribute))) {
|
||||||
|
if($attribute) {
|
||||||
|
if(!$attrdef->validate($attribute)) {
|
||||||
|
$this->errormsg = getAttributeValidationError($attrdef->getValidationError(), $attrdef->getName(), $attribute);
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
} elseif($attrdef->getMinValues() > 0) {
|
||||||
|
$this->errormsg = array("attr_min_values", array("attrname"=>$attrdef->getName()));
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
if($ret === false)
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
$attributes_version = $this->getParam('attributesversion');
|
$attributes_version = $this->getParam('attributesversion');
|
||||||
|
foreach($attributes_version as $attrdefid=>$attribute) {
|
||||||
|
if($attrdef = $dms->getAttributeDefinition($attrdefid)) {
|
||||||
|
if(null === ($ret = $this->callHook('validateAttribute', $attrdef, $attribute))) {
|
||||||
|
if($attribute) {
|
||||||
|
if(!$attrdef->validate($attribute)) {
|
||||||
|
$this->errormsg = getAttributeValidationError($attrdef->getValidationError(), $attrdef->getName(), $attribute);
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
if($ret === false)
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
$workflow = $this->getParam('workflow');
|
$workflow = $this->getParam('workflow');
|
||||||
$notificationgroups = $this->getParam('notificationgroups');
|
$notificationgroups = $this->getParam('notificationgroups');
|
||||||
$notificationusers = $this->getParam('notificationusers');
|
$notificationusers = $this->getParam('notificationusers');
|
||||||
|
|
|
@ -40,6 +40,24 @@ class SeedDMS_Controller_AddSubFolder extends SeedDMS_Controller_Common {
|
||||||
$comment = $this->getParam('comment');
|
$comment = $this->getParam('comment');
|
||||||
$sequence = $this->getParam('sequence');
|
$sequence = $this->getParam('sequence');
|
||||||
$attributes = $this->getParam('attributes');
|
$attributes = $this->getParam('attributes');
|
||||||
|
foreach($attributes as $attrdefid=>$attribute) {
|
||||||
|
if($attrdef = $dms->getAttributeDefinition($attrdefid)) {
|
||||||
|
if(null === ($ret = $this->callHook('validateAttribute', $attrdef, $attribute))) {
|
||||||
|
if($attribute) {
|
||||||
|
if(!$attrdef->validate($attribute)) {
|
||||||
|
$this->errormsg = getAttributeValidationError($attrdef->getValidationError(), $attrdef->getName(), $attribute);
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
} elseif($attrdef->getMinValues() > 0) {
|
||||||
|
$this->errormsg = array("attr_min_values", array("attrname"=>$attrdef->getName()));
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
if($ret === false)
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
$notificationgroups = $this->getParam('notificationgroups');
|
$notificationgroups = $this->getParam('notificationgroups');
|
||||||
$notificationusers = $this->getParam('notificationusers');
|
$notificationusers = $this->getParam('notificationusers');
|
||||||
|
|
||||||
|
|
|
@ -116,10 +116,11 @@ class SeedDMS_Controller_EditDocument extends SeedDMS_Controller_Common {
|
||||||
$oldattributes = $document->getAttributes();
|
$oldattributes = $document->getAttributes();
|
||||||
if($attributes) {
|
if($attributes) {
|
||||||
foreach($attributes as $attrdefid=>$attribute) {
|
foreach($attributes as $attrdefid=>$attribute) {
|
||||||
$attrdef = $dms->getAttributeDefinition($attrdefid);
|
if($attrdef = $dms->getAttributeDefinition($attrdefid)) {
|
||||||
|
if(null === ($ret = $this->callHook('validateAttribute', $attrdef, $attribute))) {
|
||||||
if($attribute) {
|
if($attribute) {
|
||||||
if(!$attrdef->validate($attribute)) {
|
if(!$attrdef->validate($attribute)) {
|
||||||
$this->errormsg = getAttributeValidationText($attrdef->getValidationError(), $attrdef->getName(), $attribute);
|
$this->errormsg = getAttributeValidationError($attrdef->getValidationError(), $attrdef->getName(), $attribute);
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -128,11 +129,16 @@ class SeedDMS_Controller_EditDocument extends SeedDMS_Controller_Common {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
} elseif($attrdef->getMinValues() > 0) {
|
} elseif($attrdef->getMinValues() > 0) {
|
||||||
$this->errormsg = getMLText("attr_min_values", array("attrname"=>$attrdef->getName()));
|
$this->errormsg = array("attr_min_values", array("attrname"=>$attrdef->getName()));
|
||||||
} elseif(isset($oldattributes[$attrdefid])) {
|
} elseif(isset($oldattributes[$attrdefid])) {
|
||||||
if(!$document->removeAttribute($dms->getAttributeDefinition($attrdefid)))
|
if(!$document->removeAttribute($dms->getAttributeDefinition($attrdefid)))
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
} else {
|
||||||
|
if($ret === false)
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
foreach($oldattributes as $attrdefid=>$oldattribute) {
|
foreach($oldattributes as $attrdefid=>$oldattribute) {
|
||||||
|
|
|
@ -51,6 +51,7 @@ class SeedDMS_Controller_EditFolder extends SeedDMS_Controller_Common {
|
||||||
if($attributes) {
|
if($attributes) {
|
||||||
foreach($attributes as $attrdefid=>$attribute) {
|
foreach($attributes as $attrdefid=>$attribute) {
|
||||||
$attrdef = $dms->getAttributeDefinition($attrdefid);
|
$attrdef = $dms->getAttributeDefinition($attrdefid);
|
||||||
|
if(null === ($ret = $this->callHook('validateAttribute', $attrdef, $attribute))) {
|
||||||
if($attribute) {
|
if($attribute) {
|
||||||
if(!$attrdef->validate($attribute)) {
|
if(!$attrdef->validate($attribute)) {
|
||||||
$this->errormsg = getAttributeValidationText($attrdef->getValidationError(), $attrdef->getName(), $attribute);
|
$this->errormsg = getAttributeValidationText($attrdef->getValidationError(), $attrdef->getName(), $attribute);
|
||||||
|
@ -67,6 +68,10 @@ class SeedDMS_Controller_EditFolder extends SeedDMS_Controller_Common {
|
||||||
if(!$folder->removeAttribute($dms->getAttributeDefinition($attrdefid)))
|
if(!$folder->removeAttribute($dms->getAttributeDefinition($attrdefid)))
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
} else {
|
||||||
|
if($ret === false)
|
||||||
|
return false;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
foreach($oldattributes as $attrdefid=>$oldattribute) {
|
foreach($oldattributes as $attrdefid=>$oldattribute) {
|
||||||
|
|
|
@ -203,6 +203,9 @@ class SeedDMS_Controller_Common {
|
||||||
foreach($GLOBALS['SEEDDMS_HOOKS']['controller'][lcfirst($tmp)] as $hookObj) {
|
foreach($GLOBALS['SEEDDMS_HOOKS']['controller'][lcfirst($tmp)] as $hookObj) {
|
||||||
if (method_exists($hookObj, $hook)) {
|
if (method_exists($hookObj, $hook)) {
|
||||||
switch(func_num_args()) {
|
switch(func_num_args()) {
|
||||||
|
case 4:
|
||||||
|
$result = $hookObj->$hook($this, func_get_arg(1), func_get_arg(2), func_get_arg(3));
|
||||||
|
break;
|
||||||
case 3:
|
case 3:
|
||||||
$result = $hookObj->$hook($this, func_get_arg(1), func_get_arg(2));
|
$result = $hookObj->$hook($this, func_get_arg(1), func_get_arg(2));
|
||||||
break;
|
break;
|
||||||
|
|
|
@ -194,6 +194,61 @@ class SeedDMS_Extension_Mgr {
|
||||||
return $extensions;
|
return $extensions;
|
||||||
} /* }}} */
|
} /* }}} */
|
||||||
|
|
||||||
|
static protected function Zip($source, $destination, $include_dir = false) { /* {{{ */
|
||||||
|
|
||||||
|
if (!extension_loaded('zip') || !file_exists($source)) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (file_exists($destination)) {
|
||||||
|
unlink ($destination);
|
||||||
|
}
|
||||||
|
|
||||||
|
$zip = new ZipArchive();
|
||||||
|
if (!$zip->open($destination, ZIPARCHIVE::CREATE)) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
$source = str_replace('\\', '/', realpath($source));
|
||||||
|
|
||||||
|
if (is_dir($source) === true) {
|
||||||
|
$files = new RecursiveIteratorIterator(new RecursiveDirectoryIterator($source), RecursiveIteratorIterator::SELF_FIRST);
|
||||||
|
|
||||||
|
if ($include_dir) {
|
||||||
|
$arr = explode("/",$source);
|
||||||
|
$maindir = $arr[count($arr)- 1];
|
||||||
|
|
||||||
|
$source = "";
|
||||||
|
for ($i=0; $i < count($arr) - 1; $i++) {
|
||||||
|
$source .= '/' . $arr[$i];
|
||||||
|
}
|
||||||
|
|
||||||
|
$source = substr($source, 1);
|
||||||
|
|
||||||
|
$zip->addEmptyDir($maindir);
|
||||||
|
}
|
||||||
|
|
||||||
|
foreach ($files as $file) {
|
||||||
|
$file = str_replace('\\', '/', $file);
|
||||||
|
|
||||||
|
// Ignore "." and ".." folders
|
||||||
|
if( in_array(substr($file, strrpos($file, '/')+1), array('.', '..')) )
|
||||||
|
continue;
|
||||||
|
|
||||||
|
$file = realpath($file);
|
||||||
|
|
||||||
|
if (is_dir($file) === true) {
|
||||||
|
$zip->addEmptyDir(str_replace($source . '/', '', $file . '/'));
|
||||||
|
} else if (is_file($file) === true) {
|
||||||
|
$zip->addFromString(str_replace($source . '/', '', $file), file_get_contents($file));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
} else if (is_file($source) === true) {
|
||||||
|
$zip->addFromString(basename($source), file_get_contents($source));
|
||||||
|
}
|
||||||
|
|
||||||
|
return $zip->close();
|
||||||
|
} /* }}} */
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Create zip archive of an extension
|
* Create zip archive of an extension
|
||||||
*
|
*
|
||||||
|
@ -207,8 +262,11 @@ class SeedDMS_Extension_Mgr {
|
||||||
|
|
||||||
$tmpfile = $this->cachedir."/".$extname."-".$version.".zip";
|
$tmpfile = $this->cachedir."/".$extname."-".$version.".zip";
|
||||||
|
|
||||||
$cmd = "cd ".$this->extdir."/".$extname."; zip -r ".$tmpfile." .";
|
if(!SeedDMS_Extension_Mgr::Zip($this->extdir."/".$extname, $tmpfile)) {
|
||||||
exec($cmd);
|
return false;
|
||||||
|
}
|
||||||
|
// $cmd = "cd ".$this->extdir."/".$extname."; zip -r ".$tmpfile." .";
|
||||||
|
// exec($cmd);
|
||||||
|
|
||||||
return $tmpfile;
|
return $tmpfile;
|
||||||
} /* }}} */
|
} /* }}} */
|
||||||
|
|
|
@ -334,39 +334,45 @@ function getOverallStatusText($status) { /* {{{ */
|
||||||
} /* }}} */
|
} /* }}} */
|
||||||
|
|
||||||
function getAttributeValidationText($error, $attrname='', $attrvalue='', $regex='') { /* {{{ */
|
function getAttributeValidationText($error, $attrname='', $attrvalue='', $regex='') { /* {{{ */
|
||||||
|
$arr = getAttributeValidationError($error, $attrname, $attrvalue, $regex);
|
||||||
|
|
||||||
|
return getMLText($arr[0], $arr[1]);
|
||||||
|
} /* }}} */
|
||||||
|
|
||||||
|
function getAttributeValidationError($error, $attrname='', $attrvalue='', $regex='') { /* {{{ */
|
||||||
switch($error) {
|
switch($error) {
|
||||||
case 10:
|
case 10:
|
||||||
return getMLText("attr_not_in_valueset", array('attrname'=>$attrname, 'value'=>$attrvalue));
|
return array("attr_not_in_valueset", array('attrname'=>$attrname, 'value'=>$attrvalue));
|
||||||
break;
|
break;
|
||||||
case 8:
|
case 8:
|
||||||
return getMLText("attr_malformed_date", array('attrname'=>$attrname, 'value'=>$attrvalue));
|
return array("attr_malformed_date", array('attrname'=>$attrname, 'value'=>$attrvalue));
|
||||||
break;
|
break;
|
||||||
case 8:
|
case 8:
|
||||||
return getMLText("attr_malformed_boolean", array('attrname'=>$attrname, 'value'=>$attrvalue));
|
return array("attr_malformed_boolean", array('attrname'=>$attrname, 'value'=>$attrvalue));
|
||||||
break;
|
break;
|
||||||
case 7:
|
case 7:
|
||||||
return getMLText("attr_malformed_float", array('attrname'=>$attrname, 'value'=>$attrvalue));
|
return array("attr_malformed_float", array('attrname'=>$attrname, 'value'=>$attrvalue));
|
||||||
break;
|
break;
|
||||||
case 6:
|
case 6:
|
||||||
return getMLText("attr_malformed_int", array('attrname'=>$attrname, 'value'=>$attrvalue));
|
return array("attr_malformed_int", array('attrname'=>$attrname, 'value'=>$attrvalue));
|
||||||
break;
|
break;
|
||||||
case 5:
|
case 5:
|
||||||
return getMLText("attr_malformed_email", array('attrname'=>$attrname, 'value'=>$attrvalue));
|
return array("attr_malformed_email", array('attrname'=>$attrname, 'value'=>$attrvalue));
|
||||||
break;
|
break;
|
||||||
case 4:
|
case 4:
|
||||||
return getMLText("attr_malformed_url", array('attrname'=>$attrname, 'value'=>$attrvalue));
|
return array("attr_malformed_url", array('attrname'=>$attrname, 'value'=>$attrvalue));
|
||||||
break;
|
break;
|
||||||
case 3:
|
case 3:
|
||||||
return getMLText("attr_no_regex_match", array('attrname'=>$attrname, 'value'=>$attrvalue, 'regex'=>$regex));
|
return array("attr_no_regex_match", array('attrname'=>$attrname, 'value'=>$attrvalue, 'regex'=>$regex));
|
||||||
break;
|
break;
|
||||||
case 2:
|
case 2:
|
||||||
return getMLText("attr_max_values", array('attrname'=>$attrname, 'value'=>$attrvalue));
|
return array("attr_max_values", array('attrname'=>$attrname, 'value'=>$attrvalue));
|
||||||
break;
|
break;
|
||||||
case 1:
|
case 1:
|
||||||
return getMLText("attr_min_values", array('attrname'=>$attrname, 'value'=>$attrvalue));
|
return array("attr_min_values", array('attrname'=>$attrname, 'value'=>$attrvalue));
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
return getMLText("attr_validation_error", array('attrname'=>$attrname, 'value'=>$attrvalue));
|
return array("attr_validation_error", array('attrname'=>$attrname, 'value'=>$attrvalue));
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
} /* }}} */
|
} /* }}} */
|
||||||
|
|
|
@ -94,6 +94,7 @@ if(isset($_POST["attributes"]))
|
||||||
$attributes = $_POST["attributes"];
|
$attributes = $_POST["attributes"];
|
||||||
else
|
else
|
||||||
$attributes = array();
|
$attributes = array();
|
||||||
|
/* Has been moved to controller
|
||||||
foreach($attributes as $attrdefid=>$attribute) {
|
foreach($attributes as $attrdefid=>$attribute) {
|
||||||
if($attrdef = $dms->getAttributeDefinition($attrdefid)) {
|
if($attrdef = $dms->getAttributeDefinition($attrdefid)) {
|
||||||
if($attribute) {
|
if($attribute) {
|
||||||
|
@ -106,11 +107,13 @@ foreach($attributes as $attrdefid=>$attribute) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
*/
|
||||||
|
|
||||||
if(isset($_POST["attributes_version"]))
|
if(isset($_POST["attributes_version"]))
|
||||||
$attributes_version = $_POST["attributes_version"];
|
$attributes_version = $_POST["attributes_version"];
|
||||||
else
|
else
|
||||||
$attributes_version = array();
|
$attributes_version = array();
|
||||||
|
/* Has been moved to controller
|
||||||
foreach($attributes_version as $attrdefid=>$attribute) {
|
foreach($attributes_version as $attrdefid=>$attribute) {
|
||||||
$attrdef = $dms->getAttributeDefinition($attrdefid);
|
$attrdef = $dms->getAttributeDefinition($attrdefid);
|
||||||
if($attribute) {
|
if($attribute) {
|
||||||
|
@ -120,6 +123,7 @@ foreach($attributes_version as $attrdefid=>$attribute) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
*/
|
||||||
|
|
||||||
$reqversion = (int)$_POST["reqversion"];
|
$reqversion = (int)$_POST["reqversion"];
|
||||||
if ($reqversion<1) $reqversion=1;
|
if ($reqversion<1) $reqversion=1;
|
||||||
|
@ -466,7 +470,15 @@ for ($file_num=0;$file_num<count($_FILES["userfile"]["tmp_name"]);$file_num++){
|
||||||
$controller->setParam('defaultaccessdocs', $settings->_defaultAccessDocs);
|
$controller->setParam('defaultaccessdocs', $settings->_defaultAccessDocs);
|
||||||
|
|
||||||
if(!$document = $controller->run()) {
|
if(!$document = $controller->run()) {
|
||||||
UI::exitError(getMLText("folder_title", array("foldername" => $folder->getName())),getMLText($controller->getErrorMsg()));
|
$err = $controller->getErrorMsg();
|
||||||
|
if(is_string($err))
|
||||||
|
$errmsg = getMLText($err);
|
||||||
|
elseif(is_array($err)) {
|
||||||
|
$errmsg = getMLText($err[0], $err[1]);
|
||||||
|
} else {
|
||||||
|
$errmsg = $err;
|
||||||
|
}
|
||||||
|
UI::exitError(getMLText("folder_title", array("foldername" => $folder->getName())),$errmsg);
|
||||||
} else {
|
} else {
|
||||||
// Send notification to subscribers of folder.
|
// Send notification to subscribers of folder.
|
||||||
if($notifier) {
|
if($notifier) {
|
||||||
|
|
|
@ -67,6 +67,7 @@ if(isset($_POST["attributes"]))
|
||||||
$attributes = $_POST["attributes"];
|
$attributes = $_POST["attributes"];
|
||||||
else
|
else
|
||||||
$attributes = array();
|
$attributes = array();
|
||||||
|
/*
|
||||||
foreach($attributes as $attrdefid=>$attribute) {
|
foreach($attributes as $attrdefid=>$attribute) {
|
||||||
$attrdef = $dms->getAttributeDefinition($attrdefid);
|
$attrdef = $dms->getAttributeDefinition($attrdefid);
|
||||||
if($attribute) {
|
if($attribute) {
|
||||||
|
@ -78,6 +79,7 @@ foreach($attributes as $attrdefid=>$attribute) {
|
||||||
UI::exitError(getMLText("folder_title", array("foldername" => $document->getName())),getMLText("attr_min_values", array("attrname"=>$attrdef->getName())));
|
UI::exitError(getMLText("folder_title", array("foldername" => $document->getName())),getMLText("attr_min_values", array("attrname"=>$attrdef->getName())));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
*/
|
||||||
|
|
||||||
/* Check if additional notification shall be added */
|
/* Check if additional notification shall be added */
|
||||||
$notusers = array();
|
$notusers = array();
|
||||||
|
|
|
@ -127,9 +127,15 @@ $controller->setParam('expires', $expires);
|
||||||
$controller->setParam('sequence', $sequence);
|
$controller->setParam('sequence', $sequence);
|
||||||
$controller->setParam('attributes', $attributes);
|
$controller->setParam('attributes', $attributes);
|
||||||
if(!$controller->run()) {
|
if(!$controller->run()) {
|
||||||
if($controller->getErrorMsg()) {
|
$err = $controller->getErrorMsg();
|
||||||
UI::exitError(getMLText("document_title", array("documentname" => $document->getName())), $controller->getErrorMsg());
|
if(is_string($err))
|
||||||
|
$errmsg = getMLText($err);
|
||||||
|
elseif(is_array($err)) {
|
||||||
|
$errmsg = getMLText($err[0], $err[1]);
|
||||||
|
} else {
|
||||||
|
$errmsg = $err;
|
||||||
}
|
}
|
||||||
|
UI::exitError(getMLText("document_title", array("documentname" => $document->getName())), $errmsg);
|
||||||
}
|
}
|
||||||
|
|
||||||
if ($oldname != $name) {
|
if ($oldname != $name) {
|
||||||
|
|
|
@ -80,9 +80,15 @@ $controller->setParam('comment', $comment);
|
||||||
$controller->setParam('sequence', $sequence);
|
$controller->setParam('sequence', $sequence);
|
||||||
$controller->setParam('attributes', $attributes);
|
$controller->setParam('attributes', $attributes);
|
||||||
if(!$controller->run()) {
|
if(!$controller->run()) {
|
||||||
if($controller->getErrorMsg()) {
|
$err = $controller->getErrorMsg();
|
||||||
UI::exitError(getMLText("folder_title", array("foldername" => $folder->getName())), $controller->getErrorMsg());
|
if(is_string($err))
|
||||||
|
$errmsg = getMLText($err);
|
||||||
|
elseif(is_array($err)) {
|
||||||
|
$errmsg = getMLText($err[0], $err[1]);
|
||||||
|
} else {
|
||||||
|
$errmsg = $err;
|
||||||
}
|
}
|
||||||
|
UI::exitError(getMLText("folder_title", array("foldername" => $folder->getName())), $errmsg);
|
||||||
}
|
}
|
||||||
|
|
||||||
if($oldname != $name) {
|
if($oldname != $name) {
|
||||||
|
|
|
@ -562,14 +562,14 @@ background-image: linear-gradient(to bottom, #882222, #111111);;
|
||||||
foreach($menuitems as $menuitem) {
|
foreach($menuitems as $menuitem) {
|
||||||
if(!empty($menuitem['children'])) {
|
if(!empty($menuitem['children'])) {
|
||||||
echo " <li class=\"dropdown\">\n";
|
echo " <li class=\"dropdown\">\n";
|
||||||
echo " <a href=\"".$menuitem['link']."\" class=\"dropdown-toggle\" data-toggle=\"dropdown\">".getMLText($menuitem['label'])." <i class=\"icon-caret-down\"></i></a>\n";
|
echo " <a class=\"dropdown-toggle\" data-toggle=\"dropdown\">".getMLText($menuitem['label'])." <i class=\"icon-caret-down\"></i></a>\n";
|
||||||
echo " <ul class=\"dropdown-menu\" role=\"menu\">\n";
|
echo " <ul class=\"dropdown-menu\" role=\"menu\">\n";
|
||||||
foreach($menuitem['children'] as $submenuitem) {
|
foreach($menuitem['children'] as $submenuitem) {
|
||||||
echo " <li><a href=\"".$submenuitem['link']."\">".getMLText($submenuitem['label'])."</a></li>\n";
|
echo " <li><a href=\"".$submenuitem['link']."\"".(isset($submenuitem['target']) ? ' target="'.$submenuitem['target'].'"' : '').">".getMLText($submenuitem['label'])."</a></li>\n";
|
||||||
}
|
}
|
||||||
echo " </ul>\n";
|
echo " </ul>\n";
|
||||||
} else {
|
} else {
|
||||||
echo "<li><a href=\"".$menuitem['link']."\">".getMLText($menuitem['label'])."</a></li>";
|
echo "<li><a href=\"".$menuitem['link']."\"".(isset($menuitem['target']) ? ' target="'.$menuitem['target'].'"' : '').">".getMLText($menuitem['label'])."</a></li>";
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
} /* }}} */
|
} /* }}} */
|
||||||
|
@ -1157,6 +1157,8 @@ background-image: linear-gradient(to bottom, #882222, #111111);;
|
||||||
$icons["rar"] = "package.svg";
|
$icons["rar"] = "package.svg";
|
||||||
$icons["mpg"] = "video.svg";
|
$icons["mpg"] = "video.svg";
|
||||||
$icons["avi"] = "video.svg";
|
$icons["avi"] = "video.svg";
|
||||||
|
$icons["webm"] = "video.svg";
|
||||||
|
$icons["mkv"] = "video.svg";
|
||||||
$icons["ods"] = "office-spreadsheet.svg";
|
$icons["ods"] = "office-spreadsheet.svg";
|
||||||
$icons["ots"] = "office-spreadsheet.svg";
|
$icons["ots"] = "office-spreadsheet.svg";
|
||||||
$icons["sxc"] = "office-spreadsheet.svg";
|
$icons["sxc"] = "office-spreadsheet.svg";
|
||||||
|
@ -2716,12 +2718,13 @@ $('body').on('click', '[id^=\"table-row-document\"] td:nth-child(2)', function(e
|
||||||
// $content .= "<td></td>";
|
// $content .= "<td></td>";
|
||||||
$content .= "<td>";
|
$content .= "<td>";
|
||||||
$content .= "<div class=\"list-action\">";
|
$content .= "<div class=\"list-action\">";
|
||||||
if($subFolder->getAccessMode($user) >= M_ALL) {
|
$subFolderAccessMode = $subFolder->getAccessMode($user);
|
||||||
|
if($subFolderAccessMode >= M_ALL) {
|
||||||
$content .= $this->printDeleteFolderButton($subFolder, 'splash_rm_folder', true);
|
$content .= $this->printDeleteFolderButton($subFolder, 'splash_rm_folder', true);
|
||||||
} else {
|
} else {
|
||||||
$content .= '<span style="padding: 2px; color: #CCC;"><i class="icon-remove"></i></span>';
|
$content .= '<span style="padding: 2px; color: #CCC;"><i class="icon-remove"></i></span>';
|
||||||
}
|
}
|
||||||
if($subFolder->getAccessMode($user) >= M_READWRITE) {
|
if($subFolderAccessMode >= M_READWRITE) {
|
||||||
$content .= '<a class_="btn btn-mini" href="../out/out.EditFolder.php?folderid='.$subFolder->getID().'" title="'.getMLText("edit_folder_props").'"><i class="icon-edit"></i></a>';
|
$content .= '<a class_="btn btn-mini" href="../out/out.EditFolder.php?folderid='.$subFolder->getID().'" title="'.getMLText("edit_folder_props").'"><i class="icon-edit"></i></a>';
|
||||||
} else {
|
} else {
|
||||||
$content .= '<span style="padding: 2px; color: #CCC;"><i class="icon-edit"></i></span>';
|
$content .= '<span style="padding: 2px; color: #CCC;"><i class="icon-edit"></i></span>';
|
||||||
|
|
|
@ -388,6 +388,7 @@ class SeedDMS_View_ViewDocument extends SeedDMS_Bootstrap_Style {
|
||||||
case 'video/avi':
|
case 'video/avi':
|
||||||
case 'video/msvideo':
|
case 'video/msvideo':
|
||||||
case 'video/x-msvideo':
|
case 'video/x-msvideo':
|
||||||
|
case 'video/x-matroska':
|
||||||
$this->contentHeading(getMLText("preview"));
|
$this->contentHeading(getMLText("preview"));
|
||||||
?>
|
?>
|
||||||
<video controls style="width: 100%;">
|
<video controls style="width: 100%;">
|
||||||
|
|
|
@ -555,6 +555,9 @@ $('body').on('click', '.order-btn', function(ev) {
|
||||||
}
|
}
|
||||||
if ($LeftColumnSpan > 0) {
|
if ($LeftColumnSpan > 0) {
|
||||||
echo "<div class=\"span".$LeftColumnSpan."\">\n";
|
echo "<div class=\"span".$LeftColumnSpan."\">\n";
|
||||||
|
|
||||||
|
echo $this->callHook('leftContentPre');
|
||||||
|
|
||||||
if ($enableFolderTree) {
|
if ($enableFolderTree) {
|
||||||
if ($showtree==1){
|
if ($showtree==1){
|
||||||
$this->contentHeading("<a href=\"../out/out.ViewFolder.php?folderid=". $folderid."&showtree=0\"><i class=\"icon-minus-sign\"></i></a>", true);
|
$this->contentHeading("<a href=\"../out/out.ViewFolder.php?folderid=". $folderid."&showtree=0\"><i class=\"icon-minus-sign\"></i></a>", true);
|
||||||
|
@ -574,6 +577,8 @@ $('body').on('click', '.order-btn', function(ev) {
|
||||||
|
|
||||||
if ($enableClipboard) $this->printClipboard($this->params['session']->getClipboard(), $previewer);
|
if ($enableClipboard) $this->printClipboard($this->params['session']->getClipboard(), $previewer);
|
||||||
|
|
||||||
|
echo $this->callHook('leftContentPost');
|
||||||
|
|
||||||
echo "</div>\n";
|
echo "</div>\n";
|
||||||
}
|
}
|
||||||
echo "<div class=\"span".$RightColumnSpan."\">\n";
|
echo "<div class=\"span".$RightColumnSpan."\">\n";
|
||||||
|
|
Loading…
Reference in New Issue
Block a user