<commit_before>/**
 *	@author: <NAME>
 *	@email: <EMAIL>
 *	@copyright: Copyright (C) 2010, <NAME>
 *	@license: http://opensource.org/licenses/mit-license MIT License
 **/


/**
 *	Note to future Predive Calendar and Tool Matrix developers:
 *
 *	I've attempted to document this the best way I know how. Please forgive any
 *  non-standard things I have done. 
 *
 *	This web application is built on PHP and MySQL, with heavy use of
 *  Javascript. In particular it uses jQuery and jQuery UI. Good understanding
 *  of both jQuery frameworks is required for comprehension of this code.
 *
 *  Below are a number of CONCEPTS I have determined as key to understanding
 *	the function of the code. They are used throughout this file, denoted like
 *  *My Concept*. So a comment may say something like: 
 *
 *		"When you click the button a *Dialog Box* will appear."
 * 
 *	Also, when inside the code I came across something that should be improved
 *	or reconsidered, I added an @action.
 * 
 *  I hope this makes it more clear. Thanks for your patience.
 *		~<NAME>, 05 June 2012
 **/
 
/**
 *  @concept *Tool Request* A page within the EVA Calendar which is used by
 *		EVA instructors to request tools for NBL and other events. Tools come
 *		from the USA Tools Lab. In the past this was built into SARAH, and 
 *		prior to that it was an Excel spreadsheet. At that time it was refered
 *		to as the "Tool Matrix". At this writing, people still call it that,
 *		even though that seems like a misnomer to me.
 *  @concept *Tree Item* or *Tree Items* nodes within the tree structure of a 
 *  	*Tool Request*. 
 *	@concept *Tree Branch* a *Tree Item* which contains sub items and possibly
 *		sub-sub items, sub-sub-sub items, etc.
 *	@concept *Dialog Box* this concept refers to the jQuery.dialog() method 
 *		built into jQuery UI. (http://jqueryui.com/demos/dialog/)
 *	@concept *Chooser Item* An item created which contains the
 *		*Autocomplete Textbox* and button to open the *Item Browser*. This item
 *		allows creation of new items. Once an item is chosen it becomes a 
 *		*Tree Item* and is no longer the *Chooser Item*.
 *
 *		Also, when an existing item is edited, it becomes the *Chooser Item*. 
 *	@concept *Item Browser* When building a *Tool Request* the user has the
 *		capability to either search for tools via a textbox or a browser. The
 *		*Item Browser* is a *Dialog Box* which pops up, listing all of the 
 *		available tools.
 *  @concept *Autocomplete Textbox* When building a *Tool Request* the user has
 *		the capability to either search for tools via a textbox or a browser.
 *		The textbox is called the *Autocomplete Textbox*, which allows the user
 *		to type only a few characters to find the items they are looking for.
 * 		For example, they may type "tor" to find "Torque Wrench". 
 *  @concept *Selected Item* The item in a *Tool Request* highlighted, 
 *		indicating that it is the item the user is performing actions upon.
 *		Method names and comments in this file may not be consistant with this
 *		terminology as of this writing (05 June 2012). In some cases the
 *		selected item may refer to the item the user has chosen, either by
 *		searching for it or by browsing through the *Item Browser*. One case of
 *		this is the insertSelectedItem() method, which inserts the item the
 *		user has chosen.
 * 
 *		Also can be indicated by eos.activeItemLI, specifically when dealing
 *		with the *Item Browser*. Because the *Item Browser* usage could cause
 *		the user to click somewhere that would deselect the *Selected Item*,
 *		use of the *Item Browser* sets eos.activeItemLI, meaning the intended
 *		*Selected Item* will be remembered.
 *	@concept *Chosen Item* The item in a *Tool Request* that a user has chosen
 *		by search or browsing. See *Selected Item* above for ambiguity issues.
 *  @concept *Standard Children* a list of *Tree Items* or *Tree Branches*  
 * 		which is added along with a *Tree Item* by default.
 *	@concept *Scheduler Page* Another Javascript intensive page. Allows 
 *		schedulers to more easily move classes around (in theory). In practice
 *		no schedulers use this at this time.
 *
 **/

