Documentation is available at admin.php
- <?php
- /* Admin interface, called by the "contentadmin" interface class */
- class midgard_admin_sitewizard_admin {
- var $_debug_prefix;
- var $_config;
- var $_topic;
- var $_view;
- var $errcode;
- var $errstr;
- var $form_prefix;
- var $_config_dm;
- var $_l10n;
- var $_l10n_midcom;
- var $_local_toolbar;
- var $_topic_toolbar;
- function midgard_admin_sitewizard_admin($topic, $config) {
- $this->_debug_prefix = "midgard.admin.sitewizard admin::";
- $this->_config = $config;
- $this->_topic = $topic;
- $this->_view = "";
- $this->_config_dm = null;
- $this->errcode = MIDCOM_ERROK;
- $this->errstr = "";
- // get l10n libraries
- $i18n =& $GLOBALS["midcom"]->get_service("i18n");
- $this->_l10n = $i18n->get_l10n("midgard.admin.sitewizard");
- $this->_l10n_midcom = $i18n->get_l10n("midcom");
- $GLOBALS["view_l10n"] = $this->_l10n;
- $GLOBALS["view_l10n_midcom"] = $this->_l10n_midcom;
- $this->_local_toolbar =& $GLOBALS['midcom_admin_content_toolbar_component'];
- $this->_topic_toolbar =& $GLOBALS['midcom_admin_content_toolbar_main'];
- }
- function can_handle($argc, $argv) {
- debug_push($this->_debug_prefix . "can_handle");
- // see if we can handle this request
- if ($argc == 0) {
- return true;
- } else {
- return false;
- }
- }
- function handle($argc, $argv) {
- global $_REQUEST;
- debug_push($this->_debug_prefix . "handle");
- // handle args, parse the url, save data from forms, prepare output
- /* Add the topic configuration item */
- $this->_topic_toolbar->add_item(Array(
- MIDCOM_TOOLBAR_URL => '',
- MIDCOM_TOOLBAR_LABEL => $this->_l10n_midcom->get('component configuration'),
- MIDCOM_TOOLBAR_HELPTEXT => $this->_l10n_midcom->get('component configuration helptext'),
- MIDCOM_TOOLBAR_ICON => 'stock-icons/16x16/stock_folder-properties.png',
- MIDCOM_TOOLBAR_ENABLED => true
- ));
- if ($argc == 0) {
- $this->_view = "welcome";
- debug_add ("viewport = welcome");
- // Provide configuration form
- $this->_init_config();
- debug_pop ();
- return true;
- }
- debug_pop();
- return false;
- }
- function _init_config() {
- $schemadbs = $this->_config->get("schemadbs");
- $GLOBALS["view_schemadbs"] = array_merge(Array("" => $GLOBALS["view_l10n_midcom"]->get("default setting")), $schemadbs);
- $this->_config_dm = new midcom_helper_datamanager("file:/midgard/admin/sitewizard/config/schemadb_config.dat");
- if ($this->_config_dm == false) {
- debug_add("Failed to instantinate configuration datamanager.", MIDCOM_LOG_CRIT);
- $GLOBALS["midcom"]->generate_error(MIDCOM_ERRCRIT, "Failed to instantinate configuration datamanager.");
- }
- if (! $this->_config_dm->init($this->_topic)) {
- debug_add("Failed to initialize the datamanager.", MIDCOM_LOG_CRIT);
- debug_print_r("Topic object we tried was:", $this->_topic);
- $GLOBALS["midcom"]->generate_error(MIDCOM_ERRCRIT,
- "Failed to initialize configuration datamanager.");
- }
- switch ($this->_config_dm->process_form()) {
- case MIDCOM_DATAMGR_SAVED:
- debug_add("Invalidating MidCOM cache", MIDCOM_LOG_DEBUG);
- break;
- case MIDCOM_DATAMGR_EDITING:
- case MIDCOM_DATAMGR_CANCELLED:
- // We stay here whatever happens here, at least as long as
- // there is no fatal error.
- break;
- case MIDCOM_DATAMGR_FAILED:
- $this->errstr = "Datamanager: " . $GLOBALS["midcom_errstr"];
- $this->errcode = MIDCOM_ERRCRIT;
- debug_pop();
- return false;
- }
- }
- function show() {
- global $midcom;
- global $view_topic;
- $view_topic = $this->_topic;
- $GLOBALS["view_l10n"] = $this->_l10n;
- debug_push($this->_debug_prefix . "show");
- if ($this->_view == "welcome") {
- global $title;
- global $view_config;
- $view_config = $this->_config_dm;
- midcom_show_style("admin-welcome");
- }
- debug_pop();
- return true;
- }
- function get_metadata() {
- return false;
- }
- } // admin
- ?>
Documentation generated on Mon, 21 Nov 2005 18:09:42 +0100 by phpDocumentor 1.3.0RC3