function deleteHours(hoursId){
new Popup.confirm ({
url: "/~mitoc/wall/common/entry/delete.htmx.php",
data: { 'hours_id': hoursId },
title: 'delete?',
confirmText: "delete",
confirmClass: "popup-confirm",
// cancelText: "cancel",
onLoadComplete: function(){
// for ie
$$('.message').each(function(element){
if (element.get('html') == ""){
element.setStyle('height', 0);
}
});
var editLink = this.content.getElement(".edit");
if (editLink != null){ editLink.setStyles({'display': 'block', 'right': '0px'}); }
// assign action to entry names to show profile
var name = this.content.getElement('.name');
if (name.getProperty("staff_id") != null){
name.addEvent('click', function(e){
new Popup({
url: "/~mitoc/wall/common/entry/profile.htmx.php?staff_id="+name.getProperty("staff_id"),
title: ""+name.get('html')+""
}).show();
});
}
},
onConfirm: function(){
//update db
new Request.JSON({
url: "/~mitoc/wall/db/delete_hours.php",
method: 'get',
data: {
"hours_id": hoursId
},
onComplete: function(response){
if (response.error == undefined){
window.location.reload();
}
}
}).send();
$('popup-loading').setStyle('visibility', 'visible');
// var deletingIcon = new Element("img", {
// 'src': '/~mitoc/wall/img/ajax-loader.gif',
// 'class': 'deleting icon photo-delete'
// });
//
// deletingIcon.replaces(thumb.getElement(".icon.photo-delete").getParent()); // this is the that surrounds the delete icon
}
}).show();
}
function editHours(hoursId, hoursName){
// if you're an admin editing someone else's hours...
var name = (hoursName != null) ? hoursName : Cookie.read('staff_name');
document.insertHoursPopup = new Popup.confirm({
url: "/~mitoc/wall/upcoming/insert_hours.htmx.php",
jsDomReady: "/~mitoc/wall/upcoming/insert_hours.js.php?edit=true&hours_id="+ hoursId,
title: "edit hours for "+ hoursName + "",
data: { 'edit': true, 'hours_id': hoursId},
width: "500px",
autosize: false,
confirmText: 'edit hours',
confirmClass: "popup-confirm",
onConfirm: function(){
$("insert_hours_form").fireEvent('submit');
}
});
document.insertHoursPopup.show();
}