[Fusionforge-commits] r12219 - in branches/Branch_5_1/src/plugins/oslc/include/oslc-zend/application: controllers models views/scripts views/scripts/cm views/scripts/codendicm views/scripts/error views/scripts/fusionforgecm views/scripts/mantiscm

Olivier Berger olberger at libremir.placard.fr.eu.org
Thu Feb 10 16:10:43 CET 2011


Author: olberger
Date: 2011-02-10 16:10:40 +0100 (Thu, 10 Feb 2011)
New Revision: 12219

Added:
   branches/Branch_5_1/src/plugins/oslc/include/oslc-zend/application/controllers/CodendiCmController.php
   branches/Branch_5_1/src/plugins/oslc/include/oslc-zend/application/controllers/CodendiOSLCConnector.php
   branches/Branch_5_1/src/plugins/oslc/include/oslc-zend/application/models/Codendi.inc.php
   branches/Branch_5_1/src/plugins/oslc/include/oslc-zend/application/views/scripts/cm/_add_hyperlinks.php
   branches/Branch_5_1/src/plugins/oslc/include/oslc-zend/application/views/scripts/cm/show-creation-ui.phtml
   branches/Branch_5_1/src/plugins/oslc/include/oslc-zend/application/views/scripts/codendicm/
   branches/Branch_5_1/src/plugins/oslc/include/oslc-zend/application/views/scripts/codendicm/_add_hyperlinks.php
   branches/Branch_5_1/src/plugins/oslc/include/oslc-zend/application/views/scripts/codendicm/_resource_xml.php
   branches/Branch_5_1/src/plugins/oslc/include/oslc-zend/application/views/scripts/codendicm/_service-catalog_xml.php
   branches/Branch_5_1/src/plugins/oslc/include/oslc-zend/application/views/scripts/codendicm/_service-document_xml.php
   branches/Branch_5_1/src/plugins/oslc/include/oslc-zend/application/views/scripts/codendicm/get.phtml
   branches/Branch_5_1/src/plugins/oslc/include/oslc-zend/application/views/scripts/codendicm/index.phtml
   branches/Branch_5_1/src/plugins/oslc/include/oslc-zend/application/views/scripts/codendicm/oslc-cm-service-document.phtml
   branches/Branch_5_1/src/plugins/oslc/include/oslc-zend/application/views/scripts/codendicm/oslc-cm-service-document.xml.phtml
   branches/Branch_5_1/src/plugins/oslc/include/oslc-zend/application/views/scripts/codendicm/oslc-service-catalog.json.phtml
   branches/Branch_5_1/src/plugins/oslc/include/oslc-zend/application/views/scripts/codendicm/oslc-service-catalog.phtml
   branches/Branch_5_1/src/plugins/oslc/include/oslc-zend/application/views/scripts/codendicm/oslc-service-catalog.xml.phtml
   branches/Branch_5_1/src/plugins/oslc/include/oslc-zend/application/views/scripts/codendicm/post.phtml
   branches/Branch_5_1/src/plugins/oslc/include/oslc-zend/application/views/scripts/codendicm/put.phtml
   branches/Branch_5_1/src/plugins/oslc/include/oslc-zend/application/views/scripts/codendicm/put.xml.phtml
   branches/Branch_5_1/src/plugins/oslc/include/oslc-zend/application/views/scripts/codendicm/read-bugnote-collection.json.phtml
   branches/Branch_5_1/src/plugins/oslc/include/oslc-zend/application/views/scripts/codendicm/read-bugnote-collection.phtml
   branches/Branch_5_1/src/plugins/oslc/include/oslc-zend/application/views/scripts/codendicm/read-bugnote-collection.xml.phtml
   branches/Branch_5_1/src/plugins/oslc/include/oslc-zend/application/views/scripts/codendicm/read-bugnote.json.phtml
   branches/Branch_5_1/src/plugins/oslc/include/oslc-zend/application/views/scripts/codendicm/read-bugnote.phtml
   branches/Branch_5_1/src/plugins/oslc/include/oslc-zend/application/views/scripts/codendicm/read-bugnote.xml.phtml
   branches/Branch_5_1/src/plugins/oslc/include/oslc-zend/application/views/scripts/codendicm/read-resource-collection.json.phtml
   branches/Branch_5_1/src/plugins/oslc/include/oslc-zend/application/views/scripts/codendicm/read-resource-collection.phtml
   branches/Branch_5_1/src/plugins/oslc/include/oslc-zend/application/views/scripts/codendicm/read-resource-collection.xml.phtml
   branches/Branch_5_1/src/plugins/oslc/include/oslc-zend/application/views/scripts/codendicm/read-resource.json.phtml
   branches/Branch_5_1/src/plugins/oslc/include/oslc-zend/application/views/scripts/codendicm/read-resource.phtml
   branches/Branch_5_1/src/plugins/oslc/include/oslc-zend/application/views/scripts/codendicm/read-resource.xml.phtml
   branches/Branch_5_1/src/plugins/oslc/include/oslc-zend/application/views/scripts/codendicm/show-creation-ui.phtml
   branches/Branch_5_1/src/plugins/oslc/include/oslc-zend/application/views/scripts/codendicm/show-selection-ui.phtml
   branches/Branch_5_1/src/plugins/oslc/include/oslc-zend/application/views/scripts/fusionforgecm/_add_hyperlinks.php
   branches/Branch_5_1/src/plugins/oslc/include/oslc-zend/application/views/scripts/fusionforgecm/_resource_xml.php
   branches/Branch_5_1/src/plugins/oslc/include/oslc-zend/application/views/scripts/fusionforgecm/_service-catalog_xml.php
   branches/Branch_5_1/src/plugins/oslc/include/oslc-zend/application/views/scripts/fusionforgecm/_service-document_xml.php
   branches/Branch_5_1/src/plugins/oslc/include/oslc-zend/application/views/scripts/fusionforgecm/get.phtml
   branches/Branch_5_1/src/plugins/oslc/include/oslc-zend/application/views/scripts/fusionforgecm/index.phtml
   branches/Branch_5_1/src/plugins/oslc/include/oslc-zend/application/views/scripts/fusionforgecm/oslc-cm-service-document.phtml
   branches/Branch_5_1/src/plugins/oslc/include/oslc-zend/application/views/scripts/fusionforgecm/oslc-cm-service-document.xml.phtml
   branches/Branch_5_1/src/plugins/oslc/include/oslc-zend/application/views/scripts/fusionforgecm/oslc-service-catalog.json.phtml
   branches/Branch_5_1/src/plugins/oslc/include/oslc-zend/application/views/scripts/fusionforgecm/oslc-service-catalog.phtml
   branches/Branch_5_1/src/plugins/oslc/include/oslc-zend/application/views/scripts/fusionforgecm/oslc-service-catalog.xml.phtml
   branches/Branch_5_1/src/plugins/oslc/include/oslc-zend/application/views/scripts/fusionforgecm/post.phtml
   branches/Branch_5_1/src/plugins/oslc/include/oslc-zend/application/views/scripts/fusionforgecm/put.phtml
   branches/Branch_5_1/src/plugins/oslc/include/oslc-zend/application/views/scripts/fusionforgecm/put.xml.phtml
   branches/Branch_5_1/src/plugins/oslc/include/oslc-zend/application/views/scripts/fusionforgecm/read-bugnote-collection.json.phtml
   branches/Branch_5_1/src/plugins/oslc/include/oslc-zend/application/views/scripts/fusionforgecm/read-bugnote-collection.phtml
   branches/Branch_5_1/src/plugins/oslc/include/oslc-zend/application/views/scripts/fusionforgecm/read-bugnote-collection.xml.phtml
   branches/Branch_5_1/src/plugins/oslc/include/oslc-zend/application/views/scripts/fusionforgecm/read-bugnote.json.phtml
   branches/Branch_5_1/src/plugins/oslc/include/oslc-zend/application/views/scripts/fusionforgecm/read-bugnote.phtml
   branches/Branch_5_1/src/plugins/oslc/include/oslc-zend/application/views/scripts/fusionforgecm/read-bugnote.xml.phtml
   branches/Branch_5_1/src/plugins/oslc/include/oslc-zend/application/views/scripts/fusionforgecm/read-resource-collection.json.phtml
   branches/Branch_5_1/src/plugins/oslc/include/oslc-zend/application/views/scripts/fusionforgecm/read-resource-collection.phtml
   branches/Branch_5_1/src/plugins/oslc/include/oslc-zend/application/views/scripts/fusionforgecm/read-resource-collection.xml.phtml
   branches/Branch_5_1/src/plugins/oslc/include/oslc-zend/application/views/scripts/fusionforgecm/read-resource.json.phtml
   branches/Branch_5_1/src/plugins/oslc/include/oslc-zend/application/views/scripts/fusionforgecm/read-resource.phtml
   branches/Branch_5_1/src/plugins/oslc/include/oslc-zend/application/views/scripts/fusionforgecm/read-resource.xml.phtml
   branches/Branch_5_1/src/plugins/oslc/include/oslc-zend/application/views/scripts/fusionforgecm/show-creation-ui.phtml
   branches/Branch_5_1/src/plugins/oslc/include/oslc-zend/application/views/scripts/fusionforgecm/show-selection-ui.phtml
   branches/Branch_5_1/src/plugins/oslc/include/oslc-zend/application/views/scripts/mantiscm/_add_hyperlinks.php
   branches/Branch_5_1/src/plugins/oslc/include/oslc-zend/application/views/scripts/mantiscm/_resource_xml.php
   branches/Branch_5_1/src/plugins/oslc/include/oslc-zend/application/views/scripts/mantiscm/_service-catalog_xml.php
   branches/Branch_5_1/src/plugins/oslc/include/oslc-zend/application/views/scripts/mantiscm/_service-document_xml.php
   branches/Branch_5_1/src/plugins/oslc/include/oslc-zend/application/views/scripts/mantiscm/get.phtml
   branches/Branch_5_1/src/plugins/oslc/include/oslc-zend/application/views/scripts/mantiscm/index.phtml
   branches/Branch_5_1/src/plugins/oslc/include/oslc-zend/application/views/scripts/mantiscm/oslc-cm-service-document.phtml
   branches/Branch_5_1/src/plugins/oslc/include/oslc-zend/application/views/scripts/mantiscm/oslc-cm-service-document.xml.phtml
   branches/Branch_5_1/src/plugins/oslc/include/oslc-zend/application/views/scripts/mantiscm/oslc-service-catalog.json.phtml
   branches/Branch_5_1/src/plugins/oslc/include/oslc-zend/application/views/scripts/mantiscm/oslc-service-catalog.phtml
   branches/Branch_5_1/src/plugins/oslc/include/oslc-zend/application/views/scripts/mantiscm/oslc-service-catalog.xml.phtml
   branches/Branch_5_1/src/plugins/oslc/include/oslc-zend/application/views/scripts/mantiscm/post.phtml
   branches/Branch_5_1/src/plugins/oslc/include/oslc-zend/application/views/scripts/mantiscm/put.phtml
   branches/Branch_5_1/src/plugins/oslc/include/oslc-zend/application/views/scripts/mantiscm/put.xml.phtml
   branches/Branch_5_1/src/plugins/oslc/include/oslc-zend/application/views/scripts/mantiscm/read-bugnote-collection.json.phtml
   branches/Branch_5_1/src/plugins/oslc/include/oslc-zend/application/views/scripts/mantiscm/read-bugnote-collection.phtml
   branches/Branch_5_1/src/plugins/oslc/include/oslc-zend/application/views/scripts/mantiscm/read-bugnote-collection.xml.phtml
   branches/Branch_5_1/src/plugins/oslc/include/oslc-zend/application/views/scripts/mantiscm/read-bugnote.json.phtml
   branches/Branch_5_1/src/plugins/oslc/include/oslc-zend/application/views/scripts/mantiscm/read-bugnote.phtml
   branches/Branch_5_1/src/plugins/oslc/include/oslc-zend/application/views/scripts/mantiscm/read-bugnote.xml.phtml
   branches/Branch_5_1/src/plugins/oslc/include/oslc-zend/application/views/scripts/mantiscm/read-resource-collection.json.phtml
   branches/Branch_5_1/src/plugins/oslc/include/oslc-zend/application/views/scripts/mantiscm/read-resource-collection.phtml
   branches/Branch_5_1/src/plugins/oslc/include/oslc-zend/application/views/scripts/mantiscm/read-resource-collection.xml.phtml
   branches/Branch_5_1/src/plugins/oslc/include/oslc-zend/application/views/scripts/mantiscm/read-resource.json.phtml
   branches/Branch_5_1/src/plugins/oslc/include/oslc-zend/application/views/scripts/mantiscm/read-resource.phtml
   branches/Branch_5_1/src/plugins/oslc/include/oslc-zend/application/views/scripts/mantiscm/read-resource.xml.phtml
   branches/Branch_5_1/src/plugins/oslc/include/oslc-zend/application/views/scripts/mantiscm/show-creation-ui.phtml
   branches/Branch_5_1/src/plugins/oslc/include/oslc-zend/application/views/scripts/mantiscm/show-selection-ui.phtml
Modified:
   branches/Branch_5_1/src/plugins/oslc/include/oslc-zend/application/controllers/CmController.php
   branches/Branch_5_1/src/plugins/oslc/include/oslc-zend/application/controllers/FusionForgeCmController.php
   branches/Branch_5_1/src/plugins/oslc/include/oslc-zend/application/controllers/FusionForgeOSLCConnector.php
   branches/Branch_5_1/src/plugins/oslc/include/oslc-zend/application/controllers/MantisCmController.php
   branches/Branch_5_1/src/plugins/oslc/include/oslc-zend/application/controllers/MantisOSLCConnector.php
   branches/Branch_5_1/src/plugins/oslc/include/oslc-zend/application/models/ChangeRequests.php
   branches/Branch_5_1/src/plugins/oslc/include/oslc-zend/application/models/mantis.inc.php
   branches/Branch_5_1/src/plugins/oslc/include/oslc-zend/application/views/scripts/cm/_service-document_xml.php
   branches/Branch_5_1/src/plugins/oslc/include/oslc-zend/application/views/scripts/cm/index.phtml
   branches/Branch_5_1/src/plugins/oslc/include/oslc-zend/application/views/scripts/cm/oslc-cm-service-document.phtml
   branches/Branch_5_1/src/plugins/oslc/include/oslc-zend/application/views/scripts/cm/oslc-service-catalog.json.phtml
   branches/Branch_5_1/src/plugins/oslc/include/oslc-zend/application/views/scripts/cm/oslc-service-catalog.phtml
   branches/Branch_5_1/src/plugins/oslc/include/oslc-zend/application/views/scripts/cm/read-bugnote-collection.json.phtml
   branches/Branch_5_1/src/plugins/oslc/include/oslc-zend/application/views/scripts/cm/read-bugnote-collection.phtml
   branches/Branch_5_1/src/plugins/oslc/include/oslc-zend/application/views/scripts/cm/read-bugnote.json.phtml
   branches/Branch_5_1/src/plugins/oslc/include/oslc-zend/application/views/scripts/cm/read-bugnote.phtml
   branches/Branch_5_1/src/plugins/oslc/include/oslc-zend/application/views/scripts/cm/read-resource-collection.json.phtml
   branches/Branch_5_1/src/plugins/oslc/include/oslc-zend/application/views/scripts/cm/read-resource-collection.phtml
   branches/Branch_5_1/src/plugins/oslc/include/oslc-zend/application/views/scripts/cm/read-resource.json.phtml
   branches/Branch_5_1/src/plugins/oslc/include/oslc-zend/application/views/scripts/cm/read-resource.phtml
   branches/Branch_5_1/src/plugins/oslc/include/oslc-zend/application/views/scripts/cm/show-selection-ui.phtml
   branches/Branch_5_1/src/plugins/oslc/include/oslc-zend/application/views/scripts/error/error.json.phtml
Log:
update oslc plugin with latest version from fusionforge trunk.

Modified: branches/Branch_5_1/src/plugins/oslc/include/oslc-zend/application/controllers/CmController.php
===================================================================
--- branches/Branch_5_1/src/plugins/oslc/include/oslc-zend/application/controllers/CmController.php	2011-02-10 15:08:05 UTC (rev 12218)
+++ branches/Branch_5_1/src/plugins/oslc/include/oslc-zend/application/controllers/CmController.php	2011-02-10 15:10:40 UTC (rev 12219)
@@ -128,7 +128,9 @@
 			case 'fusionforge':
 				require_once($controller_dir . 'FusionForgeCmController.php');
 				break;
-				
+			case 'Codendi':
+				require_once($controller_dir . 'CodendiCmController.php');
+				break;
 			case 'demo':
 				break;
 				
@@ -221,6 +223,9 @@
 				case 'fusionforge':
 					$this->_forward('get', 'fusionforgecm');
 					break;
+				case 'Codendi':
+					$this->_forward('get', 'codendicm');
+					break;
 				default:
 					break;
 			}
@@ -234,6 +239,9 @@
 				case 'fusionforge':
 					$this->_forward('post','fusionforgecm');
 					break;
+				case 'Codendi':
+					$this->_forward('post', 'codendicm');
+					break;
 				default:
 					break;	
 			}
@@ -251,6 +259,9 @@
 				case 'fusionforge':
 					$this->_forward('put','fusionforgecm');
 					break;
+				case 'Codendi':
+					$this->_forward('put', 'codendicm');
+					break;
 				default:
 					break;				
 			}

