cs-project-svn_notify Mailing List for CS-Project (Page 5)
Brought to you by:
crazedsanity
You can subscribe to this list here.
2007 |
Jan
|
Feb
|
Mar
|
Apr
|
May
|
Jun
|
Jul
|
Aug
|
Sep
|
Oct
|
Nov
(65) |
Dec
(47) |
---|---|---|---|---|---|---|---|---|---|---|---|---|
2008 |
Jan
(34) |
Feb
(82) |
Mar
(21) |
Apr
(12) |
May
(16) |
Jun
|
Jul
(6) |
Aug
(8) |
Sep
|
Oct
|
Nov
|
Dec
|
2009 |
Jan
(1) |
Feb
(52) |
Mar
|
Apr
|
May
|
Jun
|
Jul
(9) |
Aug
(5) |
Sep
(12) |
Oct
(11) |
Nov
(4) |
Dec
(15) |
2010 |
Jan
|
Feb
|
Mar
(6) |
Apr
|
May
|
Jun
|
Jul
|
Aug
|
Sep
|
Oct
|
Nov
|
Dec
|
2011 |
Jan
|
Feb
|
Mar
|
Apr
|
May
|
Jun
|
Jul
(1) |
Aug
|
Sep
|
Oct
|
Nov
|
Dec
(9) |
2012 |
Jan
(2) |
Feb
|
Mar
|
Apr
|
May
|
Jun
(1) |
Jul
|
Aug
|
Sep
(1) |
Oct
|
Nov
|
Dec
|
From: <cra...@us...> - 2009-02-06 20:47:44
|
Revision: 941 http://cs-project.svn.sourceforge.net/cs-project/?rev=941&view=rev Author: crazedsanity Date: 2009-02-06 20:47:43 +0000 (Fri, 06 Feb 2009) Log Message: ----------- *** RELEASE 1.2.0-ALPHA9 *** SUMMARY OF CHANGES::: * Make the "select multiple" box for project associated users stand out more. * Credits file to show who's contributed to the project. * Fix typecast problem in SQL (#234) * New external libraries: -- cs-arrayToPath v1.0 -- cs-content v1.0-ALPHA7 -- cs-phpxml v2.0-ALPHA3 -- cs-versionparse v0.1.2 (NEW) * Fixed tabs to not have spaces under corners * Admin link is a new tab (instead of a link beneath settings) * Fix problem wherein an ajax call leaves unused template vars visible (#239) * Consolidate code for solve vs. remark (#240). * Single action button for helpdesk issues (#99) * Split include scripts into several smaller bits (#244) * Fix problem error when linking an unlinked issue to a project (#248). * Fix display issue with notes deforming the page layout (#249). * Remove some old test files Modified Paths: -------------- trunk/1.2/VERSION Modified: trunk/1.2/VERSION =================================================================== --- trunk/1.2/VERSION 2009-02-06 20:42:33 UTC (rev 940) +++ trunk/1.2/VERSION 2009-02-06 20:47:43 UTC (rev 941) @@ -1,4 +1,4 @@ $Id:VERSION 628 2007-11-20 16:58:45Z crazedsanity $ -VERSION: 1.2.0-ALPHA8 +VERSION: 1.2.0-ALPHA9 $HeadURL:https://cs-project.svn.sourceforge.net/svnroot/cs-project/trunk/VERSION $ This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <cra...@us...> - 2009-02-06 20:42:36
|
Revision: 940 http://cs-project.svn.sourceforge.net/cs-project/?rev=940&view=rev Author: crazedsanity Date: 2009-02-06 20:42:33 +0000 (Fri, 06 Feb 2009) Log Message: ----------- Now the "Modify" button works just like the "Submit" button (#99). Modified Paths: -------------- trunk/1.2/includes/content/helpdesk/view.inc Modified: trunk/1.2/includes/content/helpdesk/view.inc =================================================================== --- trunk/1.2/includes/content/helpdesk/view.inc 2009-02-06 20:41:33 UTC (rev 939) +++ trunk/1.2/includes/content/helpdesk/view.inc 2009-02-06 20:42:33 UTC (rev 940) @@ -22,7 +22,7 @@ $byPassUrlExtras = FALSE; if(strlen($action)) { - if($action == "submit") { + if($action == "submit" || $action == "modify") { $proj->helpdeskObj->db->beginTrans(); //SETUP THE MESSAGE THEY'LL SEE... This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <cra...@us...> - 2009-02-06 20:41:37
|
Revision: 939 http://cs-project.svn.sourceforge.net/cs-project/?rev=939&view=rev Author: crazedsanity Date: 2009-02-06 20:41:33 +0000 (Fri, 06 Feb 2009) Log Message: ----------- Update to use cs-content v1.0-ALPHA7 Modified Paths: -------------- trunk/1.2/lib/globalFunctions.php Modified: trunk/1.2/lib/globalFunctions.php =================================================================== --- trunk/1.2/lib/globalFunctions.php 2009-02-06 20:23:18 UTC (rev 938) +++ trunk/1.2/lib/globalFunctions.php 2009-02-06 20:41:33 UTC (rev 939) @@ -17,7 +17,7 @@ function get_required_external_lib_versions($projectName=NULL) { //format: {className} => array({projectName} => {exactVersion}) $requirements = array( - 'contentSystem' => array('cs-content', '1.0.0-ALPHA6'), + 'contentSystem' => array('cs-content', '1.0.0-ALPHA7'), 'cs_phpxmlParser' => array('cs-phpxml', '1.0.0-ALPHA3'), 'cs_arrayToPath' => array('cs-arrayToPath', '1.0.0') ); This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <cra...@us...> - 2009-02-06 20:23:23
|
Revision: 938 http://cs-project.svn.sourceforge.net/cs-project/?rev=938&view=rev Author: crazedsanity Date: 2009-02-06 20:23:18 +0000 (Fri, 06 Feb 2009) Log Message: ----------- Remove error reporting stuff that kept ALL errors from appearing. NOTE: this caused contentSystem to appear as though it died, and no errors like "require_once(): file not found" appeared, so troubleshooting was very difficult. Modified Paths: -------------- trunk/1.2/lib/site_config.php Modified: trunk/1.2/lib/site_config.php =================================================================== --- trunk/1.2/lib/site_config.php 2009-02-06 20:00:40 UTC (rev 937) +++ trunk/1.2/lib/site_config.php 2009-02-06 20:23:18 UTC (rev 938) @@ -37,10 +37,6 @@ set_exception_handler('exception_handler'); -//TODO: turn off if it's not a dev site, but NOT if setup is running (so they can see problems). -ini_set('error_reporting', 'On'); -ini_set('display_errors', 'On'); -error_reporting(E_ALL && ~E_NOTICE); //########################################################################## function exception_handler($exception) { $exceptionMessage = $exception->getMessage(); This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <cra...@us...> - 2009-02-06 20:00:44
|
Revision: 937 http://cs-project.svn.sourceforge.net/cs-project/?rev=937&view=rev Author: crazedsanity Date: 2009-02-06 20:00:40 +0000 (Fri, 06 Feb 2009) Log Message: ----------- Break up contacts into smaller includes (#244). Added Paths: ----------- trunk/1.2/includes/content/contacts/ trunk/1.2/includes/content/contacts/index.inc trunk/1.2/includes/content/contacts/view.inc Removed Paths: ------------- trunk/1.2/includes/content/contacts.inc Copied: trunk/1.2/includes/content/contacts/index.inc (from rev 930, trunk/1.2/includes/content/contacts.inc) =================================================================== --- trunk/1.2/includes/content/contacts/index.inc (rev 0) +++ trunk/1.2/includes/content/contacts/index.inc 2009-02-06 20:00:40 UTC (rev 937) @@ -0,0 +1,104 @@ +<?php +/* + * Created on Oct 15, 2007 + * + * SVN INFORMATION::: + * ------------------ + * Last Author: $Author$ + * Current Revision: $Revision$ + * Repository Location: $HeadURL$ + * Last Updated: $Date$ + */ + +require_once(dirname(__FILE__) .'/../../../lib/contactClass.php'); + +$contactObj = new contactClass($page->db); + +$page->allow_invalid_urls(TRUE); + + if(count($sectionArr) == 4 && $sectionArr[2] == 'view') { + $contactId = $sectionArr[3]; + } + + if(is_numeric($contactId)) { + + try{ + $page->rip_all_block_rows(); + + + $contactObj->set_contact_id($contactId); + $contactDetails = $contactObj->get_contact(); + + $userDetails = $user->get_user_info(array('contact_id'=>$contactId)); + if(is_array($userDetails)) { + $contactDetails['username'] = $userDetails['username']; + $page->add_template_var('display_username', $page->templateRows['display_username']); + } + + + //set the main details. + foreach($contactDetails as $name=>$value) { + $page->add_template_var($name, $value); + } + + $addableAttribs = $contactObj->get_attribute_list(2); + $page->add_template_var('attributeOptionList', $page->gfObj->array_as_option_list($addableAttribs)); + + $contactAttributes = $contactObj->get_contact_attributes(); + $attributeFormRows = ""; + $baseRow = $page->templateRows['attributeRow']; + foreach($contactAttributes as $name=>$value) { + $displayValue = $value; + if(!strlen($value) || !strlen(preg_replace('/ /', '', $value))) { + $displayValue = "<font color='red'><b>[EMPTY]</b></font>"; + } + $repArr=array( + 'name' => $name, + 'displayValue' => $displayValue, + 'value' => $value + ); + + $attributeFormRows .= $page->gfObj->mini_parser($baseRow, $repArr, '{', '}'); + } + $page->add_template_var('attributeRow', $attributeFormRows); + + $emailList = $contactObj->get_contact_email_list(); + $emailRow = ""; + foreach($emailList as $id=>$value) { + $repArr = array( + 'contact_email_id' => $id, + 'email' => $value, + 'isPrimary' => "" + ); + if($id == $contactDetails['contact_email_id']) { + $repArr['isPrimary'] = 'checked'; + } + $emailRow .= $page->mini_parser($page->templateRows['contactEmailAddress'], $repArr, '%%', '%%'); + } + $page->add_template_var('contactEmailAddress', $emailRow); + } + catch(exception $e) { + $page->set_message_wrapper(array( + 'title' => "Error Encountered", + 'message' => "Failed to retrieve data: ". $e->getMessage(), + 'type' => "fatal" + )); + } + } + else { + $page->rip_all_block_rows(); + $contactListing = $contactObj->get_all_contacts(); + + $baseRow = $page->templateRows['dataRow']; + + $myRow = ""; + foreach($contactListing as $conId=>$data) { + $data['rowColor'] = swapValue($rowColor1, "rgb(213, 213, 213)", "rgb(194, 194, 194)"); + $data['rowColor2'] = swapValue($rowColor2,"#D5D5D5", "#C2C2C2"); + $myRow .= $page->mini_parser($baseRow, $data, '{', '}'); + } + $page->add_template_var('dataRow', $myRow); + } + + +?> Property changes on: trunk/1.2/includes/content/contacts/index.inc ___________________________________________________________________ Added: svn:keywords + Id HeadURL Date Revision Author Added: svn:mergeinfo + Added: svn:eol-style + native Copied: trunk/1.2/includes/content/contacts/view.inc (from rev 930, trunk/1.2/includes/content/contacts.inc) =================================================================== --- trunk/1.2/includes/content/contacts/view.inc (rev 0) +++ trunk/1.2/includes/content/contacts/view.inc 2009-02-06 20:00:40 UTC (rev 937) @@ -0,0 +1,242 @@ +<?php +/* + * Created on Oct 15, 2007 + * + * SVN INFORMATION::: + * ------------------ + * Last Author: $Author$ + * Current Revision: $Revision$ + * Repository Location: $HeadURL$ + * Last Updated: $Date$ + */ + +require_once(dirname(__FILE__) .'/../../../lib/contactClass.php'); + +$contactObj = new contactClass($page->db); + +$page->allow_invalid_urls(TRUE); + +if($_POST) { + if(strlen($_POST['action']) && is_numeric($_POST['contact_id'])) { + $contactObj->set_contact_id($_POST['contact_id']); + + $messageArr = array( + 'title' => "Update Results", + 'message' => "", + 'type' => 'status' + ); + + switch($_POST['action']) { + + case 'update': { + $contactObj->db->beginTrans("_POST_updateAction"); + + $totalUpdates = 0; + $totalFailures = 0; + + $updatesArr = array(); + + if(strlen($_POST['new_contact_email'])) { + $isPrimary = FALSE; + if(!is_numeric($_POST['contactData']['contact_email_id'])) { + $isPrimary = TRUE; + unset($_POST['contactData']['contact_email_id']); + if(!count($_POST['contactData'])) { + unset($_POST['contactData']); + } + } + + if($contactObj->create_contact_email($_POST['new_contact_email'], $isPrimary)) { + $totalUpdates++; + $res = "Successfully added new email"; + if($isPrimary) { + $res .= " and set as primary address"; + } + add_update_result($updatesArr, $res); + } + else { + $totalFailures++; + add_update_result($updatesArr, "FAILED to create new email address..."); + } + } + + if(is_array($_POST['contactData'])) { + if($contactObj->update_contact_data($_POST['contactData'])) { + $totalUpdates++; + add_update_result($updatesArr, "Successfully updated contact data"); + } + else { + $totalFailures++; + add_update_result($updatesArr, "FAILED to update contact data"); + } + } + + if(is_array($_POST['attributes'])) { + if($contactObj->mass_update_contact_attributes($_POST['attributes'])) { + $totalUpdates++; + add_update_result($updatesArr, "Successfully updated attributes"); + } + else { + $totalFailures++; + add_update_result($updatesArr, "FAILED to update attributes"); + } + } + + if(is_array($_POST['delAttrib'])) { + foreach($_POST['delAttrib'] as $name) { + if($contactObj->delete_contact_attribute($name)) { + $totalUpdates++; + add_update_result($updatesArr, "Successfully deleted: <b>". $name ."</b>"); + } + else { + $totalFailures++; + add_update_result($updatesArr, "FAILED to delete attribute \"<b>". $name ."</b>\""); + break; + } + } + } + + if(is_array($_POST['addAttribute']) && count($_POST['addAttribute']) == 2) { + if($contactObj->create_contact_attribute($_POST['addAttribute']['name'], $_POST['addAttribute']['value'])) { + $totalUpdates++; + add_update_result($updatesArr, "Successfully added attribute (". $_POST['addAttribute']['name'] .")"); + } + else { + $totalFailures++; + add_update_result($updatesArr, "FAILED to add attribute (". $_POST['addAttribute']['name'] .")"); + } + } + + $messageArr['message'] = create_update_result($updatesArr); + $page->set_message_wrapper($messageArr); + + $contactObj->db->commitTrans(); + + } + break; + + default: { + $page->set_message_wrapper(array( + 'title' => "Invalid Action", + 'message' => "The requested action, [". $_POST['action'] ."], is invalid.", + 'type' => "error" + )); + } + } + } + else { + $page->set_message_wrapper(array( + 'title' => "Insufficient Information", + 'message' => "The requested update could not be handled due to insufficient information.", + 'type' => "error" + )); + } + + $page->conditional_header('/content/contacts/view/'. $_POST['contact_id']); +} +else { + if(count($sectionArr) == 4 && $sectionArr[2] == 'view') { + $contactId = $sectionArr[3]; + } + + if(is_numeric($contactId)) { + try{ + $page->rip_all_block_rows(); + + + $contactObj->set_contact_id($contactId); + $contactDetails = $contactObj->get_contact(); + + $userDetails = $user->get_user_info(array('contact_id'=>$contactId)); + if(is_array($userDetails)) { + $contactDetails['username'] = $userDetails['username']; + $page->add_template_var('display_username', $page->templateRows['display_username']); + } + + + //set the main details. + foreach($contactDetails as $name=>$value) { + $page->add_template_var($name, $value); + } + + $addableAttribs = $contactObj->get_attribute_list(2); + $page->add_template_var('attributeOptionList', $page->gfObj->array_as_option_list($addableAttribs)); + + $contactAttributes = $contactObj->get_contact_attributes(); + $attributeFormRows = ""; + $baseRow = $page->templateRows['attributeRow']; + foreach($contactAttributes as $name=>$value) { + $displayValue = $value; + if(!strlen($value) || !strlen(preg_replace('/ /', '', $value))) { + $displayValue = "<font color='red'><b>[EMPTY]</b></font>"; + } + $repArr=array( + 'name' => $name, + 'displayValue' => $displayValue, + 'value' => $value + ); + + $attributeFormRows .= $page->gfObj->mini_parser($baseRow, $repArr, '{', '}'); + } + $page->add_template_var('attributeRow', $attributeFormRows); + + $emailList = $contactObj->get_contact_email_list(); + $emailRow = ""; + foreach($emailList as $id=>$value) { + $repArr = array( + 'contact_email_id' => $id, + 'email' => $value, + 'isPrimary' => "" + ); + if($id == $contactDetails['contact_email_id']) { + $repArr['isPrimary'] = 'checked'; + } + $emailRow .= $page->mini_parser($page->templateRows['contactEmailAddress'], $repArr, '%%', '%%'); + } + $page->add_template_var('contactEmailAddress', $emailRow); + } + catch(exception $e) { + $page->set_message_wrapper(array( + 'title' => "Error Encountered", + 'message' => "Failed to retrieve data: ". $e->getMessage(), + 'type' => "fatal" + )); + } + } + else { + $page->rip_all_block_rows(); + $contactListing = $contactObj->get_all_contacts(); + + $baseRow = $page->templateRows['dataRow']; + + $myRow = ""; + foreach($contactListing as $conId=>$data) { + $data['rowColor'] = swapValue($rowColor1, "rgb(213, 213, 213)", "rgb(194, 194, 194)"); + $data['rowColor2'] = swapValue($rowColor2,"#D5D5D5", "#C2C2C2"); + $myRow .= $page->mini_parser($baseRow, $data, '{', '}'); + } + $page->add_template_var('dataRow', $myRow); + } +} + + +function add_update_result(array &$updateResults, $newResult) { + $updateResults[] = $newResult; +}//end add_update_result() + + +function create_update_result(array $updateResults) { + #$retval = "Result of updates: <ul>"; + $retval = ""; + $gf = new cs_globalFunctions; + foreach($updateResults as $result) { + $retval = $gf->create_list($retval, "<li>". $result ."</li>", "\n"); + } + $retval = "Result of updates: <ul>". $retval; + $retval .= "</ul>"; + return($retval); +}//end create_update_result() + + + +?> Property changes on: trunk/1.2/includes/content/contacts/view.inc ___________________________________________________________________ Added: svn:keywords + Id HeadURL Date Revision Author Added: svn:mergeinfo + Added: svn:eol-style + native Deleted: trunk/1.2/includes/content/contacts.inc =================================================================== --- trunk/1.2/includes/content/contacts.inc 2009-02-06 19:48:26 UTC (rev 936) +++ trunk/1.2/includes/content/contacts.inc 2009-02-06 20:00:40 UTC (rev 937) @@ -1,242 +0,0 @@ -<?php -/* - * Created on Oct 15, 2007 - * - * SVN INFORMATION::: - * ------------------ - * Last Author: $Author$ - * Current Revision: $Revision$ - * Repository Location: $HeadURL$ - * Last Updated: $Date$ - */ - -require_once(dirname(__FILE__) .'/../../lib/contactClass.php'); - -$contactObj = new contactClass($page->db); - -$page->allow_invalid_urls(TRUE); - -if($_POST) { - if(strlen($_POST['action']) && is_numeric($_POST['contact_id'])) { - $contactObj->set_contact_id($_POST['contact_id']); - - $messageArr = array( - 'title' => "Update Results", - 'message' => "", - 'type' => 'status' - ); - - switch($_POST['action']) { - - case 'update': { - $contactObj->db->beginTrans("_POST_updateAction"); - - $totalUpdates = 0; - $totalFailures = 0; - - $updatesArr = array(); - - if(strlen($_POST['new_contact_email'])) { - $isPrimary = FALSE; - if(!is_numeric($_POST['contactData']['contact_email_id'])) { - $isPrimary = TRUE; - unset($_POST['contactData']['contact_email_id']); - if(!count($_POST['contactData'])) { - unset($_POST['contactData']); - } - } - - if($contactObj->create_contact_email($_POST['new_contact_email'], $isPrimary)) { - $totalUpdates++; - $res = "Successfully added new email"; - if($isPrimary) { - $res .= " and set as primary address"; - } - add_update_result($updatesArr, $res); - } - else { - $totalFailures++; - add_update_result($updatesArr, "FAILED to create new email address..."); - } - } - - if(is_array($_POST['contactData'])) { - if($contactObj->update_contact_data($_POST['contactData'])) { - $totalUpdates++; - add_update_result($updatesArr, "Successfully updated contact data"); - } - else { - $totalFailures++; - add_update_result($updatesArr, "FAILED to update contact data"); - } - } - - if(is_array($_POST['attributes'])) { - if($contactObj->mass_update_contact_attributes($_POST['attributes'])) { - $totalUpdates++; - add_update_result($updatesArr, "Successfully updated attributes"); - } - else { - $totalFailures++; - add_update_result($updatesArr, "FAILED to update attributes"); - } - } - - if(is_array($_POST['delAttrib'])) { - foreach($_POST['delAttrib'] as $name) { - if($contactObj->delete_contact_attribute($name)) { - $totalUpdates++; - add_update_result($updatesArr, "Successfully deleted: <b>". $name ."</b>"); - } - else { - $totalFailures++; - add_update_result($updatesArr, "FAILED to delete attribute \"<b>". $name ."</b>\""); - break; - } - } - } - - if(is_array($_POST['addAttribute']) && count($_POST['addAttribute']) == 2) { - if($contactObj->create_contact_attribute($_POST['addAttribute']['name'], $_POST['addAttribute']['value'])) { - $totalUpdates++; - add_update_result($updatesArr, "Successfully added attribute (". $_POST['addAttribute']['name'] .")"); - } - else { - $totalFailures++; - add_update_result($updatesArr, "FAILED to add attribute (". $_POST['addAttribute']['name'] .")"); - } - } - - $messageArr['message'] = create_update_result($updatesArr); - $page->set_message_wrapper($messageArr); - - $contactObj->db->commitTrans(); - - } - break; - - default: { - $page->set_message_wrapper(array( - 'title' => "Invalid Action", - 'message' => "The requested action, [". $_POST['action'] ."], is invalid.", - 'type' => "error" - )); - } - } - } - else { - $page->set_message_wrapper(array( - 'title' => "Insufficient Information", - 'message' => "The requested update could not be handled due to insufficient information.", - 'type' => "error" - )); - } - - $page->conditional_header('/content/contacts/view/'. $_POST['contact_id']); -} -else { - if(count($sectionArr) == 4 && $sectionArr[2] == 'view') { - $contactId = $sectionArr[3]; - } - - if(is_numeric($contactId)) { - try{ - $page->rip_all_block_rows(); - - - $contactObj->set_contact_id($contactId); - $contactDetails = $contactObj->get_contact(); - - $userDetails = $user->get_user_info(array('contact_id'=>$contactId)); - if(is_array($userDetails)) { - $contactDetails['username'] = $userDetails['username']; - $page->add_template_var('display_username', $page->templateRows['display_username']); - } - - - //set the main details. - foreach($contactDetails as $name=>$value) { - $page->add_template_var($name, $value); - } - - $addableAttribs = $contactObj->get_attribute_list(2); - $page->add_template_var('attributeOptionList', $page->gfObj->array_as_option_list($addableAttribs)); - - $contactAttributes = $contactObj->get_contact_attributes(); - $attributeFormRows = ""; - $baseRow = $page->templateRows['attributeRow']; - foreach($contactAttributes as $name=>$value) { - $displayValue = $value; - if(!strlen($value) || !strlen(preg_replace('/ /', '', $value))) { - $displayValue = "<font color='red'><b>[EMPTY]</b></font>"; - } - $repArr=array( - 'name' => $name, - 'displayValue' => $displayValue, - 'value' => $value - ); - - $attributeFormRows .= $page->gfObj->mini_parser($baseRow, $repArr, '{', '}'); - } - $page->add_template_var('attributeRow', $attributeFormRows); - - $emailList = $contactObj->get_contact_email_list(); - $emailRow = ""; - foreach($emailList as $id=>$value) { - $repArr = array( - 'contact_email_id' => $id, - 'email' => $value, - 'isPrimary' => "" - ); - if($id == $contactDetails['contact_email_id']) { - $repArr['isPrimary'] = 'checked'; - } - $emailRow .= $page->mini_parser($page->templateRows['contactEmailAddress'], $repArr, '%%', '%%'); - } - $page->add_template_var('contactEmailAddress', $emailRow); - } - catch(exception $e) { - $page->set_message_wrapper(array( - 'title' => "Error Encountered", - 'message' => "Failed to retrieve data: ". $e->getMessage(), - 'type' => "fatal" - )); - } - } - else { - $page->rip_all_block_rows(); - $contactListing = $contactObj->get_all_contacts(); - - $baseRow = $page->templateRows['dataRow']; - - $myRow = ""; - foreach($contactListing as $conId=>$data) { - $data['rowColor'] = swapValue($rowColor1, "rgb(213, 213, 213)", "rgb(194, 194, 194)"); - $data['rowColor2'] = swapValue($rowColor2,"#D5D5D5", "#C2C2C2"); - $myRow .= $page->mini_parser($baseRow, $data, '{', '}'); - } - $page->add_template_var('dataRow', $myRow); - } -} - - -function add_update_result(array &$updateResults, $newResult) { - $updateResults[] = $newResult; -}//end add_update_result() - - -function create_update_result(array $updateResults) { - #$retval = "Result of updates: <ul>"; - $retval = ""; - $gf = new cs_globalFunctions; - foreach($updateResults as $result) { - $retval = $gf->create_list($retval, "<li>". $result ."</li>", "\n"); - } - $retval = "Result of updates: <ul>". $retval; - $retval .= "</ul>"; - return($retval); -}//end create_update_result() - - - -?> This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <cra...@us...> - 2009-02-06 19:48:33
|
Revision: 936 http://cs-project.svn.sourceforge.net/cs-project/?rev=936&view=rev Author: crazedsanity Date: 2009-02-06 19:48:26 +0000 (Fri, 06 Feb 2009) Log Message: ----------- Remove more test files... Removed Paths: ------------- trunk/1.2/includes/test.inc trunk/1.2/templates/test/ Deleted: trunk/1.2/includes/test.inc =================================================================== --- trunk/1.2/includes/test.inc 2009-02-06 19:41:34 UTC (rev 935) +++ trunk/1.2/includes/test.inc 2009-02-06 19:48:26 UTC (rev 936) @@ -1,79 +0,0 @@ -<?php -/* - * Created on Dec 13, 2007 - * - * SVN INFORMATION::: - * ------------------ - * Last Author::::::::: $Author$ - * Current Revision:::: $Revision$ - * Repository Location: $HeadURL$ - * Last Updated:::::::: $Date$ - - */ - - -$invoiceData = array( - 'invoice_id' => '10015', - 'poc' => 'Johnny Jackson', - 'company' => 'Llama Soft, Inc.', - 'address1' => '1555 North Georgia Ave.', - 'address2' => 'Suite 1411', - 'phone' => '(701) 555-3389 ext. 1911', - 'fax' => '(701) 555-9193', - 'city' => 'St. Louis', - 'state' => 'Missouri', - 'zip' => '55454' -); - -$invoiceItemData = array( - 91 => array( - 'invoice_item_id' => 91, - 'invoice_id' => 10015, - 'description' => 'Contract Downpayment', - 'unit_price' => 3000, - 'quantity' => 1 - ), - 93 => array( - 'invoice_item_id' => 93, - 'invoice_id' => 10015, - 'description' => 'Remote Software Development', - 'unit_price' => 75, - 'quantity' => 40 - ), - 94 => array( - 'invoice_item_id' => 94, - 'invoice_id' => 10015, - 'description' => 'Remote Software Development (overtime hours)', - 'unit_price' => 112.5, - 'quantity' => 12 - ) -); - - -$gf = new cs_globalFunctions; -$gf->debugPrintOpt = 1; - -$gf->debug_print("Here is the main invoice data::: ". $gf->debug_print($invoiceData,0)); - -$blockRows = $page->rip_all_block_rows(); - -if(!count($blockRows)) { - $gf->debug_print("Here's what I could find for block rows (should be more than just an empty array)::: ". $gf->debug_print($page->get_block_row_defs('content'),0)); - throw new exception("You forgot to give me valid block rows for parsing invoice items!"); -} -else { - $gf->debug_print("Here's the items that will be parsed into the rows::: ". $gf->debug_print($invoiceItemData,0)); - foreach($invoiceData as $index=>$value) { - $page->add_template_var($index, $value); - } - - //I have no idea how this will work when I don't know what the name of the block row is. - $tmplRow = array_pop($blockRows); - $allParsedRows = ""; - - foreach($invoiceItemData as $itemId=>$subData) { - $allParsedRows .= $page->gfObj->mini_parser($tmplRow, $subData, '{', '}'); - } -} - -?> This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <cra...@us...> - 2009-02-06 19:41:38
|
Revision: 935 http://cs-project.svn.sourceforge.net/cs-project/?rev=935&view=rev Author: crazedsanity Date: 2009-02-06 19:41:34 +0000 (Fri, 06 Feb 2009) Log Message: ----------- Old test files... not sure where they came from, but they were for testing invoices. Removed Paths: ------------- trunk/1.2/public_html/test trunk/1.2/public_html/test.php Deleted: trunk/1.2/public_html/test =================================================================== --- trunk/1.2/public_html/test 2009-02-06 19:20:09 UTC (rev 934) +++ trunk/1.2/public_html/test 2009-02-06 19:41:34 UTC (rev 935) @@ -1,20 +0,0 @@ -<?php -/* - * Created on Mar 10, 2006 - * by - * Dan Falconer - */ - - -require_once(dirname(__FILE__) ."/../lib/site_config.php"); - -$db = new cs_phpDB; -$db->connect(get_config_db_params()); -$session = new Session($db); - -$GLOBALS['DEBUGPRINTOPT'] = DEBUGPRINTOPT; - -$contentObj = new contentSystem(); -$contentObj->handle_session($session); -$contentObj->finish(); -?> Deleted: trunk/1.2/public_html/test.php =================================================================== --- trunk/1.2/public_html/test.php 2009-02-06 19:20:09 UTC (rev 934) +++ trunk/1.2/public_html/test.php 2009-02-06 19:41:34 UTC (rev 935) @@ -1 +0,0 @@ -link test \ 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...> - 2009-02-06 19:20:13
|
Revision: 934 http://cs-project.svn.sourceforge.net/cs-project/?rev=934&view=rev Author: crazedsanity Date: 2009-02-06 19:20:09 +0000 (Fri, 06 Feb 2009) Log Message: ----------- Fix display issue with notes deforming the page layout (#249). /public_html/css/common.css: * added helpdesk_comment_header and helpdesk_comment_body styles. /templates/content/helpdesk/view.content.tmpl: * widen the issue title to 750 from 650 (works fine on 1024x768 or better) * give comment header new CSS class (helpdesk_comment_header) * give comment body new CSS class (helpdesk_comment_body) -- the old style was setting the width to be 100%, which is what deformed the page. Modified Paths: -------------- trunk/1.2/public_html/css/common.css trunk/1.2/templates/content/helpdesk/view.content.tmpl Modified: trunk/1.2/public_html/css/common.css =================================================================== --- trunk/1.2/public_html/css/common.css 2009-02-06 18:25:22 UTC (rev 933) +++ trunk/1.2/public_html/css/common.css 2009-02-06 19:20:09 UTC (rev 934) @@ -56,4 +56,18 @@ padding-left:20px; background-color: white; border: dashed #000 1px; +} + +/* Helpdesk Styles */ +.helpdesk_comment_header { + border-top:dashed #000 1px; + padding-bottom:1em; + border-left:solid #000 1px; +} +.helpdesk_comment_body { + width:750; + overflow:auto; + padding-bottom:1em; + border-left:solid #000 1px; + padding-left:1em; } \ No newline at end of file Modified: trunk/1.2/templates/content/helpdesk/view.content.tmpl =================================================================== --- trunk/1.2/templates/content/helpdesk/view.content.tmpl 2009-02-06 18:25:22 UTC (rev 933) +++ trunk/1.2/templates/content/helpdesk/view.content.tmpl 2009-02-06 19:20:09 UTC (rev 934) @@ -184,7 +184,7 @@ <th style="border-bottom:solid #000 1px;" align="right">Issue Text:</th> - <td style="border-bottom:solid #000 1px;" width="650" colspan="2" nowrap><code>{subject}</code></td> + <td style="border-bottom:solid #000 1px;" width="750" colspan="2" nowrap><font size="+1">{subject}</font></td> </tr> <tr> <th>Tasks:</th> @@ -197,10 +197,10 @@ <th style="border-bottom:solid #000 1px;" align="right">Comments:<BR><font size="-3"><i>(Includes previous/current<BR>solution(s), if available)</i></font></th> <td style="border-bottom:solid #000 1px;" colspan="2"> <!-- BEGIN issueNotes --> - <div style="border-top:dashed #000 1px;"> + <div class="helpdesk_comment_header"> %%solutionIndicator%% <u> [#%%note_id%%] <b>%%subject%%</b> (%%fname%%@%%created%%)</u> - </div><br> - <div style="width:100%; overflow:auto"><code style="font-size:10px;">%%body%%</code></div> + </div> + <div class="helpdesk_comment_body">%%body%%</div> <!-- END issueNotes --> </td> </tr> This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <cra...@us...> - 2009-02-06 18:25:26
|
Revision: 933 http://cs-project.svn.sourceforge.net/cs-project/?rev=933&view=rev Author: crazedsanity Date: 2009-02-06 18:25:22 +0000 (Fri, 06 Feb 2009) Log Message: ----------- Fix problem error when linking an unlinked issue to a project (#248). /includes/content/project/view.inc: * only include a link to the old parent project if there actually was one. Modified Paths: -------------- trunk/1.2/includes/content/project/view.inc Modified: trunk/1.2/includes/content/project/view.inc =================================================================== --- trunk/1.2/includes/content/project/view.inc 2009-02-06 17:45:43 UTC (rev 932) +++ trunk/1.2/includes/content/project/view.inc 2009-02-06 18:25:22 UTC (rev 933) @@ -82,7 +82,6 @@ } elseif($action == "view" && is_numeric($_GET['ID'])) { - $showAllProjects = FALSE; $projectId = $page->ui->magic_cache("ID", NULL, "project","_GET,_SESSION"); $detailsArr = $proj->get_details($projectId); @@ -106,16 +105,21 @@ $helpdeskObj->remark($linkIssue, $remarkDetails); if($linkRes) { - $oldIsHelpdesk = $proj->helpdeskObj->isHelpdeskIssue; - $proj->helpdeskObj->isHelpdeskIssue=FALSE; - $oldProjData = $proj->helpdeskObj->get_parent_record($issueData['ancestry']); - $proj->helpdeskObj->isHelpdeskIssue=$oldIsHelpdesk; - $oldProjLinkList = $proj->get_ancestry_link_list($oldProjData['public_id'], TRUE, TRUE, TRUE); + $linkData = ""; + if($issueData['record_id'] != $issueData['ancestry']) { + $oldIsHelpdesk = $proj->helpdeskObj->isHelpdeskIssue; + $proj->helpdeskObj->isHelpdeskIssue=FALSE; + $oldProjData = $proj->helpdeskObj->get_parent_record($issueData['ancestry']); + $proj->helpdeskObj->isHelpdeskIssue=$oldIsHelpdesk; + + //build the "go back to old project" link. + $oldProjLinkList = $proj->get_ancestry_link_list($oldProjData['public_id'], TRUE, TRUE, TRUE); + $linkData = "<BR><BR>\nBack to old project:</b> [". $oldProjLinkList ."]"; + } $page->set_message_wrapper(array( 'title' => "Issue Linked Successfully", - 'message' => "Issue #". $linkIssue ." was successfully linked to this project.<BR><BR>" . - "<b>Back to old project:</b> [". $oldProjLinkList ."]", + 'message' => "Issue #". $linkIssue ." was successfully linked to this project." . $linkData, 'type' => "status" )); } This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <cra...@us...> - 2009-02-06 17:45:47
|
Revision: 932 http://cs-project.svn.sourceforge.net/cs-project/?rev=932&view=rev Author: crazedsanity Date: 2009-02-06 17:45:43 +0000 (Fri, 06 Feb 2009) Log Message: ----------- Move $_POST actions into individual includes (except the "filter" action, for now). Modified Paths: -------------- trunk/1.2/includes/content/helpdesk/shared.inc trunk/1.2/includes/content/helpdesk/view.inc Added Paths: ----------- trunk/1.2/includes/content/helpdesk/create.inc Copied: trunk/1.2/includes/content/helpdesk/create.inc (from rev 930, trunk/1.2/includes/content/helpdesk/shared.inc) =================================================================== --- trunk/1.2/includes/content/helpdesk/create.inc (rev 0) +++ trunk/1.2/includes/content/helpdesk/create.inc 2009-02-06 17:45:43 UTC (rev 932) @@ -0,0 +1,63 @@ +<?php +/* + * SVN INFORMATION::: + * ------------------ + * Last Author: $Author:crazedsanity $ + * Current Revision: $Revision:637 $ + * Repository Location: $HeadURL:https://cs-project.svn.sourceforge.net/svnroot/cs-project/trunk/includes/content/helpdesk.inc $ + * Last Updated: $Date:2007-11-20 11:04:33 -0600 (Tue, 20 Nov 2007) $ + */ + + +if($_POST) { + //CREATING NEW RECORD!!! + $dataArr = $_POST['data']; + $result = $proj->helpdeskObj->create_record($dataArr); + + if($result > 0) { + //TODO: implement email portion. + set_message_wrapper(array( + "title" => "Success", + "message" => "Helpdesk issue #". $result ." created successfully. You should receive an email confirmation shortly", + "type" => "notice" + )); + + //only go back to helpdesk if we're supposed to. + if($_SESSION['goBackLink']) { + $byPassUrlExtras = TRUE; + $baseUrl = $_SESSION['goBackLink']; + } + else { + $helpdeskId = $result; + $urlExtrasArr['ID'] = $result; + } + } + else { + //something bad happened. + set_message_wrapper(array( + "title" => "", + "message" => "", + "type" => "error" + )); + } + + //redirect them. + $url = "/content/helpdesk/view?ID=". $result; + if($_SESSION['goBackLink']) { + $url = $_SESSION['goBackLink']; + } + $page->gfObj->conditional_header($url); +} +else { + create_page_title($page, array('title' => "Create a Helpdesk Issue")); + $page->set_all_block_rows("content"); + + //show the "category" selection. + $categoryList = $proj->helpdeskObj->get_category_list('bug', TRUE); + $page->add_template_var("select_tags", $categoryList); + + // + $page->add_template_var("email", $_SESSION['email']); + $page->add_template_var("linked_proj", cleanString($_GET['proj']),"numeric"); +} +?> \ No newline at end of file Modified: trunk/1.2/includes/content/helpdesk/shared.inc =================================================================== --- trunk/1.2/includes/content/helpdesk/shared.inc 2009-02-06 17:14:54 UTC (rev 931) +++ trunk/1.2/includes/content/helpdesk/shared.inc 2009-02-06 17:45:43 UTC (rev 932) @@ -12,156 +12,8 @@ if($_POST) { $action = strtolower($_POST['action']); - $helpdeskId = $_POST['id']; - $baseUrl = "/content/helpdesk"; - $urlSection = "view"; - if(is_numeric($helpdeskId)) { - $urlExtrasArr = array( - "ID" => $helpdeskId - ); - } - $byPassUrlExtras = FALSE; if(strlen($action)) { - - if($action == "submit") { - $proj->helpdeskObj->db->beginTrans(); - - //SETUP THE MESSAGE THEY'LL SEE... - $setMessage = array( - "title" => "", - "message" => "... SET ME!!! ...", - "type" => "error" - ); - $success = false; - $remarks = array(); - - - $oldData = $proj->helpdeskObj->get_record($helpdeskId); - - - ################################# - # ---------> BEGIN "update" - ################################# - - - //if they've changed the name, we gotta log it. - //TODO: probably log this within helpdeskClass::update(). - if(isset($_POST['updates']['name']) && $oldData['name'] !== $_POST['updates']['name']) { - $remarks[] = array( - "remark" => 'Updated [b]name[/b] from ([b][i]'. $oldData['name'] .'[/i][/b])', - false - ); - } - - $doNotAcceptFields = array("solution", "remark"); - foreach($doNotAcceptFields as $unsetThis) { - unset($_POST['updates'][$unsetThis]); - } - $result = $proj->helpdeskObj->update_record($helpdeskId, $_POST['updates']); - - - //SET/UPDATE THE TYPE OF MESSAGE THAT WILL DISPLAY... - if($result == 1) { - $success = true; - $messageTitle[] = "Updated"; - $messageText[] = "Your issue was updated successfully."; - } - else { - #$setMessage['type'] = "error"; - $success = false; - } - - ################################# - # ---------> BEGIN "remark/solve" - ################################# - if($success === true && strlen($_POST['remark'])) { - //now check remark stuff. - $useRespondLink = FALSE; - if($_POST['isSolution']) { - //IT'S A SOLUTION - //solve it & make sure they know if it was good or not. - #$result = $proj->helpdeskObj->solve($helpdeskId, $_POST['solution']); - $remarks[] = array( - 'remark' => $_POST['remark'], - 'isSolution' => true - ); - $extra = NULL; - - if($result == 1 && $success === true) { - $messageTitle[] = "Solved"; - $messageText[] = "Your solution was logged, and the issue was updated accordingly. Confirmation emails have been sent."; - } - } - else { - //JUST A REMARK... - if($oldData['email'] != $_SESSION['email']) { - $useRespondLink = $proj->helpdeskObj->create_md5($helpdeskId); - } - $remarks[] = array( - 'remark' => $_POST['remark'], - 'isSolution' => false, - 'link' => $useRespondLink - ); - - if($result > 0) { - $success = true; - $messageTitle[] = "Remarked Upon"; - $messageText[] = "Your thoughts have been dually noted in the database... or at least singly. :D"; - } - }//end REMARK - } - - if($success) { - //TODO: this is where a queued email system would be good; if the first remark succeeds but the second fails, this will generate an erroneous email. - if(count($remarks)) { - foreach($remarks as $num=>$remarkData) { - $result = $proj->helpdeskObj->remark($helpdeskId, $remarkData['remark'], $remarkData['isSolution'], $remarkData['link']); - if($result <= 0) { - $success = false; - break; - } - } - } - - if($success === true) { - $proj->helpdeskObj->db->commitTrans(); - //format the message so it looks nice... - $setMessage['message'] = ""; - if(count($messageTitle) > 2) { - $lastMessage = array_pop($setMessage); - $setMessage['title'] = $page->gfObj->string_from_array($messageTitle, null, ", "); - $setMessage['title'] .= " and ". $lastMessage; - } - else { - $setMessage['title'] = $page->gfObj->string_from_array($messageTitle, null, " and "); - } - $setMessage['message'] = $page->gfObj->string_from_array($messageText, null, "<BR>\n"); - $setMessage['type'] = "status"; - } - else { - $proj->helpdeskObj->db->rollbackTrans(); - $setMessage = array( - 'title' => "Update FAILED", - 'message' => "The update would have worked, but you didn't put enough information into your remark.", - 'type' => "error" - ); - } - } - else { - $proj->helpdeskObj->db->rollbackTrans(); - $setMessage = array( - 'title' => "Update FAILED", - 'message' => "Update returned [". $result ."]. Last error was [". $proj->helpdeskObj->lastError ."]", - 'type' => "error" - ); - } - - #$page->gfObj->debug_print($_POST,1); - #$page->gfObj->debug_print($setMessage,1); - #exit; - $page->set_message_wrapper($setMessage); - } - elseif($action == "filter") { + if($action == "filter") { if($_POST['reset_filter']) { $page->ui->unset_cache("helpdesk/filter"); $result = "unset"; @@ -171,88 +23,10 @@ $page->ui->set_cache("helpdesk/filter", $_POST['filter']); $result = "set"; } - $byPassUrlExtras = TRUE; unset($extra); + $page->gfObj->conditional_header("/content/helpdesk"); } - elseif($action == "re-open") { - //we'll update some fields, then remark the old solution. - $oldData = $proj->helpdeskObj->get_record($helpdeskId); - $oldSolution = $oldData['solution']; - $updatesArr = array( - "status_id" => 6 - ); - - $updateRes = $proj->helpdeskObj->update_record($helpdeskId, $updatesArr); - - //make the old solution... better. - $oldSolution = "Re-opened."; - $remarkRes = $proj->helpdeskObj->remark($helpdeskId, $oldSolution); - - } - else { - exit("invalid action: [$action]"); - } - } elseif(isset($_POST['submit']) && count($_POST['data']) > 1) { - //CREATING NEW RECORD!!! - $dataArr = $_POST['data']; - $result = $proj->helpdeskObj->create_record($dataArr); - - if($result > 0) { - //TODO: implement email portion. - set_message_wrapper(array( - "title" => "Success", - "message" => "Helpdesk issue #". $result ." created successfully. You should receive an email confirmation shortly", - "type" => "notice" - )); - - //only go back to helpdesk if we're supposed to. - if($_SESSION['goBackLink']) { - $byPassUrlExtras = TRUE; - $baseUrl = $_SESSION['goBackLink']; - } - else { - $helpdeskId = $result; - $urlExtrasArr['ID'] = $result; - } - } - else { - //something bad happened. - set_message_wrapper(array( - "title" => "", - "message" => "", - "type" => "error" - )); - } } - - //build the redirection URL. - $url = $baseUrl; - - //don't bother redirecting to the "view" page if the ID isn't valid. - 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; - } - else { - if(isset($urlSection) && !preg_match('/\?/', $url)) { - if(!preg_match('/$\//', $url)) { - $urlSection = "/". $urlSection; - } - $url .= $urlSection; - } - if(!$byPassUrlExtras && count($urlExtrasArr) > 0) { - $urlExtrasStr = string_from_array($urlExtrasArr, "url"); - if($urlExtrasStr !== 0) { - $url .= "?". $urlExtrasStr .'&random='. time(); - } - } - conditional_header($url); - exit; - } } Modified: trunk/1.2/includes/content/helpdesk/view.inc =================================================================== --- trunk/1.2/includes/content/helpdesk/view.inc 2009-02-06 17:14:54 UTC (rev 931) +++ trunk/1.2/includes/content/helpdesk/view.inc 2009-02-06 17:45:43 UTC (rev 932) @@ -9,7 +9,181 @@ */ - +if($_POST) { + $action = strtolower($_POST['action']); + $helpdeskId = $_POST['id']; + $baseUrl = "/content/helpdesk"; + $urlSection = "view"; + if(is_numeric($helpdeskId)) { + $urlExtrasArr = array( + "ID" => $helpdeskId + ); + } + $byPassUrlExtras = FALSE; + if(strlen($action)) { + + if($action == "submit") { + $proj->helpdeskObj->db->beginTrans(); + + //SETUP THE MESSAGE THEY'LL SEE... + $setMessage = array( + "title" => "", + "message" => "... SET ME!!! ...", + "type" => "error" + ); + $success = false; + $remarks = array(); + + + $oldData = $proj->helpdeskObj->get_record($helpdeskId); + + + ################################# + # ---------> BEGIN "update" + ################################# + + + //if they've changed the name, we gotta log it. + //TODO: probably log this within helpdeskClass::update(). + if(isset($_POST['updates']['name']) && $oldData['name'] !== $_POST['updates']['name']) { + $remarks[] = array( + "remark" => 'Updated [b]name[/b] from ([b][i]'. $oldData['name'] .'[/i][/b])', + false + ); + } + + $doNotAcceptFields = array("solution", "remark"); + foreach($doNotAcceptFields as $unsetThis) { + unset($_POST['updates'][$unsetThis]); + } + $result = $proj->helpdeskObj->update_record($helpdeskId, $_POST['updates']); + + + //SET/UPDATE THE TYPE OF MESSAGE THAT WILL DISPLAY... + if($result == 1) { + $success = true; + $messageTitle[] = "Updated"; + $messageText[] = "Your issue was updated successfully."; + } + else { + #$setMessage['type'] = "error"; + $success = false; + } + + ################################# + # ---------> BEGIN "remark/solve" + ################################# + if($success === true && strlen($_POST['remark'])) { + //now check remark stuff. + $useRespondLink = FALSE; + if($_POST['isSolution']) { + //IT'S A SOLUTION + //solve it & make sure they know if it was good or not. + #$result = $proj->helpdeskObj->solve($helpdeskId, $_POST['solution']); + $remarks[] = array( + 'remark' => $_POST['remark'], + 'isSolution' => true + ); + $extra = NULL; + + if($result == 1 && $success === true) { + $messageTitle[] = "Solved"; + $messageText[] = "Your solution was logged, and the issue was updated accordingly. Confirmation emails have been sent."; + } + } + else { + //JUST A REMARK... + if($oldData['email'] != $_SESSION['email']) { + $useRespondLink = $proj->helpdeskObj->create_md5($helpdeskId); + } + $remarks[] = array( + 'remark' => $_POST['remark'], + 'isSolution' => false, + 'link' => $useRespondLink + ); + + if($result > 0) { + $success = true; + $messageTitle[] = "Remarked Upon"; + $messageText[] = "Your thoughts have been dually noted in the database... or at least singly. :D"; + } + }//end REMARK + } + + if($success) { + //TODO: this is where a queued email system would be good; if the first remark succeeds but the second fails, this will generate an erroneous email. + if(count($remarks)) { + foreach($remarks as $num=>$remarkData) { + $result = $proj->helpdeskObj->remark($helpdeskId, $remarkData['remark'], $remarkData['isSolution'], $remarkData['link']); + if($result <= 0) { + $success = false; + break; + } + } + } + + if($success === true) { + $proj->helpdeskObj->db->commitTrans(); + //format the message so it looks nice... + $setMessage['message'] = ""; + if(count($messageTitle) > 2) { + $lastMessage = array_pop($setMessage); + $setMessage['title'] = $page->gfObj->string_from_array($messageTitle, null, ", "); + $setMessage['title'] .= " and ". $lastMessage; + } + else { + $setMessage['title'] = $page->gfObj->string_from_array($messageTitle, null, " and "); + } + $setMessage['message'] = $page->gfObj->string_from_array($messageText, null, "<BR>\n"); + $setMessage['type'] = "status"; + } + else { + $proj->helpdeskObj->db->rollbackTrans(); + $setMessage = array( + 'title' => "Update FAILED", + 'message' => "The update would have worked, but you didn't put enough information into your remark.", + 'type' => "error" + ); + } + } + else { + $proj->helpdeskObj->db->rollbackTrans(); + $setMessage = array( + 'title' => "Update FAILED", + 'message' => "Update returned [". $result ."]. Last error was [". $proj->helpdeskObj->lastError ."]", + 'type' => "error" + ); + } + + #$page->gfObj->debug_print($_POST,1); + #$page->gfObj->debug_print($setMessage,1); + #exit; + $page->set_message_wrapper($setMessage); + } + elseif($action == "re-open") { + //we'll update some fields, then remark the old solution. + $oldData = $proj->helpdeskObj->get_record($helpdeskId); + $oldSolution = $oldData['solution']; + $updatesArr = array( + "status_id" => 6 + ); + + $updateRes = $proj->helpdeskObj->update_record($helpdeskId, $updatesArr); + + //make the old solution... better. + $oldSolution = "Re-opened."; + $remarkRes = $proj->helpdeskObj->remark($helpdeskId, $oldSolution); + + } + else { + } + } + + if(!isset($_POST['xajax'])) { + $page->gfObj->conditional_header("/content/helpdesk/view?ID=". $helpdeskId); + } +} +else { $helpdeskId = $_GET['ID']; $action = $page->ftsSections[2]; @@ -211,7 +385,7 @@ $page->add_template_var('associatedUser_data', $parsedRow); } - +} //call the function to add AJAX stuff... addAjax(); This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <cra...@us...> - 2009-02-06 17:15:05
|
Revision: 931 http://cs-project.svn.sourceforge.net/cs-project/?rev=931&view=rev Author: crazedsanity Date: 2009-02-06 17:14:54 +0000 (Fri, 06 Feb 2009) Log Message: ----------- Ripped the shared.inc file into the appropriately-named include scripts. Modified Paths: -------------- trunk/1.2/includes/content/project/shared.inc Added Paths: ----------- trunk/1.2/includes/content/project/create.inc trunk/1.2/includes/content/project/index.inc trunk/1.2/includes/content/project/view.inc Copied: trunk/1.2/includes/content/project/create.inc (from rev 930, trunk/1.2/includes/content/project/shared.inc) =================================================================== --- trunk/1.2/includes/content/project/create.inc (rev 0) +++ trunk/1.2/includes/content/project/create.inc 2009-02-06 17:14:54 UTC (rev 931) @@ -0,0 +1,42 @@ +<?php +/* + * SVN INFORMATION::: + * ------------------ + * Last Author: $Author$ + * Current Revision: $Revision$ + * Repository Location: $HeadURL$ + * Last Updated: $Date$ + */ + + + //set the "parent" arbitrarily (give it a default), then check the URL to see if it's specified. + $parent = 0; + if(is_numeric($_GET['parent'])) { + $parent = $_GET['parent']; + } + //make sure all the projects aren't displayed... + $showAllProjects = FALSE; + + //now set the proper content. + create_page_title($page, array('title' => "Create New Project")); + $page->add_template_var("parent", $parent); + $page->add_template_var("submit_name", "Create Project"); + + //create the "chef" and "participants" list. + //TODO: if creating a sub-project, select the list of users that had been selected for the parent... + $page->add_template_var("select_linked_users", $proj->create_user_option_list($_SESSION['user_ID'],NULL,NULL,FALSE)); + $page->add_template_var("select_leader_uid", $proj->create_user_option_list($_SESSION['user_ID'])); + + //add the priority thing. + $priorityOptionLIst = create_priority_option_list(50); + $page->add_template_var("select_priority", $priorityOptionLIst); + + //give a default for the begin & end dates. + //TODO: if it's a sub-project (if $_GET['parent'] > 0), use the "end" value for the parent. + $page->add_template_var("start_date", date("Y-m-d")); + $page->add_template_var("deadline", strftime("%Y-%m-%d", strtotime("+1 month"))); + + $page->add_template_var("parentProjectId", $_GET['parent']); + + +?> Copied: trunk/1.2/includes/content/project/index.inc (from rev 930, trunk/1.2/includes/content/project/shared.inc) =================================================================== --- trunk/1.2/includes/content/project/index.inc (rev 0) +++ trunk/1.2/includes/content/project/index.inc 2009-02-06 17:14:54 UTC (rev 931) @@ -0,0 +1,49 @@ +<?php +/* + * SVN INFORMATION::: + * ------------------ + * Last Author: $Author$ + * Current Revision: $Revision$ + * Repository Location: $HeadURL$ + * Last Updated: $Date$ + */ + + + //check to see if something's been selected to expand... + $expandArr = $page->ui->get_cache("expandArr"); + if(!is_array($expandArr)) { + $expandArr = array(); + } + $expandId = $_GET['expandId']; + $expandAction = $_GET['expand']; + if($expandAction && $expandId) { + //let's add it to the array. + if($expandAction == "open" && !isset($expandArr[$expandId])) { + //add it to the array!!! + $expandArr[$expandId] = $_GET['level']; + } + elseif($expandAction == "close" && isset($expandArr[$expandId])) { + //remove it, so it's not expanded anymore. + unset($expandArr[$expandId]); + } + } + $page->ui->set_cache("expandArr", $expandArr); + + #$page->change_content(html_file_to_string("modules/project/project_main.tmpl")); + $page->set_all_block_rows("content"); + + //set some template vars for the filtering. + $page->add_template_var("filter_keyword", $filterData['keyword']); + $page->add_template_var("filter_field_". $filterData['field'] ."_selected", "selected"); + $page->add_template_var("filter_status_id_". $filterData['status_id'] ."_selected", "selected"); + + //show the main (root) level projects. + $sortArr = $page->ui->get_cache("$module/currentSort"); + $projectsArr = $proj->list_projects(0,$sortArr,$filter); + $page->add_template_var("project_row", process_row($page, $projectsArr, $expandArr, $page->templateRows['project_row'])); + + //loop through the sub-projects. + process_subProjects($page, $proj, $filter); + + +?> Modified: trunk/1.2/includes/content/project/shared.inc =================================================================== --- trunk/1.2/includes/content/project/shared.inc 2009-02-06 17:03:50 UTC (rev 930) +++ trunk/1.2/includes/content/project/shared.inc 2009-02-06 17:14:54 UTC (rev 931) @@ -92,384 +92,13 @@ } $filter = $filterData; unset($filter['status']); - +} - if($_GET['action']) { - //it's a get var... use it. - $action = $_GET['action']; - } - else { - //get the action from our handy URL. - $action = $page->ftsSections[2]; - - //example URL: /content/project/view/365 - // ^0 ^1 ^2 ^3 - } - $showAllProjects = TRUE; - - //TODO: fix the logic of this if/elseif/else statement, and make the "showAllProjects" better, so there is a GOOD DEFAULT. - //CREATE A NEW PROJECT!!! - if($action == "create") { - - //set the "parent" arbitrarily (give it a default), then check the URL to see if it's specified. - $parent = 0; - if(is_numeric($_GET['parent'])) { - $parent = $_GET['parent']; - } - //make sure all the projects aren't displayed... - $showAllProjects = FALSE; - - //now set the proper content. - create_page_title($page, array('title' => "Create New Project")); - $page->add_template_var("parent", $parent); - $page->add_template_var("submit_name", "Create Project"); - - //create the "chef" and "participants" list. - //TODO: if creating a sub-project, select the list of users that had been selected for the parent... - $page->add_template_var("select_linked_users", $proj->create_user_option_list($_SESSION['user_ID'],NULL,NULL,FALSE)); - $page->add_template_var("select_leader_uid", $proj->create_user_option_list($_SESSION['user_ID'])); - - //add the priority thing. - $priorityOptionLIst = create_priority_option_list(50); - $page->add_template_var("select_priority", $priorityOptionLIst); - - //give a default for the begin & end dates. - //TODO: if it's a sub-project (if $_GET['parent'] > 0), use the "end" value for the parent. - $page->add_template_var("start_date", date("Y-m-d")); - $page->add_template_var("deadline", strftime("%Y-%m-%d", strtotime("+1 month"))); - - $page->add_template_var("parentProjectId", $_GET['parent']); - - //attempting to view the details of a project, but had an invalid ID. - } - elseif($action == "view" && !is_numeric($_GET['ID'])) { - set_message_wrapper(array( - "title" => "Invalid ID", - "message" => "An invalid ID was specified [". $_GET['ID'] ."].<BR>\n" . - "You've been redirected here instead.", - "type" => "error" - )); - conditional_header("/content/project/"); - exit; - - - //VIEW THE DETAILS OF A PROJECT!!! - } - elseif($action == "view" && is_numeric($_GET['ID'])) { - - $showAllProjects = FALSE; - $projectId = $page->ui->magic_cache("ID", NULL, "project","_GET,_SESSION"); - $detailsArr = $proj->get_details($projectId); - - if(is_numeric($page->ui->get_cache("project/linkToIssue"))) { - $linkIssue = $page->ui->get_cache("project/linkToIssue"); - $page->ui->unset_cache("project/linkToIssue"); - - //now link it! - $helpdeskObj = new helpdeskClass($proj->db); - $helpdeskObj->helpdeskId = $linkIssue; - $issueData = $helpdeskObj->get_record($linkIssue); - $fixedIssueAncestry = preg_replace('/:'. $issueData['record_id'] .'$/', '', $issueData['ancestry']); - if($fixedIssueAncestry !== $detailsArr['ancestry']) { - try { - $remarkDetails = "Re-linked to [project_id=". $projectId ."]"; - if($issueData['ancestry_level'] > 1) { - $parentRecord= $helpdeskObj->get_parent_record($issueData['ancestry']); - $remarkDetails .= " from [project_id=". $parentRecord['public_id'] ."]"; - } - $linkRes = $helpdeskObj->update_record($linkIssue, array('parentRecordId' => $projectId)); - $helpdeskObj->remark($linkIssue, $remarkDetails); - - if($linkRes) { - $oldIsHelpdesk = $proj->helpdeskObj->isHelpdeskIssue; - $proj->helpdeskObj->isHelpdeskIssue=FALSE; - $oldProjData = $proj->helpdeskObj->get_parent_record($issueData['ancestry']); - $proj->helpdeskObj->isHelpdeskIssue=$oldIsHelpdesk; - $oldProjLinkList = $proj->get_ancestry_link_list($oldProjData['public_id'], TRUE, TRUE, TRUE); - - $page->set_message_wrapper(array( - 'title' => "Issue Linked Successfully", - 'message' => "Issue #". $linkIssue ." was successfully linked to this project.<BR><BR>" . - "<b>Back to old project:</b> [". $oldProjLinkList ."]", - 'type' => "status" - )); - } - else { - $page->set_message_wrapper(array( - 'title' => "Issue Linking FAILED", - 'message' => "Failed to link issue #". $linkIssue ." to this project, result was (". $linkRes .").", - 'type' => "status" - )); - } - - //now get the details for this project again. - $detailsArr = $proj->get_details($projectId); - } - catch(exception $e) { - $page->set_message_wrapper(array( - 'title' => "An Error Occurred", - 'message' => "While trying to link the record, a fatal error was encountered: ". $e->getMessage(), - 'type' => 'error' - )); - } - } - else { - $page->set_message_wrapper(array( - 'title' => "Issue Linkage Not Updated", - 'message' => "You chose the project that issue #". $linkIssue ." was already attached to; doing nothing.", - 'type' => 'error', - 'linkText' => "Back to issue #". $linkIssue, - 'linkUrl' => "/content/helpdesk/view?ID=". $linkIssue - )); - } - } - - //TODO: Create a link or something for moving it to a new parent (something like the main list, where clicking will change the parent). - $page->add_template_var("submit_name", "Modify"); - - create_page_title($page, array('title' => "Project #". $_GET['ID'] .": \"". $detailsArr['name'] ."\"")); - $page->add_template_var("note_readonly", "readonly"); - $page->set_all_block_rows("content", array("related", "new_subproject_link", "status_section", "note_show")); - $page->set_all_block_rows("related_task"); - $page->set_all_block_rows("related_note"); - $page->set_all_block_rows("related_issue"); - - - //TODO: re-implement tags for projects. - - //re-add the "modify" button. - $page->add_template_var("modify_button", $page->templateRows['modify_button']); - - //format the "note" area. - if(strlen($detailsArr['subject']) > 0) { - $detailsArr['subject'] = cleanString($detailsArr['subject'], "htmlspecial_nq"); - $detailsArr['subject'] = cleanString($detailsArr['subject'], "htmlentity_plus_brackets"); - $detailsArr['subject'] = $bbCodeParser->parseString($detailsArr['subject']); - $detailsArr['subject'] = preg_replace("/\n/", "<BR>\n", $detailsArr['subject']); - $detailsArr['subject'] = preg_replace("/\s\s/", " ", $detailsArr['subject']); - } - else { - //no data. - $detailsArr['subject'] = '<font color="red"><b>[NO DATA]</b></font>'; - } - - //retrieve a list of it's parents. - $ancestryString = $proj->get_ancestry_link_list($projectId); - $displayProjectName = $ancestryString; - if(is_null($ancestryString)) { - // - $ancestryString = '<font color="red"><b>[N/A]</b></font>'; - $displayProjectName = $detailsArr['name']; - } - $page->add_template_var('ancestry_string', $ancestryString); - $page->add_template_var('projectName', $displayProjectName); - - //list the immediate children. - $childFilter = $filter; - $childFilter['ancestry_level'] = count(explode(':', $detailsArr['ancestry'])) +1; - $childrenString = $proj->get_children_string($projectId, $childFilter); - $childAncestryBoxSize = 100; - if(is_null($childrenString)) { - //set something. - $childrenString = '<font color="red"><b>[N/A]</b></font>'; - $childAncestryBoxSize = 20; - } - $page->add_template_var('children_string_height', $childAncestryBoxSize); - $page->add_template_var('children_string', $childrenString); - - - //format the start_date - $tmpStartDate = explode(" ", $detailsArr['start_date']); - $detailsArr['start_date'] = $tmpStartDate[0]; - - foreach($detailsArr as $field=>$value) { - $page->add_template_var($field, $value); - } - $page->add_template_var("project_name", $detailsArr['name']); - $page->add_template_var("select_status_id_". $detailsArr['status_id'], "selected"); - - - //TODO: make this use a better name... - $linkedUserList = array(); - if(is_array($detailsArr['linked_users'])) { - $linkedUserList = array_flip($detailsArr['linked_users']); - } - $page->add_template_var("select_linked_users", $proj->create_user_option_list($linkedUserList,NULL,NULL,FALSE)); - $page->add_template_var("select_leader_uid", $proj->create_user_option_list($detailsArr['leader_contact_id'], NULL, NULL, ' ---- none ----')); - - //add the priority (wichtung). - $priorityOptionLIst = create_priority_option_list($detailsArr['priority']); - $page->add_template_var("select_priority", $priorityOptionLIst); - unset($userList,$tSelected,$userListArr, $selLeader, $leaderSelect); - - //pull a couple of preferences, so we can say if they're getting the whole picture or not. - $taskPref = $proj->prefObj->get_pref_value_by_name('projectDetails_taskDisplayOnlyMine'); - $helpdeskPref = $proj->prefObj->get_pref_value_by_name('projectDetails_showCompletedIssues'); - - if($taskPref !== 'all') { - $page->add_template_var("taskPrefWarning", $page->templateRows['taskPrefWarning']); - } - - if($helpdeskPref == 0) { - $page->add_template_var("helpdeskPrefWarning", $page->templateRows['helpdeskPrefWarning']); - } - - //SPECIAL PROCESSING FOR TODO's... - if(is_array($detailsArr['related']['task'])) { - parse_related_task($detailsArr['related']['task']); - } - unset($detailsArr['related']['task']); - - //parse-in everything under "related"... - foreach($detailsArr['related'] as $type => $subArr) { - $rowName = "related_". $type ."_row"; - if(is_array($subArr) && isset($page->templateRows[$rowName])) { - //build the related rows... - unset($myRow, $bgColor, $bgColor2); - $baseRow = $page->templateRows[$rowName]; - foreach($subArr as $id=>$arr) { - swapValue($bgColor, "rgb(213, 213, 213)", "rgb(194, 194, 194)"); - swapValue($bgColor2, "#d5d5d5", "#c2c2c2"); - $repArr = array( - "id" => $id, - "bgColor" => $bgColor, - "bgColor2" => $bgColor2 - ); - - if($type == "issue") { - $arr['display_id'] = $id; - //special parsing of data for issues. - if(preg_match('/solved/', strtolower($arr['status_text']))) { - $strikeThroughArr = array( - "name", "assigned", "submit", "helpdesk_cat_name", "priority", "status_text", "display_id" - ); - foreach($strikeThroughArr as $field) { - $arr[$field] = '<del> '. $arr[$field] .' </del>'; - } - unset($strikeThroughArr); - } - $repArr['font_weight'] = 'normal'; - } - elseif($type == "task") { - $changeFontColor=TRUE; - //Making TODO stuff look purdy. Boy. - if(!preg_match('/accepted/', strtolower($arr['status_text']))) { - $repArr['bgColor'] = "e0e0e0"; - $repArr['bgColor2'] = "e0e0e0"; - } - - //Add dashes to fields that don't have any information in them. - if(strlen($arr['deadline']) <6) { - $changeFontColor = FALSE; - $arr['deadline'] = "————"; - } - if(strlen($arr['begin_date']) <6) { - $changeFontColor = FALSE; - $arr['begin_date'] = "————"; - } - if(strlen($arr['assigned_user']) == 0) { - //put some dashes in if nobody is assigned. - $arr['assigned_user'] = "——"; - } - - //cross-out all items that are ended. - if(preg_match('/ended/', strtolower($arr['status_text']))) { - $changeFontColor = FALSE; - $strikeThroughArr = array( - "creator", "creator", "assigned", "status_text", "remark", "begin_date", "deadline" - ); - foreach($strikeThroughArr as $myField) { - $arr[$myField] = '<del> '. $arr[$myField] .' </del>'; - } - unset($strikeThroughArr); - } - - if(strlen($arr['deadline']) && preg_match('/ended/', strtolower($arr['status_text']))) { - //make the deadline look nice. - $today = date("Ymd"); - $myDeadline = str_replace("-", "", $arr['deadline']); - settype($myDeadline, "int"); - settype($today, "int"); - - if(!$changeFontColor) { - //do nothing. - } - elseif($myDeadline <= $today) { - $arr['deadline'] = '<font color="red"><b>'. $arr['deadline'] .'</b></font>'; - } - else { - $arr['deadline'] = '<font color="green">'. $arr['deadline'] .'</font>'; - } - } - - if($arr['status_id'] == 2) { - $repArr['font_weight'] = "bold"; - } - else { - $repArr['font_weight'] = "normal"; - } - } - - //put every item in our array into the replacement array. - foreach($arr as $x=>$y) { - $repArr[$x] = $y; - } - $myRow .= mini_parser($baseRow, $repArr, "%%", "%%"); - } - $page->add_template_var($rowName, $myRow); - } - } - - //set a var in the session to go back to here... - $_SESSION['goBackLink'] = "/content/project/view?ID=". $_GET['ID']; - } - - - if($showAllProjects) { - //check to see if something's been selected to expand... - $expandArr = $page->ui->get_cache("expandArr"); - if(!is_array($expandArr)) { - $expandArr = array(); - } - $expandId = $_GET['expandId']; - $expandAction = $_GET['expand']; - if($expandAction && $expandId) { - //let's add it to the array. - if($expandAction == "open" && !isset($expandArr[$expandId])) { - //add it to the array!!! - $expandArr[$expandId] = $_GET['level']; - } - elseif($expandAction == "close" && isset($expandArr[$expandId])) { - //remove it, so it's not expanded anymore. - unset($expandArr[$expandId]); - } - } - $page->ui->set_cache("expandArr", $expandArr); - - #$page->change_content(html_file_to_string("modules/project/project_main.tmpl")); - $page->set_all_block_rows("content"); - - //set some template vars for the filtering. - $page->add_template_var("filter_keyword", $filterData['keyword']); - $page->add_template_var("filter_field_". $filterData['field'] ."_selected", "selected"); - $page->add_template_var("filter_status_id_". $filterData['status_id'] ."_selected", "selected"); - - //show the main (root) level projects. - $sortArr = $page->ui->get_cache("$module/currentSort"); - $projectsArr = $proj->list_projects(0,$sortArr,$filter); - $page->add_template_var("project_row", process_row($page, $projectsArr, $expandArr, $page->templateRows['project_row'])); - - //loop through the sub-projects. - process_subProjects($page, $proj, $filter); - } -} - - //========================================================================================== function process_row(&$page, $projectArr, $expandArr, $baseRow, $level=0) { //loop through the array... Copied: trunk/1.2/includes/content/project/view.inc (from rev 930, trunk/1.2/includes/content/project/shared.inc) =================================================================== --- trunk/1.2/includes/content/project/view.inc (rev 0) +++ trunk/1.2/includes/content/project/view.inc 2009-02-06 17:14:54 UTC (rev 931) @@ -0,0 +1,353 @@ +<?php +/* + * SVN INFORMATION::: + * ------------------ + * Last Author: $Author$ + * Current Revision: $Revision$ + * Repository Location: $HeadURL$ + * Last Updated: $Date$ + */ + + + + // +++ SETUP FILTERING +++ + $filterData = $page->ui->get_cache("$module/filter"); + if(!is_array($filterData)) { + //no filter array... set one. + $filterData = array(); + $page->ui->set_cache("$module/filter", $filterData); + } + + //setup the "linkExtra"... + if(is_numeric($_GET['linkToIssue'])) { + $page->ui->set_cache("project/linkToIssue", $_GET['linkToIssue']); + } + + if(is_numeric($page->ui->get_cache("project/linkToIssue"))) { + $page->set_message_wrapper(array( + 'title' => "Re-linking Issue", + 'message' => "Please select the project that issue #". $page->ui->get_cache("project/linkToIssue") ." will be linked to.", + 'type' => "notice", + 'linkURL' => "/content/helpdesk/view?ID=". $page->ui->get_cache("project/linkToIssue"), + 'linkText' => "Back to issue #". $page->ui->get_cache("project/linkToIssue") + )); + } + + //the data will already show only items with the given status, so don't add that to the filter again. + $primaryFilterArr = array("status_id" => $filterData['status_id']); + if($filterData['status_id'] == "all") { + //no filter: we're showing everything. + unset($filterData['status_id']); + } + elseif(!isset($filterData['status_id'])) { + //this shows everything EXCEPT the "ended" items. + $filterData['status_id'] = $GLOBALS['STATUS_NOTENDED']; + } + $filter = $filterData; + unset($filter['status']); + + + if($_GET['action']) { + //it's a get var... use it. + $action = $_GET['action']; + } + else { + //get the action from our handy URL. + $action = $page->ftsSections[2]; + + //example URL: /content/project/view/365 + // ^0 ^1 ^2 ^3 + } + $showAllProjects = TRUE; + + //TODO: fix the logic of this if/elseif/else statement, and make the "showAllProjects" better, so there is a GOOD DEFAULT. + //CREATE A NEW PROJECT!!! + if($action == "create") { + + + //attempting to view the details of a project, but had an invalid ID. + } + elseif($action == "view" && !is_numeric($_GET['ID'])) { + set_message_wrapper(array( + "title" => "Invalid ID", + "message" => "An invalid ID was specified [". $_GET['ID'] ."].<BR>\n" . + "You've been redirected here instead.", + "type" => "error" + )); + conditional_header("/content/project/"); + exit; + + + //VIEW THE DETAILS OF A PROJECT!!! + } + elseif($action == "view" && is_numeric($_GET['ID'])) { + + $showAllProjects = FALSE; + $projectId = $page->ui->magic_cache("ID", NULL, "project","_GET,_SESSION"); + $detailsArr = $proj->get_details($projectId); + + if(is_numeric($page->ui->get_cache("project/linkToIssue"))) { + $linkIssue = $page->ui->get_cache("project/linkToIssue"); + $page->ui->unset_cache("project/linkToIssue"); + + //now link it! + $helpdeskObj = new helpdeskClass($proj->db); + $helpdeskObj->helpdeskId = $linkIssue; + $issueData = $helpdeskObj->get_record($linkIssue); + $fixedIssueAncestry = preg_replace('/:'. $issueData['record_id'] .'$/', '', $issueData['ancestry']); + if($fixedIssueAncestry !== $detailsArr['ancestry']) { + try { + $remarkDetails = "Re-linked to [project_id=". $projectId ."]"; + if($issueData['ancestry_level'] > 1) { + $parentRecord= $helpdeskObj->get_parent_record($issueData['ancestry']); + $remarkDetails .= " from [project_id=". $parentRecord['public_id'] ."]"; + } + $linkRes = $helpdeskObj->update_record($linkIssue, array('parentRecordId' => $projectId)); + $helpdeskObj->remark($linkIssue, $remarkDetails); + + if($linkRes) { + $oldIsHelpdesk = $proj->helpdeskObj->isHelpdeskIssue; + $proj->helpdeskObj->isHelpdeskIssue=FALSE; + $oldProjData = $proj->helpdeskObj->get_parent_record($issueData['ancestry']); + $proj->helpdeskObj->isHelpdeskIssue=$oldIsHelpdesk; + $oldProjLinkList = $proj->get_ancestry_link_list($oldProjData['public_id'], TRUE, TRUE, TRUE); + + $page->set_message_wrapper(array( + 'title' => "Issue Linked Successfully", + 'message' => "Issue #". $linkIssue ." was successfully linked to this project.<BR><BR>" . + "<b>Back to old project:</b> [". $oldProjLinkList ."]", + 'type' => "status" + )); + } + else { + $page->set_message_wrapper(array( + 'title' => "Issue Linking FAILED", + 'message' => "Failed to link issue #". $linkIssue ." to this project, result was (". $linkRes .").", + 'type' => "status" + )); + } + + //now get the details for this project again. + $detailsArr = $proj->get_details($projectId); + } + catch(exception $e) { + $page->set_message_wrapper(array( + 'title' => "An Error Occurred", + 'message' => "While trying to link the record, a fatal error was encountered: ". $e->getMessage(), + 'type' => 'error' + )); + } + } + else { + $page->set_message_wrapper(array( + 'title' => "Issue Linkage Not Updated", + 'message' => "You chose the project that issue #". $linkIssue ." was already attached to; doing nothing.", + 'type' => 'error', + 'linkText' => "Back to issue #". $linkIssue, + 'linkUrl' => "/content/helpdesk/view?ID=". $linkIssue + )); + } + } + + //TODO: Create a link or something for moving it to a new parent (something like the main list, where clicking will change the parent). + $page->add_template_var("submit_name", "Modify"); + + create_page_title($page, array('title' => "Project #". $_GET['ID'] .": \"". $detailsArr['name'] ."\"")); + $page->add_template_var("note_readonly", "readonly"); + $page->set_all_block_rows("content", array("related", "new_subproject_link", "status_section", "note_show")); + $page->set_all_block_rows("related_task"); + $page->set_all_block_rows("related_note"); + $page->set_all_block_rows("related_issue"); + + + //TODO: re-implement tags for projects. + + //re-add the "modify" button. + $page->add_template_var("modify_button", $page->templateRows['modify_button']); + + //format the "note" area. + if(strlen($detailsArr['subject']) > 0) { + $detailsArr['subject'] = cleanString($detailsArr['subject'], "htmlspecial_nq"); + $detailsArr['subject'] = cleanString($detailsArr['subject'], "htmlentity_plus_brackets"); + $detailsArr['subject'] = $bbCodeParser->parseString($detailsArr['subject']); + $detailsArr['subject'] = preg_replace("/\n/", "<BR>\n", $detailsArr['subject']); + $detailsArr['subject'] = preg_replace("/\s\s/", " ", $detailsArr['subject']); + } + else { + //no data. + $detailsArr['subject'] = '<font color="red"><b>[NO DATA]</b></font>'; + } + + //retrieve a list of it's parents. + $ancestryString = $proj->get_ancestry_link_list($projectId); + $displayProjectName = $ancestryString; + if(is_null($ancestryString)) { + // + $ancestryString = '<font color="red"><b>[N/A]</b></font>'; + $displayProjectName = $detailsArr['name']; + } + $page->add_template_var('ancestry_string', $ancestryString); + $page->add_template_var('projectName', $displayProjectName); + + //list the immediate children. + $childFilter = $filter; + $childFilter['ancestry_level'] = count(explode(':', $detailsArr['ancestry'])) +1; + $childrenString = $proj->get_children_string($projectId, $childFilter); + $childAncestryBoxSize = 100; + if(is_null($childrenString)) { + //set something. + $childrenString = '<font color="red"><b>[N/A]</b></font>'; + $childAncestryBoxSize = 20; + } + $page->add_template_var('children_string_height', $childAncestryBoxSize); + $page->add_template_var('children_string', $childrenString); + + + //format the start_date + $tmpStartDate = explode(" ", $detailsArr['start_date']); + $detailsArr['start_date'] = $tmpStartDate[0]; + + foreach($detailsArr as $field=>$value) { + $page->add_template_var($field, $value); + } + $page->add_template_var("project_name", $detailsArr['name']); + $page->add_template_var("select_status_id_". $detailsArr['status_id'], "selected"); + + + //TODO: make this use a better name... + $linkedUserList = array(); + if(is_array($detailsArr['linked_users'])) { + $linkedUserList = array_flip($detailsArr['linked_users']); + } + $page->add_template_var("select_linked_users", $proj->create_user_option_list($linkedUserList,NULL,NULL,FALSE)); + $page->add_template_var("select_leader_uid", $proj->create_user_option_list($detailsArr['leader_contact_id'], NULL, NULL, ' ---- none ----')); + + //add the priority (wichtung). + $priorityOptionLIst = create_priority_option_list($detailsArr['priority']); + $page->add_template_var("select_priority", $priorityOptionLIst); + unset($userList,$tSelected,$userListArr, $selLeader, $leaderSelect); + + //pull a couple of preferences, so we can say if they're getting the whole picture or not. + $taskPref = $proj->prefObj->get_pref_value_by_name('projectDetails_taskDisplayOnlyMine'); + $helpdeskPref = $proj->prefObj->get_pref_value_by_name('projectDetails_showCompletedIssues'); + + if($taskPref !== 'all') { + $page->add_template_var("taskPrefWarning", $page->templateRows['taskPrefWarning']); + } + + if($helpdeskPref == 0) { + $page->add_template_var("helpdeskPrefWarning", $page->templateRows['helpdeskPrefWarning']); + } + + //SPECIAL PROCESSING FOR TODO's... + if(is_array($detailsArr['related']['task'])) { + parse_related_task($detailsArr['related']['task']); + } + unset($detailsArr['related']['task']); + + //parse-in everything under "related"... + foreach($detailsArr['related'] as $type => $subArr) { + $rowName = "related_". $type ."_row"; + if(is_array($subArr) && isset($page->templateRows[$rowName])) { + //build the related rows... + unset($myRow, $bgColor, $bgColor2); + $baseRow = $page->templateRows[$rowName]; + foreach($subArr as $id=>$arr) { + swapValue($bgColor, "rgb(213, 213, 213)", "rgb(194, 194, 194)"); + swapValue($bgColor2, "#d5d5d5", "#c2c2c2"); + $repArr = array( + "id" => $id, + "bgColor" => $bgColor, + "bgColor2" => $bgColor2 + ); + + if($type == "issue") { + $arr['display_id'] = $id; + //special parsing of data for issues. + if(preg_match('/solved/', strtolower($arr['status_text']))) { + $strikeThroughArr = array( + "name", "assigned", "submit", "helpdesk_cat_name", "priority", "status_text", "display_id" + ); + foreach($strikeThroughArr as $field) { + $arr[$field] = '<del> '. $arr[$field] .' </del>'; + } + unset($strikeThroughArr); + } + $repArr['font_weight'] = 'normal'; + } + elseif($type == "task") { + $changeFontColor=TRUE; + //Making TODO stuff look purdy. Boy. + if(!preg_match('/accepted/', strtolower($arr['status_text']))) { + $repArr['bgColor'] = "e0e0e0"; + $repArr['bgColor2'] = "e0e0e0"; + } + + //Add dashes to fields that don't have any information in them. + if(strlen($arr['deadline']) <6) { + $changeFontColor = FALSE; + $arr['deadline'] = "————"; + } + if(strlen($arr['begin_date']) <6) { + $changeFontColor = FALSE; + $arr['begin_date'] = "————"; + } + if(strlen($arr['assigned_user']) == 0) { + //put some dashes in if nobody is assigned. + $arr['assigned_user'] = "——"; + } + + //cross-out all items that are ended. + if(preg_match('/ended/', strtolower($arr['status_text']))) { + $changeFontColor = FALSE; + $strikeThroughArr = array( + "creator", "creator", "assigned", "status_text", "remark", "begin_date", "deadline" + ); + foreach($strikeThroughArr as $myField) { + $arr[$myField] = '<del> '. $arr[$myField] .' </del>'; + } + unset($strikeThroughArr); + } + + if(strlen($arr['deadline']) && preg_match('/ended/', strtolower($arr['status_text']))) { + //make the deadline look nice. + $today = date("Ymd"); + $myDeadline = str_replace("-", "", $arr['deadline']); + settype($myDeadline, "int"); + settype($today, "int"); + + if(!$changeFontColor) { + //do nothing. + } + elseif($myDeadline <= $today) { + $arr['deadline'] = '<font color="red"><b>'. $arr['deadline'] .'</b></font>'; + } + else { + $arr['deadline'] = '<font color="green">'. $arr['deadline'] .'</font>'; + } + } + + if($arr['status_id'] == 2) { + $repArr['font_weight'] = "bold"; + } + else { + $repArr['font_weight'] = "normal"; + } + } + + //put every item in our array into the replacement array. + foreach($arr as $x=>$y) { + $repArr[$x] = $y; + } + $myRow .= mini_parser($baseRow, $repArr, "%%", "%%"); + } + $page->add_template_var($rowName, $myRow); + } + } + + //set a var in the session to go back to here... + $_SESSION['goBackLink'] = "/content/project/view?ID=". $_GET['ID']; + } + + +?> This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <cra...@us...> - 2009-02-06 17:03:52
|
Revision: 930 http://cs-project.svn.sourceforge.net/cs-project/?rev=930&view=rev Author: crazedsanity Date: 2009-02-06 17:03:50 +0000 (Fri, 06 Feb 2009) Log Message: ----------- Updated message for notes box (#245) & minor alignment fix. Modified Paths: -------------- trunk/1.2/templates/content/helpdesk/view.content.tmpl Modified: trunk/1.2/templates/content/helpdesk/view.content.tmpl =================================================================== --- trunk/1.2/templates/content/helpdesk/view.content.tmpl 2009-02-06 17:02:25 UTC (rev 929) +++ trunk/1.2/templates/content/helpdesk/view.content.tmpl 2009-02-06 17:03:50 UTC (rev 930) @@ -194,7 +194,7 @@ </td> </tr> <tr> - <th style="border-bottom:solid #000 1px;" align="right">Notes:<BR><font size="-3"><i>(Includes previous/current<BR>solution(s), if available)</i></font></th> + <th style="border-bottom:solid #000 1px;" align="right">Comments:<BR><font size="-3"><i>(Includes previous/current<BR>solution(s), if available)</i></font></th> <td style="border-bottom:solid #000 1px;" colspan="2"> <!-- BEGIN issueNotes --> <div style="border-top:dashed #000 1px;"> @@ -208,7 +208,7 @@ <!-- BEGIN remark_row --> <tr> - <td colspan="3">Remark: <br> + <td colspan="3" align="center">Add a Comment (or solution by checking the box): <br> <textarea name="remark" rows="8" cols="80"></textarea> </td> </tr> This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <cra...@us...> - 2009-02-06 17:02:29
|
Revision: 929 http://cs-project.svn.sourceforge.net/cs-project/?rev=929&view=rev Author: crazedsanity Date: 2009-02-06 17:02:25 +0000 (Fri, 06 Feb 2009) Log Message: ----------- Begin splitting project.inc into pieces (#244). Added Paths: ----------- trunk/1.2/includes/content/project/ trunk/1.2/includes/content/project/shared.inc Removed Paths: ------------- trunk/1.2/includes/content/project.inc Copied: trunk/1.2/includes/content/project/shared.inc (from rev 923, trunk/1.2/includes/content/project.inc) =================================================================== --- trunk/1.2/includes/content/project/shared.inc (rev 0) +++ trunk/1.2/includes/content/project/shared.inc 2009-02-06 17:02:25 UTC (rev 929) @@ -0,0 +1,549 @@ +<?php +/* + * SVN INFORMATION::: + * ------------------ + * Last Author: $Author$ + * Current Revision: $Revision$ + * Repository Location: $HeadURL$ + * Last Updated: $Date$ + */ + +if($_POST) { + $projectId = $_POST['ID']; + $proj->projectId = $projectId; + + + //figure out what we need to change... + if($_POST['action'] == "filter") { + if($_POST['reset_filter']) { + $page->ui->unset_cache("$module/filter"); + $result = "unset"; + } + else { + //store the filter. + $page->ui->set_cache("$module/filter", $_POST['filter']); + $result = "set"; + } + } + elseif($_POST['ID'] == "new") { + unset($_POST['ID']); + $result = $proj->create_project($_POST['data']); + $extra = "/view?ID=". $result; + #exit; + } + else { + //TODO: check to see if somebody else has updated the project since this user viewed the page... + $updateRes = $proj->update_project($_POST['data']); + if($updateRes) { + set_message_wrapper(array( + "title" => "Successfully Updated", + "message" => "Update successful. Good job!", + "type" => "status" + )); + $extra = "/view?ID=". $projectId; + } + else { + set_message_wrapper(array( + "title" => "Unable to Update", + "message" => "Something happened, and the update failed. Sorry, dude.", + "type" => "fatal" + )); + } + } + + //okay, now send 'em to the right page. + conditional_header("/content/project". $extra); + exit; +} +else { + + // +++ SETUP FILTERING +++ + $filterData = $page->ui->get_cache("$module/filter"); + if(!is_array($filterData)) { + //no filter array... set one. + $filterData = array(); + $page->ui->set_cache("$module/filter", $filterData); + } + + //setup the "linkExtra"... + if(is_numeric($_GET['linkToIssue'])) { + $page->ui->set_cache("project/linkToIssue", $_GET['linkToIssue']); + } + + if(is_numeric($page->ui->get_cache("project/linkToIssue"))) { + $page->set_message_wrapper(array( + 'title' => "Re-linking Issue", + 'message' => "Please select the project that issue #". $page->ui->get_cache("project/linkToIssue") ." will be linked to.", + 'type' => "notice", + 'linkURL' => "/content/helpdesk/view?ID=". $page->ui->get_cache("project/linkToIssue"), + 'linkText' => "Back to issue #". $page->ui->get_cache("project/linkToIssue") + )); + } + + //the data will already show only items with the given status, so don't add that to the filter again. + $primaryFilterArr = array("status_id" => $filterData['status_id']); + if($filterData['status_id'] == "all") { + //no filter: we're showing everything. + unset($filterData['status_id']); + } + elseif(!isset($filterData['status_id'])) { + //this shows everything EXCEPT the "ended" items. + $filterData['status_id'] = $GLOBALS['STATUS_NOTENDED']; + } + $filter = $filterData; + unset($filter['status']); + + + if($_GET['action']) { + //it's a get var... use it. + $action = $_GET['action']; + } + else { + //get the action from our handy URL. + $action = $page->ftsSections[2]; + + //example URL: /content/project/view/365 + // ^0 ^1 ^2 ^3 + } + $showAllProjects = TRUE; + + //TODO: fix the logic of this if/elseif/else statement, and make the "showAllProjects" better, so there is a GOOD DEFAULT. + //CREATE A NEW PROJECT!!! + if($action == "create") { + + //set the "parent" arbitrarily (give it a default), then check the URL to see if it's specified. + $parent = 0; + if(is_numeric($_GET['parent'])) { + $parent = $_GET['parent']; + } + //make sure all the projects aren't displayed... + $showAllProjects = FALSE; + + //now set the proper content. + create_page_title($page, array('title' => "Create New Project")); + $page->add_template_var("parent", $parent); + $page->add_template_var("submit_name", "Create Project"); + + //create the "chef" and "participants" list. + //TODO: if creating a sub-project, select the list of users that had been selected for the parent... + $page->add_template_var("select_linked_users", $proj->create_user_option_list($_SESSION['user_ID'],NULL,NULL,FALSE)); + $page->add_template_var("select_leader_uid", $proj->create_user_option_list($_SESSION['user_ID'])); + + //add the priority thing. + $priorityOptionLIst = create_priority_option_list(50); + $page->add_template_var("select_priority", $priorityOptionLIst); + + //give a default for the begin & end dates. + //TODO: if it's a sub-project (if $_GET['parent'] > 0), use the "end" value for the parent. + $page->add_template_var("start_date", date("Y-m-d")); + $page->add_template_var("deadline", strftime("%Y-%m-%d", strtotime("+1 month"))); + + $page->add_template_var("parentProjectId", $_GET['parent']); + + + + //attempting to view the details of a project, but had an invalid ID. + } + elseif($action == "view" && !is_numeric($_GET['ID'])) { + set_message_wrapper(array( + "title" => "Invalid ID", + "message" => "An invalid ID was specified [". $_GET['ID'] ."].<BR>\n" . + "You've been redirected here instead.", + "type" => "error" + )); + conditional_header("/content/project/"); + exit; + + + //VIEW THE DETAILS OF A PROJECT!!! + } + elseif($action == "view" && is_numeric($_GET['ID'])) { + + $showAllProjects = FALSE; + $projectId = $page->ui->magic_cache("ID", NULL, "project","_GET,_SESSION"); + $detailsArr = $proj->get_details($projectId); + + if(is_numeric($page->ui->get_cache("project/linkToIssue"))) { + $linkIssue = $page->ui->get_cache("project/linkToIssue"); + $page->ui->unset_cache("project/linkToIssue"); + + //now link it! + $helpdeskObj = new helpdeskClass($proj->db); + $helpdeskObj->helpdeskId = $linkIssue; + $issueData = $helpdeskObj->get_record($linkIssue); + $fixedIssueAncestry = preg_replace('/:'. $issueData['record_id'] .'$/', '', $issueData['ancestry']); + if($fixedIssueAncestry !== $detailsArr['ancestry']) { + try { + $remarkDetails = "Re-linked to [project_id=". $projectId ."]"; + if($issueData['ancestry_level'] > 1) { + $parentRecord= $helpdeskObj->get_parent_record($issueData['ancestry']); + $remarkDetails .= " from [project_id=". $parentRecord['public_id'] ."]"; + } + $linkRes = $helpdeskObj->update_record($linkIssue, array('parentRecordId' => $projectId)); + $helpdeskObj->remark($linkIssue, $remarkDetails); + + if($linkRes) { + $oldIsHelpdesk = $proj->helpdeskObj->isHelpdeskIssue; + $proj->helpdeskObj->isHelpdeskIssue=FALSE; + $oldProjData = $proj->helpdeskObj->get_parent_record($issueData['ancestry']); + $proj->helpdeskObj->isHelpdeskIssue=$oldIsHelpdesk; + $oldProjLinkList = $proj->get_ancestry_link_list($oldProjData['public_id'], TRUE, TRUE, TRUE); + + $page->set_message_wrapper(array( + 'title' => "Issue Linked Successfully", + 'message' => "Issue #". $linkIssue ." was successfully linked to this project.<BR><BR>" . + "<b>Back to old project:</b> [". $oldProjLinkList ."]", + 'type' => "status" + )); + } + else { + $page->set_message_wrapper(array( + 'title' => "Issue Linking FAILED", + 'message' => "Failed to link issue #". $linkIssue ." to this project, result was (". $linkRes .").", + 'type' => "status" + )); + } + + //now get the details for this project again. + $detailsArr = $proj->get_details($projectId); + } + catch(exception $e) { + $page->set_message_wrapper(array( + 'title' => "An Error Occurred", + 'message' => "While trying to link the record, a fatal error was encountered: ". $e->getMessage(), + 'type' => 'error' + )); + } + } + else { + $page->set_message_wrapper(array( + 'title' => "Issue Linkage Not Updated", + 'message' => "You chose the project that issue #". $linkIssue ." was already attached to; doing nothing.", + 'type' => 'error', + 'linkText' => "Back to issue #". $linkIssue, + 'linkUrl' => "/content/helpdesk/view?ID=". $linkIssue + )); + } + } + + //TODO: Create a link or something for moving it to a new parent (something like the main list, where clicking will change the parent). + $page->add_template_var("submit_name", "Modify"); + + create_page_title($page, array('title' => "Project #". $_GET['ID'] .": \"". $detailsArr['name'] ."\"")); + $page->add_template_var("note_readonly", "readonly"); + $page->set_all_block_rows("content", array("related", "new_subproject_link", "status_section", "note_show")); + $page->set_all_block_rows("related_task"); + $page->set_all_block_rows("related_note"); + $page->set_all_block_rows("related_issue"); + + + //TODO: re-implement tags for projects. + + //re-add the "modify" button. + $page->add_template_var("modify_button", $page->templateRows['modify_button']); + + //format the "note" area. + if(strlen($detailsArr['subject']) > 0) { + $detailsArr['subject'] = cleanString($detailsArr['subject'], "htmlspecial_nq"); + $detailsArr['subject'] = cleanString($detailsArr['subject'], "htmlentity_plus_brackets"); + $detailsArr['subject'] = $bbCodeParser->parseString($detailsArr['subject']); + $detailsArr['subject'] = preg_replace("/\n/", "<BR>\n", $detailsArr['subject']); + $detailsArr['subject'] = preg_replace("/\s\s/", " ", $detailsArr['subject']); + } + else { + //no data. + $detailsArr['subject'] = '<font color="red"><b>[NO DATA]</b></font>'; + } + + //retrieve a list of it's parents. + $ancestryString = $proj->get_ancestry_link_list($projectId); + $displayProjectName = $ancestryString; + if(is_null($ancestryString)) { + // + $ancestryString = '<font color="red"><b>[N/A]</b></font>'; + $displayProjectName = $detailsArr['name']; + } + $page->add_template_var('ancestry_string', $ancestryString); + $page->add_template_var('projectName', $displayProjectName); + + //list the immediate children. + $childFilter = $filter; + $childFilter['ancestry_level'] = count(explode(':', $detailsArr['ancestry'])) +1; + $childrenString = $proj->get_children_string($projectId, $childFilter); + $childAncestryBoxSize = 100; + if(is_null($childrenString)) { + //set something. + $childrenString = '<font color="red"><b>[N/A]</b></font>'; + $childAncestryBoxSize = 20; + } + $page->add_template_var('children_string_height', $childAncestryBoxSize); + $page->add_template_var('children_string', $childrenString); + + + //format the start_date + $tmpStartDate = explode(" ", $detailsArr['start_date']); + $detailsArr['start_date'] = $tmpStartDate[0]; + + foreach($detailsArr as $field=>$value) { + $page->add_template_var($field, $value); + } + $page->add_template_var("project_name", $detailsArr['name']); + $page->add_template_var("select_status_id_". $detailsArr['status_id'], "selected"); + + + //TODO: make this use a better name... + $linkedUserList = array(); + if(is_array($detailsArr['linked_users'])) { + $linkedUserList = array_flip($detailsArr['linked_users']); + } + $page->add_template_var("select_linked_users", $proj->create_user_option_list($linkedUserList,NULL,NULL,FALSE)); + $page->add_template_var("select_leader_uid", $proj->create_user_option_list($detailsArr['leader_contact_id'], NULL, NULL, ' ---- none ----')); + + //add the priority (wichtung). + $priorityOptionLIst = create_priority_option_list($detailsArr['priority']); + $page->add_template_var("select_priority", $priorityOptionLIst); + unset($userList,$tSelected,$userListArr, $selLeader, $leaderSelect); + + //pull a couple of preferences, so we can say if they're getting the whole picture or not. + $taskPref = $proj->prefObj->get_pref_value_by_name('projectDetails_taskDisplayOnlyMine'); + $helpdeskPref = $proj->prefObj->get_pref_value_by_name('projectDetails_showCompletedIssues'); + + if($taskPref !== 'all') { + $page->add_template_var("taskPrefWarning", $page->templateRows['taskPrefWarning']); + } + + if($helpdeskPref == 0) { + $page->add_template_var("helpdeskPrefWarning", $page->templateRows['helpdeskPrefWarning']); + } + + //SPECIAL PROCESSING FOR TODO's... + if(is_array($detailsArr['related']['task'])) { + parse_related_task($detailsArr['related']['task']); + } + unset($detailsArr['related']['task']); + + //parse-in everything under "related"... + foreach($detailsArr['related'] as $type => $subArr) { + $rowName = "related_". $type ."_row"; + if(is_array($subArr) && isset($page->templateRows[$rowName])) { + //build the related rows... + unset($myRow, $bgColor, $bgColor2); + $baseRow = $page->templateRows[$rowName]; + foreach($subArr as $id=>$arr) { + swapValue($bgColor, "rgb(213, 213, 213)", "rgb(194, 194, 194)"); + swapValue($bgColor2, "#d5d5d5", "#c2c2c2"); + $repArr = array( + "id" => $id, + "bgColor" => $bgColor, + "bgColor2" => $bgColor2 + ); + + if($type == "issue") { + $arr['display_id'] = $id; + //special parsing of data for issues. + if(preg_match('/solved/', strtolower($arr['status_text']))) { + $strikeThroughArr = array( + "name", "assigned", "submit", "helpdesk_cat_name", "priority", "status_text", "display_id" + ); + foreach($strikeThroughArr as $field) { + $arr[$field] = '<del> '. $arr[$field] .' </del>'; + } + unset($strikeThroughArr); + } + $repArr['font_weight'] = 'normal'; + } + elseif($type == "task") { + $changeFontColor=TRUE; + //Making TODO stuff look purdy. Boy. + if(!preg_match('/accepted/', strtolower($arr['status_text']))) { + $repArr['bgColor'] = "e0e0e0"; + $repArr['bgColor2'] = "e0e0e0"; + } + + //Add dashes to fields that don't have any information in them. + if(strlen($arr['deadline']) <6) { + $changeFontColor = FALSE; + $arr['deadline'] = "————"; + } + if(strlen($arr['begin_date']) <6) { + $changeFontColor = FALSE; + $arr['begin_date'] = "————"; + } + if(strlen($arr['assigned_user']) == 0) { + //put some dashes in if nobody is assigned. + $arr['assigned_user'] = "——"; + } + + //cross-out all items that are ended. + if(preg_match('/ended/', strtolower($arr['status_text']))) { + $changeFontColor = FALSE; + $strikeThroughArr = array( + "creator", "creator", "assigned", "status_text", "remark", "begin_date", "deadline" + ); + foreach($strikeThroughArr as $myField) { + $arr[$myField] = '<del> '. $arr[$myField] .' </del>'; + } + unset($strikeThroughArr); + } + + if(strlen($arr['deadline']) && preg_match('/ended/', strtolower($arr['status_text']))) { + //make the deadline look nice. + $today = date("Ymd"); + $myDeadline = str_replace("-", "", $arr['deadline']); + settype($myDeadline, "int"); + settype($today, "int"); + + if(!$changeFontColor) { + //do nothing. + } + elseif($myDeadline <= $today) { + $arr['deadline'] = '<font color="red"><b>'. $arr['deadline'] .'</b></font>'; + } + else { + $arr['deadline'] = '<font color="green">'. $arr['deadline'] .'</font>'; + } + } + + if($arr['status_id'] == 2) { + $repArr['font_weight'] = "bold"; + } + else { + $repArr['font_weight'] = "normal"; + } + } + + //put every item in our array into the replacement array. + foreach($arr as $x=>$y) { + $repArr[$x] = $y; + } + $myRow .= mini_parser($baseRow, $repArr, "%%", "%%"); + } + $page->add_template_var($rowName, $myRow); + } + } + + //set a var in the session to go back to here... + $_SESSION['goBackLink'] = "/content/project/view?ID=". $_GET['ID']; + } + + + if($showAllProjects) { + //check to see if something's been selected to expand... + $expandArr = $page->ui->get_cache("expandArr"); + if(!is_array($expandArr)) { + $expandArr = array(); + } + $expandId = $_GET['expandId']; + $expandAction = $_GET['expand']; + if($expandAction && $expandId) { + //let's add it to the array. + if($expandAction == "open" && !isset($expandArr[$expandId])) { + //add it to the array!!! + $expandArr[$expandId] = $_GET['level']; + } + elseif($expandAction == "close" && isset($expandArr[$expandId])) { + //remove it, so it's not expanded anymore. + unset($expandArr[$expandId]); + } + } + $page->ui->set_cache("expandArr", $expandArr); + + #$page->change_content(html_file_to_string("modules/project/project_main.tmpl")); + $page->set_all_block_rows("content"); + + //set some template vars for the filtering. + $page->add_template_var("filter_keyword", $filterData['keyword']); + $page->add_template_var("filter_field_". $filterData['field'] ."_selected", "selected"); + $page->add_template_var("filter_status_id_". $filterData['status_id'] ."_selected", "selected"); + + //show the main (root) level projects. + $sortArr = $page->ui->get_cache("$module/currentSort"); + $projectsArr = $proj->list_projects(0,$sortArr,$filter); + $page->add_template_var("project_row", process_row($page, $projectsArr, $expandArr, $page->templateRows['project_row'])); + + //loop through the sub-projects. + process_subProjects($page, $proj, $filter); + } +} + + + + + +//========================================================================================== +function process_row(&$page, $projectArr, $expandArr, $baseRow, $level=0) { + //loop through the array... + $linkLevel = $level+1; + + + //pre-pad subprojects, so they appear indented. + if($level > 0) { + $basePad = " "; + for($i=0; $i < $linkLevel; $i++) { + $levelPad .= $basePad; + } + } + if(is_array($projectArr)) { + foreach($projectArr as $id=>$subArr) { + //parse stuff into the template row... + $rowColor1 = swapValue($rowColor1, "rgb(213, 213, 213)", "rgb(194, 194, 194)"); + $rowColor2 = swapValue($rowColor2,"#D5D5D5", "#C2C2C2"); + + $expand = "clear"; + if($subArr['num_children'] > 0) { + #if(in_array($id, $expandArr)) { + if(isset($expandArr[$id])) { + $expand = "open"; + $expand2= "close"; + } + else { + $expand = "close"; + $expand2="open"; + } + } + $repArr = $subArr; + $repArr['expand'] = $expand; + $repArr['expand2'] = $expand2; + $repArr['rowColor'] = $rowColor1; + $repArr['rowColor2'] = $rowColor2; + $repArr['levelPad'] = $levelPad; + $repArr['level'] = $linkLevel;//denotes which "level" the subprojects should be on... + + //if the current user owns the project, they can update it... show the stupid little box. + $repArr['status'] .= " %"; + + + $myRow .= mini_parser($baseRow, $repArr, "%%", "%%"); + } + } + + //done processing it... return our processed row. + return($myRow); +}//end process_row() +//========================================================================================== + + +//========================================================================================== +function process_subProjects(&$page, &$proj, $filter) { + //get our list of expanded projects. + $expandArr = $page->ui->get_cache("expandArr"); + + //okay, now let's start grabbing the projects. + foreach($expandArr as $id=>$level) { + // + $filter['ancestry_level'] = ($level +1); + $projectArr = $proj->list_projects($id,NULL,$filter); + if(is_array($projectArr)) { + $myRow = process_row($page, $projectArr, $expandArr, $page->templateRows['project_row'], $level); + $page->add_template_var("subproject_". $id, $myRow); + } + else { + debug_print("process_subProjects(): id #$id disappeared..."); + unset($expandArr[$id]); + $page->ui->set_cache("expandArr", $expandArr); + } + } + +}//end process_subProjects() +//========================================================================================== +?> Property changes on: trunk/1.2/includes/content/project/shared.inc ___________________________________________________________________ Added: svn:eol + native Added: svn:executable + * Added: svn:keywords + Id HeadURL Date Revision Author Added: svn:mergeinfo + Added: svn:eol-style + native Deleted: trunk/1.2/includes/content/project.inc =================================================================== --- trunk/1.2/includes/content/project.inc 2009-02-06 16:59:50 UTC (rev 928) +++ trunk/1.2/includes/content/project.inc 2009-02-06 17:02:25 UTC (rev 929) @@ -1,549 +0,0 @@ -<?php -/* - * SVN INFORMATION::: - * ------------------ - * Last Author: $Author$ - * Current Revision: $Revision$ - * Repository Location: $HeadURL$ - * Last Updated: $Date$ - */ - -if($_POST) { - $projectId = $_POST['ID']; - $proj->projectId = $projectId; - - - //figure out what we need to change... - if($_POST['action'] == "filter") { - if($_POST['reset_filter']) { - $page->ui->unset_cache("$module/filter"); - $result = "unset"; - } - else { - //store the filter. - $page->ui->set_cache("$module/filter", $_POST['filter']); - $result = "set"; - } - } - elseif($_POST['ID'] == "new") { - unset($_POST['ID']); - $result = $proj->create_project($_POST['data']); - $extra = "/view?ID=". $result; - #exit; - } - else { - //TODO: check to see if somebody else has updated the project since this user viewed the page... - $updateRes = $proj->update_project($_POST['data']); - if($updateRes) { - set_message_wrapper(array( - "title" => "Successfully Updated", - "message" => "Update successful. Good job!", - "type" => "status" - )); - $extra = "/view?ID=". $projectId; - } - else { - set_message_wrapper(array( - "title" => "Unable to Update", - "message" => "Something happened, and the update failed. Sorry, dude.", - "type" => "fatal" - )); - } - } - - //okay, now send 'em to the right page. - conditional_header("/content/project". $extra); - exit; -} -else { - - // +++ SETUP FILTERING +++ - $filterData = $page->ui->get_cache("$module/filter"); - if(!is_array($filterData)) { - //no filter array... set one. - $filterData = array(); - $page->ui->set_cache("$module/filter", $filterData); - } - - //setup the "linkExtra"... - if(is_numeric($_GET['linkToIssue'])) { - $page->ui->set_cache("project/linkToIssue", $_GET['linkToIssue']); - } - - if(is_numeric($page->ui->get_cache("project/linkToIssue"))) { - $page->set_message_wrapper(array( - 'title' => "Re-linking Issue", - 'message' => "Please select the project that issue #". $page->ui->get_cache("project/linkToIssue") ." will be linked to.", - 'type' => "notice", - 'linkURL' => "/content/helpdesk/view?ID=". $page->ui->get_cache("project/linkToIssue"), - 'linkText' => "Back to issue #". $page->ui->get_cache("project/linkToIssue") - )); - } - - //the data will already show only items with the given status, so don't add that to the filter again. - $primaryFilterArr = array("status_id" => $filterData['status_id']); - if($filterData['status_id'] == "all") { - //no filter: we're showing everything. - unset($filterData['status_id']); - } - elseif(!isset($filterData['status_id'])) { - //this shows everything EXCEPT the "ended" items. - $filterData['status_id'] = $GLOBALS['STATUS_NOTENDED']; - } - $filter = $filterData; - unset($filter['status']); - - - if($_GET['action']) { - //it's a get var... use it. - $action = $_GET['action']; - } - else { - //get the action from our handy URL. - $action = $page->ftsSections[2]; - - //example URL: /content/project/view/365 - // ^0 ^1 ^2 ^3 - } - $showAllProjects = TRUE; - - //TODO: fix the logic of this if/elseif/else statement, and make the "showAllProjects" better, so there is a GOOD DEFAULT. - //CREATE A NEW PROJECT!!! - if($action == "create") { - - //set the "parent" arbitrarily (give it a default), then check the URL to see if it's specified. - $parent = 0; - if(is_numeric($_GET['parent'])) { - $parent = $_GET['parent']; - } - //make sure all the projects aren't displayed... - $showAllProjects = FALSE; - - //now set the proper content. - create_page_title($page, array('title' => "Create New Project")); - $page->add_template_var("parent", $parent); - $page->add_template_var("submit_name", "Create Project"); - - //create the "chef" and "participants" list. - //TODO: if creating a sub-project, select the list of users that had been selected for the parent... - $page->add_template_var("select_linked_users", $proj->create_user_option_list($_SESSION['user_ID'],NULL,NULL,FALSE)); - $page->add_template_var("select_leader_uid", $proj->create_user_option_list($_SESSION['user_ID'])); - - //add the priority thing. - $priorityOptionLIst = create_priority_option_list(50); - $page->add_template_var("select_priority", $priorityOptionLIst); - - //give a default for the begin & end dates. - //TODO: if it's a sub-project (if $_GET['parent'] > 0), use the "end" value for the parent. - $page->add_template_var("start_date", date("Y-m-d")); - $page->add_template_var("deadline", strftime("%Y-%m-%d", strtotime("+1 month"))); - - $page->add_template_var("parentProjectId", $_GET['parent']); - - - - //attempting to view the details of a project, but had an invalid ID. - } - elseif($action == "view" && !is_numeric($_GET['ID'])) { - set_message_wrapper(array( - "title" => "Invalid ID", - "message" => "An invalid ID was specified [". $_GET['ID'] ."].<BR>\n" . - "You've been redirected here instead.", - "type" => "error" - )); - conditional_header("/content/project/"); - exit; - - - //VIEW THE DETAILS OF A PROJECT!!! - } - elseif($action == "view" && is_numeric($_GET['ID'])) { - - $showAllProjects = FALSE; - $projectId = $page->ui->magic_cache("ID", NULL, "project","_GET,_SESSION"); - $detailsArr = $proj->get_details($projectId); - - if(is_numeric($page->ui->get_cache("project/linkToIssue"))) { - $linkIssue = $page->ui->get_cache("project/linkToIssue"); - $page->ui->unset_cache("project/linkToIssue"); - - //now link it! - $helpdeskObj = new helpdeskClass($proj->db); - $helpdeskObj->helpdeskId = $linkIssue; - $issueData = $helpdeskObj->get_record($linkIssue); - $fixedIssueAncestry = preg_replace('/:'. $issueData['record_id'] .'$/', '', $issueData['ancestry']); - if($fixedIssueAncestry !== $detailsArr['ancestry']) { - try { - $remarkDetails = "Re-linked to [project_id=". $projectId ."]"; - if($issueData['ancestry_level'] > 1) { - $parentRecord= $helpdeskObj->get_parent_record($issueData['ancestry']); - $remarkDetails .= " from [project_id=". $parentRecord['public_id'] ."]"; - } - $linkRes = $helpdeskObj->update_record($linkIssue, array('parentRecordId' => $projectId)); - $helpdeskObj->remark($linkIssue, $remarkDetails); - - if($linkRes) { - $oldIsHelpdesk = $proj->helpdeskObj->isHelpdeskIssue; - $proj->helpdeskObj->isHelpdeskIssue=FALSE; - $oldProjData = $proj->helpdeskObj->get_parent_record($issueData['ancestry']); - $proj->helpdeskObj->isHelpdeskIssue=$oldIsHelpdesk; - $oldProjLinkList = $proj->get_ancestry_link_list($oldProjData['public_id'], TRUE, TRUE, TRUE); - - $page->set_message_wrapper(array( - 'title' => "Issue Linked Successfully", - 'message' => "Issue #". $linkIssue ." was successfully linked to this project.<BR><BR>" . - "<b>Back to old project:</b> [". $oldProjLinkList ."]", - 'type' => "status" - )); - } - else { - $page->set_message_wrapper(array( - 'title' => "Issue Linking FAILED", - 'message' => "Failed to link issue #". $linkIssue ." to this project, result was (". $linkRes .").", - 'type' => "status" - )); - } - - //now get the details for this project again. - $detailsArr = $proj->get_details($projectId); - } - catch(exception $e) { - $page->set_message_wrapper(array( - 'title' => "An Error Occurred", - 'message' => "While trying to link the record, a fatal error was encountered: ". $e->getMessage(), - 'type' => 'error' - )); - } - } - else { - $page->set_message_wrapper(array( - 'title' => "Issue Linkage Not Updated", - 'message' => "You chose the project that issue #". $linkIssue ." was already attached to; doing nothing.", - 'type' => 'error', - 'linkText' => "Back to issue #". $linkIssue, - 'linkUrl' => "/content/helpdesk/view?ID=". $linkIssue - )); - } - } - - //TODO: Create a link or something for moving it to a new parent (something like the main list, where clicking will change the parent). - $page->add_template_var("submit_name", "Modify"); - - create_page_title($page, array('title' => "Project #". $_GET['ID'] .": \"". $detailsArr['name'] ."\"")); - $page->add_template_var("note_readonly", "readonly"); - $page->set_all_block_rows("content", array("related", "new_subproject_link", "status_section", "note_show")); - $page->set_all_block_rows("related_task"); - $page->set_all_block_rows("related_note"); - $page->set_all_block_rows("related_issue"); - - - //TODO: re-implement tags for projects. - - //re-add the "modify" button. - $page->add_template_var("modify_button", $page->templateRows['modify_button']); - - //format the "note" area. - if(strlen($detailsArr['subject']) > 0) { - $detailsArr['subject'] = cleanString($detailsArr['subject'], "htmlspecial_nq"); - $detailsArr['subject'] = cleanString($detailsArr['subject'], "htmlentity_plus_brackets"); - $detailsArr['subject'] = $bbCodeParser->parseString($detailsArr['subject']); - $detailsArr['subject'] = preg_replace("/\n/", "<BR>\n", $detailsArr['subject']); - $detailsArr['subject'] = preg_replace("/\s\s/", " ", $detailsArr['subject']); - } - else { - //no data. - $detailsArr['subject'] = '<font color="red"><b>[NO DATA]</b></font>'; - } - - //retrieve a list of it's parents. - $ancestryString = $proj->get_ancestry_link_list($projectId); - $displayProjectName = $ancestryString; - if(is_null($ancestryString)) { - // - $ancestryString = '<font color="red"><b>[N/A]</b></font>'; - $displayProjectName = $detailsArr['name']; - } - $page->add_template_var('ancestry_string', $ancestryString); - $page->add_template_var('projectName', $displayProjectName); - - //list the immediate children. - $childFilter = $filter; - $childFilter['ancestry_level'] = count(explode(':', $detailsArr['ancestry'])) +1; - $childrenString = $proj->get_children_string($projectId, $childFilter); - $childAncestryBoxSize = 100; - if(is_null($childrenString)) { - //set something. - $childrenString = '<font color="red"><b>[N/A]</b></font>'; - $childAncestryBoxSize = 20; - } - $page->add_template_var('children_string_height', $childAncestryBoxSize); - $page->add_template_var('children_string', $childrenString); - - - //format the start_date - $tmpStartDate = explode(" ", $detailsArr['start_date']); - $detailsArr['start_date'] = $tmpStartDate[0]; - - foreach($detailsArr as $field=>$value) { - $page->add_template_var($field, $value); - } - $page->add_template_var("project_name", $detailsArr['name']); - $page->add_template_var("select_status_id_". $detailsArr['status_id'], "selected"); - - - //TODO: make this use a better name... - $linkedUserList = array(); - if(is_array($detailsArr['linked_users'])) { - $linkedUserList = array_flip($detailsArr['linked_users']); - } - $page->add_template_var("select_linked_users", $proj->create_user_option_list($linkedUserList,NULL,NULL,FALSE)); - $page->add_template_var("select_leader_uid", $proj->create_user_option_list($detailsArr['leader_contact_id'], NULL, NULL, ' ---- none ----')); - - //add the priority (wichtung). - $priorityOptionLIst = create_priority_option_list($detailsArr['priority']); - $page->add_template_var("select_priority", $priorityOptionLIst); - unset($userList,$tSelected,$userListArr, $selLeader, $leaderSelect); - - //pull a couple of preferences, so we can say if they're getting the whole picture or not. - $taskPref = $proj->prefObj->get_pref_value_by_name('projectDetails_taskDisplayOnlyMine'); - $helpdeskPref = $proj->prefObj->get_pref_value_by_name('projectDetails_showCompletedIssues'); - - if($taskPref !== 'all') { - $page->add_template_var("taskPrefWarning", $page->templateRows['taskPrefWarning']); - } - - if($helpdeskPref == 0) { - $page->add_template_var("helpdeskPrefWarning", $page->templateRows['helpdeskPrefWarning']); - } - - //SPECIAL PROCESSING FOR TODO's... - if(is_array($detailsArr['related']['task'])) { - parse_related_task($detailsArr['related']['task']); - } - unset($detailsArr['related']['task']); - - //parse-in everything under "related"... - foreach($detailsArr['related'] as $type => $subArr) { - $rowName = "related_". $type ."_row"; - if(is_array($subArr) && isset($page->templateRows[$rowName])) { - //build the related rows... - unset($myRow, $bgColor, $bgColor2); - $baseRow = $page->templateRows[$rowName]; - foreach($subArr as $id=>$arr) { - swapValue($bgColor, "rgb(213, 213, 213)", "rgb(194, 194, 194)"); - swapValue($bgColor2, "#d5d5d5", "#c2c2c2"); - $repArr = array( - "id" => $id, - "bgColor" => $bgColor, - "bgColor2" => $bgColor2 - ); - - if($type == "issue") { - $arr['display_id'] = $id; - //special parsing of data for issues. - if(preg_match('/solved/', strtolower($arr['status_text']))) { - $strikeThroughArr = array( - "name", "assigned", "submit", "helpdesk_cat_name", "priority", "status_text", "display_id" - ); - foreach($strikeThroughArr as $field) { - $arr[$field] = '<del> '. $arr[$field] .' </del>'; - } - unset($strikeThroughArr); - } - $repArr['font_weight'] = 'normal'; - } - elseif($type == "task") { - $changeFontColor=TRUE; - //Making TODO stuff look purdy. Boy. - if(!preg_match('/accepted/', strtolower($arr['status_text']))) { - $repArr['bgColor'] = "e0e0e0"; - $repArr['bgColor2'] = "e0e0e0"; - } - - //Add dashes to fields that don't have any information in them. - if(strlen($arr['deadline']) <6) { - $changeFontColor = FALSE; - $arr['deadline'] = "————"; - } - if(strlen($arr['begin_date']) <6) { - $changeFontColor = FALSE; - $arr['begin_date'] = "————"; - } - if(strlen($arr['assigned_user']) == 0) { - //put some dashes in if nobody is assigned. - $arr['assigned_user'] = "——"; - } - - //cross-out all items that are ended. - if(preg_match('/ended/', strtolower($arr['status_text']))) { - $changeFontColor = FALSE; - $strikeThroughArr = array( - "creator", "creator", "assigned", "status_text", "remark", "begin_date", "deadline" - ); - foreach($strikeThroughArr as $myField) { - $arr[$myField] = '<del> '. $arr[$myField] .' </del>'; - } - unset($strikeThroughArr); - } - - if(strlen($arr['deadline']) && preg_match('/ended/', strtolower($arr['status_text']))) { - //make the deadline look nice. - $today = date("Ymd"); - $myDeadline = str_replace("-", "", $arr['deadline']); - settype($myDeadline, "int"); - settype($today, "int"); - - if(!$changeFontColor) { - //do nothing. - } - elseif($myDeadline <= $today) { - $arr['deadline'] = '<font color="red"><b>'. $arr['deadline'] .'</b></font>'; - } - else { - $arr['deadline'] = '<font color="green">'. $arr['deadline'] .'</font>'; - } - } - - if($arr['status_id'] == 2) { - $repArr['font_weight'] = "bold"; - } - else { - $repArr['font_weight'] = "normal"; - } - } - - //put every item in our array into the replacement array. - foreach($arr as $x=>$y) { - $repArr[$x] = $y; - } - $myRow .= mini_parser($baseRow, $repArr, "%%", "%%"); - } - $page->add_template_var($rowName, $myRow); - } - } - - //set a var in the session to go back to here... - $_SESSION['goBackLink'] = "/content/project/view?ID=". $_GET['ID']; - } - - - if($showAllProjects) { - //check to see if something's been selected to expand... - $expandArr = $page->ui->get_cache("expandArr"); - if(!is_array($expandArr)) { - $expandArr = array(); - } - $expandId = $_GET['expandId']; - $expandAction = $_GET['expand']; - if($expandAction && $expandId) { - //let's add it to the array. - if($expandAction == "open" && !isset($expandArr[$expandId])) { - //add it to the array!!! - $expandArr[$expandId] = $_GET['level']; - } - elseif($expandAction == "close" && isset($expandArr[$expandId])) { - //remove it, so it's not expanded anymore. - unset($expandArr[$expandId]); - } - } - $page->ui->set_cache("expandArr", $expandArr); - - #$page->change_content(html_file_to_string("modules/project/project_main.tmpl")); - $page->set_all_block_rows("content"); - - //set some template vars for the filtering. - $page->add_template_var("filter_keyword", $filterData['keyword']); - $page->add_template_var("filter_field_". $filterData['field'] ."_selected", "selected"); - $page->add_template_var("filter_status_id_". $filterData['status_id'] ."_selected", "selected"); - - //show the main (root) level projects. - $sortArr = $page->ui->get_cache("$module/currentSort"); - $projectsArr = $proj->list_projects(0,$sortArr,$filter); - $page->add_template_var("project_row", process_row($page, $projectsArr, $expandArr, $page->templateRows['project_row'])); - - //loop through the sub-projects. - process_subProjects($page, $proj, $filter); - } -} - - - - - -//========================================================================================== -function process_row(&$page, $projectArr, $expandArr, $baseRow, $level=0) { - //loop through the array... - $linkLevel = $level+1; - - - //pre-pad subprojects, so they appear indented. - if($level > 0) { - $basePad = " "; - for($i=0; $i < $linkLevel; $i++) { - $levelPad .= $basePad; - } - } - if(is_array($projectArr)) { - foreach($projectArr as $id=>$subArr) { - //parse stuff into the template row... - $rowColor1 = swapValue($rowColor1, "rgb(213, 213, 213)", "rgb(194, 194, 194)"); - $rowColor2 = swapValue($rowColor2,"#D5D5D5", "#C2C2C2"); - - $expand = "clear"; - if($subArr['num_children'] > 0) { - #if(in_array($id, $expandArr)) { - if(isset($expandArr[$id])) { - $expand = "open"; - $expand2= "close"; - } - else { - $expand = "close"; - $expand2="open"; - } - } - $repArr = $subArr; - $repArr['expand'] = $expand; - $repArr['expand2'] = $expand2; - $repArr['rowColor'] = $rowColor1; - $repArr['rowColor2'] = $rowColor2; - $repArr['levelPad'] = $levelPad; - $repArr['level'] = $linkLevel;//denotes which "level" the subprojects should be on... - - //if the current user owns the project, they can update it... show the stupid little box. - $repArr['status'] .= " %"; - - - $myRow .= mini_parser($baseRow, $repArr, "%%", "%%"); - } - } - - //done processing it... return our processed row. - return($myRow); -}//end process_row() -//========================================================================================== - - -//========================================================================================== -function process_subProjects(&$page, &$proj, $filter) { - //get our list of expanded projects. - $expandArr = $page->ui->get_cache("expandArr"); - - //okay, now let's start grabbing the projects. - foreach($expandArr as $id=>$level) { - // - $filter['ancestry_level'] = ($level +1); - $projectArr = $proj->list_projects($id,NULL,$filter); - if(is_array($projectArr)) { - $myRow = process_row($page, $projectArr, $expandArr, $page->templateRows['project_row'], $level); - $page->add_template_var("subproject_". $id, $myRow); - } - else { - debug_print("process_subProjects(): id #$id disappeared..."); - unset($expandArr[$id]); - $page->ui->set_cache("expandArr", $expandArr); - } - } - -}//end process_subProjects() -//========================================================================================== -?> This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <cra...@us...> - 2009-02-06 16:59:53
|
Revision: 928 http://cs-project.svn.sourceforge.net/cs-project/?rev=928&view=rev Author: crazedsanity Date: 2009-02-06 16:59:50 +0000 (Fri, 06 Feb 2009) Log Message: ----------- Split helpdesk.inc into pieces (#244). Modified Paths: -------------- trunk/1.2/includes/content/helpdesk/shared.inc Added Paths: ----------- trunk/1.2/includes/content/helpdesk/index.inc trunk/1.2/includes/content/helpdesk/view.inc Copied: trunk/1.2/includes/content/helpdesk/index.inc (from rev 927, trunk/1.2/includes/content/helpdesk/shared.inc) =================================================================== --- trunk/1.2/includes/content/helpdesk/index.inc (rev 0) +++ trunk/1.2/includes/content/helpdesk/index.inc 2009-02-06 16:59:50 UTC (rev 928) @@ -0,0 +1,108 @@ +<?php +/* + * SVN INFORMATION::: + * ------------------ + * Last Author: $Author:crazedsanity $ + * Current Revision: $Revision:637 $ + * Repository Location: $HeadURL:https://cs-project.svn.sourceforge.net/svnroot/cs-project/trunk/includes/content/helpdesk.inc $ + * Last Updated: $Date:2007-11-20 11:04:33 -0600 (Tue, 20 Nov 2007) $ + */ + + + $helpdeskId = $_GET['ID']; + $action = $page->ftsSections[2]; + + if(is_numeric($page->ui->get_cache("project/linkToIssue"))) { + $page->ui->unset_cache("project/linkToIssue"); + } + + + //remove the link in the session that they should return to if not requested. + if($_SESSION['goBackLink'] && !$_GET['goBack']) { + unset($_SESSION['goBackLink']); + } + + + //DISPLAY ALL AVAILABLE HELPDESK ISSUES. + //change the content of the page properly. + $page->set_all_block_rows("content", array("helpdesk_search")); + + $filterData = $page->ui->get_cache("helpdesk/filter"); + if(is_array($filterData)) { + $page->add_template_var("filter_keyword", $filterData['keyword']); + $page->add_template_var("filter_field_". $filterData['field'] ."_selected", "selected"); + } + else { + //no filter array... set one. + $filterData = array(); + $page->ui->set_cache("helpdesk/filter", $filterData); + } + $page->add_template_var("filter_status_id_". $filterData['status_id'] ."_selected", "selected"); + + if($filterData['status_id'] == 'all') { + $primaryFilterArr = NULL; + } + elseif(is_numeric($filterData['status_id'])) { + //the data will already show only items with the given status, so don't add that to the filter again. + $primaryFilterArr = array("status_id" => $filterData['status_id']); + } + else { + $primaryFilterArr = array(); + } + $filter = $filterData; + unset($filter['status_id'], $filter['status']); + + //pull the recordset. + $helpdeskArr = $proj->helpdeskObj->get_records($primaryFilterArr, $currentSortArr, $filter); + + $issueCount = 0; + if(is_array($helpdeskArr)) { + $issueCount = count($helpdeskArr); + } + $page->add_template_var("numRows", $issueCount); + //if there's an array, show it... + if(is_array($helpdeskArr) && count($helpdeskArr) > 0) { + //got good data. + $baseRow = $page->templateRows['helpdesk_row']; + foreach($helpdeskArr as $helpdeskId=>$subData) { + unset($deleteLink); + + + swapValue($bgColor, "rgb(213, 213, 213)", "rgb(194, 194, 194)"); + swapValue($bgColor2, "#d5d5d5", "#c2c2c2"); + + $subData['bgColor'] = $bgColor; + $subData['bgColor2']= $bgColor2; + + //define the text fields, so they can be cleaned & truncated. + $previewLength = 110; + $textFieldArr = array("name", "subject"); + foreach($textFieldArr as $cleanThisField) { + //truncate them... + $subData[$cleanThisField] = truncate_string($subData[$cleanThisField], $previewLength, "... [more]", TRUE); + + //now clean 'em (clean after to avoid truncating html special characters. + $subData[$cleanThisField] = cleanString($subData[$cleanThisField], "htmlentity"); + + //more special parsing to ensure GenericPage{} doesn't make the $ (and random characters after it) disappear. + $subData[$cleanThisField] = str_replace('$', '\$', $subData[$cleanThisField]); + } + + //parse bbCode in preview... + $subData['subject'] = $bbCodeParser->parseString($subData['subject']); + + //truncate the email address... + $subData['email'] = truncate_string($subData['email'], 20, "...", TRUE); + + $subData['helpdesk_id'] = $helpdeskId; + unset($subData['id']); + + //show the "created" and "updated" strings properly... + $subData['created'] = parse_date_string($subData['div1'],TRUE); + $subData['updated'] = parse_date_string($subData['div2'],TRUE); + $finalRow .= mini_parser($baseRow, $subData, "%%", "%%"); + } + $page->add_template_var("helpdesk_row", $finalRow); + } + +?> \ No newline at end of file Modified: trunk/1.2/includes/content/helpdesk/shared.inc =================================================================== --- trunk/1.2/includes/content/helpdesk/shared.inc 2009-02-05 18:23:11 UTC (rev 927) +++ trunk/1.2/includes/content/helpdesk/shared.inc 2009-02-06 16:59:50 UTC (rev 928) @@ -10,7 +10,6 @@ - if($_POST) { $action = strtolower($_POST['action']); $helpdeskId = $_POST['id']; @@ -255,293 +254,8 @@ exit; } } -else { - $helpdeskId = $_GET['ID']; - $action = $page->ftsSections[2]; - - if(is_numeric($page->ui->get_cache("project/linkToIssue"))) { - $page->ui->unset_cache("project/linkToIssue"); - } - - - //remove the link in the session that they should return to if not requested. - if($_SESSION['goBackLink'] && !$_GET['goBack']) { - unset($_SESSION['goBackLink']); - } - - if($action == "create") { - create_page_title($page, array('title' => "Create a Helpdesk Issue")); - $page->set_all_block_rows("content"); - - //show the "category" selection. - $categoryList = $proj->helpdeskObj->get_category_list('bug', TRUE); - $page->add_template_var("select_tags", $categoryList); - - // - $page->add_template_var("email", $_SESSION['email']); - $page->add_template_var("linked_proj", cleanString($_GET['proj']),"numeric"); - - } - elseif($action == "view" && !is_numeric($helpdeskId)) { - //missing ID: throw a message & send 'em packin'. - set_message_wrapper(array( - "title" => "Invalid ID Specified", - "message" => "Unable to retrieve the requested record, due to an invalid ID:<BR>" . - " you were automatically redirected.<BR>" . - "Requested ID: [$helpdeskId]", - "type" => "error" - )); - conditional_header("/". $page->ftsSections[0] ."/". $page->ftsSections[1]); - exit; - } - elseif($action == "view" && is_numeric($helpdeskId)) { - $doNotRipRows = array("edit_form", "info_block", "access_block", "associatedUserBlock"); - $helpdeskData = $proj->helpdeskObj->get_record($helpdeskId); - create_page_title($page, array('title' => "Issue #". $helpdeskId .": \"". $helpdeskData['name'] ."\"")); - - //TODO: handle this better, somehow... AJAX comes to mind. ;) - if($_GET['newTag'] && !$_SESSION['addTag_cache'][$helpdeskData['record_id']][$_GET['newTag']]) { - $tempObj = new tagClass($proj->helpdeskObj->db); - $addRes = $tempObj->add_tag($helpdeskData['record_id'], $_GET['newTag']); - if($addRes) { - $_SESSION['addTag_cache'][$helpdeskData['record_id']][$_GET['newTag']] = $addRes; - } - } - - //show it's "access" properly.. - $page->add_template_var("select_acc_". $helpdeskData['acc'], "selected"); - - //show the "category" properly. - $categoryList = $proj->helpdeskObj->get_category_list($helpdeskData['helpdesk_cat_id']); - $page->add_template_var("select_category_list", $categoryList); - - //convert the returned data into htmlentities so brackets show properly. - $helpdeskData['subject'] = $bbCodeParser->parseString(cleanString($helpdeskData['subject'], "htmlentity_plus_brackets"), TRUE); - $helpdeskData['subject'] = preg_replace('/\s\s/', ' ', $helpdeskData['subject']); - $helpdeskData['subject'] = preg_replace('/\S\s\s/', ' ', $helpdeskData['subject']); - - - $helpdeskData['name'] = cleanString($helpdeskData['name'], "htmlentity_plus_brackets"); - $helpdeskData['solution'] = cleanString($helpdeskData['solution'], "htmlentity_plus_brackets"); - - //make the wrapping SANE. - #$helpdeskData['subject'] = wordwrap($helpdeskData['subject'], FORMAT_WORDWRAP); - - //show the buttons appropriate to their membership level & ownership. - //if they're the owner, show the "solution" section. - $assignedStr = $helpdeskData['leader_contact_id']; - if($helpdeskData['status_id'] == 4) { - //CLOSED: allow the current user to re-open this issue. - $doNotRipRows[] = "assigned_text"; - $doNotRipRows[] = "priority_text"; - $doNotRipRows[] = "reopen_button"; - } - else { - //NOT closed... - $doNotRipRows[] = "assigned_optionList"; - $doNotRipRows[] = "priority_optionList"; - $doNotRipRows[] = "editable_tags"; - if(($assignedStr == $_SESSION['contact_id']) || ($assignedStr == "" || is_null($assignedStr))) { - //well, we can show 'em the update/modify button. - $doNotRipRows[] = "update_button"; - if($_SESSION['contact_id'] == $assignedStr) { - //they're the owner... show 'em more options. - $doNotRipRows[] = "solution_row"; - $doNotRipRows[] = "owner_options"; - } - //if they're the owner, show 'em more options... - } - elseif($_SESSION['isGroupOwner']) { - //we got an OWNER!!! - $doNotRipRows[] = "owner_options"; - } - $doNotRipRows[] = "remark_row"; - $doNotRipRows[] = "buttons_row"; - $doNotRipRows[] = 'accessBlock__modifyButton'; - $doNotRipRows[] = 'linkToIssue'; - - if($helpdeskData['status_id'] == 6) { - //yeah, it's dirty... but it highlights the fact that it's been re-opened. - $helpdeskData['status_text'] = '<font color="red">'. $helpdeskData['status_text'] .'</font>'; - } - - //keep the set of data allows it to be linked to a project. - $doNotRipRows[] = "edit_project_selection"; - - //TODO: implement a link for updating project associations. - #$page->add_template_var("select_project_list", $proj->create_project_option_list($helpdeskData['ancestry'], NULL)); - } - $doNotRipRows[] = 'update_button'; - - //TODO: get ancestry data for this! - if($helpdeskData['ancestry_level'] > 1) { - $doNotRipRows[] = "link_to_parent_project"; - - //get the parent. - //TODO: since mainRecord{} tries to enforce having criteria of "is_helpdesk_issue" set, there's extra crap logic required. - //TODO: fix the afore-mentioned bug by splitting helpdesk & project issues into separate tables. - $oldIsHelpdesk = $proj->helpdeskObj->isHelpdeskIssue; - $proj->helpdeskObj->isHelpdeskIssue=FALSE; - $parentData = $proj->helpdeskObj->get_parent_record($helpdeskData['ancestry']); - $proj->helpdeskObj->isHelpdeskIssue=$oldIsHelpdesk; - $page->add_template_var("ancestryLinkList", $proj->get_ancestry_link_list($parentData['public_id'], TRUE, TRUE, TRUE)); - } - - //create the priority list. - $page->add_template_var("select_priority_list", create_priority_option_list($helpdeskData['priority'],9,0)); - - //create the list of users. - //TODO: retrieve list of attached contacts. - $page->add_template_var("user_assign_list", $proj->create_user_option_list($helpdeskData['leader_contact_id'],NULL,NULL,"n/a")); - - //add everything to the page as a template var... - $myNotes = $helpdeskData['notes']; - unset($helpdeskData['notes']); - foreach($helpdeskData as $field=>$value) { - $page->add_template_var($field, $value); - } - - //now, rip all block rows that don't need to be there... - $page->set_all_block_rows("content", $doNotRipRows); - - $taskData = $proj->helpdeskObj->get_tasks($helpdeskId); - $page->set_all_block_rows('related_task'); - if(is_array($taskData)) { - parse_related_task($taskData); - } - - - - $useTextTags = FALSE; - if($helpdeskData['status_id'] == 4) { - $useTextTags = TRUE; - } - generate_tag_list($helpdeskData['record_id'], $useTextTags); - - - - //Display tags that can be added. - generate_addable_tags($helpdeskData['record_id']); - - //now parse the note rows. - if(is_array($myNotes) && count($myNotes)) { - $baseRow = $page->templateRows['issueNotes']; - foreach($myNotes as $repArr) { - $repArr['body'] = $bbCodeParser->parseString($repArr['body']); - - $repArr['subject'] = cleanString($repArr['subject'], "htmlentity_plus_brackets"); - - - $repArr['solutionIndicator'] = ""; - if($repArr['is_solution'] == 't') { - $repArr['solutionIndicator'] = "<img src='/images/checkmark_green.jpg' height='14px'>"; - } - $issueNotesRow .= mini_parser($baseRow, $repArr, '%%', '%%'); - } - $page->add_template_var('issueNotes', $issueNotesRow); - } - - - //show the list of associated users. - $parsedRow = $page->templateRows['associatedUser_none']; - if(is_array($helpdeskData['associatedUsers'])) { - $baseRow = $page->templateRows['associatedUser_data']; - $parsedRow = ""; - foreach($helpdeskData['associatedUsers'] as $id => $data) { - $displayName = truncate_string($data['fname'] ." ". $data['lname'], 20); - $repArr = $data; - $repArr['displayName'] = $displayName; - $parsedRow .= $page->mini_parser($baseRow, $repArr, '%%', '%%'); - } - } - $page->add_template_var('associatedUser_data', $parsedRow); - - } - else { - //DISPLAY ALL AVAILABLE HELPDESK ISSUES. - //change the content of the page properly. - $page->set_all_block_rows("content", array("helpdesk_search")); - - $filterData = $page->ui->get_cache("helpdesk/filter"); - if(is_array($filterData)) { - $page->add_template_var("filter_keyword", $filterData['keyword']); - $page->add_template_var("filter_field_". $filterData['field'] ."_selected", "selected"); - } - else { - //no filter array... set one. - $filterData = array(); - $page->ui->set_cache("helpdesk/filter", $filterData); - } - $page->add_template_var("filter_status_id_". $filterData['status_id'] ."_selected", "selected"); - - if($filterData['status_id'] == 'all') { - $primaryFilterArr = NULL; - } - elseif(is_numeric($filterData['status_id'])) { - //the data will already show only items with the given status, so don't add that to the filter again. - $primaryFilterArr = array("status_id" => $filterData['status_id']); - } - else { - $primaryFilterArr = array(); - } - $filter = $filterData; - unset($filter['status_id'], $filter['status']); - - //pull the recordset. - $helpdeskArr = $proj->helpdeskObj->get_records($primaryFilterArr, $currentSortArr, $filter); - - $issueCount = 0; - if(is_array($helpdeskArr)) { - $issueCount = count($helpdeskArr); - } - $page->add_template_var("numRows", $issueCount); - //if there's an array, show it... - if(is_array($helpdeskArr) && count($helpdeskArr) > 0) { - //got good data. - $baseRow = $page->templateRows['helpdesk_row']; - foreach($helpdeskArr as $helpdeskId=>$subData) { - unset($deleteLink); - - - swapValue($bgColor, "rgb(213, 213, 213)", "rgb(194, 194, 194)"); - swapValue($bgColor2, "#d5d5d5", "#c2c2c2"); - - $subData['bgColor'] = $bgColor; - $subData['bgColor2']= $bgColor2; - - //define the text fields, so they can be cleaned & truncated. - $previewLength = 110; - $textFieldArr = array("name", "subject"); - foreach($textFieldArr as $cleanThisField) { - //truncate them... - $subData[$cleanThisField] = truncate_string($subData[$cleanThisField], $previewLength, "... [more]", TRUE); - - //now clean 'em (clean after to avoid truncating html special characters. - $subData[$cleanThisField] = cleanString($subData[$cleanThisField], "htmlentity"); - - //more special parsing to ensure GenericPage{} doesn't make the $ (and random characters after it) disappear. - $subData[$cleanThisField] = str_replace('$', '\$', $subData[$cleanThisField]); - } - - //parse bbCode in preview... - $subData['subject'] = $bbCodeParser->parseString($subData['subject']); - - //truncate the email address... - $subData['email'] = truncate_string($subData['email'], 20, "...", TRUE); - - $subData['helpdesk_id'] = $helpdeskId; - unset($subData['id']); - - //show the "created" and "updated" strings properly... - $subData['created'] = parse_date_string($subData['div1'],TRUE); - $subData['updated'] = parse_date_string($subData['div2'],TRUE); - $finalRow .= mini_parser($baseRow, $subData, "%%", "%%"); - } - $page->add_template_var("helpdesk_row", $finalRow); - } - } -} + //call the function to add AJAX stuff... addAjax(); Copied: trunk/1.2/includes/content/helpdesk/view.inc (from rev 927, trunk/1.2/includes/content/helpdesk/shared.inc) =================================================================== --- trunk/1.2/includes/content/helpdesk/view.inc (rev 0) +++ trunk/1.2/includes/content/helpdesk/view.inc 2009-02-06 16:59:50 UTC (rev 928) @@ -0,0 +1,218 @@ +<?php +/* + * SVN INFORMATION::: + * ------------------ + * Last Author: $Author:crazedsanity $ + * Current Revision: $Revision:637 $ + * Repository Location: $HeadURL:https://cs-project.svn.sourceforge.net/svnroot/cs-project/trunk/includes/content/helpdesk.inc $ + * Last Updated: $Date:2007-11-20 11:04:33 -0600 (Tue, 20 Nov 2007) $ + */ + + + + $helpdeskId = $_GET['ID']; + $action = $page->ftsSections[2]; + + if(is_numeric($page->ui->get_cache("project/linkToIssue"))) { + $page->ui->unset_cache("project/linkToIssue"); + } + + + //remove the link in the session that they should return to if not requested. + if($_SESSION['goBackLink'] && !$_GET['goBack']) { + unset($_SESSION['goBackLink']); + } + + if($action == "create") { + create_page_title($page, array('title' => "Create a Helpdesk Issue")); + $page->set_all_block_rows("content"); + + //show the "category" selection. + $categoryList = $proj->helpdeskObj->get_category_list('bug', TRUE); + $page->add_template_var("select_tags", $categoryList); + + // + $page->add_template_var("email", $_SESSION['email']); + $page->add_template_var("linked_proj", cleanString($_GET['proj']),"numeric"); + + } + elseif($action == "view" && !is_numeric($helpdeskId)) { + //missing ID: throw a message & send 'em packin'. + set_message_wrapper(array( + "title" => "Invalid ID Specified", + "message" => "Unable to retrieve the requested record, due to an invalid ID:<BR>" . + " you were automatically redirected.<BR>" . + "Requested ID: [$helpdeskId]", + "type" => "error" + )); + conditional_header("/". $page->ftsSections[0] ."/". $page->ftsSections[1]); + exit; + } + elseif($action == "view" && is_numeric($helpdeskId)) { + $doNotRipRows = array("edit_form", "info_block", "access_block", "associatedUserBlock"); + $helpdeskData = $proj->helpdeskObj->get_record($helpdeskId); + create_page_title($page, array('title' => "Issue #". $helpdeskId .": \"". $helpdeskData['name'] ."\"")); + + //TODO: handle this better, somehow... AJAX comes to mind. ;) + if($_GET['newTag'] && !$_SESSION['addTag_cache'][$helpdeskData['record_id']][$_GET['newTag']]) { + $tempObj = new tagClass($proj->helpdeskObj->db); + $addRes = $tempObj->add_tag($helpdeskData['record_id'], $_GET['newTag']); + if($addRes) { + $_SESSION['addTag_cache'][$helpdeskData['record_id']][$_GET['newTag']] = $addRes; + } + } + + //show it's "access" properly.. + $page->add_template_var("select_acc_". $helpdeskData['acc'], "selected"); + + //show the "category" properly. + $categoryList = $proj->helpdeskObj->get_category_list($helpdeskData['helpdesk_cat_id']); + $page->add_template_var("select_category_list", $categoryList); + + //convert the returned data into htmlentities so brackets show properly. + $helpdeskData['subject'] = $bbCodeParser->parseString(cleanString($helpdeskData['subject'], "htmlentity_plus_brackets"), TRUE); + $helpdeskData['subject'] = preg_replace('/\s\s/', ' ', $helpdeskData['subject']); + $helpdeskData['subject'] = preg_replace('/\S\s\s/', ' ', $helpdeskData['subject']); + + + $helpdeskData['name'] = cleanString($helpdeskData['name'], "htmlentity_plus_brackets"); + $helpdeskData['solution'] = cleanString($helpdeskData['solution'], "htmlentity_plus_brackets"); + + //make the wrapping SANE. + #$helpdeskData['subject'] = wordwrap($helpdeskData['subject'], FORMAT_WORDWRAP); + + //show the buttons appropriate to their membership level & ownership. + //if they're the owner, show the "solution" section. + $assignedStr = $helpdeskData['leader_contact_id']; + if($helpdeskData['status_id'] == 4) { + //CLOSED: allow the current user to re-open this issue. + $doNotRipRows[] = "assigned_text"; + $doNotRipRows[] = "priority_text"; + $doNotRipRows[] = "reopen_button"; + } + else { + //NOT closed... + $doNotRipRows[] = "assigned_optionList"; + $doNotRipRows[] = "priority_optionList"; + $doNotRipRows[] = "editable_tags"; + if(($assignedStr == $_SESSION['contact_id']) || ($assignedStr == "" || is_null($assignedStr))) { + //well, we can show 'em the update/modify button. + $doNotRipRows[] = "update_button"; + if($_SESSION['contact_id'] == $assignedStr) { + //they're the owner... show 'em more options. + $doNotRipRows[] = "solution_row"; + $doNotRipRows[] = "owner_options"; + } + //if they're the owner, show 'em more options... + } + elseif($_SESSION['isGroupOwner']) { + //we got an OWNER!!! + $doNotRipRows[] = "owner_options"; + } + $doNotRipRows[] = "remark_row"; + $doNotRipRows[] = "buttons_row"; + $doNotRipRows[] = 'accessBlock__modifyButton'; + $doNotRipRows[] = 'linkToIssue'; + + if($helpdeskData['status_id'] == 6) { + //yeah, it's dirty... but it highlights the fact that it's been re-opened. + $helpdeskData['status_text'] = '<font color="red">'. $helpdeskData['status_text'] .'</font>'; + } + + //keep the set of data allows it to be linked to a project. + $doNotRipRows[] = "edit_project_selection"; + + //TODO: implement a link for updating project associations. + #$page->add_template_var("select_project_list", $proj->create_project_option_list($helpdeskData['ancestry'], NULL)); + } + $doNotRipRows[] = 'update_button'; + + //TODO: get ancestry data for this! + if($helpdeskData['ancestry_level'] > 1) { + $doNotRipRows[] = "link_to_parent_project"; + + //get the parent. + //TODO: since mainRecord{} tries to enforce having criteria of "is_helpdesk_issue" set, there's extra crap logic required. + //TODO: fix the afore-mentioned bug by splitting helpdesk & project issues into separate tables. + $oldIsHelpdesk = $proj->helpdeskObj->isHelpdeskIssue; + $proj->helpdeskObj->isHelpdeskIssue=FALSE; + $parentData = $proj->helpdeskObj->get_parent_record($helpdeskData['ancestry']); + $proj->helpdeskObj->isHelpdeskIssue=$oldIsHelpdesk; + $page->add_template_var("ancestryLinkList", $proj->get_ancestry_link_list($parentData['public_id'], TRUE, TRUE, TRUE)); + } + + //create the priority list. + $page->add_template_var("select_priority_list", create_priority_option_list($helpdeskData['priority'],9,0)); + + //create the list of users. + //TODO: retrieve list of attached contacts. + $page->add_template_var("user_assign_list", $proj->create_user_option_list($helpdeskData['leader_contact_id'],NULL,NULL,"n/a")); + + //add everything to the page as a template var... + $myNotes = $helpdeskData['notes']; + unset($helpdeskData['notes']); + foreach($helpdeskData as $field=>$value) { + $page->add_template_var($field, $value); + } + + //now, rip all block rows that don't need to be there... + $page->set_all_block_rows("content", $doNotRipRows); + + $taskData = $proj->helpdeskObj->get_tasks($helpdeskId); + $page->set_all_block_rows('related_task'); + if(is_array($taskData)) { + parse_related_task($taskData); + } + + + + $useTextTags = FALSE; + if($helpdeskData['status_id'] == 4) { + $useTextTags = TRUE; + } + generate_tag_list($helpdeskData['record_id'], $useTextTags); + + + + //Display tags that can be added. + generate_addable_tags($helpdeskData['record_id']); + + //now parse the note rows. + if(is_array($myNotes) && count($myNotes)) { + $baseRow = $page->templateRows['issueNotes']; + foreach($myNotes as $repArr) { + $repArr['body'] = $bbCodeParser->parseString($repArr['body']); + + $repArr['subject'] = cleanString($repArr['subject'], "htmlentity_plus_brackets"); + + + $repArr['solutionIndicator'] = ""; + if($repArr['is_solution'] == 't') { + $repArr['solutionIndicator'] = "<img src='/images/checkmark_green.jpg' height='14px'>"; + } + $issueNotesRow .= mini_parser($baseRow, $repArr, '%%', '%%'); + } + $page->add_template_var('issueNotes', $issueNotesRow); + } + + + //show the list of associated users. + $parsedRow = $page->templateRows['associatedUser_none']; + if(is_array($helpdeskData['associatedUsers'])) { + $baseRow = $page->templateRows['associatedUser_data']; + $parsedRow = ""; + foreach($helpdeskData['associatedUsers'] as $id => $data) { + $displayName = truncate_string($data['fname'] ." ". $data['lname'], 20); + $repArr = $data; + $repArr['displayName'] = $displayName; + $parsedRow .= $page->mini_parser($baseRow, $repArr, '%%', '%%'); + } + } + $page->add_template_var('associatedUser_data', $parsedRow); + + } + +//call the function to add AJAX stuff... +addAjax(); + +?> \ 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...> - 2009-02-05 18:23:21
|
Revision: 927 http://cs-project.svn.sourceforge.net/cs-project/?rev=927&view=rev Author: crazedsanity Date: 2009-02-05 18:23:11 +0000 (Thu, 05 Feb 2009) Log Message: ----------- Moved /includes/content/helpdesk.inc to /includes/content/helpdesk/shared.inc (starting on #244). Added Paths: ----------- trunk/1.2/includes/content/helpdesk/ trunk/1.2/includes/content/helpdesk/shared.inc Removed Paths: ------------- trunk/1.2/includes/content/helpdesk.inc Copied: trunk/1.2/includes/content/helpdesk/shared.inc (from rev 925, trunk/1.2/includes/content/helpdesk.inc) =================================================================== --- trunk/1.2/includes/content/helpdesk/shared.inc (rev 0) +++ trunk/1.2/includes/content/helpdesk/shared.inc 2009-02-05 18:23:11 UTC (rev 927) @@ -0,0 +1,724 @@ +<?php +/* + * SVN INFORMATION::: + * ------------------ + * Last Author: $Author:crazedsanity $ + * Current Revision: $Revision:637 $ + * Repository Location: $HeadURL:https://cs-project.svn.sourceforge.net/svnroot/cs-project/trunk/includes/content/helpdesk.inc $ + * Last Updated: $Date:2007-11-20 11:04:33 -0600 (Tue, 20 Nov 2007) $ + */ + + + + +if($_POST) { + $action = strtolower($_POST['action']); + $helpdeskId = $_POST['id']; + $baseUrl = "/content/helpdesk"; + $urlSection = "view"; + if(is_numeric($helpdeskId)) { + $urlExtrasArr = array( + "ID" => $helpdeskId + ); + } + $byPassUrlExtras = FALSE; + if(strlen($action)) { + + if($action == "submit") { + $proj->helpdeskObj->db->beginTrans(); + + //SETUP THE MESSAGE THEY'LL SEE... + $setMessage = array( + "title" => "", + "message" => "... SET ME!!! ...", + "type" => "error" + ); + $success = false; + $remarks = array(); + + + $oldData = $proj->helpdeskObj->get_record($helpdeskId); + + + ################################# + # ---------> BEGIN "update" + ################################# + + + //if they've changed the name, we gotta log it. + //TODO: probably log this within helpdeskClass::update(). + if(isset($_POST['updates']['name']) && $oldData['name'] !== $_POST['updates']['name']) { + $remarks[] = array( + "remark" => 'Updated [b]name[/b] from ([b][i]'. $oldData['name'] .'[/i][/b])', + false + ); + } + + $doNotAcceptFields = array("solution", "remark"); + foreach($doNotAcceptFields as $unsetThis) { + unset($_POST['updates'][$unsetThis]); + } + $result = $proj->helpdeskObj->update_record($helpdeskId, $_POST['updates']); + + + //SET/UPDATE THE TYPE OF MESSAGE THAT WILL DISPLAY... + if($result == 1) { + $success = true; + $messageTitle[] = "Updated"; + $messageText[] = "Your issue was updated successfully."; + } + else { + #$setMessage['type'] = "error"; + $success = false; + } + + ################################# + # ---------> BEGIN "remark/solve" + ################################# + if($success === true && strlen($_POST['remark'])) { + //now check remark stuff. + $useRespondLink = FALSE; + if($_POST['isSolution']) { + //IT'S A SOLUTION + //solve it & make sure they know if it was good or not. + #$result = $proj->helpdeskObj->solve($helpdeskId, $_POST['solution']); + $remarks[] = array( + 'remark' => $_POST['remark'], + 'isSolution' => true + ); + $extra = NULL; + + if($result == 1 && $success === true) { + $messageTitle[] = "Solved"; + $messageText[] = "Your solution was logged, and the issue was updated accordingly. Confirmation emails have been sent."; + } + } + else { + //JUST A REMARK... + if($oldData['email'] != $_SESSION['email']) { + $useRespondLink = $proj->helpdeskObj->create_md5($helpdeskId); + } + $remarks[] = array( + 'remark' => $_POST['remark'], + 'isSolution' => false, + 'link' => $useRespondLink + ); + + if($result > 0) { + $success = true; + $messageTitle[] = "Remarked Upon"; + $messageText[] = "Your thoughts have been dually noted in the database... or at least singly. :D"; + } + }//end REMARK + } + + if($success) { + //TODO: this is where a queued email system would be good; if the first remark succeeds but the second fails, this will generate an erroneous email. + if(count($remarks)) { + foreach($remarks as $num=>$remarkData) { + $result = $proj->helpdeskObj->remark($helpdeskId, $remarkData['remark'], $remarkData['isSolution'], $remarkData['link']); + if($result <= 0) { + $success = false; + break; + } + } + } + + if($success === true) { + $proj->helpdeskObj->db->commitTrans(); + //format the message so it looks nice... + $setMessage['message'] = ""; + if(count($messageTitle) > 2) { + $lastMessage = array_pop($setMessage); + $setMessage['title'] = $page->gfObj->string_from_array($messageTitle, null, ", "); + $setMessage['title'] .= " and ". $lastMessage; + } + else { + $setMessage['title'] = $page->gfObj->string_from_array($messageTitle, null, " and "); + } + $setMessage['message'] = $page->gfObj->string_from_array($messageText, null, "<BR>\n"); + $setMessage['type'] = "status"; + } + else { + $proj->helpdeskObj->db->rollbackTrans(); + $setMessage = array( + 'title' => "Update FAILED", + 'message' => "The update would have worked, but you didn't put enough information into your remark.", + 'type' => "error" + ); + } + } + else { + $proj->helpdeskObj->db->rollbackTrans(); + $setMessage = array( + 'title' => "Update FAILED", + 'message' => "Update returned [". $result ."]. Last error was [". $proj->helpdeskObj->lastError ."]", + 'type' => "error" + ); + } + + #$page->gfObj->debug_print($_POST,1); + #$page->gfObj->debug_print($setMessage,1); + #exit; + $page->set_message_wrapper($setMessage); + } + elseif($action == "filter") { + if($_POST['reset_filter']) { + $page->ui->unset_cache("helpdesk/filter"); + $result = "unset"; + } + else { + //store the filter. + $page->ui->set_cache("helpdesk/filter", $_POST['filter']); + $result = "set"; + } + $byPassUrlExtras = TRUE; + unset($extra); + } + elseif($action == "re-open") { + //we'll update some fields, then remark the old solution. + $oldData = $proj->helpdeskObj->get_record($helpdeskId); + $oldSolution = $oldData['solution']; + $updatesArr = array( + "status_id" => 6 + ); + + $updateRes = $proj->helpdeskObj->update_record($helpdeskId, $updatesArr); + + //make the old solution... better. + $oldSolution = "Re-opened."; + $remarkRes = $proj->helpdeskObj->remark($helpdeskId, $oldSolution); + + } + else { + exit("invalid action: [$action]"); + } + } elseif(isset($_POST['submit']) && count($_POST['data']) > 1) { + //CREATING NEW RECORD!!! + $dataArr = $_POST['data']; + $result = $proj->helpdeskObj->create_record($dataArr); + + if($result > 0) { + //TODO: implement email portion. + set_message_wrapper(array( + "title" => "Success", + "message" => "Helpdesk issue #". $result ." created successfully. You should receive an email confirmation shortly", + "type" => "notice" + )); + + //only go back to helpdesk if we're supposed to. + if($_SESSION['goBackLink']) { + $byPassUrlExtras = TRUE; + $baseUrl = $_SESSION['goBackLink']; + } + else { + $helpdeskId = $result; + $urlExtrasArr['ID'] = $result; + } + } + else { + //something bad happened. + set_message_wrapper(array( + "title" => "", + "message" => "", + "type" => "error" + )); + } + } + + //build the redirection URL. + $url = $baseUrl; + + //don't bother redirecting to the "view" page if the ID isn't valid. + 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; + } + else { + if(isset($urlSection) && !preg_match('/\?/', $url)) { + if(!preg_match('/$\//', $url)) { + $urlSection = "/". $urlSection; + } + $url .= $urlSection; + } + if(!$byPassUrlExtras && count($urlExtrasArr) > 0) { + $urlExtrasStr = string_from_array($urlExtrasArr, "url"); + if($urlExtrasStr !== 0) { + $url .= "?". $urlExtrasStr .'&random='. time(); + } + } + conditional_header($url); + exit; + } +} +else { + $helpdeskId = $_GET['ID']; + $action = $page->ftsSections[2]; + + if(is_numeric($page->ui->get_cache("project/linkToIssue"))) { + $page->ui->unset_cache("project/linkToIssue"); + } + + + //remove the link in the session that they should return to if not requested. + if($_SESSION['goBackLink'] && !$_GET['goBack']) { + unset($_SESSION['goBackLink']); + } + + if($action == "create") { + create_page_title($page, array('title' => "Create a Helpdesk Issue")); + $page->set_all_block_rows("content"); + + //show the "category" selection. + $categoryList = $proj->helpdeskObj->get_category_list('bug', TRUE); + $page->add_template_var("select_tags", $categoryList); + + // + $page->add_template_var("email", $_SESSION['email']); + $page->add_template_var("linked_proj", cleanString($_GET['proj']),"numeric"); + + } + elseif($action == "view" && !is_numeric($helpdeskId)) { + //missing ID: throw a message & send 'em packin'. + set_message_wrapper(array( + "title" => "Invalid ID Specified", + "message" => "Unable to retrieve the requested record, due to an invalid ID:<BR>" . + " you were automatically redirected.<BR>" . + "Requested ID: [$helpdeskId]", + "type" => "error" + )); + conditional_header("/". $page->ftsSections[0] ."/". $page->ftsSections[1]); + exit; + } + elseif($action == "view" && is_numeric($helpdeskId)) { + $doNotRipRows = array("edit_form", "info_block", "access_block", "associatedUserBlock"); + $helpdeskData = $proj->helpdeskObj->get_record($helpdeskId); + create_page_title($page, array('title' => "Issue #". $helpdeskId .": \"". $helpdeskData['name'] ."\"")); + + //TODO: handle this better, somehow... AJAX comes to mind. ;) + if($_GET['newTag'] && !$_SESSION['addTag_cache'][$helpdeskData['record_id']][$_GET['newTag']]) { + $tempObj = new tagClass($proj->helpdeskObj->db); + $addRes = $tempObj->add_tag($helpdeskData['record_id'], $_GET['newTag']); + if($addRes) { + $_SESSION['addTag_cache'][$helpdeskData['record_id']][$_GET['newTag']] = $addRes; + } + } + + //show it's "access" properly.. + $page->add_template_var("select_acc_". $helpdeskData['acc'], "selected"); + + //show the "category" properly. + $categoryList = $proj->helpdeskObj->get_category_list($helpdeskData['helpdesk_cat_id']); + $page->add_template_var("select_category_list", $categoryList); + + //convert the returned data into htmlentities so brackets show properly. + $helpdeskData['subject'] = $bbCodeParser->parseString(cleanString($helpdeskData['subject'], "htmlentity_plus_brackets"), TRUE); + $helpdeskData['subject'] = preg_replace('/\s\s/', ' ', $helpdeskData['subject']); + $helpdeskData['subject'] = preg_replace('/\S\s\s/', ' ', $helpdeskData['subject']); + + + $helpdeskData['name'] = cleanString($helpdeskData['name'], "htmlentity_plus_brackets"); + $helpdeskData['solution'] = cleanString($helpdeskData['solution'], "htmlentity_plus_brackets"); + + //make the wrapping SANE. + #$helpdeskData['subject'] = wordwrap($helpdeskData['subject'], FORMAT_WORDWRAP); + + //show the buttons appropriate to their membership level & ownership. + //if they're the owner, show the "solution" section. + $assignedStr = $helpdeskData['leader_contact_id']; + if($helpdeskData['status_id'] == 4) { + //CLOSED: allow the current user to re-open this issue. + $doNotRipRows[] = "assigned_text"; + $doNotRipRows[] = "priority_text"; + $doNotRipRows[] = "reopen_button"; + } + else { + //NOT closed... + $doNotRipRows[] = "assigned_optionList"; + $doNotRipRows[] = "priority_optionList"; + $doNotRipRows[] = "editable_tags"; + if(($assignedStr == $_SESSION['contact_id']) || ($assignedStr == "" || is_null($assignedStr))) { + //well, we can show 'em the update/modify button. + $doNotRipRows[] = "update_button"; + if($_SESSION['contact_id'] == $assignedStr) { + //they're the owner... show 'em more options. + $doNotRipRows[] = "solution_row"; + $doNotRipRows[] = "owner_options"; + } + //if they're the owner, show 'em more options... + } + elseif($_SESSION['isGroupOwner']) { + //we got an OWNER!!! + $doNotRipRows[] = "owner_options"; + } + $doNotRipRows[] = "remark_row"; + $doNotRipRows[] = "buttons_row"; + $doNotRipRows[] = 'accessBlock__modifyButton'; + $doNotRipRows[] = 'linkToIssue'; + + if($helpdeskData['status_id'] == 6) { + //yeah, it's dirty... but it highlights the fact that it's been re-opened. + $helpdeskData['status_text'] = '<font color="red">'. $helpdeskData['status_text'] .'</font>'; + } + + //keep the set of data allows it to be linked to a project. + $doNotRipRows[] = "edit_project_selection"; + + //TODO: implement a link for updating project associations. + #$page->add_template_var("select_project_list", $proj->create_project_option_list($helpdeskData['ancestry'], NULL)); + } + $doNotRipRows[] = 'update_button'; + + //TODO: get ancestry data for this! + if($helpdeskData['ancestry_level'] > 1) { + $doNotRipRows[] = "link_to_parent_project"; + + //get the parent. + //TODO: since mainRecord{} tries to enforce having criteria of "is_helpdesk_issue" set, there's extra crap logic required. + //TODO: fix the afore-mentioned bug by splitting helpdesk & project issues into separate tables. + $oldIsHelpdesk = $proj->helpdeskObj->isHelpdeskIssue; + $proj->helpdeskObj->isHelpdeskIssue=FALSE; + $parentData = $proj->helpdeskObj->get_parent_record($helpdeskData['ancestry']); + $proj->helpdeskObj->isHelpdeskIssue=$oldIsHelpdesk; + $page->add_template_var("ancestryLinkList", $proj->get_ancestry_link_list($parentData['public_id'], TRUE, TRUE, TRUE)); + } + + //create the priority list. + $page->add_template_var("select_priority_list", create_priority_option_list($helpdeskData['priority'],9,0)); + + //create the list of users. + //TODO: retrieve list of attached contacts. + $page->add_template_var("user_assign_list", $proj->create_user_option_list($helpdeskData['leader_contact_id'],NULL,NULL,"n/a")); + + //add everything to the page as a template var... + $myNotes = $helpdeskData['notes']; + unset($helpdeskData['notes']); + foreach($helpdeskData as $field=>$value) { + $page->add_template_var($field, $value); + } + + //now, rip all block rows that don't need to be there... + $page->set_all_block_rows("content", $doNotRipRows); + + $taskData = $proj->helpdeskObj->get_tasks($helpdeskId); + $page->set_all_block_rows('related_task'); + if(is_array($taskData)) { + parse_related_task($taskData); + } + + + + $useTextTags = FALSE; + if($helpdeskData['status_id'] == 4) { + $useTextTags = TRUE; + } + generate_tag_list($helpdeskData['record_id'], $useTextTags); + + + + //Display tags that can be added. + generate_addable_tags($helpdeskData['record_id']); + + //now parse the note rows. + if(is_array($myNotes) && count($myNotes)) { + $baseRow = $page->templateRows['issueNotes']; + foreach($myNotes as $repArr) { + $repArr['body'] = $bbCodeParser->parseString($repArr['body']); + + $repArr['subject'] = cleanString($repArr['subject'], "htmlentity_plus_brackets"); + + + $repArr['solutionIndicator'] = ""; + if($repArr['is_solution'] == 't') { + $repArr['solutionIndicator'] = "<img src='/images/checkmark_green.jpg' height='14px'>"; + } + $issueNotesRow .= mini_parser($baseRow, $repArr, '%%', '%%'); + } + $page->add_template_var('issueNotes', $issueNotesRow); + } + + + //show the list of associated users. + $parsedRow = $page->templateRows['associatedUser_none']; + if(is_array($helpdeskData['associatedUsers'])) { + $baseRow = $page->templateRows['associatedUser_data']; + $parsedRow = ""; + foreach($helpdeskData['associatedUsers'] as $id => $data) { + $displayName = truncate_string($data['fname'] ." ". $data['lname'], 20); + $repArr = $data; + $repArr['displayName'] = $displayName; + $parsedRow .= $page->mini_parser($baseRow, $repArr, '%%', '%%'); + } + } + $page->add_template_var('associatedUser_data', $parsedRow); + + } + else { + //DISPLAY ALL AVAILABLE HELPDESK ISSUES. + //change the content of the page properly. + $page->set_all_block_rows("content", array("helpdesk_search")); + + $filterData = $page->ui->get_cache("helpdesk/filter"); + if(is_array($filterData)) { + $page->add_template_var("filter_keyword", $filterData['keyword']); + $page->add_template_var("filter_field_". $filterData['field'] ."_selected", "selected"); + } + else { + //no filter array... set one. + $filterData = array(); + $page->ui->set_cache("helpdesk/filter", $filterData); + } + $page->add_template_var("filter_status_id_". $filterData['status_id'] ."_selected", "selected"); + + if($filterData['status_id'] == 'all') { + $primaryFilterArr = NULL; + } + elseif(is_numeric($filterData['status_id'])) { + //the data will already show only items with the given status, so don't add that to the filter again. + $primaryFilterArr = array("status_id" => $filterData['status_id']); + } + else { + $primaryFilterArr = array(); + } + $filter = $filterData; + unset($filter['status_id'], $filter['status']); + + //pull the recordset. + $helpdeskArr = $proj->helpdeskObj->get_records($primaryFilterArr, $currentSortArr, $filter); + + $issueCount = 0; + if(is_array($helpdeskArr)) { + $issueCount = count($helpdeskArr); + } + $page->add_template_var("numRows", $issueCount); + //if there's an array, show it... + if(is_array($helpdeskArr) && count($helpdeskArr) > 0) { + //got good data. + $baseRow = $page->templateRows['helpdesk_row']; + foreach($helpdeskArr as $helpdeskId=>$subData) { + unset($deleteLink); + + + swapValue($bgColor, "rgb(213, 213, 213)", "rgb(194, 194, 194)"); + swapValue($bgColor2, "#d5d5d5", "#c2c2c2"); + + $subData['bgColor'] = $bgColor; + $subData['bgColor2']= $bgColor2; + + //define the text fields, so they can be cleaned & truncated. + $previewLength = 110; + $textFieldArr = array("name", "subject"); + foreach($textFieldArr as $cleanThisField) { + //truncate them... + $subData[$cleanThisField] = truncate_string($subData[$cleanThisField], $previewLength, "... [more]", TRUE); + + //now clean 'em (clean after to avoid truncating html special characters. + $subData[$cleanThisField] = cleanString($subData[$cleanThisField], "htmlentity"); + + //more special parsing to ensure GenericPage{} doesn't make the $ (and random characters after it) disappear. + $subData[$cleanThisField] = str_replace('$', '\$', $subData[$cleanThisField]); + } + + //parse bbCode in preview... + $subData['subject'] = $bbCodeParser->parseString($subData['subject']); + + //truncate the email address... + $subData['email'] = truncate_string($subData['email'], 20, "...", TRUE); + + $subData['helpdesk_id'] = $helpdeskId; + unset($subData['id']); + + //show the "created" and "updated" strings properly... + $subData['created'] = parse_date_string($subData['div1'],TRUE); + $subData['updated'] = parse_date_string($subData['div2'],TRUE); + $finalRow .= mini_parser($baseRow, $subData, "%%", "%%"); + } + $page->add_template_var("helpdesk_row", $finalRow); + } + } +} + +//call the function to add AJAX stuff... +addAjax(); + +//AJAX FUNCTIONS + +function ajax__removeTag($tagNameId, $recordId) { + ob_start(); + $tagObj = $GLOBALS['objects']['tag']; + $page = $GLOBALS['objects']['page']; + $objResponse = new xajaxResponse(); + + $messageArr = array( + 'title' => 'Unable to Remove Tag', + 'message' => "There was an unknown error while attempting to remove the tag.", + 'type' => 'error' + ); + + if(is_numeric($tagNameId) && is_numeric($recordId)) { + $result = $tagObj->remove_tag($recordId,$tagNameId); + $tagList = $tagObj->get_tag_list(); + + //check the results. + if($result==1) { + //Cool. Tell 'em the tag was removed. + $messageArr = array( + 'title' => 'Tag Successfully Removed', + 'message' => "We removed \"". $tagList[$tagNameId] ."\".", + 'type' => 'status' + ); + } + else { + //already got most of the array, just change the actual message. + $messageArr['message'] = "Result of trying to remove tag: (". $result .")"; + } + } + + $newTagList = generate_tag_list($recordId); + + if(strlen($newTagList)) { + $returnThis = $newTagList; + } + else { + $returnThis = "invalid response from generate_tag_list($recordId)"; + } + + $page->set_message_wrapper($messageArr); + $objResponse->addAssign('MAIN_error_message', 'innerHTML', $page->process_set_message()); + + $objResponse->addAssign('tagList', 'innerHTML', $returnThis); + $objResponse->addAssign('addTagOptionList', 'innerHTML', generate_addable_tags($recordId)); + + + ob_end_clean(); + return($objResponse); +}//end ajax__removeTag() + + + +function ajax__addTag($tagNameId, $recordId) { + ob_start(); + + $tagObj = $GLOBALS['objects']['tag']; + $page = $GLOBALS['objects']['page']; + $objResponse = new xajaxResponse(); + + $result = $tagObj->add_tag($recordId, $tagNameId); + + $objResponse->addAssign('tagList', 'innerHTML', generate_tag_list($recordId)); + $objResponse->addAssign('addTagOptionList', 'innerHTML', generate_addable_tags($recordId)); + + //display a message saying it worked. + if($result == 1) { + $tagList = $tagObj->get_tag_list(); + $messageArr = array( + 'title' => 'Tag Added Successfully', + 'message' => "Successfully tagged record with \"". $tagList[$tagNameId] ."\"", + 'type' => 'status' + ); + } + else { + $messageArr = array( + 'title' => 'Failed to Add Tag', + 'message' => "Result of adding tag was (". $result .")", + 'type' => 'error' + ); + } + $page->set_message_wrapper($messageArr); + $objResponse->addAssign('MAIN_error_message', 'innerHTML', $page->process_set_message()); + + + return($objResponse); + ob_end_clean(); + +}//end ajax__addTag() + + +function generate_tag_list($recordId, $useTextRows=FALSE) { + $page = $GLOBALS['objects']['page']; + $tagObj = $GLOBALS['objects']['tag']; + + if(!is_numeric($recordId)) { + return("invalid recordId=(". $recordId .")"); + } + elseif(!(is_object($tagObj) && get_class($tagObj) == 'tagClass')) { + return("didn't get tagClass object"); + } + elseif(!(is_object($page) && get_class($page) == 'cs_genericPage')) { + return("invalid page object: (". get_class($page) .")"); + } + + + $myTagList = $tagObj->get_tags_for_record($recordId, TRUE); + if(is_array($myTagList)) { + if($useTextRows) { + $tagListVar = 'text_tags'; + } + else { + $tagListVar = 'removeable_tag'; + } + + if(!isset($page->templateRows[$tagListVar])) { + $page->set_all_block_rows(); + } + $baseRow = $page->templateRows[$tagListVar]; + + $myTagRow = ""; + $tCount = 0; + foreach($myTagList as $tagNameId=>$tagData) { + $tagName = $tagData['name']; + + //don't show a separator for the end piece. + $tCount++; + $separator = ' || '; + if($tCount == count($myTagList)) { + $separator = ""; + } + $repArr = array( + 'tag_name_id' => $tagNameId, + 'name' => $tagName, + 'separator' => $separator, + 'imgHtml' => $tagData['imgHtml'] + ); + $myTagRow .= mini_parser($baseRow, $repArr, '%%', '%%'); + } + $myTagRow = mini_parser($myTagRow, array('record_id'=>$recordId), '{', '}'); + $page->add_template_var($tagListVar, $myTagRow); + + if(strlen($myTagRow)) { + $retval = $myTagRow; + } + else { + $retval = __METHOD__ .": No data parsed..?"; + throw new exception($retval); + } + } + else { + $retval = ""; + } + + return($retval); +}//end generate_tag_list() + + +function generate_addable_tags($recordId) { + $tagObj = $GLOBALS['objects']['tag']; + $page = $GLOBALS['objects']['page']; + $availableTagsList = $tagObj->get_available_tags_for_record($recordId, 3); + $retval = NULL; + if(is_array($availableTagsList) && count($availableTagsList) > 0) { + $myTagsList = array_as_option_list($availableTagsList,NULL,'select',$page->templateRows['addTag_option']); + $myTagsList = '<select>'. $myTagsList .'</select>'; + $myTagsList = mini_parser($myTagsList, array('record_id' => $recordId), '{', '}'); + $page->add_template_var("add_tag_list", $myTagsList); + $retval = $myTagsList; + } + return($retval); +} + + +?> \ No newline at end of file Property changes on: trunk/1.2/includes/content/helpdesk/shared.inc ___________________________________________________________________ Added: svn:keywords + Id HeadURL Date Revision Author Added: svn:mergeinfo + Added: svn:eol-style + native Deleted: trunk/1.2/includes/content/helpdesk.inc =================================================================== --- trunk/1.2/includes/content/helpdesk.inc 2009-02-05 18:07:59 UTC (rev 926) +++ trunk/1.2/includes/content/helpdesk.inc 2009-02-05 18:23:11 UTC (rev 927) @@ -1,724 +0,0 @@ -<?php -/* - * SVN INFORMATION::: - * ------------------ - * Last Author: $Author:crazedsanity $ - * Current Revision: $Revision:637 $ - * Repository Location: $HeadURL:https://cs-project.svn.sourceforge.net/svnroot/cs-project/trunk/includes/content/helpdesk.inc $ - * Last Updated: $Date:2007-11-20 11:04:33 -0600 (Tue, 20 Nov 2007) $ - */ - - - - -if($_POST) { - $action = strtolower($_POST['action']); - $helpdeskId = $_POST['id']; - $baseUrl = "/content/helpdesk"; - $urlSection = "view"; - if(is_numeric($helpdeskId)) { - $urlExtrasArr = array( - "ID" => $helpdeskId - ); - } - $byPassUrlExtras = FALSE; - if(strlen($action)) { - - if($action == "submit") { - $proj->helpdeskObj->db->beginTrans(); - - //SETUP THE MESSAGE THEY'LL SEE... - $setMessage = array( - "title" => "", - "message" => "... SET ME!!! ...", - "type" => "error" - ); - $success = false; - $remarks = array(); - - - $oldData = $proj->helpdeskObj->get_record($helpdeskId); - - - ################################# - # ---------> BEGIN "update" - ################################# - - - //if they've changed the name, we gotta log it. - //TODO: probably log this within helpdeskClass::update(). - if(isset($_POST['updates']['name']) && $oldData['name'] !== $_POST['updates']['name']) { - $remarks[] = array( - "remark" => 'Updated [b]name[/b] from ([b][i]'. $oldData['name'] .'[/i][/b])', - false - ); - } - - $doNotAcceptFields = array("solution", "remark"); - foreach($doNotAcceptFields as $unsetThis) { - unset($_POST['updates'][$unsetThis]); - } - $result = $proj->helpdeskObj->update_record($helpdeskId, $_POST['updates']); - - - //SET/UPDATE THE TYPE OF MESSAGE THAT WILL DISPLAY... - if($result == 1) { - $success = true; - $messageTitle[] = "Updated"; - $messageText[] = "Your issue was updated successfully."; - } - else { - #$setMessage['type'] = "error"; - $success = false; - } - - ################################# - # ---------> BEGIN "remark/solve" - ################################# - if($success === true && strlen($_POST['remark'])) { - //now check remark stuff. - $useRespondLink = FALSE; - if($_POST['isSolution']) { - //IT'S A SOLUTION - //solve it & make sure they know if it was good or not. - #$result = $proj->helpdeskObj->solve($helpdeskId, $_POST['solution']); - $remarks[] = array( - 'remark' => $_POST['remark'], - 'isSolution' => true - ); - $extra = NULL; - - if($result == 1 && $success === true) { - $messageTitle[] = "Solved"; - $messageText[] = "Your solution was logged, and the issue was updated accordingly. Confirmation emails have been sent."; - } - } - else { - //JUST A REMARK... - if($oldData['email'] != $_SESSION['email']) { - $useRespondLink = $proj->helpdeskObj->create_md5($helpdeskId); - } - $remarks[] = array( - 'remark' => $_POST['remark'], - 'isSolution' => false, - 'link' => $useRespondLink - ); - - if($result > 0) { - $success = true; - $messageTitle[] = "Remarked Upon"; - $messageText[] = "Your thoughts have been dually noted in the database... or at least singly. :D"; - } - }//end REMARK - } - - if($success) { - //TODO: this is where a queued email system would be good; if the first remark succeeds but the second fails, this will generate an erroneous email. - if(count($remarks)) { - foreach($remarks as $num=>$remarkData) { - $result = $proj->helpdeskObj->remark($helpdeskId, $remarkData['remark'], $remarkData['isSolution'], $remarkData['link']); - if($result <= 0) { - $success = false; - break; - } - } - } - - if($success === true) { - $proj->helpdeskObj->db->commitTrans(); - //format the message so it looks nice... - $setMessage['message'] = ""; - if(count($messageTitle) > 2) { - $lastMessage = array_pop($setMessage); - $setMessage['title'] = $page->gfObj->string_from_array($messageTitle, null, ", "); - $setMessage['title'] .= " and ". $lastMessage; - } - else { - $setMessage['title'] = $page->gfObj->string_from_array($messageTitle, null, " and "); - } - $setMessage['message'] = $page->gfObj->string_from_array($messageText, null, "<BR>\n"); - $setMessage['type'] = "status"; - } - else { - $proj->helpdeskObj->db->rollbackTrans(); - $setMessage = array( - 'title' => "Update FAILED", - 'message' => "The update would have worked, but you didn't put enough information into your remark.", - 'type' => "error" - ); - } - } - else { - $proj->helpdeskObj->db->rollbackTrans(); - $setMessage = array( - 'title' => "Update FAILED", - 'message' => "Update returned [". $result ."]. Last error was [". $proj->helpdeskObj->lastError ."]", - 'type' => "error" - ); - } - - #$page->gfObj->debug_print($_POST,1); - #$page->gfObj->debug_print($setMessage,1); - #exit; - $page->set_message_wrapper($setMessage); - } - elseif($action == "filter") { - if($_POST['reset_filter']) { - $page->ui->unset_cache("helpdesk/filter"); - $result = "unset"; - } - else { - //store the filter. - $page->ui->set_cache("helpdesk/filter", $_POST['filter']); - $result = "set"; - } - $byPassUrlExtras = TRUE; - unset($extra); - } - elseif($action == "re-open") { - //we'll update some fields, then remark the old solution. - $oldData = $proj->helpdeskObj->get_record($helpdeskId); - $oldSolution = $oldData['solution']; - $updatesArr = array( - "status_id" => 6 - ); - - $updateRes = $proj->helpdeskObj->update_record($helpdeskId, $updatesArr); - - //make the old solution... better. - $oldSolution = "Re-opened."; - $remarkRes = $proj->helpdeskObj->remark($helpdeskId, $oldSolution); - - } - else { - exit("invalid action: [$action]"); - } - } elseif(isset($_POST['submit']) && count($_POST['data']) > 1) { - //CREATING NEW RECORD!!! - $dataArr = $_POST['data']; - $result = $proj->helpdeskObj->create_record($dataArr); - - if($result > 0) { - //TODO: implement email portion. - set_message_wrapper(array( - "title" => "Success", - "message" => "Helpdesk issue #". $result ." created successfully. You should receive an email confirmation shortly", - "type" => "notice" - )); - - //only go back to helpdesk if we're supposed to. - if($_SESSION['goBackLink']) { - $byPassUrlExtras = TRUE; - $baseUrl = $_SESSION['goBackLink']; - } - else { - $helpdeskId = $result; - $urlExtrasArr['ID'] = $result; - } - } - else { - //something bad happened. - set_message_wrapper(array( - "title" => "", - "message" => "", - "type" => "error" - )); - } - } - - //build the redirection URL. - $url = $baseUrl; - - //don't bother redirecting to the "view" page if the ID isn't valid. - 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; - } - else { - if(isset($urlSection) && !preg_match('/\?/', $url)) { - if(!preg_match('/$\//', $url)) { - $urlSection = "/". $urlSection; - } - $url .= $urlSection; - } - if(!$byPassUrlExtras && count($urlExtrasArr) > 0) { - $urlExtrasStr = string_from_array($urlExtrasArr, "url"); - if($urlExtrasStr !== 0) { - $url .= "?". $urlExtrasStr .'&random='. time(); - } - } - conditional_header($url); - exit; - } -} -else { - $helpdeskId = $_GET['ID']; - $action = $page->ftsSections[2]; - - if(is_numeric($page->ui->get_cache("project/linkToIssue"))) { - $page->ui->unset_cache("project/linkToIssue"); - } - - - //remove the link in the session that they should return to if not requested. - if($_SESSION['goBackLink'] && !$_GET['goBack']) { - unset($_SESSION['goBackLink']); - } - - if($action == "create") { - create_page_title($page, array('title' => "Create a Helpdesk Issue")); - $page->set_all_block_rows("content"); - - //show the "category" selection. - $categoryList = $proj->helpdeskObj->get_category_list('bug', TRUE); - $page->add_template_var("select_tags", $categoryList); - - // - $page->add_template_var("email", $_SESSION['email']); - $page->add_template_var("linked_proj", cleanString($_GET['proj']),"numeric"); - - } - elseif($action == "view" && !is_numeric($helpdeskId)) { - //missing ID: throw a message & send 'em packin'. - set_message_wrapper(array( - "title" => "Invalid ID Specified", - "message" => "Unable to retrieve the requested record, due to an invalid ID:<BR>" . - " you were automatically redirected.<BR>" . - "Requested ID: [$helpdeskId]", - "type" => "error" - )); - conditional_header("/". $page->ftsSections[0] ."/". $page->ftsSections[1]); - exit; - } - elseif($action == "view" && is_numeric($helpdeskId)) { - $doNotRipRows = array("edit_form", "info_block", "access_block", "associatedUserBlock"); - $helpdeskData = $proj->helpdeskObj->get_record($helpdeskId); - create_page_title($page, array('title' => "Issue #". $helpdeskId .": \"". $helpdeskData['name'] ."\"")); - - //TODO: handle this better, somehow... AJAX comes to mind. ;) - if($_GET['newTag'] && !$_SESSION['addTag_cache'][$helpdeskData['record_id']][$_GET['newTag']]) { - $tempObj = new tagClass($proj->helpdeskObj->db); - $addRes = $tempObj->add_tag($helpdeskData['record_id'], $_GET['newTag']); - if($addRes) { - $_SESSION['addTag_cache'][$helpdeskData['record_id']][$_GET['newTag']] = $addRes; - } - } - - //show it's "access" properly.. - $page->add_template_var("select_acc_". $helpdeskData['acc'], "selected"); - - //show the "category" properly. - $categoryList = $proj->helpdeskObj->get_category_list($helpdeskData['helpdesk_cat_id']); - $page->add_template_var("select_category_list", $categoryList); - - //convert the returned data into htmlentities so brackets show properly. - $helpdeskData['subject'] = $bbCodeParser->parseString(cleanString($helpdeskData['subject'], "htmlentity_plus_brackets"), TRUE); - $helpdeskData['subject'] = preg_replace('/\s\s/', ' ', $helpdeskData['subject']); - $helpdeskData['subject'] = preg_replace('/\S\s\s/', ' ', $helpdeskData['subject']); - - - $helpdeskData['name'] = cleanString($helpdeskData['name'], "htmlentity_plus_brackets"); - $helpdeskData['solution'] = cleanString($helpdeskData['solution'], "htmlentity_plus_brackets"); - - //make the wrapping SANE. - #$helpdeskData['subject'] = wordwrap($helpdeskData['subject'], FORMAT_WORDWRAP); - - //show the buttons appropriate to their membership level & ownership. - //if they're the owner, show the "solution" section. - $assignedStr = $helpdeskData['leader_contact_id']; - if($helpdeskData['status_id'] == 4) { - //CLOSED: allow the current user to re-open this issue. - $doNotRipRows[] = "assigned_text"; - $doNotRipRows[] = "priority_text"; - $doNotRipRows[] = "reopen_button"; - } - else { - //NOT closed... - $doNotRipRows[] = "assigned_optionList"; - $doNotRipRows[] = "priority_optionList"; - $doNotRipRows[] = "editable_tags"; - if(($assignedStr == $_SESSION['contact_id']) || ($assignedStr == "" || is_null($assignedStr))) { - //well, we can show 'em the update/modify button. - $doNotRipRows[] = "update_button"; - if($_SESSION['contact_id'] == $assignedStr) { - //they're the owner... show 'em more options. - $doNotRipRows[] = "solution_row"; - $doNotRipRows[] = "owner_options"; - } - //if they're the owner, show 'em more options... - } - elseif($_SESSION['isGroupOwner']) { - //we got an OWNER!!! - $doNotRipRows[] = "owner_options"; - } - $doNotRipRows[] = "remark_row"; - $doNotRipRows[] = "buttons_row"; - $doNotRipRows[] = 'accessBlock__modifyButton'; - $doNotRipRows[] = 'linkToIssue'; - - if($helpdeskData['status_id'] == 6) { - //yeah, it's dirty... but it highlights the fact that it's been re-opened. - $helpdeskData['status_text'] = '<font color="red">'. $helpdeskData['status_text'] .'</font>'; - } - - //keep the set of data allows it to be linked to a project. - $doNotRipRows[] = "edit_project_selection"; - - //TODO: implement a link for updating project associations. - #$page->add_template_var("select_project_list", $proj->create_project_option_list($helpdeskData['ancestry'], NULL)); - } - $doNotRipRows[] = 'update_button'; - - //TODO: get ancestry data for this! - if($helpdeskData['ancestry_level'] > 1) { - $doNotRipRows[] = "link_to_parent_project"; - - //get the parent. - //TODO: since mainRecord{} tries to enforce having criteria of "is_helpdesk_issue" set, there's extra crap logic required. - //TODO: fix the afore-mentioned bug by splitting helpdesk & project issues into separate tables. - $oldIsHelpdesk = $proj->helpdeskObj->isHelpdeskIssue; - $proj->helpdeskObj->isHelpdeskIssue=FALSE; - $parentData = $proj->helpdeskObj->get_parent_record($helpdeskData['ancestry']); - $proj->helpdeskObj->isHelpdeskIssue=$oldIsHelpdesk; - $page->add_template_var("ancestryLinkList", $proj->get_ancestry_link_list($parentData['public_id'], TRUE, TRUE, TRUE)); - } - - //create the priority list. - $page->add_template_var("select_priority_list", create_priority_option_list($helpdeskData['priority'],9,0)); - - //create the list of users. - //TODO: retrieve list of attached contacts. - $page->add_template_var("user_assign_list", $proj->create_user_option_list($helpdeskData['leader_contact_id'],NULL,NULL,"n/a")); - - //add everything to the page as a template var... - $myNotes = $helpdeskData['notes']; - unset($helpdeskData['notes']); - foreach($helpdeskData as $field=>$value) { - $page->add_template_var($field, $value); - } - - //now, rip all block rows that don't need to be there... - $page->set_all_block_rows("content", $doNotRipRows); - - $taskData = $proj->helpdeskObj->get_tasks($helpdeskId); - $page->set_all_block_rows('related_task'); - if(is_array($taskData)) { - parse_related_task($taskData); - } - - - - $useTextTags = FALSE; - if($helpdeskData['status_id'] == 4) { - $useTextTags = TRUE; - } - generate_tag_list($helpdeskData['record_id'], $useTextTags); - - - - //Display tags that can be added. - generate_addable_tags($helpdeskData['record_id']); - - //now parse the note rows. - if(is_array($myNotes) && count($myNotes)) { - $baseRow = $page->templateRows['issueNotes']; - foreach($myNotes as $repArr) { - $repArr['body'] = $bbCodeParser->parseString($repArr['body']); - - $repArr['subject'] = cleanString($repArr['subject'], "htmlentity_plus_brackets"); - - - $repArr['solutionIndicator'] = ""; - if($repArr['is_solution'] == 't') { - $repArr['solutionIndicator'] = "<img src='/images/checkmark_green.jpg' height='14px'>"; - } - $issueNotesRow .= mini_parser($baseRow, $repArr, '%%', '%%'); - } - $page->add_template_var('issueNotes', $issueNotesRow); - } - - - //show the list of associated users. - $parsedRow = $page->templateRows['associatedUser_none']; - if(is_array($helpdeskData['associatedUsers'])) { - $baseRow = $page->templateRows['associatedUser_data']; - $parsedRow = ""; - foreach($helpdeskData['associatedUsers'] as $id => $data) { - $displayName = truncate_string($data['fname'] ." ". $data['lname'], 20); - $repArr = $data; - $repArr['displayName'] = $displayName; - $parsedRow .= $page->mini_parser($baseRow, $repArr, '%%', '%%'); - } - } - $page->add_template_var('associatedUser_data', $parsedRow); - - } - else { - //DISPLAY ALL AVAILABLE HELPDESK ISSUES. - //change the content of the page properly. - $page->set_all_block_rows("content", array("helpdesk_search")); - - $filterData = $page->ui->get_cache("helpdesk/filter"); - if(is_array($filterData)) { - $page->add_template_var("filter_keyword", $filterData['keyword']); - $page->add_template_var("filter_field_". $filterData['field'] ."_selected", "selected"); - } - else { - //no filter array... set one. - $filterData = array(); - $page->ui->set_cache("helpdesk/filter", $filterData); - } - $page->add_template_var("filter_status_id_". $filterData['status_id'] ."_selected", "selected"); - - if($filterData['status_id'] == 'all') { - $primaryFilterArr = NULL; - } - elseif(is_numeric($filterData['status_id'])) { - //the data will already show only items with the given status, so don't add that to the filter again. - $primaryFilterArr = array("status_id" => $filterData['status_id']); - } - else { - $primaryFilterArr = array(); - } - $filter = $filterData; - unset($filter['status_id'], $filter['status']); - - //pull the recordset. - $helpdeskArr = $proj->helpdeskObj->get_records($primaryFilterArr, $currentSortArr, $filter); - - $issueCount = 0; - if(is_array($helpdeskArr)) { - $issueCount = count($helpdeskArr); - } - $page->add_template_var("numRows", $issueCount); - //if there's an array, show it... - if(is_array($helpdeskArr) && count($helpdeskArr) > 0) { - //got good data. - $baseRow = $page->templateRows['helpdesk_row']; - foreach($helpdeskArr as $helpdeskId=>$subData) { - unset($deleteLink); - - - swapValue($bgColor, "rgb(213, 213, 213)", "rgb(194, 194, 194)"); - swapValue($bgColor2, "#d5d5d5", "#c2c2c2"); - - $subData['bgColor'] = $bgColor; - $subData['bgColor2']= $bgColor2; - - //define the text fields, so they can be cleaned & truncated. - $previewLength = 110; - $textFieldArr = array("name", "subject"); - foreach($textFieldArr as $cleanThisField) { - //truncate them... - $subData[$cleanThisField] = truncate_string($subData[$cleanThisField], $previewLength, "... [more]", TRUE); - - //now clean 'em (clean after to avoid truncating html special characters. - $subData[$cleanThisField] = cleanString($subData[$cleanThisField], "htmlentity"); - - //more special parsing to ensure GenericPage{} doesn't make the $ (and random characters after it) disappear. - $subData[$cleanThisField] = str_replace('$', '\$', $subData[$cleanThisField]); - } - - //parse bbCode in preview... - $subData['subject'] = $bbCodeParser->parseString($subData['subject']); - - //truncate the email address... - $subData['email'] = truncate_string($subData['email'], 20, "...", TRUE); - - $subData['helpdesk_id'] = $helpdeskId; - unset($subData['id']); - - //show the "created" and "updated" strings properly... - $subData['created'] = parse_date_string($subData['div1'],TRUE); - $subData['updated'] = parse_date_string($subData['div2'],TRUE); - $finalRow .= mini_parser($baseRow, $subData, "%%", "%%"); - } - $page->add_template_var("helpdesk_row", $finalRow); - } - } -} - -//call the function to add AJAX stuff... -addAjax(); - -//AJAX FUNCTIONS - -function ajax__removeTag($tagNameId, $recordId) { - ob_start(); - $tagObj = $GLOBALS['objects']['tag']; - $page = $GLOBALS['objects']['page']; - $objResponse = new xajaxResponse(); - - $messageArr = array( - 'title' => 'Unable to Remove Tag', - 'message' => "There was an unknown error while attempting to remove the tag.", - 'type' => 'error' - ); - - if(is_numeric($tagNameId) && is_numeric($recordId)) { - $result = $tagObj->remove_tag($recordId,$tagNameId); - $tagList = $tagObj->get_tag_list(); - - //check the results. - if($result==1) { - //Cool. Tell 'em the tag was removed. - $messageArr = array( - 'title' => 'Tag Successfully Removed', - 'message' => "We removed \"". $tagList[$tagNameId] ."\".", - 'type' => 'status' - ); - } - else { - //already got most of the array, just change the actual message. - $messageArr['message'] = "Result of trying to remove tag: (". $result .")"; - } - } - - $newTagList = generate_tag_list($recordId); - - if(strlen($newTagList)) { - $returnThis = $newTagList; - } - else { - $returnThis = "invalid response from generate_tag_list($recordId)"; - } - - $page->set_message_wrapper($messageArr); - $objResponse->addAssign('MAIN_error_message', 'innerHTML', $page->process_set_message()); - - $objResponse->addAssign('tagList', 'innerHTML', $returnThis); - $objResponse->addAssign('addTagOptionList', 'innerHTML', generate_addable_tags($recordId)); - - - ob_end_clean(); - return($objResponse); -}//end ajax__removeTag() - - - -function ajax__addTag($tagNameId, $recordId) { - ob_start(); - - $tagObj = $GLOBALS['objects']['tag']; - $page = $GLOBALS['objects']['page']; - $objResponse = new xajaxResponse(); - - $result = $tagObj->add_tag($recordId, $tagNameId); - - $objResponse->addAssign('tagList', 'innerHTML', generate_tag_list($recordId)); - $objResponse->addAssign('addTagOptionList', 'innerHTML', generate_addable_tags($recordId)); - - //display a message saying it worked. - if($result == 1) { - $tagList = $tagObj->get_tag_list(); - $messageArr = array( - 'title' => 'Tag Added Successfully', - 'message' => "Successfully tagged record with \"". $tagList[$tagNameId] ."\"", - 'type' => 'status' - ); - } - else { - $messageArr = array( - 'title' => 'Failed to Add Tag', - 'message' => "Result of adding tag was (". $result .")", - 'type' => 'error' - ); - } - $page->set_message_wrapper($messageArr); - $objResponse->addAssign('MAIN_error_message', 'innerHTML', $page->process_set_message()); - - - return($objResponse); - ob_end_clean(); - -}//end ajax__addTag() - - -function generate_tag_list($recordId, $useTextRows=FALSE) { - $page = $GLOBALS['objects']['page']; - $tagObj = $GLOBALS['objects']['tag']; - - if(!is_numeric($recordId)) { - return("invalid recordId=(". $recordId .")"); - } - elseif(!(is_object($tagObj) && get_class($tagObj) == 'tagClass')) { - return("didn't get tagClass object"); - } - elseif(!(is_object($page) && get_class($page) == 'cs_genericPage')) { - return("invalid page object: (". get_class($page) .")"); - } - - - $myTagList = $tagObj->get_tags_for_record($recordId, TRUE); - if(is_array($myTagList)) { - if($useTextRows) { - $tagListVar = 'text_tags'; - } - else { - $tagListVar = 'removeable_tag'; - } - - if(!isset($page->templateRows[$tagListVar])) { - $page->set_all_block_rows(); - } - $baseRow = $page->templateRows[$tagListVar]; - - $myTagRow = ""; - $tCount = 0; - foreach($myTagList as $tagNameId=>$tagData) { - $tagName = $tagData['name']; - - //don't show a separator for the end piece. - $tCount++; - $separator = ' || '; - if($tCount == count($myTagList)) { - $separator = ""; - } - $repArr = array( - 'tag_name_id' => $tagNameId, - 'name' => $tagName, - 'separator' => $separator, - 'imgHtml' => $tagData['imgHtml'] - ); - $myTagRow .= mini_parser($baseRow, $repArr, '%%', '%%'); - } - $myTagRow = mini_parser($myTagRow, array('record_id'=>$recordId), '{', '}'); - $page->add_template_var($tagListVar, $myTagRow); - - if(strlen($myTagRow)) { - $retval = $myTagRow; - } - else { - $retval = __METHOD__ .": No data parsed..?"; - throw new exception($retval); - } - } - else { - $retval = ""; - } - - return($retval); -}//end generate_tag_list() - - -function generate_addable_tags($recordId) { - $tagObj = $GLOBALS['objects']['tag']; - $page = $GLOBALS['objects']['page']; - $availableTagsList = $tagObj->get_available_tags_for_record($recordId, 3); - $retval = NULL; - if(is_array($availableTagsList) && count($availableTagsList) > 0) { - $myTagsList = array_as_option_list($availableTagsList,NULL,'select',$page->templateRows['addTag_option']); - $myTagsList = '<select>'. $myTagsList .'</select>'; - $myTagsList = mini_parser($myTagsList, array('record_id' => $recordId), '{', '}'); - $page->add_template_var("add_tag_list", $myTagsList); - $retval = $myTagsList; - } - return($retval); -} - - -?> \ 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...> - 2009-02-05 18:08:04
|
Revision: 926 http://cs-project.svn.sourceforge.net/cs-project/?rev=926&view=rev Author: crazedsanity Date: 2009-02-05 18:07:59 +0000 (Thu, 05 Feb 2009) Log Message: ----------- Minor layout changes. /includes/login.inc: * updates new "MAINTABLE_EXTRA" so it is center-aligned. /templates/header.shared.tmpl: * set the table holding the infobar & MAIN_error_message to have padding. /templates/main.shared.tmpl: * put content into a table with left padding (and a "MAINTABLE_EXTRA" var in the table declaration, so it can be changed on a per-page basis). Modified Paths: -------------- trunk/1.2/includes/login.inc trunk/1.2/templates/header.shared.tmpl trunk/1.2/templates/main.shared.tmpl Modified: trunk/1.2/includes/login.inc =================================================================== --- trunk/1.2/includes/login.inc 2009-02-05 17:41:48 UTC (rev 925) +++ trunk/1.2/includes/login.inc 2009-02-05 18:07:59 UTC (rev 926) @@ -16,6 +16,7 @@ $page->db = &$db; $page->add_template_var('cs-project_version', VERSION_STRING); +$page->add_template_var('MAINTABLE_EXTRA', 'align="center"'); if(isset($_GET['loginDestination']) && strlen($_GET['loginDestination'])) { $_SESSION['loginDestination'] = $_GET['loginDestination']; Modified: trunk/1.2/templates/header.shared.tmpl =================================================================== --- trunk/1.2/templates/header.shared.tmpl 2009-02-05 17:41:48 UTC (rev 925) +++ trunk/1.2/templates/header.shared.tmpl 2009-02-05 18:07:59 UTC (rev 926) @@ -10,7 +10,7 @@ <body bgcolor="#e0e0e0" style="margin:1px" {HTMLBODY_EXTRA}> -<table> +<table style="padding-left:2em"> <tr> <td> {infobar} Modified: trunk/1.2/templates/main.shared.tmpl =================================================================== --- trunk/1.2/templates/main.shared.tmpl 2009-02-05 17:41:48 UTC (rev 925) +++ trunk/1.2/templates/main.shared.tmpl 2009-02-05 18:07:59 UTC (rev 926) @@ -1,3 +1,9 @@ {header} -{content} +<table border="0" cellpadding="0" cellspacing="0" style="padding-left:1em" {MAINTABLE_EXTRA}> + <tr> + <td> + {content} + </td> + </tr> +</table> {footer} \ 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...> - 2009-02-05 17:41:53
|
Revision: 925 http://cs-project.svn.sourceforge.net/cs-project/?rev=925&view=rev Author: crazedsanity Date: 2009-02-05 17:41:48 +0000 (Thu, 05 Feb 2009) Log Message: ----------- Partial implementation for single action button on issues (#99). NOTE: there are still some display issues to work out, but the code properly handles updates, remarks, solving, or any combination thereof. A future commit will fix the display issue (shows a remark box when the issue is solved). NOTE2: there is currently no handling of whether the person looking at the issue has any authority to do anything to it; I believe at one point only the owner could make modifications or solve it... this make come back in the future... /includes/content/helpdesk.inc: * "submit" action (for $_POST) handles updates, remarks, and solutions. * there was a segment involving change of ancestry, but it doesn't seem to have ever been called. * the updates, remarks, solving, etc all happen in a big transaction: if one part fails, the whole thing fails. Not sure about sending emails; that is probably out of the scope of this fix... * updated one comment so it's easier to tell what it is supposed to do. /templates/content/helpdesk/view.content.tmpl: * dropped the solution row * replaced the remark/modify/solve buttons with a single "submit" button. * added a checkbox for "isSolution". Modified Paths: -------------- trunk/1.2/includes/content/helpdesk.inc trunk/1.2/templates/content/helpdesk/view.content.tmpl Modified: trunk/1.2/includes/content/helpdesk.inc =================================================================== --- trunk/1.2/includes/content/helpdesk.inc 2009-02-05 16:36:30 UTC (rev 924) +++ trunk/1.2/includes/content/helpdesk.inc 2009-02-05 17:41:48 UTC (rev 925) @@ -22,23 +22,36 @@ ); } $byPassUrlExtras = FALSE; - if($action) { + if(strlen($action)) { - if($action == "modify") { - //update the ancestry... - $_POST['updates']['parentRecordId'] = $_POST['updates']['project_id']; - unset($_POST['updates']['project_id']); + if($action == "submit") { + $proj->helpdeskObj->db->beginTrans(); + //SETUP THE MESSAGE THEY'LL SEE... + $setMessage = array( + "title" => "", + "message" => "... SET ME!!! ...", + "type" => "error" + ); + $success = false; + $remarks = array(); + + $oldData = $proj->helpdeskObj->get_record($helpdeskId); + + + ################################# + # ---------> BEGIN "update" + ################################# + + //if they've changed the name, we gotta log it. //TODO: probably log this within helpdeskClass::update(). - if(isset($_POST['updates']['name'])) { - //retrieve the old info. - $oldData = $proj->helpdeskObj->get_record($_POST['id']); - - if($oldData['name'] !== $_POST['updates']['name']) { - $addRemark = 'Updated [b]name[/b] from ([b][i]'. $oldData['name'] .'[/i][/b])'; - } + if(isset($_POST['updates']['name']) && $oldData['name'] !== $_POST['updates']['name']) { + $remarks[] = array( + "remark" => 'Updated [b]name[/b] from ([b][i]'. $oldData['name'] .'[/i][/b])', + false + ); } $doNotAcceptFields = array("solution", "remark"); @@ -47,72 +60,107 @@ } $result = $proj->helpdeskObj->update_record($helpdeskId, $_POST['updates']); - if(strlen($addRemark)) { - $proj->helpdeskObj->remark($_POST['id'], $addRemark); - } - - //tell them what happened. + //SET/UPDATE THE TYPE OF MESSAGE THAT WILL DISPLAY... if($result == 1) { - set_message_wrapper(array( - "title" => "Update Successful", - "message" => "Your issue was updated successfully.", - "type" => "status" - )); + $success = true; + $messageTitle[] = "Updated"; + $messageText[] = "Your issue was updated successfully."; } else { - set_message_wrapper(array( - "title" => "Update FAILURE", - "message" => "Update returned [$result]. Last error was [". $proj->helpdeskObj->lastError ."]", - "type" => "error" - )); + #$setMessage['type'] = "error"; + $success = false; } - $urlSection = "view"; - } - elseif($action == "remark") { - $helpdeskData = $proj->helpdeskObj->get_record($helpdeskId); - //only care about the remark data... if they changed something, well... they're stupid. - $useRespondLink = FALSE; - if($helpdeskData['email'] != $_SESSION['email']) { - $useRespondLink = $proj->helpdeskObj->create_md5($helpdeskId); - } - $result = $proj->helpdeskObj->remark($helpdeskId, $_POST['remark'], FALSE, $useRespondLink); - if($result > 0) { - set_message_wrapper(array( - "title" => "Remark Added Successfully", - "message" => "Your thoughts have been dually noted in the database... or at least singly. :D", - "type" => "status" - )); + ################################# + # ---------> BEGIN "remark/solve" + ################################# + if($success === true && strlen($_POST['remark'])) { + //now check remark stuff. + $useRespondLink = FALSE; + if($_POST['isSolution']) { + //IT'S A SOLUTION + //solve it & make sure they know if it was good or not. + #$result = $proj->helpdeskObj->solve($helpdeskId, $_POST['solution']); + $remarks[] = array( + 'remark' => $_POST['remark'], + 'isSolution' => true + ); + $extra = NULL; + + if($result == 1 && $success === true) { + $messageTitle[] = "Solved"; + $messageText[] = "Your solution was logged, and the issue was updated accordingly. Confirmation emails have been sent."; + } + } + else { + //JUST A REMARK... + if($oldData['email'] != $_SESSION['email']) { + $useRespondLink = $proj->helpdeskObj->create_md5($helpdeskId); + } + $remarks[] = array( + 'remark' => $_POST['remark'], + 'isSolution' => false, + 'link' => $useRespondLink + ); + + if($result > 0) { + $success = true; + $messageTitle[] = "Remarked Upon"; + $messageText[] = "Your thoughts have been dually noted in the database... or at least singly. :D"; + } + }//end REMARK } + + if($success) { + //TODO: this is where a queued email system would be good; if the first remark succeeds but the second fails, this will generate an erroneous email. + if(count($remarks)) { + foreach($remarks as $num=>$remarkData) { + $result = $proj->helpdeskObj->remark($helpdeskId, $remarkData['remark'], $remarkData['isSolution'], $remarkData['link']); + if($result <= 0) { + $success = false; + break; + } + } + } + + if($success === true) { + $proj->helpdeskObj->db->commitTrans(); + //format the message so it looks nice... + $setMessage['message'] = ""; + if(count($messageTitle) > 2) { + $lastMessage = array_pop($setMessage); + $setMessage['title'] = $page->gfObj->string_from_array($messageTitle, null, ", "); + $setMessage['title'] .= " and ". $lastMessage; + } + else { + $setMessage['title'] = $page->gfObj->string_from_array($messageTitle, null, " and "); + } + $setMessage['message'] = $page->gfObj->string_from_array($messageText, null, "<BR>\n"); + $setMessage['type'] = "status"; + } + else { + $proj->helpdeskObj->db->rollbackTrans(); + $setMessage = array( + 'title' => "Update FAILED", + 'message' => "The update would have worked, but you didn't put enough information into your remark.", + 'type' => "error" + ); + } + } else { - set_message_wrapper(array( - "title" => "Unable to Add Remark", - "message" => "Dually noted, summarily denied. Beotch.", - "type" => "error" - )); + $proj->helpdeskObj->db->rollbackTrans(); + $setMessage = array( + 'title' => "Update FAILED", + 'message' => "Update returned [". $result ."]. Last error was [". $proj->helpdeskObj->lastError ."]", + 'type' => "error" + ); } - } - elseif($action == "solve") { - //solve it & make sure they know if it was good or not. - $result = $proj->helpdeskObj->solve($helpdeskId, $_POST['solution']); - $extra = NULL; - if($result == 1) { - set_message_wrapper(array( - "title" => "Solved Successfully", - "message" => "Your solution was logged, and the issue was updated accordingly. Confirmation emails " . - "have been sent.", - "type" => "status" - )); - } - else { - set_message_wrapper(array( - "title" => "Unable to Solve", - "message" => "Try using a longer explanation... or check the error log.", - "type" => "error" - )); - } + #$page->gfObj->debug_print($_POST,1); + #$page->gfObj->debug_print($setMessage,1); + #exit; + $page->set_message_wrapper($setMessage); } elseif($action == "filter") { if($_POST['reset_filter']) { @@ -410,6 +458,7 @@ } else { + //DISPLAY ALL AVAILABLE HELPDESK ISSUES. //change the content of the page properly. $page->set_all_block_rows("content", array("helpdesk_search")); Modified: trunk/1.2/templates/content/helpdesk/view.content.tmpl =================================================================== --- trunk/1.2/templates/content/helpdesk/view.content.tmpl 2009-02-05 16:36:30 UTC (rev 924) +++ trunk/1.2/templates/content/helpdesk/view.content.tmpl 2009-02-05 17:41:48 UTC (rev 925) @@ -213,13 +213,6 @@ </td> </tr> <!-- END remark_row --> -<!-- BEGIN solution_row --> -<tr> - <td colspan="3">Solution: <br> - <textarea name="solution" rows="10" cols="80" {solution_readonly}></textarea> - </td> -</tr> -<!-- END solution_row --> <!-- BEGIN reopen_button --> <tr> <td> </td> @@ -228,21 +221,16 @@ <!-- END reopen_button --> <!-- BEGIN buttons_row --> <tr> - <td colspan="3"><i>(Changes only take effect when clicking "modify", while "solve" only cares about the solution field, and "remark" only cares about the remarks field.)</i></td> -</tr> -<tr> - <td colspan="3"> - <input name="action" value="Remark" type="submit"> -<!-- BEGIN update_button --> - <input name="action" value="Modify" type="submit"> -<!-- END update_button --> -<!-- BEGIN owner_options --> - <input name="action" value="solve" type="submit"> -<!-- END owner_options --> + <td colspan="3" align="center"> + <input name="action" value="Submit" type="submit"> <a href="/help/helpdesk/submit_buttons" target="_blank"> <img src="/images/icon-help.png" border="0"></a> + + <BR> + Is this a <b>Solution</b>? + <input name="isSolution" type="checkbox"> </td> </tr> <!-- END buttons_row --> This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <cra...@us...> - 2009-02-05 16:36:40
|
Revision: 924 http://cs-project.svn.sourceforge.net/cs-project/?rev=924&view=rev Author: crazedsanity Date: 2009-02-05 16:36:30 +0000 (Thu, 05 Feb 2009) Log Message: ----------- Consolidate code for solve vs. remark (#240). /lib/helpdeskClass.php: * MAIN::: -- changed $db and $helpdeskId from var to public (same, but PHP5-ified). * remark(): -- SINGLE RETURN STATEMENT (note that it is not fully tabbed correctly yet, as that would cause the diff to be difficult to understand). -- starts a transaction so it's all or nothing. -- if it's a solution, calls protected method solve() -- commits on success, rolls back on failure (failure logs AFTER the transaction is rolled back so its not missed). * solve(): -- VISIBILITY CHANGE: from public to PROTECTED -- ARG CHANGE: ALL ARGS DELETED -- no longer accepts arguments, since it is only called internally and there is no need for a description of the solution (and its not public) -- progress is updated to 100 (#242) -- removed comments about email when no email is sent here. Modified Paths: -------------- trunk/1.2/lib/helpdeskClass.php Modified: trunk/1.2/lib/helpdeskClass.php =================================================================== --- trunk/1.2/lib/helpdeskClass.php 2009-02-04 19:15:53 UTC (rev 923) +++ trunk/1.2/lib/helpdeskClass.php 2009-02-05 16:36:30 UTC (rev 924) @@ -13,8 +13,8 @@ class helpdeskClass extends mainRecord { - var $db; //database handle. - var $helpdeskId = NULL; //bug/helpdesk + public $db; //database handle. + public $helpdeskId=null; private $allowedFields; protected $logsObj; @@ -149,8 +149,12 @@ //PRE-CHECK!!! if(strlen($remark) < 10) { $this->logsObj->log_by_class(__METHOD__ .": not enough content to remark on [helpdesk_id=". $helpdeskId."] ::: $remark", 'error'); - return(-1); + #return(-1); + $retval = -1; } + else { + //start a transaction so if one part fails, they all fail. + $this->db->beginTrans(); $tmp = $this->get_record($helpdeskId); $noteObj = new noteClass($this->db); @@ -214,13 +218,20 @@ $sendEmailRes = send_email(HELPDESK_ISSUE_ANNOUNCE_EMAIL, $subject, $emailTemplate, $parseArr); $details = 'Sent notifications of SOLUTION for [helpdesk_id='. $helpdeskId .'] to: '. $sendEmailRes; $this->logsObj->log_by_class($details, 'information'); + + $this->solve(); } + $this->db->commitTrans(); } else { + $this->rollbackTrans(); //something went wrong. $this->logsObj->log_by_class(__METHOD__ .": failed to remark on [helpdesk_id=". $helpdeskId ."] (". $retval .")", 'error'); } + } + $this->gfObj->debug_print(__METHOD__ .": result=(". $retval .")",1); + return($retval); }//end remark() @@ -229,7 +240,7 @@ //================================================================================================ /** - * Updates the given record with the "solved" status, and updates the "solution" field. + * Marks the issue as solved (does NOT handle marking any notes as solutions). * * @param <$helpdeskId> <int> helpdesk issue to update. * @param <$solution> <str> solution for the problem. @@ -237,46 +248,32 @@ * @return 0 FAIL: unable to solve... not sure why. * @return 1 PASS: solved successfully. */ - function solve($helpdeskId, $solution) { + protected function solve() { //PRE-CHECK!!! - if(!is_numeric($helpdeskId) || !is_string($solution) || strlen($solution) < 10) { - $retval = 0; - if(strlen($solution) < 10) { - $this->logsObj->log_by_class(__METHOD__ .": not enough information to solve [helpdesk_id=" . - $helpdeskId ."]::: $solution", 'error'); - $retval = -1; - } + if(!is_numeric($this->helpdeskId)) { + $details = __METHOD__ .": not enough information to solve [helpdesk_id=" . + $this->helpdeskId ."]::: $solution"; + $this->logsObj->log_by_class($details, 'error'); + throw new exception($details); } else { //okay, everything checked out. Do your thing. - //NOTE::: projects using the original helpdesk code had the "minute" part of the time as "daylight savings time"... $updatesArr = array( - "solution" => $solution, - "solve_time" => date("Y-m-d H:m:s"), - "solved" => $_SESSION['uid'], + "progress" => 100, "status_id" => 4 ); - //now, let's run the update method & tell 'em what happened. - $createSolution = $this->remark($helpdeskId, $solution, TRUE); - if($createSolution > 0) { - $retval = $this->update_record($helpdeskId, $updatesArr); - - //only send an email if the update succeeded. - if($retval == 1) { - //send the submitter a notification. - $this->logsObj->log_by_class("Solved issue #". $helpdeskId .": [helpdesk_id=". $helpdeskId ."]", 'report'); - } - else { - //log the problem. - $this->logsObj->log_by_class(__METHOD__ .": failed to update [helpdesk_id=". - $helpdeskId ."]: (". $retval .")", 'error'); - } + $retval = $this->update_record($this->helpdeskId, $updatesArr); + + //log the action. + if($retval == 1) { + //send the submitter a notification. + $this->logsObj->log_by_class("Solved issue #". $this->helpdeskId .": [helpdesk_id=". $this->helpdeskId ."]", 'report'); } else { - //failed to create the solution remark. - $this->logsObj->log_dberror("Unable to create solution note for issue [helpdesk_id=" . - $helpdeskId ."] : (". $createSolution .")"); + //log the problem. + $this->logsObj->log_by_class(__METHOD__ .": failed to update [helpdesk_id=". + $this->helpdeskId ."]: (". $retval .")", 'error'); } } return($retval); This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <cra...@us...> - 2009-02-04 19:15:58
|
Revision: 923 http://cs-project.svn.sourceforge.net/cs-project/?rev=923&view=rev Author: crazedsanity Date: 2009-02-04 19:15:53 +0000 (Wed, 04 Feb 2009) Log Message: ----------- Fix problem wherein an ajax call that updates tag list leaves unused template vars visible (#239). Modified Paths: -------------- trunk/1.2/includes/content/tags.inc Modified: trunk/1.2/includes/content/tags.inc =================================================================== --- trunk/1.2/includes/content/tags.inc 2009-02-04 19:09:54 UTC (rev 922) +++ trunk/1.2/includes/content/tags.inc 2009-02-04 19:15:53 UTC (rev 923) @@ -300,6 +300,8 @@ $retval = mini_parser($myRow, array('tag_row'=>$recordList), '{', '}'); $retval = mini_parser($outerTemplate, array('availableTagsList' => $retval), '{', '}'); + $retval = $page->strip_undef_template_vars($retval); + return($retval); }//end updateTagList() This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <cra...@us...> - 2009-02-04 19:10:01
|
Revision: 922 http://cs-project.svn.sourceforge.net/cs-project/?rev=922&view=rev Author: crazedsanity Date: 2009-02-04 19:09:54 +0000 (Wed, 04 Feb 2009) Log Message: ----------- Fix tabs to not have spaces under corners, change admin link to a new tab. /includes/content.inc: * move "tags" so it is the last tab in the list. * remove code that adds link to "settings" tab. * code to create admin tab (and select it as needed) if they're an admin. /public_html/css/common.css: * remove vertical alignment setting for table cells (was set to "top") /templates/infobar.shared.tmpl: * remove some extra lines so things are separated nicely * add spacing to left and right of tabs (like tabs.shared.tmpl) * valign=middle on cells containing text/url * remove " " from corner cells to remove spacing beneath image /templates/tabs.shared.tmpl: * add spacing to left and right of tabs * valign=middle on cells containing text/url * remove " " from corner cells to remove spacing beneath image Modified Paths: -------------- trunk/1.2/includes/content.inc trunk/1.2/public_html/css/common.css trunk/1.2/templates/infobar.shared.tmpl trunk/1.2/templates/tabs.shared.tmpl Modified: trunk/1.2/includes/content.inc =================================================================== --- trunk/1.2/includes/content.inc 2009-02-04 18:37:17 UTC (rev 921) +++ trunk/1.2/includes/content.inc 2009-02-04 19:09:54 UTC (rev 922) @@ -127,16 +127,11 @@ 'summary' => "Summary", 'project' => "Projects", 'helpdesk' => "Helpdesk", - 'tags' => "Tags", 'contacts' => "Contacts", 'settings' => "Settings", + 'tags' => "Tags", ); -if($user->is_admin()) { - $tabNames['settings'] = "Settings</a><BR>\n<a href=\"/content/settings/admin\"><b>[Admin]</b>"; -} - -#$page->add_template_var('tabs', $page->file_to_string('tabs.shared.tmpl')); $tabObj = new cs_tabs($page); foreach($tabNames as $moduleName=>$name) { $tabUrl = "/content/". $moduleName; @@ -146,6 +141,14 @@ } $tabObj->add_tab($name, $tabUrl); } + +if($user->is_admin()) { + $name = "Admin"; + $tabObj->add_tab($name, "/content/settings/admin"); + if(count($page->ftsSections) == 3 && $page->ftsSections[2] == 'admin') { + $tabObj->select_tab($name); + } +} $tabObj->display_tabs(); Modified: trunk/1.2/public_html/css/common.css =================================================================== --- trunk/1.2/public_html/css/common.css 2009-02-04 18:37:17 UTC (rev 921) +++ trunk/1.2/public_html/css/common.css 2009-02-04 19:09:54 UTC (rev 922) @@ -1,6 +1,6 @@ body, a, li { font-size: 8pt; font-family: helvetica, sans-serif; text-decoration:none; } a:visited {color: #0000FF; } -td {font-size: 8pt; font-family: helvetica, sans-serif; text-decoration:none; vertical-align:top; } +td {font-size: 8pt; font-family: helvetica, sans-serif; text-decoration:none; } form {margin:0; padding:0;} input, textarea { background-color: #F5F5F5; font-family: courier, sans-serif; font-size: 8pt; } Modified: trunk/1.2/templates/infobar.shared.tmpl =================================================================== --- trunk/1.2/templates/infobar.shared.tmpl 2009-02-04 18:37:17 UTC (rev 921) +++ trunk/1.2/templates/infobar.shared.tmpl 2009-02-04 19:09:54 UTC (rev 922) @@ -22,16 +22,12 @@ <table border="0" cellpadding=0 cellspacing=0> <tr> {tabs} + <td valign=top align="right" style="padding-left:1px;"><img src='/images/tab_left_inactive.gif' border='0' height="100%"></td> + <td id='notselected' valign="middle"><a id='notselected' href='/login.php?logout=1' target='_top'>Logout</a></td> + <td valign=top style="padding-right:1px;"><img src='/images/tab_right_inactive.gif' border='0' height="100%"></td> - <td valign=top align="right"><img src='/images/tab_left_inactive.gif' border='0' height="100%"></td> - - <td id='notselected' valign=top><a id='notselected' href='/login.php?logout=1' target='_top'>Logout</a></td> - - <td valign=top><img src='/images/tab_right_inactive.gif' border='0' height="100%"> </td> - - <td valign=top align="right"><img src='/images/tab_left_inactive.gif' border='0' height="100%"></td> - - <td id='notselected' valign=top><input type=hidden name='module' value='projects'> + <td valign=top align="right" style="padding-left:1px;"><img src='/images/tab_left_inactive.gif' border='0' height="100%"></td> + <td id='notselected' valign="middle"><input type=hidden name='module' value='projects'> <form action="/content" method=get> <input type="hidden" name="version" value="{cs-project_version}"> <select name=changeGroup onchange='document.forms[0].submit()'> @@ -39,8 +35,7 @@ </select> </form> </td> - - <td valign=top><img src='/images/tab_right_inactive.gif' border='0' height="100%"> </td> + <td valign=top style="padding-right:1px;"><img src='/images/tab_right_inactive.gif' border='0' height="100%"></td> </tr> </table> </td> Modified: trunk/1.2/templates/tabs.shared.tmpl =================================================================== --- trunk/1.2/templates/tabs.shared.tmpl 2009-02-04 18:37:17 UTC (rev 921) +++ trunk/1.2/templates/tabs.shared.tmpl 2009-02-04 19:09:54 UTC (rev 922) @@ -1,11 +1,11 @@ <!-- BEGIN selected_tab --> - <td valign=top align="right"><img src='/images/tab_left_active.gif' border='0' height="100%"></td> - <td id='selected' valign=top><a id='selected' href='%%url%%' target='_top'>%%title%%</a></td> - <td valign=top><img src='/images/tab_right_active.gif' border='0' height="100%"> </td> + <td valign=top align="right" style="padding-left:1px;"><img src='/images/tab_left_active.gif' border='0' height="100%"></td> + <td id='selected' valign="middle"><a id='selected' href='%%url%%' target='_top'>%%title%%</a></td> + <td valign=top style="padding-right:1px;"><img src='/images/tab_right_active.gif' border='0' height="100%"></td> <!-- END selected_tab --> <!-- BEGIN unselected_tab --> <td valign=top align="right"><img src='/images/tab_left_inactive.gif' border='0' height="100%"></td> - <td id='notselected' valign=top><a id='notselected' href='%%url%%' target='_top'>%%title%%</a></td> - <td valign=top><img src='/images/tab_right_inactive.gif' border='0' height="100%"> </td> + <td id='notselected'><div style="text:align=middle"><a id='notselected' href='%%url%%' target='_top'>%%title%%</a></td> + <td valign=top style="padding-right:1px;"><img src='/images/tab_right_inactive.gif' border='0' height="100%"></td> <!-- END unselected_tab --> This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <cra...@us...> - 2009-02-04 18:37:24
|
Revision: 921 http://cs-project.svn.sourceforge.net/cs-project/?rev=921&view=rev Author: crazedsanity Date: 2009-02-04 18:37:17 +0000 (Wed, 04 Feb 2009) Log Message: ----------- Updated to use CS-Content v1.0-ALPHA6 Modified Paths: -------------- trunk/1.2/lib/globalFunctions.php Modified: trunk/1.2/lib/globalFunctions.php =================================================================== --- trunk/1.2/lib/globalFunctions.php 2009-02-03 19:55:17 UTC (rev 920) +++ trunk/1.2/lib/globalFunctions.php 2009-02-04 18:37:17 UTC (rev 921) @@ -17,7 +17,7 @@ function get_required_external_lib_versions($projectName=NULL) { //format: {className} => array({projectName} => {exactVersion}) $requirements = array( - 'contentSystem' => array('cs-content', '1.0.0-ALPHA4'), + 'contentSystem' => array('cs-content', '1.0.0-ALPHA6'), 'cs_phpxmlParser' => array('cs-phpxml', '1.0.0-ALPHA3'), 'cs_arrayToPath' => array('cs-arrayToPath', '1.0.0') ); This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <cra...@us...> - 2009-02-03 19:55:21
|
Revision: 920 http://cs-project.svn.sourceforge.net/cs-project/?rev=920&view=rev Author: crazedsanity Date: 2009-02-03 19:55:17 +0000 (Tue, 03 Feb 2009) Log Message: ----------- Update to use cs-phpxml v1.0.0-ALPHA3 Modified Paths: -------------- trunk/1.2/lib/globalFunctions.php Modified: trunk/1.2/lib/globalFunctions.php =================================================================== --- trunk/1.2/lib/globalFunctions.php 2009-02-03 19:30:55 UTC (rev 919) +++ trunk/1.2/lib/globalFunctions.php 2009-02-03 19:55:17 UTC (rev 920) @@ -18,7 +18,7 @@ //format: {className} => array({projectName} => {exactVersion}) $requirements = array( 'contentSystem' => array('cs-content', '1.0.0-ALPHA4'), - 'cs_phpxmlParser' => array('cs-phpxml', '1.0.0-ALPHA2'), + 'cs_phpxmlParser' => array('cs-phpxml', '1.0.0-ALPHA3'), 'cs_arrayToPath' => array('cs-arrayToPath', '1.0.0') ); This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <cra...@us...> - 2009-02-03 19:30:59
|
Revision: 919 http://cs-project.svn.sourceforge.net/cs-project/?rev=919&view=rev Author: crazedsanity Date: 2009-02-03 19:30:55 +0000 (Tue, 03 Feb 2009) Log Message: ----------- Update to new version of cs-content (1.0.0-ALPHA4). /lib/globalFunctions.php: * get_required_external_lib_versions(): -- change cs-content version to 1.0.0-ALPHA4 /lib/session_class.php: * MAIN::: -- update file name of cs_session{} location. Modified Paths: -------------- trunk/1.2/lib/globalFunctions.php trunk/1.2/lib/session_class.php Modified: trunk/1.2/lib/globalFunctions.php =================================================================== --- trunk/1.2/lib/globalFunctions.php 2009-02-03 19:07:44 UTC (rev 918) +++ trunk/1.2/lib/globalFunctions.php 2009-02-03 19:30:55 UTC (rev 919) @@ -17,7 +17,7 @@ function get_required_external_lib_versions($projectName=NULL) { //format: {className} => array({projectName} => {exactVersion}) $requirements = array( - 'contentSystem' => array('cs-content', '1.0.0-ALPHA3'), + 'contentSystem' => array('cs-content', '1.0.0-ALPHA4'), 'cs_phpxmlParser' => array('cs-phpxml', '1.0.0-ALPHA2'), 'cs_arrayToPath' => array('cs-arrayToPath', '1.0.0') ); Modified: trunk/1.2/lib/session_class.php =================================================================== --- trunk/1.2/lib/session_class.php 2009-02-03 19:07:44 UTC (rev 918) +++ trunk/1.2/lib/session_class.php 2009-02-03 19:30:55 UTC (rev 919) @@ -13,7 +13,7 @@ */ ## -require_once(dirname(__FILE__) .'/cs-content/cs_sessionClass.php'); +require_once(dirname(__FILE__) .'/cs-content/cs_session.class.php'); class Session extends cs_session { This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <cra...@us...> - 2009-02-03 19:07:48
|
Revision: 918 http://cs-project.svn.sourceforge.net/cs-project/?rev=918&view=rev Author: crazedsanity Date: 2009-02-03 19:07:44 +0000 (Tue, 03 Feb 2009) Log Message: ----------- Fix require_once() statement to point to proper file name. Modified Paths: -------------- trunk/1.2/includes/content.inc Modified: trunk/1.2/includes/content.inc =================================================================== --- trunk/1.2/includes/content.inc 2009-02-03 19:03:18 UTC (rev 917) +++ trunk/1.2/includes/content.inc 2009-02-03 19:07:44 UTC (rev 918) @@ -8,7 +8,7 @@ * Last Updated:::::::: $Date$ */ -require_once(dirname(__FILE__) ."/../lib/cs-content/cs_tabsClass.php"); +require_once(dirname(__FILE__) ."/../lib/cs-content/cs_tabs.class.php"); $db = new cs_phpDB; This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <cra...@us...> - 2009-02-03 19:03:25
|
Revision: 917 http://cs-project.svn.sourceforge.net/cs-project/?rev=917&view=rev Author: crazedsanity Date: 2009-02-03 19:03:18 +0000 (Tue, 03 Feb 2009) Log Message: ----------- Include the cs-versionparse project & update cs-content to v1.0 Property Changed: ---------------- trunk/1.2/lib/ Property changes on: trunk/1.2/lib ___________________________________________________________________ Modified: svn:externals - cs-content https://cs-content.svn.sourceforge.net/svnroot/cs-content/trunk/0.10 cs-phpxml https://cs-phpxml.svn.sourceforge.net/svnroot/cs-phpxml/trunk cs-arrayToPath https://cs-arraytopath.svn.sourceforge.net/svnroot/cs-arraytopath/trunk + cs-content https://cs-content.svn.sourceforge.net/svnroot/cs-content/trunk/1.0 cs-phpxml https://cs-phpxml.svn.sourceforge.net/svnroot/cs-phpxml/trunk cs-arrayToPath https://cs-arraytopath.svn.sourceforge.net/svnroot/cs-arraytopath/trunk cs-versionparse https://cs-versionparse.svn.sourceforge.net/svnroot/cs-versionparse/trunk/0.1/ This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |