mirror of
https://git.code.sf.net/p/seeddms/code
synced 2025-05-21 09:01:27 +00:00
Merge branch 'seeddms-5.1.x' into seeddms-6.0.x
This commit is contained in:
commit
f42d4d38b1
|
@ -1051,8 +1051,6 @@ $(document).ready(function() {
|
||||||
$this->formField(getMLText("under_folder"), $this->getFolderChooserHtml("form3", M_READ, -1, $startfolder, 'folderfullsearchid'));
|
$this->formField(getMLText("under_folder"), $this->getFolderChooserHtml("form3", M_READ, -1, $startfolder, 'folderfullsearchid'));
|
||||||
|
|
||||||
$this->contentContainerEnd();
|
$this->contentContainerEnd();
|
||||||
$this->formSubmit("<i class=\"fa fa-search\"></i> ".getMLText('search'));
|
|
||||||
echo "<p></p>";
|
|
||||||
|
|
||||||
if($facets) {
|
if($facets) {
|
||||||
$menuitems = [];
|
$menuitems = [];
|
||||||
|
@ -1064,10 +1062,22 @@ $(document).ready(function() {
|
||||||
/* Create a link to remove the filter */
|
/* Create a link to remove the filter */
|
||||||
$allparams = $request->query->all();
|
$allparams = $request->query->all();
|
||||||
if(isset($allparams['attributes'][$facetname])) {
|
if(isset($allparams['attributes'][$facetname])) {
|
||||||
$oldvalue = is_array($allparams['attributes'][$facetname]) ? implode(',', $allparams['attributes'][$facetname]) : $allparams['attributes'][$facetname];
|
if(isset($allparams['attributes'][$facetname]['to']) && isset($allparams['attributes'][$facetname]['from'])) {
|
||||||
unset($allparams['attributes'][$facetname]);
|
$oldvalue = $allparams['attributes'][$facetname];
|
||||||
$newrequest = Symfony\Component\HttpFoundation\Request::create($request->getBaseUrl(), 'GET', $allparams);
|
if(!empty($oldvalue['from']) || !empty($oldvalue['to'])) {
|
||||||
$menuitems[] = array('label'=>$dispname.' = '.$oldvalue, 'link'=>$newrequest->getRequestUri(), 'attributes'=>[['title', 'Click to remove']], '_badge'=>'x');
|
unset($allparams['attributes'][$facetname]);
|
||||||
|
$newrequest = Symfony\Component\HttpFoundation\Request::create($request->getBaseUrl(), 'GET', $allparams);
|
||||||
|
$menuitems[] = array('label'=>'<i class="fa fa-remove"></i> '.$dispname.' = '.$oldvalue['from'].' TO '.$oldvalue['to'], 'link'=>$newrequest->getRequestUri(), 'attributes'=>[['title', 'Click to remove']], '_badge'=>'x');
|
||||||
|
echo '<input type="hidden" name="attributes['.$facetname.'][from]" value="'.$oldvalue['from'].'" />';
|
||||||
|
echo '<input type="hidden" name="attributes['.$facetname.'][to]" value="'.$oldvalue['to'].'" />';
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
$oldvalue = is_array($allparams['attributes'][$facetname]) ? implode(',', $allparams['attributes'][$facetname]) : $allparams['attributes'][$facetname];
|
||||||
|
unset($allparams['attributes'][$facetname]);
|
||||||
|
$newrequest = Symfony\Component\HttpFoundation\Request::create($request->getBaseUrl(), 'GET', $allparams);
|
||||||
|
$menuitems[] = array('label'=>'<i class="fa fa-remove"></i> '.$dispname.' = '.$oldvalue, 'link'=>$newrequest->getRequestUri(), 'attributes'=>[['title', 'Click to remove']], '_badge'=>'x');
|
||||||
|
echo '<input type="hidden" name="attributes['.$facetname.'][]" value="'.$oldvalue.'" />';
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
|
@ -1077,46 +1087,76 @@ $(document).ready(function() {
|
||||||
$oldvalue = is_array($allparams[$facetname]) ? implode(',', $allparams[$facetname]) : $allparams[$facetname];
|
$oldvalue = is_array($allparams[$facetname]) ? implode(',', $allparams[$facetname]) : $allparams[$facetname];
|
||||||
unset($allparams[$facetname]);
|
unset($allparams[$facetname]);
|
||||||
$newrequest = Symfony\Component\HttpFoundation\Request::create($request->getBaseUrl(), 'GET', $allparams);
|
$newrequest = Symfony\Component\HttpFoundation\Request::create($request->getBaseUrl(), 'GET', $allparams);
|
||||||
$menuitems[] = array('label'=>getMLText($facetname).' = '.$oldvalue, 'link'=>$newrequest->getRequestUri(), 'attributes'=>[['title', 'Click to remove']], '_badge'=>'x');
|
$menuitems[] = array('label'=>'<i class="fa fa-remove"></i> '.getMLText($facetname).' = '.$oldvalue, 'link'=>$newrequest->getRequestUri(), 'attributes'=>[['title', 'Click to remove']], '_badge'=>'x');
|
||||||
|
echo '<input type="hidden" name="'.$facetname.'[]" value="'.$oldvalue.'" />';
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if($menuitems) {
|
if($menuitems) {
|
||||||
ob_start();
|
// ob_start();
|
||||||
self::showNavigationListWithBadges($menuitems);
|
self::showNavigationListWithBadges($menuitems);
|
||||||
$content = ob_get_clean();
|
// $content = ob_get_clean();
|
||||||
$this->printAccordion(getMLText('current_filter'), $content, true);
|
// $this->printAccordion(getMLText('current_filter'), $content, true);
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
echo "<p></p>";
|
||||||
|
$this->formSubmit("<i class=\"fa fa-search\"></i> ".getMLText('search'));
|
||||||
|
echo "<p></p>";
|
||||||
|
if($facets) {
|
||||||
|
$allparams = $request->query->all();
|
||||||
|
if(!isset($allparams['fullsearch']))
|
||||||
|
$allparams['fullsearch'] = 1;
|
||||||
|
if(!isset($allparams['facetsearch']))
|
||||||
|
$allparams['facetsearch'] = 1;
|
||||||
|
$newrequest = Symfony\Component\HttpFoundation\Request::create($request->getBaseUrl(), 'GET', $allparams);
|
||||||
foreach($facets as $facetname=>$values) {
|
foreach($facets as $facetname=>$values) {
|
||||||
if(substr($facetname, 0, 5) == 'attr_') {
|
if(substr($facetname, 0, 5) == 'attr_') {
|
||||||
$tmp = explode('_', $facetname);
|
$tmp = explode('_', $facetname);
|
||||||
if($attrdef = $dms->getAttributeDefinition($tmp[1])) {
|
if($attrdef = $dms->getAttributeDefinition($tmp[1])) {
|
||||||
$dispname = $attrdef->getName();
|
$dispname = $attrdef->getName();
|
||||||
/* See below on an explaination for the if statement */
|
switch($attrdef->getType()) {
|
||||||
if($values && (count($values) > 1 || reset($values) < $total)) {
|
case SeedDMS_Core_AttributeDefinition::type_int:
|
||||||
$menuitems = array();
|
/* See below on an explaination for the if statement */
|
||||||
arsort($values);
|
if($values && (count($values) > 1 || reset($values) < $total)) {
|
||||||
foreach($values as $v=>$c) {
|
if(empty($allparams['attributes'][$facetname]['from']) && empty($allparams['attributes'][$facetname]['to'])) {
|
||||||
$menuitems[] = array('label'=>htmlspecialchars($v), 'link'=>$request->getRequestUri().'&attributes['.$facetname.'][]='.urlencode($v), 'badge'=>$c, 'attributes'=>array(array('data-href', $request->getRequestUri().'&'.$facetname.'='.$v), array('data-action', "printOpenTasksList")));
|
$tt = array_keys($values);
|
||||||
|
$content = '<div class="input-group">';
|
||||||
|
$content .= '<span class="input-group-text" style="border-left: 0; border-right: 0;"> from </span>';
|
||||||
|
$content .= '<input type="number" class="form-control" name="attributes['.$facetname.'][from]" value="" placeholder="min is '.min($tt).'" />';
|
||||||
|
$content .= '<span class="input-group-text" style="border-left: 0; border-right: 0;"> to </span>';
|
||||||
|
$content .= '<input type="number" class="form-control" name="attributes['.$facetname.'][to]" value="" placeholder="max is '.max($tt).'" />';
|
||||||
|
$content .= '<button class="btn btn-outline-secondary" type="submit">Set</button>';
|
||||||
|
$content .= '</div>';
|
||||||
|
$this->printAccordion($dispname, $content);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
/* See below on an explaination for the if statement */
|
||||||
|
if($values && (count($values) > 1 || reset($values) < $total)) {
|
||||||
|
$menuitems = array();
|
||||||
|
arsort($values);
|
||||||
|
foreach($values as $v=>$c) {
|
||||||
|
$menuitems[] = array('label'=>htmlspecialchars($v), 'link'=>$newrequest->getRequestUri().'&attributes['.$facetname.'][]='.urlencode($v), 'badge'=>$c);
|
||||||
|
}
|
||||||
|
ob_start();
|
||||||
|
self::showNavigationListWithBadges($menuitems);
|
||||||
|
$content = ob_get_clean();
|
||||||
|
$this->printAccordion($dispname, $content);
|
||||||
}
|
}
|
||||||
ob_start();
|
|
||||||
self::showNavigationListWithBadges($menuitems);
|
|
||||||
$content = ob_get_clean();
|
|
||||||
$this->printAccordion($dispname, $content);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
/* Further filter makes onle sense if the facet has mor than 1 value
|
/* Further filter makes only sense if the facet has more than 1 value
|
||||||
* or in case of 1 value that value has a count < $total. That second
|
* or in case of 1 value, if that value has a count < $total. That second
|
||||||
* case will reduce the result set on those objects which the field
|
* case will reduce the result set on those objects which have the field
|
||||||
* actually set.
|
* actually set.
|
||||||
*/
|
*/
|
||||||
if($values && (count($values) > 1 || reset($values) < $total)) {
|
if($values && (count($values) > 1 || reset($values) < $total)) {
|
||||||
$menuitems = array();
|
$menuitems = array();
|
||||||
arsort($values);
|
arsort($values);
|
||||||
foreach($values as $v=>$c) {
|
foreach($values as $v=>$c) {
|
||||||
$menuitems[] = array('label'=>htmlspecialchars($v), 'link'=>$request->getRequestUri().'&'.$facetname.'[]='.urlencode($v), 'badge'=>$c, 'attributes'=>array(array('data-href', "#initlist"), array('data-action', "printOpenTasksList")));
|
$menuitems[] = array('label'=>htmlspecialchars($v), 'link'=>$newrequest->getRequestUri().'&'.$facetname.'[]='.urlencode($v), 'badge'=>$c);
|
||||||
}
|
}
|
||||||
ob_start();
|
ob_start();
|
||||||
self::showNavigationListWithBadges($menuitems);
|
self::showNavigationListWithBadges($menuitems);
|
||||||
|
|
Loading…
Reference in New Issue
Block a user