Changeset 273

Show
Ignore:
Timestamp:
12/15/06 19:07:21 (2 years ago)
Author:
scorfield
Message:

Fixes #89 and #128 by adding two new types: moved and javascript.

Files:
1 modified

Legend:

Unmodified
Added
Removed
  • framework/trunk/verbs/relocate.cfm

    r267 r273  
    7070                // type - server|client - default client 
    7171                if (structKeyExists(fb_.verbInfo.attributes,"type")) { 
    72                         if (listFind("server,client",fb_.verbInfo.attributes.type) eq 0) { 
     72                        // FB51: adds moved and javascript types: 
     73                        if (listFind("server,client,moved,javascript",fb_.verbInfo.attributes.type) eq 0) { 
    7374                                fb_throw("fusebox.badGrammar.invalidAttributeValue", 
    7475                                                        "Attribute has invalid value", 
    75                                                         "The attribute 'type' must either be ""server"" or ""client"", for a 'relocate' verb in fuseaction #fb_.verbInfo.circuit#.#fb_.verbInfo.fuseaction#."); 
     76                                                        "The attribute 'type' must either be ""server"", ""client"", ""moved"" or ""javascript"", for a 'relocate' verb in fuseaction #fb_.verbInfo.circuit#.#fb_.verbInfo.fuseaction#."); 
    7677                        } 
    7778                } else { 
     
    8889                 
    8990                // compile <relocate> 
    90                 if (fb_.verbInfo.attributes.type is "server") { 
     91                switch (fb_.verbInfo.attributes.type) { 
     92 
     93                case "server": 
    9194                        fb_appendLine('<cfset getPageContext().forward("#fb_.verbInfo.attributes.url#")>'); 
    92                 } else { 
     95                        break; 
     96 
     97                case "client": 
    9398                        fb_appendLine('<cflocation url="#fb_.verbInfo.attributes.url#" addtoken="#fb_.verbInfo.attributes.addtoken#">'); 
     99                        break; 
     100 
     101                case "moved": 
     102                        fb_appendLine('<cfheader statuscode="301" statustext="Moved Permanently">'); 
     103                        fb_appendLine('<cfheader name="Location" value="#fb_.verbInfo.attributes.url#">'); 
     104                        break; 
     105 
     106                case "javascript": 
     107                        fb_appendLine('<cfoutput><script type="text/javascript">( document.location.replace ) ? ' & 
     108                                                        'document.location.replace("#fb_verbInfo.attributes.url#") : ' & 
     109                                                        'document.location.href = "#fb_.verbInfo.attributes.url#";</script></cfoutput>'); 
     110                        break; 
     111 
    94112                } 
    95113                fb_appendLine('<cfabort>');