mirror of
https://git.code.sf.net/p/seeddms/code
synced 2025-02-06 15:14:58 +00:00
Merge branch 'seeddms-5.1.x' into seeddms-6.0.x
This commit is contained in:
commit
6ddf3c3cfe
|
@ -798,12 +798,22 @@ if(($kkk = $this->callHook('getFullSearchEngine')) && is_array($kkk))
|
|||
case "attributedefinitions":
|
||||
$objtype = empty($conf['objtype']) ? 0 : $conf['objtype'];
|
||||
$attrtype = empty($conf['attrtype']) ? 0 : $conf['attrtype'];
|
||||
$order = empty($conf['order']) ? '' : $conf['order'];
|
||||
$recs = $dms->getAllAttributeDefinitions($objtype, $attrtype);
|
||||
if($recs) {
|
||||
echo "<select class=\"chzn-select\"".($allowempty ? " data-allow-clear=\"true\"" : "")." name=\"extensions[".$extname."][".$confkey."][]\"".(!empty($conf['multiple']) ? " multiple" : "").(!empty($conf['size']) ? " size=\"".$conf['size']."\"" : "")." data-placeholder=\"".getMLText("select_attrdef")."\" data-no_results_text=\"".getMLText('unknown_attrdef')."\" style=\"width: 100%;\">";
|
||||
echo "<select class=\"chzn-select\"".($allowempty ? " data-allow-clear=\"true\"" : "").($order ? " order=\"".$order."\"" : "")." name=\"extensions[".$extname."][".$confkey."][]\"".(!empty($conf['multiple']) ? " multiple" : "").(!empty($conf['size']) ? " size=\"".$conf['size']."\"" : "")." data-placeholder=\"".getMLText("select_attrdef")."\" data-no_results_text=\"".getMLText('unknown_attrdef')."\" style=\"width: 100%;\">";
|
||||
if($allowempty)
|
||||
echo "<option value=\"\"></option>";
|
||||
if($order == 'keep') {
|
||||
foreach($selections as $selid) {
|
||||
if($rec = $dms->getAttributeDefinition($selid)) {
|
||||
echo "<option value=\"".$rec->getID()."\" selected data-subtitle=\"".htmlspecialchars(getAttributeObjectTypeText($rec).", ".getAttributeTypeText($rec))."\">".htmlspecialchars($rec->getName())."</option>";
|
||||
}
|
||||
}
|
||||
}
|
||||
foreach($recs as $rec) {
|
||||
if($order == 'keep' && in_array($rec->getID(), $selections))
|
||||
continue;
|
||||
echo "<option value=\"".$rec->getID()."\"";
|
||||
if(in_array($rec->getID(), $selections))
|
||||
echo " selected";
|
||||
|
|
|
@ -28,6 +28,12 @@ chzn_template_func = function (state) { /* {{{ */
|
|||
return $newstate;
|
||||
}; /* }}} */
|
||||
|
||||
function chzn_select_item(target, id) { /* {{{ */
|
||||
var option = $(target).children('[value=' + id + ']');
|
||||
option.detach();
|
||||
$(target).append(option).change();
|
||||
}; /* }}} */
|
||||
|
||||
function escapeHtml(text) { /* {{{ */
|
||||
var map = {
|
||||
'&': '&',
|
||||
|
@ -99,6 +105,11 @@ function initMost() { /* {{{ */
|
|||
templateResult: chzn_template_func
|
||||
}); /* }}} */
|
||||
|
||||
/* newly selected items will be appended to the end */
|
||||
$('.chzn-select[order=keep]').on('select2:select', function (e) { /* {{{ */
|
||||
chzn_select_item(e.target, e.params.data.id);
|
||||
}); /* }}} */
|
||||
|
||||
$(".chzn-select-folder").select2({ /* {{{ */
|
||||
theme: "bootstrap4",
|
||||
width: 'resolve',
|
||||
|
|
|
@ -28,6 +28,12 @@ chzn_template_func = function (state) { /* {{{ */
|
|||
return $newstate;
|
||||
}; /* }}} */
|
||||
|
||||
function chzn_select_item(target, id) { /* {{{ */
|
||||
var option = $(target).children('[value=' + id + ']');
|
||||
option.detach();
|
||||
$(target).append(option).change();
|
||||
}; /* }}} */
|
||||
|
||||
function escapeHtml(text) { /* {{{ */
|
||||
var map = {
|
||||
'&': '&',
|
||||
|
@ -103,6 +109,11 @@ function initMost() { /* {{{ */
|
|||
templateResult: chzn_template_func
|
||||
}); /* }}} */
|
||||
|
||||
/* newly selected items will be appended to the end */
|
||||
$('.chzn-select[order=keep]').on('select2:select', function (e) { /* {{{ */
|
||||
chzn_select_item(e.target, e.params.data.id);
|
||||
}); /* }}} */
|
||||
|
||||
$(".chzn-select-folder").select2({ /* {{{ */
|
||||
theme: "bootstrap4",
|
||||
width: 'resolve',
|
||||
|
|
Loading…
Reference in New Issue
Block a user