From 4e39e36838926dc9302a453094ec2b17c61a7693 Mon Sep 17 00:00:00 2001 From: Tino Vazquez Date: Wed, 13 Mar 2013 17:22:06 +0100 Subject: [PATCH] feature #1664: Fix for vectorial templates --- .../public/js/plugins/templates-tab.js | 75 +++++++------- src/sunstone/public/js/sunstone-util.js | 99 ++++++++++++------- 2 files changed, 102 insertions(+), 72 deletions(-) diff --git a/src/sunstone/public/js/plugins/templates-tab.js b/src/sunstone/public/js/plugins/templates-tab.js index c1f7d3aac1..94ddd509a1 100644 --- a/src/sunstone/public/js/plugins/templates-tab.js +++ b/src/sunstone/public/js/plugins/templates-tab.js @@ -824,45 +824,42 @@ function updateTemplateInfo(request,template){ var info_tab = { title: tr("Information"), content: - '\ - \ - \ - \ - \ - \ - \ - \ - \ - \ - \ - \ - \ - \ - \ - \ - \ - \ - \ - \ - \ - \ - \ - \ - \ - \ - \ - \ - \ - \ - \ - \ - \ - \ - \ - \ - \ -
'+tr("Template")+' \"'+template_info.NAME+'\" '+ - tr("information")+'
'+tr("ID")+''+template_info.ID+'
'+tr("Name")+''+template_info.NAME+'
'+tr("Owner")+''+template_info.UNAME+'
'+tr("Group")+''+template_info.GNAME+'
'+tr("Register time")+''+pretty_time(template_info.REGTIME)+'
'+tr("Permissions")+'
     '+tr("Owner")+''+ownerPermStr(template_info)+'
     '+tr("Group")+''+groupPermStr(template_info)+'
     '+tr("Other")+''+otherPermStr(template_info)+'
