oodt-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From mattm...@apache.org
Subject [44/53] [partial] oodt git commit: Record change for OODT-836, OODT-837.
Date Sun, 16 Jul 2017 16:16:00 GMT
http://git-wip-us.apache.org/repos/asf/oodt/blob/098cc4fa/balance/modules/cas-browser/classes/CasBrowser.class.php
----------------------------------------------------------------------
diff --git a/balance/modules/cas-browser/classes/CasBrowser.class.php b/balance/modules/cas-browser/classes/CasBrowser.class.php
deleted file mode 100644
index 583a6c8..0000000
--- a/balance/modules/cas-browser/classes/CasBrowser.class.php
+++ /dev/null
@@ -1,455 +0,0 @@
-<?php
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements.  See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License.  You may obtain a copy of the License at
- *
- *     http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-/**
- * 
- * $Id$
- * 
- * CAS-Browser Module
- * 
- * This module provides applications a means for browsing a CAS File 
- * Manager catalog and obtaining products from a CAS File Manager repository.
- * 
- * For complete functionality, the following configuration variables
- * are expected to be present in the module's config.ini file:
- * 
- * browser_filemgr_url    - filemanager host (e.g.: http://somehost:9000)
- * browser_filemgr_path   - filemanager url on server (e.g.: /)  
- * browser_datadeliv_url  - the base url to use when downloading products
- *   
- * NOTE: This module has a dependency upon the CAS-Filemgr PHP classes
- * (https://svn.apache.org/repos/asf/oodt/trunk/filemgr/src/main/php)
- *      
- *      To build this dependency, check out the above project and then:
- *      1) cd into the checked out project (you should see a package.xml file)
- *      2) pear package
- *      3) (sudo) pear install --force CAS_Filemgr...tar.gz
- *   
- * @author ahart
- * @author resneck
- *
- */
-// Require CAS Filemgr Classes
-require_once("CAS/Filemgr/BooleanQueryCriteria.class.php");
-require_once("CAS/Filemgr/Element.class.php");
-require_once("CAS/Filemgr/Metadata.class.php");
-require_once("CAS/Filemgr/Product.class.php");
-require_once("CAS/Filemgr/ProductType.class.php");
-require_once("CAS/Filemgr/ProductPage.class.php");
-require_once("CAS/Filemgr/Query.class.php");
-require_once("CAS/Filemgr/RangeQueryCriteria.class.php");
-require_once("CAS/Filemgr/TermQueryCriteria.class.php");
-require_once("CAS/Filemgr/XmlRpcFilemgrClient.class.php");
-require_once(dirname(__FILE__) . "/Utils.class.php");
-
-
-class CasBrowser {
-	
-	const VIS_INTERPRET_HIDE     = 'hide';
-	const VIS_INTERPRET_SHOW     = 'show';
-	const VIS_AUTH_ANONYMOUS     = false;
-	const VIS_AUTH_AUTHENTICATED = true;
-	const VIS_ALL                = 'all';
-	const VIS_LIMIT              = 'limit';
-	const VIS_NONE               = 'deny';
-	const VIS_DENY               = 'deny';
-	
-	public $client;
-	
-	public function __construct() {
-		try {
-			$this->client = new CAS_Filemgr_XmlRpcFilemgrClient(
-				App::Get()->settings['browser_filemgr_url'],
-				App::Get()->settings['browser_filemgr_path']);
-		} catch (Exception $e) {
-			App::Get()->fatal("Unable to instantiate a connection to "
-				. App::Get()->settings['browser_filemgr_url']
-				. App::Get()->settings['browser_filemgr_path']);
-		}
-	}
-	
-	public function getClient() {
-		return $this->client;
-	}
-	
-	/**
-	 * Use the rules in element-ordering.ini to determine the display order
-	 * for product type metadata elements. See element-ordering.ini for more
-	 * information on how to specify element order rules.
-	 * 
-	 * @param integer $productTypeId  The id of the product type to get met for
-	 * @param array   $metadataTouse  An optional array of metadata key/vals to sort. If
-	 *                this is not provided, the product type metadata will be used.
-	 */
-	public function getSortedMetadata($productTypeId,$metadataToUse = null, $orderingAttribute) {
-		
-		if (!is_array($metadataToUse)) {
-			$pt = $this->client
-				->getProductTypeById($productTypeId)
-				->toAssocArray();
-			$metadataAsArray = $pt['typeMetadata'];
-		} else {
-			$metadataAsArray = $metadataToUse;
-		}
-		
-		$orderingPolicyFilePath = dirname(dirname(__FILE__)) . '/element-ordering.ini';
-		if (file_exists($orderingPolicyFilePath)) {
-			$orderPolicy = parse_ini_file($orderingPolicyFilePath,true);
-
-			$first    = isset($orderPolicy[$productTypeId][$orderingAttribute . '.element.ordering.first']) 
-				? $orderPolicy[$productTypeId][$orderingAttribute . '.element.ordering.first']
-				: $orderPolicy['*'][$orderingAttribute . '.element.ordering.first'];
-			$last     = isset($orderPolicy[$productTypeId][$orderingAttribute . '.element.ordering.last']) 
-				? $orderPolicy[$productTypeId][$orderingAttribute . '.element.ordering.last']
-				: $orderPolicy['*'][$orderingAttribute . '.element.ordering.last'];
-								
-			// Using the odering policy, determine the order in which the metadata will be listed
-			return $this->sortMetadata($metadataAsArray,$first,$last);	
-		} else {
-			return $metadataAsArray;
-		}
-	}
-	
-	/**
-	 * Retreives the set of metadata for the provided productTypeId that should be visible
-	 * to the current user. This function also applies the sorting policy (if it is defined)
-	 * specified in element.ordering.ini.
-	 * 
-	 * @param string $productTypeId - the unique productType identifier
-	 */
-	public function getVisibleMetadataForProductType($productTypeId) {
-		// Get the metadata for the product type
-		$pt = $this->client
-			->getProductTypeById($productTypeId)
-			->toAssocArray();
-			
-		// Determine which metadata should be visible to the current user
-		$visibleMetadata = $this->getVisibleMetadata($pt['typeMetadata'], $productTypeId);
-		
-		// Sort the visible metadata according to the ordering policy
-		$result  = $this->getSortedMetadata($productTypeId,$visibleMetadata, 'pt');
-		
-		return $result;
-	}
-	
-	
-	/**
-	 * Retrieves the set of metadata for the provided productId that should be visible to 
-	 * the current user
-	 * 
-	 * @param string  $productId - the unique product identifier
-	 * @param boolean $authState - whether or not the current user is authenticated
-	 */
-	public function getVisibleMetadataForProduct($productId) {
-		$p  = $this->client->getProductById($productId);
-		$productTypeInfo = $p->getType()->toAssocArray();
-		$productTypeId   = $productTypeInfo[App::Get()->settings['browser_pt_id_key']];
-		$productMetadata = $this->client->getMetadata($p);
-		
-		// Determine which metadata should be visible to the current user
-		$visibleMetadata = $this->getVisibleMetadata($productMetadata->toAssocArray(), $productTypeId);
-				
-		// Sort the visible metadata according to the ordering policy
-		$result  = $this->getSortedMetadata($productTypeId,$visibleMetadata, 'p');
-		
-		return $result;		
-	}
-	
-	
-	/**
-	 * Determine the visibility level for the current product type and current user.
-	 * The level returned is one of VIS_ALL,VIS_LIMIT,VIS_NONE
-	 * 
-	 * @param string $productTypeId - the unique product type identifier
-	 */
-	public function getProductTypeVisibilityLevel( $productTypeId ) {
-		// If the configuration explicitly states that this dataset is to be ignored,
-		// ignore it:
-		if (in_array($productTypeId,App::Get()->settings['browser_dataset_ignores'])) {
-			return CasBrowser::VIS_NONE;
-		}
-		
-		// Get the metadata for the product type
-		$typeInfo = $this->client
-			->getProductTypeById($productTypeId)
-			->toAssocArray();
-		
-		if ( App::Get()->getAuthenticationProvider() ) {
-			
-			// Does the product type define a metadata element matching
-			// the `browser_data_access_key` config setting?
-			$accessKeyExists = isset($typeInfo['typeMetadata'][App::Get()->settings['browser_data_access_key']]);
-			
-			// Obtain the groups for the current resource
-			$resourceGroups = ($accessKeyExists)
-				? $typeInfo['typeMetadata'][App::Get()->settings['browser_data_access_key']]
-				: array();
-			
-			return $this->getResourceVisibility($resourceGroups,
-				App::Get()->settings['browser_pt_auth_policy']);
-		} else {
-			// No authentication provider, everything is public
-			return CasBrowser::VIS_ALL;
-		}
-	}
-	
-	public function getProductVisibilityLevel( $productId ) {
-		
-		$product = $this->client->getProductById( $productId );
-		$productMetadata = $this->client->getMetadata($product);
-
-		// Get metadata for product and productType as associative arrays
-		$productTypeInfo = $product->getType()->toAssocArray();
-		$productInfo     = $productMetadata->toAssocArray();
-		
-		if ( App::Get()->getAuthenticationProvider() ) {
-			
-			// Does the product type define a metadata element matching
-			// the `browser_data_access_key` config setting?
-			$accessKeyExists = isset($productInfo[App::Get()->settings['browser_data_access_key']]);
-			 
-			// Obtain the groups for the current resource
-			$resourceGroups = ($accessKeyExists)
-				? $productInfo[App::Get()->settings['browser_data_access_key']]
-				: array();
-			
-			return $this->getResourceVisibility($resourceGroups, 
-				App::Get()->settings['browser_p_auth_policy']);
-		} else {
-			// No authentication provider, everything is public
-			return CasBrowser::VIS_ALL;
-		}
-	}
-	
-	
-	/**
-	 * Internal helper function for sorting(ordering) a metadata array according to policy. 
-	 * 
-	 * @param array $unsortedMetadata An associative array of unsorted metadta key/(multi)values
-	 * @param array $sortFirst        A scalar array of metadata keys that must be ordered first
-	 * @param array $sortLast         A scalar array of metadata keys that must be ordered last
-	 * @returns array An associative array of sorted(ordered) metadata key/(multi)values
-	 */
-	protected function sortMetadata($unsortedMetadata,$sortFirst,$sortLast) {
-		$orderedMetadata = array();
-		foreach ($sortFirst as $key) {
-			if (isset($unsortedMetadata[$key])) {
-				$orderedMetadata[$key] = $unsortedMetadata[$key];
-				unset($unsortedMetadata[$key]);
-			}
-		}
-		$lastMetadata = array();
-		foreach ($sortLast as $key) {
-			if (isset($unsortedMetadata[$key])) {
-				$lastMetadata[$key] = $unsortedMetadata[$key];
-				unset($unsortedMetadata[$key]);
-			}
-		}
-		$orderedMetadata += $unsortedMetadata;
-		$orderedMetadata += $lastMetadata;
-		
-		return $orderedMetadata;
-	}
-	
-	/**
-	 * Internal helper function for, given an array of metadata, a productTypeID, and an indication of whether or not the 
-	 * current user is authenticated, returning the subset of metadata that should be visible to
-	 * the user. 
-	 * 
-	 * @param array   $metadataAsArray
-	 * @param string  $productTypeId
-	 * @param boolean $longinState - one of VIS_AUTH_AUTHENTICATED|VIS_AUTH_ANONYMOUS
-	 */
-	protected function getVisibleMetadata($metadataAsArray, $productTypeId) {
-		
-		// Determine whether the user is authenticated
-		$authState = (($ap = App::Get()->getAuthenticationProvider()) && $ap->isLoggedIn());
-		
-		$visibilityPolicyFilePath = dirname(dirname(__FILE__)) . '/element-visibility.ini';
-		if (file_exists($visibilityPolicyFilePath)) {
-			$visibilityPolicy = parse_ini_file($visibilityPolicyFilePath,true);
-			
-			$interpretation = $visibilityPolicy['interpretation.policy'];
-			$globalVisibilityPolicy = $visibilityPolicy['*'];
-			$productTypeVisibilityPolicy = isset($visibilityPolicy[$productTypeId])
-				? $visibilityPolicy[$productTypeId]
-				: array("visibility.always" => array(),
-						"visibility.anonymous" => array(),
-						"visibility.authenticated" => array());
-
-			// The visibility of a given metadata element is dependent upon
-			//   (1) the authentication status of the user (VIS_AUTH_AUTHENTICATED|VIS_AUTH_ANONYMOUS)
-			//   (2) the interpretation of the visibility policy (VIS_INTERPRET_SHOW|VIS_INTERPRET_HIDE)
-			//   
-			//   Using these values, determine which metadata to display:
-			switch ($interpretation) {
-				// If the policy defines only those metadata which should be hidden:
-				case self::VIS_INTERPRET_HIDE:
-					$displayMet = $metadataAsArray;                                     // everything is shown unless explicitly hidden via the policy
-					foreach ($globalVisibilityPolicy['visibility.always'] as $elm)      // iterate through the global 'always hide' array...
-						unset($displayMet[$elm]);                                       // and remove all listed elements
-					foreach ($productTypeVisibilityPolicy['visibility.always'] as $elm) // now iterate through the product-type 'always hide' array...
-						unset($displayMet[$elm]);                                       // and remove all listed elements
-							
-					// Determine what to hide given the user's login state 
-					switch ($authState) {                                                             // check the login status of the user
-						case self::VIS_AUTH_ANONYMOUS:                                                 // if the user is anonymous...
-							foreach($globalVisibilityPolicy['visibility.anonymous'] as $elm)           // iterate through the global 'anonymous hide' array...
-								unset($displayMet[$elm]);                                              // and remove all listed elements
-							foreach ($productTypeVisibilityPolicy['visibility.anonymous'] as $elm)     // now iterate through the product-type 'anonymous hide' array...
-								unset($displayMet[$elm]);                                              // and remove all listed elements
-							break;                                                                     // done.
-						case self::VIS_AUTH_AUTHENTICATED:                                             // if the user is authenticated...
-							foreach($globalVisibilityPolicy['visibility.authenticated'] as $elm)       // iterate through the global 'authenticated hide' array...
-								unset($displayMet[$elm]);                                              // and remove all listed elements
-							foreach ($productTypeVisibilityPolicy['visibility.authenticated'] as $elm) // now iterate through the product-type 'authenticated hide' array...
-								unset($displayMet[$elm]);                                              // and remove all listed elements
-							break;                                                                     // done.
-					}
-
-					break;
-				
-				// If the policy defines only those metadata which should be shown:
-				case self::VIS_INTERPRET_SHOW:
-					$displayMet = $globalVisibilityPolicy['visibility.always']                         // merge the global 'always show' array
-						+ $productTypeVisibilityPolicy['visibility.always'];                           // with the product-type specific 'always show' array
-					switch ($authState) {                                                              // check the login status of the user
-						case self::VIS_AUTH_ANONYMOUS:                                                 // if the user is anonymous...
-							$displayMet += $globalVisibilityPolicy['visibility.anonymous'];            // merge the global 'anonymous show' array
-							$displayMet += $productTypeVisibilityPolicy['visibility.anonymous'];       // and the product-type specific 'anonymous show' array
-							break;                                                                     // done.
-						case self::VIS_AUTH_AUTHENTICATED:                                             // if the user is authenticated...
-							$displayMet += $globalVisibilityPolicy['visibility.authenticated'];        // merge the global 'authenticated show' array 
-							$displayMet += $productTypeVisibilityPolicy['visibility.authenticated'];   // and the product-type specific 'authenticated show' array
-							break;                                                                     // done.
-					}
-			}
-			
-			return $displayMet;	
-				
-		} else {
-			return $metadataAsArray;
-		}
-	}
-		
-	/**
-	 * Internal helper function to determine the visibility level of a given resource given
-	 * its array of security groups. The value returned is one of VIS_ALL,VIS_LIMIT,VIS_NONE.
-	 * 
-	 * @param array $resourceGroups - an array of security groups for the resource
-	 * @param string $policy        - one of VIS_LIMIT or VIS_DENY
-	 */	
-	protected function getResourceVisibility( $resourceGroups, $policy = CasBrowser::VIS_DENY ) {
-		
-		// Is the resource considered "public"?
- 		if (in_array(App::Get()->settings['browser_data_public_access'],$resourceGroups)) { 
-			return CasBrowser::VIS_ALL;
-		}
-		
-		// Get user authentication info
-		$authentication = App::Get()->getAuthenticationProvider();
-		$username = ($authentication)
-		    ? $authentication->getCurrentUsername()
-		    : false;	// no authentication info provided in config file
-		
-		// Does the metadata visibility depend on an access element matching
- 		// the `browser_data_access_key` in the config setting?
- 		$accessKeyExists = isset(App::Get()->settings['browser_data_access_key']);
-
- 		// If key is set then we look into what groups have access to metadata
- 		if ( $accessKeyExists && !empty($resourceGroups) ) {
-			
-			// Has authentication provider information been specified?
-			if ( $authentication ) {
-				
-			 	// Is the user currently logged in?
-			 	if ( $username ) {
-	 				
-			 		if ( $authorization = App::Get()->getAuthorizationProvider() ) {
-				 		// Obtain the groups for the current user
-				 		$userGroups = $authorization->retrieveGroupsForUser($username);
-				 		
-				 		// Perform a comparison via array intersection to determine overlap
-				 		$x = array_intersect($userGroups,$resourceGroups);
-				 		
-				 		if (empty($x)) { // No intersection found between user and resource groups
-				
-				 			// Examine the policy to determine how to handle the failure
-				 			switch ($policy) {
-				 				case CasBrowser::VIS_LIMIT:
-				 					// Allow the user to proceed, the metadata visibility policy
-				 					// will be used to determine what is visible to non-authorized
-				 					// users.
-				 					return CasBrowser::VIS_LIMIT;
-				 				default:
-				 					// Kick the user out at this point, deny all access. 
-					 				return CasBrowser::VIS_NONE;
-				 			}
-				 		} else {
-				 			// We have an authorized user
-				 			$authorizedUser = true;
-				 		}
-			 		} else {
-			 			
-						// If no authorization provider information exists in the application
-					 	// configuration file, it is assumed that every user is authorized once
-					 	// logged in.
-					 	return CasBrowser::VIS_ALL;				 			
-			 		}
-			 	} else {
-			 		
-			 		// If no logged in user, and policy says DENY, kick the user
-			 		if ($policy == CasBrowser::VIS_DENY) {
-			 			return CasBrowser::VIS_NONE;
- 			 		} else {
-			 			return CasBrowser::VIS_LIMIT;
- 			 		}
-			 	}
-		 	} else {
-			 	// If no authentication provider information exists in the application
-			 	// configuration file, it is assumed that authentication and authorization
-			 	// are not needed for this application, and thus every user is authorized
-			 	// by default.
-			 	return CasBrowser::VIS_ALL;	
-			}				
- 		} else {
- 			
- 			// All data is visible to user if logged in
- 			// Has authentication provider information been specified?
-			if ( $authentication ) {
-				
-			 	// Is the user currently logged in?
-			 	if ( $username ) {
-			 		return CasBrowser::VIS_ALL; // We have an authorized user
-			 	} else {
-			 		// If no logged in user, and policy says DENY, kick the user
-			 		if ($policy == CasBrowser::VIS_DENY) {
-			 			return CasBrowser::VIS_NONE;
-			 		} else {
-			 			return CasBrowser::VIS_LIMIT;
-			 		}
-			 	}
-		 	} else {
-			 	// If no authentication provider information exists in the application
-			 	// configuration file, it is assumed that authentication and authorization
-			 	// are not needed for this application, and thus every user is authorized
-			 	// by default.
-			 	return CasBrowser::VIS_ALL;	
-			}
- 		}
-	}
-}

