mirror of
https://git.code.sf.net/p/seeddms/code
synced 2026-05-08 13:31:24 +00:00
take attribute groups into account if set
This commit is contained in:
parent
8ede764db0
commit
5baecedf70
|
|
@ -60,12 +60,15 @@ if (!is_object($version)) {
|
|||
$folder = $document->getFolder();
|
||||
|
||||
$attrdefs = $dms->getAllAttributeDefinitions(array(SeedDMS_Core_AttributeDefinition::objtype_documentcontent, SeedDMS_Core_AttributeDefinition::objtype_all));
|
||||
$f = null;
|
||||
$attrdefgrps = $folder->getAttributeDefintionGroupList(true, $f);
|
||||
|
||||
if($view) {
|
||||
$view->setParam('folder', $folder);
|
||||
$view->setParam('document', $document);
|
||||
$view->setParam('version', $version);
|
||||
$view->setParam('attrdefs', $attrdefs);
|
||||
$view->setParam('attrdefgrps', $attrdefgrps);
|
||||
$view->setParam('accessobject', $accessop);
|
||||
$view($_GET);
|
||||
exit;
|
||||
|
|
|
|||
|
|
@ -56,10 +56,14 @@ if($document->isLocked()) {
|
|||
$folder = $document->getFolder();
|
||||
$attrdefs = $dms->getAllAttributeDefinitions(array(SeedDMS_Core_AttributeDefinition::objtype_document, SeedDMS_Core_AttributeDefinition::objtype_all));
|
||||
|
||||
$f = null;
|
||||
$attrdefgrps = $folder->getAttributeDefintionGroupList(true, $f);
|
||||
|
||||
if($view) {
|
||||
$view->setParam('folder', $folder);
|
||||
$view->setParam('document', $document);
|
||||
$view->setParam('attrdefs', $attrdefs);
|
||||
$view->setParam('attrdefgrps', $attrdefgrps);
|
||||
$view->setParam('strictformcheck', $settings->_strictFormCheck);
|
||||
$view->setParam('orderby', $settings->_sortFoldersDefault);
|
||||
$view->setParam('nodocumentformfields', $settings->_noDocumentFormFields);
|
||||
|
|
|
|||
|
|
@ -50,7 +50,8 @@ if ($folder->getAccessMode($user) < M_READWRITE) {
|
|||
}
|
||||
|
||||
$attrdefs = $dms->getAllAttributeDefinitions(array(SeedDMS_Core_AttributeDefinition::objtype_folder, SeedDMS_Core_AttributeDefinition::objtype_all));
|
||||
$attrdefgrps = $folder->getAttributeDefintionGroupList();
|
||||
$f = null;
|
||||
$attrdefgrps = $folder->getAttributeDefintionGroupList(true, $f);
|
||||
|
||||
if($view) {
|
||||
$view->setParam('folder', $folder);
|
||||
|
|
|
|||
|
|
@ -38,6 +38,7 @@ class SeedDMS_View_EditAttributes extends SeedDMS_Theme_Style {
|
|||
$document = $this->params['document'];
|
||||
$version = $this->params['version'];
|
||||
$attrdefs = $this->params['attrdefs'];
|
||||
$attrdefgrps = $this->params['attrdefgrps'];
|
||||
|
||||
$this->htmlStartPage(getMLText("document_title", array("documentname" => htmlspecialchars($document->getName()))));
|
||||
$this->globalNavigation($folder);
|
||||
|
|
@ -54,7 +55,41 @@ class SeedDMS_View_EditAttributes extends SeedDMS_Theme_Style {
|
|||
<input type="hidden" name="version" value="<?php print $version->getVersion();?>">
|
||||
|
||||
<?php
|
||||
if($attrdefs) {
|
||||
if($attrdefgrps) {
|
||||
$attrdefids = array();
|
||||
foreach($attrdefgrps as $attrdefgrp) {
|
||||
$attrdefs = $attrdefgrp['group']->getAttributeDefinitions(array(SeedDMS_Core_AttributeDefinition::objtype_all, SeedDMS_Core_AttributeDefinition::objtype_documentcontent));
|
||||
echo "<tr><td colspan=\"2\"><b>".htmlspecialchars($attrdefgrp['group']->getName())."</b></td></tr>";
|
||||
foreach($attrdefs as $attrdefarr) {
|
||||
$attrdef = $attrdefarr['attrdef'];
|
||||
if(!in_array($attrdef->getID(), $attrdefids)) {
|
||||
$arr = $this->callHook('folderEditAttribute', $folder, $attrdef);
|
||||
if(is_array($arr)) {
|
||||
echo $txt;
|
||||
echo "<tr>";
|
||||
echo "<td>".$arr[0]."</td>";
|
||||
echo "<td>".$arr[1]."</td>";
|
||||
echo "</tr>";
|
||||
} else {
|
||||
?>
|
||||
<tr>
|
||||
<td><?php echo htmlspecialchars($attrdef->getName()); ?></td>
|
||||
<td><?php $this->printAttributeEditField($attrdef, $version->getAttribute($attrdef)) ?></td>
|
||||
</tr>
|
||||
<?php
|
||||
}
|
||||
$attrdefids[] = $attrdef->getID();
|
||||
} else {
|
||||
?>
|
||||
<tr>
|
||||
<td><?php echo htmlspecialchars($attrdef->getName()); ?></td>
|
||||
<td><?php echo $folder->getAttribute($attrdef)->getValue(); ?></td>
|
||||
</tr>
|
||||
<?php
|
||||
}
|
||||
}
|
||||
}
|
||||
} elseif($attrdefs) {
|
||||
$this->contentContainerStart();
|
||||
foreach($attrdefs as $attrdef) {
|
||||
$arr = $this->callHook('editDocumentContentAttribute', $version, $attrdef);
|
||||
|
|
|
|||
|
|
@ -61,6 +61,7 @@ $(document).ready( function() {
|
|||
$folder = $this->params['folder'];
|
||||
$document = $this->params['document'];
|
||||
$attrdefs = $this->params['attrdefs'];
|
||||
$attrdefgrps = $this->params['attrdefgrps'];
|
||||
$strictformcheck = $this->params['strictformcheck'];
|
||||
$nodocumentformfields = $this->params['nodocumentformfields'];
|
||||
$orderby = $this->params['orderby'];
|
||||
|
|
@ -206,8 +207,49 @@ $(document).ready( function() {
|
|||
$this->formField(getMLText("sequence"), $this->getSequenceChooser($folder, 'd', $document->getID()).($orderby != 's' ? "<br />".getMLText('order_by_sequence_off') : ''));
|
||||
}
|
||||
}
|
||||
if($attrdefs) {
|
||||
|
||||
if($attrdefgrps) {
|
||||
$attrdefids = array();
|
||||
foreach($attrdefgrps as $attrdefgrp) {
|
||||
$attrdefs = $attrdefgrp['group']->getAttributeDefinitions(array(SeedDMS_Core_AttributeDefinition::objtype_all, SeedDMS_Core_AttributeDefinition::objtype_document));
|
||||
echo "<tr><td colspan=\"2\"><b>".htmlspecialchars($attrdefgrp['group']->getName())."</b></td></tr>";
|
||||
foreach($attrdefs as $attrdefarr) {
|
||||
$attrdef = $attrdefarr['attrdef'];
|
||||
if(!in_array($attrdef->getID(), $attrdefids)) {
|
||||
$arr = $this->callHook('editDocumentAttribute', $document, $attrdef);
|
||||
if(is_array($arr)) {
|
||||
echo $txt;
|
||||
echo "<tr>";
|
||||
echo "<td>".$arr[0]."</td>";
|
||||
echo "<td>".$arr[1]."</td>";
|
||||
echo "</tr>";
|
||||
} else {
|
||||
?>
|
||||
<tr>
|
||||
<td><?php echo htmlspecialchars($attrdef->getName()); ?></td>
|
||||
<td><?php $this->printAttributeEditField($attrdef, $document->getAttribute($attrdef)) ?></td>
|
||||
</tr>
|
||||
<?php
|
||||
}
|
||||
$attrdefids[] = $attrdef->getID();
|
||||
} else {
|
||||
?>
|
||||
<tr>
|
||||
<td><?php echo htmlspecialchars($attrdef->getName()); ?></td>
|
||||
<td><?php echo $document->getAttribute($attrdef)->getValue(); ?></td>
|
||||
</tr>
|
||||
<?php
|
||||
}
|
||||
}
|
||||
}
|
||||
} elseif($attrdefs) {
|
||||
foreach($attrdefs as $attrdef) {
|
||||
$found = false;
|
||||
foreach($attrdefgrps as $attrdefgrp) {
|
||||
if($attrdefgrp['group']->isMember($attrdef))
|
||||
$found = true;
|
||||
}
|
||||
if($found) {
|
||||
$arr = $this->callHook('editDocumentAttribute', $document, $attrdef);
|
||||
if(is_array($arr)) {
|
||||
if($arr) {
|
||||
|
|
@ -218,6 +260,16 @@ $(document).ready( function() {
|
|||
} else {
|
||||
$this->formField(htmlspecialchars($attrdef->getName()), $this->getAttributeEditField($attrdef, $document->getAttribute($attrdef)));
|
||||
}
|
||||
} else {
|
||||
if($attribute = $document->getAttribute($attrdef)) {
|
||||
?>
|
||||
<tr>
|
||||
<td><?php echo htmlspecialchars($attrdef->getName()); ?></td>
|
||||
<td><?php echo $attribute->getValue() ?></td>
|
||||
</tr>
|
||||
<?php
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
$arrs = $this->callHook('addDocumentAttributes', $document);
|
||||
|
|
|
|||
|
|
@ -114,24 +114,38 @@ $(document).ready(function() {
|
|||
}
|
||||
|
||||
if($attrdefgrps) {
|
||||
$attrdefids = array();
|
||||
foreach($attrdefgrps as $attrdefgrp) {
|
||||
$attrdefs = $attrdefgrp['group']->getAttributeDefinitions(array(SeedDMS_Core_AttributeDefinition::objtype_all, SeedDMS_Core_AttributeDefinition::objtype_folder));
|
||||
echo "<tr><td colspan=\"2\"><b>".htmlspecialchars($attrdefgrp['group']->getComment())."</b></td></tr>";
|
||||
foreach($attrdefs as $attrdef) {
|
||||
$arr = $this->callHook('folderEditAttribute', $folder, $attrdef);
|
||||
if(is_array($arr)) {
|
||||
echo $txt;
|
||||
echo "<tr>";
|
||||
echo "<td>".$arr[0]."</td>";
|
||||
echo "<td>".$arr[1]."</td>";
|
||||
echo "</tr>";
|
||||
} else {
|
||||
echo "<tr><td colspan=\"2\"><b>".htmlspecialchars($attrdefgrp['group']->getName())."</b></td></tr>";
|
||||
foreach($attrdefs as $attrdefarr) {
|
||||
$attrdef = $attrdefarr['attrdef'];
|
||||
if(!in_array($attrdef->getID(), $attrdefids)) {
|
||||
$arr = $this->callHook('folderEditAttribute', $folder, $attrdef);
|
||||
if(is_array($arr)) {
|
||||
echo $txt;
|
||||
echo "<tr>";
|
||||
echo "<td>".$arr[0]."</td>";
|
||||
echo "<td>".$arr[1]."</td>";
|
||||
echo "</tr>";
|
||||
} else {
|
||||
?>
|
||||
<tr>
|
||||
<td><?php echo htmlspecialchars($attrdef->getName()); ?></td>
|
||||
<td><?php $this->printAttributeEditField($attrdef, $folder->getAttribute($attrdef)) ?></td>
|
||||
</tr>
|
||||
<?php
|
||||
}
|
||||
$attrdefids[] = $attrdef->getID();
|
||||
} else {
|
||||
if($folder->getAttribute($attrdef)) {
|
||||
?>
|
||||
<tr>
|
||||
<td><?php echo htmlspecialchars($attrdef->getName()); ?></td>
|
||||
<td><?php echo $folder->getAttribute($attrdef)->getValue(); ?></td>
|
||||
</tr>
|
||||
<?php
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -337,19 +337,38 @@ $('body').on('click', '.order-btn', function(ev) {
|
|||
echo "</tr>";
|
||||
}
|
||||
}
|
||||
$attributes = $folder->getAttributes();
|
||||
if($attributes) {
|
||||
foreach($attributes as $attribute) {
|
||||
$arr = $this->callHook('showFolderAttribute', $folder, $attribute);
|
||||
if(is_array($arr)) {
|
||||
echo "<tr>";
|
||||
echo "<td>".$arr[0].":</td>";
|
||||
echo "<td>".$arr[1]."</td>";
|
||||
echo "</tr>";
|
||||
} elseif(is_string($arr)) {
|
||||
echo $arr;
|
||||
} else {
|
||||
$this->printAttribute($attribute);
|
||||
$f = null;
|
||||
$attrdefgrps = $folder->getAttributeDefintionGroupList(true, $f);
|
||||
if($attrdefgrps) {
|
||||
foreach($attrdefgrps as $attrdefgrp) {
|
||||
$attrdefs = $attrdefgrp['group']->getAttributeDefinitions(array(SeedDMS_Core_AttributeDefinition::objtype_all, SeedDMS_Core_AttributeDefinition::objtype_folder));
|
||||
echo "<tr><td colspan=\"2\"><b>".htmlspecialchars($attrdefgrp['group']->getName())."</b></td></tr>";
|
||||
if($attrdefs) {
|
||||
foreach($attrdefs as $attrdefarr) {
|
||||
$attrdef = $attrdefarr['attrdef'];
|
||||
if($attrdefarr['show'] & SeedDMS_Core_AttributeDefinitionGroup::show_details) {
|
||||
$attribute = $folder->getAttribute($attrdef);
|
||||
if($attribute)
|
||||
$this->printAttribute($attribute);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
} else {
|
||||
$attributes = $folder->getAttributes();
|
||||
if($attributes) {
|
||||
foreach($attributes as $attribute) {
|
||||
$arr = $this->callHook('showFolderAttribute', $folder, $attribute);
|
||||
if(is_array($arr)) {
|
||||
echo "<tr>";
|
||||
echo "<td>".$arr[0].":</td>";
|
||||
echo "<td>".$arr[1]."</td>";
|
||||
echo "</tr>";
|
||||
} elseif(is_string($arr)) {
|
||||
echo $arr;
|
||||
} else {
|
||||
$this->printAttribute($attribute);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user