Added: branches/Branch_5_1/src/plugins/oslc/include/oslc-zend/application/controllers/CodendiCmController.php
===================================================================
--- branches/Branch_5_1/src/plugins/oslc/include/oslc-zend/application/controllers/CodendiCmController.php	                        (rev 0)
+++ branches/Branch_5_1/src/plugins/oslc/include/oslc-zend/application/controllers/CodendiCmController.php	2011-02-10 15:10:40 UTC (rev 12219)
@@ -0,0 +1,530 @@
+<?php 
+/**
+ * Copyright (c) Institut TELECOM, 2010. All Rights Reserved.
+ *
+ * Originally written by Sabri LABBENE, 201O
+ *
+ * Codendi 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.
+ *
+ * Codendi 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 Codendi. If not, see <http://www.gnu.org/licenses/>.
+ */
+
+require_once ('CmController.php');
+require_once ('CodendiOSLCConnector.php');
+
+class CodendiCmController extends CmController {
+    /**
+     * @var oslc
+     * 
+     * This will be the OSLC-CM controller managing the business logic of the application
+     */
+    private $oslc;
+    
+    /**
+     * Defines accepted mime-types for queries, and corresponding 
+     * format of output
+     * 
+     * Order is important for the XML variants : 
+     * the first one is the default returned when only basic XML is required
+     * 
+     * @var array
+     */
+    private static $supportedAcceptMimeTypes = array();
+    
+    /**
+     * Init Codendi REST controller.
+     */
+    public function init() {
+    self::$supportedAcceptMimeTypes = parent::getSupportedAcceptMimeTypes();
+
+    parent::loadModelClasses('ChangeRequests');
+
+    // Now do things that relate to the REST framework
+
+    $req = $this->getRequest();
+
+    if(($req->getActionName()=='post')||($req->getActionName()=='put'))	{
+        $accept = $req->getHeader('Content-Type');
+    }
+    elseif($req->getActionName()=='get') {
+        $accept = $req->getHeader('Accept');
+    }
+
+    $action = $req->getActionName();
+
+    $mime = parent::checkSupportedActionMimeType(self::$supportedAcceptMimeTypes, $action);
+    if($mime) {
+        $accept = $mime;
+    }
+
+    // determine output format
+    if (isset(self::$supportedAcceptMimeTypes[$action])) {
+        if (isset(self::$supportedAcceptMimeTypes[$action][$accept])) {
+            $format = self::$supportedAcceptMimeTypes[$action][$accept];
+            $req->setParam('format', $format);
+        }
+    }
+
+    $contextSwitch = $this->_helper->getHelper('contextSwitch');
+
+    // we'll handle JSON ourselves
+    $contextSwitch->setAutoJsonSerialization(false);
+    $types = array();
+    foreach (self::$supportedAcceptMimeTypes as $action => $typesarr) {
+        //print_r(array_unique(array_values($typesarr)));
+        $types = array_unique(array_values($typesarr));
+        //print_r("Typesarr : ".$typesarr);
+        $contextSwitch->addActionContext($action, $types)->initContext();
+    }
+
+    // Create an OSLC Controller for Codendi.
+        $this->oslc = new CodendiOSLCConnector();
+    }
+    
+    public function getAction(){
+        $params = $this->getRequest()->getParams();
+
+        // Check if Authorization header was set in the request.
+        $auth = $this->getRequest()->getHeader('Authorization');
+        if (strlen($auth) != 0) {
+            // check authentication
+            if(!$this->retrieveAuthentication($login)){
+                throw new Exception('Invalid authentication provided !');
+            }
+        }
+
+        // handle OSLC services catalog access (http://open-services.net/bin/view/Main/OslcServiceProviderCatalogV1)
+        if ( isset($params['id']) && ($params['id'] == "oslc-services")) {
+            $this->_forward('oslcServiceCatalog');
+            return;
+        }
+
+        // handle OSLC-CM service document access
+        elseif (isset($params['oslc-cm-service'])) {
+            $this->_forward('oslcCmServiceDocument');
+            return;
+        }
+
+        // Now, do the OSLC-CM resources access work
+        // if no bug was mentioned, then return a resource collection
+        if (!array_key_exists('bug', $params)) {
+            // forward to an independant action so that it has its own views
+            // (see readresourcecollectionAction())
+            $this->_forward('readResourceCollection');
+        }
+        elseif(array_key_exists('bug', $params)) {
+            // now we're indeed getting one single resource
+            $this->_forward('readResource');
+        } else {
+            throw new NotFoundException("Resource ".$this->getRequest()->getRequestUri()." was not found on the server!");
+        }
+
+        // This is not explicitely required in OSLC-CM V1
+        // In the case of RDF+XML requested, mention it explicitely : LOD friendly
+        $req = $this->getRequest();
+        $accept = $req->getHeader('Accept');
+        switch (true) {
+            case (strstr($accept, 'application/rdf+xml')):
+                $resp = $this->getResponse()->setHeader('Content-Type', 'application/rdf+xml');
+                break;
+        }
+    }
+	
+    /**
+     * Handles PUT action as routed by Zend_Rest_Route
+     *  
+     * Update of an existing changerequest
+     * Will be invoked if PUT or if POST on a path relating to resources (due to Zend REST route behaviour)
+     * So in case of POST, will pass the handling to postAction()
+     * 
+     * @return unknown_type
+     */
+    public function putAction(){
+        $req = $this->getRequest();
+
+        // in case invoked like POST on .../cm/project/whatever we arrive to putAction
+        // so we check such case and then redirect to postAction() if needed
+        if ($req->isPost()) {
+            $this->postAction();
+        } else {
+            // otherwise it is indeed a PUT and we are trying to modify a change request
+
+            // do authentication.
+            $login = null;
+            $authenticated = $this->retrieveAuthentication($login);
+            if(isset($login)) {
+                // Basic auth requested
+                if (!$authenticated) {
+                    // not succesfully authd as $login
+                    // can't go on;
+                    throw new Exception('Invalid authentication provided !');
+                }
+            }
+
+            $contenttype = $req->getHeader('Content-Type');
+            $contenttype = $contenttype ? $contenttype : 'none';
+
+            switch($contenttype) {
+                case 'application/x-oslc-cm-change-request+xml':
+                case 'application/x-oslc-cm-change-request+json':
+                case 'application/xml':
+                    break;
+                default:
+                    throw new Exception('Unknown Content-Type for method put : '. $contenttype .' !');
+                    break;
+            }
+
+            $identifier = null;
+
+            $params = $req->getParams();
+
+            if (array_key_exists('id', $params)) {
+                $identifier = $req->getParam('id');
+            } else {
+                $identifier = $req->getParam('bug');
+                if (! isset($identifier)) {
+                    throw new Exception('No change request id provided !');
+                }
+            }
+
+            // checking if modification
+
+            $modifiedproperties = null;
+
+            $oslc_cm_properties = $req->getParam('oslc_cm_properties');
+            if (isset($oslc_cm_properties)) {
+                $modifiedproperties = explode(',', $oslc_cm_properties);
+                if (array_key_exists('identifier', $modifiedproperties)) {
+                    throw new Exception('Identifier cannot be modified !');
+                }
+            }
+
+            $body = file_get_contents('php://input');
+
+            // TODO: This should be done by $this->oslc
+            switch($contenttype) {
+                case 'application/x-oslc-cm-change-request+xml':
+                case 'application/xml':
+                    // extract values from XML
+                    $newchangerequest = CodendiChangeRequest::CreateCodendiArrayFromXml($body);
+                    break;
+                case 'application/x-oslc-cm-change-request+json':
+                    // extract values from JSON.
+                    $newchangerequest = CodendiChangeRequest::CreateCodendiArrayFromJson($body);
+                    break;
+                default:
+                	break;
+            }
+
+            if(!$this->oslc->checkChangeRequestExists($identifier))	{
+                throw new Exception("Change Request to be updated doesn't exist!");
+            } else {
+                // Proceed to change request update
+                $this->oslc->updateChangeRequest($identifier, $newchangerequest, $modifiedproperties);
+
+                //logout the user
+                session_logout();
+            }
+        }
+    }
+    
+    public function postAction(){
+        $req = $this->getRequest();
+
+        // check that we're indeed invoked by a POST request
+        if(! $req->isPost()) {
+            throw new Exception('postAction invoked without POST !');
+        }
+
+        $params = $req->getParams();
+
+        // do authentication.
+        $login = null;
+        $authenticated = $this->retrieveAuthentication($login);
+        if(isset($login)) {
+            // Basic auth requested
+            if (!$authenticated) {
+                // not succesfully authd as $login
+                // can't go on;
+                throw new Exception('Invalid authentication provided !');
+            }
+        }
+
+        $contenttype = $req->getHeader('Content-Type');
+        $contenttype = $contenttype ? $contenttype : 'none';
+
+        switch($contenttype) {
+            case 'application/x-oslc-cm-change-request+xml':
+            case 'application/x-oslc-cm-change-request+xml; charset=UTF-8':
+            case 'application/x-oslc-cm-change-request+json':
+            case 'application/json':
+            case 'application/xml':
+                break;
+            default:
+                throw new UnsupportedMediaTypeException('Unknown Content-Type for method post : '. $contenttype .' !');
+                break;
+        }
+
+        // used for PhpUnit tests.
+        if(APPLICATION_ENV=='testing') {
+            $body = $_POST['xml'];
+        } else {
+            $body = file_get_contents('php://input');
+        }
+        //print $body;
+
+        if(array_key_exists('project',$params)) {
+            if (array_key_exists('tracker', $params)) {
+                // create a change request
+                switch($contenttype) {
+                    case 'application/x-oslc-cm-change-request+xml':
+                    case 'application/xml':
+                    case 'application/x-oslc-cm-change-request+xml; charset=UTF-8':
+                        $newchangerequest = CodendiChangeRequest::CreateCodendiArrayFromXml($body);
+                        break;
+                    case 'application/x-oslc-cm-change-request+json':
+                        $newchangerequest = CodendiChangeRequest::CreateCodendiArrayFromJson($body);
+                        break;
+                }
+
+                $creationparams = array('project' => $params['project'],
+                                        'tracker' => $params['tracker'],
+                                        'new' => $newchangerequest);
+
+                // pass the creation work to the OSLC connector
+                $identifier = $this->oslc->createChangeRequest($creationparams);
+            } else {
+                throw new ConflictException('Need a valid tracker to create a change request');
+            }
+        } else {
+            throw new ConflictException('Need a valid project and tracker to create change request !');	
+        }
+
+        // prepare redirection
+        $httpScheme = $this->getRequest()->getScheme();
+        $httpHost = $this->getRequest()->getHttpHost();
+        $requestUri = $this->getRequest()->getRequestUri();
+        $baseURL = $this->getFrontController()->getBaseUrl();
+        $controllerName = $this->getFrontController()->getDefaultControllerName();
+
+        if(APPLICATION_ENV=='testing') {
+            $newlocation = '/'.$controllerName.'/project/'.$params['project'].'/tracker/'.$params['tracker'].'/bug/'.$identifier;
+        } else {
+            $newlocation = $httpScheme.'://'.$httpHost.$baseURL.'/'.$controllerName.'/project/'.$params['project'].'/tracker/'.$params['tracker'].'/bug/'.$identifier;
+        }
+
+        //logout the user
+        session_logout();
+				
+        //redirect to new change request
+        $this->getResponse()->setRedirect($newlocation,201);
+    }
+
+    public function indexAction(){
+        
+    }
+
+    public function deleteAction(){
+        
+    }
+    
+    /**
+     * Retrieve an individual resource and populates the view of an OSLC CM ChangeRequest
+     * 
+     * @param string $identifier
+     * @param string $uri
+     */
+    public function readresourceAction() {
+	
+        $params = $this->getRequest()->getParams();
+        $content_type = parent::checkSupportedActionMimeType(self::$supportedAcceptMimeTypes, $this->getRequest()->getActionName());
+        if (! $content_type) {
+            $this->_forward('UnknownAcceptType','error');
+            return;
+        }
+
+        $identifier = $params['bug'];
+
+        // prepare resource URI
+        $httpScheme = $this->getRequest()->getScheme();
+        $httpHost = $this->getRequest()->getHttpHost();
+        $requestUri = $this->getRequest()->getRequestUri();
+        $changerequestURI = $httpScheme.'://'.$httpHost.$requestUri;
+
+        // Check if some specific fields have been requested for the ChangeRequest.
+        if (isset($params['oslc_properties'])){
+            $preparedChangeRequest = $this->oslc->fetchChangeRequest($identifier, $changerequestURI, $params['oslc_properties']);
+        } else {
+            $preparedChangeRequest = $this->oslc->fetchChangeRequest($identifier, $changerequestURI);
+        }
+
+        if(isset($preparedChangeRequest)) {
+
+            // populate the view with the model
+            foreach($preparedChangeRequest as $field => $value) {
+                $this->view->{$field} = $value;
+            }
+
+            $this->getResponse()->setHeader('Content-Type', $content_type);
+        } else {
+            $this->view->missing_resource = $identifier;
+            $this->_forward('ResNotFound','error');
+        }
+    }
+    
+    public function readresourcecollectionAction()	{
+
+        $content_type = parent::checkSupportedActionMimeType(self::$supportedAcceptMimeTypes, $this->getRequest()->getActionName());
+        if (!$content_type) {
+            throw new NotAcceptableException("Accept header ".$this->getRequest()->getHeader('Accept')." not supported!");
+            return;
+        }
+
+        $req = $this->getRequest();
+        $params = $req->getParams();
+
+        // load the model. Will fetch requested change requests from the db.
+        $params = $this->oslc->init($params);
+
+        // construct ATOM feed-like header
+        $httpScheme = $this->getRequest()->getScheme();
+        $httpHost = $this->getRequest()->getHttpHost();
+        $requestUri = $this->getRequest()->getRequestUri();
+        $requestUri = str_replace('bugs','bug', $requestUri);
+        $requestUri = preg_replace("/project.*/", 'bug/', $requestUri);
+        $requestUri = $requestUri.(($requestUri[strlen($requestUri)-1]=='/')?'':'/');
+        $prefix = $httpScheme.'://'.$httpHost.$requestUri;
+
+        // get all resources
+        $collection = $this->oslc->getResourceCollection($prefix);
+
+        // construct an intermediate array that will be used to populate the view
+        $preparedCollection = array ('id'         => $httpScheme.'://'.$httpHost.$requestUri,
+                                     'collection'     => $collection
+                            );
+        // Add request params so they ca reach views.
+        foreach($params as $key => $value){
+            $preparedCollection[$key] = $value;
+        }
+
+        // populate the view with the loaded values
+        foreach($preparedCollection as $key => $value) {
+            $this->view->$key = $value;
+        }
+
+        //print_r($this->view);
+        $this->getResponse()->setHeader('Content-Type', $content_type);
+    }
+    
+    /**
+     * Handle OSLC services catalog access.
+     */
+    public function oslcservicecatalogAction() {
+
+        $content_type = parent::checkSupportedActionMimeType(self::$supportedAcceptMimeTypes, $this->getRequest()->getActionName());
+        if (!$content_type) {
+            throw new NotAcceptableException("Accept header ".$this->getRequest()->getHeader('Accept')." not supported!");
+            return;
+        }
+
+        // each project will generate its own service description
+        $proj_arr = $this->oslc->getProjectsList();
+
+        $this->view->projects = $proj_arr;
+
+        $this->getResponse()->setHeader('Content-Type', $content_type);
+    }
+    
+    /**
+     * 
+     * Handles OSLC service document (service document) access.
+     * TODO: Implement service document details.
+     */
+    public function oslccmservicedocumentAction() {
+        $content_type = parent::checkSupportedActionMimeType(self::$supportedAcceptMimeTypes, $this->getRequest()->getActionName());
+        if(!$content_type) {
+            throw new NotAcceptableException("Accept header ".$this->getRequest()->getHeader('Accept')." not supported!");
+            return;
+        }
+
+        $req = $this->getRequest();
+        $params = $req->getParams();
+        $project = $params['oslc-cm-service'];
+        $this->view->project = $project;
+
+        $this->getResponse()->setHeader('Content-Type', $content_type);
+    }
+    
+    /**
+     * Performs authentication according to the configured AUTH_TYPE configured
+     *
+     * @param string $login
+     * @return True if auth is valid, in which case $login is modified.
+     * If there was actually no auth requested, then return False, but $login will be set to null.
+     */
+    private function retrieveAuthentication(&$login) {
+        switch (AUTH_TYPE) {
+            case 'basic':
+                return $this->retrieveRequestAuthHttpBasic();
+                break;
+            case 'oauth':
+                return $this->checkOauthAuthorization($login);
+                break;
+            default:
+                throw new BadRequestException('Unsupported AUTH_TYPE : '. AUTH_TYPE .' !');
+                break;
+        }
+    }
+    
+    /**
+     * Helper function that performs HTTP Basic authentication from request parameters/headers
+     *
+     * @return True if auth is valid, in which case $login is modified.
+     * If there was actually no auth requested, then return False, but $login will be set to null.
+     */
+    private function retrieveRequestAuthHttpBasic() {
+        // extract login and password from Basic auth
+        $login = null;
+        $password = null;
+
+        $return = False;
+
+        $request = $this->getRequest();
+        $auth = $request->getHeader('Authorization');
+
+        if (strlen($auth) != 0) {
+            $auth = explode(' ',$auth);
+            if($auth[0] == 'Basic') {
+                $basic = base64_decode($auth[1]);
+                $basic = explode(':',$basic);
+
+                $login = $basic[0];
+                $password = $basic[1];
+            } else {
+                throw new BadRequestException('Unsupported auth method : '. $auth[0] .' !');
+            }
+        }
+        // Do authentication in Codendi 
+        if(isset($password)) {
+            $user = UserManager::instance()->login($login, $password);
+            if($user->isLoggedIn()) {
+            	$return = true;
+            } else {
+            	$return =  false;
+            }
+        }
+        
+        return $return;
+    }
+}
+
+?>

