Author: sevein
Date: Mon Sep 28 10:40:50 2009
New Revision: 3565
Log:
Some improvements for both informationobject and term treeviews.
- Add routing for term/move action.
- Update security files to make move actions secure.
- Add condition to treeView.js to avoid dragging for read-only users.
- Add move action for term treeView.
Modified:
trunk/apps/qubit/config/routing.yml
trunk/apps/qubit/modules/informationobject/actions/moveAction.class.php
trunk/apps/qubit/modules/informationobject/actions/treeViewComponent.class.php
trunk/apps/qubit/modules/informationobject/config/security.yml
trunk/apps/qubit/modules/informationobject/templates/_treeView.php
trunk/apps/qubit/modules/term/actions/treeViewComponent.class.php
trunk/apps/qubit/modules/term/config/security.yml
trunk/apps/qubit/modules/term/templates/_treeView.php
trunk/web/js/treeView.js
Modified: trunk/apps/qubit/config/routing.yml
==============================================================================
--- trunk/apps/qubit/config/routing.yml Mon Sep 28 07:00:19 2009 (r3564)
+++ trunk/apps/qubit/config/routing.yml Mon Sep 28 10:40:50 2009 (r3565)
@@ -257,6 +257,12 @@
module: term
action: edit
+termMove:
+ url: /term/move/:id
+ param:
+ module: term
+ action: move
+
oai_harvester_harvest_all_sets:
url: /oai/harvest/:type/:harvestId/*
param:
Modified:
trunk/apps/qubit/modules/informationobject/actions/moveAction.class.php
==============================================================================
--- trunk/apps/qubit/modules/informationobject/actions/moveAction.class.php
Mon Sep 28 07:00:19 2009 (r3564)
+++ trunk/apps/qubit/modules/informationobject/actions/moveAction.class.php
Mon Sep 28 10:40:50 2009 (r3565)
@@ -44,7 +44,7 @@
$this->informationObject->save();
- $this->redirect(array('module' => 'informationobject', 'action' =>
'show', 'id' => $this->informationObject->id));
+ return $this->renderText('');
}
}
}
Modified:
trunk/apps/qubit/modules/informationobject/actions/treeViewComponent.class.php
==============================================================================
---
trunk/apps/qubit/modules/informationobject/actions/treeViewComponent.class.php
Mon Sep 28 07:00:19 2009 (r3564)
+++
trunk/apps/qubit/modules/informationobject/actions/treeViewComponent.class.php
Mon Sep 28 10:40:50 2009 (r3565)
@@ -62,5 +62,8 @@
$this->treeViewExpands[$id = $ancestor->getId()] = $id;
}
$this->treeViewExpands[$id = $this->informationObject->getId()] = $id;
+
+ // Is treeView draggable?
+ $this->treeViewDraggable =
SecurityPriviliges::editCredentials($this->getUser(), 'informationObject') ?
'true' : 'false';
}
}
Modified: trunk/apps/qubit/modules/informationobject/config/security.yml
==============================================================================
--- trunk/apps/qubit/modules/informationobject/config/security.yml Mon Sep
28 07:00:19 2009 (r3564)
+++ trunk/apps/qubit/modules/informationobject/config/security.yml Mon Sep
28 10:40:50 2009 (r3565)
@@ -33,6 +33,10 @@
list:
is_secure: off
+move:
+ is_secure: on
+ credentials: [[ contributor, editor, administrator ]]
+
# not secure is default
#show:
# is_secure: off
Modified: trunk/apps/qubit/modules/informationobject/templates/_treeView.php
==============================================================================
--- trunk/apps/qubit/modules/informationobject/templates/_treeView.php Mon Sep
28 07:00:19 2009 (r3564)
+++ trunk/apps/qubit/modules/informationobject/templates/_treeView.php Mon Sep
28 10:40:50 2009 (r3565)
@@ -9,5 +9,6 @@
Qubit.treeView.objects = $treeViewObjects;
Qubit.treeView.expands = $treeViewExpands;
Qubit.treeView.Url = "$treeViewUrl";
+Qubit.treeView.draggable = $treeViewDraggable;
EOF
) ?>
Modified: trunk/apps/qubit/modules/term/actions/treeViewComponent.class.php
==============================================================================
--- trunk/apps/qubit/modules/term/actions/treeViewComponent.class.php Mon Sep
28 07:00:19 2009 (r3564)
+++ trunk/apps/qubit/modules/term/actions/treeViewComponent.class.php Mon Sep
28 10:40:50 2009 (r3565)
@@ -74,5 +74,8 @@
$this->treeViewExpands[$id = $ancestor->id] = $id;
}
$this->treeViewExpands[$id = $this->term->id] = $id;
+
+ // Is treeView draggable?
+ $this->treeViewDraggable =
SecurityPriviliges::editCredentials($this->getUser(), 'term') ? 'true' :
'false';
}
}
Modified: trunk/apps/qubit/modules/term/config/security.yml
==============================================================================
--- trunk/apps/qubit/modules/term/config/security.yml Mon Sep 28 07:00:19
2009 (r3564)
+++ trunk/apps/qubit/modules/term/config/security.yml Mon Sep 28 10:40:50
2009 (r3565)
@@ -13,6 +13,10 @@
list:
is_secure: off
+move:
+ is_secure: on
+ credentials: [[ contributor, editor, administrator ]]
+
show:
is_secure: off
Modified: trunk/apps/qubit/modules/term/templates/_treeView.php
==============================================================================
--- trunk/apps/qubit/modules/term/templates/_treeView.php Mon Sep 28
07:00:19 2009 (r3564)
+++ trunk/apps/qubit/modules/term/templates/_treeView.php Mon Sep 28
10:40:50 2009 (r3565)
@@ -4,10 +4,12 @@
</div>
<?php $treeViewObjects = json_encode($sf_data->getRaw('treeViewObjects')) ?>
<?php $treeViewExpands = json_encode($sf_data->getRaw('treeViewExpands')) ?>
-<?php $treeViewUrl = url_for(array('module' => 'term', 'action' =>
'treeView'), true); ?>
+<?php $treeViewUrl = url_for(array('module' => 'term', 'action' =>
'treeView'), true);
+$treeViewUrl = "/~jesus/qubit/web/qubit_dev.php/term/treeView"; ?>
<?php echo javascript_tag(<<<EOF
Qubit.treeView.objects = $treeViewObjects;
Qubit.treeView.expands = $treeViewExpands;
Qubit.treeView.Url = "$treeViewUrl";
+Qubit.treeView.draggable = $treeViewDraggable;
EOF
) ?>
Modified: trunk/web/js/treeView.js
==============================================================================
--- trunk/web/js/treeView.js Mon Sep 28 07:00:19 2009 (r3564)
+++ trunk/web/js/treeView.js Mon Sep 28 10:40:50 2009 (r3565)
@@ -13,29 +13,29 @@
var textNode = new YAHOO.widget.TextNode(object, parentNode,
expands[object.id] !== undefined);
textNode.isLeaf = object.isLeaf;
- var dd = new YAHOO.util.DDProxy(textNode.labelElId);
+ if (Qubit.treeView.draggable)
+ {
+ var dd = new YAHOO.util.DD(textNode.labelElId);
- dd.invalidHandleTypes = {};
+ dd.invalidHandleTypes = {};
- dd.onDragDrop = function (event, id)
- {
- var newParent = parentNode.tree.getNodeByElement($('#' + id)[0]);
+ dd.onDragDrop = function (event, id) {
+ var newParent = parentNode.tree.getNodeByElement($('#' +
id)[0]);
- jQuery.ajax({
- data: { parent: newParent.href },
- type: 'POST',
- url: textNode.href.replace(/\/informationobject\/\D*(\d+)/,
'/informationobject/move/$1')});
+ jQuery.ajax({
+ data: { parent: newParent.href },
+ type: 'POST',
+ url:
textNode.href.replace(/\/(informationobject|term)\/\D*(\d+)/, '/$1/move/$2')});
- parentNode.tree.popNode(textNode);
- textNode.appendTo(newParent);
+ parentNode.tree.popNode(textNode);
+ textNode.appendTo(newParent);
- parentNode.refresh();
- newParent.refresh();
- };
+ parentNode.refresh();
+ newParent.refresh();
+ };
- dd.endDrag = function ()
- {
- };
+ dd.endDrag = function () { };
+ }
build(objects, expands, object.id, textNode);
}
@@ -63,29 +63,29 @@
var tmp = new YAHOO.widget.TextNode(data[i], node, false);
tmp.isLeaf = data[i].isLeaf;
- var dd = new YAHOO.util.DDProxy(tmp.labelElId);
+ if (Qubit.treeView.draggable)
+ {
+ var dd = new YAHOO.util.DD(tmp.labelElId);
- dd.invalidHandleTypes = {};
+ dd.invalidHandleTypes = {};
- dd.onDragDrop = function (event, id)
- {
- var newParent = node.tree.getNodeByElement($('#' + id)[0]);
+ dd.onDragDrop = function (event, id) {
+ var newParent = node.tree.getNodeByElement($('#' + id)[0]);
- jQuery.ajax({
- data: { parent: newParent.href },
- type: 'POST',
- url: tmp.href.replace(/\/informationobject\/\D*(\d+)/,
'/informationobject/move/$1')});
+ jQuery.ajax({
+ data: { parent: newParent.href },
+ type: 'POST',
+ url:
tmp.href.replace(/\/(informationobject|term)\/\D*(\d+)/, '/$1/move/$2')});
- node.tree.popNode(tmp);
- tmp.appendTo(newParent);
+ node.tree.popNode(tmp);
+ tmp.appendTo(newParent);
- node.refresh();
- tmp.parent.refresh();
- };
+ node.refresh();
+ tmp.parent.refresh();
+ };
- dd.endDrag = function ()
- {
- };
+ dd.endDrag = function () { };
+ }
}
fnLoadComplete();
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups
"Qubit Toolkit Commits" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.ca/group/qubit-commits?hl=en
-~----------~----~----~----~------~----~------~--~---