Commit a1882d4c6c3e8c23c29cc8c6154c68941c076f60

Authored by Kevin G Fourie
2 parents 8f884970 90a5c45e

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

ktatompub/Client/index.html
... ... @@ -2,544 +2,526 @@
2 2 <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
3 3 <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
4 4 <head>
5   - <title>KnowlegeTree AtomPub Client</title>
6   - <script src="js/jquery/jquery-1.3.2.min.js"></script>
7   - <script src="js/jquery/plugins/jquery.cookie.js"></script>
8   - <script src="js/jquery/plugins/jquery.xml2json.js"></script>
9   - <script src="js/jquery/ui/ui.core.js"></script>
10   - <script src="js/jquery/ui/ui.tabs.js"></script>
11   - <script src="js/jquery/ui/ui.dialog.js"></script>
12   - <script src="js/jquery/plugins/jquery.dynatree.min.js"></script>
13   - <script src="js/site/site.js"></script>
14   - <script src="js/site/site_cfg.js"></script>
15   - <script src="js/lib/lib.js"></script>
16   - <script src="js/lib/lib.dom.js"></script>
17   - <script src="js/lib/lib.debug.js"></script>
18   - <script src="js/lib/lib.utils.js"></script>
19   - <script src="js/lib/lib.resources.js"></script>
20   - <script src="js/lib/lib.data.js"></script>
21   - <script src="js/lib/events.js"></script>
22   - <script src="js/site/site.event_handlers.js"></script>
23   - <script src="js/APP/ktApp.js"></script>
24   - <script src="js/APP/app.js"></script>
25   - <script type="text/javascript">
  5 +<title>KnowlegeTree AtomPub Client</title>
  6 +<script src="js/jquery/jquery-1.3.2.min.js"></script>
  7 +<script src="js/jquery/plugins/jquery.cookie.js"></script>
  8 +<script src="js/jquery/plugins/jquery.xml2json.js"></script>
  9 +<script src="js/jquery/ui/ui.core.js"></script>
  10 +<script src="js/jquery/ui/ui.tabs.js"></script>
  11 +<script src="js/jquery/ui/ui.dialog.js"></script>
  12 +<script src="js/jquery/plugins/jquery.dynatree.min.js"></script>
  13 +<script src="js/site/site.js"></script>
  14 +<script src="js/site/site_cfg.js"></script>
  15 +<script src="js/lib/lib.js"></script>
  16 +<script src="js/lib/lib.dom.js"></script>
  17 +<script src="js/lib/lib.debug.js"></script>
  18 +<script src="js/lib/lib.utils.js"></script>
  19 +<script src="js/lib/lib.resources.js"></script>
  20 +<script src="js/lib/lib.data.js"></script>
  21 +<script src="js/lib/events.js"></script>
  22 +<script src="js/site/site.event_handlers.js"></script>
  23 +<script src="js/APP/ktApp.js"></script>
  24 +<script src="js/APP/app.js"></script>
  25 +<script type="text/javascript">
26 26 // site.bootStrap(); //If enabled then you don't need to have all the javascript installs above
27 27 // however, it breaks in Titanium
28 28 $(document).ready(function(){site.init();});
29   - </script>
30   - <link type="text/css" href="js/jquery/ui/themes/start/ui.all.css" rel="stylesheet" />
31   - <link rel="stylesheet" type="text/css" href="js/jquery/plugins/skin/ui.dynatree.css">
32   - <style>
33   - body{
34   - margin: 5px;
35   - background-color: #EEEEEE;
36   - }
37   - .mainTable{
38   - width: 1024px;
39   - background-color: #FFFFFF;
40   - }
41   - .header{
42   - font-family: Arial, Helvetica, sans-serif;
43   - font-size: 18px;
44   - font-weight: bold;
45   - color: #666666;
46   - padding: 5px 5px 5px 5px;
47   - margin-bottom:10px;
48   - }
49   -
50   - .TabText{
51   - font-size: 11px;
52   - margin: 0px;
53   - padding: 0px;
54   - }
55   -
56   - .settingsRow{
57   - margin-bottom: 5px;
58   - padding-bottom: 5px;
59   - border-bottom: 1px solid #EEEEEE;
60   - }
61   - .settingsRow_nodivider{
62   - margin-bottom: 5px;
63   - padding-bottom: 5px;
64   - }
65   -
66   - .tree_panel_scrollbar_hider{
67   - padding:1px;
68   - width:400px;
69   - height: 528px;
70   - overflow: hidden;
71   - }
72   - .tree_panel_area{
73   - width: 418px;
74   - height: 548px;
75   - overflow:scroll;
76   - }
77   -
78   - .info_panel_scrollbar_hider{
79   - width:515px;
80   - height: 500px;
81   - overflow: hidden;
82   - }
83   - .info_panel_area{
84   - width: 535px;
85   - height: 520px;
86   - overflow:scroll;
87   - }
88   -
89   - .info_panel_toolbar{
90   - width:510px;
91   - padding: 3px;
92   - margin-bottom:4px;
93   - }
94   -
95   - .info_panel_container{
96   - width: 500px;
97   - }
98   -
99   - .info_panel_heading{
100   - background-color:#DDDDDD;
101   - padding: 4px;
102   - font-weight: bold;
103   - font-size:14px;
104   - }
105   -
106   - .info_panel_subheading{
107   - background-color:#DDDDDD;
108   - padding: 3px;
109   - font-weight: bold;
110   - font-size:12px;
111   - }
112   -
113   - .info_panel_field_name{
114   - font-family: Arial, Helvetica, sans-serif;
115   - font-size:12px;
116   - font-weight: bold;
117   - color:#333333;
118   - padding: 2px 10px 2px 5px;
119   - text-align:right;
120   - background-color: #EEEEEE;
121   - }
122   -
123   - .info_panel_field_value{
124   - font-family:Arial, Helvetica, sans-serif;
125   - font-size: 11px;
126   - font-weight:normal;
127   - color:#000000;
128   - padding: 2px 5px 2px 10px;
129   - text-align:left;
130   - }
131   -
132   - .info_panel_container input[type=text]{
133   - width: 320px;
134   - border: 1px solid #DDDDDD;
135   - font-family:Tahoma, Arial, Helvetica, sans-serif;
136   - font-size:14px;
137   - font-weight: bold;
138   - color:#333399;
139   - padding: 2px;
140   - }
141   -
142   - .dialogs{
143   - font-size: 11px;
144   - color:#333399;
145   - font-family:Verdana, Arial, Helvetica, sans-serif
146   - }
147   - </style>
  29 + </script>
  30 +<link type="text/css" href="js/jquery/ui/themes/start/ui.all.css" rel="stylesheet" />
  31 +<link rel="stylesheet" type="text/css" href="js/jquery/plugins/skin/ui.dynatree.css">
  32 +<style>
  33 +body {
  34 + margin: 5px;
  35 + background-color: #EEEEEE;
  36 +}
  37 +.mainTable {
  38 + width: 1024px;
  39 + background-color: #FFFFFF;
  40 +}
  41 +.header {
  42 + font-family: Arial, Helvetica, sans-serif;
  43 + font-size: 18px;
  44 + font-weight: bold;
  45 + color: #666666;
  46 + padding: 5px 5px 5px 5px;
  47 + margin-bottom:10px;
  48 +}
  49 +.TabText {
  50 + font-size: 11px;
  51 + margin: 0px;
  52 + padding: 0px;
  53 +}
  54 +.settingsRow {
  55 + margin-bottom: 5px;
  56 + padding-bottom: 5px;
  57 + border-bottom: 1px solid #EEEEEE;
  58 +}
  59 +.settingsRow_nodivider {
  60 + margin-bottom: 5px;
  61 + padding-bottom: 5px;
  62 +}
  63 +.tree_panel_scrollbar_hider {
  64 + padding:1px;
  65 + width:400px;
  66 + height: 528px;
  67 + overflow: hidden;
  68 +}
  69 +.tree_panel_area {
  70 + width: 418px;
  71 + height: 548px;
  72 + overflow:scroll;
  73 +}
  74 +.info_panel_scrollbar_hider {
  75 + width:515px;
  76 + height: 500px;
  77 + overflow: hidden;
  78 +}
  79 +.info_panel_area {
  80 + width: 535px;
  81 + height: 520px;
  82 + overflow:scroll;
  83 +}
  84 +.info_panel_toolbar {
  85 + width:510px;
  86 + padding: 3px;
  87 + margin-bottom:4px;
  88 +}
  89 +.info_panel_container {
  90 + width: 500px;
  91 +}
  92 +.info_panel_heading {
  93 + background-color:#DDDDDD;
  94 + padding: 4px;
  95 + font-weight: bold;
  96 + font-size:14px;
  97 +}
  98 +.info_panel_subheading {
  99 + background-color:#DDDDDD;
  100 + padding: 3px;
  101 + font-weight: bold;
  102 + font-size:12px;
  103 +}
  104 +.info_panel_field_name {
  105 + font-family: Arial, Helvetica, sans-serif;
  106 + font-size:12px;
  107 + font-weight: bold;
  108 + color:#333333;
  109 + padding: 2px 10px 2px 5px;
  110 + text-align:right;
  111 + background-color: #EEEEEE;
  112 +}
  113 +.info_panel_field_value {
  114 + font-family:Arial, Helvetica, sans-serif;
  115 + font-size: 11px;
  116 + font-weight:normal;
  117 + color:#000000;
  118 + padding: 2px 5px 2px 10px;
  119 + text-align:left;
  120 +}
  121 +.info_panel_container input[type=text] {
  122 + width: 320px;
  123 + border: 1px solid #DDDDDD;
  124 + font-family:Tahoma, Arial, Helvetica, sans-serif;
  125 + font-size:14px;
  126 + font-weight: bold;
  127 + color:#333399;
  128 + padding: 2px;
  129 +}
  130 +.dialogs {
  131 + font-size: 11px;
  132 + color:#333399;
  133 + font-family:Verdana, Arial, Helvetica, sans-serif
  134 +}
  135 +.setttings_heading {
  136 + padding: 2px 10px 2px 2px;
  137 + text-align:right;
  138 + font-family:Arial, Helvetica, sans-serif;
  139 + font-size:12px;
  140 + font-weight: bold;
  141 + border-right:1px solid #3333CC;
  142 +}
  143 +
  144 +.settings_indicator{
  145 + padding:5px;
  146 + text-align:center;
  147 + width: 20px;
  148 +}
  149 +</style>
