Skip to content
Browse files

Merge branch 'develop' of github.com:AKSW/OntoWiki into develop

  • Loading branch information...
2 parents 433e14b + f350175 commit 231841353c21823379d97cb3c1d14637d5d6627d @jbrekle jbrekle committed May 6, 2012
View
10 application/classes/OntoWiki/Controller/ActionHelper/List.php
@@ -1,7 +1,9 @@
<?php
-class OntoWiki_Controller_ActionHelper_List extends Zend_Controller_Action_Helper_Abstract
-{
+/**
+ *manage the session variable that stores multiple lists (mostly the current instance list)
+ */
+class OntoWiki_Controller_ActionHelper_List extends Zend_Controller_Action_Helper_Abstract{
protected $_owApp;
public function __construct()
@@ -131,7 +133,7 @@ public function removeList($name)
if (key_exists($name, $lists)) {
unset ($lists[$name]);
}
-
- throw new InvalidArgumentException('list was not found. check with listExists() first');
+
+ throw new InvalidArgumentException("list was not found. check with listExists() first");
}
}
View
8 application/classes/OntoWiki/Controller/Plugin/ListSetupHelper.php
@@ -158,6 +158,14 @@ function _json_decode($string) {
if ($config == false) {
throw new OntoWiki_Exception('Invalid parameter instancesconfig (json_decode failed)');
}
+
+ if (isset($config->sort)) {
+ if($config->sort == null){
+ $list->orderByUri($config->sort->asc);
+ } else {
+ $list->setOrderProperty($config->sort->uri, $config->sort->asc);
+ }
+ }
if (isset($config->shownProperties)) {
foreach ($config->shownProperties as $prop) {
View
5 application/classes/OntoWiki/Model/Instances.php
@@ -1215,8 +1215,7 @@ public function getAllPropertiesQuery($inverse = false){
$query
->addProjectionVar($predVar)
->getOrder()
- ->clear()
- ->add($predVar);
+ ->clear();
return $query;
}
@@ -1613,6 +1612,7 @@ public function setOrderProperty($uri, $asc = true) {
);
} else {
$this->_sortTriple->getElement(0)->setP(new Erfurt_Sparql_Query2_IriRef($uri));
+ if($asc){$this->_resourceQuery->getOrder()->setAsc(0);} else {$this->_resourceQuery->getOrder()->setDesc(0);}
}
}
@@ -1623,6 +1623,7 @@ public function setOrderProperty($uri, $asc = true) {
* @param boolean $asc true if ascending, false if descending
*/
public function setOrderVar($var, $asc = true) {
+ $this->setOffset(0);
if(!is_bool($asc)){
$asc = true;
}
View
24 application/views/templates/partials/list_std_main.phtml
@@ -20,9 +20,25 @@ $config = Erfurt_App::getInstance()->getConfig();
$urlBase = $config->urlBase;
$this->headScript()->prependScript(
- 'function showPermaLink(){$("#permalink").slideToggle(400);}
- function showresQuery(){$("#resQuery").slideToggle(400);}
- function showvalQuery(){$("#valQuery").slideToggle(400);}');
+ 'function showPermaLink(){$("#permalink").slideToggle(400);}
+ function showresQuery(){$("#resQuery").slideToggle(400);}
+ function showvalQuery(){$("#valQuery").slideToggle(400);}
+ function changeSorting(n){
+ var mainInnerContent = $(n).parents(".innercontent");
+ mainInnerContent.addClass("is-processing");
+ mainInnerContent.load(
+ reloadUrl+"",
+ {"instancesconfig": $.toJSON({ sort : {
+ "uri" : $(n).attr("p"),
+ "asc" : $(n).hasClass("up")
+ }}), "list":listName},
+ function(){
+ mainInnerContent.removeClass("is-processing");
+ $(".statustool li a").removeClass("selected");
+ $("body").trigger("ontowiki.resource-list.reloaded");
+ });
+ }'
+);
?>
<div id="permalink" class="messagebox" style="display:none"><?php echo $permalink; ?></div>
<div id="resQuery" class="messagebox" style="display:none"><?php echo htmlentities($resourceQuery); ?><br><a href="<?php echo $urlBase; ?>queries/editor/?query=<?php echo urlencode($resourceQuery)?>">Open in editor</a></div>
@@ -50,6 +66,8 @@ $this->headScript()->prependScript(
about="<?php echo $property['uri'] ?>"
href="<?php echo $property['url'] ?>"><?php echo $property['title']; ?></a>
<?php if ($property['inverse']){ ?><sup>-1</sup><?php } ?>
+ <a class="tablesort up" p="<?php echo $property['uri'] ?>" onclick="javascript:changeSorting(this)">&uArr;</a>
+ <a class="tablesort down" p="<?php echo $property['uri'] ?>" onclick="javascript:changeSorting(this)">&dArr;</a>
</th>
<?php endforeach; ?>
</tr>
View
4 extensions/history/HistoryController.php
@@ -224,9 +224,9 @@ public function listAction()
if($listHelper->listExists($listName)){
$list = $listHelper->getList($listName);
} else {
- $this->_owApp->appendMessage(
+ $this->_owApp->appendMessage(
new OntoWiki_Message('something went wrong with the list of instances', OntoWiki_Message::ERROR)
- );
+ );
}
$query = clone $list->getResourceQuery();

0 comments on commit 2318413

Please sign in to comment.
Something went wrong with that request. Please try again.