function run()
    {
        admPageHeader("Create new journo");
        ?>
<h2>Create new Journo</h2>
<?php 
        $action = get_http_var('action', '');
        $params = $this->get_params();
        if ($action == '') {
            $this->emit_form($params);
        } else {
            if ($action == 'preview') {
                $errs = $this->validate($params);
                $this->emit_form($params, $errs, $errs ? false : true);
            } else {
                if ($action == 'back') {
                    $errs = $this->validate($params);
                    $this->emit_form($params, $errs);
                } else {
                    if ($action == 'do_it') {
                        $errs = $this->validate($params);
                        if (!$errs) {
                            // thunderbirds are go.
                            $this->create_journo($params);
                        } else {
                            $this->emit_form($params, $errs);
                        }
                    }
                }
            }
        }
        admPageFooter();
    }
    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();
        }
    }
 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();
     }
 }
 public static function dispatch()
 {
     // TODO: check adm permissions!!!
     $id = get_http_var('id');
     $action = get_http_var('action');
     $err = SubmittedArticle::fetch_single($id);
     $w = new SubmittedArticleWidget($err);
     // 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("Submitted Article", "SubmittedArticleWidget::emit_head_js");
         print "<h2>Submitted article</h2>\n";
         $w->emit_full();
         admPageFooter();
     }
 }
