Thread: [CS-Project-svn_notify] SF.net SVN: cs-project: [799] trunk/1.2
Brought to you by:
crazedsanity
From: <cra...@us...> - 2008-02-07 07:00:22
|
Revision: 799 http://cs-project.svn.sourceforge.net/cs-project/?rev=799&view=rev Author: crazedsanity Date: 2008-02-06 23:00:16 -0800 (Wed, 06 Feb 2008) Log Message: ----------- Move admin stuff to sub-section of settings (code cleaning still needed). Modified Paths: -------------- trunk/1.2/includes/content/settings.inc trunk/1.2/templates/content/settings/index.content.tmpl Added Paths: ----------- trunk/1.2/templates/content/settings/admin.content.tmpl Modified: trunk/1.2/includes/content/settings.inc =================================================================== --- trunk/1.2/includes/content/settings.inc 2008-02-07 06:24:26 UTC (rev 798) +++ trunk/1.2/includes/content/settings.inc 2008-02-07 07:00:16 UTC (rev 799) @@ -171,30 +171,40 @@ $page->add_template_var('pref_row', $prefRow); } - if($user->is_admin() == 1) { - //add the template to show various admin stuff. - $page->add_template_var("admin_section", $page->templateRows['admin_section']); - - //create an object with administrative capabilities. - $adminUserClass = new adminUserClass($page->db); - - //build the list of available groups. - $myGroups = $adminUserClass->get_groups(TRUE); - $page->add_template_var("addUser_gruppe", array_as_option_list($myGroups, $_SESSION['login_group_id'])); - - //Group administration. - { - $showGroup = $page->ui->get_cache("settings/showGroup"); - if(is_numeric($_GET['showGroup'])) { - $showGroup = $_GET['showGroup']; + if(count($page->ftsSections) == 3 && $page->ftsSections[2] == 'admin') { + if($user->is_admin() == 1) { + //add the template to show various admin stuff. + $page->add_template_var("admin_section", $page->templateRows['admin_section']); + + //create an object with administrative capabilities. + $adminUserClass = new adminUserClass($page->db); + + //build the list of available groups. + $myGroups = $adminUserClass->get_groups(TRUE); + $page->add_template_var("addUser_gruppe", array_as_option_list($myGroups, $_SESSION['login_group_id'])); + + //Group administration. + { + $showGroup = $page->ui->get_cache("settings/showGroup"); + if(is_numeric($_GET['showGroup'])) { + $showGroup = $_GET['showGroup']; + } + elseif(!is_numeric($showGroup)) { + $showGroup = $_SESSION['login_group_id']; + } + $page->ui->set_cache("settings/showGroup", $showGroup); + regenerate_group_lists($showGroup); + display_current_leader($showGroup); } - elseif(!is_numeric($showGroup)) { - $showGroup = $_SESSION['login_group_id']; - } - $page->ui->set_cache("settings/showGroup", $showGroup); - regenerate_group_lists($showGroup); - display_current_leader($showGroup); } + else { + $msg = array( + 'title' => "Insufficient Privileges ", + 'message' => "Administrative privileges are required to view this section.", + 'type' => "fatal" + ); + $page->set_message_wrapper($msg); + } } } Copied: trunk/1.2/templates/content/settings/admin.content.tmpl (from rev 789, trunk/1.2/templates/content/settings/index.content.tmpl) =================================================================== --- trunk/1.2/templates/content/settings/admin.content.tmpl (rev 0) +++ trunk/1.2/templates/content/settings/admin.content.tmpl 2008-02-07 07:00:16 UTC (rev 799) @@ -0,0 +1,117 @@ + +<h2><font color="red">Administrative Settings</font></h2> + + +<a name="group"> +<table border=1 cellpadding=3 cellspacing=0> + <tr> + <th colspan="3"><a href="#groupManagement"></a>Group Management</th> + </tr> + <tr> + <th>Select a group</th> + + <th>Current Members</th> + + <th>Non-Members</th> + </tr> + <tr> + <td> + <b>Change current group:</b><BR> + <SELECT> +<!-- BEGIN show_group_list --> + <option onClick="javascript:void(xajax_ajax__change_current_group(%%group_id%%))" %%selectedString%%>%%display%% (%%short_name%%)</option> +<!-- END show_group_list --> + </SELECT><BR><BR><hr> + <div id="currentGroupLeader"> +<!-- BEGIN currentGroupLeaderBox --> + <b>Change Leader </b>({currentGroupLeader})<b> to:</b> + <input name="changeLeader[groupId]" type="HIDDEN" value="{groupId}"> + <SELECT name="changeLeader[newLeader]"> + {changeGroupLeader_list} + </SELECT><BR> +<!-- END currentGroupLeaderBox --> + </div> + <input type="submit" value="Change Leader" onClick="this.form.action.value='changeLeader'"> + </td> + + <td> + <div id="group_nonMembers"> + <!-- BEGIN group_nonMembers --> + <table> +<!-- BEGIN show_group_list__removeUser --> + <tr> + <td>(<b><a href="javascript:void(xajax_ajax__group_user(%%group_id%%, %%uid%%, 'remove'));">Remove</a></b>) %%username%%</td> + </tr> +<!-- END show_group_list__removeUser --> +<!-- BEGIN show_group_list__noRemoveUser --> + <tr> + <td><b><font color="red">No users to remove</font></b></td> + </tr> +<!-- END show_group_list__noRemoveUser --> + </table> + <!-- END group_nonMembers --> + </div> + </td> + + <td> + <div id="group_currentMembers"> + <!-- BEGIN group_currentMembers --> + <table> +<!-- BEGIN show_group_list__selectUser --> + <tr> + <td>(<b><a href="javascript:void(xajax_ajax__group_user(%%group_id%%, %%uid%%, 'add'));">Add</a></b>) %%username%%</td> + </tr> +<!-- END show_group_list__selectUser --> +<!-- BEGIN show_group_list__noUser --> + <tr> + <td><b><font color="red">No users to add</font></b></td> + </tr> +<!-- END show_group_list__noUser --> + </table> + <!-- END group_currentMembers --> + </div> + </td> + </tr> +</table> + + +<form method="POST"> + +<table border=1 cellpadding=3 cellspacing=0> + <tr> + <th colspan="2"><a href="#createUser"></a>Create User:</th> + </tr> + <tr> + <td>Username: </td> + <td><input name="addUser[username]" type="text"></td> + </tr> + <tr> + <td>Password: </td> + <td><input name="addUser[password]" type="text"></td> + </tr> + <tr> + <td>First Name: </td> + <td><input name="addUser[fname]" type="text"></td> + </tr> + <tr> + <td>Last Name: </td> + <td><input name="addUser[lname]" type="text"></td> + </tr> + <tr> + <td>Company: </td> + <td><input name="addUser[company]" type="text"></td> + </tr> + <tr> + <td>Email: </td> + <td><input name="addUser[email]" type="text"></td> + </tr> + <tr> + <td>Default Group: </td> + <td><SELECT name="addUser[group_id]">{addUser_gruppe}</SELECT></td> + </tr> + <tr> + <td colspan="2"><input type="submit" value="Add User" OnClick="javascript:this.form.action.value='addUser';"></td> + </tr> +</table> +<input type="HIDDEN" name="action" value="Fix_JAVASCRIPT"> +</form> Modified: trunk/1.2/templates/content/settings/index.content.tmpl =================================================================== --- trunk/1.2/templates/content/settings/index.content.tmpl 2008-02-07 06:24:26 UTC (rev 798) +++ trunk/1.2/templates/content/settings/index.content.tmpl 2008-02-07 07:00:16 UTC (rev 799) @@ -80,126 +80,3 @@ <input type="hidden" name="action" value="set_preference"> </form> - - - - - -<!-- BEGIN admin_section --> -<form method="POST"> -<hr> -<h2><font color="red">Administrative Settings</font></h2> - - -<a name="group"> -<table border=1 cellpadding=3 cellspacing=0> - <tr> - <th colspan="3"><a href="#groupManagement"></a>Group Management</th> - </tr> - <tr> - <th>Select a group</th> - - <th>Current Members</th> - - <th>Non-Members</th> - </tr> - <tr> - <td> - <b>Change current group:</b><BR> - <SELECT> -<!-- BEGIN show_group_list --> - <option onClick="javascript:void(xajax_ajax__change_current_group(%%group_id%%))" %%selectedString%%>%%display%% (%%short_name%%)</option> -<!-- END show_group_list --> - </SELECT><BR><BR><hr> - <div id="currentGroupLeader"> -<!-- BEGIN currentGroupLeaderBox --> - <b>Change Leader </b>({currentGroupLeader})<b> to:</b> - <input name="changeLeader[groupId]" type="HIDDEN" value="{groupId}"> - <SELECT name="changeLeader[newLeader]"> - {changeGroupLeader_list} - </SELECT><BR> -<!-- END currentGroupLeaderBox --> - </div> - <input type="submit" value="Change Leader" onClick="this.form.action.value='changeLeader'"> - </td> - - <td> - <div id="group_nonMembers"> - <!-- BEGIN group_nonMembers --> - <table> -<!-- BEGIN show_group_list__removeUser --> - <tr> - <td>(<b><a href="javascript:void(xajax_ajax__group_user(%%group_id%%, %%uid%%, 'remove'));">Remove</a></b>) %%username%%</td> - </tr> -<!-- END show_group_list__removeUser --> -<!-- BEGIN show_group_list__noRemoveUser --> - <tr> - <td><b><font color="red">No users to remove</font></b></td> - </tr> -<!-- END show_group_list__noRemoveUser --> - </table> - <!-- END group_nonMembers --> - </div> - </td> - - <td> - <div id="group_currentMembers"> - <!-- BEGIN group_currentMembers --> - <table> -<!-- BEGIN show_group_list__selectUser --> - <tr> - <td>(<b><a href="javascript:void(xajax_ajax__group_user(%%group_id%%, %%uid%%, 'add'));">Add</a></b>) %%username%%</td> - </tr> -<!-- END show_group_list__selectUser --> -<!-- BEGIN show_group_list__noUser --> - <tr> - <td><b><font color="red">No users to add</font></b></td> - </tr> -<!-- END show_group_list__noUser --> - </table> - <!-- END group_currentMembers --> - </div> - </td> - </tr> -</table> - -<table border=1 cellpadding=3 cellspacing=0> - <tr> - <th colspan="2"><a href="#createUser"></a>Create User:</th> - </tr> - <tr> - <td>Username: </td> - <td><input name="addUser[username]" type="text"></td> - </tr> - <tr> - <td>Password: </td> - <td><input name="addUser[password]" type="text"></td> - </tr> - <tr> - <td>First Name: </td> - <td><input name="addUser[fname]" type="text"></td> - </tr> - <tr> - <td>Last Name: </td> - <td><input name="addUser[lname]" type="text"></td> - </tr> - <tr> - <td>Company: </td> - <td><input name="addUser[company]" type="text"></td> - </tr> - <tr> - <td>Email: </td> - <td><input name="addUser[email]" type="text"></td> - </tr> - <tr> - <td>Default Group: </td> - <td><SELECT name="addUser[group_id]">{addUser_gruppe}</SELECT></td> - </tr> - <tr> - <td colspan="2"><input type="submit" value="Add User" OnClick="javascript:this.form.action.value='addUser';"></td> - </tr> -</table> -<input type="HIDDEN" name="action" value="Fix_JAVASCRIPT"> -</form> -<!-- END admin_section --> - This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <cra...@us...> - 2008-02-07 07:56:56
|
Revision: 802 http://cs-project.svn.sourceforge.net/cs-project/?rev=802&view=rev Author: crazedsanity Date: 2008-02-06 23:56:52 -0800 (Wed, 06 Feb 2008) Log Message: ----------- Parses the sample config, and there's a warning about incorrect settings. Modified Paths: -------------- trunk/1.2/includes/content/settings.inc trunk/1.2/templates/content/settings/admin.content.tmpl Modified: trunk/1.2/includes/content/settings.inc =================================================================== --- trunk/1.2/includes/content/settings.inc 2008-02-07 07:36:05 UTC (rev 801) +++ trunk/1.2/includes/content/settings.inc 2008-02-07 07:56:52 UTC (rev 802) @@ -131,9 +131,14 @@ if(count($page->ftsSections) == 3 && $page->ftsSections[2] == 'admin') { if($user->is_admin() == 1) { - //add the template to show various admin stuff. - $page->add_template_var("admin_section", $page->templateRows['admin_section']); + //read the sample config. + $xmlObj = new XMLParser(file_get_contents(dirname(__FILE__) .'/../../docs/samples/sample_config.xml')); + $myData = $xmlObj->get_path('/CONFIG'); + $mainAttributes = $myData['attributes']; + unset($myData['type'], $myData['attributes']); + debug_print($myData); + //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-07 07:36:05 UTC (rev 801) +++ trunk/1.2/templates/content/settings/admin.content.tmpl 2008-02-07 07:56:52 UTC (rev 802) @@ -8,10 +8,18 @@ <th colspan="2">Config Settings</th> </tr> <tr> + <td colspan="2" align="center"> + <div class="note" style="width:60em"><b>NOTE:</b> You should be <font color="red"><b>absolutely certain</b></font> of the + effects of the changes you make here. Changing an item to an incorrect value make render the + installation useless. To rectify a broken configuration, you would need to modify the + <b>/lib/config.xml</b> file manually.</div> + </td> +</tr> +<tr> <th>Name/Description</th> <th>Value/Select Option</th> </tr> -<!-- BEGIN xsetting_text --> +<!-- BEGIN setting_text --> <tr> <td> <b>%%title%%</b><hr> @@ -21,7 +29,7 @@ <td><input name="%%index%%" type="text" value="%%value%%" %%disabled%%></td> </tr> <!-- END setting_text --> -<!-- BEGIN xsetting_select --> +<!-- BEGIN setting_select --> <tr> <td> <b>%%title%%</b><hr> @@ -40,7 +48,7 @@ </td> </tr> <!-- END setting_select --> -<!-- BEGIN xsetting_hidden --> +<!-- BEGIN setting_hidden --> <tr> <td> <!-- NOTE: should we even have hidden elements in the form? --> This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
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. |
From: <cra...@us...> - 2008-02-09 03:49:57
|
Revision: 811 http://cs-project.svn.sourceforge.net/cs-project/?rev=811&view=rev Author: crazedsanity Date: 2008-02-08 19:49:54 -0800 (Fri, 08 Feb 2008) Log Message: ----------- Updates to completely parse sample config (doesn't handle dependent items). Modified Paths: -------------- trunk/1.2/includes/content/settings.inc trunk/1.2/templates/content/settings/admin.content.tmpl Modified: trunk/1.2/includes/content/settings.inc =================================================================== --- trunk/1.2/includes/content/settings.inc 2008-02-09 03:48:05 UTC (rev 810) +++ trunk/1.2/includes/content/settings.inc 2008-02-09 03:49:54 UTC (rev 811) @@ -130,9 +130,12 @@ if(count($page->ftsSections) == 3 && $page->ftsSections[2] == 'admin') { if($user->is_admin() == 1) { + //read the sample config. - $xmlObj = new XMLParser(file_get_contents(dirname(__FILE__) .'/../../docs/samples/sample_config.xml')); - $myData = $xmlObj->get_path('/CONFIG'); + require_once(dirname(__FILE__) .'/../../lib/config.class.php'); + $config = new config(dirname(__FILE__) .'/../../docs/samples/sample_config.xml', FALSE); + $myData = $config->get_config_contents(FALSE); + $mainAttributes = $myData['attributes']; unset($myData['type'], $myData['attributes']); @@ -151,10 +154,24 @@ $rowName = $defaultRowName; if(strlen($attributes['TYPE'])) { $rowName = 'setting_'. $attributes['TYPE']; + + $optionList = NULL; + if($attributes['TYPE'] == 'select' && isset($attributes['OPTIONS'])) { + #debug_print(explode('|', $attributes['OPTIONS'])); + $tmpOptionList = explode('|', $attributes['OPTIONS']); + debug_print("parsing (". $indexName .")"); + debug_print($tmpOptionList); + $optionList = array(); + foreach($tmpOptionList as $optionInfo) { + $x = explode('=', $optionInfo); + $optionList[$x[0]] = $x[1]; + } + debug_print($optionList); + $optionList = $page->gfObj->array_as_option_list($optionList, $attributes['DEFAULT']); + debug_print($optionList); + } } - debug_print("Parsing (". $indexName .") using rowName=(". $rowName .")"); - if(!isset($page->templateRows[$rowName])) { throw new exception(__METHOD__ .": failed to retrieve block row named (". $rowName .")"); } @@ -167,6 +184,9 @@ 'description' => $attributes['DESCRIPTION'], 'value' => $value ); + if(!is_null($optionList)) { + $repArr['setting_select__normal'] = $optionList; + } $parsedRows .= $page->mini_parser($page->templateRows[$rowName], $repArr); } #debug_print($parsedRows); Modified: trunk/1.2/templates/content/settings/admin.content.tmpl =================================================================== --- trunk/1.2/templates/content/settings/admin.content.tmpl 2008-02-09 03:48:05 UTC (rev 810) +++ trunk/1.2/templates/content/settings/admin.content.tmpl 2008-02-09 03:49:54 UTC (rev 811) @@ -38,12 +38,7 @@ <td> <select name="%%index%%" %%disabled%%> - <!-- BEGIN xsetting_select__normal --> - <option value="%%value%%">%%displayValue%%</option> - <!-- END setting_select__normal --> - <!-- BEGIN xsetting_select__onSelect --> - <option value="%%value%%" onSelect="enableInput(%%namedSection%%);">%%displayValue%%</option> - <!-- END setting_select__onSelect --> + %%setting_select__normal%% </select> </td> </tr> This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <cra...@us...> - 2008-02-09 21:30:12
|
Revision: 820 http://cs-project.svn.sourceforge.net/cs-project/?rev=820&view=rev Author: crazedsanity Date: 2008-02-09 13:30:08 -0800 (Sat, 09 Feb 2008) Log Message: ----------- Upgrade for 1.2.0-ALPHA3 (config has attributes for displaying admin update). /lib/upgradeClass.php: * update_config_file(): -- retain attributes instead of removing them. /upgrade/upgrade.xml: * update explanation to be slightly less confusing. /upgrade/upgradeTo1.2.0-ALPHA3.php: * run_upgrade(): -- no more transactions. * update_config_file(): -- backup the original config (just in case) -- updates existing config with attributes from sample config -- if the "CONFIG_EMAIL_SERVER_IP" tag exists in the current config and "PHPMAILER_HOST" isn't, use the value of the former for the latter (and remove the former). -- writes-out the updated config file. Modified Paths: -------------- trunk/1.2/lib/upgradeClass.php trunk/1.2/upgrade/upgrade.xml trunk/1.2/upgrade/upgradeTo1.2.0-ALPHA3.php Modified: trunk/1.2/lib/upgradeClass.php =================================================================== --- trunk/1.2/lib/upgradeClass.php 2008-02-09 10:01:10 UTC (rev 819) +++ trunk/1.2/lib/upgradeClass.php 2008-02-09 21:30:08 UTC (rev 820) @@ -631,7 +631,7 @@ $xmlCreator->load_xmlparser_data($xmlParser); //update the given index. - $xmlCreator->add_tag($index, $value); + $xmlCreator->add_tag($index, $value, $xmlParser->get_attribute('/CONFIG/'. strtoupper($index))); $this->mainConfig[strtoupper($index)] = $value; $xmlString = $xmlCreator->create_xml_string(); Modified: trunk/1.2/upgrade/upgrade.xml =================================================================== --- trunk/1.2/upgrade/upgrade.xml 2008-02-09 10:01:10 UTC (rev 819) +++ trunk/1.2/upgrade/upgrade.xml 2008-02-09 21:30:08 UTC (rev 820) @@ -1,8 +1,5 @@ <upgrade> - <system_note>The database and version listed in the config.xml file should - ALWAYS match. - - To determine which section in matching to use, heed only the information + <system_note>To determine which section in matching to use, heed only the information beneath the tag that indicates the current database version (for 5.2.4, you would find information under matching for "v5.2.4"). This section indicates the version that it should upgrade the database to Modified: trunk/1.2/upgrade/upgradeTo1.2.0-ALPHA3.php =================================================================== --- trunk/1.2/upgrade/upgradeTo1.2.0-ALPHA3.php 2008-02-09 10:01:10 UTC (rev 819) +++ trunk/1.2/upgrade/upgradeTo1.2.0-ALPHA3.php 2008-02-09 21:30:08 UTC (rev 820) @@ -27,13 +27,9 @@ //========================================================================= public function run_upgrade() { - $this->db->beginTrans(__METHOD__); - $this->update_config_file(); - exit; - $this->db->commitTrans(__METHOD__); - + return('Upgrade complete'); }//end run_upgrade() //========================================================================= @@ -48,25 +44,41 @@ $updateXml = new xmlCreator(); $updateXml->load_xmlparser_data($siteXmlObj); + + //BACKUP ORIGINAL XML CONFIG... + $backupFile = 'lib/__BACKUP__'. time() .'__config.xml'; + $fs->create_file($backupFile); + $fs->openFile($backupFile); + $fs->write($updateXml->create_xml_string()); + $sampleIndexes = $sampleXmlObj->get_tree(TRUE); $sampleIndexes = $sampleIndexes['CONFIG']; + $siteConfigIndexes = $siteXmlObj->get_tree(TRUE); + $siteConfigIndexes = $siteConfigIndexes['CONFIG']; foreach($sampleIndexes as $indexName=>$indexValue) { $path = '/CONFIG/'. $indexName; $attributes = $sampleXmlObj->get_attribute($path); #debug_print(__METHOD__ .": attributes from sample (/CONFIG/". $indexName ."::: ",1); #debug_print($attributes,1); + debug_print(__METHOD__ .': indexName=('. $indexName .'), indexValue=('. $indexValue .'), original config value=('. $siteConfigIndexes[$indexName] .')'); - if(is_array($attributes)) { - $updateXml->add_attribute($path, $attributes); + //add tag if it's not there, update values otherwise. + $tagValue = $attributes['DEFAULT']; + if(isset($siteConfigIndexes[$indexName])) { + $tagValue = $siteConfigIndexes[$indexName]; } + elseif($indexName == 'PHPMAILER_HOST' && isset($siteConfigIndexes['CONFIG_EMAIL_SERVER_IP'])) { + $tagValue = $siteConfigIndexes['CONFIG_EMAIL_SERVER_IP']; + $updateXml->remove_path('/CONFIG/CONFIG_EMAIL_SERVER_IP'); + } + $updateXml->add_tag($path, $tagValue, $attributes); } - $this->gfObj->debug_print($updateXml->create_xml_string()); - $fs->openFile('lib/_test_config.xml'); + $this->gfObj->debug_print($this->gfObj->cleanString($updateXml->create_xml_string(), 'htmlentity_plus_brackets')); + $fs->openFile('lib/config.xml'); $fs->write($updateXml->create_xml_string()); - exit; }//end update_config_file() //========================================================================= } This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <cra...@us...> - 2008-02-14 07:05:13
|
Revision: 838 http://cs-project.svn.sourceforge.net/cs-project/?rev=838&view=rev Author: crazedsanity Date: 2008-02-13 23:05:11 -0800 (Wed, 13 Feb 2008) Log Message: ----------- Move building of update settings interface into config{}. NOTE::: some updates may need to be done to keep from segfaulting (through the need of config{} to create possibly multiple instances of itself within itself. Also, config::__construct() may need to be a bit less strict in order to avoid those same problems. Modified Paths: -------------- trunk/1.2/includes/content/settings.inc trunk/1.2/lib/config.class.php Modified: trunk/1.2/includes/content/settings.inc =================================================================== --- trunk/1.2/includes/content/settings.inc 2008-02-11 03:11:01 UTC (rev 837) +++ trunk/1.2/includes/content/settings.inc 2008-02-14 07:05:11 UTC (rev 838) @@ -131,61 +131,11 @@ if(count($page->ftsSections) == 3 && $page->ftsSections[2] == 'admin') { if($user->is_admin() == 1) { - //read the sample config. - require_once(dirname(__FILE__) .'/../../lib/config.class.php'); - $config = new config(dirname(__FILE__) .'/../../lib/config.xml', FALSE); - $myData = $config->get_config_contents(FALSE); + #debug_print(get_class($page)); - $mainAttributes = $myData['attributes']; - unset($myData['type'], $myData['attributes']); + $config = new config(); + $config->build_update_interface($page); - $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); - - //pull the appropriate template row. - $rowName = $defaultRowName; - if(strlen($attributes['TYPE'])) { - $rowName = 'setting_'. $attributes['TYPE']; - - $optionList = NULL; - if($attributes['TYPE'] == 'select' && isset($attributes['OPTIONS'])) { - #debug_print(explode('|', $attributes['OPTIONS'])); - $tmpOptionList = explode('|', $attributes['OPTIONS']); - $optionList = array(); - foreach($tmpOptionList as $optionInfo) { - $x = explode('=', $optionInfo); - $optionList[$x[0]] = $x[1]; - } - $optionList = $page->gfObj->array_as_option_list($optionList, $attributes['DEFAULT']); - } - } - - 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 - ); - if(!is_null($optionList)) { - $repArr['setting_select__normal'] = $optionList; - } - $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/lib/config.class.php =================================================================== --- trunk/1.2/lib/config.class.php 2008-02-11 03:11:01 UTC (rev 837) +++ trunk/1.2/lib/config.class.php 2008-02-14 07:05:11 UTC (rev 838) @@ -93,5 +93,68 @@ return($config); }//end read_config_file() //------------------------------------------------------------------------- + + + + //------------------------------------------------------------------------- + /** + * Create a page (portion of a page, actually) to set/update config settings. + */ + public function build_update_interface(cs_genericPage &$page) { + + //read the sample config. + $config = new config(dirname(__FILE__) .'/config.xml', FALSE); + $myData = $config->get_config_contents(FALSE); + + $mainAttributes = $myData['attributes']; + unset($myData['type'], $myData['attributes']); + + $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); + + //pull the appropriate template row. + $rowName = $defaultRowName; + if(strlen($attributes['TYPE'])) { + $rowName = 'setting_'. $attributes['TYPE']; + + $optionList = NULL; + if($attributes['TYPE'] == 'select' && isset($attributes['OPTIONS'])) { + #debug_print(explode('|', $attributes['OPTIONS'])); + $tmpOptionList = explode('|', $attributes['OPTIONS']); + $optionList = array(); + foreach($tmpOptionList as $optionInfo) { + $x = explode('=', $optionInfo); + $optionList[$x[0]] = $x[1]; + } + $optionList = $page->gfObj->array_as_option_list($optionList, $attributes['DEFAULT']); + } + } + + 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 + ); + if(!is_null($optionList)) { + $repArr['setting_select__normal'] = $optionList; + } + $parsedRows .= $page->mini_parser($page->templateRows[$rowName], $repArr); + } + #debug_print($parsedRows); + $page->add_template_var($defaultRowName, $parsedRows); + }//end build_update_interface() + //------------------------------------------------------------------------- }//end config{} ?> \ No newline at end of file This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <cra...@us...> - 2008-02-14 07:58:07
|
Revision: 839 http://cs-project.svn.sourceforge.net/cs-project/?rev=839&view=rev Author: crazedsanity Date: 2008-02-13 23:58:02 -0800 (Wed, 13 Feb 2008) Log Message: ----------- Beginning to convert setup to use new config::build_update_interface() to display page that builds the config.xml file. Modified Paths: -------------- trunk/1.2/includes/setup/3.inc trunk/1.2/includes/setup.inc trunk/1.2/lib/config.class.php trunk/1.2/lib/site_config.php trunk/1.2/templates/setup/3.content.tmpl Modified: trunk/1.2/includes/setup/3.inc =================================================================== --- trunk/1.2/includes/setup/3.inc 2008-02-14 07:05:11 UTC (rev 838) +++ trunk/1.2/includes/setup/3.inc 2008-02-14 07:58:02 UTC (rev 839) @@ -6,41 +6,23 @@ if($_POST) { - switch($_POST['selectedOption']) { - case 'convertExisting': { - store_setup_data(3, $_POST['fields'], 'convertExisting_post_info'); - $convertObj = new __convertDatabase(); - store_setup_data(3, $convertObj->go(), 'text'); - $convertObj->finish($page); - } - break; - - - case 'newInstall': { - $validSubmission = test_submitted_data($page, $_POST['users']); - if($validSubmission === TRUE) { - $obj = new __setupDefaultValues(); - store_setup_data(3, $obj->go(), 'text'); - $obj->finish($page); - } - else { - store_setup_data(3, $_POST['users'], 'post_info'); - $page->set_message_wrapper( - array( - 'title' => "Invalid User Data", - 'message' => "The user data you submitted appears to be invalid: <BR>\n". $validSubmission, - 'type' => "error" - ) - ); - $page->conditional_header("/setup/3", TRUE); - } - } - break; - - - default: - throw new exception("Invalid option selected!"); - }; + $validSubmission = test_submitted_data($page, $_POST['users']); + if($validSubmission === TRUE) { + $obj = new __setupDefaultValues(); + store_setup_data(3, $obj->go(), 'text'); + $obj->finish($page); + } + else { + store_setup_data(3, $_POST['users'], 'post_info'); + $page->set_message_wrapper( + array( + 'title' => "Invalid User Data", + 'message' => "The user data you submitted appears to be invalid: <BR>\n". $validSubmission, + 'type' => "error" + ) + ); + $page->conditional_header("/setup/3", TRUE); + } $page->conditional_header("/setup/3", TRUE); } @@ -58,14 +40,6 @@ } } } - - //now parse the "convertExisting" stuff... - $convertData = get_setup_data(3, 'convertExisting_post_info'); - if(is_array($convertData)) { - foreach($convertData as $userField => $userValue) { - $page->add_template_var($userField, $userValue); - } - } } @@ -1172,191 +1146,6 @@ -class __convertDatabase { - - - - private $db; - private $newDb; - private $gfObj; - - private $lastNumrows=NULL; - private $lastDberror=NULL; - - //========================================================================= - public function __construct() { - $this->db = new cs_phpDB; - - //retrieve the connection parameters. - $storedParams = get_setup_data(3, 'convertExisting_post_info'); - $params = array(); - foreach($storedParams as $index=>$value) { - $key = preg_replace('/^database__/', '', $index); - $params[$key] = $value; - } - $this->db->connect($params); - - $this->gfObj = new cs_globalFunctions; - $this->gfObj->debugPrintOpt=1; - - - $this->newDb = new cs_phpDb;; - $this->newDb->connect(get_db_params()); - }//end __construct() - //========================================================================= - - - //========================================================================= - public function go() { - //determine what script we have to include & run. - if(!$this->db->is_connected()) { - throw new exception(__METHOD__ .": failed to connect to database..."); - } - else { - $numrows = $this->db->exec("SELECT internal_data_get_value('version_string')"); - $dberror = $this->db->errorMsg(); - - if(!strlen($dberror) && $numrows == 1) { - $data = $this->db->farray(); - $version = $data[0]; - $this->run_conversion($version); - } - else { - throw new exception(__METHOD__ .": failed to get version... ". $dberror); - } - } - - }//end go() - //========================================================================= - - - - //========================================================================= - private function run_conversion($fromVersion) { - - //check if the script exists. - $convertScript = dirname(__FILE__) .'/../../upgrade/convert/'. $fromVersion .'.php'; - if(file_exists($convertScript)) { - require_once($convertScript); - try { - //create the object... - $obj = new convertDatabase($this->db, $this->newDb); - if(method_exists($obj, 'go')) { - $result = $obj->go(); - } - else { - throw new exception(__METHOD__ .": convertDatabase::go() does not exist"); - } - } - catch(exception $e) { - $this->gfObj->debug_print(__METHOD__ .": FATAL EXCEPTION OCCURRED::: ". $e->getMessage(),1); - } - } - else { - throw new exception(__METHOD__ .": conversion script does not exist: ". $convertScript); - } - }//end run_conversion() - //========================================================================= - - - - //========================================================================= - private function get_config_values() { - - store_setup_data(3, 0, 'result'); - $configData = array(); - //setup the list of required items. - $requiredItems = array( - 'log_category_table' => array( - 'prefix' => 'logcat', - 'idColumn' => 'log_category_id', - 'data' => array( - 'database', 'authentication', 'users', 'general', 'project', 'helpdesk', 'todo', - 'tags', 'estimates', 'navigation', 'preferences' - ), - ), - 'record_type_table' => array( - 'prefix' => 'rectype', - 'idColumn' => 'record_type_id', - 'data' => array( - 'project', 'todo', 'helpdesk' - ) - ) - ); - - foreach($requiredItems as $tableName => $info) { - //check that all the required values are present.} - foreach($info['data'] as $itemName) { - $configIndex = $info['prefix'] .'__'. $itemName; - - $getItemSql = "SELECT * FROM ". $tableName ." WHERE lower(name) = '". $itemName ."'"; - $numrows = $this->db->exec($getItemSql); - $dberror = $this->db->errorMsg(); - - if(!strlen($dberror)) { - if($numrows == 1) { - //retrieve the id & store it. - $data = $this->db->farray_fieldnames(); - $configData[$configIndex] = $data[$info['idColumn']]; - } - else { - throw new exception(__METHOD__ .": invalid data...? numrows=(". $numrows ."), dberror::: ". $dberror ."<BR>\nSQL::: ". $getItemSql); - } - } - else { - throw new exception(__METHOD__ .": failed to retrieve id for (". $itemName ."), rows=(". $numrows .") ERROR::: ". $dberror ."<BR>\nSQL::: ". $getItemSql); - } - } - } - - $this->gfObj->debug_print(__METHOD__ .": config data::: ". $this->gfObj->debug_print($configData,0)); - - //set this step's results. - store_setup_data(3, $configData, 'data'); - store_setup_data(3, 1, 'result'); - - return($configData); - }//end get_config_values() - //========================================================================= - - - - //========================================================================= - public function finish(cs_genericPage &$page) { - //retrieve some configuration values. - $this->get_config_values(); - - //create an upgrade{} object, for setting some internal values. - $obj = new _setupUpgrade($this->newDb); - $config = get_setup_data(3, 'data'); - $config['version_string'] = $obj->finalize_conversion(); - store_setup_data(3, $config, 'data'); - - store_setup_data(4, 1, 'accessible'); - $stepRes = get_setup_data(3, 'result'); - if($stepRes == 1) { - $page->set_message_wrapper(array( - 'title' => "Successfully Setup Data", - 'message' => "All default data was stored in the new database successfully!", - 'type' => "status" - )); - $page->conditional_header("/setup/4", TRUE); - } - else { - $page->set_message_wrapper(array( - 'title' => "Step Failed", - 'message' => "Please review the errors below and proceed accordingly.", - 'type' => "error" - )); - $page->conditional_header("/setup/3", TRUE); - } - - }//end finish() - //========================================================================= - -}//end __convertDatabase{} - - class _setupUpgrade extends upgrade { public function __construct(cs_phpDB $db) { Modified: trunk/1.2/includes/setup.inc =================================================================== --- trunk/1.2/includes/setup.inc 2008-02-14 07:05:11 UTC (rev 838) +++ trunk/1.2/includes/setup.inc 2008-02-14 07:58:02 UTC (rev 839) @@ -19,7 +19,8 @@ require_once(dirname(__FILE__) .'/../lib/simpletest/unit_tester.php'); require_once(dirname(__FILE__) .'/../lib/simpletest/reporter.php'); -$configData = read_config_file(FALSE); +$configObj = new config(NULL, FALSE); +$configData = $configObj->read_config_file(FALSE); if(strlen($configData['DATABASE__DBNAME'])) { //setup already complete. Stop 'em. Modified: trunk/1.2/lib/config.class.php =================================================================== --- trunk/1.2/lib/config.class.php 2008-02-14 07:05:11 UTC (rev 838) +++ trunk/1.2/lib/config.class.php 2008-02-14 07:58:02 UTC (rev 839) @@ -12,7 +12,7 @@ private $fileName; //------------------------------------------------------------------------- - public function __construct($fileName=NULL, $redirectOnFileMissing=TRUE) { + public function __construct($fileName=NULL) { $this->gf = new cs_globalFunctions(); $this->fs = new cs_fileSystemClass(dirname(__FILE__) .'/..'); @@ -24,10 +24,6 @@ //Redirect them to the setup page. if(!file_exists($this->fileName)) { $this->fileExists = FALSE; - if($redirectOnFileMissing) { - $this->gf->conditional_header("/setup?from=". urlencode($_SERVER['REQUEST_URI'])); - exit; - } } else { $this->fileExists = TRUE; @@ -58,7 +54,7 @@ } } else { - throw new exception(__METHOD__ .": config file doesn't exist"); + $config = NULL; } return($config); @@ -75,7 +71,7 @@ public function read_config_file($defineConstants=TRUE, $setEverything=TRUE) { $config = $this->get_config_contents(TRUE); - if($defineConstants) { + if(!is_null($config) && $defineConstants) { $conditionallySet = array('VERSION_STRING', 'WORKINGONIT'); foreach($config as $index=>$value) { if(in_array($index, $conditionallySet)) { @@ -104,17 +100,24 @@ //read the sample config. $config = new config(dirname(__FILE__) .'/config.xml', FALSE); - $myData = $config->get_config_contents(FALSE); + $myData = $config->get_config_contents(); + //parse the sample config for it's attributes, so we can display the page properly. + $sampleConfig = new config(dirname(__FILE__) .'/../docs/samples/sample_config.xml', FALSE); + $systemData = $sampleConfig->get_config_contents(FALSE); + $mainAttributes = $myData['attributes']; + unset($myData['type'], $myData['attributes']); $parsedRows = ""; $defaultRowName = 'setting_text'; - foreach($myData as $indexName=>$data) { - $attributes = $data['attributes']; - $value = $data['value']; - unset($data['type'], $data['attributes'], $data['value']); + foreach($systemData as $indexName=>$defaultValue) { + $value = NULL; + if(is_array($myData) && isset($myData[$indexName])) { + $value = $myData[$indexName]; + } + $attributes = $systemData[$indexName]['attributes']; $indexName = strtolower($indexName); //pull the appropriate template row. Modified: trunk/1.2/lib/site_config.php =================================================================== --- trunk/1.2/lib/site_config.php 2008-02-14 07:05:11 UTC (rev 838) +++ trunk/1.2/lib/site_config.php 2008-02-14 07:58:02 UTC (rev 839) @@ -22,6 +22,7 @@ require_once(dirname(__FILE__) .'/cs-phpxml/xmlCreatorClass.php'); require_once(dirname(__FILE__) .'/cs-phpxml/xmlParserClass.php'); require_once(dirname(__FILE__) .'/cs-content/cs_globalFunctions.php'); +require_once(dirname(__FILE__) .'/config.class.php'); define(CONFIG_FILENAME, 'config.xml'); //Set of functions that should be usefull to everyone @@ -62,43 +63,8 @@ //########################################################################## -//------------------------------------------------------------------- -function read_config_file($setEverything=TRUE) { - if(!file_exists(dirname(__FILE__) .'/'. CONFIG_FILENAME)) { - $gf = new cs_globalFunctions; - $gf->conditional_header("/setup?from=". urlencode($_SERVER['REQUEST_URI'])); - exit; - } - - $fs = new cs_fileSystemClass(dirname(__FILE__)); - - $xmlString = $fs->read(CONFIG_FILENAME); - - - //parse the file. - $xmlParser = new xmlParser($xmlString); - - $config = $xmlParser->get_tree(TRUE); - $config = $config['CONFIG']; - unset($config['type'], $config['attributes']); - - $conditionallySet = array('VERSION_STRING', 'WORKINGONIT'); - foreach($config as $index=>$value) { - if(in_array($index, $conditionallySet)) { - //only set this part if we're told to. - if($setEverything) { - define($index, $value); - } - } - else { - define($index, $value); - } - } - - return($config); - -}//end read_config_file() -//------------------------------------------------------------------- +$config = new config(dirname(__FILE__) .'/'. CONFIG_FILENAME, FALSE); +$config->read_config_file(TRUE, TRUE); check_external_lib_versions(); Modified: trunk/1.2/templates/setup/3.content.tmpl =================================================================== --- trunk/1.2/templates/setup/3.content.tmpl 2008-02-14 07:05:11 UTC (rev 838) +++ trunk/1.2/templates/setup/3.content.tmpl 2008-02-14 07:58:02 UTC (rev 839) @@ -2,20 +2,9 @@ {stepData} <form method="POST"> -<div id="setup_text" style="display:inline;"> -<h2>Please Select an Option:</h2> -<a href="javascript:void(setup__enableInput('setup', 'newInstall'));">Perform New Install</a> -or -<a href="javascript:void(setup__enableInput('setup', 'convertExisting'));">Convert Existing Database</a> -</div> -<input type="hidden" id="setup_selectedOption" name="selectedOption" value=""> - -<div id="setup_newInstall_div" style="display:none;"> - - <p> This step will build the following default values in the database: <ul> @@ -59,80 +48,9 @@ </tr> </table> -</div> -<div id="setup_convertExisting_div" style="display:none;"> -<p> - <blink><font color="red">!!!WARNING!!!<b></b></font></blink> This process may take <b>several minutes</b> to complete, - depending upon the speed of the two servers, this webserver, and how many records need to be transferred.<BR><BR> - - This step will attempt to do the following: - <ul> - <li>Determine existing database version</li> - <li>Convert existing information</li> - <li>Ensure the following items contain the necessary values (in new database): - <ul> - <li>Version information</li> - <li>Log categories, classes, and record type data</li> - <li>Attribute records</li> - <li>Anonymous contact data & groups</li> - <li>Status records</li> - <li>Tag names</li> - <li>Preferences & options</li> - <li>Administrator/user information</li> - </ul> - </li> - </ul> -</p> -<table border="1" cellpadding="3" cellspacing="0"> - <tr> - <th>Database Name (cs_project)</th> - - <td><input type="text" name="fields[database__dbname]" value="{database__dbname}"></td> - - <td>Name of the database within PostgreSQL (i.e. "cs_project")</td> - </tr> - <tr> +<input id="submitButton" type="submit" name="go" value="Create default values & proceed to the next step" onClick="new Effect.DropOut('submitButton');"> - <th>Hostname (localhost)</th> - - <td><input type="text" name="fields[database__host]" value="{database__host}"></td> - - <td>Fully qualified host name (like "taz.google.com" or "localhost").</td> - </tr> - <tr> - <th>Port (5432)</th> - - <td><input type="text" name="fields[database__port]" value="{database__port}"></td> - - - <td>Port to connect to PostgreSQL on (default is 5432).</td> - </tr> - <tr> - <th>Database Username (postgres)</th> - - <td><input type="text" name="fields[database__user]" value="{database__user}"></td> - - <td>Username for connecting to PostgreSQL (if you don't know, it's probably "postgres", though connecting as a SUPERUSER is generally accepted as a BAD THING).</td> - </tr> - - <tr> - <th>Database Password</th> - - <td><input type="text" name="fields[database__password]" value="{database__password}"></td> - - <td>Password for connecting to PostgreSQL (for a trusted connection, this can be blank).</td> - </tr> -</table> -</div> - -<div id="setup_newInstall_submitButton" style="display:none;"> - <input id="submitButton" type="submit" name="go" value="Create default values & proceed to the next step" onClick="new Effect.DropOut('submitButton');"> -</div> -<div id="setup_convertExisting_submitButton" style="display:none;"> - <input id="submitButton2" type="submit" name="go" value="Convert existing database & proceed to the next step" onClick="new Effect.DropOut('submitButton2');"> -</div> - </form> This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <cra...@us...> - 2008-02-14 08:23:51
|
Revision: 840 http://cs-project.svn.sourceforge.net/cs-project/?rev=840&view=rev Author: crazedsanity Date: 2008-02-14 00:23:49 -0800 (Thu, 14 Feb 2008) Log Message: ----------- More changes to make setup use config{}... PROBLEMS ENCOUNTERED::: 1.) ALL options show, including previously answered items 2.) Default values displayed instead of logically set ones (like project URL) 3.) user-defined values not stored when returning to step 4 4.) at the end of the run (step #5), system redirects before running tests, since the config already exists... (probably check for a session var in that test, instead of just checkng for the config file). Modified Paths: -------------- trunk/1.2/includes/setup/4.inc trunk/1.2/lib/config.class.php trunk/1.2/lib/site_config.php trunk/1.2/lib/upgradeClass.php Modified: trunk/1.2/includes/setup/4.inc =================================================================== --- trunk/1.2/includes/setup/4.inc 2008-02-14 07:58:02 UTC (rev 839) +++ trunk/1.2/includes/setup/4.inc 2008-02-14 08:23:49 UTC (rev 840) @@ -9,15 +9,15 @@ $defaultValues = array( 'isdevsite' => array(1, 'numeric', 0), 'proj_name' => array(10, 'sql', "CS-Project"), - 'project_url' => array(5, 'sql', $_SERVER['HTTP_HOST']), + 'project_url' => array(5, 'sql', $_SERVER['HTTP_HOST']), 'helpdesk_issue_announce_email' => array(7, 'email', "new...@yo..."), - 'max_time' => array(5, 'sql', "18 hours"), - 'max_idle' => array(5, 'sql', "2 hours"), - 'config_session_name' => array(9, 'alpha', "CS_PROJECT_SESSID"), - 'stop_logins_on_global_alert' => array(1, 'numeric', 1), + 'max_time' => array(5, 'sql', "18 hours"), + 'max_idle' => array(5, 'sql', "2 hours"), + 'config_session_name' => array(9, 'alpha', "CS_PROJECT_SESSID"), + 'stop_logins_on_global_alert' => array(1, 'numeric', 1), 'debugprintopt' => array(1, 'numeric', 0), 'debugremovehr' => array(1, 'numeric', 0), - 'workingonit' => array(1, 'numeric', 0) + 'workingonit' => array(1, 'numeric', 0) ); @@ -60,15 +60,18 @@ } } - foreach($priorSetupData as $index=>$value) { - //check if it's a yes/no type thing. - if(is_numeric($defaultValues[$index])) { - $index .= "__". $value ."__checked"; - $value = "selected"; - } - $page->add_template_var($index, $value); - } + $configObj = new config(); + $configObj->build_update_interface($page); + #foreach($priorSetupData as $index=>$value) { + # //check if it's a yes/no type thing. + # if(is_numeric($defaultValues[$index])) { + # $index .= "__". $value ."__checked"; + # $value = "selected"; + # } + # $page->add_template_var($index, $value); + #} + $page->add_template_var("currentUrl", $_SERVER['HTTP_HOST']); } @@ -93,6 +96,9 @@ $retval = __FUNCTION__ .": ". $index ." failed minimum length check after cleaning"; } } + elseif($index == 'workingonit') { + $goodValues++; + } else { $retval = __FUNCTION__ .": ". $index ." contains invalid data"; } Modified: trunk/1.2/lib/config.class.php =================================================================== --- trunk/1.2/lib/config.class.php 2008-02-14 07:58:02 UTC (rev 839) +++ trunk/1.2/lib/config.class.php 2008-02-14 08:23:49 UTC (rev 840) @@ -113,10 +113,12 @@ $parsedRows = ""; $defaultRowName = 'setting_text'; foreach($systemData as $indexName=>$defaultValue) { - $value = NULL; if(is_array($myData) && isset($myData[$indexName])) { $value = $myData[$indexName]; } + else { + $value = $systemData[$indexName]['value']; + } $attributes = $systemData[$indexName]['attributes']; $indexName = strtolower($indexName); @@ -139,7 +141,10 @@ } if(!isset($page->templateRows[$rowName])) { - throw new exception(__METHOD__ .": failed to retrieve block row named (". $rowName .")"); + $page->set_block_row('content', $rowName); + if(!isset($page->templateRows[$rowName])) { + throw new exception(__METHOD__ .": failed to retrieve block row named (". $rowName .")"); + } } //now parse stuff into the row... Modified: trunk/1.2/lib/site_config.php =================================================================== --- trunk/1.2/lib/site_config.php 2008-02-14 07:58:02 UTC (rev 839) +++ trunk/1.2/lib/site_config.php 2008-02-14 08:23:49 UTC (rev 840) @@ -63,14 +63,14 @@ //########################################################################## -$config = new config(dirname(__FILE__) .'/'. CONFIG_FILENAME, FALSE); -$config->read_config_file(TRUE, TRUE); +$configObj = new config(dirname(__FILE__) .'/'. CONFIG_FILENAME, FALSE); +$configObj->read_config_file(TRUE, TRUE); check_external_lib_versions(); if(!defined("PROJECT__INITIALSETUP") || PROJECT__INITIALSETUP !== TRUE) { - $config = read_config_file(FALSE); + $config = $configObj->read_config_file(FALSE); if(($config['WORKINGONIT'] != "0" && strlen($config['WORKINGONIT'])) || strlen($config['WORKINGONIT']) > 1) { //TODO: consider making this look prettier... @@ -93,7 +93,7 @@ else { $upgrade->check_versions(); } - read_config_file(TRUE); + $configObj->read_config_file(TRUE); } } Modified: trunk/1.2/lib/upgradeClass.php =================================================================== --- trunk/1.2/lib/upgradeClass.php 2008-02-14 07:58:02 UTC (rev 839) +++ trunk/1.2/lib/upgradeClass.php 2008-02-14 08:23:49 UTC (rev 840) @@ -141,7 +141,8 @@ //========================================================================= private function read_config_version() { - $config = read_config_file(FALSE); + $configObj = new config(); + $config = $configObj->read_config_file(FALSE); $this->mainConfig = $config; $retval = NULL; This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <cra...@us...> - 2008-02-17 22:11:13
|
Revision: 843 http://cs-project.svn.sourceforge.net/cs-project/?rev=843&view=rev Author: crazedsanity Date: 2008-02-17 14:11:12 -0800 (Sun, 17 Feb 2008) Log Message: ----------- Revert last changes (go back to manually building list of options & setting their value/list of values). Modified Paths: -------------- trunk/1.2/includes/setup/4.inc trunk/1.2/templates/setup/4.content.tmpl Modified: trunk/1.2/includes/setup/4.inc =================================================================== --- trunk/1.2/includes/setup/4.inc 2008-02-17 21:57:13 UTC (rev 842) +++ trunk/1.2/includes/setup/4.inc 2008-02-17 22:11:12 UTC (rev 843) @@ -9,15 +9,15 @@ $defaultValues = array( 'isdevsite' => array(1, 'numeric', 0), 'proj_name' => array(10, 'sql', "CS-Project"), - 'project_url' => array(5, 'sql', $_SERVER['HTTP_HOST']), + 'project_url' => array(5, 'sql', $_SERVER['HTTP_HOST']), 'helpdesk_issue_announce_email' => array(7, 'email', "new...@yo..."), - 'max_time' => array(5, 'sql', "18 hours"), - 'max_idle' => array(5, 'sql', "2 hours"), - 'config_session_name' => array(9, 'alpha', "CS_PROJECT_SESSID"), - 'stop_logins_on_global_alert' => array(1, 'numeric', 1), + 'max_time' => array(5, 'sql', "18 hours"), + 'max_idle' => array(5, 'sql', "2 hours"), + 'config_session_name' => array(9, 'alpha', "CS_PROJECT_SESSID"), + 'stop_logins_on_global_alert' => array(1, 'numeric', 1), 'debugprintopt' => array(1, 'numeric', 0), 'debugremovehr' => array(1, 'numeric', 0), - 'workingonit' => array(1, 'numeric', 0) + 'workingonit' => array(1, 'numeric', 0) ); @@ -60,18 +60,15 @@ } } - $configObj = new config(); - $configObj->build_update_interface($page); + foreach($priorSetupData as $index=>$value) { + //check if it's a yes/no type thing. + if(is_numeric($defaultValues[$index])) { + $index .= "__". $value ."__checked"; + $value = "selected"; + } + $page->add_template_var($index, $value); + } - #foreach($priorSetupData as $index=>$value) { - # //check if it's a yes/no type thing. - # if(is_numeric($defaultValues[$index])) { - # $index .= "__". $value ."__checked"; - # $value = "selected"; - # } - # $page->add_template_var($index, $value); - #} - $page->add_template_var("currentUrl", $_SERVER['HTTP_HOST']); } @@ -96,9 +93,6 @@ $retval = __FUNCTION__ .": ". $index ." failed minimum length check after cleaning"; } } - elseif($index == 'workingonit') { - $goodValues++; - } else { $retval = __FUNCTION__ .": ". $index ." contains invalid data"; } Modified: trunk/1.2/templates/setup/4.content.tmpl =================================================================== --- trunk/1.2/templates/setup/4.content.tmpl 2008-02-17 21:57:13 UTC (rev 842) +++ trunk/1.2/templates/setup/4.content.tmpl 2008-02-17 22:11:12 UTC (rev 843) @@ -6,65 +6,110 @@ </p> - - <form method="POST" onSubmit="new Effect.DropOut('submitButton');"> -<a name="config" /> -<table border="1" cellpadding="3" cellspacing="0" width="80%"> -<tr> - <th colspan="2">Config Settings</th> -</tr> -<tr> - <td colspan="2" align="center"> - <div class="note" style="width:60em"><b>NOTE:</b> You should be <font color="red"><b>absolutely certain</b></font> of the - effects of the changes you make here. Changing an item to an incorrect value make render the - installation useless. To rectify a broken configuration, you would need to modify the - <b>/lib/config.xml</b> file manually.</div> - </td> -</tr> -<tr> - <th width="80%">Name/Description</th> - <th width="20%">Value/Select Option</th> -</tr> -<!-- BEGIN setting_text --> +<table border=1 cellpadding=3 cellspacing=0> <tr> + <th>Is Development Site?</th> <td> - <b>%%title%%</b> (%%index%%)<BR> - %%description%% + <SELECT name="fields[isdevsite]"> + <option value="0" {isdevsite__0__checked}>0 (False)</option> + <option value="1" {isdevsite__1__checked}>1 (True)</option> + </SELECT> </td> - - <td><input name="fields[%%index%%]" type="text" value="%%value%%" %%disabled%%></td> + <td>Whether it's a development site for cs-project or not... (TODO: add more info here)</td> </tr> -<!-- END setting_text --> -<!-- BEGIN setting_select --> + <tr> + <th>Project Name</th> + <td><input type="text" name="fields[proj_name]" value="{proj_name}" size="40"></td> + <td>Displayed name of the project (like "CS-Project")</td> + </tr> + + <tr> + <th>Project URL</th> + <td><input type="text" name="fields[project_url]" value="{project_url}" size="40"></td> + <td>Generally it's this website: ( <i>http://{currentUrl}</i> ).</td> + </tr> + + <tr> + <th nowrap>Helpdesk Issue Announce Email</th> + <td><input type="text" name="fields[helpdesk_issue_announce_email]" value="{helpdesk_issue_announce_email}" size="40"></td> + <td>This would be something like "<i>new...@yo...</i>"</td> + </tr> + + <tr> + <th nowrap>Mail Server IP</th> <td> - <b>%%title%%</b> (%%index%%)<BR> - %%description%% + <input type="text" name="fields[phpmailer_host]" value="{phpmailer_host}" size="40"> + <input type="HIDDEN" name="fields[phpmailer_method]" value="IsSMTP"> </td> - - <td> - <select name="fields[%%index%%]" %%disabled%%> - %%setting_select__normal%% - </select> + <td>This should be the IP of your mailserver, like <i>127.0.0.1</i>...</td> + </tr> + + + <tr> + <th>Maximum Session Length</th> + <td><input type="text" name="fields[max_time]" value="{max_time}" size="10"></td> + <td>This is how long any single session can be open before it's automatically removed from the server.</td> + </tr> + + <tr> + <th>Maximum Idleness</th> + <td><input type="text" name="fields[max_idle]" value="{max_idle}" size="10"></td> + <td>How long a session can be idle (no page views/activities) before it is removed.</td> + </tr> + + <tr> + <th>Session Name</th> + <td><input type="text" name="fields[config_session_name]" value="{config_session_name}" size="40"></td> + <td>Name of the session: really, this only matters if you have other websites running under the same + domain using PHP sessions, in which case this should be unique to avoid random annoying issues.</td> + </tr> + + + <tr> + <th>Stop Logins on Global Alert</th> + <td><SELECT name="fields[stop_logins_on_global_alert]"> + <option value="0" {stop_logins_on_global_alert__0__checked}>0 (off)</option> + <option value="1" {stop_logins_on_global_alert__1__checked}>1 (on)</option> + </SELECT></td> + <td>(<font color="red"><b>Currently unimplemented</b></font>) Stop users from logging in if a global alert has been created.</td> + </tr> + + + <tr> + <th>Debug Printing?</th> + <td><SELECT name="fields[debugprintopt]"> + <option value="0" {debugprintopt__0__checked}>0 (off)</option> + <option value="1" {debugprintopt__1__checked}>1 (on)</option> + </SELECT> </td> + <td>Generally, this should only be turned on if you're running a development site for cs-project...</td> </tr> -<!-- END setting_select --> -<!-- BEGIN setting_locked --> + + <tr> - <td> - <b>%%title%%</b> (%%index%%)<BR> - %%description%% + <th>Debug Print: Add "HR" Tag?</th> + <td><SELECT name="fields[debugremovehr]"> + <option value="0" {debugremovehr__0__checked}>0 (no separator)</option> + <option value="1" {debugremovehr__1__checked}>1 (add separator)</option> + </SELECT> </td> - - <td> - <!-- NOTE: should we even have hidden elements in the form? --> - <input type="text" name="fields[%%index%%]" value="%%value%%" disabled> - </td> + <td>This setting affects whether or not there are separators between debug_print()'s (useful to discover if there's a print occurring that is otherwise not visible)</td> </tr> -<!-- END setting_locked --> + + + <tr> + <th>Working On It?</th> + <td>0 (no)<input type="HIDDEN" name="fields[workingonit]" value="0"></td> + <td><font color="red"><b><blink>WARNING!</blink></b></font> Setting this to a non-zero value + will DISABLE all connections to the database, and make your site unuseable. It is provided as + a simple, fast way to stop connections to your database, usually for maintenance purposes. It + is displayed here for reference only.</td> + </tr> + <tr> <td colspan="3" align="center"><input id="submitButton" type="submit" value="Go to next step"><td> </tr> This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <cra...@us...> - 2008-02-17 22:44:54
|
Revision: 844 http://cs-project.svn.sourceforge.net/cs-project/?rev=844&view=rev Author: crazedsanity Date: 2008-02-17 14:44:48 -0800 (Sun, 17 Feb 2008) Log Message: ----------- Remove "stop_logins_on_global_alert" (unused). Modified Paths: -------------- trunk/1.2/docs/samples/sample_config.xml trunk/1.2/templates/setup/4.content.tmpl Modified: trunk/1.2/docs/samples/sample_config.xml =================================================================== --- trunk/1.2/docs/samples/sample_config.xml 2008-02-17 22:11:12 UTC (rev 843) +++ trunk/1.2/docs/samples/sample_config.xml 2008-02-17 22:44:48 UTC (rev 844) @@ -47,12 +47,6 @@ unless you really know what you're doing." type="locked" disabled="1">1.0.0-ALPHA1</version_string> - <stop_logins_on_global_alert - title="Stop Logins on Global Alert" - description="(<font color=red><b>Currently unimplemented</b></font>) Stop users from logging in if a global alert has been created." - type="select" - options="0=No (0)|1=Yes (1)" - default="0">0</stop_logins_on_global_alert> <debugprintopt title="Debug Printing?" description="Generally, this should only be turned on if you're running a development site for cs-project..." Modified: trunk/1.2/templates/setup/4.content.tmpl =================================================================== --- trunk/1.2/templates/setup/4.content.tmpl 2008-02-17 22:11:12 UTC (rev 843) +++ trunk/1.2/templates/setup/4.content.tmpl 2008-02-17 22:44:48 UTC (rev 844) @@ -68,16 +68,6 @@ <tr> - <th>Stop Logins on Global Alert</th> - <td><SELECT name="fields[stop_logins_on_global_alert]"> - <option value="0" {stop_logins_on_global_alert__0__checked}>0 (off)</option> - <option value="1" {stop_logins_on_global_alert__1__checked}>1 (on)</option> - </SELECT></td> - <td>(<font color="red"><b>Currently unimplemented</b></font>) Stop users from logging in if a global alert has been created.</td> - </tr> - - - <tr> <th>Debug Printing?</th> <td><SELECT name="fields[debugprintopt]"> <option value="0" {debugprintopt__0__checked}>0 (off)</option> This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <cra...@us...> - 2008-03-27 02:50:53
|
Revision: 854 http://cs-project.svn.sourceforge.net/cs-project/?rev=854&view=rev Author: crazedsanity Date: 2008-03-26 19:50:51 -0700 (Wed, 26 Mar 2008) Log Message: ----------- Use new CONFIG_FILE_LOCATION instead of hard-coding the config filename's location. Modified Paths: -------------- trunk/1.2/includes/setup.inc trunk/1.2/templates/content/settings/admin.content.tmpl trunk/1.2/upgrade/upgradeTo1.2.0-ALPHA3.php Modified: trunk/1.2/includes/setup.inc =================================================================== --- trunk/1.2/includes/setup.inc 2008-03-27 02:50:15 UTC (rev 853) +++ trunk/1.2/includes/setup.inc 2008-03-27 02:50:51 UTC (rev 854) @@ -9,7 +9,7 @@ * Repository Location: $HeadURL:https://cs-project.svn.sourceforge.net/svnroot/cs-project/trunk/includes/setup.inc $ * Last Updated:::::::: $Date:2007-11-20 11:04:59 -0600 (Tue, 20 Nov 2007) $ * - * TODO: check for the existence of the /lib/config.xml file + * TODO: check for the existence of the config file (CONFIG_FILE_LOCATION) * TODO: if the config.xml exists, check if the database connection works, and if we can get ANY version data: if so, give fatal message saying it won't work. * TODO: if step 2 is re-run, do something to reset the status/accessibility of the other steps. */ Modified: trunk/1.2/templates/content/settings/admin.content.tmpl =================================================================== --- trunk/1.2/templates/content/settings/admin.content.tmpl 2008-03-27 02:50:15 UTC (rev 853) +++ trunk/1.2/templates/content/settings/admin.content.tmpl 2008-03-27 02:50:51 UTC (rev 854) @@ -12,7 +12,7 @@ <div class="note" style="width:60em"><b>NOTE:</b> You should be <font color="red"><b>absolutely certain</b></font> of the effects of the changes you make here. Changing an item to an incorrect value make render the installation useless. To rectify a broken configuration, you would need to modify the - <b>/lib/config.xml</b> file manually.</div> + <b>{CONFIG_FILE_LOCATION}</b> file manually.</div> </td> </tr> <tr> Modified: trunk/1.2/upgrade/upgradeTo1.2.0-ALPHA3.php =================================================================== --- trunk/1.2/upgrade/upgradeTo1.2.0-ALPHA3.php 2008-03-27 02:50:15 UTC (rev 853) +++ trunk/1.2/upgrade/upgradeTo1.2.0-ALPHA3.php 2008-03-27 02:50:51 UTC (rev 854) @@ -39,14 +39,14 @@ public function update_config_file() { $fs = new cs_fileSystemClass(dirname(__FILE__) .'/../'); $sampleXmlObj = new XMLParser($fs->read('docs/samples/sample_config.xml')); - $siteXmlObj = new XMLParser($fs->read('lib/config.xml')); + $siteXmlObj = new XMLParser($fs->read(CONFIG_FILE_LOCATION)); $updateXml = new xmlCreator(); $updateXml->load_xmlparser_data($siteXmlObj); //BACKUP ORIGINAL XML CONFIG... - $backupFile = 'lib/__BACKUP__'. time() .'__config.xml'; + $backupFile = 'lib/__BACKUP__'. time() .'__'. CONFIG_FILENAME; $fs->create_file($backupFile); $fs->openFile($backupFile); $fs->write($updateXml->create_xml_string()); @@ -77,7 +77,7 @@ } $this->gfObj->debug_print($this->gfObj->cleanString($updateXml->create_xml_string(), 'htmlentity_plus_brackets')); - $fs->openFile('lib/config.xml'); + $fs->openFile(CONFIG_FILE_LOCATION); $fs->write($updateXml->create_xml_string()); }//end update_config_file() //========================================================================= This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <cra...@us...> - 2008-03-27 04:43:07
|
Revision: 856 http://cs-project.svn.sourceforge.net/cs-project/?rev=856&view=rev Author: crazedsanity Date: 2008-03-26 21:43:00 -0700 (Wed, 26 Mar 2008) Log Message: ----------- More thoughts on the upgrade, plus "rw" directory for reading & writing stuff. Modified Paths: -------------- trunk/1.2/upgrade/upgradeTo1.2.0-ALPHA4.php Added Paths: ----------- trunk/1.2/rw/ Property changes on: trunk/1.2/rw ___________________________________________________________________ Name: svn:ignore + *.xml Modified: trunk/1.2/upgrade/upgradeTo1.2.0-ALPHA4.php =================================================================== --- trunk/1.2/upgrade/upgradeTo1.2.0-ALPHA4.php 2008-03-27 04:34:34 UTC (rev 855) +++ trunk/1.2/upgrade/upgradeTo1.2.0-ALPHA4.php 2008-03-27 04:43:00 UTC (rev 856) @@ -41,57 +41,30 @@ $configFileContents = $fs->read(CONFIG_FILE_LOCATION); + //TODO: test that /rw is readable & writable + //TODO: write to new config file location + //TODO: delete old config file + /* - * PROBLEM: the config file MUST be readable in the specified location... - * once it is moved, the site config needs to be updated to point at the - * new location... we could throw an error here, explaining that the - * file needs to be moved manually, but if the user upgrades to the NEXT - * version, the system would believe that there's a problem because the - * config file would be MISSING (they'd have to go through setup all over - * again, even though they have an existing WORKING db)... + * PROBLEMS WITH MOVING THE CONFIG FILE: + * 1.) upgrades currently won't survive (through multiple version updates) + * if the config location changes, since it is statically set. * - * STEPS THAT NEED TO OCCUR::: - * 1.) move the config file to /rw/config.xml from /lib/config.xml - * 2.) ensure the site_config points to the CURRENT config file - * OPTIONS: - * a.) set "trigger" to look for old config when rw/config.xml - * is missing & do the proper change (must be set prior - * to the upgrade/setup system checks) - * ++ ALPHA3 -> ALPHA4 would work - * -- potentially breaks future upgrades - * -- bypasses upgrade system - * b.) scriptify direct modification of the site_config.php file - * so it points to the new location during this upgrade - * ++ ALPHA3 -> ALPHA4 would work - * ++ doesn't bypass upgrade system - * c.) drop all auto-upgrades prior to this one (ALPHA4), with - * moving the config file being the FIRST step, then run - * ALL other changes; it's an ALPHA, so things are - * expected to possibly be hairy. - * -- developers running pre-ALPHA4 will have problems - * ++ ALPHA3 -> ALPHA4 would work - * ++ doesn't bypass upgrade system - * 3.) systems upgrading from 1.1 must be able to do so automatically. + * 2.) upgrades from 1.1 MUST be able to work automatically. * - * PROBLEMS: - * 1.) setup MUST know where current config file is: if it is pointing - * to the NEW location and it exists in the OLD, setup will run; if it - * is pointing to the OLD location but it's in the NEW, setup will run. - * a.) if 1.2 (post-ALPHA4) always expects config to be in the new - * location, those caught in the mix can just manually move it - * to the new location - * b.) no reason to believe it would EVER point to the old location - * when there's one in the new location. + * 3.) upgrades MUST BE SURVIVABLE through multiple version changes (see #1) * + * SOLUTION: * + * TODO: add "trigger" to check for old config file; if old config exists, bypass setup & go to upgrade. * TODO: remove support for pre-alpha4 installs * TODO: consolidate pre-alpha4 changes into alpha4 upgrade * TODO: warn existing developers of changes and how to manually upgrade (update to r{x}, let setup run, update db + VERSION file) + * + * NOTE: while it might cause headaches for one or two developers, this + * minimizes pain for users upgrading from previous versions. Yay. */ - $this->gfObj->debug_print($this->gfObj->cleanString($updateXml->create_xml_string(), 'htmlentity_plus_brackets')); - $fs->openFile(CONFIG_FILE_LOCATION); - $fs->write($updateXml->create_xml_string()); }//end update_config_file() //========================================================================= } This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <cra...@us...> - 2008-03-30 06:25:44
|
Revision: 860 http://cs-project.svn.sourceforge.net/cs-project/?rev=860&view=rev Author: crazedsanity Date: 2008-03-29 23:25:40 -0700 (Sat, 29 Mar 2008) Log Message: ----------- Update setup to write proper config & remove setup config, give URL for user to go after setup, set constants & so forth properly. /includes/setup/5.inc: * when setting message, set linkURL as "/login" * __finalStep{}: -- __construct(): ++ use constant for config directory (instead of hard-coding lib). -- write_config(): ++ use constant for config filename instead of hard-coding. ++ use constant for config directory/config location... ++ update an error to be less misleading. ++ remove the setup config file. /lib/config.class.php: * get_config_contents(): -- ARG CHANGE: NEW ARG: #2 ($setConstants=FALSE) -- ARG CHANGE: NEW ARG: #3 ($setEverything=FALSE) -- set constants so getting config database parameters works properly. * remove_setup_config() [NEW]: -- method to destroy rw/setup.xml /lib/site_config.php: * call config::get_config_contents() with new arguments to set constants. Modified Paths: -------------- trunk/1.2/includes/setup/5.inc trunk/1.2/lib/config.class.php trunk/1.2/lib/site_config.php Modified: trunk/1.2/includes/setup/5.inc =================================================================== --- trunk/1.2/includes/setup/5.inc 2008-03-30 05:44:19 UTC (rev 859) +++ trunk/1.2/includes/setup/5.inc 2008-03-30 06:25:40 UTC (rev 860) @@ -11,8 +11,9 @@ $page->set_message_wrapper(array( 'title' => "Reloaded... ", - 'message' => "Result of writing the config file:<BR>\n". $writeConfigResult, - 'type' => "status" + 'message' => $writeConfigResult, + 'type' => "status", + 'linkURL' => '/login' )); $page->conditional_header("/setup/5", TRUE); } @@ -50,7 +51,7 @@ unset($this->stepData[5]); $this->gfObj = new cs_globalFunctions; - $this->fsObj = new cs_fileSystemClass(dirname(__FILE__) ."/../../lib"); + $this->fsObj = new cs_fileSystemClass(dirname(__FILE__) ."/../../". CONFIG_DIRECTORY); }//end __construct() //========================================================================= @@ -60,7 +61,7 @@ function write_config() { if($this->fsObj->is_writable(NULL)) { $lsData = $this->fsObj->ls(); - if(!is_array($lsData['config.xml'])) { + if(!is_array($lsData[CONFIG_FILENAME])) { $myData = array(); foreach($this->stepData as $stepNum=>$garbage) { $tempStepData = get_setup_data($stepNum, 'data'); @@ -86,8 +87,8 @@ //now, create an XML string... $xmlString = $xmlCreator->create_xml_string(); - $this->fsObj->create_file('config.xml', TRUE); - $writeRes = $this->fsObj->write($xmlString, 'config.xml'); + $this->fsObj->create_file(CONFIG_FILENAME, TRUE); + $writeRes = $this->fsObj->write($xmlString, CONFIG_FILENAME); if($writeRes > 0) { $retval = "Successfully created the XML config file"; @@ -99,13 +100,16 @@ } } else { - throw new exception(__METHOD__ .": config.xml already exists!"); + throw new exception(__METHOD__ .": ". CONFIG_FILE_LOCATION ." already exists!"); } } else { - throw new exception(__METHOD__ .": the lib directory is not writable!"); + throw new exception(__METHOD__ .": the config directory is not writable!"); } + $configObj = new config(CONFIG_FILE_LOCATION); + $configObj->remove_setup_config(); + return($retval); }//end write_config() //========================================================================= Modified: trunk/1.2/lib/config.class.php =================================================================== --- trunk/1.2/lib/config.class.php 2008-03-30 05:44:19 UTC (rev 859) +++ trunk/1.2/lib/config.class.php 2008-03-30 06:25:40 UTC (rev 860) @@ -43,7 +43,7 @@ /** * Get the contents of the config file. */ - public function get_config_contents($simple=TRUE) { + public function get_config_contents($simple=TRUE, $setConstants=FALSE, $setEverything=FALSE) { if($this->fileExists) { $xmlString = $this->fs->read($this->fileName); @@ -58,6 +58,26 @@ $config = $xmlParser->get_path('/CONFIG'); unset($config['type'], $config['attributes']); } + + if($setConstants) { + $myConfig = $config; + if(!$simple) { + $myConfig = $xmlParser->get_tree(TRUE); + $myConfig = $myConfig['CONFIG']; + } + $conditionallySet = array('VERSION_STRING', 'WORKINGONIT'); + foreach($myConfig as $index=>$value) { + if(in_array($index, $conditionallySet)) { + //only set this part if we're told to. + if($setEverything) { + define($index, $value); + } + } + else { + define($index, $value); + } + } + } } else { $config = NULL; @@ -270,5 +290,13 @@ return($this->siteStatus); }//end get_site_status() //------------------------------------------------------------------------- + + + + //------------------------------------------------------------------------- + public function remove_setup_config() { + return($this->fs->rm(SETUP_FILE_LOCATION)); + }//end remove_setup_config() + //------------------------------------------------------------------------- }//end config{} ?> \ No newline at end of file Modified: trunk/1.2/lib/site_config.php =================================================================== --- trunk/1.2/lib/site_config.php 2008-03-30 05:44:19 UTC (rev 859) +++ trunk/1.2/lib/site_config.php 2008-03-30 06:25:40 UTC (rev 860) @@ -85,6 +85,9 @@ if($configObj->is_setup_required()) { $configObj->do_setup_redirect(); } + else { + $configObj->get_config_contents(NULL,TRUE,TRUE); + } } else { //tell 'em what the site's status is. This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <cra...@us...> - 2008-03-31 01:56:57
|
Revision: 866 http://cs-project.svn.sourceforge.net/cs-project/?rev=866&view=rev Author: crazedsanity Date: 2008-03-30 18:56:53 -0700 (Sun, 30 Mar 2008) Log Message: ----------- Modify BBCode & email template to show issue ancestry. FIXES ISSUE::: #146: Email notice -- display ancestry /templates/email/helpdesk-remark.tmpl: -- change template var from {name} to "[helpdesk_id={public_id}]" so it can be parsed by the BBCode parser. /lib/bbCodeParser.class.php: * get_helpdesk_bbcode(): -- adds linkage to parent project if one is set. Modified Paths: -------------- trunk/1.2/lib/bbCodeParser.class.php trunk/1.2/templates/email/helpdesk-remark.tmpl Modified: trunk/1.2/lib/bbCodeParser.class.php =================================================================== --- trunk/1.2/lib/bbCodeParser.class.php 2008-03-31 00:54:12 UTC (rev 865) +++ trunk/1.2/lib/bbCodeParser.class.php 2008-03-31 01:56:53 UTC (rev 866) @@ -69,8 +69,18 @@ $retval = '[helpdesk_id='. $helpdeskId .']'; if(is_numeric($helpdeskId)) { try { - $data = $this->helpdeskObj->get_record($helpdeskId); - $retval = '[<a href="http://'. PROJECT_URL .'/content/helpdesk/view?ID='. $helpdeskId .'">'. $data['name'] .'</a>]'; + $data = $this->helpdeskObj->get_record($helpdeskId); + $displayName = $data['name']; + + //add project linkage if there is any... + if($data['ancestry_level'] > 1) { + //pull the ancestry string. + $parentRecord = $this->projectObj->get_parent_record($data['ancestry']); + $x = $this->projectObj->get_ancestry_link_list($parentRecord['public_id'], TRUE, TRUE, TRUE); + $displayName = $x .' / <b>'. $displayName ."</b>"; + } + + $retval = '[<a href="http://'. PROJECT_URL .'/content/helpdesk/view?ID='. $helpdeskId .'">'. $displayName .'</a>]'; } catch(exception $e) { debug_print($e->getMessage); Modified: trunk/1.2/templates/email/helpdesk-remark.tmpl =================================================================== --- trunk/1.2/templates/email/helpdesk-remark.tmpl 2008-03-31 00:54:12 UTC (rev 865) +++ trunk/1.2/templates/email/helpdesk-remark.tmpl 2008-03-31 01:56:53 UTC (rev 866) @@ -12,7 +12,7 @@ </tr> <tr> <th>Name of Issue:</th> - <td><pre>{name}</pre></td> + <td><pre>[helpdesk_id={public_id}]</pre></td> </tr> <tr> <th>Submitted by:</th> This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <cra...@us...> - 2008-04-09 03:57:23
|
Revision: 877 http://cs-project.svn.sourceforge.net/cs-project/?rev=877&view=rev Author: crazedsanity Date: 2008-04-08 20:57:22 -0700 (Tue, 08 Apr 2008) Log Message: ----------- More renaming of "todo" to "task" (issue #151) Modified Paths: -------------- trunk/1.2/lib/helpdeskClass.php trunk/1.2/lib/site_config.php trunk/1.2/templates/content/helpdesk/view.content.tmpl trunk/1.2/templates/content/project/view/index.content.tmpl Added Paths: ----------- trunk/1.2/templates/content/related_task.shared.tmpl Removed Paths: ------------- trunk/1.2/templates/content/related_todo.shared.tmpl Modified: trunk/1.2/lib/helpdeskClass.php =================================================================== --- trunk/1.2/lib/helpdeskClass.php 2008-04-09 03:56:56 UTC (rev 876) +++ trunk/1.2/lib/helpdeskClass.php 2008-04-09 03:57:22 UTC (rev 877) @@ -457,38 +457,38 @@ //========================================================================= - function get_todos($helpdeskId) { + function get_tasks($helpdeskId) { $retval = 0; $prefObj = new pref($this->db, $_SESSION['uid']); - $todoDisplayPref = $prefObj->get_pref_value_by_name('projectDetails_todoDisplayOnlyMine'); + $taskDisplayPref = $prefObj->get_pref_value_by_name('projectDetails_taskDisplayOnlyMine'); - $todoObj = new todoClass($this->db); + $taskObj = new taskClass($this->db); - //attempt to get a list of the todos... + //attempt to get a list of the tasks... //TODO: change this reference to "publicId" instead of "projectId" - $todoObj->projectId = $helpdeskId; + $taskObj->projectId = $helpdeskId; $critArr = array("record_id"=>$this->get_parent_from_ancestry($this->get_ancestry($helpdeskId,TRUE),0)); $contactCrit = NULL; - if($todoDisplayPref != 'all') { - if($todoDisplayPref == 'mine') { + if($taskDisplayPref != 'all') { + if($taskDisplayPref == 'mine') { $contactCrit = array( 't.creator_contact_id' => $_SESSION['contact_id'], 't.assigned_contact_id' => $_SESSION['contact_id'] ); } - elseif($todoDisplayPref == 'assigned') { + elseif($taskDisplayPref == 'assigned') { $contactCrit = array( 't.assigned_contact_id' => $_SESSION['contact_id'] ); } } - $retval = $todoObj->get_todos($critArr, NULL, $contactCrit); + $retval = $taskObj->get_tasks($critArr, NULL, $contactCrit); return($retval); - }//end get_todos() + }//end get_tasks() //========================================================================= Modified: trunk/1.2/lib/site_config.php =================================================================== --- trunk/1.2/lib/site_config.php 2008-04-09 03:56:56 UTC (rev 876) +++ trunk/1.2/lib/site_config.php 2008-04-09 03:57:22 UTC (rev 877) @@ -127,7 +127,7 @@ define('SEQ_HELPDESK', 'special__helpdesk_public_id_seq'); define('SEQ_PROJECT', 'special__project_public_id_seq'); define('SEQ_MAIN', 'record_table_record_id_seq'); -define('TABLE_TODOCOMMENT', 'todo_comment_table'); +define('TABLE_TODOCOMMENT', 'task_comment_table'); define('FORMAT_WORDWRAP', 90); //========================================================================= Modified: trunk/1.2/templates/content/helpdesk/view.content.tmpl =================================================================== --- trunk/1.2/templates/content/helpdesk/view.content.tmpl 2008-04-09 03:56:56 UTC (rev 876) +++ trunk/1.2/templates/content/helpdesk/view.content.tmpl 2008-04-09 03:57:22 UTC (rev 877) @@ -190,7 +190,7 @@ <th>Todos:</th> <td> - <div id="related_todo">{related_todo}</div> + <div id="related_task">{related_task}</div> </td> </tr> <tr> Modified: trunk/1.2/templates/content/project/view/index.content.tmpl =================================================================== --- trunk/1.2/templates/content/project/view/index.content.tmpl 2008-04-09 03:56:56 UTC (rev 876) +++ trunk/1.2/templates/content/project/view/index.content.tmpl 2008-04-09 03:57:22 UTC (rev 877) @@ -119,7 +119,7 @@ </tr> <tr> <td width="50%"> - <div id="related_todo" width="100%">{related_todo}</div> + <div id="related_task" width="100%">{related_task}</div> <div id="related_note" style="padding-top:1em;">{related_note}</div> </td> Copied: trunk/1.2/templates/content/related_task.shared.tmpl (from rev 875, trunk/1.2/templates/content/related_todo.shared.tmpl) =================================================================== --- trunk/1.2/templates/content/related_task.shared.tmpl (rev 0) +++ trunk/1.2/templates/content/related_task.shared.tmpl 2008-04-09 03:57:22 UTC (rev 877) @@ -0,0 +1,39 @@ +<table cellpadding="2" cellspacing="0" border="1"> +<tr> + <td colspan="8"> + <b>Related Tasks: </b> + (<a href='/content/task/create?parentPublicId={public_id}&module={module}' target=_top>Create</a>): + <a href="/help/task" target="_blank"> + <img src="/images/icon-help.png" border="0"></a> +<!-- BEGIN taskPrefWarning --> + <BR><font color="red"><b>Warning:</b></font> Not all issues will be displayed, due to your <a href="/content/settings">preferences</a>. +<!-- END taskPrefWarning --> + </td> +</tr> +<tr> + <th>Pri</th> + <th>Creator</th> + <th>Assigned</th> + <th>%</th> + <th>Status</th> + <th>Title</th> + <th>Deadline</th> + <th>Hours Left</th> +</tr> + +<!-- BEGIN related_task_row --> +<tr style="background-color: %%bgColor%%;" onmouseover="this.style.backgroundColor = '#ffffff'" + onmouseout="this.style.backgroundColor = '%%bgColor2%%'" onclick="location.href = '/content/task/view?ID=%%id%%'"> + <td><font style="font-weight:%%font_weight%%;">%%priority%%</font></td> + <td><font style="font-weight:%%font_weight%%;">%%creator%%</font></td> + <td><font style="font-weight:%%font_weight%%;">%%assigned_user%%</font></td> + <td align="right"><font style="font-weight:%%font_weight%%;">%%progress%%%</font></td> + <td nowrap align="center">(%%status_text%%)</td> + <td><a href="/content/task/view?ID=%%id%%" target="_top" style="font-weight:%%font_weight%%;"> + %%name%%</a></td> + <td>%%deadline%%</td> + <td><b>%%hours_remaining%%</b> (%%estimate_current%%) </td> + +</tr> +<!-- END related_task_row --> +</table> \ No newline at end of file Deleted: trunk/1.2/templates/content/related_todo.shared.tmpl =================================================================== --- trunk/1.2/templates/content/related_todo.shared.tmpl 2008-04-09 03:56:56 UTC (rev 876) +++ trunk/1.2/templates/content/related_todo.shared.tmpl 2008-04-09 03:57:22 UTC (rev 877) @@ -1,39 +0,0 @@ -<table cellpadding="2" cellspacing="0" border="1"> -<tr> - <td colspan="8"> - <b>Related Tasks: </b> - (<a href='/content/todo/create?parentPublicId={public_id}&module={module}' target=_top>Create</a>): - <a href="/help/task" target="_blank"> - <img src="/images/icon-help.png" border="0"></a> -<!-- BEGIN todoPrefWarning --> - <BR><font color="red"><b>Warning:</b></font> Not all issues will be displayed, due to your <a href="/content/settings">preferences</a>. -<!-- END todoPrefWarning --> - </td> -</tr> -<tr> - <th>Pri</th> - <th>Creator</th> - <th>Assigned</th> - <th>%</th> - <th>Status</th> - <th>Title</th> - <th>Deadline</th> - <th>Hours Left</th> -</tr> - -<!-- BEGIN related_todo_row --> -<tr style="background-color: %%bgColor%%;" onmouseover="this.style.backgroundColor = '#ffffff'" - onmouseout="this.style.backgroundColor = '%%bgColor2%%'" onclick="location.href = '/content/todo/view?ID=%%id%%'"> - <td><font style="font-weight:%%font_weight%%;">%%priority%%</font></td> - <td><font style="font-weight:%%font_weight%%;">%%creator%%</font></td> - <td><font style="font-weight:%%font_weight%%;">%%assigned_user%%</font></td> - <td align="right"><font style="font-weight:%%font_weight%%;">%%progress%%%</font></td> - <td nowrap align="center">(%%status_text%%)</td> - <td><a href="/content/todo/view?ID=%%id%%" target="_top" style="font-weight:%%font_weight%%;"> - %%name%%</a></td> - <td>%%deadline%%</td> - <td><b>%%hours_remaining%%</b> (%%estimate_current%%) </td> - -</tr> -<!-- END related_todo_row --> -</table> \ No newline at end of file This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <cra...@us...> - 2008-04-09 05:08:22
|
Revision: 878 http://cs-project.svn.sourceforge.net/cs-project/?rev=878&view=rev Author: crazedsanity Date: 2008-04-08 22:08:16 -0700 (Tue, 08 Apr 2008) Log Message: ----------- Upgrade scripts + fixes to upgrade system to allow for protected setup & such... Modified Paths: -------------- trunk/1.2/lib/config.class.php trunk/1.2/lib/site_config.php trunk/1.2/lib/upgradeClass.php trunk/1.2/upgrade/upgradeTo1.2.0-ALPHA4.php Added Paths: ----------- trunk/1.2/docs/sql/upgrades/upgradeTo1.2.0-ALPHA4.sql Copied: trunk/1.2/docs/sql/upgrades/upgradeTo1.2.0-ALPHA4.sql (from rev 877, trunk/1.2/docs/sql/upgrades/upgradeTo1.2.0-ALPHA2.sql) =================================================================== --- trunk/1.2/docs/sql/upgrades/upgradeTo1.2.0-ALPHA4.sql (rev 0) +++ trunk/1.2/docs/sql/upgrades/upgradeTo1.2.0-ALPHA4.sql 2008-04-09 05:08:16 UTC (rev 878) @@ -0,0 +1,67 @@ +-- +-- SVN INFORMATION::: +-- +-- SVN Signature::::::::: $Id$ +-- Last Committted Date:: $Date$ +-- Last Committed Path::: $HeadURL$ +-- + + + + + + +CREATE TABLE task_table ( + task_id serial NOT NULL PRIMARY KEY, + creator_contact_id integer NOT NULL REFERENCES contact_table(contact_id), + name text NOT NULL, + body text NOT NULL, + assigned_contact_id integer REFERENCES contact_table(contact_id), + created timestamp with time zone DEFAULT ('now'::text)::date NOT NULL, + updated timestamp with time zone, + deadline date, + started date, + status_id integer DEFAULT 0 NOT NULL REFERENCES status_table(status_id), + priority smallint DEFAULT 50 NOT NULL, + progress numeric DEFAULT 0 NOT NULL, + record_id integer NOT NULL REFERENCES record_table(record_id), + estimate_original numeric(10,2) DEFAULT 1 NOT NULL, + estimate_current numeric(10,2) DEFAULT 1 NOT NULL, + estimate_elapsed numeric(10,2) DEFAULT 0 NOT NULL +); + +-- Populate the table with existing todo data. + + +INSERT INTO task_table (task_id, creator_contact_id, name, body, assigned_contact_id, created, updated, deadline, started, status_id, priority, progress, record_id, estimate_original, estimate_current, estimate_elapsed) (SELECT todo_id, creator_contact_id, name, body, assigned_contact_id, created, updated, deadline, started, status_id, priority, progress, record_id, estimate_original, estimate_current, estimate_elapsed FROM todo_table); + + + + +CREATE TABLE task_comment_table ( + task_comment_id serial NOT NULL PRIMARY KEY, + task_id integer NOT NULL, + creator_contact_id integer NOT NULL REFERENCES contact_table(contact_id), + created timestamp with time zone DEFAULT now() NOT NULL, + updated timestamp with time zone, + subject text DEFAULT 'Comment'::text NOT NULL, + body text NOT NULL +); + +--Copy data into the table. +INSERT INTO task_comment_table (task_comment_id, task_id, creator_contact_id, created, updated, subject, body) (SELECT todo_comment_id, todo_id, creator_contact_id, created, updated, subject, body FROM todo_comment_table); + + + + +-- Fix foreign keys and such. +ALTER TABLE log_estimate_table RENAME todo_id TO task_id; +ALTER TABLE log_estimate_table DROP CONSTRAINT "log_estiate_table_todo_id_fkey"; +ALTER TABLE ONLY log_estimate_table ADD CONSTRAINT log_estimate_table_task_id_fkey FOREIGN KEY (task_id) REFERENCES task_table(task_id); + + + +-- GET RID OF THE OLD TABLES... +DROP TABLE todo_comment_table; +DROP TABLE todo_table; + Modified: trunk/1.2/lib/config.class.php =================================================================== --- trunk/1.2/lib/config.class.php 2008-04-09 03:57:22 UTC (rev 877) +++ trunk/1.2/lib/config.class.php 2008-04-09 05:08:16 UTC (rev 878) @@ -22,6 +22,9 @@ if(!is_null($fileName) && strlen($fileName)) { $this->fileName = $fileName; } + else { + $this->fileName = CONFIG_FILE_LOCATION; + } if(!file_exists($this->fileName)) { $this->fileExists = FALSE; Modified: trunk/1.2/lib/site_config.php =================================================================== --- trunk/1.2/lib/site_config.php 2008-04-09 03:57:22 UTC (rev 877) +++ trunk/1.2/lib/site_config.php 2008-04-09 05:08:16 UTC (rev 878) @@ -86,6 +86,17 @@ $configObj->do_setup_redirect(); } else { + //don't panic: we're going to check for upgrades, but this doesn't + // necessarily mean anything will ACTUALLY be upgraded. + $configObj->get_config_contents(NULL,TRUE,FALSE); + $upgrade = new upgrade; + if($upgrade->upgrade_in_progress()) { + throw new exception("Upgrade in progress... reload the page after a few minutes and it should be complete. :) "); + } + else { + $upgrade->check_versions(); + } + #read_config_file(TRUE); $configObj->get_config_contents(NULL,TRUE,TRUE); } } Modified: trunk/1.2/lib/upgradeClass.php =================================================================== --- trunk/1.2/lib/upgradeClass.php 2008-04-09 03:57:22 UTC (rev 877) +++ trunk/1.2/lib/upgradeClass.php 2008-04-09 05:08:16 UTC (rev 878) @@ -791,7 +791,7 @@ } } - $this->gfObj->debug_print(__METHOD__ .": ('". $version ."', '". $checkIfHigher ."') retval=(". $retval .")"); + $this->gfObj->debug_print(__METHOD__ .": ('". $version ."', '". $checkIfHigher ."') retval=(". $retval .")", 1); return($retval); Modified: trunk/1.2/upgrade/upgradeTo1.2.0-ALPHA4.php =================================================================== --- trunk/1.2/upgrade/upgradeTo1.2.0-ALPHA4.php 2008-04-09 03:57:22 UTC (rev 877) +++ trunk/1.2/upgrade/upgradeTo1.2.0-ALPHA4.php 2008-04-09 05:08:16 UTC (rev 878) @@ -48,6 +48,16 @@ $details = "Executed SQL file, '". $this->lastSQLFile ."'. Encoded contents::: ". base64_encode($this->fsObj->read($this->lastSQLFile)); $this->logsObj->log_by_class($details, 'system'); + + + + $this->gfObj->debug_print(__METHOD__ .": running SQL file..."); + $this->run_sql_file(dirname(__FILE__) .'/../docs/sql/upgrades/upgradeTo1.2.0-ALPHA4.sql'); + + $details = "Executed SQL file, '". $this->lastSQLFile ."'. Encoded contents::: ". + base64_encode($this->fsObj->read($this->lastSQLFile)); + $this->logsObj->log_by_class($details, 'system'); + }//end run_schema_changes() //========================================================================= This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <cra...@us...> - 2008-05-01 00:53:37
|
Revision: 883 http://cs-project.svn.sourceforge.net/cs-project/?rev=883&view=rev Author: crazedsanity Date: 2008-04-30 17:53:33 -0700 (Wed, 30 Apr 2008) Log Message: ----------- Fixed issue #172 ("Initial Upgrade to v1.2 Fails to Copy Config File") /lib/config.class.php: * do_setup_redirect(): -- more debug information. * check_site_status(): -- when moving file, set some internal vars and re-read the config. -- the initial move preempts all other checks: if it runs, they don't. /includes/setup.inc: * updated message to NOT point to the settings/admin tab. Modified Paths: -------------- trunk/1.2/includes/setup.inc trunk/1.2/lib/config.class.php Modified: trunk/1.2/includes/setup.inc =================================================================== --- trunk/1.2/includes/setup.inc 2008-04-29 15:34:18 UTC (rev 882) +++ trunk/1.2/includes/setup.inc 2008-05-01 00:53:33 UTC (rev 883) @@ -26,10 +26,7 @@ //setup already complete. Stop 'em. $page->set_message_wrapper(array( 'title' => "Setup Unavailable", - 'message' => "It appears that CS-Project has already been installed. Please use " . - "the administrative section of the <a href=\"/content/settings\">Settings " . - "Tab</a> to make changes to your configuration (<i><b>NOTE:</b> you must be " . - "an admin to be able to see administrative options</i>).", + 'message' => "It appears that CS-Project has already been installed.", 'type' => "error" )); $page->conditional_header('/login.php'); Modified: trunk/1.2/lib/config.class.php =================================================================== --- trunk/1.2/lib/config.class.php 2008-04-29 15:34:18 UTC (rev 882) +++ trunk/1.2/lib/config.class.php 2008-05-01 00:53:33 UTC (rev 883) @@ -125,7 +125,8 @@ public function do_setup_redirect() { if($this->check_site_status() && $this->setupRequired) { if(!($_SERVER['SCRIPT_NAME'] == '/setup')) { - $this->gf->debug_print("script_name check=(". ($_SERVER['script_name'] != '/setup') .")", 1); + $this->gf->debug_print(__METHOD__ .": script_name check=(". ($_SERVER['script_name'] != '/setup') .")," . + " check_site_status=(". $this->check_site_status() ."), setupRequired=(". $this->setupRequired .")", 1); $goHere = '/setup'; if(strlen($_SERVER['REQUEST_URI']) > 1 && !isset($_SESSION['setup__viewed'])) { $goHere .= '?from='. urlencode($_SERVER['REQUEST_URI']); @@ -168,14 +169,22 @@ */ if(file_exists(OLD_CONFIG_FILE_LOCATION)) { //copy old file to new location... - if(!$this->fs->copy_file(OLD_CONFIG_FILE_LOCATION, CONFIG_FILE_LOCATION)) { - throw new exception(__METHOD__ .": failed to copy existing config into new location"); + $fs = new cs_fileSystemClass(dirname(__FILE__) .'/../'); + $moveRes = $fs->move_file(OLD_CONFIG_FILE_LOCATION, CONFIG_FILE_LOCATION); + if(!$moveRes) { + throw new exception(__METHOD__ .": failed to move existing config into new location (". $moveRes .")"); } - $this->fs->rm(OLD_CONFIG_FILE_LOCATION); + + //set some parameters. + $this->siteStatus = 'Old config file moved... '; + $this->setupRequired = FALSE; + $retval = TRUE; + + //set a parameter so get_config_contents() works, then read config parameters (like in __construct()). + $this->fileExists=TRUE; + $this->config = $this->get_config_contents(TRUE); } - - - if($this->setup_config_exists()) { + elseif($this->setup_config_exists()) { if($this->setup_config_exists(TRUE)) { //the currently logged-in user is actually running the setup, no worries. $this->siteStatus = 'You are running setup... please continue.'; This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <cra...@us...> - 2008-05-02 04:25:53
|
Revision: 884 http://cs-project.svn.sourceforge.net/cs-project/?rev=884&view=rev Author: crazedsanity Date: 2008-05-01 21:25:50 -0700 (Thu, 01 May 2008) Log Message: ----------- *** Release 1.2.0-ALPHA5 *** SUMMARY OF CHANGES::: * fix issue #172 (Initial Upgrade to v1.2 Fails to Copy Config File) * upgrade to cs-content v0.10.11 (also for issue #172) * some work on issue #166 (Automatic Setup System) Modified Paths: -------------- trunk/1.2/VERSION trunk/1.2/lib/globalFunctions.php Modified: trunk/1.2/VERSION =================================================================== --- trunk/1.2/VERSION 2008-05-01 00:53:33 UTC (rev 883) +++ trunk/1.2/VERSION 2008-05-02 04:25:50 UTC (rev 884) @@ -1,4 +1,4 @@ $Id:VERSION 628 2007-11-20 16:58:45Z crazedsanity $ -VERSION: 1.2.0-ALPHA4 +VERSION: 1.2.0-ALPHA5 $HeadURL:https://cs-project.svn.sourceforge.net/svnroot/cs-project/trunk/VERSION $ Modified: trunk/1.2/lib/globalFunctions.php =================================================================== --- trunk/1.2/lib/globalFunctions.php 2008-05-01 00:53:33 UTC (rev 883) +++ trunk/1.2/lib/globalFunctions.php 2008-05-02 04:25:50 UTC (rev 884) @@ -17,7 +17,7 @@ function get_required_external_lib_versions($projectName=NULL) { //format: {className} => array({projectName} => {exactVersion}) $requirements = array( - 'contentSystem' => array('cs-content', '0.10.10'), + 'contentSystem' => array('cs-content', '0.10.11'), 'XMLParser' => array('cs-phpxml', '0.5.6'), 'arrayToPath' => array('cs-arrayToPath', '0.2.2') ); This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <cra...@us...> - 2008-05-02 04:45:17
|
Revision: 885 http://cs-project.svn.sourceforge.net/cs-project/?rev=885&view=rev Author: crazedsanity Date: 2008-05-01 21:45:07 -0700 (Thu, 01 May 2008) Log Message: ----------- Minor changes to rename "Todo" to "Task". Modified Paths: -------------- trunk/1.2/includes/content/task.inc trunk/1.2/includes/setup/3.inc trunk/1.2/lib/taskClass.php trunk/1.2/templates/content/helpdesk/view.content.tmpl Modified: trunk/1.2/includes/content/task.inc =================================================================== --- trunk/1.2/includes/content/task.inc 2008-05-02 04:25:50 UTC (rev 884) +++ trunk/1.2/includes/content/task.inc 2008-05-02 04:45:07 UTC (rev 885) @@ -73,14 +73,14 @@ if($action == "create" && $retval > 0) { set_message_wrapper(array( "title" => "Creation Successful", - "message" => "Todo #$retval was created successfully.", + "message" => "Task #$retval was created successfully.", "type" => "notice" )); } elseif($retval == 1) { set_message_wrapper(array( "title" => "Update Successful", - "message" => "Todo was updated successfully.", + "message" => "Task was updated successfully.", "type" => "notice" )); } @@ -120,7 +120,7 @@ } //update the title. - create_page_title($page, array('title' => "Create New Todo")); + create_page_title($page, array('title' => "Create New Task")); //show the proper drop-downs. $page->add_template_var("user_assign_list", $proj->create_user_option_list()); @@ -143,7 +143,7 @@ $taskDetails = $proj->taskObj->get_task($taskId); //set the page's title. - create_page_title($page, array('title' => "Todo #". $taskId .": \"". $taskDetails['name'] ."\"")); + create_page_title($page, array('title' => "Task #". $taskId .": \"". $taskDetails['name'] ."\"")); //format the body, so long sentences fit properly. Modified: trunk/1.2/includes/setup/3.inc =================================================================== --- trunk/1.2/includes/setup/3.inc 2008-05-02 04:25:50 UTC (rev 884) +++ trunk/1.2/includes/setup/3.inc 2008-05-02 04:45:07 UTC (rev 885) @@ -7,7 +7,7 @@ if($_POST) { $validSubmission = test_submitted_data($page, $_POST['users']); - if($validSubmission === TRUE) { + if($validSubmission === TRUE) { $obj = new __setupDefaultValues(); store_setup_data(3, $obj->go(), 'text'); $obj->finish($page); @@ -347,7 +347,7 @@ 4 => 'General', 5 => 'Project', 6 => 'Helpdesk', - 7 => 'Todo', + 7 => 'Task', 8 => 'Tags', 9 => 'Estimates', 10 => 'Navigation', @@ -395,12 +395,12 @@ 7 => array(2, 6, 'Helpdesk: Information'), 8 => array(1, 6, 'Helpdesk: ERROR'), 9 => array(6, 6, 'Helpdesk: Report'), - 10 => array(3, 7, 'Todo: created record'), - 11 => array(5, 7, 'Todo: deleted record'), - 12 => array(4, 7, 'Todo: updated record'), + 10 => array(3, 7, 'Task: created record'), + 11 => array(5, 7, 'Task: deleted record'), + 12 => array(4, 7, 'Task: updated record'), 13 => array(1, 1, 'Database Error'), 14 => array(6, 5, 'Project: Activity Report'), - 15 => array(6, 7, 'Todo: Activity Report'), + 15 => array(6, 7, 'Task: Activity Report'), 16 => array(3, 2, 'User logged-in'), 17 => array(5, 2, 'User logged-out'), 18 => array(6, 2, 'Login/Logout Report'), @@ -414,7 +414,7 @@ 26 => array(1, 9, 'Error: Estimates'), 27 => array(2, 5, 'Information: Project'), 28 => array(4, 3, 'Update: Users'), - 29 => array(1, 7, 'Error: Todo'), + 29 => array(1, 7, 'Error: Task'), 30 => array(3, 3, 'Create: Users') ); @@ -476,7 +476,7 @@ // {record_type_id} => array({name}, {module}) $recordTypes = array( 1 => array('Project', 'project'), - 2 => array('Todo', 'task'), + 2 => array('Task', 'task'), 3 => array('Helpdesk', 'helpdesk') ); @@ -822,7 +822,7 @@ 1 => array('startModule', 'helpdesk', 'Starting on Module', 'Defines which section will be loaded upon login if nothing was selected.'), 5 => array('sorting_helpdesk', 'public_id|DESC', 'Helpdesk Sorting', 'Define the type of sorting for the helpdesk page.'), 6 => array('sorting_project', 'priority|ASC', 'Project Sorting', 'Define the type of sorting for the helpdesk page.'), - 7 => array('projectDetails_taskDisplayOnlyMine', 'all', 'Project Details: Todo display', 'Define what tasks are displayed on a project\'s details page.'), + 7 => array('projectDetails_taskDisplayOnlyMine', 'all', 'Project Details: Task display', 'Define what tasks are displayed on a project\'s details page.'), 8 => array('projectDetails_showCompletedIssues', '1', 'Project Details: Display completed issues', 'Should completed issues display in the details of a project?') ); Modified: trunk/1.2/lib/taskClass.php =================================================================== --- trunk/1.2/lib/taskClass.php 2008-05-02 04:25:50 UTC (rev 884) +++ trunk/1.2/lib/taskClass.php 2008-05-02 04:45:07 UTC (rev 885) @@ -38,7 +38,7 @@ } //create the logging object. - $this->logsObj = new logsClass($this->db, 'Todo'); + $this->logsObj = new logsClass($this->db, 'Task'); }//end taskClass() //================================================================================================ Modified: trunk/1.2/templates/content/helpdesk/view.content.tmpl =================================================================== --- trunk/1.2/templates/content/helpdesk/view.content.tmpl 2008-05-02 04:25:50 UTC (rev 884) +++ trunk/1.2/templates/content/helpdesk/view.content.tmpl 2008-05-02 04:45:07 UTC (rev 885) @@ -187,7 +187,7 @@ <td style="border-bottom:solid #000 1px;" width="650" colspan="2" nowrap><code>{subject}</code></td> </tr> <tr> - <th>Todos:</th> + <th>Tasks:</th> <td> <div id="related_task">{related_task}</div> This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <cra...@us...> - 2008-05-05 16:18:39
|
Revision: 886 http://cs-project.svn.sourceforge.net/cs-project/?rev=886&view=rev Author: crazedsanity Date: 2008-05-05 09:14:13 -0700 (Mon, 05 May 2008) Log Message: ----------- Remove unused admin "config" settings, fix invalid call to logging. Modified Paths: -------------- trunk/1.2/includes/content/settings.inc trunk/1.2/lib/mainRecordClass.php trunk/1.2/templates/content/settings/admin.content.tmpl Modified: trunk/1.2/includes/content/settings.inc =================================================================== --- trunk/1.2/includes/content/settings.inc 2008-05-02 04:45:07 UTC (rev 885) +++ trunk/1.2/includes/content/settings.inc 2008-05-05 16:14:13 UTC (rev 886) @@ -131,11 +131,6 @@ if(count($page->ftsSections) == 3 && $page->ftsSections[2] == 'admin') { if($user->is_admin() == 1) { - #debug_print(get_class($page)); - - $config = new config(); - $config->build_update_interface($page); - //create an object with administrative capabilities. $adminUserClass = new adminUserClass($page->db); Modified: trunk/1.2/lib/mainRecordClass.php =================================================================== --- trunk/1.2/lib/mainRecordClass.php 2008-05-02 04:45:07 UTC (rev 885) +++ trunk/1.2/lib/mainRecordClass.php 2008-05-05 16:14:13 UTC (rev 886) @@ -634,7 +634,7 @@ } else { $details = __METHOD__ .": no data for ancestry (". $ancestryString .") with recordId=(". $recordId ."), or couldn't find lastRecordId (". $this->lastRecordId .")::: ". debug_print($data); - $this->log_by_class($details, 'error'); + $this->logsObj->log_by_class($details, 'error'); throw new exception($details); } $this->isHelpdeskIssue = $oldIsHelpdesk; Modified: trunk/1.2/templates/content/settings/admin.content.tmpl =================================================================== --- trunk/1.2/templates/content/settings/admin.content.tmpl 2008-05-02 04:45:07 UTC (rev 885) +++ trunk/1.2/templates/content/settings/admin.content.tmpl 2008-05-05 16:14:13 UTC (rev 886) @@ -2,63 +2,7 @@ <h2><font color="red">Administrative Settings</font></h2> -<a name="config" /> -<table border="1" cellpadding="3" cellspacing="0" width="80%"> -<tr> - <th colspan="2">Config Settings</th> -</tr> -<tr> - <td colspan="2" align="center"> - <div class="note" style="width:60em"><b>NOTE:</b> You should be <font color="red"><b>absolutely certain</b></font> of the - effects of the changes you make here. Changing an item to an incorrect value make render the - installation useless. To rectify a broken configuration, you would need to modify the - <b>{CONFIG_FILE_LOCATION}</b> file manually.</div> - </td> -</tr> -<tr> - <th width="80%">Name/Description</th> - <th width="20%">Value/Select Option</th> -</tr> -<!-- BEGIN setting_text --> - <tr> - <td> - <b>%%title%%</b> (%%index%%)<BR> - %%description%% - </td> - - <td><input name="%%index%%" type="text" value="%%value%%" %%disabled%%></td> - </tr> -<!-- END setting_text --> -<!-- BEGIN setting_select --> - <tr> - <td> - <b>%%title%%</b> (%%index%%)<BR> - %%description%% - </td> - - <td> - <select name="%%index%%" %%disabled%%> - %%setting_select__normal%% - </select> - </td> - </tr> -<!-- END setting_select --> -<!-- 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="text" name="%%index%%" value="%%value%%" disabled> - </td> - </tr> -<!-- END setting_locked --> -</table> - <a name="group" /> <table border=1 cellpadding=3 cellspacing=0> <tr> This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <cra...@us...> - 2008-05-12 20:45:20
|
Revision: 889 http://cs-project.svn.sourceforge.net/cs-project/?rev=889&view=rev Author: crazedsanity Date: 2008-05-12 13:43:26 -0700 (Mon, 12 May 2008) Log Message: ----------- Fix problems with AJAX tags and decimals in tasks. AFFECTS ISSUES: #180: Tasks handling decimals poorly #185: AJAX tags failing on helpdesk issues /includes/content/helpdesk.inc: * don't do any exiting or redirecting if $_POST[xajax] is set * remove the exit that ran NO MATTER WHAT. /lib/taskClass.php: * create_task(): -- added "estimate_current" to the cleanStringArr as a decimal so it gets cleaned properly (instead of having the period removed). Modified Paths: -------------- trunk/1.2/includes/content/helpdesk.inc trunk/1.2/lib/taskClass.php Modified: trunk/1.2/includes/content/helpdesk.inc =================================================================== --- trunk/1.2/includes/content/helpdesk.inc 2008-05-06 00:23:25 UTC (rev 888) +++ trunk/1.2/includes/content/helpdesk.inc 2008-05-12 20:43:26 UTC (rev 889) @@ -182,7 +182,10 @@ $url = $baseUrl; //don't bother redirecting to the "view" page if the ID isn't valid. - if(preg_match('/view/', $urlSection) && !is_numeric($urlExtrasArr['ID'])) { + if(isset($_POST['xajax'])) { + //don't exit or anything here: let the AJAX stuff work itself out, I guess. + } + elseif(preg_match('/view/', $urlSection) && !is_numeric($urlExtrasArr['ID'])) { unset($urlSection); conditional_header('/content/helpdesk'); exit; @@ -203,7 +206,6 @@ conditional_header($url); exit; } - exit; } else { $helpdeskId = $_GET['ID']; Modified: trunk/1.2/lib/taskClass.php =================================================================== --- trunk/1.2/lib/taskClass.php 2008-05-06 00:23:25 UTC (rev 888) +++ trunk/1.2/lib/taskClass.php 2008-05-12 20:43:26 UTC (rev 889) @@ -389,6 +389,7 @@ $insertArr[$field] = $value; } + $cleanStringArr['estimate_current'] = 'decimal'; //merge it with the fields we manually set.. $insertArr = array_merge($insertArr, $addFieldsArr); This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <cra...@us...> - 2008-05-12 22:18:44
|
Revision: 891 http://cs-project.svn.sourceforge.net/cs-project/?rev=891&view=rev Author: crazedsanity Date: 2008-05-12 15:18:42 -0700 (Mon, 12 May 2008) Log Message: ----------- Fix email notices (#159). Modified Paths: -------------- trunk/1.2/lib/helpdeskClass.php Added Paths: ----------- trunk/1.2/templates/email/helpdesk.tmpl Removed Paths: ------------- trunk/1.2/templates/email/helpdesk-new.tmpl trunk/1.2/templates/email/helpdesk-remark.tmpl Modified: trunk/1.2/lib/helpdeskClass.php =================================================================== --- trunk/1.2/lib/helpdeskClass.php 2008-05-12 20:49:31 UTC (rev 890) +++ trunk/1.2/lib/helpdeskClass.php 2008-05-12 22:18:42 UTC (rev 891) @@ -173,7 +173,7 @@ if($retval > 0) { //send the submitter an email $newRemarks = $remark; - $emailTemplate = html_file_to_string("email/helpdesk-remark.tmpl"); + $emailTemplate = html_file_to_string("email/helpdesk.tmpl"); $linkAction = "view"; if($useRespondLink) { @@ -198,7 +198,7 @@ //okay, now send the email. The function "send_email()" should be ensuring that all values in // the recipients array are valid, and there's no dups. - $subject = "Update to Helpdesk Issue #". $helpdeskId ." -- ". $tmp['name']; + $subject = "Helpdesk Issue #". $helpdeskId ." -- ". $tmp['name']; $sendEmailRes = send_email($recipientsArr, $subject, $emailTemplate, $parseArr); //log who we sent the emails to. @@ -341,19 +341,19 @@ //got good data... get the note_id. //now send 'em an email about it. - $emailTemplate = html_file_to_string("email/helpdesk-new.tmpl"); + $emailTemplate = html_file_to_string("email/helpdesk.tmpl"); $parseArr = $this->get_record($retval); $normalEmailExtra = NULL; $emailAddressList = $linkObj->get_record_email_list($newRecord); if((strlen($_SESSION['login_email'])) && ($_SESSION['login_email'] != $parseArr['email'])) { - $subject = "Created Helpdesk Issue #$retval Created [for ".$parseArr['email'] ."] -- ". $parseArr['name']; + $subject = "Helpdesk Issue #$retval Created [for ".$parseArr['email'] ."] -- ". $parseArr['name']; send_email($emailAddressList, $subject, $emailTemplate, $parseArr); $normalEmailExtra = " [registered by ". $_SESSION['login_loginname'] .": uid=". $_SESSION['login_id'] ."]"; } else { - $subject = "Created Helpdesk Issue #$retval Created". $normalEmailExtra ." -- ". $parseArr['name']; + $subject = "Helpdesk Issue #$retval Created -- ". $parseArr['name']; send_email($emailAddressList, $subject, $emailTemplate, $parseArr); } Deleted: trunk/1.2/templates/email/helpdesk-new.tmpl =================================================================== --- trunk/1.2/templates/email/helpdesk-new.tmpl 2008-05-12 20:49:31 UTC (rev 890) +++ trunk/1.2/templates/email/helpdesk-new.tmpl 2008-05-12 22:18:42 UTC (rev 891) @@ -1,49 +0,0 @@ -<html> -<body> - -<font color="red"><b>DO NOT REPLY TO THIS EMAIL!</b></font> Please -utilize the link provided at the bottom of this message to view -and/or reply to it. Thank you.<BR><BR> - -A new helpdesk issue has been submitted! Please review the details below<br> -for more details. You will be sent an email when the issue is resolved,<br> -along with any updates along the way (if you submitted it or add remarks). - -<table border="1" cellpadding="2" cellspacing="0"> -<tr> - <th>Issue Number:</th> - <td><pre>{public_id}</pre></td> -</tr> -<tr> - <th>Name of Issue:</th> - <td><pre>{name}</pre></td> -</tr> -<tr> - <th>Submitted by:</th> - <td>{email}</td> -</tr> -<tr> - <th>Contents:</th> - <td><pre>{subject}</pre></td> -</tr> -<tr> - <th>Date of Submission:</th> - <td>{start_date}</td> -</tr> -<tr> - <th>Issue Category:</th> - <td>{tag_list}</td> -</tr> -<tr> - <td colspan="2" align="center">Click the link to view online: - [<a href="http://{project_url}/extern/helpdesk/view?ID={public_id}">view</a>]</td> -</tr> -</table> - -Generated by: {PROJ_NAME} v{VERSION_STRING} - -<hr> -$Id$ - -</body> -</html> \ No newline at end of file Deleted: trunk/1.2/templates/email/helpdesk-remark.tmpl =================================================================== --- trunk/1.2/templates/email/helpdesk-remark.tmpl 2008-05-12 20:49:31 UTC (rev 890) +++ trunk/1.2/templates/email/helpdesk-remark.tmpl 2008-05-12 22:18:42 UTC (rev 891) @@ -1,57 +0,0 @@ -<html> -<body> - -<font color="red"><b>DO NOT REPLY TO THIS EMAIL!</b></font> Please -utilize the link provided at the bottom of this message to view -and/or reply to it. Thank you.<BR><BR> - -<table border="1" cellpadding="2" cellspacing="0"> -<tr> - <th>Issue Number:</th> - <td>{public_id}</td> -</tr> -<tr> - <th>Name of Issue:</th> - <td><pre>[helpdesk_id={public_id}]</pre></td> -</tr> -<tr> - <th>Submitted by:</th> - <td>{email}</td> -</tr> -<tr> - <th>Contents:</th> - <td><pre>{subject}</pre></td> -</tr> -<tr> - <th>Date of Submission:</th> - <td>{start_date}</td> -</tr> -<tr> - <th>Issue Category:</th> - <td>{tag_list}</td> -</tr> -<tr> - <th>Assigned To:</th> - <td>{assigned}</td> -</tr> -<tr> - <th>Priority:</th> - <td>{priority}</td> -</tr> -<tr> - <th>New Remark:</th> - <td><pre>{newRemark}</pre></td> -</tr> -<tr> - <td align="center" colspan="2">Click the link to view/respond online: - [<a href="http://{project_url}/extern/helpdesk/view?myLinkAction={linkAction}&ID={public_id}{linkExtra}">{linkAction}</a>]</td> -</tr> -</table> - -Generated by: {PROJ_NAME} v{VERSION_STRING} - -<hr> -$Id$ - -</body> -</html> \ No newline at end of file Copied: trunk/1.2/templates/email/helpdesk.tmpl (from rev 888, trunk/1.2/templates/email/helpdesk-remark.tmpl) =================================================================== --- trunk/1.2/templates/email/helpdesk.tmpl (rev 0) +++ trunk/1.2/templates/email/helpdesk.tmpl 2008-05-12 22:18:42 UTC (rev 891) @@ -0,0 +1,57 @@ +<html> +<body> + +<font color="red"><b>DO NOT REPLY TO THIS EMAIL!</b></font> Please +utilize the link provided at the bottom of this message to view +and/or reply to it. Thank you.<BR><BR> + +<table border="1" cellpadding="2" cellspacing="0"> +<tr> + <th>Issue Number:</th> + <td>{public_id}</td> +</tr> +<tr> + <th>Name of Issue:</th> + <td><pre>[helpdesk_id={public_id}]</pre></td> +</tr> +<tr> + <th>Submitted by:</th> + <td>{email}</td> +</tr> +<tr> + <th>Contents:</th> + <td><pre>{subject}</pre></td> +</tr> +<tr> + <th>Date of Submission:</th> + <td>{start_date}</td> +</tr> +<tr> + <th>Issue Category:</th> + <td>{tag_list}</td> +</tr> +<tr> + <th>Assigned To:</th> + <td>{assigned}</td> +</tr> +<tr> + <th>Priority:</th> + <td>{priority}</td> +</tr> +<tr> + <th>New Remark:</th> + <td><pre>{newRemark}</pre></td> +</tr> +<tr> + <td align="center" colspan="2">Click the link to view/respond online: + [<a href="http://{project_url}/extern/helpdesk/view?myLinkAction={linkAction}&ID={public_id}{linkExtra}">{linkAction}</a>]</td> +</tr> +</table> + +Generated by: {PROJ_NAME} v{VERSION_STRING} + +<hr> +$Id$ + +</body> +</html> \ No newline at end of file This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <cra...@us...> - 2008-05-12 22:35:17
|
Revision: 892 http://cs-project.svn.sourceforge.net/cs-project/?rev=892&view=rev Author: crazedsanity Date: 2008-05-12 15:35:11 -0700 (Mon, 12 May 2008) Log Message: ----------- Fix issue #143. Modified Paths: -------------- trunk/1.2/upgrade/upgrade.xml Added Paths: ----------- trunk/1.2/docs/sql/upgrades/upgradeTo1.2.0-ALPHA7.sql trunk/1.2/upgrade/upgradeTo1.2.0-ALPHA7.php Added: trunk/1.2/docs/sql/upgrades/upgradeTo1.2.0-ALPHA7.sql =================================================================== --- trunk/1.2/docs/sql/upgrades/upgradeTo1.2.0-ALPHA7.sql (rev 0) +++ trunk/1.2/docs/sql/upgrades/upgradeTo1.2.0-ALPHA7.sql 2008-05-12 22:35:11 UTC (rev 892) @@ -0,0 +1,11 @@ +-- +-- SVN INFORMATION::: +-- +-- SVN Signature::::::::: $Id$ +-- Last Committted Date:: $Date$ +-- Last Committed Path::: $HeadURL$ +-- + + +delete from user_group_table WHERE user_group_id NOT IN (select distinct ON (uid, group_id) user_group_id FROM user_group_table); +CREATE UNIQUE INDEX user_group_table_uid_group_id_uidx ON user_group_table USING btree (uid, group_id); \ No newline at end of file Property changes on: trunk/1.2/docs/sql/upgrades/upgradeTo1.2.0-ALPHA7.sql ___________________________________________________________________ Name: svn:keywords + Id HeadURL Date Revision Author Name: svn:eol-style + native Modified: trunk/1.2/upgrade/upgrade.xml =================================================================== --- trunk/1.2/upgrade/upgrade.xml 2008-05-12 22:18:42 UTC (rev 891) +++ trunk/1.2/upgrade/upgrade.xml 2008-05-12 22:35:11 UTC (rev 892) @@ -26,4 +26,12 @@ <call_method>run_upgrade</call_method> </v1.2.0-ALPHA3> </matching> + <matching> + <v1.2.0-ALPHA6> + <target_version>1.2.0-ALPHA7</target_version> + <script_name>upgradeTo1.2.0-ALPHA7.php</script_name> + <class_name>upgrade_to_1_2_0_ALPHA7</class_name> + <call_method>run_upgrade</call_method> + </v1.2.0-ALPHA6> + </matching> </upgrade> Copied: trunk/1.2/upgrade/upgradeTo1.2.0-ALPHA7.php (from rev 888, trunk/1.2/upgrade/upgradeTo1.2.0-ALPHA4.php) =================================================================== --- trunk/1.2/upgrade/upgradeTo1.2.0-ALPHA7.php (rev 0) +++ trunk/1.2/upgrade/upgradeTo1.2.0-ALPHA7.php 2008-05-12 22:35:11 UTC (rev 892) @@ -0,0 +1,54 @@ +<?php + +class upgrade_to_1_2_0_ALPHA7 extends dbAbstract { + + private $logsObj; + + //========================================================================= + public function __construct(cs_phpDB &$db) { + if(!$db->is_connected()) { + throw new exception(__METHOD__ .": database is not connected"); + } + $this->db = $db; + + $this->logsObj = new logsClass($this->db, 'Upgrade'); + + $this->gfObj = new cs_globalFunctions; + $this->gfObj->debugPrintOpt = 1; + }//end __construct() + //========================================================================= + + + + //========================================================================= + public function run_upgrade() { + + $this->db->beginTrans(__METHOD__); + + + $this->run_schema_changes(); + + + $this->db->commitTrans(__METHOD__); + + return('Upgrade complete'); + }//end run_upgrade() + //========================================================================= + + + + //========================================================================= + private function run_schema_changes() { + + $this->gfObj->debug_print(__METHOD__ .": running SQL file..."); + $this->run_sql_file(dirname(__FILE__) .'/../docs/sql/upgrades/upgradeTo1.2.0-ALPHA7.sql'); + + $details = "Executed SQL file, '". $this->lastSQLFile ."'. Encoded contents::: ". + base64_encode($this->fsObj->read($this->lastSQLFile)); + $this->logsObj->log_by_class($details, 'system'); + + }//end run_schema_changes() + //========================================================================= +} + +?> This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <cra...@us...> - 2008-05-16 03:26:41
|
Revision: 894 http://cs-project.svn.sourceforge.net/cs-project/?rev=894&view=rev Author: crazedsanity Date: 2008-05-15 20:26:15 -0700 (Thu, 15 May 2008) Log Message: ----------- Fix issue #188 (revert invalid fix for cs-phpxml problem; see issue #189). Modified Paths: -------------- trunk/1.2/lib/upgradeClass.php trunk/1.2/upgrade/upgrade.xml Modified: trunk/1.2/lib/upgradeClass.php =================================================================== --- trunk/1.2/lib/upgradeClass.php 2008-05-13 00:21:44 UTC (rev 893) +++ trunk/1.2/lib/upgradeClass.php 2008-05-16 03:26:15 UTC (rev 894) @@ -178,20 +178,6 @@ $config = $xmlParser->get_tree(TRUE); $this->config = $config['UPGRADE']; - - //now fix the "MATCHING" section as needed. - $matchingKeys = $this->config['MATCHING']; - - $myMatching = $this->config['MATCHING']; - unset($this->config['MATCHING']); - if(!preg_match('/^V/', $matchingKeys[0])) { - foreach($myMatching as $index=>$data) { - $keys = array_keys($data); - $this->config['MATCHING'][$keys[0]] = $myMatching[$index][$keys[0]]; - } - } - debug_print($this->config); - }//end read_upgrade_config_file() //========================================================================= @@ -286,8 +272,7 @@ //========================================================================= public function parse_version_string($versionString) { - if(is_null($versionString) || !(strlen($versionString) > 4)) { - cs_debug_backtrace(1); + if(is_null($versionString) || !strlen($versionString)) { throw new exception(__METHOD__ .": invalid version string ($versionString)"); } $tmp = explode('.', $versionString); @@ -337,16 +322,6 @@ $retval['version_suffix'] = ""; } - //double-check our data matches the initial version string. - $checkThis = $retval['version_major'] .".". $retval['version_minor'] .".". $retval['version_maintenance']; - if(strlen($retval['version_suffix'])) { - $checkThis .= "-". $retval['version_suffix']; - } - - if($checkThis != $versionString) { - throw new exception(__METHOD__ .": initial version string (". $versionString .") doesn't match final (". $checkThis .")"); - } - return($retval); }//end parse_version_string() //========================================================================= @@ -743,7 +718,7 @@ } else { //TODO: should there maybe be an option to throw an exception (freak out) here? - debug_print(__METHOD__ .": while checking ". $index .", realized the new version (". $checkIfHigher .") is LOWER than current (". $versionNumber .")",1); + debug_print(__METHOD__ .": while checking ". $index .", realized the new version (". $checkIfHigher .") is LOWER than current (". $version .")",1); } } else { @@ -839,10 +814,6 @@ $dbVersion = $this->databaseVersion; $newVersion = $this->versionFileVersion; - if((strlen($dbVersion) <= 4) || (strlen($newVersion) <= 4)) { - throw new exception(__METHOD__ .": invalid data in dbVersion (". $dbVersion .") or newVersion (". $newVersion .")"); - } - $retval = array(); if(!$this->is_higher_version($dbVersion, $newVersion)) { throw new exception(__METHOD__ .": version (". $newVersion .") isn't higher than (". $dbVersion .")... something is broken"); Modified: trunk/1.2/upgrade/upgrade.xml =================================================================== --- trunk/1.2/upgrade/upgrade.xml 2008-05-13 00:21:44 UTC (rev 893) +++ trunk/1.2/upgrade/upgrade.xml 2008-05-16 03:26:15 UTC (rev 894) @@ -25,8 +25,6 @@ <class_name>upgrade_to_1_2_0_ALPHA4</class_name> <call_method>run_upgrade</call_method> </v1.2.0-ALPHA3> - </matching> - <matching> <v1.2.0-ALPHA6> <target_version>1.2.0-ALPHA7</target_version> <script_name>upgradeTo1.2.0-ALPHA7.php</script_name> This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <cra...@us...> - 2008-05-20 18:48:29
|
Revision: 897 http://cs-project.svn.sourceforge.net/cs-project/?rev=897&view=rev Author: crazedsanity Date: 2008-05-20 11:48:23 -0700 (Tue, 20 May 2008) Log Message: ----------- First step into consolidating setup into a class to handle automatic setup system. I'm not sure if this will all remain in a main class, or if it will be separated into special class files in a sub directory of /lib... we'll see. Modified Paths: -------------- trunk/1.2/includes/setup/2.inc trunk/1.2/includes/setup/3.inc trunk/1.2/includes/setup/5.inc Added Paths: ----------- trunk/1.2/lib/setup.class.php Modified: trunk/1.2/includes/setup/2.inc =================================================================== --- trunk/1.2/includes/setup/2.inc 2008-05-16 03:59:22 UTC (rev 896) +++ trunk/1.2/includes/setup/2.inc 2008-05-20 18:48:23 UTC (rev 897) @@ -20,9 +20,8 @@ if($result === TRUE) { //Good to go: load the schema! - //now create a temporary local class that does the rest. - $obj = new __tmpSetupClass($db, $page); - $finalResult = $obj->go(); + $obj = new setup($page, $db); + $finalResult = $obj->handle_step(2); $page->set_message_wrapper( array( @@ -56,191 +55,4 @@ - -class __tmpSetupClass { - - - private $db; - private $fs; - private $page; - private $url = "/setup/1"; - - //========================================================================= - public function __construct(cs_phpDB &$db, cs_genericPage &$page) { - $this->db = $db; - $this->fsObj = new cs_fileSystemClass(dirname(__FILE__) .'/../../docs/sql/setup'); - $this->gfObj = new cs_globalFunctions; - $this->page = $page; - - store_setup_data(2, 0, 'result'); - store_setup_data(2, 'Initializing...', 'text'); - }//end __construct() - //========================================================================= - - - //========================================================================= - public function go() { - $retval = "Nothing done... something went horribly wrong."; - if($this->create_database()) { - $retval = $this->handle_plpgsql(); - - if($retval === TRUE) { - $retval = $this->load_schema(); - if($retval === TRUE) { - $this->page->set_message_wrapper( - array( - 'title' => "Step Successful", - 'message' => "Finished step two with result:::<BR>\n". get_setup_data(2,'text'), - 'type' => "status" - ) - ); - $this->page->conditional_header('/setup/3', TRUE); - } - else { - $retval = "There was an error while testing PL/PGSQL functionality: ". $retval; - store_setup_data(2, $retval, 'text'); - } - } - } - else { - store_setup_data(2, 0, 'result'); - store_setup_data(2, 'Failed to create database', 'text'); - $setupData = get_setup_data(1, 'data'); - $retval = "Unable to create database... check that ". $setupData['host'] . - " does not already have a database named '". $setupData['dbname'] ."'. " . - "Also, make sure no other user is connected to template1."; - } - - return($retval); - }//end go() - //========================================================================= - - - - //========================================================================= - private function create_database() { - $params = get_db_params(); - - //okay, let's try to create the database. - $numrows = $this->db->exec("CREATE DATABASE ". $params['dbname'] ." WITH ENCODING='SQL_ASCII'"); - $dberror = $this->db->errorMsg(); - - if(strlen($dberror)) { - $retval = FALSE; - } - else { - $retval = TRUE; - - //okay. Now destroy our database handle & create a new one, connected to the proper database. - unset($this->db); - $this->db = new cs_phpDb; - $this->db->connect(get_db_params()); - } - - return($retval); - }//end create_database() - //========================================================================= - - - //========================================================================= - private function load_schema() { - - store_setup_data(2, "Schema not loaded... ", 'text'); - store_setup_data(2, 0, 'result'); - - $fileData = $this->fsObj->read("01__storedprocs.sql"); - - //now we'll try to push that into the database. - $this->db->beginTrans(); - - $this->gfObj->debug_print("Loading stored procedures... "); - - $this->db->exec($fileData); - $dberror = $this->db->errorMsg(); - - if(strlen($dberror)) { - $this->db->rollbackTrans(); - $retval = $dberror; - } - else { - //keep going - $retval = "Successfully loaded stored procedures! Loading tables...."; - $this->gfObj->debug_print($retval); - - $fileData = $this->fsObj->read("02__tables.sql"); - $this->db->exec($fileData); - $dberror = $this->db->errorMsg(); - - if(strlen($dberror)) { - $this->db->rollbackTrans(); - $retval = $dberror; - } - else { - $retval = "Done loading tables!!! Creating indexes and miscellaneous other things..."; - $this->gfObj->debug_print($retval); - - $fileData = $this->fsObj->read("03__indexes_etc.sql"); - $this->db->exec($fileData); - $dberror = $this->db->errorMsg(); - - if(strlen($dberror)) { - $this->db->rollbackTrans(); - $retval = $dberror; - } - else { - $retval = "All stored procedures, tables, and indexes have been created!"; - $this->gfObj->debug_print($retval); - - $this->db->commitTrans(); - store_setup_data(2, array(), 'data'); - store_setup_data(2, 1, 'result'); - store_setup_data(2, $retval, 'text'); - store_setup_data(3, 1, 'accessible'); - - $retval = TRUE; - } - } - } - - return($retval); - }//end load_schema() - //========================================================================= - - - - //========================================================================= - /** - * Try to load PL/pgsql functions... - * - * NOTE: this is a terrible requirement, which requires PostgreSQL to be - * compiled with certain options... - */ - private function handle_plpgsql() { - $this->db->beginTrans(); - $fileData = $this->fsObj->read("plpgsql.sql"); - - $numrows = $this->db->exec($fileData); - $dberror = $this->db->errorMsg(); - - if(!strlen($dberror)) { - $this->db->commitTrans(); - $retval = TRUE; - } - else { - //figure out WHY this failed: if they're already loaded it's okay, otherwise it's bad. - $this->db->rollbackTrans(); - - if(preg_match('/"plpgsql_call_handler" already exists/', $dberror)) { - $retval = TRUE; - } - else { - $retval = $dberror; - } - } - - return($retval); - }//end handle_plpgsql() - //========================================================================= -} - ?> \ No newline at end of file Modified: trunk/1.2/includes/setup/3.inc =================================================================== --- trunk/1.2/includes/setup/3.inc 2008-05-16 03:59:22 UTC (rev 896) +++ trunk/1.2/includes/setup/3.inc 2008-05-20 18:48:23 UTC (rev 897) @@ -7,10 +7,9 @@ if($_POST) { $validSubmission = test_submitted_data($page, $_POST['users']); - if($validSubmission === TRUE) { - $obj = new __setupDefaultValues(); - store_setup_data(3, $obj->go(), 'text'); - $obj->finish($page); + if($validSubmission === TRUE) { + $obj = new setup($page); + store_setup_data(3, $obj->handle_step(3), 'text'); } else { store_setup_data(3, $_POST['users'], 'post_info'); @@ -122,1046 +121,4 @@ -class __setupDefaultValues extends upgrade { - - - protected $db; - private $gfObj; - private $totalRecords=0; - - private $data=array(); - - private $lastNumrows=NULL; - private $lastDberror=NULL; - - //========================================================================= - public function __construct() { - $this->db = new cs_phpDB; - $this->gfObj = new cs_globalFunctions; - }//end __construct() - //========================================================================= - - - - //========================================================================= - public function go() { - store_setup_data(3, 0, 'result'); - try { - $params = get_db_params(); - $this->db->connect($params); - $this->db->beginTrans(__METHOD__); - $retval = "Connected successfully to the database."; - - //now that we've connected, start doing stuff. - $retval = $this->set_version(); - $retval .= "<BR>\n". $this->create_log_categories_and_classes(); - $retval .= "<BR>\n". $this->create_record_type_data(); - $retval .= "<BR>\n". $this->create_attributes(); - $retval .= "<BR>\n". $this->create_anonymous_contact_data(); - $retval .= "<BR>\n". $this->create_status_records(); - $retval .= "<BR>\n". $this->create_tag_names(); - $retval .= "<BR>\n". $this->build_preferences(); - $retval .= "<BR>\n". $this->create_users(); - $retval .= "<BR>\n". $this->create_user_group_records(); - - $commitRes = $this->db->commitTrans(); - if($commitRes == 1) { - $retval .= "<BR>\n ----------- Created (". $this->totalRecords ."), result of commit: (". $commitRes .")."; - store_setup_data(3, 1, 'result'); - store_setup_data(4, 1, 'accessible'); - } - else { - $this->db->rollbackTrans(); - store_setup_data(3, 0, 'result'); - throw new exception(__METHOD__ .": failed to commit the transaction (". $commitRes .")"); - } - - } - catch(exception $e) { - //TODO: rollback the transaction - $retval = "An error occurred: ". $e->getMessage(); - } - - return($retval); - - }//end go() - //========================================================================= - - - - //========================================================================= - /** - * Set version information into the database for future upgradeability. - */ - private function set_version() { - //get the version string. - $fullVersionString = read_version_file(); - - $suffixData = explode('-', $fullVersionString); - if(count($suffixData) == 2 && preg_match('/\./', $suffixData[0]) && !preg_match('/\./', $suffixData[1])) { - //there's a suffix, and it doesn't contain periods (i.e. "1.0.0-ALPHA1") - $suffix = $suffixData[1]; - } - elseif(count($suffixData) == 1) { - //no suffix. - $suffix = ""; - } - else { - //there's a dash in the name, but it's invalid or contains periods (i.e. "BETA-1.0.0" or "1.0.0-ALPHA1.0") - throw new exception(__METHOD__ .": version string is invalid (". $fullVersionString ."), suffix contains dashes, or there is a prefix"); - } - - //remove the suffix & parse it. - $versionString = $suffixData[0]; - $versionData = $this->parse_version_string($fullVersionString); - $sqlData = $versionData; - - - #$sqlData = array( - # 'version_string' => $fullVersionString, - # 'version_major' => $versionData[0], - # 'version_minor' => $versionData[1], - # 'version_maintenance' => $versionData[2], - # 'version_suffix' => $suffix - #); - - $retval = 0; - foreach($sqlData as $name => $value) { - $sql = "SELECT internal_data_set_value('". $name ."', '". $value ."')"; - $numrows = $this->db->exec($sql); - $dberror = $this->db->errorMsg(); - - if(!strlen($dberror) && $numrows == 1) { - $retval++; - $this->totalRecords++; - } - else { - throw new exception(__METHOD__ .": failed to set (". $name .") as (". $value .")::: ". $dberror); - } - } - - if($retval == count($sqlData)) { - //okay, the final test: run a query that straps everything together, to ensure it all has the same version. - $sql = "SELECT internal_data_get_value('version_major') || '.' || internal_data_get_value('version_minor') " . - " || '.' || internal_data_get_value('version_maintenance') as text, " . - "internal_data_get_value('version_suffix') as version_suffix;"; - $numrows = $this->db->exec($sql); - $dberror = $this->db->errorMsg(); - - if(!strlen($dberror) && $numrows == 1) { - $data = $this->db->farray(); - $dbVersionString = $data['text']; - if(strlen($data['version_suffix'])) { - $dbVersionString .= "-". $data['version_suffix']; - } - - if($dbVersionString === $fullVersionString) { - //okay, one final test: check that the "version_string" in the database matches ours. - $sql = "SELECT internal_data_get_value('version_string')"; - $numrows = $this->db->exec($sql); - $dberror = $this->db->errorMsg(); - - if(!strlen($dberror) && $numrows == 1) { - $data = $this->db->farray(); - $dbVersionString = $data[0]; - - if($dbVersionString === $fullVersionString) { - $this->data['version_string'] = $fullVersionString; - $retval = "Successfully set version string"; - } - else { - throw new exception(__METHOD__ .": derived database version string (". $dbVersionString .") doesn't match our version (". $fullVersionString .")"); - } - } - else { - throw new exception(__METHOD__ .": failed to retrieve full version_string from database::: ". $dberror ."<BR>\nSQL::: ". $sql); - } - } - else { - throw new exception(__METHOD__ .": derived database version string (". $dbVersionString .") doesn't match our version (". $fullVersionString .")"); - } - } - else { - throw new exception(__METHOD__ .": failed to retrieve derived database version string::: ". $dberror ."<BR>\nSQL::: ". $sql); - } - } - else { - //it's cryptic, but what should it really say??? - throw new exception(__METHOD__ .": internal error, checksum didn't match"); - } - - return($retval); - - }//end set_version() - //========================================================================= - - - - //========================================================================= - private function create_log_categories_and_classes() { - - $counter = 0; - - $classes = array( - 1 => 'Error', - 2 => 'Information', - 3 => 'Create', - 4 => 'Update', - 5 => 'Delete', - 6 => 'REPORT', - 7 => 'DEBUG' - ); - - - foreach($classes as $num=>$name) { - $insertArr = array( - 'log_class_id' => $num, - 'name' => $name - ); - $sql = "INSERT INTO log_class_table ". $this->gfObj->string_from_array($insertArr, 'insert', NULL, 'sql'); - - $numrows = $this->db->exec($sql); - $dberror = $this->db->errorMsg(); - - if(!strlen($dberror) && $numrows == 1) { - //good. - $counter++; - $this->totalRecords++; - } - else { - throw new exception(__METHOD__ .": failed to create class record for (". $name .")::: ". $dberror ."<BR>\nSQL::: ". $sql); - } - } - - - //Reset sequence, so new records can be created. - $sql = "SELECT setval('log_class_table_log_class_id_seq', (SELECT max(log_class_id) FROM log_class_table))"; - $numrows = $this->db->exec($sql); - $dberror = $this->db->errorMsg(); - - if(!strlen($dberror) && $numrows == 1) { - $categories = array( - 1 => 'Database', - 2 => 'Authentication', - 3 => 'Users', - 4 => 'General', - 5 => 'Project', - 6 => 'Helpdesk', - 7 => 'Task', - 8 => 'Tags', - 9 => 'Estimates', - 10 => 'Navigation', - 11 => 'Preferences' - ); - - - foreach($categories as $num=>$name) { - $insertArr = array( - 'log_category_id' => $num, - 'name' => $name - ); - $sql = "INSERT INTO log_category_table ". $this->gfObj->string_from_array($insertArr, 'insert', NULL, 'sql'); - - $numrows = $this->db->exec($sql); - $dberror = $this->db->errorMsg(); - - if(!strlen($dberror) && $numrows == 1) { - //good. - $counter++; - $this->totalRecords++; - $this->data['logcat__'. strtolower($name)] = $num; - } - else { - throw new exception(__METHOD__ .": failed to create category record for (". $name .")::: ". $dberror ."<BR>\nSQL::: ". $sql); - } - } - - //Reset sequence, so new records can be created. - $sql = "SELECT setval('log_category_table_log_category_id_seq', (SELECT max(log_category_id) FROM log_category_table))"; - $numrows = $this->db->exec($sql); - $dberror = $this->db->errorMsg(); - - if(!strlen($dberror) && $numrows == 1) { - - //format (primary index is log_event_id): log_class_id, log_category_id, description - $logEvents = array( - // * log_event_id | log_class_id | log_category_id | description - 1 => array(3, 5, 'Project: created record'), - 2 => array(5, 5, 'Project: deleted record'), - 3 => array(4, 5, 'Project: updated record'), - 4 => array(1, 5, 'Project: ERROR'), - 5 => array(3, 6, 'Helpdesk: Created record'), - 6 => array(4, 6, 'Helpdesk: Updated record'), - 7 => array(2, 6, 'Helpdesk: Information'), - 8 => array(1, 6, 'Helpdesk: ERROR'), - 9 => array(6, 6, 'Helpdesk: Report'), - 10 => array(3, 7, 'Task: created record'), - 11 => array(5, 7, 'Task: deleted record'), - 12 => array(4, 7, 'Task: updated record'), - 13 => array(1, 1, 'Database Error'), - 14 => array(6, 5, 'Project: Activity Report'), - 15 => array(6, 7, 'Task: Activity Report'), - 16 => array(3, 2, 'User logged-in'), - 17 => array(5, 2, 'User logged-out'), - 18 => array(6, 2, 'Login/Logout Report'), - 19 => array(3, 8, 'Tags: created record'), - 20 => array(5, 8, 'Tags: deleted record'), - 21 => array(4, 8, 'Tags: updated record'), - 22 => array(6, 8, 'Tags: Activity Report'), - 23 => array(1, 2, 'Authentication: ERROR'), - 24 => array(2, 10, 'Navigation: Viewed page'), - 25 => array(4, 9, 'Update: Estimates'), - 26 => array(1, 9, 'Error: Estimates'), - 27 => array(2, 5, 'Information: Project'), - 28 => array(4, 3, 'Update: Users'), - 29 => array(1, 7, 'Error: Task'), - 30 => array(3, 3, 'Create: Users') - ); - - foreach($logEvents as $logEventId => $subArr) { - $insertArr = array( - 'log_event_id' => $logEventId, - 'log_class_id' => $subArr[0], - 'log_category_id' => $subArr[1], - 'description' => $subArr[2] - ); - $sql = "INSERT INTO log_event_table ". $this->gfObj->string_from_array($insertArr, 'insert', NULL, 'sql'); - $numrows = $this->db->exec($sql); - $dberror = $this->db->errorMsg(); - - if(!strlen($dberror) && $numrows == 1) { - $counter++; - $this->totalRecords++; - } - else { - throw new exception(__METHOD__ .": failed to create log_event_id #". $insertArr['log_event_id'] - .", description: ". $insertArr['description'] ."<BR>\nERROR::: ". $dberror ."<BR>\nSQL::: ". $sql); - } - } - - //FINAL SANITY CHECKS!!! - if($counter == (count($classes) + count($categories) + count($logEvents))) { - - //reset the sequence. - $sql = "SELECT setval('log_event_table_log_event_id_seq', (SELECT max(log_event_id) FROM log_event_table))"; - if($this->run_sql($sql) === TRUE) { - $retval = "Successfully created all category, class, and log event records (". $counter .")"; - } - else { - throw new exception(__METHOD__ .": failed to reset sequence for log_event table::: ". $dberror ."<BR>\nSQL::: ". $sql); - } - } - else { - throw new exception(__METHOD__ .": Internal error, failed to create all category and class records"); - } - } - else { - throw new exception(__METHOD__ .": failed to reset sequence for log_category_table::: ". $dberror ."<BR>\nSQL::: ". $sql); - } - } - else { - throw new exception(__METHOD__ .": failed to reset sequence for log_class_table::: ". $dberror ."<BR>\nSQL::: ". $sql); - } - - return($retval); - - }//end create_log_categories_and_classes() - //========================================================================= - - - - //========================================================================= - private function create_record_type_data() { - //format: - // {record_type_id} => array({name}, {module}) - $recordTypes = array( - 1 => array('Project', 'project'), - 2 => array('Task', 'task'), - 3 => array('Helpdesk', 'helpdesk') - ); - - $retval = 0; - foreach($recordTypes as $recTypeId => $subData) { - $insertArr = array( - 'record_type_id' => $recTypeId, - 'name' => $subData[0], - 'module' => $subData[1] - ); - $sql = "INSERT INTO record_type_table ". $this->gfObj->string_from_array($insertArr, 'insert', NULL, 'sql'); - $numrows = $this->db->exec($sql); - $dberror = $this->db->errorMsg(); - - if(!strlen($dberror) && $numrows == 1) { - $this->totalRecords++; - $retval++; - $this->data['rectype__'. $insertArr['module']] = $recTypeId; - } - else { - throw new exception(__METHOD__ .": failed to create record for ". $insertArr['name'] - .", dberror::: ". $dberror ."<BR>\nSQL::: ". $sql); - } - } - - if(count($recordTypes) == $retval) { - - $sql = "SELECT setval('record_type_table_record_type_id_seq'::text, (SELECT max(record_type_id) FROM record_type_table))"; - $numrows = $this->db->exec($sql); - $dberror = $this->db->errorMsg(); - - if(!strlen($dberror) && $numrows == 1) { - if($retval == count($recordTypes)) { - $retval = "Created all record types (". $retval .")"; - } - else { - throw new exception(__METHOD__ .": internal error (sanity check failed)"); - } - } - else { - throw new exception(__METHOD__ .": failed to reset sequence::: ". $dberror ."<BR>\nSQL::: ". $sql); - } - } - else { - throw new exception(__METHOD__ .": internal error"); - } - - return($retval); - }//end create_record_type_data() - //========================================================================= - - - - //========================================================================= - private function create_attributes() { - $attributes = array( - 3 => array('phone', 'phone', 'Phone'), - 4 => array('fax', 'phone', 'Fax'), - 5 => array('cell', 'phone', 'Cell'), - 6 => array('im_yahoo', 'alphanumeric', 'IM: Yahoo'), - 7 => array('im_skype', 'alphanumeric', 'IM: Skype'), - 8 => array('im_aol', 'alphanumeric', 'IM: AOL'), - 9 => array('im_msn', 'alphanumeric', 'IM: MSN'), - 10 => array('im_icq', 'alphanumeric', 'IM: ICQ'), - 11 => array('address', 'sql', 'Address'), - 12 => array('city', 'alphanumeric', 'City'), - 13 => array('state', 'alphanumeric', 'State'), - 14 => array('zip', 'alphanumeric', 'Zip') - ); - - $retval = 0; - foreach($attributes as $attributeId => $subData) { - $insertArr = array( - 'attribute_id' => $attributeId, - 'name' => $subData[0], - 'clean_as' => $subData[1], - 'display_name' => $subData[2] - ); - $sql = "INSERT INTO attribute_table ". $this->gfObj->string_from_array($insertArr, 'insert', NULL, 'sql'); - $numrows = $this->db->exec($sql); - $dberror = $this->db->errorMsg(); - - if(!strlen($dberror) && $numrows == 1) { - $retval++; - $this->totalRecords++; - } - else { - throw new exception(__METHOD__ .": failed to insert data for attribute (". $insertArr['name'] .")::: ". $dberror ."<BR>\nSQL::: ". $sql); - } - } - - if($retval == count($attributes)) { - $sql = "SELECT setval('attribute_table_attribute_id_seq'::text, (SELECT max(attribute_id) FROM attribute_table))"; - $numrows = $this->db->exec($sql); - $dberror = $this->db->errorMsg(); - - if(!strlen($dberror) && $numrows == 1) { - $retval = "Successfully created all attributes (". $retval .")!"; - } - else { - throw new exception(__METHOD__ .": failed to reset sequence::: ". $dberror ."<BR>\nSQL::: ". $sql); - } - } - else { - throw new exception(__METHOD__ .": internal error (sanity check failed)"); - } - - return($retval); - }//end create_attributes() - //========================================================================= - - - - //========================================================================= - /** - * Create the anonymous user. This includes their contact data and the - * default group. - * - * TODO: change "short_name" into "display_name". - */ - private function create_anonymous_contact_data() { - $allRecords = array( - 'disabled group' => array( - 'name' => 'group_table', - 'data' => array( - 'group_id' => 0, - 'name' => 'disabled', - 'short_name' => 'DISABLED', - 'leader_uid' => 0 - ), - ), - 'anonymous record in user table' => array( - 'name' => 'user_table', - 'data' => array( - 'uid' => 0, - 'username' => 'Anonymous', - 'password' => 'disabled', //this is PURPOSELY an invalid password (passwords should be 32-char md5's - 'is_admin' => 'f', - 'is_active' => 'f', - 'group_id' => 0, - 'contact_id' => 0 - ), - ), - 'default group' => array( - 'name' => 'group_table', - 'data' => array( - 'group_id' => 1, - 'name' => 'default', - 'short_name' => '-DEFAULT-', - 'leader_uid' => 0 - ), - ), - 'anonymous contact record' => array( - 'name' => 'contact_table', - 'data' => array( - 'contact_id' => 0, - 'company' => '', - 'fname' => 'Anonymous', - 'lname' => '', - 'contact_email_id' => '-1' - ) - ), - 'anonymous email record' => array( - 'name' => 'contact_email_table', - 'data' => array( - 'contact_id' => 0, - 'email' => 'ano...@nu...' - ) - ) - ); - - $retval = 0; - foreach($allRecords as $operationName => $subData) { - $tableName = $subData['name']; - $insertArr = $subData['data']; - - $sql = "INSERT INTO ". $tableName ." ". $this->gfObj->string_from_array($insertArr, 'insert', NULL, 'sql'); - $numrows = $this->db->exec($sql); - $dberror = $this->db->errorMsg(); - - if(!strlen($dberror) && $numrows == 1) { - $this->totalRecords++; - $retval++; - } else { - throw new exception(__METHOD__. ": failed perform operation (". $operationName .") for table (". $tableName .")::: ". $dberror ."<BR>\nSQL::: ". $sql); - } - } - - $sql = "SELECT currval('contact_email_table_contact_email_id_seq'::text)"; - if($this->run_sql($sql)) { - $data = $this->db->farray(); - $sql = "UPDATE contact_table SET contact_email_id=". $data[0] ." WHERE contact_id=0"; - if($this->run_sql($sql)) { - $this->totalRecords++; - } - else { - throw new exception(__METHOD__ .": failed to set contact_email_id for anonymous"); - } - } - else { - throw new exception(__METHOD__ .": failed to get sequence for contact_email_table"); - } - - if($retval == count($allRecords)) { - //reset the sequence for the group table... - $sql = "SELECT setval('group_table_group_id_seq'::text, (SELECT max(group_id) FROM group_table))"; - $numrows = $this->db->exec($sql); - $dberror = $this->db->errorMsg(); - - if(!strlen($dberror) && $numrows == 1) { - //good to go. - $retval = "Successfully created anonymous user, anonymous contact record, and the two default groups (". $retval .")!"; - } - else { - throw new exception(__METHOD__ .": failed to reset group sequence::: ". $dberror ."<BR>\nSQL::: ". $sql); - } - } - else { - throw new exception(__METHOD__ .": internal error (failed sanity check)"); - } - - return($retval); - }//end create_anonymous_contact_data() - //========================================================================= - - - //========================================================================= - private function create_status_records() { - //format: {status_id} => array({name}, {description}) - $statuses = array( - 0 => array('New/Offered', 'New record'), - 1 => array('Pending', 'Not new: pending review, or nearly complete.'), - 2 => array('Running/Accepted', 'Work is underway'), - 3 => array('Stalled', 'Unable to complete, or dependent on other things.'), - 4 => array('Ended/Solved', 'Work is complete!'), - 5 => array('Rejected', 'Denied.'), - 6 => array('Re-opened', 'Was solved, but is once again open.'), - ); - - $retval = 0; - foreach($statuses as $statusId => $subData) { - $insertArr = array( - 'status_id' => $statusId, - 'name' => $subData[0], - 'description' => $subData[1] - ); - $sql = "INSERT INTO status_table ". $this->gfObj->string_from_array($insertArr, 'insert', NULL, 'sql'); - $numrows = $this->db->exec($sql); - $dberror = $this->db->errorMsg(); - - if(!strlen($dberror) && $numrows == 1) { - $retval++; - $this->totalRecords++; - } - else { - throw new exception(__METHOD__ .": failed to create status (". $insertArr['name'] .")::: ". $dberror ."<BR>\nSQL::: ". $sql); - } - } - - if($retval == count($statuses)) { - //reset the status_table.status_id sequence... - $sql = "SELECT setval('status_table_status_id_seq'::text, (SELECT max(status_id) FROM status_table))"; - $numrows = $this->db->exec($sql); - $dberror = $this->db->errorMsg(); - - if(!strlen($dberror) && $numrows == 1) { - //good to go. - $retval = "Successfully created all status records (". $retval .")!"; - } - else { - throw new exception(__METHOD__ .": failed to reset status sequence::: ". $dberror ."<BR>\nSQL::: ". $sql); - } - } - else { - throw new exception(__METHOD__ .": internal error (failed sanity check)"); - } - - return($retval); - - }//end create_status_records() - //========================================================================= - - - - //========================================================================= - private function create_tag_names() { - $tags = array( - 1 => 'bug', - 2 => 'feature request', - 3 => 'information', - 4 => 'network related', - 5 => 'critical', - 6 => 'exception' - ); - - $retval = 0; - foreach($tags as $id=>$name) { - $insertArr = array( - 'tag_name_id' => $id, - 'name' => $name - ); - $sql = "INSERT INTO tag_name_table ". $this->gfObj->string_from_array($insertArr, 'insert', NULL, 'sql'); - $numrows = $this->db->exec($sql); - $dberror = $this->db->errorMsg(); - - if(!strlen($dberror) && $numrows == 1) { - $retval++; - $this->totalRecords++; - } - else { - throw new exception(__METHOD__ .": failed to insert data for (". $name .")::: ". $dberror ."<BR>\nSQL::: ". $sql); - } - } - - if($retval == count($tags)) { - //reset sequence for tag_name_table.tag_name_id - $sql = "SELECT setval('tag_name_table_tag_name_id_seq'::text, (SELECT max(tag_name_id) FROM tag_name_table))"; - $numrows = $this->db->exec($sql); - $dberror = $this->db->errorMsg(); - - if(!strlen($dberror) && $numrows == 1) { - //good to go. - $retval = "Successfully created all tags (". $retval .")!"; - } - else { - throw new exception(__METHOD__ .": failed to reset tag_name sequence::: ". $dberror ."<BR>\nSQL::: ". $sql); - } - } - else { - throw new exception(__METHOD__ .": internal error (sanity check failed)"); - } - - return($retval); - }//end create_tag_names() - //========================================================================= - - - - //========================================================================= - private function build_preferences() { - //format: {pref_type_id} => array({name}, {default_value}, {display_name}, {description}) - $prefTypes = array( - 1 => array('startModule', 'helpdesk', 'Starting on Module', 'Defines which section will be loaded upon login if nothing was selected.'), - 5 => array('sorting_helpdesk', 'public_id|DESC', 'Helpdesk Sorting', 'Define the type of sorting for the helpdesk page.'), - 6 => array('sorting_project', 'priority|ASC', 'Project Sorting', 'Define the type of sorting for the helpdesk page.'), - 7 => array('projectDetails_taskDisplayOnlyMine', 'all', 'Project Details: Task display', 'Define what tasks are displayed on a project\'s details page.'), - 8 => array('projectDetails_showCompletedIssues', '1', 'Project Details: Display completed issues', 'Should completed issues display in the details of a project?') - ); - - $retval = 0; - foreach($prefTypes as $prefTypeId => $subData) { - $insertArr = array( - 'pref_type_id' => $prefTypeId, - 'name' => $subData[0], - 'default_value' => $subData[1], - 'display_name' => $subData[2], - 'description' => $subData[3] - ); - - $sql = "INSERT INTO pref_type_table ". $this->gfObj->string_from_array($insertArr, 'insert', NULL, 'sql'); - $numrows = $this->db->exec($sql); - $dberror = $this->db->errorMsg(); - - if(!strlen($dberror) && $numrows == 1) { - $retval++; - $this->totalRecords++; - } - else { - throw new exception(__METHOD__ .": failed to insert data for (". $insertArr['name'] .")::: ". $dberror ."<BR>\nSQL::: ". $sql); - } - } - - if($retval == count($prefTypes)) { - //format: {pref_option_id} => array({pref_type_id}, {name}, {effective_value}) - $prefOptions = array( - 1 =>array(1, 'Helpdesk', 'helpdesk'), - 2 =>array(1, 'Projects', 'project'), - 3 =>array(1, 'Summary ', 'summary'), - 8 =>array(5, 'ID - Descending', 'public_id|DESC'), - 9 =>array(5, 'ID - Ascending', 'public_id|ASC'), - 10 =>array(5, 'Priority - Descending', 'priority|DESC'), - 11 =>array(5, 'Priority - Ascending', 'priority|ASC'), - 12 =>array(5, 'Submit - Descending', 'start_date|DESC'), - 13 =>array(5, 'Submit - Ascending', 'start_date|ASC'), - 14 =>array(5, 'Title - Descending', 'name|DESC'), - 15 =>array(5, 'Title - Ascending', 'name|DESC'), - 16 =>array(5, 'Status ID - Descending', 'status_id|DESC'), - 17 =>array(5, 'Status ID - Ascending', 'status_id|DESC'), - 18 =>array(5, 'Assigned - Descending', 'assigned|DESC'), - 19 =>array(5, 'Assigned - Ascending', 'assigned|DESC'), - 20 =>array(6, 'Priority - Ascending', 'priority|ASC'), - 21 =>array(6, 'Priority - Descending', 'priority|DESC'), - 22 =>array(6, 'Name of Project - Ascending', 'name|ASC'), - 23 =>array(6, 'Name of Project - Descending', 'name|DESC'), - 24 =>array(6, 'Begin - Ascending', 'start_date|ASC'), - 25 =>array(6, 'Begin - Descending', 'start_date|DESC'), - 26 =>array(6, 'End - Ascending', 'end|ASC'), - 27 =>array(6, 'End - Descending', 'end|DESC'), - 28 =>array(6, 'Status ID - Ascending', 'status_id|ASC'), - 29 =>array(6, 'Status ID - Descending', 'status_id|DESC'), - 30 =>array(6, 'Progress - Ascending', 'progress|ASC'), - 31 =>array(6, 'Progress - Descending', 'progress|DESC'), - 32 =>array(6, 'Leader - Ascending', 'leader_contact_id|ASC'), - 33 =>array(6, 'Leader - Descending', 'leader_contact_id|DESC'), - 34 =>array(7, 'Show everything', 'all'), - 35 =>array(7, 'All of mine (created & assigned)', 'mine'), - 36 =>array(7, 'Only my assigned items', 'assigned'), - 37 =>array(8, 'Yes', '1'), - 38 =>array(8, 'No', '0'), - ); - - foreach($prefOptions as $prefOptionId => $subData) { - $insertArr = array( - 'pref_option_id' => $prefOptionId, - 'pref_type_id' => $subData[0], - 'name' => $subData[1], - 'effective_value' => $subData[2] - ); - $sql = "INSERT INTO pref_option_table ". $this->gfObj->string_from_array($insertArr, 'insert', NULL, 'sql'); - $numrows = $this->db->exec($sql); - $dberror = $this->db->errorMsg(); - - if(!strlen($dberror) && $numrows == 1) { - $retval++; - $this->totalRecords++; - } - else { - throw new exception(__METHOD__ .": failed to insert data for pref option (". $insertArr['name'] .")::: ". $dberror ."<BR>\nSQL::: ". $sql); - } - } - - if($retval == (count($prefTypes) + count($prefOptions))) { - //reset the pref_type_table.pref_type_id sequence. - $sql = "SELECT setval('pref_type_table_pref_type_id_seq'::text, (SELECT max(pref_type_id) FROM pref_type_table))"; - $numrows = $this->db->exec($sql); - $dberror = $this->db->errorMsg(); - - if(!strlen($dberror) && $numrows == 1) { - if($retval == (count($prefTypes) + count($prefOptions))) { - //reset the pref_option_table.pref_option_id sequence. - $sql = "SELECT setval('pref_option_table_pref_option_id_seq'::text, (SELECT max(pref_option_id) FROM pref_option_table))"; - $numrows = $this->db->exec($sql); - $dberror = $this->db->errorMsg(); - - if(!strlen($dberror) && $numrows == 1) { - $retval = "Successfully created all preferences and options (". $retval .")!"; - } - else { - throw new exception(__METHOD__ .": failed to reset the pref_option sequence::: ". $dberror ."<BR>\nSQL::: ". $sql); - } - } - else { - throw new exception(__METHOD__ .": internal error (sanity check #2 failed)"); - } - } - else { - throw new exception(__METHOD__ .": failed to reset pref_type sequence::: ". $dberror ."<BR>\nSQL::: ". $sql); - } - } - else { - throw new exception(__METHOD__ .": internal error (sanity check #2 failed): (". $retval ." != ". (count($prefTypes) + count($prefOptions)) .")"); - } - } - else { - throw new exception(__METHOD__ .": internal error (sanity check #1 failed)"); - } - - return($retval); - - }//end build_preferences() - //========================================================================= - - - - //========================================================================= - private function create_users() { - - //retrieve the user information. - $userData = get_setup_data(3, 'post_info'); - if(!is_array($userData) || count($userData) != 2) { - throw new exception(__METHOD__ .": no user data...?". $this->gfObj->debug_print($userData,0)); - } - - $counter = 0; - $retval = "Successfully created records for::: "; - foreach($userData as $num => $subData) { - - //split their name up, based upon spaces. - $nameData = explode(' ', $subData['name']); - $insertArr = array(); - if(count($nameData) == 1) { - $insertArr['fname'] = $nameData[0]; - $insertArr['lname'] = ""; - } - elseif(count($nameData) == 2) { - $insertArr['fname'] = $nameData[0]; - $insertArr['lname'] = $nameData[1]; - } - else { - $insertArr['fname'] = $nameData[0]; - $insertArr['lname'] = preg_replace('/^'. $insertArr['fname'] .' /', '', $subData['name']); - } - $insertArr['contact_email_id'] = '-1'; - - //create their contact record. - $sql = "INSERT INTO contact_table ". $this->gfObj->string_from_array($insertArr, 'insert', NULL, 'sql'); - $numrows = $this->db->exec($sql); - $dberror = $this->db->errorMsg(); - - if(!strlen($dberror) && $numrows == 1) { - $sql = "SELECT currval('contact_table_contact_id_seq'::text)"; - if($this->run_sql($sql, 1) === TRUE) { - $this->totalRecords++; - - $data = $this->db->farray(); - $contactId = $data[0]; - - //now create the user. - $xUser = $subData['username']; - $insertArr = array( - 'username' => $subData['username'], - 'password' => md5($subData['password'] .'_'. $contactId), - 'is_admin' => interpret_bool($subData['is_admin'], array('f', 't')), - 'contact_id' => $contactId - ); - $sql = "INSERT INTO user_table ". $this->gfObj->string_from_array($insertArr, 'insert', NULL, 'sql'); - - if($this->run_sql($sql, 1) === TRUE) { - $sql = "SELECT currval('user_table_uid_seq'::text)"; - if($this->run_sql($sql,1) === TRUE) { - $data = $this->db->farray(); - $lastUid = $data[0]; - - //create an email address for them. - $sql = "INSERT INTO contact_email_table (contact_id, email) VALUES (". $contactId .", '". strtolower($subData['email']) ."')"; - if($this->run_sql($sql,1) === TRUE) { - $counter++; - //get the newly inserted id, so we can update the contact table. - if($this->run_sql("SELECT currval('contact_email_table_contact_email_id_seq'::text)")) { - $data = $this->db->farray(); - $contactEmailId = $data[0]; - - $sql = "UPDATE contact_table SET contact_email_id=". $contactEmailId ." WHERE contact_id=". $contactId; - if($this->run_sql($sql)) { - $retval = $this->gfObj->create_list($retval, " --- Created record for ". $subData['username'] ." (". $lastUid .")", "<BR>\n"); - } - else { - throw new exception(__METHOD__ .": unable to update contact table with new contact_email_id..."); - } - } - else { - throw new exception(__METHOD__ .": failed to retrieve contact_email_id"); - } - } - else { - throw new exception(__METHOD__ .": failed to create email for ". $subData['username'] ."::: ". $dberror ."<BR>\nSQL::: ". $sql); - } - } - else { - throw new exception(__METHOD__ .": failed to retrieve uid for ". $subData['username'] ."::: ". $dberror ."<BR>\nSQL::: ". $sql); - } - } - else { - throw new exception(__METHOD__ .": failed to create user record for ". $subData['username'] ."::: ". $dberror ."<BR>\nSQL::: ". $sql); - } - } - else { - throw new exception(__METHOD__ .": unable to retrieve contact_id for ". $subData['username'] ."::: ". $dberror ."<BR>\nSQL::: ". $sql); - } - } - else { - throw new exception(__METHOD__ .": failed to create contact record for ". $subData['username'] ."::: ". $dberror ."<BR>\nSQL::: ". $sql); - } - } - - if($counter == 2) { - $retval = $this->gfObj->create_list($retval, " --->>> done, created (". $counter .") records", "<BR>\n"); - } - else { - throw new exception(__METHOD__ .": failed to create users (". $counter .")::: ". $this->gfObj->debug_print($userData,0)); - } - - return($retval); - }//end create_users() - //========================================================================= - - - - //========================================================================= - public function finish(cs_genericPage &$page) { - - $stepRes = get_setup_data(3, 'result'); - if($stepRes == 1) { - $page->set_message_wrapper(array( - 'title' => "Successfully Setup Data", - 'message' => "All default data was stored in the new database successfully!", - 'type' => "status" - )); - store_setup_data(3, $this->data, 'data'); - $page->conditional_header("/setup/4", TRUE); - } - else { - $page->set_message_wrapper(array( - 'title' => "Step Failed", - 'message' => "Please review the errors below and proceed accordingly.", - 'type' => "error" - )); - $page->conditional_header("/setup/3", TRUE); - } - - }//end finish() - //========================================================================= - - - - //========================================================================= - protected function run_sql($sql, $expectedNumrows=NULL) { - if(strlen($sql)) { - $numrows = $this->db->exec($sql); - $dberror = $this->db->errorMsg(); - $this->lastNumrows = $numrows; - $this->lastDberror = $dberror; - - if(!strlen($dberror) && $numrows >= 0) { - if(is_numeric($expectedNumrows)) { - if($expectedNumrows == $numrows) { - $retval = TRUE; - } - else { - $retval = FALSE; - } - } - else { - //don't care if it's numeric. - $retval = TRUE; - } - } - else { - throw new exception(__METHOD__ .": failed to run SQL, got numrows=(". $numrows ."), dberror::: ". $dberror ."<BR>\nSQL::: ". $sql); - } - } - else { - throw new exception(__METHOD__ .": no SQL to run..."); - } - - return($retval); - }//end run_sql() - //========================================================================= - - - - //========================================================================= - private function create_user_group_records() { - $sql = "INSERT INTO user_group_table (uid, group_id) SELECT uid, group_id FROM user_table"; - if($this->run_sql($sql, 3) === TRUE) { - $retval = "Successfully created user_group linkage."; - } - else { - throw new exception(__METHOD__ .": unable to create user group records::: ". $this->lastDberror ."<BR>\nSQL::: ". $sql); - } - return($retval); - }//end create_user_group_records() - //========================================================================= - - -}//end __setupDefaultValues{} - - - -class _setupUpgrade extends upgrade { - - public function __construct(cs_phpDB $db) { - $this->db = $db; - parent::__construct(); - }//end __construct() - - public function finalize_conversion() { - $myVersion = parent::read_version_file(); - $setDataResult = parent::run_sql("SELECT internal_data_set_value('converted_from_version', '". parent::read_version_file() ."')"); - parent::update_num_users_to_convert(); - $retval = parent::update_database_version($myVersion); - debug_print(__METHOD__ .": myVersion=(". $myVersion ."), setDataResult=(". $setDataResult ."), retval=(". $retval .")"); - - return($myVersion); - }//end finalize_conversion() -}//end _setupUpgrade{} - ?> Modified: trunk/1.2/includes/setup/5.inc =================================================================== --- trunk/1.2/includes/setup/5.inc 2008-05-16 03:59:22 UTC (rev 896) +++ trunk/1.2/includes/setup/5.inc 2008-05-20 18:48:23 UTC (rev 897) @@ -6,8 +6,10 @@ if($_POST) { - $obj = new __finalStep($page, $stepNames); - $writeConfigResult = $obj->write_config($page); + #$obj = new __finalStep($page, $stepNames); + #$writeConfigResult = $obj->write_config($page); + $obj = new setup($page); + $writeConfigResult = $obj->handle_step(5, $stepNames); $page->set_message_wrapper(array( 'title' => "Reloaded... ", @@ -37,121 +39,4 @@ } -class __finalStep { - - - private $page; - private $gfObj; - - - //========================================================================= - public function __construct(cs_genericPage $page, array $stepData) { - $this->page = $page; - $this->stepData = $stepData; - unset($this->stepData[5]); - - $this->gfObj = new cs_globalFunctions; - $this->fsObj = new cs_fileSystemClass(dirname(__FILE__) ."/../../". CONFIG_DIRECTORY); - }//end __construct() - //========================================================================= - - - - //========================================================================= - function write_config() { - if($this->fsObj->is_writable(NULL)) { - $lsData = $this->fsObj->ls(); - if(!is_array($lsData[CONFIG_FILENAME])) { - $myData = array(); - foreach($this->stepData as $stepNum=>$garbage) { - $tempStepData = get_setup_data($stepNum, 'data'); - if(is_array($tempStepData)) { - $myData = array_merge($tempStepData, $myData); - } - else { - throw new exception(__METHOD__ .": step #". $stepNum ." has no valid data... ". $this->gfObj->debug_print($tempStepData,0)); - } - } - - //now that we've built the array successfully, now let's turn it into XML. - $xmlCreator = new xmlCreator('config'); - foreach($myData as $index=>$value) { - $xmlCreator->add_tag($index, $value); - } - $extraAttributes = array( - 'generated' => date('Y-m-d H:m:s'), - 'version' => $myData['version_string'] - ); - $xmlCreator->add_attribute('/config', $extraAttributes); - - //now, create an XML string... - $xmlString = $xmlCreator->create_xml_string(); - - $this->fsObj->create_file(CONFIG_FILENAME, TRUE); - $writeRes = $this->fsObj->write($xmlString, CONFIG_FILENAME); - - if($writeRes > 0) { - $retval = "Successfully created the XML config file"; - store_setup_data(5, 1, 'result'); - store_setup_data(5, $retval, 'text'); - } - else { - throw new exception(__METHOD__ .": failed to write any data to the config file"); - } - } - else { - throw new exception(__METHOD__ .": ". CONFIG_FILE_LOCATION ." already exists!"); - } - } - else { - throw new exception(__METHOD__ .": the config directory is not writable!"); - } - - $configObj = new config(CONFIG_FILE_LOCATION); - $configObj->remove_setup_config(); - - return($retval); - }//end write_config() - //========================================================================= -} - - -//####################################################################################### -/** - * Built to avoid always printing-out the results (so we can retrieve result data separately. - */ -class MyDisplay extends SimpleReporter { - - function paintHeader($test_name) { - } - - function paintFooter($test_name) { - } - - function paintStart($test_name, $size) { - parent::paintStart($test_name, $size); - } - - function paintEnd($test_name, $size) { - parent::paintEnd($test_name, $size); - } - - function paintPass($message) { - parent::paintPass($message); - } - - function paintFail($message) { - parent::paintFail($message); - } -} -//####################################################################################### - - -class unitTest extends UnitTestCase { - - function testOfTester () { - $this->assertTrue(FALSE); - } -} - ?> Added: trunk/1.2/lib/setup.class.php =================================================================== --- trunk/1.2/lib/setup.class.php (rev 0) +++ trunk/1.2/lib/setup.class.php 2008-05-20 18:48:23 UTC (rev 897) @@ -0,0 +1,1627 @@ +<?php +/* + * SVN INFORMATION::: + * ------------------ + * SVN Signature::::::: $Id$ + * Last Author::::::::: $Author$ + * Current Revision:::: $Revision$ + * Repository Location: $HeadURL$ + * Last Updated:::::::: $Date$ + */ + + +require_once(dirname(__FILE__) .'/../lib/simpletest/unit_tester.php'); +require_once(dirname(__FILE__) .'/../lib/simpletest/reporter.php'); + + +class setup { + + private $pageObj; + private $dbObj; + + //============================================================================= + function __construct(cs_genericPage $page, cs_phpDB $db=NULL) { + $this->pageObj = $page; + $this->dbObj = $db; + }//end __construct() + //============================================================================= + + + + //============================================================================= + function store_setup_data($step, $data, $type='data') { + $_SESSION['setup'][$type][$step] = $data; + }//end store_setup_data() + //============================================================================= + + + + //============================================================================= + function get_setup_data($step, $type='data') { + return($_SESSION['setup'][$type][$step]); + }//end get_setup_data() + //============================================================================= + + + + //============================================================================= + function read_version_file() { + $retval = NULL; + $fsObj = new cs_fileSystemClass(dirname(__FILE__) .'/..'); + + //okay, all files present: check the version in the VERSION file. + $lines = $fsObj->read('VERSION', TRUE); + $versionLine = $lines[2]; + if(preg_match('/^VERSION: /', $versionLine)) { + + $retval = trim(preg_replace('/VERSION: /', '', $versionLine)); + } + else { + throw new exception(__METHOD__ .": could not find VERSION data"); + } + + return($retval); + }//end read_version_file() + //============================================================================= + + + + //============================================================================= + function get_db_params() { + + $stepOneData = get_setup_data(1, 'data'); + if(is_array($stepOneData)) { + $params = array(); + foreach($stepOneData as $name=>$value) { + $index = preg_replace('/^database__/', '', $name); + $params[$index] = $value; + } + } + else { + throw new exception(__FUNCTION__ .": unable to retrieve step one data..."); + } + + return($params); + }//end get_db_params() + //============================================================================= + + + + //============================================================================= + function reset_all_steps($leaveText=TRUE, $afterStep=NULL) { + $retval=0; + if(is_array($_SESSION['setup'])) { + if(is_numeric($afterStep)) { + $_SESSION['setup']['lastStep'] = $afterStep; + } + else { + $_SESSION['setup']['lastStep'] = 1; + } + $unsetThis = array('data', 'result', 'accessible'); + + if($leaveText !== TRUE) { + $unsetThis[] = 'text'; + } + foreach($unsetThis as $indexName) { + if(isset($_SESSION['setup'][$indexName])) { + if(is_numeric($afterStep)) { + foreach($_SESSION['setup'][$indexName] as $stepNum=>$stepData) { + if(is_numeric($stepNum) && $stepNum > $afterStep) { + unset($_SESSION['setup'][$indexName][$stepNum]); + $retval++; + } + } + } + else { + unset($_SESSION['setup'][$indexName]); + $retval++; + } + } + } + } + else { + throw new exception(__FUNCTION__ .": no step data found in session"); + } + + return($retval); + }//end reset_all_steps() + //============================================================================= + + + + //============================================================================= + function test_db_stuff(cs_phpDB &$db=NULL) { + if(is_null($db) || !is_object($db)) { + $db = new cs_phpDB; + } + $stepOneData = get_setup_data(1); + $params = get_db_params(); + $originalParams = $params; + + + + $params['dbname'] = 'template1'; + $retval = "Failed to connect to ". $params['host'] .":". $params['dbname'] ." (host connection failed)"; + + $gf = new cs_globalFunctions; + + try { + $db->connect($params); + $result = "Connected successfully to ". $params['host'] .":". $params['dbname'] ." (host connection good)"; + try { + $newParams = $originalParams; + $db2 = new cs_phpDB; + $db2->connect($originalParams ); + $retval = "Connected successfully to ". $newParams['host'] .":". $newParams['dbname'] ." (host connection good, DATABASE EXISTS)"; + } + catch(exception $e) { + //no database! + //TODO: do a preg_match() on $e->getMessage() to see if it says something about the database not existing + $retval = TRUE; + } + } + catch(exception $e) { + $retval = $e->getMessage(); + } + + return($retval); + }//end test_db_stuff() + //============================================================================= + + + + //============================================================================= + public function handle_step($step, $extraData=NULL) { + if(is_null($step) || !is_numeric($step)) { + throw new exception(__METHOD__ .": invalid step (". $step .")"); + } + else { + switch($step) { + + //------------------------------------------------------------- + case 1: { + $obj = new __tmpSetupClass($this->dbObj, $this->pageObj); + $retval = $obj->go(); + break; + }//end case 1 + //------------------------------------------------------------- + + + //------------------------------------------------------------- + case 3: { + $obj = new __setupDefaultValues(); + $retval = $obj->go(); + break; + }//end case 3 + //------------------------------------------------------------- + + + //------------------------------------------------------------- + case 5: { + $obj = new __finalStep($this->pageObj, $extraData); + $retval = $obj->write_config($this->pageObj); + break; + }//end case 5 + //------------------------------------------------------------- + + + //------------------------------------------------------------- + default: { + throw new exception(__METHOD__ .": invalid step (". $step .")"); + }//end case default + //------------------------------------------------------------- + } + } + + return($retval); + }//end handle_step() + //============================================================================= + + +}//end setup{} + + + + +/* ###################################################################### + * ###################################################################### + * ###################################################################### + * + * HELPER CLASSES + * (eventually, they should probably be consolidated into setup{}... or separated into other files...?) + * + * ###################################################################### + * ###################################################################### + * ###################################################################### + */ + + + + + + + + + + + + + +class __tmpSetupClass { + + + private $db; + private $fs; + private $page; + private $url = "/setup/1"; + + //========================================================================= + public function __construct(cs_phpDB &$db, cs_genericPage &$page) { + $this->db = $db; + $this->fsObj = new cs_fileSystemClass(dirname(__FILE__) .'/../../docs/sql/setup'); + $this->gfObj = new cs_globalFunctions; + $this->page = $page; + + store_setup_data(2, 0, 'result'); + store_setup_data(2, 'Initializing...', 'text'); + }//end __construct() + //========================================================================= + + + //========================================================================= + public function go() { + $retval = "Nothing done... something went horribly wrong."; + if($this->create_database()) { + $retval = $this->handle_plpgsql(); + + if($retval === TRUE) { + $retval = $this->load_schema(); + if($retval === TRUE) { + $this->page->set_message_wrapper( + array( + 'title' => "Step Successful", + 'message' => "Finished step two with result:::<BR>\n". get_setup_data(2,'text'), + 'type' => "status" + ) + ); + $this->page->conditional_header('/setup/3', TRUE); + } + else { + $retval = "There was an error while testing PL/PGSQL functionality: ". $retval; + store_setup_data(2, $retval, 'text'); + } + } + } + else { + store_setup_data(2, 0, 'result'); + store_setup_data(2, 'Failed to create database', 'text'); + $setupData = get_setup_data(1, 'data'); + $retval = "Unable to create database... check that ". $setupData['host'] . + " does not already have a database named '". $setupData['dbname'] ."'. " . + "Also, make sure no other user is connected to template1."; + } + + return($retval); + }//end go() + //========================================================================= + + + + //========================================================================= + private function create_database() { + $params = get_db_params(); + + //okay, let's try to create the database. + $numrows = $this->db->exec("CREATE DATABASE ". $params['dbname'] ." WITH ENCODING='SQL_ASCII'"); + $dberror = $this->db->errorMsg(); + + if(strlen($dberror)) { + $retval = FALSE; + } + else { + $retval = TRUE; + + //okay. Now destroy our database handle & create a new one, connected to the proper database. + unset($this->db); + $this->db = new cs_phpDb; + $this->db->connect(get_db_params()); + } + + return($retval); + }//end create_database() + //========================================================================= + + + //========================================================================= + private function load_schema() { + + store_setup_data(2, "Schema not loaded... ", 'text'); + store_setup_data(2, 0, 'result'); + + $fileData = $this->fsObj->read("01__storedprocs.sql"); + + //now we'll try to push that into the database. + $this->db->beginTrans(); + + $this->gfObj->debug_print("Loading stored procedures... "); + + $this->db->exec($fileData); + $dberror = $this->db->errorMsg(); + + if(strlen($dberror)) { + $this->db->rollbackTrans(); + $retval = $dberror; + } + else { + //keep going + $retval = "Successfully loaded stored procedures! Loading tables...."; + $this->gfObj->debug_print($retval); + + $fileData = $this->fsObj->read("02__tables.sql"); + $this->db->exec($fileData); + $dberror = $this->db->errorMsg(); + + if(strlen($dberror)) { + $this->db->rollbackTrans(); + $retval = $dberror; + } + else { + $retval = "Done loading tables!!! Creating indexes and miscellaneous other things..."; + $this->gfObj->debug_print($retval); + + $fileData = $this->fsObj->read("03__indexes_etc.sql"); + $this->db->exec($fileData); + $dberror = $this->db->errorMsg(); + + if(strlen($dberror)) { + $this->db->rollbackTrans(); + $retval = $dberror; + } + else { + $retval = "All stored proc... [truncated message content] |