http://git-wip-us.apache.org/repos/asf/oodt/blob/098cc4fa/balance/modules/cas-browser/classes/Utils.class.php
----------------------------------------------------------------------
diff --git a/balance/modules/cas-browser/classes/Utils.class.php b/balance/modules/cas-browser/classes/Utils.class.php
deleted file mode 100644
index e8d608a..0000000
--- a/balance/modules/cas-browser/classes/Utils.class.php
+++ /dev/null
@@ -1,388 +0,0 @@
-<?php
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements.  See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License.  You may obtain a copy of the License at
- *
- *     http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-require_once("CasBrowser.class.php");
-
-class Utils{
-	
-	public static $acceptedReturnTypes = array('html', 'json');
-
-	/**
-	 * @param types
-	 *		An array of PoductTypes.
-	 *
-	 * @return 
-	 *		An array of unique names of Metadata and Elements associated with the given 
-	 *		ProductTypes.
-	 */
-	public static function getMetadataElements($types){
-		$cb = new CasBrowser();
-		$client = $cb->getClient();
-		$metadataNames = array();
-		foreach($types as $type){
-			foreach(array_keys($type->getTypeMetadata()->toAssocArray()) as $metadata){
-				if(!in_array($metadata, $metadataNames)){
-					array_push($metadataNames, $metadata);
-				}
-			}
-			foreach($client->getElementsByProductType($type) as $element){
-				$elementName = $element->getElementName();
-				if(!in_array($elementName, $metadataNames)){
-					array_push($metadataNames, $elementName);
-				}
-			}
-		}
-		return $metadataNames;
-	}
-	
-	/**
-	 * @param productType
-	 *		The productType of the ProductPage desired.
-	 *
-	 * @param pageNum
-	 *		The number of the page desired in the set of ProductPages of that ProductType.
-	 *
-	 * @return
-	 *		The requested ProductPage object.
-	 */
-	public static function getPage($productType, $pageNum){
-		$cb = new CasBrowser();
-		$client = $cb->getClient();
-		
-		// Iterate until the proper page is reached
-		for($page = $client->getFirstPage($productType);
-			$page->getPageNum() < $pageNum && $page->getPageNum() < $page->getTotalPages();
-			$page = $client->getNextPage($productType, $page)){}
-			
-		return $page;
-	}
-	
-	public static function getRequestedReturnType($requestedType){
-		$lowerRequestedType = strtolower($requestedType);
-		if(!in_array($lowerRequestedType, self::$acceptedReturnTypes)){
-			throw new CasBrowserException('Error: The requested return type of '. $requestedType . 'is not accepted.');
-		}
-		return $lowerRequestedType;
-	}
-	
-	public static function getProductListMetadata($products){
-		$payload = array();
-		foreach($products as $p){
-			$cb = new CasBrowser();
-			$client = $cb->getClient();
-			$met = $client->getMetadata($p);
-			$payload[$p->getId()] = $met;
-		}
-		return $payload;
-	}
-	
-	// What kind of access should the currently authenticated user have, given the 
-	// provided groups (aka roles, permissions) associated with the resource?
-	//
-	// Possible values are: CasBrowser::{VIS_ALL, VIS_LIMIT, VIS_NONE}. It is up to the 
-	// caller to determine what to do based on the return value
-	//
-	public static function ResourceVisibility( $resourceGroups ) {
-		
-		// Is the resource considered "public"?
- 		if (in_array(App::Get()->settings['browser_data_public_access'],$resourceGroups)) { 
-			return CasBrowser::VIS_ALL;
-		}
-		
-		// Get user authentication info
-		$authentication = App::Get()->getAuthenticationProvider();
-		$username = ($authentication)
-		    ? $authentication->getCurrentUsername()
-		    : false;	// no authentication info provided in config file
-		
-		// Does the metadata visibility depend on an access element matching
- 		// the `browser_data_access_key` in the config setting?
- 		$accessKeyExists = isset(App::Get()->settings['browser_data_access_key']);
-
- 		// If key is set then we look into what groups have access to metadata
- 		if ( $accessKeyExists && !empty($resourceGroups) ) {
-			
-			// Has authentication provider information been specified?
-			if ( $authentication ) {
-				
-			 	// Is the user currently logged in?
-			 	if ( $username ) {
-	 		
-			 		// Obtain the groups for the current user
-			 		$userGroups = App::Get()->getAuthorizationProvider()->retrieveGroupsForUser($username);
-			 			 		
-			 		// Perform a comparison via array intersection to determine overlap
-			 		$x = array_intersect($userGroups,$resourceGroups);
-			 		
-			 		if (empty($x)) { // No intersection found between user and resource groups
-			
-			 			// Examine `browser_pt_auth_policy` to determine how to handle the failure
-			 			switch (strtoupper(App::Get()->settings['browser_pt_auth_policy'])) {
-			 				case "LIMIT":
-			 					// Allow the user to proceed, the metadata visibility policy
-			 					// will be used to determine what is visible to non-authorized
-			 					// users.
-			 					return CasBrowser::VIS_LIMIT;				
-			 				case "DENY":
-			 				default:
-			 					// Kick the user out at this point, deny all access. 
-				 				return CasBrowser::VIS_NONE;
-			 			}
-			 		} else {
-			 			// We have an authorized user
-			 			$authorizedUser = true;
-			 		}
-			 	} else {
-			 		// If no logged in user, and policy says DENY, kick the user
-			 		if (strtoupper(App::Get()->settings[$metType]) == "DENY") {
-			 			return CasBrowser::VIS_NONE;
- 			 		} else {
-			 			return CasBrowser::VIS_LIMIT;
- 			 		}
-			 	}
-		 	} else {
-			 	// If no authentication provider information exists in the application
-			 	// configuration file, it is assumed that authentication and authorization
-			 	// are not needed for this application, and thus every user is authorized
-			 	// by default.
-			 	return CasBrowser::VIS_ALL;	
-			}				
- 		} else {
- 			
- 			// All data is visible to user if logged in
- 			// Has authentication provider information been specified?
-			if ( $authentication ) {
-				
-			 	// Is the user currently logged in?
-			 	if ( $username ) {
-			 		return CasBrowser::VIS_ALL; // We have an authorized user
-			 	} else {
-			 		// If no logged in user, and policy says DENY, kick the user
-			 		if (strtoupper(App::Get()->settings[$metType]) == "DENY") {
-			 			return CasBrowser::VIS_NONE;
-			 		}
-			 		return CasBrowser::VIS_LIMIT;
-			 	}
-		 	} else {
-			 	// If no authentication provider information exists in the application
-			 	// configuration file, it is assumed that authentication and authorization
-			 	// are not needed for this application, and thus every user is authorized
-			 	// by default.
-			 	return CasBrowser::VIS_ALL;	
-			}
- 		}
-	}
-	
-	// Create a criteria subtree that will search for the value at the given criteriaIndex across all 
-	// metadata elements associated with the given productTypes.
-	public static function createBasicSearchSubtree($criteriaIndex, $queryTypes){
-		$criterion = new CAS_Filemgr_BooleanQueryCriteria();
-		$criterion->setOperator(CAS_Filemgr_BooleanQueryCriteria::$OR_OP);
-		$metadataNames = getMetadataElements($queryTypes);
-		foreach($metadataNames as $name){
-			$term = new CAS_Filemgr_TermQueryCriteria();
-			$term->setElementName($name);
-			$term->setValue($_POST['Criteria'][$criteriaIndex]['Value']);
-			$criterion->addTerm($term);
-		}
-		return $criterion;
-	}
-	
-	public static function createTermCriteria($criteriaIndex, $queryTypes){
-		if(!isset($_POST['Criteria'][$criteriaIndex]['ElementName'])){
-			throw new CasBrowserException("Query Term criterion " . $criteriaIndex . " does not contain 'ElementName' specification");
-		}
-		if(!isset($_POST['Criteria'][$criteriaIndex]['Value'])){
-			throw new CasBrowserException("Query Term criterion " . $criteriaIndex . " does not contain 'Value' specification");
-		}
-		if($_POST['Criteria'][$criteriaIndex]['ElementName'] == '*'){
-			$criterion = self::createBasicSearchSubtree($criteriaIndex, $queryTypes);
-		}else{
-			$criterion = new CAS_Filemgr_TermQueryCriteria();
-			$criterion->setElementName($_POST['Criteria'][$criteriaIndex]['ElementName']);
-			$criterion->setValue($_POST['Criteria'][$criteriaIndex]['Value']);
-		}
-		return $criterion;
-	}
-	
-	public static function createRangeCriteria($criteriaIndex){
-		if(!isset($_POST['Criteria'][$criteriaIndex]['ElementName'])){
-			throw new CasBrowserException("Query Term criterion " . $criteriaIndex . " does not contain 'ElementName' specification");
-		}
-		if(!isset($_POST['Criteria'][$criteriaIndex]['Min'])){
-			throw new CasBrowserException("Query Range criterion " . $criteriaIndex . " does not contain 'Min' specification");
-		}
-		if(!isset($_POST['Criteria'][$criteriaIndex]['Max'])){
-			throw new CasBrowserException("Query Range criterion " . $criteriaIndex . " does not contain 'Max' specification");
-		}
-		$criterion = new CAS_Filemgr_RangeQueryCriteria();
-		$criterion->setElementName($_POST['Criteria'][$criteriaIndex]['ElementName']);
-		$criterion->setStartValue($_POST['Criteria'][$criteriaIndex]['Min']);
-		$criterion->setEndValue($_POST['Criteria'][$criteriaIndex]['Max']);
-		if(isset($_POST['Criteria'][$criteriaIndex]['Inclusive'])){
-			$criterion->setInclusive($_POST['Criteria'][$criteriaIndex]['Inclusive']);
-		}
-		return $criterion;
-	}
-	
-	public static function createBooleanCriteria($criteriaIndex, $queryTypes, $createdIndices){
-		if(!isset($_POST['Criteria'][$criteriaIndex]['Operator'])){
-			throw new CasBrowserException("Query Boolean criterion " . $criteriaIndex . " does not contain 'Operator' specification");
-		}
-		if(!isset($_POST['Criteria'][$criteriaIndex]['CriteriaTerms'])){
-			throw new CasBrowserException("Query Boolean criterion " . $criteriaIndex . " does not contain 'CriteriaTerms' specification");
-		}
-		if(!count($_POST['Criteria'][$criteriaIndex]['CriteriaTerms'])){
-			throw new CasBrowserException("Query Boolean criterion " . $criteriaIndex . " does not contain any terms");
-		}
-		$criterion = new CAS_Filemgr_BooleanQueryCriteria();
-		$operator = trim(strtoupper($_POST['Criteria'][$criteriaIndex]['Operator']));
-		if($operator == 'AND'){
-			$criterion->setOperator(CAS_Filemgr_BooleanQueryCriteria::$AND_OP);
-		}elseif($operator == 'OR'){
-			$criterion->setOperator(CAS_Filemgr_BooleanQueryCriteria::$OR_OP);
-		}elseif($operator == 'NOT'){
-			if(count($_POST['Criteria'][$criteriaIndex]['CriteriaTerms']) != 1){
-				throw new CasBrowserException("Query Boolean criterion " . $criteriaIndex . " cannot negate more than one term");
-			}
-			$criterion->setOperator(CAS_Filemgr_BooleanQueryCriteria::$NOT_OP);
-		}else{
-			throw new CasBrowserException("Error: Query Boolean criterion " . $criteriaIndex . " tries to use undefined operator '" . $operator . "'");
-		}
-		foreach(array_map("intval", $_POST['Criteria'][$criteriaIndex]['CriteriaTerms']) as $childIndex){
-			if(in_array($childIndex, $createdIndices)){		// Check for loops in criteria tree
-				throw new CasBrowserException("Criterion " . $criteriaIndex . " lists " . $childIndex . "as a child, making a loop.");
-			}
-			array_push($createdIndices, $childIndex);
-			$child = self::createCriteriaTree($childIndex, $queryTypes);
-			$criterion->addTerm($child);
-		}
-		return $criterion;
-	}
-	
-	public static function createCriteriaTree($criteriaIndex, $queryTypes, $createdIndices=null){
-		if(!isset($createdIndices)){
-			$createdIndices = array();
-		}
-		if(!isset($_POST['Criteria'][$criteriaIndex])){
-			throw new CasBrowserException("Query Boolean criterion " . $criteriaIndex . " does not exist.");
-		}
-		$type = strtolower($_POST['Criteria'][$criteriaIndex]['CriteriaType']);
-		if($type == 'term'){
-			$criterion = self::createTermCriteria($criteriaIndex, $queryTypes);
-		}elseif($type == 'range'){
-			$criterion = self::createRangeCriteria($criteriaIndex);
-		}elseif($type == 'boolean'){
-			$criterion = self::createBooleanCriteria($criteriaIndex, $queryTypes, $createdIndices);
-		}else{
-			throw new CasBrowserException("Query criterion " . $criteriaIndex . " contains an unknown type " . $type . ".  Please use one of 'term', 'range' or 'boolean'");
-		}
-		return $criterion;
-	}
-	
-	public static function getMetadataNamesForTypeProducts($type){
-		$cb = new CasBrowser();
-		$client = $cb->getClient();
-		$elementNames = array();
-		foreach($client->getElementsByProductType($type) as $e){
-			array_push($elementNames, $e->getElementName());
-		}
-		foreach(array_keys($type->getTypeMetadata()->toAssocArray()) as $typeElementName){
-			if(!in_array($typeElementName, $elementNames)){
-				array_push($elementNames, $typeElementName);
-			}
-		}
-		return $elementNames;
-	}
-	
-	public static function getFacets(){
-		$cb = new CasBrowser();
-		$client = $cb->getClient();
-		$types = $client->getProductTypes();
-		$facets = self::getMetadataNamesForTypeProducts(array_pop($types));
-		if(count($types) == 0){
-			return $facets;	// In case there is only one product type
-		}
-		foreach($types as $type){
-			$elementNames = self::getMetadataNamesForTypeProducts($type);
-			$facets = array_intersect($facets, $elementNames);
-		}
-		return $facets;
-	}
-	
-	public static function paginate($allProducts, $pageNum, $pageSize){
-		if(count($allProducts) == 0){
-			return array();
-		}
-		if($pageSize <= 0){
-			throw new CasBrowserException("The given PageSize (" . $pageSize . ") was zero or less.");
-		}
-		$startIndex = ($pageNum - 1) * $pageSize;
-		if($startIndex >= count($allProducts)){
-			throw new CasBrowserException("The starting index of the requested page (" .
-					$startIndex . ") is greater than the last index of all products (" .
-					count($allProducts) . ").");
-		}
-		$endIndex = $startIndex + $pageSize - 1;
-		$endIndex = min($endIndex, count($allProducts) - 1);
-		$requestedProducts = array();
-		for($i = $startIndex; $i <= $endIndex; $i++){
-			array_push($requestedProducts, $allProducts[$i]);
-		}
-		return $requestedProducts;
-	}
-	
-	public static function formatResults($products){
-		$cb = new CasBrowser();
-		$client = $cb->getClient();
-		$results = array();
-		foreach($products as $product){
-			try{
-				$p = array('id'=>$product['product']->getId(),
-						'name'=>urlDecode($product['product']->getName()),
-						'metadata'=>$client->getMetadata($product['product'])->toAssocArray());
-				if(isset($product['typeName'])){
-					$p['type'] = $product['typeName'];
-				}
-				array_push($results, $p);
-			}catch(Exception $e){
-				throw new CasBrowserException("An error occured while formatting product [" .
-						$product['product']->getId() . "] metadata: " . $e->getMessage());
-			}
-		}
-		return $results;
-	}
-	
-	public static function reportError($message, $outputFormat){
-		if($outputFormat == 'html'){
-			echo '<div class="error">' . $message . '</div>';
-		}elseif($outputFormat == 'json'){
-			$payload = array();
-			$payload['Error'] = 1;
-			$payload['ErrorMsg'] = $message;
-			$payload = json_encode($payload);
-			echo $payload;
-		}
-		exit();
-	}
-	
-}
-
-class CasBrowserException extends Exception{}
-
-?>

