// Ext.BLANK_IMAGE_URL = '../images/default/s.gif'; /** This is the loaded code when viewing the plugin from the client perspective **/ // // globals used by preplanningform.js.php // var preplanform; // globals needed by obitgrid.js.php var panel; function openWindow1(url, rheight, rwidth, rname) { if(typeof(rheight) != "undefined") var height = rheight; else var height = 600; if(typeof(rwidth) != "undefined") var width = rwidth; else var width = 800; if(typeof(rname) != "undefined") var name = rname; else name = 'sub_window1'; window.open(url, name, 'toolbar=no,location=yes,directories=no,status=no,menubar=yes,scrollbars=yes,resizable=no,copyhistory=no,width='+width+',height='+height); } var obitview; var fw_search; // called by submit button on search form and on init of search module var funeralworks_obituary_plugin_search = function(){ var searchform = Ext.getCmp('funeralworks_obituary_search_form'); if(searchform.getForm().findField('searchterm')){ obitview.setBaseParams(searchform.getForm().findField('searchterm').getValue()); searchform.getForm().findField('searchterm').setValue(''); } obitview.load(); } // // function to load and eval external files into the // current scope - calls afterfn when all modules have // been loaded. // // global variable of the same name as the script.fn // required at this level so that each module has scope access. // constructor in loaded module must be script.fn + "_m" // // fwStatusWin must already exist on entry. and be closed // in the afterfn callback /* args: scripts - array of loader objects of the form { file: 'srcname', fn: 'constructor callback', text: 'status info msg', status: .1 }, i - current index, always 0 on initial call, src - source file directory location, afterfn - function to call when complete */ function system_loader(scripts, i, src, afterfn, dest){ if(typeof afterfn == 'undefined'){ alert("Impropper use of system_loader. Args required."); } if(typeof i == "undefined") i = 0; // url path below should be adjusted to suit the application Ext.Ajax.request({ url: '/js/' + scripts[i].file, method: 'POST', success: function(resp){ fwStatusWin.updateProgress(scripts[i].status, scripts[i].text); var t = resp.responseText; eval(resp.responseText); if(typeof scripts[i].fn == "string") { // the following line should be modified to suit the application if(dest == "preplanform") { if(i > 0){ eval(dest + ".add(new " + scripts[i].fn + "_m());"); } else { eval(scripts[i].fn + " = new " + scripts[i].fn + "_m();"); } } else { eval(scripts[i].fn + " = new " + scripts[i].fn + "_m();"); } } if(++i < scripts.length){ // recursive call to get all files system_loader(scripts, i, src, afterfn, dest); } else { eval(afterfn + "();"); } }, failure: function(resp){ Ext.MessageBox.alert("Communication Error", "Unable to communicate with remote server."); }, scope: this }); } function loadPanel(){ var ow = Ext.get('obitswrapper'); var op = Ext.get('preplanningwrapper'); var cl = Ext.get('currentobitslist'); if(op) { var id = 'preplan'; var div = op; var items = [preplanform]; var bbar = ''; } if(ow) { var id = 'obits'; var div = ow; var items = [fw_search, obitview]; var bbar = new Ext.PagingToolbar({ id: 'obitpager', autoEl: {tag: 'div', cls: 'obitpager'}, style: 'background: transparent; border-top: 1px solid black;', store: obitview.getStore(), displayInfo: true, totalProperty: 'count', pageSize: 10, displayMsg: 'Displaying items {0} - {1} of {2}' }); } else if(cl) { var id = 'obitschedule'; var div = cl var items = [obitschedules]; var bbar = ''; } // turn on spinner window for AJAX activities from here out Ext.Ajax.request({ url: '/session_start.php', params: {lid: "", lpw: "", type: 'long'}, success: function(resp){ var j = Ext.decode(resp.responseText); if(j.success){ panel = new Ext.Panel({ id: id, border: false, autoHeight: true, renderTo: div, items: items, bbar: bbar }); fwStatusWin.hide(); if(ow) { funeralworks_obituary_plugin_search(); } } }, failure: function(resp){ Ext.MessageBox.alert('Communcations failure', 'Unable to load initial values from server.'); } }, this); } function system_init() { fwStatusWin.updateProgress(.1, "Preparing preplannig form"); } Ext.onReady( function() { Ext.QuickTips.init(); var ow = Ext.get('obitswrapper'); var op = Ext.get('preplanningwrapper'); var cl = Ext.get('currentobitslist'); var srcdir = '/js/'; if( ow || op || cl){ // only exists if in page view with hot tag embedded if(op){ fwStatusWin = Ext.MessageBox.progress('Funeralworks', "Loading components. Standby."); var scripts = [ {file: 'preplanning.js.php', fn: 'preplanform', text: 'Preparing panel. Stand by.', status: .05}, {file: 'filerinfo.js.php', fn: 'ppaboutfiler', text: 'Loading form filer profile', status: .1}, {file: 'ppplanset.js.php', fn: 'ppplanset', text: 'Loading individual\' profile', status: .2}, {file: 'ppfatherset.js.php', fn: 'ppfatherset', text: 'Loading father\' module', status: .25}, {file: 'ppmotherset.js.php', fn: 'ppmotherset', text: 'Loading mother\'s module', status: .3}, {file: 'ppliveset.js.php', fn: 'ppliveset', text: 'Loading residency module', status: .35}, {file: 'ppmaritalset.js.php', fn: 'ppmaritalset', text: 'Loading marriage module', status: .4}, {file: 'ppemploymentset.js.php', fn: 'ppemploymentset', text: 'Loading employment module', status: .5}, {file: 'ppeduset.js.php', fn: 'ppeduset', text: 'Loading education module', status: .55}, {file: 'ppmilset.js.php', fn: 'ppmilset', text: 'Loading military module', status: .6}, {file: 'ppsurvivorsset.js.php', fn: 'ppsurvivorsset', text: 'Loading survivors module', status: .68}, {file: 'ppclubsset.js.php',fn: 'ppclubsset', text: 'Loading clubs module', status: .75}, {file: 'pphobbiesset.js.php', fn: 'pphobbiesset', text: 'Loading hobbies module', status: .8}, {file: 'ppinfoset.js.php', fn: 'ppinfoset', text: 'Loading funeralservice module', status: .82}, {file: 'ppdispositionset.js.php', fn: 'ppdispositionset', text: 'Loading final disposition module', status: .85}, {file: 'ppexecset.js.php', fn: 'ppexecset', text: 'Loading executor module', status: .9}/* , {file: 'ppwhat.js.php', fn: 'ppwhat', text: 'Preparing form for display', status: .97}*/ ]; var dest = "preplanform"; } if(ow) { fwStatusWin = Ext.MessageBox.progress('Funeralworks', "Loading components. Standby."); var scripts = [ {file: 'fw_search.js.php', fn: 'fw_search', text: 'Loading search form.', status: .1}, {file: 'obitpager.js.php', fn: 'obitview', text: 'Loading paging toolbar', status: .5} ]; var dest = ""; } else if(cl) { fwStatusWin = Ext.MessageBox.progress('Funeralworks', "Loading current obituary schedules."); var scripts = [ {file: 'fw_obitschedule.js.php', fn: 'obitschedules', text: 'Retrieving schedules.', status: .5} ]; var dest = "currentobitslist"; } system_loader(scripts, 0, srcdir, 'loadPanel', dest); } });