From bb13e137bf65cf2e29096e4e5af983d368f9ffe3 Mon Sep 17 00:00:00 2001 From: Natanael Arndt Date: Tue, 15 Oct 2013 15:56:01 +0200 Subject: [PATCH 001/482] Add config option to enable FormBuilder feature --- application/config/default.ini | 1 + application/controllers/ServiceController.php | 24 ++++++++++++++----- config.ini.dist | 5 ++++ 3 files changed, 24 insertions(+), 6 deletions(-) diff --git a/application/config/default.ini b/application/config/default.ini index 68eccb0e6..a2bbbdce6 100644 --- a/application/config/default.ini +++ b/application/config/default.ini @@ -184,6 +184,7 @@ cache.translation = on ; RDFa widget configuration ;; update.endpoint = "endpoint" +rdfauthor.usetemplate = off ;; diff --git a/application/controllers/ServiceController.php b/application/controllers/ServiceController.php index 8e931cd5c..32454a365 100644 --- a/application/controllers/ServiceController.php +++ b/application/controllers/ServiceController.php @@ -877,12 +877,24 @@ public function rdfauthorinitAction() } if ($workingMode == 'class') { - $properties = $model->sparqlQuery( - 'SELECT DISTINCT ?uri ?value { - ?s ?uri ?value. - ?s a <' . $parameter . '>. - } LIMIT 20 ', array('result_format' => 'extended') - ); + if ($this->_config->rdfauthor->usetemplate) { + $properties = $model->sparqlQuery( + 'SELECT ?a { ?a } LIMIT 20' + ); + } else { + $properties = null; + } + + if ($properties === null || count($properties) < 1) { + $propertiesQuery = 'SELECT DISTINCT ?uri ?value {' . PHP_EOL; + $propertiesQuery.= ' ?s ?uri ?value.' . PHP_EOL; + $propertiesQuery.= ' ?s a <' . $parameter . '>.' . PHP_EOL; + $propertiesQuery.= '} LIMIT 20 ' . PHP_EOL; + + $properties = $model->sparqlQuery( + $propertiesQuery, array('result_format' => 'extended') + ); + } } elseif ($workingMode == 'clone') { // FIXME: more than one values of a property are not supported right now // FIXME: Literals are not supported right now diff --git a/config.ini.dist b/config.ini.dist index f8dae4e6c..e9048593b 100644 --- a/config.ini.dist +++ b/config.ini.dist @@ -65,6 +65,11 @@ store.comparer.ignoredMethods[] = sparqlQuery ;; languages.locale = "en" ; en, de, ru, zh (Chinese) +;;;; +;; Configuration for RDFauthor +;; +rdfauthor.usetemplate = true ; this should be set to false when merging to develop + ;;;; ;; Set this identifier to a unique value if you want to run multiple OntoWiki ;; installations on one server From da63ff8df8fbfa3db279270ce0c40f533476f042 Mon Sep 17 00:00:00 2001 From: Andreas Nareike Date: Wed, 16 Oct 2013 15:28:05 +0200 Subject: [PATCH 002/482] add first prototype of rdfauthor-template needs a template resource to work correctly --- application/controllers/ServiceController.php | 35 ++++++++++++++++--- 1 file changed, 30 insertions(+), 5 deletions(-) diff --git a/application/controllers/ServiceController.php b/application/controllers/ServiceController.php index 32454a365..d2d79ce7a 100644 --- a/application/controllers/ServiceController.php +++ b/application/controllers/ServiceController.php @@ -878,9 +878,25 @@ public function rdfauthorinitAction() if ($workingMode == 'class') { if ($this->_config->rdfauthor->usetemplate) { - $properties = $model->sparqlQuery( - 'SELECT ?a { ?a } LIMIT 20' - ); + $template = 'http://vocab.ub.uni-leipzig.de/bibrm/Template'; + $properties = $model->sparqlQuery(' + PREFIX erm: + SELECT DISTINCT ?uri ?propType ?pclass { + ?template a <'.$template.'> ; + erm:providesProperty ?uri ; + erm:bindsClass ?pclass . + OPTIONAL { + ?uri a ?propType . + } + } LIMIT 20', array('result_format' => 'extended')); + // not used right now + // $providedClass = $properties['results']['bindings'][0]['pclass']['value']; + // re-sort results to put rdf:type first + $properties['results']['bindings'] = + array_merge(array(array('uri' => array( + 'value' => "http://www.w3.org/1999/02/22-rdf-syntax-ns#type", + 'type' => 'uri'))), + $properties['results']['bindings']); } else { $properties = null; } @@ -932,8 +948,17 @@ public function rdfauthorinitAction() foreach ($properties as $property) { $currentUri = $property['uri']['value']; - $currentValue = $property['value']['value']; - $currentType = $property['value']['type']; + /* FIXME ad-hoc fix since in rdfauthor template mode + the value will not be set right now (but should probably + be provided in future + */ + if (isset($property['value'])) { + $currentValue = $property['value']['value']; + $currentType = $property['value']['type']; + } else { + $currentValue = ''; + $currentType = ''; + } $value = new stdClass(); From 1d7216a5cef709a7dd88a3b8b7fb3934c5e8163e Mon Sep 17 00:00:00 2001 From: Norman Radtke Date: Fri, 18 Oct 2013 14:33:44 +0200 Subject: [PATCH 003/482] Add query for classes bound to a template If RDFauthor template mode is active we check if the selected class is bound to a template resource and load exactly the properties specified there. If we do not find a suitable template we fall back to normal behaviour of RDFauthor. --- application/controllers/ServiceController.php | 67 +++++++++---------- 1 file changed, 33 insertions(+), 34 deletions(-) diff --git a/application/controllers/ServiceController.php b/application/controllers/ServiceController.php index d2d79ce7a..58d32cb24 100644 --- a/application/controllers/ServiceController.php +++ b/application/controllers/ServiceController.php @@ -668,7 +668,6 @@ public function templateAction() $this->_response->setBody($this->view->render($file)); } - /** * JSON outputs of the transitive closure of resources to a given start * resource and an transitive attribute @@ -827,7 +826,6 @@ public function rdfauthorcacheAction() $response->setBody(json_encode($output)); } - /** * JSON output of the RDFauthor init config, which is a RDF/JSON Model * without objects where the user should be able to add data @@ -876,40 +874,42 @@ public function rdfauthorinitAction() $resourceUri = $parameter; } + $templateFound = false; + // Look if template for selected class exist + if ($workingMode == 'class' && $this->_config->rdfauthor->usetemplate) + { + $template = 'http://vocab.ub.uni-leipzig.de/bibrm/Template'; + $properties = $model->sparqlQuery(' + PREFIX erm: + SELECT DISTINCT ?uri ?value { + ?template a <'.$template.'> ; + erm:providesProperty ?uri ; + erm:bindsClass <' . $parameter . '> . + OPTIONAL { + ?s ?uri ?value . + ?s a <' . $parameter . '> . + } + } LIMIT 20', array('result_format' => 'extended')); + // if a template suits the class (reosurceuri) add rdf:type + if (!empty($properties['results']['bindings'])) { + $templateFound = true ; + } + } + if ($workingMode == 'class') { - if ($this->_config->rdfauthor->usetemplate) { - $template = 'http://vocab.ub.uni-leipzig.de/bibrm/Template'; - $properties = $model->sparqlQuery(' - PREFIX erm: - SELECT DISTINCT ?uri ?propType ?pclass { - ?template a <'.$template.'> ; - erm:providesProperty ?uri ; - erm:bindsClass ?pclass . - OPTIONAL { - ?uri a ?propType . - } - } LIMIT 20', array('result_format' => 'extended')); - // not used right now - // $providedClass = $properties['results']['bindings'][0]['pclass']['value']; - // re-sort results to put rdf:type first + if ($templateFound) { $properties['results']['bindings'] = - array_merge(array(array('uri' => array( - 'value' => "http://www.w3.org/1999/02/22-rdf-syntax-ns#type", - 'type' => 'uri'))), - $properties['results']['bindings']); + array_merge(array(array('uri' => array( + 'value' => "http://www.w3.org/1999/02/22-rdf-syntax-ns#type", + 'type' => 'uri'))), + $properties['results']['bindings']); } else { - $properties = null; - } - - if ($properties === null || count($properties) < 1) { - $propertiesQuery = 'SELECT DISTINCT ?uri ?value {' . PHP_EOL; - $propertiesQuery.= ' ?s ?uri ?value.' . PHP_EOL; - $propertiesQuery.= ' ?s a <' . $parameter . '>.' . PHP_EOL; - $propertiesQuery.= '} LIMIT 20 ' . PHP_EOL; - $properties = $model->sparqlQuery( - $propertiesQuery, array('result_format' => 'extended') - ); + 'SELECT DISTINCT ?uri ?value { + ?s ?uri ?value. + ?s a <'. $parameter . '>. + } LIMIT 20 ', array('result_format' => 'extended') + ); } } elseif ($workingMode == 'clone') { // FIXME: more than one values of a property are not supported right now @@ -939,7 +939,6 @@ public function rdfauthorinitAction() $newProperties = new stdClass(); $properties = $properties['results']['bindings']; - // feed title helper w/ URIs $titleHelper = new OntoWiki_Model_TitleHelper($model); $titleHelper->addResources($properties, 'uri'); @@ -952,7 +951,7 @@ public function rdfauthorinitAction() the value will not be set right now (but should probably be provided in future */ - if (isset($property['value'])) { + if (isset($property['value']) && $property['value']['value'] !== '') { $currentValue = $property['value']['value']; $currentType = $property['value']['type']; } else { From 84a33be7752a3351e0cb20780bf9b17e8d6f3330 Mon Sep 17 00:00:00 2001 From: Andreas Nareike Date: Tue, 22 Oct 2013 13:46:04 +0200 Subject: [PATCH 004/482] Fix conflict when creating instance while editing Ad hoc fix that prevents a user from creating a new resource via the class module context menu when there is already a RDFAuthor widget open. Allowing both at the same time will lead to conflicts that could maybe be resolved later on. --- extensions/themes/silverblue/scripts/support.js | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/extensions/themes/silverblue/scripts/support.js b/extensions/themes/silverblue/scripts/support.js index ffa304dc2..e7b2214e8 100644 --- a/extensions/themes/silverblue/scripts/support.js +++ b/extensions/themes/silverblue/scripts/support.js @@ -1,4 +1,3 @@ - /** * This file is part of the {@link http://ontowiki.net OntoWiki} project. * @@ -484,8 +483,10 @@ function createInstanceFromClassURI(type, dataCallback) { // check if an resource is in editing mode if($(body).data('editingMode')) { - RDFauthor.cancel(); - RDFauthor.reset(); + alert("Please finish all other editing actions before creating a new instance."); + return; + //RDFauthor.cancel(); + //RDFauthor.reset(); } // remove resource menus @@ -594,6 +595,8 @@ function resourceURL(resourceURI) { function editProperty(event) { var element = $.event.fix(event).target; + $(body).data('editingMode', true); + loadRDFauthor(function () { RDFauthor.setOptions({ saveButtonTitle: 'Save Changes', From 06ec984545f92364424372b81249c86249365c7e Mon Sep 17 00:00:00 2001 From: Natanael Arndt Date: Tue, 22 Oct 2013 15:56:16 +0200 Subject: [PATCH 005/482] Forward RDFauthor --- libraries/RDFauthor | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/libraries/RDFauthor b/libraries/RDFauthor index d1e2c5b3d..f9449d860 160000 --- a/libraries/RDFauthor +++ b/libraries/RDFauthor @@ -1 +1 @@ -Subproject commit d1e2c5b3da334a0c062b39c9a8b043bf05b599f0 +Subproject commit f9449d8602195bba1b4809ecec937ba7f06ea3e2 From f2f4f1ced165a3923c3b2c789b4e466e4d2b83e9 Mon Sep 17 00:00:00 2001 From: Andreas Nareike Date: Tue, 5 Nov 2013 14:55:18 +0100 Subject: [PATCH 006/482] disable reload on propertyEdit this is a test that works together with the RDFauthor to enable submitting values without reloading --- extensions/themes/silverblue/scripts/support.js | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/extensions/themes/silverblue/scripts/support.js b/extensions/themes/silverblue/scripts/support.js index e7b2214e8..de7b94d08 100644 --- a/extensions/themes/silverblue/scripts/support.js +++ b/extensions/themes/silverblue/scripts/support.js @@ -610,9 +610,11 @@ function editProperty(event) { $('.edit-enable').removeClass('active'); // HACK: reload whole page after 1000 ms - window.setTimeout(function () { + /* + window.setTimeout(function () { window.location.href = window.location.href; }, 1000); + */ }, onCancel: function () { $('.edit').each(function() { From 1a8c6fd093ad387428349a090578dfeae43c0449 Mon Sep 17 00:00:00 2001 From: Norman Radtke Date: Tue, 5 Nov 2013 15:06:43 +0100 Subject: [PATCH 007/482] Add events onRDFAuthorInitTemplateAction in ServiceController and onPropertiesTemplateAction in ResourceController to trigger template extension --- .../controllers/ResourceController.php | 14 ++++++++- application/controllers/ServiceController.php | 30 +++++-------------- 2 files changed, 20 insertions(+), 24 deletions(-) diff --git a/application/controllers/ResourceController.php b/application/controllers/ResourceController.php index 89455a407..707ca3ebc 100644 --- a/application/controllers/ResourceController.php +++ b/application/controllers/ResourceController.php @@ -91,8 +91,20 @@ public function propertiesAction() } $model = new OntoWiki_Model_Resource($store, $graph, (string)$resource); + + $event = new Erfurt_Event('onPropertiesActionTemplate'); + $event->model = $model; + $event->resource = $resource; + $event->graph = $graph; + $result = $event->trigger(); + + if ($result) { + $predicates = $event->predicates; + } else { + $predicates = $model->getPredicates(); + } + $values = $model->getValues(); - $predicates = $model->getPredicates(); // new trigger onPropertiesActionData to work with data (reorder with plugin) $event = new Erfurt_Event('onPropertiesActionData'); diff --git a/application/controllers/ServiceController.php b/application/controllers/ServiceController.php index 58d32cb24..69ce6b4e1 100644 --- a/application/controllers/ServiceController.php +++ b/application/controllers/ServiceController.php @@ -876,33 +876,17 @@ public function rdfauthorinitAction() $templateFound = false; // Look if template for selected class exist - if ($workingMode == 'class' && $this->_config->rdfauthor->usetemplate) + if ($workingMode == 'class') { - $template = 'http://vocab.ub.uni-leipzig.de/bibrm/Template'; - $properties = $model->sparqlQuery(' - PREFIX erm: - SELECT DISTINCT ?uri ?value { - ?template a <'.$template.'> ; - erm:providesProperty ?uri ; - erm:bindsClass <' . $parameter . '> . - OPTIONAL { - ?s ?uri ?value . - ?s a <' . $parameter . '> . - } - } LIMIT 20', array('result_format' => 'extended')); - // if a template suits the class (reosurceuri) add rdf:type - if (!empty($properties['results']['bindings'])) { - $templateFound = true ; - } + $event = new Erfurt_Event('onRDFAuthorInitActionTemplate'); + $event->model = $model; + $event->resource = $parameter; + $eventResult = $event->trigger(); } if ($workingMode == 'class') { - if ($templateFound) { - $properties['results']['bindings'] = - array_merge(array(array('uri' => array( - 'value' => "http://www.w3.org/1999/02/22-rdf-syntax-ns#type", - 'type' => 'uri'))), - $properties['results']['bindings']); + if ($eventResult) { + $properties = $event->properties; } else { $properties = $model->sparqlQuery( 'SELECT DISTINCT ?uri ?value { From 1070d88f36fa2a63e2976fffb060823994eb748a Mon Sep 17 00:00:00 2001 From: Norman Radtke Date: Mon, 18 Nov 2013 16:47:56 +0100 Subject: [PATCH 008/482] Fix indent --- application/controllers/ServiceController.php | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/application/controllers/ServiceController.php b/application/controllers/ServiceController.php index 69ce6b4e1..2c701168c 100644 --- a/application/controllers/ServiceController.php +++ b/application/controllers/ServiceController.php @@ -881,7 +881,8 @@ public function rdfauthorinitAction() $event = new Erfurt_Event('onRDFAuthorInitActionTemplate'); $event->model = $model; $event->resource = $parameter; - $eventResult = $event->trigger(); + $event->mode = $workingMode; + $eventResult = $event->trigger(); } if ($workingMode == 'class') { From 28c95298b22bfc01fbf0f129a58c09a92acab0f6 Mon Sep 17 00:00:00 2001 From: Andreas Nareike Date: Tue, 19 Nov 2013 10:36:45 +0100 Subject: [PATCH 009/482] display expanded resources automatically This is a prototypical implementation to test if a resource view can automatically be expanded to provide a subform like view. --- application/views/templates/resource/properties.phtml | 3 ++- extensions/themes/silverblue/scripts/jquery.ontowiki.js | 3 +++ libraries/RDFauthor | 2 +- 3 files changed, 6 insertions(+), 2 deletions(-) diff --git a/application/views/templates/resource/properties.phtml b/application/views/templates/resource/properties.phtml index bb0ff3ab6..35816a343 100644 --- a/application/views/templates/resource/properties.phtml +++ b/application/views/templates/resource/properties.phtml @@ -100,7 +100,8 @@ - + + namespacePrefixes as $prefix => $namespace): ?> diff --git a/extensions/themes/silverblue/scripts/jquery.ontowiki.js b/extensions/themes/silverblue/scripts/jquery.ontowiki.js index 2d9a29b70..a48fa08ea 100644 --- a/extensions/themes/silverblue/scripts/jquery.ontowiki.js +++ b/extensions/themes/silverblue/scripts/jquery.ontowiki.js @@ -179,6 +179,9 @@ toggleExpansion(event); return false; // -> event is not given further }); + if (!($(this).closest("table").hasClass("resource-list"))) { + $(this).prev().trigger("click"); + } }) } diff --git a/libraries/RDFauthor b/libraries/RDFauthor index f9449d860..98d2b0bed 160000 --- a/libraries/RDFauthor +++ b/libraries/RDFauthor @@ -1 +1 @@ -Subproject commit f9449d8602195bba1b4809ecec937ba7f06ea3e2 +Subproject commit 98d2b0beded7d9f6741001df4b541cd6bc4e37da From e743e452ba0fe0417161a4f405402fe8de99838e Mon Sep 17 00:00:00 2001 From: Andreas Nareike Date: Tue, 19 Nov 2013 16:24:50 +0100 Subject: [PATCH 010/482] revert last commit --- application/views/templates/resource/properties.phtml | 3 +-- extensions/themes/silverblue/scripts/jquery.ontowiki.js | 3 --- 2 files changed, 1 insertion(+), 5 deletions(-) diff --git a/application/views/templates/resource/properties.phtml b/application/views/templates/resource/properties.phtml index 35816a343..bb0ff3ab6 100644 --- a/application/views/templates/resource/properties.phtml +++ b/application/views/templates/resource/properties.phtml @@ -100,8 +100,7 @@ - - + namespacePrefixes as $prefix => $namespace): ?> diff --git a/extensions/themes/silverblue/scripts/jquery.ontowiki.js b/extensions/themes/silverblue/scripts/jquery.ontowiki.js index a48fa08ea..2d9a29b70 100644 --- a/extensions/themes/silverblue/scripts/jquery.ontowiki.js +++ b/extensions/themes/silverblue/scripts/jquery.ontowiki.js @@ -179,9 +179,6 @@ toggleExpansion(event); return false; // -> event is not given further }); - if (!($(this).closest("table").hasClass("resource-list"))) { - $(this).prev().trigger("click"); - } }) } From 36f64c4f3682148e83c09f136eddb803e34024b7 Mon Sep 17 00:00:00 2001 From: Andreas Nareike Date: Mon, 2 Dec 2013 21:31:25 +0100 Subject: [PATCH 011/482] add option to export result to CSV This will add an option to export a result of a SPARQL query as CSV. Note that this will only work with when the corresponding feature of Erfurt is also checked out. --- extensions/queries/QueriesController.php | 7 ++++++- extensions/queries/templates/sparqloptions.phtml | 7 +++++++ 2 files changed, 13 insertions(+), 1 deletion(-) diff --git a/extensions/queries/QueriesController.php b/extensions/queries/QueriesController.php index 014369984..3acd9d440 100644 --- a/extensions/queries/QueriesController.php +++ b/extensions/queries/QueriesController.php @@ -187,6 +187,7 @@ public function editorAction() $query = $prefixString . PHP_EOL . $query; } } + if ($format == 'list') { $url = new OntoWiki_Url(array('controller' => 'list'), array()); $query = str_replace("\r\n", ' ', $query); @@ -240,7 +241,7 @@ public function editorAction() } //this is for the "output to file option - if (($format == 'json' || $format == 'xml') + if (($format == 'json' || $format == 'xml' || $format == 'csv') && ($this->_request->getParam('result_outputfile') == 'true') ) { $this->_helper->viewRenderer->setNoRender(); @@ -256,6 +257,10 @@ public function editorAction() $contentType = 'application/json'; $filename = 'query-result.json'; break; + case 'csv': + $contentType = 'text/csv'; + $filename = 'query-result.csv'; + break; } $response->setHeader('Content-Type', $contentType, true); diff --git a/extensions/queries/templates/sparqloptions.phtml b/extensions/queries/templates/sparqloptions.phtml index c3d0fe406..2c0002452 100644 --- a/extensions/queries/templates/sparqloptions.phtml +++ b/extensions/queries/templates/sparqloptions.phtml @@ -35,6 +35,13 @@ />
+ placeholder('sparql.result.format') == 'csv'): ?> + + + /> + +
placeholder('sparql.result.file') == 'true'): ?> From 368868718e31ad0d6f5792c4d6269842ed16b109 Mon Sep 17 00:00:00 2001 From: Natanael Arndt Date: Tue, 15 Oct 2013 15:56:01 +0200 Subject: [PATCH 012/482] Add config option to enable FormBuilder feature --- application/config/default.ini | 1 + application/controllers/ServiceController.php | 24 ++++++++++++++----- config.ini.dist | 5 ++++ 3 files changed, 24 insertions(+), 6 deletions(-) diff --git a/application/config/default.ini b/application/config/default.ini index 11b7e970f..603437920 100644 --- a/application/config/default.ini +++ b/application/config/default.ini @@ -184,6 +184,7 @@ cache.translation = on ; RDFa widget configuration ;; update.endpoint = "endpoint" +rdfauthor.usetemplate = off ;; diff --git a/application/controllers/ServiceController.php b/application/controllers/ServiceController.php index 8e931cd5c..32454a365 100644 --- a/application/controllers/ServiceController.php +++ b/application/controllers/ServiceController.php @@ -877,12 +877,24 @@ public function rdfauthorinitAction() } if ($workingMode == 'class') { - $properties = $model->sparqlQuery( - 'SELECT DISTINCT ?uri ?value { - ?s ?uri ?value. - ?s a <' . $parameter . '>. - } LIMIT 20 ', array('result_format' => 'extended') - ); + if ($this->_config->rdfauthor->usetemplate) { + $properties = $model->sparqlQuery( + 'SELECT ?a { ?a } LIMIT 20' + ); + } else { + $properties = null; + } + + if ($properties === null || count($properties) < 1) { + $propertiesQuery = 'SELECT DISTINCT ?uri ?value {' . PHP_EOL; + $propertiesQuery.= ' ?s ?uri ?value.' . PHP_EOL; + $propertiesQuery.= ' ?s a <' . $parameter . '>.' . PHP_EOL; + $propertiesQuery.= '} LIMIT 20 ' . PHP_EOL; + + $properties = $model->sparqlQuery( + $propertiesQuery, array('result_format' => 'extended') + ); + } } elseif ($workingMode == 'clone') { // FIXME: more than one values of a property are not supported right now // FIXME: Literals are not supported right now diff --git a/config.ini.dist b/config.ini.dist index ebbd0cc34..8064485a8 100644 --- a/config.ini.dist +++ b/config.ini.dist @@ -65,6 +65,11 @@ store.comparer.ignoredMethods[] = sparqlQuery ;; languages.locale = "en" ; en, de, ru, zh (Chinese) +;;;; +;; Configuration for RDFauthor +;; +rdfauthor.usetemplate = true ; this should be set to false when merging to develop + ;;;; ;; Set this identifier to a unique value if you want to run multiple OntoWiki ;; installations on one server From 2f253306eacf4b32c805f6c0c3201b5c566765bb Mon Sep 17 00:00:00 2001 From: Andreas Nareike Date: Wed, 16 Oct 2013 15:28:05 +0200 Subject: [PATCH 013/482] add first prototype of rdfauthor-template needs a template resource to work correctly --- application/controllers/ServiceController.php | 35 ++++++++++++++++--- 1 file changed, 30 insertions(+), 5 deletions(-) diff --git a/application/controllers/ServiceController.php b/application/controllers/ServiceController.php index 32454a365..d2d79ce7a 100644 --- a/application/controllers/ServiceController.php +++ b/application/controllers/ServiceController.php @@ -878,9 +878,25 @@ public function rdfauthorinitAction() if ($workingMode == 'class') { if ($this->_config->rdfauthor->usetemplate) { - $properties = $model->sparqlQuery( - 'SELECT ?a { ?a } LIMIT 20' - ); + $template = 'http://vocab.ub.uni-leipzig.de/bibrm/Template'; + $properties = $model->sparqlQuery(' + PREFIX erm: + SELECT DISTINCT ?uri ?propType ?pclass { + ?template a <'.$template.'> ; + erm:providesProperty ?uri ; + erm:bindsClass ?pclass . + OPTIONAL { + ?uri a ?propType . + } + } LIMIT 20', array('result_format' => 'extended')); + // not used right now + // $providedClass = $properties['results']['bindings'][0]['pclass']['value']; + // re-sort results to put rdf:type first + $properties['results']['bindings'] = + array_merge(array(array('uri' => array( + 'value' => "http://www.w3.org/1999/02/22-rdf-syntax-ns#type", + 'type' => 'uri'))), + $properties['results']['bindings']); } else { $properties = null; } @@ -932,8 +948,17 @@ public function rdfauthorinitAction() foreach ($properties as $property) { $currentUri = $property['uri']['value']; - $currentValue = $property['value']['value']; - $currentType = $property['value']['type']; + /* FIXME ad-hoc fix since in rdfauthor template mode + the value will not be set right now (but should probably + be provided in future + */ + if (isset($property['value'])) { + $currentValue = $property['value']['value']; + $currentType = $property['value']['type']; + } else { + $currentValue = ''; + $currentType = ''; + } $value = new stdClass(); From 41fca7cd54041713d017baace774d2d13361ca14 Mon Sep 17 00:00:00 2001 From: Norman Radtke Date: Fri, 18 Oct 2013 14:33:44 +0200 Subject: [PATCH 014/482] Add query for classes bound to a template If RDFauthor template mode is active we check if the selected class is bound to a template resource and load exactly the properties specified there. If we do not find a suitable template we fall back to normal behaviour of RDFauthor. --- application/controllers/ServiceController.php | 67 +++++++++---------- 1 file changed, 33 insertions(+), 34 deletions(-) diff --git a/application/controllers/ServiceController.php b/application/controllers/ServiceController.php index d2d79ce7a..58d32cb24 100644 --- a/application/controllers/ServiceController.php +++ b/application/controllers/ServiceController.php @@ -668,7 +668,6 @@ public function templateAction() $this->_response->setBody($this->view->render($file)); } - /** * JSON outputs of the transitive closure of resources to a given start * resource and an transitive attribute @@ -827,7 +826,6 @@ public function rdfauthorcacheAction() $response->setBody(json_encode($output)); } - /** * JSON output of the RDFauthor init config, which is a RDF/JSON Model * without objects where the user should be able to add data @@ -876,40 +874,42 @@ public function rdfauthorinitAction() $resourceUri = $parameter; } + $templateFound = false; + // Look if template for selected class exist + if ($workingMode == 'class' && $this->_config->rdfauthor->usetemplate) + { + $template = 'http://vocab.ub.uni-leipzig.de/bibrm/Template'; + $properties = $model->sparqlQuery(' + PREFIX erm: + SELECT DISTINCT ?uri ?value { + ?template a <'.$template.'> ; + erm:providesProperty ?uri ; + erm:bindsClass <' . $parameter . '> . + OPTIONAL { + ?s ?uri ?value . + ?s a <' . $parameter . '> . + } + } LIMIT 20', array('result_format' => 'extended')); + // if a template suits the class (reosurceuri) add rdf:type + if (!empty($properties['results']['bindings'])) { + $templateFound = true ; + } + } + if ($workingMode == 'class') { - if ($this->_config->rdfauthor->usetemplate) { - $template = 'http://vocab.ub.uni-leipzig.de/bibrm/Template'; - $properties = $model->sparqlQuery(' - PREFIX erm: - SELECT DISTINCT ?uri ?propType ?pclass { - ?template a <'.$template.'> ; - erm:providesProperty ?uri ; - erm:bindsClass ?pclass . - OPTIONAL { - ?uri a ?propType . - } - } LIMIT 20', array('result_format' => 'extended')); - // not used right now - // $providedClass = $properties['results']['bindings'][0]['pclass']['value']; - // re-sort results to put rdf:type first + if ($templateFound) { $properties['results']['bindings'] = - array_merge(array(array('uri' => array( - 'value' => "http://www.w3.org/1999/02/22-rdf-syntax-ns#type", - 'type' => 'uri'))), - $properties['results']['bindings']); + array_merge(array(array('uri' => array( + 'value' => "http://www.w3.org/1999/02/22-rdf-syntax-ns#type", + 'type' => 'uri'))), + $properties['results']['bindings']); } else { - $properties = null; - } - - if ($properties === null || count($properties) < 1) { - $propertiesQuery = 'SELECT DISTINCT ?uri ?value {' . PHP_EOL; - $propertiesQuery.= ' ?s ?uri ?value.' . PHP_EOL; - $propertiesQuery.= ' ?s a <' . $parameter . '>.' . PHP_EOL; - $propertiesQuery.= '} LIMIT 20 ' . PHP_EOL; - $properties = $model->sparqlQuery( - $propertiesQuery, array('result_format' => 'extended') - ); + 'SELECT DISTINCT ?uri ?value { + ?s ?uri ?value. + ?s a <'. $parameter . '>. + } LIMIT 20 ', array('result_format' => 'extended') + ); } } elseif ($workingMode == 'clone') { // FIXME: more than one values of a property are not supported right now @@ -939,7 +939,6 @@ public function rdfauthorinitAction() $newProperties = new stdClass(); $properties = $properties['results']['bindings']; - // feed title helper w/ URIs $titleHelper = new OntoWiki_Model_TitleHelper($model); $titleHelper->addResources($properties, 'uri'); @@ -952,7 +951,7 @@ public function rdfauthorinitAction() the value will not be set right now (but should probably be provided in future */ - if (isset($property['value'])) { + if (isset($property['value']) && $property['value']['value'] !== '') { $currentValue = $property['value']['value']; $currentType = $property['value']['type']; } else { From 3df07d99904fe83f99a7cd2b04dd22ea6b0058a1 Mon Sep 17 00:00:00 2001 From: Andreas Nareike Date: Tue, 22 Oct 2013 13:46:04 +0200 Subject: [PATCH 015/482] Fix conflict when creating instance while editing Ad hoc fix that prevents a user from creating a new resource via the class module context menu when there is already a RDFAuthor widget open. Allowing both at the same time will lead to conflicts that could maybe be resolved later on. --- extensions/themes/silverblue/scripts/support.js | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/extensions/themes/silverblue/scripts/support.js b/extensions/themes/silverblue/scripts/support.js index ffa304dc2..e7b2214e8 100644 --- a/extensions/themes/silverblue/scripts/support.js +++ b/extensions/themes/silverblue/scripts/support.js @@ -1,4 +1,3 @@ - /** * This file is part of the {@link http://ontowiki.net OntoWiki} project. * @@ -484,8 +483,10 @@ function createInstanceFromClassURI(type, dataCallback) { // check if an resource is in editing mode if($(body).data('editingMode')) { - RDFauthor.cancel(); - RDFauthor.reset(); + alert("Please finish all other editing actions before creating a new instance."); + return; + //RDFauthor.cancel(); + //RDFauthor.reset(); } // remove resource menus @@ -594,6 +595,8 @@ function resourceURL(resourceURI) { function editProperty(event) { var element = $.event.fix(event).target; + $(body).data('editingMode', true); + loadRDFauthor(function () { RDFauthor.setOptions({ saveButtonTitle: 'Save Changes', From f37fb8f49bf252269bc17c485fe8d9d02b3d6ac3 Mon Sep 17 00:00:00 2001 From: Natanael Arndt Date: Tue, 22 Oct 2013 15:56:16 +0200 Subject: [PATCH 016/482] Forward RDFauthor --- libraries/RDFauthor | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/libraries/RDFauthor b/libraries/RDFauthor index a0a1ca71e..760aa9cdc 160000 --- a/libraries/RDFauthor +++ b/libraries/RDFauthor @@ -1 +1 @@ -Subproject commit a0a1ca71ea8ecd548939a85b1b0d2261234975e4 +Subproject commit 760aa9cdce4c16b32b2a7e52bfc3f5e2f57cf82f From 21094ee7f8d34824ffb056dda8136af258773740 Mon Sep 17 00:00:00 2001 From: Andreas Nareike Date: Tue, 5 Nov 2013 14:55:18 +0100 Subject: [PATCH 017/482] disable reload on propertyEdit this is a test that works together with the RDFauthor to enable submitting values without reloading --- extensions/themes/silverblue/scripts/support.js | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/extensions/themes/silverblue/scripts/support.js b/extensions/themes/silverblue/scripts/support.js index e7b2214e8..de7b94d08 100644 --- a/extensions/themes/silverblue/scripts/support.js +++ b/extensions/themes/silverblue/scripts/support.js @@ -610,9 +610,11 @@ function editProperty(event) { $('.edit-enable').removeClass('active'); // HACK: reload whole page after 1000 ms - window.setTimeout(function () { + /* + window.setTimeout(function () { window.location.href = window.location.href; }, 1000); + */ }, onCancel: function () { $('.edit').each(function() { From e798745aed6bffa46ef8b133833439bf1111c882 Mon Sep 17 00:00:00 2001 From: Norman Radtke Date: Tue, 5 Nov 2013 15:06:43 +0100 Subject: [PATCH 018/482] Add events onRDFAuthorInitTemplateAction in ServiceController and onPropertiesTemplateAction in ResourceController to trigger template extension --- .../controllers/ResourceController.php | 14 ++++++++- application/controllers/ServiceController.php | 30 +++++-------------- 2 files changed, 20 insertions(+), 24 deletions(-) diff --git a/application/controllers/ResourceController.php b/application/controllers/ResourceController.php index 89455a407..707ca3ebc 100644 --- a/application/controllers/ResourceController.php +++ b/application/controllers/ResourceController.php @@ -91,8 +91,20 @@ public function propertiesAction() } $model = new OntoWiki_Model_Resource($store, $graph, (string)$resource); + + $event = new Erfurt_Event('onPropertiesActionTemplate'); + $event->model = $model; + $event->resource = $resource; + $event->graph = $graph; + $result = $event->trigger(); + + if ($result) { + $predicates = $event->predicates; + } else { + $predicates = $model->getPredicates(); + } + $values = $model->getValues(); - $predicates = $model->getPredicates(); // new trigger onPropertiesActionData to work with data (reorder with plugin) $event = new Erfurt_Event('onPropertiesActionData'); diff --git a/application/controllers/ServiceController.php b/application/controllers/ServiceController.php index 58d32cb24..69ce6b4e1 100644 --- a/application/controllers/ServiceController.php +++ b/application/controllers/ServiceController.php @@ -876,33 +876,17 @@ public function rdfauthorinitAction() $templateFound = false; // Look if template for selected class exist - if ($workingMode == 'class' && $this->_config->rdfauthor->usetemplate) + if ($workingMode == 'class') { - $template = 'http://vocab.ub.uni-leipzig.de/bibrm/Template'; - $properties = $model->sparqlQuery(' - PREFIX erm: - SELECT DISTINCT ?uri ?value { - ?template a <'.$template.'> ; - erm:providesProperty ?uri ; - erm:bindsClass <' . $parameter . '> . - OPTIONAL { - ?s ?uri ?value . - ?s a <' . $parameter . '> . - } - } LIMIT 20', array('result_format' => 'extended')); - // if a template suits the class (reosurceuri) add rdf:type - if (!empty($properties['results']['bindings'])) { - $templateFound = true ; - } + $event = new Erfurt_Event('onRDFAuthorInitActionTemplate'); + $event->model = $model; + $event->resource = $parameter; + $eventResult = $event->trigger(); } if ($workingMode == 'class') { - if ($templateFound) { - $properties['results']['bindings'] = - array_merge(array(array('uri' => array( - 'value' => "http://www.w3.org/1999/02/22-rdf-syntax-ns#type", - 'type' => 'uri'))), - $properties['results']['bindings']); + if ($eventResult) { + $properties = $event->properties; } else { $properties = $model->sparqlQuery( 'SELECT DISTINCT ?uri ?value { From 8991a252f88ffcda7d98abf01270289a4592daa4 Mon Sep 17 00:00:00 2001 From: Norman Radtke Date: Mon, 18 Nov 2013 16:47:56 +0100 Subject: [PATCH 019/482] Fix indent --- application/controllers/ServiceController.php | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/application/controllers/ServiceController.php b/application/controllers/ServiceController.php index 69ce6b4e1..2c701168c 100644 --- a/application/controllers/ServiceController.php +++ b/application/controllers/ServiceController.php @@ -881,7 +881,8 @@ public function rdfauthorinitAction() $event = new Erfurt_Event('onRDFAuthorInitActionTemplate'); $event->model = $model; $event->resource = $parameter; - $eventResult = $event->trigger(); + $event->mode = $workingMode; + $eventResult = $event->trigger(); } if ($workingMode == 'class') { From 39d9c0037986a7ef0e4146610002a9e7c6efe526 Mon Sep 17 00:00:00 2001 From: Andreas Nareike Date: Tue, 19 Nov 2013 10:36:45 +0100 Subject: [PATCH 020/482] display expanded resources automatically This is a prototypical implementation to test if a resource view can automatically be expanded to provide a subform like view. --- application/views/templates/resource/properties.phtml | 3 ++- extensions/themes/silverblue/scripts/jquery.ontowiki.js | 3 +++ libraries/RDFauthor | 2 +- 3 files changed, 6 insertions(+), 2 deletions(-) diff --git a/application/views/templates/resource/properties.phtml b/application/views/templates/resource/properties.phtml index bb0ff3ab6..35816a343 100644 --- a/application/views/templates/resource/properties.phtml +++ b/application/views/templates/resource/properties.phtml @@ -100,7 +100,8 @@
- + + namespacePrefixes as $prefix => $namespace): ?> diff --git a/extensions/themes/silverblue/scripts/jquery.ontowiki.js b/extensions/themes/silverblue/scripts/jquery.ontowiki.js index 2d9a29b70..a48fa08ea 100644 --- a/extensions/themes/silverblue/scripts/jquery.ontowiki.js +++ b/extensions/themes/silverblue/scripts/jquery.ontowiki.js @@ -179,6 +179,9 @@ toggleExpansion(event); return false; // -> event is not given further }); + if (!($(this).closest("table").hasClass("resource-list"))) { + $(this).prev().trigger("click"); + } }) } diff --git a/libraries/RDFauthor b/libraries/RDFauthor index 760aa9cdc..98d2b0bed 160000 --- a/libraries/RDFauthor +++ b/libraries/RDFauthor @@ -1 +1 @@ -Subproject commit 760aa9cdce4c16b32b2a7e52bfc3f5e2f57cf82f +Subproject commit 98d2b0beded7d9f6741001df4b541cd6bc4e37da From ec6084c734c96ae136086394ae38f7ab7c772dd0 Mon Sep 17 00:00:00 2001 From: Andreas Nareike Date: Tue, 19 Nov 2013 16:24:50 +0100 Subject: [PATCH 021/482] revert last commit --- application/views/templates/resource/properties.phtml | 3 +-- extensions/themes/silverblue/scripts/jquery.ontowiki.js | 3 --- 2 files changed, 1 insertion(+), 5 deletions(-) diff --git a/application/views/templates/resource/properties.phtml b/application/views/templates/resource/properties.phtml index 35816a343..bb0ff3ab6 100644 --- a/application/views/templates/resource/properties.phtml +++ b/application/views/templates/resource/properties.phtml @@ -100,8 +100,7 @@ - - + namespacePrefixes as $prefix => $namespace): ?> diff --git a/extensions/themes/silverblue/scripts/jquery.ontowiki.js b/extensions/themes/silverblue/scripts/jquery.ontowiki.js index a48fa08ea..2d9a29b70 100644 --- a/extensions/themes/silverblue/scripts/jquery.ontowiki.js +++ b/extensions/themes/silverblue/scripts/jquery.ontowiki.js @@ -179,9 +179,6 @@ toggleExpansion(event); return false; // -> event is not given further }); - if (!($(this).closest("table").hasClass("resource-list"))) { - $(this).prev().trigger("click"); - } }) } From f6d69b722b78271d99193c330be6a65c50734e9e Mon Sep 17 00:00:00 2001 From: Andreas Nareike Date: Mon, 2 Dec 2013 21:31:25 +0100 Subject: [PATCH 022/482] add option to export result to CSV This will add an option to export a result of a SPARQL query as CSV. Note that this will only work with when the corresponding feature of Erfurt is also checked out. --- extensions/queries/QueriesController.php | 7 ++++++- extensions/queries/templates/sparqloptions.phtml | 7 +++++++ 2 files changed, 13 insertions(+), 1 deletion(-) diff --git a/extensions/queries/QueriesController.php b/extensions/queries/QueriesController.php index 014369984..3acd9d440 100644 --- a/extensions/queries/QueriesController.php +++ b/extensions/queries/QueriesController.php @@ -187,6 +187,7 @@ public function editorAction() $query = $prefixString . PHP_EOL . $query; } } + if ($format == 'list') { $url = new OntoWiki_Url(array('controller' => 'list'), array()); $query = str_replace("\r\n", ' ', $query); @@ -240,7 +241,7 @@ public function editorAction() } //this is for the "output to file option - if (($format == 'json' || $format == 'xml') + if (($format == 'json' || $format == 'xml' || $format == 'csv') && ($this->_request->getParam('result_outputfile') == 'true') ) { $this->_helper->viewRenderer->setNoRender(); @@ -256,6 +257,10 @@ public function editorAction() $contentType = 'application/json'; $filename = 'query-result.json'; break; + case 'csv': + $contentType = 'text/csv'; + $filename = 'query-result.csv'; + break; } $response->setHeader('Content-Type', $contentType, true); diff --git a/extensions/queries/templates/sparqloptions.phtml b/extensions/queries/templates/sparqloptions.phtml index c3d0fe406..2c0002452 100644 --- a/extensions/queries/templates/sparqloptions.phtml +++ b/extensions/queries/templates/sparqloptions.phtml @@ -35,6 +35,13 @@ />
+ placeholder('sparql.result.format') == 'csv'): ?> + + + /> + +
placeholder('sparql.result.file') == 'true'): ?> From 21ae458c01bc7c42cb2e3fab9e4e069b2cb78500 Mon Sep 17 00:00:00 2001 From: Andreas Nareike Date: Fri, 13 Dec 2013 15:58:43 +0100 Subject: [PATCH 023/482] Fix bug concerning 'permanent' editing mode --- extensions/themes/silverblue/scripts/support.js | 1 + libraries/Erfurt | 2 +- libraries/RDFauthor | 2 +- 3 files changed, 3 insertions(+), 2 deletions(-) diff --git a/extensions/themes/silverblue/scripts/support.js b/extensions/themes/silverblue/scripts/support.js index de7b94d08..08769cb6e 100644 --- a/extensions/themes/silverblue/scripts/support.js +++ b/extensions/themes/silverblue/scripts/support.js @@ -608,6 +608,7 @@ function editProperty(event) { $(this).fadeOut(effectTime); }); $('.edit-enable').removeClass('active'); + $(body).data('editingMode', false); // HACK: reload whole page after 1000 ms /* diff --git a/libraries/Erfurt b/libraries/Erfurt index c437ddf71..5f9bcd148 160000 --- a/libraries/Erfurt +++ b/libraries/Erfurt @@ -1 +1 @@ -Subproject commit c437ddf71908d3f9a13a6f7a23bbad8963b44474 +Subproject commit 5f9bcd14850440dc989257bbc82cf8dedbe5e5b8 diff --git a/libraries/RDFauthor b/libraries/RDFauthor index 98d2b0bed..be732d653 160000 --- a/libraries/RDFauthor +++ b/libraries/RDFauthor @@ -1 +1 @@ -Subproject commit 98d2b0beded7d9f6741001df4b541cd6bc4e37da +Subproject commit be732d653fb468d848aad8ae0382f37f5014e8da From e86c2d22d6f45181b747ecd404d81efb10498e35 Mon Sep 17 00:00:00 2001 From: Norman Radtke Date: Tue, 17 Dec 2013 11:46:55 +0100 Subject: [PATCH 024/482] Move event statements out of workingMode if-block --- application/controllers/ServiceController.php | 22 +++++++++---------- 1 file changed, 11 insertions(+), 11 deletions(-) diff --git a/application/controllers/ServiceController.php b/application/controllers/ServiceController.php index 2c701168c..163dbf266 100644 --- a/application/controllers/ServiceController.php +++ b/application/controllers/ServiceController.php @@ -874,16 +874,12 @@ public function rdfauthorinitAction() $resourceUri = $parameter; } - $templateFound = false; - // Look if template for selected class exist - if ($workingMode == 'class') - { - $event = new Erfurt_Event('onRDFAuthorInitActionTemplate'); - $event->model = $model; - $event->resource = $parameter; - $event->mode = $workingMode; - $eventResult = $event->trigger(); - } + $event = new Erfurt_Event('onRDFAuthorInitActionTemplate'); + $event->model = $model; + $event->resource = $resourceUri; + $event->parameter = $parameter; + $event->mode = $workingMode; + $eventResult = $event->trigger(); if ($workingMode == 'class') { if ($eventResult) { @@ -906,11 +902,15 @@ public function rdfauthorinitAction() } LIMIT 20 ', array('result_format' => 'extended') ); } elseif ($workingMode == 'edit') { + if ($eventResult) { + $properties = $event->properties; + } else { $properties = $model->sparqlQuery( 'SELECT ?uri ?value { <' . $parameter . '> ?uri ?value. } LIMIT 20 ', array('result_format' => 'extended') - ); + ); + } } else { // resource $properties = $model->sparqlQuery( 'SELECT DISTINCT ?uri ?value { From c2e97fce95d9367477429082501670bd1831b5ba Mon Sep 17 00:00:00 2001 From: Norman Radtke Date: Tue, 7 Jan 2014 12:23:00 +0100 Subject: [PATCH 025/482] Add a if statement to allow values for templates If template extension is active values in rdfauthorinitAction will be allowed to let RDFauthor chose the correct widgets. The values returned from template extension will be given if a property has xsd:date, -time or dateTime as rdfs:range. --- application/controllers/ServiceController.php | 13 ++++++++++--- 1 file changed, 10 insertions(+), 3 deletions(-) diff --git a/application/controllers/ServiceController.php b/application/controllers/ServiceController.php index 163dbf266..d7ffe018b 100644 --- a/application/controllers/ServiceController.php +++ b/application/controllers/ServiceController.php @@ -938,9 +938,13 @@ public function rdfauthorinitAction() */ if (isset($property['value']) && $property['value']['value'] !== '') { $currentValue = $property['value']['value']; - $currentType = $property['value']['type']; } else { $currentValue = ''; + } + + if (isset($property['value']) && $property['value']['type'] !== '') { + $currentType = $property['value']['type']; + } else { $currentType = ''; } @@ -986,8 +990,11 @@ public function rdfauthorinitAction() $value->value = $currentValue; $value->type = $currentType; } - if ($workingMode == 'class') { - $value->value = ''; + if ($workingMode == 'class' && $eventResult) { + $value->value = $currentValue; + $value->type = $currentType; + } elseif ($workingMode == 'class' && !$eventResult) { + $value->value = '' ; $value->type = $currentType; } } From 91fc29eff6779f1acb834416a62c50306de226c2 Mon Sep 17 00:00:00 2001 From: Andreas Nareike Date: Wed, 8 Jan 2014 13:54:53 +0100 Subject: [PATCH 026/482] Fix concerning data types for empty strings Data types for values passed to RDFauthor will also be transmitted when the value is not set. This change will allow RDFauthor to choose the right widget when creating new instances or new properties. --- extensions/themes/silverblue/scripts/support.js | 16 +++++++--------- 1 file changed, 7 insertions(+), 9 deletions(-) diff --git a/extensions/themes/silverblue/scripts/support.js b/extensions/themes/silverblue/scripts/support.js index 08769cb6e..e6b3fef1b 100644 --- a/extensions/themes/silverblue/scripts/support.js +++ b/extensions/themes/silverblue/scripts/support.js @@ -437,15 +437,13 @@ function populateRDFauthor(data, protect, resource, graph, workingmode) { type: String(objSpec.type).replace('typed-', '') } - if (objSpec.value) { - if (objSpec.type == 'typed-literal') { - newObjectSpec.options = { - datatype: objSpec.datatype - } - } else if (objSpec.lang) { - newObjectSpec.options = { - lang: objSpec.lang - } + if (objSpec.type == 'typed-literal') { + newObjectSpec.options = { + datatype: objSpec.datatype + } + } else if (objSpec.lang) { + newObjectSpec.options = { + lang: objSpec.lang } } From a1f22797dd7930b58a8602792dba54e0d9d52b8b Mon Sep 17 00:00:00 2001 From: Norman Radtke Date: Mon, 13 Jan 2014 14:38:24 +0100 Subject: [PATCH 027/482] Add HTML5 data*- attribute output To support provided template properties in "Add Property"-widget (from property view) HTML5 data-* attributes with json objects will be written to phtml template. --- application/controllers/ResourceController.php | 12 +++++++----- .../views/templates/resource/properties.phtml | 10 ++++++++-- 2 files changed, 15 insertions(+), 7 deletions(-) diff --git a/application/controllers/ResourceController.php b/application/controllers/ResourceController.php index 707ca3ebc..29e08d0e1 100644 --- a/application/controllers/ResourceController.php +++ b/application/controllers/ResourceController.php @@ -92,14 +92,16 @@ public function propertiesAction() $model = new OntoWiki_Model_Resource($store, $graph, (string)$resource); - $event = new Erfurt_Event('onPropertiesActionTemplate'); - $event->model = $model; - $event->resource = $resource; - $event->graph = $graph; - $result = $event->trigger(); + $event = new Erfurt_Event('onPropertiesActionTemplate'); + $event->model = $model; + $event->selectedModel = $this->_owApp->selectedModel; + $event->resource = $resource; + $event->graph = $graph; + $result = $event->trigger(); if ($result) { $predicates = $event->predicates; + $this->view->templateHtml = $event->templateHtml; } else { $predicates = $model->getPredicates(); } diff --git a/application/views/templates/resource/properties.phtml b/application/views/templates/resource/properties.phtml index bb0ff3ab6..36bb8ca90 100644 --- a/application/views/templates/resource/properties.phtml +++ b/application/views/templates/resource/properties.phtml @@ -1,5 +1,8 @@ prePropertiesContent)): ?> -
prePropertiesContent; ?>
+
prePropertiesContent; ?>
+ +templateHtml)): ?> + templateHtml ?> @@ -9,7 +12,7 @@ namespacePrefixes as $prefix => $namespace): ?> > - + predicates as $graph => $predicatesForGraph): ?> predicates[$graph]) > 0): /* has resource predicates from graph at all? */ ?> @@ -100,6 +103,9 @@
+templateHtml)): ?> + templateHtml ?> + namespacePrefixes as $prefix => $namespace): ?> From 9b87550d9df653e29ae44303674520ca7a0308c9 Mon Sep 17 00:00:00 2001 From: Norman Radtke Date: Mon, 13 Jan 2014 16:24:54 +0100 Subject: [PATCH 028/482] Add output for "Add Property" button in popover Add output for mode=class (Create Instance) --- application/controllers/ServiceController.php | 3 +++ 1 file changed, 3 insertions(+) diff --git a/application/controllers/ServiceController.php b/application/controllers/ServiceController.php index d7ffe018b..b58049a17 100644 --- a/application/controllers/ServiceController.php +++ b/application/controllers/ServiceController.php @@ -884,6 +884,9 @@ public function rdfauthorinitAction() if ($workingMode == 'class') { if ($eventResult) { $properties = $event->properties; + if (isset($event->addPropertyValues)) { + $output->addPropertyValues = $event->addPropertyValues; + } } else { $properties = $model->sparqlQuery( 'SELECT DISTINCT ?uri ?value { From ff12beaf95650d9cdd0192b5b70017338d7627b8 Mon Sep 17 00:00:00 2001 From: Norman Radtke Date: Tue, 14 Jan 2014 11:11:23 +0100 Subject: [PATCH 029/482] Add data for "Add Property" button Add a data output that will be json encoded and read by RDFauthor to fill "elsewhere in use" section of widget.property.js with properties provided by templates. If no template is found or if extension is not activated an empty output will be generated, so RDFauthor can fallback to default or check if widget was called from button in properties.phtml. --- application/controllers/ServiceController.php | 16 +++++++++++----- 1 file changed, 11 insertions(+), 5 deletions(-) diff --git a/application/controllers/ServiceController.php b/application/controllers/ServiceController.php index b58049a17..cbe201784 100644 --- a/application/controllers/ServiceController.php +++ b/application/controllers/ServiceController.php @@ -881,10 +881,14 @@ public function rdfauthorinitAction() $event->mode = $workingMode; $eventResult = $event->trigger(); + // empty object to hold data + $output = new stdClass(); + $newProperties = new stdClass(); + if ($workingMode == 'class') { if ($eventResult) { $properties = $event->properties; - if (isset($event->addPropertyValues)) { + if ($event->addPropertyValues !== null) { $output->addPropertyValues = $event->addPropertyValues; } } else { @@ -907,6 +911,9 @@ public function rdfauthorinitAction() } elseif ($workingMode == 'edit') { if ($eventResult) { $properties = $event->properties; + if ($event->addPropertyValues !== null) { + $output->addPropertyValues = $event->addPropertyValues; + } } else { $properties = $model->sparqlQuery( 'SELECT ?uri ?value { @@ -922,10 +929,6 @@ public function rdfauthorinitAction() ); } - // empty object to hold data - $output = new stdClass(); - $newProperties = new stdClass(); - $properties = $properties['results']['bindings']; // feed title helper w/ URIs $titleHelper = new OntoWiki_Model_TitleHelper($model); @@ -1030,6 +1033,9 @@ public function rdfauthorinitAction() $uri = EF_RDFS_LABEL; $newProperties->$uri = array($value); $output->$resourceUri = $newProperties; + if (!isset($output->addPropertyValues)) { + $output->addPropertyValues = '{}'; + } } // send the response From 9add6c7e65bcfc8528d4403bb8f9b1a2de07b863 Mon Sep 17 00:00:00 2001 From: Andreas Nareike Date: Thu, 16 Jan 2014 09:00:37 +0100 Subject: [PATCH 030/482] Modify behaviour of the 'Add Property' button The Template extension will optionally provide properties that should be shown be the 'Add Property' button. The RDFauthor has been modified to accept these. This commit is needed to link both Template extension and RDFauthor. --- .../themes/silverblue/scripts/support.js | 41 ++++++++++++++----- 1 file changed, 31 insertions(+), 10 deletions(-) diff --git a/extensions/themes/silverblue/scripts/support.js b/extensions/themes/silverblue/scripts/support.js index e6b3fef1b..9c4a5a228 100644 --- a/extensions/themes/silverblue/scripts/support.js +++ b/extensions/themes/silverblue/scripts/support.js @@ -511,6 +511,7 @@ function createInstanceFromClassURI(type, dataCallback) { autoParse: false, showPropertyButton: true, loadOwStylesheet: false, + addPropertyValues: data['addPropertyValues'], onSubmitSuccess: function (responseData) { var newLocation; if (responseData && responseData.changed) { @@ -559,6 +560,7 @@ function editResourceFromURI(resource) { autoParse: false, showPropertyButton: true, loadOwStylesheet: false, + addPropertyValues: data['addPropertyValues'], onSubmitSuccess: function () { // HACK: reload whole page after 500 ms window.setTimeout(function () { @@ -703,16 +705,35 @@ function addProperty() { $('table.rdfa').parent().find('p.messagebox').hide(); var selectorOptions = { - container: $('#' + td1ID), - selectionCallback: function (uri, label) { - var statement = new Statement({ - subject: '<' + RDFAUTHOR_DEFAULT_SUBJECT + '>', - predicate: '<' + uri + '>' - }, { - title: label, - graph: RDFAUTHOR_DEFAULT_GRAPH - }); - + container: $('#' + td1ID), + selectionCallback: function (uri, label, datatype) { + var statement; + + if (datatype != undefined) { + statement = new Statement({ + subject: '<' + RDFAUTHOR_DEFAULT_SUBJECT + '>', + predicate: '<' + uri + '>', + object: { + value: '', + options: { + datatype: "http://www.w3.org/2001/XMLSchema#date" + } + } + }, { + title: label, + graph: RDFAUTHOR_DEFAULT_GRAPH + }); + } + else { + statement = new Statement({ + subject: '<' + RDFAUTHOR_DEFAULT_SUBJECT + '>', + predicate: '<' + uri + '>' + }, { + title: label, + graph: RDFAUTHOR_DEFAULT_GRAPH + }); + } + var owURL = urlBase + 'view?r=' + encodeURIComponent(uri); $('#' + td1ID).closest('td') .attr('colspan', '1') From bc37c591b2de01dcef6e43099acf748babf79636 Mon Sep 17 00:00:00 2001 From: Andreas Nareike Date: Mon, 27 Jan 2014 16:40:12 +0100 Subject: [PATCH 031/482] correct handling of optional addProperties For the template extension we needed the possibility to pass an array of properties that can be added via the add properities button. We modified the rdfauthorinitaction to provide an optional argument. This commit corrects the handling of this optional argument. --- extensions/themes/silverblue/scripts/support.js | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/extensions/themes/silverblue/scripts/support.js b/extensions/themes/silverblue/scripts/support.js index 9c4a5a228..e48858846 100644 --- a/extensions/themes/silverblue/scripts/support.js +++ b/extensions/themes/silverblue/scripts/support.js @@ -499,6 +499,9 @@ function createInstanceFromClassURI(type, dataCallback) { if (typeof dataCallback == 'function') { data = dataCallback(data); } + var addPropertyValues = data['addPropertyValues']; + delete data.addPropertyValues; + // get default resource uri for subjects in added statements (issue 673) // grab first object key for (var subjectUri in data) {break;}; @@ -511,7 +514,7 @@ function createInstanceFromClassURI(type, dataCallback) { autoParse: false, showPropertyButton: true, loadOwStylesheet: false, - addPropertyValues: data['addPropertyValues'], + addPropertyValues: addPropertyValues, onSubmitSuccess: function (responseData) { var newLocation; if (responseData && responseData.changed) { From 0e0a40e31634690c76fadce894b2702719b1b516 Mon Sep 17 00:00:00 2001 From: Andreas Nareike Date: Mon, 27 Jan 2014 16:50:40 +0100 Subject: [PATCH 032/482] Pass the working mode to the RDFauthor The RDFauthor form builder feature does not delete the complete triple when a literal value is deleted (i.e. set to ''). This might not be favorable when creating new instances. The RDFauthor currently doesn't know from where it was called, so we pass the working mode to the start-function. --- extensions/themes/silverblue/scripts/support.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/extensions/themes/silverblue/scripts/support.js b/extensions/themes/silverblue/scripts/support.js index e48858846..0e6db12bd 100644 --- a/extensions/themes/silverblue/scripts/support.js +++ b/extensions/themes/silverblue/scripts/support.js @@ -529,7 +529,7 @@ function createInstanceFromClassURI(type, dataCallback) { } }); - RDFauthor.start(); + RDFauthor.start(null, 'class'); }) }); } From a7d46999309388bd400da304bfab47b7ce67440f Mon Sep 17 00:00:00 2001 From: Andreas Nareike Date: Wed, 19 Feb 2014 13:53:10 +0100 Subject: [PATCH 033/482] Forward submodules --- libraries/Erfurt | 2 +- libraries/RDFauthor | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/libraries/Erfurt b/libraries/Erfurt index 5f9bcd148..88b09afe0 160000 --- a/libraries/Erfurt +++ b/libraries/Erfurt @@ -1 +1 @@ -Subproject commit 5f9bcd14850440dc989257bbc82cf8dedbe5e5b8 +Subproject commit 88b09afe0dbedf7459944940f49cb14f8a132174 diff --git a/libraries/RDFauthor b/libraries/RDFauthor index be732d653..aa0b103f0 160000 --- a/libraries/RDFauthor +++ b/libraries/RDFauthor @@ -1 +1 @@ -Subproject commit be732d653fb468d848aad8ae0382f37f5014e8da +Subproject commit aa0b103f04659ff3c0970bf54953516d0ddfc6d0 From 3119e3e3336663eb64b3c5bfab03d4b2c5521c15 Mon Sep 17 00:00:00 2001 From: Andreas Nareike Date: Mon, 2 Dec 2013 21:31:25 +0100 Subject: [PATCH 034/482] add option to export result to CSV This will add an option to export a result of a SPARQL query as CSV. Note that this will only work with when the corresponding feature of Erfurt is also checked out. --- extensions/queries/QueriesController.php | 7 ++++++- extensions/queries/templates/sparqloptions.phtml | 7 +++++++ 2 files changed, 13 insertions(+), 1 deletion(-) diff --git a/extensions/queries/QueriesController.php b/extensions/queries/QueriesController.php index 014369984..3acd9d440 100644 --- a/extensions/queries/QueriesController.php +++ b/extensions/queries/QueriesController.php @@ -187,6 +187,7 @@ public function editorAction() $query = $prefixString . PHP_EOL . $query; } } + if ($format == 'list') { $url = new OntoWiki_Url(array('controller' => 'list'), array()); $query = str_replace("\r\n", ' ', $query); @@ -240,7 +241,7 @@ public function editorAction() } //this is for the "output to file option - if (($format == 'json' || $format == 'xml') + if (($format == 'json' || $format == 'xml' || $format == 'csv') && ($this->_request->getParam('result_outputfile') == 'true') ) { $this->_helper->viewRenderer->setNoRender(); @@ -256,6 +257,10 @@ public function editorAction() $contentType = 'application/json'; $filename = 'query-result.json'; break; + case 'csv': + $contentType = 'text/csv'; + $filename = 'query-result.csv'; + break; } $response->setHeader('Content-Type', $contentType, true); diff --git a/extensions/queries/templates/sparqloptions.phtml b/extensions/queries/templates/sparqloptions.phtml index c3d0fe406..2c0002452 100644 --- a/extensions/queries/templates/sparqloptions.phtml +++ b/extensions/queries/templates/sparqloptions.phtml @@ -35,6 +35,13 @@ />
+ placeholder('sparql.result.format') == 'csv'): ?> + + + /> + +
placeholder('sparql.result.file') == 'true'): ?> From d4525fa4e1317db4e9ed24074ba505e8f94cf0d4 Mon Sep 17 00:00:00 2001 From: Andreas Nareike Date: Wed, 19 Feb 2014 14:28:42 +0100 Subject: [PATCH 035/482] Forward submodule RDFauthor --- libraries/RDFauthor | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/libraries/RDFauthor b/libraries/RDFauthor index aa0b103f0..d403f7baf 160000 --- a/libraries/RDFauthor +++ b/libraries/RDFauthor @@ -1 +1 @@ -Subproject commit aa0b103f04659ff3c0970bf54953516d0ddfc6d0 +Subproject commit d403f7baf74b07f9451934bf563c788e6026b300 From b4b0505ee975bafa199ba8143dfc3cee7564965e Mon Sep 17 00:00:00 2001 From: Andreas Nareike Date: Thu, 20 Feb 2014 11:35:47 +0100 Subject: [PATCH 036/482] Forward submodule RDFauthor --- libraries/RDFauthor | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/libraries/RDFauthor b/libraries/RDFauthor index d403f7baf..e72420c14 160000 --- a/libraries/RDFauthor +++ b/libraries/RDFauthor @@ -1 +1 @@ -Subproject commit d403f7baf74b07f9451934bf563c788e6026b300 +Subproject commit e72420c142111fe3516bc1847af66d9dc01b54ea From bac3bdad04517f9f4a6f92389924b9488e6ad796 Mon Sep 17 00:00:00 2001 From: Norman Radtke Date: Mon, 24 Feb 2014 08:07:24 +0100 Subject: [PATCH 037/482] Change of event->trigger() for templates extension Since there was an issue with missing "more" link in propertiesShow if more than 5 objects are found, the event->trigger() method was moved behind call of "onPropertiesActionData" event and predicates array is set as a param. --- .../controllers/ResourceController.php | 28 +++++++++---------- 1 file changed, 13 insertions(+), 15 deletions(-) diff --git a/application/controllers/ResourceController.php b/application/controllers/ResourceController.php index 29e08d0e1..cc7039c0d 100644 --- a/application/controllers/ResourceController.php +++ b/application/controllers/ResourceController.php @@ -91,22 +91,8 @@ public function propertiesAction() } $model = new OntoWiki_Model_Resource($store, $graph, (string)$resource); - - $event = new Erfurt_Event('onPropertiesActionTemplate'); - $event->model = $model; - $event->selectedModel = $this->_owApp->selectedModel; - $event->resource = $resource; - $event->graph = $graph; - $result = $event->trigger(); - - if ($result) { - $predicates = $event->predicates; - $this->view->templateHtml = $event->templateHtml; - } else { - $predicates = $model->getPredicates(); - } - $values = $model->getValues(); + $predicates = $model->getPredicates(); // new trigger onPropertiesActionData to work with data (reorder with plugin) $event = new Erfurt_Event('onPropertiesActionData'); @@ -120,6 +106,18 @@ public function propertiesAction() $values = $event->values; } + $event = new Erfurt_Event('onPropertiesActionTemplate'); + $event->selectedModel = $this->_owApp->selectedModel; + $event->resource = $resource; + $event->graph = $graph; + $event->predicates = $predicates; + $result = $event->trigger(); + + if ($result) { + $predicates = $event->predicates; + $this->view->templateHtml = $event->templateHtml; + } + $titleHelper = new OntoWiki_Model_TitleHelper($graph); // add graphs $graphs = array_keys($predicates); From 00b6ad2a32d423ec22175e085b9b59e474363d10 Mon Sep 17 00:00:00 2001 From: Andreas Nareike Date: Mon, 3 Mar 2014 14:55:03 +0100 Subject: [PATCH 038/482] Add title/heading to list view The navigation module displays a title (e.g. a class name) that is now passed to the list view in order to display a title. This helps to remember, where the displayed list of instances is actually coming from. The legacy method getSelectedClass() from the Model/Instances.php was not used because it fails to provide a name for customized entries in the navigation module. NB: some additional testing and refining is probably needed --- .../OntoWiki/Controller/ActionHelper/List.php | 3 ++- .../Controller/Plugin/ListSetupHelper.php | 2 +- .../classes/OntoWiki/Model/Instances.php | 22 +++++++++++++++++-- .../views/templates/partials/list.phtml | 3 ++- .../templates/partials/list_std_main.phtml | 1 + .../navigation/NavigationController.php | 7 +++--- 6 files changed, 30 insertions(+), 8 deletions(-) diff --git a/application/classes/OntoWiki/Controller/ActionHelper/List.php b/application/classes/OntoWiki/Controller/ActionHelper/List.php index 63fa97519..81c4aa986 100644 --- a/application/classes/OntoWiki/Controller/ActionHelper/List.php +++ b/application/classes/OntoWiki/Controller/ActionHelper/List.php @@ -133,7 +133,8 @@ public function addList( 'listName' => $listName, 'instances' => $list, 'mainTemplate' => $mainTemplate, - 'other' => $other + 'other' => $other, + 'heading' => $list->getTitle() ) ); diff --git a/application/classes/OntoWiki/Controller/Plugin/ListSetupHelper.php b/application/classes/OntoWiki/Controller/Plugin/ListSetupHelper.php index 3ff48f442..84b1a66b5 100644 --- a/application/classes/OntoWiki/Controller/Plugin/ListSetupHelper.php +++ b/application/classes/OntoWiki/Controller/Plugin/ListSetupHelper.php @@ -96,7 +96,7 @@ public function routeShutdown(Zend_Controller_Request_Abstract $request) || isset($request->init) ) { // instantiate model, that selects all resources - $list = new OntoWiki_Model_Instances($store, $ontoWiki->selectedModel, array()); + $list = new OntoWiki_Model_Instances($store, $ontoWiki->selectedModel, array(), $request->title); } else { // use the object from the session if (isset($request->list) && $request->list != $listHelper->getLastListName()) { diff --git a/application/classes/OntoWiki/Model/Instances.php b/application/classes/OntoWiki/Model/Instances.php index 292cd2b54..5080d261b 100644 --- a/application/classes/OntoWiki/Model/Instances.php +++ b/application/classes/OntoWiki/Model/Instances.php @@ -139,10 +139,16 @@ class OntoWiki_Model_Instances extends OntoWiki_Model */ protected $_titleHelper = null; + + /** + * @var string + */ + protected $_title = null; + /** * Constructor */ - public function __construct(Erfurt_Store $store, Erfurt_Rdf_Model $model, $options = array()) + public function __construct(Erfurt_Store $store, Erfurt_Rdf_Model $model, $options = array(), $title = '') { parent::__construct($store, $model); @@ -199,6 +205,8 @@ public function __construct(Erfurt_Store $store, Erfurt_Rdf_Model $model, $optio $this->_valueQuery->addFrom((string)$model); $this->_resourceQuery->addFrom((string)$model); + $this->_title = $title; + $this->invalidate(); } @@ -301,6 +309,16 @@ public function getTitleHelper() return $this->_titleHelper; } + /** + * get title + * + * @return string + */ + public function getTitle() + { + return $this->_title; + } + /** * add ?resourceUri ?p ?o to the resource query * TODO: support objects as resources? optionally? @@ -1194,7 +1212,7 @@ public function getPermalink($listname) } } - return $url; + return $url . "&title=" . urlencode($this->_title); } /** diff --git a/application/views/templates/partials/list.phtml b/application/views/templates/partials/list.phtml index d18b1437d..3c7eb2537 100644 --- a/application/views/templates/partials/list.phtml +++ b/application/views/templates/partials/list.phtml @@ -133,6 +133,7 @@ echo $this->partial('partials/'.$this->mainTemplate.'.phtml', 'propertyInfo' => $propertyInfo, 'other' => $other, 'listName' => $this->listName, - 'start' => $start + 'start' => $start, + 'heading' => $this->heading ) ); diff --git a/application/views/templates/partials/list_std_main.phtml b/application/views/templates/partials/list_std_main.phtml index 3f01f0552..1052802ef 100644 --- a/application/views/templates/partials/list_std_main.phtml +++ b/application/views/templates/partials/list_std_main.phtml @@ -43,6 +43,7 @@ $this->headScript()->prependScript( +

