datatracker/static/js/agenda/agenda_property_utils.js
Henrik Levkowetz a3c8adfdf6 Merged in the contents of commit [6337] from mcr@sandelman.ca, with some changes to take out dead code that inadvertently came back in.
- Legacy-Id: 6344
Note: SVN reference [6337] has been migrated to Git commit d0d1d949a9328da6c4e30d8f5e0d14ffb204e678
2013-10-02 21:53:28 +00:00

102 lines
2.5 KiB
JavaScript

/*
* agenda_property_utils.js
*
* Copyright (c) 2013, The IETF Trust. See ../../../LICENSE.
*
* www.credil.org: Project Orlando 2013
* Author: Justin Hornosty ( justin@credil.org )
* Michael Richardson <mcr@sandelman.ca>
*
* Some functions for toggling, saving and deleting agenda properties.
*
*/
//////////////-GLOBALS----////////////////////////////////////////
/////////////-END-GLOBALS-///////////////////////////////////////
function delete_agenda(event) {
var agenda_url = $(event.target).closest('tr').attr('href');
event.preventDefault();
$("#agenda_delete_dialog").dialog({
buttons : {
"Confirm" : function() {
$.ajax({
url: agenda_url,
type: 'DELETE',
success: function(result) {
window.location.reload(true);
}
});
$(this).dialog("close");
},
"Cancel" : function() {
$(this).dialog("close");
}
}
});
$("#room_delete_dialog").dialog("open");
}
function toggle_public(event) {
var span_to_replace = event.target;
var current_value = $(event.target).html();
var agenda_url = $(event.target).closest('tr').attr('href');
var new_value = 1;
log("value "+current_value)
if(current_value == "public") {
new_value = 0
}
event.preventDefault();
$.ajax({ "url": agenda_url,
"type": "PUT",
"data": { "public" : new_value },
"dataType": "json",
"success": function(result) {
/* result is a json object */
value = result["public"]
log("new value "+value)
$(span_to_replace).html(value)
}});
}
function toggle_visible(event) {
var span_to_replace = event.target;
var current_value = $(event.target).html();
var agenda_url = $(event.target).closest('tr').attr('href');
var new_value = 1;
log("value "+current_value)
if(current_value == "visible") {
new_value = 0
}
event.preventDefault();
$.ajax({ "url": agenda_url,
"type": "PUT",
"data": { "visible" : new_value },
"dataType": "json",
"success": function(result) {
/* result is a json object */
value = result["visible"]
log("new value "+value)
$(span_to_replace).html(value)
}});
}
/*
* Local Variables:
* c-basic-offset:4
* End:
*/