Source for file interfaces.php

Documentation is available at interfaces.php

  1. <?php
  2.  
  3. class pl_olga_files_midcom {
  4.  
  5. function initialize() {
  6.  
  7. global $midcom;
  8. global $pl_olga_files_nap_activeid;
  9. global $pl_olga_files_layouts;
  10.  
  11. debug_push("pl.olga.files midcom::initialize");
  12.  
  13. $prefix = MIDCOM_ROOT . "/pl/olga/files";
  14. require("{$prefix}/viewer.php");
  15. require("{$prefix}/admin.php");
  16. require("{$prefix}/navigation.php");
  17.  
  18. $midcom->load_library("midcom.helper.datamanager");
  19.  
  20. $pl_olga_files_nap_activeid = false;
  21.  
  22. // default configuration
  23. debug_add("Loading default configuration", MIDCOM_LOG_DEBUG);
  24. $data = file_get_contents("${prefix}/config/config_default.dat");
  25. eval("\$component_default = Array ( {$data} );");
  26. $default_config = new midcom_helper_configuration($component_default);
  27. if (mgd_snippet_exists("/sitegroup-config/pl.olga.files/config")) {
  28. $snippet = mgd_get_snippet_by_path("/sitegroup-config/pl.olga.files/config");
  29. eval("\$local_default = Array ( " . $snippet->code . ");");
  30. if (!$default_config->store($local_default)) {
  31. debug_add("Sitegroup configuration is invalid, configuration management failed, aborting", MIDCOM_LOG_CRIT);
  32. debug_pop();
  33. return false;
  34. }
  35. }
  36. $GLOBALS["pl_olga_files__default_config"] = new midcom_helper_configuration($default_config->get_all());
  37.  
  38. debug_pop();
  39. return true;
  40. }
  41.  
  42.  
  43. function properties() {
  44.  
  45. $i18n =& $GLOBALS["midcom"]->get_service("i18n");
  46. $l10n = $i18n->get_l10n("pl.olga.files");
  47. return array(
  48. MIDCOM_PROP_NAME => $l10n->get("files browser"),
  49. MIDCOM_PROP_VERSION => 1
  50. );
  51. }
  52.  
  53. } // midcom
  54.  
  55.  
  56.  
  57. class pl_olga_files_component {
  58.  
  59. var $configs;
  60. var $components;
  61.  
  62.  
  63. function configure($configuration, $contextid) {
  64.  
  65. $tmp = $GLOBALS["pl_olga_files__default_config"];
  66. if (! $tmp->store($configuration))
  67. return false;
  68. $this->configs[$contextid] = $tmp;
  69. return true;
  70. }
  71.  
  72.  
  73. function can_handle($current_object, $argc, $argv, $contextid) {
  74.  
  75. $this->components[$contextid] = new pl_olga_files_viewer
  76. ($current_object, $this->configs[$contextid]);
  77. return $this->components[$contextid]->can_handle($argc, $argv);
  78. }
  79.  
  80. function handle($current_object, $argc, $argv, $contextid) {
  81.  
  82. return $this->components[$contextid]->handle($argc, $argv);
  83. }
  84.  
  85. function errcode($contextid) {
  86.  
  87. return $this->components[$contextid]->errcode;
  88. }
  89.  
  90. function errstr($contextid) {
  91.  
  92. return $this->components[$contextid]->errstr;
  93. }
  94.  
  95.  
  96. function get_metadata ($contextid) {
  97.  
  98. return $this->components[$contextid]->get_metadata ();
  99. }
  100.  
  101.  
  102. function show_content ($contextid) {
  103.  
  104. $this->components[$contextid]->show();
  105. }
  106.  
  107. } // component
  108.  
  109.  
  110.  
  111. class pl_olga_files_contentadmin {
  112.  
  113. var $configs;
  114. var $components;
  115.  
  116.  
  117. function pl_olga_files_contentadmin() {
  118.  
  119. $this->configs = array ();
  120. $this->components = array ();
  121. }
  122.  
  123.  
  124. function configure($configuration, $contextid) {
  125.  
  126. $tmp = $GLOBALS["pl_olga_files__default_config"];
  127. if (! $tmp->store($configuration))
  128. return false;
  129. $this->configs[$contextid] = $tmp;
  130. return true;
  131. }
  132.  
  133.  
  134. function can_handle($current_object, $argc, $argv, $contextid) {
  135.  
  136. $this->components[$contextid] = new pl_olga_files_admin
  137. ($current_object, $this->configs[$contextid]);
  138.  
  139. return $this->components[$contextid]->can_handle($argc, $argv);
  140. }
  141.  
  142. function handle($current_object, $argc, $argv, $contextid) {
  143.  
  144. return $this->components[$contextid]->handle($argc, $argv);
  145. }
  146.  
  147. function errcode($contextid) {
  148.  
  149. return $this->components[$contextid]->errcode;
  150. }
  151.  
  152. function errstr($contextid) {
  153.  
  154. return $this->components[$contextid]->errstr;
  155. }
  156.  
  157.  
  158. function get_metadata($contextid) {
  159.  
  160. return $this->components[$contextid]->get_metadata();
  161. }
  162.  
  163.  
  164. function show_content($contextid) {
  165.  
  166. $this->components[$contextid]->show();
  167. }
  168.  
  169. } // contentadmin
  170.  
  171.  
  172.  
  173. class pl_olga_files_nap {
  174.  
  175. var $napclass;
  176.  
  177.  
  178. function pl_olga_files_nap() {
  179.  
  180. $this->napclass = new pl_olga_files_navigation();
  181. }
  182.  
  183.  
  184. function is_internal() {
  185.  
  186. return $this->napclass->is_internal();
  187. }
  188.  
  189.  
  190. function set_object($object) {
  191.  
  192. return $this->napclass->set_object($object);
  193. }
  194.  
  195.  
  196. function get_node() {
  197.  
  198. return $this->napclass->get_node();
  199. }
  200.  
  201.  
  202. function get_current_leaf() {
  203.  
  204. return $this->napclass->get_current_leaf();
  205. }
  206.  
  207.  
  208. function get_leaves() {
  209.  
  210. return $this->napclass->get_leaves();
  211. }
  212.  
  213. } // nap
  214.  
  215. ?>

Documentation generated on Mon, 21 Nov 2005 18:17:31 +0100 by phpDocumentor 1.3.0RC3