public static function dispatch() { $id = get_http_var('id'); $action = get_http_var('action'); $sql = <<<EOT SELECT m.id,m.journo_id, j.ref, j.prettyname, j.oneliner, m.url, m.submitted, m.reason FROM missing_articles m LEFT JOIN journo j ON m.journo_id=j.id WHERE m.id=?; EOT; $row = db_getRow($sql, $id); $w = new MissingArticleWidget($row); // perform whatever action has been requested $w->perform($action); // is request ajax? $ajax = get_http_var('ajax') ? true : false; if ($ajax) { $w->emit_core(); } else { // not an ajax request, so output a full page admPageHeader("Missing Article", "MissingArticleWidget::emit_head_js"); print "<h2>Missing article</h2>\n"; $w->emit_full(); admPageFooter(); } }
function ExtraHead() { MissingArticleWidget::emit_head_js(); }
* using this file means widgets don't have to care which page they're embedded on */ // sigh... stupid php include-path trainwreck... chdir(dirname(dirname(__FILE__))); require_once '../conf/general'; require_once '../../phplib/utility.php'; require_once '../phplib/adm.php'; require_once 'missingarticle_widget.php'; require_once 'otherarticle_widget.php'; require_once 'weblink_widget.php'; require_once 'submitted_article_widget.php'; if (!admCheckAccess()) { exit; } // should return error code? header("Cache-Control: no-cache"); $widget = get_http_var('widget'); switch ($widget) { case 'missingarticle': MissingArticleWidget::dispatch(); break; case 'otherarticle': OtherArticleWidget::dispatch(); break; case WeblinkWidget::PREFIX: WeblinkWidget::dispatch(); break; case SubmittedArticleWidget::PREFIX: SubmittedArticleWidget::dispatch(); break; }