[Fusionforge-commits] r11696 - in trunk/src/plugins/oslc/include/oslc-zend/application/views/scripts: . codendicm

Sabri LABBENE labbenes at libremir.placard.fr.eu.org
Fri Dec 3 14:51:41 CET 2010


Author: labbenes
Date: 2010-12-03 14:51:41 +0100 (Fri, 03 Dec 2010)
New Revision: 11696

Added:
   trunk/src/plugins/oslc/include/oslc-zend/application/views/scripts/codendicm/
   trunk/src/plugins/oslc/include/oslc-zend/application/views/scripts/codendicm/_add_hyperlinks.php
   trunk/src/plugins/oslc/include/oslc-zend/application/views/scripts/codendicm/_resource_xml.php
   trunk/src/plugins/oslc/include/oslc-zend/application/views/scripts/codendicm/_service-catalog_xml.php
   trunk/src/plugins/oslc/include/oslc-zend/application/views/scripts/codendicm/_service-document_xml.php
   trunk/src/plugins/oslc/include/oslc-zend/application/views/scripts/codendicm/get.phtml
   trunk/src/plugins/oslc/include/oslc-zend/application/views/scripts/codendicm/index.phtml
   trunk/src/plugins/oslc/include/oslc-zend/application/views/scripts/codendicm/oslc-cm-service-document.phtml
   trunk/src/plugins/oslc/include/oslc-zend/application/views/scripts/codendicm/oslc-cm-service-document.xml.phtml
   trunk/src/plugins/oslc/include/oslc-zend/application/views/scripts/codendicm/oslc-service-catalog.json.phtml
   trunk/src/plugins/oslc/include/oslc-zend/application/views/scripts/codendicm/oslc-service-catalog.phtml
   trunk/src/plugins/oslc/include/oslc-zend/application/views/scripts/codendicm/oslc-service-catalog.xml.phtml
   trunk/src/plugins/oslc/include/oslc-zend/application/views/scripts/codendicm/post.phtml
   trunk/src/plugins/oslc/include/oslc-zend/application/views/scripts/codendicm/put.phtml
   trunk/src/plugins/oslc/include/oslc-zend/application/views/scripts/codendicm/put.xml.phtml
   trunk/src/plugins/oslc/include/oslc-zend/application/views/scripts/codendicm/read-bugnote-collection.json.phtml
   trunk/src/plugins/oslc/include/oslc-zend/application/views/scripts/codendicm/read-bugnote-collection.phtml
   trunk/src/plugins/oslc/include/oslc-zend/application/views/scripts/codendicm/read-bugnote-collection.xml.phtml
   trunk/src/plugins/oslc/include/oslc-zend/application/views/scripts/codendicm/read-bugnote.json.phtml
   trunk/src/plugins/oslc/include/oslc-zend/application/views/scripts/codendicm/read-bugnote.phtml
   trunk/src/plugins/oslc/include/oslc-zend/application/views/scripts/codendicm/read-bugnote.xml.phtml
   trunk/src/plugins/oslc/include/oslc-zend/application/views/scripts/codendicm/read-resource-collection.json.phtml
   trunk/src/plugins/oslc/include/oslc-zend/application/views/scripts/codendicm/read-resource-collection.phtml
   trunk/src/plugins/oslc/include/oslc-zend/application/views/scripts/codendicm/read-resource-collection.xml.phtml
   trunk/src/plugins/oslc/include/oslc-zend/application/views/scripts/codendicm/read-resource.json.phtml
   trunk/src/plugins/oslc/include/oslc-zend/application/views/scripts/codendicm/read-resource.phtml
   trunk/src/plugins/oslc/include/oslc-zend/application/views/scripts/codendicm/read-resource.xml.phtml
   trunk/src/plugins/oslc/include/oslc-zend/application/views/scripts/codendicm/show-creation-ui.phtml
   trunk/src/plugins/oslc/include/oslc-zend/application/views/scripts/codendicm/show-selection-ui.phtml
Log:
Add views for codendi OSLC-CM plugin.

Added: trunk/src/plugins/oslc/include/oslc-zend/application/views/scripts/codendicm/_add_hyperlinks.php
===================================================================
--- trunk/src/plugins/oslc/include/oslc-zend/application/views/scripts/codendicm/_add_hyperlinks.php	                        (rev 0)
+++ trunk/src/plugins/oslc/include/oslc-zend/application/views/scripts/codendicm/_add_hyperlinks.php	2010-12-03 13:51:41 UTC (rev 11696)
@@ -0,0 +1,28 @@
+<?php 
+
+
+function get_url() {
+	 $url = 'http';
+	 if ($_SERVER["HTTPS"] == "on") {$url .= "s";}
+	 $url .= "://";
+	 if ($_SERVER["SERVER_PORT"] != "80") {
+	  	$url .= $_SERVER["SERVER_NAME"].":".$_SERVER["SERVER_PORT"];
+	 } else {
+	  	$url .= $_SERVER["SERVER_NAME"];
+	 }
+	 return $url;
+}
+
+function add_href($match){
+	return '<a href="'.$match[0].'">'.$match[0].'</a>';
+}
+
+function add_links($text, $url)	{
+	$preg_url = "/".str_replace("/", "\/", $url)."[^&\"]*"."/";
+	$replacement = preg_replace_callback($preg_url, "add_href", $text);
+	return $replacement;
+}
+
+
+
+?>

Added: trunk/src/plugins/oslc/include/oslc-zend/application/views/scripts/codendicm/_resource_xml.php
===================================================================
--- trunk/src/plugins/oslc/include/oslc-zend/application/views/scripts/codendicm/_resource_xml.php	                        (rev 0)
+++ trunk/src/plugins/oslc/include/oslc-zend/application/views/scripts/codendicm/_resource_xml.php	2010-12-03 13:51:41 UTC (rev 11696)
@@ -0,0 +1,136 @@
+<?php
+
+/*
+ * This file is (c) Copyright 2009 by Olivier BERGER, Institut
+ * TELECOM
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version 2
+ * of the License, or (at your option) any later version.
+ * 
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ * 
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA.
+ *
+ * This program has been developed in the frame of the HELIOS
+ * project with financial support of its funders.
+ *
+ */
+
+/* $Id$ */
+ 
+function encodeResource($doc, $container, $resource) {
+	// oslc_cm attributes
+	foreach ($resource as $field => $value) {
+		$tokens = explode(':', $field);
+		if (count($tokens) != 2)
+			throw new Exception('Bad internal resource filed type '.$field.' : missing prefix !');
+		$prefix = $tokens[0];
+		switch ($prefix) {
+			case 'dc' :
+				$prefix = 'http://purl.org/dc/terms/';
+				break;
+			case 'helios_bt' :
+				$prefix = 'http://heliosplatform.sourceforge.net/ontologies/2010/05/helios_bt.owl';
+				break;
+			case 'mantisbt' :
+				$prefix = 'http://helios-platform.org/ontologies/mantisbt/';
+				break;
+			default :
+				throw new Exception('Unknown ontology prefix '.$prefix.' !');
+				break;
+		}
+		$element = $doc->createElementNS($prefix, $field, $resource[$field]);
+		$child = $container->appendChild($element);
+	}
+	
+	$mandatorytags = array('dc:title', 'dc:identifier');
+	
+}
+
+function createRessourceCollectionView($view){
+	$feedcharset = 'UTF-8';
+	$feedauthor = 'OSLC-CM-V1 Demo server ( '.TRACKER_TYPE.' version)';
+	if(isset($view->tracker)){
+		$feedtitle = TRACKER_TYPE.' OSLC-CM Change requests';
+	}else{
+		$feedtitle = 'All '.TRACKER_TYPE.' OSLC-CM Change requests';
+	}
+
+	$doc = new DOMDocument('1.0',$feedcharset);
+	$doc->formatOutput = true;
+
+	// process the ATOM feed header
+	$root = $doc->createElementNS("http://www.w3.org/2005/Atom", "feed");
+	$feed = $doc->appendChild($root);
+
+	$title = $doc->createElement('title', $feedtitle);
+	$child = $feed->appendChild($title);
+
+	$id = $doc->createElement('id', $view->id);
+	$child = $feed->appendChild($id);
+
+	$author = $doc->createElement('author');
+	$child = $feed->appendChild($author);
+	$name = $doc->createElement('name', $feedauthor);
+	$child = $child->appendChild($name);
+
+	// process all entries
+	foreach ($view->collection as $entry) {
+		$entryel = $doc->createElement('entry');
+		$entryel = $feed->appendChild($entryel);
+
+		$title = $doc->createElement('title', $entry['title']);
+		$child = $entryel->appendChild($title);
+
+		$id = $doc->createElement('id', $entry['id']);
+		$child = $entryel->appendChild($id);
+		$link = $doc->createElement('link');
+		$child = $entryel->appendChild($link);
+		$href = $doc->createAttribute('href');
+		$child = $child->appendChild($href);
+		$href = $doc->createTextNode($entry['id']);
+		$child = $child->appendChild($href);
+
+
+		if( count($entry['resource']) ) {
+			$content = $doc->createElement('content');
+			$content = $entryel->appendChild($content);
+			$type = $doc->createAttribute('type');
+			$child = $content->appendChild($type);
+			$type = $doc->createTextNode('application/xml');
+			$child = $child->appendChild($type);
+
+			encodeResource($doc, $content, $entry['resource']);
+		}
+	}
+	$doc->normalizeDocument();
+	return $doc->saveXML();
+}
+
+function createResourceView($view)
+{
+	$doc = new DOMDocument();
+	$doc->formatOutput = true;
+	
+	$root = $doc->createElementNS("http://www.w3.org/1999/02/22-rdf-syntax-ns#", "rdf:RDF");
+	$root = $doc->appendChild($root);
+	
+	$child = $doc->createElementNS("http://open-services.net/xmlns/cm/1.0/","oslc_cm:ChangeRequest");
+	$changerequest = $root->appendChild($child);
+	
+	$child = $doc->createAttributeNS("http://www.w3.org/1999/02/22-rdf-syntax-ns#", "rdf:about");
+	$about = $changerequest->appendChild($child);
+	$child = $doc->createTextNode($view->id);
+	$child = $about->appendChild($child);
+	
+	encodeResource($doc, $changerequest, $view->resource);
+	
+	return $doc->saveXML();
+}

