CatalystX-CRUD-YUI
view release on metacpan or search on metacpan
lib/CatalystX/CRUD/YUI/TT/static/js/crud.js view on Meta::CPAN
// TODO reload grid, but need to wait till after all rows are removed?
grid.store.reload();
}
}
YAHOO.crud.handle_related_livegrid_click = function(args) {
if (!args.rec) {
Logger('no row passed on click');
return;
}
//Logger(args);
if (args.sm.checkBoxClicked == true) {
return;
}
else {
//var tab = YAHOO.crud.TABS[args.index];
//Logger(tab);
//Logger(args);
var uri = args.url + args.rec.id + '/' + args.action;
if (args.action == 'livegrid_edit_form') {
// if de-selecting the row, erase the form
if (!args.sm.isSelected(args.rec)) {
var formId = 'livegrid' + args.index + '-form';
YAHOO.util.Dom.get(formId).innerHTML = '';
return;
}
YAHOO.crud.livegrid_form({'index':args.index,'form':uri});
}
else {
window.location = uri;
}
}
}
YAHOO.crud.redirect_location = function(args) {
var pk_vals = [];
for(var i=0; i<args.pk_fields.length; i++) {
pk_vals[i] = args.r.get(args.pk_fields[i]);
}
var pk = pk_vals.join(';;');
var newurl = args.url + pk + '/' + args.action;
//Logger(newurl);
window.location = newurl;
}
YAHOO.crud.toggle_link = function(id_to_toggle, link_id) {
YAHOO.crud.toggle_class_hidden(id_to_toggle);
YAHOO.crud.toggle_class_hidden(link_id);
return false; // so the click is not followed on a href
}
YAHOO.crud.datetime_picker = function(id) {
YAHOO.crud.make_calendar_popup(id, true);
}
YAHOO.crud.date_picker = function(id) {
YAHOO.crud.make_calendar_popup(id);
}
YAHOO.crud.make_calendar_popup = function(id, set_time) {
var Dom = YAHOO.util.Dom;
// Create an Overlay instance to house the Calendar instance
var oCalendarMenu = new YAHOO.widget.Overlay("calendar_for_" + id, { zIndex: 99 });
/*
Create an empty body element for the Overlay instance in order
to reserve space to render the Calendar instance into.
*/
oCalendarMenu.setBody(" ");
oCalendarMenu.body.id = "calendarcontainer_" + id;
// Render the Overlay instance into the Button's parent element
oCalendarMenu.render(Dom.get(id + "_calendar_container"));
// Align the Overlay
oCalendarMenu.align();
/*
Create a Calendar instance and render it into the body
element of the Overlay.
*/
var oCalendar = new YAHOO.widget.Calendar(
"buttoncalendar_" + id,
oCalendarMenu.body.id,
{
close: true
});
oCalendar.render();
/*
we have a close button but we want to hide the Overlay,
not the calendar
*/
oCalendar.beforeHideEvent.subscribe(function() {
oCalendarMenu.hide();
return false; // prevent calendar from being hidden
});
/*
Subscribe to the Calendar instance's "changePage" event to
keep the Overlay visible when either the previous or next page
controls are clicked.
*/
oCalendar.changePageEvent.subscribe(function () {
window.setTimeout(function () {
oCalendarMenu.show();
}, 0);
});
/*
Subscribe to the Calendar instance's "select" event to
update the form field when the user
selects a date.
*/
( run in 2.116 seconds using v1.01-cache-2.11-cpan-364913b4093 )