mirror of
https://git.code.sf.net/p/seeddms/code
synced 2025-11-29 02:50:39 +00:00
take attribute groups into account if set
This commit is contained in:
parent
9ec7cb9025
commit
7ce31e80a6
|
|
@ -50,6 +50,8 @@ $folder = $document->getFolder();
|
|||
$accessop = new SeedDMS_AccessOperation($dms, $user, $settings);
|
||||
|
||||
$attrdefs = $dms->getAllAttributeDefinitions(array(SeedDMS_Core_AttributeDefinition::objtype_documentcontent, SeedDMS_Core_AttributeDefinition::objtype_all));
|
||||
$f = null;
|
||||
$attrdefgrps = $folder->getAttributeDefintionGroupList(true, $f);
|
||||
|
||||
$tmp = explode('.', basename($_SERVER['SCRIPT_FILENAME']));
|
||||
$view = UI::factory($theme, $tmp[1], array('dms'=>$dms, 'user'=>$user));
|
||||
|
|
@ -58,6 +60,7 @@ if($view) {
|
|||
$view->setParam('document', $document);
|
||||
$view->setParam('version', $version);
|
||||
$view->setParam('attrdefs', $attrdefs);
|
||||
$view->setParam('attrdefgrps', $attrdefgrps);
|
||||
$view->setParam('accessobject', $accessop);
|
||||
$view($_GET);
|
||||
exit;
|
||||
|
|
|
|||
|
|
@ -51,12 +51,16 @@ 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);
|
||||
|
||||
/* Create object for checking access to certain operations */
|
||||
$accessop = new SeedDMS_AccessOperation($dms, $user, $settings);
|
||||
|
||||
$tmp = explode('.', basename($_SERVER['SCRIPT_FILENAME']));
|
||||
$view = UI::factory($theme, $tmp[1], array('dms'=>$dms, 'user'=>$user, 'folder'=>$folder, 'document'=>$document, 'attrdefs'=>$attrdefs, 'strictformcheck'=>$settings->_strictFormCheck, 'orderby'=>$settings->_sortFoldersDefault));
|
||||
if($view) {
|
||||
$view->setParam('attrdefgrps', $attrdefgrps);
|
||||
$view->setParam('accessobject', $accessop);
|
||||
$view($_GET);
|
||||
exit;
|
||||
|
|
|
|||
|
|
@ -45,7 +45,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_Bootstrap_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);
|
||||
|
|
@ -53,16 +54,66 @@ class SeedDMS_View_EditAttributes extends SeedDMS_Bootstrap_Style {
|
|||
<input type="Hidden" name="version" value="<?php print $version->getVersion();?>">
|
||||
<table class="table-condensed">
|
||||
<?php
|
||||
if($attrdefs) {
|
||||
foreach($attrdefs as $attrdef) {
|
||||
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) {
|
||||
foreach($attrdefs as $attrdef) {
|
||||
$found = false;
|
||||
foreach($attrdefgrps as $attrdefgrp) {
|
||||
if($attrdefgrp['group']->isMember($attrdef))
|
||||
$found = true;
|
||||
}
|
||||
if($found) {
|
||||
?>
|
||||
<tr>
|
||||
<td><?php echo htmlspecialchars($attrdef->getName()); ?></td>
|
||||
<td><?php $this->printAttributeEditField($attrdef, $version->getAttribute($attrdef)) ?></td>
|
||||
</tr>
|
||||
<?php
|
||||
} else {
|
||||
if($attribute = $folder->getAttribute($attrdef)) {
|
||||
?>
|
||||
<tr>
|
||||
<td><?php echo htmlspecialchars($attrdef->getName()); ?></td>
|
||||
<td><?php echo $attribute->getValue() ?></td>
|
||||
</tr>
|
||||
<?php
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
?>
|
||||
<tr>
|
||||
<td colspan="2"><button type="submit" class="btn"><i class="icon-save"></i> <?php printMLText("save") ?></button></td>
|
||||
|
|
|
|||
|
|
@ -98,6 +98,7 @@ $(document).ready( function() {
|
|||
$folder = $this->params['folder'];
|
||||
$document = $this->params['document'];
|
||||
$attrdefs = $this->params['attrdefs'];
|
||||
$attrdefgrps = $this->params['attrdefgrps'];
|
||||
$strictformcheck = $this->params['strictformcheck'];
|
||||
$orderby = $this->params['orderby'];
|
||||
|
||||
|
|
@ -172,8 +173,49 @@ $(document).ready( function() {
|
|||
if($orderby != 's') echo "<br />".getMLText('order_by_sequence_off');
|
||||
print "</td></tr>";
|
||||
}
|
||||
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)) {
|
||||
echo "<tr>";
|
||||
|
|
@ -188,6 +230,16 @@ $(document).ready( function() {
|
|||
</tr>
|
||||
<?php
|
||||
}
|
||||
} else {
|
||||
if($attribute = $document->getAttribute($attrdef)) {
|
||||
?>
|
||||
<tr>
|
||||
<td><?php echo htmlspecialchars($attrdef->getName()); ?></td>
|
||||
<td><?php echo $attribute->getValue() ?></td>
|
||||
</tr>
|
||||
<?php
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
?>
|
||||
|
|
|
|||
|
|
@ -129,24 +129,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
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -233,24 +233,37 @@ function folderSelected(id, name) {
|
|||
echo "</tr>";
|
||||
}
|
||||
}
|
||||
$attributes = $folder->getAttributes();
|
||||
if($attributes) {
|
||||
foreach($attributes as $attribute) {
|
||||
$arr = $this->callHook('showFolderAttribute', $folder, $attribute);
|
||||
if(is_array($arr)) {
|
||||
echo $txt;
|
||||
echo "<tr>";
|
||||
echo "<td>".$arr[0].":</td>";
|
||||
echo "<td>".$arr[1].":</td>";
|
||||
echo "</tr>";
|
||||
} else {
|
||||
$attrdef = $attribute->getAttributeDefinition();
|
||||
?>
|
||||
<tr>
|
||||
<td><?php echo htmlspecialchars($attrdef->getName()); ?>:</td>
|
||||
<td><?php echo htmlspecialchars(implode(', ', $attribute->getValueAsArray())); ?></td>
|
||||
</tr>
|
||||
<?php
|
||||
$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 $txt;
|
||||
echo "<tr>";
|
||||
echo "<td>".$arr[0].":</td>";
|
||||
echo "<td>".$arr[1].":</td>";
|
||||
echo "</tr>";
|
||||
} else {
|
||||
$this->printAttribute($attribute);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user