From: Mark W. <ma...@rw...> - 2011-02-11 16:19:27
|
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"> <html> <head> <meta content="text/html; charset=ISO-8859-1" http-equiv="Content-Type"> </head> <body text="#000000" bgcolor="#ffffff"> I recently came up with a nice OO way to handle exactly this but without using a db for the config tables. ( there is no reason why a db couldn't be used though.)<br> <br> If you have a config class that contains the default config of the system.<br> <br> To sumarise:<br> config.factory.class.php:<br> <br> class ConfigFactory{<br> <br> protected static itemOne = 'something';<br> <br> public static function initialise(){}<br> <br> public static getItemOne(){<br> return self::itemOne;<br> }<br> <br> ....more config params here....<br> <br> }<br> <br> config.class.php:<br> <br> class Config extends ConfigFactory{<br> <br> /**<br> * initialise the config class<br> */<br> public static function initialise(){<br> <br> if(file_exists('include/config/config.php')){<br> include('include/config/config.php');<br> }<br> <br> parent::initialise();<br> }<br> <br> <br> }<br> <br> <br> and finally in include/config/config.php the actual userdefined config:<br> <br> parent::$itemOne = "somethingelse";<br> <br> i think this would be slightly better than an ini file albeit of similar concept.<br> <br> Using this type of topology database credentials could be stored in a file and a database hook to grab other config data from the database in the config::initialise() function.<br> <br> This ensures default values are always present and then overwritten with specific config parameters for the users setup.<br> <br> so in the application code access would be as follows: Config::getItemOne();<br> <br> <br> However the final solution is done, the data from the config table should be loaded into some from of class structure. This minimises the potential for coding errors. :)<br> <br> Thoughts please? - (this is an extension to the config setup currently in my and peters branch.)<br> <br> <br> <br> Mark <pre class="moz-signature" cols="72">_____________________________________________ Mob: 07725 695178 Email: <a class="moz-txt-link-abbreviated" href="mailto:ma...@rw...">ma...@rw...</a></pre> <br> On 11/02/2011 15:56, Scott Miller wrote: <blockquote cite="mid:AANLkTi=E=zN5inS5dFbh0vM=Pzk...@ma..." type="cite">Yes, I've given some thought to default entries, as well as the potential issues when items that are supposed to exist don't.<br> <br> It could be handled by putting the defaults into an .ini type file, and we could just load the defaults from the ini file before we then over write them with info from the database, that would help ensure that missing configuration items from the database wouldn't necessarily break the application. <br> <br> I'm not convinced this is a good idea because that would mean the application would have to read configuration data from two places with every page load. And if some admin is dumb enough to delete configuration stuff out of the database, they deserve to have the app break on them :-)<br> <br> But, putting that info in an .ini file, we could then still have the "revert to default" buttons on the configuration page, and if needed, we could then load that info from the .ini file. Or we could have default entries in the database itself. I'm kinda leaning toward the ini file though.<br> <br> -Scott<br> <br> <div class="gmail_quote">On Fri, Feb 11, 2011 at 3:22 PM, David Thompson <span dir="ltr"><<a moz-do-not-send="true" href="mailto:tom...@us..." target="_blank">tom...@us...</a>></span> wrote:<br> <blockquote class="gmail_quote" style="margin: 0pt 0pt 0pt 0.8ex; border-left: 1px solid rgb(204, 204, 204); padding-left: 1ex;"> <div> Scott - I like your idea with the generic config table, but have you considered defaults?<br> Mark, Peter - I am impressed by your progress, well done, a rework like this will give the "next gen" feel that we need. And don't worry about rewriting 90% of the code, go ahead if necessary.<br> <br> I am not actively working on anything (well, related to TSNG I mean), but I keep an eye on what is going on. There are a number of branches where changes have been made that should really be completed and merged into the trunk, or merged into txsheet-2.0 and further developed there. Can anyone claim responsibility for the changes?<br> <br> Cheers<br> tommo<br> <br> <hr> Date: Fri, 11 Feb 2011 10:21:53 +1100<br> From: <a moz-do-not-send="true" href="mailto:pal...@gm..." target="_blank">pal...@gm...</a><br> To: <a moz-do-not-send="true" href="mailto:tsh...@li..." target="_blank">tsh...@li...</a><br> Subject: [Tsheetx-developers] [SPAM] Re: Who's actively working on the TSNG system? <div> <div><br> <br> Scott,<br> you asked if I have done more work on the 'management approval' area. The answer is no. I have incorporated the management approval process into branches/txsheet-2.0-demo but nothing further has been added. I have spent most of my development time on the changes made in conjunction with Mark.<br> <br> Peter<br> <br> On 11/02/11 05:00, Scott Miller wrote: <blockquote>Oh, sorry, I didn't answer what the new config stuff would look like: rather than having each configuration item have it's own column in the database, I'm making the table generic, so we can easily add whatever we want to the configuration table. So it currently looks like this:<br> <br> columns are: name | type | INT | FLOAT | TEXT<br> INT and FLOAT are their namesake types, name is varchar(35), type is an enum ('INT','FLOAT','TEXT') defaulting to text, and TEXT is of type MEDIUMTEXT (which was done to make sure there was enough space for the HTML entities, which with your work, would mean we could probably safely make that of type TEXT instead)<br> <br> An example select from the database looks like this:<br> <span style="font-family: courier new,monospace;">mysql> select * from tstrunk_new_config where name not like "HTML%";</span><br style="font-family: courier new,monospace;"> <span style="font-family: courier new,monospace;">+------------------------+------+------+-------+------------------------------+</span><br style="font-family: courier new,monospace;"> <span style="font-family: courier new,monospace;">| name | type | INT | FLOAT | TEXT |</span><br style="font-family: courier new,monospace;"> <span style="font-family: courier new,monospace;">+------------------------+------+------+-------+------------------------------+</span><br style="font-family: courier new,monospace;"> <span style="font-family: courier new,monospace;">| version | TEXT | NULL | NULL | 1.6.0 | </span><br style="font-family: courier new,monospace;"> <span style="font-family: courier new,monospace;">| locale | TEXT | NULL | NULL | | </span><br style="font-family: courier new,monospace;"> <span style="font-family: courier new,monospace;">| timezone | TEXT | NULL | NULL | US/Central | </span><br style="font-family: courier new,monospace;"> <span style="font-family: courier new,monospace;">| timeformat | INT | 12 | NULL | NULL | </span><br style="font-family: courier new,monospace;"> <span style="font-family: courier new,monospace;">| weekstartday | INT | 1 | NULL | NULL | </span><br style="font-family: courier new,monospace;"> <span style="font-family: courier new,monospace;">| startPage | TEXT | NULL | NULL | monthly | </span><br style="font-family: courier new,monospace;"> <span style="font-family: courier new,monospace;">| project_items_per_page | INT | 20 | NULL | NULL | </span><br style="font-family: courier new,monospace;"> <span style="font-family: courier new,monospace;">| task_items_per_page | INT | 20 | NULL | NULL | </span><br style="font-family: courier new,monospace;"> <span style="font-family: courier new,monospace;">| simpleTimesheetLayout | TEXT | NULL | NULL | small work description field | </span><br style="font-family: courier new,monospace;"> <span style="font-family: courier new,monospace;">| useLDAP | INT | 0 | NULL | NULL | </span><br style="font-family: courier new,monospace;"> <span style="font-family: courier new,monospace;">| LDAPurl | TEXT | NULL | NULL | <a moz-do-not-send="true">ldap://watson:389</a> | </span><br style="font-family: courier new,monospace;"> <span style="font-family: courier new,monospace;">| LDAPBaseDN | TEXT | NULL | NULL | dc=watson | </span><br style="font-family: courier new,monospace;"> <span style="font-family: courier new,monospace;">| LDAPUsernameAttribute | TEXT | NULL | NULL | cn | </span><br style="font-family: courier new,monospace;"> <span style="font-family: courier new,monospace;">| LDAPSearchScope | TEXT | NULL | NULL | base | </span><br style="font-family: courier new,monospace;"> <span style="font-family: courier new,monospace;">| LDAPFilter | TEXT | NULL | NULL | | </span><br style="font-family: courier new,monospace;"> <span style="font-family: courier new,monospace;">| LDAPProtocolVersion | TEXT | NULL | NULL | 3 | </span><br style="font-family: courier new,monospace;"> <span style="font-family: courier new,monospace;">| LDAPBindUsername | TEXT | NULL | NULL | | </span><br style="font-family: courier new,monospace;"> <span style="font-family: courier new,monospace;">| LDAPBindPassword | TEXT | NULL | NULL | | </span><br style="font-family: courier new,monospace;"> <span style="font-family: courier new,monospace;">| LDAPReferrals | INT | 0 | NULL | NULL | </span><br style="font-family: courier new,monospace;"> <span style="font-family: courier new,monospace;">| LDAPFallback | INT | 0 | NULL | NULL | </span><br style="font-family: courier new,monospace;"> <span style="font-family: courier new,monospace;">+------------------------+------+------+-------+------------------------------+</span><br> <br> Oh, you can also see above, I've replaced several of the old LDAP items with an LDAPurl item instead...<br> <br> -Scott<br> <br> <div>On Thu, Feb 10, 2011 at 5:42 PM, Scott Miller <span dir="ltr"><<a moz-do-not-send="true" href="mailto:sco...@gm..." target="_blank">sco...@gm...</a>></span> wrote:<br> <blockquote style="padding-left: 1ex;">Good to hear about the HTML stuff in the database now being ignored, and moving to some sort of template system; I think that will be much nicer than having that stuff in the database. I would certainly be interested in reading what peter has...<br> <br> There are many suggested improvements that are impossible without having per user configuration options. Things like having each user able to create a default set of time entries per week, eventually allowing the user to set their own timezone (once we can store times as UTC). Once we have this ability a whole myriad of new possibilities are opened up to further improve the user experience.<br> <br> Peter Lazarus, are you still working on improving the "managment approval" area?<br> <font color="#888888"><br> -Scott</font></blockquote> </div> <br> </blockquote> <br> </div> </div> ------------------------------------------------------------------------------ The ultimate all-in-one performance toolkit: Intel(R) Parallel Studio XE: Pinpoint memory and threading errors before they happen. Find and fix more than 250 security defects in the development cycle. Locate bottlenecks in serial and parallel code that limit performance. <a moz-do-not-send="true" href="http://p.sf.net/sfu/intel-dev2devfeb" target="_blank">http://p.sf.net/sfu/intel-dev2devfeb</a> <div> <br> _______________________________________________ Tsheetx-developers mailing list <a moz-do-not-send="true" href="mailto:Tsh...@li..." target="_blank">Tsh...@li...</a> <a moz-do-not-send="true" href="https://lists.sourceforge.net/lists/listinfo/tsheetx-developers" target="_blank">https://lists.sourceforge.net/lists/listinfo/tsheetx-developers</a> </div> </div> <br> ------------------------------------------------------------------------------<br> The ultimate all-in-one performance toolkit: Intel(R) Parallel Studio XE:<br> Pinpoint memory and threading errors before they happen.<br> Find and fix more than 250 security defects in the development cycle.<br> Locate bottlenecks in serial and parallel code that limit performance.<br> <a moz-do-not-send="true" href="http://p.sf.net/sfu/intel-dev2devfeb" target="_blank">http://p.sf.net/sfu/intel-dev2devfeb</a><br> _______________________________________________<br> Tsheetx-developers mailing list<br> <a moz-do-not-send="true" href="mailto:Tsh...@li..." target="_blank">Tsh...@li...</a><br> <a moz-do-not-send="true" href="https://lists.sourceforge.net/lists/listinfo/tsheetx-developers" target="_blank">https://lists.sourceforge.net/lists/listinfo/tsheetx-developers</a><br> <br> </blockquote> </div> <br> <pre wrap=""> <fieldset class="mimeAttachmentHeader"></fieldset> ------------------------------------------------------------------------------ The ultimate all-in-one performance toolkit: Intel(R) Parallel Studio XE: Pinpoint memory and threading errors before they happen. Find and fix more than 250 security defects in the development cycle. Locate bottlenecks in serial and parallel code that limit performance. <a class="moz-txt-link-freetext" href="http://p.sf.net/sfu/intel-dev2devfeb">http://p.sf.net/sfu/intel-dev2devfeb</a></pre> <pre wrap=""> <fieldset class="mimeAttachmentHeader"></fieldset> _______________________________________________ Tsheetx-developers mailing list <a class="moz-txt-link-abbreviated" href="mailto:Tsh...@li...">Tsh...@li...</a> <a class="moz-txt-link-freetext" href="https://lists.sourceforge.net/lists/listinfo/tsheetx-developers">https://lists.sourceforge.net/lists/listinfo/tsheetx-developers</a> </pre> </blockquote> </body> </html> |