Added: branches/Branch_5_1/src/plugins/oslc/include/oslc-zend/application/controllers/CodendiOSLCConnector.php
===================================================================
--- branches/Branch_5_1/src/plugins/oslc/include/oslc-zend/application/controllers/CodendiOSLCConnector.php	                        (rev 0)
+++ branches/Branch_5_1/src/plugins/oslc/include/oslc-zend/application/controllers/CodendiOSLCConnector.php	2011-02-10 15:10:40 UTC (rev 12219)
@@ -0,0 +1,409 @@
+<?php 
+/**
+ * Copyright (c) Institut TELECOM, 2010. All Rights Reserved.
+ *
+ * Originally written by Sabri LABBENE, 201O
+ *
+ * Codendi 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.
+ *
+ * Codendi 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 Codendi. If not, see <http://www.gnu.org/licenses/>.
+ */
+
+require_once('OSLCConnector.php');
+require_once(dirname(__FILE__) . '/../models/Codendi.inc.php');
+
+require_once ('pre.php');
+require_once ('session.php');
+
+require_once ('common/tracker/Tracker.class.php');
+require_once ('common/tracker/TrackerFactory.class.php');
+require_once ('common/tracker/Tracker_Artifact.class.php');
+require_once ('common/tracker/Tracker_ArtifactFactory.class.php');
+require_once ('common/tracker/Tracker_FormElementFactory.class.php');
+
+
+class CodendiOSLCConnector extends OSLCConnector {
+
+	
+    /**
+     * Filter parameters provided in the REST GET request to check whether mandatory ones are set.
+     * 
+     * @param array $params
+     * @return array 
+     */
+    public function filterRequestParams($params) {
+        // Process the args provided by Zend REST
+        if (is_array($params)) {
+            if(!isset($params['project'])) {
+                throw new Exception('Missing project id !');
+            } elseif(!isset($params['tracker'])) {
+                throw new Exception('Missing tracker id resource for project '.$params['project'].' !');
+            } else {
+                return $params;
+            }
+        }
+    }
+    
+    /**
+     * Checks whether a change request exists inside Codendi trackers. 
+     * @param int $id change request id.
+     * @return bool
+     */
+    public function checkChangeRequestExists($changerequest_id) {
+        $af = Tracker_ArtifactFactory::instance();
+        $artifact = $af->getArtifactById($changerequest_id);
+        if (!$artifact) {
+            return false;
+        } else {
+            return true;
+        }
+    }
+    
+    /**
+     * Constructs the model from Codendi DB by fetching the requested changeRequests.
+     *
+     * @param array $params contains 'project' + 'tracker'
+     */
+    public function fetchChangeRequests($params) {
+        $artifacts = array();
+
+        // what the DB will be queried on
+        $group_id = null;
+        $tracker_id = null;
+
+        if (isset($params['project'])) {
+            $group_id = $params['project'];
+        }
+        if (isset($params['tracker'])) {
+            $tracker_id = $params['tracker'];
+        }
+        if (isset($params['bug'])) {
+            $changerequest_id = $params['bug'];
+            $af = Tracker_ArtifactFactory::instance();
+            $changeRequest = $af->getArtifactById($changerequest_id);
+            $this->changerequests = new ChangeRequestsFusionForgeDb($changeRequest);
+        }
+
+        $project = new Project($group_id);
+        if (!$project->usesService('tracker')) {
+            throw new Exception('Error : Tracker service is not used for this project.', 'fetchChangeRequests');
+        }
+
+        $tf = TrackerFactory::instance();
+        if (!$tf) {
+            throw new Exception('Error : Could Not Get TrackerFactory', 'fetchChangeRequests');
+        } 
+        
+        $tracker = $tf->getTrackerById($tracker_id);
+        
+        if ($tracker == null) {
+            throw new Exception('Error : Could Not Get Tracker', 'fetchChangeRequests');
+        } else {
+            $af = Tracker_ArtifactFactory::instance();
+            $artifacts = $af->getArtifactsByTrackerId($tracker_id);
+        }
+
+        // instanciate the model from the returned artifacts
+            if(isset($params['fields'])){
+                $this->changerequests = new ChangeRequestsCodendiDb($artifacts, $params['fields']);
+            } else {
+                $this->changerequests = new ChangeRequestsCodendiDb($artifacts);
+            }
+    }
+
+    public function fetchChangeRequest($changerequest_id, $uri, $requested_fields=array()) {
+        $af = Tracker_ArtifactFactory::instance();
+        $artifact = $af->getArtifactById($changerequest_id);
+
+        if(!$artifact){
+            throw new NotFoundException('Error : Change Request not found', 'fetchChangeRequest' );
+        }
+        $art = array($artifact);
+
+        $changerequest = new ChangeRequestsCodendiDb($art, $requested_fields);
+
+        return $this->prepareChangeRequest($changerequest[$changerequest_id], $uri);
+    }
+
+    /**
+     * Updates an existant Codendi ChangeRequest in the tracker DataBase.
+     * @param int $identifier id of the ChangeRequest within Codendi tracker
+     * @param ChangeRequest the change request given as input for the PUT request.
+     * @param array $props array of the properties that PUT request is going to change 
+     * @return boolean true if success, false otherwise.
+     */
+    public function updateChangeRequest($changerequest_id, $group_id, $tracker_id, $changerequest, $props) {
+        $user = UserManager::instance()->getCurrentUser();
+        $pm = ProjectManager::instance();
+        $project = $pm->getProject($group_id);
+        if (! $project || ! is_object($project)) {
+            throw new Exception('Error : Could Not Get Group','updateChangeRequest');
+        } elseif ($project->isError()) {
+            throw new Exception('Error : ' . $project->getErrorMessage(),'updateChangeRequest');
+        }
+        if ( ! checkRestrictedAccess($project)) {
+            throw new Exception('Error, Restricted user: permission denied.', 'updateChangeRequest');
+        }
+
+        $tf = TrackerFactory::instance();
+        $tracker = $tf->getTrackerById($tracker_id);
+
+        if ($tracker == null) {
+            throw new Exception('Error : Could not get Tracker.', 'updateChangeRequest');
+        } elseif ($tracker->getGroupId() != $group_id) {
+            throw new Exception('Error : Could not get Tracker.', 'updateChangeRequest');
+        }
+
+        $af = Tracker_ArtifactFactory::instance();
+        if ($artifact = $af->getArtifactById($changerequest_id)) {
+            if ($artifact->getTrackerId() != $tracker_id) {
+                throw new Exception('Error : Could not get Artifact.', 'updateChangeRequest');
+            }
+        }
+
+        // Get the artifact data using its ID. 
+		$art_obj =& artifact_get_object($identifier);
+		$art = $art_obj->data_array;
+
+		$cm_request = $changerequest->container;
+
+		$terms = array('dc:','helios_bt:');
+		foreach($props as &$prop) {
+			$prop = str_replace($terms,"",$prop);
+			//echo $prop;
+		}
+		
+		// Check all the mandatory fields for an artifact update request.
+		
+		// dc:title ===> summary 
+		if(in_array('title',$props))
+		{
+			if(isset($cm_request['title']))
+			{
+				$art['summary'] = $cm_request['title'];			// mandatory
+			}
+			else
+			{
+				throw new BadRequestException("dc:title mentioned in the request query not found in request body!");
+			}
+		}
+		
+		// dc:description ===> details 
+		if(in_array('description',$props))
+		{
+			if(isset($cm_request['description']))
+			{
+				$art['details'] = $cm_request['description'];			// mandatory
+			}
+			else
+			{
+				throw new BadRequestException("dc:decription mentioned in the request query not found in request body!");
+			}
+		}
+		
+		// helios_bt:priority ===> priority 
+		if(in_array('priority',$props))
+		{
+			if(isset($cm_request['priority']))
+			{
+				$art['priority'] = $cm_request['priority'];			// mandatory
+			}
+			else
+			{
+				throw new BadRequestException("helios_bt:priority mentioned in the request query not found in request body!");
+			}
+		}
+		
+		// helios_bt:status ===> status 
+		if(in_array('status',$props))
+		{
+			if(isset($cm_request['status']))
+			{
+				$art['status_id'] = self::$status_arr[$cm_request['status']];			// mandatory
+			}
+			else
+			{
+				throw new BadRequestException("helios_bt:status mentioned in the request query not found in request body!");
+			}
+		}
+		
+		//helios_bt:assigned_to ====> assigned_to
+		if(in_array('assigned_to', $props))
+		{
+			if(isset($cm_request['assigned_to']))
+			{
+				$art['assigned_to'] = $cm_request['assigned_to'];
+			}
+			else 
+			{
+				throw new BadRequestException("helios_bt:assigned_to mentionned in the request query not found in request body!");
+			}
+		}
+		
+		
+		$canned_response=100;
+		
+		// We assume that we don't change the artifact type (bug, task, etc)
+		// in PUT request. 
+		$new_artifact_type_id = $art_obj->ArtifactType->getID();
+		
+		//TODO: figure out if a follow up is in OSLC specs and if it is the case include it.
+		$follow_up_msg = '';
+		
+		if(!$art_obj->update($art['priority'],$art['status_id'],$art['assigned_to'],$art['summary'],$canned_response,$follow_up_msg,$new_artifact_type_id,array(),$art['details']))
+		{
+			throw new Exception($art_obj->getErrorMessage());
+		}
+	}
+
+    /**
+     * Returns the list of projects of the user.
+     * @todo fix this method.
+     */
+    public function getProjectsList() {
+        $uM = UserManager::instance();
+        $pM = ProjectManager::instance();
+        $user = $uM->getCurrentUser();
+        if($user->getId() != 0) {
+            $project_ids = $user->getProjects();
+        } else {
+            return $this->createProjectsArray($pM->getAllPublicProjects()); 
+        }
+        foreach($project_ids as $id) {
+            $projects[$id] = $pM->getProject($id);
+        }
+        $uM->logout(); 
+        return $this->createProjectsArray($projects);
+	}
+	
+    /**
+     *  Converts projects objects into a single projects array.
+     *  We only set the id and the public name of each project 
+     *  into the array.
+     *  @param array $projects array of projects indexed by their relative ids
+     */
+    private function createProjectsArray($projects) {
+        $return = array();
+        foreach($projects as $prj_idx => $project){
+            $return[$prj_idx] = array(
+                'id'                => $prj_idx, 
+                'name'              => $project->getPublicName()
+            );
+        }
+        return $return;
+    }
+
+/**
+ * updateArtifact - update the artifact $artifact_id in tracker $tracker_id of the project $group_id with given values
+ *
+ * @param string $sessionKey  the session hash associated with the session opened by the person who calls the service
+ * @param int    $group_id    the ID of the group we want to update the artifact
+ * @param int    $tracker_id  the ID of the tracker we want to update the artifact
+ * @param int    $artifact_id the ID of the artifact to update
+ * @param array{SOAPArtifactFieldValue} $value the fields value to update
+ * @param string $comment     the comment associated with the modification, or null if no follow-up comment.
+ *
+ * @return int The artifact id if update was fine,
+ *              or a soap fault if :
+ *              - group_id does not match with a valid project, 
+ *              - tracker_id does not match with a valid tracker,
+ *              - artifact_id does not match with a valid artifact,
+ *              - the given values are breaking a field dependency rule
+ *              - the artifact modification failed.
+ */
+function updateArtifact($sessionKey, $group_id, $tracker_id, $artifact_id, $value, $comment) {
+    if (session_continue($sessionKey)) {
+        $user = UserManager::instance()->getCurrentUser();
+        $pm = ProjectManager::instance();
+        $project = $pm->getProject($group_id);
+        if (! $project || ! is_object($project)) {
+            return new SoapFault(get_group_fault,'Could Not Get Group','updateArtifact');
+        } elseif ($project->isError()) {
+            return new SoapFault(get_group_fault, $project->getErrorMessage(),'updateArtifact');
+        }
+        if ( ! checkRestrictedAccess($project)) {
+            return new SoapFault(get_group_fault, 'Restricted user: permission denied.', 'updateArtifact');
+        }
+        
+        $tf = TrackerFactory::instance();
+        $tracker = $tf->getTrackerById($tracker_id);
+        if ($tracker == null) {
+            return new SoapFault(get_tracker_fault, 'Could not get Tracker.', 'updateArtifact');
+        } elseif ($tracker->getGroupId() != $group_id) {
+            return new SoapFault(get_tracker_fault, 'Could not get Tracker.', 'updateArtifact');
+        }
+        
+        $af = Tracker_ArtifactFactory::instance();
+        if ($artifact = $af->getArtifactById($artifact_id)) {
+            if ($artifact->getTrackerId() != $tracker_id) {
+                return new SoapFault(get_tracker_fault, 'Could not get Artifact.', 'updateArtifact');
+            }
+            
+            //Check Field Dependencies
+            // TODO : implement it
+            /*require_once('common/tracker/ArtifactRulesManager.class.php');
+            $arm =& new ArtifactRulesManager();
+            if (!$arm->validate($ath->getID(), $data, $art_field_fact)) {
+                return new SoapFault(invalid_field_dependency_fault, 'Invalid Field Dependency', 'updateArtifact');
+            }*/
+            
+            $fef = Tracker_FormElementFactory::instance();
+            
+            $fields_data = array();
+            foreach ($value as $field_value) {
+                // field are identified by name, we need to retrieve the field id
+                if ($field_value->field_name) {
+                    
+                    $field = $fef->getUsedFieldByName($tracker_id, $field_value->field_name);
+                    if ($field) {
+                        
+                        $field_data = $field->getFieldData($field_value->field_value);
+                        if ($field_data != null) {
+                            // $field_value is an object: SOAP must cast it in ArtifactFieldValue
+                            if (isset($fields_data[$field->getId()])) {
+                                if ( ! is_array($fields_data[$field->getId()]) ) {
+                                    $fields_data[$field->getId()] = array($fields_data[$field->getId()]);
+                                }
+                                $fields_data[$field->getId()][] = $field_data;
+                            } else {
+                                $fields_data[$field->getId()] = $field_data;
+                            }
+                        } else {
+                            return new SoapFault(update_artifact_fault, 'Unknown value ' . $field_value->field_value . ' for field: '.$field_value->field_name ,'addArtifact');
+                        }
+                    } else {
+                        return new SoapFault(update_artifact_fault, 'Unknown field: '.$field_value->field_name ,'addArtifact');
+                    }
+                }
+            }
+            
+            if ($artifact->createNewChangeset($fields_data, $comment, $user, null)) {
+                return $artifact_id;
+            } else {
+                $response = new Response();
+                if ($response->feedbackHasErrors()) {
+                    return new SoapFault(update_artifact_fault, $response->getRawFeedback(),'updateArtifact');
+                } else {
+                    return new SoapFault(update_artifact_fault, 'Unknown error','updateArtifact');
+                }
+            }
+        } else {
+            return new SoapFault(get_tracker_fault, 'Could not get Artifact.', 'updateArtifact');
+        }
+        
+    } else {
+        return new SoapFault(invalid_session_fault,'Invalid Session ','updateArtifact');
+    }
+}
+
+}
+?>
\ No newline at end of file

Modified: branches/Branch_5_1/src/plugins/oslc/include/oslc-zend/application/controllers/FusionForgeCmController.php
===================================================================
--- branches/Branch_5_1/src/plugins/oslc/include/oslc-zend/application/controllers/FusionForgeCmController.php	2011-02-10 15:08:05 UTC (rev 12218)
+++ branches/Branch_5_1/src/plugins/oslc/include/oslc-zend/application/controllers/FusionForgeCmController.php	2011-02-10 15:10:40 UTC (rev 12219)
@@ -124,6 +124,16 @@
 			$this->_forward('oslcCmServiceDocument');
 			return;
 		}
+		// Handle creation UI access
+		elseif (isset($params['ui']) && $params['ui'] == 'creation' && isset($params['project']) && isset($params['tracker'])){
+			$this->_forward('showCreationUi');
+			return;
+		}
+		// Handle selection UI access 
+		elseif (isset($params['ui']) && $params['ui'] == 'selection' && isset($params['project']) && isset($params['tracker'])){
+			$this->_forward('showSelectionUi');
+			return;
+		}
 		
 		// Now, do the OSLC-CM resources access work
 		// if no bug was mentioned, then return a resource collection
@@ -187,12 +197,17 @@
 			$contenttype = $contenttype ? $contenttype : 'none';
 
 			switch($contenttype) {
+				case 'application/x-oslc-cm-change-request+xml; charset=UTF-8':
+				case 'application/x-oslc-cm-change-request+json; charset=UTF-8':
+				case 'application/xml; charset=UTF-8':
+				case 'application/json; charset=UTF-8':
 				case 'application/x-oslc-cm-change-request+xml':
 				case 'application/x-oslc-cm-change-request+json':
 				case 'application/xml':
+				case 'application/json':
 					break;
 				default:
-					throw new Exception('Unknown Content-Type for method put : '. $contenttype .' !');
+					throw new UnsupportedMediaTypeException('Unknown Content-Type for method put : '. $contenttype .' !');
 					break;
 			}
 
@@ -227,12 +242,17 @@
 
 			// TODO: This should be done by $this->oslc
 			switch($contenttype) {
+				case 'application/x-oslc-cm-change-request+xml; charset=UTF-8':
+				case 'application/xml; charset=UTF-8':
 				case 'application/x-oslc-cm-change-request+xml':
 				case 'application/xml':
 					// extract values from XML
 					$newchangerequest = FusionForgeChangeRequest::CreateFusionForgeArrayFromXml($body);
 					break;
+				case 'application/x-oslc-cm-change-request+json; charset=UTF-8':
+				case 'application/json; charset=UTF-8':
 				case 'application/x-oslc-cm-change-request+json':
+				case 'application/json':
 					// extract values from JSON.
 					$newchangerequest = FusionForgeChangeRequest::CreateFusionForgeArrayFromJson($body);
 					break;
@@ -280,7 +300,10 @@
 			case 'application/x-oslc-cm-change-request+xml':
 			case 'application/x-oslc-cm-change-request+xml; charset=UTF-8':
 			case 'application/x-oslc-cm-change-request+json':
+			case 'application/x-oslc-cm-change-request+json; charset=UTF-8':
 			case 'application/json':
+			case 'application/json; charset=UTF-8':
+			case 'application/xml; charset=UTF-8':
 			case 'application/xml':
 				break;
 			default:
@@ -300,12 +323,16 @@
 			if (array_key_exists('tracker', $params)) {
 				// create a change request
 				switch($contenttype) {
+					case 'application/x-oslc-cm-change-request+xml; charset=UTF-8':
 					case 'application/x-oslc-cm-change-request+xml':
+					case 'application/xml; charset=UTF-8':
 					case 'application/xml':
-					case 'application/x-oslc-cm-change-request+xml; charset=UTF-8':
 						$newchangerequest = FusionForgeChangeRequest::CreateFusionForgeArrayFromXml($body);
 						break;
+					case 'application/x-oslc-cm-change-request+json; charset=UTF-8':
 					case 'application/x-oslc-cm-change-request+json':
+					case 'application/json; charset=UTF-8':
+					case 'application/json':
 						$newchangerequest = FusionForgeChangeRequest::CreateFusionForgeArrayFromJson($body);
 						break;
 				}
@@ -487,7 +514,24 @@
 
 	}
 
+	public function showselectionuiAction()	{
+		$req = $this->getRequest();
+		$params = $req->getParams();
+		$project = $params['project'];
+		$tracker = $params['tracker'];
+		$data = $this->oslc->getDataForSelectionUi($project, $tracker);
+		$this->view->data = $data;
+	}
 	
+	public function showcreationuiAction() {
+		$req = $this->getRequest();
+		$params = $req->getParams();
+		$project = $params['project'];
+		$tracker = $params['tracker'];
+		$data = $this->oslc->getDataForCreationUi($project, $tracker);
+		$this->view->data = $data;
+	}
+	
 		/**
 	 * Performs authentication according to the configured AUTH_TYPE configured
 	 *

Modified: branches/Branch_5_1/src/plugins/oslc/include/oslc-zend/application/controllers/FusionForgeOSLCConnector.php
===================================================================
--- branches/Branch_5_1/src/plugins/oslc/include/oslc-zend/application/controllers/FusionForgeOSLCConnector.php	2011-02-10 15:08:05 UTC (rev 12218)
+++ branches/Branch_5_1/src/plugins/oslc/include/oslc-zend/application/controllers/FusionForgeOSLCConnector.php	2011-02-10 15:10:40 UTC (rev 12219)
@@ -40,6 +40,7 @@
 require_once $gfwww.'include/pre.php';
 
 require_once $gfwww.'tracker/include/ArtifactTypeHtml.class.php';
+require_once $gfcommon.'tracker/ArtifactType.class.php';
 require_once $gfcommon.'tracker/ArtifactFactory.class.php';
 require_once $gfcommon.'include/Group.class.php';
 require_once $gfcommon.'include/FusionForge.class.php';
@@ -55,6 +56,26 @@
 
 
 	private static $status_arr = array('open'=>1, 'closed'=>2, 'deleted' => 3);
+	private static $query_properties = array(
+		'dc:identifier',
+		'dc:title',
+		'dc:description',
+		'dc:creator',
+		'helios_bt:status',
+		'helios_bt:priority',
+		'helios_bt:assigned_to',
+		'dc:modified',
+		'dc:created'
+	);
+	private static $orderBy_properties = array(
+		'dc:identifier',
+		'dc:title',
+		'dc:created',
+		'dc:creator',
+		'dc:closed',
+		'helios_bt:assigned_to',
+		'helios_bt:priority'
+	);
 	
 	/**
 	 * Filter parameters provided in the REST GET request to check whether mandatory ones are set.
@@ -108,7 +129,6 @@
 	 *  Constructs the model from fusionforge db by fetching the change requests requested
 	 *  through an oslc query.
 	 *  @param array $filter array of the query settings.
-	 *  @param array $fields array of the requested fields
 	 *  @TODO: Implement oslc_searchTerms
 	 *  @TODO: Implement oslc_select
 	 */
@@ -147,7 +167,7 @@
 								throw new BadRequestException("Invalid helios_bt:assigned_to: " . $term[2]); 
 							}
 							break;
-						default:  throw new BadRequestException("Invalid attribute ".$term[1]." specified in oslc_where! only heliosbt:status|assignedto are accepted.");
+						default:  throw new BadRequestException("Invalid attribute ".$term[1]." specified in oslc_where! only heliosbt:status|assigned_to are accepted.");
 						break;
 					}
 				}
@@ -280,7 +300,92 @@
 			$this->changerequests = new ChangeRequestsFusionForgeDb($art_arr);
 		}
 	}
-	
+	/**
+	 * Retrieves needed data for the display of the creation UI.
+	 * 
+	 * @param int $project project id
+	 * @param int $tracker tracker id
+	 * 
+	 * @return array $data tracker fields and their respective possible values.
+	 */
+	public function getDataForCreationUi($project, $tracker) {
+		$data = array();
+		$data['project'] = $project;
+		$data['tracker'] = $tracker;
+
+		$group = group_get_object($project);
+		if (!$at = new ArtifactType($group, $tracker)){
+			throw new Exception('Error : Could not instanciate project Tracker');
+		} else {
+			// construct data for tracker extra fields and their values.
+			$extrafields = $at->getExtraFields();
+			$keys = array_keys($extrafields);
+			for ($k = 0; $k<count($keys); $k++){
+				$i = $keys[$k];
+				if ($extrafields[$i]['field_type'] == ARTIFACT_EXTRAFIELDTYPE_SELECT){
+					$efelements = $at->getExtraFieldElements($extrafields[$i]);
+					foreach ($efelements as $key => $value){
+						$data[$extrafields[$i]['field_name']][] = $efelements[$key]['element_name'];
+					}
+				} elseif ($extrafields[$i]['field_type'] == ARTIFACT_EXTRAFIELDTYPE_TEXT) {
+					$data[$extrafields[$i]['field_name']] = '';
+				}
+			}
+
+			// Add assigned to data. We use default FusionForge UI for assigned_to selectBox. 
+			$ath = new ArtifactTypeHtml($group,$tracker);
+			$data['assigned_to'] = $ath->technicianBox('assigned_to'); 
+
+			// Add priority data. We use default FusionForge UI for priority selectBox.
+			$data['priority'] = build_priority_select_box('priority');
+						
+			// Add summary and detailed description.
+			$data['summary'] = '';
+			$data['description'] = '';
+			
+			//return data for creation UI.
+			return $data;
+		}
+	}
+
+	/**
+	 * Retrieves needed data for the display of the selection UI.
+	 * 
+	 * @param int $project project id
+	 * @param int $tracker tracker id
+	 * 
+	 * @return array $data tracker fields and their respective possible values.
+	 */
+	public function getDataForSelectionUi($project, $tracker) {
+		$data = array();
+		$data['project'] = $project;
+		$data['tracker'] = $tracker;
+
+		$group = group_get_object($project);
+		if (!$at = new ArtifactType($group, $tracker)){
+			throw new Exception('Error : Could not instanciate project Tracker');
+		} else {
+			// Construct array for oslc.where with all possible values for each attribute
+			// Currently only helios_bt:status and helios_bt:assigned_to are supported for
+			// oslc.where query.
+			$engine = RBACEngine::getInstance() ;
+			$techs = $engine->getUsersByAllowedAction ('tracker', $tracker, 'tech') ;
+			foreach ($techs as $tech) {
+				$data['where']['assigned_to'][] = $tech->getRealName();
+			}
+			$data['where']['status'] = self::$status_arr;
+			
+			//construct array for oslc.properties with all possible values for each attribute
+			$data['properties'] = self::$query_properties;
+			
+			// Construct array for oslc.orderBy 
+			$data['orderBy'] = self::$orderBy_properties;
+			
+			// Return data needed for selection UI.
+			return $data;
+		}
+	}
+
 	/*
 	 * Constructs the model from the FusionForge DB by fetching the requested changeRequests.
 	 *

Modified: branches/Branch_5_1/src/plugins/oslc/include/oslc-zend/application/controllers/MantisCmController.php
===================================================================
--- branches/Branch_5_1/src/plugins/oslc/include/oslc-zend/application/controllers/MantisCmController.php	2011-02-10 15:08:05 UTC (rev 12218)
+++ branches/Branch_5_1/src/plugins/oslc/include/oslc-zend/application/controllers/MantisCmController.php	2011-02-10 15:10:40 UTC (rev 12219)
@@ -129,6 +129,7 @@
 	private function retrieveAuthentication(&$login) {
 		switch (AUTH_TYPE) {
 			case 'basic':
+				//print_r("BASIC");
 				return $this->retrieveRequestAuthHttpBasic($login);
 				break;
 			case 'oauth':
@@ -311,12 +312,16 @@
 		{
 			$this->_forward('showSelectionUi');
 			//echo "here";exit;
+		}
+		elseif(($params['ui']=="creation")&&isset($params['project']))
+		{
+			$this->_forward('showCreationUi');
+			//echo "here";exit;
 		}		
 		elseif(preg_match("/^\/cm\/bug\/[1-9]+[0-9]*\/notes[\/]?$/", $this->getRequest()->getPathInfo()))
 		{
 			$this->_forward('readBugnoteCollection');
-		}
-		
+		}		
 		elseif(preg_match("/^\/cm\/notes\/[1-9]+[0-9]*[\/]?$/", $this->getRequest()->getPathInfo()))
 		{
 			$this->_forward('readBugnote');
@@ -421,6 +426,10 @@
 			$contenttype = $contenttype ? $contenttype : 'none';
 
 			switch($contenttype) {
+				case 'application/x-oslc-cm-change-request+xml; charset=UTF-8':
+				case 'application/x-oslc-cm-change-request+json; charset=UTF-8':
+				case 'application/xml; charset=UTF-8':
+				case 'application/json; charset=UTF-8':
 				case 'application/x-oslc-cm-change-request+xml':
 				case 'application/x-oslc-cm-change-request+json':
 				case 'application/xml':
@@ -481,10 +490,14 @@
 			*/
 			// TODO: This should be done by $this->oslc
 			switch($contenttype) {
+				case 'application/x-oslc-cm-change-request+xml; charset=UTF-8':
+				case 'application/xml; charset=UTF-8':
 				case 'application/x-oslc-cm-change-request+xml':
 				case 'application/xml':
 					$newchangerequest = MantisChangeRequest::CreateMantisArrayFromXml($body);
 					break;
+				case 'application/x-oslc-cm-change-request+json; charset=UTF-8':
+				case 'application/json; charset=UTF-8':
 				case 'application/x-oslc-cm-change-request+json':
 				case 'application/json':
 					$newchangerequest = MantisChangeRequest::CreateMantisArrayFromJson($body);
@@ -548,11 +561,14 @@
 			case 'application/x-oslc-cm-change-request+xml':
 			case 'application/x-oslc-cm-change-request+xml; charset=UTF-8':
 			case 'application/x-oslc-cm-change-request+json':
+			case 'application/x-oslc-cm-change-request+json; charset=UTF-8':
 			case 'application/json':
+			case 'application/json; charset=UTF-8':
+			case 'application/xml; charset=UTF-8':
 			case 'application/xml':
 				break;
 			default:
-				//print_r('exception');
+				//print_r('exception: '.$contenttype);
 				throw new UnsupportedMediaTypeException('Unknown Content-Type for method post : '. $contenttype .' !');
 				break;
 		}
