mirror of
https://git.code.sf.net/p/seeddms/code
synced 2024-11-26 15:32:13 +00:00
attributes of type user, group, document, folder are now an object
This commit is contained in:
parent
8d758085a4
commit
2fe99c2905
|
@ -55,13 +55,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) {
|
foreach($attributes as $attrdefid=>&$attribute) {
|
||||||
if($attrdef = $dms->getAttributeDefinition($attrdefid)) {
|
if($attrdef = $dms->getAttributeDefinition($attrdefid)) {
|
||||||
if(null === ($ret = $this->callHook('validateAttribute', $attrdef, $attribute))) {
|
if(null === ($ret = $this->callHook('validateAttribute', $attrdef, $attribute))) {
|
||||||
if($attribute) {
|
if($attribute) {
|
||||||
switch($attrdef->getType()) {
|
switch($attrdef->getType()) {
|
||||||
case SeedDMS_Core_AttributeDefinition::type_date:
|
case SeedDMS_Core_AttributeDefinition::type_date:
|
||||||
$attribute = date('Y-m-d', makeTsFromDate($attribute));
|
if(is_array($attribute))
|
||||||
|
$attribute = array_map(fn($value): string => date('Y-m-d', makeTsFromDate($value)), $attribute);
|
||||||
|
else
|
||||||
|
$attribute = date('Y-m-d', makeTsFromDate($attribute));
|
||||||
|
break;
|
||||||
|
case SeedDMS_Core_AttributeDefinition::type_folder:
|
||||||
|
if(is_array($attribute))
|
||||||
|
$attribute = array_map(fn($value): object => $dms->getFolder((int) $value), $attribute);
|
||||||
|
else
|
||||||
|
$attribute = $dms->getFolder((int) $attribute);
|
||||||
|
break;
|
||||||
|
case SeedDMS_Core_AttributeDefinition::type_document:
|
||||||
|
if(is_array($attribute))
|
||||||
|
$attribute = array_map(fn($value): object => $dms->getDocument((int) $value), $attribute);
|
||||||
|
else
|
||||||
|
$attribute = $dms->getDocument((int) $attribute);
|
||||||
|
break;
|
||||||
|
case SeedDMS_Core_AttributeDefinition::type_user:
|
||||||
|
if(is_array($attribute))
|
||||||
|
$attribute = array_map(fn($value): object => $dms->getUser((int) $value), $attribute);
|
||||||
|
else
|
||||||
|
$attribute = $dms->getUser((int) $attribute);
|
||||||
|
break;
|
||||||
|
case SeedDMS_Core_AttributeDefinition::type_group:
|
||||||
|
if(is_array($attribute))
|
||||||
|
$attribute = array_map(fn($value): object => $dms->getGroup((int) $value), $attribute);
|
||||||
|
else
|
||||||
|
$attribute = $dms->getGroup((int) $attribute);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
if(!$attrdef->validate($attribute, null, true)) {
|
if(!$attrdef->validate($attribute, null, true)) {
|
||||||
|
@ -79,13 +106,40 @@ class SeedDMS_Controller_AddDocument extends SeedDMS_Controller_Common {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if($attributes_version = $this->getParam('attributesversion')) {
|
if($attributes_version = $this->getParam('attributesversion')) {
|
||||||
foreach($attributes_version as $attrdefid=>$attribute) {
|
foreach($attributes_version as $attrdefid=>&$attribute) {
|
||||||
if($attrdef = $dms->getAttributeDefinition($attrdefid)) {
|
if($attrdef = $dms->getAttributeDefinition($attrdefid)) {
|
||||||
if(null === ($ret = $this->callHook('validateAttribute', $attrdef, $attribute))) {
|
if(null === ($ret = $this->callHook('validateAttribute', $attrdef, $attribute))) {
|
||||||
if($attribute) {
|
if($attribute) {
|
||||||
switch($attrdef->getType()) {
|
switch($attrdef->getType()) {
|
||||||
case SeedDMS_Core_AttributeDefinition::type_date:
|
case SeedDMS_Core_AttributeDefinition::type_date:
|
||||||
$attribute = date('Y-m-d', makeTsFromDate($attribute));
|
if(is_array($attribute))
|
||||||
|
$attribute = array_map(fn($value): string => date('Y-m-d', makeTsFromDate($value)), $attribute);
|
||||||
|
else
|
||||||
|
$attribute = date('Y-m-d', makeTsFromDate($attribute));
|
||||||
|
break;
|
||||||
|
case SeedDMS_Core_AttributeDefinition::type_folder:
|
||||||
|
if(is_array($attribute))
|
||||||
|
$attribute = array_map(fn($value): object => $dms->getFolder((int) $value), $attribute);
|
||||||
|
else
|
||||||
|
$attribute = $dms->getFolder((int) $attribute);
|
||||||
|
break;
|
||||||
|
case SeedDMS_Core_AttributeDefinition::type_document:
|
||||||
|
if(is_array($attribute))
|
||||||
|
$attribute = array_map(fn($value): object => $dms->getDocument((int) $value), $attribute);
|
||||||
|
else
|
||||||
|
$attribute = $dms->getDocument((int) $attribute);
|
||||||
|
break;
|
||||||
|
case SeedDMS_Core_AttributeDefinition::type_user:
|
||||||
|
if(is_array($attribute))
|
||||||
|
$attribute = array_map(fn($value): object => $dms->getUser((int) $value), $attribute);
|
||||||
|
else
|
||||||
|
$attribute = $dms->getUser((int) $attribute);
|
||||||
|
break;
|
||||||
|
case SeedDMS_Core_AttributeDefinition::type_group:
|
||||||
|
if(is_array($attribute))
|
||||||
|
$attribute = array_map(fn($value): object => $dms->getGroup((int) $value), $attribute);
|
||||||
|
else
|
||||||
|
$attribute = $dms->getGroup((int) $attribute);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
if(!$attrdef->validate($attribute, null, true)) {
|
if(!$attrdef->validate($attribute, null, true)) {
|
||||||
|
|
|
@ -41,13 +41,40 @@ 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) {
|
foreach($attributes as $attrdefid=>&$attribute) {
|
||||||
if($attrdef = $dms->getAttributeDefinition($attrdefid)) {
|
if($attrdef = $dms->getAttributeDefinition($attrdefid)) {
|
||||||
if(null === ($ret = $this->callHook('validateAttribute', $attrdef, $attribute))) {
|
if(null === ($ret = $this->callHook('validateAttribute', $attrdef, $attribute))) {
|
||||||
if($attribute) {
|
if($attribute) {
|
||||||
switch($attrdef->getType()) {
|
switch($attrdef->getType()) {
|
||||||
case SeedDMS_Core_AttributeDefinition::type_date:
|
case SeedDMS_Core_AttributeDefinition::type_date:
|
||||||
$attribute = date('Y-m-d', makeTsFromDate($attribute));
|
if(is_array($attribute))
|
||||||
|
$attribute = array_map(fn($value): string => date('Y-m-d', makeTsFromDate($value)), $attribute);
|
||||||
|
else
|
||||||
|
$attribute = date('Y-m-d', makeTsFromDate($attribute));
|
||||||
|
break;
|
||||||
|
case SeedDMS_Core_AttributeDefinition::type_folder:
|
||||||
|
if(is_array($attribute))
|
||||||
|
$attribute = array_map(fn($value): object => $dms->getFolder((int) $value), $attribute);
|
||||||
|
else
|
||||||
|
$attribute = $dms->getFolder((int) $attribute);
|
||||||
|
break;
|
||||||
|
case SeedDMS_Core_AttributeDefinition::type_document:
|
||||||
|
if(is_array($attribute))
|
||||||
|
$attribute = array_map(fn($value): object => $dms->getDocument((int) $value), $attribute);
|
||||||
|
else
|
||||||
|
$attribute = $dms->getDocument((int) $attribute);
|
||||||
|
break;
|
||||||
|
case SeedDMS_Core_AttributeDefinition::type_user:
|
||||||
|
if(is_array($attribute))
|
||||||
|
$attribute = array_map(fn($value): object => $dms->getUser((int) $value), $attribute);
|
||||||
|
else
|
||||||
|
$attribute = $dms->getUser((int) $attribute);
|
||||||
|
break;
|
||||||
|
case SeedDMS_Core_AttributeDefinition::type_group:
|
||||||
|
if(is_array($attribute))
|
||||||
|
$attribute = array_map(fn($value): object => $dms->getGroup((int) $value), $attribute);
|
||||||
|
else
|
||||||
|
$attribute = $dms->getGroup((int) $attribute);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
if(!$attrdef->validate($attribute, null, true)) {
|
if(!$attrdef->validate($attribute, null, true)) {
|
||||||
|
|
|
@ -122,7 +122,34 @@ class SeedDMS_Controller_EditDocument extends SeedDMS_Controller_Common {
|
||||||
if($attribute) {
|
if($attribute) {
|
||||||
switch($attrdef->getType()) {
|
switch($attrdef->getType()) {
|
||||||
case SeedDMS_Core_AttributeDefinition::type_date:
|
case SeedDMS_Core_AttributeDefinition::type_date:
|
||||||
$attribute = date('Y-m-d', makeTsFromDate($attribute));
|
if(is_array($attribute))
|
||||||
|
$attribute = array_map(fn($value): string => date('Y-m-d', makeTsFromDate($value)), $attribute);
|
||||||
|
else
|
||||||
|
$attribute = date('Y-m-d', makeTsFromDate($attribute));
|
||||||
|
break;
|
||||||
|
case SeedDMS_Core_AttributeDefinition::type_folder:
|
||||||
|
if(is_array($attribute))
|
||||||
|
$attribute = array_map(fn($value): object => $dms->getFolder((int) $value), $attribute);
|
||||||
|
else
|
||||||
|
$attribute = $dms->getFolder((int) $attribute);
|
||||||
|
break;
|
||||||
|
case SeedDMS_Core_AttributeDefinition::type_document:
|
||||||
|
if(is_array($attribute))
|
||||||
|
$attribute = array_map(fn($value): object => $dms->getDocument((int) $value), $attribute);
|
||||||
|
else
|
||||||
|
$attribute = $dms->getDocument((int) $attribute);
|
||||||
|
break;
|
||||||
|
case SeedDMS_Core_AttributeDefinition::type_user:
|
||||||
|
if(is_array($attribute))
|
||||||
|
$attribute = array_map(fn($value): object => $dms->getUser((int) $value), $attribute);
|
||||||
|
else
|
||||||
|
$attribute = $dms->getUser((int) $attribute);
|
||||||
|
break;
|
||||||
|
case SeedDMS_Core_AttributeDefinition::type_group:
|
||||||
|
if(is_array($attribute))
|
||||||
|
$attribute = array_map(fn($value): object => $dms->getGroup((int) $value), $attribute);
|
||||||
|
else
|
||||||
|
$attribute = $dms->getGroup((int) $attribute);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
if(!$attrdef->validate($attribute, $document, false)) {
|
if(!$attrdef->validate($attribute, $document, false)) {
|
||||||
|
|
|
@ -51,33 +51,61 @@ class SeedDMS_Controller_EditFolder extends SeedDMS_Controller_Common {
|
||||||
$oldattributes = $folder->getAttributes();
|
$oldattributes = $folder->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(null === ($ret = $this->callHook('validateAttribute', $attrdef, $attribute))) {
|
||||||
if($attribute) {
|
if($attribute) {
|
||||||
switch($attrdef->getType()) {
|
switch($attrdef->getType()) {
|
||||||
case SeedDMS_Core_AttributeDefinition::type_date:
|
case SeedDMS_Core_AttributeDefinition::type_date:
|
||||||
$attribute = date('Y-m-d', makeTsFromDate($attribute));
|
if(is_array($attribute))
|
||||||
break;
|
$attribute = array_map(fn($value): string => date('Y-m-d', makeTsFromDate($value)), $attribute);
|
||||||
}
|
else
|
||||||
if(!$attrdef->validate($attribute, $folder, false)) {
|
$attribute = date('Y-m-d', makeTsFromDate($attribute));
|
||||||
$this->errormsg = getAttributeValidationText($attrdef->getValidationError(), $attrdef->getName(), $attribute);
|
break;
|
||||||
return false;
|
case SeedDMS_Core_AttributeDefinition::type_folder:
|
||||||
}
|
if(is_array($attribute))
|
||||||
|
$attribute = array_map(fn($value): object => $dms->getFolder((int) $value), $attribute);
|
||||||
|
else
|
||||||
|
$attribute = $dms->getFolder((int) $attribute);
|
||||||
|
break;
|
||||||
|
case SeedDMS_Core_AttributeDefinition::type_document:
|
||||||
|
if(is_array($attribute))
|
||||||
|
$attribute = array_map(fn($value): object => $dms->getDocument((int) $value), $attribute);
|
||||||
|
else
|
||||||
|
$attribute = $dms->getDocument((int) $attribute);
|
||||||
|
break;
|
||||||
|
case SeedDMS_Core_AttributeDefinition::type_user:
|
||||||
|
if(is_array($attribute))
|
||||||
|
$attribute = array_map(fn($value): object => $dms->getUser((int) $value), $attribute);
|
||||||
|
else
|
||||||
|
$attribute = $dms->getUser((int) $attribute);
|
||||||
|
break;
|
||||||
|
case SeedDMS_Core_AttributeDefinition::type_group:
|
||||||
|
if(is_array($attribute))
|
||||||
|
$attribute = array_map(fn($value): object => $dms->getGroup((int) $value), $attribute);
|
||||||
|
else
|
||||||
|
$attribute = $dms->getGroup((int) $attribute);
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
if(!$attrdef->validate($attribute, $folder, false)) {
|
||||||
|
$this->errormsg = getAttributeValidationText($attrdef->getValidationError(), $attrdef->getName(), $attribute);
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
if(!isset($oldattributes[$attrdefid]) || $attribute != $oldattributes[$attrdefid]->getValue()) {
|
if(!isset($oldattributes[$attrdefid]) || $attribute != $oldattributes[$attrdefid]->getValue()) {
|
||||||
if(!$folder->setAttributeValue($dms->getAttributeDefinition($attrdefid), $attribute))
|
if(!$folder->setAttributeValue($dms->getAttributeDefinition($attrdefid), $attribute))
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
} elseif($attrdef->getMinValues() > 0) {
|
||||||
|
$this->errormsg = getMLText("attr_min_values", array("attrname"=>$attrdef->getName()));
|
||||||
|
return false;
|
||||||
|
} elseif(isset($oldattributes[$attrdefid])) {
|
||||||
|
if(!$folder->removeAttribute($dms->getAttributeDefinition($attrdefid)))
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
if($ret === false)
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
} elseif($attrdef->getMinValues() > 0) {
|
|
||||||
$this->errormsg = getMLText("attr_min_values", array("attrname"=>$attrdef->getName()));
|
|
||||||
return false;
|
|
||||||
} elseif(isset($oldattributes[$attrdefid])) {
|
|
||||||
if(!$folder->removeAttribute($dms->getAttributeDefinition($attrdefid)))
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
} else {
|
|
||||||
if($ret === false)
|
|
||||||
return false;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -70,27 +70,55 @@ foreach($version->getAttributes() as $ai=>$aa)
|
||||||
$attributes = $_POST["attributes"];
|
$attributes = $_POST["attributes"];
|
||||||
if($attributes) {
|
if($attributes) {
|
||||||
foreach($attributes as $attrdefid=>$attribute) {
|
foreach($attributes as $attrdefid=>$attribute) {
|
||||||
$attrdef = $dms->getAttributeDefinition($attrdefid);
|
if($attrdef = $dms->getAttributeDefinition($attrdefid)) {
|
||||||
if($attribute) {
|
if($attribute) {
|
||||||
switch($attrdef->getType()) {
|
switch($attrdef->getType()) {
|
||||||
case SeedDMS_Core_AttributeDefinition::type_date:
|
case SeedDMS_Core_AttributeDefinition::type_date:
|
||||||
$attribute = date('Y-m-d', makeTsFromDate($attribute));
|
if(is_array($attribute))
|
||||||
break;
|
$attribute = array_map(fn($value): string => date('Y-m-d', makeTsFromDate($value)), $attribute);
|
||||||
}
|
else
|
||||||
if(!$attrdef->validate($attribute, $version, false)) {
|
$attribute = date('Y-m-d', makeTsFromDate($attribute));
|
||||||
$errmsg = getAttributeValidationText($attrdef->getValidationError(), $attrdef->getName(), $attribute);
|
break;
|
||||||
UI::exitError(getMLText("document_title", array("documentname" => $document->getName())), $errmsg);
|
case SeedDMS_Core_AttributeDefinition::type_folder:
|
||||||
}
|
if(is_array($attribute))
|
||||||
if(!isset($oldattributes[$attrdefid]) || $attribute != $oldattributes[$attrdefid]->getValue()) {
|
$attribute = array_map(fn($value): object => $dms->getFolder((int) $value), $attribute);
|
||||||
if(!$version->setAttributeValue($dms->getAttributeDefinition($attrdefid), $attribute)) {
|
else
|
||||||
UI::exitError(getMLText("document_title", array("documentname" => $document->getName())),getMLText("error_occured"));
|
$attribute = $dms->getFolder((int) $attribute);
|
||||||
|
break;
|
||||||
|
case SeedDMS_Core_AttributeDefinition::type_document:
|
||||||
|
if(is_array($attribute))
|
||||||
|
$attribute = array_map(fn($value): object => $dms->getDocument((int) $value), $attribute);
|
||||||
|
else
|
||||||
|
$attribute = $dms->getDocument((int) $attribute);
|
||||||
|
break;
|
||||||
|
case SeedDMS_Core_AttributeDefinition::type_user:
|
||||||
|
if(is_array($attribute))
|
||||||
|
$attribute = array_map(fn($value): object => $dms->getUser((int) $value), $attribute);
|
||||||
|
else
|
||||||
|
$attribute = $dms->getUser((int) $attribute);
|
||||||
|
break;
|
||||||
|
case SeedDMS_Core_AttributeDefinition::type_group:
|
||||||
|
if(is_array($attribute))
|
||||||
|
$attribute = array_map(fn($value): object => $dms->getGroup((int) $value), $attribute);
|
||||||
|
else
|
||||||
|
$attribute = $dms->getGroup((int) $attribute);
|
||||||
|
break;
|
||||||
}
|
}
|
||||||
|
if(!$attrdef->validate($attribute, $version, false)) {
|
||||||
|
$errmsg = getAttributeValidationText($attrdef->getValidationError(), $attrdef->getName(), $attribute);
|
||||||
|
UI::exitError(getMLText("document_title", array("documentname" => $document->getName())), $errmsg);
|
||||||
|
}
|
||||||
|
if(!isset($oldattributes[$attrdefid]) || $attribute != $oldattributes[$attrdefid]->getValue()) {
|
||||||
|
if(!$version->setAttributeValue($dms->getAttributeDefinition($attrdefid), $attribute)) {
|
||||||
|
UI::exitError(getMLText("document_title", array("documentname" => $document->getName())),getMLText("error_occured"));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
} elseif($attrdef->getMinValues() > 0) {
|
||||||
|
UI::exitError(getMLText("document_title", array("documentname" => $document->getName())),getMLText("attr_min_values", array("attrname"=>$attrdef->getName())));
|
||||||
|
} elseif(isset($oldattributes[$attrdefid])) {
|
||||||
|
if(!$version->removeAttribute($dms->getAttributeDefinition($attrdefid)))
|
||||||
|
UI::exitError(getMLText("document_title", array("documentname" => $folder->getName())),getMLText("error_occured"));
|
||||||
}
|
}
|
||||||
} elseif($attrdef->getMinValues() > 0) {
|
|
||||||
UI::exitError(getMLText("document_title", array("documentname" => $document->getName())),getMLText("attr_min_values", array("attrname"=>$attrdef->getName())));
|
|
||||||
} elseif(isset($oldattributes[$attrdefid])) {
|
|
||||||
if(!$version->removeAttribute($dms->getAttributeDefinition($attrdefid)))
|
|
||||||
UI::exitError(getMLText("document_title", array("documentname" => $folder->getName())),getMLText("error_occured"));
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -93,14 +93,26 @@ $(document).ready( function() {
|
||||||
$content .= "</tr></thead>\n<tbody>\n";
|
$content .= "</tr></thead>\n<tbody>\n";
|
||||||
$separator = $selattrdef->getValueSetSeparator();
|
$separator = $selattrdef->getValueSetSeparator();
|
||||||
foreach($res['frequencies'][$type] as $entry) {
|
foreach($res['frequencies'][$type] as $entry) {
|
||||||
$value = $selattrdef->parseValue($entry['value']);
|
if(is_array($entry['value'])) {
|
||||||
|
$values = $entry['value'];
|
||||||
|
} else {
|
||||||
|
$values = [$entry['value']];
|
||||||
|
}
|
||||||
|
$value = [];
|
||||||
|
foreach($values as $v) {
|
||||||
|
if(is_object($v))
|
||||||
|
$value[] = $v->getId();
|
||||||
|
else
|
||||||
|
$value[] = $v;
|
||||||
|
}
|
||||||
|
// $value = $selattrdef->parseValue($entry['value']);
|
||||||
$content .= "<tr>";
|
$content .= "<tr>";
|
||||||
$content .= "<td>".htmlspecialchars(implode('<span style="color: #aaa;">'.($separator ? ' '.$separator.' ' : ' ; ').'</span>', $value))."</td>";
|
$content .= "<td>".htmlspecialchars(implode('<span style="color: #aaa;">'.($separator ? ' '.$separator.' ' : ' ; ').'</span>', $value))."</td>";
|
||||||
$content .= "<td><a href=\"../out/out.Search.php?fullsearch=0&resultmode=".($type == 'folder' ? 2 : ($type == 'document' ? 1 : 3))."&";
|
$content .= "<td><a href=\"../out/out.Search.php?fullsearch=0&resultmode=".($type == 'folder' ? 2 : ($type == 'document' ? 1 : 3))."&";
|
||||||
if($selattrdef->getType() == SeedDMS_Core_AttributeDefinition::type_date)
|
if($selattrdef->getType() == SeedDMS_Core_AttributeDefinition::type_date)
|
||||||
$content .= "attributes[".$selattrdef->getID()."][from]=".urlencode($entry['value'])."&attributes[".$selattrdef->getID()."][to]=".urlencode($entry['value']);
|
$content .= "attributes[".$selattrdef->getID()."][from]=".urlencode($entry['value'])."&attributes[".$selattrdef->getID()."][to]=".urlencode($entry['value']);
|
||||||
else
|
else
|
||||||
$content .= "attributes[".$selattrdef->getID()."]=".urlencode($entry['value']);
|
$content .= "attributes[".$selattrdef->getID()."]=".urlencode($value[0]);
|
||||||
$content .= "\">".urlencode($entry['c'])."</a></td>";
|
$content .= "\">".urlencode($entry['c'])."</a></td>";
|
||||||
$content .= "<td>";
|
$content .= "<td>";
|
||||||
/* various checks, if the value is valid */
|
/* various checks, if the value is valid */
|
||||||
|
|
|
@ -1879,26 +1879,23 @@ $(document).ready(function() {
|
||||||
case SeedDMS_Core_AttributeDefinition::type_folder:
|
case SeedDMS_Core_AttributeDefinition::type_folder:
|
||||||
$attrs = $attribute->getValueAsArray();
|
$attrs = $attribute->getValueAsArray();
|
||||||
$tmp = array();
|
$tmp = array();
|
||||||
foreach($attrs as $attr) {
|
foreach($attrs as $targetfolder) {
|
||||||
if($targetfolder = $dms->getFolder(intval($attr)))
|
$tmp[] = '<a href="'.$this->params['settings']->_httpRoot.'out/out.ViewFolder.php?folderid='.$targetfolder->getId().'">'.htmlspecialchars($targetfolder->getName()).'</a>';
|
||||||
$tmp[] = '<a href="'.$this->params['settings']->_httpRoot.'out/out.ViewFolder.php?folderid='.$targetfolder->getId().'">'.htmlspecialchars($targetfolder->getName()).'</a>';
|
|
||||||
}
|
}
|
||||||
return implode('<br />', $tmp);
|
return implode('<br />', $tmp);
|
||||||
break;
|
break;
|
||||||
case SeedDMS_Core_AttributeDefinition::type_document:
|
case SeedDMS_Core_AttributeDefinition::type_document:
|
||||||
$attrs = $attribute->getValueAsArray();
|
$attrs = $attribute->getValueAsArray();
|
||||||
$tmp = array();
|
$tmp = array();
|
||||||
foreach($attrs as $attr) {
|
foreach($attrs as $targetdoc) {
|
||||||
if($targetdoc = $dms->getDocument(intval($attr)))
|
$tmp[] = '<a href="'.$this->params['settings']->_httpRoot.'out/out.ViewDocument.php?documentid='.$targetdoc->getId().'">'.htmlspecialchars($targetdoc->getName()).'</a>';
|
||||||
$tmp[] = '<a href="'.$this->params['settings']->_httpRoot.'out/out.ViewDocument.php?documentid='.$targetdoc->getId().'">'.htmlspecialchars($targetdoc->getName()).'</a>';
|
|
||||||
}
|
}
|
||||||
return implode('<br />', $tmp);
|
return implode('<br />', $tmp);
|
||||||
break;
|
break;
|
||||||
case SeedDMS_Core_AttributeDefinition::type_user:
|
case SeedDMS_Core_AttributeDefinition::type_user:
|
||||||
$attrs = $attribute->getValueAsArray();
|
$attrs = $attribute->getValueAsArray();
|
||||||
$tmp = array();
|
$tmp = array();
|
||||||
foreach($attrs as $attr) {
|
foreach($attrs as $curuser) {
|
||||||
$curuser = $dms->getUser((int) $attr);
|
|
||||||
$tmp[] = htmlspecialchars($curuser->getFullname()." (".$curuser->getLogin().")");
|
$tmp[] = htmlspecialchars($curuser->getFullname()." (".$curuser->getLogin().")");
|
||||||
}
|
}
|
||||||
return implode('<br />', $tmp);
|
return implode('<br />', $tmp);
|
||||||
|
@ -1906,8 +1903,7 @@ $(document).ready(function() {
|
||||||
case SeedDMS_Core_AttributeDefinition::type_group:
|
case SeedDMS_Core_AttributeDefinition::type_group:
|
||||||
$attrs = $attribute->getValueAsArray();
|
$attrs = $attribute->getValueAsArray();
|
||||||
$tmp = array();
|
$tmp = array();
|
||||||
foreach($attrs as $attr) {
|
foreach($attrs as $curgroup) {
|
||||||
$curgroup = $dms->getGroup((int) $attr);
|
|
||||||
$tmp[] = htmlspecialchars($curgroup->getName());
|
$tmp[] = htmlspecialchars($curgroup->getName());
|
||||||
}
|
}
|
||||||
return implode('<br />', $tmp);
|
return implode('<br />', $tmp);
|
||||||
|
@ -1957,23 +1953,18 @@ $(document).ready(function() {
|
||||||
$content .= "<input type=\"text\" id=\"".$attr_id."\" name=\"".$attr_name."\" value=\"".htmlspecialchars($objvalue)."\"".((!$norequire && $attrdef->getMinValues() > 0) ? ' required="required"' : '')." data-rule-number=\"true\"/>";
|
$content .= "<input type=\"text\" id=\"".$attr_id."\" name=\"".$attr_name."\" value=\"".htmlspecialchars($objvalue)."\"".((!$norequire && $attrdef->getMinValues() > 0) ? ' required="required"' : '')." data-rule-number=\"true\"/>";
|
||||||
break; */
|
break; */
|
||||||
case SeedDMS_Core_AttributeDefinition::type_folder:
|
case SeedDMS_Core_AttributeDefinition::type_folder:
|
||||||
$objvalue = $attribute ? (is_object($attribute) ? (int) $attribute->getValue() : (int) $attribute) : 0;
|
$target = $attribute ? $attribute->getValue() : null;
|
||||||
if($objvalue)
|
|
||||||
$target = $dms->getFolder($objvalue);
|
|
||||||
else
|
|
||||||
$target = null;
|
|
||||||
$content .= $this->getFolderChooserHtml("attr".$attrdef->getId(), M_READWRITE, -1, $target, $attr_name, false);
|
$content .= $this->getFolderChooserHtml("attr".$attrdef->getId(), M_READWRITE, -1, $target, $attr_name, false);
|
||||||
break;
|
break;
|
||||||
case SeedDMS_Core_AttributeDefinition::type_document:
|
case SeedDMS_Core_AttributeDefinition::type_document:
|
||||||
$objvalue = $attribute ? (is_object($attribute) ? (int) $attribute->getValue() : (int) $attribute) : 0;
|
$target = $attribute ? $attribute->getValue() : null;
|
||||||
if($objvalue)
|
|
||||||
$target = $dms->getDocument($objvalue);
|
|
||||||
else
|
|
||||||
$target = null;
|
|
||||||
$content .= $this->getDocumentChooserHtml("attr".$attrdef->getId(), $target, $attr_name);
|
$content .= $this->getDocumentChooserHtml("attr".$attrdef->getId(), $target, $attr_name);
|
||||||
break;
|
break;
|
||||||
case SeedDMS_Core_AttributeDefinition::type_user:
|
case SeedDMS_Core_AttributeDefinition::type_user:
|
||||||
$objvalue = $attribute ? (is_object($attribute) ? $attribute->getValueAsArray() : (is_string($attribute) ? [$attribute] : $attribute)) : array();
|
$target = $attribute ? $attribute->getValueAsArray() : [];
|
||||||
|
$objvalue = [];
|
||||||
|
foreach($target as $t)
|
||||||
|
$objvalue[] = $t->getId();
|
||||||
$users = $dms->getAllUsers();
|
$users = $dms->getAllUsers();
|
||||||
if($users) {
|
if($users) {
|
||||||
$allowempty = $attrdef->getMinValues() == 0;
|
$allowempty = $attrdef->getMinValues() == 0;
|
||||||
|
@ -1993,7 +1984,10 @@ $(document).ready(function() {
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case SeedDMS_Core_AttributeDefinition::type_group:
|
case SeedDMS_Core_AttributeDefinition::type_group:
|
||||||
$objvalue = $attribute ? (is_object($attribute) ? $attribute->getValueAsArray() : (is_string($attribute) ? [$attribute] : $attribute)) : array();
|
$target = $attribute ? $attribute->getValueAsArray() : [];
|
||||||
|
$objvalue = [];
|
||||||
|
foreach($target as $t)
|
||||||
|
$objvalue[] = $t->getId();
|
||||||
$groups = $dms->getAllGroups();
|
$groups = $dms->getAllGroups();
|
||||||
if($groups) {
|
if($groups) {
|
||||||
$allowempty = $attrdef->getMinValues() == 0;
|
$allowempty = $attrdef->getMinValues() == 0;
|
||||||
|
|
|
@ -1498,7 +1498,7 @@ $(document).ready(function() {
|
||||||
$attrstr .= $arr;
|
$attrstr .= $arr;
|
||||||
} else {
|
} else {
|
||||||
$attrdef = $docattribute->getAttributeDefinition();
|
$attrdef = $docattribute->getAttributeDefinition();
|
||||||
$attrstr .= "<tr><td>".htmlspecialchars($attrdef->getName())."</td><td>".htmlspecialchars(implode(', ', $docattribute->getValueAsArray()))."</td></tr>\n";
|
$attrstr .= "<tr><td>".htmlspecialchars($attrdef->getName())."</td><td>".htmlspecialchars($docattribute->getValueAsString())."</td></tr>\n";
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
$attrstr .= "</table>\n";
|
$attrstr .= "</table>\n";
|
||||||
|
|
|
@ -1917,26 +1917,23 @@ $(document).ready(function() {
|
||||||
case SeedDMS_Core_AttributeDefinition::type_folder:
|
case SeedDMS_Core_AttributeDefinition::type_folder:
|
||||||
$attrs = $attribute->getValueAsArray();
|
$attrs = $attribute->getValueAsArray();
|
||||||
$tmp = array();
|
$tmp = array();
|
||||||
foreach($attrs as $attr) {
|
foreach($attrs as $targetfolder) {
|
||||||
if($targetfolder = $dms->getFolder(intval($attr)))
|
$tmp[] = '<a href="'.$this->params['settings']->_httpRoot.'out/out.ViewFolder.php?folderid='.$targetfolder->getId().'">'.htmlspecialchars($targetfolder->getName()).'</a>';
|
||||||
$tmp[] = '<a href="'.$this->params['settings']->_httpRoot.'out/out.ViewFolder.php?folderid='.$targetfolder->getId().'">'.htmlspecialchars($targetfolder->getName()).'</a>';
|
|
||||||
}
|
}
|
||||||
return implode('<br />', $tmp);
|
return implode('<br />', $tmp);
|
||||||
break;
|
break;
|
||||||
case SeedDMS_Core_AttributeDefinition::type_document:
|
case SeedDMS_Core_AttributeDefinition::type_document:
|
||||||
$attrs = $attribute->getValueAsArray();
|
$attrs = $attribute->getValueAsArray();
|
||||||
$tmp = array();
|
$tmp = array();
|
||||||
foreach($attrs as $attr) {
|
foreach($attrs as $targetdoc) {
|
||||||
if($targetdoc = $dms->getDocument(intval($attr)))
|
$tmp[] = '<a href="'.$this->params['settings']->_httpRoot.'out/out.ViewDocument.php?documentid='.$targetdoc->getId().'">'.htmlspecialchars($targetdoc->getName()).'</a>';
|
||||||
$tmp[] = '<a href="'.$this->params['settings']->_httpRoot.'out/out.ViewDocument.php?documentid='.$targetdoc->getId().'">'.htmlspecialchars($targetdoc->getName()).'</a>';
|
|
||||||
}
|
}
|
||||||
return implode('<br />', $tmp);
|
return implode('<br />', $tmp);
|
||||||
break;
|
break;
|
||||||
case SeedDMS_Core_AttributeDefinition::type_user:
|
case SeedDMS_Core_AttributeDefinition::type_user:
|
||||||
$attrs = $attribute->getValueAsArray();
|
$attrs = $attribute->getValueAsArray();
|
||||||
$tmp = array();
|
$tmp = array();
|
||||||
foreach($attrs as $attr) {
|
foreach($attrs as $curuser) {
|
||||||
$curuser = $dms->getUser((int) $attr);
|
|
||||||
$tmp[] = htmlspecialchars($curuser->getFullname()." (".$curuser->getLogin().")");
|
$tmp[] = htmlspecialchars($curuser->getFullname()." (".$curuser->getLogin().")");
|
||||||
}
|
}
|
||||||
return implode('<br />', $tmp);
|
return implode('<br />', $tmp);
|
||||||
|
@ -1944,8 +1941,7 @@ $(document).ready(function() {
|
||||||
case SeedDMS_Core_AttributeDefinition::type_group:
|
case SeedDMS_Core_AttributeDefinition::type_group:
|
||||||
$attrs = $attribute->getValueAsArray();
|
$attrs = $attribute->getValueAsArray();
|
||||||
$tmp = array();
|
$tmp = array();
|
||||||
foreach($attrs as $attr) {
|
foreach($attrs as $curgroup) {
|
||||||
$curgroup = $dms->getGroup((int) $attr);
|
|
||||||
$tmp[] = htmlspecialchars($curgroup->getName());
|
$tmp[] = htmlspecialchars($curgroup->getName());
|
||||||
}
|
}
|
||||||
return implode('<br />', $tmp);
|
return implode('<br />', $tmp);
|
||||||
|
@ -1979,17 +1975,11 @@ $(document).ready(function() {
|
||||||
$content .= "<input type=\"checkbox\" id=\"".$attr_id."\" name=\"".$attr_name."\" value=\"1\" ".($objvalue ? 'checked' : '')." />";
|
$content .= "<input type=\"checkbox\" id=\"".$attr_id."\" name=\"".$attr_name."\" value=\"1\" ".($objvalue ? 'checked' : '')." />";
|
||||||
break;
|
break;
|
||||||
case SeedDMS_Core_AttributeDefinition::type_date:
|
case SeedDMS_Core_AttributeDefinition::type_date:
|
||||||
$objvalue = $attribute ? (is_object($attribute) ? $attribute->getValue() : $attribute) : '';
|
$objvalue = $attribute ? getReadableDate((is_object($attribute) ? $attribute->getValue() : $attribute)) : '';
|
||||||
$dateformat = getConvertDateFormat($this->params['settings']->_dateformat);
|
$dateformat = getConvertDateFormat($this->params['settings']->_dateformat);
|
||||||
/*
|
|
||||||
$content .= '<span class="input-append date datepicker" data-date="'.getReadableDate(').'" data-date-format="'.$dateformat.'" data-date-language="'.str_replace('_', '-', $this->params['session']->getLanguage()).'">
|
|
||||||
<input id="'.$attr_id.'" class="span9" size="16" name="'.$attr_name.'" type="text" value="'.($objvalue ? $objvalue : '').'">
|
|
||||||
<span class="add-on"><i class="fa fa-calendar"></i></span>
|
|
||||||
</span>';
|
|
||||||
*/
|
|
||||||
$content = '
|
$content = '
|
||||||
<div class="input-group date">
|
<div class="input-group date">
|
||||||
<input type="text" class="form-control" id="'.$attr_id.'" name="'.$attr_name.'" value="'.($objvalue ? getReadableDate($objvalue) : '').'" data-date="'.getReadableDate().'" data-date-format="'.$dateformat.'" data-date-language="'.str_replace('_', '-', $this->params['session']->getLanguage()).'" data-date-autoclose="true" data-provide="datepicker">
|
<input type="text" class="form-control" id="'.$attr_id.'" name="'.$attr_name.'" value="'.($objvalue ? $objvalue : '').'" data-date="'.getReadableDate().'" data-date-format="'.$dateformat.'" data-date-language="'.str_replace('_', '-', $this->params['session']->getLanguage()).'" data-date-autoclose="true" data-provide="datepicker">
|
||||||
<div class="input-group-append">
|
<div class="input-group-append">
|
||||||
<span class="input-group-text"><i class="fa fa-calendar"></i></span>
|
<span class="input-group-text"><i class="fa fa-calendar"></i></span>
|
||||||
</div>
|
</div>
|
||||||
|
@ -2005,23 +1995,18 @@ $(document).ready(function() {
|
||||||
$content .= "<input type=\"text\" class=\"form-control\" id=\"".$attr_id."\" name=\"".$attr_name."\" value=\"".htmlspecialchars($objvalue)."\"".((!$norequire && $attrdef->getMinValues() > 0) ? ' required="required"' : '')." data-rule-number=\"true\"/>";
|
$content .= "<input type=\"text\" class=\"form-control\" id=\"".$attr_id."\" name=\"".$attr_name."\" value=\"".htmlspecialchars($objvalue)."\"".((!$norequire && $attrdef->getMinValues() > 0) ? ' required="required"' : '')." data-rule-number=\"true\"/>";
|
||||||
break; */
|
break; */
|
||||||
case SeedDMS_Core_AttributeDefinition::type_folder:
|
case SeedDMS_Core_AttributeDefinition::type_folder:
|
||||||
$objvalue = $attribute ? (is_object($attribute) ? (int) $attribute->getValue() : (int) $attribute) : 0;
|
$target = $attribute ? $attribute->getValue() : null;
|
||||||
if($objvalue)
|
|
||||||
$target = $dms->getFolder($objvalue);
|
|
||||||
else
|
|
||||||
$target = null;
|
|
||||||
$content .= $this->getFolderChooserHtml("attr".$attrdef->getId(), M_READWRITE, -1, $target, $attr_name, false);
|
$content .= $this->getFolderChooserHtml("attr".$attrdef->getId(), M_READWRITE, -1, $target, $attr_name, false);
|
||||||
break;
|
break;
|
||||||
case SeedDMS_Core_AttributeDefinition::type_document:
|
case SeedDMS_Core_AttributeDefinition::type_document:
|
||||||
$objvalue = $attribute ? (is_object($attribute) ? (int) $attribute->getValue() : (int) $attribute) : 0;
|
$target = $attribute ? $attribute->getValue() : null;
|
||||||
if($objvalue)
|
|
||||||
$target = $dms->getDocument($objvalue);
|
|
||||||
else
|
|
||||||
$target = null;
|
|
||||||
$content .= $this->getDocumentChooserHtml("attr".$attrdef->getId(), $target, $attr_name);
|
$content .= $this->getDocumentChooserHtml("attr".$attrdef->getId(), $target, $attr_name);
|
||||||
break;
|
break;
|
||||||
case SeedDMS_Core_AttributeDefinition::type_user:
|
case SeedDMS_Core_AttributeDefinition::type_user:
|
||||||
$objvalue = $attribute ? (is_object($attribute) ? $attribute->getValueAsArray() : (is_string($attribute) ? [$attribute] : $attribute)) : array();
|
$target = $attribute ? $attribute->getValueAsArray() : [];
|
||||||
|
$objvalue = [];
|
||||||
|
foreach($target as $t)
|
||||||
|
$objvalue[] = $t->getId();
|
||||||
$users = $dms->getAllUsers();
|
$users = $dms->getAllUsers();
|
||||||
if($users) {
|
if($users) {
|
||||||
$allowempty = $attrdef->getMinValues() == 0;
|
$allowempty = $attrdef->getMinValues() == 0;
|
||||||
|
@ -2041,7 +2026,10 @@ $(document).ready(function() {
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case SeedDMS_Core_AttributeDefinition::type_group:
|
case SeedDMS_Core_AttributeDefinition::type_group:
|
||||||
$objvalue = $attribute ? (is_object($attribute) ? $attribute->getValueAsArray() : (is_string($attribute) ? [$attribute] : $attribute)) : array();
|
$target = $attribute ? $attribute->getValueAsArray() : [];
|
||||||
|
$objvalue = [];
|
||||||
|
foreach($target as $t)
|
||||||
|
$objvalue[] = $t->getId();
|
||||||
$groups = $dms->getAllGroups();
|
$groups = $dms->getAllGroups();
|
||||||
if($groups) {
|
if($groups) {
|
||||||
$allowempty = $attrdef->getMinValues() == 0;
|
$allowempty = $attrdef->getMinValues() == 0;
|
||||||
|
|
Loading…
Reference in New Issue
Block a user