heading; ?>

instances->hasData()): ?> diff --git a/extensions/navigation/NavigationController.php b/extensions/navigation/NavigationController.php index 747a3667c..c3dd1ee22 100644 --- a/extensions/navigation/NavigationController.php +++ b/extensions/navigation/NavigationController.php @@ -404,7 +404,7 @@ protected function _queryNavigationEntries($setup) $entry = array(); $entry['title'] = $this->_getTitle($uri, $mode, $setup); // get resource ling - $entry['link'] = $this->_getListLink($uri, $setup); + $entry['link'] = $this->_getListLink($uri, $setup, $entry['title']); // chech if there's need to look for subresources $checkSubs = false; @@ -910,7 +910,7 @@ protected function _buildSubCheckQuery($uri, $setup) * according to a given URI in the navigation module and a * given navigation setup */ - protected function _getListLink($uri, $setup) + protected function _getListLink($uri, $setup, $title = '') { if (isset($setup->config->directLink) && $setup->config->directLink) { $return = new OntoWiki_Url(array('route' => 'properties'), array('r')); @@ -974,6 +974,7 @@ protected function _getListLink($uri, $setup) //$this->_owApp->logger->info("conf: ".print_r($conf,true)); - return $return . "&instancesconfig=" . urlencode(json_encode($conf)); + return $return . "&instancesconfig=" . urlencode(json_encode($conf)) + . "&title=" . urlencode($title); } } From 9606bc74acd3d8f55e346952b73df2136b3ad9b7 Mon Sep 17 00:00:00 2001 From: Andreas Nareike Date: Wed, 5 Mar 2014 15:06:52 +0100 Subject: [PATCH 039/482] Reverting fix 91fc29 This commit reverts the changes made in commit 91fc29 because there was an unwanted side-effect with multiple label widgets when creating a new instance. The problem which was tackled with that commit (incorrect widgets when using the template extension) should be fixed with a later commit in the template extension. --- extensions/themes/silverblue/scripts/support.js | 16 +++++++++------- 1 file changed, 9 insertions(+), 7 deletions(-) diff --git a/extensions/themes/silverblue/scripts/support.js b/extensions/themes/silverblue/scripts/support.js index 1e0c41a60..c1b7bb9f6 100644 --- a/extensions/themes/silverblue/scripts/support.js +++ b/extensions/themes/silverblue/scripts/support.js @@ -437,13 +437,15 @@ function populateRDFauthor(data, protect, resource, graph, workingmode) { type: String(objSpec.type).replace('typed-', '') } - if (objSpec.type == 'typed-literal') { - newObjectSpec.options = { - datatype: objSpec.datatype - } - } else if (objSpec.lang) { - newObjectSpec.options = { - lang: objSpec.lang + if (objSpec.value) { + if (objSpec.type == 'typed-literal') { + newObjectSpec.options = { + datatype: objSpec.datatype + } + } else if (objSpec.lang) { + newObjectSpec.options = { + lang: objSpec.lang + } } } From ef4d9f4e42ee807a20d6ec00ab900d2a18a00049 Mon Sep 17 00:00:00 2001 From: Norman Radtke Date: Tue, 25 Mar 2014 14:20:56 +0100 Subject: [PATCH 040/482] Add event to sort properties in RDFauthor In ServiceController an event is triggered to sort properties for RDFauthor. Therefore the json output now contains an array of sorted properties that has to be treated in RDFauthor. --- application/controllers/ServiceController.php | 9 +++ .../sortproperties/SortpropertiesPlugin.php | 57 ++++++++++++++++++- extensions/sortproperties/doap.n3 | 3 +- 3 files changed, 67 insertions(+), 2 deletions(-) diff --git a/application/controllers/ServiceController.php b/application/controllers/ServiceController.php index 8e931cd5c..57421a236 100644 --- a/application/controllers/ServiceController.php +++ b/application/controllers/ServiceController.php @@ -1001,6 +1001,15 @@ public function rdfauthorinitAction() $output->$resourceUri = $newProperties; } + // Sort Properties with sortproperties extension + $event = new Erfurt_Event('onSortPropertiesRDFauthorData'); + $event->data = $output; + $result = $event->trigger(); + + if ($result) { + $output = $event->output; + } + // send the response $response->setHeader('Content-Type', 'application/json'); $response->setBody(json_encode($output)); diff --git a/extensions/sortproperties/SortpropertiesPlugin.php b/extensions/sortproperties/SortpropertiesPlugin.php index 65e15d741..3d27cc0e5 100644 --- a/extensions/sortproperties/SortpropertiesPlugin.php +++ b/extensions/sortproperties/SortpropertiesPlugin.php @@ -48,7 +48,6 @@ public function onPropertiesActionData($event) $predicateOrder[] = 0; } } - array_multisort($predicateOrder, SORT_DESC, SORT_STRING, $predicates); $data[$graphUri] = $predicates; @@ -61,4 +60,60 @@ public function onPropertiesActionData($event) return true; } } + + public function onSortPropertiesRDFauthorData($event) + { + if ($this->_privateConfig->sort->property) { + + $store = Erfurt_App::getInstance()->getStore(); + $config = Erfurt_App::getInstance()->getConfig(); + + $data = $event->data; + $data = json_decode(json_encode($data), true); + + + $query = new Erfurt_Sparql_SimpleQuery(); + $query->setProloguePart('SELECT DISTINCT *') + ->setWherePart('WHERE { ?p <' . $this->_privateConfig->sort->property . '> ?o . }'); + + $result = $store->sparqlQuery($query); + + if (!empty($result)) { + + $order = array(); + + foreach ($result as $v) { + $order[$v['p']] = $v['o']; + } + + $predicateOrder = array(); + + foreach($data as $key => $resource) { + foreach($resource as $predicateUri => &$values) { + if (array_key_exists($predicateUri, $order)) { + $predicateOrder[$predicateUri] = (int)$order; + } else { + $predicateOrder[$predicateUri] = 0; + } + } + } + + + $predicates = reset($data); + array_multisort($predicateOrder, SORT_DESC, SORT_STRING, $predicates); + $data[$key] = $predicates; + + // Generate an non associative array for RDFauthor containing + // ordered predicates as values + $ordering = array(); + foreach($predicates as $predicate => $value) { + $ordering[] = $predicate; + } + + $data['propertyOrder'] = $ordering; + $event->output = $data; + return true; + } + } + } } diff --git a/extensions/sortproperties/doap.n3 b/extensions/sortproperties/doap.n3 index 3f670deda..2e80708e7 100644 --- a/extensions/sortproperties/doap.n3 +++ b/extensions/sortproperties/doap.n3 @@ -11,9 +11,10 @@ :sortproperties a doap:Project ; doap:name "sortproperties" ; owconfig:privateNamespace ; - owconfig:enabled "false"^^xsd:boolean ; + owconfig:enabled "true"^^xsd:boolean ; rdfs:label "Sortproperties" ; owconfig:pluginEvent event:onPropertiesActionData ; + owconfig:pluginEvent event:onSortPropertiesRDFauthorData ; owconfig:config [ a owconfig:Config; owconfig:id "sort"; From 3f1c8d3f60566a0a89b34eebefe944e8fa069592 Mon Sep 17 00:00:00 2001 From: Norman Radtke Date: Wed, 26 Mar 2014 08:57:31 +0100 Subject: [PATCH 041/482] Remove multisort and use arsort instead --- .../sortproperties/SortpropertiesPlugin.php | 18 +++++++----------- 1 file changed, 7 insertions(+), 11 deletions(-) diff --git a/extensions/sortproperties/SortpropertiesPlugin.php b/extensions/sortproperties/SortpropertiesPlugin.php index 3d27cc0e5..94a881420 100644 --- a/extensions/sortproperties/SortpropertiesPlugin.php +++ b/extensions/sortproperties/SortpropertiesPlugin.php @@ -69,6 +69,8 @@ public function onSortPropertiesRDFauthorData($event) $config = Erfurt_App::getInstance()->getConfig(); $data = $event->data; + + // cast stdClass to array $data = json_decode(json_encode($data), true); @@ -88,7 +90,7 @@ public function onSortPropertiesRDFauthorData($event) $predicateOrder = array(); - foreach($data as $key => $resource) { + foreach($:data as $key => $resource) { foreach($resource as $predicateUri => &$values) { if (array_key_exists($predicateUri, $order)) { $predicateOrder[$predicateUri] = (int)$order; @@ -99,18 +101,12 @@ public function onSortPropertiesRDFauthorData($event) } + // create non associative array for sorted json output $predicates = reset($data); - array_multisort($predicateOrder, SORT_DESC, SORT_STRING, $predicates); - $data[$key] = $predicates; - - // Generate an non associative array for RDFauthor containing - // ordered predicates as values - $ordering = array(); - foreach($predicates as $predicate => $value) { - $ordering[] = $predicate; - } + arsort($predicateOrder); + $predicateOrder = array_keys($predicateOrder); - $data['propertyOrder'] = $ordering; + $data['propertyOrder'] = $predicateOrder; $event->output = $data; return true; } From 1252ecdae190907bdd50afde42bba4925f2d5adf Mon Sep 17 00:00:00 2001 From: Norman Radtke Date: Wed, 26 Mar 2014 09:09:51 +0100 Subject: [PATCH 042/482] Fix typo --- extensions/sortproperties/SortpropertiesPlugin.php | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/extensions/sortproperties/SortpropertiesPlugin.php b/extensions/sortproperties/SortpropertiesPlugin.php index 94a881420..c23ea2dcb 100644 --- a/extensions/sortproperties/SortpropertiesPlugin.php +++ b/extensions/sortproperties/SortpropertiesPlugin.php @@ -90,7 +90,7 @@ public function onSortPropertiesRDFauthorData($event) $predicateOrder = array(); - foreach($:data as $key => $resource) { + foreach($data as $key => $resource) { foreach($resource as $predicateUri => &$values) { if (array_key_exists($predicateUri, $order)) { $predicateOrder[$predicateUri] = (int)$order; @@ -100,7 +100,6 @@ public function onSortPropertiesRDFauthorData($event) } } - // create non associative array for sorted json output $predicates = reset($data); arsort($predicateOrder); From 5d671db0ad06ffbf0ab94d67907382318a135fe9 Mon Sep 17 00:00:00 2001 From: Norman Radtke Date: Wed, 26 Mar 2014 09:17:33 +0100 Subject: [PATCH 043/482] Add missing array-key --- extensions/sortproperties/SortpropertiesPlugin.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/extensions/sortproperties/SortpropertiesPlugin.php b/extensions/sortproperties/SortpropertiesPlugin.php index c23ea2dcb..e5cbd7270 100644 --- a/extensions/sortproperties/SortpropertiesPlugin.php +++ b/extensions/sortproperties/SortpropertiesPlugin.php @@ -93,7 +93,7 @@ public function onSortPropertiesRDFauthorData($event) foreach($data as $key => $resource) { foreach($resource as $predicateUri => &$values) { if (array_key_exists($predicateUri, $order)) { - $predicateOrder[$predicateUri] = (int)$order; + $predicateOrder[$predicateUri] = (int)$order[$predicateUri]; } else { $predicateOrder[$predicateUri] = 0; } From bc8f3d81b2dd7967a57dbd7133ea4e376a6c2c3d Mon Sep 17 00:00:00 2001 From: Andreas Nareike Date: Wed, 26 Mar 2014 09:21:56 +0100 Subject: [PATCH 044/482] Pass propertyOrder to RDFauthor Note: Passing options to RDFauthor will be refactored in one of the next commits. Instead of passing each variable separately, an options object will be constructed. --- extensions/themes/silverblue/scripts/support.js | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/extensions/themes/silverblue/scripts/support.js b/extensions/themes/silverblue/scripts/support.js index ed8c89598..bc1e5df8c 100644 --- a/extensions/themes/silverblue/scripts/support.js +++ b/extensions/themes/silverblue/scripts/support.js @@ -496,6 +496,10 @@ function createInstanceFromClassURI(type, dataCallback) { mode: 'class', uri: type }, function(data) { + if (data.hasOwnProperty('propertyOrder')) { + propertyOrder = data.propertyOrder; + delete data.propertyOrder; + } // pass data through callback if (typeof dataCallback == 'function') { data = dataCallback(data); @@ -504,7 +508,7 @@ function createInstanceFromClassURI(type, dataCallback) { // grab first object key for (var subjectUri in data) {break;}; // add statements to RDFauthor - populateRDFauthor(data, true, subjectUri, selectedGraph.URI, 'class'); + populateRDFauthor(data, true, subjectUri, selectedGraph.URI, 'class', propertyOrder); RDFauthor.setOptions({ saveButtonTitle: 'Create Resource', cancelButtonTitle: 'Cancel', @@ -532,7 +536,7 @@ function createInstanceFromClassURI(type, dataCallback) { } }); - RDFauthor.start(); + RDFauthor.start(null, null, propertyOrder); }) }); } From 17664cc1b1adfe0f662cd378d1666b6b96c247bd Mon Sep 17 00:00:00 2001 From: Andreas Nareike Date: Wed, 26 Mar 2014 11:12:28 +0100 Subject: [PATCH 045/482] Fix bug when sorting extension is disabled --- extensions/themes/silverblue/scripts/support.js | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/extensions/themes/silverblue/scripts/support.js b/extensions/themes/silverblue/scripts/support.js index bc1e5df8c..f73560c48 100644 --- a/extensions/themes/silverblue/scripts/support.js +++ b/extensions/themes/silverblue/scripts/support.js @@ -497,9 +497,12 @@ function createInstanceFromClassURI(type, dataCallback) { uri: type }, function(data) { if (data.hasOwnProperty('propertyOrder')) { - propertyOrder = data.propertyOrder; + var propertyOrder = data.propertyOrder; delete data.propertyOrder; } + else { + var propertyOrder = null; + } // pass data through callback if (typeof dataCallback == 'function') { data = dataCallback(data); From 9e67477a3f836a87ea3c7f444811fb52a8b46062 Mon Sep 17 00:00:00 2001 From: Andreas Nareike Date: Wed, 26 Mar 2014 11:38:21 +0100 Subject: [PATCH 046/482] Refactor options for RDFauthor into an object Here and in the formbuilder feature branches we pass additional options to the RDFauthor. Since it is cumbersome to identify arguments by position, we create an object to hold the different options. --- extensions/themes/silverblue/scripts/support.js | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/extensions/themes/silverblue/scripts/support.js b/extensions/themes/silverblue/scripts/support.js index f73560c48..0347e70d1 100644 --- a/extensions/themes/silverblue/scripts/support.js +++ b/extensions/themes/silverblue/scripts/support.js @@ -539,7 +539,11 @@ function createInstanceFromClassURI(type, dataCallback) { } }); - RDFauthor.start(null, null, propertyOrder); + var options = {}; + if (propertyOrder != null) { + options.propertyOrder = propertyOrder; + } + RDFauthor.start(null, options); }) }); } From 4bbe12b205691d66534aa91d728bf018f6002461 Mon Sep 17 00:00:00 2001 From: Andreas Nareike Date: Wed, 26 Mar 2014 14:04:11 +0100 Subject: [PATCH 047/482] Remove superfluous parameter --- extensions/themes/silverblue/scripts/support.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/extensions/themes/silverblue/scripts/support.js b/extensions/themes/silverblue/scripts/support.js index 0347e70d1..9f0a03957 100644 --- a/extensions/themes/silverblue/scripts/support.js +++ b/extensions/themes/silverblue/scripts/support.js @@ -511,7 +511,7 @@ function createInstanceFromClassURI(type, dataCallback) { // grab first object key for (var subjectUri in data) {break;}; // add statements to RDFauthor - populateRDFauthor(data, true, subjectUri, selectedGraph.URI, 'class', propertyOrder); + populateRDFauthor(data, true, subjectUri, selectedGraph.URI, 'class'); RDFauthor.setOptions({ saveButtonTitle: 'Create Resource', cancelButtonTitle: 'Cancel', From 39f0cb062c5fe4016390e7510988b3614ec1db6f Mon Sep 17 00:00:00 2001 From: Norman Radtke Date: Wed, 26 Mar 2014 14:26:27 +0100 Subject: [PATCH 048/482] Insert sort_flags SORT_NUMERIC in both events --- extensions/sortproperties/SortpropertiesPlugin.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/extensions/sortproperties/SortpropertiesPlugin.php b/extensions/sortproperties/SortpropertiesPlugin.php index e5cbd7270..680e612c3 100644 --- a/extensions/sortproperties/SortpropertiesPlugin.php +++ b/extensions/sortproperties/SortpropertiesPlugin.php @@ -48,7 +48,7 @@ public function onPropertiesActionData($event) $predicateOrder[] = 0; } } - array_multisort($predicateOrder, SORT_DESC, SORT_STRING, $predicates); + array_multisort($predicateOrder, SORT_DESC, SORT_NUMERIC, $predicates); $data[$graphUri] = $predicates; } @@ -102,7 +102,7 @@ public function onSortPropertiesRDFauthorData($event) // create non associative array for sorted json output $predicates = reset($data); - arsort($predicateOrder); + arsort($predicateOrder, SORT_NUMERIC); $predicateOrder = array_keys($predicateOrder); $data['propertyOrder'] = $predicateOrder; From 2135fc36f63b4139f4110696b9a167bb6b28338a Mon Sep 17 00:00:00 2001 From: Andreas Nareike Date: Wed, 26 Mar 2014 15:04:02 +0100 Subject: [PATCH 049/482] Pass optional property order also to edit mode The optional property order is now also passed to the popover window when editing a resource (via context/hover menu -> "Edit Resource") --- extensions/themes/silverblue/scripts/support.js | 14 ++++++++++++-- 1 file changed, 12 insertions(+), 2 deletions(-) diff --git a/extensions/themes/silverblue/scripts/support.js b/extensions/themes/silverblue/scripts/support.js index 9f0a03957..a444dc8b8 100644 --- a/extensions/themes/silverblue/scripts/support.js +++ b/extensions/themes/silverblue/scripts/support.js @@ -562,7 +562,13 @@ function editResourceFromURI(resource) { mode: 'edit', uri: resource }, function(data) { - + if (data.hasOwnProperty('propertyOrder')) { + var propertyOrder = data.propertyOrder; + delete data.propertyOrder; + } + else { + var propertyOrder = null; + } // get default resource uri for subjects in added statements (issue 673) // grab first object key for (var subjectUri in data) {break;}; @@ -591,7 +597,11 @@ function editResourceFromURI(resource) { } }); - RDFauthor.start(); + var options = {}; + if (propertyOrder != null) { + options.propertyOrder = propertyOrder; + } + RDFauthor.start(null, options); }) }); } From 95571d58e0e05709220cdcd60eca60f8751c77c8 Mon Sep 17 00:00:00 2001 From: Andreas Nareike Date: Tue, 8 Apr 2014 10:29:14 +0200 Subject: [PATCH 050/482] Inject an i18n variable 'RDFAUTHOR_LANGUAGE' The variable 'RDFAUTHOR_LANGUAGE' holds a string with the set language ('en', 'de', etc...) This tag will be used by the RDFauthor to provide an i18n. --- application/classes/OntoWiki/Controller/Base.php | 1 + 1 file changed, 1 insertion(+) diff --git a/application/classes/OntoWiki/Controller/Base.php b/application/classes/OntoWiki/Controller/Base.php index 6602ab341..93cf698c7 100644 --- a/application/classes/OntoWiki/Controller/Base.php +++ b/application/classes/OntoWiki/Controller/Base.php @@ -126,6 +126,7 @@ public function init() var themeUrlBase = "' . $this->_config->themeUrlBase . '"; var _OWSESSION = "' . _OWSESSION . '"; var RDFAUTHOR_BASE = "' . $this->_config->staticUrlBase . 'libraries/RDFauthor/"; + var RDFAUTHOR_LANGUAGE = "' . $this->_config->languages->locale . '"; var RDFAUTHOR_VIEW_MODE = "' . $viewMode . '";' . PHP_EOL; if (defined('_OWDEBUG')) { From 5a758beb8b96ff903ddcb1fe9d7f68cf7729e6e0 Mon Sep 17 00:00:00 2001 From: Andreas Nareike Date: Tue, 8 Apr 2014 17:30:28 +0200 Subject: [PATCH 051/482] Add i18n for RDFauthor popover controller This commit works together with the i18n commits of the RDFauthor formbuilder branch. Translation works without this commit but in order to translate string with parameters (e.g. the title), some changes have to be made in the support.js as well. --- extensions/themes/silverblue/scripts/support.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/extensions/themes/silverblue/scripts/support.js b/extensions/themes/silverblue/scripts/support.js index c1b7bb9f6..fd1ba863c 100644 --- a/extensions/themes/silverblue/scripts/support.js +++ b/extensions/themes/silverblue/scripts/support.js @@ -512,7 +512,7 @@ function createInstanceFromClassURI(type, dataCallback) { RDFauthor.setOptions({ saveButtonTitle: 'Create Resource', cancelButtonTitle: 'Cancel', - title: 'Create New Instance of ' + type, + title: ['createNewInstanceOf', type], autoParse: false, showPropertyButton: true, loadOwStylesheet: false, @@ -561,7 +561,7 @@ function editResourceFromURI(resource) { RDFauthor.setOptions({ saveButtonTitle: 'Save Changes', cancelButtonTitle: 'Cancel', - title: 'Edit Resource ' + resource, + title: ['editResource', resource], autoParse: false, showPropertyButton: true, loadOwStylesheet: false, From 6659e9a4f03ada82e837139fd1d17ab329691379 Mon Sep 17 00:00:00 2001 From: Andreas Nareike Date: Thu, 24 Apr 2014 16:40:08 +0200 Subject: [PATCH 052/482] Add styles and options for comments A comment will be placed under the heading, this commit provides the css and the options in the default.ini --- application/config/default.ini | 10 ++++++++++ extensions/themes/silverblue/styles/default.css | 6 ++++++ 2 files changed, 16 insertions(+) diff --git a/application/config/default.ini b/application/config/default.ini index 7518fcd57..5654f1bae 100644 --- a/application/config/default.ini +++ b/application/config/default.ini @@ -78,6 +78,16 @@ titleHelper.searchMode = "language" ;; titleHelper.useLocalNames = true +;; +; These properties are the ones what will be queried to display a comment +; for the selected class (if available) +;; +lists.showHeading = "true" +lists.showCommentsForHeading = "true" +lists.headingComment[] = "http://www.w3.org/2000/01/rdf-schema#comment" +lists.headingComment[] = "http://rdfs.org/sioc/ns#content" +lists.headingComment[] = "http://www.w3.org/2004/02/skos/core#comment" +lists.headingComment[] = "http://rdfs.org/sioc/ns#about" ;; ; Model Info description properties (maybe later a description helper?) diff --git a/extensions/themes/silverblue/styles/default.css b/extensions/themes/silverblue/styles/default.css index aff3f467b..b0851d467 100644 --- a/extensions/themes/silverblue/styles/default.css +++ b/extensions/themes/silverblue/styles/default.css @@ -2160,6 +2160,12 @@ a.open:hover { background-position: 0 0.4em; } +.listComment { + font-size: 0.85em; + font-style: italic; + margin-bottom: 1em; +} + .hidden { display: none; } From 777ffa872f5b9eaaa5846cbcc9c29b47691a94d3 Mon Sep 17 00:00:00 2001 From: Andreas Nareike Date: Thu, 24 Apr 2014 16:41:40 +0200 Subject: [PATCH 053/482] Use option from default.ini The heading will only be displayed if the option is set in the default.ini (on default, this will be set to false) --- .../classes/OntoWiki/Controller/ActionHelper/List.php | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/application/classes/OntoWiki/Controller/ActionHelper/List.php b/application/classes/OntoWiki/Controller/ActionHelper/List.php index 81c4aa986..44717d544 100644 --- a/application/classes/OntoWiki/Controller/ActionHelper/List.php +++ b/application/classes/OntoWiki/Controller/ActionHelper/List.php @@ -127,6 +127,12 @@ public function addList( $other = new stdClass(); } + $config = $this->_owApp->config; + $listHeading = ''; + if (($config->lists) && $config->lists->showHeading === "true") { + $listHeading = $list->getTitle(); + } + $renderedList = $view->partial( 'partials/list.phtml', array( @@ -134,7 +140,7 @@ public function addList( 'instances' => $list, 'mainTemplate' => $mainTemplate, 'other' => $other, - 'heading' => $list->getTitle() + 'heading' => $listHeading ) ); From e63c841c4df976eef40fe152863652abb0696d19 Mon Sep 17 00:00:00 2001 From: Andreas Nareike Date: Thu, 24 Apr 2014 16:43:46 +0200 Subject: [PATCH 054/482] Add function to retrieve a comment Note: Use of the option in the default.ini whether to display the comment will be implemented in a later commit. --- .../classes/OntoWiki/Model/Instances.php | 44 +++++++++++++++++++ 1 file changed, 44 insertions(+) diff --git a/application/classes/OntoWiki/Model/Instances.php b/application/classes/OntoWiki/Model/Instances.php index 5080d261b..e68f6351a 100644 --- a/application/classes/OntoWiki/Model/Instances.php +++ b/application/classes/OntoWiki/Model/Instances.php @@ -1917,4 +1917,48 @@ public static function getSelectedClass() return -1; } + + public function getClassComment() + { + $classUri = $this->getSelectedClass(); + if ($classUri == -1) { + return false; + } + else { + $owApp = OntoWiki::getInstance(); + $lang = $owApp->config->languages->locale; + if(!isset($owApp->config->lists)) { + $commentPredicates = array('http://www.w3.org/2000/01/rdf-schema#comment'); + } + else { + $commentPredicates = $owApp->config->lists->headingComment->toArray(); + } + + $property_queries = array(); + foreach ($commentPredicates as $property) { + $property_queries[] = ' { <' . $classUri . '> <' . $property . '> ?comment . }'; + } + + $query = 'PREFIX rdfs: ' . PHP_EOL; + $query.= 'SELECT DISTINCT ?comment WHERE {' . PHP_EOL; + $query.= join(PHP_EOL . ' UNION' . PHP_EOL, $property_queries) . PHP_EOL; + $query.= 'FILTER (langMatches(lang(?comment), \'' . $lang . '\'))' . PHP_EOL; + $query.= '}'; + + $result = $this->_store->sparqlQuery($query); + + if (count($result) > 0) { + $resultstrings = array(); + foreach ($result as $res) { + $resultstrings[] = $res['comment']; + } + return join(PHP_EOL, $resultstrings); + } + else { + return false; + } + } + } + + } From 2d79568edf00d93cc84f5625dfb9635b48577dd8 Mon Sep 17 00:00:00 2001 From: Andreas Nareike Date: Thu, 24 Apr 2014 16:45:25 +0200 Subject: [PATCH 055/482] Rework phtml for list to display headings --- .../views/templates/partials/list_std_main.phtml | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-) diff --git a/application/views/templates/partials/list_std_main.phtml b/application/views/templates/partials/list_std_main.phtml index 1052802ef..cfe591470 100644 --- a/application/views/templates/partials/list_std_main.phtml +++ b/application/views/templates/partials/list_std_main.phtml @@ -43,7 +43,19 @@ $this->headScript()->prependScript( -

