Skip to content

Commit

Permalink
zmi-menu: added type attr to nav-tree rendering
Browse files Browse the repository at this point in the history
Ref: idasm-unibe-ch/unibe-cms#394

(cherry picked from commit 786e7d6)
  • Loading branch information
drfho authored and cmeier76 committed Sep 18, 2023
1 parent d938e5b commit 7ed3f32
Showing 1 changed file with 39 additions and 36 deletions.
75 changes: 39 additions & 36 deletions Products/zms/plugins/www/bootstrap/plugin/bootstrap.plugin.zmi.js
Original file line number Diff line number Diff line change
Expand Up @@ -154,7 +154,7 @@ $ZMI.registerReady(function(){
}
});

// Titleimage: Video-Preview on Hover
// Titleimage: Video-Preview on Hover
if ($('.object_has_titleimage')) {
$('.object_has_titleimage i.preview_on_hover').each( function() {
var media_url = $(this).data('preview_url');
Expand Down Expand Up @@ -252,7 +252,7 @@ $ZMI.registerReady(function(){
var $single_line = $(this);
var $textarea = $('textarea',this);
$textarea.prop({rows:1,wrap:'off'});

if ($single_line.hasClass("zmi-code")) {
$('textarea',$single_line).on('focus', function() {
if ( !$(this).hasClass('open-zmi-code') ) {
Expand Down Expand Up @@ -293,7 +293,7 @@ $ZMI.registerReady(function(){
});
return;
}

if ($single_line.hasClass("zmi-nodes")) {
$textarea.prop({title:getZMILangStr('ATTR_NODE')});
}
Expand Down Expand Up @@ -368,7 +368,7 @@ $ZMI.registerReady(function(){
}
if (!(href==null || typeof href=="undefined")) {
self.location.href = href;
}
}
})
.attr( "title", "Double-click to edit!");

Expand Down Expand Up @@ -693,7 +693,7 @@ ZMI.prototype.initInputFields = function(container) {
}
}
else if (nodeName=="select") {
isBlank = (($("option:selected",$control).length==0)
isBlank = (($("option:selected",$control).length==0)
|| ($("option:selected",$control).length==1 && $("option:selected",$control).attr("value")==""))
&& !$control.attr("disabled")=="disabled";
}
Expand Down Expand Up @@ -1302,6 +1302,9 @@ ZMIObjectTree.prototype.addPages = function(nodes) {
if (node.restricted) {
css.push("restricted");
};
if (node.attr_dc_type) {
css.push('type-' + node.attr_dc_type);
};
html += `<ul data-id="${node.uid}" class="zmi-page ${node.meta_id}${node.is_page_element ? ' is_page_element' :''}">`;
html += `<li class="${css.join(' ')}">`;
html += `<i class="fas fa-caret-right toggle" title="+" onclick="$ZMI.objectTree.toggleClick(this ${typeof callback=='undefined' ? '' : ',' + callback})"></i> `;
Expand All @@ -1312,9 +1315,9 @@ ZMIObjectTree.prototype.addPages = function(nodes) {
html += `<span class="preview_on_hover preview_text" style="cursor:help" data-preview_text="Loading ..." onmouseover="$ZMI.objectTree.preview_load(this)" title="${getZMILangStr('TAB_PREVIEW')}">${icon}</span> `;
}
}
html += `<a href="${node.getPath}"
data-link-url="${link_url}"
data-uid="${node.uid}"
html += `<a href="${node.getPath}"
data-link-url="${link_url}"
data-uid="${node.uid}"
data-anchor="${anchor}"
data-page-titlealt="${node.titlealt.replace(/"/g,'&quot;').replace(/'/g,'&apos;')}"
onclick="return zmiSelectObject(this);return false;">`;
Expand Down Expand Up @@ -1592,7 +1595,7 @@ ZMIActionList.prototype.exec = function(sender, label, target, meta_id='') {
data['id_prefix'] = id_prefix;
var title = '<i class="fas fa-plus-sign"></i> ' + getZMILangStr('BTN_INSERT') + ':&nbsp;' + label;
// debugger;
if (meta_id!='') {
if (meta_id!='') {
data['meta_id'] = meta_id;
}
$('<li id="manage_addProduct" class="zmi-item zmi-highlighted"><div class="center">'+title+'</div></li>').insertAfter($el.parents(".zmi-item"));
Expand All @@ -1614,7 +1617,7 @@ ZMIActionList.prototype.exec = function(sender, label, target, meta_id='') {
zmiModal("hide");
});
// Auto-Insert on models without attributes but not ZMSSqlDb or ZMSTable
if ( ['ZMSSqlDb','ZMSTable'].indexOf($('#ZMS_INSERT').val())==-1 &&
if ( ['ZMSSqlDb','ZMSTable'].indexOf($('#ZMS_INSERT').val())==-1 &&
$('#zmiIframeAddDialog .form-group:not([class*="activity"]) .form-control').length==0 ) {
$('#addInsertBtn').click();
}
Expand Down Expand Up @@ -1777,7 +1780,7 @@ function zmiBrowseObjsApplyUrlValue(fmName, elName, elValue, elTitle) {
$('form[name='+fmName+'] input[name^=title]:text').each(function() {
if ($(this).val()=='') {
$(this).val(elTitle).change();
}
}
});
}
}
Expand Down Expand Up @@ -1863,7 +1866,7 @@ function untagSelected(tag, leftDelimiter, rightDelimiter) {
var tagName = tag.indexOf(" ")>0?tag.substring(0,tag.indexOf(" ")):tag;
var startTag = leftDelimiter + tag + rightDelimiter;
var startRe = new RegExp(leftDelimiter + tag + "(.*?)" + rightDelimiter, "gi");
var endTag = leftDelimiter + "/" + tagName + rightDelimiter;
var endTag = leftDelimiter + "/" + tagName + rightDelimiter;
var endRe = new RegExp(leftDelimiter + "/" + tag + rightDelimiter, "gi");
var preMatch = pre.match(startRe);
var postMatch = post.match(endRe);
Expand Down Expand Up @@ -1905,11 +1908,11 @@ function tagSelected(tag, leftDelimiter, rightDelimiter) {
}
if (tagName == 'a' && tagAttrs == '') {
zmiBrowseObjs('','',getZMILang());
}
}
else {
var startTag = leftDelimiter + tagName + tagAttrs + rightDelimiter;
var endTag = leftDelimiter + "/" + tagName + rightDelimiter;
var newRange = startTag + range + endTag;
var newRange = startTag + range + endTag;
$(selectedInput).val(pre+newRange+post);
// Set selection.
var offset = startTag.length;
Expand Down Expand Up @@ -2030,7 +2033,7 @@ $ZMI.registerReady(function(){
} else {
$('.scroller-right').hide();
}

if (getLeftPosi()<0) {
$('.scroller-left').show();
} else {
Expand Down Expand Up @@ -2140,7 +2143,7 @@ function zmiExpandConfFiles(el, pattern) {
// Url-Input
// /////////////////////////////////////////////////////////////////////////////

ZMI.prototype.initUrlInput = function(context) {
ZMI.prototype.initUrlInput = function(context) {
var fn_url_input_each = function() {
var $input = $(this);
var fmName = $input.parents("form").attr("name");
Expand Down Expand Up @@ -2231,28 +2234,28 @@ ZMI.prototype.initUrlInput = function(context) {
/**
* Remove option from multiselect
*/
ZMI.prototype.removeFromMultiselect = function(src) {
ZMI.prototype.removeFromMultiselect = function(src) {
if (typeof src == "string") {
src = document.getElementById(src);
}
var selected = new Array();
var index = 0;
while (index < src.options.length) {
if (src.options[index].selected) {
selected[index] = src.options[index].selected;
}
index++;
}
index = 0;
var count = 0;
while (index < selected.length) {
if (selected[index])
src.options[count] = null;
else
count++;
index++;
}
sortOptions(src);
var selected = new Array();
var index = 0;
while (index < src.options.length) {
if (src.options[index].selected) {
selected[index] = src.options[index].selected;
}
index++;
}
index = 0;
var count = 0;
while (index < selected.length) {
if (selected[index])
src.options[count] = null;
else
count++;
index++;
}
sortOptions(src);
}

/**
Expand Down Expand Up @@ -2341,7 +2344,7 @@ function addOption( object, name, value, selectedValue) {
var selected = value.length > 0 && value == selectedValue;
object.options[object.length] = new Option( name, value, defaultSelected, selected);
}

/**
* Sort options.
*/
Expand Down

0 comments on commit 7ed3f32

Please sign in to comment.