http://git-wip-us.apache.org/repos/asf/oodt/blob/098cc4fa/balance/modules/cas-browser/config.ini
----------------------------------------------------------------------
diff --git a/balance/modules/cas-browser/config.ini b/balance/modules/cas-browser/config.ini
deleted file mode 100644
index f397af8..0000000
--- a/balance/modules/cas-browser/config.ini
+++ /dev/null
@@ -1,121 +0,0 @@
-; Licensed to the Apache Software Foundation (ASF) under one or more
-; contributor license agreements.  See the NOTICE file distributed with
-; this work for additional information regarding copyright ownership.
-; The ASF licenses this file to You under the Apache License, Version 2.0
-; (the "License"); you may not use this file except in compliance with
-; the License.  You may obtain a copy of the License at
-;
-;     http://www.apache.org/licenses/LICENSE-2.0
-;
-; Unless required by applicable law or agreed to in writing, software
-; distributed under the License is distributed on an "AS IS" BASIS,
-; WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-; See the License for the specific language governing permissions and
-; limitations under the License.
-
-
-; CAS-BROWSER module configuration file
-; ------------------------------------------------------------------------
-
-
-; FILE MANAGER CONNECTIVITY
-; -----------------------------------------------------------------------------
-; Specify connection information for an instance of the OODT file manager.
-;
-browser_filemgr_url   = http://localhost:9000
-browser_filemgr_path  = /
-browser_datadeliv_url = http://host:port/path
-
-
-
-; AUTHENTICATION AND AUTHORIZATION
-; -----------------------------------------------------------------------------
-; Customize the behavior of the module for specific auth & auth requirements.
-
-; This key specifies the behavior to take when users attempt to access resources
-; for which they do not have the necessary permissions. There are two options:
-;
-; deny  => force redirect with a 403 Not Authorized error
-;           This option prevents a user from viewing any information about
-;           products or productTypes they are not authorized to see.
-;
-; limit => apply the metadata filtering policy specified in element-visibility.ini
-;           to control access to information on a more granular, element by
-;           element level. This allows users to see publicly available information
-;           about an otherwise protected product or productType.
-;
-; Policy for product types:
-browser_pt_auth_policy = limit
-; Policy for products:
-browser_p_auth_policy  = limit
-
-; This key specifies the productType metadata element that contains
-; the list of security groups (aka roles, permissions,etc) that should
-; be granted access. This key can exist in productType metadata, or
-; product metadata, or both. If it exists in productType metadata only,
-; products will inherit the information.
-;
-browser_data_access_key 	= AccessGrantedTo
-browser_data_public_access 	= public
-
-; LOOK AND FEEL SETTINGS
-; -----------------------------------------------------------------------------
-; Customize aspects of the user interface to suit project needs
-
-browser_index_title_text  = Cas Browser
-
-; These keys identify the metadata keys used to obtain basic product type 
-; information. These rarely need to be manually changed.
-;    browser_pt_name_key: the product type name
-;    browser_pt_desc_key: the key containing a description of the product type 
-;    browser_pt_id_key:   the key containing the unique product type id (urn)
-
-browser_pt_name_key       = name
-browser_pt_desc_key       = description
-browser_pt_id_key         = id
-
-; These keys determine which metadata elements will
-; appear as column headers on the dataset viewer
-
-browser_pt_search_met[]   = name
-browser_pt_search_met[]   = description
-browser_pt_search_met[]   = id
-
-; This key determines which of the `browser_pt_search_met` keys will be used
-; as the clickable link taking the user to the overview page for the given
-; product type
-
-browser_pt_search_linkkey = name
-
-; These keys specify (an array of) product types to exclude from the 
-; product type list displayed on the index page.
-browser_dataset_ignores[] = urn:oodt:GenericFile
-
-
-
-; The browser_products_met[] array key dictates which metadata elements will
-; be displayed in the products view.  One can designate any number of
-; elements to display (including zero), but all of them must be defined for
-; all product types.
-
-browser_products_met[] = CAS.ProductId
-browser_products_met[] = MimeType
-browser_products_met[] = ProductStructure
-browser_products_met[] = CAS.ProductReceivedTime
-
-; The browser_private_products_visibility key dictates whether private products 
-; will be displayed in the products view.
-browser_private_products_visibility = true
-
-; If the browser_show_download_widget key is set to 0, the download widget in
-; the products view won't be displayed.  If the key is set to any other value
-; the widget will be displayed.
-
-browser_show_download_widget=1
-
-; If default_show_all is set to 1, then the typesearch view will, by deafult,
-; display all products of all types when the view is opened.  Otherwise, no
-; products will be shown in the typesearch vie until filters are specified.
-
-default_show_all = 1
-