/** TO DO
 *  
 *	1) COMPLETED - Real time itemized list
 *	2) COMPLETED - Custom alerts
 * 	3) COMPLETED - Like-item highlight
 *	4) Fix add-item-to-tool-catalog
 *		a) Fix JSONTree saving
 *		b) Category not saving
 *		c) Move "comments" below "standard children"
 *		d) Improve layout of "training hw part numbers"
 *			1) if not too difficult, add IO images to these
 *			2) remove IO images from main area
 *			3) onmouseover checkboxes, show thumbnail???
 *	5) Link to EVA Library
 *	6) Fix tools tab in Event viewer
 *  7) Make tools page PDFable
 *	8) SCUBA wired comm
 *	9) "Other Water Event" black not red on calendar
 *	10) Test like whoa
 *	11) Fix email on "copy but make changes" but not email on "copy"
 *	12) Fix redirect to "../false" issue
 * 
 *	Code cleanup and such:
 *	1) getTextboxSelect(): very long. Clean up.
 *	2) jQuery and jQuery UI update? When is jQuery UI 1.9 coming out?
 *	3) Fix LayerX and LayerY issues in webkit
 *
 *
 **/
 

/**
 * PROPERTIES:
 *	selectedItem
 *	copiedItem
 *	lookupURL
 *	jsonTreeData
 *	initialTreeStructure
 *	initiateJsonTree
 *	activeItemLI
 *
 *	
 * METHODS:
 *	getPostObject
 *	getFieldValue
 *	getJSONTreeValue
 *	getNewJSONTreeItem
 *	initiateJsonTree
 *	buildInitialTreeStructure
 *	getJsonTreeItemByID
 *	getItemNameByID
 *	getItemAutoQtyByID
 *	getItemAutoCommentByID
 *	getItemAutoChildrenByID
 *	getItemCheckboxDataByID
 *	getCheckboxAlertByIdAndType
 *	getCheckboxPartNumsByIdAndType
 *	getItemAutoCheckedBoxesByID
 *	getItemCheckboxAlertsByID
 *	getItemCheckboxOptionArrayByID
 *	encodeJsonTreeCheckboxType
 *	displayItemSelector
 *	getTextboxSelect
 *	getItemBrowserDialogButton
 *	getCancelNewLIButton
 *	getCancelEditButton
 *	getSelectedItemLI
 *	selectItemFromBrowser
 *	updateListItem
 *	
 *	
 *	
 *		
 *	
 *	
 *	
 *	
 *	
 *	
 *	
 *	
 **/

 
"use strict";

