db ();
getstr ("titlemask");
getint ("maxcnt", 25);
pageheader ("Batch-Edit Attributes");
$marcs = array ();
$db->exec ("select * from attriblist order by pk");
if ($db->FirstRow ()) {
do {
$marcs[$db->get ("pk", SQLINT)] = $db->get ("name", SQLCHAR);
} while ($db->NextRow ());
}
function mk_options ($name, $options, $option) {
$ret = "";
foreach ($options as $value => $opt) {
$selected = ($value == $option) ? " selected=\"selected\"" : "";
$ret .= "\n";
}
return "\n";
}
class TypeColumn extends dbtSimpleColumn {
function __construct () {
parent::__construct (null, "Type", "narrow");
}
function Data ($db) {
global $marcs;
return "
" . mk_options ("marcs", $marcs, $db->get ("fk_attriblist")) . " | ";
}
}
class TextAreaColumn extends dbtSimpleColumn {
function __construct ($dbfield, $caption, $class = null) {
parent::__construct ($dbfield, $caption, $class);
}
function Data ($db) {
global $config;
return "" . preg_replace ("/#(\w+)#/e",
"htmlspecialchars (\$db->get('\\1'))", $this->dbfield) . " | ";
}
}
form_open_get ();
p ("Enter Perl RegExp:
eg. Commedia");
p ("Max. No.: ");
form_submit ("Reload");
form_close ();
$t = new ListTable ();
$t->AddColumn ("", "", "narrow");
$t->AddColumn ("", "Nonfiling");
$t->AddColumnObject (new TextAreaColumn ("" .
"", "Title"));
$t->AddColumnObject (new TypeColumn ());
$t->AddColumn ("etext/#fk_books#\">#fk_books#", "eBook");
/////////////////////////////////////////////////////////////////////////////////
if (!empty ($titlemask)) {
form_open ("titles2");
$sql = "select * from attributes where text ~ '$titlemask' order by text";
$db->exec ($sql);
$t->limit = $maxcnt;
$t->PrintTable ($db, "Attributes Matching RegExp: $titlemask", "pgdbfiles");
form_relay ("titlemask");
form_relay ("maxcnt");
form_submit ("Update Checked Attribute Entries");
form_close ();
}
pagefooter ();
// Local Variables:
// mode:php
// coding:utf-8-unix
// fill-column: 75
// End:
?>