@@ -574,11 +590,14 @@
 			// create a change request
 			switch($contenttype) {
 				case 'application/x-oslc-cm-change-request+xml':
+				case 'application/xml; charset=UTF-8':
 				case 'application/xml':
 				case 'application/x-oslc-cm-change-request+xml; charset=UTF-8':
 					$newchangerequest = MantisChangeRequest::CreateMantisArrayFromXml($body);
 					break;
+				case 'application/x-oslc-cm-change-request+json; charset=UTF-8':
 				case 'application/x-oslc-cm-change-request+json':
+				case 'application/json; charset=UTF-8':
 				case 'application/json':
 					$newchangerequest = MantisChangeRequest::CreateMantisArrayFromJson($body);
 					break;
@@ -593,12 +612,15 @@
 		elseif(array_key_exists('bug',$params))
 		{
 			switch($contenttype) {
+				case 'application/xml; charset=UTF-8':
 				case 'application/x-oslc-cm-change-request+xml':
 				case 'application/xml':
 				case 'application/x-oslc-cm-change-request+xml; charset=UTF-8':
 					$notes_arr = MantisChangeRequest::CreateMantisNotesArrayFromXml($body);
 					break;
+				case 'application/x-oslc-cm-change-request+json; charset=UTF-8':
 				case 'application/x-oslc-cm-change-request+json':
+				case 'application/json; charset=UTF-8':
 				case 'application/json':
 					$notes_arr = MantisChangeRequest::CreateMantisNotesArrayFromJson($body);
 					break;
@@ -866,6 +888,15 @@
 		$this->view->data = $data;
 	}
 	
+	public function showcreationuiAction()
+	{
+		$req = $this->getRequest();
+		$params = $req->getParams();
+		$project = $params['project'];
+		$data = $this->oslc->getDataForCreationUi($project);
+		$this->view->data = $data;
+	}
+	
 }
 
 ?>

Modified: branches/Branch_5_1/src/plugins/oslc/include/oslc-zend/application/controllers/MantisOSLCConnector.php
===================================================================
--- branches/Branch_5_1/src/plugins/oslc/include/oslc-zend/application/controllers/MantisOSLCConnector.php	2011-02-10 15:08:05 UTC (rev 12218)
+++ branches/Branch_5_1/src/plugins/oslc/include/oslc-zend/application/controllers/MantisOSLCConnector.php	2011-02-10 15:10:40 UTC (rev 12219)
@@ -157,6 +157,8 @@
 	
 	private static $severity_arr = array('feature'=>10, 'trivial'=>20, 'text'=>30, 'tweak'=>40, 'minor'=>50, 'major'=>60, 'crash'=>70, 'block'=>80);
 	
+	private static $reproducibility_arr = array('always'=>10, 'sometimes'=>30, 'random'=>50, 'have not tried'=>70, 'unable to duplicate'=>90, 'not applicable'=>100);
+	
 	private static $where_params = array(
 		'dc:creator',
 		'dc:type',
@@ -266,7 +268,7 @@
 		$query['view_type'] = "advanced";
 		$query['user_monitor'][]= 0;
 		$query['handler_id'][] = 0;
-		$query['show_resol$orderBy_paramsution'][] = 0;
+		$query['show_resolution'][] = 0;
 		$query['show_profile'][] = 0;
 		$query['view_state'] = 0;
 		$query['sticky_issues'] = "on";
@@ -349,7 +351,7 @@
 							break;
 						case self::$where_params[6]:
 							$v_num_id = custom_field_get_id_from_name("version_number");
-							if(custom_field_validate( $v_num_id, $term[2] ))	{
+							if(($v_num_id!=false)&&(custom_field_validate( $v_num_id, $term[2] )))	{
 								$query['custom_field_'.$v_num_id][] = $term[2];
 							}else {
 								throw new BadRequestException("Invalid value ".$term[2]." specified for mantisbt:version_number!");
@@ -357,7 +359,7 @@
 							break;
 						case self::$where_params[7]:
 							if(project_exists(project_get_id_by_name($term[2])))	{
-								$query['project_id'][] = $term[2];
+								$query['project_id'][] = project_get_id_by_name($term[2]);
 							}else {
 								throw new BadRequestException("Invalid value ".$term[2]." specified for mantisbt:project!");
 							}
@@ -459,6 +461,72 @@
 	}
 	
 	/*
+	 * Retrieves the data to be displayed in the creation ui
+	 */
+	public function getDataForCreationUi($project)
+	{
+		$data = array();
+		
+		//check project validity
+		if(!is_numeric($project)) {
+			$project = project_get_id_by_name($project);
+		}
+		if(project_exists($project))	{
+			$data['project'] = project_get_name($project);
+		}else {
+			throw new BadRequestException("Invalid project specified!");
+		}
+		
+		$fields = config_get( 'bug_report_page_fields');
+		//print_r($fields);
+		//exit;
+		
+		foreach($fields as $field)	{
+			switch($field)	{
+				
+				case 'category_id': foreach(category_get_all_rows($project) as $row){
+										$data[$field][] = $row['name'];
+									}
+									break;
+				case 'view_state' : $data[$field][] = "public";
+									$data[$field][] = "private";
+									break;
+				case 'handler' : 	break;
+				case 'priority' : 	foreach(self::$priority_arr as $key=>$value)	{
+										$data[$field][] = $key;
+									}
+									break;
+				case 'severity' :	foreach(self::$severity_arr as $key=>$value)	{
+										$data[$field][] = $key;
+									}
+									break;
+				case 'reproducibility':	foreach(self::$reproducibility_arr as $key=>$value)	{
+											$data[$field][] = $key;
+										}
+										break;
+				case 'target_version':
+				case 'product_version':	$temp_arr = version_get_all_rows($project);
+										if(!empty($temp_arr))	{
+											foreach ($temp_arr as $version) {
+												$data[$field][] = $version['version'];
+											}
+										}
+										break;
+				case 'summary':
+				case 'description':
+				case 'additional_info':
+				case 'steps_to_reproduce':	$data[$field] = "";
+											break;
+			}
+		}
+		
+		//print_r($data);
+		//exit;
+		return $data;
+		
+	}
+	
+	/*
 	 * Retrieves the data to be displayed in the selection ui
 	 */
 	public function getDataForSelectionUi($project)
@@ -516,9 +584,12 @@
 			}
 			if($param=='mantisbt:version_number')
 			{
-				$def = custom_field_get_definition(custom_field_get_id_from_name("version_number"));
-				foreach (custom_field_distinct_values($def, $project) as $v_num) {
-					$data['where'][$param][] = $v_num;
+				$v_id = custom_field_get_id_from_name("version_number");
+				if(($v_id!=false)&&(custom_field_is_linked($v_id, $project)))	{
+					$def = custom_field_get_definition($v_id);
+					foreach (custom_field_distinct_values($def, $project) as $v_num) {
+						$data['where'][$param][] = $v_num;
+					}
 				}
 				
 			}
@@ -526,7 +597,27 @@
 		}
 		
 		//construct array for oslc.properties
-		$data['properties'] = self::$properties_params;
+		foreach(self::$properties_params as $prop)	{
+			switch($prop)	{
+				case 'mantisbt:target_version':
+				case 'mantisbt:version':
+					$temp_arr = version_get_all_rows($project);
+					if(!empty($temp_arr))	{
+						$data['properties'][] = $prop;
+					}
+					break;
+					
+				case 'mantisbt:version_number':
+					if(custom_field_get_id_from_name("version_number")!=false)	{
+						$data['properties'][] = $prop;
+					}
+					break;
+					
+				default:
+					$data['properties'][] = $prop;
+					
+			}
+		}
 		
 		//construct array for oslc.orderBy
 		$data['orderBy'] = self::$orderBy_params;
@@ -546,7 +637,7 @@
 		$post = array();
 		$post = $this->createQueryFromFilter($filter);
 		
-		//print_r($post);
+		//print_r($post); exit;
 		foreach($post as $key => $value) //to mimic POST action on view_all_set.php
 		{
 			$_POST[$key] = $value;
@@ -600,68 +691,25 @@
 	protected function fetchChangeRequests($params=null)
 	{
 		$rows	= null;
-
-		// This has only been tested really with GET/retrieval
-		if (is_array($params)) {
-			$project = null;	
-		
-			if (isset($params['project'])) {
-				$project = $params['project'];
+		//print_r($params);
+		if(empty($params))	{
+			$arr['where']['terms'][] = array();
+			$this->postQuery($arr, null);
+		}
+		elseif(isset($params['project']))	{
+			if(is_numeric($params['project']))	{
+				if(( $params['project'] == 0 ) || !project_exists( $params['project'])) {
+					throw new NotFoundException("Project does not exist!!!");
+				}
+				else {
+					$params['project'] = project_get_name($params['project']);
+				}
 			}
-
-			//global $g_log_level;
-			//$g_log_level = LOG_FILTERING;
-
-			$t_offline_file = dirname( dirname( __FILE__ ) ) . DIRECTORY_SEPARATOR . 'mantis_offline.php';
-			//	print_r($t_offline_file);
-			//	if ($t_offline_file)
-			//	   print_r('problem');
-
-			$user_id = null;
-			//		$return_val = auth_attempt_script_login( 'administrator' );
-			
-			if (auth_is_user_authenticated())
-			{
-				// this normally redirects to login page
-				$user_id = auth_get_current_user_id();
-			}
-
-			if (! isset($user_id)) {
-				throw new Exception('Could not authenticate user '.$login.' !');
-			}
-			//auth_ensure_user_authenticated();
-			//print_r('do query');
-			$f_page_number = 1;
-			$t_per_page = -1 ; // all bugs at once
-			$t_page_count = null;
-			$t_bug_count = null;
-			$t_custom_filter = null;
-			if(is_int($project))
-			{
-				$t_project_id = $project;
-			}
-			else
-			{
-				$t_project_id = project_get_id_by_name($project);
-			}
-			
-			//print_r($t_project_id);
-			$t_user_id = null;
-			$t_show_sticky = null;
-
-			$rows = filter_get_bug_rows( $f_page_number, $t_per_page, $t_page_count, $t_bug_count, $t_custom_filter, $t_project_id, $t_user_id, $t_show_sticky);
-			//print_r($t_bug_count);
-			//print_r('Rows :');
-			//print_r($rows);
-			//exit(0);
-			if ( $rows === false ) {
-				throw new NotFoundException('No bugs found !');
-			}
+			$arr['where']['terms'][] = array("=","mantisbt:project",'"'.$params['project'].'"');
+			$this->postQuery($arr, null);
 		}
+		
 
-		$this->changerequests = new ChangeRequestsMantisDb($rows, $params['fields']);
-		//print_r($this->changerequests);
-
 	}
 	
 	public function getChangeRequest($id, $uri)
@@ -1097,6 +1145,18 @@
 		}
 	}
 	
+	private function checkReproducibility($reproducibility, &$cm_data)
+	{
+		if (array_key_exists($reproducibility,self::$reproducibility_arr))
+		{
+			$cm_data->reproducibility = self::$reproducibility_arr[$reproducibility];
+		}
+		else
+		{
+			throw new BadRequestException('Unknown mantisbt:reproducibility value specified!');
+		}
+	}
+	
 	private function checkVersion($version, &$cm_data)
 	{
 		if(version_get_id($version, $cm_data->project_id ))
@@ -1222,9 +1282,10 @@
 		
 		//mantisbt:priority
 		//print_r($cm_request['priority']);
-		$cm_request['priority'] = strtolower($cm_request['priority']);
+		
 		if(isset($cm_request['priority']))
 		{
+			$cm_request['priority'] = strtolower($cm_request['priority']);
 			$this->checkPriority($cm_request['priority'], $cm_data);			
 		}
 		else
@@ -1233,9 +1294,9 @@
 		}
 		
 		//mantisbt:severity
-		$cm_request['severity'] = strtolower($cm_request['severity']);
 		if(isset($cm_request['severity']))
 		{
+			$cm_request['severity'] = strtolower($cm_request['severity']);
 			$this->checkSeverity($cm_request['severity'], $cm_data);
 		}
 		else
@@ -1243,6 +1304,18 @@
 			$cm_data->severity = config_get( 'default_bug_severity' );
 		}
 		
+		//mantisbt:reproducibility
+		if(isset($cm_request['reproducibility']))
+		{
+			$cm_request['reproducibility'] = strtolower($cm_request['reproducibility']);
+			$this->checkReproducibility($cm_request['reproducibility'], $cm_data);
+		}
+		else
+		{
+			$cm_data->reproducibility = config_get( 'default_bug_reproducibility' );
+		}
+		
+		//cases to be chked when versions not specified
 		if ( isset( $cm_request['version'] ) && !is_blank( $cm_request['version'] ) )
 		{
 			//$v_id = version_get_id( $cm_request['version'], $cm_data->project_id );
@@ -1255,22 +1328,43 @@
 			$this->checkTargetVersion($cm_request['target_version'], $cm_data);						
 		}
 		
+		//mantisbt:steps_to_reproduce
+		if(isset($cm_request['steps_to_reproduce'])) {
+			$cm_data->steps_to_reproduce = $cm_request['steps_to_reproduce'];
+		}else{
+			$cm_data->steps_to_reproduce = config_get( 'default_bug_steps_to_reproduce' );
+		}
 		
+		//mantisbt:additional_information
+		if(isset($cm_request['additional_information'])) {
+			$cm_data->additional_information = $cm_request['additional_information'];
+		}else{
+			$cm_data->additional_information = config_get( 'default_bug_additional_info' );
+		}
 		
+		//mantisbt:view_state
+		if(isset($cm_request['view_state'])) {
+			if($cm_request['view_state']=="public")	{
+				$cm_data->view_state = VS_PUBLIC;
+			}elseif($cm_request['view_state']=="private")	{
+				$cm_data->view_state = VS_PRIVATE;
+			}else	{
+				throw new BadRequestException('Unknown mantisbt:view_state value specified!');
+			}
+		}else{
+			$cm_data->view_state = config_get( 'default_bug_view_status' );
+		}	
+		
 		$cm_data->handler_id = 0;
 		$cm_data->profile_id = 0;
-
-		$cm_data->view_state = config_get( 'default_bug_view_status' );
-		$cm_data->reproducibility = config_get( 'default_bug_reproducibility' );
+				
 		$cm_data->status = config_get( 'bug_submit_status' );		
 		$cm_data->projection = config_get( 'default_bug_projection' );
 		$cm_data->eta = config_get( 'default_bug_eta' );
 		$cm_data->resolution = config_get( 'default_bug_resolution' );
 		
-		$cm_data->steps_to_reproduce = config_get( 'default_bug_steps_to_reproduce' );
-		$cm_data->additional_information = config_get( 'default_bug_additional_info' );
 		$cm_data->due_date = date_get_null();
-		$cm_data->summary			= trim( $cm_data->summary );
+		$cm_data->summary = trim( $cm_data->summary );
 
 		# still have to add code to Validate the custom fields (for a particular project) before adding the bug
 		

Modified: branches/Branch_5_1/src/plugins/oslc/include/oslc-zend/application/models/ChangeRequests.php
===================================================================
--- branches/Branch_5_1/src/plugins/oslc/include/oslc-zend/application/models/ChangeRequests.php	2011-02-10 15:08:05 UTC (rev 12218)
+++ branches/Branch_5_1/src/plugins/oslc/include/oslc-zend/application/models/ChangeRequests.php	2011-02-10 15:10:40 UTC (rev 12219)
@@ -41,6 +41,8 @@
 		break;
 	case 'fusionforge':
 		break;
+	case 'Codendi':
+		break;
 	case 'demo':
 		// Use the PEAR File_CSV module which handles various kinds of CSV encodings
 		require_once 'File/CSV.php';

Added: branches/Branch_5_1/src/plugins/oslc/include/oslc-zend/application/models/Codendi.inc.php
===================================================================
--- branches/Branch_5_1/src/plugins/oslc/include/oslc-zend/application/models/Codendi.inc.php	                        (rev 0)
+++ branches/Branch_5_1/src/plugins/oslc/include/oslc-zend/application/models/Codendi.inc.php	2011-02-10 15:10:40 UTC (rev 12219)
@@ -0,0 +1,145 @@
+<?php 
+/**
+ * Copyright (c) Institut TELECOM, 2010. All Rights Reserved.
+ *
+ * Originally written by Sabri LABBENE, 201O
+ *
+ * Codendi 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.
+ *
+ * Codendi 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 Codendi. If not, see <http://www.gnu.org/licenses/>.
+ */
+
+require_once('ChangeRequests.php');
+
+
+
+        // will contain an array of fields read in the oslc:ChangeRequest
+        $resource = null;
+
+        // we use simplexml PHP library which supports namespaces
+
+        /*******Sample CR*****************************************
+         * 
+         * <?xml version="1.0"?>
+         * <rdf:RDF xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#">
+         *   <oslc_cm:ChangeRequest xmlns:oslc_cm="http://open-services.net/xmlns/cm/1.0/">
+         *       <dc:title xmlns:dc="http://purl.org/dc/terms/">Provide import</dc:title>
+         *       <dc:identifier xmlns:dc="http://purl.org/dc/terms/">1234</dc:identifier>
+         *       <dc:type xmlns:dc="http://purl.org/dc/terms/">http://myserver/mycmapp/types/Enhancement</dc:type>
+         *       <dc:description xmlns:dc="http://purl.org/dc/terms/">Implement the system's import capabilities.</dc:description>
+         *       <dc:subject xmlns:dc="http://purl.org/dc/terms/">import</dc:subject>
+         *       <dc:creator xmlns:dc="http://purl.org/dc/terms/">mailto:aadams at someemail.com</dc:creator>
+         *       <dc:modified xmlns:dc="http://purl.org/dc/terms/">2008-09-16T08:42:11.265Z</dc:modified>
+         *   </oslc_cm:ChangeRequest>
+         * </rdf:RDF>
+         *           
+         */
+
+/*        $dc_attr = array("title", "identifier", "description","creator","modified","created");
+        $fusionforgebt_attr = array("status","priority", "assigned_to");
+
+        $xml = simplexml_load_string($xmlstr);
+
+		$namespace = $xml->getNamespaces(true);
+
+*/
+// Represents a base of changerequests loaded from Codendi DB
+class ChangeRequestsCodendiDb extends ChangeRequests {
+    function __construct($art_arr, $fields='') {
+        parent::__construct();
+        $changerequestsdata = $this->convert_artifacts_array($art_arr, $fields);
+        foreach ($changerequestsdata as $identifier => $data) {
+            $this->_data[$identifier] = ChangeRequest::Create('Codendi');
+            $this->_data[$identifier] = $data;
+        }
+    }
+	
+    /* duplicated from Codendi tracker SOAP API
+     * 
+     * TODO Add code that maps Codendi tracker fields to ontologies (dc, oslc, etc) 
+     * 
+     */
+    protected static function convert_artifacts_array($at_arr, $fields_string) {
+        $CodendiCR_attr = array('artifact_id','group_artifact_id','status_id','priority','submitted_by','assigned_to','open_date','close_date',
+            'summary','details','assigned_unixname','assigned_realname','assigned_email','submitted_unixname','submitted_realname','submitted_email',
+            'status_name','last_modified_date');
+
+        $return = array();
+
+        if (is_array($at_arr) && count($at_arr) > 0) {
+            for ($i=0; $i <count($at_arr); $i++) {
+                // Retrieving the artifact details
+                //**checks whether there is any artifact details exists for this object, if not continue with next loop
+                if(count($at_arr[$i]) < 1) { continue; }
+                $identifier = $at_arr[$i]->data_array['artifact_id'];
+
+                // If specific fields were requested using a query
+                // we only return the requested fields data in the change request.
+                if (strlen($fields_string) > 0) {
+                    $fields = explode(",", $fields_string);
+                }
+
+                if(isset($fields) && is_array($fields) && count($fields) > 0){
+                    foreach ($fields as $field) {
+                        switch ($field) {
+                            case 'dc:identifier': 
+                                $return[$identifier]['identifier'] = $identifier;
+                                break;
+                            case 'dc:title': 
+                                $return[$identifier]['title'] = $at_arr[$i]->data_array['summary'];
+                                break;
+                            case 'dc:description': 
+                                $return[$identifier]['description'] = $at_arr[$i]->data_array['details'];
+                                break;
+                            case 'dc:creator': 
+                                $return[$identifier]['creator'] = $at_arr[$i]->data_array['submitted_realname'];
+                                break;
+                            case 'helios_bt:status': 
+                                $return[$identifier]['helios_bt:status'] = $at_arr[$i]->data_array['status_name'];
+                                break;
+                            case 'helios_bt:priority': 
+                                $return[$identifier]['helios_bt:priority'] = $at_arr[$i]->data_array['priority'];
+                                break;
+                            case 'helios_bt:assigned_to': 
+                                $return[$identifier]['helios_bt:assigned_to'] = $at_arr[$i]->data_array['assigned_realname'];
+                                break;
+                            case 'dc:modified': 
+                                $return[$identifier]['modified'] = $at_arr[$i]->data_array['last_modified_date'];
+                                break;
+                            case 'dc:created': 
+                                $return[$identifier]['created'] = $at_arr[$i]->data_array['open_date'];
+                                break;
+                            default: 
+                                throw new ConflictException("The attribute specified ".$field." cannot be found!");
+                        }
+                    }
+                } else {
+                    //return the by default set of Change request fields.
+                    $return[$identifier]=array(
+                        'identifier'=>$identifier,
+                        'title'=>$at_arr[$i]->data_array['summary'],
+                        'description'=>$at_arr[$i]->data_array['details'],
+                        'helios_bt:status'=>$at_arr[$i]->data_array['status_name'],
+                        'helios_bt:priority'=>$at_arr[$i]->data_array['priority'],
+                        'creator' => $at_arr[$i]->data_array['submitted_realname'],
+                        'helios_bt:assigned_to' => $at_arr[$i]->data_array['assigned_realname'],
+                        'modified' => $at_arr[$i]->data_array['last_modified_date'],
+                        'created' => $at_arr[$i]->data_array['open_date']
+                    );
+                }
+            }
+        }
+        return $return;
+    }
+}
+
+?>

Modified: branches/Branch_5_1/src/plugins/oslc/include/oslc-zend/application/models/mantis.inc.php
===================================================================
--- branches/Branch_5_1/src/plugins/oslc/include/oslc-zend/application/models/mantis.inc.php	2011-02-10 15:08:05 UTC (rev 12218)
+++ branches/Branch_5_1/src/plugins/oslc/include/oslc-zend/application/models/mantis.inc.php	2011-02-10 15:10:40 UTC (rev 12219)
@@ -142,6 +142,7 @@
 	
 	public static function CreateMantisArrayFromJson($jsonstr)
 	{
+		//print_r($jsonstr);
 		$resource = Zend_Json::decode($jsonstr);
 
 		$changerequest = new MantisChangeRequest();
@@ -267,8 +268,10 @@
 				$return[$identifier]=array();
 				$fields = explode(",", $fieldstring);
 				//print_r($fieldstring);
+				$custom_field_array = custom_field_get_linked_ids($row->project_id);
 				
 				if(empty($fieldstring))	{
+					//mandatory attributes
 					$return[$identifier]=array(
 						'identifier'=>$identifier,
 						'title'=>$row->summary,
@@ -278,14 +281,25 @@
 						'mantisbt:status'=>self::$status_arr[$row->status],
 						'mantisbt:priority'=>self::$priority_arr[$row->priority],
 						'mantisbt:severity'=>self::$severity_arr[$row->severity],
-						'mantisbt:version'=>$row->version,
-						'mantisbt:target_version'=>$row->target_version,
 						'modified'=>date(DATE_ATOM,$row->last_updated),
 						'created'=>date(DATE_ATOM,$row->date_submitted)
 						);
+						
+					$temp_arr = version_get_all_rows($row->project_id);
+					if(!empty($temp_arr))	{
+						if($row->version!="")	{
+							$return[$identifier]['mantisbt:version'] = $row->version;
+						}
+						if($row->target_version!="")	{
+							$return[$identifier]['mantisbt:target_version'] = $row->target_version;
+						}
+					}						
+						
 					if ($v_num_id) {
 						$v_num = custom_field_get_value( $v_num_id, $identifier );
-						$return[$identifier]['mantisbt:version_number'] = $v_num;
+						if($v_num!="")	{
+							$return[$identifier]['mantisbt:version_number'] = $v_num;
+						}						
 					}
 					 
 				}else {

Added: branches/Branch_5_1/src/plugins/oslc/include/oslc-zend/application/views/scripts/cm/_add_hyperlinks.php
===================================================================
--- branches/Branch_5_1/src/plugins/oslc/include/oslc-zend/application/views/scripts/cm/_add_hyperlinks.php	                        (rev 0)
+++ branches/Branch_5_1/src/plugins/oslc/include/oslc-zend/application/views/scripts/cm/_add_hyperlinks.php	2011-02-10 15:10:40 UTC (rev 12219)
@@ -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;
+}
+
+
+
+?>

Modified: branches/Branch_5_1/src/plugins/oslc/include/oslc-zend/application/views/scripts/cm/_service-document_xml.php
===================================================================
--- branches/Branch_5_1/src/plugins/oslc/include/oslc-zend/application/views/scripts/cm/_service-document_xml.php	2011-02-10 15:08:05 UTC (rev 12218)
+++ branches/Branch_5_1/src/plugins/oslc/include/oslc-zend/application/views/scripts/cm/_service-document_xml.php	2011-02-10 15:10:40 UTC (rev 12219)
@@ -61,7 +61,7 @@
 	
 	$child = $doc->createElementNS("http://purl.org/dc/terms/", "dc:title");
 	$title = $sq->appendChild($child);
-	$child = $doc->createTextNode("Simple GET-based Bug Query");
+	$child = $doc->createTextNode("Simple Project Query");
 	$child = $title->appendChild($child);
 	
 	$child = $doc->createElementNS("http://open-services.net/xmlns/cm/1.0/", "oslc_cm:url");
@@ -69,6 +69,41 @@
 	$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");

Modified: branches/Branch_5_1/src/plugins/oslc/include/oslc-zend/application/views/scripts/cm/index.phtml
===================================================================
--- branches/Branch_5_1/src/plugins/oslc/include/oslc-zend/application/views/scripts/cm/index.phtml	2011-02-10 15:08:05 UTC (rev 12218)
+++ branches/Branch_5_1/src/plugins/oslc/include/oslc-zend/application/views/scripts/cm/index.phtml	2011-02-10 15:10:40 UTC (rev 12219)
@@ -24,14 +24,8 @@
 <ul>
 	<li>
 	<p><tt>curl -H "Accept: application/x-oslc-disc-service-provider-catalog+xml" -X GET <a 
-		href="<?php 
-				$catalog_uri = $this->serverUrl() . util_make_uri($this->baseUrl().'/cm/oslc-services/');
-				echo $catalog_uri;
-			?>
-		"><?php
-		echo $catalog_uri;
-		?>
-		</a></tt> : to retrieve an HTML view of an RDF/XML OSLC Service Provider Catalog document.</p>
+		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>

Modified: branches/Branch_5_1/src/plugins/oslc/include/oslc-zend/application/views/scripts/cm/oslc-cm-service-document.phtml
===================================================================
--- branches/Branch_5_1/src/plugins/oslc/include/oslc-zend/application/views/scripts/cm/oslc-cm-service-document.phtml	2011-02-10 15:08:05 UTC (rev 12218)
+++ branches/Branch_5_1/src/plugins/oslc/include/oslc-zend/application/views/scripts/cm/oslc-cm-service-document.phtml	2011-02-10 15:10:40 UTC (rev 12219)
@@ -26,6 +26,7 @@
   /* $Id$ */
 
 require('_service-document_xml.php');
+require('_add_hyperlinks.php');
 
 
 /*$child = $doc->createElementNS("http://open-services.net/xmlns/discovery/1.0/", "oslc_disc:ServiceProvider");
@@ -48,7 +49,10 @@
 <pre>
 <?php
 	$xml = project_to_service_description($this->baseUrl(), $this->project);
-	print str_replace('>', '>', str_replace('<', '<', $xml)); ?>
+	$text = str_replace('>', '>', str_replace('<', '<', $xml));
+	$text = add_links($text, "http");
+	$text = add_links($text, $this->baseUrl());
+	echo $text;?>
 </pre>
 </body>
 

Modified: branches/Branch_5_1/src/plugins/oslc/include/oslc-zend/application/views/scripts/cm/oslc-service-catalog.json.phtml
===================================================================
--- branches/Branch_5_1/src/plugins/oslc/include/oslc-zend/application/views/scripts/cm/oslc-service-catalog.json.phtml	2011-02-10 15:08:05 UTC (rev 12218)
+++ branches/Branch_5_1/src/plugins/oslc/include/oslc-zend/application/views/scripts/cm/oslc-service-catalog.json.phtml	2011-02-10 15:10:40 UTC (rev 12219)
@@ -11,4 +11,4 @@
 $json["oslc_disc:ServiceProviderCatalog"] = $catalog;
 
 
-print Zend_Json::prettyPrint(Zend_Json::encode($json));
\ No newline at end of file
+print str_replace("\/", "/", Zend_Json::prettyPrint(Zend_Json::encode($json)));
\ No newline at end of file

Modified: branches/Branch_5_1/src/plugins/oslc/include/oslc-zend/application/views/scripts/cm/oslc-service-catalog.phtml
===================================================================
--- branches/Branch_5_1/src/plugins/oslc/include/oslc-zend/application/views/scripts/cm/oslc-service-catalog.phtml	2011-02-10 15:08:05 UTC (rev 12218)
+++ branches/Branch_5_1/src/plugins/oslc/include/oslc-zend/application/views/scripts/cm/oslc-service-catalog.phtml	2011-02-10 15:10:40 UTC (rev 12219)
@@ -26,8 +26,8 @@
   /* $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);
 
@@ -48,7 +48,11 @@
 <pre>
 <?php
 	$xml = projects_to_service_catalog($this->baseUrl(), $this->projects);
-	print str_replace('>', '>', str_replace('<', '<', $xml)); ?>
+	//print $xml;
+	$text = str_replace('>', '>', str_replace('<', '<', $xml));
+	$text = add_links($text, "http");
+	$text = add_links($text, $this->baseUrl());
+	echo $text;?>
 </pre>
 </body>
 

Modified: branches/Branch_5_1/src/plugins/oslc/include/oslc-zend/application/views/scripts/cm/read-bugnote-collection.json.phtml
===================================================================
--- branches/Branch_5_1/src/plugins/oslc/include/oslc-zend/application/views/scripts/cm/read-bugnote-collection.json.phtml	2011-02-10 15:08:05 UTC (rev 12218)
+++ branches/Branch_5_1/src/plugins/oslc/include/oslc-zend/application/views/scripts/cm/read-bugnote-collection.json.phtml	2011-02-10 15:10:40 UTC (rev 12219)
@@ -37,4 +37,4 @@
 //print_r($json);
 
 
-print Zend_Json::prettyPrint(Zend_Json::encode($json));
\ No newline at end of file
+print str_replace("\/", "/", Zend_Json::prettyPrint(Zend_Json::encode($json)));
\ No newline at end of file

Modified: branches/Branch_5_1/src/plugins/oslc/include/oslc-zend/application/views/scripts/cm/read-bugnote-collection.phtml
===================================================================
--- branches/Branch_5_1/src/plugins/oslc/include/oslc-zend/application/views/scripts/cm/read-bugnote-collection.phtml	2011-02-10 15:08:05 UTC (rev 12218)
+++ branches/Branch_5_1/src/plugins/oslc/include/oslc-zend/application/views/scripts/cm/read-bugnote-collection.phtml	2011-02-10 15:10:40 UTC (rev 12219)
@@ -20,6 +20,7 @@
 /* $Id$ */
 
 require_once('_resource_xml.php');
+require('_add_hyperlinks.php');
 
 $tracker = 'unknown';
 
@@ -40,8 +41,9 @@
 
 print '<h1>'.$tracker.' Change Requests Comments:</h1>';
 $xml = createRessourceCollectionView($this);
-print '<pre>'.(str_replace('>', '>', str_replace('<', '<', $xml))).'<pre>';
-?>
+$text = str_replace('>', '>', str_replace('<', '<', $xml));
+$text = add_links($text, "http");
+print '<pre>'.$text.'</pre>';?>
 
 </body>
 </html>
\ No newline at end of file

Modified: branches/Branch_5_1/src/plugins/oslc/include/oslc-zend/application/views/scripts/cm/read-bugnote.json.phtml
===================================================================
--- branches/Branch_5_1/src/plugins/oslc/include/oslc-zend/application/views/scripts/cm/read-bugnote.json.phtml	2011-02-10 15:08:05 UTC (rev 12218)
+++ branches/Branch_5_1/src/plugins/oslc/include/oslc-zend/application/views/scripts/cm/read-bugnote.json.phtml	2011-02-10 15:10:40 UTC (rev 12219)
@@ -22,7 +22,7 @@
 foreach ($this->resource as $field => $value) {
 	$json[$field] = $value;
 }
-print Zend_Json::prettyPrint(Zend_Json::encode($json));
+print str_replace("\/", "/", Zend_Json::prettyPrint(Zend_Json::encode($json)));
 
 //require('_get_response.php');
 //print $doc->saveXML();

Modified: branches/Branch_5_1/src/plugins/oslc/include/oslc-zend/application/views/scripts/cm/read-bugnote.phtml
===================================================================
--- branches/Branch_5_1/src/plugins/oslc/include/oslc-zend/application/views/scripts/cm/read-bugnote.phtml	2011-02-10 15:08:05 UTC (rev 12218)
+++ branches/Branch_5_1/src/plugins/oslc/include/oslc-zend/application/views/scripts/cm/read-bugnote.phtml	2011-02-10 15:10:40 UTC (rev 12219)
@@ -3,6 +3,7 @@
 <?php
 
 require_once('_resource_xml.php');
+require('_add_hyperlinks.php');
 
 $tracker = 'unknown';
 
@@ -23,8 +24,9 @@
 
 print '<h1>'.$tracker.' Change Request:</h1>';
 $xml = createResourceView($this);
-$xml = str_replace('>', '>', str_replace('<', '<', $xml));
-print '<pre>'.$xml.'</pre>';
+$text = str_replace('>', '>', str_replace('<', '<', $xml));
+	$text = add_links($text, "http");
+	print '<pre>'.$text.'</pre>';
 ?>
 
 </body>

Modified: branches/Branch_5_1/src/plugins/oslc/include/oslc-zend/application/views/scripts/cm/read-resource-collection.json.phtml
===================================================================
--- branches/Branch_5_1/src/plugins/oslc/include/oslc-zend/application/views/scripts/cm/read-resource-collection.json.phtml	2011-02-10 15:08:05 UTC (rev 12218)
+++ branches/Branch_5_1/src/plugins/oslc/include/oslc-zend/application/views/scripts/cm/read-resource-collection.json.phtml	2011-02-10 15:10:40 UTC (rev 12219)
@@ -37,4 +37,4 @@
 //print_r($json);
 
 
-print Zend_Json::prettyPrint(Zend_Json::encode($json));
\ No newline at end of file
+print str_replace("\/", "/", Zend_Json::prettyPrint(Zend_Json::encode($json)));
\ No newline at end of file

Modified: branches/Branch_5_1/src/plugins/oslc/include/oslc-zend/application/views/scripts/cm/read-resource-collection.phtml
===================================================================
--- branches/Branch_5_1/src/plugins/oslc/include/oslc-zend/application/views/scripts/cm/read-resource-collection.phtml	2011-02-10 15:08:05 UTC (rev 12218)
+++ branches/Branch_5_1/src/plugins/oslc/include/oslc-zend/application/views/scripts/cm/read-resource-collection.phtml	2011-02-10 15:10:40 UTC (rev 12219)
@@ -20,6 +20,7 @@
 /* $Id$ */
 
 require_once('_resource_xml.php');
+require('_add_hyperlinks.php');
 
 $tracker = 'unknown';
 
@@ -40,8 +41,9 @@
 
 print '<h1>'.$tracker.' Change Requests:</h1>';
 $xml = createRessourceCollectionView($this);
-print '<pre>'.(str_replace('>', '>', str_replace('<', '<', $xml))).'<pre>';
-?>
+$text = str_replace('>', '>', str_replace('<', '<', $xml));
+$text = add_links($text, "http");
+print '<pre>'.$text.'</pre>';?>
 
 </body>
 </html>

Modified: branches/Branch_5_1/src/plugins/oslc/include/oslc-zend/application/views/scripts/cm/read-resource.json.phtml
===================================================================
--- branches/Branch_5_1/src/plugins/oslc/include/oslc-zend/application/views/scripts/cm/read-resource.json.phtml	2011-02-10 15:08:05 UTC (rev 12218)
+++ branches/Branch_5_1/src/plugins/oslc/include/oslc-zend/application/views/scripts/cm/read-resource.json.phtml	2011-02-10 15:10:40 UTC (rev 12219)
@@ -22,7 +22,7 @@
 foreach ($this->resource as $field => $value) {
 	$json[$field] = $value;
 }
-print Zend_Json::prettyPrint(Zend_Json::encode($json));
+print str_replace("\/", "/", Zend_Json::prettyPrint(Zend_Json::encode($json)));
 
 //require('_get_response.php');
 //print $doc->saveXML();

Modified: branches/Branch_5_1/src/plugins/oslc/include/oslc-zend/application/views/scripts/cm/read-resource.phtml
===================================================================
--- branches/Branch_5_1/src/plugins/oslc/include/oslc-zend/application/views/scripts/cm/read-resource.phtml	2011-02-10 15:08:05 UTC (rev 12218)
+++ branches/Branch_5_1/src/plugins/oslc/include/oslc-zend/application/views/scripts/cm/read-resource.phtml	2011-02-10 15:10:40 UTC (rev 12219)
@@ -3,6 +3,7 @@
 <?php
 
 require_once('_resource_xml.php');
+require('_add_hyperlinks.php');
 
 $tracker = 'unknown';
 
@@ -23,8 +24,9 @@
 
 print '<h1>'.$tracker.' Change Request:</h1>';
 $xml = createResourceView($this);
-$xml = str_replace('>', '>', str_replace('<', '<', $xml));
-print '<pre>'.$xml.'</pre>';
+$text = str_replace('>', '>', str_replace('<', '<', $xml));
+$text = add_links($text, "http");
+print '<pre>'.$text.'</pre>';
 ?>
 
 </body>

Added: branches/Branch_5_1/src/plugins/oslc/include/oslc-zend/application/views/scripts/cm/show-creation-ui.phtml
===================================================================
--- branches/Branch_5_1/src/plugins/oslc/include/oslc-zend/application/views/scripts/cm/show-creation-ui.phtml	                        (rev 0)
+++ branches/Branch_5_1/src/plugins/oslc/include/oslc-zend/application/views/scripts/cm/show-creation-ui.phtml	2011-02-10 15:10:40 UTC (rev 12219)
@@ -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>

Modified: branches/Branch_5_1/src/plugins/oslc/include/oslc-zend/application/views/scripts/cm/show-selection-ui.phtml
===================================================================
--- branches/Branch_5_1/src/plugins/oslc/include/oslc-zend/application/views/scripts/cm/show-selection-ui.phtml	2011-02-10 15:08:05 UTC (rev 12218)
+++ branches/Branch_5_1/src/plugins/oslc/include/oslc-zend/application/views/scripts/cm/show-selection-ui.phtml	2011-02-10 15:10:40 UTC (rev 12219)
@@ -6,14 +6,19 @@
 		$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 "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");
+		@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;	
@@ -51,7 +56,7 @@
 		}
 		
 		</style>
-        <script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/dojo/1.4.0/dojo/dojo.xd.js"
+        <script type="text/javascript" src="/javascript/dojo/dojo.js"
 			djconfig="parseOnLoad:true">
 		</script>
         <script type="text/javascript">
@@ -61,7 +66,8 @@
         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
@@ -232,7 +238,7 @@
             
 
             var xhrArgs = {
-                    url: "/~mdhar/mantisbt/oslc-zend/cm/bugs",
+                    url: URL,
                     headers: {Accept: "application/json"},
                     preventCache: true,
                     handleAs: "json",
@@ -276,9 +282,23 @@
                         
                      
                     },
-                    error: function(err) {
-                  	  err = err.message||err;
-                  	  alert('error: '+err);
+                    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);
+						   }
+						}
                     }
                 }
 