heading; ?>

+ +heading != '')): ?> +

heading; ?>

+ instances->getSelectedClass() != -1): ?> + instances->getClassComment(); + if ($comment !== false): + ?> +
instances->getClassComment(); ?>
+ + + + instances->hasData()): ?> From 02c26e5e4507c828d6bc43d16a51b51bb32c2a4d Mon Sep 17 00:00:00 2001 From: Andreas Nareike Date: Fri, 25 Apr 2014 10:57:09 +0200 Subject: [PATCH 056/482] Make comment optial (via ini) The key "showCommentsForHeading" can be used to show/hide comments. Additionally, it's possible to hide a comment by clicking on the heading. It might be desirable to only display comments when clicking on the heading and have them hidden by default. This can easily be achieved by setting "display: none" to the #listComment id in the default.css (see line 2163). Would be nice: Use a button that changes depending on the state (hidden or not) and implement a "commentHiddenByDefault" for the default.ini Even nicer: Save the state of the comment (hidden or not) across reloads. --- .../classes/OntoWiki/Model/Instances.php | 11 ++++++----- .../templates/partials/list_std_main.phtml | 17 +++++++++-------- extensions/themes/silverblue/styles/default.css | 2 +- 3 files changed, 16 insertions(+), 14 deletions(-) diff --git a/application/classes/OntoWiki/Model/Instances.php b/application/classes/OntoWiki/Model/Instances.php index e68f6351a..adbcda17c 100644 --- a/application/classes/OntoWiki/Model/Instances.php +++ b/application/classes/OntoWiki/Model/Instances.php @@ -1927,8 +1927,10 @@ public function getClassComment() else { $owApp = OntoWiki::getInstance(); $lang = $owApp->config->languages->locale; - if(!isset($owApp->config->lists)) { - $commentPredicates = array('http://www.w3.org/2000/01/rdf-schema#comment'); + if(!isset($owApp->config->lists) + || !isset($owApp->config->lists->showCommentsForHeading) + || ($owApp->config->lists->showCommentsForHeading === "false")) { + return false; } else { $commentPredicates = $owApp->config->lists->headingComment->toArray(); @@ -1939,8 +1941,7 @@ public function getClassComment() $property_queries[] = ' { <' . $classUri . '> <' . $property . '> ?comment . }'; } - $query = 'PREFIX rdfs: ' . PHP_EOL; - $query.= 'SELECT DISTINCT ?comment WHERE {' . PHP_EOL; + $query = 'SELECT DISTINCT ?comment WHERE {' . PHP_EOL; $query.= join(PHP_EOL . ' UNION' . PHP_EOL, $property_queries) . PHP_EOL; $query.= 'FILTER (langMatches(lang(?comment), \'' . $lang . '\'))' . PHP_EOL; $query.= '}'; @@ -1952,7 +1953,7 @@ public function getClassComment() foreach ($result as $res) { $resultstrings[] = $res['comment']; } - return join(PHP_EOL, $resultstrings); + return join('
', $resultstrings); } else { return false; diff --git a/application/views/templates/partials/list_std_main.phtml b/application/views/templates/partials/list_std_main.phtml index cfe591470..08fd632cd 100644 --- a/application/views/templates/partials/list_std_main.phtml +++ b/application/views/templates/partials/list_std_main.phtml @@ -45,14 +45,15 @@ $this->headScript()->prependScript( heading != '')): ?> -

heading; ?>

- instances->getSelectedClass() != -1): ?> - instances->getClassComment(); - if ($comment !== false): - ?> -
instances->getClassComment(); ?>
- +

heading; ?>

+ instances->getClassComment(); + if ($comment !== false): ?> + + +
diff --git a/extensions/themes/silverblue/styles/default.css b/extensions/themes/silverblue/styles/default.css index b0851d467..f8abb6734 100644 --- a/extensions/themes/silverblue/styles/default.css +++ b/extensions/themes/silverblue/styles/default.css @@ -2160,7 +2160,7 @@ a.open:hover { background-position: 0 0.4em; } -.listComment { +#listComment { font-size: 0.85em; font-style: italic; margin-bottom: 1em; From 2d1ebc439ef25ef3d891c16a2e6ea96cab2ea669 Mon Sep 17 00:00:00 2001 From: Andreas Nareike Date: Fri, 25 Apr 2014 11:10:25 +0200 Subject: [PATCH 057/482] Disable feature by default The feature has been disabled by default as to not change the OntoWiki behaviour when the branch is merged into develop. --- application/config/default.ini | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/application/config/default.ini b/application/config/default.ini index 5654f1bae..876ba7531 100644 --- a/application/config/default.ini +++ b/application/config/default.ini @@ -82,8 +82,8 @@ titleHelper.useLocalNames = true ; These properties are the ones what will be queried to display a comment ; for the selected class (if available) ;; -lists.showHeading = "true" -lists.showCommentsForHeading = "true" +lists.showHeading = "false" +lists.showCommentsForHeading = "false" lists.headingComment[] = "http://www.w3.org/2000/01/rdf-schema#comment" lists.headingComment[] = "http://rdfs.org/sioc/ns#content" lists.headingComment[] = "http://www.w3.org/2004/02/skos/core#comment" From 578d16f1da6084a549e64699f8e79ca01885d494 Mon Sep 17 00:00:00 2001 From: Norman Radtke Date: Tue, 13 May 2014 10:59:36 +0200 Subject: [PATCH 058/482] Fix a logical error in two if-clauses --- application/controllers/ServiceController.php | 26 +++++++++++-------- 1 file changed, 15 insertions(+), 11 deletions(-) diff --git a/application/controllers/ServiceController.php b/application/controllers/ServiceController.php index cbe201784..afd02aa66 100644 --- a/application/controllers/ServiceController.php +++ b/application/controllers/ServiceController.php @@ -885,12 +885,22 @@ public function rdfauthorinitAction() $output = new stdClass(); $newProperties = new stdClass(); + //Write rdfAuthor-output to handle 'Add Property'-widget + if ($event->addPropertyValues !== null) { + $output->addPropertyValues = $event->addPropertyValues; + } else { + $output->addPropertyValues = '{}'; + } + + if ($event->addOptionalPropertyValues !== null) { + $output->addOptionalPropertyValues = $event->addOptionalPropertyValues; + } else { + $output->addOptionalPropertyValues = '{}'; + } + if ($workingMode == 'class') { if ($eventResult) { $properties = $event->properties; - if ($event->addPropertyValues !== null) { - $output->addPropertyValues = $event->addPropertyValues; - } } else { $properties = $model->sparqlQuery( 'SELECT DISTINCT ?uri ?value { @@ -911,9 +921,6 @@ public function rdfauthorinitAction() } elseif ($workingMode == 'edit') { if ($eventResult) { $properties = $event->properties; - if ($event->addPropertyValues !== null) { - $output->addPropertyValues = $event->addPropertyValues; - } } else { $properties = $model->sparqlQuery( 'SELECT ?uri ?value { @@ -942,13 +949,13 @@ public function rdfauthorinitAction() the value will not be set right now (but should probably be provided in future */ - if (isset($property['value']) && $property['value']['value'] !== '') { + if (isset($property['value']) && isset($property['value']['value'])) { $currentValue = $property['value']['value']; } else { $currentValue = ''; } - if (isset($property['value']) && $property['value']['type'] !== '') { + if (isset($property['value']) && isset($property['value']['type'])) { $currentType = $property['value']['type']; } else { $currentType = ''; @@ -1033,9 +1040,6 @@ public function rdfauthorinitAction() $uri = EF_RDFS_LABEL; $newProperties->$uri = array($value); $output->$resourceUri = $newProperties; - if (!isset($output->addPropertyValues)) { - $output->addPropertyValues = '{}'; - } } // send the response From e37585377022c8e2eb5089220b807b2ec8009ca3 Mon Sep 17 00:00:00 2001 From: Andreas Nareike Date: Wed, 14 May 2014 15:31:33 +0200 Subject: [PATCH 059/482] Add optional properties to RDFauthor Add the possiblity to add optional properties to the popover mode of RDFauthor. These properties will be added to a 'template' section in the 'Add Property' dialog. --- extensions/themes/silverblue/scripts/support.js | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/extensions/themes/silverblue/scripts/support.js b/extensions/themes/silverblue/scripts/support.js index fd1ba863c..13f8f33a6 100644 --- a/extensions/themes/silverblue/scripts/support.js +++ b/extensions/themes/silverblue/scripts/support.js @@ -502,7 +502,9 @@ function createInstanceFromClassURI(type, dataCallback) { data = dataCallback(data); } var addPropertyValues = data['addPropertyValues']; + var addOptionalPropertyValues = data['addOptionalPropertyValues']; delete data.addPropertyValues; + delete data.addOptionalPropertyValues; // get default resource uri for subjects in added statements (issue 673) // grab first object key @@ -517,6 +519,7 @@ function createInstanceFromClassURI(type, dataCallback) { showPropertyButton: true, loadOwStylesheet: false, addPropertyValues: addPropertyValues, + addOptionalPropertyValues: addOptionalPropertyValues, onSubmitSuccess: function (responseData) { var newLocation; if (responseData && responseData.changed) { @@ -550,6 +553,10 @@ function editResourceFromURI(resource) { mode: 'edit', uri: resource }, function(data) { + var addPropertyValues = data['addPropertyValues']; + var addOptionalPropertyValues = data['addOptionalPropertyValues']; + delete data.addPropertyValues; + delete data.addOptionalPropertyValues; // get default resource uri for subjects in added statements (issue 673) // grab first object key @@ -565,7 +572,8 @@ function editResourceFromURI(resource) { autoParse: false, showPropertyButton: true, loadOwStylesheet: false, - addPropertyValues: data['addPropertyValues'], + addPropertyValues: addPropertyValues, + addOptionalPropertyValues: addOptionalPropertyValues, onSubmitSuccess: function () { // HACK: reload whole page after 500 ms window.setTimeout(function () { From 82081cd7718ce76cffdc2c03325cb7f8517f96f1 Mon Sep 17 00:00:00 2001 From: Andreas Nareike Date: Tue, 27 May 2014 14:48:48 +0200 Subject: [PATCH 060/482] Disable (most) reloads for RDFauthor --- extensions/themes/silverblue/scripts/main.js | 8 +++++++- extensions/themes/silverblue/scripts/support.js | 4 ++++ 2 files changed, 11 insertions(+), 1 deletion(-) diff --git a/extensions/themes/silverblue/scripts/main.js b/extensions/themes/silverblue/scripts/main.js index c3edd3541..5dccb8c91 100644 --- a/extensions/themes/silverblue/scripts/main.js +++ b/extensions/themes/silverblue/scripts/main.js @@ -395,9 +395,11 @@ $(document).ready(function() { $('.edit-enable').removeClass('active'); // HACK: reload whole page after 1000 ms + /* window.setTimeout(function () { window.location.href = window.location.href; }, 500); + */ }, onCancel: function () { $('.edit').each(function() { @@ -470,9 +472,11 @@ $(document).ready(function() { newLocation = window.location.href; } // HACK: reload whole page after 500 ms + /* window.setTimeout(function () { window.location.href = newLocation; }, 500); + */ } }); @@ -498,11 +502,13 @@ $(document).ready(function() { $(this).fadeOut(effectTime); }); $('.edit-enable').removeClass('active'); - + // HACK: reload whole page after 1000 ms + /* window.setTimeout(function () { window.location.href = window.location.href; }, 500); + */ }, onCancel: function () { $('.edit').each(function() { diff --git a/extensions/themes/silverblue/scripts/support.js b/extensions/themes/silverblue/scripts/support.js index 13f8f33a6..50dde11f8 100644 --- a/extensions/themes/silverblue/scripts/support.js +++ b/extensions/themes/silverblue/scripts/support.js @@ -576,9 +576,11 @@ function editResourceFromURI(resource) { addOptionalPropertyValues: addOptionalPropertyValues, onSubmitSuccess: function () { // HACK: reload whole page after 500 ms + /* window.setTimeout(function () { window.location.href = window.location.href; }, 500); + */ } }); @@ -690,9 +692,11 @@ function editPropertyListmode(event) { loadOwStylesheet: false, onSubmitSuccess: function () { // HACK: reload whole page after 500 ms + /* window.setTimeout(function () { window.location.href = window.location.href; }, 500); + */ } }); From 2d6848a6d5871530cc331938bd48fa5ff86895c3 Mon Sep 17 00:00:00 2001 From: Andreas Nareike Date: Fri, 18 Jul 2014 14:33:50 +0200 Subject: [PATCH 061/482] Add missing check for keys of data array The data object that is delivered by the ServiceController via the rdfauthorinit action contains usually only resource URIs as key. For the formbuilder branch, this array may contain additional keys that are not URIs but identifier for additional options. This commit filters out these special cases. --- extensions/sortproperties/SortpropertiesPlugin.php | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/extensions/sortproperties/SortpropertiesPlugin.php b/extensions/sortproperties/SortpropertiesPlugin.php index 680e612c3..e8d6466fd 100644 --- a/extensions/sortproperties/SortpropertiesPlugin.php +++ b/extensions/sortproperties/SortpropertiesPlugin.php @@ -91,11 +91,13 @@ public function onSortPropertiesRDFauthorData($event) $predicateOrder = array(); foreach($data as $key => $resource) { - foreach($resource as $predicateUri => &$values) { - if (array_key_exists($predicateUri, $order)) { - $predicateOrder[$predicateUri] = (int)$order[$predicateUri]; - } else { - $predicateOrder[$predicateUri] = 0; + if (Erfurt_Uri::check($key)) { + foreach($resource as $predicateUri => &$values) { + if (array_key_exists($predicateUri, $order)) { + $predicateOrder[$predicateUri] = (int)$order[$predicateUri]; + } else { + $predicateOrder[$predicateUri] = 0; + } } } } From 6ae77825b9401157edb0362a53e0da33279a1431 Mon Sep 17 00:00:00 2001 From: Sebastian Nuck Date: Wed, 23 Jul 2014 15:08:11 +0200 Subject: [PATCH 062/482] add index hook on update resource --- application/controllers/ServiceController.php | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/application/controllers/ServiceController.php b/application/controllers/ServiceController.php index 8e931cd5c..bda04096d 100644 --- a/application/controllers/ServiceController.php +++ b/application/controllers/ServiceController.php @@ -554,6 +554,14 @@ public function updateAction() $event->insertData = $insert; $event->trigger(); + /** + * Trigger Index + **/ + $indexEvent = new Erfurt_Event('onIndexAction'); + $indexEvent->resource = !null == key($delete) ? key($delete) : key($insert); + $indexEvent->model = $deleteModel->getModelUri(); + $indexEvent->trigger(); + // writeback $delete = $event->deleteData; $insert = $event->insertData; From ecce8201b4989fc594cb04c12f003b9a7f204e49 Mon Sep 17 00:00:00 2001 From: Sebastian Nuck Date: Thu, 7 Aug 2014 10:38:50 +0200 Subject: [PATCH 063/482] change event trigger order --- application/controllers/ServiceController.php | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/application/controllers/ServiceController.php b/application/controllers/ServiceController.php index bda04096d..ab09212e8 100644 --- a/application/controllers/ServiceController.php +++ b/application/controllers/ServiceController.php @@ -554,14 +554,6 @@ public function updateAction() $event->insertData = $insert; $event->trigger(); - /** - * Trigger Index - **/ - $indexEvent = new Erfurt_Event('onIndexAction'); - $indexEvent->resource = !null == key($delete) ? key($delete) : key($insert); - $indexEvent->model = $deleteModel->getModelUri(); - $indexEvent->trigger(); - // writeback $delete = $event->deleteData; $insert = $event->insertData; @@ -615,6 +607,14 @@ public function updateAction() } } + /** + * Trigger Index + **/ + $indexEvent = new Erfurt_Event('onIndexAction'); + $indexEvent->resource = !null == key($delete) ? key($delete) : key($insert); + $indexEvent->model = $deleteModel->getModelUri(); + $indexEvent->trigger(); + if ($changes) { /** * @see {http://www.w3.org/Protocols/rfc2616/rfc2616-sec10.html#sec10.2.2} From ee96b30a4dceea5a6db023a2bfe5109ba1135949 Mon Sep 17 00:00:00 2001 From: Sebastian Nuck Date: Thu, 7 Aug 2014 11:42:57 +0200 Subject: [PATCH 064/482] add trigger for deleting resources from index --- application/controllers/ResourceController.php | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/application/controllers/ResourceController.php b/application/controllers/ResourceController.php index 89455a407..18982bb0c 100644 --- a/application/controllers/ResourceController.php +++ b/application/controllers/ResourceController.php @@ -412,6 +412,14 @@ public function deleteAction() $event->modelUri = $modelIri; $event->trigger(); + /** + * Trigger Index + **/ + $indexEvent = new Erfurt_Event('onDeleteResourceAction'); + $indexEvent->resources = $resources; + $indexEvent->model = $modelIri; + $indexEvent->trigger(); + $this->_redirect($redirect, array('code' => 302)); } From 5d8ca945903a399055f7a69b0afeab5cd03306f0 Mon Sep 17 00:00:00 2001 From: Sebastian Nuck Date: Mon, 11 Aug 2014 11:20:55 +0200 Subject: [PATCH 065/482] add menu button for index configuration --- application/classes/OntoWiki/Menu/Registry.php | 1 + 1 file changed, 1 insertion(+) diff --git a/application/classes/OntoWiki/Menu/Registry.php b/application/classes/OntoWiki/Menu/Registry.php index 250078b8e..c5870709d 100644 --- a/application/classes/OntoWiki/Menu/Registry.php +++ b/application/classes/OntoWiki/Menu/Registry.php @@ -151,6 +151,7 @@ private function _getApplicationMenu($context = null) $extrasMenu = new OntoWiki_Menu(); $extrasMenu->setEntry('News', $owApp->config->urlBase . 'index/news'); + $extrasMenu->setEntry('Configure Index', $owApp->config->urlBase . 'fulltextsearch/info'); // help sub menue $helpMenu = new OntoWiki_Menu(); From 0fb07c864efccc12936a71189cb12c8581fd8dc3 Mon Sep 17 00:00:00 2001 From: Sebastian Nuck Date: Mon, 11 Aug 2014 11:27:56 +0200 Subject: [PATCH 066/482] remove menu button for index configuration --- application/classes/OntoWiki/Menu/Registry.php | 1 - 1 file changed, 1 deletion(-) diff --git a/application/classes/OntoWiki/Menu/Registry.php b/application/classes/OntoWiki/Menu/Registry.php index c5870709d..250078b8e 100644 --- a/application/classes/OntoWiki/Menu/Registry.php +++ b/application/classes/OntoWiki/Menu/Registry.php @@ -151,7 +151,6 @@ private function _getApplicationMenu($context = null) $extrasMenu = new OntoWiki_Menu(); $extrasMenu->setEntry('News', $owApp->config->urlBase . 'index/news'); - $extrasMenu->setEntry('Configure Index', $owApp->config->urlBase . 'fulltextsearch/info'); // help sub menue $helpMenu = new OntoWiki_Menu(); From 8d77374d042dc4806459c92f76b149205aeb4ded Mon Sep 17 00:00:00 2001 From: Sebastian Nuck Date: Tue, 2 Sep 2014 11:27:25 +0200 Subject: [PATCH 067/482] Add trigger for reindexing after import --- extensions/basicimporter/BasicimporterController.php | 3 +++ 1 file changed, 3 insertions(+) diff --git a/extensions/basicimporter/BasicimporterController.php b/extensions/basicimporter/BasicimporterController.php index e12dd951d..55df88a9e 100644 --- a/extensions/basicimporter/BasicimporterController.php +++ b/extensions/basicimporter/BasicimporterController.php @@ -198,6 +198,9 @@ private function _import($fileOrUrl, $filetype, $locator) try { $this->_erfurt->getStore()->importRdf($modelIri, $fileOrUrl, $filetype, $locator); + // Trigger Reindex + $indexEvent = new Erfurt_Event('onFullreindexAction'); + $indexEvent->trigger(); } catch (Erfurt_Exception $e) { // re-throw throw new OntoWiki_Controller_Exception( From 044d8657880ed24217937654c998ca6d6bdb8cb7 Mon Sep 17 00:00:00 2001 From: Andreas Nareike Date: Wed, 17 Sep 2014 14:27:38 +0200 Subject: [PATCH 068/482] Reset width year dropdown of calendar widget --- extensions/themes/silverblue/styles/default.css | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/extensions/themes/silverblue/styles/default.css b/extensions/themes/silverblue/styles/default.css index 1b495abaf..d9e97ee30 100644 --- a/extensions/themes/silverblue/styles/default.css +++ b/extensions/themes/silverblue/styles/default.css @@ -1317,6 +1317,11 @@ select { vertical-align: middle; } +/* -- reset width for 'year' dropdown --------------------------------------- */ +select.ui-datepicker-year { + min-width: initial; +} + select.multiselect, select[multiple="multiple"], select.multiple { vertical-align: text-top; max-height: 32em; From b9a082a9b168bffc1ef053e6722680e1548bdfbc Mon Sep 17 00:00:00 2001 From: Andreas Nareike Date: Wed, 17 Sep 2014 15:37:20 +0200 Subject: [PATCH 069/482] This commit fixes the broken 'clone' button --- extensions/themes/silverblue/scripts/main.js | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/extensions/themes/silverblue/scripts/main.js b/extensions/themes/silverblue/scripts/main.js index 1c750dda0..72847299d 100644 --- a/extensions/themes/silverblue/scripts/main.js +++ b/extensions/themes/silverblue/scripts/main.js @@ -446,7 +446,7 @@ $(document).ready(function() { }); } }); - + $('.clone-resource').click(function() { loadRDFauthor(function () { var serviceURI = urlBase + 'service/rdfauthorinit'; @@ -457,6 +457,10 @@ $(document).ready(function() { mode: 'clone', uri: prototypeResource }, function(data) { + var addPropertyValues = data['addPropertyValues']; + var addOptionalPropertyValues = data['addOptionalPropertyValues']; + delete data.addPropertyValues; + delete data.addOptionalPropertyValues; // get default resource uri for subjects in added statements (issue 673) // grab first object key for (var subjectUri in data) {break;}; @@ -470,6 +474,8 @@ $(document).ready(function() { autoParse: false, showPropertyButton: true, loadOwStylesheet: false, + addPropertyValues: addPropertyValues, + addOptionalPropertyValues: addOptionalPropertyValues, onSubmitSuccess: function (responseData) { var newLocation; if (responseData && responseData.changed) { From f777b2f0e7b89707119a6c4cf9e47f0ee163fadd Mon Sep 17 00:00:00 2001 From: Andreas Nareike Date: Fri, 19 Sep 2014 11:22:35 +0200 Subject: [PATCH 070/482] Improve handling of active/inactive RDFauthor --- extensions/themes/silverblue/scripts/main.js | 5 +---- extensions/themes/silverblue/scripts/support.js | 16 +++++++--------- 2 files changed, 8 insertions(+), 13 deletions(-) diff --git a/extensions/themes/silverblue/scripts/main.js b/extensions/themes/silverblue/scripts/main.js index 72847299d..675868cf8 100644 --- a/extensions/themes/silverblue/scripts/main.js +++ b/extensions/themes/silverblue/scripts/main.js @@ -355,7 +355,6 @@ $(document).ready(function() { }); $('.edit.cancel').click(function() { - $(body).data('editingMode', false); // reload page window.location.href = window.location.href; RDFauthor.cancel(); @@ -373,7 +372,6 @@ $(document).ready(function() { // edit mode $('.edit-enable').click(function() { - $(body).data('editingMode', true); var button = this; if ($(button).hasClass('active')) { RDFauthor.cancel(); @@ -499,8 +497,7 @@ $(document).ready(function() { // add property $('.property-add').click(function() { - $(body).data('editingMode', true); - if(typeof(RDFauthor) === 'undefined') { + if(typeof(RDFauthor) === 'undefined' || ((typeof(RDFAUTHOR_STATUS) != 'undefined') && (RDFAUTHOR_STATUS === 'inactive'))) { loadRDFauthor(function () { RDFauthor.setOptions({ onSubmitSuccess: function () { diff --git a/extensions/themes/silverblue/scripts/support.js b/extensions/themes/silverblue/scripts/support.js index 78601d849..555913a4b 100644 --- a/extensions/themes/silverblue/scripts/support.js +++ b/extensions/themes/silverblue/scripts/support.js @@ -482,11 +482,13 @@ function createInstanceFromClassURI(type, dataCallback) { var serviceUri = urlBase + 'service/rdfauthorinit'; // check if an resource is in editing mode - if($(body).data('editingMode')) { - alert("Please finish all other editing actions before creating a new instance."); - return; - //RDFauthor.cancel(); - //RDFauthor.reset(); + if(typeof RDFAUTHOR_STATUS != 'undefined') { + if(RDFAUTHOR_STATUS === 'active') { + alert("Please finish all other editing actions before creating a new instance."); + return; + //RDFauthor.cancel(); + //RDFauthor.reset(); + } } // remove resource menus @@ -622,8 +624,6 @@ function resourceURL(resourceURI) { function editProperty(event) { var element = $.event.fix(event).target; - $(body).data('editingMode', true); - loadRDFauthor(function () { RDFauthor.setOptions({ saveButtonTitle: 'Save Changes', @@ -635,7 +635,6 @@ function editProperty(event) { $(this).fadeOut(effectTime); }); $('.edit-enable').removeClass('active'); - $(body).data('editingMode', false); // HACK: reload whole page after 1000 ms /* @@ -771,7 +770,6 @@ function addProperty() { RDFauthor.getView().addWidget(statement, null, {container: $('#' + td2ID), activate: true}); } }; - var selector = new Selector(RDFAUTHOR_DEFAULT_GRAPH, RDFAUTHOR_DEFAULT_SUBJECT, selectorOptions); selector.presentInContainer(); } From 959d24c1a5d80257aa480026d2fc4b14c8f905d7 Mon Sep 17 00:00:00 2001 From: Sebastian Nuck Date: Thu, 6 Nov 2014 11:24:35 +0100 Subject: [PATCH 071/482] refactor TitleHelper TitleHelper is now based on an abstract class and a DescriptionHelper has been added --- .../classes/OntoWiki/Model/AbstractHelper.php | 245 ++++++++++++++++ .../OntoWiki/Model/DescriptionHelper.php | 112 +++++++ .../classes/OntoWiki/Model/TitleHelper.php | 273 +++--------------- 3 files changed, 395 insertions(+), 235 deletions(-) create mode 100644 application/classes/OntoWiki/Model/AbstractHelper.php create mode 100644 application/classes/OntoWiki/Model/DescriptionHelper.php diff --git a/application/classes/OntoWiki/Model/AbstractHelper.php b/application/classes/OntoWiki/Model/AbstractHelper.php new file mode 100644 index 000000000..205cf3bfb --- /dev/null +++ b/application/classes/OntoWiki/Model/AbstractHelper.php @@ -0,0 +1,245 @@ +_resources[$resourceUri])) { + $this->_resources[$resourceUri] = null; + } + } else { + // throw exeption in debug mode only + if (defined('_OWDEBUG')) { + $logger = OntoWiki::getInstance()->logger; + $logger->info('Supplied resource ' . htmlentities('<' . $resource . '>') . ' is not a valid URI.'); + } + } + return $this; + } + + /** + * Adds a bunch of resources for which to query the requested properties. + * @param array $resources + * @return $this + */ + public function addResources($resources = array(), $variable = null) + { + if (null === $variable) { + foreach ($resources as $resourceUri) { + $this->addResource($resourceUri); + } + } else { + foreach ($resources as $row) { + foreach ((array)$variable as $key) { + if (!empty($row[$key])) { + $object = $row[$key]; + $toBeAdded = null; + if (is_array($object)) { + // probably support extended format + if (isset($object['type']) && ($object['type'] == 'uri')) { + $toBeAdded = $object['value']; + } + } else { + // plain object + $toBeAdded = $object; + } + if ($toBeAdded != null) { + $this->addResource($toBeAdded); + } + } + } + } + } + return $this; + } + + /** + * operate on _resources array and call the method to fetch the requested properties + * if no requested properties found for the respective resource the localname will be extracted + * + * @return void + */ + protected function _receiveRequestetProperties() + { + //first we check if there are resourceUris without the requested property + $toBeReceived = array(); + foreach ($this->_resources as $resourceUri => $resource) { + if ($resource == null) { + $toBeReceived[] = $resourceUri; + } + } + //now we try to receive the requested properties from ResourcePool + $this->_fetchRequestedPropertiesFromResourcePool($toBeReceived); + + // if nothing found fetch fallback properties, if implemented + $this->_fetchFallbackProperties(); + + } + + /** + * Fallback method in case we dont find the requested properties. + */ + abstract protected function _fetchFallbackProperties(); + + /** + * fetches all requested properties according the given array if Uris + * + * @param array resourceUris + */ + protected function _fetchRequestedPropertiesFromResourcePool($resourceUris) + { + $resourcePool = $this->_erfurtApp->getResourcePool(); + if (!empty($this->_model)) { + $modelUri = $this->_model->getModelIri(); + $resources = $resourcePool->getResources($resourceUris, $modelUri); + } else { + $resources = $resourcePool->getResources($resourceUris); + } + + $memoryModel = new Erfurt_Rdf_MemoryModel(); + foreach ($resources as $resourceUri => $resource) { + $resourceDescription = $resource->getDescription(); + $memoryModel->addStatements($resourceDescription); + foreach ($this->_requestedProperties as $requestedProperty) { + $values = $memoryModel->getValues($resourceUri, $requestedProperty); + foreach ($values as $value) { + if (!empty($value['lang'])) { + $language = $value['lang']; + } else { + $language = ''; + } + $this->_resources[$resourceUri][$requestedProperty][$language] = $value['value']; + } + } + } + } + + /** + * Returns the requested property for the resource URI in the requested language. + * + * @param string $resourceUri + * @param string $language The preferred language for the commment + * + * @return string + */ + public function getRequestedProperty($resourceUri, $language = null) + { + if (!Erfurt_Uri::check($resourceUri)) { + return $resourceUri; + } + + // * means any language + if (trim($language) == '*') { + $language = null; + } + + //Have a look if we have an entry for the given resourceUri + if (!array_key_exists($resourceUri, $this->_resources)) { + + if (defined('_OWDEBUG')) { + $logger = OntoWiki::getInstance()->logger; + $logger->info('CommentHelper: getRequestedProperty called for unknown resource. Adding resource before fetch.'); + } + //If we dont have an entry create one + $this->addResource($resourceUri); + } + + // prepend the language that is asked for to the array + // of languages we will look for + $languages = $this->_languages; + if (null !== $language) { + array_unshift($languages, (string)$language); + } + + $languages = array_values(array_unique($languages)); + + //Have a look if we have already a commment for the given resourceUri + if ($this->_resources[$resourceUri] === null) { + $this->_receiveRequestetProperties(); + } + + $foundProperty = null; + $requestedProperties = $this->_resources[$resourceUri]; + foreach ($languages as $language) { + foreach ($this->_requestedProperties as $requestedProperty) { + if (isset($requestedProperties[$requestedProperty][$language]) && !empty($requestedProperties[$requestedProperty][$language])) { + $foundProperty = $requestedProperties[$requestedProperty][$language]; + break(2); + } + } + } + return $foundProperty; + } + + /** + * Resets the helper, emptying all resources, results and queries stored + */ + abstract public function reset(); + +} \ No newline at end of file diff --git a/application/classes/OntoWiki/Model/DescriptionHelper.php b/application/classes/OntoWiki/Model/DescriptionHelper.php new file mode 100644 index 000000000..1415039de --- /dev/null +++ b/application/classes/OntoWiki/Model/DescriptionHelper.php @@ -0,0 +1,112 @@ +_model = $model; + } + + $this->_erfurtApp = Erfurt_App::getInstance(); + + if (null !== $store) { + $this->_store = $store; + } else { + $this->_store = $this->_erfurtApp->getStore(); + } + + if (null == $config) { + $config = OntoWiki::getInstance()->config; + } + if (is_array($config)) { + if (isset($config['descriptionHelper']['properties'])) { // naming properties for resources + $this->_requestedProperties = array_values($config['descriptionHelper']['properties']); + } else { + $this->_requestedProperties = array(); + } + } else { + if ($config instanceof Zend_Config) { + //its possible to define myProperties in config.ini + if (isset($config->descriptionHelper->myProperties)) { + $this->_requestedProperties = array_values($config->descriptionHelper->myProperties->toArray()); + } else if (isset($config->descriptionHelper->properties)) { // naming properties for resources + $this->_requestedProperties = array_values($config->descriptionHelper->properties->toArray()); + } else { + $this->_requestedProperties = array(); + } + + } else { + $this->_requestedProperties = array(); + } + } + + + if (null === $this->_languages) { + $this->_languages = array(); + } + if (isset($config->languages->locale)) { + array_unshift($this->_languages, (string)$config->languages->locale); + $this->_languages = array_unique($this->_languages); + } + + } + + /** + * Singleton instance + * + * @return OntoWiki_Model_Instance + */ + public static function getInstance() + { + if (null === self::$_instance) { + self::$_instance = new self(); + } + + return self::$_instance; + } + + /** + * Resets the helper, emptying all resources, results and queries stored + */ + public function reset() + { + $this->_resources = array(); + } + + /** + * No fallback comments + */ + protected function _fetchFallbackProperties() + { + + } +} diff --git a/application/classes/OntoWiki/Model/TitleHelper.php b/application/classes/OntoWiki/Model/TitleHelper.php index 15e51d1df..afc1ec4cc 100644 --- a/application/classes/OntoWiki/Model/TitleHelper.php +++ b/application/classes/OntoWiki/Model/TitleHelper.php @@ -2,7 +2,7 @@ /** * This file is part of the {@link http://ontowiki.net OntoWiki} project. * - * @copyright Copyright (c) 2012, {@link http://aksw.org AKSW} + * @copyright Copyright (c) 2014, {@link http://aksw.org AKSW} * @license http://opensource.org/licenses/gpl-license.php GNU General Public License (GPL) */ @@ -13,7 +13,11 @@ * @category OntoWiki * @package OntoWiki_Classes_Model */ -class OntoWiki_Model_TitleHelper + +require_once 'OntoWiki/Model/AbstractHelper.php'; + + +class OntoWiki_Model_TitleHelper extends OntoWiki_Model_AbstractHelper { /** * Whether to always search all configured title properties @@ -39,65 +43,16 @@ class OntoWiki_Model_TitleHelper */ private static $_instance = null; - /** - * The languages to consider for title properties. - * - * @var array - */ - protected $_languages = array('en','','localname'); - - /** - * The model object to operate on - * - * @var Erfurt_Rdf_Model - */ - protected $_model = null; - - /** - * The resources for whitch to fetch title properties - * - * @var array - */ - protected $_resources = array(); - - /** - * Resource query object - * - * @var Erfurt_Sparql_SimpleQuery - */ - protected $_resourceQuery = null; - - /** - * Erfurt store object - * - * @var Erfurt_Store - */ - protected $_store = null; - - /** - * Erfurt store object - * - * @var Erfurt_App - */ - protected $_erfurtApp = null; - - /** - * titleProperties from configuration - * - * @var array - */ - protected $_titleProperties = null; - - - - // ------------------------------------------------------------------------ - // --- Magic methods ------------------------------------------------------ - // ------------------------------------------------------------------------ /** * Constructs a new title helper instance. * * @param Erfurt_Rdf_Model $model The model instance to operate on + * @param Erfurt_Store $store + * @param null $config + * @throws Erfurt_Exception + * @throws Erfurt_Store_Exception + * @throws Exception */ public function __construct(Erfurt_Rdf_Model $model = null, Erfurt_Store $store = null, $config = null) { @@ -118,9 +73,9 @@ public function __construct(Erfurt_Rdf_Model $model = null, Erfurt_Store $store } if (is_array($config)) { if (isset($config['titleHelper']['properties'])) { // naming properties for resources - $this->_titleProperties = array_values($config['titleHelper']['properties']); + $this->_requestedProperties = array_values($config['titleHelper']['properties']); } else { - $this->_titleProperties = array(); + $this->_requestedProperties = array(); } // fetch mode @@ -131,11 +86,11 @@ public function __construct(Erfurt_Rdf_Model $model = null, Erfurt_Store $store if ($config instanceof Zend_Config) { //its possible to define myProperties in config.ini if (isset($config->titleHelper->myProperties)) { - $this->_titleProperties = array_values($config->titleHelper->myProperties->toArray()); + $this->_requestedProperties = array_values($config->titleHelper->myProperties->toArray()); } else if (isset($config->titleHelper->properties)) { // naming properties for resources - $this->_titleProperties = array_values($config->titleHelper->properties->toArray()); + $this->_requestedProperties = array_values($config->titleHelper->properties->toArray()); } else { - $this->_titleProperties = array(); + $this->_requestedProperties = array(); } // fetch mode @@ -143,7 +98,7 @@ public function __construct(Erfurt_Rdf_Model $model = null, Erfurt_Store $store $this->_alwaysSearchAllProperties = (strtolower($config->titleHelper->searchMode) == 'language'); } } else { - $this->_titleProperties = array(); + $this->_requestedProperties = array(); } } // always use local name for unknown resources? @@ -151,7 +106,7 @@ public function __construct(Erfurt_Rdf_Model $model = null, Erfurt_Store $store $this->_alwaysUseLocalNames = (bool)$config->titleHelper->useLocalNames; } // add localname to titleproperties - $this->_titleProperties[] = 'localname'; + $this->_requestedProperties[] = 'localname'; if (null === $this->_languages) { $this->_languages = array(); @@ -179,66 +134,6 @@ public static function getInstance() return self::$_instance; } - /** - * Adds a resource to list of resources for which to query title properties. - * - * @param Erfurt_Rdf_Resource|string $resource Resource instance or URI - * - * @return OntoWiki_Model_TitleHelper - */ - public function addResource($resource) - { - $resourceUri = (string)$resource; - if (Erfurt_Uri::check($resourceUri)) { - if (empty($this->_resources[$resourceUri])) { - $this->_resources[$resourceUri] = null; - } - } else { - // throw exeption in debug mode only - if (defined('_OWDEBUG')) { - $logger = OntoWiki::getInstance()->logger; - $logger->info('Supplied resource ' . htmlentities('<' . $resource . '>') . ' is not a valid URI.'); - } - } - return $this; - } - - /** - * Adds a bunch of resources for which to query title properties. - * @param array $resources - * @return OntoWiki_Model_TitleHelper - */ - public function addResources($resources = array(), $variable = null) - { - if (null === $variable) { - foreach ($resources as $resourceUri) { - $this->addResource($resourceUri); - } - } else { - foreach ($resources as $row) { - foreach ((array)$variable as $key) { - if (!empty($row[$key])) { - $object = $row[$key]; - $toBeAdded = null; - if (is_array($object)) { - // probably support extended format - if (isset($object['type']) && ($object['type'] == 'uri')) { - $toBeAdded = $object['value']; - } - } else { - // plain object - $toBeAdded = $object; - } - if ($toBeAdded != null) { - $this->addResource($toBeAdded); - } - } - } - } - } - return $this; - } - /** * Returns the title property for the resource URI in the requested language. * If no title property is found for that language the local part @@ -251,50 +146,7 @@ public function addResources($resources = array(), $variable = null) */ public function getTitle($resourceUri, $language = null) { - if (!Erfurt_Uri::check($resourceUri)) { - return $resourceUri; - } - // * means any language - if (trim($language) == '*') { - $language = null; - } - - //Have a look if we have an entry for the given resourceUri - if (!array_key_exists($resourceUri, $this->_resources) ) { - - if (defined('_OWDEBUG')) { - $logger = OntoWiki::getInstance()->logger; - $logger->info('TitleHelper: getTitle called for unknown resource. Adding resource before fetch.'); - } - //If we dont have an entry create one - $this->addResource($resourceUri); - } - - // prepend the language that is asked for to the array - // of languages we will look for - $languages = $this->_languages; - if (null !== $language) { - array_unshift($languages, (string)$language); - } - $languages = array_values(array_unique($languages)); - - //Have a look if we have already a title for the given resourceUri - if ($this->_resources[$resourceUri] === null ) { - $this->_receiveTitles(); - } - //Select the best found title according received titles and order of configured titleproperties - $title = $resourceUri; - - $titles = $this->_resources[$resourceUri]; - foreach ($languages as $language) { - foreach ($this->_titleProperties as $titleProperty) { - if (isset($titles[$titleProperty][$language]) && !empty($titles[$titleProperty][$language])) { - $title = $titles[$titleProperty][$language]; - break(2); - } - } - } - return $title; + return $this->getRequestedProperty($resourceUri, $language); } /** @@ -307,24 +159,24 @@ public function prependTitleProperty($propertyUri) // check if we have a valid URI if (Erfurt_Uri::check($propertyUri)) { // remove the property from the list if it already exist - foreach ($this->_titleProperties as $key => $value) { + foreach ($this->_requestedProperties as $key => $value) { if ($value == $propertyUri) { - unset($this->_titleProperties[$key]); + unset($this->_requestedProperties[$key]); } } // rewrite the array - $this->_titleProperties = array_values($this->_titleProperties); + $this->_requestedProperties = array_values($this->_requestedProperties); // prepend the new URI - array_unshift($this->_titleProperties, $propertyUri); + array_unshift($this->_requestedProperties, $propertyUri); // reset the TitleHelper to fetch resources with new title properties $this->reset(); } } - /** + /** * Resets the title helper, emptying all resources, results and queries stored */ public function reset() @@ -332,75 +184,13 @@ public function reset() $this->_resources = array(); } - /** - * operate on _resources array and call the method to fetch the titles - * if no titles found for the respective resource the localname will be extracted - * - * @return void - */ - private function _receiveTitles() - { - //first we check if there are resourceUris without a title representation - $toBeReceived = array(); - foreach ($this->_resources as $resourceUri => $resource) { - if ($resource == null) { - $toBeReceived[] = $resourceUri; - } - } - //now we try to receive the Titles from ResourcePool - $this->_fetchTitlesFromResourcePool($toBeReceived); - - //If we dont find titles then we extract them from LocalName - foreach ($this->_resources as $resourceUri => $resource) { - if ($resource == null) { - $this->_resources[$resourceUri]['localname']['localname'] - = $this->_extractTitleFromLocalName($resourceUri); - } - } - } - - /** - * fetches all titles according the given array if Uris - * - * @param array resourceUris - */ - private function _fetchTitlesFromResourcePool($resourceUris) - { - $resourcePool = $this->_erfurtApp->getResourcePool(); - $resources = array(); - if (!empty($this->_model)) { - $modelUri = $this->_model->getModelIri(); - $resources = $resourcePool->getResources($resourceUris, $modelUri); - } else { - $resources = $resourcePool->getResources($resourceUris); - } - - $memoryModel = new Erfurt_Rdf_MemoryModel(); - foreach ($resources as $resourceUri => $resource) { - $resourceDescription = $resource->getDescription(); - $memoryModel->addStatements($resourceDescription); - $found = false; - foreach ($this->_titleProperties as $titleProperty) { - $values = $memoryModel->getValues($resourceUri, $titleProperty); - foreach ($values as $value) { - if (!empty($value['lang'])) { - $language = $value['lang']; - } else { - $language = ''; - } - $this->_resources[$resourceUri][$titleProperty][$language] = $value['value']; - } - } - } - } - /** * extract the localname from given resourceUri * * @param string resourceUri * @return string title */ - private function _extractTitleFromLocalName($resourceUri) + protected function _extractTitleFromLocalName($resourceUri) { $title = OntoWiki_Utils::contractNamespace($resourceUri); // not even namespace found? @@ -409,4 +199,17 @@ private function _extractTitleFromLocalName($resourceUri) } return $title; } + + /** + * If we dont find titles then we extract them from LocalName as a fallback solution + */ + protected function _fetchFallbackProperties() + { + foreach ($this->_resources as $resourceUri => $resource) { + if ($resource == null) { + $this->_resources[$resourceUri]['localname']['localname'] + = $this->_extractTitleFromLocalName($resourceUri); + } + } + } } From 6f4474ae2dbe52d911215d92675acde4415670cf Mon Sep 17 00:00:00 2001 From: Sebastian Nuck Date: Thu, 24 Jul 2014 14:01:09 +0200 Subject: [PATCH 072/482] add versioning on change events and imports --- application/controllers/ServiceController.php | 17 +++++++++++++++++ .../basicimporter/BasicimporterController.php | 14 ++++++++++++++ extensions/history/languages/history-de.csv | 2 ++ extensions/history/languages/history-en.csv | 2 ++ extensions/history/templates/history/list.phtml | 2 ++ 5 files changed, 37 insertions(+) diff --git a/application/controllers/ServiceController.php b/application/controllers/ServiceController.php index 8e931cd5c..45d4d2945 100644 --- a/application/controllers/ServiceController.php +++ b/application/controllers/ServiceController.php @@ -515,6 +515,8 @@ public function updateAction() $insert = json_decode($this->_request->getParam('insert', '{}'), true); $delete = json_decode($this->_request->getParam('delete', '{}'), true); + $changeReason = $this->_request->getParam('changeReason', null); + if ($this->_request->has('delete_hashed')) { $hashedObjectStatements = $this->_findStatementsForObjectsWithHashes( $namedGraph, @@ -539,6 +541,18 @@ public function updateAction() $flag = false; + + // action spec for versioning + $versioning = OntoWiki::getInstance()->erfurt->getVersioning(); + $actionSpec = array(); + $actionSpec['type'] = 21; + $actionSpec['modeluri'] = $deleteModel->getModelUri(); + $actionSpec['resourceuri'] = !null == key($delete) ? key($delete) : key($insert); + $actionSpec['changeReason'] = $changeReason; + + // starting action + $versioning->startAction($actionSpec); + /** * @trigger onUpdateServiceAction is triggered when Service-Controller Update Action is executed. * Event contains following attributes: @@ -595,6 +609,9 @@ public function updateAction() } } + // stopping action + $versioning->endAction(); + // nothing done? if (!$flag) { // When no user is given (Anoymous) give the requesting party a chance to authenticate. diff --git a/extensions/basicimporter/BasicimporterController.php b/extensions/basicimporter/BasicimporterController.php index e12dd951d..b83717c03 100644 --- a/extensions/basicimporter/BasicimporterController.php +++ b/extensions/basicimporter/BasicimporterController.php @@ -196,8 +196,22 @@ private function _import($fileOrUrl, $filetype, $locator) { $modelIri = (string)$this->_model; + // action spec for versioning + $versioning = $this->_erfurt->getVersioning(); + $actionSpec = array(); + $actionSpec['type'] = 11; + $actionSpec['modeluri'] = $modelIri; + $actionSpec['resourceuri'] = $modelIri; + try { + // starting versioning action + $versioning->startAction($actionSpec); + $this->_erfurt->getStore()->importRdf($modelIri, $fileOrUrl, $filetype, $locator); + + // stopping versioning action + $versioning->endAction(); + } catch (Erfurt_Exception $e) { // re-throw throw new OntoWiki_Controller_Exception( diff --git a/extensions/history/languages/history-de.csv b/extensions/history/languages/history-de.csv index 4fa8d18e4..78a887832 100644 --- a/extensions/history/languages/history-de.csv +++ b/extensions/history/languages/history-de.csv @@ -1,4 +1,5 @@ HISTORY_ACTIONTYPE_10;Model importiert +HISTORY_ACTIONTYPE_11;Daten importiert HISTORY_ACTIONTYPE_20;Statement hinzugefügt HISTORY_ACTIONTYPE_21;Statement geändert HISTORY_ACTIONTYPE_22;Statement gelöscht @@ -11,3 +12,4 @@ timestamp;Zeitstempel action-type;Aktionstyp Rollback changes;"Änderungen wiederherstellen" Versions for %1$s;Versionen von %1$s +change-reason;Änderungsgrund diff --git a/extensions/history/languages/history-en.csv b/extensions/history/languages/history-en.csv index 1ddf40ba7..4d74bf425 100644 --- a/extensions/history/languages/history-en.csv +++ b/extensions/history/languages/history-en.csv @@ -1,4 +1,5 @@ HISTORY_ACTIONTYPE_10;Model imported +HISTORY_ACTIONTYPE_11;Data imported HISTORY_ACTIONTYPE_20;Statement added HISTORY_ACTIONTYPE_21;Statement changed HISTORY_ACTIONTYPE_22;Statement deleted @@ -7,3 +8,4 @@ HISTORY_ACTIONTYPE_120;Added data to knowledge base HISTORY_ACTIONTYPE_130;Resource deleted Versions for %1$s action-type;Action type +change-reason;Change Reason \ No newline at end of file diff --git a/extensions/history/templates/history/list.phtml b/extensions/history/templates/history/list.phtml index 62b9c0a9e..32d05b854 100644 --- a/extensions/history/templates/history/list.phtml +++ b/extensions/history/templates/history/list.phtml @@ -10,6 +10,7 @@
+ @@ -41,6 +42,7 @@ + From af6ce5a1ae22211921940132d5ccf6b3f636dfa9 Mon Sep 17 00:00:00 2001 From: Philipp Frischmuth Date: Tue, 3 Jun 2014 18:14:59 +0200 Subject: [PATCH 073/482] Add support for attributes in toolbar buttons --- application/classes/OntoWiki/Toolbar.php | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) diff --git a/application/classes/OntoWiki/Toolbar.php b/application/classes/OntoWiki/Toolbar.php index b203d92d1..895dacfff 100644 --- a/application/classes/OntoWiki/Toolbar.php +++ b/application/classes/OntoWiki/Toolbar.php @@ -276,6 +276,16 @@ private function _getButton($type, $options = array()) $title = null; } + if (array_key_exists('attributes', $options) && is_array($options['attributes'])) { + $attributes = array(); + foreach ($options['attributes'] as $key => $value) { + $attributes[] = $key . '="' . $value . '"'; + } + $attributes = implode(' ', $attributes); + } else { + $attributes = null; + } + // set image if (array_key_exists('image_url', $options)) { $image = $options['image_url']; @@ -289,11 +299,12 @@ private function _getButton($type, $options = array()) // construct button link $button = sprintf( - ' %s', + ' %s', $class, $id, $href, $title, + $attributes, $image, $label ); From 3ae94266f8db050f66a98948c7171e32103144bd Mon Sep 17 00:00:00 2001 From: Natanael Arndt Date: Thu, 5 Jun 2014 00:19:07 +0100 Subject: [PATCH 074/482] Fix minor cs issues --- application/Bootstrap.php | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/application/Bootstrap.php b/application/Bootstrap.php index 9b811b965..c87e8db59 100644 --- a/application/Bootstrap.php +++ b/application/Bootstrap.php @@ -165,7 +165,8 @@ public function _initConfig() $rewriteBase = substr($_SERVER['PHP_SELF'], 0, strpos($_SERVER['PHP_SELF'], BOOTSTRAP_FILE)); $protocol = (isset($_SERVER['HTTPS']) && strtolower($_SERVER['HTTPS']) == 'on') ? 'https' : 'http'; - if (isset($_SERVER['SERVER_PORT']) + if ( + isset($_SERVER['SERVER_PORT']) && $_SERVER['SERVER_PORT'] != '80' && $_SERVER['SERVER_PORT'] != '443' ) { @@ -231,8 +232,8 @@ protected function applySessionConfig($sessionConfig) 'lifetime' => isset($sessionConfig->lifetime) ? $sessionConfig->lifetime : 0, 'path' => isset($sessionConfig->path) ? $sessionConfig->path : '/', 'domain' => isset($sessionConfig->domain) ? $sessionConfig->domain : '', - 'secure' => isset($sessionConfig->secure) ? (bool) $sessionConfig->secure : false, - 'httpOnly' => isset($sessionConfig->httpOnly) ? (bool) $sessionConfig->httpOnly : false + 'secure' => isset($sessionConfig->secure) ? (bool)$sessionConfig->secure : false, + 'httpOnly' => isset($sessionConfig->httpOnly) ? (bool)$sessionConfig->httpOnly : false ); call_user_func_array('session_set_cookie_params', $cookieParams); } From 11623d9911664041410949db3f7d4161fa15cd5c Mon Sep 17 00:00:00 2001 From: Natanael Arndt Date: Thu, 5 Jun 2014 00:19:54 +0100 Subject: [PATCH 075/482] User HTTP_HOST instead of SERVER_NAME SERVER_NAME holds the name configured in the server setting and thus can not be used, if the same server is used under different names. HTTP_HOST instead contains the currently requested hostname. This also includes the correct format for IPv6 in URLs and a port if appended. --- application/Bootstrap.php | 26 +++----------------------- 1 file changed, 3 insertions(+), 23 deletions(-) diff --git a/application/Bootstrap.php b/application/Bootstrap.php index c87e8db59..d8c4c1f7b 100644 --- a/application/Bootstrap.php +++ b/application/Bootstrap.php @@ -165,32 +165,12 @@ public function _initConfig() $rewriteBase = substr($_SERVER['PHP_SELF'], 0, strpos($_SERVER['PHP_SELF'], BOOTSTRAP_FILE)); $protocol = (isset($_SERVER['HTTPS']) && strtolower($_SERVER['HTTPS']) == 'on') ? 'https' : 'http'; - if ( - isset($_SERVER['SERVER_PORT']) - && $_SERVER['SERVER_PORT'] != '80' - && $_SERVER['SERVER_PORT'] != '443' - ) { - $port = ':' . $_SERVER['SERVER_PORT']; - } else { - $port = ''; - } - - if (isset($_SERVER['SERVER_NAME']) && strpos($_SERVER['SERVER_NAME'], ':') !== false) { - // IPv6 - $serverName = '[' . $_SERVER['SERVER_NAME'] . ']'; - } else if (isset($_SERVER['SERVER_NAME'])) { - // IPv4 or host name - $serverName = $_SERVER['SERVER_NAME']; - } else { - // localhost - $serverName = 'localhost'; - } + $httpHost = $_SERVER['HTTP_HOST']; $urlBase = sprintf( - '%s://%s%s%s', + '%s://%s%s', $protocol, - $serverName, - $port, + $httpHost, $rewriteBase ); From 0a9c72776b94e737fc3d4f9c39a80ac6206ccb05 Mon Sep 17 00:00:00 2001 From: Natanael Arndt Date: Thu, 5 Jun 2014 00:29:47 +0100 Subject: [PATCH 076/482] Default HTTP_HOST to localhost if not set --- application/Bootstrap.php | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/application/Bootstrap.php b/application/Bootstrap.php index d8c4c1f7b..9ba90fcc4 100644 --- a/application/Bootstrap.php +++ b/application/Bootstrap.php @@ -165,7 +165,11 @@ public function _initConfig() $rewriteBase = substr($_SERVER['PHP_SELF'], 0, strpos($_SERVER['PHP_SELF'], BOOTSTRAP_FILE)); $protocol = (isset($_SERVER['HTTPS']) && strtolower($_SERVER['HTTPS']) == 'on') ? 'https' : 'http'; - $httpHost = $_SERVER['HTTP_HOST']; + if (isset($_SERVER['HTTP_HOST'])) { + $httpHost = $_SERVER['HTTP_HOST']; + } else { + $httpHost = 'localhost'; + } $urlBase = sprintf( '%s://%s%s', From af1d87fd2795e25d2b6ca154138ee84d909bbc74 Mon Sep 17 00:00:00 2001 From: Natanael Arndt Date: Thu, 5 Jun 2014 13:10:13 +0100 Subject: [PATCH 077/482] Forward Erfurt and RDFauthor --- libraries/Erfurt | 2 +- libraries/RDFauthor | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/libraries/Erfurt b/libraries/Erfurt index 35bbcb0f7..7fc1c5ae3 160000 --- a/libraries/Erfurt +++ b/libraries/Erfurt @@ -1 +1 @@ -Subproject commit 35bbcb0f7eb0ab1558726000a5041d7c14072d2e +Subproject commit 7fc1c5ae342ac15b14e637b31e93bc425423f44e diff --git a/libraries/RDFauthor b/libraries/RDFauthor index a0a1ca71e..250fdba0f 160000 --- a/libraries/RDFauthor +++ b/libraries/RDFauthor @@ -1 +1 @@ -Subproject commit a0a1ca71ea8ecd548939a85b1b0d2261234975e4 +Subproject commit 250fdba0f6f8687f0adc6fe58b65770cef4859fa From 4752a8d6567eb97fd6b728cf8bc08bd9f116868b Mon Sep 17 00:00:00 2001 From: Natanael Arndt Date: Wed, 11 Jun 2014 16:16:31 +0100 Subject: [PATCH 078/482] Fix selectlanguage config for russian --- extensions/selectlanguage/default.ini | 2 +- extensions/selectlanguage/doap.n3 | 6 +----- 2 files changed, 2 insertions(+), 6 deletions(-) diff --git a/extensions/selectlanguage/default.ini b/extensions/selectlanguage/default.ini index 53f803758..48eed1efb 100644 --- a/extensions/selectlanguage/default.ini +++ b/extensions/selectlanguage/default.ini @@ -11,5 +11,5 @@ author = "Michael Martin" languages.en = "english (en)" languages.de = "deutsch (de)" languages.zh = "汉语 (zh)" -langzages.ru = "русский язык (ru)" +languages.ru = "русский язык (ru)" ;languages.nl = dutch diff --git a/extensions/selectlanguage/doap.n3 b/extensions/selectlanguage/doap.n3 index af837cc2f..dabb8883b 100644 --- a/extensions/selectlanguage/doap.n3 +++ b/extensions/selectlanguage/doap.n3 @@ -22,11 +22,7 @@ owconfig:id "languages"; :en "english (en)" ; :de "deutsch (de)" ; - :zh "汉语 (zh)" -]; - owconfig:config [ - a owconfig:Config; - owconfig:id "langzages"; + :zh "汉语 (zh)" ; :ru "русский язык (ru)" ] . :selectlanguage doap:release :v1-0 . From d4d51ca71ba0ac6e9b43f2bfb0faa46af3d6025d Mon Sep 17 00:00:00 2001 From: Natanael Arndt Date: Tue, 17 Jun 2014 10:30:35 +0200 Subject: [PATCH 079/482] Set zend version to latest 1.x. Fix #306. --- Makefile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Makefile b/Makefile index 47742a185..d71056377 100644 --- a/Makefile +++ b/Makefile @@ -1,4 +1,4 @@ -ZENDVERSION=1.11.5 +ZENDVERSION=1.12.7 ZEND2VERSION=2.2.2 default: From b95ed47984f754aab3fa0ee8292c8ee3b06b4c90 Mon Sep 17 00:00:00 2001 From: Natanael Arndt Date: Tue, 17 Jun 2014 13:57:22 +0200 Subject: [PATCH 080/482] Fix comments if creator not set. --- .../templates/partials/list_community_item.phtml | 8 +++++++- .../templates/partials/list_community_main.phtml | 6 +++++- 2 files changed, 12 insertions(+), 2 deletions(-) diff --git a/extensions/community/templates/partials/list_community_item.phtml b/extensions/community/templates/partials/list_community_item.phtml index 61f8796ca..a4c2e846c 100644 --- a/extensions/community/templates/partials/list_community_item.phtml +++ b/extensions/community/templates/partials/list_community_item.phtml @@ -1,3 +1,9 @@ +author; +if ($author === null) { + $author = 'anonymous'; +} +?> - author ?> + resource)) : ?> on instanceInfo as $instance){ + $author = null; + if (isset($this->instanceData[$instance['uri']]['creator'][0]['value'])) { + $author = $this->instanceData[$instance['uri']]['creator'][0]['value']; + } $options = array( - 'author' => $this->instanceData[$instance['uri']]['creator'][0]['value'], + 'author' => $author, 'comment' => $instance['uri'], 'commentUrl' => $instance['url'], 'content' => $this->instanceData[$instance['uri']]['content'][0]['value'], From 364752f40e2957f041752b74216590973fa9e9d7 Mon Sep 17 00:00:00 2001 From: Andreas Nareike Date: Fri, 4 Jul 2014 08:42:31 +0200 Subject: [PATCH 081/482] First draft (incomplete) to provide french --- extensions/selectlanguage/doap.n3 | 1 + extensions/translations/fr/core.csv | 225 ++++++++++++++++++++++++++++ 2 files changed, 226 insertions(+) create mode 100644 extensions/translations/fr/core.csv diff --git a/extensions/selectlanguage/doap.n3 b/extensions/selectlanguage/doap.n3 index dabb8883b..b4834ccab 100644 --- a/extensions/selectlanguage/doap.n3 +++ b/extensions/selectlanguage/doap.n3 @@ -22,6 +22,7 @@ owconfig:id "languages"; :en "english (en)" ; :de "deutsch (de)" ; + :fr "français (fr)" ; :zh "汉语 (zh)" ; :ru "русский язык (ru)" ] . diff --git a/extensions/translations/fr/core.csv b/extensions/translations/fr/core.csv new file mode 100644 index 000000000..21d46d5b6 --- /dev/null +++ b/extensions/translations/fr/core.csv @@ -0,0 +1,225 @@ +# +# OntoWiki German language translation +# Encoding: UTF-8 +# Separator: ; +# +Back;Retour +Submit;Envoyer +Cancel;Terminer +Save Changes;"Sauvegarder les modificitions" +Reset Form;Reculer formulaire +Edit Instances;TODO +Edit Properties;TODO +Add Property;"Ajouter propriété" +Rendered in %1$d microseconds using %2$d SPARQL queries.;Gerendert in %1$d Mikrosekunden mit %2$d SPARQL-Anfragen. +more;mehr + +moments ago;TODO +approx. 1 minute ago;il y'a une minute +approx. %d minutes ago;il y'a %d minutes +approx. 1 hour ago;il y'a une heure +approx. %d hours ago;il y'a %d heures +approx. %d days ago;il y'a %d jours + +# test +page1;Page 1 +page2;Page 2 + + +# Module +Search all Knowledge Bases;Chercher tous les bases de connaissance +Search Text;TODO +Knowledge Bases;Bases de connaissance +Create Knowledge Base;"Créer une base de connaissance" +Show Hidden Knowledge Bases;"Afficher bases de connaissance cachées" +Hide Hidden Knowledge Bases;"Cacher bases de connaissance cachées" +Languages (Tagged Literals);Sprachen (ausgezeichnete Labels) +none;aucun +Classes;Classes +Create Class;"Créer une classe" +Show Empty Classes;Afficher des classes vides +Hide Empty Classes;Cacher des classes vides +Show System Classes;Afficher des classes TODO +Hide System Classes;TODO +Show Hidden Classes;Afficher des classes cachées +Hide Hidden Classes;Cacher des classes cachées +Most Popular | Most Active;Populär | Aktiv +Rec. Changes;"Modifications" +Rec. Comments;Commentaires +Login;Connecter +No matches.;Keine Entsprechungen. +Predicates;Prädikate +Similar Instances;"Des instances similaires" +Instances Linking Here;Verlinkte Ressourcen +Usage as Property;Auftreten als Prädikat +Not implemented yet.;Noch nicht implementiert. +Latest Changes;Aktuelle Änderungen +Latest Discussions;Aktuelle Diskussionen +Comments, Descriptions and Notes;Kurzbeschreibung +Actions; Aktionen +There are no comments, descriptions or notes on this knowledge base.; Es sind keine Kommentare, Beschreibungen oder Anmerkungen in der Wissensbasis enthalten. +view all resources; Alle Ressourcen anzeigen +Search for Resources;Suche nach Ressourcen +Source;Code source +by;von +Objects;Objekte +Subjects;Subjekte + + +# Komponenten +# TODO: sollten Komponenten ihre Übersetzung selbst verwalten? +Properties;"Propriétés" +Instances;Instances +Calendar;Calendrier +History;ChangeLog +Map;Carte + +# application menu +User;Utilisateur +Register New User;Enregistrer nouvel utilisateur +Preferences;"Préférences" +Logout;Annuler +View;"Aperçu" +Edit;"Éditer" +Extras;Extras +SPARQL Query Editor;SPARQL-Anfrage-Editor +File Resource Manager;Dateiressourcen-Manager +News;Nouvelles +Clear Cache;Vider cache +Help;Aide +Documentation;Documentation +Bug Report;Fehler melden +Version Info;Versionsinfo +About;"Über" + +#Pager +First;Erste +Previous;Vorherige +Next;Nächste +Last;Letzte + +Create New Knowledge Base;Neue Wissensbasis anlegen +Model URI;Modell-URI +Create an Empty Knowledge Base; Eine leere Wissensbasis anlegen +Base URI;Basis-URI +Type;Typ +Import From the Web;Aus dem WWW importieren +Upload a File;Eine Datei hochladen +File Type;Dateityp +File (max. %1$sB);Datei (max. %1$sB) +Paste Source;Quelltext eingeben +Source Code;Quelltext +Enter the URL where the model should be downloaded from. If you leave the field empty the model URI will be used.;Geben Sie die URL zur Modelldatei an. Wenn Sie dieses Feld leer lassen, wird stattdessen die Modell-URI benutzt. +Location;URL zur Datei +Instances of %1$s;Instanzen von %1$s +Properties of %1$s;Eigenschaften von %1$s + +Register User;Enregister utilisateur +Username;Nom d'utilisateur +Email Address;Adresse e-mail +Password;Mot de passe +Password (repeat);"Mot de passe (répéter)" +Unknown user identifier.;Unbekannte Benutzerkennung. +Forgot your password?;Passwort vergessen? + +Predefined namespaces;Vordefinierte Namensräume +SPARQL Options;SPARQL-Optionen +Plain;Einfach +Submit Query;Anfrage absenden +result;Ergebnis +results;Ergebnisse +Search returned %1$d %2$s.;Die Suche lieferte %1$d %2$s. +Query execution took %1$d ms.;Die Bearbeitung der Anfrage dauerte %1$d ms. + +# Menüs +View Resource;Regarder ressource +Edit Resource;"Éditer ressource" +Delete Resource;Effacer ressource + +List Instances;Lister les instances +Create Instance;"Créer instance" +Create Subclass;"Créer sous-classe" + +Select Knowledge Base;"Sélectionner base de connaissance" +Configure Knowledge Base;"Configurer base de connaissance" +Add Data to Knowledge Base;"Ajouter des données à base de connaissance" +Export Knowledge Base as RDF/XML;Exporter base de connaissance comme RDF/XML +Export Knowledge Base as RDF/JSON;Exporter base de connaissance comme RDF/JSON +Export Knowledge Base as RDF/N3;Exorter base de connaissance comme RDF/N3 +Export Knowledge Base as RDF/JSON (Talis);Exporter base de connaisssance comme RDF/JSON (Talis) +Export Knowledge Base as Turtle;Exporter base de connaissance comme Turtle +Export Knowledge Base as Notation 3;Exporter base de connaissance comme N3 +Delete Knowledge Base;Supprimer base de connaissance + +Toggle show Permalink;Afficher/cacher Permalien +Toggle show Resoure Query;Afficher/cacher Resource Query + +# Wochentage +Monday;Lundi +Tuesday;Mardi +Wednesday;Mercredi +Thursday;Jeudi +Friday;Vendredi +Saturday;Samedi +Sunday;Dimance + +Add Class;Ajouter classe +Add Instance;Ajouter instance + +Show Properties;"Afficher propriétés" + +Filter;Filter +Combine Filters (Conjunction);Filter kombinieren (Konjunktion) + +Merge;Fusionner +Visit resource on the web;Ressource im Netz aufsuchen + +Create instances from property value by regexp +Similar Instances +Rating +Average Rating +Your Rating +Instances Linking Here +Usage as Property +Instances +Values +Search | OntoWiki +Search Text +Submit +Search All Knowledge Bases +Search +Add Property +Submit Values +SPARQL Query Editor +Result Options +Table +SPARQL Query Results XML Format +Render Ressources as OntoWiki Links +Create New Knowledge Base +FOAFSSL;FOAF+SSL + +# explore tags module +Explore Tags;Schlagwörter / Tag-Wolken +Reset Explore Tags Box;Modul zurücksetzen +Reset selected tags;Tag-Auswahl zurücksetzen +Number of showed tags;Anzahl Tags +Sort;Triage +by name; par nom +by frequency;"par quantité" + +# navigation module +Number of Elements;Anzahl Ressourcen +Toggle Elements;Spezielle Elemente +Reset Navigation;Navigation zurücksetzen +Add Resource here;Ajouter ressource ici +Show Hidden Elements;Versteckte Ressourcen einblenden +Hide Hidden Elements;Versteckte Ressourcen ausblenden + +# filter extension +Toggle help; Hilfe (de)aktivieren +filter_help1;Wörter die durch Leerzeichen getrennt sind müssen alle im Ergebnis enthalten sein, dabei spielt die eingegebene Reihenfolge keine Rolle. +filter_help2;Phrasen können gesucht werden, indem die Wortgruppe in einfache Anführungszeichen gesetzt wird (Strg + #). +filter_help3;Werden mindestens vier Buchstaben eingegeben, kann anschließend durch Sternchen '*' eine Trunkierung erfolgen. +filter_help4;Sobald die Suche die Wörter AND oder OR enthält, muss die komplette bif:contains-Syntax benutzt werden. +Further info;mehr Informationen + From 5069b4d858edb6b8ba7c721a9b2f2f595299be56 Mon Sep 17 00:00:00 2001 From: Natanael Arndt Date: Tue, 15 Jul 2014 11:24:54 +0200 Subject: [PATCH 082/482] Add hugarian to language selection --- extensions/selectlanguage/default.ini | 1 + extensions/selectlanguage/doap.n3 | 7 ++++--- 2 files changed, 5 insertions(+), 3 deletions(-) diff --git a/extensions/selectlanguage/default.ini b/extensions/selectlanguage/default.ini index 48eed1efb..478185ade 100644 --- a/extensions/selectlanguage/default.ini +++ b/extensions/selectlanguage/default.ini @@ -10,6 +10,7 @@ author = "Michael Martin" [private] languages.en = "english (en)" languages.de = "deutsch (de)" +languages.hu = "magyar (hu)" languages.zh = "汉语 (zh)" languages.ru = "русский язык (ru)" ;languages.nl = dutch diff --git a/extensions/selectlanguage/doap.n3 b/extensions/selectlanguage/doap.n3 index b4834ccab..223bd8ebe 100644 --- a/extensions/selectlanguage/doap.n3 +++ b/extensions/selectlanguage/doap.n3 @@ -20,9 +20,10 @@ owconfig:config [ a owconfig:Config; owconfig:id "languages"; - :en "english (en)" ; - :de "deutsch (de)" ; - :fr "français (fr)" ; + :en "English (en)" ; + :de "Deutsch (de)" ; + :fr "Français (fr)" ; + :hu "Magyar (hu)" ; :zh "汉语 (zh)" ; :ru "русский язык (ru)" ] . From 99beaace257122cc803355fb2dab3573ca1ad2a3 Mon Sep 17 00:00:00 2001 From: Natanael Arndt Date: Tue, 15 Jul 2014 12:02:41 +0200 Subject: [PATCH 083/482] Forward RDFauthor and Erfurt --- libraries/Erfurt | 2 +- libraries/RDFauthor | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/libraries/Erfurt b/libraries/Erfurt index 7fc1c5ae3..98c128da5 160000 --- a/libraries/Erfurt +++ b/libraries/Erfurt @@ -1 +1 @@ -Subproject commit 7fc1c5ae342ac15b14e637b31e93bc425423f44e +Subproject commit 98c128da5992db85b2d4ff80f01c177011c276b2 diff --git a/libraries/RDFauthor b/libraries/RDFauthor index 250fdba0f..415ac249f 160000 --- a/libraries/RDFauthor +++ b/libraries/RDFauthor @@ -1 +1 @@ -Subproject commit 250fdba0f6f8687f0adc6fe58b65770cef4859fa +Subproject commit 415ac249f4369ef91c1e878d95a82b6d80abf48a From 15e4a5ef6db5aa5c4073fbd57242a36ead11d9c4 Mon Sep 17 00:00:00 2001 From: Sebastian Tramp Date: Thu, 17 Jul 2014 13:12:06 +0200 Subject: [PATCH 084/482] add an onRegisterUser Event --- application/controllers/ApplicationController.php | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/application/controllers/ApplicationController.php b/application/controllers/ApplicationController.php index de0750d31..52c70db4c 100644 --- a/application/controllers/ApplicationController.php +++ b/application/controllers/ApplicationController.php @@ -310,6 +310,10 @@ public function registerAction() $this->_owApp->appendMessage( new OntoWiki_Message($message, OntoWiki_Message::SUCCESS) ); + + $event = new Erfurt_Event('onRegisterUser'); + $event->username = $username; + $event->trigger(); } else { $message = 'A registration error occured. Please refer to the log entries.'; $this->_owApp->appendMessage( From c0bc550f585e45fbf6fbc9e0515a45074c044bd3 Mon Sep 17 00:00:00 2001 From: Sebastian Tramp Date: Thu, 17 Jul 2014 17:26:42 +0200 Subject: [PATCH 085/482] add an onRegisterUserFailed Event --- .../controllers/ApplicationController.php | 20 +++++++++++++++---- libraries/Erfurt | 2 +- 2 files changed, 17 insertions(+), 5 deletions(-) diff --git a/application/controllers/ApplicationController.php b/application/controllers/ApplicationController.php index 52c70db4c..1c6a4b172 100644 --- a/application/controllers/ApplicationController.php +++ b/application/controllers/ApplicationController.php @@ -225,6 +225,8 @@ public function registerAction() ); if ($post) { + /* status var in order to fire corresponding events */ + $registrationError = true; $registeredUsernames = array(); $registeredEmailAddresses = array(); @@ -310,10 +312,7 @@ public function registerAction() $this->_owApp->appendMessage( new OntoWiki_Message($message, OntoWiki_Message::SUCCESS) ); - - $event = new Erfurt_Event('onRegisterUser'); - $event->username = $username; - $event->trigger(); + $registrationError = false; } else { $message = 'A registration error occured. Please refer to the log entries.'; $this->_owApp->appendMessage( @@ -327,6 +326,19 @@ public function registerAction() } } } + + /* + * fire events for success and error + */ + if ($registrationError === false) { + $event = new Erfurt_Event('onRegisterUser'); + $event->username = $username; + $event->trigger(); + } else { + $event = new Erfurt_Event('onRegisterUserFailed'); + $event->username = $username; + $event->trigger(); + } } } diff --git a/libraries/Erfurt b/libraries/Erfurt index 98c128da5..45ce14ec3 160000 --- a/libraries/Erfurt +++ b/libraries/Erfurt @@ -1 +1 @@ -Subproject commit 98c128da5992db85b2d4ff80f01c177011c276b2 +Subproject commit 45ce14ec38daef6e682cbc90d07f332754d27b00 From 9c63f90594dd92becec3a3443bded0c90852c184 Mon Sep 17 00:00:00 2001 From: Henri Knochenhauer Date: Fri, 18 Jul 2014 11:01:46 +0200 Subject: [PATCH 086/482] additional fixes while firing onRegisterUser and onRegisterUserFailed event add response to event add message to event --- application/controllers/ApplicationController.php | 3 +++ 1 file changed, 3 insertions(+) diff --git a/application/controllers/ApplicationController.php b/application/controllers/ApplicationController.php index 1c6a4b172..55ede661b 100644 --- a/application/controllers/ApplicationController.php +++ b/application/controllers/ApplicationController.php @@ -333,10 +333,13 @@ public function registerAction() if ($registrationError === false) { $event = new Erfurt_Event('onRegisterUser'); $event->username = $username; + $event->response = $this->_response; $event->trigger(); } else { $event = new Erfurt_Event('onRegisterUserFailed'); $event->username = $username; + $event->message = $message; + $event->response = $this->_response; $event->trigger(); } } From 67c3dfa68fe0a485dc9b64d9302869aaa4b36c29 Mon Sep 17 00:00:00 2001 From: Henri Knochenhauer Date: Sat, 19 Jul 2014 14:27:43 +0200 Subject: [PATCH 087/482] add json-support for registrationAction --- application/controllers/ApplicationController.php | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/application/controllers/ApplicationController.php b/application/controllers/ApplicationController.php index 55ede661b..376635610 100644 --- a/application/controllers/ApplicationController.php +++ b/application/controllers/ApplicationController.php @@ -223,6 +223,13 @@ public function registerAction() array('escape' => false, 'translate' => false) ) ); + + $contentType = $this->_request->getHeader('Content-Type'); + if(strstr($contentType, 'application/json')){ + $rawBody = $this->_request->getRawBody(); + echo $rawBody; + $post = Zend_Json::decode($rawBody); + } if ($post) { /* status var in order to fire corresponding events */ From 534006ff8b01817d838d9db9efaec15e231199b2 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Christian=20W=C3=BCrker?= Date: Fri, 1 Aug 2014 15:09:22 +0200 Subject: [PATCH 088/482] Complete license and copyright information in doc blocks. --- extensions/community/rating.js | 19 +- extensions/community/styles/community.css | 4 + extensions/datagathering/datagathering.js | 4 + extensions/exconf/resources/exconf.css | 15 +- extensions/exconf/resources/exconf.js | 4 + extensions/exconf/resources/outline.js | 14 +- extensions/exconf/resources/togglebutton.css | 15 +- extensions/filter/resources/FilterAPI.js | 281 ++++----- extensions/filter/resources/filter.css | 4 + extensions/filter/resources/filter.js | 5 + extensions/filter/resources/jquery.dump.js | 588 +++++++++--------- extensions/listmodules/showproperties.js | 40 +- extensions/modellist/modellist.js | 10 +- extensions/navigation/navigation.css | 24 +- .../queries/resources/querieseditor.css | 4 + extensions/queries/resources/savepartial.js | 142 +++-- .../themes/darkorange/styles/default.css | 6 +- extensions/themes/silverblue/scripts/main.js | 6 + .../silverblue/scripts/serialize-php.js | 5 + .../themes/silverblue/scripts/support.js | 2 +- .../themes/silverblue/styles/clickmenu.css | 5 + .../themes/silverblue/styles/default.css | 9 +- .../themes/silverblue/styles/default.dev.css | 19 +- .../silverblue/styles/deprecated.dev.css | 22 +- extensions/themes/silverblue/styles/old.css | 4 + .../styles/patches/ie6.clickmenu.css | 4 + .../themes/silverblue/styles/patches/ie6.css | 4 + .../themes/silverblue/styles/patches/ie7.css | 5 + 28 files changed, 681 insertions(+), 583 deletions(-) diff --git a/extensions/community/rating.js b/extensions/community/rating.js index e3024a1f8..8dcf3ae5b 100644 --- a/extensions/community/rating.js +++ b/extensions/community/rating.js @@ -1,3 +1,7 @@ +/** + * @copyright Copyright (c) 2014, {@link http://aksw.org AKSW} + * @license http://opensource.org/licenses/gpl-license.php GNU General Public License (GPL) + */ $(document).ready(function() { var rating_disp = document.getElementsByName('rating'); @@ -71,8 +75,6 @@ $(document).ready(function() { tab5.style.display = ''; } - - $('#changebutton').click(function(){ tab0.style.display = ''; tab1.style.display = ''; @@ -85,11 +87,11 @@ $(document).ready(function() { }); $('#ratingfield').mouseout(function(){ - + $('#submit').val(getCheckedValue(rating_in)); - + }); - + }); function getCheckedValue(radioObj) { @@ -107,9 +109,4 @@ function getCheckedValue(radioObj) { } } return ""; -} - - - - - +} \ No newline at end of file diff --git a/extensions/community/styles/community.css b/extensions/community/styles/community.css index 4f7ea5de7..f3ea7f8c6 100644 --- a/extensions/community/styles/community.css +++ b/extensions/community/styles/community.css @@ -1,3 +1,7 @@ +/** + * @copyright Copyright (c) 2014, {@link http://aksw.org AKSW} + * @license http://opensource.org/licenses/gpl-license.php GNU General Public License (GPL) + */ .comment { background-image: ; } \ No newline at end of file diff --git a/extensions/datagathering/datagathering.js b/extensions/datagathering/datagathering.js index 8c31a3a62..765b23545 100644 --- a/extensions/datagathering/datagathering.js +++ b/extensions/datagathering/datagathering.js @@ -1,3 +1,7 @@ +/** + * @copyright Copyright (c) 2014, {@link http://aksw.org AKSW} + * @license http://opensource.org/licenses/gpl-license.php GNU General Public License (GPL) + */ $(document).ready(function() { // ------------------------------------------------------------------------ diff --git a/extensions/exconf/resources/exconf.css b/extensions/exconf/resources/exconf.css index e493e90c8..298ce6056 100644 --- a/extensions/exconf/resources/exconf.css +++ b/extensions/exconf/resources/exconf.css @@ -1,11 +1,10 @@ -/* - Document : exconf - Created on : 03.02.2011, 19:29:44 - Author : haschek - Description: - defines special elements for the extension configurator -*/ - +/** + * Defines special elements for the extension configurator + * @author haschek + * @since 03.02.2011, 19:29:44 + * @copyright Copyright (c) 2014, {@link http://aksw.org AKSW} + * @license http://opensource.org/licenses/gpl-license.php GNU General Public License (GPL) + */ #show_extension input, legend { position:absolute; diff --git a/extensions/exconf/resources/exconf.js b/extensions/exconf/resources/exconf.js index 6f3f5f4ad..249b1fcb1 100644 --- a/extensions/exconf/resources/exconf.js +++ b/extensions/exconf/resources/exconf.js @@ -1,3 +1,7 @@ +/** + * @copyright Copyright (c) 2014, {@link http://aksw.org AKSW} + * @license http://opensource.org/licenses/gpl-license.php GNU General Public License (GPL) + */ $(function() { diff --git a/extensions/exconf/resources/outline.js b/extensions/exconf/resources/outline.js index 92e764370..5b39025b8 100644 --- a/extensions/exconf/resources/outline.js +++ b/extensions/exconf/resources/outline.js @@ -1,15 +1,19 @@ +/** + * @copyright Copyright (c) 2014, {@link http://aksw.org AKSW} + * @license http://opensource.org/licenses/gpl-license.php GNU General Public License (GPL) + */ $(document).ready(function() { extensionOutline(); }); function extensionOutline() { - target=$('div.outline').empty(); - target=target.append('
    ').children('ol'); - + var target = $('div.outline').empty(); + target = target.append('
      ').children('ol'); + var even = true; $('div.extension:visible').each(function(){ - title=$(this).find('.name').text(); - id=$(this).attr('id'); + var title = $(this).find('.name').text(); + var id = $(this).attr('id'); if(even){ target.append('
    1. ' +title+ '
    2. '); } else { diff --git a/extensions/exconf/resources/togglebutton.css b/extensions/exconf/resources/togglebutton.css index ddc072a98..f349f8dd8 100644 --- a/extensions/exconf/resources/togglebutton.css +++ b/extensions/exconf/resources/togglebutton.css @@ -1,11 +1,10 @@ -/* - Document : togglebutton - Created on : 21.08.205, 21:39:53 - Author : jonas - Description: - style for the jquery.togglebutton plugin -*/ - +/** + * Style for the jquery.togglebutton plugin. + * @copyright Copyright (c) 2014, {@link http://aksw.org AKSW} + * @license http://opensource.org/licenses/gpl-license.php GNU General Public License (GPL) + * @author jonas + * @since 21.08.205, 21:39:53 + */ .togglebutton { border: none; background: transparent; diff --git a/extensions/filter/resources/FilterAPI.js b/extensions/filter/resources/FilterAPI.js index 93306eb78..cd070345e 100644 --- a/extensions/filter/resources/FilterAPI.js +++ b/extensions/filter/resources/FilterAPI.js @@ -1,162 +1,163 @@ /** * @class + * @copyright Copyright (c) 2014, {@link http://aksw.org AKSW} + * @license http://opensource.org/licenses/gpl-license.php GNU General Public License (GPL) */ function FilterAPI(){ - /* - * @var - */ - this.uri = reloadUrl; - /* - *@var array - */ - this.callbacks = new Array(); - - /** - * @var array - */ - this.filters = filtersFromSession; - - /** - * @var int - */ - this.count = 0; - for(onefilter in filtersFromSession){ - this.count++; - } + /* + * @var + */ + + this.uri = reloadUrl; + /* + *@var array + */ + + this.callbacks = new Array(); + /** + * @var array + */ + this.filters = filtersFromSession; + + /** + * @var int + */ + this.count = 0; + for(onefilter in filtersFromSession){ + this.count++; + } + + /** + *@method + * + */ + this.addCallback = function(callback){ + if(typeof callback == 'function' || typeof callback == 'object') + this.callbacks.push(callback); + }; + + /** + *@method + * + */ + this.removeAllFiltersOfProperty = function(uri){ + var data = { filter: [] } + for(afilterName in this.filters){ + if(this.filters[afilterName].property == uri){ + data.filter.push({ + "mode" : "box", + "action" : "remove", + "id" : this.filters[afilterName].id + }) + } + } + var dataserialized = $.toJSON(data); + var url = this.uri + "?instancesconfig=" + encodeURIComponent(dataserialized)+"&list="+listName; + //alert(dataserialized) + window.location = url; + }; + + /** + * add a filter + * @method + * @param id int,string + * @param property string an iri (predicate) which values should be filtered + * @param isInverse boolean if the property is inverse + * @param propertyLabel string a label for the property (will be displayed instead) + * @param filter string can be "contains" or "equals" . going to be enhanced + * @param value1 mixed the value applied to the filter + * @param value2 mixed the value applied to the filter. often optional (used for "between") + * @param valuetype string may be "uri" or "literal" or "typedliteral" or "langtaggedliteral" + * @param literaltype string if valuetype is "typedliteral" or "langtaggedliteral": you can put stuff like "de" or "xsd:int" here... + * @param callback function will be called on success + * @param hidden boolean will not show up in filterbox if true + * @param negate + * @param dontReload prevent page reloading + */ + this.add = function(id, property, isInverse, propertyLabel, filter, value1, value2, valuetype, literaltype, callback, hidden, negate, dontReload){ + if(typeof callback != 'function' && typeof callback != 'object'){ + callback = function(){}; + } - /** - *@method - * - */ - this.addCallback = function(callback){ - if(typeof callback == 'function' || typeof callback == 'object') - this.callbacks.push(callback); - }; - - /** - *@method - * - */ - this.removeAllFiltersOfProperty = function(uri){ - var data = { filter: [] } - for(afilterName in this.filters){ - if(this.filters[afilterName].property == uri){ - data.filter.push({ + if(id == null){ + id = "filterbox"+this.count + } + var data = + { + filter: + [ + { "mode" : "box", - "action" : "remove", - "id" : this.filters[afilterName].id - }) - } - } - var dataserialized = $.toJSON(data); - var url = this.uri + "?instancesconfig=" + encodeURIComponent(dataserialized)+"&list="+listName; - //alert(dataserialized) - window.location = url; + "action" : "add", + "id" : id, + "property" : property, + "isInverse" : typeof isInverse != 'undefined' ? isInverse : false, + "propertyLabel" : typeof propertyLabel != 'undefined' ? propertyLabel : null, + "filter" : filter, + "value1": value1, + "value2": typeof value2 != 'undefined' ? value2 : null, + "valuetype": typeof valuetype != 'undefined' ? valuetype : null, + "literaltype" : typeof literaltype != 'undefined' ? literaltype : null, + "hidden" : typeof hidden != 'undefined' ? hidden : false, + "negate" : typeof negate != 'undefined' ? negate : false + } + ] }; - /** - * add a filter - * @method - * @param id int,string - * @param property string an iri (predicate) which values should be filtered - * @param isInverse boolean if the property is inverse - * @param propertyLabel string a label for the property (will be displayed instead) - * @param filter string can be "contains" or "equals" . going to be enhanced - * @param value1 mixed the value applied to the filter - * @param value2 mixed the value applied to the filter. often optional (used for "between") - * @param valuetype string may be "uri" or "literal" or "typedliteral" or "langtaggedliteral" - * @param literaltype string if valuetype is "typedliteral" or "langtaggedliteral": you can put stuff like "de" or "xsd:int" here... - * @param callback function will be called on success - * @param hidden boolean will not show up in filterbox if true - * @param negate - * @param dontReload prevent page reloading - */ - this.add = function(id, property, isInverse, propertyLabel, filter, value1, value2, valuetype, literaltype, callback, hidden, negate, dontReload){ - if(typeof callback != 'function' && typeof callback != 'object'){ - callback = function(){}; - } + var dataserialized = $.toJSON(data); + var url = this.uri + "?instancesconfig=" + encodeURIComponent(dataserialized)+"&list="+listName; - if(id == null){ - id = "filterbox"+this.count - } - var data = - { - filter: - [ - { - "mode" : "box", - "action" : "add", - "id" : id, - "property" : property, - "isInverse" : typeof isInverse != 'undefined' ? isInverse : false, - "propertyLabel" : typeof propertyLabel != 'undefined' ? propertyLabel : null, - "filter" : filter, - "value1": value1, - "value2": typeof value2 != 'undefined' ? value2 : null, - "valuetype": typeof valuetype != 'undefined' ? valuetype : null, - "literaltype" : typeof literaltype != 'undefined' ? literaltype : null, - "hidden" : typeof hidden != 'undefined' ? hidden : false, - "negate" : typeof negate != 'undefined' ? negate : false - } - ] - }; - - var dataserialized = $.toJSON(data); - var url = this.uri + "?instancesconfig=" + encodeURIComponent(dataserialized)+"&list="+listName; - - this.count++; - - if(dontReload == true){ - $.ajax( - { - "url": url, - "type" : "POST" - } - ); - } else { - window.location = url; - } - }; + this.count++; - this.reloadInstances = function(){ - //$('.content .innercontent').load(document.URL); - //window.location = this.uri; - }; - - this.filterExists = function(id){ - return (typeof this.filters[id] != 'undefined'); + if(dontReload == true){ + $.ajax( + { + "url": url, + "type" : "POST" + } + ); + } else { + window.location = url; } + }; - this.getFilterById = function(id){ - return this.filters[id]; - } + this.reloadInstances = function(){ + //$('.content .innercontent').load(document.URL); + //window.location = this.uri; + }; + this.filterExists = function(id){ + return (typeof this.filters[id] != 'undefined'); + } - this.remove = function(id, callback){ - if(typeof callback != 'function' && typeof callback != 'object') - callback = function(){}; + this.getFilterById = function(id){ + return this.filters[id]; + } - var data = { - filter: [ - { - "action" : "remove", - "id" : id - } - ] - }; + this.remove = function(id, callback){ + if(typeof callback != 'function' && typeof callback != 'object') + callback = function(){}; + + var data = { + filter: [ + { + "action" : "remove", + "id" : id + } + ] + }; - var dataserialized = $.toJSON(data); + var dataserialized = $.toJSON(data); - this.count--; - - window.location = this.uri + "?instancesconfig=" + encodeURIComponent(dataserialized); - }; + this.count--; + window.location = this.uri + "?instancesconfig=" + encodeURIComponent(dataserialized); + }; - this.removeAll = function(){ - this.count = 0; - window.location = this.uri+"?init" - }; + this.removeAll = function(){ + this.count = 0; + window.location = this.uri+"?init" + }; } var filter = new FilterAPI(); \ No newline at end of file diff --git a/extensions/filter/resources/filter.css b/extensions/filter/resources/filter.css index d3c998ba6..6cd9e9adf 100644 --- a/extensions/filter/resources/filter.css +++ b/extensions/filter/resources/filter.css @@ -1,3 +1,7 @@ +/** + * @copyright Copyright (c) 2014, {@link http://aksw.org AKSW} + * @license http://opensource.org/licenses/gpl-license.php GNU General Public License (GPL) + */ #cancelrestrictionbutton { color: red; } diff --git a/extensions/filter/resources/filter.js b/extensions/filter/resources/filter.js index 4a371aacc..48db7c2f2 100644 --- a/extensions/filter/resources/filter.js +++ b/extensions/filter/resources/filter.js @@ -1,3 +1,8 @@ +/* + * @copyright Copyright (c) 2012, {@link http://aksw.org AKSW} + * @license http://opensource.org/licenses/gpl-license.php GNU General Public License (GPL) + */ + var filterboxcounter = 0; // dont overwrite previous filters function showAddFilterBox(){ diff --git a/extensions/filter/resources/jquery.dump.js b/extensions/filter/resources/jquery.dump.js index 43a05a4e7..851ab6cf5 100644 --- a/extensions/filter/resources/jquery.dump.js +++ b/extensions/filter/resources/jquery.dump.js @@ -1,301 +1,305 @@ +/** + * @copyright Copyright (c) 2014, {@link http://aksw.org AKSW} + * @license http://opensource.org/licenses/gpl-license.php GNU General Public License (GPL) + */ jQuery.fn.dump = function(showTypes, showAttributes) { - jQuery.dump($(this), showTypes, showAttributes); - return this; + jQuery.dump($(this), showTypes, showAttributes); + return this; }; jQuery.dump = function(object, showTypes, showAttributes) { - var dump = ''; - var st = typeof showTypes == 'undefined' ? true : showTypes; - var sa = typeof showAttributes == 'undefined' ? true : showAttributes; - var winName = 'dumpWin'; - var w = 760; - var h = 500; - var leftPos = screen.width ? (screen.width - w) / 2 : 0; - var topPos = screen.height ? (screen.height - h) / 2 : 0; - var settings = 'height=' + h + ',width=' + w + ',top=' + topPos + ',left=' + leftPos + ',scrollbars=yes,menubar=yes,status=yes,resizable=yes'; - var title = 'Dump'; - var script = 'function tRow(s) {t = s.parentNode.lastChild;tTarget(t, tSource(s)) ;}function tTable(s) {var switchToState = tSource(s) ;var table = s.parentNode.parentNode;for (var i = 1; i < table.childNodes.length; i++) {t = table.childNodes[i] ;if (t.style) {tTarget(t, switchToState);}}}function tSource(s) {if (s.style.fontStyle == "italic" || s.style.fontStyle == null) {s.style.fontStyle = "normal";s.title = "click to collapse";return "open";} else {s.style.fontStyle = "italic";s.title = "click to expand";return "closed" ;}}function tTarget (t, switchToState) {if (switchToState == "open") {t.style.display = "";} else {t.style.display = "none";}}'; - - var _recurse = function (o, type) { - var i; - var j = 0; - var r = ''; - type = _dumpType(o); - switch (type) { - case 'regexp': - var t = type; - r += '