148 150 </head>
149 151 <body>
150   - <table id="container" class="mainTable ui-tabs ui-widget ui-widget-content ui-corner-all" align="center">
151   - <tr><td class="header">KnowledgeTree AtomPub Client</td></tr>
152   - <tr><td class="perspectivesbar"></td></tr>
153   - <tr>
154   - <td>
155   - <div id="perspectives" style="display:block;">
156   - <ul>
157   - <li><a href="#perspective_Folders" class="TabText">Explore</a></li>
158   - <li><a href="#perspective_Settings" class="TabText">Settings</a></li>
159   - <li><a href="#perspective_Comms" class="TabText">Comms</a></li>
160   - </ul>
161   -
162   - <div id="perspective_Folders" class="info_panel_container">
163   - <table width="100%" height="500" cellpadding="0" cellspacing="5">
164   - <tr>
165   - <td width="402" id="" class="ui-widget-content ui-corner-all" style="font-size: 12px; font-weight:bold; vertical-align:top; overflow:scroll;"><span id="folder_loading_icon" style="float:right; display:none; padding: 10px"><img src="js/skin/loading.gif" alt="Loading.. Please Wait" width="16" height="16"/></span>
166   - <div class="tree_panel_scrollbar_hider">
167   - <div id="perspective_folder_view" class="tree_panel_area"></div>
168   - </div></td>
169   - <td width="597" valign="top" class="ui-tabs ui-widget ui-widget-content ui-corner-all">
170   - <div id="info_pane_toolbar" class="fg-toolbar ui-widget-header ui-corner-all ui-helper-clearfix info_panel_toolbar">
171   - <div class="fg-buttonset fg-buttonset-single ui-helper-clearfix" style="font-size: 12px; padding:3px;"> </div>
172   - </div>
173   - <div class="info_panel_scrollbar_hider">
174   - <div class="info_panel_area">
175   -
176   -
177   -
178   -
179   -<!-- FOLDER INFO PANE -->
180   - <div id="panel_folder_info">
181   - <table width="100%" border="0" cellpadding="0" cellspacing="0">
182   - <tr>
183   - <td class="info_panel_heading">Folder Info</td>
184   - </tr>
185   - <tr>
186   - <td><table width="100%" border="0" cellpadding="0" cellspacing="0">
187   - <tr>
188   - <td width="150" class="info_panel_field_name">Id</td>
189   - <td class="info_panel_field_value folder_id">&nbsp;</td>
190   - </tr>
191   - <tr>
192   - <td class="info_panel_field_name ">Name</td>
193   - <td class="info_panel_field_value folder_name">&nbsp;</td>
194   - </tr>
195   - <tr>
196   - <td class="info_panel_field_name">Full Path</td>
197   - <td class="info_panel_field_value folder_path">&nbsp;</td>
198   - </tr>
199   - <tr>
200   - <td class="info_panel_field_name">Permissions</td>
201   - <td class="info_panel_field_value folder_permissions">&nbsp;</td>
202   - </tr>
203   - <tr>
204   - <td>&nbsp;</td>
205   - <td>&nbsp;</td>
206   - </tr>
207   - </table></td>
208   - </tr>
209   - </table>
210   - </div>
211   -
212   -
213   -
214   -
215   -<!-- DOCUMENT INFO PANE -->
216   - <div id="panel_document_info" class="info_panel_container">
217   - <table width="100%" border="0" cellpadding="0" cellspacing="0">
218   - <tr>
219   - <td width="100%" class="info_panel_heading">Document Info</td>
220   - </tr>
221   - <tr>
222   - <td><table width="100%" border="0" cellpadding="0" cellspacing="0">
223   - <tr>
224   - <td width="150" class="info_panel_field_name">Id</td>
225   - <td class="info_panel_field_value document_id">&nbsp;</td>
226   - </tr>
227   - <tr>
228   - <td class="info_panel_field_name ">Title</td>
229   - <td class="info_panel_field_value document_title">&nbsp;</td>
230   - </tr>
231   - <tr>
232   - <td class="info_panel_field_name">File Name</td>
233   - <td class="info_panel_field_value document_filename">&nbsp;</td>
234   - </tr>
235   - <tr>
236   - <td class="info_panel_field_name">Document Type</td>
237   - <td class="info_panel_field_value document_type">&nbsp;</td>
238   - </tr>
239   - <tr>
240   - <td class="info_panel_field_name">Custom Document No.</td>
241   - <td class="info_panel_field_value document_custom_no">&nbsp;</td>
242   - </tr>
243   - <tr>
244   - <td class="info_panel_field_name">OEM Document No.</td>
245   - <td class="info_panel_field_value document_oem_no">&nbsp;</td>
246   - </tr>
247   - <tr>
248   - <td class="info_panel_field_name">File Size</td>
249   - <td class="info_panel_field_value document_file_size">&nbsp;</td>
250   - </tr>
251   - <tr>
252   - <td class="info_panel_field_name">Full Path</td>
253   - <td class="info_panel_field_value document_full_path">&nbsp;</td>
254   - </tr>
255   - <tr>
256   - <td class="info_panel_field_name">Created By</td>
257   - <td class="info_panel_field_value document_created_by">&nbsp;</td>
258   - </tr>
259   - <tr>
260   - <td class="info_panel_field_name">Created Date</td>
261   - <td class="info_panel_field_value document_created_on">&nbsp;</td>
262   - </tr>
263   - <tr>
264   - <td class="info_panel_field_name">Checked out By</td>
265   - <td class="info_panel_field_value document_checkout_by">&nbsp;</td>
266   - </tr>
267   - <tr>
268   - <td class="info_panel_field_name">Checkout Date</td>
269   - <td class="info_panel_field_value document_checkout_on">&nbsp;</td>
270   - </tr>
271   - <tr>
272   - <td class="info_panel_field_name">Modified By</td>
273   - <td class="info_panel_field_value document_modified_by">&nbsp;</td>
274   - </tr>
275   - <tr>
276   - <td class="info_panel_field_name">Modified Date</td>
277   - <td class="info_panel_field_value document_modified_on">&nbsp;</td>
278   - </tr>
279   - <tr>
280   - <td class="info_panel_field_name">Owned by</td>
281   - <td class="info_panel_field_value document_owned_by">&nbsp;</td>
282   - </tr>
283   - <tr>
284   - <td class="info_panel_field_name">Version</td>
285   - <td class="info_panel_field_value document_version">&nbsp;</td>
286   - </tr>
287   - <tr>
288   - <td class="info_panel_field_name">Content ID</td>
289   - <td class="info_panel_field_value document_content_id">&nbsp;</td>
290   - </tr>
291   - <tr>
292   - <td class="info_panel_field_name">Is Immutable</td>
293   - <td class="info_panel_field_value document_immutable">&nbsp;</td>
294   - </tr>
295   - <tr>
296   - <td class="info_panel_field_name">Permissions</td>
297   - <td class="info_panel_field_value document_permissions">&nbsp;</td>
298   - </tr>
299   - <tr>
300   - <td class="info_panel_field_name">Workflow</td>
301   - <td class="info_panel_field_value document_workflow">&nbsp;</td>
302   - </tr>
303   - <tr>
304   - <td class="info_panel_field_name">Workflow State</td>
305   - <td class="info_panel_field_value document_workflow_state">&nbsp;</td>
306   - </tr>
307   - <tr>
308   - <td class="info_panel_field_name">Mime Type</td>
309   - <td class="info_panel_field_value document_mime_type">&nbsp;</td>
310   - </tr>
311   - <tr>
312   - <td class="info_panel_field_name">Mime Display</td>
313   - <td class="info_panel_field_value document_mime_display">&nbsp;</td>
314   - </tr>
315   - <tr>
316   - <td class="info_panel_field_name">Storage Path</td>
317   - <td class="info_panel_field_value document_storage_path">&nbsp;</td>
318   - </tr>
319   -
320   - </table></td>
321   - </tr>
322   - </table>
323   - </div>
324   -
325   -
326   -
327   -
328   -<!-- DOCUMENT EDIT PANE -->
329   - <div id="panel_document_info_edit" class="info_panel_container">
330   - <table width="100%" border="0" cellpadding="0" cellspacing="0">
331   - <tr>
332   - <td width="585" class="info_panel_heading">Document Info</td>
333   - </tr>
334   - <tr>
335   - <td><table width="100%" border="0" cellpadding="0" cellspacing="0">
336   - <tr>
337   - <td width="150" class="info_panel_field_name">Id</td>
338   - <td class="info_panel_field_value"><input id="" class="document_id" type="text" /></td>
339   - </tr>
340   - <tr>
341   - <td class="info_panel_field_name ">Title</td>
342   - <td class="info_panel_field_value"><input id="" class="document_title" type="text" /></td>
343   - </tr>
344   - <tr>
345   - <td class="info_panel_field_name">File Name</td>
346   - <td class="info_panel_field_value"><input id="" class="document_filename" type="text" /></td>
347   - </tr>
348   - <tr>
349   - <td class="info_panel_field_name">Document Type</td>
350   - <td class="info_panel_field_value"><input id="" class="document_type" type="text" /></td>
351   - </tr>
352   - <tr>
353   - <td class="info_panel_field_name">Custom Document No.</td>
354   - <td class="info_panel_field_value"><input id="" class="document_custom_no" type="text" /></td>
355   - </tr>
356   - <tr>
357   - <td class="info_panel_field_name">OEM Document No.</td>
358   - <td class="info_panel_field_value"><input id="" class="document_oem_no" type="text" /></td>
359   - </tr>
360   - <tr>
361   - <td class="info_panel_field_name">File Size</td>
362   - <td class="info_panel_field_value"><input id="" class="document_file_size" type="text" /></td>
363   - </tr>
364   - <tr>
365   - <td class="info_panel_field_name">Full Path</td>
366   - <td class="info_panel_field_value"><input id="" class="document_full_path" type="text" /></td>
367   - </tr>
368   - <tr>
369   - <td class="info_panel_field_name">Created By</td>
370   - <td class="info_panel_field_value"><input id="" class="document_created_by" type="text" /></td>
371   - </tr>
372   - <tr>
373   - <td class="info_panel_field_name">Created Date</td>
374   - <td class="info_panel_field_value"><input id="" class="document_created_on" type="text" /></td>
375   - </tr>
376   - <tr>
377   - <td class="info_panel_field_name">Checked out By</td>
378   - <td class="info_panel_field_value"><input id="" class="document_checkout_by" type="text" /></td>
379   - </tr>
380   - <tr>
381   - <td class="info_panel_field_name">Checkout Date</td>
382   - <td class="info_panel_field_value"><input id="" class="document_checkout_on" type="text" /></td>
383   - </tr>
384   - <tr>
385   - <td class="info_panel_field_name">Modified By</td>
386   - <td class="info_panel_field_value"><input id="" class="document_modified_by" type="text" /></td>
387   - </tr>
388   - <tr>
389   - <td class="info_panel_field_name">Modified Date</td>
390   - <td class="info_panel_field_value"><input id="" class="document_modified_on" type="text" /></td>
391   - </tr>
392   - <tr>
393   - <td class="info_panel_field_name">Owned by</td>
394   - <td class="info_panel_field_value"><input id="" class="document_owned_by" type="text" /></td>
395   - </tr>
396   - <tr>
397   - <td class="info_panel_field_name">Version</td>
398   - <td class="info_panel_field_value"><input id="" class="document_version" type="text" /></td>
399   - </tr>
400   - <tr>
401   - <td class="info_panel_field_name">Content ID</td>
402   - <td class="info_panel_field_value"><input id="" class="document_content_id" type="text" /></td>
403   - </tr>
404   - <tr>
405   - <td class="info_panel_field_name">Is Immutable</td>
406   - <td class="info_panel_field_value"><input id="" class="document_immutable" type="text" /></td>
407   - </tr>
408   - <tr>
409   - <td class="info_panel_field_name">Permissions</td>
410   - <td class="info_panel_field_value"><input id="" class="document_permissions" type="text" /></td>
411   - </tr>
412   - <tr>
413   - <td class="info_panel_field_name">Workflow</td>
414   - <td class="info_panel_field_value"><input id="" class="document_workflow" type="text" /></td>
415   - </tr>
416   - <tr>
417   - <td class="info_panel_field_name">Workflow State</td>
418   - <td class="info_panel_field_value"><input id="" class="document_workflow_state" type="text" /></td>
419   - </tr>
420   - <tr>
421   - <td class="info_panel_field_name">Mime Type</td>
422   - <td class="info_panel_field_value"><input id="" class="document_mime_type" type="text" /></td>
423   - </tr>
424   - <tr>
425   - <td class="info_panel_field_name">Mime Display</td>
426   - <td class="info_panel_field_value"><input id="" class="document_mime_display" type="text" /></td>
427   - </tr>
428   - <tr>
429   - <td class="info_panel_field_name">Storage Path</td>
430   - <td class="info_panel_field_value"><input id="" class="document_storage_path" type="text" /></td>
431   - </tr>
432   -
433   - </table></td>
434   - </tr>
435   - </table>
436   - </div>
437   -
438   -
439   -
440   -
441   -<!-- FOLDER EDIT PANE -->
442   -
443   -
444   -
445   -
446   -<!-- FOLDER INFO PANE -->
447   -
448   -
449   -
450   -
451   -<!-- FOLDER INFO PANE -->
452   - </div>
453   - </div> </td>
454   - </tr>
455   - </table>
456   - </div>
457   -
458   -
459   -
460   -
461   - <div id="perspective_Settings" style=" padding: 5px;">
462   - <div class="ui-widget-content ui-corner-all" style="height:500px; padding: 15px; font-size: 12px;">
463   - <div class="settingsRow_nodivider">
464   -<div class="fg-buttonset fg-buttonset-single ui-helper-clearfix" style="width:100%;">
465   - <div id="clear_settings_cache" class="fg-button ui-state-default ui-priority-primary ui-corner-all" style="width: 100px; border: 1px solid #BBBBBB; padding:2px; cursor:pointer;"><span style="display: inline; padding-right: 20px;" class="ui-icon ui-icon-refresh"/></span><span>Clear Cache</span></div>
466   - </div> </div>
467   - <div class="settingsRow">
468   - <span style="width: 500px; text-align:right; padding: 5px 10px 5px 5px; margin-right: 10px; border-right: 1px solid #CCCCCC;">KT Atompub Server URL</span><input type="text" id="settings_baseurl" value="" style="width: 520px;" />
469   - </div>
470   - <div class="settingsRow">
471   - <span style="width: 300px; text-align:right; padding: 5px 10px 5px 5px; margin-right: 10px; border-right: 1px solid #CCCCCC;">Document Tree Service</span>
472   - <input type="text" id="settings_service_treestruct" value="" style="width: 520px;" />
473   - </div>
474   - <div class="settingsRow">
475   - <span style="width: 300px; text-align:right; padding: 5px 10px 5px 5px; margin-right: 10px; border-right: 1px solid #CCCCCC;">Folder Info Service</span>
476   - <input type="text" id="settings_service_folderinfo" value="" style="width: 520px;" />
477   - </div>
478   - <div class="settingsRow">
479   - <span style="width: 300px; text-align:right; padding: 5px 10px 5px 5px; margin-right: 10px; border-right: 1px solid #CCCCCC;">Document Info Service</span>
480   - <input type="text" id="settings_service_docinfo" value="" style="width: 520px;" />
481   - </div>
482   - </div>
483   - </div>
484   -
485   - <div id="perspective_Comms" style=" padding: 5px;">
486   - <div class="ui-widget-content ui-corner-all" style="height:500px; padding: 15px; font-size: 12px;">
487   - <div class="settingsRow_nodivider">
488   - <div class="fg-toolbar ui-widget-header ui-corner-all ui-helper-clearfix" style="width:100%; padding: 3px;">
489   - <div class="fg-buttonset fg-buttonset-single ui-helper-clearfix">
490   - <div id="comms_clear_cache" class="fg-button ui-state-default ui-priority-primary ui-corner-all" style="width: 220px; border: 1px solid #BBBBBB; padding:2px; cursor:pointer;" onclick="events.trigger('comms_clear_cache');"><span style="display: inline; padding-right: 20px;" class="ui-icon ui-icon-refresh"/></span><span>Clear all Communication Data</span></div>
491   - </div>
492   - </div>
493   - </div>
494   - <div style="height: 450px;">
495   - <textarea name="panel_comms" id="panel_comms" style="width:100%; height:448px; border: none; font-family:'Courier New', Courier, monospace; font-size: 10px;"></textarea>
496   - </div>
497   - </div>
498   - </div>
499   - </div> </td>
500   - </tr>
501   - </table>
502   -
503   -
  152 +<table id="container" class="mainTable ui-tabs ui-widget ui-widget-content ui-corner-all" align="center">
  153 + <tr>
  154 + <td class="header">KnowledgeTree AtomPub Client</td>
  155 + </tr>
  156 + <tr>
  157 + <td class="perspectivesbar"></td>
  158 + </tr>
  159 + <tr>
  160 + <td><div id="perspectives" style="display:block;">
  161 + <ul>
  162 + <li><a href="#perspective_Folders" class="TabText">Explore</a></li>
  163 + <li><a href="#perspective_Settings" class="TabText">Settings</a></li>
  164 + <li><a href="#perspective_Comms" class="TabText">Comms</a></li>
  165 + </ul>
  166 + <div id="perspective_Folders" class="info_panel_container">
  167 + <table width="100%" height="500" cellpadding="0" cellspacing="5">
  168 + <tr>
  169 + <td width="402" id="" class="ui-widget-content ui-corner-all" style="font-size: 12px; font-weight:bold; vertical-align:top; overflow:scroll;"><span id="folder_loading_icon" style="float:right; display:none; padding: 10px"><img src="js/jquery/plugins/skin/loading.gif" alt="Loading.. Please Wait" width="16" height="16"/></span> <div class="tree_panel_scrollbar_hider">
  170 + <div id="perspective_folder_view" class="tree_panel_area"></div>
  171 + </div>
  172 +</td>
  173 + <td width="597" valign="top" class="ui-tabs ui-widget ui-widget-content ui-corner-all"><div id="info_pane_toolbar" class="fg-toolbar ui-widget-header ui-corner-all ui-helper-clearfix info_panel_toolbar">
  174 + <div class="fg-buttonset fg-buttonset-single ui-helper-clearfix" style="font-size: 12px; padding:3px;"> </div>
  175 + </div>
  176 + <div class="info_panel_scrollbar_hider">
  177 + <div class="info_panel_area">
  178 + <!-- FOLDER INFO PANE -->
  179 + <div id="panel_folder_info">
  180 + <table width="100%" border="0" cellpadding="0" cellspacing="0">
  181 + <tr>
  182 + <td class="info_panel_heading">Folder Info</td>
  183 + </tr>
  184 + <tr>
  185 + <td><table width="100%" border="0" cellpadding="0" cellspacing="0">
  186 + <tr>
  187 + <td width="150" class="info_panel_field_name">Id</td>
  188 + <td class="info_panel_field_value folder_id">&nbsp;</td>
  189 + </tr>
  190 + <tr>
  191 + <td class="info_panel_field_name ">Name</td>
  192 + <td class="info_panel_field_value folder_name">&nbsp;</td>
  193 + </tr>
  194 + <tr>
  195 + <td class="info_panel_field_name">Full Path</td>
  196 + <td class="info_panel_field_value folder_path">&nbsp;</td>
  197 + </tr>
  198 + <tr>
  199 + <td class="info_panel_field_name">Permissions</td>
  200 + <td class="info_panel_field_value folder_permissions">&nbsp;</td>
  201 + </tr>
  202 + <tr>
  203 + <td>&nbsp;</td>
  204 + <td>&nbsp;</td>
  205 + </tr>
  206 + </table></td>
  207 + </tr>
  208 + </table>
  209 + </div>
  210 + <!-- DOCUMENT INFO PANE -->
  211 + <div id="panel_document_info" class="info_panel_container">
  212 + <table width="100%" border="0" cellpadding="0" cellspacing="0">
  213 + <tr>
  214 + <td width="100%" class="info_panel_heading">Document Info</td>
  215 + </tr>
  216 + <tr>
  217 + <td><table width="100%" border="0" cellpadding="0" cellspacing="0">
  218 + <tr>
  219 + <td width="150" class="info_panel_field_name">Id</td>
  220 + <td class="info_panel_field_value document_id">&nbsp;</td>
  221 + </tr>
  222 + <tr>
  223 + <td class="info_panel_field_name ">Title</td>
  224 + <td class="info_panel_field_value document_title">&nbsp;</td>
  225 + </tr>
  226 + <tr>
  227 + <td class="info_panel_field_name">File Name</td>
  228 + <td class="info_panel_field_value document_filename">&nbsp;</td>
  229 + </tr>
  230 + <tr>
  231 + <td class="info_panel_field_name">Document Type</td>
  232 + <td class="info_panel_field_value document_type">&nbsp;</td>
  233 + </tr>
  234 + <tr>
  235 + <td class="info_panel_field_name">Custom Document No.</td>
  236 + <td class="info_panel_field_value document_custom_no">&nbsp;</td>
  237 + </tr>
  238 + <tr>
  239 + <td class="info_panel_field_name">OEM Document No.</td>
  240 + <td class="info_panel_field_value document_oem_no">&nbsp;</td>
  241 + </tr>
  242 + <tr>
  243 + <td class="info_panel_field_name">File Size</td>
  244 + <td class="info_panel_field_value document_file_size">&nbsp;</td>
  245 + </tr>
  246 + <tr>
  247 + <td class="info_panel_field_name">Full Path</td>
  248 + <td class="info_panel_field_value document_full_path">&nbsp;</td>
  249 + </tr>
  250 + <tr>
  251 + <td class="info_panel_field_name">Created By</td>
  252 + <td class="info_panel_field_value document_created_by">&nbsp;</td>
  253 + </tr>
  254 + <tr>
  255 + <td class="info_panel_field_name">Created Date</td>
  256 + <td class="info_panel_field_value document_created_on">&nbsp;</td>
  257 + </tr>
  258 + <tr>
  259 + <td class="info_panel_field_name">Checked out By</td>
  260 + <td class="info_panel_field_value document_checkout_by">&nbsp;</td>
  261 + </tr>
  262 + <tr>
  263 + <td class="info_panel_field_name">Checkout Date</td>
  264 + <td class="info_panel_field_value document_checkout_on">&nbsp;</td>
  265 + </tr>
  266 + <tr>
  267 + <td class="info_panel_field_name">Modified By</td>
  268 + <td class="info_panel_field_value document_modified_by">&nbsp;</td>
  269 + </tr>
  270 + <tr>
  271 + <td class="info_panel_field_name">Modified Date</td>
  272 + <td class="info_panel_field_value document_modified_on">&nbsp;</td>
  273 + </tr>
  274 + <tr>
  275 + <td class="info_panel_field_name">Owned by</td>
  276 + <td class="info_panel_field_value document_owned_by">&nbsp;</td>
  277 + </tr>
  278 + <tr>
  279 + <td class="info_panel_field_name">Version</td>
  280 + <td class="info_panel_field_value document_version">&nbsp;</td>
  281 + </tr>
  282 + <tr>
  283 + <td class="info_panel_field_name">Content ID</td>
  284 + <td class="info_panel_field_value document_content_id">&nbsp;</td>
  285 + </tr>
  286 + <tr>
  287 + <td class="info_panel_field_name">Is Immutable</td>
  288 + <td class="info_panel_field_value document_immutable">&nbsp;</td>
  289 + </tr>
  290 + <tr>
  291 + <td class="info_panel_field_name">Permissions</td>
  292 + <td class="info_panel_field_value document_permissions">&nbsp;</td>
  293 + </tr>
  294 + <tr>
  295 + <td class="info_panel_field_name">Workflow</td>
  296 + <td class="info_panel_field_value document_workflow">&nbsp;</td>
  297 + </tr>
  298 + <tr>
  299 + <td class="info_panel_field_name">Workflow State</td>
  300 + <td class="info_panel_field_value document_workflow_state">&nbsp;</td>
  301 + </tr>
  302 + <tr>
  303 + <td class="info_panel_field_name">Mime Type</td>
  304 + <td class="info_panel_field_value document_mime_type">&nbsp;</td>
  305 + </tr>
  306 + <tr>
  307 + <td class="info_panel_field_name">Mime Display</td>
  308 + <td class="info_panel_field_value document_mime_display">&nbsp;</td>
  309 + </tr>
  310 + <tr>
  311 + <td class="info_panel_field_name">Storage Path</td>
  312 + <td class="info_panel_field_value document_storage_path">&nbsp;</td>
  313 + </tr>
  314 + </table></td>
  315 + </tr>
  316 + </table>
  317 + </div>
  318 + <!-- DOCUMENT EDIT PANE -->
  319 + <div id="panel_document_info_edit" class="info_panel_container">
  320 + <table width="100%" border="0" cellpadding="0" cellspacing="0">
  321 + <tr>
  322 + <td width="585" class="info_panel_heading">Document Info</td>
  323 + </tr>
  324 + <tr>
  325 + <td><table width="100%" border="0" cellpadding="0" cellspacing="0">
  326 + <tr>
  327 + <td width="150" class="info_panel_field_name">Id</td>
  328 + <td class="info_panel_field_value"><input id="" class="document_id" type="text" /></td>
  329 + </tr>
  330 + <tr>
  331 + <td class="info_panel_field_name ">Title</td>
  332 + <td class="info_panel_field_value"><input id="" class="document_title" type="text" /></td>
  333 + </tr>
  334 + <tr>
  335 + <td class="info_panel_field_name">File Name</td>
  336 + <td class="info_panel_field_value"><input id="" class="document_filename" type="text" /></td>
  337 + </tr>
  338 + <tr>
  339 + <td class="info_panel_field_name">Document Type</td>
  340 + <td class="info_panel_field_value"><input id="" class="document_type" type="text" /></td>
  341 + </tr>
  342 + <tr>
  343 + <td class="info_panel_field_name">Custom Document No.</td>
  344 + <td class="info_panel_field_value"><input id="" class="document_custom_no" type="text" /></td>
  345 + </tr>
  346 + <tr>
  347 + <td class="info_panel_field_name">OEM Document No.</td>
  348 + <td class="info_panel_field_value"><input id="" class="document_oem_no" type="text" /></td>
  349 + </tr>
  350 + <tr>
  351 + <td class="info_panel_field_name">File Size</td>
  352 + <td class="info_panel_field_value"><input id="" class="document_file_size" type="text" /></td>
  353 + </tr>
  354 + <tr>
  355 + <td class="info_panel_field_name">Full Path</td>
  356 + <td class="info_panel_field_value"><input id="" class="document_full_path" type="text" /></td>
  357 + </tr>
  358 + <tr>
  359 + <td class="info_panel_field_name">Created By</td>
  360 + <td class="info_panel_field_value"><input id="" class="document_created_by" type="text" /></td>
  361 + </tr>
  362 + <tr>
  363 + <td class="info_panel_field_name">Created Date</td>
  364 + <td class="info_panel_field_value"><input id="" class="document_created_on" type="text" /></td>
  365 + </tr>
  366 + <tr>
  367 + <td class="info_panel_field_name">Checked out By</td>
  368 + <td class="info_panel_field_value"><input id="" class="document_checkout_by" type="text" /></td>
  369 + </tr>
  370 + <tr>
  371 + <td class="info_panel_field_name">Checkout Date</td>
  372 + <td class="info_panel_field_value"><input id="" class="document_checkout_on" type="text" /></td>
  373 + </tr>
  374 + <tr>
  375 + <td class="info_panel_field_name">Modified By</td>
  376 + <td class="info_panel_field_value"><input id="" class="document_modified_by" type="text" /></td>
  377 + </tr>
  378 + <tr>
  379 + <td class="info_panel_field_name">Modified Date</td>
  380 + <td class="info_panel_field_value"><input id="" class="document_modified_on" type="text" /></td>
  381 + </tr>
  382 + <tr>
  383 + <td class="info_panel_field_name">Owned by</td>
  384 + <td class="info_panel_field_value"><input id="" class="document_owned_by" type="text" /></td>
  385 + </tr>
  386 + <tr>
  387 + <td class="info_panel_field_name">Version</td>
  388 + <td class="info_panel_field_value"><input id="" class="document_version" type="text" /></td>
  389 + </tr>
  390 + <tr>
  391 + <td class="info_panel_field_name">Content ID</td>
  392 + <td class="info_panel_field_value"><input id="" class="document_content_id" type="text" /></td>
  393 + </tr>
  394 + <tr>
  395 + <td class="info_panel_field_name">Is Immutable</td>
  396 + <td class="info_panel_field_value"><input id="" class="document_immutable" type="text" /></td>
  397 + </tr>
  398 + <tr>
  399 + <td class="info_panel_field_name">Permissions</td>
  400 + <td class="info_panel_field_value"><input id="" class="document_permissions" type="text" /></td>
  401 + </tr>
  402 + <tr>
  403 + <td class="info_panel_field_name">Workflow</td>
  404 + <td class="info_panel_field_value"><input id="" class="document_workflow" type="text" /></td>
  405 + </tr>
  406 + <tr>
  407 + <td class="info_panel_field_name">Workflow State</td>
  408 + <td class="info_panel_field_value"><input id="" class="document_workflow_state" type="text" /></td>
  409 + </tr>
  410 + <tr>
  411 + <td class="info_panel_field_name">Mime Type</td>
  412 + <td class="info_panel_field_value"><input id="" class="document_mime_type" type="text" /></td>
  413 + </tr>
  414 + <tr>
  415 + <td class="info_panel_field_name">Mime Display</td>
  416 + <td class="info_panel_field_value"><input id="" class="document_mime_display" type="text" /></td>
  417 + </tr>
  418 + <tr>
  419 + <td class="info_panel_field_name">Storage Path</td>
  420 + <td class="info_panel_field_value"><input id="" class="document_storage_path" type="text" /></td>
  421 + </tr>
  422 + </table></td>
  423 + </tr>
  424 + </table>
  425 + </div>
  426 + <!-- FOLDER EDIT PANE -->
  427 + <!-- FOLDER INFO PANE -->
  428 + <!-- FOLDER INFO PANE -->
  429 + </div>
  430 + </div></td>
  431 + </tr>
  432 + </table>
  433 + </div>
  434 + <div id="perspective_Settings" style=" padding: 5px;">
  435 + <div class="ui-widget-content ui-corner-all" style="height:500px; padding: 15px; font-size: 12px;">
  436 + <div class="settingsRow_nodivider">
  437 + <div class="fg-buttonset fg-buttonset-single ui-helper-clearfix" style="width:100%;">
  438 + <div id="clear_settings_cache" class="fg-button ui-state-default ui-priority-primary ui-corner-all" style="width: 100px; border: 1px solid #BBBBBB; padding:2px; cursor:pointer;"><span style="display: inline; padding-right: 20px;" class="ui-icon ui-icon-refresh"/></span><span>Clear Cache</span></div>
  439 + </div>
  440 + </div>
  441 + <div class="settingsRow"> <span style="width: 500px; text-align:right; padding: 5px 10px 5px 5px; margin-right: 10px; border-right: 1px solid #CCCCCC;">KT Atompub Server URL</span>
  442 + <input type="text" id="settings_baseurl" value="" style="width: 520px;" />
  443 + </div>
  444 + <div class="settingsRow"> <span style="width: 300px; text-align:right; padding: 5px 10px 5px 5px; margin-right: 10px; border-right: 1px solid #CCCCCC;">Document Tree Service</span>
  445 + <input type="text" id="settings_service_treestruct" value="" style="width: 520px;" />
  446 + </div>
  447 + <div class="settingsRow"> <span style="width: 300px; text-align:right; padding: 5px 10px 5px 5px; margin-right: 10px; border-right: 1px solid #CCCCCC;">Folder Info Service</span>
  448 + <input type="text" id="settings_service_folderinfo" value="" style="width: 520px;" />
  449 + </div>
  450 + <div class="settingsRow"> <span style="width: 300px; text-align:right; padding: 5px 10px 5px 5px; margin-right: 10px; border-right: 1px solid #CCCCCC;">Document Info Service</span>
  451 + <input type="text" id="settings_service_docinfo" value="" style="width: 520px;" />
  452 + </div>
  453 + </div>
  454 + </div>
  455 + <div id="perspective_Comms" style=" padding: 5px;">
  456 + <div class="ui-widget-content ui-corner-all" style="height:500px; padding: 15px; font-size: 12px;">
  457 + <div class="settingsRow_nodivider">
  458 + <div class="fg-toolbar ui-widget-header ui-corner-all ui-helper-clearfix" style="width:100%; padding: 3px;">
  459 + <div class="fg-buttonset fg-buttonset-single ui-helper-clearfix">
  460 + <div id="comms_clear_cache" class="fg-button ui-state-default ui-priority-primary ui-corner-all" style="width: 220px; border: 1px solid #BBBBBB; padding:2px; cursor:pointer;" onclick="events.trigger('comms_clear_cache');"><span style="display: inline; padding-right: 20px;" class="ui-icon ui-icon-refresh"/></span><span>Clear all Communication Data</span></div>
  461 + </div>
  462 + </div>
  463 + </div>
  464 + <div style="height: 450px;">
  465 + <textarea name="panel_comms" id="panel_comms" style="width:100%; height:448px; border: none; font-family:'Courier New', Courier, monospace; font-size: 10px;"></textarea>
  466 + </div>
  467 + </div>
  468 + </div>
  469 + </div></td>
  470 + </tr>
  471 +</table>
