Author: jablko
Date: Mon Sep 14 16:39:39 2009
New Revision: 3289

Log:
Support defaults for $params which aren't :variables, 
http://trac.symfony-project.org/ticket/7124
Add default parent to information object create route

Modified:
   trunk/apps/qubit/config/qubitConfiguration.class.php
   trunk/apps/qubit/config/routing.yml
   trunk/lib/vendor/symfony/lib/routing/sfRoute.class.php

Modified: trunk/apps/qubit/config/qubitConfiguration.class.php
==============================================================================
--- trunk/apps/qubit/config/qubitConfiguration.class.php        Mon Sep 14 
16:32:50 2009        (r3288)
+++ trunk/apps/qubit/config/qubitConfiguration.class.php        Mon Sep 14 
16:39:39 2009        (r3289)
@@ -50,6 +50,8 @@
         $context->routing->setDefaultParameter($name, 
$context->request[$name]);
       }
     }
+
+    $context->routing->insertRouteBefore('default', 
'informationObject/create', new 
sfRoute('/informationobject/create/:informationobject_template', array('module' 
=> 'informationobject', 'action' => 'create', 'parent' => array('default' => 
$context->routing->generate(null, array('module' => 'informationobject', 
'action' => 'show', 'id' => QubitInformationObject::ROOT_ID))))));
   }
 
   public function responseFilterContent(sfEvent $event, $content)

Modified: trunk/apps/qubit/config/routing.yml
==============================================================================
--- trunk/apps/qubit/config/routing.yml Mon Sep 14 16:32:50 2009        (r3288)
+++ trunk/apps/qubit/config/routing.yml Mon Sep 14 16:39:39 2009        (r3289)
@@ -176,12 +176,6 @@
     module: digitalobject
     action: create
 
-informationObjectCreate:
-  url: /informationobject/create/:informationobject_template
-  param:
-    module: informationobject
-    action: create
-
 informationObjectDelete:
   url: /informationobject/delete/:id
   param:
@@ -254,16 +248,14 @@
   param:
     module: oai
     action: harvesterHarvest
-  requirements:
-    harvestId: \d+
+    harvestId: { pattern: \d+ }
 
 oai_harvester_delete:
   url: /oai/deleteRepository/:repositoryId/*
   param:
     module: oai
     action: harvesterDelete
-  requirements:
-    repositoryId: \d+
+    repositoryId: { pattern: \d+ }
 
 oai_requests:
   url: /oai/request

Modified: trunk/lib/vendor/symfony/lib/routing/sfRoute.class.php
==============================================================================
--- trunk/lib/vendor/symfony/lib/routing/sfRoute.class.php      Mon Sep 14 
16:32:50 2009        (r3288)
+++ trunk/lib/vendor/symfony/lib/routing/sfRoute.class.php      Mon Sep 14 
16:39:39 2009        (r3289)
@@ -180,7 +180,7 @@
     }
 
     // check that $params does not override a default value that is not a 
variable
-    foreach ($defaults as $key => $value)
+    foreach ($this->params as $key => $value)
     {
       if (!isset($this->variables[$key]) && $tparams[$key] != $value)
       {
@@ -723,9 +723,23 @@
       {
         $this->defaults[$value] = true;
       }
+      else if (is_array($value))
+      {
+        unset($this->defaults[$key]);
+
+        if (isset($value['default']))
+        {
+          $this->defaults[$key] = $value['default'];
+        }
+
+        if (isset($value['pattern']))
+        {
+          $this->requirements[$key] = $value['pattern'];
+        }
+      }
       else
       {
-        $this->defaults[$key] = urldecode($value);
+        $this->defaults[$key] = $this->params[$key] = urldecode($value);
       }
     }
   }

--~--~---------~--~----~------------~-------~--~----~
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
-~----------~----~----~----~------~----~------~--~---

Reply via email to