From 9561237646c508e24d99fdc98b1aa9f6c0b90c9f Mon Sep 17 00:00:00 2001 From: Demian Katz <demian.katz@villanova.edu> Date: Tue, 11 Sep 2012 12:25:32 -0400 Subject: [PATCH] Revert "Starts of install printout. Dave's digital library stuff." (Rolling back changes we are not ready for quite yet). This reverts commit 81f586eb8480a38d2b45851abe04f1a7a64253b3. --- module/VuFind/config/module.config.php | 3 +- .../VuFind/Controller/InstallController.php | 53 +++---- .../src/VuFind/Controller/VudlController.php | 149 ------------------ themes/blueprint/css/styles.css | 4 - themes/blueprint/templates/vudl/record.phtml | 5 +- 5 files changed, 28 insertions(+), 186 deletions(-) diff --git a/module/VuFind/config/module.config.php b/module/VuFind/config/module.config.php index dd3368d92e2..ac0bcf7215a 100644 --- a/module/VuFind/config/module.config.php +++ b/module/VuFind/config/module.config.php @@ -314,8 +314,7 @@ $staticRoutes = array( 'Tag/Home', 'Upgrade/Home', 'Upgrade/FixAnonymousTags', 'Upgrade/FixConfig', 'Upgrade/FixDatabase', 'Upgrade/FixMetadata', 'Upgrade/GetDBCredentials', - 'Upgrade/GetSourceDir', 'Upgrade/Reset', 'Upgrade/ShowSQL', - 'VuDL/Browse', 'VuDL/DSRecord', 'VuDL/Record', + 'Upgrade/GetSourceDir', 'Upgrade/Reset', 'Upgrade/ShowSQL', 'VuDL/Record', 'Worldcat/Advanced', 'Worldcat/Home', 'Worldcat/Search' ); diff --git a/module/VuFind/src/VuFind/Controller/InstallController.php b/module/VuFind/src/VuFind/Controller/InstallController.php index a4c79e30df3..df1faf18acd 100644 --- a/module/VuFind/src/VuFind/Controller/InstallController.php +++ b/module/VuFind/src/VuFind/Controller/InstallController.php @@ -323,46 +323,39 @@ class InstallController extends AbstractBase $connection . '/mysql' ); try { - $skip = $this->params()->fromPost('printdb', 'nope'); - // Get SQL together $query = 'CREATE DATABASE ' . $view->dbname; + $db->query($query, $db::QUERY_MODE_EXECUTE); $grant = "GRANT SELECT,INSERT,UPDATE,DELETE ON " . $view->dbname . ".* TO '{$view->dbuser}'@'{$view->dbhost}' " . "IDENTIFIED BY " . $db->getPlatform()->quoteValue($newpass) . " WITH GRANT OPTION"; + $db->query($grant, $db::QUERY_MODE_EXECUTE); + $db->query('FLUSH PRIVILEGES', $db::QUERY_MODE_EXECUTE); + $db = AdapterFactory::getAdapterFromConnectionString( + $connection . '/' . $view->dbname + ); $sql = file_get_contents( APPLICATION_PATH . '/module/VuFind/sql/mysql.sql' ); - if($skip == 'Skip') { - $omnisql = $query .';'. $grant .';FLUSH PRIVILEGES;'. $sql; - echo $omnisql; - } else { - $db->query($query, $db::QUERY_MODE_EXECUTE); - $db->query($grant, $db::QUERY_MODE_EXECUTE); - $db->query('FLUSH PRIVILEGES', $db::QUERY_MODE_EXECUTE); - $db = AdapterFactory::getAdapterFromConnectionString( - $connection . '/' . $view->dbname - ); - $statements = explode(';', $sql); - foreach ($statements as $current) { - // Skip empty sections: - if (strlen(trim($current)) == 0) { - continue; - } - $db->query($current, $db::QUERY_MODE_EXECUTE); - } - // If we made it this far, we can update the config file and - // forward back to the home action! - $string = "mysql://{$view->dbuser}:{$newpass}@" - . $view->dbhost . '/' . $view->dbname; - $config - = ConfigReader::getLocalConfigPath('config.ini', null, true); - $writer = new ConfigWriter($config); - $writer->set('Database', 'database', $string); - if (!$writer->save()) { - return $this->forwardTo('Install', 'fixbasicconfig'); + $statements = explode(';', $sql); + foreach ($statements as $current) { + // Skip empty sections: + if (strlen(trim($current)) == 0) { + continue; } + $db->query($current, $db::QUERY_MODE_EXECUTE); + } + // If we made it this far, we can update the config file and + // forward back to the home action! + $string = "mysql://{$view->dbuser}:{$newpass}@" + . $view->dbhost . '/' . $view->dbname; + $config + = ConfigReader::getLocalConfigPath('config.ini', null, true); + $writer = new ConfigWriter($config); + $writer->set('Database', 'database', $string); + if (!$writer->save()) { + return $this->forwardTo('Install', 'fixbasicconfig'); } return $this->redirect()->toRoute('install-home'); } catch (\Exception $e) { diff --git a/module/VuFind/src/VuFind/Controller/VudlController.php b/module/VuFind/src/VuFind/Controller/VudlController.php index 3eee3911191..b6a244cab26 100644 --- a/module/VuFind/src/VuFind/Controller/VudlController.php +++ b/module/VuFind/src/VuFind/Controller/VudlController.php @@ -39,155 +39,6 @@ namespace VuFind\Controller; */ class VudlController extends AbstractBase { - /** - * - * - * - */ - public function browseAction() - { - // TARGET ID - $id = $this->params()->fromQuery('id'); - $view = $this->createViewModel(); - $view->id = $id; - - // REDUCE TO INTEGER - if(empty($id)) { - $id = 'vudl:1'; - } elseif(strpos($id, 'vudl') < 0) { - $id = 'vudl' . $id; - } - - // GET THIS FOLDER'S DETAILS - $view->details = $this->getDSDetails($id); - $xml = simplexml_load_file('http://falveydev.villanova.edu:8088/fedora/objects/'.$id.'/datastreams/STRUCTMAP/content'); - $view->xml = $xml; - - // GET CHILDREN AND CHILD DETAILS - $children = array(); - foreach($xml->xpath('//METS:structMap/METS:div') as $order) { - $item = $order->xpath('METS:fptr'); - $id = strval($item[0]['FILEID']); - - $children[intval($order['ORDER'])] = $this->getDSDetails($id); - $children[intval($order['ORDER'])]['classes'] = $this->getDSClasses($id); - } - $view->children = $children; - - return $view; - } - - /** - * - * - * - */ - protected function getDSDetails($id) - { - $xml = simplexml_load_file('http://falveydev.villanova.edu:8088/fedora/objects/'.$id.'/datastreams/DC/content'); - $data = array(); - foreach($xml->children('dc', true) as $detail) { - $data[$detail->getName()] = (string) $detail; - } - $data['thumbnail'] = 'http://falveydev.villanova.edu:8088/fedora/objects/'.$id.'/datastreams/THUMBNAIL/content'; - return $data; - } - - /** - * - * - * - */ - protected function getDSClasses($id) - { - $data = file_get_contents('http://falveydev.villanova.edu:8088/fedora/objects/'.$id.'/datastreams/RELS-EXT/content'); - $matches = array(); - preg_match_all('/rdf:resource="info:fedora\/vudl-system:[^"]+/', $data, $matches); - $classes = array(); - foreach($matches[0] as $match) { - $classes[] = substr($match, 38); - } - return $classes; - } - - /** - * - * - * - */ - protected function getDSOutline($root) - { - $outline = array(); - $queue = array($root); - $matches = array(); - // BFS - do { - $id = array_shift($queue); - // Have we reached the bottom? We get a 404 if we have. - $check = get_headers('http://falveydev.villanova.edu:8088/fedora/objects/'.$id.'/datastreams/STRUCTMAP/content', 1); - // Figure out which parent to put this link under - if(strpos($check[0], '404')) { - $data = file_get_contents('http://falveydev.villanova.edu:8088/fedora/objects/'.$id.'/datastreams/PARENT-LIST/content'); - preg_match_all('/vudl:[^"]+/', $data, $matches); - $parent = $matches[0][0] == 'MASTER' ? 'original' : substr($matches[0][0], 5); - $index = strtolower(explode(' ', $this->getDSDetails($id)['title'])[0]); - $outline[$parent][$index] = 'http://falveydev.villanova.edu:8088/fedora/objects/'.$id.'/datastreams/FILE/content'; - // echo $id, ' ', $parent, ' ', $this->getDSDetails($id)['title'], '<br>'; - } else { - $data = file_get_contents('http://falveydev.villanova.edu:8088/fedora/objects/'.$id.'/datastreams/STRUCTMAP/content'); - preg_match_all('/vudl:[^"]+/', $data, $matches); - if(count($matches) > 0) { - foreach($matches[0] as $m) { - $queue[] = $m; - } - } - $outline[substr($id, 5)]['label'] = $this->getDSDetails($id)['title']; - // echo $id, ' ', $this->getDSDetails($id)['title'], '<br>'; - } - } while(count($queue) > 0); - // Remove parents and empty items - foreach($outline as $item) { - if(!isset($item['large'])) { - array_shift($outline); - } - } - return $outline; - } - - /** - * - * - * - */ - public function dsrecordAction() - { - // TARGET ID - $id = $this->params()->fromQuery('id'); - $view = $this->createViewModel(); - $view->id = $id; - - // GET XML FILE NAME - $url = 'http://falveydev.villanova.edu:8088/fedora/objects/'.$id.'/datastreams/DC/content'; - - // LOAD FILE - $xml = simplexml_load_file($url); - - // FILE INFORMATION / DESCRIPTION - $fileDetails = $this->getDSDetails($id); - $view->details = $fileDetails; - $view->file = urlencode($url); - - // GET IDS FOR ALL FILES - $pages = $this->getDSOutline($id); - - // SEND THE DATA FOR THE FIRST PAGES - // (Original, Large, Medium, Thumbnail srcs) and THE DOCUMENTS - $view->pages = $pages; - $view->docs = array(); - $view->setTemplate('/vudl/record.phtml'); - return $view; - } - /** * Get the information from the XML * diff --git a/themes/blueprint/css/styles.css b/themes/blueprint/css/styles.css index dace46dbaa0..afdd6d6da65 100644 --- a/themes/blueprint/css/styles.css +++ b/themes/blueprint/css/styles.css @@ -342,10 +342,6 @@ div.searchHomeForm div.searchform { padding:0; } -#searchForm_type { - padding:2px; -} - /******** Result List ***/ ul.recordSet { diff --git a/themes/blueprint/templates/vudl/record.phtml b/themes/blueprint/templates/vudl/record.phtml index cb3e04ec172..cf921040a9d 100644 --- a/themes/blueprint/templates/vudl/record.phtml +++ b/themes/blueprint/templates/vudl/record.phtml @@ -15,7 +15,10 @@ // TRUNCATE PAGES TO FIRST PAGES $this->firstPages = array_slice($this->pages, 0, 6); ?> -<script>var documentID = '<?=$this->id ?>'</script> +<script> + var documentID = '<?=$this->id ?>'; + var fileName = '<?=$this->file ?>'; +</script> <div class="inspector_container"> <div class="side_nav"> <a href="javascript:showPages()" class="top"><?=$this->transEsc('vudl_tab_pages') ?></a> -- GitLab