public static function dispatch() { $action = get_http_var('action'); $r = null; if ($action == 'update') { $r = WeblinkWidget::fetch_from_httpvars(); } else { $id = get_http_var('id'); $r = WeblinkWidget::fetch_one($id); } $w = new WeblinkWidget($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("Web Link", "WeblinkWidget::emit_head_js"); print "<h2>Web Link</h2>\n"; $w->emit_full(); admPageFooter(); } }
function EmitWebLinks($journo_id) { print "<h3>Web links</h3>\n"; $links = WeblinkWidget::fetch_lots($journo_id, ''); foreach ($links as $l) { $w = new WeblinkWidget($l); $w->emit_full(); } /* cheesy form to add a link */ /* replace with widget-based version */ ?> <form method="post"> url: <input type="text" name="url" size="40" /> description: <input type="text" name="desc" size="40" /> <?php print form_element_hidden('action', 'add_link'); print form_element_hidden('journo_id', $journo_id); ?> <input type="submit" name="submit" value="Add Link" /> </form> <?php return; }
* 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() { WeblinkWidget::emit_head_js(); }