function execute($par) { global $wgOut, $wgScriptPath, $wgRequest; $wgOut->addScriptFile("{$wgScriptPath}/extensions/metasearch/proxy.js"); $cat_stack = new MsCategoryStack($wgRequest->getArray('ms-cat')); /// TODO: Copied from QueryPage if ($cat_stack->get_top()->is_root()) { throw new MsException("Cat stack is {$cat_stack}. Please select a category", MsException::BAD_INPUT); } else { if (!$cat_stack->get_top()->has_databases()) { throw new MsException('Please select a category that has databases!', MsException::BAD_INPUT); } } // get "the" database if ($wgRequest->getVal('ms-db')) { $database = new MsDatabase($wgRequest->getVal('ms-db')); } else { $database = $cat_stack->get_top()->get_one_database(MsCategory::AS_OBJECTS); } if (!$database) { throw new MsException("No db in top cat of {$cat_stack} / ms-db param"); } // verify that we've got some 'proxydriver' type driver. // We cannot handle other drivers! if (!$database->is_driver_type('proxydriver')) { throw new MsException("MsProxyPage can only handle 'proxydriver' databases. " . "Unfortunately [{$database}] is not such a database.", MsException::BAD_INSTALLATION); } // Load common proxy engine configuration // (for proxify, etc.) $proxy_conf = MsProxyConfiguration::get_instance(); // Get values for the template: $start_url = $database->get('start_url'); if (!$start_url) { throw new MsException("start_url field missing in config for {$database}!", MsException::BAD_CONFIGURATION); } $template = new MsProxyTemplate(); # eigentlich unnoetig: #$template->set_from_array($this->database->conf); $template->set('assistant_text', wfMsg('ms-assistant-starting-bla')); $template->set('assistant_msg', 'ms-assistant-happy'); $template->set('iframe_start', $proxy_conf->proxify($start_url)); # das ist jetzt eher quick & dirty, aber den cat_stack brauch dann keiner mehr: $cat_stack->pop(); # poppen fuer catchooser_link (damit der catchooser nicht direkt zur cat leitet) $template->set('leave_biokemika_link', '#'); $template->set('catchooser_link', $this->special_page->get_sub_title('choose')->escapeFullURL(str_replace('[]', '%5B%5D', $cat_stack->build_query('ms-cat')))); //print $template->get('iframe_start');exit(); $wgOut->addTemplate($template); }
function execute() { extract($this->data); // PHP magic, mainly for shorthand $stack. ?> <div class="ms-page <?php echo 'ms-page-' . str_replace(' ', '_', $stack->get_top()->id); ?> "> <div class="ms-assistant-text"> <?php $assistant_text_msg = $stack->get_top()->get('assistant_text', 'ms-' . $stack->get_top()->id . '-presearch-box'); $assistant_msg = $stack->get_top()->get('assistant', 'ms-assistant-happy-right'); # brute force: $assistant_msg = 'ms-assistant-happy-right'; $assistant_text = wfMsg($assistant_text_msg); $assistant = wfMsg($assistant_msg); $this->wiki($assistant_text); ?> </div> <div class="ms-assistant"> <?php $this->wiki($assistant); ?> </div> <div class="ms-catchooser"> <?php // $this->data['stack'] = $stack = MsCategoryStack object // Cats not to display in the list but only // at the end of page (debugging, maintenance, etc. cats) $maintenance_cats = array(); // make an own temporary category stack for the current location $current_stack = new MsCategoryStack(); // go throught the stack and get data from each category for ($x = 0; $x < $stack->count(); $x++) { $sub_cats = $stack->get($x)->get_sub_categories(MsCategory::AS_OBJECTS); if (empty($sub_cats)) { // Endkategorie erreicht! break; } // update loop stack $current_stack->push($stack->get($x)); $is_last = $x < $stack->count() - 1; echo '<div class="sub level' . $x . ' ' . ($is_last ? 'level_last' : '') . '">'; if ($is_last) { // for a bit barrierefreiheit... echo '<div class="help">Hier hast du schon ausgewaehlt:</div>'; } else { echo '<div class="help">Bitte waehle hier aus:</div>'; } echo '<ul>'; foreach ($sub_cats as $cat) { if ($cat->has_set('maintenance')) { $maintenance_cats[] = $cat; continue; } // update stack $current_stack->push($cat); echo '<li>'; $a = array(); // the <a> Xml tag $a['href'] = $this->data['title']->getLocalURL($current_stack->build_query('ms-cat')); // display title attribute if ($cat->has_set('tooltip_text')) { $a['title'] = $cat->get('tooltip_text'); } $a['class'] = ''; // will be filled :-) // Highlight the selected database if ($x + 1 < $stack->count() && $stack->get($x + 1)->id == $cat->id) { $a['class'] .= ' selected'; } // this came from the idea of the "notyet" tag. $a['class'] .= $cat->get('class', ''); // print out <a ...>...</a> tag: echo Xml::tags('a', $a, $this->link_design_content($cat->get('name'))); echo '</li>'; $current_stack->pop(); } echo '</ul>'; echo '</div>'; } ?> </div><!--ms-catchooser --> <?php if (!$stack->get_top()->has_sub_categories()) { // display the db chooser ?> <div class="ms-dbchooser"> <?php $dbs = $stack->get_top()->get_databases(MsCategory::AS_INFO_ARRAY); foreach ($dbs as $db) { echo '<div class="ms-db">'; // Inhalt der Box if (isset($db['desc-msg'])) { $this->wiki(wfMsg($db['desc-msg'])); } else { // no details for this database... how sad ;-) echo '<h3>' . $db['id'] . '</h3>'; } // Link zum "Diese Datenbank waehlen..." echo '<a href="' . $title->getLocalURL($stack->build_query('ms-cat') . '&ms-db=' . urlencode($db['id'])) . '">Datenbank auswaehlen...</a>'; echo '</div>'; } ?> </div><!--ms-dbchooser--> <?php } /* endif dbchooser */ ?> </div><!--ms-page--> <?php }