4 * This file is (c) Copyright 2009 by Olivier BERGER, Institut
7 * This program is free software; you can redistribute it and/or
8 * modify it under the terms of the GNU General Public License
9 * as published by the Free Software Foundation; either version 2
10 * of the License, or (at your option) any later version.
12 * This program is distributed in the hope that it will be useful,
13 * but WITHOUT ANY WARRANTY; without even the implied warranty of
14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15 * GNU General Public License for more details.
17 * You should have received a copy of the GNU General Public License
18 * along with this program; if not, write to the Free Software
19 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
21 * This program has been developed in the frame of the HELIOS
22 * project with financial support of its funders.
28 // Generate a OSLC-CM V1 Change Management Service Description document (http://open-services.net/bin/view/Main/CmServiceDescriptionV1)
30 function project_to_service_description($base_url, $project) {
32 $doc = new DOMDocument();
33 $doc->formatOutput = true;
35 $root = $doc->createElementNS("http://open-services.net/xmlns/cm/1.0/", "oslc_cm:ServiceDescriptor");
36 $root = $doc->appendChild($root);
38 $child = $doc->createAttributeNS("http://www.w3.org/1999/02/22-rdf-syntax-ns#", "rdf:about");
39 $about = $root->appendChild($child);
40 $child = $doc->createTextNode("");
41 $child = $about->appendChild($child);
43 $child = $doc->createElementNS("http://purl.org/dc/terms/", "dc:title");
44 $title = $root->appendChild($child);
45 $child = $doc->createTextNode("Demo OSLC CM services");
46 $child = $title->appendChild($child);
49 $child = $doc->createElementNS("http://open-services.net/xmlns/cm/1.0/", "oslc_cm:changeRequests");
50 $cr = $root->appendChild($child);
52 $child = $doc->createAttribute("version");
53 $version = $cr->appendChild($child);
54 $child = $doc->createTextNode("1.0");
55 $child = $version->appendChild($child);
57 // Simple GET-based URL-encoded query
59 $child = $doc->createElementNS("http://open-services.net/xmlns/cm/1.0/", "oslc_cm:simpleQuery");
60 $sq = $cr->appendChild($child);
62 $child = $doc->createElementNS("http://purl.org/dc/terms/", "dc:title");
63 $title = $sq->appendChild($child);
64 $child = $doc->createTextNode("Simple Project Query");
65 $child = $title->appendChild($child);
67 $child = $doc->createElementNS("http://open-services.net/xmlns/cm/1.0/", "oslc_cm:url");
68 $url = $sq->appendChild($child);
69 $child = $doc->createTextNode($base_url.'/cm/project/'.$project);
70 $child = $url->appendChild($child);
72 // OSLC URL-encoded query
74 $child = $doc->createElementNS("http://open-services.net/xmlns/cm/1.0/", "oslc_cm:simpleQuery");
75 $sq = $cr->appendChild($child);
77 $child = $doc->createElementNS("http://purl.org/dc/terms/", "dc:title");
78 $title = $sq->appendChild($child);
79 $child = $doc->createTextNode("OSLC Change Request Queries");
80 $child = $title->appendChild($child);
82 $child = $doc->createElementNS("http://open-services.net/xmlns/cm/1.0/", "oslc_cm:url");
83 $url = $sq->appendChild($child);
84 $child = $doc->createTextNode($base_url.'/cm/bugs');
85 $child = $url->appendChild($child);
89 $child = $doc->createElementNS("http://open-services.net/xmlns/cm/1.0/", "oslc_cm:factory");
90 $crdl = $cr->appendChild($child);
92 $child = $doc->createAttribute("oslc_cm:default");
93 $option = $crdl->appendChild($child);
94 $child = $doc->createTextNode("true");
95 $child = $option->appendChild($child);
97 $child = $doc->createElementNS("http://purl.org/dc/terms/", "dc:title");
98 $title = $crdl->appendChild($child);
99 $child = $doc->createTextNode("Location for creation of change requests");
100 $child = $title->appendChild($child);
102 $child = $doc->createElementNS("http://open-services.net/xmlns/cm/1.0/", "oslc_cm:url");
103 $url = $crdl->appendChild($child);
104 $child = $doc->createTextNode($base_url.'/cm/project/'.$project);
105 $child = $url->appendChild($child);
109 $child = $doc->createElementNS("http://open-services.net/xmlns/cm/1.0/", "oslc_cm:creationDialog");
110 $crdl = $cr->appendChild($child);
112 $child = $doc->createAttribute("oslc_cm:default");
113 $option = $crdl->appendChild($child);
114 $child = $doc->createTextNode("true");
115 $child = $option->appendChild($child);
117 $child = $doc->createAttribute("oslc_cm:hintWidth");
118 $option = $crdl->appendChild($child);
119 $child = $doc->createTextNode("740px");
120 $child = $option->appendChild($child);
122 $child = $doc->createAttribute("oslc_cm:hintHeight");
123 $option = $crdl->appendChild($child);
124 $child = $doc->createTextNode("540px");
125 $child = $option->appendChild($child);
127 $child = $doc->createElementNS("http://purl.org/dc/terms/", "dc:title");
128 $title = $crdl->appendChild($child);
129 $child = $doc->createTextNode("New Change Request Creation Dialog");
130 $child = $title->appendChild($child);
132 $child = $doc->createElementNS("http://open-services.net/xmlns/cm/1.0/", "oslc_cm:url");
133 $url = $crdl->appendChild($child);
134 $child = $doc->createTextNode($base_url.'/cm/project/'.$project.'/ui/creation');
135 $child = $url->appendChild($child);
139 $child = $doc->createElementNS("http://open-services.net/xmlns/cm/1.0/", "oslc_cm:selectionDialog");
140 $sldl = $cr->appendChild($child);
142 $child = $doc->createAttribute("oslc_cm:default");
143 $option = $sldl->appendChild($child);
144 $child = $doc->createTextNode("true");
145 $child = $option->appendChild($child);
147 $child = $doc->createAttribute("oslc_cm:hintWidth");
148 $option = $sldl->appendChild($child);
149 $child = $doc->createTextNode("800px");
150 $child = $option->appendChild($child);
152 $child = $doc->createAttribute("oslc_cm:hintHeight");
153 $option = $sldl->appendChild($child);
154 $child = $doc->createTextNode("600px");
155 $child = $option->appendChild($child);
157 $child = $doc->createElementNS("http://purl.org/dc/terms/", "dc:title");
158 $title = $sldl->appendChild($child);
159 $child = $doc->createTextNode("Change Request Selection Dialog");
160 $child = $title->appendChild($child);
162 $child = $doc->createElementNS("http://open-services.net/xmlns/cm/1.0/", "oslc_cm:url");
163 $url = $sldl->appendChild($child);
164 $child = $doc->createTextNode($base_url.'/cm/project/'.$project.'/ui/selection');
165 $child = $url->appendChild($child);
167 return $doc->saveXML();