mirror of
https://git.code.sf.net/p/seeddms/code
synced 2025-02-11 09:35:00 +00:00
Merge branch 'seeddms-5.1.x' into seeddms-6.0.x
This commit is contained in:
commit
f97124d694
|
@ -238,6 +238,8 @@ class SeedDMS_EmailNotify extends SeedDMS_Notify {
|
|||
}
|
||||
$result = $mail->send($to, $hdrs, $message);
|
||||
if (PEAR::isError($result)) {
|
||||
if($this->debug)
|
||||
echo "\n".$result->getMessage();
|
||||
return false;
|
||||
} else {
|
||||
return true;
|
||||
|
|
|
@ -200,6 +200,26 @@ if($fullsearch) {
|
|||
else
|
||||
$attributes = array();
|
||||
|
||||
foreach($attributes as $an=>&$av) {
|
||||
if(substr($an, 0, 5) == 'attr_') {
|
||||
$tmp = explode('_', $an);
|
||||
if($attrdef = $dms->getAttributeDefinition($tmp[1])) {
|
||||
switch($attrdef->getType()) {
|
||||
/* Turn dates into timestamps */
|
||||
case SeedDMS_Core_AttributeDefinition::type_date:
|
||||
foreach(['from', 'to'] as $kk)
|
||||
if(!empty($av[$kk])) {
|
||||
if(!is_numeric($av[$kk])) {
|
||||
$av[$kk] = makeTsFromDate($av[$kk]);
|
||||
}
|
||||
}
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
//print_r($attributes);exit;
|
||||
// Check to see if the search has been restricted to a particular sub-tree in
|
||||
// the folder hierarchy.
|
||||
$startFolder = null;
|
||||
|
|
|
@ -991,7 +991,13 @@ $(document).ready(function() {
|
|||
default:
|
||||
$options = [];
|
||||
foreach($values as $v=>$c) {
|
||||
$option = array($v, $v);
|
||||
switch($attrdef->getType()) {
|
||||
case SeedDMS_Core_AttributeDefinition::type_date:
|
||||
$option = array($v, getReadableDate($v));
|
||||
break;
|
||||
default:
|
||||
$option = array($v, $v);
|
||||
}
|
||||
if(isset($attributes[$facetname]) && in_array($v, $attributes[$facetname]))
|
||||
$option[] = true;
|
||||
else
|
||||
|
@ -1072,7 +1078,16 @@ $(document).ready(function() {
|
|||
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];
|
||||
if(is_array($allparams['attributes'][$facetname])) {
|
||||
switch($attrdef->getType()) {
|
||||
case SeedDMS_Core_AttributeDefinition::type_date:
|
||||
array_walk($allparams['attributes'][$facetname], function(&$v, $k){$v=getReadableDate($v);});
|
||||
break;
|
||||
}
|
||||
$oldvalue = implode(',', $allparams['attributes'][$facetname]);
|
||||
} else {
|
||||
$oldvalue = $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');
|
||||
|
@ -1085,18 +1100,22 @@ $(document).ready(function() {
|
|||
$allparams = $request->query->all();
|
||||
if(isset($allparams[$facetname])) {
|
||||
$oldvalue = is_array($allparams[$facetname]) ? implode(',', $allparams[$facetname]) : $allparams[$facetname];
|
||||
switch($facetname) {
|
||||
case 'status':
|
||||
$oldtransval = getOverallStatusText($oldvalue);
|
||||
break;
|
||||
default:
|
||||
$oldtransval = $oldvalue;
|
||||
}
|
||||
unset($allparams[$facetname]);
|
||||
$newrequest = Symfony\Component\HttpFoundation\Request::create($request->getBaseUrl(), 'GET', $allparams);
|
||||
$menuitems[] = array('label'=>'<i class="fa fa-remove"></i> '.getMLText($facetname).' = '.$oldvalue, 'link'=>$newrequest->getRequestUri(), 'attributes'=>[['title', 'Click to remove']], '_badge'=>'x');
|
||||
$menuitems[] = array('label'=>'<i class="fa fa-remove"></i> '.getMLText($facetname).' = '.$oldtransval, 'link'=>$newrequest->getRequestUri(), 'attributes'=>[['title', 'Click to remove']], '_badge'=>'x');
|
||||
echo '<input type="hidden" name="'.$facetname.'[]" value="'.$oldvalue.'" />';
|
||||
}
|
||||
}
|
||||
}
|
||||
if($menuitems) {
|
||||
// ob_start();
|
||||
self::showNavigationListWithBadges($menuitems);
|
||||
// $content = ob_get_clean();
|
||||
// $this->printAccordion(getMLText('current_filter'), $content, true);
|
||||
}
|
||||
}
|
||||
echo "<p></p>";
|
||||
|
@ -1122,7 +1141,7 @@ $(document).ready(function() {
|
|||
if(empty($allparams['attributes'][$facetname]['from']) && empty($allparams['attributes'][$facetname]['to'])) {
|
||||
$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 .= '<span class="input-group-text" style="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).'" />';
|
||||
|
@ -1132,13 +1151,34 @@ $(document).ready(function() {
|
|||
}
|
||||
}
|
||||
break;
|
||||
case SeedDMS_Core_AttributeDefinition::type_date:
|
||||
if($values && (count($values) > 1 || reset($values) < $total)) {
|
||||
if(empty($allparams['attributes'][$facetname]['from']) && empty($allparams['attributes'][$facetname]['to'])) {
|
||||
$tt = array_keys($values);
|
||||
$content = '<div class="input-group">';
|
||||
$content .= '<span class="input-group-text" style="border-right: 0;"> from </span>';
|
||||
$content .= $this->getDateChooser('', "attributes[".$facetname."][from]", $this->params['session']->getLanguage(), '', getReadableDate(min($tt)), getReadableDate(max($tt)));
|
||||
$content .= '<span class="input-group-text" style="border-left: 0; border-right: 0;"> to </span>';
|
||||
$content .= $this->getDateChooser('', "attributes[".$facetname."][to]", $this->params['session']->getLanguage(), '', getReadableDate(min($tt)), getReadableDate(max($tt)));
|
||||
$content .= '<button class="btn btn-primary" 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);
|
||||
switch($attrdef->getType()) {
|
||||
case SeedDMS_Core_AttributeDefinition::type_date:
|
||||
$menuitems[] = array('label'=>getReadableDate($v), 'link'=>$newrequest->getRequestUri().'&attributes['.$facetname.'][]='.urlencode($v), 'badge'=>$c);
|
||||
break;
|
||||
default:
|
||||
$menuitems[] = array('label'=>htmlspecialchars($v), 'link'=>$newrequest->getRequestUri().'&attributes['.$facetname.'][]='.urlencode($v), 'badge'=>$c);
|
||||
}
|
||||
}
|
||||
ob_start();
|
||||
self::showNavigationListWithBadges($menuitems);
|
||||
|
@ -1156,8 +1196,16 @@ $(document).ready(function() {
|
|||
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().'&'.$facetname.'[]='.urlencode($v), 'badge'=>$c);
|
||||
switch($facetname) {
|
||||
case 'status':
|
||||
foreach($values as $v=>$c) {
|
||||
$menuitems[] = array('label'=>getOverallStatusText($v), 'link'=>$newrequest->getRequestUri().'&'.$facetname.'[]='.urlencode($v), 'badge'=>$c);
|
||||
}
|
||||
break;
|
||||
default:
|
||||
foreach($values as $v=>$c) {
|
||||
$menuitems[] = array('label'=>htmlspecialchars($v), 'link'=>$newrequest->getRequestUri().'&'.$facetname.'[]='.urlencode($v), 'badge'=>$c);
|
||||
}
|
||||
}
|
||||
ob_start();
|
||||
self::showNavigationListWithBadges($menuitems);
|
||||
|
|
Loading…
Reference in New Issue
Block a user