http://git-wip-us.apache.org/repos/asf/oodt/blob/098cc4fa/balance/modules/cas-browser/element-ordering.ini
----------------------------------------------------------------------
diff --git a/balance/modules/cas-browser/element-ordering.ini b/balance/modules/cas-browser/element-ordering.ini
deleted file mode 100644
index 72c51fd..0000000
--- a/balance/modules/cas-browser/element-ordering.ini
+++ /dev/null
@@ -1,64 +0,0 @@
-;
-; Licensed to the Apache Software Foundation (ASF) under one or more
-; contributor license agreements.  See the NOTICE file distributed with
-; this work for additional information regarding copyright ownership.
-; The ASF licenses this file to You under the Apache License, Version 2.0
-; (the "License"); you may not use this file except in compliance with
-; the License.  You may obtain a copy of the License at
-;
-;     http://www.apache.org/licenses/LICENSE-2.0
-;
-; Unless required by applicable law or agreed to in writing, software
-; distributed under the License is distributed on an "AS IS" BASIS,
-; WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-; See the License for the specific language governing permissions and
-; limitations under the License.
-
-;
-; ELEMENT-ORDERING.INI
-;
-; This file defines the order of metadata keys on a per-product-type basis
-; Elements not explicitly mentioned in this file will be displayed following
-; all of the explicitly ordered elements.
-;
-; The global section [*] can be used to define a default ordering to apply.
-; Note that, if a product type declaration is found, its ordering overrides
-; the default ordering in [*].
-;
-; There are two ordered arrays for each product type:
-;    pt.element.ordering:   specifies product-type metadata order
-;    p.element.ordering:    specifies product metadata order
-;
-
-[*]
-;product type metadata element ordering (global)
-; the '.first' array indicates those elements which should be shown BEFORE
-; all other metadata elements:
-pt.element.ordering.first[] = 
-
-
-; the '.last' array indicates those elements that should be shown AFTER
-; all other metadata elements. The last element in this array will be
-; shown last.
-pt.element.ordering.last[] = 
-
-
-; product metadata element ordering (global)
-; the '.first' array indicates those elements that should be shown BEFORE
-; all other metadata elements:
-p.element.ordering.first[] =
-; the '.last' array indicates those elements that should be shown AFTER
-; all other metadata elements. The last element in this array will be
-; shown last.
-p.element.ordering.last[] =
-
-; It is possible to override the global settings on a per-productType basis
-; simply by defining a productType header and re-defining the pt.element.ordering.*
-; arrays for that productType. ProductType-specific settings do not inherit from 
-;the global settings.
-;
-;[urn:oodt:GenericFile]
-;pt.element.ordering.first[] =
-;pt.element.ordering.last[] = 
-;p.element.ordering.first[] =
-;p.element.ordering.last[] =

