AddColumn ("$prefix=edit&pk=#pk#\">Edit", "$prefix=add\">Add", "narrow"); $this->AddColumn ("$prefix=delete&pk=#pk#\">Delete", "", "narrow"); $this->AddSimpleColumn ("name", "MARC Tag"); $this->AddSimpleColumn ("indicators", "MARC Indicators", "narrow"); $this->AddSimpleColumn ("nonfiling", "Nonfiling Chars", "narrow"); $this->AddSimpleColumn ("text", "Text"); } } class ListMarcFieldsTable extends ListTable { function __construct () { global $fk_books, $fk_marcauthrecs; $prefix = "AddColumn ("$prefix=delete&fk_marcauthrecs=#fk_marcauthrecs#&fk_marctags=#fk_marctags#\">Unlink", "", "narrow"); // $this->AddColumn ("$prefix=edit&fk_marcauthrecs=#fk_marcauthrecs#&fk_marctags=#fk_marctags#\">Edit Link", "", "narrow"); $this->AddSimpleColumn ("name", "MARC Tag"); // $this->AddSimpleColumn ("indicators", "MARC Indicators", "narrow"); // $this->AddSimpleColumn ("nonfiling", "Nonfiling Chars", "narrow"); $this->AddSimpleColumn ("text", "Text"); } } class ListAuthorsTable extends ListTable { function __construct () { global $fk_books; $prefix = "AddColumn ("$prefix=delete&fk_authors=#pk#&fk_roles=#fk_roles#\">Unlink", "Link", "narrow"); $this->AddColumn ("$prefix=edit&fk_authors=#pk#&fk_roles=#fk_roles#\">Edit Link", "", "narrow"); $this->AddColumn ("#author#", "Author"); $this->AddSimpleColumn ("role", "Role", "narrow"); $this->AddSimpleColumn ("c_heading", "Heading", "narrow"); $this->AddSimpleColumn ("born_floor", "Born", "narrow right"); $this->AddSimpleColumn ("died_floor", "Died", "narrow right"); $this->AddSubCaption ("All authors for this work."); } } class ListReviewsTable extends ListTable { function __construct () { global $fk_books; $this->AddSubCaption ("All reviews for this work."); $prefix = "AddColumn ("$prefix=edit&fk_reviews=#pk#\">Edit", "$prefix=add\">Add", "narrow"); $this->AddColumn ("$prefix=delete&fk_reviews=#pk#\">Delete", "", "narrow"); $this->AddSimpleColumn ("name", "Reviewer"); $this->AddSimpleColumn ("review", "Review"); } } class ListCategoriesTable extends ListTable { function __construct () { global $fk_books; $prefix = "AddColumn ("$prefix=delete&fk_categories=#pk#\">Unlink", "$prefix=add\">Link", "narrow"); $this->AddSimpleColumn ("category", "Category"); $this->AddSubCaption ("All categories for this work."); } } class ListSubjectsTable extends ListTable { function __construct () { global $fk_books; $prefix = "AddColumn ("$prefix=delete&fk_subjects=#pk#\">Unlink", "$prefix=add\">Link", "narrow"); $this->AddColumn ("#subject#", "Subject"); //Make the subject name's clickable links to the edit & list of books page $this->AddColumn ("#pk#", "#", "narrow"); //List the Internal Code #. $this->AddSubCaption ("All subjects for this work."); } } class ListLangsTable extends ListTable { function __construct () { global $fk_books; $prefix = "AddColumn ("$prefix=delete&fk_langs=#pk#\">Unlink", "$prefix=add\">Link", "narrow"); $this->AddSimpleColumn ("lang", "Language"); $this->AddSubCaption ("Languages of all major sections in this work."); } } class ListLoccsTable extends ListTable { function __construct () { global $fk_books; $prefix = "AddColumn ("$prefix=delete&fk_loccs=#pk#\">Unlink", "$prefix=add\">Link", "narrow"); $this->AddSimpleColumn("pk", "Code"); $this->AddSimpleColumn ("locc", "LoC class"); $this->AddSubCaption ("All LoC Classes this work falls into."); } } $db = $config->db (); $db->logger = new logger (); $f = new SQLForm (); getint ("fk_books"); if (ismode ("delete")) { $f->SubCaption ("You are about to delete this book."); $f->SubCaption ("Press the '$caption' button to continue or hit " . "the back button on your browser to dismiss."); } else { $f->Text ("pk", "pk", "EText Nr.", SQLINT, 20, 5, true); $f->ToolTip ("Enter the ebook number."); $f->Text ("release_date", "release_date", "Release Date", SQLCHAR, 20, 20, false); $f->ToolTip ("Enter the official release date."); $f->CheckBox ("copyrighted", "copyrighted", "Copyrighted", SQLINT); $f->ToolTip ("Check if book is copyrighted."); $f->CheckBox ("updatemode", "updatemode", "Manual Update", SQLINT); $f->ToolTip ("Check if book is manually updated."); $f->LoadData ("select * from books where pk = $fk_books"); } $f->Hidden ("fk_books"); if (isupdatemode ("add")) { if ($f->Check ()) { $sql = $f->mkInsert ($db->GetFormatter ()); if ($db->Exec ("insert into books " . $sql)) { msg ("Book added !"); } else { error_msg ("Could not add Book!"); } } } if (isupdatemode ("edit")) { if ($f->Check ()) { $sql = $f->mkUpdate ($db->GetFormatter ()); // set manually updated mode if ($db->Exec ("update books set " . $sql . "where pk = $fk_books")) { msg ("Book modified !"); } else { error_msg ("Could not modify book !"); } } } if (isupdatemode ("delete")) { $db->exec ("delete from files where fk_books = $fk_books"); $db->exec ("delete from attributes where fk_books = $fk_books"); $db->exec ("delete from reviews.reviews where fk_books = $fk_books"); $db->Exec ("delete from mn_books_authors where fk_books = $fk_books"); $db->Exec ("delete from mn_books_langs where fk_books = $fk_books"); $db->Exec ("delete from mn_books_loccs where fk_books = $fk_books"); $db->Exec ("delete from mn_books_subjects where fk_books = $fk_books"); $db->Exec ("delete from mn_books_categories where fk_books = $fk_books"); if ($db->Exec ("delete from books where pk = $fk_books")) { msg ("Book deleted !"); } else { error_msg ("Could not delete book !"); } } if (isupdate ()) { getint ("fk_books"); echo ("
\n\n"); } else { $f->Output ($caption, $caption); if (ismode ("edit")) { p ("Goto Edit Files Page — " . "etext/${fk_books}#bibrec\">Goto Bibrec Page — " . "etext/${fk_books}#download\">Goto Bibrec Download Page"); $db->exec ("select gutindex from books where pk = $fk_books"); if ($db->FirstRow ()) { $gutindex = $db->get ("gutindex", SQLCHAR); if (!empty ($gutindex)) { echo ("$gutindex\n"); } } // Authors for book $db->exec ("select authors.pk as pk, author, heading, born_floor, died_floor, " . "fk_roles, role " . "from authors, mn_books_authors, roles " . "where authors.pk = mn_books_authors.fk_authors " . "and mn_books_authors.fk_roles = roles.pk " . "and mn_books_authors.fk_books = $fk_books " . "order by author;"); $db->calcfields ["c_heading"] = new CalcFieldHeading (); $table = new ListAuthorsTable (); $table->PrintTable ($db, "Authors", "pgdbdata"); p ("A Summary of Commonly Used MARC 21 Fields"); // Uncontrolled Fields for book $db->exec ("select attributes.*, attriblist.name from attributes, attriblist " . "where attributes.fk_books = $fk_books and " . "attributes.fk_attriblist = attriblist.pk " . "order by attriblist.name;"); $table = new ListAttributesTable (); $table->PrintTable ($db, "Uncontrolled MARC 21 Fields", "pgdbdata"); // Controlled Fields for book // $db->exec ("select marcfields.text, marctags.name, mn_books_marcauthrecs.* " . // "from mn_books_marcauthrecs, marcfields, marctags " . // "where mn_books_marcauthrecs.fk_books = $fk_books " . // "and marcfields.fk_marcauthrecs = mn_books_marcauthrecs.fk_marcauthrecs " . // "and marctags.pk = mn_books_marcauthrecs.fk_marctags " . // "and marcfields.fk_marctags like 'A1%' order by marctags.name, marcfields.text;"); // $table = new ListMarcFieldsTable (); // $table->PrintTable ($db, "Controlled MARC 21 Fields", "pgdbdata"); // $f2 = new SQLForm ("mn_books_marcauthrecs", "get"); // $f2->KeySelect ("fk_marctags", "fk_marctags", "Tag to Link", SQLCHAR, 40, 40, true); // $f2->last->LoadSQL ("select pk as key, name as caption from marctags where pk like 'B%' and type IS NOT NULL and not exists (select * from mn_books_marcauthrecs as mnm, marctags as mt where mnm.fk_books = $fk_books and mnm.fk_marctags = mt.pk and mt.excludes = marctags.excludes) order by name"); // $f2->last->DefValue ("B100"); // $f2->last->ToolTip ("Select a Bibliographic MARC Tag."); // $f2->Hidden ("fk_books"); // $f2->Hidden ("mode", "add"); // $f2->Hidden ("step", "first"); // $f2->Output ("Link Controlled Field", "Link Controlled Field"); // Categories for book $db->exec ("select * from categories, mn_books_categories " . "where categories.pk = mn_books_categories.fk_categories " . "and mn_books_categories.fk_books =$fk_books " . "order by category;"); $table = new ListCategoriesTable (); $table->PrintTable ($db, "Categories", "pgdbdata"); // Subjects for book $db->exec ("select * from subjects, mn_books_subjects " . "where subjects.pk = mn_books_subjects.fk_subjects " . "and mn_books_subjects.fk_books =$fk_books " . "order by subject;"); $table = new ListSubjectsTable (); $table->PrintTable ($db, "Subjects", "pgdbdata"); form_open ("mn_books_subjects"); form_hidden ("mode", "add"); form_hidden ("step", "update"); form_hidden ("fk_books", $fk_books); echo ("Quick link subject: Use internal subject #!\n"); form_submit ("Link Subject"); echo ("(See \"#\" column above.)"); form_close (); // Languages for book $db->exec ("select langs.pk as pk, lang from langs, mn_books_langs " . "where mn_books_langs.fk_langs = langs.pk " . "and fk_books = $fk_books order by lang;"); $table = new ListLangsTable (); $table->PrintTable ($db, "Languages", "pgdbdata"); form_open ("mn_books_langs"); form_hidden ("mode", "add"); form_hidden ("step", "update"); form_hidden ("fk_books", $fk_books); echo ("Quick link language: Use 2-letter code!\n"); form_submit ("Link Language"); form_close (); // LoCCs for book $db->exec ("select loccs.pk as pk, locc from loccs, mn_books_loccs " . "where mn_books_loccs.fk_loccs = loccs.pk " . "and fk_books = $fk_books order by locc;"); $table = new ListLoccsTable (); $table->PrintTable ($db, "LoC Classes", "pgdbdata"); form_open ("mn_books_loccs"); form_hidden ("mode", "add"); form_hidden ("step", "update"); form_hidden ("fk_books", $fk_books); echo ("Quick link LoC class: Use code!\n"); form_submit ("Link LoC Class"); form_close (); // Reviews for book $db->exec ("select reviews.reviews.*, reviews.reviewers.name from reviews.reviews, reviews.reviewers where fk_books = $fk_books and reviews.reviewers.pk = reviews.reviews.fk_reviewers;"); $table = new ListReviewsTable (); $table->PrintTable ($db, "Reviews", "pgdbdata"); } } pagefooter (); // Local Variables: // mode:php // coding:utf-8-unix // fill-column: 75 // End: ?>