From e2fe6e503382a2145a4941ab94e485c45e4d8812 Mon Sep 17 00:00:00 2001
From: shinobu
Date: Fri, 26 Aug 2016 20:54:08 +0200
Subject: [PATCH] create a db for users with AC test enabled, activate the
checkbox value, make the checkbox prechecked, fix statement parameters
---
extensions/queries/QueriesController.php | 12 +++++++++---
extensions/queries/resources/savepartial.js | 7 +++----
extensions/queries/templates/savequery.phtml | 2 +-
3 files changed, 13 insertions(+), 8 deletions(-)
diff --git a/extensions/queries/QueriesController.php b/extensions/queries/QueriesController.php
index 00f27a1bb..6fb421c0e 100644
--- a/extensions/queries/QueriesController.php
+++ b/extensions/queries/QueriesController.php
@@ -408,7 +408,11 @@ public function savequeryAction()
$res = "json or desc missing";
// checking for post data to save queries
$params = $this->_request->getParams();
- if (isset($params['json']) && isset($params['json'])) {
+ $hasAC = !(
+ empty(Erfurt_App::getInstance()->isActionAllowed('ModelManagement'))
+ && ($params['share'] == 'false')
+ );
+ if (isset($params['json']) && $hasAC) {
if ($this->_request->getParam('share') == "true") {
// store in the model itself - everybody can see it
$storeGraph = $this->_owApp->selectedModel;
@@ -581,6 +585,8 @@ public function savequeryAction()
} else {
$res = 'Save failed. (Query with same pattern exists)';
}
+ } else {
+ $res = 'You dont have the permissions to save your Queries non-shared.';
}
$response->setBody($res);
}
@@ -693,7 +699,7 @@ private function createUserQueryDB()
$proposedDBname = $this->_userDbUri;
$store = $this->_erfurt->getStore();
- $newModel = $store->getNewModel($proposedDBname, null, null, false);
+ $newModel = $store->getNewModel($proposedDBname, null, null, true);
$object = array();
@@ -714,7 +720,7 @@ private function createUserQueryDB()
//domain of this db (needed?)
$object['value'] = $this->_privateConfig->saving->baseQueryDbUri;
- $object['type'] = 'iri';
+ $object['type'] = 'uri';
$newModel->addStatement($proposedDBname, EF_RDFS_DOMAIN, $object);
//add owner/maker of this db
diff --git a/extensions/queries/resources/savepartial.js b/extensions/queries/resources/savepartial.js
index 9f3d3bfa3..280307efb 100644
--- a/extensions/queries/resources/savepartial.js
+++ b/extensions/queries/resources/savepartial.js
@@ -22,7 +22,7 @@ $(document).ready(function() {
success: function(msg){
//TODO check for status
if(msg != "All OK")
- alert("Fehler "+msg);
+ alert("Error "+msg);
//open(urlBase + "querybuilding/listquery");
}
});
@@ -46,8 +46,7 @@ $(document).ready(function() {
name: $('#qname').val(),
"query": editor.getValue(),
generator: "qe",
- //share: $("#savequerysharecheckbox").is(':checked') ? "true" : "false"
- share: "true"
+ share: $("#savequerysharecheckbox").is(':checked') ? "true" : "false"
}),
dataType: "text",
error: function(xmlHttpObj, type, error){
@@ -56,7 +55,7 @@ $(document).ready(function() {
success: function(msg){
//TODO check for status
if (msg != "All OK") {
- alert("Fehler " + msg);
+ alert("Error " + msg);
} else {
$('.innercontent').prepend("The Query was saved
");
diff --git a/extensions/queries/templates/savequery.phtml b/extensions/queries/templates/savequery.phtml
index c7351f155..e873e82c9 100644
--- a/extensions/queries/templates/savequery.phtml
+++ b/extensions/queries/templates/savequery.phtml
@@ -4,6 +4,6 @@
- share with others
+ share with others
_('Save Query'); ?>
\ No newline at end of file