|
From: <gem...@li...> - 2012-10-11 12:15:07
|
Revision: 978
http://gemstracker.svn.sourceforge.net/gemstracker/?rev=978&view=rev
Author: matijsdejong
Date: 2012-10-11 12:14:57 +0000 (Thu, 11 Oct 2012)
Log Message:
-----------
Switching organizations now switches organization search term in auto search from the old organization to the new organization.
Modified Paths:
--------------
trunk/library/classes/Gems/Default/OrganizationAction.php
trunk/library/classes/Gems/User/User.php
Modified: trunk/library/classes/Gems/Default/OrganizationAction.php
===================================================================
--- trunk/library/classes/Gems/Default/OrganizationAction.php 2012-10-10 18:00:13 UTC (rev 977)
+++ trunk/library/classes/Gems/Default/OrganizationAction.php 2012-10-11 12:14:57 UTC (rev 978)
@@ -74,14 +74,22 @@
$user = $this->loader->getCurrentUser();
$request = $this->getRequest();
$orgId = urldecode($request->getParam('org'));
- $url = base64_decode($request->getParam('current_uri'));
+ $oldOrg = $user->getCurrentOrganizationId();
+ $origUrl = base64_decode($request->getParam('current_uri'));
$allowedOrganizations = $user->getAllowedOrganizations();
if (isset($allowedOrganizations[$orgId])) {
$user->setCurrentOrganization($orgId);
- if ($url) {
- $this->getResponse()->setRedirect($url);
+ if ($origUrl) {
+ foreach ($user->possibleOrgIds as $key) {
+ $finds[] = '/' . $key. '/' . $oldOrg;
+ $replaces[] = '/' . $key. '/' . $orgId;
+ }
+ $correctUrl = str_replace($finds, $replaces, $origUrl);
+ // MUtil_Echo::track($origUrl, $correctUrl);
+
+ $this->getResponse()->setRedirect($correctUrl);
} else {
$user->gotoStartPage($this->menu, $request);
}
Modified: trunk/library/classes/Gems/User/User.php
===================================================================
--- trunk/library/classes/Gems/User/User.php 2012-10-10 18:00:13 UTC (rev 977)
+++ trunk/library/classes/Gems/User/User.php 2012-10-11 12:14:57 UTC (rev 978)
@@ -94,7 +94,17 @@
protected $failureIgnoreTime = 600;
/**
+ * Array containing the parameter names that may point to an organization
*
+ * @var array
+ */
+ public $possibleOrgIds = array(
+ MUtil_Model::REQUEST_ID2,
+ 'gr2o_id_organization',
+ 'gto_id_organization');
+
+ /**
+ *
* @var Gems_Project_ProjectSettings
*/
protected $project;
@@ -1376,15 +1386,11 @@
if ($requestCache = $this->session->requestCache) {
//Create the list of request cache keys that match an organization ID (to be extended)
- $possibleOrgIds = array(
- MUtil_Model::REQUEST_ID2,
- 'gr2o_id_organization',
- 'gto_id_organization');
-
foreach ($requestCache as $key => $value) {
if (is_array($value)) {
foreach ($value as $paramKey => $paramValue) {
- if (in_array($paramKey, $possibleOrgIds)) {
+ if (in_array($paramKey, $this->possibleOrgIds)) {
+
if ($paramValue == $oldOrganizationId) {
$requestCache[$key][$paramKey] = $organizationId;
}
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|