window.eos = {
	
	/**
	 *	Field value methods
	 *
	 *
	 *
	 *
	 *
	 *
	 *
	 **/
    getPostObject : function (noSubmitVal) {

		// argument "form" should be used to specify which form is being submitted, so multiple can be on the page.

        var fieldVals = {};
        var htmlName;
        var fieldValue;
		<commit_msg>Start list of methods, to break up appropriately<commit_after>/**
 *	@author: <NAME>
 *	@email: <EMAIL>
 *	@copyright: Copyright (C) 2010, <NAME>
 *	@license: http://opensource.org/licenses/mit-license MIT License
 **/


/**
 *	Note to future Predive Calendar and Tool Matrix developers:
 *
 *	I've attempted to document this the best way I know how. Please forgive any
 *  non-standard things I have done. 
 *
 *	This web application is built on PHP and MySQL, with heavy use of
 *  Javascript. In particular it uses jQuery and jQuery UI. Good understanding
 *  of both jQuery frameworks is required for comprehension of this code.
 *
 *  Below are a number of CONCEPTS I have determined as key to understanding
 *	the function of the code. They are used throughout this file, denoted like
 *  *My Concept*. So a comment may say something like: 
 *
 *		"When you click the button a *Dialog Box* will appear."
 * 
 *	Also, when inside the code I came across something that should be improved
 *	or reconsidered, I added an @action.
 * 
 *  I hope this makes it more clear. Thanks for your patience.
 *		~<NAME>, 05 June 2012
 **/
 
/**
 *  @concept *Tool Request* A page within the EVA Calendar which is used by
 *		EVA instructors to request tools for NBL and other events. Tools come
 *		from the USA Tools Lab. In the past this was built into SARAH, and 
 *		prior to that it was an Excel spreadsheet. At that time it was refered
 *		to as the "Tool Matrix". At this writing, people still call it that,
 *		even though that seems like a misnomer to me.
 *  @concept *Tree Item* or *Tree Items* nodes within the tree structure of a 
 *  	*Tool Request*. 
 *	@concept *Tree Branch* a *Tree Item* which contains sub items and possibly
 *		sub-sub items, sub-sub-sub items, etc.
 *	@concept *Dialog Box* this concept refers to the jQuery.dialog() method 
 *		built into jQuery UI. (http://jqueryui.com/demos/dialog/)
 *	@concept *Chooser Item* An item created which contains the
 *		*Autocomplete Textbox* and button to open the *Item Browser*. This item
 *		allows creation of new items. Once an item is chosen it becomes a 
 *		*Tree Item* and is no longer the *Chooser Item*.
 *
 *		Also, when an existing item is edited, it becomes the *Chooser Item*. 
 *	@concept *Item Browser* When building a *Tool Request* the user has the
 *		capability to either search for tools via a textbox or a browser. The
 *		*Item Browser* is a *Dialog Box* which pops up, listing all of the 
 *		available tools.
 *  @concept *Autocomplete Textbox* When building a *Tool Request* the user has
 *		the capability to either search for tools via a textbox or a browser.
 *		The textbox is called the *Autocomplete Textbox*, which allows the user
 *		to type only a few characters to find the items they are looking for.
 * 		For example, they may type "tor" to find "Torque Wrench". 
 *  @concept *Selected Item* The item in a *Tool Request* highlighted, 
 *		indicating that it is the item the user is performing actions upon.
 *		Method names and comments in this file may not be consistant with this
 *		terminology as of this writing (05 June 2012). In some cases the
 *		selected item may refer to the item the user has chosen, either by
 *		searching for it or by browsing through the *Item Browser*. One case of
 *		this is the insertSelectedItem() method, which inserts the item the
 *		user has chosen.
 * 
 *		Also can be indicated by eos.activeItemLI, specifically when dealing
 *		with the *Item Browser*. Because the *Item Browser* usage could cause
 *		the user to click somewhere that would deselect the *Selected Item*,
 *		use of the *Item Browser* sets eos.activeItemLI, meaning the intended
 *		*Selected Item* will be remembered.
 *	@concept *Chosen Item* The item in a *Tool Request* that a user has chosen
 *		by search or browsing. See *Selected Item* above for ambiguity issues.
 *  @concept *Standard Children* a list of *Tree Items* or *Tree Branches*  
 * 		which is added along with a *Tree Item* by default.
 *	@concept *Scheduler Page* Another Javascript intensive page. Allows 
 *		schedulers to more easily move classes around (in theory). In practice
 *		no schedulers use this at this time.
 *
 **/

/** TO DO
 *  
 *	1) COMPLETED - Real time itemized list
 *	2) COMPLETED - Custom alerts
 * 	3) COMPLETED - Like-item highlight
 *	4) Fix add-item-to-tool-catalog
 *		a) Fix JSONTree saving
 *		b) Category not saving
 *		c) Move "comments" below "standard children"
 *		d) Improve layout of "training hw part numbers"
 *			1) if not too difficult, add IO images to these
 *			2) remove IO images from main area
 *			3) onmouseover checkboxes, show thumbnail???
 *	5) Link to EVA Library
 *	6) Fix tools tab in Event viewer
 *  7) Make tools page PDFable
 *	8) SCUBA wired comm
 *	9) "Other Water Event" black not red on calendar
 *	10) Test like whoa
 *	11) Fix email on "copy but make changes" but not email on "copy"
 *	12) Fix redirect to "../false" issue
 * 
 *	Code cleanup and such:
 *	1) getTextboxSelect(): very long. Clean up.
 *	2) jQuery and jQuery UI update? When is jQuery UI 1.9 coming out?
 *	3) Fix LayerX and LayerY issues in webkit
 *
 *
 **/
 

/**
 * PROPERTIES:
 *	selectedItem
 *	copiedItem
 *	lookupURL
 *	jsonTreeData
 *	initialTreeStructure
 *	initiateJsonTree
 *	activeItemLI
 *
 *	
 * METHODS:
 * 
 * 	data structure
 *		getPostObject
 *		getFieldValue
 *		getJSONTreeValue
 *
 *	TBD
 *		getNewJSONTreeItem
 *		initiateJsonTree
 *		buildInitialTreeStructure
 *
 *	
 *		getJsonTreeItemByID
 *		getItemNameByID
 *		getItemAutoQtyByID
 *		getItemAutoCommentByID
 *		getItemAutoChildrenByID
 *		getItemCheckboxDataByID
 *		getCheckboxAlertByIdAndType
 *		getCheckboxPartNumsByIdAndType
 *		getItemAutoCheckedBoxesByID
 *		getItemCheckboxAlertsByID
 *		getItemCheckboxOptionArrayByID
 *
 *	
 *		encodeJsonTreeCheckboxType
 *		displayItemSelector
 *		getTextboxSelect
 *		getItemBrowserDialogButton
 *		getCancelNewLIButton
 *		getCancelEditButton
 *		getSelectedItemLI
 *		selectItemFromBrowser
 *		updateListItem
 *		doCheckboxAlerts
 *		createNewItemUnderParent
 *		createChildLI
 *		modifyLI
 *		getUniqueNumber
 *		handleCheckboxes
 *		createChildItems
 *		removeItemSelectors
 *		cancelNewItem
 *		cancelItemEdit
 *		editItem
 *		handleComment
 *		itemComment
 *		deselectItem
 *		selectItem
 *		addItemFunctions
 *		getItemInfo
 *
 *	Expand / Collapse
 *		toggleExpandCollapse
 *		rebuildExpandCollapseImages
 *		expandAllItems
 *		collapseAllItems
 *		collapseTopLevelItems
 *
 *		adjustIndents
 *	
 *	Context Menu
 *		jsonTreeContextMenu
 *		addItem
 *		copyItem
 *		cutItem
 *		pasteItem
 *		contextMenuMoveItemUp
 *		contextMenuMoveItemDown
 *
 *	Move items
 *		moveSelectedItemUp
 *		moveSelectedItemDown
 *
 *	Itemized List
 *		updateItemizedList
 *		
 *		document.ready->tooltip
 *	
 *	
 **/

 
"use strict";

window.eos = {
	
	/**
	 *	Field value methods
	 *
	 *
	 *
	 *
	 *
	 *
	 *
	 **/
    getPostObject : function (noSubmitVal) {

		// argument "form" should be used to specify which form is being submitted, so multiple can be on the page.

        var fieldVals = {};
        var htmlName;
        var fieldValue;
		
{'fraction_non_alphanumeric': 0.07635340294749315, 'fraction_numerical': 0.005776494112419463, 'mean_word_length': 3.4001303356142065, 'pattern_counts': {'":': 0, '<': 11, '<?xml version=': 0, '>': 12, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '5127070', 'n_tokens_mistral': 4350, 'n_tokens_neox': 4119, 'n_words': 1754}