Added: trunk/src/plugins/oslc/include/oslc-zend/application/views/scripts/codendicm/_service-catalog_xml.php
===================================================================
--- trunk/src/plugins/oslc/include/oslc-zend/application/views/scripts/codendicm/_service-catalog_xml.php	                        (rev 0)
+++ trunk/src/plugins/oslc/include/oslc-zend/application/views/scripts/codendicm/_service-catalog_xml.php	2010-12-03 13:51:41 UTC (rev 11696)
@@ -0,0 +1,78 @@
+<?php
+
+/*
+ * This file is (c) Copyright 2009 by Olivier BERGER, Institut
+ * TELECOM
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version 2
+ * of the License, or (at your option) any later version.
+ * 
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ * 
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA.
+ *
+ * This program has been developed in the frame of the HELIOS
+ * project with financial support of its funders.
+ *
+ */
+
+/* $Id$ */
+
+// Generate a OSLC-CM V1 Service Catalog document (http://open-services.net/bin/view/Main/OslcServiceProviderCatalogV1)
+
+function projects_to_service_catalog($base_url, $projects) {
+
+	$doc = new DOMDocument();
+	$doc->formatOutput = true;
+
+	$root = $doc->createElementNS("http://open-services.net/xmlns/discovery/1.0/", "oslc_disc:ServiceProviderCatalog");
+	$root = $doc->appendChild($root);
+
+	$child = $doc->createAttributeNS("http://www.w3.org/1999/02/22-rdf-syntax-ns#", "rdf:about");
+	$about = $root->appendChild($child);
+	$child = $doc->createTextNode("");
+	$child = $about->appendChild($child);
+
+	$child = $doc->createElementNS("http://purl.org/dc/terms/", "dc:title");
+	$title = $root->appendChild($child);
+	
+	// TODO ? : MAY have an oslc_disc:details child element. 
+	
+	$child = $doc->createTextNode(TRACKER_TYPE. " Change management service provider catalog");
+	$child = $title->appendChild($child);
+
+	foreach ($projects as $proj) {
+
+		if(count($proj)>0)
+		{
+			// entry
+			$child = $doc->createElementNS("http://open-services.net/xmlns/discovery/1.0/", "oslc_disc:entry");
+			$entry = $root->appendChild($child);
+
+			$child = $doc->createElementNS("http://open-services.net/xmlns/discovery/1.0/", "oslc_disc:ServiceProvider");
+			$sp = $entry->appendChild($child);
+
+			$child = $doc->createElementNS("http://purl.org/dc/terms/", "dc:title");
+			$title = $sp->appendChild($child);
+			$child = $doc->createTextNode($proj['name']);
+			$child = $title->appendChild($child);
+
+			$child = $doc->createElementNS("http://open-services.net/xmlns/discovery/1.0/", "oslc_disc:services");
+			$services = $sp->appendChild($child);
+			$child = $doc->createAttributeNS("http://www.w3.org/1999/02/22-rdf-syntax-ns#", "rdf:resource");
+			$resource = $services->appendChild($child);
+			$child = $doc->createTextNode($base_url.'/cm/oslc-cm-service/'.$proj['id']);
+			$child = $resource->appendChild($child);
+
+
+		}
+	}
+	return $doc->saveXML();
+}

Added: trunk/src/plugins/oslc/include/oslc-zend/application/views/scripts/codendicm/_service-document_xml.php
===================================================================
--- trunk/src/plugins/oslc/include/oslc-zend/application/views/scripts/codendicm/_service-document_xml.php	                        (rev 0)
+++ trunk/src/plugins/oslc/include/oslc-zend/application/views/scripts/codendicm/_service-document_xml.php	2010-12-03 13:51:41 UTC (rev 11696)
@@ -0,0 +1,168 @@
+<?php
+
+/*
+ * This file is (c) Copyright 2009 by Olivier BERGER, Institut
+ * TELECOM
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version 2
+ * of the License, or (at your option) any later version.
+ * 
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ * 
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA.
+ *
+ * This program has been developed in the frame of the HELIOS
+ * project with financial support of its funders.
+ *
+ */
+
+/* $Id$ */
+
+// Generate a OSLC-CM V1 Change Management Service Description document (http://open-services.net/bin/view/Main/CmServiceDescriptionV1)
+
+function project_to_service_description($base_url, $project) {
+
+	$doc = new DOMDocument();
+	$doc->formatOutput = true;
+
+	$root = $doc->createElementNS("http://open-services.net/xmlns/cm/1.0/", "oslc_cm:ServiceDescriptor");
+	$root = $doc->appendChild($root);
+
+	$child = $doc->createAttributeNS("http://www.w3.org/1999/02/22-rdf-syntax-ns#", "rdf:about");
+	$about = $root->appendChild($child);
+	$child = $doc->createTextNode("");
+	$child = $about->appendChild($child);
+
+	$child = $doc->createElementNS("http://purl.org/dc/terms/", "dc:title");
+	$title = $root->appendChild($child);
+	$child = $doc->createTextNode("Demo OSLC CM services");
+	$child = $title->appendChild($child);
+
+	// changeRequests
+	$child = $doc->createElementNS("http://open-services.net/xmlns/cm/1.0/", "oslc_cm:changeRequests");
+	$cr = $root->appendChild($child);
+
+	$child = $doc->createAttribute("version");
+	$version = $cr->appendChild($child);
+	$child = $doc->createTextNode("1.0");
+	$child = $version->appendChild($child);
+
+	// Simple GET-based URL-encoded query
+
+	$child = $doc->createElementNS("http://open-services.net/xmlns/cm/1.0/", "oslc_cm:simpleQuery");
+	$sq = $cr->appendChild($child);
+	
+	$child = $doc->createElementNS("http://purl.org/dc/terms/", "dc:title");
+	$title = $sq->appendChild($child);
+	$child = $doc->createTextNode("Simple Project Query");
+	$child = $title->appendChild($child);
+	
+	$child = $doc->createElementNS("http://open-services.net/xmlns/cm/1.0/", "oslc_cm:url");
+	$url = $sq->appendChild($child);
+	$child = $doc->createTextNode($base_url.'/cm/project/'.$project);
+	$child = $url->appendChild($child);
+	
+	// OSLC URL-encoded query
+
+	$child = $doc->createElementNS("http://open-services.net/xmlns/cm/1.0/", "oslc_cm:simpleQuery");
+	$sq = $cr->appendChild($child);
+	
+	$child = $doc->createElementNS("http://purl.org/dc/terms/", "dc:title");
+	$title = $sq->appendChild($child);
+	$child = $doc->createTextNode("OSLC Change Request Queries");
+	$child = $title->appendChild($child);
+	
+	$child = $doc->createElementNS("http://open-services.net/xmlns/cm/1.0/", "oslc_cm:url");
+	$url = $sq->appendChild($child);
+	$child = $doc->createTextNode($base_url.'/cm/bugs');
+	$child = $url->appendChild($child);
+	
+	//creation factory
+	
+	$child = $doc->createElementNS("http://open-services.net/xmlns/cm/1.0/", "oslc_cm:factory");
+	$crdl = $cr->appendChild($child);	
+	
+	$child = $doc->createAttribute("oslc_cm:default");
+	$option = $crdl->appendChild($child);
+	$child = $doc->createTextNode("true");
+	$child = $option->appendChild($child);
+	
+	$child = $doc->createElementNS("http://purl.org/dc/terms/", "dc:title");
+	$title = $crdl->appendChild($child);
+	$child = $doc->createTextNode("Location for creation of change requests");
+	$child = $title->appendChild($child);
+
+	$child = $doc->createElementNS("http://open-services.net/xmlns/cm/1.0/", "oslc_cm:url");
+	$url = $crdl->appendChild($child);
+	$child = $doc->createTextNode($base_url.'/cm/project/'.$project);
+	$child = $url->appendChild($child);
+	
+	//creation dialog
+	
+	$child = $doc->createElementNS("http://open-services.net/xmlns/cm/1.0/", "oslc_cm:creationDialog");
+	$crdl = $cr->appendChild($child);	
+	
+	$child = $doc->createAttribute("oslc_cm:default");
+	$option = $crdl->appendChild($child);
+	$child = $doc->createTextNode("true");
+	$child = $option->appendChild($child);
+	
+	$child = $doc->createAttribute("oslc_cm:hintWidth");
+	$option = $crdl->appendChild($child);
+	$child = $doc->createTextNode("740px");
+	$child = $option->appendChild($child);
+	
+	$child = $doc->createAttribute("oslc_cm:hintHeight");
+	$option = $crdl->appendChild($child);
+	$child = $doc->createTextNode("540px");
+	$child = $option->appendChild($child);
+
+	$child = $doc->createElementNS("http://purl.org/dc/terms/", "dc:title");
+	$title = $crdl->appendChild($child);
+	$child = $doc->createTextNode("New Change Request Creation Dialog");
+	$child = $title->appendChild($child);
+
+	$child = $doc->createElementNS("http://open-services.net/xmlns/cm/1.0/", "oslc_cm:url");
+	$url = $crdl->appendChild($child);
+	$child = $doc->createTextNode($base_url.'/cm/project/'.$project.'/ui/creation');
+	$child = $url->appendChild($child);
+	
+	//selection dialog
+	
+	$child = $doc->createElementNS("http://open-services.net/xmlns/cm/1.0/", "oslc_cm:selectionDialog");
+	$sldl = $cr->appendChild($child);
+	
+	$child = $doc->createAttribute("oslc_cm:default");
+	$option = $sldl->appendChild($child);
+	$child = $doc->createTextNode("true");
+	$child = $option->appendChild($child);
+	
+	$child = $doc->createAttribute("oslc_cm:hintWidth");
+	$option = $sldl->appendChild($child);
+	$child = $doc->createTextNode("800px");
+	$child = $option->appendChild($child);
+	
+	$child = $doc->createAttribute("oslc_cm:hintHeight");
+	$option = $sldl->appendChild($child);
+	$child = $doc->createTextNode("600px");
+	$child = $option->appendChild($child);
+	
+	$child = $doc->createElementNS("http://purl.org/dc/terms/", "dc:title");
+	$title = $sldl->appendChild($child);
+	$child = $doc->createTextNode("Change Request Selection Dialog");
+	$child = $title->appendChild($child);
+
+	$child = $doc->createElementNS("http://open-services.net/xmlns/cm/1.0/", "oslc_cm:url");
+	$url = $sldl->appendChild($child);
+	$child = $doc->createTextNode($base_url.'/cm/project/'.$project.'/ui/selection');
+	$child = $url->appendChild($child);
+
+	return $doc->saveXML();
+}
\ No newline at end of file

Added: trunk/src/plugins/oslc/include/oslc-zend/application/views/scripts/codendicm/index.phtml
===================================================================
--- trunk/src/plugins/oslc/include/oslc-zend/application/views/scripts/codendicm/index.phtml	                        (rev 0)
+++ trunk/src/plugins/oslc/include/oslc-zend/application/views/scripts/codendicm/index.phtml	2010-12-03 13:51:41 UTC (rev 11696)
@@ -0,0 +1,31 @@
+<?php
+
+$tracker = 'unknown';
+
+switch (TRACKER_TYPE) {
+	case 'mantis':
+		$tracker = 'Mantis';
+		break;
+	case 'fusionforge':
+		$tracker = 'FusionForge';
+		break;
+	case 'demo':
+		$tracker = 'Demo Server';
+		break;
+	default:
+		$tracker = 'Unknown';
+		break;
+}
+?>
+<body>
+<h1><?php echo 'Thanks for using this '.$tracker.' OSLC-CM V1 compatible REST server' ?></h1>
+
+<p>To test, please access one of the following links, using the proper "Accept:" content type header :</p>
+<ul>
+	<li>
+	<p><tt>curl -H "Accept: application/x-oslc-disc-service-provider-catalog+xml" -X GET <a 
+		href="<?php echo $this->baseUrl().'/cm/oslc-services/' ?>">
+		.../cm/oslc-services/</a></tt> : to retrieve an RDF/XML OSLC Service Provider Catalog document.</p>
+	</li>
+</ul>
+</body>

