Commit 44695155c7af036392e4ed57fa23a620397a6751

Authored by Megan Watson
2 parents 1377f4b4 551aeb7c

Merge branch 'edge' of git@github.com:ktgit/knowledgetree into edge

Showing 40 changed files with 1016 additions and 1661 deletions
ktatompub/Client/index.html
@@ -20,7 +20,7 @@ @@ -20,7 +20,7 @@
20 <script src="js/lib/lib.data.js"></script> 20 <script src="js/lib/lib.data.js"></script>
21 <script src="js/lib/events.js"></script> 21 <script src="js/lib/events.js"></script>
22 <script src="js/site/site.event_handlers.js"></script> 22 <script src="js/site/site.event_handlers.js"></script>
23 -<script src="js/APP/ktApp.js"></script> 23 +<script src="js/APP/KT_atom_server.js"></script>
24 <script src="js/APP/app.js"></script> 24 <script src="js/APP/app.js"></script>
25 <script type="text/javascript"> 25 <script type="text/javascript">
26 // site.bootStrap(); //If enabled then you don't need to have all the javascript installs above 26 // site.bootStrap(); //If enabled then you don't need to have all the javascript installs above
ktatompub/Client/js/APP/ktApp.js
1 -ktApp=new function(){ 1 +KT_atom_server=new function(){
2 this.xmlhelpers=new function(){ 2 this.xmlhelpers=new function(){
3 this.getTagContents=function(node,tagName){ 3 this.getTagContents=function(node,tagName){
4 return $(node).find(tagName)[0].textContent; 4 return $(node).find(tagName)[0].textContent;
@@ -53,7 +53,7 @@ ktApp=new function(){ @@ -53,7 +53,7 @@ ktApp=new function(){
53 $('.document_storage_path',elem).html($(entry).find('storage_path')[0].textContent); 53 $('.document_storage_path',elem).html($(entry).find('storage_path')[0].textContent);
54 54
55 */ 55 */
56 -ktApp.folder=new function(){ 56 +KT_atom_server.folder=new function(){
57 this.fieldList={ 57 this.fieldList={
58 'folder_id' :'id', 58 'folder_id' :'id',
59 'folder_name' :'folder_name', 59 'folder_name' :'folder_name',
@@ -65,7 +65,7 @@ ktApp.folder=new function(){ @@ -65,7 +65,7 @@ ktApp.folder=new function(){
65 this.parseXML=function(entry){ 65 this.parseXML=function(entry){
66 this.data={}; 66 this.data={};
67 for(var lFname in this.fieldList){ 67 for(var lFname in this.fieldList){
68 - this.data[lFname]=ktApp.xmlhelpers.getTagContents(entry,this.fieldList[lFname]); 68 + this.data[lFname]=KT_atom_server.xmlhelpers.getTagContents(entry,this.fieldList[lFname]);
69 } 69 }
70 } 70 }
71 71
@@ -73,13 +73,13 @@ ktApp.folder=new function(){ @@ -73,13 +73,13 @@ ktApp.folder=new function(){
73 var elem=lib.def(document.getElementById(containerId),window.document.body); 73 var elem=lib.def(document.getElementById(containerId),window.document.body);
74 for(var field in this.fieldList){ 74 for(var field in this.fieldList){
75 $("."+field,elem).each(function(){ 75 $("."+field,elem).each(function(){
76 - ktApp.set(this,ktApp.folder.data[field]); 76 + KT_atom_server.set(this,KT_atom_server.folder.data[field]);
77 }); 77 });
78 } 78 }
79 } 79 }
80 } 80 }
81 81
82 -ktApp.serviceDoc=new function(){ 82 +KT_atom_server.serviceDoc=new function(){
83 this.parseXML=function(data,workspace){ 83 this.parseXML=function(data,workspace){
84 $('workspace',data).each(function(){ 84 $('workspace',data).each(function(){
85 var ws=$(this); 85 var ws=$(this);
@@ -92,7 +92,7 @@ ktApp.serviceDoc=new function(){ @@ -92,7 +92,7 @@ ktApp.serviceDoc=new function(){
92 } 92 }
93 93
94 94
95 -ktApp.document=new function(){ 95 +KT_atom_server.document=new function(){
96 this.fieldList={ 96 this.fieldList={
97 'document_id' :'document_id', 97 'document_id' :'document_id',
98 'document_title' :'title', 98 'document_title' :'title',
@@ -125,7 +125,7 @@ ktApp.document=new function(){ @@ -125,7 +125,7 @@ ktApp.document=new function(){
125 this.parseXML=function(entry){ 125 this.parseXML=function(entry){
126 this.data={}; 126 this.data={};
127 for(var lFname in this.fieldList){ 127 for(var lFname in this.fieldList){
128 - this.data[lFname]=ktApp.xmlhelpers.getTagContents(entry,this.fieldList[lFname]); 128 + this.data[lFname]=KT_atom_server.xmlhelpers.getTagContents(entry,this.fieldList[lFname]);
129 } 129 }
130 130
131 } 131 }
@@ -134,7 +134,7 @@ ktApp.document=new function(){ @@ -134,7 +134,7 @@ ktApp.document=new function(){
134 var elem=lib.def(document.getElementById(containerId),window.document.body); 134 var elem=lib.def(document.getElementById(containerId),window.document.body);
135 for(var field in this.fieldList){ 135 for(var field in this.fieldList){
136 $("."+field,elem).each(function(){ 136 $("."+field,elem).each(function(){
137 - ktApp.set(this,ktApp.document.data[field]); 137 + KT_atom_server.set(this,KT_atom_server.document.data[field]);
138 }); 138 });
139 } 139 }
140 } 140 }
ktatompub/Client/js/site/site.event_handlers.js
@@ -23,8 +23,8 @@ site.event_handlers=new function(){ @@ -23,8 +23,8 @@ site.event_handlers=new function(){
23 var data=lib.resources.getResourceFromUrl(url); 23 var data=lib.resources.getResourceFromUrl(url);
24 events.trigger('panel.clear'); 24 events.trigger('panel.clear');
25 site.event_handlers.setInfoPaneToolbar('info_panel_toolbar_viewFolder'); 25 site.event_handlers.setInfoPaneToolbar('info_panel_toolbar_viewFolder');
26 - ktApp.folder.parseXML($(data.data).find('entry')[0]);  
27 - ktApp.folder.renderContainer(); 26 + KT_atom_server.folder.parseXML($(data.data).find('entry')[0]);
  27 + KT_atom_server.folder.renderContainer();
28 $('#panel_folder_info').fadeIn(100); 28 $('#panel_folder_info').fadeIn(100);
29 29
30 }else{ 30 }else{
@@ -43,8 +43,8 @@ site.event_handlers=new function(){ @@ -43,8 +43,8 @@ site.event_handlers=new function(){
43 var data=lib.resources.getResourceFromUrl(url); 43 var data=lib.resources.getResourceFromUrl(url);
44 events.trigger('panel.clear'); 44 events.trigger('panel.clear');
45 site.event_handlers.setInfoPaneToolbar('info_panel_toolbar_editFolder'); 45 site.event_handlers.setInfoPaneToolbar('info_panel_toolbar_editFolder');
46 - ktApp.folder.parseXML($(data.data).find('entry')[0]);  
47 - ktApp.folder.renderContainer(); 46 + KT_atom_server.folder.parseXML($(data.data).find('entry')[0]);
  47 + KT_atom_server.folder.renderContainer();
48 $('#panel_folder_edit').fadeIn(100); 48 $('#panel_folder_edit').fadeIn(100);
49 49
50 }else{ 50 }else{
@@ -63,8 +63,8 @@ site.event_handlers=new function(){ @@ -63,8 +63,8 @@ site.event_handlers=new function(){
63 var data=lib.resources.getResourceFromUrl(url); 63 var data=lib.resources.getResourceFromUrl(url);
64 events.trigger('panel.clear'); 64 events.trigger('panel.clear');
65 site.event_handlers.setInfoPaneToolbar('info_panel_toolbar_viewDocument'); 65 site.event_handlers.setInfoPaneToolbar('info_panel_toolbar_viewDocument');
66 - ktApp.document.parseXML($(data.data).find('entry')[0]);  
67 - ktApp.document.renderContainer(); 66 + KT_atom_server.document.parseXML($(data.data).find('entry')[0]);
  67 + KT_atom_server.document.renderContainer();
68 $('#panel_document_info').fadeIn(100); 68 $('#panel_document_info').fadeIn(100);
69 69
70 }else{ 70 }else{
@@ -83,8 +83,8 @@ site.event_handlers=new function(){ @@ -83,8 +83,8 @@ site.event_handlers=new function(){
83 var data=lib.resources.getResourceFromUrl(url); 83 var data=lib.resources.getResourceFromUrl(url);
84 events.trigger('panel.clear'); 84 events.trigger('panel.clear');
85 site.event_handlers.setInfoPaneToolbar('info_panel_toolbar_editDocument'); 85 site.event_handlers.setInfoPaneToolbar('info_panel_toolbar_editDocument');
86 - ktApp.document.parseXML($(data.data).find('entry')[0]);  
87 - ktApp.document.renderContainer(); 86 + KT_atom_server.document.parseXML($(data.data).find('entry')[0]);
  87 + KT_atom_server.document.renderContainer();
88 $('#panel_document_info_edit').fadeIn(100); 88 $('#panel_document_info_edit').fadeIn(100);
89 89
90 }else{ 90 }else{
@@ -122,7 +122,7 @@ site.event_handlers=new function(){ @@ -122,7 +122,7 @@ site.event_handlers=new function(){
122 this.document_action_download=function(){ 122 this.document_action_download=function(){
123 //site.showDialog('Feature Not Yet Supported','In the future the document can be <b>downloaded</b> here.'); 123 //site.showDialog('Feature Not Yet Supported','In the future the document can be <b>downloaded</b> here.');
124 if(site.currentDocument!=undefined){ 124 if(site.currentDocument!=undefined){
125 - var url=unescape(ktApp.document.data.document_download_url); 125 + var url=unescape(KT_atom_server.document.data.document_download_url);
126 window.document.location.replace(url); 126 window.document.location.replace(url);
127 } 127 }
128 } 128 }
@@ -140,7 +140,7 @@ site.event_handlers=new function(){ @@ -140,7 +140,7 @@ site.event_handlers=new function(){
140 site.cfg('service',sdoc); 140 site.cfg('service',sdoc);
141 if(lib.resources.resourceLoaded(sdoc)){ 141 if(lib.resources.resourceLoaded(sdoc)){
142 var data=lib.resources.getResourceFromUrl(sdoc); 142 var data=lib.resources.getResourceFromUrl(sdoc);
143 - ktApp.serviceDoc.parseXML($(data.data).find('service')[0],'DMS'); 143 + KT_atom_server.serviceDoc.parseXML($(data.data).find('service')[0],'DMS');
144 144
145 }else{ 145 }else{
146 lib.resources.getUrl(sdoc,site.event_handlers.discovery); 146 lib.resources.getUrl(sdoc,site.event_handlers.discovery);
ktatompub/Client/js/site/site.js
@@ -38,7 +38,7 @@ site=new function(){ @@ -38,7 +38,7 @@ site=new function(){
38 <script src="js/ui/ui.core.js"></script> 38 <script src="js/ui/ui.core.js"></script>
39 <script src="js/ui/ui.tabs.js"></script> 39 <script src="js/ui/ui.tabs.js"></script>
40 <script src="js/jquery.dynatree.min.js"></script> 40 <script src="js/jquery.dynatree.min.js"></script>
41 - <script src="js/ktApp.js"></script> 41 + <script src="js/KT_atom_server.js"></script>
42 42
43 */ 43 */
44 this.libraries={ 44 this.libraries={
@@ -51,7 +51,7 @@ site=new function(){ @@ -51,7 +51,7 @@ site=new function(){
51 'js/ui/ui.core.js' :'jQuery UI Core', 51 'js/ui/ui.core.js' :'jQuery UI Core',
52 'js/ui/ui.tabs.js' :'jQuery UI Tabs Plugin', 52 'js/ui/ui.tabs.js' :'jQuery UI Tabs Plugin',
53 'js/jquery.dynatree.min.js' :'jQuery DynaTree Tree Menu Plugin', 53 'js/jquery.dynatree.min.js' :'jQuery DynaTree Tree Menu Plugin',
54 - 'js/ktApp.js' :'KT Atom Publishing Protocol Library' 54 + 'js/KT_atom_server.js' :'KT Atom Publishing Protocol Library'
55 } 55 }
56 56
57 this.init=function(){ 57 this.init=function(){
ktatompub/auth.php
@@ -42,7 +42,7 @@ @@ -42,7 +42,7 @@
42 * TODO: Thest HTTP Basic Auth - Try Library From Home 42 * TODO: Thest HTTP Basic Auth - Try Library From Home
43 */ 43 */
44 44
45 -$SessionId=KTAPPHelper::login('admin','admin'); 45 +$SessionId=KT_atom_service_helper::login('admin','admin');
46 $SessionId=$SessionId['session_id']; 46 $SessionId=$SessionId['session_id'];
47 47
48 48
ktatompub/index.php
@@ -57,6 +57,7 @@ ob_start(); @@ -57,6 +57,7 @@ ob_start();
57 57
58 define('KT_APP_BASE_URI',"http://".$_SERVER['HTTP_HOST'].dirname($_SERVER['PHP_SELF']).'/?/'); 58 define('KT_APP_BASE_URI',"http://".$_SERVER['HTTP_HOST'].dirname($_SERVER['PHP_SELF']).'/?/');
59 define('KT_APP_SYSTEM_URI',"http://".$_SERVER['HTTP_HOST']); 59 define('KT_APP_SYSTEM_URI',"http://".$_SERVER['HTTP_HOST']);
  60 +define('KT_ATOM_LIB_FOLDER','lib/');
60 61
61 // Define whether to use in debug mode for viewing generated structures 62 // Define whether to use in debug mode for viewing generated structures
62 //define('KT_APP_WEB_OUTPUT',false); //defunct 63 //define('KT_APP_WEB_OUTPUT',false); //defunct
@@ -67,37 +68,38 @@ define(&#39;KT_APP_SYSTEM_URI&#39;,&quot;http://&quot;.$_SERVER[&#39;HTTP_HOST&#39;]); @@ -67,37 +68,38 @@ define(&#39;KT_APP_SYSTEM_URI&#39;,&quot;http://&quot;.$_SERVER[&#39;HTTP_HOST&#39;]);
67 * Includes 68 * Includes
68 */ 69 */
69 include_once('../ktapi/ktapi.inc.php'); 70 include_once('../ktapi/ktapi.inc.php');
70 -include_once('lib/ktAPP.inc.php');  
71 -include_once('lib/KTAPPHelper.inc.php'); //Containing helper bridge functions to KtAPI  
72 -include_once('lib/KTAPDoc.inc.php'); //Containing the parent class allowing easy XML manipulation  
73 -include_once('lib/KTAPPServiceDoc.inc.php'); //Containing the servicedoc class allowing easy ServiceDocument generation  
74 -include_once('lib/KTAPPFeed.inc.php'); //Containing the response feed class allowing easy atom feed generation  
75 -include_once('lib/KTAPP_ResponseFeed.inc.php'); //Containing the response feed class allowing easy atom feed generation  
76 -include_once('lib/ktAPP_Service.inc.php');  
77 -include_once('lib/ktApp.default_dms_services.inc.php'); 71 +include_once(KT_ATOM_LIB_FOLDER.'KT_atom_server.inc.php');
  72 +include_once(KT_ATOM_LIB_FOLDER.'KT_atom_service_helper.inc.php'); //Containing helper bridge functions to KtAPI
  73 +include_once(KT_ATOM_LIB_FOLDER.'KT_atom_baseDoc.inc.php'); //Containing the parent class allowing easy XML manipulation
  74 +include_once(KT_ATOM_LIB_FOLDER.'KT_atom_serviceDoc.inc.php'); //Containing the servicedoc class allowing easy ServiceDocument generation
  75 +include_once(KT_ATOM_LIB_FOLDER.'KT_atom_responseFeed.inc.php'); //Containing the response feed class allowing easy atom feed generation
  76 +include_once(KT_ATOM_LIB_FOLDER.'KT_atom_service.inc.php');
  77 +include_once(KT_ATOM_LIB_FOLDER.'KT_atom_server.default_dms_services.inc.php');
78 include_once('auth.php'); //Containing the authentication protocols 78 include_once('auth.php'); //Containing the authentication protocols
79 79
80 80
81 //Start the AtomPubProtocol Routing Engine 81 //Start the AtomPubProtocol Routing Engine
82 -$APP=new KTAPP(); 82 +$APP=new KT_atom_server();
83 83
84 /** 84 /**
85 * Register Services 85 * Register Services
86 * 86 *
87 - * Registered services are classes extended from ktAPP_Service 87 + * Registered services are classes extended from KT_atom_service
88 * The registration process takes the following parameters 88 * The registration process takes the following parameters
89 * Workspace :The workspace within which the service collection will be grouped 89 * Workspace :The workspace within which the service collection will be grouped
90 * ServiceName :This is the name by which the service/collection is exposed 90 * ServiceName :This is the name by which the service/collection is exposed
91 * ServiceClass :This is the class name of the class to be instantiated when this service is accessed 91 * ServiceClass :This is the class name of the class to be instantiated when this service is accessed
92 * Title :This is the title given to the service/collection in the servicedocument 92 * Title :This is the title given to the service/collection in the servicedocument
93 */ 93 */
94 -$APP->registerService('DMS','fulltree','ktAPP_Service_fullTree','Full Document Tree');  
95 -$APP->registerService('DMS','folder','ktAPP_Service_folder','Folder Detail');  
96 -$APP->registerService('DMS','document','ktAPP_Service_document','Document Detail'); 94 +$APP->registerService('DMS','fulltree','KT_atom_service_fulltree','Full Document Tree');
  95 +$APP->registerService('DMS','folder','KT_atom_service_folder','Folder Detail');
  96 +$APP->registerService('DMS','document','KT_atom_service_document','Document Detail');
97 97
98 //Execute the current url/header request 98 //Execute the current url/header request
99 $APP->execute(); 99 $APP->execute();
100 100
  101 +//echo '<pre>'.print_r($APP,true).'</pre>';
  102 +
101 //Render the resulting feed response 103 //Render the resulting feed response
102 $APP->render(); 104 $APP->render();
103 105
ktatompub/lib/KTAPDoc.inc.php renamed to ktatompub/lib/KT_atom_baseDoc.inc.php
@@ -41,7 +41,7 @@ @@ -41,7 +41,7 @@
41 * Includes 41 * Includes
42 */ 42 */
43 43
44 -class KTAPDoc{ 44 +class KT_atom_baseDoc{
45 const XML_ENCODING='utf-8'; 45 const XML_ENCODING='utf-8';
46 const XML_VERSION='1.0'; 46 const XML_VERSION='1.0';
47 47
ktatompub/lib/KT_atom_responseFeed.inc.php 0 โ†’ 100644
  1 +<?php
  2 +class KT_atom_responseFeed extends KT_atom_baseDoc {
  3 +
  4 + private $baseURI=NULL;
  5 + private $feed=NULL;
  6 +
  7 +
  8 + public function __construct($baseURI=NULL,$title=NULL,$link=NULL,$updated=NULL,$author=NULL,$id=NULL){
  9 + parent::__construct();
  10 + $this->constructHeader();
  11 + $this->baseURI=$baseURI;
  12 + }
  13 +
  14 + private function constructHeader(){
  15 + $feed=$this->newElement('feed');
  16 + $feed->appendChild($this->newAttr('xmlns','http://www.w3.org/2005/Atom'));
  17 + $this->feed=&$feed;
  18 + $this->DOM->appendChild($this->feed);
  19 + }
  20 +
  21 + public function &newEntry(){
  22 + $entry=$this->newElement('entry');
  23 + $this->feed->appendChild($entry);
  24 + return $entry;
  25 + }
  26 +
  27 + public function &newField($name=NULL,$value=NULL,&$attachToNode=NULL){
  28 + $field=$this->newElement($name,$value);
  29 + if(isset($attachToNode))$attachToNode->appendChild($field);
  30 + return $field;
  31 + }
  32 +
  33 + public function render(){
  34 + return $this->formatXmlString(trim($this->DOM->saveXML()));
  35 + }
  36 +
  37 +
  38 +}
  39 +
  40 +class KT_atom_ResponseFeed_GET extends KT_atom_responseFeed{}
  41 +class KT_atom_ResponseFeed_PUT extends KT_atom_responseFeed{}
  42 +class KT_atom_ResponseFeed_POST extends KT_atom_responseFeed{}
  43 +class KT_atom_ResponseFeed_DELETE extends KT_atom_responseFeed{}
  44 +
  45 +?>
0 \ No newline at end of file 46 \ No newline at end of file
ktatompub/lib/ktApp.default_dms_services.inc.php renamed to ktatompub/lib/KT_atom_server.default_dms_services.inc.php
@@ -6,13 +6,13 @@ @@ -6,13 +6,13 @@
6 * Tree structure obtained by referencing parent id 6 * Tree structure obtained by referencing parent id
7 * 7 *
8 */ 8 */
9 -class ktAPP_Service_fullTree extends ktAPP_Service { 9 +class KT_atom_service_fulltree extends KT_atom_service {
10 public function GET_action(){ 10 public function GET_action(){
11 //Create a new response feed 11 //Create a new response feed
12 - $feed=new KTAPPFeed(KT_APP_BASE_URI); 12 + $feed=new KT_atom_ResponseFeed_GET(KT_APP_BASE_URI);
13 13
14 //Invoke the KtAPI to get detail about the referenced document 14 //Invoke the KtAPI to get detail about the referenced document
15 - $tree=KTAPPHelper::getFullTree(); 15 + $tree=KT_atom_service_helper::getFullTree();
16 16
17 //Create the atom response feed 17 //Create the atom response feed
18 foreach($tree as $item){ 18 foreach($tree as $item){
@@ -28,7 +28,7 @@ class ktAPP_Service_fullTree extends ktAPP_Service { @@ -28,7 +28,7 @@ class ktAPP_Service_fullTree extends ktAPP_Service {
28 } 28 }
29 29
30 public function DELETE_action(){ 30 public function DELETE_action(){
31 - $feed = new ktAPP_ResponseFeed_DELETE(); 31 + $feed = new KT_atom_ResponseFeed_DELETE();
32 $this->responseFeed=$feed; 32 $this->responseFeed=$feed;
33 } 33 }
34 } 34 }
@@ -42,13 +42,13 @@ class ktAPP_Service_fullTree extends ktAPP_Service { @@ -42,13 +42,13 @@ class ktAPP_Service_fullTree extends ktAPP_Service {
42 * Returns detail on a particular folder 42 * Returns detail on a particular folder
43 * 43 *
44 */ 44 */
45 -class ktAPP_Service_folder extends ktAPP_Service { 45 +class KT_atom_service_folder extends KT_atom_service {
46 public function GET_action(){ 46 public function GET_action(){
47 //Create a new response feed 47 //Create a new response feed
48 - $feed=new KTAPPFeed(KT_APP_BASE_URI); 48 + $feed=new KT_atom_responseFeed(KT_APP_BASE_URI);
49 49
50 //Invoke the KtAPI to get detail about the referenced document 50 //Invoke the KtAPI to get detail about the referenced document
51 - $folderDetail=KTAPPHelper::getFolderDetail($this->params[0]?$this->params[0]:1); 51 + $folderDetail=KT_atom_service_helper::getFolderDetail($this->params[0]?$this->params[0]:1);
52 52
53 //Create the atom response feed 53 //Create the atom response feed
54 $entry=$feed->newEntry(); 54 $entry=$feed->newEntry();
@@ -70,13 +70,13 @@ class ktAPP_Service_folder extends ktAPP_Service { @@ -70,13 +70,13 @@ class ktAPP_Service_folder extends ktAPP_Service {
70 * Returns detail on a particular document 70 * Returns detail on a particular document
71 * 71 *
72 */ 72 */
73 -class ktAPP_Service_document extends ktAPP_Service { 73 +class KT_atom_service_document extends KT_atom_service {
74 public function GET_action(){ 74 public function GET_action(){
75 //Create a new response feed 75 //Create a new response feed
76 - $feed=new KTAPPFeed(KT_APP_BASE_URI); 76 + $feed=new KT_atom_responseFeed(KT_APP_BASE_URI);
77 77
78 //Invoke the KtAPI to get detail about the referenced document 78 //Invoke the KtAPI to get detail about the referenced document
79 - $docDetail=KTAPPHelper::getDocumentDetail($this->params[0]); 79 + $docDetail=KT_atom_service_helper::getDocumentDetail($this->params[0]);
80 80
81 //Create the atom response feed 81 //Create the atom response feed
82 $entry=$feed->newEntry(); 82 $entry=$feed->newEntry();
ktatompub/lib/ktAPP.inc.php renamed to ktatompub/lib/KT_atom_server.inc.php
1 -<?php  
2 -class KTAPP{ 1 +<?php
  2 +class KT_atom_server{
3 private $services=array(); 3 private $services=array();
4 private $errors=array(); 4 private $errors=array();
5 private $output=''; 5 private $output='';
6 - 6 + private $queryArray=array();
  7 + private $serviceName='';
  8 + private $method='';
  9 + private $workspace='';
  10 +
  11 +
7 public function __construct(){ 12 public function __construct(){
8 } 13 }
9 - 14 +
10 public function execute(){ 15 public function execute(){
11 $reqMethod=trim(strtoupper($_SERVER['REQUEST_METHOD'])); 16 $reqMethod=trim(strtoupper($_SERVER['REQUEST_METHOD']));
12 $queryArray=split('/',trim($_SERVER['QUERY_STRING'],'/')); 17 $queryArray=split('/',trim($_SERVER['QUERY_STRING'],'/'));
@@ -17,54 +22,58 @@ class KTAPP{ @@ -17,54 +22,58 @@ class KTAPP{
17 $requestParams=array_slice($queryArray,2); 22 $requestParams=array_slice($queryArray,2);
18 $this->queryArray=$queryArray; 23 $this->queryArray=$queryArray;
19 $this->serviceName=$service; 24 $this->serviceName=$service;
20 - 25 + $this->method=$reqMethod;
  26 + $this->workspace=$workspace;
  27 +
21 if($workspace=='servicedocument'){ 28 if($workspace=='servicedocument'){
22 $this->serviceDocument(); 29 $this->serviceDocument();
23 return; 30 return;
24 } 31 }
25 - 32 +
26 $service=$this->getRegisteredService($workspace,$serviceName); 33 $service=$this->getRegisteredService($workspace,$serviceName);
27 -  
28 if(is_array($service)){ 34 if(is_array($service)){
29 $serviceClass=$service['serviceClass']; 35 $serviceClass=$service['serviceClass'];
  36 + echo 'made it';
30 $serviceObject=new $serviceClass($reqMethod,$requestParams,$rawRequest); 37 $serviceObject=new $serviceClass($reqMethod,$requestParams,$rawRequest);
31 $this->output=$serviceObject->render(); 38 $this->output=$serviceObject->render();
32 }else{ 39 }else{
33 - echo "Could not find service:{$service['serviceFunc']} in $workspace"; //TODO: ERROR HERE 40 + $serviceObject=new KT_atom_service($requestParams,$rawRequest);
  41 + $serviceObject->setStatus(KT_atom_service::STATUS_NOT_FOUND);
  42 + $this->output=$serviceObject->render();
34 } 43 }
35 } 44 }
36 45
37 public function registerService($workspace=NULL,$serviceName=NULL,$serviceClass=NULL,$title=NULL){ 46 public function registerService($workspace=NULL,$serviceName=NULL,$serviceClass=NULL,$title=NULL){
38 $workspace=strtolower(trim($workspace)); 47 $workspace=strtolower(trim($workspace));
39 $serviceName=strtolower(trim($serviceName)); 48 $serviceName=strtolower(trim($serviceName));
40 - 49 +
41 $serviceRecord=array( 50 $serviceRecord=array(
42 'fileName' =>$fileName, 51 'fileName' =>$fileName,
43 'serviceClass' =>$serviceClass, 52 'serviceClass' =>$serviceClass,
44 'title' =>$title 53 'title' =>$title
45 ); 54 );
46 - 55 +
47 $this->services[$workspace][$serviceName]=$serviceRecord; 56 $this->services[$workspace][$serviceName]=$serviceRecord;
48 } 57 }
49 - 58 +
50 public function getRegisteredService($workspace,$serviceName=NULL){ 59 public function getRegisteredService($workspace,$serviceName=NULL){
51 $serviceName=strtolower(trim($serviceName)); 60 $serviceName=strtolower(trim($serviceName));
52 if(isset($this->services[$workspace][$serviceName]))return $this->services[$workspace][$serviceName]; 61 if(isset($this->services[$workspace][$serviceName]))return $this->services[$workspace][$serviceName];
53 return false; 62 return false;
54 } 63 }
55 - 64 +
56 public function serviceDocument(){ 65 public function serviceDocument(){
57 - $service=new KTAPPServiceDoc(KT_APP_BASE_URI);  
58 - 66 + $service=new KT_atom_serviceDoc(KT_APP_BASE_URI);
  67 +
59 foreach($this->services as $workspace=>$collection){ 68 foreach($this->services as $workspace=>$collection){
60 //Creating the Default Workspace for use with standard atomPub Clients 69 //Creating the Default Workspace for use with standard atomPub Clients
61 $ws=$service->newWorkspace($workspace); 70 $ws=$service->newWorkspace($workspace);
62 - 71 +
63 foreach($collection as $serviceName=>$serviceInstance){ 72 foreach($collection as $serviceName=>$serviceInstance){
64 $col=$service->newCollection(KT_APP_BASE_URI.$workspace.'/'.$serviceName.'/',$serviceInstance['title'],$ws); 73 $col=$service->newCollection(KT_APP_BASE_URI.$workspace.'/'.$serviceName.'/',$serviceInstance['title'],$ws);
65 } 74 }
66 } 75 }
67 - 76 +
68 $this->output=$service->getAPPdoc(); 77 $this->output=$service->getAPPdoc();
69 } 78 }
70 79
ktatompub/lib/KtAPP_Service.inc.php renamed to ktatompub/lib/KT_atom_service.inc.php
1 <?php 1 <?php
2 -class ktAPP_Service{ 2 +class KT_atom_service{
3 const STATUS_OK ='200 OK'; 3 const STATUS_OK ='200 OK';
4 const STATUS_NOT_FOUND ='204 No Content'; 4 const STATUS_NOT_FOUND ='204 No Content';
5 const STATUS_NOT_ALLOWED ='204 Not Allowed'; 5 const STATUS_NOT_ALLOWED ='204 Not Allowed';
6 const STATUS_NOT_AUTHENTICATED ='204 Not Authenticated'; 6 const STATUS_NOT_AUTHENTICATED ='204 Not Authenticated';
7 const STATUS_CREATED ='201 Created'; 7 const STATUS_CREATED ='201 Created';
8 const STATUS_UPDATED ='200 Updated'; 8 const STATUS_UPDATED ='200 Updated';
9 - const STATUS_NOT_MODIFIED ='304 Not Modified'; 9 + const STATUS_NOT_MODIFIED ='304 Not Modified'; //For use with ETag & If-None-Match headers.
10 const STATUS_PRECONDITION_FAILED='412 Precondition Failed'; //Could not update document because another a newer version exist on the server than the one you are trying to update 10 const STATUS_PRECONDITION_FAILED='412 Precondition Failed'; //Could not update document because another a newer version exist on the server than the one you are trying to update
11 11
12 public $responseFeed=NULL; 12 public $responseFeed=NULL;
@@ -21,31 +21,37 @@ class ktAPP_Service{ @@ -21,31 +21,37 @@ class ktAPP_Service{
21 $this->method=$method; 21 $this->method=$method;
22 $this->params=$params; 22 $this->params=$params;
23 $this->rawContent=$content; 23 $this->rawContent=$content;
24 - $this->parsedXMLContent=json_decode(json_encode(@simplexml_load_string($this->rawContent)),true); 24 + $this->parseHeaders();
  25 + $this->parsedXMLContent=$this->xml2array($this->rawContent);
25 $this->setStatus(self::STATUS_OK); 26 $this->setStatus(self::STATUS_OK);
26 - $this->responseFeed=new KTAPPFeed(KT_APP_BASE_URI); 27 + $this->responseFeed=new KT_atom_responseFeed(KT_APP_BASE_URI);
27 switch(strtoupper($this->method)){ 28 switch(strtoupper($this->method)){
28 case 'GET': $this->GET_action();break; 29 case 'GET': $this->GET_action();break;
29 case 'PUT': $this->PUT_action();break; 30 case 'PUT': $this->PUT_action();break;
30 case 'POST': $this->POST_action();break; 31 case 'POST': $this->POST_action();break;
31 case 'DELETE': $this->DELETE_action();break; 32 case 'DELETE': $this->DELETE_action();break;
  33 + default: $this->UNSUPPORTED_action();break;
32 } 34 }
33 } 35 }
34 36
35 public function GET_action(){ 37 public function GET_action(){
36 - $this->setStatus(ktAPP_Service::STATUS_OK); 38 + $this->setStatus(KT_atom_service::STATUS_OK);
37 } 39 }
38 40
39 public function PUT_action(){ 41 public function PUT_action(){
40 - $this->setStatus(ktAPP_Service::STATUS_NOT_FOUND ); 42 + $this->setStatus(KT_atom_service::STATUS_NOT_FOUND );
41 } 43 }
42 44
43 public function POST_action(){ 45 public function POST_action(){
44 - $this->setStatus(ktAPP_Service::STATUS_NOT_FOUND ); 46 + $this->setStatus(KT_atom_service::STATUS_NOT_FOUND );
45 } 47 }
46 48
47 public function DELETE_action(){ 49 public function DELETE_action(){
48 - $this->setStatus(ktAPP_Service::STATUS_NOT_FOUND ); 50 + $this->setStatus(KT_atom_service::STATUS_NOT_FOUND );
  51 + }
  52 +
  53 + public function UNSUPPORTED_action(){
  54 + $this->setStatus(KT_atom_service::STATUS_NOT_FOUND );
49 } 55 }
50 56
51 57
@@ -53,11 +59,26 @@ class ktAPP_Service{ @@ -53,11 +59,26 @@ class ktAPP_Service{
53 return $this->responseFeed->render(); 59 return $this->responseFeed->render();
54 } 60 }
55 61
56 - private function parseHeaders(){ 62 + private function xml2array($xml){
  63 + $array=json_decode(json_encode(@simplexml_load_string($xml)),true); //TODO - XML2ARRAY Translation
  64 + return $array;
  65 + }
57 66
  67 + private function parseHeaders(){
  68 + $headers=null;
  69 + if(function_exists('http_get_request_headers')){ //Try to use pcre_http library if it exists
  70 + $headers=http_get_request_headers();
  71 + }else{
  72 + if(function_exists('apache_request_headers')){ //If not: try to use apache specific headers
  73 + $headers=apache_request_headers();
  74 + }else{ //If not: not supported - empty headers
  75 + $headers=array();
  76 + }
  77 + }
  78 + $this->headers=$headers;
58 } 79 }
59 80
60 - private function setStatus($status=NULL){ 81 + public function setStatus($status=NULL){
61 header("HTTP/1.1 ".$status); 82 header("HTTP/1.1 ".$status);
62 } 83 }
63 84
@@ -65,6 +86,5 @@ class ktAPP_Service{ @@ -65,6 +86,5 @@ class ktAPP_Service{
65 if($etagValue)header('ETag: '.$etagValue); 86 if($etagValue)header('ETag: '.$etagValue);
66 } 87 }
67 88
68 -  
69 } 89 }
70 ?> 90 ?>
71 \ No newline at end of file 91 \ No newline at end of file
ktatompub/lib/KTAPPServiceDoc.inc.php renamed to ktatompub/lib/KT_atom_serviceDoc.inc.php
@@ -41,10 +41,10 @@ @@ -41,10 +41,10 @@
41 /** 41 /**
42 * Includes 42 * Includes
43 */ 43 */
44 -include_once('KTAPDoc.inc.php'); 44 +include_once('KT_atom_baseDoc.inc.php');
45 45
46 46
47 -class KTAPPServiceDoc extends KTAPDoc { 47 +class KT_atom_serviceDoc extends KT_atom_baseDoc {
48 48
49 private $baseURI=NULL; 49 private $baseURI=NULL;
50 private $service=NULL; 50 private $service=NULL;
ktatompub/lib/KTAPPHelper.inc.php renamed to ktatompub/lib/KT_atom_service_helper.inc.php
@@ -37,7 +37,7 @@ @@ -37,7 +37,7 @@
37 * 37 *
38 */ 38 */
39 39
40 -class KTAPPHelper{ 40 +class KT_atom_service_helper{
41 private static $FOLDER_LIST_PROPERTIES=array('id','title','permissions','mime_icon_path'); 41 private static $FOLDER_LIST_PROPERTIES=array('id','title','permissions','mime_icon_path');
42 private static $FILE_LIST_PROPERTIES=array('id','title','document_type','created_by','created_date','checked_out_by','checked_out_date','modified_by','modified_date','owned_by','mime_type','mime_icon_path','mime_display'); 42 private static $FILE_LIST_PROPERTIES=array('id','title','document_type','created_by','created_date','checked_out_by','checked_out_date','modified_by','modified_date','owned_by','mime_type','mime_icon_path','mime_display');
43 private static $FOLDER_RECURSION_LEVEL=100; 43 private static $FOLDER_RECURSION_LEVEL=100;
@@ -49,7 +49,7 @@ class KTAPPHelper{ @@ -49,7 +49,7 @@ class KTAPPHelper{
49 * @return void 49 * @return void
50 */ 50 */
51 public function __construct(){ 51 public function __construct(){
52 - die('KTAPPHelper should not be instantiated. Only use as a static class'); 52 + die('KT_atom_service_helper should not be instantiated. Only use as a static class');
53 } 53 }
54 54
55 55
@@ -181,11 +181,11 @@ class KTAPPHelper{ @@ -181,11 +181,11 @@ class KTAPPHelper{
181 181
182 $session = $kt->start_session($username,$password, $ip); 182 $session = $kt->start_session($username,$password, $ip);
183 if (PEAR::isError($session)){ 183 if (PEAR::isError($session)){
184 - $response['status_code']=KTAPP_FAILURE; 184 + $response['status_code']=KT_atom_server_FAILURE;
185 $response['session_id']=''; 185 $response['session_id']='';
186 }else{ 186 }else{
187 $session= $session->get_session(); 187 $session= $session->get_session();
188 - $response['status_code'] = KTAPP_SUCCESS; 188 + $response['status_code'] = KT_atom_server_SUCCESS;
189 $response['session_id'] = $session; 189 $response['session_id'] = $session;
190 } 190 }
191 return $response; 191 return $response;
@@ -203,10 +203,10 @@ class KTAPPHelper{ @@ -203,10 +203,10 @@ class KTAPPHelper{
203 $session = $kt->get_active_session($session_id, null); 203 $session = $kt->get_active_session($session_id, null);
204 204
205 if (PEAR::isError($session)){ 205 if (PEAR::isError($session)){
206 - $response['status_code']=KTAPP_FAILURE; 206 + $response['status_code']=KT_atom_server_FAILURE;
207 }else{ 207 }else{
208 $session->logout(); 208 $session->logout();
209 - $response['status_code'] = KTAPP_SUCCESS; 209 + $response['status_code'] = KT_atom_server_SUCCESS;
210 } 210 }
211 return $response; 211 return $response;
212 } 212 }
ktatompub/lib/cmis/KTCMISAPPFeed.inc.php
@@ -40,13 +40,13 @@ @@ -40,13 +40,13 @@
40 /** 40 /**
41 * Includes 41 * Includes
42 */ 42 */
43 -include_once('../KTAPDoc.inc.php'); 43 +include_once('../KT_atom_baseDoc.inc.php');
44 44
45 /** 45 /**
46 * This class generates an AtomPub CMIS feed 46 * This class generates an AtomPub CMIS feed
47 */ 47 */
48 48
49 -class KTCMISAPPFeed extends KTAPDoc { 49 +class KTCMISAPPFeed extends KT_atom_baseDoc {
50 50
51 private $baseURI = NULL; 51 private $baseURI = NULL;
52 private $id = NULL; 52 private $id = NULL;
ktatompub/lib/cmis/KTCMISAPPServiceDoc.inc.php
@@ -39,13 +39,13 @@ @@ -39,13 +39,13 @@
39 /** 39 /**
40 * Includes 40 * Includes
41 */ 41 */
42 -include_once('../KTAPDoc.inc.php'); 42 +include_once('../KT_atom_baseDoc.inc.php');
43 43
44 /** 44 /**
45 * This class generates an AtomPub CMIS service document 45 * This class generates an AtomPub CMIS service document
46 */ 46 */
47 47
48 -class KTCMISAPPServiceDoc extends KTAPDoc { 48 +class KTCMISAPPServiceDoc extends KT_atom_baseDoc {
49 49
50 private $baseURI=NULL; 50 private $baseURI=NULL;
51 private $service=NULL; 51 private $service=NULL;
ktatompub/lib/ktAPP_ResponseFeed.inc.php deleted
1 -<?php  
2 -class ktAPP_ResponseFeed extends KTAPPFeed {  
3 -  
4 -}  
5 -  
6 -class ktAPP_ResponseFeed_GET extends ktAPP_ResponseFeed{}  
7 -class ktAPP_ResponseFeed_PUT extends ktAPP_ResponseFeed{}  
8 -class ktAPP_ResponseFeed_POST extends ktAPP_ResponseFeed{}  
9 -class ktAPP_ResponseFeed_DELETE extends ktAPP_ResponseFeed{  
10 -}  
11 -?>  
12 \ No newline at end of file 0 \ No newline at end of file
ktatompub/phpinfo.php 0 โ†’ 100644
  1 +<?php
  2 +phpinfo();
  3 +?>
0 \ No newline at end of file 4 \ No newline at end of file
ktatompub/services/cmis/NavigationService.inc.php deleted
1 -<?php  
2 -  
3 -require_once KT_LIB_DIR . '/api/ktcmis/ktcmis.inc.php';  
4 -  
5 -/**  
6 - * CMIS Service class which hooks into the KnowledgeTree interface  
7 - * for processing of CMIS queries and responses via atompub/webservices  
8 - */  
9 -  
10 -class NavigationService extends KTNavigationService {  
11 -  
12 - /**  
13 - * Get descendents of the specified folder, up to the depth indicated  
14 - *  
15 - * @param string $repositoryId  
16 - * @param string $folderId  
17 - * @param boolean $includeAllowableActions  
18 - * @param boolean $includeRelationships  
19 - * @param string $typeID  
20 - * @param int $depth  
21 - * @param string $filter  
22 - * @return cmisObjectType[]  
23 - */  
24 - public function getDescendants($repositoryId, $folderId, $includeAllowableActions, $includeRelationships,  
25 - $depth = 1, $typeID = 'Any', $filter = '')  
26 - {  
27 - $result = parent::getDescendants($repositoryId, $folderId, $includeAllowableActions,  
28 - $includeRelationships, $depth, $typeID, $filter);  
29 -  
30 - if ($result['status_code'] == 0)  
31 - {  
32 - return $result['results'];  
33 - }  
34 - }  
35 -  
36 - /**  
37 - * Get direct children of the specified folder  
38 - *  
39 - * @param string $repositoryId  
40 - * @param string $folderId  
41 - * @param boolean $includeAllowableActions  
42 - * @param boolean $includeRelationships  
43 - * @param string $typeID  
44 - * @param string $filter  
45 - * @param int $maxItems  
46 - * @param int $skipCount  
47 - * @return cmisObjectType[]  
48 - */  
49 - public function getChildren($repositoryId, $folderId, $includeAllowableActions, $includeRelationships,  
50 - $typeID = 'Any', $filter = '', $maxItems = 0, $skipCount = 0)  
51 - {  
52 - $result = parent::getChildren($repositoryId, $folderId, $includeAllowableActions, $includeRelationships,  
53 - $typeID, $filter, $maxItems, $skipCount);  
54 -  
55 - if ($result['status_code'] == 0)  
56 - {  
57 - return $result['results'];  
58 - }  
59 - }  
60 -  
61 - /**  
62 - * Gets the parent of the selected folder  
63 - *  
64 - * @param string $repositoryId  
65 - * @param string $folderId  
66 - * @param boolean $includeAllowableActions  
67 - * @param boolean $includeRelationships  
68 - * @param boolean $returnToRoot  
69 - * @param string $filter  
70 - * @return cmisObjectType[]  
71 - */  
72 - public function getFolderParent($repositoryId, $folderId, $includeAllowableActions, $includeRelationships, $returnToRoot, $filter = '')  
73 - {  
74 - $result = parent::getFolderParent($repositoryId, $folderId, $includeAllowableActions, $includeRelationships, $returnToRoot, $filter);  
75 -  
76 - if ($result['status_code'] == 0)  
77 - {  
78 - return $result['results'];  
79 - }  
80 - }  
81 -  
82 - /**  
83 - * Gets the parents for the selected object  
84 - *  
85 - * @param string $repositoryId  
86 - * @param string $folderId  
87 - * @param boolean $includeAllowableActions  
88 - * @param boolean $includeRelationships  
89 - * @param string $filter  
90 - * @return cmisObjectType[]  
91 - */  
92 - public function getObjectParents($repositoryId, $objectId, $includeAllowableActions, $includeRelationships, $filter = '')  
93 - {  
94 - $result = parent::getObjectParents($repositoryId, $objectId, $includeAllowableActions, $includeRelationships, $filter);  
95 -  
96 - if ($result['status_code'] == 0)  
97 - {  
98 - return $result['results'];  
99 - }  
100 - }  
101 -  
102 - /**  
103 - * Returns a list of checked out documents from the selected repository  
104 - *  
105 - * @param string $repositoryId  
106 - * @param string $folderId The folder for which checked out docs are requested  
107 - * @param string $filter  
108 - * @param int $maxItems  
109 - * @param int $skipCount  
110 - * @return array $checkedout The collection of checked out documents  
111 - */  
112 - function getCheckedoutDocs($repositoryId, $folderId = null, $filter = '', $maxItems = 0, $skipCount = 0)  
113 - {  
114 - $checkedout = parent::getObjectParents($repositoryId, $folderId, $filter, $maxItems, $skipCount);  
115 -  
116 - if ($result['status_code'] == 0)  
117 - {  
118 - return $result['results'];  
119 - }  
120 - }  
121 -  
122 -}  
123 -  
124 -?>  
ktatompub/services/cmis/ObjectFeed.inc.php deleted
1 -<?php  
2 -  
3 -class CMISObjectFeed {  
4 -  
5 - /**  
6 - * Creates an AtomPub entry for a CMIS entry and adds it to the supplied feed  
7 - *  
8 - * @param object $feed The feed to which we add the entry  
9 - * @param array $cmisEntry The entry data  
10 - * @param string $parent The parent folder  
11 - */  
12 - static public function createEntry(&$feed, $cmisEntry, $parent, $path)  
13 - {  
14 - preg_match('/^\/?cmis\/folder\/(.*)\/[^\/]*\/?$/', trim($_SERVER['QUERY_STRING'], '/'), $matches);  
15 - $path = $matches[1];  
16 - $parent = preg_replace('/\/[^\/]*$/', '', $path);  
17 -  
18 - $entry = $feed->newEntry();  
19 - $feed->newId('urn:uuid:' . $cmisEntry['properties']['Name']['value'] . '-'  
20 - . strtolower($cmisEntry['properties']['ObjectTypeId']['value']), $entry);  
21 -  
22 - /*  
23 -<link rel="edit" href="http://10.33.4.34:8080/alfresco/service/api/node/workspace/SpacesStore/e98319fa-76e4-478f-8ce8-a3a0fd683e2c"/>  
24 -<link rel="cmis-allowableactions" href="http://10.33.4.34:8080/alfresco/service/api/node/workspace/SpacesStore/e98319fa-76e4-478f-8ce8-a3a0fd683e2c/permissions"/>  
25 -<link rel="cmis-relationships" href="http://10.33.4.34:8080/alfresco/service/api/node/workspace/SpacesStore/e98319fa-76e4-478f-8ce8-a3a0fd683e2c/associations"/>  
26 - */  
27 -  
28 - // links  
29 -// $link = $feed->newElement('link');  
30 -// $link->appendChild($feed->newAttr('rel','self'));  
31 -// $link->appendChild($feed->newAttr('href', CMIS_BASE_URI . strtolower($cmisEntry['properties']['ObjectTypeId']['value'])  
32 -// . '/' . $cmisEntry['properties']['ObjectId']['value']));  
33 -// $entry->appendChild($link);  
34 - $link = $feed->newElement('link');  
35 - $link->appendChild($feed->newAttr('rel','cmis-parent'));  
36 - $link->appendChild($feed->newAttr('href', CMIS_BASE_URI . 'folder/' . $path));  
37 - $entry->appendChild($link);  
38 -  
39 - if (strtolower($cmisEntry['properties']['ObjectTypeId']['value']) == 'folder')  
40 - {  
41 - $link = $feed->newElement('link');  
42 - $link->appendChild($feed->newAttr('rel','cmis-folderparent'));  
43 - $link->appendChild($feed->newAttr('href', CMIS_BASE_URI . 'folder/' . $path));  
44 - $entry->appendChild($link);  
45 - $link = $feed->newElement('link');  
46 - $link->appendChild($feed->newAttr('rel','cmis-children'));  
47 - $link->appendChild($feed->newAttr('href', CMIS_BASE_URI  
48 - . strtolower($cmisEntry['properties']['ObjectTypeId']['value'])  
49 - . '/' . $path . '/' . urlencode($cmisEntry['properties']['Name']['value'])  
50 - . '/children'));  
51 - $entry->appendChild($link);  
52 - $link = $feed->newElement('link');  
53 - $link->appendChild($feed->newAttr('rel','cmis-descendants'));  
54 - $link->appendChild($feed->newAttr('href', CMIS_BASE_URI  
55 - . strtolower($cmisEntry['properties']['ObjectTypeId']['value'])  
56 - . '/' . $path . '/' . urlencode($cmisEntry['properties']['Name']['value'])  
57 - . '/descendants'));  
58 - $entry->appendChild($link);  
59 - }  
60 -  
61 - $link = $feed->newElement('link');  
62 - $link->appendChild($feed->newAttr('rel','cmis-type'));  
63 - $link->appendChild($feed->newAttr('href', CMIS_BASE_URI . 'type/' . strtolower($cmisEntry['properties']['ObjectTypeId']['value'])));  
64 - $entry->appendChild($link);  
65 - $link = $feed->newElement('link');  
66 - $link->appendChild($feed->newAttr('rel','cmis-repository'));  
67 - $link->appendChild($feed->newAttr('href', CMIS_BASE_URI . 'repository'));  
68 - $entry->appendChild($link);  
69 - // end links  
70 -  
71 - $entry->appendChild($feed->newElement('summary', $cmisEntry['properties']['Name']['value']));  
72 - $entry->appendChild($feed->newElement('title', $cmisEntry['properties']['Name']['value']));  
73 -  
74 - // main CMIS entry  
75 - $objectElement = $feed->newElement('cmis:object');  
76 - $propertiesElement = $feed->newElement('cmis:properties');  
77 -  
78 - foreach($cmisEntry['properties'] as $propertyName => $property)  
79 - {  
80 - $propElement = $feed->newElement('cmis:' . $property['type']);  
81 - $propElement->appendChild($feed->newAttr('cmis:name', $propertyName));  
82 - $feed->newField('value', CMISUtil::boolToString($property['value']), $propElement);  
83 - $propertiesElement->appendChild($propElement);  
84 - }  
85 -  
86 - $objectElement->appendChild($propertiesElement);  
87 - $entry->appendChild($objectElement);  
88 - }  
89 -  
90 -}  
91 -  
92 -?>  
ktatompub/services/cmis/ObjectService.inc.php deleted
1 -<?php  
2 -  
3 -require_once KT_LIB_DIR . '/api/ktcmis/ktcmis.inc.php';  
4 -  
5 -/**  
6 - * CMIS Service class which hooks into the KnowledgeTree interface  
7 - * for processing of CMIS queries and responses via atompub/webservices  
8 - */  
9 -  
10 -class ObjectService extends KTObjectService {  
11 -  
12 - /**  
13 - * Fetches the properties for the specified object  
14 - *  
15 - * @param string $repositoryId  
16 - * @param string $objectId  
17 - * @param boolean $includeAllowableActions  
18 - * @param boolean $includeRelationships  
19 - * @param boolean $returnVersion  
20 - * @param string $filter  
21 - * @return object CMIS object properties  
22 - */  
23 - public function getProperties($repositoryId, $objectId, $includeAllowableActions, $includeRelationships,  
24 - $returnVersion = false, $filter = '')  
25 - {  
26 - $result = parent::getProperties($repositoryId, $objectId, $includeAllowableActions,  
27 - $returnVersion, $filter);  
28 -  
29 - if ($result['status_code'] == 0)  
30 - {  
31 - return $result['results'];  
32 - }  
33 - }  
34 -  
35 -}  
36 -  
37 -?>  
ktatompub/services/cmis/RepositoryService.inc.php deleted
1 -<?php  
2 -  
3 -/**  
4 - * CMIS Service class which hooks into the KnowledgeTree interface  
5 - * for processing of CMIS queries and responses via atompub/webservices  
6 - */  
7 -  
8 -require_once KT_LIB_DIR . '/api/ktcmis/ktcmis.inc.php';  
9 -  
10 -class RepositoryService extends KTRepositoryService {  
11 -  
12 - /**  
13 - * Fetches a list of available repositories  
14 - *  
15 - * @return cmisRepositoryEntryType[]  
16 - */  
17 - public function getRepositories()  
18 - {  
19 - $result = parent::getRepositories();  
20 -  
21 - if ($result['status_code'] == 0)  
22 - {  
23 - return $result['results'];  
24 - }  
25 - }  
26 -  
27 - /**  
28 - * Fetches information about the selected repository  
29 - *  
30 - * @param string $repositoryId  
31 - * @return cmisRepositoryInfoType  
32 - */  
33 - public function getRepositoryInfo($repositoryId)  
34 - {  
35 - $result = parent::getRepositoryInfo($repositoryId);  
36 -  
37 - if ($result['status_code'] == 0)  
38 - {  
39 - return $result['results'];  
40 - }  
41 - }  
42 -  
43 - /**  
44 - * Fetch the list of supported object types for the selected repository  
45 - *  
46 - * @param string $repositoryId The ID of the repository for which object types must be returned  
47 - * @param string $typeId The type to return, ALL if not set  
48 - * @param boolean $returnPropertyDefinitions Return property definitions as well if TRUE  
49 - * @param int $maxItems The maximum number of items to return  
50 - * @param int $skipCount The number of items to skip before starting to return results  
51 - * @param boolean $hasMoreItems TRUE if there are more items to return than were requested  
52 - * @return cmisTypeDefinitionType[]  
53 - */  
54 - public function getTypes($repositoryId, $typeId = '', $returnPropertyDefinitions = false,  
55 - $maxItems = 0, $skipCount = 0, &$hasMoreItems = false)  
56 - {  
57 - $result = parent::getTypes($repositoryId, $typeId, $returnPropertyDefinitions,  
58 - $maxItems, $skipCount, $hasMoreItems);  
59 -  
60 - if ($result['status_code'] == 0)  
61 - {  
62 - return $result['results'];  
63 - }  
64 - }  
65 -  
66 - /**  
67 - * Fetch the object type definition for the requested type  
68 - *  
69 - * @param string $repositoryId  
70 - * @param string $typeId  
71 - * @return cmisTypeDefinitionType  
72 - */  
73 - public function getTypeDefinition($repositoryId, $typeId)  
74 - {  
75 - $result = parent::getTypeDefinition($repositoryId, $typeId);  
76 -  
77 - if ($result['status_code'] == 0)  
78 - {  
79 - return $result['results'];  
80 - }  
81 - }  
82 -  
83 -}  
84 -  
85 -?>  
ktatompub/services/cmis/checkedout.inc.php deleted
1 -<?php  
2 -  
3 -/**  
4 - * Retrieves the list of checked out documents and returns it as an AtomPub feed  
5 - *  
6 - * NOTE since we don't yet support getCheckedOutDocuments in the CMIS API, this code  
7 - * returns a static empty feed  
8 - *  
9 - * TODO when the CMIS API functionality exists, create the feed dynamically  
10 - */  
11 -  
12 -include 'services/cmis/RepositoryService.inc.php';  
13 -include 'services/cmis/NavigationService.inc.php';  
14 -  
15 -$RepositoryService = new RepositoryService();  
16 -$NavigationService = new NavigationService();  
17 -  
18 -$NavigationService->startSession($username, $password);  
19 -  
20 -$repositories = $RepositoryService->getRepositories();  
21 -$repositoryId = $repositories[0]['repositoryId'];  
22 -  
23 -$checkedout = $NavigationService->getCheckedoutDocs($repositoryId);  
24 -  
25 -$feed = new KTCMISAPPFeed(KT_APP_BASE_URI, 'Checked out Documents', null, null, null, 'urn:uuid:checkedout');  
26 -  
27 -foreach($checkedout as $document)  
28 -{  
29 - $entry = $feed->newEntry();  
30 - $objectElement = $feed->newElement('cmis:object');  
31 - $propertiesElement = $feed->newElement('cmis:properties');  
32 -  
33 - foreach($cmisEntry['properties'] as $propertyName => $property)  
34 - {  
35 - $propElement = $feed->newElement('cmis:' . $property['type']);  
36 - $propElement->appendChild($feed->newAttr('cmis:name', $propertyName));  
37 - $feed->newField('value', CMISUtil::boolToString($property['value']), $propElement);  
38 - $propertiesElement->appendChild($propElement);  
39 - }  
40 -  
41 - $objectElement->appendChild($propertiesElement);  
42 - $entry->appendChild($objectElement);  
43 -}  
44 -  
45 -$entry = null;  
46 -$feed->newField('hasMoreItems', 'false', $entry, true);  
47 -  
48 -$output = $feed->getAPPdoc();  
49 -  
50 -?>  
ktatompub/services/cmis/document.inc.php deleted
1 -<?php  
2 -  
3 -/**  
4 - * Document access/management functions for CMIS AtomPub  
5 - * Output returned as an AtomPub feed  
6 - */  
7 -include 'services/cmis/ObjectFeed.inc.php';  
8 -  
9 -class CMISDocumentFeed extends CMISObjectFeed {  
10 -  
11 - /**  
12 - * Retrieves data about a specific document  
13 - *  
14 - * @param object $ObjectService The CMIS service  
15 - * @param string $repositoryId  
16 - * @param string $documentId  
17 - * @return string CMIS AtomPub feed  
18 - */  
19 - static public function getDocumentFeed($ObjectService, $repositoryId, $documentId)  
20 - {  
21 - $cmisEntry = $ObjectService->getProperties($repositoryId, $documentId, false, false);  
22 -  
23 - $feed = new KTCMISAPPFeed(KT_APP_BASE_URI, $cmisEntry['properties']['ObjectTypeId']['value'], null, null, null,  
24 - 'urn:uuid:' . $cmisEntry['properties']['ObjectId']['value']);  
25 -  
26 - CMISDocumentFeed::createEntry($feed, $cmisEntry, $cmisEntry['properties']['ParentId']['value']);  
27 -  
28 - // <cmis:hasMoreItems>false</cmis:hasMoreItems>  
29 -  
30 - $output = $feed->getAPPdoc();  
31 -  
32 - $outputs = '<?xml version="1.0" encoding="UTF-8"?>  
33 -<feed xmlns="http://www.w3.org/2005/Atom" xmlns:cmis="http://www.cmis.org/2008/05">  
34 -<entry>  
35 -<author><name>admin</name></author>  
36 -<content type="application/pdf" src="http://127.0.0.1:8080/alfresco/service/api/node/workspace/SpacesStore/2df9d676-f173-47bb-8ec1-41fa1186b66d/content.h4555-cmis-so.pdf"/><id>urn:uuid:2df9d676-f173-47bb-8ec1-41fa1186b66d</id>  
37 -<link rel="self" href="http://127.0.0.1:8080/alfresco/service/api/node/workspace/SpacesStore/2df9d676-f173-47bb-8ec1-41fa1186b66d"/>  
38 -<link rel="enclosure" type="application/pdf" href="http://127.0.0.1:8080/alfresco/service/api/node/workspace/SpacesStore/2df9d676-f173-47bb-8ec1-41fa1186b66d/content.h4555-cmis-so.pdf"/><link rel="edit" href="http://127.0.0.1:8080/alfresco/service/api/node/workspace/SpacesStore/2df9d676-f173-47bb-8ec1-41fa1186b66d"/>  
39 -<link rel="edit-media" type="application/pdf" href="http://127.0.0.1:8080/alfresco/service/api/node/workspace/SpacesStore/2df9d676-f173-47bb-8ec1-41fa1186b66d/content.h4555-cmis-so.pdf"/><link rel="cmis-allowableactions" href="http://127.0.0.1:8080/alfresco/service/api/node/workspace/SpacesStore/2df9d676-f173-47bb-8ec1-41fa1186b66d/permissions"/>  
40 -<link rel="cmis-relationships" href="http://127.0.0.1:8080/alfresco/service/api/node/workspace/SpacesStore/2df9d676-f173-47bb-8ec1-41fa1186b66d/associations"/>  
41 -<link rel="cmis-parents" href="http://127.0.0.1:8080/alfresco/service/api/node/workspace/SpacesStore/2df9d676-f173-47bb-8ec1-41fa1186b66d/parents"/>  
42 -<link rel="cmis-allversions" href="http://127.0.0.1:8080/alfresco/service/api/node/workspace/SpacesStore/2df9d676-f173-47bb-8ec1-41fa1186b66d/versions"/>  
43 -<link rel="cmis-stream" type="application/pdf" href="http://127.0.0.1:8080/alfresco/service/api/node/workspace/SpacesStore/2df9d676-f173-47bb-8ec1-41fa1186b66d/content.h4555-cmis-so.pdf"/><link rel="cmis-type" href="http://127.0.0.1:8080/alfresco/service/api/type/document"/>  
44 -<link rel="cmis-repository" href="http://127.0.0.1:8080/alfresco/service/api/repository"/>  
45 -<published>2009-06-23T09:40:47.889+02:00</published>  
46 -<summary></summary>  
47 -<title>h4555-cmis-so.pdf</title>  
48 -<updated>2009-06-23T09:40:58.524+02:00</updated>  
49 -<cmis:object>  
50 -<cmis:properties>  
51 -<cmis:propertyId cmis:name="ObjectId"><cmis:value>workspace://SpacesStore/2df9d676-f173-47bb-8ec1-41fa1186b66d</cmis:value></cmis:propertyId>  
52 -<cmis:propertyString cmis:name="BaseType"><cmis:value>document</cmis:value></cmis:propertyString>  
53 -<cmis:propertyString cmis:name="ObjectTypeId"><cmis:value>document</cmis:value></cmis:propertyString>  
54 -<cmis:propertyString cmis:name="CreatedBy"><cmis:value>admin</cmis:value></cmis:propertyString>  
55 -<cmis:propertyDateTime cmis:name="CreationDate"><cmis:value>2009-06-23T09:40:47.889+02:00</cmis:value></cmis:propertyDateTime>  
56 -<cmis:propertyString cmis:name="LastModifiedBy"><cmis:value>admin</cmis:value></cmis:propertyString>  
57 -<cmis:propertyDateTime cmis:name="LastModificationDate"><cmis:value>2009-06-23T09:40:58.524+02:00</cmis:value></cmis:propertyDateTime>  
58 -<cmis:propertyString cmis:name="Name"><cmis:value>h4555-cmis-so.pdf</cmis:value></cmis:propertyString>  
59 -<cmis:propertyBoolean cmis:name="IsImmutable"><cmis:value>false</cmis:value></cmis:propertyBoolean>  
60 -<cmis:propertyBoolean cmis:name="IsLatestVersion"><cmis:value>true</cmis:value></cmis:propertyBoolean>  
61 -<cmis:propertyBoolean cmis:name="IsMajorVersion"><cmis:value>false</cmis:value></cmis:propertyBoolean>  
62 -<cmis:propertyBoolean cmis:name="IsLatestMajorVersion"><cmis:value>false</cmis:value></cmis:propertyBoolean>  
63 -<cmis:propertyString cmis:name="VersionLabel"/>  
64 -<cmis:propertyId cmis:name="VersionSeriesId"><cmis:value>workspace://SpacesStore/2df9d676-f173-47bb-8ec1-41fa1186b66d</cmis:value></cmis:propertyId>  
65 -<cmis:propertyBoolean cmis:name="IsVersionSeriesCheckedOut"><cmis:value>false</cmis:value></cmis:propertyBoolean>  
66 -<cmis:propertyString cmis:name="VersionSeriesCheckedOutBy"/>  
67 -<cmis:propertyId cmis:name="VersionSeriesCheckedOutId"/>  
68 -<cmis:propertyString cmis:name="CheckinComment"/>  
69 -<cmis:propertyInteger cmis:name="ContentStreamLength"><cmis:value>343084</cmis:value></cmis:propertyInteger>  
70 -<cmis:propertyString cmis:name="ContentStreamMimeType"><cmis:value>application/pdf</cmis:value></cmis:propertyString>  
71 -<cmis:propertyString cmis:name="ContentStreamFilename"><cmis:value>h4555-cmis-so.pdf</cmis:value></cmis:propertyString>  
72 -<cmis:propertyString cmis:name="ContentStreamURI"><cmis:value>http://127.0.0.1:8080/alfresco/service/api/node/workspace/SpacesStore/2df9d676-f173-47bb-8ec1-41fa1186b66d/content.h4555-cmis-so.pdf</cmis:value></cmis:propertyString>  
73 -</cmis:properties>  
74 -</cmis:object>  
75 -<cmis:terminator/>  
76 -<app:edited>2009-06-23T09:40:58.524+02:00</app:edited>  
77 -<alf:icon>http://127.0.0.1:8080/alfresco/images/filetypes/pdf.gif</alf:icon>  
78 -</entry>  
79 -</feed>';  
80 -  
81 - return $output;  
82 - }  
83 -  
84 -}  
85 -  
86 -include 'services/cmis/RepositoryService.inc.php';  
87 -include 'services/cmis/ObjectService.inc.php';  
88 -  
89 -$RepositoryService = new RepositoryService();  
90 -$repositories = $RepositoryService->getRepositories();  
91 -$repositoryId = $repositories[0]['repositoryId'];  
92 -  
93 -$ObjectService = new ObjectService();  
94 -$ObjectService->startSession($username, $password);  
95 -  
96 -$output = CMISDocumentFeed::getDocumentFeed($ObjectService, $repositoryId, $query[2]);  
97 -  
98 -?>  
ktatompub/services/cmis/folder.inc.php deleted
1 -<?php  
2 -  
3 -/**  
4 - * Folder access/management functions for CMIS AtomPub  
5 - * Output returned as an AtomPub feed  
6 - */  
7 -  
8 - // NOTE the static responses in the code are example responses and partial responses  
9 - // against which the dynamic response is being checked while we are still uncertain  
10 - // whether everything is as it should be  
11 -  
12 -include 'services/cmis/ObjectFeed.inc.php';  
13 -  
14 -class CMISFolderFeed extends CMISObjectFeed {  
15 -  
16 - /**  
17 - * Retrieves children/descendants of the specified folder  
18 - * TODO this currently only works in children mode, add descendants  
19 - *  
20 - * @param string $repositoryId  
21 - * @param string $folderId folder id for which children/descendants are requested  
22 - * @param string $feedType children or descendants  
23 - * @return string CMIS AtomPub feed  
24 - */  
25 - static public function getFolderChildrenFeed($NavigationService, $repositoryId, $folderId, $folderName, $feedType)  
26 - {  
27 - if ($feedType == 'children')  
28 - {  
29 - $entries = $NavigationService->getChildren($repositoryId, $folderId, false, false);  
30 - }  
31 - else if ($feedType == 'descendants')  
32 - {  
33 - $entries = $NavigationService->getDescendants($repositoryId, $folderId, $includeAllowableActions, $includeRelationships);  
34 - }  
35 - else  
36 - {  
37 - // error, we shouldn't be here, if we are then the wrong function was called  
38 - }  
39 -  
40 - $feed = new KTCMISAPPFeed(KT_APP_BASE_URI, $folderName . ' ' . ucwords($feedType), null, null, null,  
41 - 'urn:uuid:' . $folderName . '-' . $feedType);  
42 -  
43 - foreach($entries as $cmisEntry)  
44 - {  
45 - CMISFolderFeed::createEntry($feed, $cmisEntry, $folderName);  
46 - }  
47 -  
48 - // <cmis:hasMoreItems>false</cmis:hasMoreItems>  
49 -  
50 - $output = $feed->getAPPdoc();  
51 - $outputs = '<?xml version="1.0" encoding="utf-8"?>  
52 - <feed xmlns="http://www.w3.org/2005/Atom" xmlns:cmis="http://www.cmis.org/2008/05">  
53 - <id>urn:uuid:28537649-8af2-4c74-aa92-5d8bbecac9ce-children</id>  
54 - <link rel="self" href="http://10.33.4.34/ktatompub/?/cmis/folder/F1/children"/>  
55 - <title>Root Folder Children</title>  
56 - <entry>  
57 - <id>urn:uuid:86224486-b7ae-4074-a793-82cd259b0026-folder</id>  
58 - <link rel="cmis-children" href="http://10.33.4.34/ktatompub/?cmis/folder/F2/children"/>  
59 -  
60 - <link rel="cmis-descendants" href="http://10.33.4.34/ktatompub/?cmis/folder/F2/descendants"/>  
61 - <link rel="cmis-type" href="http://10.33.4.34:8080/alfresco/service/api/type/folder"/>  
62 - <link rel="cmis-repository" href="http://10.33.4.34:8080/alfresco/service/api/repository"/>  
63 - <summary>DroppedDocuments</summary>  
64 - <title>DroppedDocuments</title>  
65 - <cmis:object>  
66 - <cmis:properties>  
67 - <cmis:propertyId cmis:name="ObjectId">  
68 -  
69 - <cmis:value>F2</cmis:value>  
70 - </cmis:propertyId>  
71 - <cmis:propertyString cmis:name="ObjectTypeId">  
72 - <cmis:value>Folder</cmis:value>  
73 - </cmis:propertyString>  
74 - <cmis:propertyString cmis:name="Name">  
75 - <cmis:value>DroppedDocuments</cmis:value>  
76 -  
77 - </cmis:propertyString>  
78 - </cmis:properties>  
79 - </cmis:object>  
80 - </entry>  
81 - <entry>  
82 - <id>urn:uuid:86224486-b7ae-4074-a793-82cd259b0026-folder</id>  
83 - <link rel="cmis-children" href="http://10.33.4.34/ktatompub/?cmis/folder/F4/children"/>  
84 - <link rel="cmis-descendants" href="http://10.33.4.34/ktatompub/?cmis/folder/F4/descendants"/>  
85 -  
86 - <link rel="cmis-type" href="http://10.33.4.34:8080/alfresco/service/api/type/folder"/>  
87 - <link rel="cmis-repository" href="http://10.33.4.34:8080/alfresco/service/api/repository"/>  
88 - <summary>Test KT Folder</summary>  
89 - <title>Test KT Folder</title>  
90 - <cmis:object>  
91 - <cmis:properties>  
92 - <cmis:propertyId cmis:name="ObjectId">  
93 - <cmis:value>F4</cmis:value>  
94 -  
95 - </cmis:propertyId>  
96 - <cmis:propertyString cmis:name="ObjectTypeId">  
97 - <cmis:value>Folder</cmis:value>  
98 - </cmis:propertyString>  
99 - <cmis:propertyString cmis:name="Name">  
100 - <cmis:value>Test KT Folder</cmis:value>  
101 - </cmis:propertyString>  
102 - </cmis:properties>  
103 -  
104 - </cmis:object>  
105 - </entry>  
106 - <entry>  
107 - <author><name>admin</name></author>  
108 - <content type="application/pdf" src="http://10.33.4.34:8080/alfresco/service/api/node/workspace/SpacesStore/2df9d676-f173-47bb-8ec1-41fa1186b66d/content.h4555-cmis-so.pdf"/><id>urn:uuid:2df9d676-f173-47bb-8ec1-41fa1186b66d</id>  
109 - <link rel="self" href="http://10.33.4.34:8080/alfresco/service/api/node/workspace/SpacesStore/2df9d676-f173-47bb-8ec1-41fa1186b66d"/>  
110 -  
111 - <link rel="enclosure" type="application/pdf" href="http://10.33.4.34:8080/alfresco/service/api/node/workspace/SpacesStore/2df9d676-f173-47bb-8ec1-41fa1186b66d/content.h4555-cmis-so.pdf"/><link rel="edit" href="http://10.33.4.34:8080/alfresco/service/api/node/workspace/SpacesStore/2df9d676-f173-47bb-8ec1-41fa1186b66d"/>  
112 - <link rel="edit-media" type="application/pdf" href="http://10.33.4.34:8080/alfresco/service/api/node/workspace/SpacesStore/2df9d676-f173-47bb-8ec1-41fa1186b66d/content.h4555-cmis-so.pdf"/><link rel="cmis-allowableactions" href="http://10.33.4.34:8080/alfresco/service/api/node/workspace/SpacesStore/2df9d676-f173-47bb-8ec1-41fa1186b66d/permissions"/>  
113 - <link rel="cmis-relationships" href="http://10.33.4.34:8080/alfresco/service/api/node/workspace/SpacesStore/2df9d676-f173-47bb-8ec1-41fa1186b66d/associations"/>  
114 - <link rel="cmis-parents" href="http://10.33.4.34:8080/alfresco/service/api/node/workspace/SpacesStore/2df9d676-f173-47bb-8ec1-41fa1186b66d/parents"/>  
115 - <link rel="cmis-allversions" href="http://10.33.4.34:8080/alfresco/service/api/node/workspace/SpacesStore/2df9d676-f173-47bb-8ec1-41fa1186b66d/versions"/>  
116 - <link rel="cmis-stream" type="application/pdf" href="http://10.33.4.34:8080/alfresco/service/api/node/workspace/SpacesStore/2df9d676-f173-47bb-8ec1-41fa1186b66d/content.h4555-cmis-so.pdf"/><link rel="cmis-type" href="http://10.33.4.34:8080/alfresco/service/api/type/document"/>  
117 - <link rel="cmis-repository" href="http://10.33.4.34:8080/alfresco/service/api/repository"/>  
118 - <published>2009-06-23T09:40:47.889+02:00</published>  
119 - <summary></summary>  
120 - <title>h4555-cmis-so.pdf</title>  
121 - <updated>2009-06-23T09:40:58.524+02:00</updated>  
122 -  
123 - <cmis:object>  
124 - <cmis:properties>  
125 - <cmis:propertyId cmis:name="ObjectId"><cmis:value>workspace://SpacesStore/2df9d676-f173-47bb-8ec1-41fa1186b66d</cmis:value></cmis:propertyId>  
126 - <cmis:propertyString cmis:name="BaseType"><cmis:value>document</cmis:value></cmis:propertyString>  
127 - <cmis:propertyString cmis:name="ObjectTypeId"><cmis:value>document</cmis:value></cmis:propertyString>  
128 - <cmis:propertyString cmis:name="CreatedBy"><cmis:value>admin</cmis:value></cmis:propertyString>  
129 -  
130 - <cmis:propertyDateTime cmis:name="CreationDate"><cmis:value>2009-06-23T09:40:47.889+02:00</cmis:value></cmis:propertyDateTime>  
131 - <cmis:propertyString cmis:name="LastModifiedBy"><cmis:value>admin</cmis:value></cmis:propertyString>  
132 - <cmis:propertyDateTime cmis:name="LastModificationDate"><cmis:value>2009-06-23T09:40:58.524+02:00</cmis:value></cmis:propertyDateTime>  
133 - <cmis:propertyString cmis:name="Name"><cmis:value>h4555-cmis-so.pdf</cmis:value></cmis:propertyString>  
134 - <cmis:propertyBoolean cmis:name="IsImmutable"><cmis:value>false</cmis:value></cmis:propertyBoolean>  
135 -  
136 - <cmis:propertyBoolean cmis:name="IsLatestVersion"><cmis:value>true</cmis:value></cmis:propertyBoolean>  
137 - <cmis:propertyBoolean cmis:name="IsMajorVersion"><cmis:value>false</cmis:value></cmis:propertyBoolean>  
138 - <cmis:propertyBoolean cmis:name="IsLatestMajorVersion"><cmis:value>false</cmis:value></cmis:propertyBoolean>  
139 - <cmis:propertyString cmis:name="VersionLabel"/>  
140 - <cmis:propertyId cmis:name="VersionSeriesId"><cmis:value>workspace://SpacesStore/2df9d676-f173-47bb-8ec1-41fa1186b66d</cmis:value></cmis:propertyId>  
141 -  
142 - <cmis:propertyBoolean cmis:name="IsVersionSeriesCheckedOut"><cmis:value>false</cmis:value></cmis:propertyBoolean>  
143 - <cmis:propertyString cmis:name="VersionSeriesCheckedOutBy"/>  
144 - <cmis:propertyId cmis:name="VersionSeriesCheckedOutId"/>  
145 - <cmis:propertyString cmis:name="CheckinComment"/>  
146 - <cmis:propertyInteger cmis:name="ContentStreamLength"><cmis:value>343084</cmis:value></cmis:propertyInteger>  
147 - <cmis:propertyString cmis:name="ContentStreamMimeType"><cmis:value>application/pdf</cmis:value></cmis:propertyString>  
148 - <cmis:propertyString cmis:name="ContentStreamFilename"><cmis:value>h4555-cmis-so.pdf</cmis:value></cmis:propertyString>  
149 -  
150 - <cmis:propertyString cmis:name="ContentStreamURI"><cmis:value>http://10.33.4.34:8080/alfresco/service/api/node/workspace/SpacesStore/2df9d676-f173-47bb-8ec1-41fa1186b66d/content.h4555-cmis-so.pdf</cmis:value></cmis:propertyString>  
151 - </cmis:properties>  
152 - </cmis:object>  
153 -  
154 -  
155 - </entry>  
156 - </feed>';  
157 -  
158 - $outputs = '<?xml version="1.0" encoding="UTF-8"?>  
159 -<feed xmlns="http://www.w3.org/2005/Atom" xmlns:app="http://www.w3.org/2007/app" xmlns:cmis="http://www.cmis.org/2008/05" xmlns:alf="http://www.alfresco.org" xmlns:opensearch="http://a9.com/-/spec/opensearch/1.1/">  
160 -<author><name>System</name></author>  
161 -<generator version="3.0.0 (Stable 1526)">Alfresco (Labs)</generator>  
162 -<icon>http://10.33.4.34:8080/alfresco/images/logo/AlfrescoLogo16.ico</icon>  
163 -<id>urn:uuid:28537649-8af2-4c74-aa92-5d8bbecac9ce-children</id>  
164 -<link rel="self" href="http://10.33.4.34:8080/alfresco/service/api/path/workspace/SpacesStore/Company%20Home/children"/>  
165 -<link rel="cmis-source" href="http://10.33.4.34:8080/alfresco/service/api/node/workspace/SpacesStore/28537649-8af2-4c74-aa92-5d8bbecac9ce"/>  
166 -<link rel="first" href="http://10.33.4.34:8080/alfresco/service/api/path/workspace/SpacesStore/Company%20Home/children?pageNo=1&amp;pageSize=0&amp;guest=&amp;format=atomfeed" type="application/atom+xml;type=feed"/>  
167 -  
168 -<link rel="last" href="http://10.33.4.34:8080/alfresco/service/api/path/workspace/SpacesStore/Company%20Home/children?pageNo=1&amp;pageSize=0&amp;guest=&amp;format=atomfeed" type="application/atom+xml;type=feed"/>  
169 -<title>Company Home Children</title>  
170 -<updated>2009-06-18T10:20:29.937+02:00</updated>  
171 -<entry>  
172 -<author><name>System</name></author>  
173 -<content>e98319fa-76e4-478f-8ce8-a3a0fd683e2c</content>  
174 -<id>urn:uuid:e98319fa-76e4-478f-8ce8-a3a0fd683e2c</id>  
175 -  
176 -<link rel="self" href="http://10.33.4.34:8080/alfresco/service/api/node/workspace/SpacesStore/e98319fa-76e4-478f-8ce8-a3a0fd683e2c"/>  
177 -<link rel="edit" href="http://10.33.4.34:8080/alfresco/service/api/node/workspace/SpacesStore/e98319fa-76e4-478f-8ce8-a3a0fd683e2c"/>  
178 -<link rel="cmis-allowableactions" href="http://10.33.4.34:8080/alfresco/service/api/node/workspace/SpacesStore/e98319fa-76e4-478f-8ce8-a3a0fd683e2c/permissions"/>  
179 -<link rel="cmis-relationships" href="http://10.33.4.34:8080/alfresco/service/api/node/workspace/SpacesStore/e98319fa-76e4-478f-8ce8-a3a0fd683e2c/associations"/>  
180 -<link rel="cmis-parent" href="http://10.33.4.34:8080/alfresco/service/api/node/workspace/SpacesStore/28537649-8af2-4c74-aa92-5d8bbecac9ce"/>  
181 -<link rel="cmis-folderparent" href="http://10.33.4.34:8080/alfresco/service/api/node/workspace/SpacesStore/e98319fa-76e4-478f-8ce8-a3a0fd683e2c/parent"/>  
182 -<link rel="cmis-children" href="http://10.33.4.34:8080/alfresco/service/api/node/workspace/SpacesStore/e98319fa-76e4-478f-8ce8-a3a0fd683e2c/children"/>  
183 -<link rel="cmis-descendants" href="http://10.33.4.34:8080/alfresco/service/api/node/workspace/SpacesStore/e98319fa-76e4-478f-8ce8-a3a0fd683e2c/descendants"/>  
184 -<link rel="cmis-type" href="http://10.33.4.34:8080/alfresco/service/api/type/F/st_sites"/>  
185 -<link rel="cmis-repository" href="http://10.33.4.34:8080/alfresco/service/api/repository"/>  
186 -<published>2009-06-18T10:20:37.788+02:00</published>  
187 -<summary>Site Collaboration Spaces</summary>  
188 -<title>Sites</title>  
189 -<updated>2009-06-18T10:20:37.874+02:00</updated>  
190 -  
191 -<cmis:object>  
192 -<cmis:properties>  
193 -<cmis:propertyId cmis:name="ObjectId"><cmis:value>workspace://SpacesStore/e98319fa-76e4-478f-8ce8-a3a0fd683e2c</cmis:value></cmis:propertyId>  
194 -<cmis:propertyString cmis:name="BaseType"><cmis:value>folder</cmis:value></cmis:propertyString>  
195 -<cmis:propertyString cmis:name="ObjectTypeId"><cmis:value>F/st_sites</cmis:value></cmis:propertyString>  
196 -<cmis:propertyString cmis:name="CreatedBy"><cmis:value>System</cmis:value></cmis:propertyString>  
197 -  
198 -<cmis:propertyDateTime cmis:name="CreationDate"><cmis:value>2009-06-18T10:20:37.788+02:00</cmis:value></cmis:propertyDateTime>  
199 -<cmis:propertyString cmis:name="LastModifiedBy"><cmis:value>System</cmis:value></cmis:propertyString>  
200 -<cmis:propertyDateTime cmis:name="LastModificationDate"><cmis:value>2009-06-18T10:20:37.874+02:00</cmis:value></cmis:propertyDateTime>  
201 -<cmis:propertyString cmis:name="Name"><cmis:value>Sites</cmis:value></cmis:propertyString>  
202 -<cmis:propertyId cmis:name="ParentId"><cmis:value>workspace://SpacesStore/28537649-8af2-4c74-aa92-5d8bbecac9ce</cmis:value></cmis:propertyId>  
203 -  
204 -</cmis:properties>  
205 -</cmis:object>  
206 -<cmis:terminator/>  
207 -<app:edited>2009-06-18T10:20:37.874+02:00</app:edited>  
208 -<alf:icon>http://10.33.4.34:8080/alfresco/images/icons/space-icon-default-16.gif</alf:icon>  
209 -</entry>  
210 -<entry>  
211 -<author><name>System</name></author>  
212 -<content>8c80a0f7-74b4-4bd8-bb76-a2464e4b2d10</content>  
213 -<id>urn:uuid:8c80a0f7-74b4-4bd8-bb76-a2464e4b2d10</id>  
214 -  
215 -<link rel="self" href="http://10.33.4.34:8080/alfresco/service/api/node/workspace/SpacesStore/8c80a0f7-74b4-4bd8-bb76-a2464e4b2d10"/>  
216 -<link rel="edit" href="http://10.33.4.34:8080/alfresco/service/api/node/workspace/SpacesStore/8c80a0f7-74b4-4bd8-bb76-a2464e4b2d10"/>  
217 -<link rel="cmis-allowableactions" href="http://10.33.4.34:8080/alfresco/service/api/node/workspace/SpacesStore/8c80a0f7-74b4-4bd8-bb76-a2464e4b2d10/permissions"/>  
218 -<link rel="cmis-relationships" href="http://10.33.4.34:8080/alfresco/service/api/node/workspace/SpacesStore/8c80a0f7-74b4-4bd8-bb76-a2464e4b2d10/associations"/>  
219 -<link rel="cmis-parent" href="http://10.33.4.34:8080/alfresco/service/api/node/workspace/SpacesStore/28537649-8af2-4c74-aa92-5d8bbecac9ce"/>  
220 -<link rel="cmis-folderparent" href="http://10.33.4.34:8080/alfresco/service/api/node/workspace/SpacesStore/8c80a0f7-74b4-4bd8-bb76-a2464e4b2d10/parent"/>  
221 -<link rel="cmis-children" href="http://10.33.4.34:8080/alfresco/service/api/node/workspace/SpacesStore/8c80a0f7-74b4-4bd8-bb76-a2464e4b2d10/children"/>  
222 -<link rel="cmis-descendants" href="http://10.33.4.34:8080/alfresco/service/api/node/workspace/SpacesStore/8c80a0f7-74b4-4bd8-bb76-a2464e4b2d10/descendants"/>  
223 -<link rel="cmis-type" href="http://10.33.4.34:8080/alfresco/service/api/type/folder"/>  
224 -<link rel="cmis-repository" href="http://10.33.4.34:8080/alfresco/service/api/repository"/>  
225 -<published>2009-06-18T10:20:29.939+02:00</published>  
226 -<summary>User managed definitions</summary>  
227 -<title>Data Dictionary</title>  
228 -<updated>2009-06-18T10:20:30.004+02:00</updated>  
229 -  
230 -<cmis:object>  
231 -<cmis:properties>  
232 -<cmis:propertyId cmis:name="ObjectId"><cmis:value>workspace://SpacesStore/8c80a0f7-74b4-4bd8-bb76-a2464e4b2d10</cmis:value></cmis:propertyId>  
233 -<cmis:propertyString cmis:name="BaseType"><cmis:value>folder</cmis:value></cmis:propertyString>  
234 -<cmis:propertyString cmis:name="ObjectTypeId"><cmis:value>folder</cmis:value></cmis:propertyString>  
235 -<cmis:propertyString cmis:name="CreatedBy"><cmis:value>System</cmis:value></cmis:propertyString>  
236 -  
237 -<cmis:propertyDateTime cmis:name="CreationDate"><cmis:value>2009-06-18T10:20:29.939+02:00</cmis:value></cmis:propertyDateTime>  
238 -<cmis:propertyString cmis:name="LastModifiedBy"><cmis:value>System</cmis:value></cmis:propertyString>  
239 -<cmis:propertyDateTime cmis:name="LastModificationDate"><cmis:value>2009-06-18T10:20:30.004+02:00</cmis:value></cmis:propertyDateTime>  
240 -<cmis:propertyString cmis:name="Name"><cmis:value>Data Dictionary</cmis:value></cmis:propertyString>  
241 -<cmis:propertyId cmis:name="ParentId"><cmis:value>workspace://SpacesStore/28537649-8af2-4c74-aa92-5d8bbecac9ce</cmis:value></cmis:propertyId>  
242 -  
243 -</cmis:properties>  
244 -</cmis:object>  
245 -<cmis:terminator/>  
246 -<app:edited>2009-06-18T10:20:30.004+02:00</app:edited>  
247 -<alf:icon>http://10.33.4.34:8080/alfresco/images/icons/space-icon-default-16.gif</alf:icon>  
248 -</entry>  
249 -<entry>  
250 -<author><name>System</name></author>  
251 -<content>ba2524ef-7f3d-4ed4-84a0-8d99b6524737</content>  
252 -<id>urn:uuid:ba2524ef-7f3d-4ed4-84a0-8d99b6524737</id>  
253 -  
254 -<link rel="self" href="http://10.33.4.34:8080/alfresco/service/api/node/workspace/SpacesStore/ba2524ef-7f3d-4ed4-84a0-8d99b6524737"/>  
255 -<link rel="edit" href="http://10.33.4.34:8080/alfresco/service/api/node/workspace/SpacesStore/ba2524ef-7f3d-4ed4-84a0-8d99b6524737"/>  
256 -<link rel="cmis-allowableactions" href="http://10.33.4.34:8080/alfresco/service/api/node/workspace/SpacesStore/ba2524ef-7f3d-4ed4-84a0-8d99b6524737/permissions"/>  
257 -<link rel="cmis-relationships" href="http://10.33.4.34:8080/alfresco/service/api/node/workspace/SpacesStore/ba2524ef-7f3d-4ed4-84a0-8d99b6524737/associations"/>  
258 -<link rel="cmis-parent" href="http://10.33.4.34:8080/alfresco/service/api/node/workspace/SpacesStore/28537649-8af2-4c74-aa92-5d8bbecac9ce"/>  
259 -<link rel="cmis-folderparent" href="http://10.33.4.34:8080/alfresco/service/api/node/workspace/SpacesStore/ba2524ef-7f3d-4ed4-84a0-8d99b6524737/parent"/>  
260 -<link rel="cmis-children" href="http://10.33.4.34:8080/alfresco/service/api/node/workspace/SpacesStore/ba2524ef-7f3d-4ed4-84a0-8d99b6524737/children"/>  
261 -<link rel="cmis-descendants" href="http://10.33.4.34:8080/alfresco/service/api/node/workspace/SpacesStore/ba2524ef-7f3d-4ed4-84a0-8d99b6524737/descendants"/>  
262 -<link rel="cmis-type" href="http://10.33.4.34:8080/alfresco/service/api/type/folder"/>  
263 -<link rel="cmis-repository" href="http://10.33.4.34:8080/alfresco/service/api/repository"/>  
264 -<published>2009-06-18T10:20:30.312+02:00</published>  
265 -<summary>The guest root space</summary>  
266 -<title>Guest Home</title>  
267 -  
268 -<updated>2009-06-18T10:20:30.400+02:00</updated>  
269 -<cmis:object>  
270 -<cmis:properties>  
271 -<cmis:propertyId cmis:name="ObjectId"><cmis:value>workspace://SpacesStore/ba2524ef-7f3d-4ed4-84a0-8d99b6524737</cmis:value></cmis:propertyId>  
272 -<cmis:propertyString cmis:name="BaseType"><cmis:value>folder</cmis:value></cmis:propertyString>  
273 -<cmis:propertyString cmis:name="ObjectTypeId"><cmis:value>folder</cmis:value></cmis:propertyString>  
274 -<cmis:propertyString cmis:name="CreatedBy"><cmis:value>System</cmis:value></cmis:propertyString>  
275 -  
276 -<cmis:propertyDateTime cmis:name="CreationDate"><cmis:value>2009-06-18T10:20:30.312+02:00</cmis:value></cmis:propertyDateTime>  
277 -<cmis:propertyString cmis:name="LastModifiedBy"><cmis:value>System</cmis:value></cmis:propertyString>  
278 -<cmis:propertyDateTime cmis:name="LastModificationDate"><cmis:value>2009-06-18T10:20:30.400+02:00</cmis:value></cmis:propertyDateTime>  
279 -<cmis:propertyString cmis:name="Name"><cmis:value>Guest Home</cmis:value></cmis:propertyString>  
280 -<cmis:propertyId cmis:name="ParentId"><cmis:value>workspace://SpacesStore/28537649-8af2-4c74-aa92-5d8bbecac9ce</cmis:value></cmis:propertyId>  
281 -  
282 -</cmis:properties>  
283 -</cmis:object>  
284 -<cmis:terminator/>  
285 -<app:edited>2009-06-18T10:20:30.400+02:00</app:edited>  
286 -<alf:icon>http://10.33.4.34:8080/alfresco/images/icons/space-icon-default-16.gif</alf:icon>  
287 -</entry>  
288 -<entry>  
289 -<author><name>System</name></author>  
290 -<content>86224486-b7ae-4074-a793-82cd259b0026</content>  
291 -<id>urn:uuid:86224486-b7ae-4074-a793-82cd259b0026</id>  
292 -  
293 -<link rel="self" href="http://10.33.4.34:8080/alfresco/service/api/node/workspace/SpacesStore/86224486-b7ae-4074-a793-82cd259b0026"/>  
294 -<link rel="edit" href="http://10.33.4.34:8080/alfresco/service/api/node/workspace/SpacesStore/86224486-b7ae-4074-a793-82cd259b0026"/>  
295 -<link rel="cmis-allowableactions" href="http://10.33.4.34:8080/alfresco/service/api/node/workspace/SpacesStore/86224486-b7ae-4074-a793-82cd259b0026/permissions"/>  
296 -<link rel="cmis-relationships" href="http://10.33.4.34:8080/alfresco/service/api/node/workspace/SpacesStore/86224486-b7ae-4074-a793-82cd259b0026/associations"/>  
297 -<link rel="cmis-parent" href="http://10.33.4.34:8080/alfresco/service/api/node/workspace/SpacesStore/28537649-8af2-4c74-aa92-5d8bbecac9ce"/>  
298 -<link rel="cmis-folderparent" href="http://10.33.4.34:8080/alfresco/service/api/node/workspace/SpacesStore/86224486-b7ae-4074-a793-82cd259b0026/parent"/>  
299 -<link rel="cmis-children" href="http://10.33.4.34:8080/alfresco/service/api/node/workspace/SpacesStore/86224486-b7ae-4074-a793-82cd259b0026/children"/>  
300 -<link rel="cmis-descendants" href="http://10.33.4.34:8080/alfresco/service/api/node/workspace/SpacesStore/86224486-b7ae-4074-a793-82cd259b0026/descendants"/>  
301 -<link rel="cmis-type" href="http://10.33.4.34:8080/alfresco/service/api/type/folder"/>  
302 -<link rel="cmis-repository" href="http://10.33.4.34:8080/alfresco/service/api/repository"/>  
303 -<published>2009-06-18T10:20:30.402+02:00</published>  
304 -<summary>User Homes</summary>  
305 -<title>User Homes</title>  
306 -<updated>2009-06-18T10:20:30.428+02:00</updated>  
307 -  
308 -<cmis:object>  
309 -<cmis:properties>  
310 -<cmis:propertyId cmis:name="ObjectId"><cmis:value>workspace://SpacesStore/86224486-b7ae-4074-a793-82cd259b0026</cmis:value></cmis:propertyId>  
311 -<cmis:propertyString cmis:name="BaseType"><cmis:value>folder</cmis:value></cmis:propertyString>  
312 -<cmis:propertyString cmis:name="ObjectTypeId"><cmis:value>folder</cmis:value></cmis:propertyString>  
313 -<cmis:propertyString cmis:name="CreatedBy"><cmis:value>System</cmis:value></cmis:propertyString>  
314 -  
315 -<cmis:propertyDateTime cmis:name="CreationDate"><cmis:value>2009-06-18T10:20:30.402+02:00</cmis:value></cmis:propertyDateTime>  
316 -<cmis:propertyString cmis:name="LastModifiedBy"><cmis:value>System</cmis:value></cmis:propertyString>  
317 -<cmis:propertyDateTime cmis:name="LastModificationDate"><cmis:value>2009-06-18T10:20:30.428+02:00</cmis:value></cmis:propertyDateTime>  
318 -<cmis:propertyString cmis:name="Name"><cmis:value>User Homes</cmis:value></cmis:propertyString>  
319 -<cmis:propertyId cmis:name="ParentId"><cmis:value>workspace://SpacesStore/28537649-8af2-4c74-aa92-5d8bbecac9ce</cmis:value></cmis:propertyId>  
320 -  
321 -</cmis:properties>  
322 -</cmis:object>  
323 -<cmis:terminator/>  
324 -<app:edited>2009-06-18T10:20:30.428+02:00</app:edited>  
325 -<alf:icon>http://10.33.4.34:8080/alfresco/images/icons/space-icon-default-16.gif</alf:icon>  
326 -</entry>  
327 -<entry>  
328 -<author><name>System</name></author>  
329 -<content>0df9087f-e334-4890-a467-b60e3d6be92c</content>  
330 -<id>urn:uuid:0df9087f-e334-4890-a467-b60e3d6be92c</id>  
331 -  
332 -<link rel="self" href="http://10.33.4.34:8080/alfresco/service/api/node/workspace/SpacesStore/0df9087f-e334-4890-a467-b60e3d6be92c"/>  
333 -<link rel="edit" href="http://10.33.4.34:8080/alfresco/service/api/node/workspace/SpacesStore/0df9087f-e334-4890-a467-b60e3d6be92c"/>  
334 -<link rel="cmis-allowableactions" href="http://10.33.4.34:8080/alfresco/service/api/node/workspace/SpacesStore/0df9087f-e334-4890-a467-b60e3d6be92c/permissions"/>  
335 -<link rel="cmis-relationships" href="http://10.33.4.34:8080/alfresco/service/api/node/workspace/SpacesStore/0df9087f-e334-4890-a467-b60e3d6be92c/associations"/>  
336 -<link rel="cmis-parent" href="http://10.33.4.34:8080/alfresco/service/api/node/workspace/SpacesStore/28537649-8af2-4c74-aa92-5d8bbecac9ce"/>  
337 -<link rel="cmis-folderparent" href="http://10.33.4.34:8080/alfresco/service/api/node/workspace/SpacesStore/0df9087f-e334-4890-a467-b60e3d6be92c/parent"/>  
338 -<link rel="cmis-children" href="http://10.33.4.34:8080/alfresco/service/api/node/workspace/SpacesStore/0df9087f-e334-4890-a467-b60e3d6be92c/children"/>  
339 -<link rel="cmis-descendants" href="http://10.33.4.34:8080/alfresco/service/api/node/workspace/SpacesStore/0df9087f-e334-4890-a467-b60e3d6be92c/descendants"/>  
340 -<link rel="cmis-type" href="http://10.33.4.34:8080/alfresco/service/api/type/folder"/>  
341 -<link rel="cmis-repository" href="http://10.33.4.34:8080/alfresco/service/api/repository"/>  
342 -<published>2009-06-18T10:20:45.115+02:00</published>  
343 -<summary>Web Content Management Spaces</summary>  
344 -<title>Web Projects</title>  
345 -<updated>2009-06-18T10:20:45.137+02:00</updated>  
346 -  
347 -<cmis:object>  
348 -<cmis:properties>  
349 -<cmis:propertyId cmis:name="ObjectId"><cmis:value>workspace://SpacesStore/0df9087f-e334-4890-a467-b60e3d6be92c</cmis:value></cmis:propertyId>  
350 -<cmis:propertyString cmis:name="BaseType"><cmis:value>folder</cmis:value></cmis:propertyString>  
351 -<cmis:propertyString cmis:name="ObjectTypeId"><cmis:value>folder</cmis:value></cmis:propertyString>  
352 -<cmis:propertyString cmis:name="CreatedBy"><cmis:value>System</cmis:value></cmis:propertyString>  
353 -  
354 -<cmis:propertyDateTime cmis:name="CreationDate"><cmis:value>2009-06-18T10:20:45.115+02:00</cmis:value></cmis:propertyDateTime>  
355 -<cmis:propertyString cmis:name="LastModifiedBy"><cmis:value>System</cmis:value></cmis:propertyString>  
356 -<cmis:propertyDateTime cmis:name="LastModificationDate"><cmis:value>2009-06-18T10:20:45.137+02:00</cmis:value></cmis:propertyDateTime>  
357 -<cmis:propertyString cmis:name="Name"><cmis:value>Web Projects</cmis:value></cmis:propertyString>  
358 -<cmis:propertyId cmis:name="ParentId"><cmis:value>workspace://SpacesStore/28537649-8af2-4c74-aa92-5d8bbecac9ce</cmis:value></cmis:propertyId>  
359 -  
360 -</cmis:properties>  
361 -</cmis:object>  
362 -<cmis:terminator/>  
363 -<app:edited>2009-06-18T10:20:45.137+02:00</app:edited>  
364 -<alf:icon>http://10.33.4.34:8080/alfresco/images/icons/space-icon-default-16.gif</alf:icon>  
365 -</entry>  
366 -<entry>  
367 -<author><name>admin</name></author>  
368 -<content type="application/pdf" src="http://10.33.4.34:8080/alfresco/service/api/node/workspace/SpacesStore/2df9d676-f173-47bb-8ec1-41fa1186b66d/content.h4555-cmis-so.pdf"/><id>urn:uuid:2df9d676-f173-47bb-8ec1-41fa1186b66d</id>  
369 -<link rel="self" href="http://10.33.4.34:8080/alfresco/service/api/node/workspace/SpacesStore/2df9d676-f173-47bb-8ec1-41fa1186b66d"/>  
370 -  
371 -<link rel="enclosure" type="application/pdf" href="http://10.33.4.34:8080/alfresco/service/api/node/workspace/SpacesStore/2df9d676-f173-47bb-8ec1-41fa1186b66d/content.h4555-cmis-so.pdf"/><link rel="edit" href="http://10.33.4.34:8080/alfresco/service/api/node/workspace/SpacesStore/2df9d676-f173-47bb-8ec1-41fa1186b66d"/>  
372 -<link rel="edit-media" type="application/pdf" href="http://10.33.4.34:8080/alfresco/service/api/node/workspace/SpacesStore/2df9d676-f173-47bb-8ec1-41fa1186b66d/content.h4555-cmis-so.pdf"/><link rel="cmis-allowableactions" href="http://10.33.4.34:8080/alfresco/service/api/node/workspace/SpacesStore/2df9d676-f173-47bb-8ec1-41fa1186b66d/permissions"/>  
373 -<link rel="cmis-relationships" href="http://10.33.4.34:8080/alfresco/service/api/node/workspace/SpacesStore/2df9d676-f173-47bb-8ec1-41fa1186b66d/associations"/>  
374 -<link rel="cmis-parents" href="http://10.33.4.34:8080/alfresco/service/api/node/workspace/SpacesStore/2df9d676-f173-47bb-8ec1-41fa1186b66d/parents"/>  
375 -<link rel="cmis-allversions" href="http://10.33.4.34:8080/alfresco/service/api/node/workspace/SpacesStore/2df9d676-f173-47bb-8ec1-41fa1186b66d/versions"/>  
376 -<link rel="cmis-stream" type="application/pdf" href="http://10.33.4.34:8080/alfresco/service/api/node/workspace/SpacesStore/2df9d676-f173-47bb-8ec1-41fa1186b66d/content.h4555-cmis-so.pdf"/><link rel="cmis-type" href="http://10.33.4.34:8080/alfresco/service/api/type/document"/>  
377 -<link rel="cmis-repository" href="http://10.33.4.34:8080/alfresco/service/api/repository"/>  
378 -<published>2009-06-23T09:40:47.889+02:00</published>  
379 -<summary></summary>  
380 -<title>h4555-cmis-so.pdf</title>  
381 -<updated>2009-06-23T09:40:58.524+02:00</updated>  
382 -  
383 -<cmis:object>  
384 -<cmis:properties>  
385 -<cmis:propertyId cmis:name="ObjectId"><cmis:value>workspace://SpacesStore/2df9d676-f173-47bb-8ec1-41fa1186b66d</cmis:value></cmis:propertyId>  
386 -<cmis:propertyString cmis:name="BaseType"><cmis:value>document</cmis:value></cmis:propertyString>  
387 -<cmis:propertyString cmis:name="ObjectTypeId"><cmis:value>document</cmis:value></cmis:propertyString>  
388 -<cmis:propertyString cmis:name="CreatedBy"><cmis:value>admin</cmis:value></cmis:propertyString>  
389 -  
390 -<cmis:propertyDateTime cmis:name="CreationDate"><cmis:value>2009-06-23T09:40:47.889+02:00</cmis:value></cmis:propertyDateTime>  
391 -<cmis:propertyString cmis:name="LastModifiedBy"><cmis:value>admin</cmis:value></cmis:propertyString>  
392 -<cmis:propertyDateTime cmis:name="LastModificationDate"><cmis:value>2009-06-23T09:40:58.524+02:00</cmis:value></cmis:propertyDateTime>  
393 -<cmis:propertyString cmis:name="Name"><cmis:value>h4555-cmis-so.pdf</cmis:value></cmis:propertyString>  
394 -<cmis:propertyBoolean cmis:name="IsImmutable"><cmis:value>false</cmis:value></cmis:propertyBoolean>  
395 -  
396 -<cmis:propertyBoolean cmis:name="IsLatestVersion"><cmis:value>true</cmis:value></cmis:propertyBoolean>  
397 -<cmis:propertyBoolean cmis:name="IsMajorVersion"><cmis:value>false</cmis:value></cmis:propertyBoolean>  
398 -<cmis:propertyBoolean cmis:name="IsLatestMajorVersion"><cmis:value>false</cmis:value></cmis:propertyBoolean>  
399 -<cmis:propertyString cmis:name="VersionLabel"/>  
400 -<cmis:propertyId cmis:name="VersionSeriesId"><cmis:value>workspace://SpacesStore/2df9d676-f173-47bb-8ec1-41fa1186b66d</cmis:value></cmis:propertyId>  
401 -  
402 -<cmis:propertyBoolean cmis:name="IsVersionSeriesCheckedOut"><cmis:value>false</cmis:value></cmis:propertyBoolean>  
403 -<cmis:propertyString cmis:name="VersionSeriesCheckedOutBy"/>  
404 -<cmis:propertyId cmis:name="VersionSeriesCheckedOutId"/>  
405 -<cmis:propertyString cmis:name="CheckinComment"/>  
406 -<cmis:propertyInteger cmis:name="ContentStreamLength"><cmis:value>343084</cmis:value></cmis:propertyInteger>  
407 -<cmis:propertyString cmis:name="ContentStreamMimeType"><cmis:value>application/pdf</cmis:value></cmis:propertyString>  
408 -<cmis:propertyString cmis:name="ContentStreamFilename"><cmis:value>h4555-cmis-so.pdf</cmis:value></cmis:propertyString>  
409 -  
410 -<cmis:propertyString cmis:name="ContentStreamURI"><cmis:value>http://10.33.4.34:8080/alfresco/service/api/node/workspace/SpacesStore/2df9d676-f173-47bb-8ec1-41fa1186b66d/content.h4555-cmis-so.pdf</cmis:value></cmis:propertyString>  
411 -</cmis:properties>  
412 -</cmis:object>  
413 -<cmis:terminator/>  
414 -<app:edited>2009-06-23T09:40:58.524+02:00</app:edited>  
415 -<alf:icon>http://10.33.4.34:8080/alfresco/images/filetypes/pdf.gif</alf:icon>  
416 -</entry>  
417 -<cmis:hasMoreItems>false</cmis:hasMoreItems>  
418 -<opensearch:totalResults>6</opensearch:totalResults>  
419 -<opensearch:startIndex>0</opensearch:startIndex>  
420 -  
421 -<opensearch:itemsPerPage>0</opensearch:itemsPerPage>  
422 -</feed>';  
423 -  
424 - return $output;  
425 - }  
426 -  
427 - /**  
428 - * Retrieves data about a specific folder  
429 - *  
430 - * @param object $ObjectService The CMIS service  
431 - * @param string $repositoryId  
432 - * @param string $folderId  
433 - * @return string CMIS AtomPub feed  
434 - */  
435 - static public function getFolderFeed($ObjectService, $repositoryId, $folderId)  
436 - {  
437 - $cmisEntry = $ObjectService->getProperties($repositoryId, $folderId, false, false);  
438 -  
439 - $feed = new KTCMISAPPFeed(KT_APP_BASE_URI, $cmisEntry['properties']['ObjectTypeId']['value'], null, null, null,  
440 - 'urn:uuid:' . $cmisEntry['properties']['ObjectId']['value']);  
441 -  
442 - CMISFolderFeed::createEntry($feed, $cmisEntry, $cmisEntry['properties']['ParentId']['value']);  
443 -  
444 - // <cmis:hasMoreItems>false</cmis:hasMoreItems>  
445 -  
446 - $output = $feed->getAPPdoc();  
447 -  
448 - $outputs = '<?xml version="1.0" encoding="UTF-8"?>  
449 -<feed xmlns="http://www.w3.org/2005/Atom" xmlns:cmis="http://www.cmis.org/2008/05">  
450 -<entry>  
451 -<author><name>System</name></author>  
452 -<content>28537649-8af2-4c74-aa92-5d8bbecac9ce</content>  
453 -<id>urn:uuid:28537649-8af2-4c74-aa92-5d8bbecac9ce</id>  
454 -<link rel="self" href="http://127.0.0.1:8080/alfresco/service/api/node/workspace/SpacesStore/28537649-8af2-4c74-aa92-5d8bbecac9ce"/>  
455 -<link rel="edit" href="http://127.0.0.1:8080/alfresco/service/api/node/workspace/SpacesStore/28537649-8af2-4c74-aa92-5d8bbecac9ce"/>  
456 -<link rel="cmis-allowableactions" href="http://127.0.0.1:8080/alfresco/service/api/node/workspace/SpacesStore/28537649-8af2-4c74-aa92-5d8bbecac9ce/permissions"/>  
457 -<link rel="cmis-relationships" href="http://127.0.0.1:8080/alfresco/service/api/node/workspace/SpacesStore/28537649-8af2-4c74-aa92-5d8bbecac9ce/associations"/>  
458 -<link rel="cmis-children" href="http://127.0.0.1:8080/alfresco/service/api/node/workspace/SpacesStore/28537649-8af2-4c74-aa92-5d8bbecac9ce/children"/>  
459 -<link rel="cmis-descendants" href="http://127.0.0.1:8080/alfresco/service/api/node/workspace/SpacesStore/28537649-8af2-4c74-aa92-5d8bbecac9ce/descendants"/>  
460 -<link rel="cmis-type" href="http://127.0.0.1:8080/alfresco/service/api/type/folder"/>  
461 -<link rel="cmis-repository" href="http://127.0.0.1:8080/alfresco/service/api/repository"/>  
462 -<published>2009-06-18T10:20:29.871+02:00</published>  
463 -<summary>The company root space</summary>  
464 -<title>Company Home</title>  
465 -<updated>2009-06-18T10:20:29.937+02:00</updated>  
466 -<cmis:object>  
467 -<cmis:properties>  
468 -<cmis:propertyId cmis:name="ObjectId"><cmis:value>workspace://SpacesStore/28537649-8af2-4c74-aa92-5d8bbecac9ce</cmis:value></cmis:propertyId>  
469 -<cmis:propertyString cmis:name="BaseType"><cmis:value>folder</cmis:value></cmis:propertyString>  
470 -<cmis:propertyString cmis:name="ObjectTypeId"><cmis:value>folder</cmis:value></cmis:propertyString>  
471 -<cmis:propertyString cmis:name="CreatedBy"><cmis:value>System</cmis:value></cmis:propertyString>  
472 -<cmis:propertyDateTime cmis:name="CreationDate"><cmis:value>2009-06-18T10:20:29.871+02:00</cmis:value></cmis:propertyDateTime>  
473 -<cmis:propertyString cmis:name="LastModifiedBy"><cmis:value>System</cmis:value></cmis:propertyString>  
474 -<cmis:propertyDateTime cmis:name="LastModificationDate"><cmis:value>2009-06-18T10:20:29.937+02:00</cmis:value></cmis:propertyDateTime>  
475 -<cmis:propertyString cmis:name="Name"><cmis:value>Company Home</cmis:value></cmis:propertyString>  
476 -<cmis:propertyId cmis:name="ParentId"/>  
477 -</cmis:properties>  
478 -</cmis:object>  
479 -<cmis:terminator/>  
480 -<app:edited>2009-06-18T10:20:29.937+02:00</app:edited>  
481 -<alf:icon>http://127.0.0.1:8080/alfresco/images/icons/space-icon-default-16.gif</alf:icon>  
482 -</entry>  
483 -</feed>';  
484 -  
485 - return $output;  
486 - }  
487 -  
488 - static public function getFolderData($query, &$folderName, &$tree)  
489 - {  
490 - $ktapi = new KTAPI();  
491 - $ktapi->start_session('admin', 'admin');  
492 -  
493 - $numQ = count($query);  
494 - $numFolders = $numQ-3;  
495 - $folderId = 1;  
496 -  
497 - if ($query[$numQ-1] == 'children' || $query[$numQ-1] == 'descendants')  
498 - {  
499 - $tree = $query[$numQ-1];  
500 - }  
501 -  
502 - $start = 0;  
503 - while($start < $numFolders-1)  
504 - {  
505 - $folderName = urldecode($query[$numQ-$numFolders+$start]);  
506 - $folder = $ktapi->get_folder_by_name($folderName, $folderId);  
507 - $folderId = $folder->get_folderid();  
508 - ++$start;  
509 - }  
510 -  
511 - return CMISUtil::encodeObjectId('Folder', $folderId);  
512 - }  
513 -}  
514 -  
515 -include 'services/cmis/RepositoryService.inc.php';  
516 -include 'services/cmis/NavigationService.inc.php';  
517 -include 'services/cmis/ObjectService.inc.php';  
518 -  
519 -$RepositoryService = new RepositoryService();  
520 -$repositories = $RepositoryService->getRepositories();  
521 -$repositoryId = $repositories[0]['repositoryId'];  
522 -  
523 -$folderId = CMISFolderFeed::getFolderData($query, $folderName, $tree);  
524 -  
525 -if (isset($tree) && (($tree == 'children') || ($tree == 'descendants')))  
526 -{  
527 - $NavigationService = new NavigationService();  
528 - $NavigationService->startSession($username, $password);  
529 -  
530 - $output = CMISFolderFeed::getFolderChildrenFeed($NavigationService, $repositoryId, $folderId, $folderName, $tree);  
531 -}  
532 -else  
533 -{  
534 - $ObjectService = new ObjectService();  
535 - $ObjectService->startSession($username, $password);  
536 -  
537 - $output = CMISFolderFeed::getFolderFeed($ObjectService, $repositoryId, $folderId);  
538 -}  
539 -  
540 -?>  
ktatompub/services/cmis/index.php deleted
1 -<?php  
2 -  
3 -/**  
4 - * Index page for CMIS AtomPub services  
5 - */  
6 -  
7 -include_once('lib/cmis/KTCMISAPPServiceDoc.inc.php');  
8 -include_once('lib/cmis/KTCMISAPPFeed.inc.php');  
9 -  
10 -define ('CMIS_BASE_URI', trim(KT_APP_BASE_URI, '/') . 'cmis/');  
11 -// hack for links not yet working in KT, use Alfresco installation to move things forward  
12 -//define ('CMIS_BASE_URI_ALF', 'http://127.0.0.1:8080/alfresco/service/api/');  
13 -  
14 -// fetch username and password for auth; note that this apparently only works when PHP is run as an apache module  
15 -// TODO method to fetch username and password when running PHP as CGI, if possible  
16 -// HTTP Basic Auth:  
17 -$username = $_SERVER['PHP_AUTH_USER'];  
18 -$password = $_SERVER['PHP_AUTH_PW'];  
19 -  
20 -// TODO response if failed auth, need generic response which can be used by all code  
21 -  
22 -$arg = (isset($query[1]) ? $query[1] : '');  
23 -  
24 -switch($arg)  
25 -{  
26 - case 'checkedout':  
27 - include('services/cmis/checkedout.inc.php');  
28 - break;  
29 - case 'document':  
30 - include('services/cmis/document.inc.php');  
31 - break;  
32 - case 'folder':  
33 - include('services/cmis/folder.inc.php');  
34 - break;  
35 - case 'type':  
36 - case 'types':  
37 - include('services/cmis/types.inc.php');  
38 - break;  
39 - case 'repository':  
40 - default:  
41 - include('services/cmis/servicedocument.inc.php');  
42 - break;  
43 -}  
44 -  
45 -?>  
ktatompub/services/cmis/servicedocument.inc.php deleted
1 -<?php  
2 -  
3 -/**  
4 - * Creates the CMIS AtomPub service document  
5 - *  
6 - * NOTE Includes the results of a repositoryInfo call as well as service links  
7 - */  
8 -  
9 -// NOTE currently we only support one repository, which will be the first one found in the repositories.xml config  
10 -// TODO multiple repositories as individual workspaces  
11 -  
12 -include 'services/cmis/RepositoryService.inc.php';  
13 -$RepositoryService = new RepositoryService();  
14 -  
15 -// fetch data for response  
16 -$repositories = $RepositoryService->getRepositories();  
17 -// fetch for default first repo; NOTE that this will probably have to change at some point, quick and dirty for now  
18 -$repositoryInfo = $RepositoryService->getRepositoryInfo($repositories[0]['repositoryId']);  
19 -  
20 -// generate service document  
21 -$service = new KTCMISAPPServiceDoc(KT_APP_BASE_URI);  
22 -$ws = $service->newWorkspace($repositoryInfo['repositoryName']);  
23 -$ws->appendChild($service->newAttr('cmis:repositoryRelationship', $repositoryInfo['repositoryRelationship']));  
24 -  
25 -// repository information  
26 -$element = $service->newElement('cmis:repositoryInfo');  
27 -foreach($repositoryInfo as $key => $repoData)  
28 -{  
29 - if ($key == 'rootFolderId')  
30 - {  
31 - $repoData = CMIS_BASE_URI . 'folder/' . $repoData;  
32 - }  
33 -  
34 - if (!is_array($repoData))  
35 - {  
36 - $element->appendChild($service->newElement('cmis:' . $key, $repoData));  
37 - }  
38 - else  
39 - {  
40 - $elementSub = $service->newElement('cmis:' . $key);  
41 - foreach($repoData as $key2 => $data)  
42 - {  
43 - $elementSub->appendChild($service->newElement('cmis:' . $key2, CMISUtil::boolToString($data)));  
44 - }  
45 - $element->appendChild($elementSub);  
46 - }  
47 -}  
48 -$ws->appendChild($element);  
49 -  
50 -// collection links  
51 -$col = $service->newCollection(CMIS_BASE_URI . 'folder/' . $repositoryInfo['rootFolderId'] . '/children',  
52 - 'Root Folder Children Collection', 'root-children', $ws);  
53 -$col = $service->newCollection(CMIS_BASE_URI . 'folder/' . $repositoryInfo['rootFolderId'] . '/descendants',  
54 - 'Root Folder Descendant Collection', 'root-descendants', $ws);  
55 -$col = $service->newCollection(CMIS_BASE_URI . 'checkedout', 'Checked Out Document Collection', 'checkedout', $ws);  
56 -$col = $service->newCollection(CMIS_BASE_URI . 'types', 'Object Type Collection', 'types-children', $ws);  
57 -$col = $service->newCollection(CMIS_BASE_URI . 'types', 'Object Type Collection', 'types-descendants', $ws);  
58 -  
59 -$output = $service->getAPPdoc();  
60 -  
61 -?>  
62 \ No newline at end of file 0 \ No newline at end of file
ktatompub/services/cmis/types.inc.php deleted
1 -<?php  
2 -  
3 -/**  
4 - * Type access functions for CMIS AtomPub  
5 - */  
6 -  
7 -include 'services/cmis/RepositoryService.inc.php';  
8 -  
9 -$RepositoryService = new RepositoryService();  
10 -// technically do not need to log in to access this information  
11 -// TODO consider requiring authentication even to access basic repository information  
12 -$RepositoryService->startSession($username, $password);  
13 -  
14 -// fetch repository id  
15 -$repositories = $RepositoryService->getRepositories();  
16 -$repositoryId = $repositories[0]['repositoryId'];  
17 -  
18 -switch($arg)  
19 -{  
20 - case 'type':  
21 - {  
22 - if (!isset($query[3]))  
23 - {  
24 - $type = ucwords($query[2]);  
25 - $types = $RepositoryService->getTypes($repositoryId, $type);  
26 - $output = CMISTypeFeed::getTypeFeed($type, $types);  
27 - }  
28 - else  
29 - {  
30 - // TODO dynamic dates, as needed everywhere  
31 - // NOTE children of types not yet implemented and we don't support any non-basic types at this time  
32 - $output = CMISTypeFeed::getTypeChildrenFeed($query[2]);  
33 - }  
34 - }  
35 - break;  
36 - case 'types':  
37 - $types = $RepositoryService->getTypes($repositoryId);  
38 - $type = (($query[2] == '') ? 'all' : $query[2]);  
39 - $output = CMISTypeFeed::getTypeFeed($type, $types);  
40 - break;  
41 -}  
42 -  
43 -/**  
44 - * Class to generate CMIS AtomPub feeds for Type responses  
45 - */  
46 -  
47 -class CMISTypeFeed {  
48 -  
49 - /**  
50 - * Retrieves the list of types as a CMIS AtomPub feed  
51 - *  
52 - * @param string $typeDef Type requested - 'All Types' indicates a listing, else only a specific type  
53 - * @param array $types The types found  
54 - * @return string CMIS AtomPub feed  
55 - */  
56 - static public function getTypeFeed($typeDef, $types)  
57 - {  
58 - $typesString = '';  
59 - $typesHeading = '';  
60 - switch($typeDef)  
61 - {  
62 - case 'all':  
63 - case 'children':  
64 - case 'descendants':  
65 - $typesString = 'types-' . $typeDef;  
66 - $typesHeading = 'All Types';  
67 - break;  
68 - default:  
69 - $typesString = 'type-' . $typeDef;  
70 - $typesHeading = $typeDef;  
71 - break;  
72 - }  
73 -  
74 - $feed = new KTCMISAPPFeed(KT_APP_BASE_URI, $typesHeading, null, null, null, 'urn:uuid:' . $typesString);  
75 -  
76 - foreach($types as $type)  
77 - {  
78 - $entry = $feed->newEntry();  
79 - $feed->newId('urn:uuid:type-' . strtolower($type['typeId']), $entry);  
80 -  
81 - // links  
82 - $link = $feed->newElement('link');  
83 - $link->appendChild($feed->newAttr('rel','self'));  
84 - $link->appendChild($feed->newAttr('href', CMIS_BASE_URI . 'type/' . strtolower($type['typeId'])));  
85 - $entry->appendChild($link);  
86 - $link = $feed->newElement('link');  
87 - $link->appendChild($feed->newAttr('rel','cmis-type'));  
88 - $link->appendChild($feed->newAttr('href', CMIS_BASE_URI . 'type/' . strtolower($type['typeId'])));  
89 - $entry->appendChild($link);  
90 - $link = $feed->newElement('link');  
91 - $link->appendChild($feed->newAttr('rel','cmis-children'));  
92 - $link->appendChild($feed->newAttr('href', CMIS_BASE_URI . 'type/' . strtolower($type['typeId']) . '/children'));  
93 - $entry->appendChild($link);  
94 - $link = $feed->newElement('link');  
95 - $link->appendChild($feed->newAttr('rel','cmis-descendants'));  
96 - $link->appendChild($feed->newAttr('href', CMIS_BASE_URI . 'type/' . strtolower($type['typeId']) . '/descendants'));  
97 - $entry->appendChild($link);  
98 - $link = $feed->newElement('link');  
99 - $link->appendChild($feed->newAttr('rel','cmis-repository'));  
100 - $link->appendChild($feed->newAttr('href', CMIS_BASE_URI . 'repository'));  
101 - $entry->appendChild($link);  
102 -  
103 - $entry->appendChild($feed->newElement('summary', $type['typeId'] . ' Type'));  
104 - $entry->appendChild($feed->newElement('title', $type['typeId']));  
105 -  
106 - // main CMIS entry  
107 - $feedElement = $feed->newElement('cmis:' . strtolower($type['typeId']) . 'Type');  
108 - foreach($type as $property => $value)  
109 - {  
110 - $feed->newField($property, CMISUtil::boolToString($value), $feedElement);  
111 - }  
112 -  
113 - $entry->appendChild($feedElement);  
114 - }  
115 -  
116 - $output = $feed->getAPPdoc();  
117 -  
118 - return $output;  
119 - }  
120 -  
121 - /**  
122 - * Retrieves a list of child types for the supplied type  
123 - *  
124 - * NOTE this currently returns a hard coded empty list, since we do not currently support child types  
125 - * TODO make dynamic if/when we support checking for child types (we don't actually need to support child types themselves)  
126 - *  
127 - * @param string $type  
128 - * @return string CMIS AtomPub feed  
129 - */  
130 - static public function getTypeChildrenFeed($type)  
131 - {  
132 - $output = '<?xml version="1.0" encoding="UTF-8"?>  
133 -<feed xmlns="http://www.w3.org/2005/Atom" xmlns:app="http://www.w3.org/2007/app" xmlns:cmis="http://www.cmis.org/2008/05">  
134 -<id>urn:uuid:type-' . $type . '-children</id>  
135 -<link rel="self" href="' . CMIS_BASE_URI . 'type/document/children"/>  
136 -<link rel="first" href="' . CMIS_BASE_URI . 'type/document/children?pageNo=1&amp;pageSize=0&amp;guest=" type="application/atom+xml;type=feed"/>  
137 -<link rel="last" href="' . CMIS_BASE_URI . 'type/document/children?pageNo=1&amp;pageSize=0&amp;guest=" type="application/atom+xml;type=feed"/>  
138 -<title>Child types of ' . $type . '</title>  
139 -<updated>2009-06-23T13:40:32.786+02:00</updated>  
140 -<cmis:hasMoreItems>false</cmis:hasMoreItems>  
141 -</feed>';  
142 -  
143 - return $output;  
144 - }  
145 -  
146 -}  
147 -  
148 -?>  
149 \ No newline at end of file 0 \ No newline at end of file
ktatompub/services/document.inc.php deleted
1 -<?php  
2 -/**  
3 - * Framework for an Atom Publication Protocol Service  
4 - *  
5 - * KnowledgeTree Community Edition  
6 - * Document Management Made Simple  
7 - * Copyright (C) 2008, 2009 KnowledgeTree Inc.  
8 - * Portions copyright The Jam Warehouse Software (Pty) Limited  
9 - *  
10 - * This program is free software; you can redistribute it and/or modify it under  
11 - * the terms of the GNU General Public License version 3 as published by the  
12 - * Free Software Foundation.  
13 - *  
14 - * This program is distributed in the hope that it will be useful, but WITHOUT  
15 - * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS  
16 - * FOR A PARTICULAR PURPOSE. See the GNU General Public License for more  
17 - * details.  
18 - *  
19 - * You should have received a copy of the GNU General Public License  
20 - * along with this program. If not, see <http://www.gnu.org/licenses/>.  
21 - *  
22 - * You can contact KnowledgeTree Inc., PO Box 7775 #87847, San Francisco,  
23 - * California 94120-7775, or email info@knowledgetree.com.  
24 - *  
25 - * The interactive user interfaces in modified source and object code versions  
26 - * of this program must display Appropriate Legal Notices, as required under  
27 - * Section 5 of the GNU General Public License version 3.  
28 - *  
29 - * In accordance with Section 7(b) of the GNU General Public License version 3,  
30 - * these Appropriate Legal Notices must retain the display of the "Powered by  
31 - * KnowledgeTree" logo and retain the original copyright notice. If the display of the  
32 - * logo is not reasonably feasible for technical reasons, the Appropriate Legal Notices  
33 - * must display the words "Powered by KnowledgeTree" and retain the original  
34 - * copyright notice.  
35 - * Contributor( s):  
36 - * Mark Holtzhausen <mark@knowledgetree.com>  
37 - *  
38 - */  
39 -  
40 - //Create a new response feed  
41 - $feed=new KTAPPFeed(KT_APP_BASE_URI);  
42 -  
43 - //Invoke the KtAPI to get detail about the referenced document  
44 - $docDetail=KTAPPHelper::getDocumentDetail($query[1]);  
45 -  
46 - //Create the atom response feed  
47 - $entry=$feed->newEntry();  
48 - foreach($docDetail['results'] as $property=>$value){  
49 - $feed->newField($property,$value,$entry);  
50 - }  
51 - //Add a downloaduri field manually  
52 - $feed->newField('downloaduri',urlencode(KT_APP_SYSTEM_URI.'/action.php?kt_path_info=ktcore.actions.document.view&fDocumentId='.$docDetail['results']['document_id']),$entry);  
53 -  
54 - //Generate and set the output  
55 - $output=$feed->getAPPdoc();  
56 -?>  
57 \ No newline at end of file 0 \ No newline at end of file
ktatompub/services/fulltree.inc.php deleted
1 -<?php  
2 -/**  
3 - * Framework for an Atom Publication Protocol Service  
4 - *  
5 - * KnowledgeTree Community Edition  
6 - * Document Management Made Simple  
7 - * Copyright (C) 2008, 2009 KnowledgeTree Inc.  
8 - * Portions copyright The Jam Warehouse Software (Pty) Limited  
9 - *  
10 - * This program is free software; you can redistribute it and/or modify it under  
11 - * the terms of the GNU General Public License version 3 as published by the  
12 - * Free Software Foundation.  
13 - *  
14 - * This program is distributed in the hope that it will be useful, but WITHOUT  
15 - * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS  
16 - * FOR A PARTICULAR PURPOSE. See the GNU General Public License for more  
17 - * details.  
18 - *  
19 - * You should have received a copy of the GNU General Public License  
20 - * along with this program. If not, see <http://www.gnu.org/licenses/>.  
21 - *  
22 - * You can contact KnowledgeTree Inc., PO Box 7775 #87847, San Francisco,  
23 - * California 94120-7775, or email info@knowledgetree.com.  
24 - *  
25 - * The interactive user interfaces in modified source and object code versions  
26 - * of this program must display Appropriate Legal Notices, as required under  
27 - * Section 5 of the GNU General Public License version 3.  
28 - *  
29 - * In accordance with Section 7(b) of the GNU General Public License version 3,  
30 - * these Appropriate Legal Notices must retain the display of the "Powered by  
31 - * KnowledgeTree" logo and retain the original copyright notice. If the display of the  
32 - * logo is not reasonably feasible for technical reasons, the Appropriate Legal Notices  
33 - * must display the words "Powered by KnowledgeTree" and retain the original  
34 - * copyright notice.  
35 - * Contributor( s):  
36 - * Mark Holtzhausen <mark@knowledgetree.com>  
37 - *  
38 - */  
39 -  
40 - //Create a new response feed  
41 - $feed=new KTAPPFeed(KT_APP_BASE_URI);  
42 -  
43 - //Invoke the KtAPI to get detail about the referenced document  
44 - $tree=KTAPPHelper::getFullTree();  
45 -  
46 - //Create the atom response feed  
47 - foreach($tree as $item){  
48 - $id=$item['id'];  
49 - $entry=$feed->newEntry();  
50 - $feed->newField('id',$id,$entry);  
51 - foreach($item as $property=>$value){  
52 - $feed->newField($property,$value,$entry);  
53 - }  
54 - }  
55 -  
56 -  
57 - //Generate and set the output  
58 - $output=$feed->getAPPdoc();  
59 -?>  
60 \ No newline at end of file 0 \ No newline at end of file
ktatompub/services/servicedocument.inc.php deleted
1 -<?php  
2 -/**  
3 - * Framework for an Atom Publication Protocol Service  
4 - *  
5 - * KnowledgeTree Community Edition  
6 - * Document Management Made Simple  
7 - * Copyright (C) 2008, 2009 KnowledgeTree Inc.  
8 - * Portions copyright The Jam Warehouse Software (Pty) Limited  
9 - *  
10 - * This program is free software; you can redistribute it and/or modify it under  
11 - * the terms of the GNU General Public License version 3 as published by the  
12 - * Free Software Foundation.  
13 - *  
14 - * This program is distributed in the hope that it will be useful, but WITHOUT  
15 - * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS  
16 - * FOR A PARTICULAR PURPOSE. See the GNU General Public License for more  
17 - * details.  
18 - *  
19 - * You should have received a copy of the GNU General Public License  
20 - * along with this program. If not, see <http://www.gnu.org/licenses/>.  
21 - *  
22 - * You can contact KnowledgeTree Inc., PO Box 7775 #87847, San Francisco,  
23 - * California 94120-7775, or email info@knowledgetree.com.  
24 - *  
25 - * The interactive user interfaces in modified source and object code versions  
26 - * of this program must display Appropriate Legal Notices, as required under  
27 - * Section 5 of the GNU General Public License version 3.  
28 - *  
29 - * In accordance with Section 7(b) of the GNU General Public License version 3,  
30 - * these Appropriate Legal Notices must retain the display of the "Powered by  
31 - * KnowledgeTree" logo and retain the original copyright notice. If the display of the  
32 - * logo is not reasonably feasible for technical reasons, the Appropriate Legal Notices  
33 - * must display the words "Powered by KnowledgeTree" and retain the original  
34 - * copyright notice.  
35 - * Contributor( s):  
36 - * Mark Holtzhausen <mark@knowledgetree.com>  
37 - *  
38 - */  
39 -  
40 - $service=new KTAPPServiceDoc(KT_APP_BASE_URI);  
41 -  
42 - //Creating the Default Workspace for use with standard atomPub Clients  
43 - $ws=$service->newWorkspace('DMS');  
44 - $col=$service->newCollection(KT_APP_BASE_URI.'fulltree/','Full Document Tree',$ws);  
45 - $col=$service->newCollection(KT_APP_BASE_URI.'folder/','Folder Detail',$ws);  
46 - $col=$service->newCollection(KT_APP_BASE_URI.'document/','Document Detail',$ws);  
47 - $col=$service->newCollection(KT_APP_BASE_URI.'mimetypes/','Supported Mime Types',$ws);  
48 -  
49 -  
50 -/* NOT YET IMPLEMENTED - Conceptual Spec Only * /  
51 - //Creating an additional Enhanced Workspace for webservices via atomPub  
52 - $ws=$service->newWorkspace('REST');  
53 - $col=$service->newCollection(KT_APP_BASE_URI.'REST/serviceList','Full Document Tree',$ws);  
54 - $col=$service->newCollection(KT_APP_BASE_URI.'REST/[controller]/[function]/[param1]/[param2]','RPC via REST',$ws);  
55 -/* */  
56 -  
57 -  
58 - $output=$service->getAPPdoc();  
59 -?>  
60 \ No newline at end of file 0 \ No newline at end of file
ktatompub/xmlparsetest.php
1 <?php 1 <?php
2 2
3 class xml2array{ 3 class xml2array{
4 - private $xml='<?xml version="1.0" encoding="utf-8"?>';  
5 - private $namespaces=array();  
6 -  
7 - public function __construct($xml=NULL){  
8 - if($xml)$this->xml=simplexml_load_string($xml);  
9 - $this->namespaces=$this->xml->getNamespaces(true);  
10 - }  
11 -  
12 - public function parse2array(){  
13 - return $this->parseTag($this->xml); 4 + public static function parse($xml){
  5 + return self::parsetag(simplexml_load_string($xml));
14 } 6 }
15 7
16 - private function parsetag($xml,$ns=NULL){ 8 + private static function parsetag($xml,$ns=NULL,$rootXML=NULL){
  9 + if(!$rootXML)$rootXML=$xml;
17 $tagName=$xml->getName(); 10 $tagName=$xml->getName();
18 if($ns)$tagName=$ns.':'.$tagName; 11 if($ns)$tagName=$ns.':'.$tagName;
19 - //$tagAttributes=(array)$xml->attributes(); $tagAttributes=isset($tagAttributes['@attributes'])?$tagAttributes['@attributes']:array();  
20 $array=array(); 12 $array=array();
21 - $array[$tagName]['@attributes']=$this->getAttributes($xml);  
22 - if($this->hasChildren($xml)){  
23 - $children=$this->getChildren($xml);  
24 - foreach($children as $childName=>$child){  
25 - $childName=split(':',$childName);  
26 - $childParsed=$this->parsetag($child,$childName[0]);  
27 - $array[$tagName]=array_merge($array[$tagName],$childParsed); 13 + $array[$tagName]['@attributes']=self::getAttributes($xml,$rootXML);
  14 + if(self::hasChildren($xml,$rootXML)){
  15 + $children=self::getChildren($xml,$rootXML);
  16 + echo '<b>'.$tagName.'</b><br /><pre>'.print_r($children,true).'</pre>';
  17 + foreach($children as $fullChildName=>$childCollection){
  18 + //$child=$childCollection;
  19 + $childName=split(':',$fullChildName);
  20 + foreach($childCollection as $child){
  21 + $childParsed=self::parsetag($child,$childName[0],$rootXML);
  22 + //$cIndex=count($array[$tagName][$childName]);
  23 + $array[$tagName][]=$childParsed;
  24 + }
28 25
29 } 26 }
30 }else{ 27 }else{
@@ -33,13 +30,14 @@ class xml2array{ @@ -33,13 +30,14 @@ class xml2array{
33 return $array; 30 return $array;
34 } 31 }
35 32
36 - private function hasChildren($xml){  
37 - return count($this->getChildren($xml))>0; 33 + private static function hasChildren($xml,$rootXML){
  34 + return count(self::getChildren($xml,$rootXML))>0;
38 } 35 }
39 36
40 - private function getAttributes($xml){ 37 + private static function getAttributes($xml,$rootXML){
41 $attr=array(); 38 $attr=array();
42 - foreach($this->namespaces as $namespace=>$uri){ 39 + $namespaces=$rootXML->getNamespaces(true);
  40 + foreach($namespaces as $namespace=>$uri){
43 $nsAttrs=(array)$xml->attributes($uri); 41 $nsAttrs=(array)$xml->attributes($uri);
44 $nsAttrs=isset($nsAttrs['@attributes'])?$nsAttrs['@attributes']:array(); 42 $nsAttrs=isset($nsAttrs['@attributes'])?$nsAttrs['@attributes']:array();
45 foreach($nsAttrs as $nsAttr=>$nsAttrVal){ //TODO: Support for multiple same name tags 43 foreach($nsAttrs as $nsAttr=>$nsAttrVal){ //TODO: Support for multiple same name tags
@@ -49,12 +47,16 @@ class xml2array{ @@ -49,12 +47,16 @@ class xml2array{
49 return $attr; 47 return $attr;
50 } 48 }
51 49
52 - private function getChildren($xml){ 50 + private static function getChildren($xml,$rootXML){
53 $children=array(); 51 $children=array();
54 - foreach($this->namespaces as $namespace=>$uri){ 52 + $namespaces=$rootXML->getNamespaces(true);
  53 + foreach($namespaces as $namespace=>$uri){
55 $nsChildren=$xml->children($uri); 54 $nsChildren=$xml->children($uri);
56 foreach($nsChildren as $nsChild){ //TODO: Support for multiple same name tags 55 foreach($nsChildren as $nsChild){ //TODO: Support for multiple same name tags
57 - $children[$namespace.':'.$nsChild->getName()]=$nsChild; 56 + $childRealName=$namespace.':'.$nsChild->getName();
  57 + if(!isset($children[$childRealName]))$children[$childRealName]=array();
  58 + if(!is_array($children[$childRealName]))$children[$childRealName]=array();
  59 + $children[$childRealName][]=$nsChild;
58 } 60 }
59 } 61 }
60 return $children; 62 return $children;
@@ -63,6 +65,7 @@ class xml2array{ @@ -63,6 +65,7 @@ class xml2array{
63 } 65 }
64 66
65 67
  68 +
66 $xml='<?xml version="1.0" encoding="utf-8"?> 69 $xml='<?xml version="1.0" encoding="utf-8"?>
67 <service xmlns="http://www.w3.org/2007/app" xmlns:atom="http://www.w3.org/2005/Atom" xmlns:cmis="http://www.cmis.org/2008/05" xmlns:alf="http://www.alfresco.org"> 70 <service xmlns="http://www.w3.org/2007/app" xmlns:atom="http://www.w3.org/2005/Atom" xmlns:cmis="http://www.cmis.org/2008/05" xmlns:alf="http://www.alfresco.org">
68 <workspace cmis:repositoryRelationship="self"> 71 <workspace cmis:repositoryRelationship="self">
@@ -121,15 +124,15 @@ $xml=&#39;&lt;?xml version=&quot;1.0&quot; encoding=&quot;utf-8&quot;?&gt; @@ -121,15 +124,15 @@ $xml=&#39;&lt;?xml version=&quot;1.0&quot; encoding=&quot;utf-8&quot;?&gt;
121 $sxml=simplexml_load_string($xml); 124 $sxml=simplexml_load_string($xml);
122 $struct=json_decode(json_encode($sxml),true); 125 $struct=json_decode(json_encode($sxml),true);
123 126
124 -$nxml=new xml2array($xml); 127 +
125 128
126 echo '<pre>'.htmlentities($xml).'</pre>'; 129 echo '<pre>'.htmlentities($xml).'</pre>';
127 //echo '<hr /><pre>'.print_r($struct,true).'</pre>'; 130 //echo '<hr /><pre>'.print_r($struct,true).'</pre>';
128 //echo '<hr /><pre>'.print_r($sxml,true).'</pre>'; 131 //echo '<hr /><pre>'.print_r($sxml,true).'</pre>';
129 //cho '<hr /><pre>'.print_r(xml2array($xml),true).'</pre>'; 132 //cho '<hr /><pre>'.print_r(xml2array($xml),true).'</pre>';
130 -echo '<hr /><pre>'.print_r($nxml->parse2array(),true).'</pre>'; 133 +echo '<hr /><pre>'.print_r(xml2array::parse($xml),true).'</pre>';
131 134
132 135
133 -echo http_get_request_headers(); 136 +//echo http_get_request_headers();
134 137
135 ?> 138 ?>
136 \ No newline at end of file 139 \ No newline at end of file
ktatompub/services/folder.inc.php renamed to webservice/atompub/auth.php
@@ -32,23 +32,18 @@ @@ -32,23 +32,18 @@
32 * logo is not reasonably feasible for technical reasons, the Appropriate Legal Notices 32 * logo is not reasonably feasible for technical reasons, the Appropriate Legal Notices
33 * must display the words "Powered by KnowledgeTree" and retain the original 33 * must display the words "Powered by KnowledgeTree" and retain the original
34 * copyright notice. 34 * copyright notice.
35 - * Contributor( s): 35 + * Contributor( s):
36 * Mark Holtzhausen <mark@knowledgetree.com> 36 * Mark Holtzhausen <mark@knowledgetree.com>
37 * 37 *
38 */ 38 */
39 39
40 - //Create a new response feed  
41 - $feed=new KTAPPFeed(KT_APP_BASE_URI); 40 +/**
  41 + * Automatic Login bypassing HTTP Basic Auth
  42 + * TODO: Thest HTTP Basic Auth - Try Library From Home
  43 + */
42 44
43 - //Invoke the KtAPI to get detail about the referenced document  
44 - $folderDetail=KTAPPHelper::getFolderDetail($query[1]); 45 +$SessionId=KT_atom_service_helper::login('admin','admin');
  46 +$SessionId=$SessionId['session_id'];
45 47
46 - //Create the atom response feed  
47 - $entry=$feed->newEntry();  
48 - foreach($folderDetail as $property=>$value){  
49 - $feed->newField($property,$value,$entry);  
50 - }  
51 48
52 - //Generate and set the output  
53 - $output=$feed->getAPPdoc();  
54 ?> 49 ?>
55 \ No newline at end of file 50 \ No newline at end of file
webservice/atompub/demodms/KT_atom_server.default_dms_services.inc.php 0 โ†’ 100644
  1 +<?php
  2 +/**
  3 + * AtomPub Service: fulltree
  4 + *
  5 + * Returns a full tree listing starting at the root document
  6 + * Tree structure obtained by referencing parent id
  7 + *
  8 + */
  9 +class KT_atom_service_fulltree extends KT_atom_service {
  10 + public function GET_action(){
  11 + //Create a new response feed
  12 + $feed=new KT_atom_ResponseFeed_GET(KT_APP_BASE_URI);
  13 +
  14 + //Invoke the KtAPI to get detail about the referenced document
  15 + $tree=KT_atom_service_helper::getFullTree();
  16 +
  17 + //Create the atom response feed
  18 + foreach($tree as $item){
  19 + $id=$item['id'];
  20 + $entry=$feed->newEntry();
  21 + $feed->newField('id',$id,$entry);
  22 + foreach($item as $property=>$value){
  23 + $feed->newField($property,$value,$entry);
  24 + }
  25 + }
  26 + //Expose the responseFeed
  27 + $this->responseFeed=$feed;
  28 + }
  29 +
  30 + public function DELETE_action(){
  31 + $feed = new KT_atom_ResponseFeed_DELETE();
  32 + $this->responseFeed=$feed;
  33 + }
  34 +}
  35 +
  36 +
  37 +
  38 +
  39 +/**
  40 + * AtomPub Service: folder
  41 + *
  42 + * Returns detail on a particular folder
  43 + *
  44 + */
  45 +class KT_atom_service_folder extends KT_atom_service {
  46 + public function GET_action(){
  47 + //Create a new response feed
  48 + $feed=new KT_atom_responseFeed(KT_APP_BASE_URI);
  49 +
  50 + //Invoke the KtAPI to get detail about the referenced document
  51 + $folderDetail=KT_atom_service_helper::getFolderDetail($this->params[0]?$this->params[0]:1);
  52 +
  53 + //Create the atom response feed
  54 + $entry=$feed->newEntry();
  55 + foreach($folderDetail as $property=>$value){
  56 + $feed->newField($property,$value,$entry);
  57 + }
  58 +
  59 + //Expose the responseFeed
  60 + $this->responseFeed=$feed;
  61 + }
  62 +}
  63 +
  64 +
  65 +
  66 +
  67 +/**
  68 + * AtomPub Service: document
  69 + *
  70 + * Returns detail on a particular document
  71 + *
  72 + */
  73 +class KT_atom_service_document extends KT_atom_service {
  74 + public function GET_action(){
  75 + //Create a new response feed
  76 + $feed=new KT_atom_responseFeed(KT_APP_BASE_URI);
  77 +
  78 + //Invoke the KtAPI to get detail about the referenced document
  79 + $docDetail=KT_atom_service_helper::getDocumentDetail($this->params[0]);
  80 +
  81 + //Create the atom response feed
  82 + $entry=$feed->newEntry();
  83 + foreach($docDetail['results'] as $property=>$value){
  84 + $feed->newField($property,$value,$entry);
  85 + }
  86 + //Add a downloaduri field manually
  87 + $feed->newField('downloaduri',urlencode(KT_APP_SYSTEM_URI.'/action.php?kt_path_info=ktcore.actions.document.view&fDocumentId='.$docDetail['results']['document_id']),$entry);
  88 +
  89 + //Expose the responseFeed
  90 + $this->responseFeed=$feed;
  91 + }
  92 +}
  93 +?>
0 \ No newline at end of file 94 \ No newline at end of file
webservice/atompub/demodms/KT_atom_service_helper.inc.php 0 โ†’ 100644
  1 +<?php
  2 +/**
  3 + * Framework for an Atom Publication Protocol Service
  4 + *
  5 + * KnowledgeTree Community Edition
  6 + * Document Management Made Simple
  7 + * Copyright (C) 2008, 2009 KnowledgeTree Inc.
  8 + * Portions copyright The Jam Warehouse Software (Pty) Limited
  9 + *
  10 + * This program is free software; you can redistribute it and/or modify it under
  11 + * the terms of the GNU General Public License version 3 as published by the
  12 + * Free Software Foundation.
  13 + *
  14 + * This program is distributed in the hope that it will be useful, but WITHOUT
  15 + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
  16 + * FOR A PARTICULAR PURPOSE. See the GNU General Public License for more
  17 + * details.
  18 + *
  19 + * You should have received a copy of the GNU General Public License
  20 + * along with this program. If not, see <http://www.gnu.org/licenses/>.
  21 + *
  22 + * You can contact KnowledgeTree Inc., PO Box 7775 #87847, San Francisco,
  23 + * California 94120-7775, or email info@knowledgetree.com.
  24 + *
  25 + * The interactive user interfaces in modified source and object code versions
  26 + * of this program must display Appropriate Legal Notices, as required under
  27 + * Section 5 of the GNU General Public License version 3.
  28 + *
  29 + * In accordance with Section 7(b) of the GNU General Public License version 3,
  30 + * these Appropriate Legal Notices must retain the display of the "Powered by
  31 + * KnowledgeTree" logo and retain the original copyright notice. If the display of the
  32 + * logo is not reasonably feasible for technical reasons, the Appropriate Legal Notices
  33 + * must display the words "Powered by KnowledgeTree" and retain the original
  34 + * copyright notice.
  35 + * Contributor( s):
  36 + * Mark Holtzhausen <mark@knowledgetree.com>
  37 + *
  38 + */
  39 +
  40 +class KT_atom_service_helper{
  41 + private static $FOLDER_LIST_PROPERTIES=array('id','title','permissions','mime_icon_path');
  42 + private static $FILE_LIST_PROPERTIES=array('id','title','document_type','created_by','created_date','checked_out_by','checked_out_date','modified_by','modified_date','owned_by','mime_type','mime_icon_path','mime_display');
  43 + private static $FOLDER_RECURSION_LEVEL=100;
  44 + private static $kt=NULL;
  45 +
  46 + /**
  47 + * Make sure the class is always treated statically and never instantiated.
  48 + *
  49 + * @return void
  50 + */
  51 + public function __construct(){
  52 + die('KT_atom_service_helper should not be instantiated. Only use as a static class');
  53 + }
  54 +
  55 +
  56 + /**
  57 + * Get the KT singleton instance
  58 + *
  59 + * @return object
  60 + */
  61 + public static function getKt(){
  62 + if(!isset(self::$kt)){
  63 + self::$kt=new KTAPI();
  64 + self::$kt->get_active_session(session_id());
  65 + }
  66 + return self::$kt;
  67 + }
  68 +
  69 +
  70 + /**
  71 + * Get the subfolders of the indicated folder
  72 + *
  73 + * @param integer $folderId
  74 + * @return array
  75 + */
  76 + public static function getSubFolders($folderId=NULL){
  77 + if(!(int)$folderId)$folderId=1; //Default to root folder
  78 + $folderInfo=self::getKT()->get_folder_contents($folderId,1);
  79 + $subfolders=array();
  80 + foreach($folderInfo['results']['items'] as $item){
  81 + if($item['item_type']=='F'){
  82 + $subfolders[$item[id]]=self::extractFromArray($item,self::$FOLDER_LIST_PROPERTIES);
  83 + }
  84 + }
  85 + return $subfolders;
  86 + }
  87 +
  88 +
  89 + /**
  90 + * Get every folder & document in the repository
  91 + *
  92 + * @param integer $parent the id of the folder to start recursing from - defaults to root folder [1]
  93 + * @return array
  94 + */
  95 + public static function getFullTree($parent=NULL){
  96 + if(!(int)$parent)$parent=1;
  97 + $ktTree=self::getKT()->get_folder_contents($parent,1);
  98 + $appTree=array();
  99 + foreach($ktTree['results']['items'] as $item){
  100 + $newItem=array();
  101 + $newItem['parent']=$parent;
  102 + $newItem['type']=$item['item_type'];
  103 + $newItem['title']=$item['title'];
  104 + $newItem['filename']=$item['filename'];
  105 + $newItem['id']=$item['id'];
  106 +// $newItem['fullrecord']=$item;
  107 + $appTree[]=$newItem;
  108 + if($newItem['type']=='F')$appTree=array_merge($appTree,self::getFullTree($item['id']));
  109 + }
  110 + return $appTree;
  111 + }
  112 +
  113 +
  114 + /**
  115 + * Get detail about the folder
  116 + *
  117 + * @param integer $folderId The id of the folder to get detail on.
  118 + * @return array
  119 + */
  120 + public static function getFolderDetail($folderId=NULL){
  121 + $ktInfo=self::getKT()->get_folder_by_id($folderId);
  122 + return $ktInfo->get_detail();
  123 + }
  124 +
  125 +
  126 + /**
  127 + * Get detail about the indicated document
  128 + *
  129 + * @param integer $docId The document Id
  130 + * @return array
  131 + */
  132 + public static function getDocumentDetail($docId=NULL){
  133 + $ktInfo=self::getKT()->get_document_detail($docId);
  134 + return $ktInfo;
  135 + }
  136 +
  137 +
  138 + /**
  139 + * Get a list of all the documents in a folder.
  140 + *
  141 + * @param integer $folderId The id of the folder
  142 + * @return array
  143 + */
  144 + public static function getFileList($folderId=NULL){
  145 + $folderContents=self::getKt()->get_folder_contents($folderId,1);
  146 + $folderFiles=array();
  147 + foreach($folderContents['results']['items'] as $item){
  148 + if($item['item_type']=='D'){
  149 + $folderFiles[$item['id']]=self::extractFromArray($item,self::$FILE_LIST_PROPERTIES);
  150 + }
  151 + }
  152 + return $folderFiles;
  153 + }
  154 +
  155 +
  156 + /**
  157 + * Returns an array containing only the associated values from $array where the keys were found in $keyArray
  158 + *
  159 + * @param array $array The array to be processed
  160 + * @param array $keyArray The list of keys to extract from the array
  161 + * @return array
  162 + */
  163 + public static function extractFromArray($array,$keyArray){
  164 + $newArray=array();
  165 + foreach($keyArray as $key){
  166 + $newArray[$key]=isset($array[$key])?$array[$key]:NULL;
  167 + }
  168 + return $newArray;
  169 + }
  170 +
  171 + /**
  172 + * Log in to KT easily
  173 + *
  174 + * @param string $username
  175 + * @param string $password
  176 + * @param string $ip
  177 + * @return object Containing the status_code of the login and session id
  178 + */
  179 + function login($username, $password, $ip=null){
  180 + $kt = self::getKt();
  181 +
  182 + $session = $kt->start_session($username,$password, $ip);
  183 + if (PEAR::isError($session)){
  184 + $response['status_code']=KT_atom_server_FAILURE;
  185 + $response['session_id']='';
  186 + }else{
  187 + $session= $session->get_session();
  188 + $response['status_code'] = KT_atom_server_SUCCESS;
  189 + $response['session_id'] = $session;
  190 + }
  191 + return $response;
  192 + }
  193 +
  194 +
  195 + /**
  196 + * Log out of KT using the session id
  197 + *
  198 + * @param string $session_id
  199 + * @return object Containing the status_code of the logout attempt
  200 + */
  201 + function logout($session_id){
  202 + $kt = self::getKt();
  203 + $session = $kt->get_active_session($session_id, null);
  204 +
  205 + if (PEAR::isError($session)){
  206 + $response['status_code']=KT_atom_server_FAILURE;
  207 + }else{
  208 + $session->logout();
  209 + $response['status_code'] = KT_atom_server_SUCCESS;
  210 + }
  211 + return $response;
  212 + }
  213 +
  214 + /**
  215 + * Check whether the session_id is logged into KT
  216 + *
  217 + * @param string $session_id
  218 + * @return boolean
  219 + */
  220 + function isLoggedIn($session_id){
  221 + $kt=self::getKt();
  222 + $session=$kt->get_active_session($session_id);
  223 + return !PEAR::isError($session);
  224 + }
  225 +
  226 +}
  227 +?>
0 \ No newline at end of file 228 \ No newline at end of file
ktatompub/services/mimetypes.inc.php renamed to webservice/atompub/index.php
@@ -32,25 +32,75 @@ @@ -32,25 +32,75 @@
32 * logo is not reasonably feasible for technical reasons, the Appropriate Legal Notices 32 * logo is not reasonably feasible for technical reasons, the Appropriate Legal Notices
33 * must display the words "Powered by KnowledgeTree" and retain the original 33 * must display the words "Powered by KnowledgeTree" and retain the original
34 * copyright notice. 34 * copyright notice.
35 - * Contributor( s): 35 + * Contributor( s):
36 * Mark Holtzhausen <mark@knowledgetree.com> 36 * Mark Holtzhausen <mark@knowledgetree.com>
37 * 37 *
38 */ 38 */
39 39
40 - //Create a new response feed  
41 - $mimetypes=KTMime::getAllMimeTypes();  
42 -  
43 - //Invoke the KtAPI to get detail about the referenced document  
44 - $feed=new KTAPPFeed(KT_APP_BASE_URI);  
45 -  
46 - //Create the atom response feed  
47 - foreach($mimetypes as $mimeType){  
48 - $entry=$feed->newEntry();  
49 - foreach($mimeType as $property=>$value){  
50 - $feed->newField($property,$value,$entry);  
51 - }  
52 - }  
53 -  
54 - //Generate and set the output  
55 - $output=$feed->getAPPdoc(); 40 +ob_start();
  41 +
  42 +/**
  43 + * Constants
  44 + */
  45 +
  46 +/**
  47 + * To sidestep url rewrites but still retain the atomPub URL convention,
  48 + * the entry point is: index.php?/
  49 + * eg. 1. Accessing the servicedocument: http://example.com/ktatompub/index.php?/servicedocument
  50 + * 2. Accessing the folder service: http://example.com/ktatompub/index.php?/folder/1
  51 + *
  52 + * If URL rewrites are used, they should point any reference below
  53 + * this folder to index.php?/
  54 + *
  55 + * Because index.php is accessed as the default document, the url can be shortened to http://example.com/ktatompub/?/
  56 + */
  57 +
  58 +define('KT_APP_BASE_URI',"http://".$_SERVER['HTTP_HOST'].dirname($_SERVER['PHP_SELF']).'/?/');
  59 +define('KT_APP_SYSTEM_URI',"http://".$_SERVER['HTTP_HOST']);
  60 +define('KT_ATOM_LIB_FOLDER','../classes/atompub/');
  61 +
  62 +// Define whether to use in debug mode for viewing generated structures
  63 +//define('KT_APP_WEB_OUTPUT',false); //defunct
  64 +
  65 +
  66 +
  67 +/**
  68 + * Includes
  69 + */
  70 +include_once('../../ktapi/ktapi.inc.php');
  71 +include_once(KT_ATOM_LIB_FOLDER.'KT_atom_server.inc.php');
  72 +include_once('demodms/KT_atom_service_helper.inc.php'); //Containing helper bridge functions to KtAPI
  73 +include_once(KT_ATOM_LIB_FOLDER.'KT_atom_baseDoc.inc.php'); //Containing the parent class allowing easy XML manipulation
  74 +include_once(KT_ATOM_LIB_FOLDER.'KT_atom_serviceDoc.inc.php'); //Containing the servicedoc class allowing easy ServiceDocument generation
  75 +include_once(KT_ATOM_LIB_FOLDER.'KT_atom_responseFeed.inc.php'); //Containing the response feed class allowing easy atom feed generation
  76 +include_once(KT_ATOM_LIB_FOLDER.'KT_atom_service.inc.php');
  77 +include_once('demodms/KT_atom_server.default_dms_services.inc.php');
  78 +include_once('auth.php'); //Containing the authentication protocols
  79 +
  80 +
  81 +//Start the AtomPubProtocol Routing Engine
  82 +$APP=new KT_atom_server();
  83 +
  84 +/**
  85 + * Register Services
  86 + *
  87 + * Registered services are classes extended from KT_atom_service
  88 + * The registration process takes the following parameters
  89 + * Workspace :The workspace within which the service collection will be grouped
  90 + * ServiceName :This is the name by which the service/collection is exposed
  91 + * ServiceClass :This is the class name of the class to be instantiated when this service is accessed
  92 + * Title :This is the title given to the service/collection in the servicedocument
  93 +*/
  94 +$APP->registerService('DMS','fulltree','KT_atom_service_fulltree','Full Document Tree');
  95 +$APP->registerService('DMS','folder','KT_atom_service_folder','Folder Detail');
  96 +$APP->registerService('DMS','document','KT_atom_service_document','Document Detail');
  97 +
  98 +//Execute the current url/header request
  99 +$APP->execute();
  100 +
  101 +//echo '<pre>'.print_r($APP,true).'</pre>';
  102 +
  103 +//Render the resulting feed response
  104 +$APP->render();
  105 +
56 ?> 106 ?>
57 \ No newline at end of file 107 \ No newline at end of file
webservice/classes/atompub/KT_atom_baseDoc.inc.php 0 โ†’ 100644
  1 +<?php
  2 +/**
  3 + * Framework for an Atom Publication Protocol Service
  4 + *
  5 + * KnowledgeTree Community Edition
  6 + * Document Management Made Simple
  7 + * Copyright (C) 2008, 2009 KnowledgeTree Inc.
  8 + * Portions copyright The Jam Warehouse Software (Pty) Limited
  9 + *
  10 + * This program is free software; you can redistribute it and/or modify it under
  11 + * the terms of the GNU General Public License version 3 as published by the
  12 + * Free Software Foundation.
  13 + *
  14 + * This program is distributed in the hope that it will be useful, but WITHOUT
  15 + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
  16 + * FOR A PARTICULAR PURPOSE. See the GNU General Public License for more
  17 + * details.
  18 + *
  19 + * You should have received a copy of the GNU General Public License
  20 + * along with this program. If not, see <http://www.gnu.org/licenses/>.
  21 + *
  22 + * You can contact KnowledgeTree Inc., PO Box 7775 #87847, San Francisco,
  23 + * California 94120-7775, or email info@knowledgetree.com.
  24 + *
  25 + * The interactive user interfaces in modified source and object code versions
  26 + * of this program must display Appropriate Legal Notices, as required under
  27 + * Section 5 of the GNU General Public License version 3.
  28 + *
  29 + * In accordance with Section 7(b) of the GNU General Public License version 3,
  30 + * these Appropriate Legal Notices must retain the display of the "Powered by
  31 + * KnowledgeTree" logo and retain the original copyright notice. If the display of the
  32 + * logo is not reasonably feasible for technical reasons, the Appropriate Legal Notices
  33 + * must display the words "Powered by KnowledgeTree" and retain the original
  34 + * copyright notice.
  35 + * Contributor( s):
  36 + * Mark Holtzhausen <mark@knowledgetree.com>
  37 + *
  38 + */
  39 +
  40 +/**
  41 + * Includes
  42 + */
  43 +
  44 +class KT_atom_baseDoc{
  45 + const XML_ENCODING='utf-8';
  46 + const XML_VERSION='1.0';
  47 +
  48 + public $DOM=NULL;
  49 +
  50 + public function __construct(){
  51 + $this->DOM=new DOMDocument(self::XML_VERSION ,self::XML_ENCODING);
  52 + }
  53 +
  54 + public function &newAttr($name=NULL){
  55 + $node=$this->DOM->createAttribute($name);
  56 + if(func_num_args()>1){
  57 + $val=func_get_arg(1);
  58 + $node->value=$val;
  59 + }
  60 + return $node;
  61 + }
  62 +
  63 + public function &newElement($name=NULL){
  64 + if(func_num_args()>1){
  65 + $val=func_get_arg(1);
  66 + $node=$this->DOM->createElement($name,$val);
  67 + }else{
  68 + $node=$this->DOM->createElement($name);
  69 + }
  70 + return $node;
  71 + }
  72 +
  73 + public function &newCDATA($data=NULL){
  74 + $this->DOM->createCDATASection($data);
  75 + }
  76 +
  77 + public function &newB64Stream($tagName=NULL,$tagAttrs=array(),$streamString=NULL){
  78 + $e=$this->newElement($tagName,chunk_split(base64_encode($streamString),75));
  79 + foreach($tagAttrs as $attr=>$val){
  80 + $attr=$this->newAttr($attr,$val);
  81 + $e->appendChild($attr);
  82 + }
  83 + return $e;
  84 + }
  85 +
  86 +
  87 +
  88 + public function formatXmlString($xml) {
  89 + // add marker linefeeds to aid the pretty-tokeniser (adds a linefeed between all tag-end boundaries)
  90 + $xml = preg_replace('/(>)(<)(\/*)/', "$1\n$2$3", $xml);
  91 +
  92 + // now indent the tags
  93 + $token = strtok($xml, "\n");
  94 + $result = ''; // holds formatted version as it is built
  95 + $pad = 0; // initial indent
  96 + $matches = array(); // returns from preg_matches()
  97 +
  98 + // scan each line and adjust indent based on opening/closing tags
  99 + while ($token !== false) :
  100 +
  101 + // test for the various tag states
  102 +
  103 + // 1. open and closing tags on same line - no change
  104 + if (preg_match('/.+<\/\w[^>]*>$/', $token, $matches)) :
  105 + $indent=0;
  106 + // 2. closing tag - outdent now
  107 + elseif (preg_match('/^<\/\w/', $token, $matches)) :
  108 + $pad--;
  109 + // 3. opening tag - don't pad this one, only subsequent tags
  110 + elseif (preg_match('/^<\w[^>]*[^\/]>.*$/', $token, $matches)) :
  111 + $indent=1;
  112 + // 4. no indentation needed
  113 + else :
  114 + $indent = 0;
  115 + endif;
  116 +
  117 + // pad the line with the required number of leading spaces
  118 + $line = str_pad($token, strlen($token)+$pad, ' ', STR_PAD_LEFT);
  119 + $result .= $line . "\n"; // add to the cumulative result, with linefeed
  120 + $token = strtok("\n"); // get the next token
  121 + $pad += $indent; // update the pad size for subsequent lines
  122 + endwhile;
  123 +
  124 + return $result;
  125 + }
  126 +}
  127 +
  128 +?>
0 \ No newline at end of file 129 \ No newline at end of file
webservice/classes/atompub/KT_atom_responseFeed.inc.php 0 โ†’ 100644
  1 +<?php
  2 +class KT_atom_responseFeed extends KT_atom_baseDoc {
  3 +
  4 + private $baseURI=NULL;
  5 + private $feed=NULL;
  6 +
  7 +
  8 + public function __construct($baseURI=NULL,$title=NULL,$link=NULL,$updated=NULL,$author=NULL,$id=NULL){
  9 + parent::__construct();
  10 + $this->constructHeader();
  11 + $this->baseURI=$baseURI;
  12 + }
  13 +
  14 + private function constructHeader(){
  15 + $feed=$this->newElement('feed');
  16 + $feed->appendChild($this->newAttr('xmlns','http://www.w3.org/2005/Atom'));
  17 + $this->feed=&$feed;
  18 + $this->DOM->appendChild($this->feed);
  19 + }
  20 +
  21 + public function &newEntry(){
  22 + $entry=$this->newElement('entry');
  23 + $this->feed->appendChild($entry);
  24 + return $entry;
  25 + }
  26 +
  27 + public function &newField($name=NULL,$value=NULL,&$attachToNode=NULL){
  28 + $field=$this->newElement($name,$value);
  29 + if(isset($attachToNode))$attachToNode->appendChild($field);
  30 + return $field;
  31 + }
  32 +
  33 + public function render(){
  34 + return $this->formatXmlString(trim($this->DOM->saveXML()));
  35 + }
  36 +
  37 +
  38 +}
  39 +
  40 +class KT_atom_ResponseFeed_GET extends KT_atom_responseFeed{}
  41 +class KT_atom_ResponseFeed_PUT extends KT_atom_responseFeed{}
  42 +class KT_atom_ResponseFeed_POST extends KT_atom_responseFeed{}
  43 +class KT_atom_ResponseFeed_DELETE extends KT_atom_responseFeed{}
  44 +
  45 +?>
0 \ No newline at end of file 46 \ No newline at end of file
webservice/classes/atompub/KT_atom_server.inc.php 0 โ†’ 100644
  1 +<?php
  2 +class KT_atom_server{
  3 + private $services=array();
  4 + private $errors=array();
  5 + private $output='';
  6 + private $queryArray=array();
  7 + private $serviceName='';
  8 + private $method='';
  9 + private $workspace='';
  10 +
  11 +
  12 + public function __construct(){
  13 + }
  14 +
  15 + public function execute(){
  16 + $reqMethod=trim(strtoupper($_SERVER['REQUEST_METHOD']));
  17 + $queryArray=split('/',trim($_SERVER['QUERY_STRING'],'/'));
  18 + $rawRequest=@file_get_contents('php://input');
  19 +
  20 + $workspace=strtolower(trim($queryArray[0]));
  21 + $serviceName=strtolower(trim($queryArray[1]));
  22 + $requestParams=array_slice($queryArray,2);
  23 + $this->queryArray=$queryArray;
  24 + $this->serviceName=$service;
  25 + $this->method=$reqMethod;
  26 + $this->workspace=$workspace;
  27 +
  28 + if($workspace=='servicedocument'){
  29 + $this->serviceDocument();
  30 + return;
  31 + }
  32 +
  33 + $service=$this->getRegisteredService($workspace,$serviceName);
  34 + if(is_array($service)){
  35 + $serviceClass=$service['serviceClass'];
  36 + echo 'made it';
  37 + $serviceObject=new $serviceClass($reqMethod,$requestParams,$rawRequest);
  38 + $this->output=$serviceObject->render();
  39 + }else{
  40 + $serviceObject=new KT_atom_service($requestParams,$rawRequest);
  41 + $serviceObject->setStatus(KT_atom_service::STATUS_NOT_FOUND);
  42 + $this->output=$serviceObject->render();
  43 + }
  44 + }
  45 +
  46 + public function registerService($workspace=NULL,$serviceName=NULL,$serviceClass=NULL,$title=NULL){
  47 + $workspace=strtolower(trim($workspace));
  48 + $serviceName=strtolower(trim($serviceName));
  49 +
  50 + $serviceRecord=array(
  51 + 'fileName' =>$fileName,
  52 + 'serviceClass' =>$serviceClass,
  53 + 'title' =>$title
  54 + );
  55 +
  56 + $this->services[$workspace][$serviceName]=$serviceRecord;
  57 + }
  58 +
  59 + public function getRegisteredService($workspace,$serviceName=NULL){
  60 + $serviceName=strtolower(trim($serviceName));
  61 + if(isset($this->services[$workspace][$serviceName]))return $this->services[$workspace][$serviceName];
  62 + return false;
  63 + }
  64 +
  65 + public function serviceDocument(){
  66 + $service=new KT_atom_serviceDoc(KT_APP_BASE_URI);
  67 +
  68 + foreach($this->services as $workspace=>$collection){
  69 + //Creating the Default Workspace for use with standard atomPub Clients
  70 + $ws=$service->newWorkspace($workspace);
  71 +
  72 + foreach($collection as $serviceName=>$serviceInstance){
  73 + $col=$service->newCollection(KT_APP_BASE_URI.$workspace.'/'.$serviceName.'/',$serviceInstance['title'],$ws);
  74 + }
  75 + }
  76 +
  77 + $this->output=$service->getAPPdoc();
  78 + }
  79 +
  80 + public function render(){
  81 + ob_end_clean();
  82 + header('Content-type: text/xml');
  83 + echo $this->output;
  84 + }
  85 +}
  86 +
  87 +?>
0 \ No newline at end of file 88 \ No newline at end of file
webservice/classes/atompub/KT_atom_service.inc.php 0 โ†’ 100644
  1 +<?php
  2 +class KT_atom_service{
  3 + const STATUS_OK ='200 OK';
  4 + const STATUS_NOT_FOUND ='204 No Content';
  5 + const STATUS_NOT_ALLOWED ='204 Not Allowed';
  6 + const STATUS_NOT_AUTHENTICATED ='204 Not Authenticated';
  7 + const STATUS_CREATED ='201 Created';
  8 + const STATUS_UPDATED ='200 Updated';
  9 + const STATUS_NOT_MODIFIED ='304 Not Modified'; //For use with ETag & If-None-Match headers.
  10 + const STATUS_PRECONDITION_FAILED='412 Precondition Failed'; //Could not update document because another a newer version exist on the server than the one you are trying to update
  11 +
  12 + public $responseFeed=NULL;
  13 + public $responseHeader=NULL;
  14 + public $method='';
  15 + public $params='';
  16 + public $rawContent='';
  17 + public $parsedXMLContent='';
  18 + public $headers=array();
  19 +
  20 + public function __construct($method,$params,$content){
  21 + $this->method=$method;
  22 + $this->params=$params;
  23 + $this->rawContent=$content;
  24 + $this->parseHeaders();
  25 + $this->parsedXMLContent=$this->xml2array($this->rawContent);
  26 + $this->setStatus(self::STATUS_OK);
  27 + $this->responseFeed=new KT_atom_responseFeed(KT_APP_BASE_URI);
  28 + switch(strtoupper($this->method)){
  29 + case 'GET': $this->GET_action();break;
  30 + case 'PUT': $this->PUT_action();break;
  31 + case 'POST': $this->POST_action();break;
  32 + case 'DELETE': $this->DELETE_action();break;
  33 + default: $this->UNSUPPORTED_action();break;
  34 + }
  35 + }
  36 +
  37 + public function GET_action(){
  38 + $this->setStatus(KT_atom_service::STATUS_OK);
  39 + }
  40 +
  41 + public function PUT_action(){
  42 + $this->setStatus(KT_atom_service::STATUS_NOT_FOUND );
  43 + }
  44 +
  45 + public function POST_action(){
  46 + $this->setStatus(KT_atom_service::STATUS_NOT_FOUND );
  47 + }
  48 +
  49 + public function DELETE_action(){
  50 + $this->setStatus(KT_atom_service::STATUS_NOT_FOUND );
  51 + }
  52 +
  53 + public function UNSUPPORTED_action(){
  54 + $this->setStatus(KT_atom_service::STATUS_NOT_FOUND );
  55 + }
  56 +
  57 +
  58 + public function render(){
  59 + return $this->responseFeed->render();
  60 + }
  61 +
  62 + private function xml2array($xml){
  63 + $array=json_decode(json_encode(@simplexml_load_string($xml)),true); //TODO - XML2ARRAY Translation
  64 + return $array;
  65 + }
  66 +
  67 + private function parseHeaders(){
  68 + $headers=null;
  69 + if(function_exists('http_get_request_headers')){ //Try to use pcre_http library if it exists
  70 + $headers=http_get_request_headers();
  71 + }else{
  72 + if(function_exists('apache_request_headers')){ //If not: try to use apache specific headers
  73 + $headers=apache_request_headers();
  74 + }else{ //If not: not supported - empty headers
  75 + $headers=array();
  76 + }
  77 + }
  78 + $this->headers=$headers;
  79 + }
  80 +
  81 + public function setStatus($status=NULL){
  82 + header("HTTP/1.1 ".$status);
  83 + }
  84 +
  85 + private function setEtag($etagValue=NULL){
  86 + if($etagValue)header('ETag: '.$etagValue);
  87 + }
  88 +
  89 +}
  90 +?>
0 \ No newline at end of file 91 \ No newline at end of file
ktatompub/lib/KTAPPFeed.inc.php renamed to webservice/classes/atompub/KT_atom_serviceDoc.inc.php
@@ -32,7 +32,7 @@ @@ -32,7 +32,7 @@
32 * logo is not reasonably feasible for technical reasons, the Appropriate Legal Notices 32 * logo is not reasonably feasible for technical reasons, the Appropriate Legal Notices
33 * must display the words "Powered by KnowledgeTree" and retain the original 33 * must display the words "Powered by KnowledgeTree" and retain the original
34 * copyright notice. 34 * copyright notice.
35 - * Contributor( s): 35 + * Contributor( s):
36 * Mark Holtzhausen <mark@knowledgetree.com> 36 * Mark Holtzhausen <mark@knowledgetree.com>
37 * 37 *
38 */ 38 */
@@ -41,75 +41,98 @@ @@ -41,75 +41,98 @@
41 /** 41 /**
42 * Includes 42 * Includes
43 */ 43 */
44 -include_once('KTAPDoc.inc.php');  
45 -  
46 -/* Remember to include support for feed attributes / nodes  
47 -<?xml version="1.0" encoding="utf-8"?>  
48 -<feed xmlns="http://www.w3.org/2005/Atom">  
49 -  
50 - <title>Example Feed</title>  
51 - <link href="http://example.org/"/>  
52 - <updated>2003-12-13T18:30:02Z</updated>  
53 - <author>  
54 - <name>John Doe</name>  
55 - </author>  
56 - <id>urn:uuid:60a76c80-d399-11d9-b93C-0003939e0af6</id>  
57 -  
58 - <entry>  
59 - <title>Atom-Powered Robots Run Amok</title>  
60 - <link href="http://example.org/2003/12/13/atom03"/>  
61 - <id>urn:uuid:1225c695-cfb8-4ebb-aaaa-80da344efa6a</id>  
62 - <updated>2003-12-13T18:30:02Z</updated>  
63 - <summary>Some text.</summary>  
64 - </entry>  
65 -  
66 -</feed>  
67 -  
68 -*/ 44 +include_once('KT_atom_baseDoc.inc.php');
69 45
70 46
71 -class KTAPPFeed extends KTAPDoc {  
72 - 47 +class KT_atom_serviceDoc extends KT_atom_baseDoc {
  48 +
73 private $baseURI=NULL; 49 private $baseURI=NULL;
74 - private $feed=NULL;  
75 - 50 + private $service=NULL;
76 51
77 - public function __construct($baseURI=NULL,$title=NULL,$link=NULL,$updated=NULL,$author=NULL,$id=NULL){ 52 +
  53 + public function __construct($baseURI=NULL){
78 parent::__construct(); 54 parent::__construct();
79 - $this->constructHeader(); 55 + $this->constructServiceDocumentHeaders();
80 $this->baseURI=$baseURI; 56 $this->baseURI=$baseURI;
81 } 57 }
82 -  
83 - private function constructHeader(){  
84 - $feed=$this->newElement('feed');  
85 - $feed->appendChild($this->newAttr('xmlns','http://www.w3.org/2005/Atom'));  
86 - $this->feed=&$feed;  
87 - $this->DOM->appendChild($this->feed); 58 +
  59 + private function constructServiceDocumentHeaders(){
  60 + $service=$this->newElement('service');
  61 + $service->appendChild($this->newAttr('xmlns','http://www.w3.org/2007/app'));
  62 + $service->appendChild($this->newAttr('xmlns:atom','http://www.w3.org/2005/Atom'));
  63 + $this->service=&$service;
  64 + $this->DOM->appendChild($this->service);
88 } 65 }
89 -  
90 - public function &newEntry(){  
91 - $entry=$this->newElement('entry');  
92 - $this->feed->appendChild($entry);  
93 - return $entry; 66 +
  67 + public function &newWorkspace($title=NULL){
  68 + $ws=$this->newElement('workspace');
  69 + $ws->appendChild($this->newElement('atom:title',$title));
  70 + $this->service->appendChild($ws);
  71 + return $ws;
94 } 72 }
95 -  
96 - public function &newField($name=NULL,$value=NULL,&$entry=NULL){  
97 - $field=$this->newElement($name,$value);  
98 - if(isset($entry))$entry->appendChild($field);  
99 - return $field; 73 +
  74 + public function &newCollection($url=NULL,$title=NULL,&$ws=NULL){
  75 + $collection=$this->newElement('collection');
  76 + $collection->appendChild($this->newAttr('href',$url));
  77 + $collection->appendChild($this->newElement('atom:title',$title));
  78 + if(isset($ws))$ws->appendChild($collection);
  79 + return $collection;
100 } 80 }
101 - 81 +
  82 + public function &newAccept($docType=NULL,&$collection=NULL){
  83 + if($docType){
  84 + $accept=$this->newElement('accept',$docType);
  85 + }else{
  86 + $accept=$this->newElement('accept');
  87 + }
  88 + if($collection)$collection->appendChild($accept);
  89 + return $accept;
  90 + }
  91 +
  92 +
102 public function getAPPdoc(){ 93 public function getAPPdoc(){
103 return $this->formatXmlString(trim($this->DOM->saveXML())); 94 return $this->formatXmlString(trim($this->DOM->saveXML()));
104 } 95 }
  96 +
  97 +}
  98 +
  99 +
105 100
106 - public function render(){  
107 - return $this->getAPPdoc();  
108 - }  
109 101
110 -}  
111 102
112 103
113 104
114 105
  106 +/**
  107 +<?xml version="1.0" encoding="utf-8"?>
  108 +<service xmlns="http://www.w3.org/2007/app" xmlns:atom="http://www.w3.org/2005/Atom">
  109 + <workspace>
  110 + <atom:title>Main Site</atom:title>
  111 + <collection href="http://example.org/blog/main" >
  112 + <atom:title>My Blog Entries</atom:title>
  113 + <categories href="http://example.com/cats/forMain.cats" />
  114 + </collection>
  115 + <collection href="http://example.org/blog/pic" >
  116 + <atom:title>Pictures</atom:title>
  117 + <accept>image/png</accept>
  118 + <accept>image/jpeg</accept>
  119 + <accept>image/gif</accept>
  120 + </collection>
  121 + </workspace>
  122 + <workspace>
  123 + <atom:title>Sidebar Blog</atom:title>
  124 + <collection href="http://example.org/sidebar/list" >
  125 + <atom:title>Remaindered Links</atom:title>
  126 + <accept>application/atom+xml;type=entry</accept>
  127 + <categories fixed="yes">
  128 + <atom:category scheme="http://example.org/extra-cats/" term="joke" />
  129 + <atom:category scheme="http://example.org/extra-cats/" term="serious" />
  130 + </categories>
  131 + </collection>
  132 + </workspace>
  133 +</service>
  134 +
  135 + */
  136 +
  137 +
115 ?> 138 ?>
116 \ No newline at end of file 139 \ No newline at end of file