http://git-wip-us.apache.org/repos/asf/oodt/blob/098cc4fa/balance/modules/cas-browser/element-visibility.ini
----------------------------------------------------------------------
diff --git a/balance/modules/cas-browser/element-visibility.ini b/balance/modules/cas-browser/element-visibility.ini
deleted file mode 100644
index 103f9db..0000000
--- a/balance/modules/cas-browser/element-visibility.ini
+++ /dev/null
@@ -1,49 +0,0 @@
-;
-; ELEMENT-VISIBILITY.INI
-;
-; This file controls the visibility of metadata elements for product types 
-; known to the underlying file manager instance.
-; 
-; Specify the interpretation policy for this file. This can take one of two values:
-;    show: Definitions in this file indicate metadata keys which should be SHOWN
-;    hide: Definitions in this file indicate metadata keys which should be HIDDEN
-;
-;  If the policy is 'show' and an element does NOT appear in this file, it will be 
-;  hidden. Conversely, if the policy is 'hide' and an element does NOT appear in 
-;  this list, it will be shown.
-
-interpretation.policy = hide
-
-; Next, define element visibility on a per-product-type basis.
-; To specify definitions for a particular product type, first declare the product type 
-; by enclosing its URN in square brackets on its own line, e.g.:
-; [urn:oodt:GenericFile]
-; (without the leading ';', obviously) and then add element visibility definitions below. 
-;
-; Element visibility definitions take three forms:
-;     visibility.always:        will be {shown/hidden} regardless of authentication
-;     visibility.anonymous:     will be {shown/hidden} for anonymous users
-;     visibility.authenticated: will be {shown/hidden} for authenticated users
-; Note that {shown/hidden} is determined by the interpretation.policy for the file. That is, 
-; if the interpretation policy is "show", then the keys under visibility.always will always
-; be shown. If the interpretation is "hide", however, those same keys will always be
-; hidden.
-; 
-;
-;
-; Definitions under the product type label [*] will be applied to all product types and 
-; merged with any product-type-specific definitions which may come later in the file.
-[*]
-visibility.always[] = 
-visibility.anonymous[] = 
-visibility.authenticated[] = 
-
-; EXAMPLE of product-type specific override:
-; Definitions for the FHCRC Hanash (Annexin-LAMR) product type
-;
-;[urn:edrn:FHCRCHanashAnnexinLamr]
-;visibility.always[] = 
-;visibility.anonymous[] = 
-;visibility.authenticated[] =  
-
-

http://git-wip-us.apache.org/repos/asf/oodt/blob/098cc4fa/balance/modules/cas-browser/hooks.php
----------------------------------------------------------------------
diff --git a/balance/modules/cas-browser/hooks.php b/balance/modules/cas-browser/hooks.php
deleted file mode 100644
index ba0c212..0000000
--- a/balance/modules/cas-browser/hooks.php
+++ /dev/null
@@ -1,74 +0,0 @@
-<?php
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements.  See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License.  You may obtain a copy of the License at
- *
- *     http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-/**
- * HOOKS.PHP
- * 
- * Hooks provide the ability, as the name implies, to hook into various parts of 
- * the view rendering process and insert customizations. The contents of these 
- * functions are run at the appropriate time *EVERY* time a view is rendered, i.e.
- * the content of the hooks is not by default view-specific but rather will be 
- * applied to all views. (However, there is nothing that prevents developers from 
- * inserting conditional logic inside a hook that then causes view-specific
- * them to exhibit view-specific behavior).
- * 
- * Take a look at the docblock descriptions of each hook to get a sense of where
- * in the view rendering process the hook is invoked.
- * 
- * @author ahart
- */
-
-/**
- * hook_before_header
- * 
- * This hook is executed before the contents of the header file are processed.
- */
-function hook_before_header() {} 
-
-/**
- * hook_before_view
- * 
- * This hook is executed before the contents of the main view are processed.
- */
-function hook_before_view() {
-	require_once( 'scripts/widgets/BreadcrumbsWidget.php' );
-	
-	$module = App::Get()->loadModule();
-	// Include JavaScript files to be shown with every view in this module
-	App::Get()->response->addJavascript($module->moduleStatic.'/js/jquery-1.4.2-min.js');
-	App::Get()->response->addJavascript($module->moduleStatic.'/js/jcorner.jquery.js');
-	
-	// Include CAS-Browser default CSS stylesheets to be shown with every view in this module
-	App::Get()->response->addStylesheet($module->moduleStatic.'/css/cas-browser.css');
-	App::Get()->response->addStylesheet($module->moduleStatic.'/css/dataTables.css');
-}
-
-/**
- * hook_before_footer
- * 
- * This hook is executed before the contents of the footer are processed
- */
-function hook_before_footer() {}
-
-/**
- * hook_before_render
- * 
- * This hook is after all of the view components (header, view, footer) have been
- * processed but before the processed results are sent out across the wire to the 
- * browser.
- */
-function hook_before_send() {}

