public static function dispatch() { $action = get_http_var('action'); $r = null; if ($action == 'update') { $r = OtherArticleWidget::fetch_from_httpvars(); } else { $id = get_http_var('id'); $r = OtherArticleWidget::fetch_one($id); } $w = new OtherArticleWidget($r); // 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("Other Article", "OtherArticleWidget::emit_head_js"); print "<h2>Other article</h2>\n"; $w->emit_full(); admPageFooter(); } }
* 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; }
function ExtraHead() { OtherArticleWidget::emit_head_js(); }