Added: trunk/src/plugins/oslc/include/oslc-zend/application/views/scripts/codendicm/oslc-cm-service-document.phtml
===================================================================
--- trunk/src/plugins/oslc/include/oslc-zend/application/views/scripts/codendicm/oslc-cm-service-document.phtml	                        (rev 0)
+++ trunk/src/plugins/oslc/include/oslc-zend/application/views/scripts/codendicm/oslc-cm-service-document.phtml	2010-12-03 13:51:41 UTC (rev 11696)
@@ -0,0 +1,58 @@
+<?php
+
+/**
+ * This file is (c) Copyright 2010 by Olivier Berger, Institut
+ * TELECOM
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version 2
+ * of the License, or (at your option) any later version.
+ * 
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ * 
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA.
+ *
+ * This program has been developed in the frame of the HELIOS
+ * project with financial support of its funders.
+ *
+ */
+
+  /* $Id$ */
+
+require('_service-document_xml.php');
+require('_add_hyperlinks.php');
+
+
+/*$child = $doc->createElementNS("http://open-services.net/xmlns/discovery/1.0/", "oslc_disc:ServiceProvider");
+$sp = $entry->appendChild($child);
+
+$child = $doc->createElementNS("http://purl.org/dc/terms/", "dc:title");
+$title = $sp->appendChild($child);
+$child = $doc->createTextNode("Demo OSLC CM service provider");
+$child = $title->appendChild($child);
+
+$child = $doc->createElementNS("http://open-services.net/xmlns/discovery/1.0/", "oslc_disc:services");
+$serv = $sp->appendChild($child);
+$child = $doc->createAttributeNS("http://www.w3.org/1999/02/22-rdf-syntax-ns#", "rdf:resource");
+$service = $serv->appendChild($child);
+$child = $doc->createTextNode($this->baseUrl().'/cm/oslc-cm-service');
+$child = $service->appendChild($child);*/
+?>
+<body>
+<h1>OSLC-CM V1 Service Description document</h1>
+<pre>
+<?php
+	$xml = project_to_service_description($this->baseUrl(), $this->project);
+	$text = str_replace('>', '&gt;', str_replace('<', '&lt;', $xml));
+	$text = add_links($text, "http");
+	$text = add_links($text, $this->baseUrl());
+	echo $text;?>
+</pre>
+</body>
+

Added: trunk/src/plugins/oslc/include/oslc-zend/application/views/scripts/codendicm/oslc-cm-service-document.xml.phtml
===================================================================
--- trunk/src/plugins/oslc/include/oslc-zend/application/views/scripts/codendicm/oslc-cm-service-document.xml.phtml	                        (rev 0)
+++ trunk/src/plugins/oslc/include/oslc-zend/application/views/scripts/codendicm/oslc-cm-service-document.xml.phtml	2010-12-03 13:51:41 UTC (rev 11696)
@@ -0,0 +1,30 @@
+<?php
+
+/**
+ * This file is (c) Copyright 2010 by Olivier Berger, Institut
+ * TELECOM
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version 2
+ * of the License, or (at your option) any later version.
+ * 
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ * 
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA.
+ *
+ * This program has been developed in the frame of the HELIOS
+ * project with financial support of its funders.
+ *
+ */
+
+  /* $Id$ */
+
+require('_service-document_xml.php');
+
+print project_to_service_description($this->baseUrl(), $this->project);
\ No newline at end of file

Added: trunk/src/plugins/oslc/include/oslc-zend/application/views/scripts/codendicm/oslc-service-catalog.json.phtml
===================================================================
--- trunk/src/plugins/oslc/include/oslc-zend/application/views/scripts/codendicm/oslc-service-catalog.json.phtml	                        (rev 0)
+++ trunk/src/plugins/oslc/include/oslc-zend/application/views/scripts/codendicm/oslc-service-catalog.json.phtml	2010-12-03 13:51:41 UTC (rev 11696)
@@ -0,0 +1,14 @@
+<?php
+
+$json["dc:title"] = TRACKER_TYPE. " Change management service provider catalog";
+foreach ($this->projects as $proj)
+{
+	$service["oslc_disc:entry"]["oslc_disc:ServiceProvider"]["dc:title"] = $proj["name"];
+	$service["oslc_disc:entry"]["oslc_disc:ServiceProvider"]["oslc_disc:services"] = $this->baseUrl().'/cm/oslc-cm-service/'.$proj['id'];
+	$catalog[] = $service;
+}
+
+$json["oslc_disc:ServiceProviderCatalog"] = $catalog;
+
+
+print str_replace("\/", "/", Zend_Json::prettyPrint(Zend_Json::encode($json)));
\ No newline at end of file

Added: trunk/src/plugins/oslc/include/oslc-zend/application/views/scripts/codendicm/oslc-service-catalog.phtml
===================================================================
--- trunk/src/plugins/oslc/include/oslc-zend/application/views/scripts/codendicm/oslc-service-catalog.phtml	                        (rev 0)
+++ trunk/src/plugins/oslc/include/oslc-zend/application/views/scripts/codendicm/oslc-service-catalog.phtml	2010-12-03 13:51:41 UTC (rev 11696)
@@ -0,0 +1,58 @@
+<?php
+
+/**
+ * This file is (c) Copyright 2010 by Olivier Berger, Institut
+ * TELECOM
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version 2
+ * of the License, or (at your option) any later version.
+ * 
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ * 
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA.
+ *
+ * This program has been developed in the frame of the HELIOS
+ * project with financial support of its funders.
+ *
+ */
+
+  /* $Id$ */
+
+require('_service-catalog_xml.php');
+require('_add_hyperlinks.php');
+
+/*$child = $doc->createElementNS("http://open-services.net/xmlns/discovery/1.0/", "oslc_disc:ServiceProvider");
+$sp = $entry->appendChild($child);
+
+$child = $doc->createElementNS("http://purl.org/dc/terms/", "dc:title");
+$title = $sp->appendChild($child);
+$child = $doc->createTextNode("Demo OSLC CM service provider");
+$child = $title->appendChild($child);
+
+$child = $doc->createElementNS("http://open-services.net/xmlns/discovery/1.0/", "oslc_disc:services");
+$serv = $sp->appendChild($child);
+$child = $doc->createAttributeNS("http://www.w3.org/1999/02/22-rdf-syntax-ns#", "rdf:resource");
+$service = $serv->appendChild($child);
+$child = $doc->createTextNode($this->baseUrl().'/cm/oslc-cm-service');
+$child = $service->appendChild($child);*/
+?>
+<body>
+<h1>OSLC-CM V1 Service Catalog document</h1>
+<pre>
+<?php
+	$xml = projects_to_service_catalog($this->baseUrl(), $this->projects);
+	//print $xml;
+	$text = str_replace('>', '&gt;', str_replace('<', '&lt;', $xml));
+	$text = add_links($text, "http");
+	$text = add_links($text, $this->baseUrl());
+	echo $text;?>
+</pre>
+</body>
+

Added: trunk/src/plugins/oslc/include/oslc-zend/application/views/scripts/codendicm/oslc-service-catalog.xml.phtml
===================================================================
--- trunk/src/plugins/oslc/include/oslc-zend/application/views/scripts/codendicm/oslc-service-catalog.xml.phtml	                        (rev 0)
+++ trunk/src/plugins/oslc/include/oslc-zend/application/views/scripts/codendicm/oslc-service-catalog.xml.phtml	2010-12-03 13:51:41 UTC (rev 11696)
@@ -0,0 +1,30 @@
+<?php
+
+/**
+ * This file is (c) Copyright 2010 by Olivier Berger, Institut
+ * TELECOM
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version 2
+ * of the License, or (at your option) any later version.
+ * 
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ * 
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA.
+ *
+ * This program has been developed in the frame of the HELIOS
+ * project with financial support of its funders.
+ *
+ */
+
+  /* $Id$ */
+
+require('_service-catalog_xml.php');
+
+print projects_to_service_catalog($this->baseUrl(), $this->projects);

Added: trunk/src/plugins/oslc/include/oslc-zend/application/views/scripts/codendicm/post.phtml
===================================================================
--- trunk/src/plugins/oslc/include/oslc-zend/application/views/scripts/codendicm/post.phtml	                        (rev 0)
+++ trunk/src/plugins/oslc/include/oslc-zend/application/views/scripts/codendicm/post.phtml	2010-12-03 13:51:41 UTC (rev 11696)
@@ -0,0 +1 @@
+<?php

Added: trunk/src/plugins/oslc/include/oslc-zend/application/views/scripts/codendicm/put.phtml
===================================================================
--- trunk/src/plugins/oslc/include/oslc-zend/application/views/scripts/codendicm/put.phtml	                        (rev 0)
+++ trunk/src/plugins/oslc/include/oslc-zend/application/views/scripts/codendicm/put.phtml	2010-12-03 13:51:41 UTC (rev 11696)
@@ -0,0 +1 @@
+<?php

Added: trunk/src/plugins/oslc/include/oslc-zend/application/views/scripts/codendicm/put.xml.phtml
===================================================================
--- trunk/src/plugins/oslc/include/oslc-zend/application/views/scripts/codendicm/put.xml.phtml	                        (rev 0)
+++ trunk/src/plugins/oslc/include/oslc-zend/application/views/scripts/codendicm/put.xml.phtml	2010-12-03 13:51:41 UTC (rev 11696)
@@ -0,0 +1,2 @@
+<?php
+

Added: trunk/src/plugins/oslc/include/oslc-zend/application/views/scripts/codendicm/read-bugnote-collection.json.phtml
===================================================================
--- trunk/src/plugins/oslc/include/oslc-zend/application/views/scripts/codendicm/read-bugnote-collection.json.phtml	                        (rev 0)
+++ trunk/src/plugins/oslc/include/oslc-zend/application/views/scripts/codendicm/read-bugnote-collection.json.phtml	2010-12-03 13:51:41 UTC (rev 11696)
@@ -0,0 +1,40 @@
+<?php
+
+  /* 
+   * This file is (c) Copyright 2009 by Olivier BERGER, Institut
+   * TELECOM
+   *
+   * Use, modification, redistribution of this software are subject to
+   * the terms of the NEW BSD License, whose text can be found in the
+   * 'COPYING' file that is distributed along with the software archive.
+   *
+   * Thus you may use it at your own risk, of course !
+   *
+   * This program has been developed in the frame of the HELIOS
+   * project with financial support of its funders.
+   *
+   */
+
+  /* $Id$ */
+
+$entriescount = count($this->collection);
+
+$json = array('oslc_cm:totalCount' => $entriescount);
+
+$resources = array();
+
+foreach ($this->collection as $resource) {
+	$newresource = array();
+	$newresource['rdf:about'] = $resource['id'];
+	foreach ($resource['resource'] as $key => $value) {
+		$newresource[$key] = $value;
+	}
+	$resources[] = $newresource;
+}
+
+$json['oslc_cm:results'] = $resources;
+
+//print_r($json);
+
+
+print str_replace("\/", "/", Zend_Json::prettyPrint(Zend_Json::encode($json)));
\ No newline at end of file

