[CS-Project-svn_notify] SF.net SVN: cs-project: [806] trunk/1.2
Brought to you by:
crazedsanity
From: <cra...@us...> - 2008-02-08 18:30:10
|
Revision: 806 http://cs-project.svn.sourceforge.net/cs-project/?rev=806&view=rev Author: crazedsanity Date: 2008-02-08 10:30:04 -0800 (Fri, 08 Feb 2008) Log Message: ----------- Mostly parsed version of sample config... next release will need to set attributes into generated config file (from the sample, probably). Modified Paths: -------------- trunk/1.2/docs/samples/sample_config.xml trunk/1.2/includes/content/settings.inc trunk/1.2/templates/content/settings/admin.content.tmpl Modified: trunk/1.2/docs/samples/sample_config.xml =================================================================== --- trunk/1.2/docs/samples/sample_config.xml 2008-02-08 17:49:16 UTC (rev 805) +++ trunk/1.2/docs/samples/sample_config.xml 2008-02-08 18:30:04 UTC (rev 806) @@ -53,9 +53,14 @@ options="1=Do not show|1=Show" default="0">0</debugremovehr> <workingonit - type="hidden" + type="locked" default="0">0</workingonit> - <version_string>1.0.0-ALPHA1</version_string> + <version_string + title="Version String" + description="This is an important <b>INTERNAL</b> setting that should NEVER be changed manually + unless you really know what you're doing." + type="locked" + disabled="1">1.0.0-ALPHA1</version_string> <database__host title="Database Name (cs_project)" description="Hostname" Modified: trunk/1.2/includes/content/settings.inc =================================================================== --- trunk/1.2/includes/content/settings.inc 2008-02-08 17:49:16 UTC (rev 805) +++ trunk/1.2/includes/content/settings.inc 2008-02-08 18:30:04 UTC (rev 806) @@ -128,7 +128,6 @@ $x = $page->set_all_block_rows("content"); - if(count($page->ftsSections) == 3 && $page->ftsSections[2] == 'admin') { if($user->is_admin() == 1) { //read the sample config. @@ -136,9 +135,44 @@ $myData = $xmlObj->get_path('/CONFIG'); $mainAttributes = $myData['attributes']; unset($myData['type'], $myData['attributes']); - debug_print($myData); + $parsedRows = ""; + $defaultRowName = 'setting_text'; + foreach($myData as $indexName=>$data) { + $attributes = $data['attributes']; + $value = $data['value']; + unset($data['type'], $data['attributes'], $data['value']); + $indexName = strtolower($indexName); + + #debug_print($attributes); + + + //pull the appropriate template row. + $rowName = $defaultRowName; + if(strlen($attributes['TYPE'])) { + $rowName = 'setting_'. $attributes['TYPE']; + } + + debug_print("Parsing (". $indexName .") using rowName=(". $rowName .")"); + + if(!isset($page->templateRows[$rowName])) { + throw new exception(__METHOD__ .": failed to retrieve block row named (". $rowName .")"); + } + + //now parse stuff into the row... + $repArr = array( + 'disabled' => $attributes['disabled'], + 'index' => $indexName, + 'title' => $attributes['TITLE'], + 'description' => $attributes['DESCRIPTION'], + 'value' => $value + ); + $parsedRows .= $page->mini_parser($page->templateRows[$rowName], $repArr); + } + #debug_print($parsedRows); + $page->add_template_var($defaultRowName, $parsedRows); + //create an object with administrative capabilities. $adminUserClass = new adminUserClass($page->db); Modified: trunk/1.2/templates/content/settings/admin.content.tmpl =================================================================== --- trunk/1.2/templates/content/settings/admin.content.tmpl 2008-02-08 17:49:16 UTC (rev 805) +++ trunk/1.2/templates/content/settings/admin.content.tmpl 2008-02-08 18:30:04 UTC (rev 806) @@ -3,7 +3,7 @@ <a name="config" /> -<table border="1" cellpadding="3" cellspacing="0"> +<table border="1" cellpadding="3" cellspacing="0" width="80%"> <tr> <th colspan="2">Config Settings</th> </tr> @@ -16,13 +16,13 @@ </td> </tr> <tr> - <th>Name/Description</th> - <th>Value/Select Option</th> + <th width="80%">Name/Description</th> + <th width="20%">Value/Select Option</th> </tr> <!-- BEGIN setting_text --> <tr> <td> - <b>%%title%%</b><hr> + <b>%%title%%</b> (%%index%%)<BR> %%description%% </td> @@ -32,7 +32,7 @@ <!-- BEGIN setting_select --> <tr> <td> - <b>%%title%%</b><hr> + <b>%%title%%</b> (%%index%%)<BR> %%description%% </td> @@ -48,14 +48,19 @@ </td> </tr> <!-- END setting_select --> -<!-- BEGIN setting_hidden --> +<!-- BEGIN setting_locked --> <tr> <td> + <b>%%title%%</b> (%%index%%)<BR> + %%description%% + </td> + + <td> <!-- NOTE: should we even have hidden elements in the form? --> - <input type="HIDDEN" name="%%index%%" value="%%value%%"> + <input type="text" name="%%index%%" value="%%value%%" disabled> </td> </tr> -<!-- END setting_hidden --> +<!-- END setting_locked --> </table> This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |