Index: modules/cas-browser/styleFiles.txt
===================================================================
--- modules/cas-browser/styleFiles.txt (revision 0)
+++ modules/cas-browser/styleFiles.txt (revision 0)
@@ -0,0 +1,117 @@
+hooks.php:49: // Include CAS-Browser default CSS stylesheets to be shown with every view in this module
+scripts/widgets/.svn/text-base/ProductDownloadWidget.php.svn-base:58: $str .= "
").appendTo("body");f=e.css("display");if(f==="none")f="block";e.remove();la[d]=f}c.data(this[a],"olddisplay",f)}}a=0;for(b=this.length;a-10000?a:parseFloat(c.curCSS(this.elem,this.prop))||0},custom:function(a,b,d){function f(j){return e.step(j)}this.startTime=J();this.start=a;this.end=b;this.unit=d||this.unit||"px";this.now=this.start;
+static/js/.svn/text-base/jquery-1.4.2-min.js.svn-base:141:this.pos=this.state=0;var e=this;f.elem=this.elem;if(f()&&c.timers.push(f)&&!W)W=setInterval(c.fx.tick,13)},show:function(){this.options.orig[this.prop]=c.style(this.elem,this.prop);this.options.show=true;this.custom(this.prop==="width"||this.prop==="height"?1:0,this.cur());c(this.elem).show()},hide:function(){this.options.orig[this.prop]=c.style(this.elem,this.prop);this.options.hide=true;this.custom(this.cur(),0)},step:function(a){var b=J(),d=true;if(a||b>=this.options.duration+this.startTime){this.now=
+static/js/.svn/text-base/jquery-1.4.2-min.js.svn-base:142:this.end;this.pos=this.state=1;this.update();this.options.curAnim[this.prop]=true;for(var f in this.options.curAnim)if(this.options.curAnim[f]!==true)d=false;if(d){if(this.options.display!=null){this.elem.style.overflow=this.options.overflow;a=c.data(this.elem,"olddisplay");this.elem.style.display=a?a:this.options.display;if(c.css(this.elem,"display")==="none")this.elem.style.display="block"}this.options.hide&&c(this.elem).hide();if(this.options.hide||this.options.show)for(var e in this.options.curAnim)c.style(this.elem,
+static/js/.svn/text-base/jquery-1.4.2-min.js.svn-base:144:c.fx.stop()},stop:function(){clearInterval(W);W=null},speeds:{slow:600,fast:200,_default:400},step:{opacity:function(a){c.style(a.elem,"opacity",a.now)},_default:function(a){if(a.elem.style&&a.elem.style[a.prop]!=null)a.elem.style[a.prop]=(a.prop==="width"||a.prop==="height"?Math.max(0,a.now):a.now)+a.unit;else a.elem[a.prop]=a.now}}});if(c.expr&&c.expr.filters)c.expr.filters.animated=function(a){return c.grep(c.timers,function(b){return a===b.elem}).length};c.fn.offset="getBoundingClientRect"in s.documentElement?
+static/js/.svn/text-base/jquery-1.4.2-min.js.svn-base:148:f.position==="fixed"){k+=Math.max(i.scrollTop,o.scrollTop);n+=Math.max(i.scrollLeft,o.scrollLeft)}return{top:k,left:n}};c.offset={initialize:function(){var a=s.body,b=s.createElement("div"),d,f,e,j=parseFloat(c.curCSS(a,"marginTop",true))||0;c.extend(b.style,{position:"absolute",top:0,left:0,margin:0,border:0,width:"1px",height:"1px",visibility:"hidden"});b.innerHTML="
+views/typesearch.php:99:
Index: modules/cas-browser/config.ini
===================================================================
--- modules/cas-browser/config.ini (revision 0)
+++ modules/cas-browser/config.ini (revision 0)
@@ -0,0 +1,105 @@
+; 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
+
Index: modules/cas-browser/scripts/queryScript.php
===================================================================
--- modules/cas-browser/scripts/queryScript.php (revision 0)
+++ modules/cas-browser/scripts/queryScript.php (revision 0)
@@ -0,0 +1,155 @@
+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 = '
';
+ $("#filters").append(filterText);
+}
+
+function addFilter(){
+ pCurrPage = 1;
+ key = $("#filterKey").val();
+ value = $("#filterValue").val();
+ if(value!=""){
+ $("#permalink").html("");
+ createFilter(key, value);
+ formatCrossTypeQueryRequest();
+ $("#filterValue").val("");
+ }
+}
+
+function removeFilter(filterIndex){
+ pCurrPage = 1;
+ $("#filter" + filterIndex).remove();
+ $("#permalink").html("");
+ removeCriteria(filterIndex);
+ sendCrossTypeRequest();
+}
+
+function getNextPage(){
+ pCurrPage = pCurrPage + 1;
+ sendCrossTypeRequest();
+}
+
+function getPrevPage(){
+ pCurrPage = pCurrPage - 1;
+ sendCrossTypeRequest();
+}
+
+function changeExclusive(){
+ if($("#exclusive").attr("checked")){
+ setExclusiveQuery(true);
+ }else{
+ setExclusiveQuery(false);
+ }
+ if(determineRequest(criteriaRoot)){
+ formatCrossTypeQueryRequest();
+ }
+}
Index: modules/cas-browser/static/js/filterwidget.js
===================================================================
--- modules/cas-browser/static/js/filterwidget.js (revision 0)
+++ modules/cas-browser/static/js/filterwidget.js (revision 0)
@@ -0,0 +1,98 @@
+/*
+ * 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.
+ */
+
+function createFilter(key, value){
+ if(!allCriteria[criteriaRoot]){
+ criteriaRoot = addBooleanCriteria('and', null);
+ }
+ index = addTermCriteria(key, value, criteriaRoot);
+ var filterText = '
';
+ }
+ $("#" + htmlID).html(output);
+}
+
+function displayPermalink(){
+ output = 'To see these filters again, go to: ' + siteUrl + '/products/' + ptID + '/';
+ for(i = 0; i < allCriteria[criteriaRoot].criteria.length; i++){
+ termIndex = allCriteria[criteriaRoot].criteria[i];
+ termKey = allCriteria[termIndex].element;
+ termValue = allCriteria[termIndex].value;
+ output += termKey + '/' + termValue + '/';
+ }
+ $("#permalink").html(output);
+}
+
+function getNextPage(){
+ pCurrPage = pCurrPage + 1;
+ sendRequest("json");
+}
+
+function getPrevPage(){
+ pCurrPage = pCurrPage - 1;
+ sendRequest("json");
+}
\ No newline at end of file
Index: modules/cas-browser/static/js/querywidget.js
===================================================================
--- modules/cas-browser/static/js/querywidget.js (revision 0)
+++ modules/cas-browser/static/js/querywidget.js (revision 0)
@@ -0,0 +1,314 @@
+/*
+ * 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.
+ */
+
+var criteriaNum = 0;
+var allCriteria = new Array();
+var criteriaRoot = 0;
+var pCurrPage = 1;
+var pTotalPages = 0;
+var pPageSize = 0;
+var pNumPageProducts = 0;
+var pTotalProducts = 0;
+
+function encodeRequestData(key, value){
+ return escape(key) + "=" + value;
+}
+
+function displayPageInfo(){
+ pageInfo = '
Index: modules/cas-browser/views/dataset.php
===================================================================
--- modules/cas-browser/views/dataset.php (revision 0)
+++ modules/cas-browser/views/dataset.php (revision 0)
@@ -0,0 +1,100 @@
+loadModule();
+
+require_once($module->modulePath . "/classes/CasBrowser.class.php");
+require_once($module->modulePath . "/scripts/widgets/MetadataDisplayWidget.php");
+
+// Get a CAS-Browser XML/RPC client
+$browser = new CasBrowser();
+$client = $browser->getClient();
+
+// Get a Product Type object
+$productType = $client->getProductTypeById(App::Get()->request->segments[0]);
+$ptID = $productType->getId();
+$ptName = $productType->getName();
+
+// Determine the visibility level based on the current user
+$ptVisibilityLevel = $browser->getProductTypeVisibilityLevel($ptID);
+
+// Redirect the user if they are not authorized
+if ($ptVisibilityLevel == CasBrowser::VIS_NONE) {
+ App::Get()->redirect(SITE_ROOT . '/errors/403');
+}
+
+// Load a MetadataDisplayWidget with the visible metadata for this product type
+$typeMetadataWidget = new MetadataDisplayWidget(array());
+$typeMetadataWidget->loadMetadata($browser->getVisibleMetadataForProductType($ptID));
+
+// Create a MetadataDisplayWidget to display system metadata (all except typeMetadata)
+$typeMetadata = $productType->toAssocArray();
+unset($typeMetadata['typeMetadata']);
+$systemMetadataWidget = new MetadataDisplayWidget(array());
+$systemMetadataWidget->loadMetadata($typeMetadata);
+
+
+// Prepare BreadcrumbWigdet
+$bcw = new BreadcrumbsWidget();
+$bcw->add('Home',SITE_ROOT . '/');
+$bcw->add("Browse By Type", $module->moduleRoot . '/');
+$bcw->add($ptName);
+?>
+
+
+
\ No newline at end of file
Index: modules/cas-browser/element-ordering.ini
===================================================================
--- modules/cas-browser/element-ordering.ini (revision 0)
+++ modules/cas-browser/element-ordering.ini (revision 0)
@@ -0,0 +1,48 @@
+;
+; 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[] =