Added: trunk/src/plugins/oslc/include/oslc-zend/application/views/scripts/codendicm/read-bugnote-collection.phtml
===================================================================
--- trunk/src/plugins/oslc/include/oslc-zend/application/views/scripts/codendicm/read-bugnote-collection.phtml	                        (rev 0)
+++ trunk/src/plugins/oslc/include/oslc-zend/application/views/scripts/codendicm/read-bugnote-collection.phtml	2010-12-03 13:51:41 UTC (rev 11696)
@@ -0,0 +1,49 @@
+<html>
+<body>
+<?php
+
+/*
+ * This file is (c) Copyright 2009 by Olivier BERGER, Institut
+ * TELECOM
+ *
+ * Use, modification, redistribution of this software are subject to
+ * the terms of the NEW BSD License, whose text can be found in the
+ * 'COPYING' file that is distributed along with the software archive.
+ *
+ * Thus you may use it at your own risk, of course !
+ *
+ * This program has been developed in the frame of the HELIOS
+ * project with financial support of its funders.
+ *
+ */
+
+/* $Id$ */
+
+require_once('_resource_xml.php');
+require('_add_hyperlinks.php');
+
+$tracker = 'unknown';
+
+switch (TRACKER_TYPE) {
+	case 'mantis':
+		$tracker = 'Mantis';
+		break;
+	case 'fusionforge':
+		$tracker = 'FusionForge';
+		break;
+	case 'demo':
+		$tracker = 'Demo Server';
+		break;
+	default:
+		$tracker = 'Unknown';
+		break;
+}
+
+print '<h1>'.$tracker.' Change Requests Comments:</h1>';
+$xml = createRessourceCollectionView($this);
+$text = str_replace('>', '&gt;', str_replace('<', '&lt;', $xml));
+$text = add_links($text, "http");
+print '<pre>'.$text.'</pre>';?>
+
+</body>
+</html>
\ No newline at end of file

Added: trunk/src/plugins/oslc/include/oslc-zend/application/views/scripts/codendicm/read-bugnote-collection.xml.phtml
===================================================================
--- trunk/src/plugins/oslc/include/oslc-zend/application/views/scripts/codendicm/read-bugnote-collection.xml.phtml	                        (rev 0)
+++ trunk/src/plugins/oslc/include/oslc-zend/application/views/scripts/codendicm/read-bugnote-collection.xml.phtml	2010-12-03 13:51:41 UTC (rev 11696)
@@ -0,0 +1,20 @@
+<?php
+
+/*
+ * This file is (c) Copyright 2009 by Madhumita DHAR, Institut
+ * TELECOM
+ *
+ * Use, modification, redistribution of this software are subject to
+ * the terms of the NEW BSD License, whose text can be found in the
+ * 'COPYING' file that is distributed along with the software archive.
+ *
+ * Thus you may use it at your own risk, of course !
+ *
+ * This program has been developed in the frame of the HELIOS
+ * project with financial support of its funders.
+ *
+ */
+
+require_once('_resource_xml.php');
+
+print createRessourceCollectionView($this);
\ No newline at end of file

Added: trunk/src/plugins/oslc/include/oslc-zend/application/views/scripts/codendicm/read-bugnote.json.phtml
===================================================================
--- trunk/src/plugins/oslc/include/oslc-zend/application/views/scripts/codendicm/read-bugnote.json.phtml	                        (rev 0)
+++ trunk/src/plugins/oslc/include/oslc-zend/application/views/scripts/codendicm/read-bugnote.json.phtml	2010-12-03 13:51:41 UTC (rev 11696)
@@ -0,0 +1,29 @@
+<?php
+
+
+  /* 
+   * This file is (c) Copyright 2009 by Madhumita DHAR, Institut
+   * TELECOM
+   *
+   * Use, modification, redistribution of this software are subject to
+   * the terms of the NEW BSD License, whose text can be found in the
+   * 'COPYING' file that is distributed along with the software archive.
+   *
+   * Thus you may use it at your own risk, of course !
+   *
+   * This program has been developed in the frame of the HELIOS
+   * project with financial support of its funders.
+   *
+   */
+
+  /* $Id$ */
+
+$json = array('rdf:about' => $this->id);
+foreach ($this->resource as $field => $value) {
+	$json[$field] = $value;
+}
+print str_replace("\/", "/", Zend_Json::prettyPrint(Zend_Json::encode($json)));
+
+//require('_get_response.php');
+//print $doc->saveXML();
+//print Zend_Json::fromXML();
\ No newline at end of file


Property changes on: trunk/src/plugins/oslc/include/oslc-zend/application/views/scripts/codendicm/read-bugnote.json.phtml
___________________________________________________________________
Added: svn:executable
   + *

Added: trunk/src/plugins/oslc/include/oslc-zend/application/views/scripts/codendicm/read-bugnote.phtml
===================================================================
--- trunk/src/plugins/oslc/include/oslc-zend/application/views/scripts/codendicm/read-bugnote.phtml	                        (rev 0)
+++ trunk/src/plugins/oslc/include/oslc-zend/application/views/scripts/codendicm/read-bugnote.phtml	2010-12-03 13:51:41 UTC (rev 11696)
@@ -0,0 +1,33 @@
+<html>
+<body>
+<?php
+
+require_once('_resource_xml.php');
+require('_add_hyperlinks.php');
+
+$tracker = 'unknown';
+
+switch (TRACKER_TYPE) {
+	case 'mantis':
+		$tracker = 'Mantis';
+		break;
+	case 'fusionforge':
+		$tracker = 'FusionForge';
+		break;
+	case 'demo':
+		$tracker = 'Demo Server';
+		break;
+	default:
+		$tracker = 'Unknown';
+		break;
+}
+
+print '<h1>'.$tracker.' Change Request:</h1>';
+$xml = createResourceView($this);
+$text = str_replace('>', '&gt;', str_replace('<', '&lt;', $xml));
+	$text = add_links($text, "http");
+	print '<pre>'.$text.'</pre>';
+?>
+
+</body>
+</html>

Added: trunk/src/plugins/oslc/include/oslc-zend/application/views/scripts/codendicm/read-bugnote.xml.phtml
===================================================================
--- trunk/src/plugins/oslc/include/oslc-zend/application/views/scripts/codendicm/read-bugnote.xml.phtml	                        (rev 0)
+++ trunk/src/plugins/oslc/include/oslc-zend/application/views/scripts/codendicm/read-bugnote.xml.phtml	2010-12-03 13:51:41 UTC (rev 11696)
@@ -0,0 +1,22 @@
+<?php
+
+  /* 
+   * This file is (c) Copyright 2009 by Madhumita DHAR, Institut
+   * TELECOM
+   *
+   * Use, modification, redistribution of this software are subject to
+   * the terms of the NEW BSD License, whose text can be found in the
+   * 'COPYING' file that is distributed along with the software archive.
+   *
+   * Thus you may use it at your own risk, of course !
+   *
+   * This program has been developed in the frame of the HELIOS
+   * project with financial support of its funders.
+   *
+   */
+
+  /* $Id$ */
+
+require_once('_resource_xml.php');
+
+print createResourceView($this);
\ No newline at end of file


Property changes on: trunk/src/plugins/oslc/include/oslc-zend/application/views/scripts/codendicm/read-bugnote.xml.phtml
___________________________________________________________________
Added: svn:executable
   + *

Added: trunk/src/plugins/oslc/include/oslc-zend/application/views/scripts/codendicm/read-resource-collection.json.phtml
===================================================================
--- trunk/src/plugins/oslc/include/oslc-zend/application/views/scripts/codendicm/read-resource-collection.json.phtml	                        (rev 0)
+++ trunk/src/plugins/oslc/include/oslc-zend/application/views/scripts/codendicm/read-resource-collection.json.phtml	2010-12-03 13:51:41 UTC (rev 11696)
@@ -0,0 +1,40 @@
+<?php
+
+  /* 
+   * This file is (c) Copyright 2009 by Olivier BERGER, Institut
+   * TELECOM
+   *
+   * Use, modification, redistribution of this software are subject to
+   * the terms of the NEW BSD License, whose text can be found in the
+   * 'COPYING' file that is distributed along with the software archive.
+   *
+   * Thus you may use it at your own risk, of course !
+   *
+   * This program has been developed in the frame of the HELIOS
+   * project with financial support of its funders.
+   *
+   */
+
+  /* $Id$ */
+
+$entriescount = count($this->collection);
+
+$json = array('oslc_cm:totalCount' => $entriescount);
+
+$resources = array();
+
+foreach ($this->collection as $resource) {
+	$newresource = array();
+	$newresource['rdf:about'] = $resource['id'];
+	foreach ($resource['resource'] as $key => $value) {
+		$newresource[$key] = $value;
+	}
+	$resources[] = $newresource;
+}
+
+$json['oslc_cm:results'] = $resources;
+
+//print_r($json);
+
+
+print str_replace("\/", "/", Zend_Json::prettyPrint(Zend_Json::encode($json)));
\ No newline at end of file

Added: trunk/src/plugins/oslc/include/oslc-zend/application/views/scripts/codendicm/read-resource-collection.phtml
===================================================================
--- trunk/src/plugins/oslc/include/oslc-zend/application/views/scripts/codendicm/read-resource-collection.phtml	                        (rev 0)
+++ trunk/src/plugins/oslc/include/oslc-zend/application/views/scripts/codendicm/read-resource-collection.phtml	2010-12-03 13:51:41 UTC (rev 11696)
@@ -0,0 +1,49 @@
+<html>
+<body>
+<?php
+
+/*
+ * This file is (c) Copyright 2009 by Olivier BERGER, Institut
+ * TELECOM
+ *
+ * Use, modification, redistribution of this software are subject to
+ * the terms of the NEW BSD License, whose text can be found in the
+ * 'COPYING' file that is distributed along with the software archive.
+ *
+ * Thus you may use it at your own risk, of course !
+ *
+ * This program has been developed in the frame of the HELIOS
+ * project with financial support of its funders.
+ *
+ */
+
+/* $Id$ */
+
+require_once('_resource_xml.php');
+require('_add_hyperlinks.php');
+
+$tracker = 'unknown';
+
+switch (TRACKER_TYPE) {
+	case 'mantis':
+		$tracker = 'Mantis';
+		break;
+	case 'fusionforge':
+		$tracker = 'FusionForge';
+		break;
+	case 'demo':
+		$tracker = 'Demo Server';
+		break;
+	default:
+		$tracker = 'Unknown';
+		break;
+}
+
+print '<h1>'.$tracker.' Change Requests:</h1>';
+$xml = createRessourceCollectionView($this);
+$text = str_replace('>', '&gt;', str_replace('<', '&lt;', $xml));
+$text = add_links($text, "http");
+print '<pre>'.$text.'</pre>';?>
+
+</body>
+</html>

Added: trunk/src/plugins/oslc/include/oslc-zend/application/views/scripts/codendicm/read-resource-collection.xml.phtml
===================================================================
--- trunk/src/plugins/oslc/include/oslc-zend/application/views/scripts/codendicm/read-resource-collection.xml.phtml	                        (rev 0)
+++ trunk/src/plugins/oslc/include/oslc-zend/application/views/scripts/codendicm/read-resource-collection.xml.phtml	2010-12-03 13:51:41 UTC (rev 11696)
@@ -0,0 +1,22 @@
+<?php
+
+/*
+ * This file is (c) Copyright 2009 by Olivier BERGER, Institut
+ * TELECOM
+ *
+ * Use, modification, redistribution of this software are subject to
+ * the terms of the NEW BSD License, whose text can be found in the
+ * 'COPYING' file that is distributed along with the software archive.
+ *
+ * Thus you may use it at your own risk, of course !
+ *
+ * This program has been developed in the frame of the HELIOS
+ * project with financial support of its funders.
+ *
+ */
+
+/* $Id$ */
+
+require_once('_resource_xml.php');
+
+print createRessourceCollectionView($this);
\ No newline at end of file

