From: Mark W. <ma...@rw...> - 2011-04-14 23:32:41
|
Hi, I have spent quite some time working to remove some of the global variables that of course no longer work. Whilst working through this process it has meant I have been tidying up various pieces of code and in some cases rewriting sections to ensure that things work properly rather than magically. Part of this process is to remove include files that are not classes. For instance in stopwatch: Before: //$stopwatch = 1; //$fromPopup = "true"; //include(dirname(__FILE__)."/../include/tsx/clockOnOff_core_new.inc"); After: require("include/tsx/clocking.class.php"); $clock = new Clocking(); $clock->createClockOnOff(null,true,false,true); by doing this the variables can be traced through and if a variable isn't passed into a function it will cause an error whereas it was hit and miss before. This is still an on going process. I have created classes for the stopwatch clock and also navcal. Please be aware that I still haven't finished making the stopwatch work. All the stopwatches and navcals have show hide functionality built in to tidy up the pages. I realise that some of the work that is done here is stuff that is being slowly modified / replaced but it really was necessary in my aim to clean up the codebase! Scott: I noticed that you changed a line in client_proj_task_javascript.php that caused the stopwatch js to stop working: <script type="text/javascript" src="<?php echo Config::getRelativeRoot();?>/js/client_proj_task_javascript.js"></script> to include(...client_proj_task_javascript.js...) The note you left in the code about variables that could not be accessed outside of a js script is as far as i'm aware incorrect. A variable in the global namespace in javascript, be it assigned inline on a html page or outside of a function in a js file, are all accessible from anywhere. I think the exact reason why the code didn't work was a missing quotation mark in the <script> line above. Please can you confirm that the drop down boxes in stopwatch now function again on your setup? When I rewrote the js code for stopwatch several months ago, my aim was to remove all php code from the javascript files and getting all the large js chunks into an external file rather than cluttering up the head of each html page. This is why I created the client_proj_task_javascript.class.php file so that this could be achieved. Regards Mark -- _____________________________________________ Mob: 07725 695178 Email: ma...@rw... |