cockpit/themes/control/theme.js in cpee-2.1.44 vs cockpit/themes/control/theme.js in cpee-2.1.45

- old
+ new

@@ -91,11 +91,11 @@ if (typeof(nodes) != "string") { return; } nodes = JSON.parse(nodes); $(nodes).each(function(key,str) { - nodes[key] = $X(str);; + nodes[key] = $X(str); }); var check1 = []; var check2 = []; $(nodes).each(function(key,node){ @@ -174,18 +174,44 @@ } } if(xml_node.get(0).tagName != 'description' && !self.elements[xml_node.get(0).tagName].neverdelete) { var icon = self.elements[xml_node.get(0).tagName].illustrator.svg.clone(); - icon.children('.rfill').addClass('menu'); + icon.find('.rfill').addClass('menu'); + icon.find('.hfill').addClass('menu'); menu['Delete'] = [{ 'label': 'Remove Element', - 'function_call': function(selector,target,selected){ self.adaptor.description.remove(selector,target); self.adaptor.illustrator.get_label_by_svg_id(selected).addClass('selected'); }, + 'function_call': function(selector,target,selected){ + del_ui_pos(target) + self.adaptor.description.remove(selector,target); + }, 'menu_icon': icon, 'type': undefined, 'params': [null, xml_node, self.selected()] }]; + var nodes = localStorage.getItem('marked'); + nodes = JSON.parse(nodes); + if (nodes && nodes.length > 0) { + var icond = self.resources['delete'].clone(); + icond.children('.standfat').addClass('menu'); + menu['Delete'].push({ + 'label': 'Remove Marked Elements', + 'function_call': function(){ + $(nodes).each(function(key,str) { + nodes[key] = $X(str); + }); + $(nodes).each(function(key,node){ + var target = self.adaptor.description.get_node_by_svg_id($(node).attr('svg-id')); + del_ui_pos(target) + self.adaptor.description.remove(null,target); + }); + }, + 'menu_icon': icond, + 'type': undefined, + 'params': [] + }) + } } if($('> code', xml_node).length > 0 && xml_node.get(0).tagName == 'call') { var icon = self.elements.callmanipulate.illustrator.svg.clone(); icon.children('.rfill:last').addClass('menu'); menu['Delete'].push({ @@ -196,11 +222,11 @@ 'params': ['> code', xml_node] }); } if (xml_node.get(0).tagName == "call" || xml_node.get(0).tagName == "manipulate" || xml_node.get(0).tagName == "stop") { var icon = self.elements.call.illustrator.svg.clone(); - icon.children('g.replace').addClass('active'); + icon.children('g.replace').addClass('passive'); var vtarget = self.adaptor.illustrator.get_node_by_svg_id(svgid); if (vtarget.length > 0) { if (vtarget.parents('g.activities.passive, g.activities.active').length > 0) { menu['Position'] = [{ 'label': 'No Execution from here', @@ -297,9 +323,10 @@ this.events.dragstart = function (svgid, e) { //{{{ } //}}} // other resources this.resources.arrow = self.adaptor.theme_dir + 'symbols/arrow.svg'; + this.resources.delete = self.adaptor.theme_dir + 'symbols/delete.svg'; // Primitive Elements this.elements.call = { /*{{{*/ 'type': 'primitive', 'illustrator': {//{{{