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

Commit

Permalink
Merge pull request #391 from AKSW/fix/savedqueries
Browse files Browse the repository at this point in the history
Fix extension/savedqueries
  • Loading branch information
pfrischmuth authored Aug 26, 2016
2 parents c403a0e + ddcd17a commit 554b5d1
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 14 deletions.
15 changes: 9 additions & 6 deletions extensions/savedqueries/SavedqueriesController.php
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,6 @@
* @license http://opensource.org/licenses/gpl-license.php GNU General Public License (GPL)
*/

require_once 'OntoWiki/Controller/Component.php';

/**
* Mass Geocoding of Ressources via attributes (parameter r)
*
Expand All @@ -32,14 +30,12 @@ public function init()
parent::init();
// m is automatically used and selected
if ((!isset($this->_request->m)) && (!$this->_owApp->selectedModel)) {
require_once 'OntoWiki/Exception.php';
throw new OntoWiki_Exception('No model pre-selected and missing parameter m (model)!');
} else {
$this->_model = $this->_owApp->selectedModel;
}

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

// get translation object
Expand All @@ -61,8 +57,15 @@ public function init()
public function initAction()
{
// create a new button on the toolbar
$queryResult = $this->_getQueryResult($this->queryString);

try {
$queryResult = $this->_getQueryResult($this->queryString);
} catch (Exception $e){
$queryResult = array(
array(
"error" => "This Query contains errors and should be corrected in the Query Editor",
),
);
}
$header = array();
try {
if (is_array($queryResult) && isset($queryResult[0]) && is_array($queryResult[0])) {
Expand Down
9 changes: 2 additions & 7 deletions extensions/savedqueries/SavedqueriesModule.php
Original file line number Diff line number Diff line change
Expand Up @@ -6,11 +6,6 @@
* @license http://opensource.org/licenses/gpl-license.php GNU General Public License (GPL)
*/

require_once 'Erfurt/Sparql/SimpleQuery.php';
require_once 'OntoWiki/Module.php';
require_once 'OntoWiki/Url.php';
require_once 'OntoWiki/Utils.php';

/**
* @category OntoWiki
* @package Extensions_Savedqueries
Expand Down Expand Up @@ -38,8 +33,8 @@ public function getContents()
?query a <" . $this->_privateConfig->queryClass . "> .
?query <" . $this->_privateConfig->queryLabel . "> ?label .
?query <" . $this->_privateConfig->queryId . "> ?id .
?query <" . $this->_privateConfig->queryDesc . "> ?description .
?query <" . $this->_privateConfig->queryCode . "> ?code
?query <" . $this->_privateConfig->queryCode . "> ?code.
OPTIONAL { ?query <" . $this->_privateConfig->queryDesc . "> ?description . }
}";

$elements = $storeGraph->sparqlQuery($query);
Expand Down
2 changes: 1 addition & 1 deletion extensions/savedqueries/templates/savedqueries/init.phtml
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
<fieldset>
<?php if (is_array($this->queryResult)): ?>
<?php
echo $this->partial('partials/resultset.phtml', array('data' => $this->queryResult, 'header' => $this->header, 'caption'=>''));
echo $this->partial('partials/resultset.phtml', array('data' => $this->queryResult, 'urlBase' => $this->urlBase, 'header' => $this->header, 'caption'=>''));
?>
<?php else: ?>
<pre><?php echo $this->escape($this->queryResult) ?></pre>
Expand Down

0 comments on commit 554b5d1

Please sign in to comment.