Skip to content
Snippets Groups Projects
Commit ecbaafd0 authored by alangrafu's avatar alangrafu
Browse files

Fixed header.inc (Haanga bug)

Haanga doesn't support variables starting with 'end' (reported at
https://github.com/crodas/Haanga/issues/14)
Use of {{base.sparqlendpoint.local}} in the meantime

Adding better error report when sqlite is not writeable.
parent 23746587
No related branches found
No related tags found
No related merge requests found
......@@ -73,7 +73,8 @@ class SpecialFunction extends AbstractSpecialFunction{
$base['this']['contentType'] = $acceptContentType;
$base['model']['directory'] = $conf['model']['directory'];
$base['view']['directory'] = $conf['view']['directory'];
$base['ns'] = $conf['ns']; $base['ns'] = $conf['ns'];
$base['ns'] = $conf['ns'];
$base['sparqlendpoint'] = $conf['endpoint'];
$base['type'] = $modelFile;
$base['header'] = $prefixHeader;
$base['args'] = $args;
......@@ -83,7 +84,8 @@ class SpecialFunction extends AbstractSpecialFunction{
$base['view']['directory'] = $conf['home'].$conf['view']['directory'];
$base['model']['directory'] = $conf['home'].$conf['model']['directory'];
chdir($conf['model']['directory']);
Utils::queryFile($modelFile, $endpoints['local'], $data);
$first = array();
Utils::queryFile($modelFile, $endpoints['local'], $data, $first);
chdir($conf['home']);
$data = Utils::internalize($data);
......
......@@ -30,13 +30,13 @@ class MetaDb{
global $conf;
try{
$db = new PDO('sqlite:'.$this->dbLocation);
$db->setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_WARNING);
$results = $db->exec($q);
$db->setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION);
$results = $db->exec($q);
$db = NULL;
}catch(PDOException $e){
print 'Exception exec: '.$e->getMessage()."\n\n";
exit(10);
}catch(Exception $e){
echo "Can't write in SQLite database. Please check you have granted write permissions to <tt>meta/</tt> and <tt>meta/db.sqlite</tt>.";
trigger_error('Exception exec: '.$e->getMessage(), E_USER_ERROR);
exit(1);
}
return $results;
}
......
......@@ -22,9 +22,12 @@ class Utils{
exit(0);
}
public static function send500($uri){
public static function send500($msg = null){
header("HTTP/1.0 500 Internal Server Error");
echo "An internal error ocurred. Please try later\n\n";
if($msg != null){
echo $msg;
}
exit(0);
}
......
<h4>Endpoint: {{base.sparqlendpoint.local}}</h4>
<div style='float:center'>
<a href='{{base.home}}'>Home</a> | <a href='{{base.home}}/special/classes'>Classes</a> | <a href='{{base.home}}/special/namedGraphs'>Named Graphs</a>
<a href='{{base.home}}'>Home</a> | <a href='{{base.home}}special/classes'>Classes</a> | <a href='{{base.home}}special/namedGraphs'>Named Graphs</a>
</div>
......@@ -11,14 +11,8 @@
<h1>Classes available</h1>
{%include "header.inc"%}
<ul>
{% if r.resource.value != null %}
<!-- Only one class available -->
<li><a href='{{base.baseUrl}}special/instances/{{ r.resource.curie }}'>{{r.resource.curie}}</a></li>
{% endif %}
{% for row in r %}
{% if row.resource.value %}
<li><a href='{{base.baseUrl}}special/instances/{{ row.resource.curie }}'>{{row.resource.curie}}</a></li>
{% endif %}
{% endfor %}
</ul>
</body>
......
......@@ -8,7 +8,7 @@
<link href="{{base.baseUrl}}/lodspeakr/css/basic.css" rel="stylesheet" type="text/css" media="screen" />
</head>
<body>
<h1>Graphs available in the triple store</h1>
<h1>Graphs available</h1>
{%include "header.inc"%}
<ul>
{% for row in r %}
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment