コード例 #1
0
function EmitFilterForm($filter)
{
    $f = array('all' => 'All addresses', 'approved' => 'Approved addresses only', 'unapproved' => 'Unapproved addresses only');
    ?>
<form method="get" action="/adm/journo-email">
Show
<?php 
    echo form_element_select("filter", $f, $filter);
    ?>
 <input type="submit" name="submit" value="Find" />
</form>
<?php 
}
コード例 #2
0
ファイル: journo.php プロジェクト: bcampbell/journalisted
function EmitJournoFilterForm()
{
    global $statusnames;
    $s = array('any' => 'Any') + $statusnames;
    ?>

<form method="get" action="/adm/journo">
 <input type="hidden" name="action" value="list" /><br />
 with status:
 <?php 
    echo form_element_select("status", $s, get_http_var('status'));
    ?>
<br />
 name containing: <input type="text" name="name" size="40" /><br />
 matching admin_tags: <input type="text" name="admin_tags" size="40" /><br />
 <label for="claimed">Claimed profiles only?</label><input id="claimed" type="checkbox" name="claimed" value="1" /><br/>
 <input type="submit" name="submit" value="Find" />
</form>
<?php 
}
コード例 #3
0
function EmitList($filter)
{
    $actions = array('' => 'None', 'skip' => 'Skip (stop trying to scrape)', 'undecided' => 'Undecided (Continue trying to scrape)');
    $whereclause = '';
    if ($filter == 'undecided') {
        $whereclause = "WHERE action=' '";
    } elseif ($filter == 'skip') {
        $whereclause = "WHERE action='s'";
    }
    $sql = <<<EOT
\tSELECT * FROM error_articlescrape
        {$whereclause}
        ORDER BY firstattempt DESC
EOT;
    $r = db_query($sql);
    $cnt = db_num_rows($r);
    printf("<p>Found %d</p>\n", $cnt);
    if ($cnt == 0) {
        return;
    }
    ?>
<form method="post" action="/adm/scrape-errors">
<?php 
    echo form_element_hidden('filter', $filter);
    ?>

Action (with selected articles):
<?php 
    echo form_element_select('action', $actions, $selected = '');
    ?>
<input type="submit" name="submit" value="Do it" />

<table>
<thead>
 <tr>
  <th>First attempt</th>
  <th>Attempts</th>
  <th>srcid/URL</th>
  <th>Action</th>
  <th>Select</th>
 </tr>
</thead>
<tbody>
<?php 
    while ($row = db_fetch_array($r)) {
        $firstattempt = strftime('%d-%b-%y %H:%M', strtotime($row['firstattempt']));
        $srcid = $row['srcid'];
        $attempts = $row['attempts'];
        $action = 'undecided';
        $trclass = 'status_red';
        if ($row['action'] == 's') {
            $action = 'Skip.';
            $trclass = 'status_green';
        }
        $title = $row['title'];
        /* title could be blank */
        $srcurl = $row['srcurl'];
        $link = sprintf("<a href=\"%s\">%s</a>", $srcurl, $title ? $title : $srcurl);
        $link = "{$srcid}<br/><small>{$link}</small>";
        $detailsurl = "/adm/scrape-errors?srcid={$srcid}&action=detail";
        $detailslink = sprintf("<small>[<a href=\"%s\">details</a>]</small>\n", $detailsurl);
        /* checkbox element to select this item... */
        $checkbox = "<input type=\"checkbox\" name=\"srcid[]\" value=\"{$srcid}\" />";
        print " <tr class=\"{$trclass}\">\n" . "  <td>{$firstattempt}</td>" . "<td>{$attempts} {$detailslink}</td>" . "<td>{$link}</td>" . "<td>{$action}</td>" . "<td>{$checkbox}</td>\n" . " </tr>\n";
    }
    ?>
</tbody>
</table>

Action (with selected articles):
<?php 
    echo form_element_select('action2', $actions, $selected = '');
    ?>
<input type="submit" name="submit2" value="Do it" />

</form>
<?php 
}