public function display($title, $data) { $idtype = $_POST['idtype']; // initialize header $this->header = new \html\Header(array('title' => "WorldCat Similar Titles", 'css' => array("style.min.css"), 'js' => array('jquery.min.js', 'bootstrap.min.js', 'results.js'))); // initialize breadcrumbs $this->breadcrumbs = new \html\Breadcrumb(array('Index' => 'index.php', 'Results' => 'process.php')); // initialize library panel $this->library_panel = \html\TablePanel::fromArray("Library", "library-panel", array(array("<b>Institution Name</b>", \util\Config::$library->name), array("<b>OCLC Symbol</b>", \util\Config::$library->oclcsymbol), array("<b>City</b>", $data['library']['city']), array("<b>State</b>", $data['library']['state']), array("<b>Country</b>", $data['library']['country']), array("<b>Postal Code</b>", $data['library']['postalCode']))); // initialize info panel $this->info_panel = new \html\TextPanel('Info', "info-panel"); $this->info_panel->setText($data['info']); // initialize error panel $this->error_panel = null; if (!empty($data['error'])) { $this->error_panel = new \html\TextPanel('Error', 'error-panel'); $this->error_panel->setText($data['error']); } // initialize results panel $this->results_panel = new \html\TablePanel($title, "results-panel"); $this->results_panel->addheader(array("{$idtype}#", "Title", "Author", "Publisher", "Date", "Related {$idtype}#s")); foreach ($data['query'] as $query) { $id = $query['id']; $rowcls = null; if ($query['url']) { $id = "<a href=\"{$query['url']}\" target=\"_blank\">{$id}</a>"; $rowcls = "success"; } $recordhtml = "<tr class='{$rowcls}' data-toggle='modal' data-target='#lookup-modal'>" . "<td>{$id}</td>" . "<td>{$query['title']}</td>" . "<td>{$query['author']}</td>" . "<td>{$query['publisher']}</td>" . "<td>{$query['date']}</td>" . "<td>" . \implode(" <br/>", $query['related']) . "</td>" . "</tr>"; $this->results_panel->addrow_raw($recordhtml); } // initialize modal $this->modal = new \html\AjaxModal($idtype, "lookup-modal"); // initialize scrolltotop $this->scrolltotop = "<a id='back-to-top' href='#' class='btn btn-primary btn-lg back-to-top' role='button' title='Click to return on the top page' data-toggle='tooltip' data-placement='left'><span class='glyphicon glyphicon-chevron-up'></span></a>"; $container = new \html\GridDiv('container-fluid'); $container->row()->column('md-12', null, $this->breadcrumbs->html())->row()->column('md-12', null, $this->library_panel->html())->row(); if ($this->error_panel) { $container->column('md-6', null, $this->info_panel->html())->column('md-6', null, $this->error_panel->html()); } else { $container->column('md-12', null, $this->info_panel->html()); } $container->row()->column('md-12', null, $this->results_panel->html()); echo "<!DOCTYPE html>\n<html>\n", $this->header->html(), "<body>\n", $this->modal->html(), $container->html(), $this->scrolltotop, "</body>\n</html>"; }
$idlist .= ", " . \util\Misc::cleanCSV($txt); } else { $idlist = \util\Misc::cleanCSV($txt); } } $idtype = $_POST['idtype']; $outputFormat = $_POST['outputFormat']; $params['idtype'] = $idtype; $params['outputFormat'] = $outputFormat; $params['hideunique'] = isset($_POST['hide_unique']) ? 1 : 0; if (trim($idlist) == "") { $params['errormsg'] = "Cannot submit without IDs!"; echo \html\FormPanel::makeHiddenForm("CSVForm", "index.php", $params); } else { $params = array('idlist' => $idlist, 'idtype' => $idtype, 'outputFormat' => $outputFormat, 'hideunique' => isset($_POST['hideunique']) ? 1 : 0); echo \html\FormPanel::makeHiddenForm("CSVForm", "process.php", $params); } } else { $form = new \html\FormPanel("WorldCat Similar Titles Search", "form-panel", 'md-10', "form-horizontal", ""); if (isset($_POST['errormsg'])) { $form->error($_POST['errormsg']); } $form->select('idtype', 'ID Type', true, array('isbn' => 'ISBN Numbers', 'issn' => 'ISSN Numbers'))->select('outputFormat', 'Output Format', true, array('html' => 'HTML', 'xml' => 'XML'))->file('idlist_file', 'Import IDs (CSV or line breaks)')->textarea('idlist_textarea', 'ID List (CSV or line breaks)')->checkbox("hideunique", "Ignore entries w/o related titles")->button('submit', 'Submit', 'btn btn-primary'); $container = new \html\GridDiv("container"); $container->row()->column('md-1')->column('md-10', null, $form->html())->column('md-1'); echo $container->html(); } ?> </body> </html>
<?php require_once __DIR__ . "/bootstrap.php"; $header = new \html\Header(); $header->title(\util\Config::$app->name)->css('css/style.min.css')->js('js/jquery.min.js', 'js/bootstrap.min.js'); echo "<!DOCTYPE html>\n<html lang='en'>" . $header->html() . "<body>"; $fname = false; if (isset($_POST['submit'])) { $file = new \util\FileUpload('spreadsheet'); if (($fname = $file->moveToDir("tmp")) === false) { $_POST['errormsg'] = "Upload Failed!"; } } if ($fname) { echo \html\FormPanel::makeHiddenForm("UploadForm", "upload_form_submit.php", array('spreadsheet' => $fname)); } else { echo "<header>" . \util\Html::genNavbar() . "</header>"; $form = new \html\FormPanel("Import Spreadsheets", "form-panel", 'md-10', "form-horizontal", ""); if (isset($_POST['errormsg'])) { $form->error($_POST['errormsg']); } $form->file('spreadsheet', '')->button('submit', 'Confirm/Upload', 'btn btn-primary'); $container = new \html\GridDiv("container"); $container->row()->column('md-1')->column('md-10', null, "\n <h1>Welcome!</h1>\n <p>\n Uploading Spreadsheet files will convert them into a database\n for use in generating reports.\n <br>Multiple files may be uploaded at one time.\n <br><b>Supported file extensions: [ .xls , .xml ]</b>\n </p>\n ")->row()->column('md-1')->column('md-10', null, $form->html())->column('md-1'); echo $container->html(); } echo "</body></html>";