[CS-Project-svn_notify] SF.net SVN: cs-project: [764] trunk
Brought to you by:
crazedsanity
From: <cra...@us...> - 2008-01-31 21:36:40
|
Revision: 764 http://cs-project.svn.sourceforge.net/cs-project/?rev=764&view=rev Author: crazedsanity Date: 2008-01-31 13:36:37 -0800 (Thu, 31 Jan 2008) Log Message: ----------- Merged changes from the "ajax_test" branch: * AJAX CHANGES: -- add/remove tags on helpdesk records (list updated, select list updated) -- switching currently selected tag (tag list updated, details of tag + associated records) * FIXES::: -- fix viewing note (due to change with cs-content) -- only show note names in project view -- fix upgrade script for ALPHA2 (so the upgrade works) -- remove unnecessary call when retrieving notes for project. Modified Paths: -------------- trunk/includes/content/helpdesk.inc trunk/includes/content/tags.inc trunk/lib/projectClass.php trunk/public_html/js/cs-project.js trunk/templates/content/helpdesk/view.content.tmpl trunk/templates/content/project/view/related_note.content.tmpl trunk/templates/content/tags/index.content.tmpl trunk/templates/header.shared.tmpl Added Paths: ----------- trunk/includes/content/shared.inc trunk/public_html/xajax/ trunk/public_html/xajax/lib/ trunk/public_html/xajax/lib/activex_off.js trunk/public_html/xajax/tests/ trunk/public_html/xajax/tests/HTTPStatusTest.php trunk/public_html/xajax/tests/catchAllFunctionTest.php trunk/public_html/xajax/tests/changeEventTest.php trunk/public_html/xajax/tests/charEncodingTest.php trunk/public_html/xajax/tests/confirmTest.php trunk/public_html/xajax/tests/createFormInputTest.php trunk/public_html/xajax/tests/customResponseClassTest.php trunk/public_html/xajax/tests/disabledFormElementsTest.php trunk/public_html/xajax/tests/errorHandlingTest.php trunk/public_html/xajax/tests/eventHandlerTest.php trunk/public_html/xajax/tests/formSubmissionTest.php trunk/public_html/xajax/tests/includeExternalScriptTest.php trunk/public_html/xajax/tests/index.php trunk/public_html/xajax/tests/largeResponseTest.php trunk/public_html/xajax/tests/myExternalFunction.js trunk/public_html/xajax/tests/myExternalFunction.php trunk/public_html/xajax/tests/phpWhitespaceTest.php trunk/public_html/xajax/tests/preFunctionTest.php trunk/public_html/xajax/tests/redirectTest.php trunk/public_html/xajax/tests/registerExternalFunctionTest.php trunk/public_html/xajax/tests/scriptCallTest.php trunk/public_html/xajax/tests/searchReplaceTest.php trunk/public_html/xajax/tests/xajaxResponseTest.php trunk/public_html/xajax/xajax.inc.php trunk/public_html/xajax/xajaxCompress.php trunk/public_html/xajax/xajaxResponse.inc.php trunk/public_html/xajax/xajax_js/ trunk/public_html/xajax/xajax_js/xajax.js trunk/public_html/xajax/xajax_js/xajax_uncompressed.js trunk/templates/content/notes/view.content.tmpl Removed Paths: ------------- trunk/public_html/xajax/lib/ trunk/public_html/xajax/lib/activex_off.js trunk/public_html/xajax/tests/ trunk/public_html/xajax/tests/HTTPStatusTest.php trunk/public_html/xajax/tests/catchAllFunctionTest.php trunk/public_html/xajax/tests/changeEventTest.php trunk/public_html/xajax/tests/charEncodingTest.php trunk/public_html/xajax/tests/confirmTest.php trunk/public_html/xajax/tests/createFormInputTest.php trunk/public_html/xajax/tests/customResponseClassTest.php trunk/public_html/xajax/tests/disabledFormElementsTest.php trunk/public_html/xajax/tests/errorHandlingTest.php trunk/public_html/xajax/tests/eventHandlerTest.php trunk/public_html/xajax/tests/formSubmissionTest.php trunk/public_html/xajax/tests/includeExternalScriptTest.php trunk/public_html/xajax/tests/index.php trunk/public_html/xajax/tests/largeResponseTest.php trunk/public_html/xajax/tests/myExternalFunction.js trunk/public_html/xajax/tests/myExternalFunction.php trunk/public_html/xajax/tests/phpWhitespaceTest.php trunk/public_html/xajax/tests/preFunctionTest.php trunk/public_html/xajax/tests/redirectTest.php trunk/public_html/xajax/tests/registerExternalFunctionTest.php trunk/public_html/xajax/tests/scriptCallTest.php trunk/public_html/xajax/tests/searchReplaceTest.php trunk/public_html/xajax/tests/xajaxResponseTest.php trunk/public_html/xajax/xajax.inc.php trunk/public_html/xajax/xajaxCompress.php trunk/public_html/xajax/xajaxResponse.inc.php trunk/public_html/xajax/xajax_js/ trunk/public_html/xajax/xajax_js/xajax.js trunk/public_html/xajax/xajax_js/xajax_uncompressed.js trunk/templates/content/notes/index.shared.tmpl Modified: trunk/includes/content/helpdesk.inc =================================================================== --- trunk/includes/content/helpdesk.inc 2008-01-31 21:13:26 UTC (rev 763) +++ trunk/includes/content/helpdesk.inc 2008-01-31 21:36:37 UTC (rev 764) @@ -7,6 +7,10 @@ * 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']; @@ -171,14 +175,6 @@ )); } } - else { - //the didn't post enough... - set_message_wrapper(array( - "title" => "FAILED TO CREATE ISSUE!", - "message" => "Unable to create the message... [$retval]", - "type" => "error" - )); - } //build the redirection URL. $url = $baseUrl; @@ -187,20 +183,22 @@ if(preg_match('/view/', $urlSection) && !is_numeric($urlExtrasArr['ID'])) { unset($urlSection); } - if(isset($urlSection) && !preg_match('/\?/', $url)) { - if(!preg_match('/$\//', $url)) { - $urlSection = "/". $urlSection; + else { + if(isset($urlSection) && !preg_match('/\?/', $url)) { + if(!preg_match('/$\//', $url)) { + $urlSection = "/". $urlSection; + } + $url .= $urlSection; } - $url .= $urlSection; - } - if(!$byPassUrlExtras && count($urlExtrasArr) > 0) { - $urlExtrasStr = string_from_array($urlExtrasArr, "url"); - if($urlExtrasStr !== 0) { - $url .= "?". $urlExtrasStr .'&random='. time(); + if(!$byPassUrlExtras && count($urlExtrasArr) > 0) { + $urlExtrasStr = string_from_array($urlExtrasArr, "url"); + if($urlExtrasStr !== 0) { + $url .= "?". $urlExtrasStr .'&random='. time(); + } } + conditional_header($url); + exit; } - conditional_header($url); - exit; } else { $helpdeskId = $_GET['ID']; @@ -353,44 +351,16 @@ - $myTagList = $proj->tagObj->get_tags_for_record($helpdeskData['record_id'], TRUE); - if(is_array($myTagList)) { - if($helpdeskData['status_id'] == 4) { - $tagListVar = 'text_tags'; - $baseRow = $page->templateRows['text_tags']; - } - else { - $tagListVar = 'removeable_tag'; - $baseRow = $page->templateRows['removeable_tag']; - } - $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, '%%', '%%'); - } - $page->add_template_var($tagListVar, $myTagRow); + $useTextTags = FALSE; + if($helpdeskData['status_id'] == 4) { + $useTextTags = TRUE; } + generate_tag_list($helpdeskData['record_id'], $useTextTags); + + //Display tags that can be added. - $availableTagsList = $proj->tagObj->get_available_tags_for_record($helpdeskData['record_id'], 3); - if(is_array($availableTagsList) && count($availableTagsList) > 0) { - $myTagsList = array_as_option_list($availableTagsList,NULL,'select',$page->templateRows['addTag_option']); - $page->add_template_var("add_tag_list", $myTagsList); - } + generate_addable_tags($helpdeskData['record_id']); //now parse the note rows. if(is_array($myNotes) && count($myNotes)) { @@ -509,4 +479,184 @@ } } } + +//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 Copied: trunk/includes/content/shared.inc (from rev 763, branches/ajax_test/includes/content/shared.inc) =================================================================== --- trunk/includes/content/shared.inc (rev 0) +++ trunk/includes/content/shared.inc 2008-01-31 21:36:37 UTC (rev 764) @@ -0,0 +1,57 @@ +<?php +/* + * Created on Jan 29, 2008 + * + * To change the template for this generated file go to + * Window - Preferences - PHPeclipse - PHP - Code Templates + */ + + +require_once(dirname(__FILE__) ."/../../public_html/xajax/xajax.inc.php"); + + + + + +$GLOBALS['objects'] = array(); +$GLOBALS['objects']['page'] =& $page; +$GLOBALS['objects']['proj'] =& $proj; +$GLOBALS['objects']['tag'] =& $proj->tagObj; + + +/** + * Handles creation of javascript functions; AJAX callback functions + * should start with "ajax__", and can then be referenced in the HTML + * with the prefix "xajax_ajax__". If the callback function is named + * "ajax__function()", the javascript call would be "xajax_ajax__function()". + * + * NOTE: Because PHP lowercases function names when calling get_defined_functions(), + * javascript calls must use the lowercase version; i.e. if the callback + * is named "ajax__showMeStuff()", the javascript would be + * "xajax_ajax__showmestuff()". + */ +function addAjax() { + $xajax = new xajax($_SERVER['PHP_SELF']); + + //automatically register all functions starting with "ajax__" + $funcList = get_defined_functions(); + $funcList = $funcList['user']; + foreach($funcList as $name) { + if(preg_match('/^ajax__/', $name)) { + $xajax->registerFunction($name); + } + } + + $xajax->processRequests(); + + //since Xajax prints things, capture it in a buffer so it can be added as a template var. + ob_start(); + $xajax->printJavascript('/xajax'); + $xajaxHeaders = ob_get_contents(); + ob_end_clean(); + + $page = $GLOBALS['objects']['page']; + $page->add_template_var('XAJAX_HEADERS', $xajaxHeaders); +}//end addAjax() + +?> Modified: trunk/includes/content/tags.inc =================================================================== --- trunk/includes/content/tags.inc 2008-01-31 21:13:26 UTC (rev 763) +++ trunk/includes/content/tags.inc 2008-01-31 21:36:37 UTC (rev 764) @@ -16,94 +16,10 @@ $sessionCache = new sessionCache("settings"); -if($page->ftsSections[2] == 'add') { - //okay, they're adding a tag: the URL should look - // something like: /content/tags/add/helpdesk/2/555 - // where helpdesk is the source section, and 2 is that tag_name_id to attach record_id #555 to. - - //okay... let's do some pre-checking. - $tagNameId = $page->ftsSections[3]; - $recordId = $page->ftsSections[4]; - - - //set a default message. - $messageArr = array( - 'title' => 'Failed to Add Tag', - 'message' => "Either no tag was specified, or the tag was invalid.", - 'type' => 'error' - ); - - //here's where to go. - $goBack = $_SERVER['HTTP_REFERER']; - - if(is_numeric($tagNameId) && is_numeric($recordId)) { - $tagList = $proj->tagObj->get_tag_list(); - - //okay, let's do the do. - $result = $proj->tagObj->add_tag($recordId, $tagNameId); - - if($result == 1) { - //it worked. - $messageArr = array( - 'title' => 'Tag Added Successfully', - 'message' => "Successfully tagged record with \"". $tagList[$tagNameId] ."\"", - 'type' => 'status' - ); - } - } - else { - set_message_wrapper(array( - 'title' => 'Failed to Add Tag', - 'message' => "Either no tag was specified, or the tag was invalid.", - 'type' => 'error' - )); - } - set_message_wrapper($messageArr); - conditional_header($goBack); - exit; -} -elseif($page->ftsSections[2] == 'remove') { - //here's where to go. - $goBack = $_SERVER['HTTP_REFERER']; - - //set some vars. - $tagNameId = $page->ftsSections[3]; - $recordId = $page->ftsSections[4]; - $tagList = $proj->tagObj->get_tag_list(); - - //default message to display. - $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 = $proj->tagObj->remove_tag($recordId,$tagNameId); - - //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 .")"; - } - } - - set_message_wrapper($messageArr); - conditional_header($goBack); - - exit; -} -elseif($_POST) { +addAjax(); + +if($_POST) { //got post vars. Check them, then reload. - debug_print($_POST); $goHere = $_SERVER['PHP_SELF']; if($_POST['action'] == 'update') { @@ -113,8 +29,6 @@ //check for pre-existing tags of that name. $myTagList = $proj->tagObj->get_tag_list(); $existingTagNameId = array_search($_POST['new_tag'], $myTagList); - debug_print($myTagList); - debug_print($existingTagNameId); if(is_numeric($existingTagNameId)) { $newTagNameId = $existingTagNameId; @@ -155,16 +69,19 @@ $goHere = $_POST['goBack'] ."&newTag=$newTagNameId"; } - //do the redirect to remove POST headers. - conditional_header($goHere); - exit; + if(strlen($goHere)) { + + //do the redirect to remove POST headers. + conditional_header($goHere); + exit; + } } //get the list of tags, regardless of whether we'll show 'em all or not. $myTagList = $proj->tagObj->get_tag_list(TRUE, FALSE); $showData = TRUE; -#$showTagNameId = $sessionCache->get_cache('tagNameId'); +$showTagNameId = $sessionCache->get_cache('tagNameId'); if($_GET['move']) { @@ -244,29 +161,36 @@ //retrieve the (possibly updated) setting $showTagNameId = $sessionCache->get_cache('tagNameId'); -if($showData) { +if($showData) { + #showCurrentTag($showTagNameId); + updateTagList($showTagNameId); + showCurrentTag($showTagNameId); + showRecordList($showTagNameId); +} + + +//AJAX FUNCTIONS... + +function showRecordList($showTagNameId) { + $tagObj = $GLOBALS['objects']['tag']; + $page = $GLOBALS['objects']['page']; + //get data for this tag. - $data = $proj->tagObj->get_records_for_tag($showTagNameId); + $data = $tagObj->get_records_for_tag($showTagNameId); - //set some vars. - $page->add_template_var("tagName", $myTagList[$showTagNameId]['name']); - $page->add_template_var('tagModifier', $myTagList[$showTagNameId]['modifier']); - $page->add_template_var("tagRecordCount", count($data)); - $page->add_template_var("showTagNameId", $showTagNameId); + if(!isset($page->templateRows['associatedRecords'])) { + $page->set_all_block_rows(); + } + $parseTmpl = $page->templateRows['associatedRecords']; - $page->add_template_var('modifier_option_list', create_priority_option_list($myTagList[$showTagNameId]['modifier'], 5, -5)); - - create_page_title($page, array('title' => "Tag #". $showTagNameId . ": ". $myTagList[$showTagNameId]['name'])); - - //rip all block rows. - $page->set_all_block_rows('content'); - //now list all records for this tag (assign the "no records" row, then check). $tagRow = $page->templateRows['tag_row__noRecords']; if(count($data)) { //got data. $tagRow = ""; $baseRow = $page->templateRows['tag_row']; + $rowColor1 = NULL; + $rowColor2 = NULL; foreach($data as $index=>$subData) { //add some things for alternating row colors. $subData['rowColor'] = swapValue($rowColor1, "rgb(213, 213, 213)", "rgb(194, 194, 194)"); @@ -276,8 +200,74 @@ $tagRow .= mini_parser($baseRow, $subData, '%%', '%%'); } } - $page->add_template_var('tag_row', $tagRow); + $repArr = array( + 'tag_row' => $tagRow, + 'currentTagData' => $page->templateRows['currentTagData'], + 'associatedRecords' => $page->templateRows['associatedRecords'], + 'tag_row__noRecords' => "" + ); + + $retval = mini_parser($parseTmpl, $repArr, '{', '}'); + foreach($repArr as $index=>$value) { + $page->add_template_var($index, $value); + } + + #$page->add_template_var('tag_row', $tagRow); + #$page->add_template_var('currentTagData', $page->templateRows['currentTagData']); + #$page->add_template_var('associatedRecords', $page->templateRows['associatedRecords']); + + return($retval); +}//end showRecordList() + + +function showCurrentTag($showTagNameId) { + + $page = $GLOBALS['objects']['page']; + $tagObj = $GLOBALS['objects']['tag']; + + $myTagList = $tagObj->get_tag_list(TRUE, FALSE); + + //get data for this tag. + $data = $tagObj->get_records_for_tag($showTagNameId); + + if(!isset($page->templateRows['currentTagData_header'])) { + $page->set_all_block_rows(); + } + $parseTemplate = $page->templateRows['currentTagData_header']; + + $repArr = array( + 'tagName' => $myTagList[$showTagNameId]['name'], + 'tagModifier' => $myTagList[$showTagNameId]['modifier'], + 'tagRecordCount' => count($data), + 'showTagNameId' => $showTagNameId, + 'modifier_option_list' => create_priority_option_list($myTagList[$showTagNameId]['modifier'], 5, -5) + ); + + $retval = mini_parser($parseTemplate, $repArr, '{', '}'); + + foreach($repArr as $tmplVar=>$value) { + $page->add_template_var($tmplVar, $value); + } + + $page->add_template_var('currentTagData_header', $page->templateRows['currentTagData_header']); + + return($retval); +}//end showCurrentTag() + + +function updateTagList($showTagNameId) { + $page = $GLOBALS['objects']['page']; + $tagObj = $GLOBALS['objects']['tag']; + + $myTagList = $tagObj->get_tag_list(TRUE, FALSE); + create_page_title($page, array('title' => "Tag #". $showTagNameId . ": ". $myTagList[$showTagNameId]['name'])); + + //rip all block rows. + $page->set_all_block_rows('content'); + + $recordList = showRecordList($showTagNameId); + //display the list of available tags. $tagListBaseRow = $page->templateRows['availableTagsList']; $showIconRow = $page->templateRows['availableTagsList__tagIcon']; @@ -296,11 +286,39 @@ $tmpRow = mini_parser($tagListBaseRow, $repArr, '%%', '%%'); if(strlen($data['icon_name'])) { $parsedIconDisplay = mini_parser($showIconRow, array('icon_name' => $data['icon_name']), '%%', '%%'); - $tmpRow = mini_parser($tmpRow, array('availableTagsList__tagIcon'=>$parsedIconDisplay), '{', '}'); } + else { + $parsedIconDisplay = ""; + } + $tmpRow = mini_parser($tmpRow, array('availableTagsList__tagIcon'=>$parsedIconDisplay), '{', '}'); $myRow .= $tmpRow; } $page->add_template_var("availableTagsList", $myRow); -} + $retval = mini_parser($myRow, array('tag_row'=>$recordList), '{', '}'); + + return($retval); +}//end updateTagList() + +function ajax__showTagRecords($tagNameId) { + $objResponse = new xajaxResponse(); + + //update the list of tags. + $tagList = updateTagList($tagNameId); + $objResponse->addAssign('tagList', 'innerHTML', $tagList); + + //now update the data for the current tag. + $currentTagData = showCurrentTag($tagNameId); + $objResponse->addAssign('currentTagData_header', 'innerHTML', $currentTagData); + + //update associated record list. + $objResponse->addAssign('associatedRecords', 'innerHTML', showRecordList($tagNameId)); + + //store in the session, so if they reload, the selected tag will remain. + $sessionCache = new sessionCache("settings"); + $sessionCache->set_cache('tagNameId', $tagNameId); + + return($objResponse); +}//end ajax__showTagRecords() + ?> \ No newline at end of file Modified: trunk/lib/projectClass.php =================================================================== --- trunk/lib/projectClass.php 2008-01-31 21:13:26 UTC (rev 763) +++ trunk/lib/projectClass.php 2008-01-31 21:36:37 UTC (rev 764) @@ -300,8 +300,6 @@ function get_notes() { $this->noteObj->projectId = $this->projectId; $retval = $this->noteObj->get_notes(array('record_id'=>$this->internalRecordId)); - - $userList = $this->list_users(); return($retval); }//end get_notes() //========================================================================= Modified: trunk/public_html/js/cs-project.js =================================================================== --- trunk/public_html/js/cs-project.js 2008-01-31 21:13:26 UTC (rev 763) +++ trunk/public_html/js/cs-project.js 2008-01-31 21:36:37 UTC (rev 764) @@ -334,3 +334,38 @@ checksumInputObj.readonly = true; }//end cs_confirmLostPass() + +function clearErrorMessage() { + var name = 'MAIN_error_message'; + document.getElementById(name).innerHTML=""; +}//end clearErrorMessage() + + +/** + * Overload the xajax call to be able to do things like clearing out the + * div that contains set messages... + */ +function checkAjax() { + var retval = false; + if(this.xajaxLoaded) { + retval = true; + } + return retval; +} +var clearMessageTimeoutID; +if(checkAjax()) { + //keep around the old call function + xajax.realCall = xajax.call; + //override the call function to bend to our wicked ways + xajax.call = function(sFunction, aArgs, sRequestType) + { + //clear out the message. + if(this.clearMessageTimeoutID) { + clearTimeout(this.clearMessageTimeoutID); + } + this.clearMessageTimeoutID = setTimeout("clearErrorMessage();", 10000); + + //call the old call function + return this.realCall(sFunction, aArgs, sRequestType); + } +} \ No newline at end of file Copied: trunk/public_html/xajax (from rev 763, branches/ajax_test/public_html/xajax) Copied: trunk/public_html/xajax/lib (from rev 763, branches/ajax_test/public_html/xajax/lib) Deleted: trunk/public_html/xajax/lib/activex_off.js =================================================================== --- branches/ajax_test/public_html/xajax/lib/activex_off.js 2008-01-31 21:13:26 UTC (rev 763) +++ trunk/public_html/xajax/lib/activex_off.js 2008-01-31 21:36:37 UTC (rev 764) @@ -1,119 +0,0 @@ -/***** -A drop in replacement for XMLHttpRequest object - -Usage: - Add to between the <head> tags, - <!--[if IE]><script type="text/javascript" src="activex_off.js"></script><![endif]--> - -*****/ -var useBackupXMLObject = false; - -xajax.oldGetRequestObject = xajax.getRequestObject; -xajax.getRequestObject = function() { - var req = null; - if (useBackupXMLObject == false) - { - this.temp = this.DebugMessage; - this.DebugMessage = function() {}; - req = this.oldGetRequestObject(); - this.DebugMessage = this.temp; - this.temp = null; - if (req) - return req; - useBackupXMLObject = true; - } - try { - req = new BackupXMLObject(); - } catch (e) {} - return req; -} - -function stringify(obj) -{ - if (typeof obj == 'string') - return "'"+obj+"'"; - first = true; - objstring = "{"; - for (i in obj) - { - if (first) - first = false; - else - objstring += ","; - objstring += i+":" + stringify(obj[i]); - } - objstring += "}"; - return objstring; -} - -xajax.realCall = xajax.call; -xajax.call = null; -xajax.pageLoaded = false; -xajax.call = function(func, params) -{ - if (this.pageLoaded) - { - return this.realCall.apply(this, arguments); - } - state = document.readyState; - if (state == 'complete' || state == 4) { - this.pageLoaded = true; - this.call = this.realCall; - return this.realCall.apply(this, arguments); - } else { - paramstring = stringify(params); - setTimeout("xajax.call('"+func+"',"+paramstring+");",100); - return true; - } -} - -function BackupXMLObject() { - this.uri = null; - this.async = null; - this.status = null; - this.readyState = 0; - this.responseText = ''; - this.statusText = null; - this.requestType = null; - this.responseXML = null; - this.onreadystatechange = function(){}; - this.xmlisland = null; - - this.open = function(requestType, uri, async) - { - this.requestType = requestType.toLowerCase(); - this.uri = uri; - this.async = async; - } - - this.setRequestHeader = function(headerKey, headerValue) - { - if (this.requestType == 'post') - throw new Error(); - } - - this.send = function(postData) - { - xmlislandId = 'xml'+(new Date().getTime()); - var xmlisland = document.createElement("xml"); - xmlisland.id = xmlislandId; - xmlisland.maker = this; - xmlisland.src = this.uri; - document.body.appendChild(xmlisland); - xmlisland.XMLDocument.onreadystatechange = function() { - xmlisland.maker.readyState = xmlisland.XMLDocument.readyState; - xmlisland.maker.responseXML = xmlisland.XMLDocument; - xmlisland.maker.status = 200; - if (xmlisland.XMLDocument && xmlisland.XMLDocument.documentElement) - xmlisland.maker.responseText = xmlisland.XMLDocument.documentElement.xml; - xmlisland.maker.onreadystatechange(); - if (xmlisland.XMLDocument.readyState == 4) - { - document.body.removeChild(xmlisland); - delete xmlisland; - xmlisland = null; - } - } - } - -} Copied: trunk/public_html/xajax/lib/activex_off.js (from rev 763, branches/ajax_test/public_html/xajax/lib/activex_off.js) =================================================================== --- trunk/public_html/xajax/lib/activex_off.js (rev 0) +++ trunk/public_html/xajax/lib/activex_off.js 2008-01-31 21:36:37 UTC (rev 764) @@ -0,0 +1,119 @@ +/***** +A drop in replacement for XMLHttpRequest object + +Usage: + Add to between the <head> tags, + <!--[if IE]><script type="text/javascript" src="activex_off.js"></script><![endif]--> + +*****/ +var useBackupXMLObject = false; + +xajax.oldGetRequestObject = xajax.getRequestObject; +xajax.getRequestObject = function() { + var req = null; + if (useBackupXMLObject == false) + { + this.temp = this.DebugMessage; + this.DebugMessage = function() {}; + req = this.oldGetRequestObject(); + this.DebugMessage = this.temp; + this.temp = null; + if (req) + return req; + useBackupXMLObject = true; + } + try { + req = new BackupXMLObject(); + } catch (e) {} + return req; +} + +function stringify(obj) +{ + if (typeof obj == 'string') + return "'"+obj+"'"; + first = true; + objstring = "{"; + for (i in obj) + { + if (first) + first = false; + else + objstring += ","; + objstring += i+":" + stringify(obj[i]); + } + objstring += "}"; + return objstring; +} + +xajax.realCall = xajax.call; +xajax.call = null; +xajax.pageLoaded = false; +xajax.call = function(func, params) +{ + if (this.pageLoaded) + { + return this.realCall.apply(this, arguments); + } + state = document.readyState; + if (state == 'complete' || state == 4) { + this.pageLoaded = true; + this.call = this.realCall; + return this.realCall.apply(this, arguments); + } else { + paramstring = stringify(params); + setTimeout("xajax.call('"+func+"',"+paramstring+");",100); + return true; + } +} + +function BackupXMLObject() { + this.uri = null; + this.async = null; + this.status = null; + this.readyState = 0; + this.responseText = ''; + this.statusText = null; + this.requestType = null; + this.responseXML = null; + this.onreadystatechange = function(){}; + this.xmlisland = null; + + this.open = function(requestType, uri, async) + { + this.requestType = requestType.toLowerCase(); + this.uri = uri; + this.async = async; + } + + this.setRequestHeader = function(headerKey, headerValue) + { + if (this.requestType == 'post') + throw new Error(); + } + + this.send = function(postData) + { + xmlislandId = 'xml'+(new Date().getTime()); + var xmlisland = document.createElement("xml"); + xmlisland.id = xmlislandId; + xmlisland.maker = this; + xmlisland.src = this.uri; + document.body.appendChild(xmlisland); + xmlisland.XMLDocument.onreadystatechange = function() { + xmlisland.maker.readyState = xmlisland.XMLDocument.readyState; + xmlisland.maker.responseXML = xmlisland.XMLDocument; + xmlisland.maker.status = 200; + if (xmlisland.XMLDocument && xmlisland.XMLDocument.documentElement) + xmlisland.maker.responseText = xmlisland.XMLDocument.documentElement.xml; + xmlisland.maker.onreadystatechange(); + if (xmlisland.XMLDocument.readyState == 4) + { + document.body.removeChild(xmlisland); + delete xmlisland; + xmlisland = null; + } + } + } + +} Copied: trunk/public_html/xajax/tests (from rev 763, branches/ajax_test/public_html/xajax/tests) Deleted: trunk/public_html/xajax/tests/HTTPStatusTest.php =================================================================== --- branches/ajax_test/public_html/xajax/tests/HTTPStatusTest.php 2008-01-31 21:13:26 UTC (rev 763) +++ trunk/public_html/xajax/tests/HTTPStatusTest.php 2008-01-31 21:36:37 UTC (rev 764) @@ -1,41 +0,0 @@ -<?php -require_once("../xajax.inc.php"); - -function returnStatus($number) -{ - if ($number == 500) { - header("HTTP/1.1 500 Internal Server Error"); - echo "Testing a server error..."; - } - if ($number == 404) { - header("HTTP/1.1 404 Not Found"); - echo "Testing an unknown URL..."; - } - exit; -} -$xajax = new xajax(); -//$xajax->debugOn(); -$xajax->registerFunction("returnStatus"); -$xajax->processRequests(); -?> -<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" - "http://www.w3.org/TR/2000/REC-xhtml1-20000126/DTD/xhtml1-transitional.dtd"> -<html xmlns="http://www.w3.org/1999/xhtml"> -<head> -<title>HTTP Status Test | xajax Tests</title> -<?php $xajax->printJavascript("../") ?> -</head> -<body> - -<h2><a href="index.php">xajax Tests</a></h2> -<h1>HTTP Status Test</h1> - -<form id="testForm1" onsubmit="return false;"> -<p><input type="submit" value="Return a 500 Internal Server Error" onclick="xajax_returnStatus(500); return false;" /></p> -<p><input type="submit" value="Return a 404 Not Found Error" onclick="xajax_returnStatus(404); return false;" /></p> -</form> - -<div id="submittedDiv"></div> - -</body> -</html> \ No newline at end of file Copied: trunk/public_html/xajax/tests/HTTPStatusTest.php (from rev 763, branches/ajax_test/public_html/xajax/tests/HTTPStatusTest.php) =================================================================== --- trunk/public_html/xajax/tests/HTTPStatusTest.php (rev 0) +++ trunk/public_html/xajax/tests/HTTPStatusTest.php 2008-01-31 21:36:37 UTC (rev 764) @@ -0,0 +1,41 @@ +<?php +require_once("../xajax.inc.php"); + +function returnStatus($number) +{ + if ($number == 500) { + header("HTTP/1.1 500 Internal Server Error"); + echo "Testing a server error..."; + } + if ($number == 404) { + header("HTTP/1.1 404 Not Found"); + echo "Testing an unknown URL..."; + } + exit; +} +$xajax = new xajax(); +//$xajax->debugOn(); +$xajax->registerFunction("returnStatus"); +$xajax->processRequests(); +?> +<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" + "http://www.w3.org/TR/2000/REC-xhtml1-20000126/DTD/xhtml1-transitional.dtd"> +<html xmlns="http://www.w3.org/1999/xhtml"> +<head> +<title>HTTP Status Test | xajax Tests</title> +<?php $xajax->printJavascript("../") ?> +</head> +<body> + +<h2><a href="index.php">xajax Tests</a></h2> +<h1>HTTP Status Test</h1> + +<form id="testForm1" onsubmit="return false;"> +<p><input type="submit" value="Return a 500 Internal Server Error" onclick="xajax_returnStatus(500); return false;" /></p> +<p><input type="submit" value="Return a 404 Not Found Error" onclick="xajax_returnStatus(404); return false;" /></p> +</form> + +<div id="submittedDiv"></div> + +</body> +</html> \ No newline at end of file Deleted: trunk/public_html/xajax/tests/catchAllFunctionTest.php =================================================================== --- branches/ajax_test/public_html/xajax/tests/catchAllFunctionTest.php 2008-01-31 21:13:26 UTC (rev 763) +++ trunk/public_html/xajax/tests/catchAllFunctionTest.php 2008-01-31 21:36:37 UTC (rev 764) @@ -1,50 +0,0 @@ -<?php -require_once("../xajax.inc.php"); - -function test2ndFunction($formData, $objResponse) -{ - $objResponse->addAlert("formData: " . print_r($formData, true)); - $objResponse->addAssign("submittedDiv", "innerHTML", nl2br(print_r($formData, true))); - return $objResponse->getXML(); -} - -function myCatchAllFunction($funcName, $args) -{ - $objResponse = new xajaxResponse(); - $objResponse->addAlert("This is from the catch all function"); -// return $objResponse; - return test2ndFunction($args[0], $objResponse); -} - -function testForm($formData) -{ - $objResponse = new xajaxResponse(); - $objResponse->addAlert("This is from the regular function"); - return test2ndFunction($formData, $objResponse); -} -$xajax = new xajax(); -$xajax->registerCatchAllFunction("myCatchAllFunction"); -//$xajax->registerFunction("testForm"); -$xajax->processRequests(); -?> -<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" - "http://www.w3.org/TR/2000/REC-xhtml1-20000126/DTD/xhtml1-transitional.dtd"> -<html xmlns="http://www.w3.org/1999/xhtml"> -<head> -<title>Catch-all Function Test | xajax Tests</title> -<?php $xajax->printJavascript("../") ?> -</head> -<body> - -<h2><a href="index.php">xajax Tests</a></h2> -<h1>Catch-all Function Test</h1> - -<form id="testForm1" onsubmit="return false;"> -<p><input type="text" id="textBox1" name="textBox1" value="This is some text" /></p> -<p><input type="submit" value="Submit Normal" onclick="xajax.call('testForm', [xajax.getFormValues('testForm1')]); return false;" /></p> -</form> - -<div id="submittedDiv"></div> - -</body> -</html> \ No newline at end of file Copied: trunk/public_html/xajax/tests/catchAllFunctionTest.php (from rev 763, branches/ajax_test/public_html/xajax/tests/catchAllFunctionTest.php) =================================================================== --- trunk/public_html/xajax/tests/catchAllFunctionTest.php (rev 0) +++ trunk/public_html/xajax/tests/catchAllFunctionTest.php 2008-01-31 21:36:37 UTC (rev 764) @@ -0,0 +1,50 @@ +<?php +require_once("../xajax.inc.php"); + +function test2ndFunction($formData, $objResponse) +{ + $objResponse->addAlert("formData: " . print_r($formData, true)); + $objResponse->addAssign("submittedDiv", "innerHTML", nl2br(print_r($formData, true))); + return $objResponse->getXML(); +} + +function myCatchAllFunction($funcName, $args) +{ + $objResponse = new xajaxResponse(); + $objResponse->addAlert("This is from the catch all function"); +// return $objResponse; + return test2ndFunction($args[0], $objResponse); +} + +function testForm($formData) +{ + $objResponse = new xajaxResponse(); + $objResponse->addAlert("This is from the regular function"); + return test2ndFunction($formData, $objResponse); +} +$xajax = new xajax(); +$xajax->registerCatchAllFunction("myCatchAllFunction"); +//$xajax->registerFunction("testForm"); +$xajax->processRequests(); +?> +<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" + "http://www.w3.org/TR/2000/REC-xhtml1-20000126/DTD/xhtml1-transitional.dtd"> +<html xmlns="http://www.w3.org/1999/xhtml"> +<head> +<title>Catch-all Function Test | xajax Tests</title> +<?php $xajax->printJavascript("../") ?> +</head> +<body> + +<h2><a href="index.php">xajax Tests</a></h2> +<h1>Catch-all Function Test</h1> + +<form id="testForm1" onsubmit="return false;"> +<p><input type="text" id="textBox1" name="textBox1" value="This is some text" /></p> +<p><input type="submit" value="Submit Normal" onclick="xajax.call('testForm', [xajax.getFormValues('testForm1')]); return false;" /></p> +</form> + +<div id="submittedDiv"></div> + +</body> +</html> \ No newline at end of file Deleted: trunk/public_html/xajax/tests/changeEventTest.php =================================================================== --- branches/ajax_test/public_html/xajax/tests/changeEventTest.php 2008-01-31 21:13:26 UTC (rev 763) +++ trunk/public_html/xajax/tests/changeEventTest.php 2008-01-31 21:36:37 UTC (rev 764) @@ -1,38 +0,0 @@ -<?php -require_once("../xajax.inc.php"); - -function addEvent($sId,$sCode) -{ - $objResponse = new xajaxResponse(); - $objResponse->addEvent($sId, "onclick", $sCode); - return $objResponse->getXML(); -} - -$xajax = new xajax(); -//$xajax->debugOn(); -$xajax->registerFunction("addEvent"); -$xajax->processRequests(); -?> -<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" - "http://www.w3.org/TR/2000/REC-xhtml1-20000126/DTD/xhtml1-transitional.dtd"> -<html xmlns="http://www.w3.org/1999/xhtml"> -<head> -<title>Change Event Test | xajax Tests</title> -<?php $xajax->printJavascript("../") ?> -</head> -<body> - -<h2><a href="index.php">xajax Tests</a></h2> -<h1>Change Event Test </h1> - -<div id="myDiv"" style="padding: 3px; display: table; border: 1px outset black; font-size: large; margin-bottom: 10px;">Click Me</div> - -<form id="testForm1" onsubmit="return false;"> -<div><input type="submit" value="Set onclick to something" onclick="xajax_addEvent('myDiv','alert(\'Something\');'); return false;" /></div> -<div><input type="submit" value="Set onclick to something else" onclick="xajax_addEvent('myDiv','alert(\'Something Else\');'); return false;" /></div> -</form> - -<div id="submittedDiv"></div> - -</body> -</html> \ No newline at end of file Copied: trunk/public_html/xajax/tests/changeEventTest.php (from rev 763, branches/ajax_test/public_html/xajax/tests/changeEventTest.php) =================================================================== --- trunk/public_html/xajax/tests/changeEventTest.php (rev 0) +++ trunk/public_html/xajax/tests/changeEventTest.php 2008-01-31 21:36:37 UTC (rev 764) @@ -0,0 +1,38 @@ +<?php +require_once("../xajax.inc.php"); + +function addEvent($sId,$sCode) +{ + $objResponse = new xajaxResponse(); + $objResponse->addEvent($sId, "onclick", $sCode); + return $objResponse->getXML(); +} + +$xajax = new xajax(); +//$xajax->debugOn(); +$xajax->registerFunction("addEvent"); +$xajax->processRequests(); +?> +<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" + "http://www.w3.org/TR/2000/REC-xhtml1-20000126/DTD/xhtml1-transitional.dtd"> +<html xmlns="http://www.w3.org/1999/xhtml"> +<head> +<title>Change Event Test | xajax Tests</title> +<?php $xajax->printJavascript("../") ?> +</head> +<body> + +<h2><a href="index.php">xajax Tests</a></h2> +<h1>Change Event Test </h1> + +<div id="myDiv"" style="padding: 3px; display: table; border: 1px outset black; font-size: large; margin-bottom: 10px;">Click Me</div> + +<form id="testForm1" onsubmit="return false;"> +<div><input type="submit" value="Set onclick to something" onclick="xajax_addEvent('myDiv','alert(\'Something\');'); return false;" /></div> +<div><input type="submit" value="Set onclick to something else" onclick="xajax_addEvent('myDiv','alert(\'Something Else\');'); return false;" /></div> +</form> + +<div id="submittedDiv"></div> + +</body> +</html> \ No newline at end of file Deleted: trunk/public_html/xajax/tests/charEncodingTest.php =================================================================== --- branches/ajax_test/public_html/xajax/tests/charEncodingTest.php 2008-01-31 21:13:26 UTC (rev 763) +++ trunk/public_html/xajax/tests/charEncodingTest.php 2008-01-31 21:36:37 UTC (rev 764) @@ -1,130 +0,0 @@ -<?php -require_once("../xajax.inc.php"); - -function setOptions($formData) -{ - $_SESSION['useEncoding'] = $formData['useEncoding']; - $_SESSION['htmlEntities'] = (boolean)$formData['htmlEntities']; - $_SESSION['decodeUTF8'] = (boolean)$formData['decodeUTF8']; - $objResponse = new xajaxResponse(); - $objResponse->addAlert("Your options have been saved."); - return $objResponse; -} - -function testForm($strText, $formData, $arrArray) -{ - global $useEncoding, $htmlEntities; - $objResponse = new xajaxResponse($useEncoding, $htmlEntities); - $data = "Text:\n" . $strText; - $data .= "\n\nFormData:\n" . print_r($formData, true); - $data .= "\n\nArray:\n" .print_r($arrArray, true); - $objResponse->addAlert($data); - $objResponse->addAssign("submittedDiv", "innerHTML", "<pre>".$data."</pre>"); - return $objResponse->getXML(); -} - -$useEncoding = "UTF-8"; -$htmlEntities = false; -$decodeUTF8 = false; - -session_start(); -session_name("xajaxCharEncodingTest"); - -if (@$_GET['refresh'] == "yes") { - session_destroy(); - header("location: charEncodingTest.php"); - exit(); -} - -if (isset($_SESSION['useEncoding'])) { - $useEncoding = $_SESSION['useEncoding']; -} -if (isset($_SESSION['htmlEntities'])) { - $htmlEntities = $_SESSION['htmlEntities']; -} -if (isset($_SESSION['decodeUTF8'])) { - $decodeUTF8 = $_SESSION['decodeUTF8']; -} - -$xajax = new xajax(); -$xajax->setCharEncoding($useEncoding); -if ($htmlEntities) { - $xajax->outputEntitiesOn(); -} -if ($decodeUTF8) { - $xajax->decodeUTF8InputOn(); -} -//$xajax->debugOn(); -$xajax->registerFunction("setOptions"); -$xajax->registerFunction("testForm"); -$xajax->processRequests(); -?> -<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" - "http://www.w3.org/TR/2000/REC-xhtml1-20000126/DTD/xhtml1-transitional.dtd"> -<html xmlns="http://www.w3.org/1999/xhtml"> -<head> -<title>Character Encoding Test | xajax Tests</title> -<?php $xajax->printJavascript("../") ?> -<script type="text/javascript"> -function getTestArray() -{ - var text = xajax.$('textField1').value; - var testArray = new Array(); - testArray[0] = text; - testArray[1] = text; - testArray[2] = new Array(); - testArray[2][0] = text; - testArray[2][1] = text; - testArray[3] = new Array(); - testArray[3][0] = text; - testArray[3][1] = text; - testArray[3][2] = new Array(); - testArray[3][2][0] = text; - testArray[3][2][1] = text; - - return testArray; -} - -function callXajax() -{ - var txt = xajax.$('textField1').value; - var frm = xajax.getFormValues('testForm1'); - var arr = getTestArray(); - xajax_testForm(txt,frm,arr); -} -</script> -</head> -<body> - -<h2><a href="index.php">xajax Tests</a></h2> -<h1>Character Encoding Test</h1> - -<h2>Options Form</h2> - -<p><strong>NOTE:</strong> if you change these options, make sure you click the Save Options button or the options won't be used.</p> - -<form id="optionsForm" onsubmit="return false;"> -<p>Encoding: <input type="text" value="<?php echo $useEncoding ?>" name="useEncoding" /><br /> -Output HTML Entities? <input type="radio" name="htmlEntities" value="1" <?php if ($htmlEntities) echo ' checked="checked"' ?>/> Yes - <input type="radio" name="htmlEntities" value="0" <?php if (!$htmlEntities) echo ' checked="checked"' ?>/> No<br /> -Decode UTF-8 Input? <input type="radio" name="decodeUTF8" value="1" <?php if ($decodeUTF8) echo ' checked="checked"' ?>/> Yes - <input type="radio" name="decodeUTF8" value="0" <?php if (!$decodeUTF8) echo ' checked="checked"' ?>/> No<br /> -<p><input type="submit" value="Save Options" onclick="xajax_setOptions(xajax.getFormValues('optionsForm')); return false;" /></p> -</form> - -<p><a href="charEncodingTest.php?refresh=yes">Clear and Refresh</a></p> - -<h2>Text Test Form</h2> - -<p><a href="http://www.i18nguy.com/unicode-example.html" target="_blank">Here are some Unicode examples</a> you can paste into the text box below. You can see <a href="http://www.unicode.org/iuc/iuc10/languages.html" target="_blank">more examples and a list of standard encoding schemes here</a>.</p> - -<form id="testForm1" onsubmit="return false;"> -<p><input type="text" value="Enter test text here" id="textField1" name="textField1" size="60" /></p> -<p><input type="submit" value="Submit Text" onclick="callXajax(); return false;" /></p> -</form> - -<div id="submittedDiv"></div> -<div id="debugDiv"></div> - -</body> -</html> \ No newline at end of file Copied: trunk/public_html/xajax/tests/charEncodingTest.php (from rev 763, branches/ajax_test/public_html/xajax/tests/charEncodingTest.php) =================================================================== --- trunk/public_html/xajax/tests/charEncodingTest.php (rev 0) +++ trunk/public_html/xajax/tests/charEncodingTest.php 2008-01-31 21:36:37 UTC (rev 764) @@ -0,0 +1,130 @@ +<?php +require_once("../xajax.inc.php"); + +function setOptions($formData) +{ + $_SESSION['useEncoding'] = $formData['useEncoding']; + $_SESSION['htmlEntities'] = (boolean)$formData['htmlEntities']; + $_SESSION['decodeUTF8'] = (boolean)$formData['decodeUTF8']; + $objResponse = new xajaxResponse(); + $objResponse->addAlert("Your options have been saved."); + return $objResponse; +} + +function testForm($strText, $formData, $arrArray) +{ + global $useEncoding, $htmlEntities; + $objResponse = new xajaxResponse($useEncoding, $htmlEntities); + $data = "Text:\n" . $strText; + $data .= "\n\nFormData:\n" . print_r($formData, true); + $data .= "\n\nArray:\n" .print_r($arrArray, true); + $objResponse->addAlert($data); + $objResponse->addAssign("submittedDiv", "innerHTML", "<pre>".$data."</pre>"); + return $objResponse->getXML(); +} + +$useEncoding = "UTF-8"; +$htmlEntities = false; +$decodeUTF8 = false; + +session_start(); +session_name("xajaxCharEncodingTest"); + +if (@$_GET['refresh'] == "yes") { + session_destroy(); + header("location: charEncodingTest.php"); + exit(); +} + +if (isset($_SESSION['useEncoding'])) { + $useEncoding = $_SESSION['useEncoding']; +} +if (isset($_SESSION['htmlEntities'])) { + $htmlEntities = $_SESSION['htmlEntities']; +} +if (isset($_SESSION['decodeUTF8'])) { + $decodeUTF8 = $_SESSION['decodeUTF8']; +} + +$xajax = new xajax(); +$xajax->setCharEncoding($useEncoding); +if ($htmlEntities) { + $xajax->outputEntitiesOn(); +} +if ($decodeUTF8) { + $xajax->decodeUTF8InputOn(); +} +//$xajax->debugOn(); +$xajax->registerFunction("setOptions"); +$xajax->registerFunction("testForm"); +$xajax->processRequests(); +?> +<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" + "http://www.w3.org/TR/2000/REC-xhtml1-20000126/DTD/xhtml1-transitional.dtd"> +<html xmlns="http://www.w3.org/1999/xhtml"> +<head> +<title>Character Encoding Test | xajax Tests</title> +<?php $xajax->printJavascript("../") ?> +<script type="text/javascript"> +function getTestArray() +{ + var text = xajax.$('textField1').value; + var testArray = new Array(); + testArray[0] = text; + testArray[1] = text; + testArray[2] = new Array(); + testArray[2][0] = text; + testArray[2][1] = text; + testArray[3] = new Array(); + testArray[3][0] = text; + testArray[3][1] = text; + testArray[3][2] = new Array(); + testArray[3][2][0] = text; + testArray[3][2][1] = text; + + return testArray; +} + +function callXajax() +{ + var txt = xajax.$('textField1').value; + var frm = xajax.getFormValues('testForm1'); + var arr = getTestArray(); + xajax_testForm(txt,frm,arr); +} +</script> +</head> +<body> + +<h2><a href="index.php">xajax Tests</a></h2> +<h1>Character Encoding Test</h1> + +<h2>Options Form</h2> + +<p><strong>NOTE:</strong> if you change these options, make sure you click the Save Options button or the options won't be used.</p> + +<form id="optionsForm" onsubmit="return false;"> +<p>Encoding: <input type="text" value="<?php echo $useEncoding ?>" name="useEncoding" /><br /> +Output HTML Entities? <input type="radio" name="htmlEntities" value="1" <?php if ($htmlEntities) echo ' checked="checked"' ?>/> Yes + <input type="radio" name="htmlEntities" value="0" <?php if (!$htmlEntities) echo ' checked="checked"' ?>/> No<br /> +Decode UTF-8 Input? <input type="radio" name="decodeUTF8" value="1" <?php if ($decodeUTF8) echo ' checked="checked"' ?>/> Yes + <input type="radio" name="decodeUTF8" value="0" <?php if (!$decodeUTF8) echo ' checked="checked"' ?>/> No<br /> +<p><input type="submit" value="Save Options" onclick="xajax_setOptions(xajax.getFormValues('optionsForm')); return false;" /></p> +</form> + +<p><a href="charEncodingTest.php?refresh=yes">Clear and Refresh</a></p> + +<h2>Text Test Form</h2> + +<p><a href="http://www.i18nguy.com/unicode-example.html" target="_blank">Here are some Unicode examples</a> you can paste into the text box below. You can see <a href="http://www.unicode.org/iuc/iuc10/languages.html" target="_blank">more examples and a list of standard encoding schemes here</a>.</p> + +<form id="testForm1" onsubmit="return false;"> +<p><input type="text" value="Enter test text here" id="textField1" name="textField1" size="60" /></p> +<p><input type="submit" value="Submit Text" onclick="callXajax(); return false;" /></p> +</form> + +<div id="submittedDiv"></div> +<div id="debugDiv"></div> + +</body> +</html> \ No newline at end of file Deleted: trunk/public_html/xajax/tests/confirmTest.php =================================================================== --- branches/ajax_test/public_html/xajax/tests/confirmTest.php 2008-01-31 21:13:26 UTC (rev 763) +++ trunk/public_html/xajax/tests/confirmTest.php 2008-01-31 21:36:37 UTC (rev 764) @@ -1,37 +0,0 @@ -<?php -require_once("../xajax.inc.php"); - -function confirmTest() -{ - $objResponse = new xajaxResponse(); - $objResponse->addAlert("Here is an alert."); - $objResponse->addConfirmCommands(2, "Are you sure you want to show two (2) more alerts?"); - $objResponse->addAlert("This will only happen if the user presses OK."); - $objResponse->addAlert("This also will only happen if the user presses OK."); - $objResponse->addAlert("This will always happen."); - return $objResponse->getXML(); -} - -$xajax = new xajax(); -//$xajax->debugOn(); -$xajax->registerFunction("confirmTest"); -$xajax->processRequests(); -?> -<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" - "http://www.w3.org/TR/2000/REC-xhtml1-20000126/DTD/xhtml1-transitional.dtd"> -<html xmlns="http://www.w3.org/1999/xhtml"> -<head> -<title>Confirm Commands Test | xajax Tests</title> -<?php $xajax->printJavascript("../") ?> -</head> -<body> - -<h2><a href="index.php">xajax Tests</a></h2> -<h1>Confirm Commands Test</h1> - -<form id="testForm1" onsubmit="return false;"> -<p><input type="submit" value="Perform Test" onclick="xajax_confirmTest(); return false;" /></p> -</form> - -</body> -</html> \ No newline at end of file Copied: trunk/public_html/xajax/tests/confirmTest.php (from rev 763, branches/ajax_test/public_html/xajax/tests/confirmTest.php) =================================================================== --- trunk/public_html/xajax/tests/confirmTest.php (rev 0) +++ trunk/public_html/xajax/tests/confirmTest.php 2008-01-31 21:36:37 UTC (rev 764) @@ -0,0 +1,37 @@ +<?php +require_once("../xajax.inc.php"); + +function confirmTest() +{ + $objResponse = new xajaxResponse(); + $objResponse->addAlert("Here is an alert."); + $objResponse->addConfirmCommands(2, "Are you sure you want to show two (2) more alerts?"); + $objResponse->addAlert("This will only happen if the user presses OK."); + $objResponse->addAlert("This also will only happen if the user presses OK."); + $objResponse->addAlert("This will always happen."); + return $objResponse->getXML(); +} + +$xajax = new xajax(); +//$xajax->debugOn(); +$xajax->registerFunction("confirmTest"); +$xajax->processRequests(); +?> +<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" + "http://www.w3.org/TR/2000/REC-xhtml1-20000126/DTD/xhtml1-transitional.dtd"> +<html xmlns="http://www.w3.org/1999/xhtml"> +<head> +<title>Confirm Commands Test | xajax Tests</title> +<?php $xajax->printJavascript("../") ?> +</head> +<body> + +<h2><a href="index.php">xajax Tests</a></h2> +<h1>Confirm Commands Test</h1> + +<form id="testForm1" onsubmit="return false;"> +<p><input type="submit" value="Perform Test" onclick="xajax_confirmTest(); return false;" /></p> +</form> + +</body> +</html> \ No newline at end of file Deleted: trunk/public_html/xajax/tests/createFormInputTest.php =================================================================== --- branches/ajax_test/public_html/xajax/tests/createFormInputTest.php 2008-01-31 21:13:26 UTC (rev 763) +++ trunk/public_html/xajax/tests/createFormInputTest.php 2008-01-31 21:36:37 UTC (rev 764) @@ -1,129 +0,0 @@ -<?php -require_once("../xajax.inc.php"); - -// tests the select form -function testForm($formData) -{ - $objResponse = new xajaxResponse(); - $objResponse->addAlert("formData: " . print_r($formData, true)); - $objResponse->addAssign("submittedDiv", "innerHTML", nl2br(print_r($formData, true))); - return $objResponse->getXML(); -} - -// adds an option to the select -function addInput($aInputData) -{ - $sId = $aInputData['inputId']; - $sName = $aInputData['inputName']; - $sType = $aInputData['inputType']; - $sValue = $aInputData['inputValue']; - - $objResponse = new xajaxResponse(); - $objResponse->addAlert("inputData: " . print_r($aInputData, true)); - $objResponse->addCreateInput("testForm1", $sType, $sName, $sId); - $objResponse->addAssign($sId, "value", $sValue); - return $objResponse->getXML(); -} - -// adds an option to the select -function insertInput($aInputData) -{ - $sId = $aInputData['inputId']; - $sName = $aInputData['inputName']; - $sType = $aInputData['inputType']; - $sValue = $aInputData['inputValue']; - $sBefore = $aInputData['inputBefore']; - - $objResponse = new xajaxResponse(); - $objResponse->addAlert("inputData: " . print_r($aInputData, true)); - $objResponse->addInsertInput($sBefore, $sType, $sName, $sId); - $objResponse->addAssign($sId, "value", $sValue); - return $objResponse->getXML(); -} - -// adds an option to the select -function insertInputAfter($aInputData) -{ - $sId = $aInputData['inputId']; - $sName = $aInputData['inputName']; - $sType = $aInputData['inputType']; - $sValue = $aInputData['inputValue']; - $sAfter = $aInputData['inputAfter']; - - $objResponse = new xajaxResponse(); - $objResponse->addAlert("inputData: " . print_r($aInputData, true)); - $objResponse->addInsertInputAfter($sAfter, $sType, $sName, $sId); - $objResponse->addAssign($sId, "value", $sValue); - return $objResponse->getXML(); -} - -function removeInput($aInputData) -{ - $sId = $aInputData['inputId']; - - $objResponse = new xajaxResponse(); - - $objResponse->addRemove($sId); - - return $objResponse->getXML(); -} - -$xajax = new xajax(); -//$xajax->debugOn(); -$xajax->registerFunction("testForm"); -$xajax->registerFunction("addInput"); -$xajax->registerFunction("insertInput"); -$xajax->registerFunction("insertInputAfter"); -$xajax->registerFunction("removeInput"); - -$xajax->processRequests(); -?> -<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" - "http://www.w3.org/TR/2000/REC-xhtml1-20000126/DTD/xhtml1-transitional.dtd"> -<html xmlns="http://www.w3.org/1999/xhtml"> - <head> - <title>Create Form Input Test| xajax Tests</title> - <?php $xajax->printJavascript("../", "xajax_js/xajax_uncompressed.js") ?> - </head> - <body> - <h2><a href="index.php">xajax Tests</a></h2> - <h1>Create Form Input Test</h1> - - <div> - <form id="testForm1" onsubmit="return false;"> - <div><input type="submit" value="submit" onclick="xajax_testForm(xajax.getFormValues('testForm1')); return false;" /></div> - </form> - </div> - - <div style="margin-top: 20px;"> - <form id="testForm2" onsubmit="return false;"> - <div>type:</div> - <select id="inputType" name="inputType"> - <option value="text" selected="selected">text</option> - <option value="password">password</option> - <option value="hidden">hidden</option> - <option value="radio">radio</option> - <option value="checkbox">checkbox</option> - </select> - <div>Id:</div> - <input type="text" id="inputId" name="inputId" value="input1" /> - <div>Name:</div> - <input type="text" id="inputName" name="inputName" value="input1" /> - <div>Value:</div> - <input type="text" id="inputValue" name="inputValue" value="1" /> - - <div> - <input type="submit" value="Add" onclick="xajax_addInput(xajax.getFormValues('testForm2')); return false;" /> - <input type="submit" v... [truncated message content] |