From 6c8425b279a4b474f54b8c8184f7fd4eccdce63e Mon Sep 17 00:00:00 2001 From: Jessica Wang Date: Mon, 18 Jun 2012 14:06:13 -0700 Subject: [PATCH] cloudstack 3.0 UI - edit template - isPublic field - Make it editable if it's root-admin or if allow.public.user.template is true. Make it non-editable otherwise. --- ui/scripts/templates.js | 20 ++++++++++++++++++-- 1 file changed, 18 insertions(+), 2 deletions(-) diff --git a/ui/scripts/templates.js b/ui/scripts/templates.js index 4c765538934..e49b94ff52c 100644 --- a/ui/scripts/templates.js +++ b/ui/scripts/templates.js @@ -365,7 +365,13 @@ }); var array2 = []; - array2.push("&ispublic=" + (args.data.ispublic=="on")); + + //array2.push("&ispublic=" + (args.data.ispublic=="on")); + if(args.data.ispublic == "on") + array2.push("&ispublic=true"); + else if(args.data.ispublic == "off") + array2.push("&ispublic=false"); + //if args.data.ispublic is undefined, do not pass ispublic to API call. if(args.data.isfeatured == "on") array2.push("&isfeatured=true"); @@ -613,7 +619,17 @@ ispublic: { label: 'label.public', isBoolean: true, - isEditable: true, + isEditable: function() { + if(isAdmin()) { + return true; + } + else { + if (g_userPublicTemplateEnabled == "true") + return true; + else + return false; + } + }, converter:cloudStack.converters.toBooleanText }, isfeatured: {