Added: trunk/src/plugins/oslc/include/oslc-zend/application/views/scripts/codendicm/read-resource.json.phtml
===================================================================
--- trunk/src/plugins/oslc/include/oslc-zend/application/views/scripts/codendicm/read-resource.json.phtml	                        (rev 0)
+++ trunk/src/plugins/oslc/include/oslc-zend/application/views/scripts/codendicm/read-resource.json.phtml	2010-12-03 13:51:41 UTC (rev 11696)
@@ -0,0 +1,29 @@
+<?php
+
+
+  /* 
+   * This file is (c) Copyright 2009 by Madhumita DHAR, Institut
+   * TELECOM
+   *
+   * Use, modification, redistribution of this software are subject to
+   * the terms of the NEW BSD License, whose text can be found in the
+   * 'COPYING' file that is distributed along with the software archive.
+   *
+   * Thus you may use it at your own risk, of course !
+   *
+   * This program has been developed in the frame of the HELIOS
+   * project with financial support of its funders.
+   *
+   */
+
+  /* $Id$ */
+
+$json = array('rdf:about' => $this->id);
+foreach ($this->resource as $field => $value) {
+	$json[$field] = $value;
+}
+print str_replace("\/", "/", Zend_Json::prettyPrint(Zend_Json::encode($json)));
+
+//require('_get_response.php');
+//print $doc->saveXML();
+//print Zend_Json::fromXML();
\ No newline at end of file


Property changes on: trunk/src/plugins/oslc/include/oslc-zend/application/views/scripts/codendicm/read-resource.json.phtml
___________________________________________________________________
Added: svn:executable
   + *

Added: trunk/src/plugins/oslc/include/oslc-zend/application/views/scripts/codendicm/read-resource.phtml
===================================================================
--- trunk/src/plugins/oslc/include/oslc-zend/application/views/scripts/codendicm/read-resource.phtml	                        (rev 0)
+++ trunk/src/plugins/oslc/include/oslc-zend/application/views/scripts/codendicm/read-resource.phtml	2010-12-03 13:51:41 UTC (rev 11696)
@@ -0,0 +1,33 @@
+<html>
+<body>
+<?php
+
+require_once('_resource_xml.php');
+require('_add_hyperlinks.php');
+
+$tracker = 'unknown';
+
+switch (TRACKER_TYPE) {
+	case 'mantis':
+		$tracker = 'Mantis';
+		break;
+	case 'fusionforge':
+		$tracker = 'FusionForge';
+		break;
+	case 'demo':
+		$tracker = 'Demo Server';
+		break;
+	default:
+		$tracker = 'Unknown';
+		break;
+}
+
+print '<h1>'.$tracker.' Change Request:</h1>';
+$xml = createResourceView($this);
+$text = str_replace('>', '&gt;', str_replace('<', '&lt;', $xml));
+$text = add_links($text, "http");
+print '<pre>'.$text.'</pre>';
+?>
+
+</body>
+</html>

Added: trunk/src/plugins/oslc/include/oslc-zend/application/views/scripts/codendicm/read-resource.xml.phtml
===================================================================
--- trunk/src/plugins/oslc/include/oslc-zend/application/views/scripts/codendicm/read-resource.xml.phtml	                        (rev 0)
+++ trunk/src/plugins/oslc/include/oslc-zend/application/views/scripts/codendicm/read-resource.xml.phtml	2010-12-03 13:51:41 UTC (rev 11696)
@@ -0,0 +1,22 @@
+<?php
+
+  /* 
+   * This file is (c) Copyright 2009 by Madhumita DHAR, Institut
+   * TELECOM
+   *
+   * Use, modification, redistribution of this software are subject to
+   * the terms of the NEW BSD License, whose text can be found in the
+   * 'COPYING' file that is distributed along with the software archive.
+   *
+   * Thus you may use it at your own risk, of course !
+   *
+   * This program has been developed in the frame of the HELIOS
+   * project with financial support of its funders.
+   *
+   */
+
+  /* $Id$ */
+
+require_once('_resource_xml.php');
+
+print createResourceView($this);
\ No newline at end of file


Property changes on: trunk/src/plugins/oslc/include/oslc-zend/application/views/scripts/codendicm/read-resource.xml.phtml
___________________________________________________________________
Added: svn:executable
   + *