@@ -438,11 +458,19 @@
 	              for(var i=0;i<len;i++)	{
 	                  var val = whereoptions[list.selectedIndex-1][i];
 	                  try	{
-						optionlist.add(new Option(val, val), null) //add new option to end
+		                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
-						optionlist.add(new Option(val, val)) //add new option to end
+	            		  	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)	{
@@ -525,6 +553,7 @@
 	        	<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">

Added: branches/Branch_5_1/src/plugins/oslc/include/oslc-zend/application/views/scripts/codendicm/_add_hyperlinks.php
===================================================================
--- branches/Branch_5_1/src/plugins/oslc/include/oslc-zend/application/views/scripts/codendicm/_add_hyperlinks.php	                        (rev 0)
+++ branches/Branch_5_1/src/plugins/oslc/include/oslc-zend/application/views/scripts/codendicm/_add_hyperlinks.php	2011-02-10 15:10:40 UTC (rev 12219)
@@ -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: branches/Branch_5_1/src/plugins/oslc/include/oslc-zend/application/views/scripts/codendicm/_resource_xml.php
===================================================================
--- branches/Branch_5_1/src/plugins/oslc/include/oslc-zend/application/views/scripts/codendicm/_resource_xml.php	                        (rev 0)
+++ branches/Branch_5_1/src/plugins/oslc/include/oslc-zend/application/views/scripts/codendicm/_resource_xml.php	2011-02-10 15:10:40 UTC (rev 12219)
@@ -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: branches/Branch_5_1/src/plugins/oslc/include/oslc-zend/application/views/scripts/codendicm/_service-catalog_xml.php
===================================================================
--- branches/Branch_5_1/src/plugins/oslc/include/oslc-zend/application/views/scripts/codendicm/_service-catalog_xml.php	                        (rev 0)
+++ branches/Branch_5_1/src/plugins/oslc/include/oslc-zend/application/views/scripts/codendicm/_service-catalog_xml.php	2011-02-10 15:10:40 UTC (rev 12219)
@@ -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();
+}

Copied: branches/Branch_5_1/src/plugins/oslc/include/oslc-zend/application/views/scripts/codendicm/_service-document_xml.php (from rev 12218, branches/Branch_5_1/src/plugins/oslc/include/oslc-zend/application/views/scripts/cm/_service-document_xml.php)
===================================================================
--- branches/Branch_5_1/src/plugins/oslc/include/oslc-zend/application/views/scripts/codendicm/_service-document_xml.php	                        (rev 0)
+++ branches/Branch_5_1/src/plugins/oslc/include/oslc-zend/application/views/scripts/codendicm/_service-document_xml.php	2011-02-10 15:10:40 UTC (rev 12219)
@@ -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: branches/Branch_5_1/src/plugins/oslc/include/oslc-zend/application/views/scripts/codendicm/get.phtml
===================================================================
Copied: branches/Branch_5_1/src/plugins/oslc/include/oslc-zend/application/views/scripts/codendicm/index.phtml (from rev 12218, branches/Branch_5_1/src/plugins/oslc/include/oslc-zend/application/views/scripts/cm/index.phtml)
===================================================================
--- branches/Branch_5_1/src/plugins/oslc/include/oslc-zend/application/views/scripts/codendicm/index.phtml	                        (rev 0)
+++ branches/Branch_5_1/src/plugins/oslc/include/oslc-zend/application/views/scripts/codendicm/index.phtml	2011-02-10 15:10:40 UTC (rev 12219)
@@ -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>

Copied: branches/Branch_5_1/src/plugins/oslc/include/oslc-zend/application/views/scripts/codendicm/oslc-cm-service-document.phtml (from rev 12218, branches/Branch_5_1/src/plugins/oslc/include/oslc-zend/application/views/scripts/cm/oslc-cm-service-document.phtml)
===================================================================
--- branches/Branch_5_1/src/plugins/oslc/include/oslc-zend/application/views/scripts/codendicm/oslc-cm-service-document.phtml	                        (rev 0)
+++ branches/Branch_5_1/src/plugins/oslc/include/oslc-zend/application/views/scripts/codendicm/oslc-cm-service-document.phtml	2011-02-10 15:10:40 UTC (rev 12219)
@@ -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('>', '>', str_replace('<', '<', $xml));
+	$text = add_links($text, "http");
+	$text = add_links($text, $this->baseUrl());
+	echo $text;?>
+</pre>
+</body>
+

Added: branches/Branch_5_1/src/plugins/oslc/include/oslc-zend/application/views/scripts/codendicm/oslc-cm-service-document.xml.phtml
===================================================================
--- branches/Branch_5_1/src/plugins/oslc/include/oslc-zend/application/views/scripts/codendicm/oslc-cm-service-document.xml.phtml	                        (rev 0)
+++ branches/Branch_5_1/src/plugins/oslc/include/oslc-zend/application/views/scripts/codendicm/oslc-cm-service-document.xml.phtml	2011-02-10 15:10:40 UTC (rev 12219)
@@ -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

Copied: branches/Branch_5_1/src/plugins/oslc/include/oslc-zend/application/views/scripts/codendicm/oslc-service-catalog.json.phtml (from rev 12218, branches/Branch_5_1/src/plugins/oslc/include/oslc-zend/application/views/scripts/cm/oslc-service-catalog.json.phtml)
===================================================================
--- branches/Branch_5_1/src/plugins/oslc/include/oslc-zend/application/views/scripts/codendicm/oslc-service-catalog.json.phtml	                        (rev 0)
+++ branches/Branch_5_1/src/plugins/oslc/include/oslc-zend/application/views/scripts/codendicm/oslc-service-catalog.json.phtml	2011-02-10 15:10:40 UTC (rev 12219)
@@ -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

Copied: branches/Branch_5_1/src/plugins/oslc/include/oslc-zend/application/views/scripts/codendicm/oslc-service-catalog.phtml (from rev 12218, branches/Branch_5_1/src/plugins/oslc/include/oslc-zend/application/views/scripts/cm/oslc-service-catalog.phtml)
===================================================================
--- branches/Branch_5_1/src/plugins/oslc/include/oslc-zend/application/views/scripts/codendicm/oslc-service-catalog.phtml	                        (rev 0)
+++ branches/Branch_5_1/src/plugins/oslc/include/oslc-zend/application/views/scripts/codendicm/oslc-service-catalog.phtml	2011-02-10 15:10:40 UTC (rev 12219)
@@ -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('>', '>', str_replace('<', '<', $xml));
+	$text = add_links($text, "http");
+	$text = add_links($text, $this->baseUrl());
+	echo $text;?>
+</pre>
+</body>
+

Added: branches/Branch_5_1/src/plugins/oslc/include/oslc-zend/application/views/scripts/codendicm/oslc-service-catalog.xml.phtml
===================================================================
--- branches/Branch_5_1/src/plugins/oslc/include/oslc-zend/application/views/scripts/codendicm/oslc-service-catalog.xml.phtml	                        (rev 0)
+++ branches/Branch_5_1/src/plugins/oslc/include/oslc-zend/application/views/scripts/codendicm/oslc-service-catalog.xml.phtml	2011-02-10 15:10:40 UTC (rev 12219)
@@ -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: branches/Branch_5_1/src/plugins/oslc/include/oslc-zend/application/views/scripts/codendicm/post.phtml
===================================================================
--- branches/Branch_5_1/src/plugins/oslc/include/oslc-zend/application/views/scripts/codendicm/post.phtml	                        (rev 0)
+++ branches/Branch_5_1/src/plugins/oslc/include/oslc-zend/application/views/scripts/codendicm/post.phtml	2011-02-10 15:10:40 UTC (rev 12219)
@@ -0,0 +1 @@
+<?php

Added: branches/Branch_5_1/src/plugins/oslc/include/oslc-zend/application/views/scripts/codendicm/put.phtml
===================================================================
--- branches/Branch_5_1/src/plugins/oslc/include/oslc-zend/application/views/scripts/codendicm/put.phtml	                        (rev 0)
+++ branches/Branch_5_1/src/plugins/oslc/include/oslc-zend/application/views/scripts/codendicm/put.phtml	2011-02-10 15:10:40 UTC (rev 12219)
@@ -0,0 +1 @@
+<?php

Added: branches/Branch_5_1/src/plugins/oslc/include/oslc-zend/application/views/scripts/codendicm/put.xml.phtml
===================================================================
--- branches/Branch_5_1/src/plugins/oslc/include/oslc-zend/application/views/scripts/codendicm/put.xml.phtml	                        (rev 0)
+++ branches/Branch_5_1/src/plugins/oslc/include/oslc-zend/application/views/scripts/codendicm/put.xml.phtml	2011-02-10 15:10:40 UTC (rev 12219)
@@ -0,0 +1,2 @@
+<?php
+

Copied: branches/Branch_5_1/src/plugins/oslc/include/oslc-zend/application/views/scripts/codendicm/read-bugnote-collection.json.phtml (from rev 12218, branches/Branch_5_1/src/plugins/oslc/include/oslc-zend/application/views/scripts/cm/read-bugnote-collection.json.phtml)
===================================================================
--- branches/Branch_5_1/src/plugins/oslc/include/oslc-zend/application/views/scripts/codendicm/read-bugnote-collection.json.phtml	                        (rev 0)
+++ branches/Branch_5_1/src/plugins/oslc/include/oslc-zend/application/views/scripts/codendicm/read-bugnote-collection.json.phtml	2011-02-10 15:10:40 UTC (rev 12219)
@@ -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

Copied: branches/Branch_5_1/src/plugins/oslc/include/oslc-zend/application/views/scripts/codendicm/read-bugnote-collection.phtml (from rev 12218, branches/Branch_5_1/src/plugins/oslc/include/oslc-zend/application/views/scripts/cm/read-bugnote-collection.phtml)
===================================================================
--- branches/Branch_5_1/src/plugins/oslc/include/oslc-zend/application/views/scripts/codendicm/read-bugnote-collection.phtml	                        (rev 0)
+++ branches/Branch_5_1/src/plugins/oslc/include/oslc-zend/application/views/scripts/codendicm/read-bugnote-collection.phtml	2011-02-10 15:10:40 UTC (rev 12219)
@@ -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('>', '>', str_replace('<', '<', $xml));
+$text = add_links($text, "http");
+print '<pre>'.$text.'</pre>';?>
+
+</body>
+</html>
\ No newline at end of file

Added: branches/Branch_5_1/src/plugins/oslc/include/oslc-zend/application/views/scripts/codendicm/read-bugnote-collection.xml.phtml
===================================================================
--- branches/Branch_5_1/src/plugins/oslc/include/oslc-zend/application/views/scripts/codendicm/read-bugnote-collection.xml.phtml	                        (rev 0)
+++ branches/Branch_5_1/src/plugins/oslc/include/oslc-zend/application/views/scripts/codendicm/read-bugnote-collection.xml.phtml	2011-02-10 15:10:40 UTC (rev 12219)
@@ -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

Copied: branches/Branch_5_1/src/plugins/oslc/include/oslc-zend/application/views/scripts/codendicm/read-bugnote.json.phtml (from rev 12218, branches/Branch_5_1/src/plugins/oslc/include/oslc-zend/application/views/scripts/cm/read-bugnote.json.phtml)
===================================================================
--- branches/Branch_5_1/src/plugins/oslc/include/oslc-zend/application/views/scripts/codendicm/read-bugnote.json.phtml	                        (rev 0)
+++ branches/Branch_5_1/src/plugins/oslc/include/oslc-zend/application/views/scripts/codendicm/read-bugnote.json.phtml	2011-02-10 15:10:40 UTC (rev 12219)
@@ -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

Copied: branches/Branch_5_1/src/plugins/oslc/include/oslc-zend/application/views/scripts/codendicm/read-bugnote.phtml (from rev 12218, branches/Branch_5_1/src/plugins/oslc/include/oslc-zend/application/views/scripts/cm/read-bugnote.phtml)
===================================================================
--- branches/Branch_5_1/src/plugins/oslc/include/oslc-zend/application/views/scripts/codendicm/read-bugnote.phtml	                        (rev 0)
+++ branches/Branch_5_1/src/plugins/oslc/include/oslc-zend/application/views/scripts/codendicm/read-bugnote.phtml	2011-02-10 15:10:40 UTC (rev 12219)
@@ -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('>', '>', str_replace('<', '<', $xml));
+	$text = add_links($text, "http");
+	print '<pre>'.$text.'</pre>';
+?>
+
+</body>
+</html>

Copied: branches/Branch_5_1/src/plugins/oslc/include/oslc-zend/application/views/scripts/codendicm/read-bugnote.xml.phtml (from rev 12218, branches/Branch_5_1/src/plugins/oslc/include/oslc-zend/application/views/scripts/error/error.json.phtml)
===================================================================
--- branches/Branch_5_1/src/plugins/oslc/include/oslc-zend/application/views/scripts/codendicm/read-bugnote.xml.phtml	                        (rev 0)
+++ branches/Branch_5_1/src/plugins/oslc/include/oslc-zend/application/views/scripts/codendicm/read-bugnote.xml.phtml	2011-02-10 15:10:40 UTC (rev 12219)
@@ -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: branches/Branch_5_1/src/plugins/oslc/include/oslc-zend/application/views/scripts/codendicm/read-bugnote.xml.phtml
___________________________________________________________________
Added: svn:executable
   + *

Copied: branches/Branch_5_1/src/plugins/oslc/include/oslc-zend/application/views/scripts/codendicm/read-resource-collection.json.phtml (from rev 12218, branches/Branch_5_1/src/plugins/oslc/include/oslc-zend/application/views/scripts/cm/read-resource-collection.json.phtml)
===================================================================
--- branches/Branch_5_1/src/plugins/oslc/include/oslc-zend/application/views/scripts/codendicm/read-resource-collection.json.phtml	                        (rev 0)
+++ branches/Branch_5_1/src/plugins/oslc/include/oslc-zend/application/views/scripts/codendicm/read-resource-collection.json.phtml	2011-02-10 15:10:40 UTC (rev 12219)
@@ -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

Copied: branches/Branch_5_1/src/plugins/oslc/include/oslc-zend/application/views/scripts/codendicm/read-resource-collection.phtml (from rev 12218, branches/Branch_5_1/src/plugins/oslc/include/oslc-zend/application/views/scripts/cm/read-resource-collection.phtml)
===================================================================
--- branches/Branch_5_1/src/plugins/oslc/include/oslc-zend/application/views/scripts/codendicm/read-resource-collection.phtml	                        (rev 0)
+++ branches/Branch_5_1/src/plugins/oslc/include/oslc-zend/application/views/scripts/codendicm/read-resource-collection.phtml	2011-02-10 15:10:40 UTC (rev 12219)
@@ -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('>', '>', str_replace('<', '<', $xml));
+$text = add_links($text, "http");
+print '<pre>'.$text.'</pre>';?>
+
+</body>
+</html>

Added: branches/Branch_5_1/src/plugins/oslc/include/oslc-zend/application/views/scripts/codendicm/read-resource-collection.xml.phtml
===================================================================
--- branches/Branch_5_1/src/plugins/oslc/include/oslc-zend/application/views/scripts/codendicm/read-resource-collection.xml.phtml	                        (rev 0)
+++ branches/Branch_5_1/src/plugins/oslc/include/oslc-zend/application/views/scripts/codendicm/read-resource-collection.xml.phtml	2011-02-10 15:10:40 UTC (rev 12219)
@@ -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

Copied: branches/Branch_5_1/src/plugins/oslc/include/oslc-zend/application/views/scripts/codendicm/read-resource.json.phtml (from rev 12218, branches/Branch_5_1/src/plugins/oslc/include/oslc-zend/application/views/scripts/cm/read-resource.json.phtml)
===================================================================
--- branches/Branch_5_1/src/plugins/oslc/include/oslc-zend/application/views/scripts/codendicm/read-resource.json.phtml	                        (rev 0)
+++ branches/Branch_5_1/src/plugins/oslc/include/oslc-zend/application/views/scripts/codendicm/read-resource.json.phtml	2011-02-10 15:10:40 UTC (rev 12219)
@@ -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

Copied: branches/Branch_5_1/src/plugins/oslc/include/oslc-zend/application/views/scripts/codendicm/read-resource.phtml (from rev 12218, branches/Branch_5_1/src/plugins/oslc/include/oslc-zend/application/views/scripts/cm/read-resource.phtml)
===================================================================
--- branches/Branch_5_1/src/plugins/oslc/include/oslc-zend/application/views/scripts/codendicm/read-resource.phtml	                        (rev 0)
+++ branches/Branch_5_1/src/plugins/oslc/include/oslc-zend/application/views/scripts/codendicm/read-resource.phtml	2011-02-10 15:10:40 UTC (rev 12219)
@@ -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('>', '>', str_replace('<', '<', $xml));
+$text = add_links($text, "http");
+print '<pre>'.$text.'</pre>';
+?>
+
+</body>
+</html>

Copied: branches/Branch_5_1/src/plugins/oslc/include/oslc-zend/application/views/scripts/codendicm/read-resource.xml.phtml (from rev 12218, branches/Branch_5_1/src/plugins/oslc/include/oslc-zend/application/views/scripts/error/error.json.phtml)
===================================================================
--- branches/Branch_5_1/src/plugins/oslc/include/oslc-zend/application/views/scripts/codendicm/read-resource.xml.phtml	                        (rev 0)
+++ branches/Branch_5_1/src/plugins/oslc/include/oslc-zend/application/views/scripts/codendicm/read-resource.xml.phtml	2011-02-10 15:10:40 UTC (rev 12219)
@@ -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: branches/Branch_5_1/src/plugins/oslc/include/oslc-zend/application/views/scripts/codendicm/read-resource.xml.phtml
___________________________________________________________________
Added: svn:executable
   + *

Added: branches/Branch_5_1/src/plugins/oslc/include/oslc-zend/application/views/scripts/codendicm/show-creation-ui.phtml
===================================================================
--- branches/Branch_5_1/src/plugins/oslc/include/oslc-zend/application/views/scripts/codendicm/show-creation-ui.phtml	                        (rev 0)
+++ branches/Branch_5_1/src/plugins/oslc/include/oslc-zend/application/views/scripts/codendicm/show-creation-ui.phtml	2011-02-10 15:10:40 UTC (rev 12219)
@@ -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>

Copied: branches/Branch_5_1/src/plugins/oslc/include/oslc-zend/application/views/scripts/codendicm/show-selection-ui.phtml (from rev 12218, branches/Branch_5_1/src/plugins/oslc/include/oslc-zend/application/views/scripts/cm/show-selection-ui.phtml)
===================================================================
--- branches/Branch_5_1/src/plugins/oslc/include/oslc-zend/application/views/scripts/codendicm/show-selection-ui.phtml	                        (rev 0)
+++ branches/Branch_5_1/src/plugins/oslc/include/oslc-zend/application/views/scripts/codendicm/show-selection-ui.phtml	2011-02-10 15:10:40 UTC (rev 12219)
@@ -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>

Modified: branches/Branch_5_1/src/plugins/oslc/include/oslc-zend/application/views/scripts/error/error.json.phtml
===================================================================
--- branches/Branch_5_1/src/plugins/oslc/include/oslc-zend/application/views/scripts/error/error.json.phtml	2011-02-10 15:08:05 UTC (rev 12218)
+++ branches/Branch_5_1/src/plugins/oslc/include/oslc-zend/application/views/scripts/error/error.json.phtml	2011-02-10 15:10:40 UTC (rev 12219)
@@ -19,4 +19,4 @@
 $json = array("oslc_cm:Error" => array(	"oslc_cm:statusCode"	=> (string)$this->code,
 										"oslc_cm:message"		=> (string)$this->exception->getMessage()));
 
-print Zend_Json::encode($json);
\ No newline at end of file
+print str_replace("\/", "/", Zend_Json::prettyPrint(Zend_Json::encode($json)));

Added: branches/Branch_5_1/src/plugins/oslc/include/oslc-zend/application/views/scripts/fusionforgecm/_add_hyperlinks.php
===================================================================
--- branches/Branch_5_1/src/plugins/oslc/include/oslc-zend/application/views/scripts/fusionforgecm/_add_hyperlinks.php	                        (rev 0)
+++ branches/Branch_5_1/src/plugins/oslc/include/oslc-zend/application/views/scripts/fusionforgecm/_add_hyperlinks.php	2011-02-10 15:10:40 UTC (rev 12219)
@@ -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: branches/Branch_5_1/src/plugins/oslc/include/oslc-zend/application/views/scripts/fusionforgecm/_resource_xml.php
===================================================================
--- branches/Branch_5_1/src/plugins/oslc/include/oslc-zend/application/views/scripts/fusionforgecm/_resource_xml.php	                        (rev 0)
+++ branches/Branch_5_1/src/plugins/oslc/include/oslc-zend/application/views/scripts/fusionforgecm/_resource_xml.php	2011-02-10 15:10:40 UTC (rev 12219)
@@ -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: branches/Branch_5_1/src/plugins/oslc/include/oslc-zend/application/views/scripts/fusionforgecm/_service-catalog_xml.php
===================================================================
--- branches/Branch_5_1/src/plugins/oslc/include/oslc-zend/application/views/scripts/fusionforgecm/_service-catalog_xml.php	                        (rev 0)
+++ branches/Branch_5_1/src/plugins/oslc/include/oslc-zend/application/views/scripts/fusionforgecm/_service-catalog_xml.php	2011-02-10 15:10:40 UTC (rev 12219)
@@ -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();
+}