http://git-wip-us.apache.org/repos/asf/oodt/blob/098cc4fa/balance/modules/cas-browser/scripts/allTypeScript.php
----------------------------------------------------------------------
diff --git a/balance/modules/cas-browser/scripts/allTypeScript.php b/balance/modules/cas-browser/scripts/allTypeScript.php
deleted file mode 100644
index c366a5a..0000000
--- a/balance/modules/cas-browser/scripts/allTypeScript.php
+++ /dev/null
@@ -1,64 +0,0 @@
-<?php
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements.  See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License.  You may obtain a copy of the License at
- *
- *     http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-$module = App::Get()->loadModule();
-require_once(dirname(dirname(__FILE__)) . '/classes/CasBrowser.class.php');
-
-$outputFormat = 'json';	// Hard-coded for now
-
-// Get client handle
-$cb = new CasBrowser();
-$client = $cb->getClient();
-
-$results = array('results'=>array());
-
-// Get all products and their types
-$allProducts = array();
-foreach($client->getProductTypes() as $type){
-	foreach($client->getProductsByProductType($type) as $product){
-		array_push($allProducts, array('product'=>$product, 'typeName'=>$type->getName()));
-	}
-}
-
-// Narrow down the given products to the requested page (if page info is given)
-$requestedProducts = array();
-if(isset($_POST['PageNum']) && isset($_POST['PageSize'])){
-	$pageNum = intval($_POST['PageNum']);
-	$pageSize = intval($_POST['PageSize']);
-	try{
-		$requestedProducts = Utils::paginate($allProducts, $pageNum, $pageSize);
-	}catch(Exception $e){
-		Utils::reportError($e->getMessage(), $outputFormat);
-	}
-	$results['totalPages'] = ceil(count($allProducts) / $pageSize);
-}else{
-	$requestedProducts = $allProducts;
-}
-
-// Get metadata and format requested products
-try{
-	$results['results'] = Utils::formatResults($requestedProducts);
-}catch(Exception $e){
-	Utils::reportError($e->getMessage(), $outputFormat);
-}
-
-$results['totalProducts'] = count($allProducts);
-
-echo json_encode($results);
-
-?>
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/oodt/blob/098cc4fa/balance/modules/cas-browser/scripts/crossTypeQueryScript.php
----------------------------------------------------------------------
diff --git a/balance/modules/cas-browser/scripts/crossTypeQueryScript.php b/balance/modules/cas-browser/scripts/crossTypeQueryScript.php
deleted file mode 100644
index d228f2b..0000000
--- a/balance/modules/cas-browser/scripts/crossTypeQueryScript.php
+++ /dev/null
@@ -1,246 +0,0 @@
-<?php
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements.  See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License.  You may obtain a copy of the License at
- *
- *     http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-$module = App::Get()->loadModule();
-require_once(dirname(dirname(__FILE__)) . '/classes/CasBrowser.class.php');
-
-global $messages;
-$messages = array();
-
-function searchBooleanMetadata($pts, $booleanCriterion){
-	global $messages;
-	$resultTypes = array();
-	$terms = $booleanCriterion->getTerms();
-	if($booleanCriterion->getOperator() == CAS_Filemgr_BooleanQueryCriteria::$AND_OP){
-		$resultTypes = $pts;
-		foreach($terms as $t){
-			try{
-				$resultTypes = searchTypeMetadata($resultTypes, $t);
-				array_push($messages, count($termResults) . " types returned to boolean type search");
-			}catch(Exception $e){
-				throw new CasBrowserException("Exception occurred while searching type metadata in boolean AND term ("
-						. $t->getElementName() . " = " . $t->getValue() . "): " . $e->getMessage());
-			}
-			if(!count($resultTypes)){
-				array_push($messages, "No types found that match the boolean AND query");
-				return array();
-			}
-		}
-	}elseif($booleanCriterion->getOperator() == CAS_Filemgr_BooleanQueryCriteria::$OR_OP){
-		foreach($terms as $t){
-			try{
-				$termResults = searchTypeMetadata($pts, $t);
-			}catch(Exception $e){
-				throw new CasBrowserException("Exception occurred while searching type metadata in boolean OR term ("
-						. $t->getElementName() . " = " . $t->getValue() . "): " . $e->getMessage());
-			}
-			$resultTypes += $termResults;	// Not sure if this is correct
-			if(count($resultTypes) == count($pts)){
-				array_push($messages, "All types match the boolean OR query");
-				return $pts;
-			}
-		}
-	}elseif($booleanCriterion->getOperator() == CAS_Filemgr_BooleanQueryCriteria::$NOT_OP){
-		try{
-			$termResults = searchTypeMetadata($pts, $terms[0]);
-		}catch(Exception $e){
-			throw new CasBrowserException("Exception occurred while searching type metadata in boolean NOT term: "
-					. $e->getMessage());
-		}
-		$resultTypes = array_merge(array_diff($pts, $termResults));
-	}else{
-		throw new CasBrowserException("A BooleanQueryCriteria object has an invalid operator");
-	}
-	array_push($messages, count($resultTypes) . " types found that match the boolean query");
-	return $resultTypes;
-}
-
-function searchTermMetadata($pts, $termCriterion){
-	global $messages;
-	$key = $termCriterion->getElementName();
-	$value = $termCriterion->getValue();
-	array_push($messages, "Searching type metadata for " . $key . " = " . $value . " in " . count($pts) . " types");
-	$resultTypes = array();
-	foreach($pts as $pt){
-		$ptMet = $pt->getTypeMetadata();
-		if(array_key_exists($key, $ptMet->toAssocArray())){
-			if($ptMet->isMultiValued($key)){
-				$ptMetValues = $ptMet->getAllMetadata($key);
-				for($i = 0; $i < count($ptMetValues); $i++){
-					//array_push($messages, "Comparing type " . $pt->getName() . " key " . $key . " value: " . $ptMetValues[$i]);
-					if($ptMetValues[$i] == $value){
-						array_push($resultTypes, $pt);
-						$i = count($ptMetValues);
-					}
-				}
-			}elseif($ptMet->getMetadata($key) == $value){
-				array_push($resultTypes, $pt);
-			}
-		}
-	}
-	array_push($messages, count($resultTypes) . " types found that match the term");
-	return $resultTypes;
-}
-
-function searchTypeMetadata($pts, $criterion){
-	if($criterion == NULL){
-		throw new CasBrowserException("A null criterion was given to search for type metadata");
-	}
-	if($pts == NULL){
-		throw new CasBrowserException("A null list of product types was given to search for type metadata");
-	}
-	if(!count($pts)){
-		throw new CasBrowserException("An empty list of product types was given to search for type metadata");
-	}
-	if($criterion instanceof CAS_Filemgr_TermQueryCriteria){
-		return searchTermMetadata($pts, $criterion);
-	}elseif($criterion instanceof CAS_Filemgr_RangeQueryCriteria){
-		return array();	// Not yet supported
-	}elseif($criterion instanceof CAS_Filemgr_BooleanQueryCriteria){
-		return searchBooleanMetadata($pts, $criterion);
-	}else{
-		throw new CasBrowserException("An unknown query criteria type was encountered while search product type metadata");
-	}
-}
-
-
-
-
-$outputFormat = 'json';	// Hard-coded for now
-
-// Get client handle
-$cb = new CasBrowser();
-$client = $cb->getClient();
-
-$results = array('results'=>array());
-
-// Ceate an array of ProductTypes to be queried
-try{
-	if(!isset($_POST['Types'])){
-		Utils::reportError("POST does not contain 'Types' sub-array", $outputFormat);
-	}
-	if(count($_POST['Types']) == 0){
-		Utils::reportError("No product types were specified in POST", $outputFormat);
-	}
-	$queryTypes = array();
-	$allTypes = $client->getProductTypes();
-	if($_POST['Types'][0] == '*'){
-		$queryTypes = $allTypes;
-	}else{
-		$allTypeNames = array_map(create_function('$t', 'return $t->getName();'), $allTypes);
-		foreach($_POST['Types'] as $type){
-			if(!in_array($type, $allTypeNames)){
-				$errStr = "Error: The type " . $type . " is not used in the repository.  Please use one of: ";
-				$errStr .= $allTypeNames[0];
-				for($i = 1; $i < count($allTypeNames); $i++){
-					$errStr .= ", " . $allTypeNames[$i];
-				}
-				Utils::reportError($errStr, $outputFormat);
-			}
-			array_push($queryTypes, $client->getProductTypeByName($type));
-		}
-		if(!count($queryTypes)){
-			Utils::reportError("No ProductTypes were given to query", $outputFormat);
-		}
-	}
-}catch(Exception $e){
-	Utils::reportError($e->getMessage(), $outputFormat);
-}
-
-// Create the tree of criteria objects that define the query.  The tree root is returned.
-if(!isset($_POST['Criteria'])){
-	Utils::reportError("POST does not contain 'Criteria' sub-array", $outputFormat);
-}
-if(!count($_POST['Criteria'])){
-	Utils::reportError("POST sub-array 'Criteria' contains no criteria", $outputFormat);
-}
-$rootIndex = (isset($_POST['RootIndex']))
-			? intval($_POST['RootIndex'])
-			: 0;
-try{
-	$criteriaTree = Utils::createCriteriaTree($rootIndex, $queryTypes, null);
-}catch(Exception $e){
-	Utils::reportError($e->getMessage(), $outputFormat);
-}
-
-// Search inside of product type metadata for results to further refine search
-// NOTE: This is all currently a dirty hack!  This needs major refinement!
-$allMatchingProducts = array();
-$typesByName = array();
-foreach($queryTypes as $t){
-	$typesByName[$t->getName()] = $t;
-}
-try{
-	$matchingPTs = searchTypeMetadata($queryTypes, $criteriaTree);
-}catch(Exception $e){
-	Utils::reportError("An exception occurred while searching type metadata: " . $e->getMessage(), $outputFormat);
-}
-foreach($matchingPTs as $matchingType){
-	array_splice($queryTypes, array_search($matchingType, $queryTypes), 1);	// Remove types that match from query
-	foreach($client->getProductsByProductType($matchingType) as $p){	// Add all products of matching types
-		array_push($allMatchingProducts, array('product'=>$p, 'typeName'=>$matchingType->getName()));
-	}
-}
-
-// Add criteria to query object
-$query = new CAS_Filemgr_Query();
-$query->addCriterion($criteriaTree);
-
-// Perform the query and collect results
-try{
-	foreach($queryTypes as $type){
-		$queryResultsOfType = $client->query($query, $type);
-		if(count($queryResultsOfType) > 0){
-			foreach($queryResultsOfType as $matchingProduct){
-				array_push($allMatchingProducts, array('product'=>$matchingProduct, 'typeName'=>$type->getName()));
-			}
-		}
-	}
-}catch(Exception $e){
-	Utils::reportError($e->getMessage(), $outputFormat);
-}
-
-// Narrow down the given products to the requested page (if page info is given)
-$requestedProducts = array();
-if(isset($_POST['PageNum']) && isset($_POST['PageSize'])){
-	$pageNum = intval($_POST['PageNum']);
-	$pageSize = intval($_POST['PageSize']);
-	try{
-		$requestedProducts = Utils::paginate($allMatchingProducts, $pageNum, $pageSize);
-	}catch(Exception $e){
-		Utils::reportError($e->getMessage(), $outputFormat);
-	}
-	$results['totalPages'] = ceil(count($allMatchingProducts) / $pageSize);
-}else{
-	$requestedProducts = $allMatchingProducts;
-}
-
-// Get metadata and format requested products
-try{
-	$results['results'] = Utils::formatResults($requestedProducts);
-}catch(Exception $e){
-	Utils::reportError($e->getMessage(), $outputFormat);
-}
-	
-$results['totalProducts'] = count($allMatchingProducts);
-
-$results['messages'] = $messages;
-
-echo json_encode($results);
-
-?>
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/oodt/blob/098cc4fa/balance/modules/cas-browser/scripts/pageScript.php
----------------------------------------------------------------------
diff --git a/balance/modules/cas-browser/scripts/pageScript.php b/balance/modules/cas-browser/scripts/pageScript.php
deleted file mode 100644
index 5b4aaec..0000000
--- a/balance/modules/cas-browser/scripts/pageScript.php
+++ /dev/null
@@ -1,102 +0,0 @@
-<?php
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements.  See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License.  You may obtain a copy of the License at
- *
- *     http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-$module = App::Get()->loadModule();
-require_once(dirname(dirname(__FILE__)) . '/classes/CasBrowser.class.php');
-
-// Extract desired output format from POST
-if(isset($_POST['OutputFormat'])){
-	try{
-		$outputFormat = Utils::getRequestedReturnType($_POST['OutputFormat']);
-	}catch(Exception $e){
-		Utils::reportError($e->getMessage(), 'html');
-	}
-}else{
-	$outputFormat = 'html';
-}
-
-// Get client handle
-$cb = new CasBrowser();
-$client = $cb->getClient();
-
-// Extract ProductType from POST
-if(!isset($_POST['Type'])){
-	Utils::reportError("POST does not contain 'Type' ProductType", $outputFormat);
-}
-$typeName = $_POST['Type'];
-try{
-	$allTypes = $client->getProductTypes();
-	$allTypeNames = array_map(create_function('$t', 'return $t->getName();'), $allTypes);
-	if(!in_array($typeName, $allTypeNames)){
-		$errStr = "The type " . $typeName . " is not used in the repository.  Please use one of: ";
-		for($i = 0; $i < count($allTypeNames) - 1; $i++){
-			$errStr .= $allTypeNames[i] . ", ";
-		}
-		$errStr .= $allTypeNames[count($allTypeNames) - 1];
-		Utils::reportError($errStr, $outputFormat);
-	}
-	$type = $client->getProductTypeByName($typeName);
-}catch(Exception $e){
-	Utils::reportError($e->getMessage(), $outputFormat);
-}
-
-// Extract page number from POST
-if(!isset($_POST['PageNum'])){
-	Utils::reportError("POST does not contain 'PageNum'", $outputFormat);
-}
-$pageNum = intval($_POST['PageNum']);
-
-// Get the requested page
-try{
-	$page = Utils::getPage($type, $pageNum);
-}catch(Exception $e){
-	Utils::reportError($e->getMessage(), $outputFormat);
-}
-
-// Get the products from the requested page -- what we're really after
-$pageProducts = array();
-foreach($page->getPageProducts() as $p){
-	array_push($pageProducts, array('product'=>$p));
-}
-
-// Format results
-if($outputFormat == 'html'){
-	$payload = '<ul class="pp_productList" id="product_list">';
-	foreach($pageProducts as $p){
-		$payload .= '<li><a href="' . $module->moduleRoot . '/product/' . $p['product']->getId() . '">';
-		$payload .= urlDecode($p['product']->getName()) . '</a></li>';
-	}
-	$payload .= "</ul>\n";
-	$payload .= '<input type="hidden" id="total_pages" value="' . $page->getTotalPages() . '">';
-	$payload .= '<input type="hidden" id="page_size" value="' . $page->getPageSize() . '">';
-}elseif ($outputFormat == 'json') {
-	$payload = array();
-	try{
-		$payload['results'] = Utils::formatResults($pageProducts);
-		$payload['totalProducts'] = $client->getNumProducts($type);
-	}catch(Exception $e){
-		Utils::reportError($e->getMessage(), $outputFormat);
-	}
-	$payload['totalPages'] = $page->getTotalPages();
-	$payload['pageSize'] = $page->getPageSize();
-	$payload = json_encode($payload);
-}
-
-echo $payload;
-
-?>
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/oodt/blob/098cc4fa/balance/modules/cas-browser/scripts/productTypeFilter.php
----------------------------------------------------------------------
diff --git a/balance/modules/cas-browser/scripts/productTypeFilter.php b/balance/modules/cas-browser/scripts/productTypeFilter.php
deleted file mode 100644
index 5724cdd..0000000
--- a/balance/modules/cas-browser/scripts/productTypeFilter.php
+++ /dev/null
@@ -1,70 +0,0 @@
-<?php
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements.  See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License.  You may obtain a copy of the License at
- *
- *     http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- *
- *
- *   PRODUCT-TYPE FILTER
- *   
- *   HTTP Method: GET
- *   Input:
- *     - key    (string) a ProductType metadata key to search on
- *     - value  (string) the value to use when determining matches
- *   Output:
- *     - json   (default) a json array representing all matching product types
- *              with their defined metadata
- *              
- */
-$module = App::Get()->loadModule();
-require_once( $module->modulePath . "/classes/CasBrowser.class.php");
-require_once( $module->modulePath . "/scripts/widgets/ProductTypeListWidget.php");
-
-// Get a Cas-Browser XML/RPC Client
-$browser = new CasBrowser();
-$client  = $browser->getClient();
-
-// Get a list of the product types managed by this server
-$ptypes = $client->getProductTypes();
-
-// Get the metadata key/val pair that will serve as the needle
-$metKey = urldecode($_GET['key']);
-$needle = urldecode($_GET['value']);
-
-$productTypes = array();
-foreach ($ptypes as $pt) {
-	$ptArray = $pt->toAssocArray();
-	
-	// Check whether the requested met key value matches desired value
-	if ($needle == '*' || (isset($ptArray['typeMetadata'][$metKey]) 
-		&& $ptArray['typeMetadata'][$metKey][0] == $needle)) {
-
-		$merged = array_merge($ptArray['typeMetadata'],array(
-			"name" => array($ptArray[App::Get()->settings['browser_pt_name_key']]),
-			"description" => array($ptArray[App::Get()->settings['browser_pt_desc_key']]),
-			"id"   => array($ptArray[App::Get()->settings['browser_pt_id_key']])));
-		
-		$productTypes[] = $merged;
-	}	
-}
-
-// Format output as json
-$json = json_encode($productTypes);
-
-// Output the json result
-header('Content-Type: application/json');
-echo $json;
-
-// We're done.
-exit();