'; - r += 'RegExp: ' + o + ''; - j++; - break; - case 'date': - var t = type; - r += '' + t + ''; - r += 'Date: ' + o + ''; - j++; - break; - case 'function': - var t = type; - var a = o.toString().match(/^.*function.*?\((.*?)\)/im); - var args = (a == null || typeof a[1] == 'undefined' || a[1] == '') ? 'none' : a[1]; - r += '' + t + ''; - r += 'Arguments: ' + args + 'Function: ' + o + ''; - j++; - break; - case 'domelement': - var t = type; - var attr = ''; - if (sa) { - for (i in o) {if (!/innerHTML|outerHTML/i.test(i)) {attr += i + ': ' + o[i] + '
';}} - } - r += '' + t + ''; - r += 'Node Name: ' + o.nodeName.toLowerCase() + ''; - r += 'Node Type: ' + o.nodeType + ''; - r += 'Node Value: ' + o.nodeValue + ''; - if (sa) { - r += 'Attributes: ' + attr + ''; - r += 'innerHTML: ' + o.innerHTML + ''; - if (typeof o.outerHTML != 'undefined') { - r += 'outerHTML: ' + o.outerHTML + ''; - } - } - j++; - break; - } - if (/object|array/.test(type)) { - for (i in o) { - var t = _dumpType(o[i]); - if (j < 1) { - r += '' + type + ''; - j++; - } - if (typeof o[i] == 'object' && o[i] != null) { - r += '' + i + (st ? ' [' + t + ']' : '') + '' + _recurse(o[i], t) + ''; - } else if (typeof o[i] == 'function') { - r += '' + i + (st ? ' [' + t + ']' : '') + '' + _recurse(o[i], t) + ''; - } else { - r += '' + i + (st ? ' [' + t + ']' : '') + '' + o[i] + ''; - } - } - } - if (j == 0) { - r += '' + type + ' [empty]'; - } - r += ''; - return r; - }; - var _dumpStyles = function(type, use) { - var r = ''; - var table = 'font-size:xx-small;font-family:verdana,arial,helvetica,sans-serif;cell-spacing:2px;'; - var th = 'font-size:xx-small;font-family:verdana,arial,helvetica,sans-serif;text-align:left;color: white;padding: 5px;vertical-align :top;cursor:hand;cursor:pointer;'; - var td = 'font-size:xx-small;font-family:verdana,arial,helvetica,sans-serif;vertical-align:top;padding:3px;'; - var thScript = 'onClick="tTable(this);" title="click to collapse"'; - var tdScript = 'onClick="tRow(this);" title="click to collapse"'; - switch (type) { - case 'string': - case 'number': - case 'boolean': - case 'undefined': - case 'object': - switch (use) { - case 'table': - r = ' style="' + table + 'background-color:#0000cc;"'; - break; - case 'th': - r = ' style="' + th + 'background-color:#4444cc;"' + thScript; - break; - case 'td-key': - r = ' style="' + td + 'background-color:#ccddff;cursor:hand;cursor:pointer;"' + tdScript; - break; - case 'td-value': - r = ' style="' + td + 'background-color:#fff;"'; - break; - } - break; - case 'array': - switch (use) { - case 'table': - r = ' style="' + table + 'background-color:#006600;"'; - break; - case 'th': - r = ' style="' + th + 'background-color:#009900;"' + thScript; - break; - case 'td-key': - r = ' style="' + td + 'background-color:#ccffcc;cursor:hand;cursor:pointer;"' + tdScript; - break; - case 'td-value': - r = ' style="' + td + 'background-color:#fff;"'; - break; - } - break; - case 'function': - switch (use) { - case 'table': - r = ' style="' + table + 'background-color:#aa4400;"'; - break; - case 'th': - r = ' style="' + th + 'background-color:#cc6600;"' + thScript; - break; - case 'td-key': - r = ' style="' + td + 'background-color:#fff;cursor:hand;cursor:pointer;"' + tdScript; - break; - case 'td-value': - r = ' style="' + td + 'background-color:#fff;"'; - break; - } - break; - case 'arguments': - switch (use) { - case 'table': - r = ' style="' + table + 'background-color:#dddddd;cell-spacing:3;"'; - break; - case 'td-key': - r = ' style="' + th + 'background-color:#eeeeee;color:#000000;cursor:hand;cursor:pointer;"' + tdScript; - break; - } - break; - case 'regexp': - switch (use) { - case 'table': - r = ' style="' + table + 'background-color:#CC0000;cell-spacing:3;"'; - break; - case 'th': - r = ' style="' + th + 'background-color:#FF0000;"' + thScript; - break; - case 'td-key': - r = ' style="' + th + 'background-color:#FF5757;color:#000000;cursor:hand;cursor:pointer;"' + tdScript; - break; - case 'td-value': - r = ' style="' + td + 'background-color:#fff;"'; - break; - } - break; - case 'date': - switch (use) { - case 'table': - r = ' style="' + table + 'background-color:#663399;cell-spacing:3;"'; - break; - case 'th': - r = ' style="' + th + 'background-color:#9966CC;"' + thScript; - break; - case 'td-key': - r = ' style="' + th + 'background-color:#B266FF;color:#000000;cursor:hand;cursor:pointer;"' + tdScript; - break; - case 'td-value': - r = ' style="' + td + 'background-color:#fff;"'; - break; - } - break; - case 'domelement': - case 'document': - case 'window': - switch (use) { - case 'table': - r = ' style="' + table + 'background-color:#FFCC33;cell-spacing:3;"'; - break; - case 'th': - r = ' style="' + th + 'background-color:#FFD966;"' + thScript; - break; - case 'td-key': - r = ' style="' + th + 'background-color:#FFF2CC;color:#000000;cursor:hand;cursor:pointer;"' + tdScript; - break; - case 'td-value': - r = ' style="' + td + 'background-color:#fff;"'; - break; - } - break; - } - return r; - }; - var _dumpType = function (obj) { - var t = typeof(obj); - if (t == 'function') { - var f = obj.toString(); - if ( ( /^\/.*\/[gi]??[gi]??$/ ).test(f)) { - return 'regexp'; - } else if ((/^\[object.*\]$/i ).test(f)) { - t = 'object' - } - } - if (t != 'object') { - return t; - } - switch (obj) { - case null: - return 'null'; - case window: - return 'window'; - case document: - return 'document'; - case window.event: - return 'event'; - } - if (window.event && (event.type == obj.type)) { - return 'event'; - } - var c = obj.constructor; - if (c != null) { - switch(c) { - case Array: - t = 'array'; - break; - case Date: - return 'date'; - case RegExp: - return 'regexp'; - case Object: - t = 'object'; - break; - case ReferenceError: - return 'error'; - default: - var sc = c.toString(); - var m = sc.match(/\s*function (.*)\(/); - if (m != null) { - return 'object'; - } - } - } - var nt = obj.nodeType; - if (nt != null) { - switch(nt) { - case 1: - return 'domelement'; - case 3: - return 'string'; - } + var dump = ''; + var st = typeof showTypes == 'undefined' ? true : showTypes; + var sa = typeof showAttributes == 'undefined' ? true : showAttributes; + var winName = 'dumpWin'; + var w = 760; + var h = 500; + var leftPos = screen.width ? (screen.width - w) / 2 : 0; + var topPos = screen.height ? (screen.height - h) / 2 : 0; + var settings = 'height=' + h + ',width=' + w + ',top=' + topPos + ',left=' + leftPos + ',scrollbars=yes,menubar=yes,status=yes,resizable=yes'; + var title = 'Dump'; + var script = 'function tRow(s) {t = s.parentNode.lastChild;tTarget(t, tSource(s)) ;}function tTable(s) {var switchToState = tSource(s) ;var table = s.parentNode.parentNode;for (var i = 1; i < table.childNodes.length; i++) {t = table.childNodes[i] ;if (t.style) {tTarget(t, switchToState);}}}function tSource(s) {if (s.style.fontStyle == "italic" || s.style.fontStyle == null) {s.style.fontStyle = "normal";s.title = "click to collapse";return "open";} else {s.style.fontStyle = "italic";s.title = "click to expand";return "closed" ;}}function tTarget (t, switchToState) {if (switchToState == "open") {t.style.display = "";} else {t.style.display = "none";}}'; + + var _recurse = function (o, type) { + var i; + var j = 0; + var r = ''; + type = _dumpType(o); + switch (type) { + case 'regexp': + var t = type; + r += '' + t + ''; + r += 'RegExp: ' + o + ''; + j++; + break; + case 'date': + var t = type; + r += '' + t + ''; + r += 'Date: ' + o + ''; + j++; + break; + case 'function': + var t = type; + var a = o.toString().match(/^.*function.*?\((.*?)\)/im); + var args = (a == null || typeof a[1] == 'undefined' || a[1] == '') ? 'none' : a[1]; + r += '' + t + ''; + r += 'Arguments: ' + args + 'Function: ' + o + ''; + j++; + break; + case 'domelement': + var t = type; + var attr = ''; + if (sa) { + for (i in o) {if (!/innerHTML|outerHTML/i.test(i)) {attr += i + ': ' + o[i] + '
';}} + } + r += '' + t + ''; + r += 'Node Name: ' + o.nodeName.toLowerCase() + ''; + r += 'Node Type: ' + o.nodeType + ''; + r += 'Node Value: ' + o.nodeValue + ''; + if (sa) { + r += 'Attributes: ' + attr + ''; + r += 'innerHTML: ' + o.innerHTML + ''; + if (typeof o.outerHTML != 'undefined') { + r += 'outerHTML: ' + o.outerHTML + ''; + } + } + j++; + break; + } + if (/object|array/.test(type)) { + for (i in o) { + var t = _dumpType(o[i]); + if (j < 1) { + r += '' + type + ''; + j++; + } + if (typeof o[i] == 'object' && o[i] != null) { + r += '' + i + (st ? ' [' + t + ']' : '') + '' + _recurse(o[i], t) + ''; + } else if (typeof o[i] == 'function') { + r += '' + i + (st ? ' [' + t + ']' : '') + '' + _recurse(o[i], t) + ''; + } else { + r += '' + i + (st ? ' [' + t + ']' : '') + '' + o[i] + ''; + } + } + } + if (j == 0) { + r += '' + type + ' [empty]'; + } + r += ''; + return r; + }; + var _dumpStyles = function(type, use) { + var r = ''; + var table = 'font-size:xx-small;font-family:verdana,arial,helvetica,sans-serif;cell-spacing:2px;'; + var th = 'font-size:xx-small;font-family:verdana,arial,helvetica,sans-serif;text-align:left;color: white;padding: 5px;vertical-align :top;cursor:hand;cursor:pointer;'; + var td = 'font-size:xx-small;font-family:verdana,arial,helvetica,sans-serif;vertical-align:top;padding:3px;'; + var thScript = 'onClick="tTable(this);" title="click to collapse"'; + var tdScript = 'onClick="tRow(this);" title="click to collapse"'; + switch (type) { + case 'string': + case 'number': + case 'boolean': + case 'undefined': + case 'object': + switch (use) { + case 'table': + r = ' style="' + table + 'background-color:#0000cc;"'; + break; + case 'th': + r = ' style="' + th + 'background-color:#4444cc;"' + thScript; + break; + case 'td-key': + r = ' style="' + td + 'background-color:#ccddff;cursor:hand;cursor:pointer;"' + tdScript; + break; + case 'td-value': + r = ' style="' + td + 'background-color:#fff;"'; + break; + } + break; + case 'array': + switch (use) { + case 'table': + r = ' style="' + table + 'background-color:#006600;"'; + break; + case 'th': + r = ' style="' + th + 'background-color:#009900;"' + thScript; + break; + case 'td-key': + r = ' style="' + td + 'background-color:#ccffcc;cursor:hand;cursor:pointer;"' + tdScript; + break; + case 'td-value': + r = ' style="' + td + 'background-color:#fff;"'; + break; + } + break; + case 'function': + switch (use) { + case 'table': + r = ' style="' + table + 'background-color:#aa4400;"'; + break; + case 'th': + r = ' style="' + th + 'background-color:#cc6600;"' + thScript; + break; + case 'td-key': + r = ' style="' + td + 'background-color:#fff;cursor:hand;cursor:pointer;"' + tdScript; + break; + case 'td-value': + r = ' style="' + td + 'background-color:#fff;"'; + break; + } + break; + case 'arguments': + switch (use) { + case 'table': + r = ' style="' + table + 'background-color:#dddddd;cell-spacing:3;"'; + break; + case 'td-key': + r = ' style="' + th + 'background-color:#eeeeee;color:#000000;cursor:hand;cursor:pointer;"' + tdScript; + break; + } + break; + case 'regexp': + switch (use) { + case 'table': + r = ' style="' + table + 'background-color:#CC0000;cell-spacing:3;"'; + break; + case 'th': + r = ' style="' + th + 'background-color:#FF0000;"' + thScript; + break; + case 'td-key': + r = ' style="' + th + 'background-color:#FF5757;color:#000000;cursor:hand;cursor:pointer;"' + tdScript; + break; + case 'td-value': + r = ' style="' + td + 'background-color:#fff;"'; + break; + } + break; + case 'date': + switch (use) { + case 'table': + r = ' style="' + table + 'background-color:#663399;cell-spacing:3;"'; + break; + case 'th': + r = ' style="' + th + 'background-color:#9966CC;"' + thScript; + break; + case 'td-key': + r = ' style="' + th + 'background-color:#B266FF;color:#000000;cursor:hand;cursor:pointer;"' + tdScript; + break; + case 'td-value': + r = ' style="' + td + 'background-color:#fff;"'; + break; + } + break; + case 'domelement': + case 'document': + case 'window': + switch (use) { + case 'table': + r = ' style="' + table + 'background-color:#FFCC33;cell-spacing:3;"'; + break; + case 'th': + r = ' style="' + th + 'background-color:#FFD966;"' + thScript; + break; + case 'td-key': + r = ' style="' + th + 'background-color:#FFF2CC;color:#000000;cursor:hand;cursor:pointer;"' + tdScript; + break; + case 'td-value': + r = ' style="' + td + 'background-color:#fff;"'; + break; + } + break; } - if (obj.toString != null) { - var ex = obj.toString(); - var am = ex.match(/^\[object (.*)\]$/i); - if (am != null) { - var am = am[1]; - switch(am.toLowerCase()) { - case 'event': + return r; + }; + var _dumpType = function (obj) { + var t = typeof(obj); + if (t == 'function') { + var f = obj.toString(); + if ( ( /^\/.*\/[gi]??[gi]??$/ ).test(f)) { + return 'regexp'; + } else if ((/^\[object.*\]$/i ).test(f)) { + t = 'object' + } + } + if (t != 'object') { + return t; + } + switch (obj) { + case null: + return 'null'; + case window: + return 'window'; + case document: + return 'document'; + case window.event: + return 'event'; + } + if (window.event && (event.type == obj.type)) { return 'event'; - case 'nodelist': - case 'htmlcollection': - case 'elementarray': - return 'array'; - case 'htmldocument': - return 'htmldocument'; } - } + var c = obj.constructor; + if (c != null) { + switch(c) { + case Array: + t = 'array'; + break; + case Date: + return 'date'; + case RegExp: + return 'regexp'; + case Object: + t = 'object'; + break; + case ReferenceError: + return 'error'; + default: + var sc = c.toString(); + var m = sc.match(/\s*function (.*)\(/); + if (m != null) { + return 'object'; + } + } + } + var nt = obj.nodeType; + if (nt != null) { + switch(nt) { + case 1: + return 'domelement'; + case 3: + return 'string'; + } + } + if (obj.toString != null) { + var ex = obj.toString(); + var am = ex.match(/^\[object (.*)\]$/i); + if (am != null) { + var am = am[1]; + switch(am.toLowerCase()) { + case 'event': + return 'event'; + case 'nodelist': + case 'htmlcollection': + case 'elementarray': + return 'array'; + case 'htmldocument': + return 'htmldocument'; + } + } + } + return t; + }; + dump += (/string|number|undefined|boolean/.test(typeof(object)) || object == null) ? object : _recurse(object, typeof object); + winName = window.open('', '', settings); + if (jQuery.browser.msie || jQuery.browser.browser == 'opera' || jQuery.browser.browser == 'safari') { + winName.document.write(' ' + title + ' '); + winName.document.write('' + dump + ''); + } else { + winName.document.body.innerHTML = dump; + winName.document.title = title; + var ffs = winName.document.createElement('script'); + ffs.setAttribute('type', 'text/javascript'); + ffs.appendChild(document.createTextNode(script)); + winName.document.getElementsByTagName('head')[0].appendChild(ffs); } - return t; - }; - dump += (/string|number|undefined|boolean/.test(typeof(object)) || object == null) ? object : _recurse(object, typeof object); - winName = window.open('', '', settings); - if (jQuery.browser.msie || jQuery.browser.browser == 'opera' || jQuery.browser.browser == 'safari') { - winName.document.write(' ' + title + ' '); - winName.document.write('' + dump + ''); - } else { - winName.document.body.innerHTML = dump; - winName.document.title = title; - var ffs = winName.document.createElement('script'); - ffs.setAttribute('type', 'text/javascript'); - ffs.appendChild(document.createTextNode(script)); - winName.document.getElementsByTagName('head')[0].appendChild(ffs); - } - winName.focus(); + winName.focus(); }; \ No newline at end of file diff --git a/extensions/listmodules/showproperties.js b/extensions/listmodules/showproperties.js index 3366d1138..df35a39de 100644 --- a/extensions/listmodules/showproperties.js +++ b/extensions/listmodules/showproperties.js @@ -1,12 +1,16 @@ +/** + * @copyright Copyright (c) 2014, {@link http://aksw.org AKSW} + * @license http://opensource.org/licenses/gpl-license.php GNU General Public License (GPL) + */ $(document).ready(function() { //Set up drag- and drop-functionality $('.show-property').draggable({ - scope: 'Resource', - helper: 'clone', - zIndex: 10000, - scroll: false, - appendTo: 'body' - }); + scope: 'Resource', + helper: 'clone', + zIndex: 10000, + scroll: false, + appendTo: 'body' +}); // highlight previously selected properties $('.show-property').each(function() { @@ -16,29 +20,25 @@ $(document).ready(function() { } else { var pos = $.inArray(propUri, shownInverseProperties); } - if (pos > -1) { $(this).addClass('selected'); } }) + function handleNewSelect() { var propUri = $(this).attr('about'); $(this).toggleClass('selected'); var action = $(this).hasClass('selected')? "add" : "remove"; - var inverse = $(this).hasClass('InverseProperty'); - var label = $(this).attr("title"); - var data = { shownProperties : [{ - "uri" : propUri, - "label" : label, - "action" : action, - "inverse" : inverse - }] - }; - + "uri" : propUri, + "label" : label, + "action" : action, + "inverse" : inverse + }]}; + var serialized = $.toJSON(data); // //reload page @@ -57,7 +57,6 @@ $(document).ready(function() { $('body').trigger('ontowiki.resource-list.reloaded'); showPropertiesAddDroppableToListTable(); }); - }; function showPropertiesAddDroppableToListTable() { @@ -69,10 +68,9 @@ $(document).ready(function() { drop: function(event, ui) {$(ui.draggable).each(handleNewSelect);} }); - } - + } + //set click handler for the properties $('.show-property').click(handleNewSelect); - showPropertiesAddDroppableToListTable(); }) diff --git a/extensions/modellist/modellist.js b/extensions/modellist/modellist.js index 6925156c5..a702fbd22 100644 --- a/extensions/modellist/modellist.js +++ b/extensions/modellist/modellist.js @@ -1,3 +1,7 @@ +/** + * @copyright Copyright (c) 2014, {@link http://aksw.org AKSW} + * @license http://opensource.org/licenses/gpl-license.php GNU General Public License (GPL) + */ $(document).ready(function() { $('.modellist_hidden_button').livequery('click', function() { if ($(this).hasClass('show')) { @@ -24,17 +28,17 @@ function updateModellistModule() $('.contextmenu-enhanced .contextmenu').fadeOut(effectTime, function(){ $(this).remove(); }) - + var options = { url: urlBase + 'module/get/name/modellist/id/modellist' }; - + $.get(options.url, function(data) { $('#modellist').replaceWith(data); $('#modellist').addClass('has-contextmenus-block') .addClass('windowbuttonscount-right-1') .addClass('windowbuttonscount-left-1'); - + $('#modellist').enhanceWindow(); }); } diff --git a/extensions/navigation/navigation.css b/extensions/navigation/navigation.css index caec7ccbd..b151e0a6a 100644 --- a/extensions/navigation/navigation.css +++ b/extensions/navigation/navigation.css @@ -1,3 +1,7 @@ +/* + * @copyright Copyright (c) 2014, {@link http://aksw.org AKSW} + * @license http://opensource.org/licenses/gpl-license.php GNU General Public License (GPL) + */ .content h2.navRoot { font-size:1em; @@ -21,12 +25,28 @@ } #navigation .icon.icon-arrow-previous { background-image:url(icon-previous.png); width:12px; } + #navigation .icon.icon-arrow-first { background-image:url(icon-first.png); width:8px; } #navigation .navRoot.fancybuttons .icon.icon-arrow-previous -{ background-color:#999; width:1.2em; height:1.2em; -moz-border-radius:0.6em; border-radius:0.6em; position:relative; left:-0.25em; } +{ + background-color:#999; + width:1.2em; + height:1.2em; + -moz-border-radius:0.6em; + border-radius:0.6em; + position:relative; + left:-0.25em; +} + #navigation .navRoot.fancybuttons .icon.icon-arrow-first -{ background-color:#bbb; width:0.9em; height:0.9em; -moz-border-radius:0.45em; border-radius:0.45em; } +{ + background-color:#bbb; + width:0.9em; + height:0.9em; + -moz-border-radius:0.45em; + border-radius:0.45em; +} /* set contextmenu more left */ #navigation .has-contextmenus-block li a:hover span.button diff --git a/extensions/queries/resources/querieseditor.css b/extensions/queries/resources/querieseditor.css index 8ca5f2422..bbe75d108 100644 --- a/extensions/queries/resources/querieseditor.css +++ b/extensions/queries/resources/querieseditor.css @@ -1,3 +1,7 @@ +/** + * @copyright Copyright (c) 2014, {@link http://aksw.org AKSW} + * @license http://opensource.org/licenses/gpl-license.php GNU General Public License (GPL) + */ .configModules { clear: left; } diff --git a/extensions/queries/resources/savepartial.js b/extensions/queries/resources/savepartial.js index 9644bc05a..9f3d3bfa3 100644 --- a/extensions/queries/resources/savepartial.js +++ b/extensions/queries/resources/savepartial.js @@ -1,74 +1,78 @@ +/** + * @copyright Copyright (c) 2014, {@link http://aksw.org AKSW} + * @license http://opensource.org/licenses/gpl-license.php GNU General Public License (GPL) + */ $(document).ready(function() { - $("#savequerybutton").click(function(){ - var box = $("#editortype"); - if(box.val() == "querybuilder"){ - $.get(urlBase+"querybuilder/updatesparql", {json: $('#hidden_json').val() , limit: $("#limit").val()}, function(query){ - $.ajax({ - url: urlBase + "queries/savequery", - type: "POST", - data: ({ - json: $('#hidden_json').val(), - name: $('#qname').val(), - qdesc: $('#qdesc').val(), - "query": query, - generator: "qb", - share: $("#savequerysharecheckbox").is(':checked') ? "true" : "false" - }), - dataType: "text", - success: function(msg){ - //TODO check for status - if(msg != "All OK") - alert("Fehler "+msg); - //open(urlBase + "querybuilding/listquery"); - } - }); + $("#savequerybutton").click(function(){ + var box = $("#editortype"); + if(box.val() == "querybuilder"){ + $.get(urlBase+"querybuilder/updatesparql", {json: $('#hidden_json').val() , limit: $("#limit").val()}, function(query){ + $.ajax({ + url: urlBase + "queries/savequery", + type: "POST", + data: ({ + json: $('#hidden_json').val(), + name: $('#qname').val(), + qdesc: $('#qdesc').val(), + "query": query, + generator: "qb", + share: $("#savequerysharecheckbox").is(':checked') ? "true" : "false" + }), + dataType: "text", + success: function(msg){ + //TODO check for status + if(msg != "All OK") + alert("Fehler "+msg); + //open(urlBase + "querybuilding/listquery"); + } + }); - }); + }); - } else if(box.val() == "graphicalquerybuilder"){ - if (!GQB.view.selectedViewClass) {alert(GQB.translate("noPatternSelMsg"));return;} - var modelPattern = GQB.view.selectedViewClass.parentViewPattern.modelPattern; - if (!modelPattern) return; // sollte nicht passieren, ist schwerer Fehler - modelPattern.name = $('#qname').val(); - modelPattern.description= $('#qdesc').val(); - modelPattern.save(); + } else if(box.val() == "graphicalquerybuilder"){ + if (!GQB.view.selectedViewClass) {alert(GQB.translate("noPatternSelMsg"));return;} + var modelPattern = GQB.view.selectedViewClass.parentViewPattern.modelPattern; + if (!modelPattern) return; // sollte nicht passieren, ist schwerer Fehler + modelPattern.name = $('#qname').val(); + modelPattern.description= $('#qdesc').val(); + modelPattern.save(); - } else if(box.val() == "queryeditor"){ - $.ajax({ - url: urlBase + "queries/savequery", - type: "POST", - data: ({ - json: "", - name: $('#qname').val(), - "query": editor.getValue(), - generator: "qe", - //share: $("#savequerysharecheckbox").is(':checked') ? "true" : "false" - share: "true" - }), - dataType: "text", - error: function(xmlHttpObj, type, error){ - alert ("error"); - }, - success: function(msg){ - //TODO check for status - if (msg != "All OK") { - alert("Fehler " + msg); - } else { - $('.innercontent').prepend("

