Commit 6e49a0ce70f3d406c71e4e333584d8e1084cb4ed

Authored by Paul Barrett
2 parents 45dace18 237433b1

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

webservice/classes/atompub/KT_atom_server.inc.php
... ... @@ -10,13 +10,15 @@ class KT_atom_server {
10 10 protected $method='';
11 11 protected $workspace='';
12 12 protected $serviceObject = null;
  13 + protected $renderBody=true;
  14 +
13 15  
14 16 public function __construct(){
15 17 }
16 18  
17 19 protected function hook_beforeDocCreate($doc){return true;}
18 20 protected function hook_beforeDocRender($doc){return true;}
19   -
  21 +
20 22 /**
21 23 * Run the server switchboard - find the correct service class to instantiate, execute & render that class with the passed parameteres
22 24 *
... ... @@ -33,21 +35,18 @@ class KT_atom_server {
33 35 $this->serviceName=$serviceName;
34 36 $this->method=$reqMethod;
35 37 $this->workspace=$workspace;
36   -
  38 +
37 39 if($workspace=='servicedocument'){
38 40 $this->serviceDocument();
39 41 return;
40 42 }
41   -
  43 +
42 44 $service=$this->getRegisteredService($workspace,$serviceName);
43 45 if(is_array($service)){
44 46 $serviceClass=$service['serviceClass'];
45   -// echo 'made it';
46 47 $serviceObject=new $serviceClass($reqMethod,$requestParams,$rawRequest);
47   - $this->output=$serviceObject->render();
  48 + if($this->hook_beforeDocRender($serviceObject)) $this->output=$serviceObject->render();
48 49 }else{
49   -// $this->serviceDocument();
50   -// return;
51 50 $serviceObject=new KT_atom_service($requestParams,$rawRequest);
52 51 $serviceObject->setStatus(KT_atom_service::STATUS_NOT_FOUND);
53 52 if($this->hook_beforeDocRender($serviceObject)) $this->output=$serviceObject->render();
... ... @@ -111,8 +110,13 @@ class KT_atom_server {
111 110 public function render(){
112 111 ob_end_clean();
113 112 header('Content-type: text/xml');
114   - echo $this->output;
  113 + if($this->renderBody)echo $this->output;
  114 + }
  115 +
  116 + public function setNoContent($flag=false){
  117 + $this->renderBody=$flag?false:true;
115 118 }
  119 +
116 120 }
117 121  
118 122 ?>
119 123 \ No newline at end of file
... ...