mirror of
https://github.com/OpenNebula/one.git
synced 2024-12-22 13:33:52 +03:00
Merge branch 'feature-687' of git.opennebula.org:one into feature-687
This commit is contained in:
commit
01606d1768
@ -39,6 +39,8 @@ module OpenNebulaJSON
|
||||
rc = case action_hash['perform']
|
||||
when "passwd" then self.passwd(action_hash['params'])
|
||||
when "chgrp" then self.chgrp(action_hash['params'])
|
||||
when "addgroup" then self.addgroup(action_hash['params'])
|
||||
when "delgroup" then self.delgroup(action_hash['params'])
|
||||
else
|
||||
error_msg = "#{action_hash['perform']} action not " <<
|
||||
" available for this resource"
|
||||
@ -52,7 +54,16 @@ module OpenNebulaJSON
|
||||
end
|
||||
|
||||
def chgrp(params=Hash.new)
|
||||
super(params['group_id'])
|
||||
super(params['group_id'].to_i)
|
||||
end
|
||||
|
||||
def addgroup(params=Hash.new)
|
||||
super(params['group_id'].to_i)
|
||||
end
|
||||
|
||||
def delgroup(params=Hash.new)
|
||||
super(params['group_id'].to_i)
|
||||
end
|
||||
|
||||
end
|
||||
end
|
||||
|
@ -151,7 +151,7 @@ var OpenNebula = {
|
||||
{
|
||||
return Error('Incorrect Pool');
|
||||
}
|
||||
|
||||
|
||||
var p_pool = [];
|
||||
|
||||
if (response[pool_name]) {
|
||||
@ -227,7 +227,7 @@ var OpenNebula = {
|
||||
var password = params.data.password;
|
||||
var remember = params.remember;
|
||||
|
||||
var resource = OpenNebula.Auth.resource;
|
||||
var resource = OpenNebula.Auth.resource;
|
||||
var request = OpenNebula.Helper.request(resource,"login");
|
||||
|
||||
$.ajax({
|
||||
@ -709,7 +709,7 @@ var OpenNebula = {
|
||||
var callback_error = params.error;
|
||||
var timeout = params.timeout || false;
|
||||
var resource = OpenNebula.Network.resource;
|
||||
|
||||
|
||||
var request = OpenNebula.Helper.request(resource,"list");
|
||||
|
||||
$.ajax({
|
||||
@ -1257,7 +1257,7 @@ var OpenNebula = {
|
||||
var callback_error = params.error;
|
||||
var id = params.data.id;
|
||||
var resource = OpenNebula.VM.resource;
|
||||
|
||||
|
||||
var method = "suspend";
|
||||
var action = OpenNebula.Helper.action(method);
|
||||
var request = OpenNebula.Helper.request(resource,method, id);
|
||||
@ -1331,7 +1331,7 @@ var OpenNebula = {
|
||||
"type" : type
|
||||
}
|
||||
var resource = OpenNebula.VM.resource;
|
||||
|
||||
|
||||
var action = OpenNebula.Helper.action(method,saveas_params)
|
||||
var request = OpenNebula.Helper.request(resource,method, [id,disk_id, image_name, type]);
|
||||
|
||||
@ -1387,7 +1387,7 @@ var OpenNebula = {
|
||||
}
|
||||
});
|
||||
},
|
||||
|
||||
|
||||
"resubmit": function(params)
|
||||
{
|
||||
var callback = params.success;
|
||||
@ -1419,7 +1419,7 @@ var OpenNebula = {
|
||||
}
|
||||
});
|
||||
},
|
||||
|
||||
|
||||
"startvnc" : function(params){
|
||||
var callback = params.success;
|
||||
var callback_error = params.error;
|
||||
@ -1449,7 +1449,7 @@ var OpenNebula = {
|
||||
}
|
||||
});
|
||||
},
|
||||
|
||||
|
||||
"stopvnc" : function(params){
|
||||
var callback = params.success;
|
||||
var callback_error = params.error;
|
||||
@ -1687,6 +1687,36 @@ var OpenNebula = {
|
||||
});
|
||||
},
|
||||
|
||||
"show" : function(params)
|
||||
{
|
||||
var callback = params.success;
|
||||
var callback_error = params.error;
|
||||
var id = params.data.id;
|
||||
|
||||
var resource = OpenNebula.User.resource;
|
||||
var request = OpenNebula.Helper.request(resource,"show", id);
|
||||
|
||||
$.ajax({
|
||||
url: "user/" + id,
|
||||
type: "GET",
|
||||
dataType: "json",
|
||||
success: function(response)
|
||||
{
|
||||
if (callback)
|
||||
{
|
||||
callback(request, response);
|
||||
}
|
||||
},
|
||||
error: function(response)
|
||||
{
|
||||
if (callback_error)
|
||||
{
|
||||
callback_error(request, OpenNebula.Error(response));
|
||||
}
|
||||
}
|
||||
});
|
||||
},
|
||||
|
||||
"delete": function(params)
|
||||
{
|
||||
var callback = params.success;
|
||||
@ -1759,7 +1789,7 @@ var OpenNebula = {
|
||||
var action = OpenNebula.Helper.action(method, {
|
||||
"password" : passwd
|
||||
});
|
||||
|
||||
|
||||
var resource = OpenNebula.User.resource;
|
||||
var request = OpenNebula.Helper.request(resource,method, passwd);
|
||||
|
||||
@ -1794,6 +1824,67 @@ var OpenNebula = {
|
||||
var action = OpenNebula.Helper.action(method, {"group_id": gid});
|
||||
var request = OpenNebula.Helper.request(OpenNebula.User.resource,method, [id, gid]);
|
||||
|
||||
$.ajax({
|
||||
url: "user/" + id + "/action",
|
||||
type: "POST",
|
||||
data: JSON.stringify(action),
|
||||
success: function()
|
||||
{
|
||||
if (callback)
|
||||
{
|
||||
callback(request);
|
||||
}
|
||||
},
|
||||
error: function(response)
|
||||
{
|
||||
if (callback_error)
|
||||
{
|
||||
callback_error(request, OpenNebula.Error(response));
|
||||
}
|
||||
}
|
||||
});
|
||||
},
|
||||
|
||||
"addgroup" : function(params){
|
||||
var callback = params.success;
|
||||
var callback_error = params.error;
|
||||
var id = params.data.id;
|
||||
var gid = params.data.extra_param;
|
||||
|
||||
var method = "addgroup";
|
||||
var action = OpenNebula.Helper.action(method, {"group_id": gid});
|
||||
var request = OpenNebula.Helper.request(OpenNebula.User.resource,method, [id, gid]);
|
||||
|
||||
$.ajax({
|
||||
url: "user/" + id + "/action",
|
||||
type: "POST",
|
||||
data: JSON.stringify(action),
|
||||
success: function()
|
||||
{
|
||||
if (callback)
|
||||
{
|
||||
callback(request);
|
||||
}
|
||||
},
|
||||
error: function(response)
|
||||
{
|
||||
if (callback_error)
|
||||
{
|
||||
callback_error(request, OpenNebula.Error(response));
|
||||
}
|
||||
}
|
||||
});
|
||||
},
|
||||
"delgroup" : function(params){
|
||||
var callback = params.success;
|
||||
var callback_error = params.error;
|
||||
var id = params.data.id;
|
||||
var gid = params.data.extra_param;
|
||||
|
||||
var method = "delgroup";
|
||||
var action = OpenNebula.Helper.action(method, {"group_id": gid});
|
||||
var request = OpenNebula.Helper.request(OpenNebula.User.resource,method, [id, gid]);
|
||||
|
||||
$.ajax({
|
||||
url: "user/" + id + "/action",
|
||||
type: "POST",
|
||||
@ -2012,7 +2103,7 @@ var OpenNebula = {
|
||||
|
||||
var method = "enable";
|
||||
var action = OpenNebula.Helper.action(method);
|
||||
|
||||
|
||||
var resource = OpenNebula.Image.resource;
|
||||
var request = OpenNebula.Helper.request(resource,method, id);
|
||||
|
||||
@ -2141,7 +2232,7 @@ var OpenNebula = {
|
||||
|
||||
var method = "persistent";
|
||||
var action = OpenNebula.Helper.action(method);
|
||||
|
||||
|
||||
var resource = OpenNebula.Image.resource;
|
||||
var request = OpenNebula.Helper.request(resource,method, id);
|
||||
|
||||
@ -2174,7 +2265,7 @@ var OpenNebula = {
|
||||
|
||||
var method = "nonpersistent";
|
||||
var action = OpenNebula.Helper.action(method);
|
||||
|
||||
|
||||
var resource = OpenNebula.Image.resource;
|
||||
var request = OpenNebula.Helper.request(resource,method, id);
|
||||
|
||||
@ -2207,10 +2298,10 @@ var OpenNebula = {
|
||||
OpenNebula.Helper.chgrp(params,OpenNebula.Image.resource,"image");
|
||||
}
|
||||
},
|
||||
|
||||
|
||||
"Template" : {
|
||||
"resource" : "VMTEMPLATE",
|
||||
|
||||
|
||||
"create" : function(params)
|
||||
{
|
||||
var callback = params.success;
|
||||
@ -2240,7 +2331,7 @@ var OpenNebula = {
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
|
||||
},
|
||||
"fetch_template" : function(params)
|
||||
{
|
||||
@ -2283,7 +2374,7 @@ var OpenNebula = {
|
||||
var method = "update";
|
||||
var action = OpenNebula.Helper.action(method, template_obj);
|
||||
|
||||
var resource = OpenNebula.Template.resource;
|
||||
var resource = OpenNebula.Template.resource;
|
||||
var request = OpenNebula.Helper.request(resource,method, [id, template_obj]);
|
||||
|
||||
$.ajax({
|
||||
@ -2427,7 +2518,7 @@ var OpenNebula = {
|
||||
callback_error(request, OpenNebula.Error(response));
|
||||
}
|
||||
}
|
||||
});
|
||||
});
|
||||
},
|
||||
"delete" : function(params)
|
||||
{
|
||||
@ -2455,7 +2546,7 @@ var OpenNebula = {
|
||||
callback_error(request, OpenNebula.Error(response));
|
||||
}
|
||||
}
|
||||
});
|
||||
});
|
||||
},
|
||||
|
||||
"chown" : function(params){
|
||||
|
@ -14,7 +14,7 @@
|
||||
/* limitations under the License. */
|
||||
/* -------------------------------------------------------------------------- */
|
||||
|
||||
var group_select="";
|
||||
var groups_select="";
|
||||
var group_list_json = {};
|
||||
var dataTable_groups;
|
||||
|
||||
@ -28,8 +28,8 @@ var groups_tab_content =
|
||||
<tr>\
|
||||
<th class="check"><input type="checkbox" class="check_all" value="">All</input></th>\
|
||||
<th>ID</th>\
|
||||
<th>Owner</th>\
|
||||
<th>Name</th>\
|
||||
<th>Users</th>\
|
||||
</tr>\
|
||||
</thead>\
|
||||
<tbody id="tbodygroups">\
|
||||
@ -157,11 +157,23 @@ Sunstone.addMainTab('groups_tab',groups_tab);
|
||||
|
||||
function groupElementArray(group_json){
|
||||
var group = group_json.GROUP;
|
||||
|
||||
var users_str="";
|
||||
if (group.USERS.ID &&
|
||||
group.USERS.ID.constructor == Array){
|
||||
for (var i=0; i<group.USERS.ID.length; i++){
|
||||
users_str+=getUserName(group.USERS.ID[i])+', ';
|
||||
};
|
||||
users_str=users_str.slice(0,-2);
|
||||
} else if (group.USERS.ID) {
|
||||
users_str=getUserName(group.USERS.ID);
|
||||
};
|
||||
|
||||
return [
|
||||
'<input type="checkbox" id="group_'+group.ID+'" name="selected_items" value="'+group.ID+'"/>',
|
||||
group.ID,
|
||||
getUserName(group.UID),
|
||||
group.NAME ];
|
||||
group.NAME,
|
||||
users_str ];
|
||||
}
|
||||
|
||||
function groupInfoListener(){
|
||||
@ -176,7 +188,7 @@ function groupInfoListener(){
|
||||
}
|
||||
|
||||
function updateGroupSelect(){
|
||||
groups_select = makeSelectOptions(dataTable_groups,1,3,-1,"",-1);
|
||||
groups_select = makeSelectOptions(dataTable_groups,1,2,-1,"",-1);
|
||||
}
|
||||
|
||||
function updateGroupElement(request, group_json){
|
||||
|
@ -222,7 +222,7 @@ var host_actions = {
|
||||
"Host.update_dialog" : {
|
||||
type: "custom",
|
||||
call: function() {
|
||||
popUpTemplateUpdateDialog("Host",hosts_select);
|
||||
popUpTemplateUpdateDialog("Host",hosts_select,getSelectedNodes(dataTable_hosts));
|
||||
}
|
||||
},
|
||||
|
||||
|
@ -223,7 +223,7 @@ var image_actions = {
|
||||
"Image.update_dialog" : {
|
||||
type: "custom",
|
||||
call: function() {
|
||||
popUpTemplateUpdateDialog("Image",images_select);
|
||||
popUpTemplateUpdateDialog("Image",images_select,getSelectedNodes(dataTable_images));
|
||||
}
|
||||
},
|
||||
|
||||
@ -442,8 +442,8 @@ function imageElementArray(image_json){
|
||||
return [
|
||||
'<input type="checkbox" id="image_'+image.ID+'" name="selected_items" value="'+image.ID+'"/>',
|
||||
image.ID,
|
||||
getUserName(image.UID),
|
||||
getGroupName(image.GID),
|
||||
image.UNAME,
|
||||
image.GNAME,
|
||||
image.NAME,
|
||||
OpenNebula.Helper.image_type(image.TYPE),
|
||||
pretty_time(image.REGTIME),
|
||||
@ -530,6 +530,14 @@ function updateImageInfo(request,img){
|
||||
<td class="key_td">Name</td>\
|
||||
<td class="value_td">'+img_info.NAME+'</td>\
|
||||
</tr>\
|
||||
<tr>\
|
||||
<td class="key_td">Owner</td>\
|
||||
<td class="value_td">'+img_info.UNAME+'</td>\
|
||||
</tr>\
|
||||
<tr>\
|
||||
<td class="key_td">Group</td>\
|
||||
<td class="value_td">'+img_info.GNAME+'</td>\
|
||||
</tr>\
|
||||
<tr>\
|
||||
<td class="key_td">Type</td>\
|
||||
<td class="value_td">'+OpenNebula.Helper.image_type(img_info.TYPE)+'</td>\
|
||||
|
@ -591,7 +591,7 @@ var template_actions = {
|
||||
"Template.update_dialog" : {
|
||||
type: "custom",
|
||||
call: function() {
|
||||
popUpTemplateUpdateDialog("Template",templates_select);
|
||||
popUpTemplateUpdateDialog("Template",templates_select,getSelectedNodes(dataTable_templates));
|
||||
}
|
||||
},
|
||||
|
||||
@ -768,8 +768,8 @@ function templateElementArray(template_json){
|
||||
return [
|
||||
'<input type="checkbox" id="template_'+template.ID+'" name="selected_items" value="'+template.ID+'"/>',
|
||||
template.ID,
|
||||
getUserName(template.UID),
|
||||
getGroupName(template.GID),
|
||||
template.UNAME,
|
||||
template.GNAME,
|
||||
template.NAME,
|
||||
pretty_time(template.REGTIME),
|
||||
parseInt(template.PUBLIC) ? "yes" : "no"
|
||||
@ -852,6 +852,14 @@ function updateTemplateInfo(request,template){
|
||||
<td class="key_td">Name</td>\
|
||||
<td class="value_td">'+template_info.NAME+'</td>\
|
||||
</tr>\
|
||||
<tr>\
|
||||
<td class="key_td">Owner</td>\
|
||||
<td class="value_td">'+template_info.UNAME+'</td>\
|
||||
</tr>\
|
||||
<tr>\
|
||||
<td class="key_td">Group</td>\
|
||||
<td class="value_td">'+template_info.GNAME+'</td>\
|
||||
</tr>\
|
||||
<tr>\
|
||||
<td class="key_td">Register time</td>\
|
||||
<td class="value_td">'+pretty_time(template_info.REGTIME)+'</td>\
|
||||
|
@ -97,6 +97,46 @@ var user_actions = {
|
||||
notify: false
|
||||
},
|
||||
|
||||
"User.chgrp" : {
|
||||
type: "multiple",
|
||||
call: OpenNebula.User.chgrp,
|
||||
callback : function(req){
|
||||
Sunstone.runAction("User.show",req.request.data[0]);
|
||||
},
|
||||
elements : function() {return getSelectedNodes(dataTable_users);},
|
||||
error: onError,
|
||||
notify: true
|
||||
},
|
||||
|
||||
"User.addgroup" : {
|
||||
type: "multiple",
|
||||
call: OpenNebula.User.addgroup,
|
||||
callback : function(req){
|
||||
Sunstone.runAction("User.show",req.request.data[0]);
|
||||
},
|
||||
elements : function() {return getSelectedNodes(dataTable_users);},
|
||||
error: onError,
|
||||
notify: true
|
||||
},
|
||||
|
||||
"User.delgroup" : {
|
||||
type: "multiple",
|
||||
call: OpenNebula.User.delgroup,
|
||||
callback : function(req){
|
||||
Sunstone.runAction("User.show",req.request.data[0]);
|
||||
},
|
||||
elements : function() {return getSelectedNodes(dataTable_users);},
|
||||
error: onError,
|
||||
notify: true
|
||||
},
|
||||
|
||||
"User.show" : {
|
||||
type: "single",
|
||||
call: OpenNebula.User.show,
|
||||
callback: updateUserElement,
|
||||
error: onError
|
||||
},
|
||||
|
||||
"User.delete" : {
|
||||
type: "multiple",
|
||||
call: OpenNebula.User.delete,
|
||||
@ -119,6 +159,27 @@ var user_buttons = {
|
||||
text: "+ New",
|
||||
condition: True
|
||||
},
|
||||
"User.chgrp" : {
|
||||
type: "confirm_with_select",
|
||||
text: "Change main group",
|
||||
select: function(){ return groups_select; },
|
||||
tip: "This will change the main group of the selected users. Select the new group:",
|
||||
condition: True
|
||||
},
|
||||
"User.addgroup" : {
|
||||
type: "confirm_with_select",
|
||||
text: "Add to group",
|
||||
select: function(){ return groups_select; },
|
||||
tip: "Select the new group to add users:",
|
||||
condition: True
|
||||
},
|
||||
"User.delgroup" : {
|
||||
type: "confirm_with_select",
|
||||
text: "Delete from group",
|
||||
select: function(){ return groups_select; },
|
||||
tip: "Select the group from which to delete users:",
|
||||
condition: True
|
||||
},
|
||||
"User.delete" : {
|
||||
type: "action",
|
||||
text: "Delete",
|
||||
@ -146,30 +207,38 @@ function userElementArray(user_json){
|
||||
name = user.NAME;
|
||||
}
|
||||
|
||||
var i = 1;
|
||||
var groups_str=getGroupName(user.GID)+", ";
|
||||
var groups_full_str=getGroupName(user.GID)+", ";
|
||||
var group_field;
|
||||
var groups_str="";
|
||||
if (user.GROUPS.ID.constructor == Array){ //several groups
|
||||
for (var i=0; i< user.GROUPS.ID.length; i++){
|
||||
groups_str+=getGroupName(user.GROUPS.ID[i])+', ';
|
||||
};
|
||||
groups_str = groups_str.slice(0,-2);
|
||||
} else { //one group
|
||||
groups_str = getGroupName(user.GROUPS.ID);
|
||||
};
|
||||
|
||||
if (user.GROUPS.ID){
|
||||
$.each(user.GROUPS.ID,function() {
|
||||
if (i<=5) {
|
||||
groups_str+=getGroupName(this)+", ";
|
||||
};
|
||||
groups_full_str+=getGroupName(this)+", ";
|
||||
i++;
|
||||
});
|
||||
if (i>0){
|
||||
groups_str = groups_str.slice(0, -2);
|
||||
groups_full_str = groups_str.slice(0, -2);
|
||||
};
|
||||
if (i>5){
|
||||
groups_str+="...";
|
||||
group_field = '<div class="shortened_info">'+groups_str+'</div><div class="full_info" style="display:none">'+groups_full_str+'</div>';
|
||||
} else {
|
||||
group_field=groups_str;
|
||||
};
|
||||
}
|
||||
// var groups_full_str=getGroupName(user.GID)+", ";
|
||||
// var group_field;
|
||||
|
||||
// if (user.GROUPS.ID){
|
||||
// $.each(user.GROUPS.ID,function() {
|
||||
// if (i<=5) {
|
||||
// groups_str+=getGroupName(this)+", ";
|
||||
// };
|
||||
// groups_full_str+=getGroupName(this)+", ";
|
||||
// i++;
|
||||
// });
|
||||
// if (i>0){
|
||||
// groups_str = groups_str.slice(0, -2);
|
||||
// groups_full_str = groups_str.slice(0, -2);
|
||||
// };
|
||||
// if (i>5){
|
||||
// groups_str+="...";
|
||||
// group_field = '<div class="shortened_info">'+groups_str+'</div><div class="full_info" style="display:none">'+groups_full_str+'</div>';
|
||||
// } else {
|
||||
// group_field=groups_str;
|
||||
// };
|
||||
// }
|
||||
|
||||
|
||||
|
||||
@ -177,7 +246,7 @@ function userElementArray(user_json){
|
||||
'<input type="checkbox" id="user_'+user.ID+'" name="selected_items" value="'+user.ID+'"/>',
|
||||
user.ID,
|
||||
name,
|
||||
group_field
|
||||
groups_str
|
||||
]
|
||||
}
|
||||
|
||||
|
@ -580,8 +580,8 @@ function vMachineElementArray(vm_json){
|
||||
return [
|
||||
'<input type="checkbox" id="vm_'+vm.ID+'" name="selected_items" value="'+vm.ID+'"/>',
|
||||
vm.ID,
|
||||
getUserName(vm.UID),
|
||||
getGroupName(vm.GID),
|
||||
vm.UNAME,
|
||||
vm.GNAME,
|
||||
vm.NAME,
|
||||
state,
|
||||
vm.CPU,
|
||||
@ -659,6 +659,14 @@ function updateVMInfo(request,vm){
|
||||
<td class="key_td">Name</td>\
|
||||
<td class="value_td">'+vm_info.NAME+'</td>\
|
||||
</tr>\
|
||||
<tr>\
|
||||
<td class="key_td">Owner</td>\
|
||||
<td class="value_td">'+vm_info.UNAME+'</td>\
|
||||
</tr>\
|
||||
<tr>\
|
||||
<td class="key_td">Group</td>\
|
||||
<td class="value_td">'+vm_info.GNAME+'</td>\
|
||||
</tr>\
|
||||
<tr>\
|
||||
<td class="key_td">State</td>\
|
||||
<td class="value_td">'+OpenNebula.Helper.resource_state("vm",vm_info.STATE)+'</td>\
|
||||
|
@ -318,8 +318,8 @@ function vNetworkElementArray(vn_json){
|
||||
return [
|
||||
'<input type="checkbox" id="vnetwork_'+network.ID+'" name="selected_items" value="'+network.ID+'"/>',
|
||||
network.ID,
|
||||
getUserName(network.UID),
|
||||
getGroupName(network.GID),
|
||||
network.UNAME,
|
||||
network.GNAME,
|
||||
network.NAME,
|
||||
parseInt(network.TYPE) ? "FIXED" : "RANGED",
|
||||
network.BRIDGE,
|
||||
@ -401,8 +401,12 @@ function updateVNetworkInfo(request,vn){
|
||||
<td class="value_td">'+vn_info.ID+'</td>\
|
||||
<tr>\
|
||||
<tr>\
|
||||
<td class="key_td">UID</td>\
|
||||
<td class="value_td">'+vn_info.UID+'</td>\
|
||||
<td class="key_td">Owner</td>\
|
||||
<td class="value_td">'+vn_info.UNAME+'</td>\
|
||||
</tr>\
|
||||
<tr>\
|
||||
<td class="key_td">Group</td>\
|
||||
<td class="value_td">'+vn_info.GNAME+'</td>\
|
||||
</tr>\
|
||||
<tr>\
|
||||
<td class="key_td">Public</td>\
|
||||
|
@ -375,11 +375,17 @@ function waitingNodes(dataTable){
|
||||
};
|
||||
|
||||
function getUserName(uid){
|
||||
return getName(uid,dataTable_users);
|
||||
if (typeof(dataTable_users) != "undefined"){
|
||||
return getName(uid,dataTable_users);
|
||||
}
|
||||
return uid;
|
||||
}
|
||||
|
||||
function getGroupName(gid){
|
||||
return getName(gid,dataTable_groups);
|
||||
if (typeof(dataTable_groups) != "undefined"){
|
||||
return getName(gid,dataTable_groups);
|
||||
}
|
||||
return gid;
|
||||
}
|
||||
|
||||
function getName(id,dataTable){
|
||||
@ -598,9 +604,13 @@ function setupTemplateUpdateDialog(){
|
||||
|
||||
$('#template_update_dialog #template_update_select').live("change",function(){
|
||||
var id = $(this).val();
|
||||
var resource = $('#template_update_dialog #template_update_button').val();
|
||||
$('#template_update_dialog #template_update_textarea').val("Loading...");
|
||||
Sunstone.runAction(resource+".fetch_template",id);
|
||||
if (id.length){
|
||||
var resource = $('#template_update_dialog #template_update_button').val();
|
||||
$('#template_update_dialog #template_update_textarea').val("Loading...");
|
||||
Sunstone.runAction(resource+".fetch_template",id);
|
||||
} else {
|
||||
$('#template_update_dialog #template_update_textarea').val("");
|
||||
}
|
||||
});
|
||||
|
||||
$('#template_update_dialog #template_update_button').click(function(){
|
||||
@ -613,10 +623,26 @@ function setupTemplateUpdateDialog(){
|
||||
});
|
||||
}
|
||||
|
||||
function popUpTemplateUpdateDialog(elem_str,select_items){
|
||||
function popUpTemplateUpdateDialog(elem_str,select_items,sel_elems){
|
||||
$('#template_update_dialog #template_update_button').val(elem_str);
|
||||
$('#template_update_dialog #template_update_select').html(select_items);
|
||||
$('#template_update_dialog #template_update_textarea').val("");
|
||||
|
||||
if (sel_elems.length >= 1){ //several items in the list are selected
|
||||
//grep them
|
||||
var new_select= sel_elems.length > 1? '<option value="">Please select</option>' : "";
|
||||
$('option','<select>'+select_items+'</select>').each(function(){
|
||||
if ($.inArray($(this).val(),sel_elems) >= 0){
|
||||
new_select+='<option value="'+$(this).val()+'">'+$(this).text()+'</option>';
|
||||
};
|
||||
});
|
||||
$('#template_update_dialog #template_update_select').html(new_select);
|
||||
if (sel_elems.length == 1) {
|
||||
$('#template_update_dialog #template_update_select option').attr("selected","selected");
|
||||
$('#template_update_dialog #template_update_select').trigger("change");
|
||||
}
|
||||
};
|
||||
|
||||
$('#template_update_dialog').dialog('open');
|
||||
return false;
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user