Skip to content
This repository was archived by the owner on Jun 11, 2024. It is now read-only.

Commit 554b5d1

Browse files
authored
Merge pull request #391 from AKSW/fix/savedqueries
Fix extension/savedqueries
2 parents c403a0e + ddcd17a commit 554b5d1

File tree

3 files changed

+12
-14
lines changed

3 files changed

+12
-14
lines changed

extensions/savedqueries/SavedqueriesController.php

Lines changed: 9 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -6,8 +6,6 @@
66
* @license http://opensource.org/licenses/gpl-license.php GNU General Public License (GPL)
77
*/
88

9-
require_once 'OntoWiki/Controller/Component.php';
10-
119
/**
1210
* Mass Geocoding of Ressources via attributes (parameter r)
1311
*
@@ -32,14 +30,12 @@ public function init()
3230
parent::init();
3331
// m is automatically used and selected
3432
if ((!isset($this->_request->m)) && (!$this->_owApp->selectedModel)) {
35-
require_once 'OntoWiki/Exception.php';
3633
throw new OntoWiki_Exception('No model pre-selected and missing parameter m (model)!');
3734
} else {
3835
$this->_model = $this->_owApp->selectedModel;
3936
}
4037

4138
// disable tabs
42-
require_once 'OntoWiki/Navigation.php';
4339
OntoWiki::getInstance()->getNavigation()->disableNavigation();
4440

4541
// get translation object
@@ -61,8 +57,15 @@ public function init()
6157
public function initAction()
6258
{
6359
// create a new button on the toolbar
64-
$queryResult = $this->_getQueryResult($this->queryString);
65-
60+
try {
61+
$queryResult = $this->_getQueryResult($this->queryString);
62+
} catch (Exception $e){
63+
$queryResult = array(
64+
array(
65+
"error" => "This Query contains errors and should be corrected in the Query Editor",
66+
),
67+
);
68+
}
6669
$header = array();
6770
try {
6871
if (is_array($queryResult) && isset($queryResult[0]) && is_array($queryResult[0])) {

extensions/savedqueries/SavedqueriesModule.php

Lines changed: 2 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -6,11 +6,6 @@
66
* @license http://opensource.org/licenses/gpl-license.php GNU General Public License (GPL)
77
*/
88

9-
require_once 'Erfurt/Sparql/SimpleQuery.php';
10-
require_once 'OntoWiki/Module.php';
11-
require_once 'OntoWiki/Url.php';
12-
require_once 'OntoWiki/Utils.php';
13-
149
/**
1510
* @category OntoWiki
1611
* @package Extensions_Savedqueries
@@ -38,8 +33,8 @@ public function getContents()
3833
?query a <" . $this->_privateConfig->queryClass . "> .
3934
?query <" . $this->_privateConfig->queryLabel . "> ?label .
4035
?query <" . $this->_privateConfig->queryId . "> ?id .
41-
?query <" . $this->_privateConfig->queryDesc . "> ?description .
42-
?query <" . $this->_privateConfig->queryCode . "> ?code
36+
?query <" . $this->_privateConfig->queryCode . "> ?code.
37+
OPTIONAL { ?query <" . $this->_privateConfig->queryDesc . "> ?description . }
4338
}";
4439

4540
$elements = $storeGraph->sparqlQuery($query);

extensions/savedqueries/templates/savedqueries/init.phtml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
<fieldset>
33
<?php if (is_array($this->queryResult)): ?>
44
<?php
5-
echo $this->partial('partials/resultset.phtml', array('data' => $this->queryResult, 'header' => $this->header, 'caption'=>''));
5+
echo $this->partial('partials/resultset.phtml', array('data' => $this->queryResult, 'urlBase' => $this->urlBase, 'header' => $this->header, 'caption'=>''));
66
?>
77
<?php else: ?>
88
<pre><?php echo $this->escape($this->queryResult) ?></pre>

0 commit comments

Comments
 (0)