http://git-wip-us.apache.org/repos/asf/oodt/blob/098cc4fa/balance/modules/cas-browser/scripts/queryScript.php
----------------------------------------------------------------------
diff --git a/balance/modules/cas-browser/scripts/queryScript.php b/balance/modules/cas-browser/scripts/queryScript.php
deleted file mode 100644
index 5566994..0000000
--- a/balance/modules/cas-browser/scripts/queryScript.php
+++ /dev/null
@@ -1,155 +0,0 @@
-<?php
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements.  See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License.  You may obtain a copy of the License at
- *
- *     http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-$module = App::Get()->loadModule();
-require_once(dirname(dirname(__FILE__)) . '/classes/CasBrowser.class.php');
-
-// Extract desired output format from POST
-if(isset($_POST['OutputFormat'])){
-	try{
-		$outputFormat = Utils::getRequestedReturnType($_POST['OutputFormat']);
-	}catch(Exception $e){
-		Utils::reportError($e->getMessage(), 'html');
-	}
-}else{
-	$outputFormat = 'html';
-}
-
-// Get client handle
-$cb = new CasBrowser();
-$client = $cb->getClient();
-
-// Ceate an array of ProductTypes to be queried
-try{
-	if(!isset($_POST['Types'])){
-		Utils::reportError("POST does not contain 'Types' sub-array", $outputFormat);
-	}
-	if(count($_POST['Types']) == 0){
-		Utils::reportError("No product types were specified in POST", $outputFormat);
-	}
-	$queryTypes = array();
-	$allTypes = $client->getProductTypes();
-	if($_POST['Types'][0] == '*'){
-		$queryTypes = $allTypes;
-	}else{
-		$allTypeNames = array_map(create_function('$t', 'return $t->getName();'), $allTypes);
-		foreach($_POST['Types'] as $type){
-			if(!in_array($type, $allTypeNames)){
-				$errStr = "Error: The type " . $type . " is not used in the repository.  Please use one of: ";
-				$errStr .= $allTypeNames[0];
-				for($i = 1; $i < count($allTypeNames); $i++){
-					$errStr .= ", " . $allTypeNames[$i];
-				}
-				Utils::reportError($errStr, $outputFormat);
-			}
-			array_push($queryTypes, $client->getProductTypeByName($type));
-		}
-		if(!count($queryTypes)){
-			Utils::reportError("No ProductTypes were given to query", $outputFormat);
-		}
-	}
-}catch(Exception $e){
-	Utils::reportError($e->getMessage(), $outputFormat);
-}
-
-// Check if results are desired in a ProductPage and which page of results is desired
-$pagedResults = false;
-$pageNum = 1;
-if(isset($_POST['PagedResults'])){
-	if($_POST['PagedResults']){
-		if(count($queryTypes) != 1){
-			Utils::reportError("Paged queries can only be performed on one ProductType", $outputFormat);
-		}
-		$pagedResults = true;
-		if(isset($_POST['PageNum'])){
-			$pageNum = intval($_POST['PageNum']);
-		}		
-	}
-}
-
-// Create the tree of criteria objects that define the query
-if(!isset($_POST['Criteria'])){
-	Utils::reportError("POST does not contain 'Criteria' sub-array", $outputFormat);
-}
-if(!count($_POST['Criteria'])){
-	Utils::reportError("POST sub-array 'Criteria' contains no criteria", $outputFormat);
-}
-$rootIndex = (isset($_POST['RootIndex']))
-			? intval($_POST['RootIndex'])
-			: 0;
-try{
-	$criteriaTree = Utils::createCriteriaTree($rootIndex, $queryTypes, null);
-}catch(Exception $e){
-	Utils::reportError($e->getMessage(), $outputFormat);
-}
-	
-// Add criteria to query object
-$query = new CAS_Filemgr_Query();
-$query->addCriterion($criteriaTree);
-
-// Perform the query and collect results
-$results = array();
-try{
-	if($pagedResults){
-		$resultPage = $client->pagedQuery($query, $queryTypes[0], $pageNum);
-		foreach($resultPage->getPageProducts() as $p){
-			array_push($results, array('product'=>$p));
-		}
-	}else{
-		foreach($queryTypes as $type){
-			foreach($client->query($query, $type) as $p){
-				array_push($results, array('product'=>$p));
-			}
-		}
-	}
-}catch(Exception $e){
-	Utils::reportError($e->getMessage(), $outputFormat);
-}
-
-// Format results
-try{
-	if($outputFormat == 'html'){
-		$payload = '<ul class="pp_productList" id="product_list">';
-		foreach($results as $r){
-			$payload .= '<li><a href="' . $module->moduleRoot . '/product/' . $r['product']->getId() . '">';
-			$payload .= urlDecode($r['product']->getName()) . '</a></li>';
-		}
-		$payload .= "</ul>\n";
-		if($pagedResults){
-			$payload .= '<input type="hidden" id="total_pages" value="' . $resultPage->getTotalPages() . '">';
-			$payload .= '<input type="hidden" id="page_size" value="' . $resultPage->getPageSize() . '">';
-			$payload .= '<input type="hidden" id="total_type_products" value="' . $client->getNumProducts($queryTypes[0]) . '">';
-		}
-	}elseif ($outputFormat == 'json') {
-		$payload = array();
-		$payload['results'] = Utils::formatResults($results);
-		if($pagedResults){
-			$payload['totalPages'] = $resultPage->getTotalPages();
-			$payload['pageSize'] = $resultPage->getPageSize();
-			$payload['totalProducts'] = $client->getNumProducts($queryTypes[0]);
-		}
-		$payload = json_encode($payload);
-	}
-}catch(Exception $e){
-	Utils::reportError($e->getMessage(), $outputFormat);
-}
-
-echo $payload;
-
-?>
-