' + '
\ + \ + \ + \ + \ + \ + \ + \ + \ + \ + \ + \ + \ + \ + \ + \ + \ + \ + \ + \ + \ + \ + \ + \ + \ +
'+tr("Template")+' \"'+template_info.NAME+'\" '+ + tr("information")+'
'+tr("ID")+''+template_info.ID+'
'+tr("Name")+''+template_info.NAME+'
'+tr("Owner")+''+template_info.UNAME+'
'+tr("Group")+''+template_info.GNAME+'
'+tr("Register time")+''+pretty_time(template_info.REGTIME)+'
\ +
\ +
' + insert_permissions_table("Template", + template_info.ID, + template_info.UNAME, + template_info.GNAME, + template_info.UID, + template_info.GID) + + '
\ + ' }; var template_tab = { title: tr("Template"), diff --git a/src/sunstone/public/js/sunstone-util.js b/src/sunstone/public/js/sunstone-util.js index 850dbd67ce..fa0f51f977 100644 --- a/src/sunstone/public/js/sunstone-util.js +++ b/src/sunstone/public/js/sunstone-util.js @@ -1500,9 +1500,12 @@ function insert_extended_template_table(template_json,resource_type,resource_id, var ocurrence=null; if (list_of_classes.length!=1) - for (var current_class in list_of_classes) - if (list_of_classes[current_class].match(/^ocurrence_/)) - ocurrence=list_of_classes[current_class].substring(10,list_of_classes[current_class].length); + { + $.each(list_of_classes, function(index, value) { + if (value.match(/^ocurrence_/)) + ocurrence=value.substring(10,value.length);; + }); + } // Erase the value from the template if(ocurrence!=null) @@ -1550,14 +1553,20 @@ function insert_extended_template_table(template_json,resource_type,resource_id, var vectorial_key = null; if (list_of_classes.length!=1) - for (var current_class in list_of_classes) - if (list_of_classes[current_class].match(/^ocurrence_/)) - ocurrence+=list_of_classes[current_class]+" "; + { + $.each(list_of_classes, function(index, value) { + if (value.match(/^ocurrence_/)) + ocurrence+=value+" "; + }); + } if (list_of_classes.length!=1) - for (var current_class in list_of_classes) - if (list_of_classes[current_class].match(/^vectorial_key_/)) - vectorial_key=list_of_classes[current_class]; + { + $.each(list_of_classes, function(index, value) { + if (value.match(/^vectorial_key_/)) + vectorial_key=value; + }); + } if (ocurrence!=" ") @@ -1584,14 +1593,20 @@ function insert_extended_template_table(template_json,resource_type,resource_id, var vectorial_key = null; if (list_of_classes.length!=1) - for (var current_class in list_of_classes) - if (list_of_classes[current_class].match(/^ocurrence_/)) - ocurrence=list_of_classes[current_class].substring(10,list_of_classes[current_class].length); + { + $.each(list_of_classes, function(index, value) { + if (value.match(/^ocurrence_/)) + ocurrence=value.substring(10,value.length); + }); + } if (list_of_classes.length!=1) - for (var current_class in list_of_classes) - if (list_of_classes[current_class].match(/^vectorial_key_/)) - vectorial_key=list_of_classes[current_class].substring(14,list_of_classes[current_class].length); + { + $.each(list_of_classes, function(index, value) { + if (value.match(/^vectorial_key_/)) + vectorial_key=value.substring(14,value.length); + }); + } if (ocurrence!=null) template_json[vectorial_key][ocurrence][key_str]=value_str; @@ -1615,14 +1630,20 @@ function insert_extended_template_table(template_json,resource_type,resource_id, var vectorial_key = null; if (list_of_classes.length!=1) - for (var current_class in list_of_classes) - if (list_of_classes[current_class].match(/^ocurrence_/)) - ocurrence=list_of_classes[current_class].substring(10,list_of_classes[current_class].length); + { + $.each(list_of_classes, function(index, value) { + if (value.match(/^ocurrence_/)) + ocurrence=value.substring(10,value.length); + }); + } if (list_of_classes.length!=1) - for (var current_class in list_of_classes) - if (list_of_classes[current_class].match(/^vectorial_key_/)) - vectorial_key=list_of_classes[current_class].substring(14,list_of_classes[current_class].length); + { + $.each(list_of_classes, function(index, value) { + if (value.match(/^vectorial_key_/)) + vectorial_key=value.substring(14,value.length); + }); + } // Erase the value from the template if(ocurrence!=null) @@ -1646,14 +1667,20 @@ function insert_extended_template_table(template_json,resource_type,resource_id, var vectorial_key = null; if (list_of_classes.length!=1) - for (var current_class in list_of_classes) - if (list_of_classes[current_class].match(/^ocurrence_/)) - ocurrence=list_of_classes[current_class]; + { + $.each(list_of_classes, function(index, value) { + if (value.match(/^ocurrence_/)) + ocurrence=value; + }); + } if (list_of_classes.length!=1) - for (var current_class in list_of_classes) - if (list_of_classes[current_class].match(/^vectorial_key_/)) - vectorial_key=list_of_classes[current_class]; + { + $.each(list_of_classes, function(index, value) { + if (value.match(/^vectorial_key_/)) + vectorial_key=value; + }); + } $(this).parent().parent().after('\ @@ -1674,14 +1701,20 @@ function insert_extended_template_table(template_json,resource_type,resource_id, var template_json_bk = $.extend({}, template_json); if (list_of_classes.length!=1) - for (var current_class in list_of_classes) - if (list_of_classes[current_class].match(/^vectorial_key_/)) - vectorial_key=list_of_classes[current_class]; + { + $.each(list_of_classes, function(index, value) { + if (value.match(/^vectorial_key_/)) + vectorial_key=value; + }); + } if (list_of_classes.length!=1) - for (var current_class in list_of_classes) - if (list_of_classes[current_class].match(/^ocurrence_/)) - ocurrence=list_of_classes[current_class]; + { + $.each(list_of_classes, function(index, value) { + if (value.match(/^ocurrence_/)) + ocurrence=value; + }); + } vectorial_key=vectorial_key.substring(14,vectorial_key.length);