Added: trunk/src/plugins/oslc/include/oslc-zend/application/views/scripts/codendicm/show-creation-ui.phtml
===================================================================
--- trunk/src/plugins/oslc/include/oslc-zend/application/views/scripts/codendicm/show-creation-ui.phtml	                        (rev 0)
+++ trunk/src/plugins/oslc/include/oslc-zend/application/views/scripts/codendicm/show-creation-ui.phtml	2010-12-03 13:51:41 UTC (rev 11696)
@@ -0,0 +1,511 @@
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
+"http://www.w3.org/TR/html4/loose.dtd">
+<?php 
+
+	$project = $this->data['project'];
+		
+	//type
+	//reproducibility
+	//severity
+	//priority
+	//platform //os //os_build ????
+	//product version
+	//product build
+	//assigned to (handler)
+	//target version
+	//summary
+	//description
+	//steps to reproduce
+	//additional info
+	//custom field
+	//view status
+	
+	/*
+	 * @import "http://ajax.googleapis.com/ajax/libs/dojo/1.5/dojox/grid/resources/Grid.css";
+		@import url("http://ajax.googleapis.com/ajax/libs/dojo/1.5/dijit/themes/soria/soria.css");
+		
+	 */
+	
+?>
+<html xmlns="http://www.w3.org/1999/xhtml">
+    <head>
+        <title>OSLC Creation UI</title>
+        <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
+		<style type="text/css">
+		@import url("/javascript/dojox/grid/resources/Grid.css");
+		@import url("/javascript/dijit/themes/soria/soria.css");
+		
+		body { 	font: 13px Myriad,Arial,Helvetica,clean,sans-serif; 	
+				*font-size: small;	
+				*font: x-small;}
+				
+		h1 {	font-size: 1.5em; 	
+				font-weight: normal;	
+				line-height: 1em; 	
+				margin-top: 1em;	
+				margin-bottom:0;}
+				
+		h2 { 	font-size: 1.1667em;
+				font-weight: bold; 	
+				line-height: 1.286em; 	
+				margin-top: 1.929em; 	
+				margin-bottom:0.643em;}
+		
+		h3, h4, h5, h6 {	font-size: 1em; 	
+							font-weight: bold; 	
+							line-height: 1.5em; 	
+							margin-top: 1.5em; 	
+							margin-bottom: 0;}
+							
+		p { 	font-size: 1em;
+				margin-top: 1.5em;
+				margin-bottom: 1.5em;
+				line-height: 1.5em;}
+		
+		body {
+			margin: 2em;
+		}
+		
+		table td {
+			padding: 2px;
+		}
+		
+		</style>
+        <script type="text/javascript" src="/javascript/dojo/dojo.js"
+			djconfig="parseOnLoad:true">
+		</script>
+        <script type="text/javascript">
+        dojo.require("dojox.encoding.base64");
+
+        var project = "<?php echo $project;?>";
+        var URL = '<?php echo $this->baseUrl(); ?>'+"/cm/project/"+project;
+        var result;
+        var postdata;
+        var userpass;
+        var error = false;
+
+        var convertToByteArray = function(data){
+            var bin=[] ;
+            for (var i=0; i<data.length; i++){
+            	bin.push(data.charCodeAt(i));
+            }
+            return bin;
+        }
+
+        var createCR = function()	{
+            createBugData();
+            if(!error)	{
+                var xhrArgs = {
+	                    url: URL,
+	                    postData: dojo.toJson(postdata),
+	                    headers: {	'Content-Type': "application/x-oslc-cm-change-request+json",
+									'Authorization': "Basic " + dojox.encoding.base64.encode(convertToByteArray(userpass))
+								},
+	                    load: function(data, ioArgs) {
+	                  	  	alert("The url of the bug just created is: "+data);                  	 	                        
+	                     	result = data;
+	                     	refresh();
+	                    },
+	                    error: function(err, ioargs) {
+	                    	var response = dojo.fromJson(ioargs.xhr.responseText);
+	                    	var errmsg, errcode;
+	                    	for (var key in response) {
+	  							var obj = response[key];						   
+	  							if(key=="oslc_cm:Error")   {
+	  							   for (var i in obj) {
+	  								  if(i=="oslc_cm:statusCode")	{
+	  									  errcode = obj[i];
+	  								  }else if(i=="oslc_cm:message")	{
+	  									  errmsg = obj[i];
+	  								  } 
+	  							   }
+	  							   var errtext = "Error " + errcode + ": " + errmsg;
+	  							   alert(errtext);
+	  						   }
+	  						}
+	                	}
+	                }			
+				dojo.xhrPost(xhrArgs);
+            }
+        }
+
+        var createBugData = function()	{
+            error = false;
+        	var user = dojo.trim(dojo.byId("usertext").value);
+            var pass = dojo.trim(dojo.byId("passtext").value);
+
+            if(user=="")	{
+                alert("User field is empty!");
+                error = true;
+                return;
+            }else if((user!="")&&(pass==""))	{
+                alert("Password field is empty!");
+                error = true;
+                return;
+            }else if(!user.match(/^[a-zA-Z0-9\s-\.+_]+$/))	{
+                alert("Invalid user name!");
+                error = true;
+                return;
+            }
+            
+			postdata = {};
+			var temp = dojo.trim(dojo.byId("titletext").value);
+			if(temp=="")	{
+				alert("Bug Title cannot be empty!");
+				error = true;
+                return;
+			}else	{
+				postdata['dc:title'] = temp;
+			}
+
+			temp = dojo.trim(dojo.byId("descriptiontext").value);
+			if(temp=="")	{
+				alert("Bug description cannot be empty!");
+				error = true;
+                return;
+			}else	{
+				postdata['dc:description'] = temp;
+			}
+
+			temp = dojo.trim(dojo.byId("stepstext").value);
+			if(temp!="")	{
+				postdata['mantisbt:steps_to_reproduce'] = temp;
+			}
+
+			temp = dojo.trim(dojo.byId("additionalinfotext").value);
+			if(temp!="")	{
+				postdata['mantisbt:additional_information'] = temp;
+			}
+
+			temp = dojo.trim(dojo.byId("categorylist").value);
+			if(temp=="none selected")	{
+				alert("Bug Category cannot be empty!");
+				error = true;
+                return;
+			}else	{
+				postdata['dc:type'] = temp;
+			}
+
+			temp = dojo.trim(dojo.byId("reproducibilitylist").value);
+			if(temp!="none selected")	{
+				postdata['mantisbt:reproducibility'] = temp;
+			}
+
+			temp = dojo.trim(dojo.byId("prioritylist").value);
+			if(temp!="none selected")	{
+				postdata['mantisbt:priority'] = temp;
+			}
+
+			temp = dojo.trim(dojo.byId("severitylist").value);
+			if(temp!="none selected")	{
+				postdata['mantisbt:severity'] = temp;
+			}
+
+			postdata['dc:creator'] = user;
+
+			var version = "<?php if(array_key_exists('product_version', $this->data)) echo "true";?>";
+			if(version=="true")	{
+				temp = dojo.trim(dojo.byId("productversionlist").value);
+				if(temp!="none selected")	{
+					postdata['mantisbt:version'] = temp;
+				}
+				temp = dojo.trim(dojo.byId("targetversionlist").value);
+				if(temp!="none selected")	{
+					postdata['mantisbt:target_version'] = temp;
+				}
+			}
+
+			if(dojo.byId("vspublic").checked==true)	{
+				postdata['mantisbt:view_state'] = "public";
+			}else if(dojo.byId("vsprivate").checked==true)	{
+				postdata['mantisbt:view_state'] = "private";
+			}
+			
+			//alert(postdata.toSource());
+			userpass = user + ":" + pass;
+			
+        }
+        
+        var creatensendCR = function()	{
+			createBugData();
+			if(!error)	{
+				
+				var xhrArgs = {
+	                    url: URL,
+	                    postData: dojo.toJson(postdata),
+	                    headers: {	'Content-Type': "application/x-oslc-cm-change-request+json",
+									'Authorization': "Basic " + dojox.encoding.base64.encode(convertToByteArray(userpass))
+								},
+	                    load: function(data, ioArgs) {
+	                  	  	alert("The url of the bug just created is: "+data);                  	 	                        
+	                     	result = data;
+	                     	postdata['rdf:resource'] = result;
+	        				postdata['oslc_cm:label'] = postdata['dc:title'];
+	        				postdataArr = [];
+	        				postdataArr.push(postdata);
+	        				var datatosend = {'oslc_cm:results': postdataArr};
+	        				datatosend = datatosend.toSource();
+	        				refresh();
+	        				//alert(datatosend);
+	        				respondWithPostMessage(datatosend);
+	                    },
+	                    error: function(err, ioargs) {
+	                    	var response = dojo.fromJson(ioargs.xhr.responseText);
+	                    	var errmsg, errcode;
+	                    	for (var key in response) {
+	  							var obj = response[key];						   
+	  							if(key=="oslc_cm:Error")   {
+	  							   for (var i in obj) {
+	  								  if(i=="oslc_cm:statusCode")	{
+	  									  errcode = obj[i];
+	  								  }else if(i=="oslc_cm:message")	{
+	  									  errmsg = obj[i];
+	  								  } 
+	  							   }
+	  							   var errtext = "Error " + errcode + ": " + errmsg;
+	  							   alert(errtext);
+	  						   }
+	  						}
+	                  	}
+	                }
+				
+				dojo.xhrPost(xhrArgs);
+			}
+			
+        }
+
+		function respondWithPostMessage(/*string*/ response) {
+            window.parent.postMessage("oslc-response:" + response, "*");
+            //TODO if window is not parented window.postMessage to be used
+            //which shud be ignored
+         }
+
+		var init = function()	{			
+			createconnect = dojo.connect(dojo.byId("createbutton"), "onclick", createCR);
+			creatensendconnect = dojo.connect(dojo.byId("creatensendbutton"), "onclick", creatensendCR);			
+		}
+
+		var refresh = function()	{
+			dojo.query(".textclass").forEach(
+                    function(item, index, array)	{
+						item.value = "";
+					});
+		
+			dojo.query(".listclass").forEach(
+                    function(item, index, array)	{
+						item.selectedIndex = 0;
+					});
+			
+		}
+
+		dojo.addOnLoad(init);
+
+        
+        </script>
+    </head>
+    <body>
+        <h1><?php echo strtoupper($project); ?>: Creation UI for OSLC</h1><hr/>
+        <!-- <p>some details of the query and blah blah to be added here</p> -->
+        
+        <br>
+        <!-- <p><b>Project: <?php echo $project ?></b></p> -->
+        <table>
+        	     		
+        </table>
+        <table border=1>        
+        <tr><td>
+	        <table CELLSPACING=2 CELLPADDING=2 id="main">
+	        	<tr><td><fieldset>
+        		<legend><em>User</em></legend>
+        		<input id="usertext" type=text>
+        		</fieldset>
+        		</td><td><fieldset>
+        		<legend><em>Password</em></legend>
+        		<input id="passtext" type=password>
+        		</fieldset>
+        		</td>
+        		</tr>
+        		<tr><td width=50% valign="top">
+	        	<fieldset>
+        		<legend><em>Title *</em></legend>
+		        <table>
+					<tr>
+						<td><input class="textclass" id="titletext" size="40" type=text></td>
+					</tr>
+				</table>
+				</fieldset>
+				</td>
+				<td width=50%>
+	        	<fieldset>
+        		<legend><em>Description *</em></legend>
+		        <table>
+					<tr>
+						<td><textarea class="textclass" id="descriptiontext" cols="40" rows="3"></textarea></td>
+					</tr>
+				</table>
+				</fieldset>
+				</td></tr>
+				<tr><td width=50% valign="top">
+	        	<fieldset>
+        		<legend><em>Steps to reproduce</em></legend>
+		        <table>
+					<tr>
+						<td><textarea class="textclass" id="stepstext" cols="40" rows="3"></textarea></td>
+					</tr>
+				</table>
+				</fieldset>
+				</td>
+				<td width=50%>
+	        	<fieldset>
+        		<legend><em>Additional information</em></legend>
+		        <table>
+					<tr>
+						<td><textarea class="textclass" id="additionalinfotext" cols="40" rows="3"></textarea></td>
+					</tr>
+				</table>
+				</fieldset>
+				</td></tr>
+				<tr><td width=50%>
+	        	<fieldset>
+        		<legend><em>Category *</em></legend>
+		        <table>
+					<tr>
+						<td><select class="listclass" id="categorylist">
+							<option value="none selected" selected="selected">Select</option>
+							<?php 
+							foreach ($this->data['category_id'] as $value) {
+								echo '<option value="'.$value.'">'.$value.'</option>';
+								
+							}
+							?>			  			
+							</select>
+						</td>
+					</tr>
+				</table>
+				</fieldset>
+				</td>
+				<td width=50%>
+	        	<fieldset>
+        		<legend><em>Reproducibility</em></legend>
+		        <table>
+					<tr>
+						<td><select class="listclass" id="reproducibilitylist">
+							<option value="none selected" selected="selected">Select</option>
+							<?php 
+							foreach ($this->data['reproducibility'] as $value) {
+								echo '<option value="'.$value.'">'.$value.'</option>';
+							}
+							?>			  			
+							</select>
+						</td>
+					</tr>
+				</table>
+				</fieldset>
+				</td></tr>
+				<tr><td width=50%>
+	        	<fieldset>
+        		<legend><em>Priority</em></legend>
+		        <table>
+					<tr>
+						<td><select class="listclass" id="prioritylist">
+							<option value="none selected" selected="selected">Select</option>
+							<?php 
+							foreach ($this->data['priority'] as $value) {
+								echo '<option value="'.$value.'">'.$value.'</option>';
+								
+							}
+							?>			  			
+							</select>
+						</td>
+					</tr>
+				</table>
+				</fieldset>
+				</td>
+				<td width=50%>
+	        	<fieldset>
+        		<legend><em>Severity</em></legend>
+		        <table>
+					<tr>
+						<td><select class="listclass" id="severitylist">
+							<option value="none selected" selected="selected">Select</option>
+							<?php 
+							foreach ($this->data['severity'] as $value) {
+								echo '<option value="'.$value.'">'.$value.'</option>';
+							}
+							?>			  			
+							</select>
+						</td>
+					</tr>
+				</table>
+				</fieldset>
+				</td></tr>
+				<?php 
+				if(array_key_exists('product_version', $this->data))	{
+				?>
+				<tr><td width=50%>
+	        	<fieldset>
+        		<legend><em>Product Version</em></legend>
+		        <table>
+					<tr>
+						<td><select class="listclass" id="productversionlist">
+							<option value="none selected" selected="selected">Select</option>
+							<?php 
+							foreach ($this->data['product_version'] as $value) {
+								echo '<option value="'.$value.'">'.$value.'</option>';
+								
+							}
+							?>			  			
+							</select>
+						</td>
+					</tr>
+				</table>
+				</fieldset>
+				</td>
+				<td width=50%>
+	        	<fieldset>
+        		<legend><em>Target Version</em></legend>
+		        <table>
+					<tr>
+						<td><select class="listclass" id="targetversionlist">
+							<option value="none selected" selected="selected">Select</option>
+							<?php 
+							foreach ($this->data['target_version'] as $value) {
+								echo '<option value="'.$value.'">'.$value.'</option>';
+							}
+							?>			  			
+							</select>
+						</td>
+					</tr>
+				</table>
+				</fieldset>
+				</td></tr>
+				<?php 
+				}
+				?>
+				<tr><td >
+	        	<fieldset>
+        		<legend><em>View State</em></legend>
+		        <table>
+					<tr>
+						<td>
+						<?php 
+						foreach ($this->data['view_state'] as $value) {
+							echo '<input type="radio" id="vs'.$value.'" name="viewstate" value="'.$value.'"/>'.$value.'';
+						}
+						?>
+						</td>
+					</tr>
+				</table>
+				</fieldset>
+				</td></tr>
+				<tr><td align="center">
+					<button id="createbutton">CREATE CHANGE REQUEST</button>
+				</td><td align="center">
+					<button id="creatensendbutton">CREATE CHANGE REQUEST AND ADD TO CLIENT</button>
+				</td></tr>
+			</table>
+		</td>
+		</tr>
+		</table>
+    </body>
+</html>

