1 (edited by apmuthu 03/23/2013 09:46:26 am)

Topic: Dashboard Theme / Module hooks issue

Managed to make the dashboard module/theme work as it should by hardcoding the inclusion of jquery-1.3.2.js file and investigated it's cause.

  • modules/dashboard/hooks.php declares function install_tabs().

  • Function install_tabs() lists the js files to be included (array $js_userlib) by using the function add_js_ufile().

  • Function add_js_ufile() (uses full URI / local path and filename) is defined in includes/main.inc along with another function add_js_file().

  • Only the function add_js_file() (uses only filename) does a file exists check in the fixed webroot's js location as well, using the file include list in array $js_static.

  • Both add js functions make sure that each file/URI is included only once from their respective arrays.

  • The file includes/page/header.inc declares the function send_scripts() which includes the files in the $js_static array (from company/#/js_cache/*.js or js/*.js) first and then includes the files from the $js_userlib array with no checks (neither existence nor once only inclusion)

  • The renderer class is instantiated in both the page_header() and page_footer() functions with the same name $rend.

Another function add_js_source() is also defined in includes/main.inc where the js to be included is in $text variable sent as an argument but is used in the function page_footer() defined in includes/page/footer.inc and is not used here.

The way out here would be to include the jquery scripts int the main webrootjsfolder itself and switch theadd_js_ufile()function to theadd_js_file()function for the said files in the themodules/dashboard/hooks.phpfile. The main menu click determines the $path_to_root as "./" but the submenu click sees it as "../../" though the global one is "../" for it, which confounds the js inclusion function.

It is possible that many extensions will use the jquery function and this will avoid duplicate files - versions of the jquery will however have to be taken into account for the specific extension concerned.

Post's attachments

FA-dashboard-r4.zip 139.9 kb, 12 downloads since 2013-03-23 

You don't have the permssions to download the attachments of this post.

2 (edited by apmuthu 03/23/2013 09:41:40 am)

Re: Dashboard Theme / Module hooks issue

Since the $path_to_root variable is hardcoded as "../../" in the dashboard setup and other php scripts in the modules/dashboard folder, it is necessary to see that the correct path is used to make sure that the install_tabs() in the hooks.php file works correctly for submenu clicks. This is ensured by patching the includes/page/header.inc till a proper alternate solution is found.

Also the FA-dashboard-r4/modules/dashboard/sql/update.sql file can have the AUTO_INCREMENT=6 phrase removed in both table creation statements.
Those who have already installed the dashboard can reset the AUTO_INCREMENT counter with:

ALTER TABLE `0_dashboard_reminders` AUTO_INCREMENT=1;

The id nos 4,5 and 8 are missing in the widgets table data.

Also the readme can list some means to populate the dashboard_setup.php and reminder_setup.php script links as a widget in the setup panel besides mentioning that the module must first be installed before the theme is installed and used.

The installed_extensions.php file in the company/# folder gets populated with "active=>false," instead of "active=>1," for the dashboard_theme v2.3.15-1 entry.

Post's attachments

Dashboard-FA-Patches.zip 4.3 kb, 9 downloads since 2013-03-23 

You don't have the permssions to download the attachments of this post.

Re: Dashboard Theme / Module hooks issue

Thanks Janusz. Dashboard r5 along with HG 3207-3210 sets right the issue natively without resort to the patches in this thread since the js inclusion has been moved back to the theme's renderer.php back again from the module's hooks.php.

Post's attachments

FA-dashboard-r5.zip 136.5 kb, 22 downloads since 2013-03-23 

You don't have the permssions to download the attachments of this post.

Re: Dashboard Theme / Module hooks issue

The fixed dashboard module is available directly in FA extensions repo. No need to download and install the attached zip, unless you have no access to internet (but how you will download the zip in this case smile).
Janusz