Exemple #5
0
" />Yes, delete it!</a></small>
</p>
<?php 
        newsPreview($post);
        break;
    case 'reallydelete':
        $id = get_http_var('id');
        $post = db_getRow("SELECT * FROM news WHERE id=?", $id);
        newsDelete($post);
        newsList();
        break;
    default:
        newsList();
        break;
}
admPageFooter();
function newsList()
{
    $posts = db_getAll("SELECT id,status,title,slug,posted,author,kind,date_from,date_to FROM news ORDER BY posted DESC");
    ?>
<h2>News Posts</h2>
 <a href="/adm/news?action=create">Create a new post</a>
 <ul>
<?php 
    foreach ($posts as $p) {
        ?>
  <li class="<?php 
        echo $p['status'] == 'a' ? 'approved' : 'unapproved';
        ?>
" >
    <?php 
Exemple #6
0
function template($vars)
{
    $tabulator = new Tabulator(array(new Column('id', array('sortable' => TRUE)), new Column('pubdate', array('sortable' => TRUE)), new LinkColumn('publication', array('sortable' => TRUE, 'text' => 'pub_name', 'href' => 'pub_home_url')), new ArtColumn('title', array('sortable' => TRUE)), new Column('byline', array('sortable' => TRUE))));
    // article_admin_link($a)
    extract($vars);
    admPageHeader();
    ?>
<h2>Show articles</h2>
<form action="articles" method="GET">
<table>
<?php 
    echo $filter->as_table();
    ?>
</table>
<input type="submit" name="submit" value="go" />
</form>

<?php 
    if ($arts) {
        ?>
<p class="paginator"><?php 
        echo $paginator->render();
        ?>
 <?php 
        echo $paginator->total;
        ?>
 articles</p>
<table class="results">
<?php 
        echo $tabulator->as_table($arts);
        ?>
</table>
<p class="paginator"><?php 
        echo $paginator->render();
        ?>
 <?php 
        echo $paginator->total;
        ?>
 articles</p>
<?php 
    }
    ?>

<?php 
    admPageFooter();
}
Exemple #7
0
    function template_html($params, $rows)
    {
        admPageHeader("Canned Queries");
        ?>
<h2><?php 
        echo $this->name;
        ?>
</h2>
<p><?php 
        echo $this->desc;
        ?>
</p>
<?php 
        if (isset($this->longdesc)) {
            ?>
<p><?php 
            echo $this->longdesc;
            ?>
</p>
<?php 
        }
        $this->emit_params_form($params);
        if (!is_null($rows)) {
            Tabulate($rows, $this->columns());
        }
        admPageFooter();
    }
function template($vars)
{
    extract($vars);
    admPageHeader();
    if (is_null($art_id)) {
        ?>
<h2>Create Article</h2>
<?php 
    } else {
        ?>
<h2>Edit Article</h2>
go to <a href="<?php 
        echo article_url($art_id);
        ?>
">public page</a>, <a href="<?php 
        echo article_adm_url($art_id);
        ?>
">admin page</a>
<?php 
    }
    ?>
<form action="/adm/editarticle" method="POST">
<table>
<?php 
    echo $form->as_table();
    ?>
</table>
<input type="submit" name="submit" value="Submit" />
</form>
<?php 
    admPageFooter();
}
Exemple #9
0
function template($vars)
{
    extract($vars);
    admPageHeader();
    ?>
<h2>scrape article(s)</h2>

<form action="/adm/scrape" method="GET">
<table>
<?php 
    echo $urls_form->as_table();
    ?>
</table>
<input type="submit" name="submit" value="go" />
</form>


<?php 
    if ($urls_form->is_valid()) {
        ?>
<h3>Result: <?php 
        echo $summary;
        ?>
</h3>

<?php 
        if (!is_null($art)) {
            ?>

<div style="border: 1px solid black;">
<h4><a href="<?php 
            echo article_url($art['id']);
            ?>
"><?php 
            echo $art['title'];
            ?>
</a> [<a href="<?php 
            echo article_adm_url($art['id']);
            ?>
">adm</a>]<h4>
<?php 
            echo $art['srcorgname'];
            ?>
, <?php 
            echo $art['pretty_pubdate'];
            ?>
<br/>
url: <a href="<?php 
            echo $art['permalink'];
            ?>
"><?php 
            echo $art['permalink'];
            ?>
</a><br/>
attributed to:
<?php 
            if (sizeof($art['journos']) > 0) {
                ?>
<ul>
<?php 
                foreach ($art['journos'] as $j) {
                    ?>
<li><a href="/<?php 
                    echo $j['ref'];
                    ?>
"><?php 
                    echo $j['ref'];
                    ?>
</a> <small>[<a href="/adm/<?php 
                    echo $j['ref'];
                    ?>
">adm</a>]</small></li>
<?php 
                }
                ?>
</ul>
<?php 
            } else {
                ?>
- nobody -<br/>
<?php 
            }
            ?>
</div>

<?php 
        }
        ?>

<?php 
        if (!is_null($return_code)) {
            ?>
<h3>raw scraper output (returncode=<?php 
            echo $return_code;
            ?>
):</h3>
<div>
<code>
<pre>
<?php 
            echo admMarkupPlainText($raw_output);
            ?>
</pre>
</code>
</div>
<?php 
        }
    }
    admPageFooter();
    ?>

<?php 
}
function template_completed($vars)
{
    extract($vars);
    admPageHeader("Split Journo");
    ?>
    <h2>Split completed</h2>
    <div class="action_summary">
    <ul>
<?php 
    foreach ($actions as $action) {
        ?>
        <li><?php 
        echo $action;
        ?>
</li>
<?php 
    }
    ?>
    </ul>
<?php 
    admPageFooter();
}
function template($vars)
{
    extract($vars);
    admPageHeader("Submitted Articles", "extra_head");
    ?>
<h2>Submitted Articles</h2>
<p>Submitted articles needing admin attention</p>

<form action="/adm/submitted_articles" method="GET">
<table>
<?php 
    echo $filterform->as_table();
    ?>
</table>
<input type="submit" name="submit" value="Go" />
</form>
<?php 
    if ($filterform->is_valid()) {
        ?>
<p class="paginator"><?php 
        echo $paginator->render();
        ?>
 <?php 
        echo $paginator->total;
        ?>
 matching</p>
<?php 
        foreach ($widgets as $w) {
            $w->emit_full();
        }
        ?>
<p class="paginator"><?php 
        echo $paginator->render();
        ?>
 <?php 
        echo $paginator->total;
        ?>
 matching</p>
<?php 
    }
    admPageFooter();
}
function show_publication($pub_id)
{
    $pub = db_getRow("SELECT * FROM organisation WHERE id=?", $pub_id);
    if (!$pub) {
        admPageHeader("Publications", "extra_head");
        ?>
<p>Bad pub_id: not found</p>
<?php 
        admPageFooter();
        return;
    }
    $aliases = db_getAll("SELECT * FROM pub_alias WHERE pub_id=?", $pub_id);
    $domains = db_getAll("SELECT * FROM pub_domain WHERE pub_id=?", $pub_id);
    $email_formats = db_getAll("SELECT * FROM pub_email_format WHERE pub_id=?", $pub_id);
    $phones = db_getAll("SELECT * FROM pub_phone WHERE pub_id=?", $pub_id);
    admPageHeader($pub['prettyname'], "extra_head");
    ?>
<h2><?php 
    echo $pub['prettyname'];
    ?>
</h2>
<table>
<tbody>
 <tr> <th>id</th><td><?php 
    echo $pub['id'];
    ?>
</td> </tr>
 <tr> <th>prettyname</th><td><?php 
    echo $pub['prettyname'];
    ?>
</td> </tr>
 <tr> <th>shortname</th><td><?php 
    echo $pub['shortname'];
    ?>
</td> </tr>
 <tr> <th>home_url</th><td><a href="<?php 
    echo $pub['home_url'];
    ?>
"><?php 
    echo $pub['home_url'];
    ?>
</a></td> </tr>
 <tr> <th>aliases</th><td>
<?php 
    foreach ($aliases as $alias) {
        ?>
   <?php 
        echo $alias['alias'];
        ?>
<br/>
<?php 
    }
    ?>
   </td> </tr>
 <tr> <th>domains</th><td>
<?php 
    foreach ($domains as $domain) {
        ?>
<a href="http://<?php 
        echo $domain['domain'];
        ?>
"><?php 
        echo $domain['domain'];
        ?>
</a><br/>
<?php 
    }
    ?>
   </td> </tr>
</tbody>
</table>

<?php 
    admPageFooter();
}