Skip to content
Snippets Groups Projects
Commit 95612376 authored by Demian Katz's avatar Demian Katz
Browse files

Revert "Starts of install printout. Dave's digital library stuff."

(Rolling back changes we are not ready for quite yet).

This reverts commit 81f586eb.
parent 43f47c28
No related merge requests found
...@@ -314,8 +314,7 @@ $staticRoutes = array( ...@@ -314,8 +314,7 @@ $staticRoutes = array(
'Tag/Home', 'Tag/Home',
'Upgrade/Home', 'Upgrade/FixAnonymousTags', 'Upgrade/FixConfig', 'Upgrade/Home', 'Upgrade/FixAnonymousTags', 'Upgrade/FixConfig',
'Upgrade/FixDatabase', 'Upgrade/FixMetadata', 'Upgrade/GetDBCredentials', 'Upgrade/FixDatabase', 'Upgrade/FixMetadata', 'Upgrade/GetDBCredentials',
'Upgrade/GetSourceDir', 'Upgrade/Reset', 'Upgrade/ShowSQL', 'Upgrade/GetSourceDir', 'Upgrade/Reset', 'Upgrade/ShowSQL', 'VuDL/Record',
'VuDL/Browse', 'VuDL/DSRecord', 'VuDL/Record',
'Worldcat/Advanced', 'Worldcat/Home', 'Worldcat/Search' 'Worldcat/Advanced', 'Worldcat/Home', 'Worldcat/Search'
); );
......
...@@ -323,46 +323,39 @@ class InstallController extends AbstractBase ...@@ -323,46 +323,39 @@ class InstallController extends AbstractBase
$connection . '/mysql' $connection . '/mysql'
); );
try { try {
$skip = $this->params()->fromPost('printdb', 'nope');
// Get SQL together
$query = 'CREATE DATABASE ' . $view->dbname; $query = 'CREATE DATABASE ' . $view->dbname;
$db->query($query, $db::QUERY_MODE_EXECUTE);
$grant = "GRANT SELECT,INSERT,UPDATE,DELETE ON " $grant = "GRANT SELECT,INSERT,UPDATE,DELETE ON "
. $view->dbname . $view->dbname
. ".* TO '{$view->dbuser}'@'{$view->dbhost}' " . ".* TO '{$view->dbuser}'@'{$view->dbhost}' "
. "IDENTIFIED BY " . $db->getPlatform()->quoteValue($newpass) . "IDENTIFIED BY " . $db->getPlatform()->quoteValue($newpass)
. " WITH GRANT OPTION"; . " 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( $sql = file_get_contents(
APPLICATION_PATH . '/module/VuFind/sql/mysql.sql' APPLICATION_PATH . '/module/VuFind/sql/mysql.sql'
); );
if($skip == 'Skip') { $statements = explode(';', $sql);
$omnisql = $query .';'. $grant .';FLUSH PRIVILEGES;'. $sql; foreach ($statements as $current) {
echo $omnisql; // Skip empty sections:
} else { if (strlen(trim($current)) == 0) {
$db->query($query, $db::QUERY_MODE_EXECUTE); continue;
$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');
} }
$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'); return $this->redirect()->toRoute('install-home');
} catch (\Exception $e) { } catch (\Exception $e) {
......
...@@ -39,155 +39,6 @@ namespace VuFind\Controller; ...@@ -39,155 +39,6 @@ namespace VuFind\Controller;
*/ */
class VudlController extends AbstractBase 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 * Get the information from the XML
* *
......
...@@ -342,10 +342,6 @@ div.searchHomeForm div.searchform { ...@@ -342,10 +342,6 @@ div.searchHomeForm div.searchform {
padding:0; padding:0;
} }
#searchForm_type {
padding:2px;
}
/******** Result List ***/ /******** Result List ***/
ul.recordSet { ul.recordSet {
......
...@@ -15,7 +15,10 @@ ...@@ -15,7 +15,10 @@
// TRUNCATE PAGES TO FIRST PAGES // TRUNCATE PAGES TO FIRST PAGES
$this->firstPages = array_slice($this->pages, 0, 6); $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="inspector_container">
<div class="side_nav"> <div class="side_nav">
<a href="javascript:showPages()" class="top"><?=$this->transEsc('vudl_tab_pages') ?></a> <a href="javascript:showPages()" class="top"><?=$this->transEsc('vudl_tab_pages') ?></a>
......
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment