Changeset 1589

Show
Ignore:
Timestamp:
06/26/08 23:27:17 (7 months ago)
Author:
lmajano
Message:

SES LOOSE MATCHING AND translate on event.buildlink

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • coldbox/trunk/system/beans/requestContext.cfc

    r1577 r1589  
    360360         
    361361        <cffunction name="buildLink" access="public" output="false" returntype="any" hint="Builds a link to a passed event, either SES or normal link. If the ses interceptor is declared it will create routes."> 
    362                 <cfargument name="linkto" required="true" type="string" hint="The event or route you want to create the link to"> 
     362                <cfargument name="linkto"               required="true"         type="string"  hint="The event or route you want to create the link to"> 
     363            <cfargument name="translate"        required="false"        type="boolean" default="true" hint="Translate between . and / depending on the ses mode. So you can just use dot notation."/> 
    363364            <cfscript> 
    364365                if( isSES() ){ 
     366                        /* Translate link */ 
     367                        if( arguments.translate ){ 
     368                                arguments.linkto = replace(arguments.linkto,".","/","all"); 
     369                        } 
     370                        /* Prepare link */ 
    365371                        if( right(getSESbaseURL(),1) eq  "/"){ 
    366372                                return getSESBaseURL() & arguments.linkto; 
  • coldbox/trunk/system/interceptors/ses.cfc

    r1583 r1589  
    4646                        catch(Any e){ 
    4747                                throw("Error including config file: #e.message#",e.detail,"interceptors.ses.executingConfigException"); 
     48                        } 
     49                         
     50                        /* Loose Matching Property: default = false */ 
     51                        if( not propertyExists('looseMatching') or not isBoolean(getProperty('looseMatching')) ){ 
     52                                setProperty('looseMatching',false); 
    4853                        } 
    4954                         
     
    255260                        <!--- Try to match this route against the URL ---> 
    256261                        <cfset match = REFindNoCase(thisPattern,requestString,1,true) /> 
    257  
     262                         
    258263                        <!--- If a match was made, use the result to route the request ---> 
    259                         <cfif match.len[1] IS NOT 0 AND match.pos[1] EQ 1> 
     264                        <cfif (match.len[1] IS NOT 0 AND getProperty('looseMatching')) OR  
     265                                  (not getProperty('looseMatching') and match.len[1] IS NOT 0 and match.pos[1] EQ 1) > 
    260266                                <cfset foundRoute = thisRoute />                                 
    261267                                <!--- For each part of the URL in the route ---> 
  • coldbox/trunk/testharness/config/routes.cfm

    r1578 r1589  
    107107 
    108108<!--- CUSTOM COURSES GO HERE (they will be checked in order) ---> 
    109 <cfset addCourse(pattern="test/:id-numeric/:name",handler="ehGeneral",action="dspHello")> 
    110 <cfset addCourse(pattern="test/:id/:name",handler="ehGeneral",action="dspHello")> 
     109<cfset addCourse(pattern="test/:id-numeric/:name?",handler="ehGeneral",action="dspHello")> 
     110<cfset addCourse(pattern="test/:id/:name?",handler="ehGeneral",action="dspHello")> 
    111111 
    112112<!--- STANDARD COLDBOX COURSES, DO NOT MODIFY UNLESS YOU DON'T LIKE THEM ---> 

Copyright 2006 ColdBox Framework by Luis Majano