504 472 <!-- Toolbars -->
505 473 <div id="toolbars" style="display:none;">
506   - <!-- Visible on view document info -->
507   - <div id="info_panel_toolbar_viewDocument">
508   - <div class="fg-buttonset fg-buttonset-single ui-helper-clearfix" style="font-size: 12px; padding:3px;">
509   - <span id="" onclick="events.trigger('panel.document.edit.show')" class="fg-button ui-state-default ui-priority-primary ui-corner-all" style="width: 100px; border: 1px solid #BBBBBB; padding:2px; cursor:pointer;"><span style="display: inline; padding-right: 15px;" class="ui-icon ui-icon-pencil"/></span><span style="padding-left:5px;">Edit</span></span>
510   - <span id="" onclick="events.trigger('panel.document.action.checkout')" class="fg-button ui-state-default ui-priority-primary ui-corner-all" style="width: 100px; border: 1px solid #BBBBBB; padding:2px; cursor:pointer;"><span style="display: inline; padding-right: 15px;" class="ui-icon ui-icon-cart"/></span><span style="padding-left:5px;">Checkout</span></span>
511   - <span id="" onclick="events.trigger('panel.document.action.delete')" class="fg-button ui-state-default ui-priority-primary ui-corner-all" style="width: 100px; border: 1px solid #BBBBBB; padding:2px; cursor:pointer;"><span style="display: inline; padding-right: 15px;" class="ui-icon ui-icon-circle-close"/></span><span style="padding-left:5px;">Delete</span></span>
512   - <span id="" onclick="events.trigger('panel.document.action.download')" class="fg-button ui-state-default ui-priority-primary ui-corner-all" style="width: 100px; border: 1px solid #BBBBBB; padding:2px; cursor:pointer;"><span style="display: inline; padding-right: 15px;" class="ui-icon ui-icon-circle-arrow-s"/></span><span style="padding-left:5px;">Download</span></span>
513   - </div>
514   - </div>
515   - <!-- Visible on edit document info -->
516   - <div id="info_panel_toolbar_editDocument">
517   - <div class="fg-buttonset fg-buttonset-single ui-helper-clearfix" style="font-size: 12px; padding:3px;">
518   - <span id="" onclick="events.trigger('panel.document.info.show')" class="fg-button ui-state-default ui-priority-primary ui-corner-all" style="width: 100px; border: 1px solid #BBBBBB; padding:2px; cursor:pointer;"><span style="display: inline; padding-right: 15px;" class="ui-icon ui-icon-cancel"/></span><span style="padding-left:5px;">Cancel Edit</span></span>
519   - <span id="" onclick="events.trigger('panel.document.action.save')" class="fg-button ui-state-default ui-priority-primary ui-corner-all" style="width: 100px; border: 1px solid #BBBBBB; padding:2px; cursor:pointer;"><span style="display: inline; padding-right: 15px;" class="ui-icon ui-icon-check"/></span><span style="padding-left:5px;">Save</span></span>
520   - <span id="" onclick="events.trigger('panel.document.action.delete')" class="fg-button ui-state-default ui-priority-primary ui-corner-all" style="width: 100px; border: 1px solid #BBBBBB; padding:2px; cursor:pointer;"><span style="display: inline; padding-right: 15px;" class="ui-icon ui-icon-circle-close"/></span><span style="padding-left:5px;">Delete</span></span>
521   - </div>
522   - </div>
523   - <!-- Visible on view folder info -->
524   - <div id="info_panel_toolbar_viewFolder">
525   - <div class="fg-buttonset fg-buttonset-single ui-helper-clearfix" style="font-size: 12px; padding:3px;">
526   - <span id="" onclick="events.trigger('panel.folder.edit.show')" class="fg-button ui-state-default ui-priority-primary ui-corner-all" style="width: 100px; border: 1px solid #BBBBBB; padding:2px; cursor:pointer;"><span style="display: inline; padding-right: 15px;" class="ui-icon ui-icon-pencil"/></span><span style="padding-left:5px;">Edit</span></span>
527   - <span id="" onclick="events.trigger('panel.folder.action.move')" class="fg-button ui-state-default ui-priority-primary ui-corner-all" style="width: 100px; border: 1px solid #BBBBBB; padding:2px; cursor:pointer;"><span style="display: inline; padding-right: 15px;" class="ui-icon ui-icon-circle-arrow-e"/></span><span style="padding-left:5px;">Move</span></span>
528   - </div>
529   - </div>
530   - <!-- Visible on edit folder info -->
531   - <div id="info_panel_toolbar_editFolder">
532   - <div class="fg-buttonset fg-buttonset-single ui-helper-clearfix" style="font-size: 12px; padding:3px;">
533   - <span id="" onclick="events.trigger('panel.folder.info.show')" class="fg-button ui-state-default ui-priority-primary ui-corner-all" style="width: 100px; border: 1px solid #BBBBBB; padding:2px; cursor:pointer;"><span style="display: inline; padding-right: 15px;" class="ui-icon ui-icon-cancel"/></span><span style="padding-left:5px;">Cancel Edit</span></span>
534   - <span id="" onclick="events.trigger('panel.folder.action.save')" class="fg-button ui-state-default ui-priority-primary ui-corner-all" style="width: 100px; border: 1px solid #BBBBBB; padding:2px; cursor:pointer;"><span style="display: inline; padding-right: 15px;" class="ui-icon ui-icon-check"/></span><span style="padding-left:5px;">Save</span></span>
535   - </div>
536   - </div>
  474 + <!-- Visible on view document info -->
  475 + <div id="info_panel_toolbar_viewDocument">
  476 + <div class="fg-buttonset fg-buttonset-single ui-helper-clearfix" style="font-size: 12px; padding:3px;"> <span id="" onclick="events.trigger('panel.document.edit.show')" class="fg-button ui-state-default ui-priority-primary ui-corner-all" style="width: 100px; border: 1px solid #BBBBBB; padding:2px; cursor:pointer;"><span style="display: inline; padding-right: 15px;" class="ui-icon ui-icon-pencil"/></span><span style="padding-left:5px;">Edit</span></span> <span id="" onclick="events.trigger('panel.document.action.checkout')" class="fg-button ui-state-default ui-priority-primary ui-corner-all" style="width: 100px; border: 1px solid #BBBBBB; padding:2px; cursor:pointer;"><span style="display: inline; padding-right: 15px;" class="ui-icon ui-icon-cart"/></span><span style="padding-left:5px;">Checkout</span></span> <span id="" onclick="events.trigger('panel.document.action.delete')" class="fg-button ui-state-default ui-priority-primary ui-corner-all" style="width: 100px; border: 1px solid #BBBBBB; padding:2px; cursor:pointer;"><span style="display: inline; padding-right: 15px;" class="ui-icon ui-icon-circle-close"/></span><span style="padding-left:5px;">Delete</span></span> <span id="" onclick="events.trigger('panel.document.action.download')" class="fg-button ui-state-default ui-priority-primary ui-corner-all" style="width: 100px; border: 1px solid #BBBBBB; padding:2px; cursor:pointer;"><span style="display: inline; padding-right: 15px;" class="ui-icon ui-icon-circle-arrow-s"/></span><span style="padding-left:5px;">Download</span></span> </div>
  477 + </div>
  478 + <!-- Visible on edit document info -->
  479 + <div id="info_panel_toolbar_editDocument">
  480 + <div class="fg-buttonset fg-buttonset-single ui-helper-clearfix" style="font-size: 12px; padding:3px;"> <span id="" onclick="events.trigger('panel.document.info.show')" class="fg-button ui-state-default ui-priority-primary ui-corner-all" style="width: 100px; border: 1px solid #BBBBBB; padding:2px; cursor:pointer;"><span style="display: inline; padding-right: 15px;" class="ui-icon ui-icon-cancel"/></span><span style="padding-left:5px;">Cancel Edit</span></span> <span id="" onclick="events.trigger('panel.document.action.save')" class="fg-button ui-state-default ui-priority-primary ui-corner-all" style="width: 100px; border: 1px solid #BBBBBB; padding:2px; cursor:pointer;"><span style="display: inline; padding-right: 15px;" class="ui-icon ui-icon-check"/></span><span style="padding-left:5px;">Save</span></span> <span id="" onclick="events.trigger('panel.document.action.delete')" class="fg-button ui-state-default ui-priority-primary ui-corner-all" style="width: 100px; border: 1px solid #BBBBBB; padding:2px; cursor:pointer;"><span style="display: inline; padding-right: 15px;" class="ui-icon ui-icon-circle-close"/></span><span style="padding-left:5px;">Delete</span></span> </div>
  481 + </div>
  482 + <!-- Visible on view folder info -->
  483 + <div id="info_panel_toolbar_viewFolder">
  484 + <div class="fg-buttonset fg-buttonset-single ui-helper-clearfix" style="font-size: 12px; padding:3px;"> <span id="" onclick="events.trigger('panel.folder.edit.show')" class="fg-button ui-state-default ui-priority-primary ui-corner-all" style="width: 100px; border: 1px solid #BBBBBB; padding:2px; cursor:pointer;"><span style="display: inline; padding-right: 15px;" class="ui-icon ui-icon-pencil"/></span><span style="padding-left:5px;">Edit</span></span> <span id="" onclick="events.trigger('panel.folder.action.move')" class="fg-button ui-state-default ui-priority-primary ui-corner-all" style="width: 100px; border: 1px solid #BBBBBB; padding:2px; cursor:pointer;"><span style="display: inline; padding-right: 15px;" class="ui-icon ui-icon-circle-arrow-e"/></span><span style="padding-left:5px;">Move</span></span> </div>
  485 + </div>
  486 + <!-- Visible on edit folder info -->
  487 + <div id="info_panel_toolbar_editFolder">
  488 + <div class="fg-buttonset fg-buttonset-single ui-helper-clearfix" style="font-size: 12px; padding:3px;"> <span id="" onclick="events.trigger('panel.folder.info.show')" class="fg-button ui-state-default ui-priority-primary ui-corner-all" style="width: 100px; border: 1px solid #BBBBBB; padding:2px; cursor:pointer;"><span style="display: inline; padding-right: 15px;" class="ui-icon ui-icon-cancel"/></span><span style="padding-left:5px;">Cancel Edit</span></span> <span id="" onclick="events.trigger('panel.folder.action.save')" class="fg-button ui-state-default ui-priority-primary ui-corner-all" style="width: 100px; border: 1px solid #BBBBBB; padding:2px; cursor:pointer;"><span style="display: inline; padding-right: 15px;" class="ui-icon ui-icon-check"/></span><span style="padding-left:5px;">Save</span></span> </div>
  489 + </div>
537 490 </div>
538   -
539   -
540 491 <!-- Dialog container-->
541   -<div id="dialog" style="display:none;">
  492 +<div id="dialog" style="display:none;"> </div>
  493 +<!-- Setup Container -->
  494 +<div id="setup" class="dialogs" style="width: 400px; height: 300px;" title="Initial Configuration">
  495 + <table width="100%" border="0" cellpadding="0" cellspacing="0">
  496 + <tr>
  497 + <td width="32%" class="setttings_heading" style="width:180px; border-right: none;">KT Atompub URL</td>
  498 + <td width="68%"><span class="settingsRow">
  499 + <input type="text" id="setting_discover" value="" style="width: 200px;" />
  500 + </span></td>
  501 + </tr>
  502 + <tr>
  503 + <td class="" style="width:180px">&nbsp;</td>
  504 + <td style="padding:10px; text-align:right;"><div onclick="events.trigger('setup.getservicedoc',$('#setting_discover').val());"class="fg-button ui-state-default ui-priority-primary ui-corner-all" style="width: 200px; border: 1px solid #BBBBBB; padding:2px; cursor:pointer;"><span style="display: inline; padding-right: 20px;" class="ui-icon ui-icon-refresh"/></span></span><span>Check ServiceDocument</span></div></td>
  505 + </tr>
  506 + </table>
  507 + <table width="100%" border="0" cellpadding="0" cellspacing="0">
  508 + <tr>
  509 + <td width="85%" class="setttings_heading">Checking ServiceDocument</td>
  510 + <td width="15%" class="settings_indicator" >&nbsp;</td>
  511 + </tr>
  512 + <tr>
  513 + <td class="setttings_heading">Document Tree Service</td>
  514 + <td class="settings_indicator">&nbsp;</td>
  515 + </tr>
  516 + <tr>
  517 + <td class="setttings_heading">Folder Info Service</td>
  518 + <td class="settings_indicator">&nbsp;</td>
  519 + </tr>
  520 + <tr>
  521 + <td class="setttings_heading">Document Info Service</td>
  522 + <td class="settings_indicator">&nbsp;</td>
  523 + </tr>
  524 + </table>
542 525 </div>
543   -
544 526 </body>
545 527 </html>
... ...
ktatompub/Client/js/APP/ktApp.js
... ... @@ -79,6 +79,18 @@ ktApp.folder=new function(){
79 79 }
80 80 }
81 81  
  82 +ktApp.serviceDoc=new function(){
  83 + this.parseXML=function(data,workspace){
  84 + $('workspace',data).each(function(){
  85 + var ws=$(this);
  86 + lib.debug.inspect($(ws[0].childNodes).);
  87 + if($('title',this)[0].textContent==workspace){
  88 + alert('found workspace '+workspace)
  89 + }
  90 + });
  91 + }
  92 +}
  93 +
