Merge branch 'seeddms-5.1.x' into seeddms-6.0.x

This commit is contained in:
Uwe Steinmann 2021-03-12 10:12:30 +01:00
commit c39fbcb70d
7 changed files with 102 additions and 14 deletions

View File

@ -2112,10 +2112,22 @@ class SeedDMS_Core_DMS {
if(is_string($attribute))
$attribute = array($attribute);
$searchAttributes[] = "EXISTS (SELECT NULL FROM `tblFolderAttributes` WHERE `tblFolderAttributes`.`attrdef`=".$attrdefid." AND (`tblFolderAttributes`.`value` like '%".$valueset[0].implode("%' OR `tblFolderAttributes`.`value` like '%".$valueset[0], $attribute)."%') AND `tblFolderAttributes`.`folder`=`tblFolders`.`id`)";
} else
} else {
$searchAttributes[] = "EXISTS (SELECT NULL FROM `tblFolderAttributes` WHERE `tblFolderAttributes`.`attrdef`=".$attrdefid." AND `tblFolderAttributes`.`value`='".$attribute."' AND `tblFolderAttributes`.`folder`=`tblFolders`.`id`)";
} else
$searchAttributes[] = "EXISTS (SELECT NULL FROM `tblFolderAttributes` WHERE `tblFolderAttributes`.`attrdef`=".$attrdefid." AND `tblFolderAttributes`.`value` like '%".$attribute."%' AND `tblFolderAttributes`.`folder`=`tblFolders`.`id`)";
}
} else {
if($attrdef->getType() == SeedDMS_Core_AttributeDefinition::type_date && is_array($attribute)) {
$kkll = [];
if(!empty($attribute['from']))
$kkll[] = "`tblFolderAttributes`.`value`>='".$attribute['from']."'";
if(!empty($attribute['to']))
$kkll[] = "`tblFolderAttributes`.`value`<='".$attribute['to']."'";
if($kkll)
$searchAttributes[] = "EXISTS (SELECT NULL FROM `tblFolderAttributes` WHERE `tblFolderAttributes`.`attrdef`=".$attrdefid." AND ".implode(' AND ', $kkll)." AND `tblFolderAttributes`.`folder`=`tblFolders`.`id`)";
} else {
$searchAttributes[] = "EXISTS (SELECT NULL FROM `tblFolderAttributes` WHERE `tblFolderAttributes`.`attrdef`=".$attrdefid." AND `tblFolderAttributes`.`value` like '%".$attribute."%' AND `tblFolderAttributes`.`folder`=`tblFolders`.`id`)";
}
}
}
}
}
@ -2291,8 +2303,19 @@ class SeedDMS_Core_DMS {
$lsearchAttributes[] = "EXISTS (SELECT NULL FROM `tblDocumentAttributes` WHERE `tblDocumentAttributes`.`attrdef`=".$attrdefid." AND (`tblDocumentAttributes`.`value` like '%".$valueset[0].implode("%' OR `tblDocumentAttributes`.`value` like '%".$valueset[0], $attribute)."%') AND `tblDocumentAttributes`.`document` = `tblDocuments`.`id`)";
} else
$lsearchAttributes[] = "EXISTS (SELECT NULL FROM `tblDocumentAttributes` WHERE `tblDocumentAttributes`.`attrdef`=".$attrdefid." AND `tblDocumentAttributes`.`value`='".$attribute."' AND `tblDocumentAttributes`.`document` = `tblDocuments`.`id`)";
} else
$lsearchAttributes[] = "EXISTS (SELECT NULL FROM `tblDocumentAttributes` WHERE `tblDocumentAttributes`.`attrdef`=".$attrdefid." AND `tblDocumentAttributes`.`value` like '%".$attribute."%' AND `tblDocumentAttributes`.`document` = `tblDocuments`.`id`)";
} else {
if($attrdef->getType() == SeedDMS_Core_AttributeDefinition::type_date && is_array($attribute)) {
$kkll = [];
if(!empty($attribute['from']))
$kkll[] = "`tblDocumentAttributes`.`value`>='".$attribute['from']."'";
if(!empty($attribute['to']))
$kkll[] = "`tblDocumentAttributes`.`value`<='".$attribute['to']."'";
if($kkll)
$lsearchAttributes[] = "EXISTS (SELECT NULL FROM `tblDocumentAttributes` WHERE `tblDocumentAttributes`.`attrdef`=".$attrdefid." AND ".implode(' AND ', $kkll)." AND `tblDocumentAttributes`.`document`=`tblDocuments`.`id`)";
} else {
$lsearchAttributes[] = "EXISTS (SELECT NULL FROM `tblDocumentAttributes` WHERE `tblDocumentAttributes`.`attrdef`=".$attrdefid." AND `tblDocumentAttributes`.`value` like '%".$attribute."%' AND `tblDocumentAttributes`.`document` = `tblDocuments`.`id`)";
}
}
}
if($attrdef->getObjType() == SeedDMS_Core_AttributeDefinition::objtype_documentcontent || $attrdef->getObjType() == SeedDMS_Core_AttributeDefinition::objtype_all) {
if($attrdef->getValueSet()) {
@ -2304,10 +2327,22 @@ class SeedDMS_Core_DMS {
} else {
$lsearchAttributes[] = "EXISTS (SELECT NULL FROM `tblDocumentContentAttributes` WHERE `tblDocumentContentAttributes`.`attrdef`=".$attrdefid." AND `tblDocumentContentAttributes`.`value`='".$attribute."' AND `tblDocumentContentAttributes`.content = `tblDocumentContent`.id)";
}
} else
$lsearchAttributes[] = "EXISTS (SELECT NULL FROM `tblDocumentContentAttributes` WHERE `tblDocumentContentAttributes`.`attrdef`=".$attrdefid." AND `tblDocumentContentAttributes`.`value` like '%".$attribute."%' AND `tblDocumentContentAttributes`.content = `tblDocumentContent`.id)";
} else {
if($attrdef->getType() == SeedDMS_Core_AttributeDefinition::type_date && is_array($attribute)) {
$kkll = [];
if(!empty($attribute['from']))
$kkll[] = "`tblDocumentContentAttributes`.`value`>='".$attribute['from']."'";
if(!empty($attribute['to']))
$kkll[] = "`tblDocumentContentAttributes`.`value`<='".$attribute['to']."'";
if($kkll)
$lsearchAttributes[] = "EXISTS (SELECT NULL FROM `tblDocumentContentAttributes` WHERE `tblDocumentContentAttributes`.`attrdef`=".$attrdefid." AND ".implode(' AND ', $kkll)." AND `tblDocumentContentAttributes`.`content`=`tblDocumentContent`.`id`)";
} else {
$lsearchAttributes[] = "EXISTS (SELECT NULL FROM `tblDocumentContentAttributes` WHERE `tblDocumentContentAttributes`.`attrdef`=".$attrdefid." AND `tblDocumentContentAttributes`.`value` like '%".$attribute."%' AND `tblDocumentContentAttributes`.content = `tblDocumentContent`.id)";
}
}
}
$searchAttributes[] = "(".implode(" OR ", $lsearchAttributes).")";
if($lsearchAttributes)
$searchAttributes[] = "(".implode(" OR ", $lsearchAttributes).")";
}
}
}