http://git-wip-us.apache.org/repos/asf/oodt/blob/098cc4fa/balance/modules/cas-browser/scripts/widgets/BasicSearchWidget.php
----------------------------------------------------------------------
diff --git a/balance/modules/cas-browser/scripts/widgets/BasicSearchWidget.php b/balance/modules/cas-browser/scripts/widgets/BasicSearchWidget.php
deleted file mode 100644
index 917eaa5..0000000
--- a/balance/modules/cas-browser/scripts/widgets/BasicSearchWidget.php
+++ /dev/null
@@ -1,42 +0,0 @@
-<?php
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements.  See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License.  You may obtain a copy of the License at
- *
- *     http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-class BasicSearchWidget 
-	implements Org_Apache_Oodt_Balance_Interfaces_IApplicationWidget {
-	
-	public function __construct($options = array()){}
-	
-	public function render($bEcho = true){
-		$module = App::Get()->loadModule();
-		$str = '';
-		$str .= '<form action="' . $module->moduleRoot . '/queryScript.do" method="POST">';
-		$str .= '<input type="hidden" name="Types[0]" value="*"/>';
-		$str .= '<input type="hidden" name="Criteria[0][CriteriaType]" value="Term"/>';
-		$str .= '<input type="hidden" name="Criteria[0][ElementName]" value="*"/>';
-		$str .= '<input type="text" name ="Criteria[0][Value]"/>';
-		$str .= '<input type="submit" value="Search"/>';
-		$str .= '</form>';
-		
-		if ($bEcho) {
-			echo $str;
-		} else {
-			return $st;
-		}
-	}
-}
-?>
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/oodt/blob/098cc4fa/balance/modules/cas-browser/scripts/widgets/CrossTypeSearchWidget.php
----------------------------------------------------------------------
diff --git a/balance/modules/cas-browser/scripts/widgets/CrossTypeSearchWidget.php b/balance/modules/cas-browser/scripts/widgets/CrossTypeSearchWidget.php
deleted file mode 100644
index b50de42..0000000
--- a/balance/modules/cas-browser/scripts/widgets/CrossTypeSearchWidget.php
+++ /dev/null
@@ -1,125 +0,0 @@
-<?php
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements.  See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License.  You may obtain a copy of the License at
- *
- *     http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-class CrossTypeSearchWidget 
-	implements Org_Apache_Oodt_Balance_Interfaces_IApplicationWidget {
-	
-	// The id of the HTMLElement that will be modified by filter results.  This must be set before
-	// calling renderScript().
-	public $htmlID;
-	
-	// The ID of the HTMLElement that contains the loading icon that will be
-	// displayed while getting results
-	public $loadingID;
-	
-	// The url of the site base
-	public $siteUrl;
-
-	public function __construct($options = array()){
-		if(isset($options['htmlID'])){
-			$this->htmlID = $options['htmlID'];
-		}
-		if(isset($options['loadingID'])){
-			$this->loadingID = $options['loadingID'];
-		}
-		if(isset($options['siteUrl'])){
-			$this->siteUrl = $options['siteUrl'];
-		}
-	}
-	
-	public function setHtmlId($htmlID){
-		$this->htmlID = $htmlID;
-	}
-	
-	public function setSiteUrl($siteUrl){
-		$this->siteUrl = $siteUrl;
-	}
-	
-	public function render($bEcho = true){
-		$str = '<div id="filter_widget_exclusive_container">';
-		$str .= '<label>Exclusive:</label><input id="exclusive" type="checkbox" checked="checked" onclick="changeExclusive()"/></div>';
-		$str .= '<select id="filterKey">';
-		$filterKeys = Utils::getFacets();
-		natcasesort($filterKeys);
-		foreach($filterKeys as $label){
-			$str .= '<option value="' . $label . '">' . $label . '</option>';
-		}
-		$str .= '</select>&nbsp;=&nbsp;';
-		$str .= '<input type="text" id="filterValue" size="18" alt="filterValue">&nbsp;';
-		$str .= '<input type="button" value="Add" onclick="addFilter()" />';
-		$str .= '<table id="filters"></table>';
-		$str .= '';
-		$str .= '<div id="permalink"></div>';
-		
-		if ($bEcho) {
-			echo $str;
-		} else {
-			return $str;
-		}
-	}
-	
-	public function renderScript($bEcho = true){
-		$str = '<script type="text/javascript">';
-		$str .= 'var htmlID = "' . $this->htmlID . '";';
-		$str .= 'var loadingID = "' . $this->loadingID . '";';
-		$str .= 'var siteUrl = "'. $this->siteUrl . '";';
-		$str .= 'var resultFormat = "json";';
-		$str .= 'var defaultShowEverything = ' . App::Get()->settings['default_show_all'] . ';';
-		$str .= 'var displayedMetadata = new Array(';
-		if(isset(App::Get()->settings['browser_products_met'])){
-			$metList = '';
-			foreach(App::Get()->settings['browser_products_met'] as $met){
-				if(strlen($metList) > 0){
-					$metList .= ',';
-				}
-				$metList .= '"' . $met . '"';
-			}
-			$str .= $metList;
-		}
-		$str .= ');</script>';
-		$str .= '<script type="text/javascript" src="' . App::Get()->request->moduleStatic . '/js/querywidget.js"></script>';
-		$str .= '<script type="text/javascript" src="' . App::Get()->request->moduleStatic . '/js/crosstypesearchwidget.js"></script>';
-		
-		if ($bEcho) {
-			echo $str;
-		} else {
-			return $str;
-		}
-	}
-	
-	public static function parseSegments(){
-		$results = array();
-		$segments = App::Get()->request->segments;
-		if(isset($segments[1]) && $segments[1] != ""){
-			$filterParams = array();
-			for($index = 1; isset($segments[$index]) && $segments[$index] != ""; $index = $index + 2){
-				array_push($filterParams, array($segments[$index], $segments[$index + 1]));
-			}
-			$results['filterParams'] = $filterParams;
-		}
-		if(isset($segments[0]) && $segments[0] != ""){
-			if(intval($segments[0]) == 1){
-				$results['exclusive'] = array('bool'=>'or', 'checked'=>false);
-			}else{
-				$results['exclusive'] = array('bool'=>'and', 'checked'=>true);
-			}
-		}
-		return $results;
-	}
-}
-?>

http://git-wip-us.apache.org/repos/asf/oodt/blob/098cc4fa/balance/modules/cas-browser/scripts/widgets/CustomSearchWidget.php
----------------------------------------------------------------------
diff --git a/balance/modules/cas-browser/scripts/widgets/CustomSearchWidget.php b/balance/modules/cas-browser/scripts/widgets/CustomSearchWidget.php
deleted file mode 100644
index 4102d7b..0000000
--- a/balance/modules/cas-browser/scripts/widgets/CustomSearchWidget.php
+++ /dev/null
@@ -1,178 +0,0 @@
-<?php
- /*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements.  See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License.  You may obtain a copy of the License at
- *
- *     http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- * 
- * 
- * This widget is configured by the customSearchConfig array in the config file.  The
- * widget expects the specifications for the criteria to search in sequence.  Each
- * criteria should start with either 'term' or 'range' as an element in the config
- * array, followed by the name of the metadata element that will be searched with the
- * value given in the field corresponding to that criteria.  Finally the next element
- * or two elements in the config array will be occupied by labels for the inout fields,
- * depending upon the criteria type (term or range).
- * Here is an exmaple of a config array for a term criterion and a range criterion in order:
- * 
- * customSearchConfig[]=term
- * customSearchConfig[]=EUFile
- * customSearchConfig[]=EUFile
- * customSearchConfig[]=range
- * customSearchConfig[]=VideoLength
- * customSearchConfig[]=Min. Video Length
- * customSearchConfig[]=Max. Video Length
- * 
- */
-class CustomSearchWidget 
-	implements Org_Apache_Oodt_Balance_Interfaces_IApplicationWidget {
-	
-	// This array will specify what criteria we use in our search, what types they are
-	// and how they should be labeled.
-	public $criteria;
-	
-	// The ProductType that the widget is filtering.  This must be set before calling
-	// render() or renderScript().
-	public $productType;
-	
-	// The id of the HTMLElement that will be modified by filter results.  This must be set before
-	// calling renderScript().
-	public $htmlID;
-	
-	// The url of the site base
-	public $siteUrl;
-	
-	// Will results be returned in html or json
-	public $resultFormat;
-	
-	public function __construct($options = array()){
-		
-		if(isset($options['productType'])){
-			$this->productType = $options['productType'];
-		}
-		if(isset($options['htmlID'])){
-			$this->htmlID = $options['htmlID'];
-		}
-		if(isset($options['siteUrl'])){
-			$this->siteUrl = $options['siteUrl'];
-		}
-		if(isset($options['resultFormat'])){
-			$this->resultFormat = $options['resultFormat'];
-		}
-		
-		if(!isset(App::Get()->settings['customSearchConfig'])){
-			echo '<div class="error">No criteria config was found for the CustomSearchWidget.</div>';
-			return;
-		}
-		$criteriaConfig = App::Get()->settings['customSearchConfig'];
-		
-		// Build a representation of the criteria to be searched by the widget.
-		// If, during this process, we encounter config values that don't make
-		// sense or an incomplete config for a criterion, we'll simply skip to
-		// the next index in the config array.
-		$this->criteria = array();
-		$configIndex = 0;
-		while(isset($criteriaConfig[$configIndex])){
-			
-			$newCriterion = array();
-			
-			// Look for a criteria type
-			$newType = strtolower($criteriaConfig[$configIndex]);
-			if($newType == 'term' or $newType == 'range'){
-				$newCriterion['type'] = $newType;
-				$configIndex++;
-			}else{
-				continue;	// Let's skip this one and hope that we
-							// find one that makes more sense later.
-			}
-			
-			// Extract the metadata element associated with the criterion
-			$newElement = $criteriaConfig[$configIndex];
-			if(isset($newElement)){
-				$newCriterion['element'] = $newElement;
-				$configIndex++;
-			}else{
-				continue;	// This criterion wasn't finished.
-			}
-			
-			// Extract the labels for the input field(s)
-			$newLabel = $criteriaConfig[$configIndex];
-			if(isset($newLabel)){
-				if($newType == 'term'){
-					$newCriterion['termLabel'] = $newLabel;
-				}else{
-					$newCriterion['minLabel'] = $newLabel;
-					$configIndex++;
-					$newLabel = $criteriaConfig[$configIndex];
-					if(isset($newLabel)){
-						$newCriterion['maxLabel'] = $newLabel;
-					}else{
-						continue;	// This criterion wasn't finished.
-					}
-				}
-			}else{
-				continue;	// This criterion wasn't finished.
-			}
-			
-			array_push($this->criteria, $newCriterion);
-			$configIndex++;
-			
-		}
-	}
-	
-	// Using the criteria representation at this->criteria, we create the fields for
-	// specifying the criteria values.  We put a hidden input tag with an id of the
-	// form termX or rangeX before the specification fields.  The JS will find these
-	// hidden tags and use them to understand whether the fields specify term or
-	// range criteria.  The number following the criterion type is only so that they
-	// have unique IDs.
-	public function render($bEcho = true){
-		$str = '';
-		for($i = 0; $i < count($this->criteria); $i++){
-			if($this->criteria[$i]['type'] == 'term'){
-				$str .= '<input id="term' . $i . '" type="hidden" value="' . $this->criteria[$i]['element'] . '">';
-				$str .= $this->criteria[$i]['termLabel'] . ':&nbsp;<input type="text" size="18" id="inputTerm' . $i . '"><br/>';
-			}else{
-				$str .= '<input id="range' . $i . '" type="hidden" value="' . $this->criteria[$i]['element'] . '">';
-				$str .= $this->criteria[$i]['minLabel'] . ':&nbsp;<input type="text" size="18" id="inputRangeMin' . $i . '">';
-				$str .= '&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;';
-				$str .= $this->criteria[$i]['maxLabel'] . ':&nbsp;<input type="text" size="18" id="inputRangeMax' . $i . '"><br/>';
-			}
-		}
-		$str .= '<input type="button" value="Search" onclick="customQuery()" />';
-		
-		if ($bEcho) {
-			echo $str;
-		} else {
-			return $str;
-		}
-	}
-	
-	public function renderScript($bEcho = true){
-		$module = App::Get()->loadModule();
-		$str = '';
-		$str .= '<script type="text/javascript">var htmlID = "' . $this->htmlID . '";</script>';
-		$str .= '<script type="text/javascript">var ptName = "' . $this->productType->getName() . '";</script>';
-		$str .= '<script type="text/javascript">var siteUrl = "' . $this->siteUrl . '";</script>';
-		$str .= '<script type="text/javascript">var resultFormat = "' . $this->resultFormat . '";</script>';
-		$str .= '<script type="text/javascript" src="' . $module->moduleStatic . '/js/querywidget.js"></script>';
-		$str .= '<script type="text/javascript" src="' . $module->moduleStatic . '/js/customsearchwidget.js"></script>';
-		
-		if ($bEcho) {
-			echo $str;
-		} else {
-			return $str;
-		}
-	}
-}
-?>


Mime
View raw message