Added: trunk/src/plugins/oslc/include/oslc-zend/application/views/scripts/codendicm/show-selection-ui.phtml
===================================================================
--- trunk/src/plugins/oslc/include/oslc-zend/application/views/scripts/codendicm/show-selection-ui.phtml	                        (rev 0)
+++ trunk/src/plugins/oslc/include/oslc-zend/application/views/scripts/codendicm/show-selection-ui.phtml	2010-12-03 13:51:41 UTC (rev 11696)
@@ -0,0 +1,678 @@
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
+"http://www.w3.org/TR/html4/loose.dtd">
+<?php 
+	$project = $this->data['project'];
+	foreach ($this->data['where'] as $key => $value) {
+		$where[] = $key;
+	}
+	//print_r($this->data['where']);
+	/*
+	 * @import "http://ajax.googleapis.com/ajax/libs/dojo/1.5/dojox/grid/resources/Grid.css";
+	@import url("http://ajax.googleapis.com/ajax/libs/dojo/1.5/dijit/themes/soria/soria.css");
+		
+	 */
+?>
+<html xmlns="http://www.w3.org/1999/xhtml">
+    <head>
+        <title>OSLC Query UI</title>
+        <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
+		<style type="text/css">
+		@import "/javascript/dojox/grid/resources/Grid.css";
+		@import url("/javascript/dijit/themes/soria/soria.css");
+		
+		body { 	font: 13px Myriad,Arial,Helvetica,clean,sans-serif; 	
+				*font-size: small;	
+				*font: x-small;}
+				
+		h1 {	font-size: 1.5em; 	
+				font-weight: normal;	
+				line-height: 1em; 	
+				margin-top: 1em;	
+				margin-bottom:0;}
+				
+		h2 { 	font-size: 1.1667em;
+				font-weight: bold; 	
+				line-height: 1.286em; 	
+				margin-top: 1.929em; 	
+				margin-bottom:0.643em;}
+		
+		h3, h4, h5, h6 {	font-size: 1em; 	
+							font-weight: bold; 	
+							line-height: 1.5em; 	
+							margin-top: 1.5em; 	
+							margin-bottom: 0;}
+							
+		p { 	font-size: 1em;
+				margin-top: 1.5em;
+				margin-bottom: 1.5em;
+				line-height: 1.5em;}
+		
+		body {
+			margin: 2em;
+		}
+		
+		table td {
+			padding: 2px;
+		}
+		
+		</style>
+        <script type="text/javascript" src="/javascript/dojo/dojo.js"
+			djconfig="parseOnLoad:true">
+		</script>
+        <script type="text/javascript">
+        dojo.require("dojox.grid.DataGrid");
+        dojo.require("dijit.Menu");
+        dojo.require("dijit.MenuItem");
+        dojo.require("dojox.data.CsvStore");
+        dojo.require("dojo.data.ItemFileReadStore");
+        dojo.require("dojox.encoding.base64");
+        
+		var URL = "<?php echo $this->baseUrl(); ?>"+"/cm/bugs";
+		var props; 	//array of all properties, dc:title has not been included in the list
+					//and is always shown in the results
+		var where; //array of all where options
+		var whereoptions; //2d array of options of where options
+		var queryconnect;
+		var selectedrowindex; //row selected to sent to client
+		var tempresult;
+		var convertToByteArray = function(data){
+            var bin=[] ;
+            for (var i=0; i<data.length; i++){
+            	bin.push(data.charCodeAt(i));
+            }
+            return bin;
+        }
+        
+        var doQuery = function(event) {
+
+            var user = dojo.trim(dojo.byId("usertext").value);
+            var pass = dojo.trim(dojo.byId("passtext").value);
+
+            if((user=="")&&(pass!=""))	{
+                alert("User field is empty!");
+                return;
+            }else if((user!="")&&(pass==""))	{
+                alert("Password field is empty!");
+                return;
+            }else if((!user.match(/^[a-zA-Z0-9\s-\.+_]+$/))&&(user!=""))	{
+                alert("Invalid user name!");
+                return;
+            }
+
+            //processing oslc.limit
+            var limit = dojo.trim(dojo.byId("limittext").value);
+            if(/^[1-9][0-9]*$/.test(limit))	{
+                if(limit>30)	{
+                    alert("oslc.limit should be less than 30!");
+                    return;
+                }
+            }else if(limit=="")	{
+                alert("Default oslc.limit value taken to be 10");
+                limit = "10";
+                dojo.byId("limittext").value = limit;
+            }else	{
+                alert("oslc.limit should be an integer less than 30!");
+                return;
+            }
+
+            //processing oslc.offset
+            var offset = dojo.trim(dojo.byId("offsettext").value);
+            if(/^[1-9][0-9]*$/.test(offset))	{
+                if((offset%limit!=0)&&(offset!="0"))	{
+                    alert("oslc.offset should be a multiple of oslc.limit!");
+                    return;
+                }
+            }else if(offset!="")	{
+                alert("oslc.offset should be an integer which is a multiple of oslc.limit!");
+                return;
+            }
+
+            //processing oslc.searchTerms
+            var searchterms = dojo.trim(dojo.byId("searchtermstext").value.replace(/\"/g,""));
+            if(searchterms!="")	{
+	            var searchtermsArray = searchterms.split(" ");
+	            for(var i=0;i<searchtermsArray.length;i++)
+	            {
+	                if(i==0)	{
+	                	searchterms = "\"" + searchtermsArray[i] + "\"";
+	                }else	{
+	                	searchterms = searchterms + ",\"" + searchtermsArray[i] + "\"";
+	                }
+	            }
+            }
+
+            //processing oslc.properties
+        	var selectedprops = ["dc:title"];
+            dojo.query(".proprowclass").forEach(
+                    function(item, index, array)	{
+						var propselect = item.cells[0].childNodes[0];
+						if(propselect.value!="none")	{
+							selectedprops.push(propselect.value);
+						}
+                    });
+            var layoutjson = [{
+                field: "rdf:about",
+                name: "URL",
+                width: "auto"
+            }];
+            var propstring; //comma separated properties list to be used in the ajax call
+            if(selectedprops.length==1)	{
+                alert("As no properties are selected, only dc:title and URL will be displayed!");
+            }
+            for(var i=0;i<selectedprops.length;i++)
+            {
+                if(i==0)	{
+                    propstring = selectedprops[i];
+                }else	{
+                    propstring = propstring + "," + selectedprops[i];
+                }
+                layoutjson.push(
+                		{
+                            field: selectedprops[i],
+                            name: selectedprops[i],
+                            width: "auto"
+                        });
+            }            
+
+            //processing oslc.where
+            var selectedwhere = ["mantisbt:project=\"<?php echo $project ?>\""];
+            dojo.query(".whererowclass").forEach(
+                    function(item, index, array)	{
+						var where1 = item.cells[0].childNodes[0];
+						var where2 = item.cells[2].childNodes[0];
+						if((where1.value!="none")&&(where2.value!="none"))	{
+							var tempString = where1.value + "=\"" + where2.value + "\"";
+							console.log(tempString);
+							selectedwhere.push(tempString);
+						}
+                    });
+            var wherestring; //'and' separated where options list to be used in the ajax call
+            for(var i=0;i<selectedwhere.length;i++)
+            {
+                if(i==0)	{
+                	wherestring = selectedwhere[i];
+                }else	{
+                	wherestring = wherestring + " and " + selectedwhere[i];
+                }
+            }
+
+            //processing oslc.orderBy
+            var selectedorder = [];
+            dojo.query(".orderrowclass").forEach(
+                    function(item, index, array)	{
+						var attr = item.cells[0].childNodes[0];
+						var dir = item.cells[1].childNodes[0];
+						if((attr.value!="none")&&(dir.value!="none"))	{
+							var tempString = dir.value + attr.value;
+							console.log(tempString);
+							selectedorder.push(tempString);
+						}
+                    });
+            var orderstring; //comma separated where options list to be used in the ajax call
+            for(var i=0;i<selectedorder.length;i++)
+            {
+                if(i==0)	{
+                	orderstring = selectedorder[i];
+                }else	{
+                	orderstring = orderstring + "," + selectedorder[i];
+                }
+            }
+
+            //creating content object for xhrargs
+            var contentobj = {};
+            contentobj['oslc_limit'] = limit;
+            contentobj['oslc_where'] = wherestring;
+            if(offset!="")	{
+                contentobj['oslc_offset'] = offset;
+            }
+            if(searchterms!="")	{
+            	contentobj['oslc_searchTerms'] = searchterms;
+            }
+            if(selectedprops.length>1)	{
+                contentobj['oslc_properties'] = propstring;
+            }
+            if(selectedorder.length>0)	{
+                contentobj['oslc_orderBy'] = orderstring;
+            }
+            //alert(contentobj.toSource());
+            
+
+            var xhrArgs = {
+                    url: URL,
+                    headers: {Accept: "application/json"},
+                    preventCache: true,
+                    handleAs: "json",
+                    content: contentobj,
+                    load: function(dataa, ioArgs) {
+                  	  	//alert(dataa.toSource());
+                  	  	var jsonObj = {};
+                  	  	for (var key in dataa) {
+						   var obj = dataa[key];						   
+						   if(key=="oslc_cm:totalCount")	{
+							   jsonObj.identifier = "rdf:about";
+						   }
+						   else if(key=="oslc_cm:results")   {
+							   var tempArr = [];							      
+							   for (var num in obj) {
+								  var result = obj[num];
+							      var temp = {};
+							      for(var prop in result)	{
+								      temp[prop] = result[prop];
+							      }
+							      tempArr.push(temp);
+							   }
+							   jsonObj.items = tempArr;
+						   }
+						}
+						//alert(jsonObj.toSource());
+                        //alert(ioArgs.xhr.responseText);
+                        var jsonStore = new dojo.data.ItemFileReadStore({data:jsonObj});
+                        window["grid"] = dijit.byId("grid");
+                        window["menu"] = dijit.byId("gridMenu");
+                        grid.setStructure(layoutjson);
+                        grid.setStore(jsonStore, {});
+                        grid.onRowDblClick = function(e)	{
+                            console.log("row double clicked");
+                        }
+                        menu.bindDomNode(grid.domNode);
+                     	// prevent grid methods from killing the context menu event by implementing our own handler
+            			grid.onCellContextMenu = function(e) {
+            				selectedrowindex = e.rowIndex;            				          				
+            			};
+                        
+                     
+                    },
+                    error: function(err, ioargs) {
+                  	  var response = dojo.fromJson(ioargs.xhr.responseText);
+                  	  var errmsg, errcode;
+                  	  for (var key in response) {
+						   var obj = response[key];						   
+						   if(key=="oslc_cm:Error")   {
+							   for (var i in obj) {
+								  if(i=="oslc_cm:statusCode")	{
+									  errcode = obj[i];
+								  }else if(i=="oslc_cm:message")	{
+									  errmsg = obj[i];
+								  } 
+							   }
+							   var errtext = "Error " + errcode + ": " + errmsg;
+							   alert(errtext);
+						   }
+						}
+                    }
+                }
+
+            if((user!="")&&(pass!=""))	{
+                //tried but didnt work
+                //xhrArgs['user'] = user;
+                //xhrArgs['password'] = pass;
+                
+                var userpass = user + ":" + pass;                
+                xhrArgs['headers']['Authorization'] = "Basic " + dojox.encoding.base64.encode(convertToByteArray(userpass));
+            }            
+            //alert(xhrArgs.toSource());
+
+            //Call the asynchronous xhrGet
+		    var deferred = dojo.xhrGet(xhrArgs);
+		    dojo.query(".plusclass").forEach(
+				    function(item, index, array)	{
+					    item.disabled = true;
+				    });
+		    dojo.query(".minusclass").forEach(
+				    function(item, index, array)	{
+					    item.disabled = true;
+				    });
+			dojo.disconnect(queryconnect);
+          
+            
+        };
+
+        function respondWithPostMessage(/*string*/ response) {
+            window.parent.postMessage("oslc-response:" + response, "*");
+            //TODO if window is not parented window.postMessage to be used
+            //which shud be ignored
+         }
+
+        var addtoclient = function()	{
+            //alert("addedtoclient");
+            tempresult = {};
+            var grid = dijit.byId("grid");
+            var items = grid.selection.getSelected();
+            if (items.length) {
+            	var tempArray = [];
+                dojo.forEach(items, function(selectedItem) {
+                    var temp = {};
+                    if (selectedItem !== null) {
+                        dojo.forEach(grid.store.getAttributes(selectedItem), function(attribute) {
+                            var value = grid.store.getValues(selectedItem, attribute);
+                            if(attribute=="rdf:about")	{
+                                temp['rdf:resource'] = value;
+                            }else if(attribute=="dc:title")	{
+                                temp[attribute] = value;
+                                temp['oslc_cm:label'] = value;
+                            }
+                        });
+                        tempArray.push(temp);
+                    }
+                });
+                tempresult['oslc_cm:results'] = tempArray;
+            }
+            var resultstring = tempresult.toSource();
+            console.log(resultstring);
+            respondWithPostMessage(resultstring);
+        }
+
+        var refresh = function()
+        {
+        	queryconnect = dojo.connect(dojo.byId("querybutton"), "onclick", doQuery);
+        	dojo.query(".plusclass").forEach(
+				    function(item, index, array)	{
+					    item.disabled = false;
+				    });
+		    dojo.query(".minusclass").forEach(
+				    function(item, index, array)	{
+					    item.disabled = false;
+				    });
+		    dijit.byId("grid").setStructure(null);
+		    dijit.byId("grid").setStore(null);
+		    
+        }
+        
+          //var plusconnects; not needed anymore
+          
+          var NUMBER = {    PROPERTIES: 2,
+                  			ORDERBY: 3,
+					        WHERE: 4	};
+	        
+          var add = function(event)
+          {
+              var rowclass;
+        	  if(event.target.id=="propplus")	{
+            	  numcells = NUMBER.PROPERTIES;
+            	  rowclass = ".proprowclass";
+        	  }else if(event.target.id=="whereplus")	{
+            	  numcells = NUMBER.WHERE;
+            	  rowclass = ".whererowclass";
+        	  }else if(event.target.id=="orderplus")	{
+            	  numcells = NUMBER.ORDERBY;
+            	  rowclass = ".orderrowclass";
+        	  }
+              //alert(event.target.parentNode.parentNode);
+              if(dojo.query(rowclass).length<5)
+              {  
+	              var newrow = dojo.clone(event.target.parentNode.parentNode);
+	              var numcells;
+	              
+	              if(newrow.cells.length<=numcells)
+	              {
+	                  var tdm = document.createElement("td");
+	                  tdm.innerHTML = "<button id=\"minus\" class=\"minusclass\">-</button>";
+	                  newrow.appendChild(tdm);
+	              }
+	              if(event.target.id=="whereplus")	{
+		              showOptions(newrow.cells[0].childNodes[0]);
+	              }
+	              
+	              dojo.place(newrow, event.target.parentNode.parentNode.parentNode);
+	              var newplus = newrow.cells[numcells-1].childNodes[0];
+	              if(event.target.id=="orderplus")	{
+		              dojo.destroy(newplus.parentNode);
+		              dojo.destroy(event.target.parentNode);
+		              var newminus = newrow.cells[numcells-1].childNodes[0];
+	              }else	{
+		              dojo.connect(newplus, "onclick", add);
+		              var newminus = newrow.cells[numcells].childNodes[0];
+	              }
+	              dojo.connect(newminus, "onclick", remove);
+              }
+          }
+
+          var remove = function(event)
+          {
+              if(event.target.parentNode.parentNode.id=="orderrow")
+              {
+                  var row = document.getElementById('orderrow').parentNode.rows[0];
+            	  var tdm = document.createElement("td");
+                  tdm.innerHTML = "<button id=\"orderplus\" class=\"plusclass\">+</button>";
+                  row.appendChild(tdm);
+                  dojo.connect(row.cells[NUMBER.ORDERBY-1].childNodes[0], "onclick", add);
+              }
+              dojo.destroy(event.target.parentNode.parentNode);
+          }
+
+          var showOptions = function(list)
+          {
+              //alert(whereoptions[list.selectedIndex-1]);
+                            
+              var optionlist = list.parentNode.parentNode.cells[NUMBER.WHERE-2].childNodes[0];
+              var len = list.parentNode.parentNode.cells[NUMBER.WHERE-2].childNodes[0].length;
+              //alert(len);
+              for(var i=len-1;i>=0;i--)	{
+            	  //alert((i+1)+"/"+len+" "+optionlist.options[i].text);
+                  optionlist.remove(i);
+                  
+              }
+              
+	          if(list.selectedIndex>0)	{	              
+	              len = whereoptions[list.selectedIndex-1].length;
+	              for(var i=0;i<len;i++)	{
+	                  var val = whereoptions[list.selectedIndex-1][i];
+	                  try	{
+		                if(i==0)	{
+							optionlist.add(new Option(val, val, true), null); //add new option to end
+		                }else	{
+		                	optionlist.add(new Option(val, val), null); //add new option to end
+		                }
+	            		
+	            	  }
+	            	  catch(e)	{ //for IE
+	            		  	if(i==0)	{
+								optionlist.add(new Option(val, val, true)); //add new option to end
+			                }else	{
+			                	optionlist.add(new Option(val, val)); //add new option to end
+			                }
+	            	  }
+	              }
+              }else if(list.selectedIndex==0)	{
+            	  try	{
+					optionlist.add(new Option("Select", "none"), null) //add new option to end
+            		
+            	  }
+            	  catch(e)	{ //for IE
+					optionlist.add(new Option("Select", "none")) //add new option to end
+            	  }
+              }
+              
+          }
+
+          var init = function()
+          {
+        	  dojo.query(".plusclass").forEach(
+        	          function(item, index, array){
+        	               dojo.connect(item, "onclick", add);
+        	          });
+	          queryconnect = dojo.connect(dojo.byId("querybutton"), "onclick", doQuery);
+
+	          var properties = dojo.byId("proplist").options;
+	          props = [];
+	          for(var i=1;i<properties.length;i++) //starts from 1 to not incluse "select"
+	          {
+		          if(properties[i].text!="dc:title")	{
+			          props[i-1] = properties[i].text;
+			          //alert(props[i-1]);
+		          }
+	          }
+	          where = [];
+	          var i = 0;
+	          <?php 
+	          print "whereoptions = [];";
+	          foreach ($this->data['where'] as $key => $value) {
+	          	print "where.push(\"$key\" );";
+	          	$i = 0;
+	          	print "whereoptions[i] = [];";
+	          	foreach ($value as $option) {
+	          		print "whereoptions[i][$i] = \"$option\";";
+	          		$i++;
+	          	}
+	          	print "i++;";
+	          }
+	          ?>
+          }
+
+          dojo.addOnLoad(init);
+          
+        </script>
+    </head>
+    <body>
+        <h1><?php echo strtoupper($project); ?>: Query UI for OSLC</h1><hr/>
+        <!-- <p>some details of the query and blah blah to be added here</p> -->
+        
+        <br>
+        <!-- <p><b>Project: <?php echo $project ?></b></p> -->
+        <table>
+        	     		
+        </table>
+        <table border=1>        
+        <tr><td width=50%>
+	        <table CELLSPACING=2 CELLPADDING=2 id="main">
+	        	<tr><td>
+	        	<table><tr><td><fieldset>
+        		<legend><em>User</em></legend>
+        		<input id="usertext" type=text>
+        		</fieldset>
+        		</td>
+        		<td><fieldset>
+        		<legend><em>Password</em></legend>
+        		<input id="passtext" type=password>
+        		</fieldset>
+        		</td>
+        		</tr></table>
+        		</td>
+        		</tr>   
+	        	<tr><td>
+	        	<fieldset>
+        		<legend><em>oslc.properties</em></legend>
+		        <table id="propstable">
+		        	<tr><small>[url, dc:title will be present by default]</small></tr>
+					<tr class="proprowclass" id="proprow">
+						<!--  td width="100">oslc.properties</td>-->
+						<td><select id="proplist">
+							<option value="none" selected="selected">Select</option>
+							<?php 
+							foreach ($this->data['properties'] as $value) {
+								if(strcmp($value,"dc:title")!=0)	{
+									echo '<option value="'.$value.'">'.$value.'</option>';
+								}
+							}
+							?>			  			
+							</select>
+						</td>
+						<td><button id="propplus" class="plusclass">+</button>
+						</td>
+					</tr>
+				</table>
+				</fieldset>
+				</td></tr>
+				<tr><td>
+				<fieldset>
+        		<legend><em>oslc.where</em></legend>
+		        <table id="wheretable">
+					<tr class="whererowclass" id="whererow">
+						<!-- <td width="100">oslc.where</td> -->
+						<td><select id="wherelist" onchange="showOptions(this)">
+							<option value="none" selected="selected">Select</option>
+							<?php 
+							foreach ($where as $value) {
+								echo '<option value="'.$value.'">'.$value.'</option>';
+							}
+							?>
+							</select>
+						</td>
+						<td><label>=</label></td>
+						<td><select id="whereoptionslist">
+							<option value="none" selected="selected">Select</option>
+							</select>
+						</td>
+						<td><button id="whereplus" class="plusclass">+</button>
+						</td>
+					</tr>
+				</table>
+				</fieldset>
+				</td></tr>
+				<tr><td>
+		        <fieldset>
+        		<legend><em>oslc.orderBy</em></legend>
+		        <table id="ordertable">
+					<tr class="orderrowclass" id="orderrow">
+						<!--  <td width="100">oslc.orderBy</td> -->
+						<td><select id="orderlist">
+							<option value="none" selected="selected">Select</option>
+							<?php 
+							foreach ($this->data['orderBy'] as $value) {
+								echo '<option value="'.$value.'">'.$value.'</option>';
+							}
+							?>			  			
+							</select>
+						</td>
+						<td><select id="orderdirlist">
+							<option value="none" selected="selected">Select</option>
+							<option value="+" >Ascending</option>
+							<option value="-" >Descending</option>
+							</select>
+						</td>
+						<td><button id="orderplus" class="plusclass">+</button>
+						</td>
+					</tr>
+				</table>
+				</fieldset>
+				</td></tr>
+				<tr><td>
+		        <fieldset>
+        		<legend><em>oslc.limit</em></legend>
+		        <table id="limittable">
+					<tr class="limitrowclass" id="limitrow">
+						<!-- <td width="100">oslc.limit</td> -->
+						<td><input id="limittext" type=text></td>
+					</tr>
+				</table>
+				</fieldset>
+				</td></tr>
+				<tr><td>
+		        <fieldset>
+        		<legend><em>oslc.offset</em></legend>
+		        <table id="offsettable">
+					<tr class="offsetrowclass" id="offsetrow">
+						<!-- <td width="100">oslc.offset</td> -->
+						<td><input id="offsettext" type=text></td>
+					</tr>
+				</table>
+				</fieldset>
+				</td></tr>
+				<tr><td>
+		        <fieldset>
+        		<legend><em>oslc.searchTerms</em></legend>
+		        <table id="searchtable">
+					<tr class="searchrowclass" id="searchrow">
+						<!-- <td width="100">oslc.searchTerms</td> -->
+						<td><input id="searchtermstext" type=text></td>
+					</tr>
+				</table>
+				</fieldset>
+				</td></tr>
+				<tr><td align="center">
+					<button id="querybutton">QUERY</button>
+					
+					<button id="refreshbutton" onclick="refresh()">REFRESH</button>
+				</td></tr>
+			</table>
+		</td>
+		<td>
+			<div id="grid" dojoType="dojox.grid.DataGrid">
+			</div>
+			<div dojoType="dijit.Menu" id="gridMenu"  style="display: none;">
+				<div dojoType="dijit.MenuItem" onClick="addtoclient()">Add to client</div>
+				</div>
+		</td></tr>
+		</table>
+    </body>
+</html>




More information about the Fusionforge-commits mailing list