Copied: branches/Branch_5_1/src/plugins/oslc/include/oslc-zend/application/views/scripts/fusionforgecm/_service-document_xml.php (from rev 12218, branches/Branch_5_1/src/plugins/oslc/include/oslc-zend/application/views/scripts/cm/_service-document_xml.php)
===================================================================
--- branches/Branch_5_1/src/plugins/oslc/include/oslc-zend/application/views/scripts/fusionforgecm/_service-document_xml.php	                        (rev 0)
+++ branches/Branch_5_1/src/plugins/oslc/include/oslc-zend/application/views/scripts/fusionforgecm/_service-document_xml.php	2011-02-10 15:10:40 UTC (rev 12219)
@@ -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: branches/Branch_5_1/src/plugins/oslc/include/oslc-zend/application/views/scripts/fusionforgecm/get.phtml
===================================================================
Copied: branches/Branch_5_1/src/plugins/oslc/include/oslc-zend/application/views/scripts/fusionforgecm/index.phtml (from rev 12218, branches/Branch_5_1/src/plugins/oslc/include/oslc-zend/application/views/scripts/cm/index.phtml)
===================================================================
--- branches/Branch_5_1/src/plugins/oslc/include/oslc-zend/application/views/scripts/fusionforgecm/index.phtml	                        (rev 0)
+++ branches/Branch_5_1/src/plugins/oslc/include/oslc-zend/application/views/scripts/fusionforgecm/index.phtml	2011-02-10 15:10:40 UTC (rev 12219)
@@ -0,0 +1,37 @@
+<?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 
+				$catalog_uri = $this->serverUrl() . util_make_uri($this->baseUrl().'/cm/oslc-services/');
+				echo $catalog_uri;
+			?>
+		"><?php
+		echo $catalog_uri;
+		?>
+		</a></tt> : to retrieve an HTML view of an RDF/XML OSLC Service Provider Catalog document.</p>
+	</li>
+</ul>
+</body>