View File

@ -485,6 +485,22 @@ if(((!isset($_GET["fullsearch"]) && $settings->_defaultSearchMethod == 'fulltext
else
$attributes = array();
foreach($attributes as $attrdefid=>$attribute) {
$attrdef = $dms->getAttributeDefinition($attrdefid);
if($attribute) {
if($attrdef->getType() == SeedDMS_Core_AttributeDefinition::type_date) {
if(is_array($attribute)) {
if(!empty($attributes[$attrdefid]['from']))
$attributes[$attrdefid]['from'] = date('Y-m-d', makeTsFromDate($attribute['from']));
if(!empty($attributes[$attrdefid]['to']))
$attributes[$attrdefid]['to'] = date('Y-m-d', makeTsFromDate($attribute['to']));
} else {
$attributes[$attrdefid] = date('Y-m-d', makeTsFromDate($attribute));
}
}
}
}
//
// Get the page number to display. If the result set contains more than
// 25 entries, it is displayed across multiple pages.

View File

@ -215,6 +215,9 @@ ul.jqtree-tree li.jqtree_common > .jqtree-element:hover {
background-color: #E0E0E0;
}
span.datepicker {
padding: 0px;
}
/* Sidenav for Docs
* -------------------------------------------------- */

View File

@ -447,6 +447,7 @@ $(document).ready( function() {
var view = element.data('view');
var action = element.data('action');
var query = element.data('query');
var afterload = $(this).data('afterload');
if(view && action) {
url = seeddms_webroot+base+"out/out."+view+".php?action="+action;
if(query) {
@ -477,6 +478,12 @@ $(document).ready( function() {
}
}
}); /* }}} */
if(afterload) {
var func = eval(afterload);
if(typeof func === "function"){
func();
}
}
});
}); /* }}} */
@ -490,6 +497,7 @@ $(document).ready( function() {
var view = element.data('view');
var action = element.data('action');
var query = element.data('query');
var afterload = $(this).data('afterload');
if(view && action) {
url = seeddms_webroot+base+"out/out."+view+".php?action="+action;
if(query) {
@ -538,6 +546,12 @@ $(document).ready( function() {
}); /* }}} */
if(callback)
callback.call();
if(afterload) {
var func = eval(afterload);
if(typeof func === "function"){
func();
}
}
});
}); /* }}} */

View File

@ -74,7 +74,10 @@ $(document).ready( function() {
$this->htmlStartPage(getMLText("folder_title", array("foldername" => htmlspecialchars($folder->getName()))));
$this->globalNavigation($folder);
$this->contentStart();
$this->pageNavigation($this->getFolderPathHTML($folder, true), "view_folder", $folder);
// $this->pageNavigation($this->getFolderPathHTML($folder, true), "view_folder", $folder);
?>
<div class="ajax" data-view="ViewFolder" data-action="navigation" data-no-spinner="true" <?php echo ($folder ? "data-query=\"folderid=".$folder->getID()."\"" : "") ?>></div>
<?php
$this->contentHeading(getMLText("add_subfolder"));
$this->contentContainerStart();
?>

View File

@ -1737,11 +1737,11 @@ $(document).ready(function() {
}
} /* }}} */
function printAttributeEditField($attrdef, $attribute, $fieldname='attributes', $norequire=false) { /* {{{ */
echo self::getAttributeEditField($attrdef, $attribute, $fieldname, $norequire);
function printAttributeEditField($attrdef, $attribute, $fieldname='attributes', $norequire=false, $namepostfix='') { /* {{{ */
echo self::getAttributeEditField($attrdef, $attribute, $fieldname, $norequire, $namepostfix);
} /* }}} */
function getAttributeEditField($attrdef, $attribute, $fieldname='attributes', $norequire=false) { /* {{{ */
function getAttributeEditField($attrdef, $attribute, $fieldname='attributes', $norequire=false, $namepostfix='') { /* {{{ */
$dms = $this->params['dms'];
$content = '';
switch($attrdef->getType()) {
@ -1754,7 +1754,7 @@ $(document).ready(function() {
$objvalue = $attribute ? (is_object($attribute) ? $attribute->getValue() : $attribute) : '';
$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="'.$fieldname.'_'.$attrdef->getId().'" class="span9" size="16" name="'.$fieldname.'['.$attrdef->getId().']" type="text" value="'.($objvalue ? $objvalue : '').'">
<input id="'.$fieldname.'_'.$attrdef->getId().($namepostfix ? '_'.$namepostfix : '').'" class="span8" size="16" name="'.$fieldname.'['.$attrdef->getId().']'.($namepostfix ? '['.$namepostfix.']' : '').'" type="text" value="'.($objvalue ? $objvalue : '').'">
<span class="add-on"><i class="fa fa-calendar"></i></span>
</span>';
break;

View File

@ -331,7 +331,14 @@ function typeahead() { /* {{{ */
?>
<tr>
<td><?php echo htmlspecialchars($attrdef->getName()); ?>:</td>
<td><?php $this->printAttributeEditField($attrdef, isset($attributes[$attrdef->getID()]) ? $attributes[$attrdef->getID()] : null, 'attributes', true) ?></td>
<td>
<?php
if($attrdef->getType() == SeedDMS_Core_AttributeDefinition::type_date)
echo $this->getAttributeEditField($attrdef, !empty($attributes[$attrdef->getID()]['from']) ? getReadableDate(makeTsFromDate($attributes[$attrdef->getID()]['from'])) : '', 'attributes', true, 'from').'&nbsp; '.getMLText('to').' '.$this->getAttributeEditField($attrdef, !empty($attributes[$attrdef->getID()]['to']) ? getReadableDate(makeTsFromDate($attributes[$attrdef->getID()]['to'])) : '', 'attributes', true, 'to');
else
$this->printAttributeEditField($attrdef, isset($attributes[$attrdef->getID()]) ? $attributes[$attrdef->getID()] : '', 'attributes', true)
?>
</td>
</tr>
<?php
@ -495,7 +502,17 @@ function typeahead() { /* {{{ */
?>
<tr>
<td><?php echo htmlspecialchars($attrdef->getName()); ?>:</td>
<<<<<<< HEAD
<td><?php $this->printAttributeEditField($attrdef, isset($attributes[$attrdef->getID()]) ? $attributes[$attrdef->getID()] : null, 'attributes', true) ?></td>
=======
<td>
<?php
if($attrdef->getType() == SeedDMS_Core_AttributeDefinition::type_date)
echo $this->getAttributeEditField($attrdef, !empty($attributes[$attrdef->getID()]['from']) ? getReadableDate(makeTsFromDate($attributes[$attrdef->getID()]['from'])) : '', 'attributes', true, 'from').'&nbsp; '.getMLText('to').' '.$this->getAttributeEditField($attrdef, !empty($attributes[$attrdef->getID()]['to']) ? getReadableDate(makeTsFromDate($attributes[$attrdef->getID()]['to'])) : '', 'attributes', true, 'to');
else
$this->printAttributeEditField($attrdef, isset($attributes[$attrdef->getID()]) ? $attributes[$attrdef->getID()] : '', 'attributes', true)
?></td>
>>>>>>> seeddms-5.1.x
</tr>
<?php