Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- function dialogHandler() {
- this.dialogOptions = {
- autoOpen: false,
- height: 300,
- width: 400,
- modal: true
- };
- this.load = {}; //empty object for functions
- }
- dialogHandler.prototype.prepareDialog = function( divId, buttonType, userDialogOptions) {
- var dialogOptions = jQuery.extend(this.dialogOptions, userDialogOptions);
- $('#'+divId).dialog( dialogOptions );
- this.assignButtonType( divId, buttonType );
- this.assignLoadFunction( divId );
- };
- dialogHandler.prototype.assignButtonType = function( divId, buttonType ) {
- switch(buttonType) {
- case 'cancel':
- $('#'+divId).dialog( "option", "buttons", {
- 'zamknij': function() {
- $(this).dialog("close");
- }
- });
- break;
- case 'next':
- $('#'+divId).dialog( "option", "buttons", {
- 'dalej': function() {
- //$('#form_'+divId).submit();
- $(this).dialog("close");
- },
- 'anuluj': function() {
- $(this).dialog("close");
- }
- });
- break;
- case 'form':
- $('#'+divId).dialog( "option", "buttons", {
- 'zapisz': function() {
- $('#form_'+divId).submit();
- $(this).dialog("close");
- },
- 'anuluj': function() {
- $(this).dialog("close");
- }
- });
- break;
- default:
- $('#'+divId).dialog( "option", "buttons", {
- 'zamknij': function() {
- $(this).dialog("close");
- }
- });
- }
- };
- dialogHandler.prototype.assignLoadFunction = function( divId ) {
- this.load[divId] = function( data ) {
- //$('#'+divId).html( Math.random() ).dialog('open');
- $('#'+divId).load('dialog.php?sub='+divId, data).dialog('open');
- };
- };
- /*
- * dialog handle and alias
- */
- window.dlgHandler = new dialogHandler();
- window.dhl = {};
- window.dhl = window.dlgHandler.load;
Add Comment
Please, Sign In to add comment