Copied: branches/Branch_5_1/src/plugins/oslc/include/oslc-zend/application/views/scripts/fusionforgecm/oslc-cm-service-document.phtml (from rev 12218, branches/Branch_5_1/src/plugins/oslc/include/oslc-zend/application/views/scripts/cm/oslc-cm-service-document.phtml)
===================================================================
--- branches/Branch_5_1/src/plugins/oslc/include/oslc-zend/application/views/scripts/fusionforgecm/oslc-cm-service-document.phtml	                        (rev 0)
+++ branches/Branch_5_1/src/plugins/oslc/include/oslc-zend/application/views/scripts/fusionforgecm/oslc-cm-service-document.phtml	2011-02-10 15:10:40 UTC (rev 12219)
@@ -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('>', '>', str_replace('<', '<', $xml));
+	$text = add_links($text, "http");
+	$text = add_links($text, $this->baseUrl());
+	echo $text;?>
+</pre>
+</body>
+

Added: branches/Branch_5_1/src/plugins/oslc/include/oslc-zend/application/views/scripts/fusionforgecm/oslc-cm-service-document.xml.phtml
===================================================================
--- branches/Branch_5_1/src/plugins/oslc/include/oslc-zend/application/views/scripts/fusionforgecm/oslc-cm-service-document.xml.phtml	                        (rev 0)
+++ branches/Branch_5_1/src/plugins/oslc/include/oslc-zend/application/views/scripts/fusionforgecm/oslc-cm-service-document.xml.phtml	2011-02-10 15:10:40 UTC (rev 12219)
@@ -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

Copied: branches/Branch_5_1/src/plugins/oslc/include/oslc-zend/application/views/scripts/fusionforgecm/oslc-service-catalog.json.phtml (from rev 12218, branches/Branch_5_1/src/plugins/oslc/include/oslc-zend/application/views/scripts/cm/oslc-service-catalog.json.phtml)
===================================================================
--- branches/Branch_5_1/src/plugins/oslc/include/oslc-zend/application/views/scripts/fusionforgecm/oslc-service-catalog.json.phtml	                        (rev 0)
+++ branches/Branch_5_1/src/plugins/oslc/include/oslc-zend/application/views/scripts/fusionforgecm/oslc-service-catalog.json.phtml	2011-02-10 15:10:40 UTC (rev 12219)
@@ -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

Copied: branches/Branch_5_1/src/plugins/oslc/include/oslc-zend/application/views/scripts/fusionforgecm/oslc-service-catalog.phtml (from rev 12218, branches/Branch_5_1/src/plugins/oslc/include/oslc-zend/application/views/scripts/cm/oslc-service-catalog.phtml)
===================================================================
--- branches/Branch_5_1/src/plugins/oslc/include/oslc-zend/application/views/scripts/fusionforgecm/oslc-service-catalog.phtml	                        (rev 0)
+++ branches/Branch_5_1/src/plugins/oslc/include/oslc-zend/application/views/scripts/fusionforgecm/oslc-service-catalog.phtml	2011-02-10 15:10:40 UTC (rev 12219)
@@ -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('>', '>', str_replace('<', '<', $xml));
+	$text = add_links($text, "http");
+	$text = add_links($text, $this->baseUrl());
+	echo $text;?>
+</pre>
+</body>
+

Added: branches/Branch_5_1/src/plugins/oslc/include/oslc-zend/application/views/scripts/fusionforgecm/oslc-service-catalog.xml.phtml
===================================================================
--- branches/Branch_5_1/src/plugins/oslc/include/oslc-zend/application/views/scripts/fusionforgecm/oslc-service-catalog.xml.phtml	                        (rev 0)
+++ branches/Branch_5_1/src/plugins/oslc/include/oslc-zend/application/views/scripts/fusionforgecm/oslc-service-catalog.xml.phtml	2011-02-10 15:10:40 UTC (rev 12219)
@@ -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: branches/Branch_5_1/src/plugins/oslc/include/oslc-zend/application/views/scripts/fusionforgecm/post.phtml
===================================================================
--- branches/Branch_5_1/src/plugins/oslc/include/oslc-zend/application/views/scripts/fusionforgecm/post.phtml	                        (rev 0)
+++ branches/Branch_5_1/src/plugins/oslc/include/oslc-zend/application/views/scripts/fusionforgecm/post.phtml	2011-02-10 15:10:40 UTC (rev 12219)
@@ -0,0 +1 @@
+<?php

Added: branches/Branch_5_1/src/plugins/oslc/include/oslc-zend/application/views/scripts/fusionforgecm/put.phtml
===================================================================
--- branches/Branch_5_1/src/plugins/oslc/include/oslc-zend/application/views/scripts/fusionforgecm/put.phtml	                        (rev 0)
+++ branches/Branch_5_1/src/plugins/oslc/include/oslc-zend/application/views/scripts/fusionforgecm/put.phtml	2011-02-10 15:10:40 UTC (rev 12219)
@@ -0,0 +1 @@
+<?php

Added: branches/Branch_5_1/src/plugins/oslc/include/oslc-zend/application/views/scripts/fusionforgecm/put.xml.phtml
===================================================================
--- branches/Branch_5_1/src/plugins/oslc/include/oslc-zend/application/views/scripts/fusionforgecm/put.xml.phtml	                        (rev 0)
+++ branches/Branch_5_1/src/plugins/oslc/include/oslc-zend/application/views/scripts/fusionforgecm/put.xml.phtml	2011-02-10 15:10:40 UTC (rev 12219)
@@ -0,0 +1,2 @@
+<?php
+

Copied: branches/Branch_5_1/src/plugins/oslc/include/oslc-zend/application/views/scripts/fusionforgecm/read-bugnote-collection.json.phtml (from rev 12218, branches/Branch_5_1/src/plugins/oslc/include/oslc-zend/application/views/scripts/cm/read-bugnote-collection.json.phtml)
===================================================================
--- branches/Branch_5_1/src/plugins/oslc/include/oslc-zend/application/views/scripts/fusionforgecm/read-bugnote-collection.json.phtml	                        (rev 0)
+++ branches/Branch_5_1/src/plugins/oslc/include/oslc-zend/application/views/scripts/fusionforgecm/read-bugnote-collection.json.phtml	2011-02-10 15:10:40 UTC (rev 12219)
@@ -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

Copied: branches/Branch_5_1/src/plugins/oslc/include/oslc-zend/application/views/scripts/fusionforgecm/read-bugnote-collection.phtml (from rev 12218, branches/Branch_5_1/src/plugins/oslc/include/oslc-zend/application/views/scripts/cm/read-bugnote-collection.phtml)
===================================================================
--- branches/Branch_5_1/src/plugins/oslc/include/oslc-zend/application/views/scripts/fusionforgecm/read-bugnote-collection.phtml	                        (rev 0)
+++ branches/Branch_5_1/src/plugins/oslc/include/oslc-zend/application/views/scripts/fusionforgecm/read-bugnote-collection.phtml	2011-02-10 15:10:40 UTC (rev 12219)
@@ -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('>', '>', str_replace('<', '<', $xml));
+$text = add_links($text, "http");
+print '<pre>'.$text.'</pre>';?>
+
+</body>
+</html>
\ No newline at end of file

Added: branches/Branch_5_1/src/plugins/oslc/include/oslc-zend/application/views/scripts/fusionforgecm/read-bugnote-collection.xml.phtml
===================================================================
--- branches/Branch_5_1/src/plugins/oslc/include/oslc-zend/application/views/scripts/fusionforgecm/read-bugnote-collection.xml.phtml	                        (rev 0)
+++ branches/Branch_5_1/src/plugins/oslc/include/oslc-zend/application/views/scripts/fusionforgecm/read-bugnote-collection.xml.phtml	2011-02-10 15:10:40 UTC (rev 12219)
@@ -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

Copied: branches/Branch_5_1/src/plugins/oslc/include/oslc-zend/application/views/scripts/fusionforgecm/read-bugnote.json.phtml (from rev 12218, branches/Branch_5_1/src/plugins/oslc/include/oslc-zend/application/views/scripts/cm/read-bugnote.json.phtml)
===================================================================
--- branches/Branch_5_1/src/plugins/oslc/include/oslc-zend/application/views/scripts/fusionforgecm/read-bugnote.json.phtml	                        (rev 0)
+++ branches/Branch_5_1/src/plugins/oslc/include/oslc-zend/application/views/scripts/fusionforgecm/read-bugnote.json.phtml	2011-02-10 15:10:40 UTC (rev 12219)
@@ -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

Copied: branches/Branch_5_1/src/plugins/oslc/include/oslc-zend/application/views/scripts/fusionforgecm/read-bugnote.phtml (from rev 12218, branches/Branch_5_1/src/plugins/oslc/include/oslc-zend/application/views/scripts/cm/read-bugnote.phtml)
===================================================================
--- branches/Branch_5_1/src/plugins/oslc/include/oslc-zend/application/views/scripts/fusionforgecm/read-bugnote.phtml	                        (rev 0)
+++ branches/Branch_5_1/src/plugins/oslc/include/oslc-zend/application/views/scripts/fusionforgecm/read-bugnote.phtml	2011-02-10 15:10:40 UTC (rev 12219)
@@ -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('>', '>', str_replace('<', '<', $xml));
+	$text = add_links($text, "http");
+	print '<pre>'.$text.'</pre>';
+?>
+
+</body>
+</html>

Copied: branches/Branch_5_1/src/plugins/oslc/include/oslc-zend/application/views/scripts/fusionforgecm/read-bugnote.xml.phtml (from rev 12218, branches/Branch_5_1/src/plugins/oslc/include/oslc-zend/application/views/scripts/error/error.json.phtml)
===================================================================
--- branches/Branch_5_1/src/plugins/oslc/include/oslc-zend/application/views/scripts/fusionforgecm/read-bugnote.xml.phtml	                        (rev 0)
+++ branches/Branch_5_1/src/plugins/oslc/include/oslc-zend/application/views/scripts/fusionforgecm/read-bugnote.xml.phtml	2011-02-10 15:10:40 UTC (rev 12219)
@@ -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: branches/Branch_5_1/src/plugins/oslc/include/oslc-zend/application/views/scripts/fusionforgecm/read-bugnote.xml.phtml
___________________________________________________________________
Added: svn:executable
   + *

Copied: branches/Branch_5_1/src/plugins/oslc/include/oslc-zend/application/views/scripts/fusionforgecm/read-resource-collection.json.phtml (from rev 12218, branches/Branch_5_1/src/plugins/oslc/include/oslc-zend/application/views/scripts/cm/read-resource-collection.json.phtml)
===================================================================
--- branches/Branch_5_1/src/plugins/oslc/include/oslc-zend/application/views/scripts/fusionforgecm/read-resource-collection.json.phtml	                        (rev 0)
+++ branches/Branch_5_1/src/plugins/oslc/include/oslc-zend/application/views/scripts/fusionforgecm/read-resource-collection.json.phtml	2011-02-10 15:10:40 UTC (rev 12219)
@@ -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

Copied: branches/Branch_5_1/src/plugins/oslc/include/oslc-zend/application/views/scripts/fusionforgecm/read-resource-collection.phtml (from rev 12218, branches/Branch_5_1/src/plugins/oslc/include/oslc-zend/application/views/scripts/cm/read-resource-collection.phtml)
===================================================================
--- branches/Branch_5_1/src/plugins/oslc/include/oslc-zend/application/views/scripts/fusionforgecm/read-resource-collection.phtml	                        (rev 0)
+++ branches/Branch_5_1/src/plugins/oslc/include/oslc-zend/application/views/scripts/fusionforgecm/read-resource-collection.phtml	2011-02-10 15:10:40 UTC (rev 12219)
@@ -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('>', '>', str_replace('<', '<', $xml));
+$text = add_links($text, "http");
+print '<pre>'.$text.'</pre>';?>
+
+</body>
+</html>

Added: branches/Branch_5_1/src/plugins/oslc/include/oslc-zend/application/views/scripts/fusionforgecm/read-resource-collection.xml.phtml
===================================================================
--- branches/Branch_5_1/src/plugins/oslc/include/oslc-zend/application/views/scripts/fusionforgecm/read-resource-collection.xml.phtml	                        (rev 0)
+++ branches/Branch_5_1/src/plugins/oslc/include/oslc-zend/application/views/scripts/fusionforgecm/read-resource-collection.xml.phtml	2011-02-10 15:10:40 UTC (rev 12219)
@@ -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

Copied: branches/Branch_5_1/src/plugins/oslc/include/oslc-zend/application/views/scripts/fusionforgecm/read-resource.json.phtml (from rev 12218, branches/Branch_5_1/src/plugins/oslc/include/oslc-zend/application/views/scripts/cm/read-resource.json.phtml)
===================================================================
--- branches/Branch_5_1/src/plugins/oslc/include/oslc-zend/application/views/scripts/fusionforgecm/read-resource.json.phtml	                        (rev 0)
+++ branches/Branch_5_1/src/plugins/oslc/include/oslc-zend/application/views/scripts/fusionforgecm/read-resource.json.phtml	2011-02-10 15:10:40 UTC (rev 12219)
@@ -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

Copied: branches/Branch_5_1/src/plugins/oslc/include/oslc-zend/application/views/scripts/fusionforgecm/read-resource.phtml (from rev 12218, branches/Branch_5_1/src/plugins/oslc/include/oslc-zend/application/views/scripts/cm/read-resource.phtml)
===================================================================
--- branches/Branch_5_1/src/plugins/oslc/include/oslc-zend/application/views/scripts/fusionforgecm/read-resource.phtml	                        (rev 0)
+++ branches/Branch_5_1/src/plugins/oslc/include/oslc-zend/application/views/scripts/fusionforgecm/read-resource.phtml	2011-02-10 15:10:40 UTC (rev 12219)
@@ -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('>', '>', str_replace('<', '<', $xml));
+$text = add_links($text, "http");
+print '<pre>'.$text.'</pre>';
+?>
+
+</body>
+</html>

Copied: branches/Branch_5_1/src/plugins/oslc/include/oslc-zend/application/views/scripts/fusionforgecm/read-resource.xml.phtml (from rev 12218, branches/Branch_5_1/src/plugins/oslc/include/oslc-zend/application/views/scripts/error/error.json.phtml)
===================================================================
--- branches/Branch_5_1/src/plugins/oslc/include/oslc-zend/application/views/scripts/fusionforgecm/read-resource.xml.phtml	                        (rev 0)
+++ branches/Branch_5_1/src/plugins/oslc/include/oslc-zend/application/views/scripts/fusionforgecm/read-resource.xml.phtml	2011-02-10 15:10:40 UTC (rev 12219)
@@ -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: branches/Branch_5_1/src/plugins/oslc/include/oslc-zend/application/views/scripts/fusionforgecm/read-resource.xml.phtml
___________________________________________________________________
Added: svn:executable
   + *

