Author: sevein
Date: Tue Jun 26 18:29:41 2012
New Revision: 11818
Log:
Check first if the action was called for moving items
Modified:
trunk/apps/qubit/modules/informationobject/actions/treeViewAction.class.php
Modified:
trunk/apps/qubit/modules/informationobject/actions/treeViewAction.class.php
==============================================================================
--- trunk/apps/qubit/modules/informationobject/actions/treeViewAction.class.php
Tue Jun 26 18:28:40 2012 (r11817)
+++ trunk/apps/qubit/modules/informationobject/actions/treeViewAction.class.php
Tue Jun 26 18:29:41 2012 (r11818)
@@ -32,6 +32,39 @@
$this->resource = $this->getRoute()->resource;
}
+ // Sorting action
+ if (in_array($request->show, array('moveAfter', 'moveBefore')))
+ {
+ // Check authorization
+ if (!QubitAcl::check($this->resource, 'update'))
+ {
+ QubitAcl::forwardUnauthorized();
+ }
+
+ // Parse $request->target
+ $params =
$this->context->routing->parse(Qubit::pathInfo($request->target));
+ if (!isset($params['_sf_route']))
+ {
+ $this->forward404();
+ }
+ $target = $params['_sf_route']->resource;
+
+ switch ($request->show)
+ {
+ case 'moveAfter':
+ $this->resource->moveToNextSiblingOf($target);
+
+ break;
+
+ case 'moveBefore':
+ $this->resource->moveToPrevSiblingOf($target);
+
+ break;
+ }
+
+ return sfView::NONE;
+ }
+
$sql = 'SELECT
io.*,
i18n.*,
@@ -93,35 +126,6 @@
$this->resource->lft)));
break;
-
- case 'moveAfter':
- case 'moveBefore':
- // Check authorization
- if (!QubitAcl::check($this->resource, 'update'))
- {
- QubitAcl::forwardUnauthorized();
- }
-
- $params =
$this->context->routing->parse(Qubit::pathInfo($request->target));
-
- if (!isset($params['_sf_route']))
- {
- $this->forward404();
- }
-
- $target = $params['_sf_route']->resource;
-
- if ('moveAfter' == $request->show)
- {
- $this->resource->moveToNextSiblingOf($target);
- }
- else
- {
- $this->resource->moveToPrevSiblingOf($target);
- }
-
-
- return sfView::NONE;
}
}
}
--
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.com/group/qubit-commits?hl=en.