The Query was saved

"); - - setTimeout(function (){ - $("#savequerynotification").remove(); - }, 5000); - } - //open(urlBase + "querybuilding/listquery"); - } - }); - } else { - alert("error: dont know which builder this is"); - } - - - - }); - $('#qname').innerLabel(); + } else if(box.val() == "queryeditor"){ + $.ajax({ + url: urlBase + "queries/savequery", + type: "POST", + data: ({ + json: "", + name: $('#qname').val(), + "query": editor.getValue(), + generator: "qe", + //share: $("#savequerysharecheckbox").is(':checked') ? "true" : "false" + share: "true" + }), + dataType: "text", + error: function(xmlHttpObj, type, error){ + alert ("error"); + }, + success: function(msg){ + //TODO check for status + if (msg != "All OK") { + alert("Fehler " + msg); + } else { + $('.innercontent').prepend("

The Query was saved

"); + + setTimeout(function (){ + $("#savequerynotification").remove(); + }, 5000); + } + //open(urlBase + "querybuilding/listquery"); + } + }); + } else { + alert("error: dont know which builder this is"); + } + + + + }); + $('#qname').innerLabel(); }); \ No newline at end of file diff --git a/extensions/themes/darkorange/styles/default.css b/extensions/themes/darkorange/styles/default.css index 02405b86a..6486cdd49 100644 --- a/extensions/themes/darkorange/styles/default.css +++ b/extensions/themes/darkorange/styles/default.css @@ -3,8 +3,10 @@ * OntoWiki Extra Styles * DARK ORANGE * - * @depends OntoWiki Silverblue Theme - * @author http://michael.haschke.biz/ + * @depends OntoWiki Silverblue Theme + * @author http://michael.haschke.biz/ + * @copyright Copyright (c) 2014, {@link http://aksw.org AKSW} + * @license http://opensource.org/licenses/gpl-license.php GNU General Public License (GPL) * *************************************************************************/ diff --git a/extensions/themes/silverblue/scripts/main.js b/extensions/themes/silverblue/scripts/main.js index c3edd3541..22ad030b6 100644 --- a/extensions/themes/silverblue/scripts/main.js +++ b/extensions/themes/silverblue/scripts/main.js @@ -1,3 +1,9 @@ +/** + * + * @copyright Copyright (c) 2014, {@link http://aksw.org AKSW} + * @license http://opensource.org/licenses/gpl-license.php GNU General Public License (GPL) + */ + // namespace for script variables var OntoWiki = {}; diff --git a/extensions/themes/silverblue/scripts/serialize-php.js b/extensions/themes/silverblue/scripts/serialize-php.js index 598a4e442..1e7121301 100644 --- a/extensions/themes/silverblue/scripts/serialize-php.js +++ b/extensions/themes/silverblue/scripts/serialize-php.js @@ -1,3 +1,8 @@ +/** + * @copyright Copyright (c) 2014, {@link http://aksw.org AKSW} + * @license http://opensource.org/licenses/gpl-license.php GNU General Public License (GPL) + */ + function serialize (mixed_value) { // Returns a string representation of variable (which can later be unserialized by php) // diff --git a/extensions/themes/silverblue/scripts/support.js b/extensions/themes/silverblue/scripts/support.js index ed8c89598..a026e48f3 100644 --- a/extensions/themes/silverblue/scripts/support.js +++ b/extensions/themes/silverblue/scripts/support.js @@ -3,7 +3,7 @@ * This file is part of the {@link http://ontowiki.net OntoWiki} project. * * @copyright Copyright (c) 2009, {@link http://aksw.org AKSW} - * @license http://opensource.org/licenses/gpl-license.php GNU General Public License (GPL) + * @license http://opensource.org/licenses/gpl-license.php GNU General Public License (GPL) */ /** diff --git a/extensions/themes/silverblue/styles/clickmenu.css b/extensions/themes/silverblue/styles/clickmenu.css index 00c25ee80..8c583ea34 100644 --- a/extensions/themes/silverblue/styles/clickmenu.css +++ b/extensions/themes/silverblue/styles/clickmenu.css @@ -1,3 +1,8 @@ +/** + * @copyright Copyright (c) 2014, {@link http://aksw.org AKSW} + * @license http://opensource.org/licenses/gpl-license.php GNU General Public License (GPL) + */ + div.cmDiv { /* border-top: 1px solid #000;*/ border-bottom: 0.1em solid #ddd; diff --git a/extensions/themes/silverblue/styles/default.css b/extensions/themes/silverblue/styles/default.css index aff3f467b..1b495abaf 100644 --- a/extensions/themes/silverblue/styles/default.css +++ b/extensions/themes/silverblue/styles/default.css @@ -1,7 +1,10 @@ /** - * default.css - * Ontowiki main style sheet, advanced theme - * @author: http://michael.haschke.biz/ + * default.css + * Ontowiki main style sheet, advanced theme + * @author http://michael.haschke.biz/ + * @copyright Copyright (c) 2014, {@link http://aksw.org AKSW} + * @license http://opensource.org/licenses/gpl-license.php GNU General Public License (GPL) + * CONTENT diff --git a/extensions/themes/silverblue/styles/default.dev.css b/extensions/themes/silverblue/styles/default.dev.css index 985a03507..9ab2d8063 100644 --- a/extensions/themes/silverblue/styles/default.dev.css +++ b/extensions/themes/silverblue/styles/default.dev.css @@ -1,12 +1,15 @@ /** - * default.dev.css - * Ontowiki developer/experimental style sheet, advanced theme - * - * ATTENTION, since this file contains of development styles, it only included in - * debug mode. See more infos on CSS Development on - * http://code.google.com/p/ontowiki/wiki/CSSDevelopment - * - */ + * default.dev.css + * Ontowiki developer/experimental style sheet, advanced theme + * + * @copyright Copyright (c) 2014, {@link http://aksw.org AKSW} + * @license http://opensource.org/licenses/gpl-license.php GNU General Public License (GPL) + * + * ATTENTION, since this file contains of development styles, it only included in + * debug mode. See more infos on CSS Development on + * http://code.google.com/p/ontowiki/wiki/CSSDevelopment + * + */ /* form stuff ****************************************************************/ diff --git a/extensions/themes/silverblue/styles/deprecated.dev.css b/extensions/themes/silverblue/styles/deprecated.dev.css index d5c4e23b8..ebcba77ba 100644 --- a/extensions/themes/silverblue/styles/deprecated.dev.css +++ b/extensions/themes/silverblue/styles/deprecated.dev.css @@ -1,14 +1,16 @@ /** - * deprecated.dev.css - * - * - it makes deprecated gui elements visible - * - should be only included in development environments - * - * @see http://code.google.com/p/ontowiki/wiki/CSSDevelopment - * - * @since 0.9.5 - * @author Michael Haschke - */ + * deprecated.dev.css + * + * - it makes deprecated gui elements visible + * - should be only included in development environments + * + * @see http://code.google.com/p/ontowiki/wiki/CSSDevelopment + * @since 0.9.5 + * @author Michael Haschke + * @copyright Copyright (c) 2014, {@link http://aksw.org AKSW} + * @license http://opensource.org/licenses/gpl-license.php GNU General Public License (GPL) + * + */ diff --git a/extensions/themes/silverblue/styles/old.css b/extensions/themes/silverblue/styles/old.css index c42ed1ad6..43b9162e3 100644 --- a/extensions/themes/silverblue/styles/old.css +++ b/extensions/themes/silverblue/styles/old.css @@ -1,3 +1,7 @@ +/** + * @copyright Copyright (c) 2014, {@link http://aksw.org AKSW} + * @license http://opensource.org/licenses/gpl-license.php GNU General Public License (GPL) + */ table * { vertical-align: top; } diff --git a/extensions/themes/silverblue/styles/patches/ie6.clickmenu.css b/extensions/themes/silverblue/styles/patches/ie6.clickmenu.css index c2286ade0..80375c939 100644 --- a/extensions/themes/silverblue/styles/patches/ie6.clickmenu.css +++ b/extensions/themes/silverblue/styles/patches/ie6.clickmenu.css @@ -1,3 +1,7 @@ +/** + * @copyright Copyright (c) 2014, {@link http://aksw.org AKSW} + * @license http://opensource.org/licenses/gpl-license.php GNU General Public License (GPL) + */ .clickMenu ul { float: left; width: 100%; diff --git a/extensions/themes/silverblue/styles/patches/ie6.css b/extensions/themes/silverblue/styles/patches/ie6.css index bf428b30f..a14ed6f39 100644 --- a/extensions/themes/silverblue/styles/patches/ie6.css +++ b/extensions/themes/silverblue/styles/patches/ie6.css @@ -1,3 +1,7 @@ +/** + * @copyright Copyright (c) 2014, {@link http://aksw.org AKSW} + * @license http://opensource.org/licenses/gpl-license.php GNU General Public License (GPL) + */ /* Zoom it, baby! (and give layout to elements) */ diff --git a/extensions/themes/silverblue/styles/patches/ie7.css b/extensions/themes/silverblue/styles/patches/ie7.css index 8f185493b..956b93d68 100644 --- a/extensions/themes/silverblue/styles/patches/ie7.css +++ b/extensions/themes/silverblue/styles/patches/ie7.css @@ -1,3 +1,8 @@ +/** + * @copyright Copyright (c) 2014, {@link http://aksw.org AKSW} + * @license http://opensource.org/licenses/gpl-license.php GNU General Public License (GPL) + */ + /* Tabs */ div.window .tabs { From 26a4129b4d9b654fc95d76cc0b5fe43302dda700 Mon Sep 17 00:00:00 2001 From: Andreas Nareike Date: Thu, 31 Jul 2014 14:42:20 +0200 Subject: [PATCH 089/482] Do an additional check if triples is existant The remove function of the jQuery.rdf library does not check if a triple that is to be removed is actually in the triplestore and will happily remove any triple if it's not the case. --- .../scripts/libraries/jquery.rdfquery.rdfa-1.0.js | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/extensions/themes/silverblue/scripts/libraries/jquery.rdfquery.rdfa-1.0.js b/extensions/themes/silverblue/scripts/libraries/jquery.rdfquery.rdfa-1.0.js index 1ddb82e71..afc6993cb 100644 --- a/extensions/themes/silverblue/scripts/libraries/jquery.rdfquery.rdfa-1.0.js +++ b/extensions/themes/silverblue/scripts/libraries/jquery.rdfquery.rdfa-1.0.js @@ -2668,7 +2668,11 @@ if (typeof triple === 'string') { triple = $.rdf.triple(triple, { namespaces: namespaces, base: base, source: triple }); } - this.tripleStore.splice($.inArray(triple, this.tripleStore), 1); + var pos = $.inArray(triple, this.tripleStore); + if (pos === -1) { + return this; + } + this.tripleStore.splice(pos, 1); striples = this.subjectIndex[triple.subject]; if (striples !== undefined) { striples.splice($.inArray(triple, striples), 1); From 0a16b3f95e8414196fbc1d14eb60c5b916ad6fb8 Mon Sep 17 00:00:00 2001 From: Natanael Arndt Date: Wed, 13 Aug 2014 10:12:41 +0200 Subject: [PATCH 090/482] Fix #285. Forward Erfurt. --- libraries/Erfurt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/libraries/Erfurt b/libraries/Erfurt index 45ce14ec3..14c8046e4 160000 --- a/libraries/Erfurt +++ b/libraries/Erfurt @@ -1 +1 @@ -Subproject commit 45ce14ec38daef6e682cbc90d07f332754d27b00 +Subproject commit 14c8046e4377c72c8317bb800094830db66800df From f381c8f7abcd4d16aeb0781247564771ad500879 Mon Sep 17 00:00:00 2001 From: Natanael Arndt Date: Thu, 14 Aug 2014 18:24:12 +0200 Subject: [PATCH 091/482] Add initial ResourceJsonrpcAdapter --- extensions/jsonrpc/MetaJsonrpcAdapter.php | 1 + extensions/jsonrpc/ResourceJsonrpcAdapter.php | 178 ++++++++++++++++++ 2 files changed, 179 insertions(+) create mode 100644 extensions/jsonrpc/ResourceJsonrpcAdapter.php diff --git a/extensions/jsonrpc/MetaJsonrpcAdapter.php b/extensions/jsonrpc/MetaJsonrpcAdapter.php index fa878c32b..d4838e5a7 100644 --- a/extensions/jsonrpc/MetaJsonrpcAdapter.php +++ b/extensions/jsonrpc/MetaJsonrpcAdapter.php @@ -23,6 +23,7 @@ class MetaJsonrpcAdapter 'meta' => 'methods to query the json service itself', 'store' => 'methods to manipulate and query the store', 'model' => 'methods to manipulate and query a specific model', + 'resource' => 'methods to manipulate and query a specific resource', //'evolution' => 'methods to manage and use the evolution engine', ); diff --git a/extensions/jsonrpc/ResourceJsonrpcAdapter.php b/extensions/jsonrpc/ResourceJsonrpcAdapter.php new file mode 100644 index 000000000..874353b41 --- /dev/null +++ b/extensions/jsonrpc/ResourceJsonrpcAdapter.php @@ -0,0 +1,178 @@ +_store = Erfurt_App::getInstance()->getStore(); + $this->_erfurt = Erfurt_App::getInstance(); + $this->_config = $this->_erfurt->getConfig(); + } + + /** + * @desc get a resource as RDF/JSON + * + * @param string modelIri + * @param string resourceIri + * @param string format + * + * @return string + */ + public function get($modelIri, $resourceIri, $format = 'rdfjson') + { + if (!$this->_store->isModelAvailable($modelIri)) { + return 'Error: Model "' . $modelIri . '" is not available.'; + } + $editable = $this->_store->getModel($modelIri)->isEditable(); + $supportedFormats = Erfurt_Syntax_RdfSerializer::getSupportedFormats(); + if (!isset($supportedFormats[$format])) { + return 'Error: Format "' . $format . '" is not supported by serializer.'; + } + $serializer = Erfurt_Syntax_RdfSerializer::rdfSerializerWithFormat($format); + // create hash for current status of resource + $currentDataHash = $this->_getCurrentResourceHash($modelIri, $resourceIri); + $return = new stdClass(); + $return->dataHash = $currentDataHash; + $return->editable = $editable; + $return->data = $serializer->serializeResourceToString($resourceIri, $modelIri); + return $return; + } + + /** + * @desc update a modified resource + * + * @param string modelIri + * @param string resourceIri + * @param string data + * @param string format + * @param string origDataHash + * + * @return string + */ + public function update($modelIri, $resourceIri, $data, $origDataHash, $format = 'rdfjson') + { + $model = $this->_store->getModel($modelIri); + if (!$model->isEditable()) { + return 'Error: Model "' . $modelIri . '" is not available.'; + } + // TODO check for formats supported by the parser (not yet implemented) + + // calculate hash of current status and compare to commited hash + $currentDataHash = $this->_getCurrentResourceHash($modelIri, $resourceIri); + + if ($currentDataHash !== $origDataHash) { + return 'Error: Resource "' . $resourceIri . '" was edited during your session.'; + } + + // get current statements of resource + $resource = $model->getResource($resourceIri); + $originalStatements = $resource->getDescription(); + + // get new statements of resource + $parser = Erfurt_Syntax_RdfParser::rdfParserWithFormat($format); + $modifiedStatements = $parser->parse($data, Erfurt_Syntax_RdfParser::LOCATOR_DATASTRING); + + $model->updateWithMutualDifference($originalStatements, $modifiedStatements); + + return true; + } + + /** + * @desc counts the number of statements of a model + * + * @param string modelIri + * @param string whereSpec + * @param string countSpec + * + * @return string + */ + public function count($modelIri, $whereSpec = '{?s ?p ?o}', $countSpec = '*') + { + return $this->_store->countWhereMatches($modelIri, $whereSpec, $countSpec); + } + + /** + * @desc add all input statements to the model + * + * @param string $modelIri + * @param string $inputModel + * + * @return bool + */ + public function add($modelIri, $inputModel) + { + $model = $this->_store->getModel($modelIri); + $versioning = $this->_erfurt->getVersioning(); + $actionSpec = array(); + $actionSpec['type'] = 80201; + $actionSpec['modeluri'] = (string)$model; + $actionSpec['resourceuri'] = (string)$model; + + $versioning->startAction($actionSpec); + $model->addMultipleStatements($inputModel); + $versioning->endAction(); + + return true; + } + + /** + * @desc create a new knowledge base + * + * @param string $modelIri + * + * @return bool + */ + public function create($modelIri) + { + $this->_store->getNewModel($modelIri); + + return true; + } + + /** + * @desc drop an existing knowledge base + * + * @param string $modelIri + * + * @return bool + */ + public function drop($modelIri) + { + $this->_store->deleteModel($modelIri); + + return true; + } + + /** + * This methid calculates a hash value for a resource including its IRI and all its properties. + * + * @param string $modelIri the IRI of the model + * @param string $resourceIri the IRI of the resource + * + * @return string with the hash value + */ + private function _getCurrentResourceHash ($modelIri, $resourceIri) + { + $resource = $this->_store->getModel($modelIri)->getResource($resourceIri); + $statements = $resource->getDescription(); + return md5(serialize($statements)); + } +} From 8a8ad4a07066d5c2d9a2d7dfe352f2131f16b585 Mon Sep 17 00:00:00 2001 From: Natanael Arndt Date: Fri, 15 Aug 2014 11:14:13 +0200 Subject: [PATCH 092/482] Fix coding standard for ApplicationController --- .../controllers/ApplicationController.php | 58 +++++++++++-------- 1 file changed, 35 insertions(+), 23 deletions(-) diff --git a/application/controllers/ApplicationController.php b/application/controllers/ApplicationController.php index 376635610..433d5a7ea 100644 --- a/application/controllers/ApplicationController.php +++ b/application/controllers/ApplicationController.php @@ -30,12 +30,17 @@ public function aboutAction() $version .= ' ' . $this->_config->version->suffix; } - $cacheWritable = is_writable($this->_config->cache->path) - ? ' (writable)' - : ' (not writable!)'; - $logWritable = is_writable($this->_config->log->path) - ? ' (writable)' - : ' (not writable!)'; + if (is_writable($this->_config->cache->path)) { + $cacheWritable = ' (writable)'; + } else { + $cacheWritable = ' (not writable!)'; + } + + if (is_writable($this->_config->log->path)) { + $logWritable = ' (writable)'; + } else { + $logWritable = ' (not writable!)'; + } $cacheBackend = $this->_config->cache->backend->type; $cacheBackendOptions = array(); @@ -84,15 +89,12 @@ public function aboutAction() ); // check if the git comand exists and ontowiki is a working directory - if (file_exists(".git") - && substr(@exec("git --version"), 0, 11) == "git version" - ) { + if (file_exists('.git') && substr(@exec('git --version'), 0, 11) == 'git version') { @exec('git status', $arr); $data['Git Versioning'] = array( - 'Version' => @exec("git describe"), + 'Version' => @exec('git describe'), 'Branch' => substr($arr[0], 12), 'last commit' => @exec("git log --pretty=format:'%ar' -n 1") - //'Git Version' => substr(@exec("git --version"),12), ); } @@ -223,9 +225,9 @@ public function registerAction() array('escape' => false, 'translate' => false) ) ); - + $contentType = $this->_request->getHeader('Content-Type'); - if(strstr($contentType, 'application/json')){ + if (strstr($contentType, 'application/json')) { $rawBody = $this->_request->getRawBody(); echo $rawBody; $post = Zend_Json::decode($rawBody); @@ -256,7 +258,8 @@ public function registerAction() $emailValidator = new Zend_Validate_EmailAddress(); - if (!$this->_erfurt->isActionAllowed('RegisterNewUser') + if ( + !$this->_erfurt->isActionAllowed('RegisterNewUser') || !($actionConfig = $this->_erfurt->getActionConfig('RegisterNewUser')) ) { $message = 'Action not permitted for the current user.'; @@ -270,20 +273,23 @@ public function registerAction() $message = 'Email address is already registered.'; $this->_owApp->appendMessage(new OntoWiki_Message($message, OntoWiki_Message::ERROR)); } else { - if (isset($actionConfig['mailvalidation']) + if ( + isset($actionConfig['mailvalidation']) && $actionConfig['mailvalidation'] == 'yes' && !$emailValidator->isValid($email) ) { $message = 'Email address validation failed.'; $this->_owApp->appendMessage(new OntoWiki_Message($message, OntoWiki_Message::ERROR)); } else { - if (in_array($username, $registeredUsernames) + if ( + in_array($username, $registeredUsernames) || ($username == $this->_owApp->erfurt->getStore()->getDbUser()) ) { $message = 'Username already registered.'; $this->_owApp->appendMessage(new OntoWiki_Message($message, OntoWiki_Message::ERROR)); } else { - if (isset($actionConfig['uidregexp']) + if ( + isset($actionConfig['uidregexp']) && !preg_match($actionConfig['uidregexp'], $username) ) { $message = 'Username contains illegal characters.'; @@ -299,7 +305,8 @@ public function registerAction() new OntoWiki_Message($message, OntoWiki_Message::ERROR) ); } else { - if (isset($actionConfig['passregexp']) + if ( + isset($actionConfig['passregexp']) && $actionConfig['passregexp'] != '' && !@preg_match($actionConfig['passregexp'], $password) ) { @@ -382,7 +389,8 @@ public function openidregAction() $emailValidator = new Zend_Validate_EmailAddress(); // Is register action allowed for current user? - if (!$this->_erfurt->isActionAllowed('RegisterNewUser') + if ( + !$this->_erfurt->isActionAllowed('RegisterNewUser') || !($actionConfig = $this->_erfurt->getActionConfig('RegisterNewUser')) ) { @@ -396,7 +404,9 @@ public function openidregAction() // Does user already exist? $message = 'A user with the given OpenID is already registered.'; $this->_owApp->appendMessage(new OntoWiki_Message($message, OntoWiki_Message::ERROR)); - } else if (!empty($email) && isset($actionConfig['mailvalidation']) + } else if ( + !empty($email) + && isset($actionConfig['mailvalidation']) && $actionConfig['mailvalidation'] === 'yes' && !$emailValidator->isValid($email) ) { @@ -654,10 +664,10 @@ public function webidregAction() $emailValidator = new Zend_Validate_EmailAddress(); // Is register action allowed for current user? - if (!$this->_erfurt->isActionAllowed('RegisterNewUser') + if ( + !$this->_erfurt->isActionAllowed('RegisterNewUser') || !($actionConfig = $this->_erfurt->getActionConfig('RegisterNewUser')) ) { - $message = 'Action not permitted for the current user.'; $this->_owApp->appendMessage(new OntoWiki_Message($message, OntoWiki_Message::ERROR)); } else if (empty($webId)) { @@ -668,7 +678,9 @@ public function webidregAction() // Does user already exist? $message = 'A user with the given WebID is already registered.'; $this->_owApp->appendMessage(new OntoWiki_Message($message, OntoWiki_Message::ERROR)); - } else if (!empty($email) && isset($actionConfig['mailvalidation']) + } else if ( + !empty($email) + && isset($actionConfig['mailvalidation']) && $actionConfig['mailvalidation'] === 'yes' && !$emailValidator->isValid($email) ) { From 8675d62dbb23cdc5fabe7057540fdc5429c5b8bc Mon Sep 17 00:00:00 2001 From: Natanael Arndt Date: Fri, 15 Aug 2014 11:15:24 +0200 Subject: [PATCH 093/482] Fix getting branch name (wasn't language independent) --- .../controllers/ApplicationController.php | 3 +- .../basicimporter/BasicimporterPlugin.php | 36 +++++++++++++++++++ extensions/basicimporter/doap.n3 | 2 +- libraries/Erfurt | 2 +- 4 files changed, 39 insertions(+), 4 deletions(-) diff --git a/application/controllers/ApplicationController.php b/application/controllers/ApplicationController.php index 433d5a7ea..ffa9e2091 100644 --- a/application/controllers/ApplicationController.php +++ b/application/controllers/ApplicationController.php @@ -90,10 +90,9 @@ public function aboutAction() // check if the git comand exists and ontowiki is a working directory if (file_exists('.git') && substr(@exec('git --version'), 0, 11) == 'git version') { - @exec('git status', $arr); $data['Git Versioning'] = array( 'Version' => @exec('git describe'), - 'Branch' => substr($arr[0], 12), + 'Branch' => @exec('git rev-parse --abbrev-ref HEAD'), 'last commit' => @exec("git log --pretty=format:'%ar' -n 1") ); } diff --git a/extensions/basicimporter/BasicimporterPlugin.php b/extensions/basicimporter/BasicimporterPlugin.php index 5f540e3f1..32c1414ee 100644 --- a/extensions/basicimporter/BasicimporterPlugin.php +++ b/extensions/basicimporter/BasicimporterPlugin.php @@ -23,6 +23,14 @@ public function onProvideImportActions($event) $this->provideImportActions($event); } + /** + * Listen for the store initialization event + */ + public function onSetupStore($event) + { + // $this->importModels(); + } + /* * here we add new import actions */ @@ -57,4 +65,32 @@ private function provideImportActions($event) $event->importActions = array_merge($event->importActions, $myImportActions); return $event; } + + private function importModels () + { + // read config for models to import + $owApp = OntoWiki::getInstance(); + $models = $this->_privateConfig->setup->model->toArray(); + foreach ($models as $info) { + // import models + $path = ONTOWIKI_ROOT . '/' . $info['path']; + $uri = $info['uri']; + $hidden = $info['hidden']; + $this->_import($uri, $path); + } + } + + private function _import($modelIri, $fileOrUrl) + { + try { + Erfurt_App::getInstance()->getStore()->importRdf($modelIri, $fileOrUrl); + } catch (Erfurt_Exception $e) { + // re-throw + throw new OntoWiki_Controller_Exception( + 'Could not import given model: ' . $e->getMessage(), + 0, + $e + ); + } + } } diff --git a/extensions/basicimporter/doap.n3 b/extensions/basicimporter/doap.n3 index 63f21c34b..7da85ede4 100644 --- a/extensions/basicimporter/doap.n3 +++ b/extensions/basicimporter/doap.n3 @@ -11,7 +11,7 @@ :extension a doap:Project ; doap:name "basicimporter" ; owconfig:privateNamespace ; - owconfig:pluginEvent event:onProvideImportActions ; + owconfig:pluginEvent event:onProvideImportActions, event:onSetupStore ; owconfig:enabled "true"^^xsd:boolean ; rdfs:label "Basic Data Import Actions" ; doap:description "provides import from web an RDF files" ; diff --git a/libraries/Erfurt b/libraries/Erfurt index 14c8046e4..0ae94ce54 160000 --- a/libraries/Erfurt +++ b/libraries/Erfurt @@ -1 +1 @@ -Subproject commit 14c8046e4377c72c8317bb800094830db66800df +Subproject commit 0ae94ce54fe0cc4da4176d4215f9ee7bb1687590 From da79f381b9f5dc1e57f07fd5b83631d659b1b82b Mon Sep 17 00:00:00 2001 From: Natanael Arndt Date: Fri, 15 Aug 2014 15:25:52 +0200 Subject: [PATCH 094/482] Fix #226. Forward Erfurt. --- libraries/Erfurt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/libraries/Erfurt b/libraries/Erfurt index 0ae94ce54..83ba7c2f1 160000 --- a/libraries/Erfurt +++ b/libraries/Erfurt @@ -1 +1 @@ -Subproject commit 0ae94ce54fe0cc4da4176d4215f9ee7bb1687590 +Subproject commit 83ba7c2f12fc7f400122bbb30c9c6913a4b390d8 From dcc90bec935f228da48402381304911932e971de Mon Sep 17 00:00:00 2001 From: Clemens Hoffmann Date: Wed, 27 Aug 2014 14:30:26 +0200 Subject: [PATCH 095/482] add hide type when using add instance --- extensions/themes/silverblue/scripts/support.js | 2 ++ 1 file changed, 2 insertions(+) diff --git a/extensions/themes/silverblue/scripts/support.js b/extensions/themes/silverblue/scripts/support.js index a026e48f3..1c324ff12 100644 --- a/extensions/themes/silverblue/scripts/support.js +++ b/extensions/themes/silverblue/scripts/support.js @@ -465,6 +465,8 @@ function populateRDFauthor(data, protect, resource, graph, workingmode) { // remove all values except for type if ( stmt.predicateURI() !== 'http://www.w3.org/1999/02/22-rdf-syntax-ns#type' ) { stmt._object.value = ""; + } else { + stmt._hidden = true; } } From 3ac374f894e29d57ff68c48cdaa72cef86126afe Mon Sep 17 00:00:00 2001 From: Clemens Hoffmann Date: Wed, 27 Aug 2014 14:32:05 +0200 Subject: [PATCH 096/482] forward rdfauthor --- libraries/RDFauthor | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/libraries/RDFauthor b/libraries/RDFauthor index 415ac249f..e87cf9eb6 160000 --- a/libraries/RDFauthor +++ b/libraries/RDFauthor @@ -1 +1 @@ -Subproject commit 415ac249f4369ef91c1e878d95a82b6d80abf48a +Subproject commit e87cf9eb63aeae87a8893d9457ca1556d440b211 From 0769f8b6a78d5cfc452b7797ebc73c1189b56965 Mon Sep 17 00:00:00 2001 From: Natanael Arndt Date: Wed, 13 Aug 2014 17:50:51 +0200 Subject: [PATCH 097/482] Move responsibility for contentType and fileExtension to Erfurt --- application/controllers/ModelController.php | 21 +++------------------ 1 file changed, 3 insertions(+), 18 deletions(-) diff --git a/application/controllers/ModelController.php b/application/controllers/ModelController.php index dee5a349a..553236592 100644 --- a/application/controllers/ModelController.php +++ b/application/controllers/ModelController.php @@ -633,24 +633,9 @@ public function exportAction() $filename = 'export' . date('Y-m-d_Hi'); - switch ($format) { - case 'rdfxml': - $contentType = 'application/rdf+xml'; - $filename .= '.rdf'; - break; - case 'rdfn3': - $contentType = 'text/rdf+n3'; - $filename .= '.n3'; - break; - case 'rdfjson': - $contentType = 'application/json'; - $filename .= '.json'; - break; - case 'turtle': - $contentType = 'application/x-turtle'; - $filename .= '.ttl'; - break; - } + $description = Erfurt_Syntax_RdfSerializer::getFormatDescription($format); + $contentType = $description['contentType']; + $filename .= $description['fileExtension']; $this->_helper->viewRenderer->setNoRender(); $this->_helper->layout->disableLayout(); From 48c606bd5abdf4af0c85b9db56eeac5e10e364e0 Mon Sep 17 00:00:00 2001 From: Natanael Arndt Date: Wed, 24 Sep 2014 11:54:47 +0200 Subject: [PATCH 098/482] Forward Erfurt --- libraries/Erfurt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/libraries/Erfurt b/libraries/Erfurt index 83ba7c2f1..9a0f00a6f 160000 --- a/libraries/Erfurt +++ b/libraries/Erfurt @@ -1 +1 @@ -Subproject commit 83ba7c2f12fc7f400122bbb30c9c6913a4b390d8 +Subproject commit 9a0f00a6f41687afac7118dbdb069f3ee034a345 From e2391bacd07a9e14a18bca907e2adcaba14b0a11 Mon Sep 17 00:00:00 2001 From: Natanael Arndt Date: Tue, 28 Oct 2014 14:59:18 +0100 Subject: [PATCH 099/482] Add getTitle method to ModelJsonrpcAdapter --- extensions/jsonrpc/ModelJsonrpcAdapter.php | 24 ++++++++++++++++++++++ 1 file changed, 24 insertions(+) diff --git a/extensions/jsonrpc/ModelJsonrpcAdapter.php b/extensions/jsonrpc/ModelJsonrpcAdapter.php index 19d78e8c1..66f22db8f 100644 --- a/extensions/jsonrpc/ModelJsonrpcAdapter.php +++ b/extensions/jsonrpc/ModelJsonrpcAdapter.php @@ -136,6 +136,30 @@ public function deletePrefix($modelIri, $prefix = 'rdf') } } + /** + * @desc get the titles for a given array of resources + * + * @param string modelIri + * @param array resources + * + * @return array An associative array of resources and their titles + */ + public function getTitles($modelIri, $resources) + { + // ["http://pfarrerbuch.comiles.eu/sachsen/"] + $resources = json_decode($resources); + + $model = $this->_store->getModel($modelIri); + $titleHelper = new OntoWiki_Model_TitleHelper($model, $this->_store); + $titleHelper->addResources($resources); + $titles = array(); + foreach ($resources as $resourceUri) { + $titles[$resourceUri] = $titleHelper->getTitle($resourceUri); + } + + return $titles; + } + /** * @desc counts the number of statements of a model * From 62e100b9e0f013811c44f6df5146ce3bf0dc9bd1 Mon Sep 17 00:00:00 2001 From: Natanael Arndt Date: Tue, 28 Oct 2014 16:40:18 +0100 Subject: [PATCH 100/482] Forward zend version to avoid deprecated methods --- Makefile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Makefile b/Makefile index d71056377..97699e874 100644 --- a/Makefile +++ b/Makefile @@ -1,4 +1,4 @@ -ZENDVERSION=1.12.7 +ZENDVERSION=1.12.9 ZEND2VERSION=2.2.2 default: From 0c1e474b4d2b7364e888be3d7016d5460d05afae Mon Sep 17 00:00:00 2001 From: Natanael Arndt Date: Tue, 28 Oct 2014 23:38:08 +0100 Subject: [PATCH 101/482] Fix #145. Fix special chars in Linked Data request URIs. --- application/classes/OntoWiki/Dispatcher.php | 1 + 1 file changed, 1 insertion(+) diff --git a/application/classes/OntoWiki/Dispatcher.php b/application/classes/OntoWiki/Dispatcher.php index bcd62c3d7..133cd90c2 100644 --- a/application/classes/OntoWiki/Dispatcher.php +++ b/application/classes/OntoWiki/Dispatcher.php @@ -163,6 +163,7 @@ public function isDispatchable(Zend_Controller_Request_Abstract $request) // URI may not contain a whitespace character! $pathInfo = str_replace(' ', '+', $pathInfo); + $pathInfo = urldecode($pathInfo); if (class_exists($className, false)) { // give a chance to let class handle (e.g. index controller news action default) From 14c446e071df8c3b5eb8a8d0c53b770bfaa584a2 Mon Sep 17 00:00:00 2001 From: Norman Radtke Date: Mon, 10 Nov 2014 10:34:06 +0100 Subject: [PATCH 102/482] Change submodule paths to amsl-project repos --- .gitmodules | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.gitmodules b/.gitmodules index aeabfa427..2eb7c7555 100644 --- a/.gitmodules +++ b/.gitmodules @@ -1,6 +1,6 @@ [submodule "libraries/RDFauthor"] path = libraries/RDFauthor - url = git://github.com/AKSW/RDFauthor.git + url = git://github.com/amsl-project/RDFauthor.git [submodule "libraries/Erfurt"] path = libraries/Erfurt - url = git://github.com/AKSW/Erfurt.git + url = git://github.com/amsl-project/Erfurt.git From e95d40a22221cb7e16bf90cdf2706021b57231cb Mon Sep 17 00:00:00 2001 From: Norman Radtke Date: Mon, 10 Nov 2014 12:34:41 +0100 Subject: [PATCH 103/482] Add submodules --- .gitmodules | 21 +++++++++++++++++++++ extensions/contextinfo | 1 + extensions/deadlinehelper | 1 + extensions/files | 1 + extensions/fulltextsearch | 1 + extensions/imagehelper | 1 + extensions/issnimporter | 1 + extensions/template | 1 + 8 files changed, 28 insertions(+) create mode 160000 extensions/contextinfo create mode 160000 extensions/deadlinehelper create mode 160000 extensions/files create mode 160000 extensions/fulltextsearch create mode 160000 extensions/imagehelper create mode 160000 extensions/issnimporter create mode 160000 extensions/template diff --git a/.gitmodules b/.gitmodules index 2eb7c7555..9de5ba0eb 100644 --- a/.gitmodules +++ b/.gitmodules @@ -4,3 +4,24 @@ [submodule "libraries/Erfurt"] path = libraries/Erfurt url = git://github.com/amsl-project/Erfurt.git +[submodule "extensions/template"] + path = extensions/template + url = https://github.com/AKSW/template.ontowiki.git +[submodule "extensions/contextinfo"] + path = extensions/contextinfo + url = https://github.com/AKSW/contextinfo.ontowiki.git +[submodule "extensions/imagehelper"] + path = extensions/imagehelper + url = https://github.com/AKSW/imagehelper.ontowiki.git +[submodule "extensions/deadlinehelper"] + path = extensions/deadlinehelper + url = https://github.com/AKSW/deadlinehelper.ontowiki.git +[submodule "extensions/issnimporter"] + path = extensions/issnimporter + url = https://github.com/amsl-project/issnimporter.ontowiki.git +[submodule "extensions/fulltextsearch"] + path = extensions/fulltextsearch + url = https://github.com/amsl-project/fulltextsearch.ontowiki.git +[submodule "extensions/files"] + path = extensions/files + url = https://github.com/AKSW/files.ontowiki.git diff --git a/extensions/contextinfo b/extensions/contextinfo new file mode 160000 index 000000000..5420516d2 --- /dev/null +++ b/extensions/contextinfo @@ -0,0 +1 @@ +Subproject commit 5420516d20fc527570ab00c84de1ad9be7c1d42d diff --git a/extensions/deadlinehelper b/extensions/deadlinehelper new file mode 160000 index 000000000..537d17d09 --- /dev/null +++ b/extensions/deadlinehelper @@ -0,0 +1 @@ +Subproject commit 537d17d0957c6b80e5500132f7eeef922967a9a7 diff --git a/extensions/files b/extensions/files new file mode 160000 index 000000000..e9962939b --- /dev/null +++ b/extensions/files @@ -0,0 +1 @@ +Subproject commit e9962939bb26c778427430dcc96d6ccfa41f5898 diff --git a/extensions/fulltextsearch b/extensions/fulltextsearch new file mode 160000 index 000000000..965e9f1df --- /dev/null +++ b/extensions/fulltextsearch @@ -0,0 +1 @@ +Subproject commit 965e9f1df179821e725c9bd37135c71baaf2444d diff --git a/extensions/imagehelper b/extensions/imagehelper new file mode 160000 index 000000000..0675a041d --- /dev/null +++ b/extensions/imagehelper @@ -0,0 +1 @@ +Subproject commit 0675a041d7a00d1ed1ffe631e818e867e4c7f300 diff --git a/extensions/issnimporter b/extensions/issnimporter new file mode 160000 index 000000000..95809babd --- /dev/null +++ b/extensions/issnimporter @@ -0,0 +1 @@ +Subproject commit 95809babd98c54c44d522189887cda32c48d3afa diff --git a/extensions/template b/extensions/template new file mode 160000 index 000000000..d2564cb39 --- /dev/null +++ b/extensions/template @@ -0,0 +1 @@ +Subproject commit d2564cb39609e1c163340e46ceb9e40628bd824b From baad02a2843165aa00fcd8711248671d253075e3 Mon Sep 17 00:00:00 2001 From: Norman Radtke Date: Tue, 11 Nov 2014 12:23:08 +0100 Subject: [PATCH 104/482] Forward submodule extensions/deadlinehelper --- extensions/deadlinehelper | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/extensions/deadlinehelper b/extensions/deadlinehelper index 537d17d09..18bf1e096 160000 --- a/extensions/deadlinehelper +++ b/extensions/deadlinehelper @@ -1 +1 @@ -Subproject commit 537d17d0957c6b80e5500132f7eeef922967a9a7 +Subproject commit 18bf1e0962a469cff633857e49ff9faa33d665ef From c007f88d217979805aab15bf8da4eafd54431078 Mon Sep 17 00:00:00 2001 From: Norman Radtke Date: Tue, 11 Nov 2014 12:23:31 +0100 Subject: [PATCH 105/482] Forward submodule libraries/Erfurt --- libraries/Erfurt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/libraries/Erfurt b/libraries/Erfurt index 9a0f00a6f..ad626ac1a 160000 --- a/libraries/Erfurt +++ b/libraries/Erfurt @@ -1 +1 @@ -Subproject commit 9a0f00a6f41687afac7118dbdb069f3ee034a345 +Subproject commit ad626ac1a6ec46f6ad1003356b3fee502db854c2 From 9ad4b654f856a1af4ab9c0a200aed0e91a9dd217 Mon Sep 17 00:00:00 2001 From: Norman Radtke Date: Tue, 11 Nov 2014 12:23:52 +0100 Subject: [PATCH 106/482] Forward submodule libraries/RDFauthor --- libraries/RDFauthor | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/libraries/RDFauthor b/libraries/RDFauthor index e87cf9eb6..367e93a75 160000 --- a/libraries/RDFauthor +++ b/libraries/RDFauthor @@ -1 +1 @@ -Subproject commit e87cf9eb63aeae87a8893d9457ca1556d440b211 +Subproject commit 367e93a75e25773f6a03a8f88c09b06144c36b58 From 82e2b2ee5ff83b71505217e1ad72b7a3aec0b79c Mon Sep 17 00:00:00 2001 From: Sebastian Nuck Date: Tue, 11 Nov 2014 15:49:43 +0100 Subject: [PATCH 107/482] add amsl config --- application/config/default.ini | 4 +- config.ini.dist | 7 ++++ .../listmodules/ShowpropertiesModule.php | 4 +- extensions/navigation/doap.n3 | 37 ++++++++++++++++++- .../themes/silverblue/scripts/support.js | 2 +- 5 files changed, 49 insertions(+), 5 deletions(-) diff --git a/application/config/default.ini b/application/config/default.ini index c4d409fca..86b8acfa0 100644 --- a/application/config/default.ini +++ b/application/config/default.ini @@ -103,7 +103,9 @@ descriptionHelper.properties.skosEditorialNote = "http://www.w3.org/2004/02/skos ;; ; List settings ;; -lists.showTypeColumnByDefault = "true" +lists.showTypeColumnByDefault = "false" +lists.showHeading = "true" +lists.showCommentsForHeading = "true" ;; ; Version info diff --git a/config.ini.dist b/config.ini.dist index 8064485a8..c9582aa55 100644 --- a/config.ini.dist +++ b/config.ini.dist @@ -152,6 +152,13 @@ cache.backend.sqlite.cache_db_complete_path = "/tmp/ow_cache.sqlite" ;; Options for Gearman/worker worker.enable = false +;; TitleHelper Bibiographic URIs +titleHelper.properties.gndPrBody = "http://d-nb.info/standards/elementset/gnd#preferredNameForTheCorporateBody" +titleHelper.properties.gndPrPerson = "http://d-nb.info/standards/elementset/gnd#preferredNameForThePerson" +titleHelper.properties.gndPrSubject= "http://d-nb.info/standards/elementset/gnd#preferredNameForTheSubjectHeading" +titleHelper.properties.gndPrWork = "http://d-nb.info/standards/elementset/gnd#preferredNameForTheWork" +titleHelper.properties.gndPrGeoName= "http://d-nb.info/standards/elementset/gnd#preferredNameForThePlaceOrGeographicName" + ;;;; ;; uncomment this line if you need more information diff --git a/extensions/listmodules/ShowpropertiesModule.php b/extensions/listmodules/ShowpropertiesModule.php index 3e3d9abe7..f2404b3eb 100644 --- a/extensions/listmodules/ShowpropertiesModule.php +++ b/extensions/listmodules/ShowpropertiesModule.php @@ -74,10 +74,10 @@ public function getContents() $this->view->inversePropertiesListLink = (string)$url; if ($this->_privateConfig->filterhidden || $this->_privateConfig->filterlist) { - $this->view->properties = $this->filterProperties($this->_instances->getAllProperties(false)); + $this->view->properties = $this->filterProperties($this->_instances->getAllPropertiesBySingleQuery(false)); $this->view->reverseProperties = $this->filterProperties($this->_instances->getAllProperties(true)); } else { - $this->view->properties = $this->_instances->getAllProperties(false); + $this->view->properties = $this->_instances->getAllPropertiesBySingleQuery(false); $this->view->reverseProperties = $this->_instances->getAllProperties(true); } diff --git a/extensions/navigation/doap.n3 b/extensions/navigation/doap.n3 index 4dba492ac..b180357d0 100644 --- a/extensions/navigation/doap.n3 +++ b/extensions/navigation/doap.n3 @@ -42,7 +42,13 @@ owconfig:id "label"; rdfs:label "By Label" ; :type - ] + ]; + owconfig:config [ + a owconfig:Config; + owconfig:id "order"; + rdfs:label "By order property" ; + :type + ]; ]; owconfig:config [ @@ -284,6 +290,35 @@ :rootURI ; ] ; + owconfig:config [ + a owconfig:Config; + owconfig:id "Bibrm-Classes"; + rdfs:label "Bibrm-Classes" ; + :titleMode "titleHelper" ; + :cache "false"^^xsd:boolean ; + :hierarchyTypes () ; + :hiddenNS ( + + + + ); + owconfig:config [ + a owconfig:Config; + owconfig:id "hierarchyRelations"; + :in () + ]; + owconfig:config [ + a owconfig:Config; + owconfig:id "list"; + :config "{|filter|:[{|rdfsclass|:|%resource%|,|mode|:|rdfsclass|}]}" + ]; + :hierarchyTypes (