Added: branches/Branch_5_1/src/plugins/oslc/include/oslc-zend/application/views/scripts/fusionforgecm/show-creation-ui.phtml
===================================================================
--- branches/Branch_5_1/src/plugins/oslc/include/oslc-zend/application/views/scripts/fusionforgecm/show-creation-ui.phtml	                        (rev 0)
+++ branches/Branch_5_1/src/plugins/oslc/include/oslc-zend/application/views/scripts/fusionforgecm/show-creation-ui.phtml	2011-02-10 15:10:40 UTC (rev 12219)
@@ -0,0 +1,496 @@
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
+"http://www.w3.org/TR/html4/loose.dtd">
+<?php 
+
+	$project = $this->data['project'];
+	$tracker = $this->data['tracker'];
+	
+	/*
+	 * @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>

Copied: branches/Branch_5_1/src/plugins/oslc/include/oslc-zend/application/views/scripts/fusionforgecm/show-selection-ui.phtml (from rev 12218, branches/Branch_5_1/src/plugins/oslc/include/oslc-zend/application/views/scripts/cm/show-selection-ui.phtml)
===================================================================
--- branches/Branch_5_1/src/plugins/oslc/include/oslc-zend/application/views/scripts/fusionforgecm/show-selection-ui.phtml	                        (rev 0)
+++ branches/Branch_5_1/src/plugins/oslc/include/oslc-zend/application/views/scripts/fusionforgecm/show-selection-ui.phtml	2011-02-10 15:10:40 UTC (rev 12219)
@@ -0,0 +1,680 @@
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
+"http://www.w3.org/TR/html4/loose.dtd">
+<?php 
+	$project = $this->data['project'];
+	$tracker = $this->data['tracker'];
+
+	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>

Added: branches/Branch_5_1/src/plugins/oslc/include/oslc-zend/application/views/scripts/mantiscm/_add_hyperlinks.php
===================================================================
--- branches/Branch_5_1/src/plugins/oslc/include/oslc-zend/application/views/scripts/mantiscm/_add_hyperlinks.php	                        (rev 0)
+++ branches/Branch_5_1/src/plugins/oslc/include/oslc-zend/application/views/scripts/mantiscm/_add_hyperlinks.php	2011-02-10 15:10:40 UTC (rev 12219)
@@ -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: branches/Branch_5_1/src/plugins/oslc/include/oslc-zend/application/views/scripts/mantiscm/_resource_xml.php
===================================================================
--- branches/Branch_5_1/src/plugins/oslc/include/oslc-zend/application/views/scripts/mantiscm/_resource_xml.php	                        (rev 0)
+++ branches/Branch_5_1/src/plugins/oslc/include/oslc-zend/application/views/scripts/mantiscm/_resource_xml.php	2011-02-10 15:10:40 UTC (rev 12219)
@@ -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: branches/Branch_5_1/src/plugins/oslc/include/oslc-zend/application/views/scripts/mantiscm/_service-catalog_xml.php
===================================================================
--- branches/Branch_5_1/src/plugins/oslc/include/oslc-zend/application/views/scripts/mantiscm/_service-catalog_xml.php	                        (rev 0)
+++ branches/Branch_5_1/src/plugins/oslc/include/oslc-zend/application/views/scripts/mantiscm/_service-catalog_xml.php	2011-02-10 15:10:40 UTC (rev 12219)
@@ -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();
+}

Copied: branches/Branch_5_1/src/plugins/oslc/include/oslc-zend/application/views/scripts/mantiscm/_service-document_xml.php (from rev 12218, branches/Branch_5_1/src/plugins/oslc/include/oslc-zend/application/views/scripts/cm/_service-document_xml.php)
===================================================================
--- branches/Branch_5_1/src/plugins/oslc/include/oslc-zend/application/views/scripts/mantiscm/_service-document_xml.php	                        (rev 0)
+++ branches/Branch_5_1/src/plugins/oslc/include/oslc-zend/application/views/scripts/mantiscm/_service-document_xml.php	2011-02-10 15:10:40 UTC (rev 12219)
@@ -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: branches/Branch_5_1/src/plugins/oslc/include/oslc-zend/application/views/scripts/mantiscm/get.phtml
===================================================================
Copied: branches/Branch_5_1/src/plugins/oslc/include/oslc-zend/application/views/scripts/mantiscm/index.phtml (from rev 12218, branches/Branch_5_1/src/plugins/oslc/include/oslc-zend/application/views/scripts/cm/index.phtml)
===================================================================
--- branches/Branch_5_1/src/plugins/oslc/include/oslc-zend/application/views/scripts/mantiscm/index.phtml	                        (rev 0)
+++ branches/Branch_5_1/src/plugins/oslc/include/oslc-zend/application/views/scripts/mantiscm/index.phtml	2011-02-10 15:10:40 UTC (rev 12219)
@@ -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>

Copied: branches/Branch_5_1/src/plugins/oslc/include/oslc-zend/application/views/scripts/mantiscm/oslc-cm-service-document.phtml (from rev 12218, branches/Branch_5_1/src/plugins/oslc/include/oslc-zend/application/views/scripts/cm/oslc-cm-service-document.phtml)
===================================================================
--- branches/Branch_5_1/src/plugins/oslc/include/oslc-zend/application/views/scripts/mantiscm/oslc-cm-service-document.phtml	                        (rev 0)
+++ branches/Branch_5_1/src/plugins/oslc/include/oslc-zend/application/views/scripts/mantiscm/oslc-cm-service-document.phtml	2011-02-10 15:10:40 UTC (rev 12219)
@@ -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('>', '>', str_replace('<', '<', $xml));
+	$text = add_links($text, "http");
+	$text = add_links($text, $this->baseUrl());
+	echo $text;?>
+</pre>
+</body>
+

Added: branches/Branch_5_1/src/plugins/oslc/include/oslc-zend/application/views/scripts/mantiscm/oslc-cm-service-document.xml.phtml
===================================================================
--- branches/Branch_5_1/src/plugins/oslc/include/oslc-zend/application/views/scripts/mantiscm/oslc-cm-service-document.xml.phtml	                        (rev 0)
+++ branches/Branch_5_1/src/plugins/oslc/include/oslc-zend/application/views/scripts/mantiscm/oslc-cm-service-document.xml.phtml	2011-02-10 15:10:40 UTC (rev 12219)
@@ -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

Copied: branches/Branch_5_1/src/plugins/oslc/include/oslc-zend/application/views/scripts/mantiscm/oslc-service-catalog.json.phtml (from rev 12218, branches/Branch_5_1/src/plugins/oslc/include/oslc-zend/application/views/scripts/cm/oslc-service-catalog.json.phtml)
===================================================================
--- branches/Branch_5_1/src/plugins/oslc/include/oslc-zend/application/views/scripts/mantiscm/oslc-service-catalog.json.phtml	                        (rev 0)
+++ branches/Branch_5_1/src/plugins/oslc/include/oslc-zend/application/views/scripts/mantiscm/oslc-service-catalog.json.phtml	2011-02-10 15:10:40 UTC (rev 12219)
@@ -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

Copied: branches/Branch_5_1/src/plugins/oslc/include/oslc-zend/application/views/scripts/mantiscm/oslc-service-catalog.phtml (from rev 12218, branches/Branch_5_1/src/plugins/oslc/include/oslc-zend/application/views/scripts/cm/oslc-service-catalog.phtml)
===================================================================
--- branches/Branch_5_1/src/plugins/oslc/include/oslc-zend/application/views/scripts/mantiscm/oslc-service-catalog.phtml	                        (rev 0)
+++ branches/Branch_5_1/src/plugins/oslc/include/oslc-zend/application/views/scripts/mantiscm/oslc-service-catalog.phtml	2011-02-10 15:10:40 UTC (rev 12219)
@@ -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('>', '>', str_replace('<', '<', $xml));
+	$text = add_links($text, "http");
+	$text = add_links($text, $this->baseUrl());
+	echo $text;?>
+</pre>
+</body>
+

Added: branches/Branch_5_1/src/plugins/oslc/include/oslc-zend/application/views/scripts/mantiscm/oslc-service-catalog.xml.phtml
===================================================================
--- branches/Branch_5_1/src/plugins/oslc/include/oslc-zend/application/views/scripts/mantiscm/oslc-service-catalog.xml.phtml	                        (rev 0)
+++ branches/Branch_5_1/src/plugins/oslc/include/oslc-zend/application/views/scripts/mantiscm/oslc-service-catalog.xml.phtml	2011-02-10 15:10:40 UTC (rev 12219)
@@ -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: branches/Branch_5_1/src/plugins/oslc/include/oslc-zend/application/views/scripts/mantiscm/post.phtml
===================================================================
--- branches/Branch_5_1/src/plugins/oslc/include/oslc-zend/application/views/scripts/mantiscm/post.phtml	                        (rev 0)
+++ branches/Branch_5_1/src/plugins/oslc/include/oslc-zend/application/views/scripts/mantiscm/post.phtml	2011-02-10 15:10:40 UTC (rev 12219)
@@ -0,0 +1 @@
+<?php

Added: branches/Branch_5_1/src/plugins/oslc/include/oslc-zend/application/views/scripts/mantiscm/put.phtml
===================================================================
--- branches/Branch_5_1/src/plugins/oslc/include/oslc-zend/application/views/scripts/mantiscm/put.phtml	                        (rev 0)
+++ branches/Branch_5_1/src/plugins/oslc/include/oslc-zend/application/views/scripts/mantiscm/put.phtml	2011-02-10 15:10:40 UTC (rev 12219)
@@ -0,0 +1 @@
+<?php

Added: branches/Branch_5_1/src/plugins/oslc/include/oslc-zend/application/views/scripts/mantiscm/put.xml.phtml
===================================================================
--- branches/Branch_5_1/src/plugins/oslc/include/oslc-zend/application/views/scripts/mantiscm/put.xml.phtml	                        (rev 0)
+++ branches/Branch_5_1/src/plugins/oslc/include/oslc-zend/application/views/scripts/mantiscm/put.xml.phtml	2011-02-10 15:10:40 UTC (rev 12219)
@@ -0,0 +1,2 @@
+<?php
+

Copied: branches/Branch_5_1/src/plugins/oslc/include/oslc-zend/application/views/scripts/mantiscm/read-bugnote-collection.json.phtml (from rev 12218, branches/Branch_5_1/src/plugins/oslc/include/oslc-zend/application/views/scripts/cm/read-bugnote-collection.json.phtml)
===================================================================
--- branches/Branch_5_1/src/plugins/oslc/include/oslc-zend/application/views/scripts/mantiscm/read-bugnote-collection.json.phtml	                        (rev 0)
+++ branches/Branch_5_1/src/plugins/oslc/include/oslc-zend/application/views/scripts/mantiscm/read-bugnote-collection.json.phtml	2011-02-10 15:10:40 UTC (rev 12219)
@@ -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

Copied: branches/Branch_5_1/src/plugins/oslc/include/oslc-zend/application/views/scripts/mantiscm/read-bugnote-collection.phtml (from rev 12218, branches/Branch_5_1/src/plugins/oslc/include/oslc-zend/application/views/scripts/cm/read-bugnote-collection.phtml)
===================================================================
--- branches/Branch_5_1/src/plugins/oslc/include/oslc-zend/application/views/scripts/mantiscm/read-bugnote-collection.phtml	                        (rev 0)
+++ branches/Branch_5_1/src/plugins/oslc/include/oslc-zend/application/views/scripts/mantiscm/read-bugnote-collection.phtml	2011-02-10 15:10:40 UTC (rev 12219)
@@ -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('>', '>', str_replace('<', '<', $xml));
+$text = add_links($text, "http");
+print '<pre>'.$text.'</pre>';?>
+
+</body>
+</html>
\ No newline at end of file

Added: branches/Branch_5_1/src/plugins/oslc/include/oslc-zend/application/views/scripts/mantiscm/read-bugnote-collection.xml.phtml
===================================================================
--- branches/Branch_5_1/src/plugins/oslc/include/oslc-zend/application/views/scripts/mantiscm/read-bugnote-collection.xml.phtml	                        (rev 0)
+++ branches/Branch_5_1/src/plugins/oslc/include/oslc-zend/application/views/scripts/mantiscm/read-bugnote-collection.xml.phtml	2011-02-10 15:10:40 UTC (rev 12219)
@@ -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

Copied: branches/Branch_5_1/src/plugins/oslc/include/oslc-zend/application/views/scripts/mantiscm/read-bugnote.json.phtml (from rev 12218, branches/Branch_5_1/src/plugins/oslc/include/oslc-zend/application/views/scripts/cm/read-bugnote.json.phtml)
===================================================================
--- branches/Branch_5_1/src/plugins/oslc/include/oslc-zend/application/views/scripts/mantiscm/read-bugnote.json.phtml	                        (rev 0)
+++ branches/Branch_5_1/src/plugins/oslc/include/oslc-zend/application/views/scripts/mantiscm/read-bugnote.json.phtml	2011-02-10 15:10:40 UTC (rev 12219)
@@ -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

Copied: branches/Branch_5_1/src/plugins/oslc/include/oslc-zend/application/views/scripts/mantiscm/read-bugnote.phtml (from rev 12218, branches/Branch_5_1/src/plugins/oslc/include/oslc-zend/application/views/scripts/cm/read-bugnote.phtml)
===================================================================
--- branches/Branch_5_1/src/plugins/oslc/include/oslc-zend/application/views/scripts/mantiscm/read-bugnote.phtml	                        (rev 0)
+++ branches/Branch_5_1/src/plugins/oslc/include/oslc-zend/application/views/scripts/mantiscm/read-bugnote.phtml	2011-02-10 15:10:40 UTC (rev 12219)
@@ -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('>', '>', str_replace('<', '<', $xml));
+	$text = add_links($text, "http");
+	print '<pre>'.$text.'</pre>';
+?>
+
+</body>
+</html>

Copied: branches/Branch_5_1/src/plugins/oslc/include/oslc-zend/application/views/scripts/mantiscm/read-bugnote.xml.phtml (from rev 12218, branches/Branch_5_1/src/plugins/oslc/include/oslc-zend/application/views/scripts/error/error.json.phtml)
===================================================================
--- branches/Branch_5_1/src/plugins/oslc/include/oslc-zend/application/views/scripts/mantiscm/read-bugnote.xml.phtml	                        (rev 0)
+++ branches/Branch_5_1/src/plugins/oslc/include/oslc-zend/application/views/scripts/mantiscm/read-bugnote.xml.phtml	2011-02-10 15:10:40 UTC (rev 12219)
@@ -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: branches/Branch_5_1/src/plugins/oslc/include/oslc-zend/application/views/scripts/mantiscm/read-bugnote.xml.phtml
___________________________________________________________________
Added: svn:executable
   + *

Copied: branches/Branch_5_1/src/plugins/oslc/include/oslc-zend/application/views/scripts/mantiscm/read-resource-collection.json.phtml (from rev 12218, branches/Branch_5_1/src/plugins/oslc/include/oslc-zend/application/views/scripts/cm/read-resource-collection.json.phtml)
===================================================================
--- branches/Branch_5_1/src/plugins/oslc/include/oslc-zend/application/views/scripts/mantiscm/read-resource-collection.json.phtml	                        (rev 0)
+++ branches/Branch_5_1/src/plugins/oslc/include/oslc-zend/application/views/scripts/mantiscm/read-resource-collection.json.phtml	2011-02-10 15:10:40 UTC (rev 12219)
@@ -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

Copied: branches/Branch_5_1/src/plugins/oslc/include/oslc-zend/application/views/scripts/mantiscm/read-resource-collection.phtml (from rev 12218, branches/Branch_5_1/src/plugins/oslc/include/oslc-zend/application/views/scripts/cm/read-resource-collection.phtml)
===================================================================
--- branches/Branch_5_1/src/plugins/oslc/include/oslc-zend/application/views/scripts/mantiscm/read-resource-collection.phtml	                        (rev 0)
+++ branches/Branch_5_1/src/plugins/oslc/include/oslc-zend/application/views/scripts/mantiscm/read-resource-collection.phtml	2011-02-10 15:10:40 UTC (rev 12219)
@@ -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('>', '>', str_replace('<', '<', $xml));
+$text = add_links($text, "http");
+print '<pre>'.$text.'</pre>';?>
+
+</body>
+</html>

Added: branches/Branch_5_1/src/plugins/oslc/include/oslc-zend/application/views/scripts/mantiscm/read-resource-collection.xml.phtml
===================================================================
--- branches/Branch_5_1/src/plugins/oslc/include/oslc-zend/application/views/scripts/mantiscm/read-resource-collection.xml.phtml	                        (rev 0)
+++ branches/Branch_5_1/src/plugins/oslc/include/oslc-zend/application/views/scripts/mantiscm/read-resource-collection.xml.phtml	2011-02-10 15:10:40 UTC (rev 12219)
@@ -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

Copied: branches/Branch_5_1/src/plugins/oslc/include/oslc-zend/application/views/scripts/mantiscm/read-resource.json.phtml (from rev 12218, branches/Branch_5_1/src/plugins/oslc/include/oslc-zend/application/views/scripts/cm/read-resource.json.phtml)
===================================================================
--- branches/Branch_5_1/src/plugins/oslc/include/oslc-zend/application/views/scripts/mantiscm/read-resource.json.phtml	                        (rev 0)
+++ branches/Branch_5_1/src/plugins/oslc/include/oslc-zend/application/views/scripts/mantiscm/read-resource.json.phtml	2011-02-10 15:10:40 UTC (rev 12219)
@@ -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

Copied: branches/Branch_5_1/src/plugins/oslc/include/oslc-zend/application/views/scripts/mantiscm/read-resource.phtml (from rev 12218, branches/Branch_5_1/src/plugins/oslc/include/oslc-zend/application/views/scripts/cm/read-resource.phtml)
===================================================================
--- branches/Branch_5_1/src/plugins/oslc/include/oslc-zend/application/views/scripts/mantiscm/read-resource.phtml	                        (rev 0)
+++ branches/Branch_5_1/src/plugins/oslc/include/oslc-zend/application/views/scripts/mantiscm/read-resource.phtml	2011-02-10 15:10:40 UTC (rev 12219)
@@ -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('>', '>', str_replace('<', '<', $xml));
+$text = add_links($text, "http");
+print '<pre>'.$text.'</pre>';
+?>
+
+</body>
+</html>

Copied: branches/Branch_5_1/src/plugins/oslc/include/oslc-zend/application/views/scripts/mantiscm/read-resource.xml.phtml (from rev 12218, branches/Branch_5_1/src/plugins/oslc/include/oslc-zend/application/views/scripts/error/error.json.phtml)
===================================================================
--- branches/Branch_5_1/src/plugins/oslc/include/oslc-zend/application/views/scripts/mantiscm/read-resource.xml.phtml	                        (rev 0)
+++ branches/Branch_5_1/src/plugins/oslc/include/oslc-zend/application/views/scripts/mantiscm/read-resource.xml.phtml	2011-02-10 15:10:40 UTC (rev 12219)
@@ -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: branches/Branch_5_1/src/plugins/oslc/include/oslc-zend/application/views/scripts/mantiscm/read-resource.xml.phtml
___________________________________________________________________
Added: svn:executable
   + *

Added: branches/Branch_5_1/src/plugins/oslc/include/oslc-zend/application/views/scripts/mantiscm/show-creation-ui.phtml
===================================================================
--- branches/Branch_5_1/src/plugins/oslc/include/oslc-zend/application/views/scripts/mantiscm/show-creation-ui.phtml	                        (rev 0)
+++ branches/Branch_5_1/src/plugins/oslc/include/oslc-zend/application/views/scripts/mantiscm/show-creation-ui.phtml	2011-02-10 15:10:40 UTC (rev 12219)
@@ -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>

Copied: branches/Branch_5_1/src/plugins/oslc/include/oslc-zend/application/views/scripts/mantiscm/show-selection-ui.phtml (from rev 12218, branches/Branch_5_1/src/plugins/oslc/include/oslc-zend/application/views/scripts/cm/show-selection-ui.phtml)
===================================================================
--- branches/Branch_5_1/src/plugins/oslc/include/oslc-zend/application/views/scripts/mantiscm/show-selection-ui.phtml	                        (rev 0)
+++ branches/Branch_5_1/src/plugins/oslc/include/oslc-zend/application/views/scripts/mantiscm/show-selection-ui.phtml	2011-02-10 15:10:40 UTC (rev 12219)
@@ -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