82 94  
83 95 ktApp.document=new function(){
84 96 this.fieldList={
... ...
ktatompub/Client/js/lib/lib.xml.js 0 โ†’ 100644
  1 +lib.xml=new function(){
  2 + getXmlDoc=function(xmlString){
  3 + try{ //Internet Explorer
  4 + xmlDoc=new ActiveXObject("Microsoft.XMLDOM");
  5 + xmlDoc.async="false";
  6 + xmlDoc.loadXML(txt);
  7 + return xmlDoc;
  8 + }
  9 + catch(e){
  10 + parser=new DOMParser();
  11 + xmlDoc=parser.parseFromString(txt,"text/xml");
  12 + return xmlDoc;
  13 + }
  14 + }
  15 +
  16 +
  17 +}
0 18 \ No newline at end of file
... ...
ktatompub/Client/js/site/site.event_handlers.js
... ... @@ -132,4 +132,18 @@ site.event_handlers=new function(){
132 132 '<p />The site will then generate an atompub formatted DELETE request, and clear it\'s own cache and the document tree cache before ' +
133 133 'switching to an empty panel.');
134 134 }
  135 +
  136 +
  137 + this.discovery=function(url){
  138 + var sdoc=url+'servicedocument';
  139 + if(typeof(url)!='string')sdoc=site.cfg('service');
  140 + site.cfg('service',sdoc);
  141 + if(lib.resources.resourceLoaded(sdoc)){
  142 + var data=lib.resources.getResourceFromUrl(sdoc);
  143 + ktApp.serviceDoc.parseXML($(data.data).find('service')[0],'DMS');
  144 +
  145 + }else{
  146 + lib.resources.getUrl(sdoc,site.event_handlers.discovery);
  147 + }
  148 + }
135 149 }
136 150 \ No newline at end of file
... ...
ktatompub/Client/js/site/site.js
... ... @@ -11,11 +11,11 @@ site=new function(){
11 11 this.currentDocument=null;
12 12  
13 13 this._cfgDefaults={
14   - 'baseurl' :'http://kt.dev/ktatompub/?',
15   - 'services' :'servicedoc/',
16   - 'service.treestruct' :'fulltree/',
17   - 'service.folderInfo' :'folder/',
18   - 'service.docInfo' :'document/'
  14 + 'baseurl' :'',
  15 + 'services' :'',
  16 + 'service.treestruct' :'',
  17 + 'service.folderInfo' :'',
  18 + 'service.docInfo' :''
19 19 };
20 20  
21 21 this.cfg=function(cfgName){
... ... @@ -61,13 +61,20 @@ site=new function(){
61 61 this.setupTabEvents();
62 62 this.setupInspectors();
63 63 this.setupDisplay();
  64 + this.checkSettings();
64 65 events.trigger('perspective.folders.show');
65 66 }
66 67  
  68 + this.checkSettings=function(){
  69 + if(this.cfg('baseurl')==''){
  70 + $('#setup').dialog('open');
  71 + }else{
  72 + }
  73 + }
  74 +
67 75 this.bootStrap=function(){
68 76 for(var liburl in this.libraries){
69 77 this.includeJs(liburl);
70   - //alert('loading '+ liburl)
71 78 }
72 79 $('document').ready(function(){site.init();});
73 80 }
... ... @@ -83,6 +90,7 @@ site=new function(){
83 90 this.setupDisplay=function(){
84 91 events.trigger('panel.clear');
85 92 $('#dialog').dialog({autoOpen:false, modal:true, dialogClass:'dialogs', closeOnEscape:true, buttons:{'OK':function(){$(this).dialog('close');}}});
  93 + $('#setup').dialog({width: 400, height:200, modal: true, autoOpen:false, dialogClass: 'dialogs'});
86 94 $('.fg-button').each(function(){
87 95 $(this).mouseover(function(){
88 96 $(this).addClass('ui-state-hover');
... ... @@ -142,6 +150,7 @@ site=new function(){
142 150 events.listen('panel.folder.action.save',site.event_handlers.folder_action_save,site.event_handlers);
143 151 events.listen('panel.folder.action.move',site.event_handlers.folder_action_move,site.event_handlers);
144 152  
  153 + events.listen('setup.getservicedoc',site.event_handlers.discovery,site.event_handlers);
145 154  
146 155  
147 156  
... ...
ktatompub/auth.php
... ... @@ -32,13 +32,14 @@
32 32 * logo is not reasonably feasible for technical reasons, the Appropriate Legal Notices
33 33 * must display the words "Powered by KnowledgeTree" and retain the original
34 34 * copyright notice.
35   - * Contributor( s):
  35 + * Contributor( s):
36 36 * Mark Holtzhausen <mark@knowledgetree.com>
37 37 *
38 38 */
39 39  
40 40 /**
41 41 * Automatic Login bypassing HTTP Basic Auth
  42 + * TODO: Thest HTTP Basic Auth - Try Library From Home
42 43 */
43 44  
44 45 $SessionId=KTAPPHelper::login('admin','admin');
... ...
ktatompub/index.php
... ... @@ -59,7 +59,7 @@ define(&#39;KT_APP_BASE_URI&#39;,&quot;http://&quot;.$_SERVER[&#39;HTTP_HOST&#39;].dirname($_SERVER[&#39;PHP_S
59 59 define('KT_APP_SYSTEM_URI',"http://".$_SERVER['HTTP_HOST']);
60 60  
61 61 // Define whether to use in debug mode for viewing generated structures
62   -define('KT_APP_WEB_OUTPUT',false);
  62 +//define('KT_APP_WEB_OUTPUT',false); //defunct
63 63  
64 64  
65 65  
... ... @@ -67,61 +67,28 @@ define(&#39;KT_APP_WEB_OUTPUT&#39;,false);
67 67 * Includes
68 68 */
69 69 include_once('../ktapi/ktapi.inc.php');
  70 +include_once('lib/ktAPP.inc.php');
70 71 include_once('lib/KTAPPHelper.inc.php'); //Containing helper bridge functions to KtAPI
71 72 include_once('lib/KTAPDoc.inc.php'); //Containing the parent class allowing easy XML manipulation
72 73 include_once('lib/KTAPPServiceDoc.inc.php'); //Containing the servicedoc class allowing easy ServiceDocument generation
73 74 include_once('lib/KTAPPFeed.inc.php'); //Containing the response feed class allowing easy atom feed generation
  75 +include_once('lib/ktAPP_Service.inc.php');
  76 +include_once('lib/ktApp.default_dms_services.inc.php');
74 77 include_once('auth.php'); //Containing the authentication protocols
75 78  
76 79  
  80 +//Start the AtomPubProtocol Routing Engine
  81 +$APP=new KTAPP();
77 82  
78   -//Parse the query string
79   -$query=split('/',trim($_SERVER['QUERY_STRING'],'/'));
80   -
81   -//Initializing the $output variable. Everything rendered by the engine must be placed in this variable as it is the only thing that will be rendered
82   -$output='';
83   -
84   -
85   -// Using the querystring to load the appropriate service
86   -
87   -switch(strtolower(trim($query[0]))){
88   - case 'mimetypes':
89   - include('services/mimetypes.inc.php');
90   - break;
91   - case 'fulltree':
92   - include('services/fulltree.inc.php');
93   - break;
94   - case 'folder':
95   - include('services/folder.inc.php');
96   - break;
97   - case 'document':
98   - include('services/document.inc.php');
99   - break;
100   - case 'cmis':
101   - include('services/cmis/index.php');
102   - break;
103   - case 'servicedocument':
104   - default:
105   - include('services/servicedocument.inc.php');
106   - break;
107   -}
108   -
109   -
110   -
111   -
112   -/**
113   - * Writing the Output
114   - *
115   - * To ensure we don't render illegal XML, we clean the output buffer and only use what is in the $ouput variable
116   - */
117   -ob_end_clean();
118   -if(KT_APP_WEB_OUTPUT){
119   - echo '<pre>'.htmlentities($output).'</pre>';
120   -}else{
121   - header('Content-type: text/xml');
122   - echo $output;
123   -}
  83 +//Register New Services (in the DMS workspace)
  84 +$APP->registerService('DMS','fulltree','ktAPP_Service_fullTree','Full Document Tree');
  85 +$APP->registerService('DMS','folder','ktAPP_Service_folder','Folder Detail');
  86 +$APP->registerService('DMS','document','ktAPP_Service_document','Document Detail');
124 87  
  88 +//Execute the current url/header request
  89 +$APP->execute();
125 90  
  91 +//Render the resulting feed response
  92 +$APP->render();
126 93  
127 94 ?>
128 95 \ No newline at end of file
... ...
ktatompub/lib/KTAPPFeed.inc.php
... ... @@ -32,7 +32,7 @@
32 32 * logo is not reasonably feasible for technical reasons, the Appropriate Legal Notices
33 33 * must display the words "Powered by KnowledgeTree" and retain the original
34 34 * copyright notice.
35   - * Contributor( s):
  35 + * Contributor( s):
36 36 * Mark Holtzhausen <mark@knowledgetree.com>
37 37 *
38 38 */
... ... @@ -43,7 +43,7 @@
43 43 */
44 44 include_once('KTAPDoc.inc.php');
45 45  
46   -/*
  46 +/* Remember to include support for feed attributes / nodes
47 47 <?xml version="1.0" encoding="utf-8"?>
48 48 <feed xmlns="http://www.w3.org/2005/Atom">
49 49  
... ... @@ -69,40 +69,44 @@ include_once(&#39;KTAPDoc.inc.php&#39;);
69 69  
70 70  
71 71 class KTAPPFeed extends KTAPDoc {
72   -
  72 +
73 73 private $baseURI=NULL;
74 74 private $feed=NULL;
75 75  
76   -
  76 +
77 77 public function __construct($baseURI=NULL,$title=NULL,$link=NULL,$updated=NULL,$author=NULL,$id=NULL){
78 78 parent::__construct();
79 79 $this->constructHeader();
80 80 $this->baseURI=$baseURI;
81 81 }
82   -
  82 +
83 83 private function constructHeader(){
84 84 $feed=$this->newElement('feed');
85 85 $feed->appendChild($this->newAttr('xmlns','http://www.w3.org/2005/Atom'));
86 86 $this->feed=&$feed;
87 87 $this->DOM->appendChild($this->feed);
88 88 }
89   -
  89 +
90 90 public function &newEntry(){
91 91 $entry=$this->newElement('entry');
92 92 $this->feed->appendChild($entry);
93   - return $entry;
  93 + return $entry;
94 94 }
95   -
  95 +
96 96 public function &newField($name=NULL,$value=NULL,&$entry=NULL){
97 97 $field=$this->newElement($name,$value);
98 98 if(isset($entry))$entry->appendChild($field);
99 99 return $field;
100 100 }
101   -
  101 +
102 102 public function getAPPdoc(){
103 103 return $this->formatXmlString(trim($this->DOM->saveXML()));
104 104 }
105   -
  105 +
  106 + public function render(){
  107 + return $this->getAPPdoc();
  108 + }
  109 +
106 110 }
107 111  
108 112  
... ...
ktatompub/lib/KtAPP_Service.inc.php 0 โ†’ 100644
  1 +<?php
  2 +class ktAPP_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 +
  10 + public $responseFeed=NULL;
  11 + public $responseHeader=NULL;
  12 + public $method='';
  13 + public $params='';
  14 + public $rawContent='';
  15 + public $parsedXMLContent='';
  16 +
  17 + public function __construct($method,$params,$content){
  18 + $this->method=$method;
  19 + $this->params=$params;
  20 + $this->rawContent=$content;
  21 + $this->parsedXMLContent=json_decode(json_encode(@simplexml_load_string($this->rawContent)),true);
  22 + $this->setStatus(self::STATUS_OK);
  23 + $this->responseFeed=new KTAPPFeed(KT_APP_BASE_URI);
  24 + switch(strtoupper($this->method)){
  25 + case 'GET': $this->GET_action();break;
  26 + case 'PUT': $this->PUT_action();break;
  27 + case 'POST': $this->POST_action();break;
  28 + case 'DELETE': $this->DELETE_action();break;
  29 + }
  30 + }
  31 +
  32 + public function GET_action(){
  33 + $this->setStatus(ktAPP_Service::STATUS_OK);
  34 + }
  35 +
  36 + public function PUT_action(){
  37 + $this->setStatus(ktAPP_Service::STATUS_NOT_FOUND );
  38 + }
  39 +
  40 + public function POST_action(){
  41 + $this->setStatus(ktAPP_Service::STATUS_NOT_FOUND );
  42 + }
  43 +
  44 + public function DELETE_action(){
  45 + $this->setStatus(ktAPP_Service::STATUS_NOT_FOUND );
  46 + }
  47 +
  48 +
  49 + public function render(){
  50 + return $this->responseFeed->render();
  51 + }
  52 +
  53 + private function setStatus($status=NULL){
  54 + header("HTTP/1.1 ".$status);
  55 + }
  56 +}
  57 +?>
0 58 \ No newline at end of file
... ...
ktatompub/lib/ktAPP.inc.php 0 โ†’ 100644
  1 +<?php
  2 +class KTAPP{
  3 + private $services=array();
  4 + private $errors=array();
  5 + private $output='';
  6 +
  7 + public function __construct(){
  8 + }
  9 +
  10 + public function execute(){
  11 + $reqMethod=trim(strtoupper($_SERVER['REQUEST_METHOD']));
  12 + $queryArray=split('/',trim($_SERVER['QUERY_STRING'],'/'));
  13 + $rawRequest=@file_get_contents('php://input');
  14 +
  15 + $workspace=strtolower(trim($queryArray[0]));
  16 + $serviceName=strtolower(trim($queryArray[1]));
  17 + $requestParams=array_slice($queryArray,2);
  18 + $this->queryArray=$queryArray;
  19 + $this->serviceName=$service;
  20 +
  21 + if($workspace=='servicedocument'){
  22 + $this->serviceDocument();
  23 + return;
  24 + }
  25 +
  26 + $service=$this->getRegisteredService($workspace,$serviceName);
  27 +
  28 + if(is_array($service)){
  29 + $serviceClass=$service['serviceClass'];
  30 + $serviceObject=new $serviceClass($reqMethod,$requestParams,$rawRequest);
  31 + $this->output=$serviceObject->render();
  32 + }else{
  33 + echo "Could not find service:{$service['serviceFunc']} in $workspace"; //TODO: ERROR HERE
  34 + }
  35 + }
  36 +
  37 + public function registerService($workspace=NULL,$serviceName=NULL,$serviceClass=NULL,$title=NULL){
  38 + $workspace=strtolower(trim($workspace));
  39 + $serviceName=strtolower(trim($serviceName));
  40 +
  41 + $serviceRecord=array(
  42 + 'fileName' =>$fileName,
  43 + 'serviceClass' =>$serviceClass,
  44 + 'title' =>$title
  45 + );
  46 +
  47 + $this->services[$workspace][$serviceName]=$serviceRecord;
  48 + }
  49 +
  50 + public function getRegisteredService($workspace,$serviceName=NULL){
  51 + $serviceName=strtolower(trim($serviceName));
  52 + if(isset($this->services[$workspace][$serviceName]))return $this->services[$workspace][$serviceName];
  53 + return false;
  54 + }
  55 +
  56 + public function serviceDocument(){
  57 + $service=new KTAPPServiceDoc(KT_APP_BASE_URI);
  58 +
  59 + foreach($this->services as $workspace=>$collection){
  60 + //Creating the Default Workspace for use with standard atomPub Clients
  61 + $ws=$service->newWorkspace($workspace);
  62 +
  63 + foreach($collection as $serviceName=>$serviceInstance){
  64 + $col=$service->newCollection(KT_APP_BASE_URI.$workspace.'/'.$serviceName.'/',$serviceInstance['title'],$ws);
  65 + }
  66 + }
  67 +
  68 + $this->output=$service->getAPPdoc();
  69 + }
  70 +
  71 + public function render(){
  72 + ob_end_clean();
  73 + header('Content-type: text/xml');
  74 + echo $this->output;
  75 + }
  76 +}
  77 +
  78 +?>
0 79 \ No newline at end of file
... ...
ktatompub/lib/ktAPP_ResponseFeed.inc.php 0 โ†’ 100644
  1 +<?php
  2 +class ktAPP_ResponseFeed extends KTAPPFeed {
  3 +
  4 +}
  5 +?>
0 6 \ No newline at end of file
... ...
ktatompub/lib/ktApp.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 ktAPP_Service_fullTree extends ktAPP_Service {
  10 + public function GET_action(){
  11 + //Create a new response feed
  12 + $feed=new KTAPPFeed(KT_APP_BASE_URI);
  13 +
  14 + //Invoke the KtAPI to get detail about the referenced document
  15 + $tree=KTAPPHelper::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 +
  31 +
  32 +
  33 +
  34 +/**
  35 + * AtomPub Service: folder
  36 + *
  37 + * Returns detail on a particular folder
  38 + *
  39 + */
  40 +class ktAPP_Service_folder extends ktAPP_Service {
  41 + public function GET_action(){
  42 + //Create a new response feed
  43 + $feed=new KTAPPFeed(KT_APP_BASE_URI);
  44 +
  45 + //Invoke the KtAPI to get detail about the referenced document
  46 + $folderDetail=KTAPPHelper::getFolderDetail($this->params[0]?$this->params[0]:1);
  47 +
  48 + //Create the atom response feed
  49 + $entry=$feed->newEntry();
  50 + foreach($folderDetail as $property=>$value){
  51 + $feed->newField($property,$value,$entry);
  52 + }
  53 +
  54 + //Expose the responseFeed
  55 + $this->responseFeed=$feed;
  56 + }
  57 +}
  58 +
  59 +
  60 +
  61 +
  62 +/**
  63 + * AtomPub Service: document
  64 + *
  65 + * Returns detail on a particular document
  66 + *
  67 + */
  68 +class ktAPP_Service_document extends ktAPP_Service {
  69 + public function GET_action(){
  70 + //Create a new response feed
  71 + $feed=new KTAPPFeed(KT_APP_BASE_URI);
  72 +
  73 + //Invoke the KtAPI to get detail about the referenced document
  74 + $docDetail=KTAPPHelper::getDocumentDetail($this->params[0]);
  75 +
  76 + //Create the atom response feed
  77 + $entry=$feed->newEntry();
  78 + foreach($docDetail['results'] as $property=>$value){
  79 + $feed->newField($property,$value,$entry);
  80 + }
  81 + //Add a downloaduri field manually
  82 + $feed->newField('downloaduri',urlencode(KT_APP_SYSTEM_URI.'/action.php?kt_path_info=ktcore.actions.document.view&fDocumentId='.$docDetail['results']['document_id']),$entry);
  83 +
  84 + //Expose the responseFeed
  85 + $this->responseFeed=$feed;
  86 + }
  87 +}
  88 +?>
0 89 \ No newline at end of file
... ...
lib/session/Session.inc
... ... @@ -283,6 +283,10 @@ class Session {
283 283 // now check if the timeout has been exceeded
284 284 $lastused = $aRow["lastused"];
285 285 $diff = time() - strtotime($lastused);
  286 +
  287 + //To make sure the sessionTimeout setting is nonzero
  288 + if($default->sessionTimeout<=0)$default->sessionTimeout=1200;
  289 +
286 290 if($diff <= $default->sessionTimeout) {
287 291 // update last used timestamp
288 292 $aFV = array(
... ...
webservice/classes/soap/IPReflectionClass.class.php
1   -<?php
2   -/**
3   - * An extended reflection/documentation class for classes
4   - *
5   - * This class extends the reflectionClass class by also parsing the
6   - * comment for javadoc compatible @tags and by providing help
7   - * functions to generate a WSDL file. THe class might also
8   - * be used to generate a phpdoc on the fly
9   - *
10   - *@author KnowledgeTree Team
11   - *@package Webservice
12   - *@version Version 0.9
13   - *@extends reflectionClass
14   - */
15   -class IPReflectionClass extends reflectionClass {
16   - /** @var string class name */
17   - public $classname = null;
18   -
19   - /** @var string */
20   - public $fullDescription = "";
21   -
22   - /** @var string */
23   - public $smallDescription = "";
24   -
25   - /** @var IPReflectionMethod[] */
26   - public $methods = Array();
27   -
28   - /** @var IPReflectionProperty[] */
29   - public $properties = Array();
30   -
31   - /** @var string */
32   - public $extends;
33   -
34   - /** @var string */
35   - private $comment = null;
36   -
37   -
38   - /**
39   - * Constructor
40   - *
41   - * sets the class name and calls the constructor of the reflectionClass
42   - *
43   - * @param string The class name
44   - * @return void
45   - */
46   - public function __construct($classname){
47   - $this->classname = $classname;
48   - parent::__construct($classname);
49   -
50   - $this->parseComment();
51   - }
52   -
53   - /**
54   - *Provides all methods exposed by this class as an array
55   - *
56   - * @param boolean If the method should also return protected functions
57   - * @param boolean If the method should also return private functions
58   - * @return IPReflectionMethod[]
59   - */
60   - public function getMethods($alsoProtected = true, $alsoPrivate = true){
61   - $ar = parent::getMethods();
62   - foreach($ar as $method){
63   - $m = new IPReflectionMethod($this->classname, $method->name);
64   - if((!$m->isPrivate() || $alsoPrivate) && (!$m->isProtected() || $alsoProtected) && ($m->getDeclaringClass()->name == $this->classname))
65   - $this->methods[$method->name] = $m;
66   - }
67   - ksort($this->methods);
68   - return $this->methods;
69   - }
70   -
71   - /**
72   - * Exposes an array with public properties of the class
73   - *
74   - * @param boolean If the method should also return protected properties
75   - * @param boolean If the method should also return private properties
76   - * @return IPReflectionProperty[]
77   - */
78   - public function getProperties($alsoProtected=true,$alsoPrivate=true) {
79   - $ar = parent::getProperties();
80   - $this->properties = Array();
81   - foreach($ar as $property){
82   - if((!$property->isPrivate() || $alsoPrivate) && (!$property->isProtected() || $alsoProtected)){
83   - try{
84   - $p = new IPReflectionProperty($this->classname, $property->getName());
85   - $this->properties[$property->name]=$p;
86   - }catch(ReflectionException $exception){
87   - echo "Fault on property: ".$property->name."<br>\n";
88   - }
89   - }
90   - }
91   - ksort($this->properties);
92   - return $this->properties;
93   - }
94   -
95   - /**
96   - * Exposes annotations of the class
97   - * @param $annotationName String the annotation name
98   - * @param $annotationClass String the annotation class
99   - * @return void
100   - */
101   - public function getAnnotation($annotationName, $annotationClass = null){
102   - return IPPhpDoc::getAnnotation($this->comment, $annotationName, $annotationClass);
103   - }
104   -
105   - /**
106   - * Gets all the usefull information from the comments
107   - * @return void
108   - */
109   - private function parseComment() {
110   - $this->comment = $this->getDocComment();
111   - new IPReflectionCommentParser($this->comment, $this);
112   - }
113   -}
  1 +<?php
  2 +/**
  3 + * An extended reflection/documentation class for classes
  4 + *
  5 + * This class extends the reflectionClass class by also parsing the
  6 + * comment for javadoc compatible @tags and by providing help
  7 + * functions to generate a WSDL file. THe class might also
  8 + * be used to generate a phpdoc on the fly
  9 + *
  10 + *@author KnowledgeTree Team
  11 + *@package Webservice
  12 + *@version Version 0.9
  13 + *@extends reflectionClass
  14 + */
  15 +class IPReflectionClass extends reflectionClass {
  16 + /** @var string class name */
  17 + public $classname = null;
  18 +
  19 + /** @var string */
  20 + public $fullDescription = "";
  21 +
  22 + /** @var string */
  23 + public $smallDescription = "";
  24 +
  25 + /** @var IPReflectionMethod[] */
  26 + public $methods = Array();
  27 +
  28 + /** @var IPReflectionProperty[] */
  29 + public $properties = Array();
  30 +
  31 + /** @var string */
  32 + public $extends;
  33 +
  34 + /** @var string */
  35 + private $comment = null;
  36 +
  37 +
  38 + /**
  39 + * Constructor
  40 + *
  41 + * sets the class name and calls the constructor of the reflectionClass
  42 + *
  43 + * @param string The class name
  44 + * @return void
  45 + */
  46 + public function __construct($classname){
  47 + $this->classname = $classname;
  48 + parent::__construct($classname);
  49 +
  50 + $this->parseComment();
  51 + }
  52 +
  53 + /**
  54 + *Provides all methods exposed by this class as an array
  55 + *
  56 + * @param boolean If the method should also return protected functions
  57 + * @param boolean If the method should also return private functions
  58 + * @return IPReflectionMethod[]
  59 + */
  60 + public function getMethods($alsoProtected = true, $alsoPrivate = true){
  61 + $ar = parent::getMethods();
  62 + foreach($ar as $method){
  63 + $m = new IPReflectionMethod($this->classname, $method->name);
  64 + if((!$m->isPrivate() || $alsoPrivate) && (!$m->isProtected() || $alsoProtected) && ($m->getDeclaringClass()->name == $this->classname))
  65 + $this->methods[$method->name] = $m;
  66 + }
  67 + ksort($this->methods);
  68 + return $this->methods;
  69 + }
  70 +
  71 + /**
  72 + * Exposes an array with public properties of the class
  73 + *
  74 + * @param boolean If the method should also return protected properties
  75 + * @param boolean If the method should also return private properties
  76 + * @return IPReflectionProperty[]
  77 + */
  78 + public function getProperties($alsoProtected=true,$alsoPrivate=true) {
  79 + $ar = parent::getProperties();
  80 + $this->properties = Array();
  81 + foreach($ar as $property){
  82 + if((!$property->isPrivate() || $alsoPrivate) && (!$property->isProtected() || $alsoProtected)){
  83 + try{
  84 + $p = new IPReflectionProperty($this->classname, $property->getName());
  85 + $this->properties[$property->name]=$p;
  86 + }catch(ReflectionException $exception){
  87 + echo "Fault on property: ".$property->name."<br>\n";
  88 + }
  89 + }
  90 + }
  91 + ksort($this->properties);
  92 + return $this->properties;
  93 + }
  94 +
  95 + /**
  96 + * Exposes annotations of the class
  97 + * @param $annotationName String the annotation name
  98 + * @param $annotationClass String the annotation class
  99 + * @return void
  100 + */
  101 + public function getAnnotation($annotationName, $annotationClass = null){
  102 + return IPPhpDoc::getAnnotation($this->comment, $annotationName, $annotationClass);
  103 + }
  104 +
  105 + /**
  106 + * Gets all the usefull information from the comments
  107 + * @return void
  108 + */
  109 + private function parseComment() {
  110 + $this->comment = $this->getDocComment();
  111 + new IPReflectionCommentParser($this->comment, $this);
  112 + }
  113 +}
114 114 ?>
115 115 \ No newline at end of file
... ...
webservice/classes/soap/IPReflectionCommentParser.class.php
1   -<?php
2   -/**
3   - * Class for parsing the comment blocks for classes, functions
4   - * methods and properties.
5   - *
6   - * The class parses the commentblock and extracts certain
7   - * documentation tags and the (full/small) description
8   - *
9   - *@author KnowledgeTree Team
10   - *@package Webservice
11   - *@version Version 0.9
12   - */
13   -
14   -class IPReflectionCommentParser{
15   - /**
16   - * @var string Contains the full commen text
17   - */
18   - public $comment;
19   -
20   - /**
21   - * @var object refence to the IPReflection(Class|Method|Property)
22   - */
23   - public $obj;
24   -
25   - /** @var boolean */
26   - public $smallDescriptionDone;
27   -
28   - /** @var boolean */
29   - public $fullDescriptionDone;
30   -
31   - /**
32   - * Constructor, initiateds the parse function
33   - *
34   - * @param string Commentaar block
35   - * @param string Defines if its the comment for a class, public of function
36   - */
37   - function __construct($comment, $obj) {
38   - $this->comment = $comment;
39   - $this->obj = $obj;
40   - $this->parse();
41   - }
42   - /**
43   - * parses the comment, line for line
44   - *
45   - * Will take the type of comment (class, property or function) as an
46   - * argument and split it up in lines.
47   - * @param string Defines if its the comment for a class, public of function
48   - * @return void
49   - */
50   - function parse() {
51   - //reset object
52   - $descriptionDone = false;
53   - $this->fullDescriptionDone = false;
54   -
55   - //split lines
56   - $lines = split("\n", $this->comment);
57   -
58   - //check lines for description or tags
59   - foreach ($lines as $line) {
60   - $pos = strpos($line,"* @");
61   - if (trim($line) == "/**" || trim($line) == "*/") { //skip the start and end line
62   - }elseif (!($pos === false)) { //comment
63   - $this->parseTagLine(substr($line,$pos+3));
64   - $descriptionDone=true;
65   - }elseif(!$descriptionDone){
66   - $this->parseDescription($line);
67   - }
68   - }
69   - //if full description is empty, put small description in full description
70   - if (trim(str_replace(Array("\n","\r"), Array("", ""), $this->obj->fullDescription)) == "")
71   - $this->obj->fullDescription = $this->obj->smallDescription;
72   - }
73   -
74   - /**
75   - * Parses the description to the small and full description properties
76   - *
77   - * @param string The description line
78   - * @return void
79   - */
80   -
81   - function parseDescription($descriptionLine) {
82   - if(strpos($descriptionLine,"*") <= 2) $descriptionLine = substr($descriptionLine, (strpos($descriptionLine,"*") + 1));
83   -
84   - //geen lege comment regel indien al in grote omschrijving
85   - if(trim(str_replace(Array("\n","\r"), Array("", ""), $descriptionLine)) == ""){
86   - if($this->obj->fullDescription == "")
87   - $descriptionLine = "";
88   - $this->smallDescriptionDone = true;
89   - }
90   -
91   - if(!$this->smallDescriptionDone)//add to small description
92   - $this->obj->smallDescription.=$descriptionLine;
93   - else{//add to full description
94   - $this->obj->fullDescription.=$descriptionLine;
95   - }
96   - }
97   -
98   - /**
99   - * Parses a tag line and extracts the tagname and values
100   - *
101   - * @param string The tagline
102   - * @return void
103   - */
104   - function parseTagLine($tagLine) {
105   - $tagArr = explode(" ", $tagLine);
106   - $tag = $tagArr[0];
107   -
108   - switch(strtolower($tag)){
109   - case 'abstract':
110   - $this->obj->abstract = true; break;
111   - case 'access':
112   - $this->obj->isPrivate = (strtolower(trim($tagArr[1]))=="private")?true:false;
113   - break;
114   - case 'author':
115   - unset($tagArr[0]);
116   - $this->obj->author = implode(" ",$tagArr);
117   - break;
118   - case 'copyright':
119   - unset($tagArr[0]);
120   - $this->obj->copyright = implode(" ",$tagArr);
121   - break;
122   - case 'deprecated':
123   - case 'deprec':
124   - $this->obj->deprecated = true;
125   - break;
126   - case 'extends': break;
127   - case 'global':
128   - $this->obj->globals[] = $tagArr[1];
129   - break;
130   - case 'param':
131   - $o = new stdClass();
132   - $o->type = trim($tagArr[1]);
133   - $o->comment = implode(" ",$tagArr);
134   - $this->obj->params[] = $o;
135   - break;
136   - case 'return':
137   - $this->obj->return = trim($tagArr[1]); break;
138   - case 'link':break;
139   - case 'see':break;
140   - case 'since':
141   - $this->obj->since = trim($tagArr[1]); break;
142   - case 'static':
143   - $this->obj->static = true; break;
144   - case 'throws':
145   - unset($tagArr[0]);
146   - $this->obj->throws = implode(" ",$tagArr);
147   - break;
148   - case 'todo':
149   - unset($tagArr[0]);
150   - $this->obj->todo[] = implode(" ",$tagArr);
151   - break;
152   - case 'var':
153   - $this->obj->type = trim($tagArr[1]);
154   - unset($tagArr[0],$tagArr[1]);
155   - $comment=implode(" ",$tagArr);
156   - //check if its an optional property
157   - $this->obj->optional = strpos($comment,"[OPTIONAL]") !== FALSE;
158   - $this->obj->autoincrement = strpos($comment,"[AUTOINCREMENT]") !== FALSE;
159   - $this->obj->description = str_replace("[OPTIONAL]", "", $comment);
160   - break;
161   - case 'version':
162   - $this->obj->version = $tagArr[1];
163   - break;
164   - default:
165   - //echo "\nno valid tag: '".strtolower($tag)."' at tagline: '$tagLine' <br>";
166   - //do nothing
167   - }
168   - }
169   -}
  1 +<?php
  2 +/**
  3 + * Class for parsing the comment blocks for classes, functions
  4 + * methods and properties.
  5 + *
  6 + * The class parses the commentblock and extracts certain
  7 + * documentation tags and the (full/small) description
  8 + *
  9 + *@author KnowledgeTree Team
  10 + *@package Webservice
  11 + *@version Version 0.9
  12 + */
  13 +
  14 +class IPReflectionCommentParser{
  15 + /**
  16 + * @var string Contains the full commen text
  17 + */
  18 + public $comment;
  19 +
  20 + /**
  21 + * @var object refence to the IPReflection(Class|Method|Property)
  22 + */
  23 + public $obj;
  24 +
  25 + /** @var boolean */
  26 + public $smallDescriptionDone;
  27 +
  28 + /** @var boolean */
  29 + public $fullDescriptionDone;
  30 +
  31 + /**
  32 + * Constructor, initiateds the parse function
  33 + *
  34 + * @param string Commentaar block
  35 + * @param string Defines if its the comment for a class, public of function
  36 + */
  37 + function __construct($comment, $obj) {
  38 + $this->comment = $comment;
  39 + $this->obj = $obj;
  40 + $this->parse();
  41 + }
  42 + /**
  43 + * parses the comment, line for line
  44 + *
  45 + * Will take the type of comment (class, property or function) as an
  46 + * argument and split it up in lines.
  47 + * @param string Defines if its the comment for a class, public of function
  48 + * @return void
  49 + */
  50 + function parse() {
  51 + //reset object
  52 + $descriptionDone = false;
  53 + $this->fullDescriptionDone = false;
  54 +
  55 + //split lines
  56 + $lines = split("\n", $this->comment);
  57 +
  58 + //check lines for description or tags
  59 + foreach ($lines as $line) {
  60 + $pos = strpos($line,"* @");
  61 + if (trim($line) == "/**" || trim($line) == "*/") { //skip the start and end line
  62 + }elseif (!($pos === false)) { //comment
  63 + $this->parseTagLine(substr($line,$pos+3));
  64 + $descriptionDone=true;
  65 + }elseif(!$descriptionDone){
  66 + $this->parseDescription($line);
  67 + }
  68 + }
  69 + //if full description is empty, put small description in full description
  70 + if (trim(str_replace(Array("\n","\r"), Array("", ""), $this->obj->fullDescription)) == "")
  71 + $this->obj->fullDescription = $this->obj->smallDescription;
  72 + }
  73 +
  74 + /**
  75 + * Parses the description to the small and full description properties
  76 + *
  77 + * @param string The description line
  78 + * @return void
  79 + */
  80 +
  81 + function parseDescription($descriptionLine) {
  82 + if(strpos($descriptionLine,"*") <= 2) $descriptionLine = substr($descriptionLine, (strpos($descriptionLine,"*") + 1));
  83 +
  84 + //geen lege comment regel indien al in grote omschrijving
  85 + if(trim(str_replace(Array("\n","\r"), Array("", ""), $descriptionLine)) == ""){
  86 + if($this->obj->fullDescription == "")
  87 + $descriptionLine = "";
  88 + $this->smallDescriptionDone = true;
  89 + }
  90 +
  91 + if(!$this->smallDescriptionDone)//add to small description
  92 + $this->obj->smallDescription.=$descriptionLine;
  93 + else{//add to full description
  94 + $this->obj->fullDescription.=$descriptionLine;
  95 + }
  96 + }
  97 +
  98 + /**
  99 + * Parses a tag line and extracts the tagname and values
  100 + *
  101 + * @param string The tagline
  102 + * @return void
  103 + */
  104 + function parseTagLine($tagLine) {
  105 + $tagArr = explode(" ", $tagLine);
  106 + $tag = $tagArr[0];
  107 +
  108 + switch(strtolower($tag)){
  109 + case 'abstract':
  110 + $this->obj->abstract = true; break;
  111 + case 'access':
  112 + $this->obj->isPrivate = (strtolower(trim($tagArr[1]))=="private")?true:false;
  113 + break;
  114 + case 'author':
  115 + unset($tagArr[0]);
  116 + $this->obj->author = implode(" ",$tagArr);
  117 + break;
  118 + case 'copyright':
  119 + unset($tagArr[0]);
  120 + $this->obj->copyright = implode(" ",$tagArr);
  121 + break;
  122 + case 'deprecated':
  123 + case 'deprec':
  124 + $this->obj->deprecated = true;
  125 + break;
  126 + case 'extends': break;
  127 + case 'global':
  128 + $this->obj->globals[] = $tagArr[1];
  129 + break;
  130 + case 'param':
  131 + $o = new stdClass();
  132 + $o->type = trim($tagArr[1]);
  133 + $o->comment = implode(" ",$tagArr);
  134 + $this->obj->params[] = $o;
  135 + break;
  136 + case 'return':
  137 + $this->obj->return = trim($tagArr[1]); break;
  138 + case 'link':break;
  139 + case 'see':break;
  140 + case 'since':
  141 + $this->obj->since = trim($tagArr[1]); break;
  142 + case 'static':
  143 + $this->obj->static = true; break;
  144 + case 'throws':
  145 + unset($tagArr[0]);
  146 + $this->obj->throws = implode(" ",$tagArr);
  147 + break;
  148 + case 'todo':
  149 + unset($tagArr[0]);
  150 + $this->obj->todo[] = implode(" ",$tagArr);
  151 + break;
  152 + case 'var':
  153 + $this->obj->type = trim($tagArr[1]);
  154 + unset($tagArr[0],$tagArr[1]);
  155 + $comment=implode(" ",$tagArr);
  156 + //check if its an optional property
  157 + $this->obj->optional = strpos($comment,"[OPTIONAL]") !== FALSE;
  158 + $this->obj->autoincrement = strpos($comment,"[AUTOINCREMENT]") !== FALSE;
  159 + $this->obj->description = str_replace("[OPTIONAL]", "", $comment);
  160 + break;
  161 + case 'version':
  162 + $this->obj->version = $tagArr[1];
  163 + break;
  164 + default:
  165 + //echo "\nno valid tag: '".strtolower($tag)."' at tagline: '$tagLine' <br>";
  166 + //do nothing
  167 + }
  168 + }
  169 +}
170 170 ?>
171 171 \ No newline at end of file
... ...
webservice/classes/soap/IPReflectionMethod.class.php
1   -<?php
2   -/**
3   - * An extended reflection/documentation class for class methods
4   - *
5   - * This class extends the reflectioMethod class by also parsing the
6   - * comment for javadoc compatible @tags and by providing help
7   - * functions to generate a WSDL file. The class might also
8   - * be used to generate a phpdoc on the fly
9   - *
10   - *@author KnowledgeTree Team
11   - *@package Webservice
12   - *@version Version 0.9
13   - *@extends reflectionMethod
14   - */
15   -
16   -class IPReflectionMethod extends reflectionMethod{
17   - /** @var string class name */
18   - public $classname;
19   -
20   - /** @var string The return type for this method */
21   - public $return = "";
22   -
23   - /** @var IPReflectionParameter[] Associative array with reflectionParameter objects */
24   - public $parameters = array();
25   -
26   - /** @var string */
27   - public $fullDescription = "";
28   -
29   - /** @var string */
30   - public $smallDescription = "";
31   -
32   - /** @var string */
33   - public $throws="";
34   -
35   - /**
36   - * Constructor which calls the parent constructor and makes sure the comment
37   - * of the method is parsed
38   - *
39   - * @param string The class name
40   - * @param string The method name
41   - */
42   - public function __construct($class,$method){
43   - $this->classname = $class;
44   - parent::__construct($class,$method);
45   - $this->parseComment();
46   - }
47   -
48   - /**
49   - * Returns the full function name, including arguments
50   - * @return string
51   - */
52   - public function getFullName(){
53   - $args = $this->getParameters();
54   - $argstr = "";
55   -
56   - foreach((array)$args as $arg){
57   - if($argstr!="")$argstr.=", ";
58   - $argstr.= $arg->type ." $".$arg->name;
59   - }
60   - return $this->return." ".$this->name."(".$argstr.")";
61   - }
62   -
63   - /**
64   - * Returns an array with parameter objects, containing type info etc.
65   - *
66   - * @return ReflectionParameter[] Associative array with parameter objects
67   - */
68   - public function getParameters(){
69   - $this->parameters = Array();
70   - $ar = parent::getParameters();
71   - $i = 0;
72   -
73   - foreach((array)$ar as $parameter){
74   - $parameter->type = $this->params[$i++]->type;
75   - $this->parameters[$parameter->name] = $parameter;
76   - }
77   -
78   - return $this->parameters;
79   - }
80   -
81   - /**
82   - *
83   - * @param $annotationName String the annotation name
84   - * @param $annotationClass String the annotation class
85   - * @return void
86   - */
87   - public function getAnnotation($annotationName, $annotationClass = null){
88   - return IPPhpDoc::getAnnotation($this->comment, $annotationName, $annotationClass);
89   - }
90   -
91   - /**
92   - * Parses the comment and adds found properties to this class
93   - * @return void
94   - */
95   - private function parseComment(){
96   - $this->comment = $this->getDocComment();
97   - new IPReflectionCommentParser($this->comment, $this);
98   - }
99   -}
  1 +<?php
  2 +/**
  3 + * An extended reflection/documentation class for class methods
  4 + *
  5 + * This class extends the reflectioMethod class by also parsing the
  6 + * comment for javadoc compatible @tags and by providing help
  7 + * functions to generate a WSDL file. The class might also
  8 + * be used to generate a phpdoc on the fly
  9 + *
  10 + *@author KnowledgeTree Team
  11 + *@package Webservice
  12 + *@version Version 0.9
  13 + *@extends reflectionMethod
  14 + */
  15 +
  16 +class IPReflectionMethod extends reflectionMethod{
  17 + /** @var string class name */
  18 + public $classname;
  19 +
  20 + /** @var string The return type for this method */
  21 + public $return = "";
  22 +
  23 + /** @var IPReflectionParameter[] Associative array with reflectionParameter objects */
  24 + public $parameters = array();
  25 +
  26 + /** @var string */
  27 + public $fullDescription = "";
  28 +
  29 + /** @var string */
  30 + public $smallDescription = "";
  31 +
  32 + /** @var string */
  33 + public $throws="";
  34 +
  35 + /**
  36 + * Constructor which calls the parent constructor and makes sure the comment
  37 + * of the method is parsed
  38 + *
  39 + * @param string The class name
  40 + * @param string The method name
  41 + */
  42 + public function __construct($class,$method){
  43 + $this->classname = $class;
  44 + parent::__construct($class,$method);
  45 + $this->parseComment();
  46 + }
  47 +
  48 + /**
  49 + * Returns the full function name, including arguments
  50 + * @return string
  51 + */
  52 + public function getFullName(){
  53 + $args = $this->getParameters();
  54 + $argstr = "";
  55 +
  56 + foreach((array)$args as $arg){
  57 + if($argstr!="")$argstr.=", ";
  58 + $argstr.= $arg->type ." $".$arg->name;
  59 + }
  60 + return $this->return." ".$this->name."(".$argstr.")";
  61 + }
  62 +
  63 + /**
  64 + * Returns an array with parameter objects, containing type info etc.
  65 + *
  66 + * @return ReflectionParameter[] Associative array with parameter objects
  67 + */
  68 + public function getParameters(){
  69 + $this->parameters = Array();
  70 + $ar = parent::getParameters();
  71 + $i = 0;
  72 +
  73 + foreach((array)$ar as $parameter){
  74 + $parameter->type = $this->params[$i++]->type;
  75 + $this->parameters[$parameter->name] = $parameter;
  76 + }
  77 +
  78 + return $this->parameters;
  79 + }
  80 +
  81 + /**
  82 + *
  83 + * @param $annotationName String the annotation name
  84 + * @param $annotationClass String the annotation class
  85 + * @return void
  86 + */
  87 + public function getAnnotation($annotationName, $annotationClass = null){
  88 + return IPPhpDoc::getAnnotation($this->comment, $annotationName, $annotationClass);
  89 + }
  90 +
  91 + /**
  92 + * Parses the comment and adds found properties to this class
  93 + * @return void
  94 + */
  95 + private function parseComment(){
  96 + $this->comment = $this->getDocComment();
  97 + new IPReflectionCommentParser($this->comment, $this);
  98 + }
  99 +}
100 100 ?>
101 101 \ No newline at end of file
... ...
webservice/classes/soap/IPReflectionProperty.class.php
1   -<?php
2   -/**
3   - * An extended reflection/documentation class for class properties
4   - *
5   - * This class extends the reflectionProperty class by also parsing the
6   - * comment for javadoc compatible @tags and by providing help
7   - * functions to generate a WSDL file. The class might also
8   - * be used to generate a phpdoc on the fly
9   - *
10   - *@author KnowledgeTree Team
11   - *@package Webservice
12   - *@version Version 0.9
13   - *@extends reflectionProperty
14   - */
15   -class IPReflectionProperty extends reflectionProperty {
16   - /** @var string Classname to whom this property belongs */
17   - public $classname;
18   -
19   - /** @var string Type description of the property */
20   - public $type = "";
21   -
22   - /** @var boolean Determens if the property is a private property */
23   - public $isPrivate = false;
24   -
25   - /** @var string */
26   - public $description;
27   -
28   - /** @var boolean */
29   - public $optional = false;
30   -
31   - /** @var boolean */
32   - public $autoincrement = false;
33   -
34   - /** @var string */
35   - public $fullDescription = "";
36   -
37   - /** @var string */
38   - public $smallDescription = "";
39   -
40   - /** @var string */
41   - public $name = null;
42   -
43   - /** @var string */
44   - private $comment = null;
45   -
46   - /**
47   - * constructor. will initiate the commentParser
48   - *
49   - * @param string Class name
50   - * @param string Property name
51   - * @return void
52   - */
53   - public function __construct($class, $property){
54   - $this->classname = $class;
55   - parent::__construct($class, $property);
56   - $this->parseComment();
57   - }
58   -
59   - /**
60   - *
61   - * @param $annotationName String the annotation name
62   - * @param $annotationClass String the annotation class
63   - * @return void
64   - */
65   - public function getAnnotation($annotationName, $annotationClass = null){
66   - return IPPhpDoc::getAnnotation($this->comment, $annotationName, $annotationClass);
67   - }
68   -
69   - private function parseComment(){
70   - // No getDocComment available for properties in php 5.0.3 :(
71   - $this->comment = $this->getDocComment();
72   - new IPReflectionCommentParser($this->comment, $this);
73   - }
74   -}
  1 +<?php
  2 +/**
  3 + * An extended reflection/documentation class for class properties
  4 + *
  5 + * This class extends the reflectionProperty class by also parsing the
  6 + * comment for javadoc compatible @tags and by providing help
  7 + * functions to generate a WSDL file. The class might also
  8 + * be used to generate a phpdoc on the fly
  9 + *
  10 + *@author KnowledgeTree Team
  11 + *@package Webservice
  12 + *@version Version 0.9
  13 + *@extends reflectionProperty
  14 + */
  15 +class IPReflectionProperty extends reflectionProperty {
  16 + /** @var string Classname to whom this property belongs */
  17 + public $classname;
  18 +
  19 + /** @var string Type description of the property */
  20 + public $type = "";
  21 +
  22 + /** @var boolean Determens if the property is a private property */
  23 + public $isPrivate = false;
  24 +
  25 + /** @var string */
  26 + public $description;
  27 +
  28 + /** @var boolean */
  29 + public $optional = false;
  30 +
  31 + /** @var boolean */
  32 + public $autoincrement = false;
  33 +
  34 + /** @var string */
  35 + public $fullDescription = "";
  36 +
  37 + /** @var string */
  38 + public $smallDescription = "";
  39 +
  40 + /** @var string */
  41 + public $name = null;
  42 +
  43 + /** @var string */
  44 + private $comment = null;
  45 +
  46 + /**
  47 + * constructor. will initiate the commentParser
  48 + *
  49 + * @param string Class name
  50 + * @param string Property name
  51 + * @return void
  52 + */
  53 + public function __construct($class, $property){
  54 + $this->classname = $class;
  55 + parent::__construct($class, $property);
  56 + $this->parseComment();
  57 + }
  58 +
  59 + /**
  60 + *
  61 + * @param $annotationName String the annotation name
  62 + * @param $annotationClass String the annotation class
  63 + * @return void
  64 + */
  65 + public function getAnnotation($annotationName, $annotationClass = null){
  66 + return IPPhpDoc::getAnnotation($this->comment, $annotationName, $annotationClass);
  67 + }
  68 +
  69 + private function parseComment(){
  70 + // No getDocComment available for properties in php 5.0.3 :(
  71 + $this->comment = $this->getDocComment();
  72 + new IPReflectionCommentParser($this->comment, $this);
  73 + }
  74 +}
75 75 ?>
76 76 \ No newline at end of file
... ...
webservice/classes/soap/WSDLException.class.php
1   -<?php
2   -/**
3   - * Exception class which can be thrown by
4   - * the WSDLStruct class.
5   - *
6   - *@author KnowledgeTree Team
7   - *@package Webservice
8   - *@version Version 0.9
9   - */
10   -class WSDLException extends Exception {
11   - /**
12   - * @param string The error message
13   - * @return void
14   - */
15   - function __construct($msg) {
16   - $this->msg = $msg;
17   - }
18   - /**
19   - * @return void
20   - */
21   - function Display() {
22   - print "Error creating WSDL document:".$this->msg;
23   - //var_dump(debug_backtrace());
24   - }
25   -}
  1 +<?php
  2 +/**
  3 + * Exception class which can be thrown by
  4 + * the WSDLStruct class.
  5 + *
  6 + *@author KnowledgeTree Team
  7 + *@package Webservice
  8 + *@version Version 0.9
  9 + */
  10 +class WSDLException extends Exception {
  11 + /**
  12 + * @param string The error message
  13 + * @return void
  14 + */
  15 + function __construct($msg) {
  16 + $this->msg = $msg;
  17 + }
  18 + /**
  19 + * @return void
  20 + */
  21 + function Display() {
  22 + print "Error creating WSDL document:".$this->msg;
  23 + //var_dump(debug_backtrace());
  24 + }
  25 +}
26 26 ?>
27 27 \ No newline at end of file
... ...
webservice/classes/soap/WSDLStruct.class.php
1   -<?php
2   -/**
3   - * Class that can generate a WSDL document from PHP code
4   - *
5   - * This class generates a WSDL document for the given
6   - * methods when the the methods and parameters are documented
7   - * enough. When there is not enough documentation available (ie
8   - * unclear what the type of a variable or return type is) a
9   - * WSDLException is thrown.
10   - *
11   - *
12   - *@author KnowledgeTree Team
13   - *@package Webservice
14   - *@version Version 0.9
15   - */
16   -class WSDLStruct {
17   - /** @var boolean */
18   - public $_debug = false;
19   -
20   - /** @var int binding type: SOAP_RPC | SOAP_DOCUMENT */
21   - public $binding_style;
22   -
23   - /** @var int use: SOAP_LITERAL | SOAP_ENCODED */
24   - public $use;
25   - /************************** Private properties ***************************/
26   -
27   - /** @var SOAPService[] */
28   - private $services = Array();
29   -
30   - /** @var domElement[] */
31   - private $serviceTags = Array();
32   -
33   - /** @var domElement[] */
34   - private $operationTags = Array();
35   -
36   - /** @var domElement[] references to the portType tags. servicename as key */
37   - private $portTypeTags = Array();
38   -
39   - /** @var domElement[] references to the binding tags. servicename as key */
40   - private $bindingTags = Array();
41   -
42   - /** @var domElement[] references to the binding operation tags. servicename as first key, operationname as second */
43   - private $bindingOperationTags = Array();
44   -
45   - /** @var domDocument */
46   - private $doc;
47   -
48   - /** @var domelement */
49   - private $definitions;
50   -
51   - /** @var domelement Refference tot the types tag*/
52   - private $typesTag;
53   -
54   - /** @var domelement Refference to the xsd:schema tag*/
55   - private $xsdSchema;
56   -
57   - /** @var IPXMLSchema */
58   - private $xmlSchema;
59   -
60   - //namespaces used
61   - const NS_WSDL = "http://schemas.xmlsoap.org/wsdl/";
62   - const NS_SOAP = "http://schemas.xmlsoap.org/wsdl/soap/";
63   - const NS_ENC = "http://schemas.xmlsoap.org/soap/encoding/";
64   - const NS_XSD = "http://www.w3.org/2001/XMLSchema";
65   -
66   - const CREATE_EMPTY_INPUTS = true;
67   -
68   - /*
69   - * @param string Target namespace
70   - * @param string URL for the webservice
71   - * @return void
72   - */
73   - public function __construct($tns, $url, $type = SOAP_RPC, $use = SOAP_ENCODED){
74   - if($type != SOAP_RPC && $type != SOAP_DOCUMENT) throw new Exception("Webservice type parameter should be either SOAP_RPC or SOAP_DOCUMENT");
75   - if($use != SOAP_ENCODED && $use != SOAP_LITERAL) throw new Exception("Webservice use parameter should be either SOAP_ENCODED or SOAP_LITERAL");
76   -
77   - $this->use = $use;
78   - $this->binding_style=$type;
79   - $this->tns = $tns;
80   - $this->url = $url;
81   - $this->doc = new domDocument();
82   - $this->definitions = $this->addElement("wsdl:definitions",$this->doc);
83   -
84   - $this->typesTag = $this->addElement("wsdl:types", $this->definitions);
85   - $this->xsdSchema = $this->addElement("xsd:schema", $this->typesTag);
86   - $this->xsdSchema->setAttribute("targetNamespace", $this->tns);
87   - $this->xmlSchema = new IPXMLSchema($this->xsdSchema);
88   -
89   - }
90   -
91   - /**
92   - * Adds the class to the services for this WSDL
93   - *
94   - * @param IPReflectionClass The service
95   - * @return void
96   - */
97   - public function setService(IPReflectionClass $class){
98   - $this->services[$class->classname] = $class;
99   - $this->services[$class->classname]->getMethods(false, false);
100   - }
101   - /**
102   - * @return string The WSDL document for this structure
103   - */
104   - public function generateDocument(){
105   - $this->addToDebug("Generating document");
106   -
107   - //add all definitions
108   - $definitions=$this->definitions;
109   - $definitions->setAttribute("xmlns", self::NS_WSDL);
110   - $definitions->setAttribute("xmlns:soap", self::NS_SOAP);
111   - $definitions->setAttribute("xmlns:SOAP-ENC", self::NS_ENC);
112   - $definitions->setAttribute("xmlns:wsdl", self::NS_WSDL);
113   - $definitions->setAttribute("xmlns:xsd", self::NS_XSD);
114   - $definitions->setAttribute("xmlns:tns", $this->tns);
115   - $definitions->setAttribute("targetNamespace", $this->tns);
116   -
117   - //add all the services
118   - foreach((array)$this->services as $serviceName => $service){
119   - //add the portType
120   - $portType = $this->addPortType($serviceName);
121   -
122   - //add binding
123   - $binding = $this->addBinding($serviceName);
124   -
125   - //loop the operations
126   - foreach((array)$service->methods as $operation){
127   - $operationName = $operation->name;
128   - $operationTag = $this->addOperation($operationName, $serviceName);
129   -
130   - //input
131   - //only when to operation needs arguments
132   - $parameters = $operation->getParameters();
133   - if(count($parameters)>0 || self::CREATE_EMPTY_INPUTS){
134   - $messageName = $operationName."Request";
135   - $input=$this->addElement("wsdl:input", $operationTag);
136   - $input->setAttribute("message", "tns:".$messageName);
137   - $para=Array();
138   - foreach((array)$parameters as $parameterName => $parameter){
139   - $para[$parameterName] = $parameter->type;
140   - }
141   - $this->addMessage($messageName, $para);
142   - $this->addInput($this->bindingOperationTags[$serviceName][$operationName]);
143   - }
144   -
145   -
146   - //output
147   - //only when the operation returns something
148   - if(!$operation->return || trim($operation->return) == "") throw new WSDLException('No return type for '.$operationName);
149   - if(strtolower(trim($operation->return))!='void'){
150   - $messageName = $operationName."Response";
151   - $output = $this->addElement("wsdl:output", $operationTag);
152   - $output->setAttribute("message", "tns:".$messageName);
153   - $this->addOutput($this->bindingOperationTags[$serviceName][$operationName]);
154   - $this->addMessage($messageName,Array($operation->name."Return" => $operation->return));
155   - }
156   - }
157   - // SH. now add the portType and binding
158   - $this->definitions->AppendChild($portType);
159   - $this->definitions->AppendChild($binding);
160   -
161   - //add the service
162   - $this->addService($serviceName);
163   -
164   - }
165   - return $this->doc->saveXML();
166   - }
167   -
168   - /**
169   - * Adds a new operation to the given service
170   - * @param string operation name
171   - * @param string service name
172   - * @return domElement
173   - */
174   - private function addOperation($operationName, $serviceName){
175   - $this->addToDebug("Adding Operation: '$operationName : $serviceName'");
176   - $operationTag = $this->addElement("wsdl:operation",$this->portTypeTags[$serviceName]);
177   - $operationTag->setAttribute("name",$operationName);
178   -
179   - //create operation tag for binding
180   - $bindingOperationTag = $this->addElement("wsdl:operation",$this->bindingTags[$serviceName]);
181   - $bindingOperationTag->setAttribute("name",$operationName);
182   -
183   - //soap operation tag
184   - $soapOperationTag = $this->addElement("soap:operation",$bindingOperationTag);
185   - $soapOperationTag->setAttribute("soapAction",$this->url."&method=".$operationName);
186   - $soapOperationTag->setAttribute("style",($this->binding_style == SOAP_RPC)? "rpc" : "document");
187   -
188   - //save references
189   - $this->operationTags[$serviceName][$operationName] = $operationTag;
190   - $this->bindingOperationTags[$serviceName][$operationName] = $bindingOperationTag;
191   -
192   - //and return
193   - return $operationTag;
194   - }
195   -
196   - /**
197   - * adds a new service tag to the WSDL file
198   - * @param string the service name
199   - * @return domElement
200   - */
201   - private function addService($serviceName){
202   - $this->addToDebug("Adding service: '$serviceName'");
203   - //create service
204   - $serviceTag=$this->addElement("wsdl:service",$this->definitions);
205   - $serviceTag->setAttribute("name",$serviceName);
206   -
207   - //port tag
208   - $portTag=$this->addElement("wsdl:port", $serviceTag);
209   - $portTag->setAttribute("name", $serviceName."Port");
210   - $portTag->setAttribute("binding", "tns:".$serviceName."Binding");
211   -
212   - //address tag
213   - $addressTag = $this->addElement("soap:address", $portTag);
214   - $addressTag->setAttribute("location", $this->url);
215   -
216   - //keep a reference
217   - $this->serviceTags[$serviceName] = $serviceTag;
218   - //and return
219   - return $serviceTag;
220   - }
221   -
222   - /**
223   - * Adds a new portType to the WSDL structure
224   - * @param string the service name for which we create a portType
225   - * @return domElement
226   - */
227   - private function addPortType($serviceName){
228   - $this->addToDebug("Adding portType: '$serviceName'");
229   - // SH don't add to main doc just yet
230   - // $portTypeTag=$this->addElement("wsdl:portType", $this->definitions);
231   - $portTypeTag = $this->addElement("wsdl:portType");
232   - $portTypeTag->setAttribute("name", $serviceName."PortType");
233   -
234   - //keep a reference
235   - $this->portTypeTags[$serviceName]=$portTypeTag;
236   - //and return
237   - return $portTypeTag;
238   - }
239   -
240   - /**
241   - * Adds a new binding to the WSDL structure
242   - * @param string serviceName to bind
243   - * @return domElement
244   - */
245   - private function addBinding($serviceName){
246   - $this->addToDebug("Adding binding: '$serviceName'");
247   - // SH. don't add to main doc just yet
248   - // $bindingTag=$this->addElement("binding");
249   - $bindingTag=$this->addElement("binding",$this->definitions);
250   - $bindingTag->setAttribute("name", $serviceName."Binding");
251   - $bindingTag->setAttribute("type", "tns:".$serviceName."PortType");
252   -
253   - //soap binding tag
254   - $soapBindingTag = $this->addElement("soap:binding", $bindingTag);
255   - $soapBindingTag->setAttribute("style", ($this->binding_style == SOAP_RPC)? "rpc" : "document");
256   - $soapBindingTag->setAttribute("transport", "http://schemas.xmlsoap.org/soap/http");
257   -
258   - //keep a reference
259   - $this->bindingTags[$serviceName] = $bindingTag;
260   - //and return
261   - return $bindingTag;
262   - }
263   -
264   - /**
265   - * Adds a message tag to the WSDL document
266   - * @param string Message name
267   - * @param Array[string=>string] Array with variables & types
268   - */
269   - private function addMessage($name, $parts){
270   - $this->addToDebug("Adding message: '$name'");
271   - $msg = $this->addElement("message", $this->definitions);
272   - $msg->setAttribute("name", $name);
273   - foreach((array)$parts as $partName => $partType){
274   - $this->addToDebug("Adding Message part: '$partName => $partType'");
275   - $part=$this->addElement("part", $msg);
276   - $part->setAttribute("name", $partName);
277   -
278   - //check if it is a valid XML Schema datatype
279   - if($t = IPXMLSchema::checkSchemaType(strtolower($partType)))
280   - $part->setAttribute("type", "xsd:".$t);
281   - else{
282   - //If it is an array, change the type name
283   - $partName = (substr($partType,-2) == "[]")?substr($partType,0,strpos($partType,"["))."Array":$partType;
284   -
285   - $part->setAttribute("type", "tns:".$partName);
286   - $this->xmlSchema->addComplexType($partType, $partName);
287   - }
288   - }
289   - }
290   -
291   - /**
292   - * Adds an input element to the given parent (an operation tag)
293   - * @param domNode The Parent domNode
294   - * @param boolean Kind of tag. true=input tag, false=output tag
295   - * @return domNode The input/output node
296   - */
297   - private function addInput($parent, $input=true){
298   - $name = $input ? "wsdl:input" : "wsdl:output";
299   - $tag=$this->addElement($name, $parent);
300   - $soapOperation=$this->addElement("soap:body", $tag);
301   - $soapOperation->setAttribute("use", ($this->use == SOAP_ENCODED)? "encoded" : "literal");
302   - $soapOperation->setAttribute("namespace", $this->tns);
303   - if($this->use == SOAP_ENCODED)
304   - $soapOperation->setAttribute("encodingStyle", self::NS_ENC);
305   - }
306   -
307   - /**
308   - * Adds an output element to the given parent (an operation tag)
309   - * @param domNode The Parent domNode
310   - * @return domNode The output node
311   - */
312   - private function addOutput($parent){
313   - return $this->addInput($parent,false);
314   - }
315   -
316   - /************************* Supporting functions ****************************/
317   -
318   - private function addToDebug($msg){
319   - if($this->_debug) echo '-'.$msg." <br>\n";
320   - }
321   -
322   - /**
323   - * Adds an child element to the parent
324   - * @param string The name element
325   - * @param domNode
326   - * @return domNode
327   - */
328   - private function addElement($name, $parent=false, $ns=false){
329   - if($ns)
330   - $el=$this->doc->createElementNS($ns,$name);
331   - else
332   - $el=$this->doc->createElement($name);
333   - if($parent)
334   - $parent->appendChild($el);
335   - return $el;
336   - }
337   -}
  1 +<?php
  2 +/**
  3 + * Class that can generate a WSDL document from PHP code
  4 + *
  5 + * This class generates a WSDL document for the given
  6 + * methods when the the methods and parameters are documented
  7 + * enough. When there is not enough documentation available (ie
  8 + * unclear what the type of a variable or return type is) a
  9 + * WSDLException is thrown.
  10 + *
  11 + *
  12 + *@author KnowledgeTree Team
  13 + *@package Webservice
  14 + *@version Version 0.9
  15 + */
  16 +class WSDLStruct {
  17 + /** @var boolean */
  18 + public $_debug = false;
  19 +
  20 + /** @var int binding type: SOAP_RPC | SOAP_DOCUMENT */
  21 + public $binding_style;
  22 +
  23 + /** @var int use: SOAP_LITERAL | SOAP_ENCODED */
  24 + public $use;
  25 + /************************** Private properties ***************************/
  26 +
  27 + /** @var SOAPService[] */
  28 + private $services = Array();
  29 +
  30 + /** @var domElement[] */
  31 + private $serviceTags = Array();
  32 +
  33 + /** @var domElement[] */
  34 + private $operationTags = Array();
  35 +
  36 + /** @var domElement[] references to the portType tags. servicename as key */
  37 + private $portTypeTags = Array();
  38 +
  39 + /** @var domElement[] references to the binding tags. servicename as key */
  40 + private $bindingTags = Array();
  41 +
  42 + /** @var domElement[] references to the binding operation tags. servicename as first key, operationname as second */
  43 + private $bindingOperationTags = Array();
  44 +
  45 + /** @var domDocument */
  46 + private $doc;
  47 +
  48 + /** @var domelement */
  49 + private $definitions;
  50 +
  51 + /** @var domelement Refference tot the types tag*/
  52 + private $typesTag;
  53 +
  54 + /** @var domelement Refference to the xsd:schema tag*/
  55 + private $xsdSchema;
  56 +
  57 + /** @var IPXMLSchema */
  58 + private $xmlSchema;
  59 +
  60 + //namespaces used
  61 + const NS_WSDL = "http://schemas.xmlsoap.org/wsdl/";
  62 + const NS_SOAP = "http://schemas.xmlsoap.org/wsdl/soap/";
  63 + const NS_ENC = "http://schemas.xmlsoap.org/soap/encoding/";
  64 + const NS_XSD = "http://www.w3.org/2001/XMLSchema";
  65 +
  66 + const CREATE_EMPTY_INPUTS = true;
  67 +
  68 + /*
  69 + * @param string Target namespace
  70 + * @param string URL for the webservice
  71 + * @return void
  72 + */
  73 + public function __construct($tns, $url, $type = SOAP_RPC, $use = SOAP_ENCODED){
  74 + if($type != SOAP_RPC && $type != SOAP_DOCUMENT) throw new Exception("Webservice type parameter should be either SOAP_RPC or SOAP_DOCUMENT");
  75 + if($use != SOAP_ENCODED && $use != SOAP_LITERAL) throw new Exception("Webservice use parameter should be either SOAP_ENCODED or SOAP_LITERAL");
  76 +
  77 + $this->use = $use;
  78 + $this->binding_style=$type;
  79 + $this->tns = $tns;
  80 + $this->url = $url;
  81 + $this->doc = new domDocument();
  82 + $this->definitions = $this->addElement("wsdl:definitions",$this->doc);
  83 +
  84 + $this->typesTag = $this->addElement("wsdl:types", $this->definitions);
  85 + $this->xsdSchema = $this->addElement("xsd:schema", $this->typesTag);
  86 + $this->xsdSchema->setAttribute("targetNamespace", $this->tns);
  87 + $this->xmlSchema = new IPXMLSchema($this->xsdSchema);
  88 +
  89 + }
  90 +
  91 + /**
  92 + * Adds the class to the services for this WSDL
  93 + *
  94 + * @param IPReflectionClass The service
  95 + * @return void
  96 + */
  97 + public function setService(IPReflectionClass $class){
  98 + $this->services[$class->classname] = $class;
  99 + $this->services[$class->classname]->getMethods(false, false);
  100 + }
  101 + /**
  102 + * @return string The WSDL document for this structure
  103 + */
  104 + public function generateDocument(){
  105 + $this->addToDebug("Generating document");
  106 +
  107 + //add all definitions
  108 + $definitions=$this->definitions;
  109 + $definitions->setAttribute("xmlns", self::NS_WSDL);
  110 + $definitions->setAttribute("xmlns:soap", self::NS_SOAP);
  111 + $definitions->setAttribute("xmlns:SOAP-ENC", self::NS_ENC);
  112 + $definitions->setAttribute("xmlns:wsdl", self::NS_WSDL);
  113 + $definitions->setAttribute("xmlns:xsd", self::NS_XSD);
  114 + $definitions->setAttribute("xmlns:tns", $this->tns);
  115 + $definitions->setAttribute("targetNamespace", $this->tns);
  116 +
  117 + //add all the services
  118 + foreach((array)$this->services as $serviceName => $service){
  119 + //add the portType
  120 + $portType = $this->addPortType($serviceName);
  121 +
  122 + //add binding
  123 + $binding = $this->addBinding($serviceName);
  124 +
  125 + //loop the operations
  126 + foreach((array)$service->methods as $operation){
  127 + $operationName = $operation->name;
  128 + $operationTag = $this->addOperation($operationName, $serviceName);
  129 +
  130 + //input
  131 + //only when to operation needs arguments
  132 + $parameters = $operation->getParameters();
  133 + if(count($parameters)>0 || self::CREATE_EMPTY_INPUTS){
  134 + $messageName = $operationName."Request";
  135 + $input=$this->addElement("wsdl:input", $operationTag);
  136 + $input->setAttribute("message", "tns:".$messageName);
  137 + $para=Array();
  138 + foreach((array)$parameters as $parameterName => $parameter){
  139 + $para[$parameterName] = $parameter->type;
  140 + }
  141 + $this->addMessage($messageName, $para);
  142 + $this->addInput($this->bindingOperationTags[$serviceName][$operationName]);
  143 + }
  144 +
  145 +
  146 + //output
  147 + //only when the operation returns something
  148 + if(!$operation->return || trim($operation->return) == "") throw new WSDLException('No return type for '.$operationName);
  149 + if(strtolower(trim($operation->return))!='void'){
  150 + $messageName = $operationName."Response";
  151 + $output = $this->addElement("wsdl:output", $operationTag);
  152 + $output->setAttribute("message", "tns:".$messageName);
  153 + $this->addOutput($this->bindingOperationTags[$serviceName][$operationName]);
  154 + $this->addMessage($messageName,Array($operation->name."Return" => $operation->return));
  155 + }
  156 + }
  157 + // SH. now add the portType and binding
  158 + $this->definitions->AppendChild($portType);
  159 + $this->definitions->AppendChild($binding);
  160 +
  161 + //add the service
  162 + $this->addService($serviceName);
  163 +
  164 + }
  165 + return $this->doc->saveXML();
  166 + }
  167 +
  168 + /**
  169 + * Adds a new operation to the given service
  170 + * @param string operation name
  171 + * @param string service name
  172 + * @return domElement
  173 + */
  174 + private function addOperation($operationName, $serviceName){
  175 + $this->addToDebug("Adding Operation: '$operationName : $serviceName'");
  176 + $operationTag = $this->addElement("wsdl:operation",$this->portTypeTags[$serviceName]);
  177 + $operationTag->setAttribute("name",$operationName);
  178 +
  179 + //create operation tag for binding
  180 + $bindingOperationTag = $this->addElement("wsdl:operation",$this->bindingTags[$serviceName]);
  181 + $bindingOperationTag->setAttribute("name",$operationName);
  182 +
  183 + //soap operation tag
  184 + $soapOperationTag = $this->addElement("soap:operation",$bindingOperationTag);
  185 + $soapOperationTag->setAttribute("soapAction",$this->url."&method=".$operationName);
  186 + $soapOperationTag->setAttribute("style",($this->binding_style == SOAP_RPC)? "rpc" : "document");
  187 +
  188 + //save references
  189 + $this->operationTags[$serviceName][$operationName] = $operationTag;
  190 + $this->bindingOperationTags[$serviceName][$operationName] = $bindingOperationTag;
  191 +
  192 + //and return
  193 + return $operationTag;
  194 + }
  195 +
  196 + /**
  197 + * adds a new service tag to the WSDL file
  198 + * @param string the service name
  199 + * @return domElement
  200 + */
  201 + private function addService($serviceName){
  202 + $this->addToDebug("Adding service: '$serviceName'");
  203 + //create service
  204 + $serviceTag=$this->addElement("wsdl:service",$this->definitions);
  205 + $serviceTag->setAttribute("name",$serviceName);
  206 +
  207 + //port tag
  208 + $portTag=$this->addElement("wsdl:port", $serviceTag);
  209 + $portTag->setAttribute("name", $serviceName."Port");
  210 + $portTag->setAttribute("binding", "tns:".$serviceName."Binding");
  211 +
  212 + //address tag
  213 + $addressTag = $this->addElement("soap:address", $portTag);
  214 + $addressTag->setAttribute("location", $this->url);
  215 +
  216 + //keep a reference
  217 + $this->serviceTags[$serviceName] = $serviceTag;
  218 + //and return
  219 + return $serviceTag;
  220 + }
  221 +
  222 + /**
  223 + * Adds a new portType to the WSDL structure
  224 + * @param string the service name for which we create a portType
  225 + * @return domElement
  226 + */
  227 + private function addPortType($serviceName){
  228 + $this->addToDebug("Adding portType: '$serviceName'");
  229 + // SH don't add to main doc just yet
  230 + // $portTypeTag=$this->addElement("wsdl:portType", $this->definitions);
  231 + $portTypeTag = $this->addElement("wsdl:portType");
  232 + $portTypeTag->setAttribute("name", $serviceName."PortType");
  233 +
  234 + //keep a reference
  235 + $this->portTypeTags[$serviceName]=$portTypeTag;
  236 + //and return
  237 + return $portTypeTag;
  238 + }
  239 +
  240 + /**
  241 + * Adds a new binding to the WSDL structure
  242 + * @param string serviceName to bind
  243 + * @return domElement
  244 + */
  245 + private function addBinding($serviceName){
  246 + $this->addToDebug("Adding binding: '$serviceName'");
  247 + // SH. don't add to main doc just yet
  248 + // $bindingTag=$this->addElement("binding");
  249 + $bindingTag=$this->addElement("binding",$this->definitions);
  250 + $bindingTag->setAttribute("name", $serviceName."Binding");
  251 + $bindingTag->setAttribute("type", "tns:".$serviceName."PortType");
  252 +
  253 + //soap binding tag
  254 + $soapBindingTag = $this->addElement("soap:binding", $bindingTag);
  255 + $soapBindingTag->setAttribute("style", ($this->binding_style == SOAP_RPC)? "rpc" : "document");
  256 + $soapBindingTag->setAttribute("transport", "http://schemas.xmlsoap.org/soap/http");
  257 +
  258 + //keep a reference
  259 + $this->bindingTags[$serviceName] = $bindingTag;
  260 + //and return
  261 + return $bindingTag;
  262 + }
  263 +
  264 + /**
  265 + * Adds a message tag to the WSDL document
  266 + * @param string Message name
  267 + * @param Array[string=>string] Array with variables & types
  268 + */
  269 + private function addMessage($name, $parts){
  270 + $this->addToDebug("Adding message: '$name'");
  271 + $msg = $this->addElement("message", $this->definitions);
  272 + $msg->setAttribute("name", $name);
  273 + foreach((array)$parts as $partName => $partType){
  274 + $this->addToDebug("Adding Message part: '$partName => $partType'");
  275 + $part=$this->addElement("part", $msg);
  276 + $part->setAttribute("name", $partName);
  277 +
  278 + //check if it is a valid XML Schema datatype
  279 + if($t = IPXMLSchema::checkSchemaType(strtolower($partType)))
  280 + $part->setAttribute("type", "xsd:".$t);
  281 + else{
  282 + //If it is an array, change the type name
  283 + $partName = (substr($partType,-2) == "[]")?substr($partType,0,strpos($partType,"["))."Array":$partType;
  284 +
  285 + $part->setAttribute("type", "tns:".$partName);
  286 + $this->xmlSchema->addComplexType($partType, $partName);
  287 + }
  288 + }
  289 + }
  290 +
  291 + /**
  292 + * Adds an input element to the given parent (an operation tag)
  293 + * @param domNode The Parent domNode
  294 + * @param boolean Kind of tag. true=input tag, false=output tag
  295 + * @return domNode The input/output node
  296 + */
  297 + private function addInput($parent, $input=true){
  298 + $name = $input ? "wsdl:input" : "wsdl:output";
  299 + $tag=$this->addElement($name, $parent);
  300 + $soapOperation=$this->addElement("soap:body", $tag);
  301 + $soapOperation->setAttribute("use", ($this->use == SOAP_ENCODED)? "encoded" : "literal");
  302 + $soapOperation->setAttribute("namespace", $this->tns);
  303 + if($this->use == SOAP_ENCODED)
  304 + $soapOperation->setAttribute("encodingStyle", self::NS_ENC);
  305 + }
  306 +
  307 + /**
  308 + * Adds an output element to the given parent (an operation tag)
  309 + * @param domNode The Parent domNode
  310 + * @return domNode The output node
  311 + */
  312 + private function addOutput($parent){
  313 + return $this->addInput($parent,false);
  314 + }
  315 +
  316 + /************************* Supporting functions ****************************/
  317 +
  318 + private function addToDebug($msg){
  319 + if($this->_debug) echo '-'.$msg." <br>\n";
  320 + }
  321 +
  322 + /**
  323 + * Adds an child element to the parent
  324 + * @param string The name element
  325 + * @param domNode
  326 + * @return domNode
  327 + */
  328 + private function addElement($name, $parent=false, $ns=false){
  329 + if($ns)
  330 + $el=$this->doc->createElementNS($ns,$name);
  331 + else
  332 + $el=$this->doc->createElement($name);
  333 + if($parent)
  334 + $parent->appendChild($el);
  335 + return $el;
  336 + }
  337 +}
338 338 ?>
339 339 \ No newline at end of file
... ...
webservice/classes/soap/WSException.class.php
1   -<?php
2   -/**
3   - * Exception class which can be thrown by
4   - * the WSHelper class.
5   - *@author KnowledgeTree Team
6   - *@package Webservice
7   - *@version Version 0.9
8   - */
9   -class WSException extends Exception {
10   - /**
11   - * @param string The error message
12   - * @return void
13   - */
14   - public function __construct($msg) {
15   - $this->msg = $msg;
16   - }
17   - /**
18   - * @return void
19   - */
20   - public function Display() {
21   - echo $this->msg;
22   - }
23   -}
  1 +<?php
  2 +/**
  3 + * Exception class which can be thrown by
  4 + * the WSHelper class.
  5 + *@author KnowledgeTree Team
  6 + *@package Webservice
  7 + *@version Version 0.9
  8 + */
  9 +class WSException extends Exception {
  10 + /**
  11 + * @param string The error message
  12 + * @return void
  13 + */
  14 + public function __construct($msg) {
  15 + $this->msg = $msg;
  16 + }
  17 + /**
  18 + * @return void
  19 + */
  20 + public function Display() {
  21 + echo $this->msg;
  22 + }
  23 +}
24 24 ?>
25 25 \ No newline at end of file
... ...
webservice/classes/soap/WSHelper.class.php
1   -<?php
2   -/**
3   - * Class that generates a WSDL file and creates documentation
4   - * for the webservices.
5   - *
6   - *@author KnowledgeTree Team
7   - *@package Webservice
8   - *@version Version 0.9
9   - */
10   -class WSHelper {
11   - private $uri;
12   - private $class = null; //IPReflectionClass object
13   - private $name; //class name
14   - private $persistence = SOAP_PERSISTENCE_SESSION;
15   - private $wsdlfile; //wsdl file name
16   - private $server; //soap server object
17   -
18   - public $actor;
19   - public $structureMap = array();
20   - public $classNameArr = array();
21   - public $wsdlFolder; //WSDL cache folder
22   - public $useWSDLCache = true;
23   -
24   - public $type = SOAP_RPC;
25   - public $use = SOAP_LITERAL;
26   -
27   - /**
28   - * Constructor
29   - * @param string The Uri name
30   - * @return void
31   - */
32   - public function __construct($uri, $class=null){
33   - $this->uri = $uri;
34   - $this->setWSDLCacheFolder($_SERVER['DOCUMENT_ROOT'].dirname($_SERVER['PHP_SELF'])."/wsdl/");
35   - if($class) $this->setClass($class);
36   - }
37   -
38   - /**
39   - * Adds the given class name to the list of classes
40   - * to be included in the documentation/WSDL/Request handlers
41   - * @param string
42   - * @return void
43   - */
44   - public function setClass($name){
45   - $this->name = $name;
46   - $this->wsdlfile = $this->wsdlFolder.$this->name.".wsdl";
47   - }
48   -
49   - public function setWSDLCacheFolder($folder) {
50   - $this->wsdlFolder = $folder;
51   - //reset wsdlfile
52   - $this->wsdlfile = $this->wsdlFolder.$this->name.".wsdl";
53   - }
54   - /**
55   - * Sets the persistence level for the soap class
56   - */
57   - public function setPersistence($persistence) {
58   - $this->persistence = $persistence;
59   - }
60   -
61   - /**
62   - * Handles everything. Makes sure the webservice is handled,
63   - * documentations is generated, or the wsdl is generated,
64   - * according to the page request
65   - * @return void
66   - */
67   - public function handle(){
68   - if(substr($_SERVER['QUERY_STRING'], -4) == 'wsdl'){
69   - $this->showWSDL();
70   - }elseif(isset($GLOBALS['HTTP_RAW_POST_DATA']) && strlen($GLOBALS['HTTP_RAW_POST_DATA'])>0){
71   - $this->handleRequest();
72   - }else{
73   - $this->createDocumentation();
74   - }
75   - }
76   - /**
77   - * Checks if the current WSDL is up-to-date, regenerates if necessary and outputs the WSDL
78   - * @return void
79   - */
80   - public function showWSDL(){
81   - //check if it's a legal webservice class
82   - if(!in_array($this->name, $this->classNameArr))
83   - throw new Exception("No valid webservice class.");
84   -
85   - //@TODO: nog een mooie oplossing voor het cachen zoeken
86   - header("Content-type: text/xml");
87   - if($this->useWSDLCache && file_exists($this->wsdlfile)){
88   - readfile($this->wsdlfile);
89   - }else{
90   - //make sure to refresh PHP WSDL cache system
91   - ini_set("soap.wsdl_cache_enabled",0);
92   - echo $this->createWSDL();
93   - }
94   - }
95   -
96   - private function createWSDL(){
97   - $this->class = new IPReflectionClass($this->name);
98   - $wsdl = new WSDLStruct($this->uri, "http://".$_SERVER['HTTP_HOST'].$_SERVER['SCRIPT_NAME']."?class=".$this->name, $this->type, $this->use);
99   - $wsdl->setService($this->class);
100   -
101   - try {
102   - $gendoc = $wsdl->generateDocument();
103   - } catch (WSDLException $exception) {
104   - $exception->Display();
105   - exit();
106   - }
107   -
108   - $fh = fopen($this->wsdlfile, "w+");
109   - fwrite($fh, $gendoc);
110   - fclose($fh);
111   -
112   - return $gendoc;
113   - }
114   -
115   - /**
116   - * Lets the native PHP5 soap implementation handle the request
117   - * after registrating the class
118   - * @return void
119   - */
120   - private function handleRequest(){
121   - //check if it's a legal webservice class
122   - if(!in_array($this->name, $this->classNameArr))
123   - throw new Exception("No valid webservice class.");
124   -
125   - //check cache
126   - //if(!file_exists($this->wsdlfile))
127   - $this->createWSDL();
128   -
129   - $options = Array('actor' => $this->actor, 'classmap' => $this->structureMap);
130   -
131   - header("Content-type: text/xml");
132   - $this->server = new SoapServer($this->wsdlfile, $options);
133   - $this->server->setClass($this->name);
134   - $this->server->setPersistence($this->persistence);
135   -
136   - use_soap_error_handler(true);
137   - $this->server->handle();
138   - }
139   -
140   - /**
141   - * @param string code
142   - * @param string string
143   - * @param string actor
144   - * @param mixed details
145   - * @param string name
146   - * @return void
147   - */
148   - public function fault($code, $string, $actor, $details, $name='') {
149   - return $this->server->fault($code, $string, $actor, $details, $name);
150   - }
151   -
152   - /**
153   - * Generates the documentations for the webservice usage.
154   - * @TODO: "int", "boolean", "double", "float", "string", "void"
155   - * @param string Template filename
156   - * @return void
157   - */
158   - public function createDocumentation($template="classes/soap/templates/docclass.xsl") {
159   - if(!is_file($template))
160   - throw new WSException("Could not find the template file: '$template'");
161   - $this->class = new IPReflectionClass($this->name);
162   - $xtpl = new IPXSLTemplate($template);
163   - $documentation = Array();
164   - $documentation['menu'] = Array();
165   - //loop menu items
166   - sort($this->classNameArr);
167   - foreach($this->classNameArr as $className) {
168   - $documentation['menu'][] = new IPReflectionClass($className);
169   - }
170   -
171   - if($this->class){
172   - $this->class->properties = $this->class->getProperties(false, false);
173   - $this->class->methods = $this->class->getMethods(false, false);
174   - foreach((array)$this->class->methods as $method) {
175   - $method->params = $method->getParameters();
176   - }
177   -
178   - $documentation['class'] = $this->class;
179   - }
180   - echo $xtpl->execute($documentation);
181   - }
182   -}
  1 +<?php
  2 +/**
  3 + * Class that generates a WSDL file and creates documentation
  4 + * for the webservices.
  5 + *
  6 + *@author KnowledgeTree Team
  7 + *@package Webservice
  8 + *@version Version 0.9
  9 + */
  10 +class WSHelper {
  11 + private $uri;
  12 + private $class = null; //IPReflectionClass object
  13 + private $name; //class name
  14 + private $persistence = SOAP_PERSISTENCE_SESSION;
  15 + private $wsdlfile; //wsdl file name
  16 + private $server; //soap server object
  17 +
  18 + public $actor;
  19 + public $structureMap = array();
  20 + public $classNameArr = array();
  21 + public $wsdlFolder; //WSDL cache folder
  22 + public $useWSDLCache = true;
  23 +
  24 + public $type = SOAP_RPC;
  25 + public $use = SOAP_LITERAL;
  26 +
  27 + /**
  28 + * Constructor
  29 + * @param string The Uri name
  30 + * @return void
  31 + */
  32 + public function __construct($uri, $class=null){
  33 + $this->uri = $uri;
  34 + $this->setWSDLCacheFolder($_SERVER['DOCUMENT_ROOT'].dirname($_SERVER['PHP_SELF'])."/wsdl/");
  35 + if($class) $this->setClass($class);
  36 + }
  37 +
  38 + /**
  39 + * Adds the given class name to the list of classes
  40 + * to be included in the documentation/WSDL/Request handlers
  41 + * @param string
  42 + * @return void
  43 + */
  44 + public function setClass($name){
  45 + $this->name = $name;
  46 + $this->wsdlfile = $this->wsdlFolder.$this->name.".wsdl";
  47 + }
  48 +
  49 + public function setWSDLCacheFolder($folder) {
  50 + $this->wsdlFolder = $folder;
  51 + //reset wsdlfile
  52 + $this->wsdlfile = $this->wsdlFolder.$this->name.".wsdl";
  53 + }
  54 + /**
  55 + * Sets the persistence level for the soap class
  56 + */
  57 + public function setPersistence($persistence) {
  58 + $this->persistence = $persistence;
  59 + }
  60 +
  61 + /**
  62 + * Handles everything. Makes sure the webservice is handled,
  63 + * documentations is generated, or the wsdl is generated,
  64 + * according to the page request
  65 + * @return void
  66 + */
  67 + public function handle(){
  68 + if(substr($_SERVER['QUERY_STRING'], -4) == 'wsdl'){
  69 + $this->showWSDL();
  70 + }elseif(isset($GLOBALS['HTTP_RAW_POST_DATA']) && strlen($GLOBALS['HTTP_RAW_POST_DATA'])>0){
  71 + $this->handleRequest();
  72 + }else{
  73 + $this->createDocumentation();
  74 + }
  75 + }
  76 + /**
  77 + * Checks if the current WSDL is up-to-date, regenerates if necessary and outputs the WSDL
  78 + * @return void
  79 + */
  80 + public function showWSDL(){
  81 + //check if it's a legal webservice class
  82 + if(!in_array($this->name, $this->classNameArr))
  83 + throw new Exception("No valid webservice class.");
  84 +
  85 + //@TODO: nog een mooie oplossing voor het cachen zoeken
  86 + header("Content-type: text/xml");
  87 + if($this->useWSDLCache && file_exists($this->wsdlfile)){
  88 + readfile($this->wsdlfile);
  89 + }else{
  90 + //make sure to refresh PHP WSDL cache system
  91 + ini_set("soap.wsdl_cache_enabled",0);
  92 + echo $this->createWSDL();
  93 + }
  94 + }
  95 +
  96 + private function createWSDL(){
  97 + $this->class = new IPReflectionClass($this->name);
  98 + $wsdl = new WSDLStruct($this->uri, "http://".$_SERVER['HTTP_HOST'].$_SERVER['SCRIPT_NAME']."?class=".$this->name, $this->type, $this->use);
  99 + $wsdl->setService($this->class);
  100 +
  101 + try {
  102 + $gendoc = $wsdl->generateDocument();
  103 + } catch (WSDLException $exception) {
  104 + $exception->Display();
  105 + exit();
  106 + }
  107 +
  108 + $fh = fopen($this->wsdlfile, "w+");
  109 + fwrite($fh, $gendoc);
  110 + fclose($fh);
  111 +
  112 + return $gendoc;
  113 + }
  114 +
  115 + /**
  116 + * Lets the native PHP5 soap implementation handle the request
  117 + * after registrating the class
  118 + * @return void
  119 + */
  120 + private function handleRequest(){
  121 + //check if it's a legal webservice class
  122 + if(!in_array($this->name, $this->classNameArr))
  123 + throw new Exception("No valid webservice class.");
  124 +
  125 + //check cache
  126 + //if(!file_exists($this->wsdlfile))
  127 + $this->createWSDL();
  128 +
  129 + $options = Array('actor' => $this->actor, 'classmap' => $this->structureMap);
  130 +
  131 + header("Content-type: text/xml");
  132 + $this->server = new SoapServer($this->wsdlfile, $options);
  133 + $this->server->setClass($this->name);
  134 + $this->server->setPersistence($this->persistence);
  135 +
  136 + use_soap_error_handler(true);
  137 + $this->server->handle();
  138 + }
  139 +
  140 + /**
  141 + * @param string code
  142 + * @param string string
  143 + * @param string actor
  144 + * @param mixed details
  145 + * @param string name
  146 + * @return void
  147 + */
  148 + public function fault($code, $string, $actor, $details, $name='') {
  149 + return $this->server->fault($code, $string, $actor, $details, $name);
  150 + }
  151 +
  152 + /**
  153 + * Generates the documentations for the webservice usage.
  154 + * @TODO: "int", "boolean", "double", "float", "string", "void"
  155 + * @param string Template filename
  156 + * @return void
  157 + */
  158 + public function createDocumentation($template="classes/soap/templates/docclass.xsl") {
  159 + if(!is_file($template))
  160 + throw new WSException("Could not find the template file: '$template'");
  161 + $this->class = new IPReflectionClass($this->name);
  162 + $xtpl = new IPXSLTemplate($template);
  163 + $documentation = Array();
  164 + $documentation['menu'] = Array();
  165 + //loop menu items
  166 + sort($this->classNameArr);
  167 + foreach($this->classNameArr as $className) {
  168 + $documentation['menu'][] = new IPReflectionClass($className);
  169 + }
  170 +
  171 + if($this->class){
  172 + $this->class->properties = $this->class->getProperties(false, false);
  173 + $this->class->methods = $this->class->getMethods(false, false);
  174 + foreach((array)$this->class->methods as $method) {
  175 + $method->params = $method->getParameters();
  176 + }
  177 +
  178 + $documentation['class'] = $this->class;
  179 + }
  180 + echo $xtpl->execute($documentation);
  181 + }
  182 +}
183 183 ?>
184 184 \ No newline at end of file
... ...
webservice/classes/soap/common.php
... ... @@ -40,48 +40,48 @@
40 40 * @version Version 0.1
41 41 */
42 42  
43   -
44   -error_reporting(E_ALL);
45   -ob_start("ob_gzhandler");
46   -
47   -require_once ("config.php");
48   -
49   -if(!extension_loaded("soap"))
50   - die("Soap extension not loaded!");
51   -
52   -session_start();
53   -
  43 +
  44 +error_reporting(E_ALL);
  45 +ob_start("ob_gzhandler");
  46 +
  47 +require_once ("config.php");
  48 +
  49 +if(!extension_loaded("soap"))
  50 + die("Soap extension not loaded!");
  51 +
  52 +session_start();
  53 +
54 54 /** autoload function for PHP5
55 55 * Loads all the classes in the model
56 56 *
57   -*/
58   -function __autoload($classname) {
59   - try{
60   - if(file_exists("classes/soap/model/$classname.class.php"))
61   - include("classes/soap/model/$classname.class.php");
62   - elseif(file_exists("classes/soap/$classname.class.php"))
63   - include("classes/soap/$classname.class.php");
64   - elseif(file_exists("classes/soap/$classname.class.php"))
65   - include("classes/soap/$classname.class.php");
66   - } catch (Exception $e) {
67   - echo $e->getMessage();
68   - }
69   -
70   -}
71   -
72   -/** Write out debug file */
73   -function debug($txt,$file="debug.txt"){
74   - $fp = fopen($file, "a");
75   - fwrite($fp, str_replace("\n","\r\n","\r\n".$txt));
76   - fclose($fp);
77   -}
78   -
79   -/** Write out object in the debug log */
80   -function debugObject($txt,$obj){
81   - ob_start();
82   - print_r($obj);
83   - $data = ob_get_contents();
84   - ob_end_clean();
85   - debug($txt."\n".$data);
86   -}
87   -?>
  57 +*/
  58 +function __autoload($classname) {
  59 + try{
  60 + if(file_exists("classes/soap/model/$classname.class.php"))
  61 + include("classes/soap/model/$classname.class.php");
  62 + elseif(file_exists("classes/soap/$classname.class.php"))
  63 + include("classes/soap/$classname.class.php");
  64 + elseif(file_exists("classes/soap/$classname.class.php"))
  65 + include("classes/soap/$classname.class.php");
  66 + } catch (Exception $e) {
  67 + echo $e->getMessage();
  68 + }
  69 +
  70 +}
  71 +
  72 +/** Write out debug file */
  73 +function debug($txt,$file="debug.txt"){
  74 + $fp = fopen($file, "a");
  75 + fwrite($fp, str_replace("\n","\r\n","\r\n".$txt));
  76 + fclose($fp);
  77 +}
  78 +
  79 +/** Write out object in the debug log */
  80 +function debugObject($txt,$obj){
  81 + ob_start();
  82 + print_r($obj);
  83 + $data = ob_get_contents();
  84 + ob_end_clean();
  85 + debug($txt."\n".$data);
  86 +}
  87 +?>
... ...
webservice/classes/soap/templates/docclass.xsl
1   -<xsl:stylesheet
2   - version="1.0"
3   - xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
4   - xmlns:php="http://php.net/xsl"
5   - xmlns:ipub="http://www.ipublisher.nl/4.0"
6   - xmlns:exsl="http://exslt.org/common"
7   - xmlns:str="http://exslt.org/strings"
8   - xmlns:date="http://exslt.org/dates-and-times"
9   - extension-element-prefixes="str exsl date"
10   - >
11   -<xsl:include href="str.replace.function.xsl"/>
12   -<xsl:output method="html" encoding="utf-8" indent="yes" doctype-public="-//W3C//DTD XHTML 1.0 Transitional//EN" doctype-system="http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd" media-type="text/html"/>
13   -
14   -<xsl:template match="/model">
15   - <html>
16   - <head>
17   - <title>Webservices</title>
18   - <link rel="stylesheet" href="classes/soap/templates/css/doc.css" type="text/css" ></link>
19   - </head>
20   - <body>
21   - <div id="main">
22   - <div id="mainheader">
23   - <div id="mainheaderpadded">
24   - <xsl:if test="class != ''">
25   - <h1><xsl:value-of select="class/name" /> <a href="?class={class/name}&amp;wsdl">&#160;[WSDL]</a></h1>
26   - </xsl:if>
27   - </div>
28   - </div>
29   - <div id="mainpadded">
30   - <table cellpadding="0" cellspacing="0">
31   - <tr>
32   - <td id="menu">
33   - <h2>Classes</h2>
34   - <xsl:for-each select="/model/menu/*">
35   - <a href="?class={name}"><xsl:value-of select="name"/></a><br />
36   - </xsl:for-each>
37   - </td>
38   - <td id="content">
39   - <xsl:if test="fault != ''">
40   - <xsl:value-of select="fault" />
41   - </xsl:if>
42   - <xsl:if test="class != '' and not(fault)">
43   -
44   - <h2>Full description</h2>
45   - <p><xsl:value-of select="class/fullDescription" /></p>
46   -
47   - <h2>Properties</h2>
48   - <xsl:for-each select="class/properties/*">
49   - <a name="property_{name}"></a>
50   - <div class="property{warning}">
51   - <b><xsl:value-of select="name" /></b><br />
52   - <xsl:choose>
53   - <xsl:when test="type != ''">
54   - <xsl:choose>
55   - <xsl:when test="contains('int,boolean,double,float,string,void', type)">
56   - <i>type <xsl:value-of select="type" /></i><br />
57   - </xsl:when>
58   - <xsl:otherwise>
59   - <i>type <a href="?class={str:replace(type,'[]','')}"><xsl:value-of select="type" /></a></i><br />
60   - </xsl:otherwise>
61   - </xsl:choose>
62   - </xsl:when>
63   - <xsl:otherwise>
64   - <div class='warning'><img src='classes/soap/templates/images/doc/warning.gif'/> missing type info</div><br />
65   - </xsl:otherwise>
66   - </xsl:choose>
67   - <xsl:value-of select="fullDescription" />
68   - </div>
69   - </xsl:for-each>
70   -
71   - <h2>Methods</h2>
72   - <xsl:for-each select="class/methods/*">
73   - <a name="method_{name}"></a>
74   - <div class="method{warning}">
75   - <b><xsl:value-of select="name" /></b>(
76   - <xsl:for-each select="params/*">
77   - <xsl:value-of select="name"/>
78   - <xsl:if test="position() != last()">,</xsl:if>
79   - </xsl:for-each>
80   - )
81   - <br />
82   - <xsl:choose>
83   - <xsl:when test="return != ''">
84   - <xsl:choose>
85   - <xsl:when test="contains('int,boolean,double,float,string,void', return)">
86   - <i>returns <xsl:value-of select="return" /></i><br />
87   - </xsl:when>
88   - <xsl:otherwise>
89   - <i>returns <a href="?class={str:replace(return,'[]','')}"><xsl:value-of select="return" /></a></i><br />
90   - </xsl:otherwise>
91   - </xsl:choose>
92   - </xsl:when>
93   - <xsl:otherwise>
94   - <div class='warning'><img src='images/doc/warning.gif'/> missing return value</div><br />
95   - </xsl:otherwise>
96   - </xsl:choose>
97   - <xsl:choose>
98   - <xsl:when test="throws != ''">
99   - <i>throws <xsl:value-of select="throws" /></i><br />
100   - </xsl:when>
101   - </xsl:choose>
102   - <xsl:value-of select="fullDescription" /><br />
103   - </div>
104   - </xsl:for-each>
105   - </xsl:if>
106   - </td>
107   - </tr>
108   - </table>
109   -
110   - </div>
111   - <div id="mainfooter"><img src="images/doc/backbottom.jpg" /></div>
112   - </div>
113   - </body>
114   - </html>
115   -</xsl:template>
  1 +<xsl:stylesheet
  2 + version="1.0"
  3 + xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
  4 + xmlns:php="http://php.net/xsl"
  5 + xmlns:ipub="http://www.ipublisher.nl/4.0"
  6 + xmlns:exsl="http://exslt.org/common"
  7 + xmlns:str="http://exslt.org/strings"
  8 + xmlns:date="http://exslt.org/dates-and-times"
  9 + extension-element-prefixes="str exsl date"
  10 + >
  11 +<xsl:include href="str.replace.function.xsl"/>
  12 +<xsl:output method="html" encoding="utf-8" indent="yes" doctype-public="-//W3C//DTD XHTML 1.0 Transitional//EN" doctype-system="http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd" media-type="text/html"/>
  13 +
  14 +<xsl:template match="/model">
  15 + <html>
  16 + <head>
  17 + <title>Webservices</title>
  18 + <link rel="stylesheet" href="classes/soap/templates/css/doc.css" type="text/css" ></link>
  19 + </head>
  20 + <body>
  21 + <div id="main">
  22 + <div id="mainheader">
  23 + <div id="mainheaderpadded">
  24 + <xsl:if test="class != ''">
  25 + <h1><xsl:value-of select="class/name" /> <a href="?class={class/name}&amp;wsdl">&#160;[WSDL]</a></h1>
  26 + </xsl:if>
  27 + </div>
  28 + </div>
  29 + <div id="mainpadded">
  30 + <table cellpadding="0" cellspacing="0">
  31 + <tr>
  32 + <td id="menu">
  33 + <h2>Classes</h2>
  34 + <xsl:for-each select="/model/menu/*">
  35 + <a href="?class={name}"><xsl:value-of select="name"/></a><br />
  36 + </xsl:for-each>
  37 + </td>
  38 + <td id="content">
  39 + <xsl:if test="fault != ''">
  40 + <xsl:value-of select="fault" />
  41 + </xsl:if>
  42 + <xsl:if test="class != '' and not(fault)">
  43 +
  44 + <h2>Full description</h2>
  45 + <p><xsl:value-of select="class/fullDescription" /></p>
  46 +
  47 + <h2>Properties</h2>
  48 + <xsl:for-each select="class/properties/*">
  49 + <a name="property_{name}"></a>
  50 + <div class="property{warning}">
  51 + <b><xsl:value-of select="name" /></b><br />
  52 + <xsl:choose>
  53 + <xsl:when test="type != ''">
  54 + <xsl:choose>
  55 + <xsl:when test="contains('int,boolean,double,float,string,void', type)">
  56 + <i>type <xsl:value-of select="type" /></i><br />
  57 + </xsl:when>
  58 + <xsl:otherwise>
  59 + <i>type <a href="?class={str:replace(type,'[]','')}"><xsl:value-of select="type" /></a></i><br />
  60 + </xsl:otherwise>
  61 + </xsl:choose>
  62 + </xsl:when>
  63 + <xsl:otherwise>
  64 + <div class='warning'><img src='classes/soap/templates/images/doc/warning.gif'/> missing type info</div><br />
  65 + </xsl:otherwise>
  66 + </xsl:choose>
  67 + <xsl:value-of select="fullDescription" />
  68 + </div>
  69 + </xsl:for-each>
  70 +
  71 + <h2>Methods</h2>
  72 + <xsl:for-each select="class/methods/*">
  73 + <a name="method_{name}"></a>
  74 + <div class="method{warning}">
  75 + <b><xsl:value-of select="name" /></b>(
  76 + <xsl:for-each select="params/*">
  77 + <xsl:value-of select="name"/>
  78 + <xsl:if test="position() != last()">,</xsl:if>
  79 + </xsl:for-each>
  80 + )
  81 + <br />
  82 + <xsl:choose>
  83 + <xsl:when test="return != ''">
  84 + <xsl:choose>
  85 + <xsl:when test="contains('int,boolean,double,float,string,void', return)">
  86 + <i>returns <xsl:value-of select="return" /></i><br />
  87 + </xsl:when>
  88 + <xsl:otherwise>
  89 + <i>returns <a href="?class={str:replace(return,'[]','')}"><xsl:value-of select="return" /></a></i><br />
  90 + </xsl:otherwise>
  91 + </xsl:choose>
  92 + </xsl:when>
  93 + <xsl:otherwise>
  94 + <div class='warning'><img src='images/doc/warning.gif'/> missing return value</div><br />
  95 + </xsl:otherwise>
  96 + </xsl:choose>
  97 + <xsl:choose>
  98 + <xsl:when test="throws != ''">
  99 + <i>throws <xsl:value-of select="throws" /></i><br />
  100 + </xsl:when>
  101 + </xsl:choose>
  102 + <xsl:value-of select="fullDescription" /><br />
  103 + </div>
  104 + </xsl:for-each>
  105 + </xsl:if>
  106 + </td>
  107 + </tr>
  108 + </table>
  109 +
  110 + </div>
  111 + <div id="mainfooter"><img src="images/doc/backbottom.jpg" /></div>
  112 + </div>
  113 + </body>
  114 + </html>
  115 +</xsl:template>
116 116 </xsl:stylesheet>
117 117 \ No newline at end of file
... ...
webservice/classes/soap/templates/str.replace.function.xsl
1   -<?xml version="1.0"?>
2   -<xsl:stylesheet version="1.0"
3   - xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
4   - xmlns:str="http://exslt.org/strings"
5   - xmlns:func="http://exslt.org/functions"
6   - xmlns:exsl="http://exslt.org/common"
7   - extension-element-prefixes="str exsl func">
8   -
9   -<func:function name="str:replace">
10   - <xsl:param name="string" select="''" />
11   - <xsl:param name="search" select="/.." />
12   - <xsl:param name="replace" select="/.." />
13   - <xsl:choose>
14   - <xsl:when test="not($string)">
15   - <func:result select="/.." />
16   - </xsl:when>
17   - <xsl:when test="function-available('exsl:node-set')">
18   - <!-- this converts the search and replace arguments to node sets
19   - if they are one of the other XPath types -->
20   - <xsl:variable name="search-nodes-rtf">
21   - <xsl:copy-of select="$search" />
22   - </xsl:variable>
23   - <xsl:variable name="replace-nodes-rtf">
24   - <xsl:copy-of select="$replace" />
25   - </xsl:variable>
26   - <xsl:variable name="replacements-rtf">
27   - <xsl:for-each select="exsl:node-set($search-nodes-rtf)/node()">
28   - <xsl:variable name="pos" select="position()" />
29   - <replace search="{.}">
30   - <xsl:copy-of select="exsl:node-set($replace-nodes-rtf)/node()[$pos]" />
31   - </replace>
32   - </xsl:for-each>
33   - </xsl:variable>
34   - <xsl:variable name="sorted-replacements-rtf">
35   - <xsl:for-each select="exsl:node-set($replacements-rtf)/replace">
36   - <xsl:sort select="string-length(@search)" data-type="number" order="descending" />
37   - <xsl:copy-of select="." />
38   - </xsl:for-each>
39   - </xsl:variable>
40   - <xsl:variable name="result">
41   - <xsl:choose>
42   - <xsl:when test="not($search)">
43   - <xsl:value-of select="$string" />
44   - </xsl:when>
45   - <xsl:otherwise>
46   - <xsl:call-template name="str:_replace">
47   - <xsl:with-param name="string" select="$string" />
48   - <xsl:with-param name="replacements" select="exsl:node-set($sorted-replacements-rtf)/replace" />
49   - </xsl:call-template>
50   - </xsl:otherwise>
51   - </xsl:choose>
52   - </xsl:variable>
53   - <func:result select="exsl:node-set($result)/node()" />
54   - </xsl:when>
55   - <xsl:otherwise>
56   - <xsl:message terminate="yes">
57   - ERROR: function implementation of str:replace() relies on exsl:node-set().
58   - </xsl:message>
59   - </xsl:otherwise>
60   - </xsl:choose>
61   -</func:function>
62   -
63   -<xsl:template name="str:_replace">
64   - <xsl:param name="string" select="''" />
65   - <xsl:param name="replacements" select="/.." />
66   - <xsl:choose>
67   - <xsl:when test="not($string)" />
68   - <xsl:when test="not($replacements)">
69   - <xsl:value-of select="$string" />
70   - </xsl:when>
71   - <xsl:otherwise>
72   - <xsl:variable name="replacement" select="$replacements[1]" />
73   - <xsl:variable name="search" select="$replacement/@search" />
74   - <xsl:choose>
75   - <xsl:when test="not(string($search))">
76   - <xsl:value-of select="substring($string, 1, 1)" />
77   - <xsl:copy-of select="$replacement/node()" />
78   - <xsl:call-template name="str:_replace">
79   - <xsl:with-param name="string" select="substring($string, 2)" />
80   - <xsl:with-param name="replacements" select="$replacements" />
81   - </xsl:call-template>
82   - </xsl:when>
83   - <xsl:when test="contains($string, $search)">
84   - <xsl:call-template name="str:_replace">
85   - <xsl:with-param name="string" select="substring-before($string, $search)" />
86   - <xsl:with-param name="replacements" select="$replacements[position() > 1]" />
87   - </xsl:call-template>
88   - <xsl:copy-of select="$replacement/node()" />
89   - <xsl:call-template name="str:_replace">
90   - <xsl:with-param name="string" select="substring-after($string, $search)" />
91   - <xsl:with-param name="replacements" select="$replacements" />
92   - </xsl:call-template>
93   - </xsl:when>
94   - <xsl:otherwise>
95   - <xsl:call-template name="str:_replace">
96   - <xsl:with-param name="string" select="$string" />
97   - <xsl:with-param name="replacements" select="$replacements[position() > 1]" />
98   - </xsl:call-template>
99   - </xsl:otherwise>
100   - </xsl:choose>
101   - </xsl:otherwise>
102   - </xsl:choose>
103   -</xsl:template>
104   -
  1 +<?xml version="1.0"?>
  2 +<xsl:stylesheet version="1.0"
  3 + xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
  4 + xmlns:str="http://exslt.org/strings"
  5 + xmlns:func="http://exslt.org/functions"
  6 + xmlns:exsl="http://exslt.org/common"
  7 + extension-element-prefixes="str exsl func">
  8 +
  9 +<func:function name="str:replace">
  10 + <xsl:param name="string" select="''" />
  11 + <xsl:param name="search" select="/.." />
  12 + <xsl:param name="replace" select="/.." />
  13 + <xsl:choose>
  14 + <xsl:when test="not($string)">
  15 + <func:result select="/.." />
  16 + </xsl:when>
  17 + <xsl:when test="function-available('exsl:node-set')">
  18 + <!-- this converts the search and replace arguments to node sets
  19 + if they are one of the other XPath types -->
  20 + <xsl:variable name="search-nodes-rtf">
  21 + <xsl:copy-of select="$search" />
  22 + </xsl:variable>
  23 + <xsl:variable name="replace-nodes-rtf">
  24 + <xsl:copy-of select="$replace" />
  25 + </xsl:variable>
  26 + <xsl:variable name="replacements-rtf">
  27 + <xsl:for-each select="exsl:node-set($search-nodes-rtf)/node()">
  28 + <xsl:variable name="pos" select="position()" />
  29 + <replace search="{.}">
  30 + <xsl:copy-of select="exsl:node-set($replace-nodes-rtf)/node()[$pos]" />
  31 + </replace>
  32 + </xsl:for-each>
  33 + </xsl:variable>
  34 + <xsl:variable name="sorted-replacements-rtf">
  35 + <xsl:for-each select="exsl:node-set($replacements-rtf)/replace">
  36 + <xsl:sort select="string-length(@search)" data-type="number" order="descending" />
  37 + <xsl:copy-of select="." />
  38 + </xsl:for-each>
  39 + </xsl:variable>
  40 + <xsl:variable name="result">
  41 + <xsl:choose>
  42 + <xsl:when test="not($search)">
  43 + <xsl:value-of select="$string" />
  44 + </xsl:when>
  45 + <xsl:otherwise>
  46 + <xsl:call-template name="str:_replace">
  47 + <xsl:with-param name="string" select="$string" />
  48 + <xsl:with-param name="replacements" select="exsl:node-set($sorted-replacements-rtf)/replace" />
  49 + </xsl:call-template>
  50 + </xsl:otherwise>
  51 + </xsl:choose>
  52 + </xsl:variable>
  53 + <func:result select="exsl:node-set($result)/node()" />
  54 + </xsl:when>
  55 + <xsl:otherwise>
  56 + <xsl:message terminate="yes">
  57 + ERROR: function implementation of str:replace() relies on exsl:node-set().
  58 + </xsl:message>
  59 + </xsl:otherwise>
  60 + </xsl:choose>
  61 +</func:function>
  62 +
  63 +<xsl:template name="str:_replace">
  64 + <xsl:param name="string" select="''" />
  65 + <xsl:param name="replacements" select="/.." />
  66 + <xsl:choose>
  67 + <xsl:when test="not($string)" />
  68 + <xsl:when test="not($replacements)">
  69 + <xsl:value-of select="$string" />
  70 + </xsl:when>
  71 + <xsl:otherwise>
  72 + <xsl:variable name="replacement" select="$replacements[1]" />
  73 + <xsl:variable name="search" select="$replacement/@search" />
  74 + <xsl:choose>
  75 + <xsl:when test="not(string($search))">
  76 + <xsl:value-of select="substring($string, 1, 1)" />
  77 + <xsl:copy-of select="$replacement/node()" />
  78 + <xsl:call-template name="str:_replace">
  79 + <xsl:with-param name="string" select="substring($string, 2)" />
  80 + <xsl:with-param name="replacements" select="$replacements" />
  81 + </xsl:call-template>
  82 + </xsl:when>
  83 + <xsl:when test="contains($string, $search)">
  84 + <xsl:call-template name="str:_replace">
  85 + <xsl:with-param name="string" select="substring-before($string, $search)" />
  86 + <xsl:with-param name="replacements" select="$replacements[position() > 1]" />
  87 + </xsl:call-template>
  88 + <xsl:copy-of select="$replacement/node()" />
  89 + <xsl:call-template name="str:_replace">
  90 + <xsl:with-param name="string" select="substring-after($string, $search)" />
  91 + <xsl:with-param name="replacements" select="$replacements" />
  92 + </xsl:call-template>
  93 + </xsl:when>
  94 + <xsl:otherwise>
  95 + <xsl:call-template name="str:_replace">
  96 + <xsl:with-param name="string" select="$string" />
  97 + <xsl:with-param name="replacements" select="$replacements[position() > 1]" />
  98 + </xsl:call-template>
  99 + </xsl:otherwise>
  100 + </xsl:choose>
  101 + </xsl:otherwise>
  102 + </xsl:choose>
  103 +</xsl:template>
  104 +
105 105 </xsl:stylesheet>
106 106 \ No newline at end of file
... ...
webservice/tests/annotations.php
1   -<?
2   -chdir("..");
3   -include "common.php";
4   -
5   -class DefaultController {
6   - const TYPE_PLAIN = 1;
7   - const TYPE_HTML = 2;
8   - public $type;
9   - public $length;
10   -}
11   -/**
12   - * @ann1('me'=>'you');
13   - */
14   -class something{
15   - /**
16   - * @var string
17   - * @Controller(type => DefaultController::TYPE_PLAIN, length => 100)
18   - */
19   - public $propertyA;
20   -
21   - /**
22   - * @var string
23   - * @Controller(type => DefaultController::TYPE_HTML, length => 100)
24   - */
25   - public function methodB () {
26   - return "aap";
27   - }
28   -}
29   -
30   -/* Annotation example */
31   -$rel = new IPReflectionClass("something");
32   -$properties = $rel->getProperties();
33   -$methods = $rel->getMethods();
34   -
35   -var_dump($rel->getAnnotation("ann1", "stdClass"));
36   -
37   -$property = $properties["propertyA"];
38   -$ann = $property->getAnnotation("Controller", "DefaultController");
39   -var_dump($ann);
40   -
41   -$method = $methods["methodB"];
42   -$ann = $method->getAnnotation("Controller", "DefaultController");
43   -var_dump($ann);
  1 +<?
  2 +chdir("..");
  3 +include "common.php";
  4 +
  5 +class DefaultController {
  6 + const TYPE_PLAIN = 1;
  7 + const TYPE_HTML = 2;
  8 + public $type;
  9 + public $length;
  10 +}
  11 +/**
  12 + * @ann1('me'=>'you');
  13 + */
  14 +class something{
  15 + /**
  16 + * @var string
  17 + * @Controller(type => DefaultController::TYPE_PLAIN, length => 100)
  18 + */
  19 + public $propertyA;
  20 +
  21 + /**
  22 + * @var string
  23 + * @Controller(type => DefaultController::TYPE_HTML, length => 100)
  24 + */
  25 + public function methodB () {
  26 + return "aap";
  27 + }
  28 +}
  29 +
  30 +/* Annotation example */
  31 +$rel = new IPReflectionClass("something");
  32 +$properties = $rel->getProperties();
  33 +$methods = $rel->getMethods();
  34 +
  35 +var_dump($rel->getAnnotation("ann1", "stdClass"));
  36 +
  37 +$property = $properties["propertyA"];
  38 +$ann = $property->getAnnotation("Controller", "DefaultController");
  39 +var_dump($ann);
  40 +
  41 +$method = $methods["methodB"];
  42 +$ann = $method->getAnnotation("Controller", "DefaultController");
  43 +var_dump($ann);
44 44 ?>
45 45 \ No newline at end of file
... ...