Changeset 1767

Show
Ignore:
Timestamp:
10/10/08 19:15:19 (3 months ago)
Author:
lmajano
Message:

Updates

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • coldbox/trunk/samples/applications/SimpleBlog/simple_blog/config/coldbox.xml.cfm

    r1763 r1767  
    4141                <Setting name="RequestStartHandler"             value="main.onRequestStart"/> 
    4242                <!--Event Handler to run at end of all requests, leave blank if not used. Emulates the Application.cfc onRequestEnd method--> 
    43                 <Setting name="RequestEndHandler"                       value="main.onRequestEnd"/> 
     43                <Setting name="RequestEndHandler"                       value=""/> 
    4444                <!--Event Handler to run at the start of an application, leave blank if not used. Emulates the Application.cfc onApplicationStart method        --> 
    4545                <Setting name="ApplicationStartHandler"         value="main.onAppInit"/> 
    4646                <!--Event Handler to run at the start of a session, leave blank if not used.--> 
    47                 <Setting name="SessionStartHandler"             value="main.onSessionStart"/> 
     47                <Setting name="SessionStartHandler"             value=""/> 
    4848                <!--Event Handler to run at the end of a session, leave blank if not used.--> 
    49                 <Setting name="SessionEndHandler"                       value="main.onSessionEnd"/> 
     49                <Setting name="SessionEndHandler"                       value=""/> 
    5050                <!--The Email address from which all outgoing framework emails will be sent. --> 
    51                 <Setting name="OwnerEmail"                                      value="hjoreteg@esri.com" /> 
     51                <Setting name="OwnerEmail"                                      value="myemail@email.com" /> 
    5252                <!-- Enable Bug Reports to be emailed out, set to true by default if left blank --> 
    5353                <Setting name="EnableBugReports"                        value="false"/> 
     
    5555                <Setting name="UDFLibraryFile"                          value="" /> 
    5656                <!--The event handler to execute on all framework exceptions. Event Handler syntax required.--> 
    57                 <Setting name="ExceptionHandler"                        value="main.onException" /> 
     57                <Setting name="ExceptionHandler"                        value="" /> 
    5858                <!--What event to fire when an invalid event is detected--> 
    5959                <Setting name="onInvalidEvent"                          value="" /> 
    6060                <!--Full path from the application's root to your custom error page, else leave blank. --> 
    61                 <Setting name="CustomErrorTemplate"                     value="includes/generic_error.cfm" /> 
     61                <Setting name="CustomErrorTemplate"                     value="" /> 
    6262                <!--Messagebox Style (css) class name to use. Look at the messagebox.cfm in the includes directory--> 
    6363                <Setting name="MessageboxStyleOverride"         value="false" /> 
     
    129129                maxPersistentRequestProfilers : Max records to keep in the profiler. Don't get gready. 
    130130                maxRCPanelQueryRows : If a query is dumped in the RC panel, it will be truncated to this many rows.--> 
    131                 
     131        <!-- 
    132132        <DebuggerSettings> 
    133133                <PersistentRequestProfiler>true</PersistentRequestProfiler> 
     
    140140                <RCPanel                show="true" expanded="true" /> 
    141141        </DebuggerSettings> 
    142          
     142        --> 
    143143         
    144144        <!--Optional,if blank it will use the CFMX administrator settings.--> 
    145         <MailServerSettings> 
    146                 <MailServer></MailServer> 
    147                 <MailPort></MailPort> 
    148                 <MailUsername></MailUsername> 
    149                 <MailPassword></MailPassword> 
    150         </MailServerSettings> 
     145        <MailServerSettings /> 
    151146 
    152147        <!--Emails to Send bug reports, you can create as many as you like--> 
    153         <BugTracerReports> 
    154  
    155         </BugTracerReports> 
     148        <BugTracerReports /> 
    156149 
    157150        <!--List url dev environments, this determines your dev/pro environment for the framework--> 
    158         <DevEnvironments> 
    159                 <url>localhost</url> 
    160         </DevEnvironments> 
     151        <DevEnvironments /> 
    161152 
    162153        <!--Webservice declarations your use in your application, if not use, leave blank 
     
    165156        --> 
    166157        <WebServices /> 
     158         
    167159        <!--Declare Layouts for your application here--> 
    168160        <Layouts> 
     
    191183         
    192184        <Datasources> 
    193                 <Datasource alias="blogDSN" name="blogengine"   dbtype="mssql"  username="" password="" /> 
     185                <Datasource alias="blogDSN" name="simpleblog"   dbtype="mssql"  username="" password="" /> 
    194186        </Datasources> 
    195  
    196187         
    197188        <!--ColdBox Object Caching Settings Overrides the Framework-wide settings  
     
    225216                 
    226217                <Interceptor class="coldbox.system.interceptors.autowire"> 
     218                        <Property name="enableSetterInjection">false</Property> 
    227219                </Interceptor>  
    228220 
  • coldbox/trunk/samples/applications/SimpleBlog/simple_blog/config/datasource.xml.cfm

    r1763 r1767  
    11<?xml version="1.0" encoding="UTF-8"?> 
    22<datasource xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"> 
    3   <name>blogengine</name> 
     3  <name>simpleblog</name> 
    44  <username></username> 
    55  <password></password> 
  • coldbox/trunk/samples/applications/SimpleBlog/simple_blog/config/routes.cfm

    r1763 r1767  
    5959---> 
    6060 
    61 <cfset setBaseURL("http://jorteg.esri.com/simple_blog/index.cfm/")> 
    62  
     61<cfif len(getSetting("AppMapping")) lte 1> 
     62        <cfset setBaseURL("http://#cgi.HTTP_HOST#/index.cfm")> 
     63<cfelse> 
     64        <cfset setBaseURL("http://#cgi.HTTP_HOST#/#getSetting('AppMapping')#/index.cfm")> 
     65</cfif> 
    6366 
    6467<!--- ------------------------------------------- 
  • coldbox/trunk/samples/applications/SimpleBlog/simple_blog/config/transfer.xml.cfm

    r1763 r1767  
    77 
    88                        <!--Entry--> 
    9                         <object name="entry" table="entry"> 
     9                        <object name="entry" table="entries"> 
    1010                                <id name="entry_id" column="entry_id" type="UUID" generate="true" /> 
    1111                                <property name="title"          type="string" /> 
     
    2626 
    2727                        <!--Comment--> 
    28                         <object name="comment" table="comment"> 
     28                        <object name="comment" table="comments"> 
    2929                                <id name="comment_id" column="comment_id" type="UUID" generate="true" /> 
    3030                                <property name="comment"        type="string" /> 
  • coldbox/trunk/samples/applications/SimpleBlog/simple_blog/handlers/general.cfc

    r1763 r1767  
    1212<cfcomponent name="general" extends="coldbox.system.eventhandler" output="false" autowire="true"> 
    1313 
     14        <!--- Dependencies ---> 
     15        <cfproperty name="Transfer" type="ocm" scope="instance" /> 
     16         
     17 
    1418<!----------------------------------- CONSTRUCTOR --------------------------------------->       
    15          
    16         <cfproperty name="Transfer" type="ocm" scope="instance" /> 
    1719         
    1820        <cffunction name="init" access="public" returntype="any" output="false" hint="constructor"> 
     
    2931        <cffunction name="index" access="public" returntype="void" output="false"> 
    3032                <cfargument name="Event" type="any"> 
    31                 <cfset var rc = event.getCollection()> 
    32                  
    33                 <!--- Do Your Logic Here to prepare a view --->  
    3433                <cfscript> 
    35                         Event.setValue("welcomeMessage","Hello, Coldbox!"); 
     34                        /* Welcome message */ 
     35                        Event.setValue("welcomeMessage","Hello, welcome to Simple Blog!"); 
     36                        /* Display View */ 
     37                        Event.setView("home"); 
    3638                </cfscript> 
    37                  
    38                 <!--- Set the View To Display, after Logic ---> 
    39                 <cfset Event.setView("home")> 
    40          
    4139        </cffunction> 
    4240         
    4341        <!--- about ---> 
    4442        <cffunction name="about" access="public" returntype="void" output="false" hint=""> 
    45                 <cfargument name="Event" type="coldbox.system.beans.requestContext" required="yes"> 
     43                <cfargument name="Event" type="any" required="yes"> 
    4644            <cfset var rc = event.getCollection()> 
    47                          
    48                 <!--- Set the View To Display, after Logic ---> 
     45            <!--- Display View --->      
    4946                <cfset Event.setView("about")> 
    50                  
    5147        </cffunction> 
    5248         
    5349        <!--- blog ---> 
    54         <cffunction name="blog" access="public" returntype="void" output="false" hint="Displays the blog page" > 
    55                 <cfargument name="Event" type="coldbox.system.beans.requestContext" required="yes"> 
    56             <cfset var rc = event.getCollection()> 
    57              
     50        <cffunction name="blog" access="public" returntype="void" output="false" hint="Displays the blog page" cache="true" cacheTimeout="10"> 
     51                <cfargument name="Event" type="any" required="yes"> 
    5852            <cfscript> 
    59                 rc.posts = instance.transfer.list("posts.entry","time", false); 
    60               
     53                        var rc = event.getCollection(); 
     54                         
     55                        /* Get all Posts */ 
     56                        rc.posts = instance.transfer.list("posts.entry","time", false); 
     57                /* Set View */ 
    6158                Event.setView("blog"); 
    6259            </cfscript> 
    63               
    6460        </cffunction> 
    6561         
    6662        <!--- newPost ---> 
    6763        <cffunction name="newPost" access="public" returntype="void" output="false" hint=""> 
    68                 <cfargument name="Event" type="coldbox.system.beans.requestContext" required="yes"> 
     64                <cfargument name="Event" type="any" required="yes"> 
    6965            <cfset var rc = event.getCollection()> 
    7066                 
    71             <cfset Event.setView("newPost")> 
    72               
     67            <cfset Event.setView("newPost")>          
    7368        </cffunction> 
    7469         
    7570        <!--- doNewPost ---> 
    7671        <cffunction name="doNewPost" access="public" returntype="void" output="false" hint="Action to handle new post operation"> 
    77                 <cfargument name="Event" type="coldbox.system.beans.requestContext" required="yes"> 
     72                <cfargument name="Event" type="any" required="yes"> 
    7873            <cfset var rc = event.getCollection()> 
    7974            <cfset var newPost = ""> 
    80              
    8175            <cfscript> 
     76                /* Get a new transfer entry object  */ 
    8277                newPost = instance.transfer.new("posts.entry"); 
    83                 /*newPost.settitle(rc.title); 
    84                 newPost.setpost(rc.post); 
    85                 newPost.setauthor(rc.author); 
    86                 */ 
     78                /* Populate the sucker */ 
    8779                getPlugin("beanFactory").populateBean(newPost); 
     80                /* Save it */ 
    8881                instance.transfer.save(newPost); 
    89              
     82               /* Clear event caching */ 
    9083                getColdboxOcm().clearEvent("general.blog"); 
    91              
    92                 setNextRoute("general/blog"); 
    93                  
     84                /* Re-Route */ 
     85                setNextRoute("general/blog");            
    9486            </cfscript>     
    9587              
     
    9789         
    9890        <!--- viewPost ---> 
    99         <cffunction name="viewPost" access="public" returntype="void" output="false" hint="Shows one particular post and related comments"
    100                 <cfargument name="Event" type="coldbox.system.beans.requestContext" required="yes"> 
     91        <cffunction name="viewPost" access="public" returntype="void" output="false" hint="Shows one particular post and related comments" cache="true" cacheTimeout="10"
     92                <cfargument name="Event" type="any" required="yes"> 
    10193            <cfset var rc = event.getCollection()> 
    102              
    10394            <cfscript> 
     95                /* Get Current incoming Post */ 
    10496                rc.oPost = instance.transfer.get("posts.entry",rc.id); 
     97                /* Setup the comments */ 
    10598                rc.comments = rc.oPost.getCommentArray(); 
     99                /* Setup the view */ 
     100                Event.setView('viewPost'); 
    106101            </cfscript>     
    107                  
    108             <cfset Event.setView('viewPost')> 
    109102        </cffunction> 
    110103 
    111104        <!--- doAddComment ---> 
    112105        <cffunction name="doAddComment" access="public" returntype="void" output="false" hint="action that adds comment"> 
    113                 <cfargument name="Event" type="coldbox.system.beans.requestContext" required="yes"> 
     106                <cfargument name="Event" type="any" required="yes"> 
    114107            <cfset var rc = event.getCollection()> 
    115              
    116                 <cfscript> 
     108            <cfset var newComment = ""> 
     109            <cfscript> 
     110                /* get a New Comment */ 
    117111                        newComment = instance.transfer.new("posts.comment"); 
     112                        /* Population */ 
    118113                        newComment.setComment(rc.commentField); 
    119114                        newComment.setParentEntry(instance.transfer.get("posts.entry", rc.id)); 
     115                        /* Save it */ 
    120116                        instance.transfer.save(newComment); 
    121                          
     117                        /* Clear Events from cache */ 
    122118                        getColdboxOCM().clearEvent("general.viewPost","id=#rc.id#"); 
    123                          
     119                        /* Re route */ 
    124120                        setNextRoute("general/viewPost/" & rc.ID); 
    125121                </cfscript>    ` 
  • coldbox/trunk/samples/applications/SimpleBlog/simple_blog/handlers/main.cfc

    r1763 r1767  
    2727 
    2828        <cffunction name="onAppInit" access="public" returntype="void" output="false"> 
    29                 <cfargument name="Event" type="coldbox.system.beans.requestContext"> 
     29                <cfargument name="Event" type="any"> 
    3030                <!--- ON Application Start Here ---> 
    3131                <!--- Create our Transfer Factory ---> 
     
    4444                <cfset var rc = event.getCollection()> 
    4545                 
    46                 <cfparam name="rc.pageTitle" default="Henrik's ColdBox App"> 
    47                  
    48                 <!--- On Request Start Code Here ---> 
     46                <cfset event.paramValue("pageTitle","Simple Blog")> 
    4947        </cffunction> 
    5048 
    51         <cffunction name="onRequestEnd" access="public" returntype="void" output="false"> 
    52                 <cfargument name="Event" type="any"> 
    53                 <!--- ON Request End Here ---> 
    54         </cffunction> 
    55          
    56         <cffunction name="onSessionStart" access="public" returntype="void" output="false"> 
    57                 <cfargument name="Event" type="any"> 
    58                 <!--- ON session start Here ---> 
    59         </cffunction> 
    60          
    61         <cffunction name="onSessionEnd" access="public" returntype="void" output="false"> 
    62                 <cfargument name="Event" type="any"> 
    63                 <!--- ON session End Here ---> 
    64                 <cfset var sessionScope = event.getValue("sessionReference")> 
    65                  
    66         </cffunction> 
    67          
    68         <cffunction name="onException" access="public" returntype="void" output="false"> 
    69                 <cfargument name="Event" type="any"> 
    70                 <!--- ON Exception Handler Here ---> 
    71                 <cfscript> 
    72                         //Grab Exception From request collection, placed by ColdBox 
    73                         var exceptionBean = event.getValue("ExceptionBean"); 
    74                         //Place exception handler below: 
    75  
    76                 </cfscript> 
    77         </cffunction> 
    78  
    79  
    8049</cfcomponent> 
  • coldbox/trunk/samples/applications/SimpleBlog/simple_blog/views/about.cfm

    r1763 r1767  
    22<div> 
    33        <h1>About this Site</h1> 
    4         <p>This site was created by Henrik as a way to teach himself how to use ColdBox and interract with a DB using an ORM. 
     4        <p>This site was created by Henrik as a way to teach himself how to use ColdBox and interract with a DB using an ORM.</p> 
    55         
    6         <p>In this case Transfer was used. 
     6        <p>In this case Transfer was used.</p> 
     7         
     8        <p>The entire suite of simple blog applications where revised by Luis Majano and Team ColdBox</p> 
    79</div> 
    810</cfoutput> 
  • coldbox/trunk/samples/applications/SimpleBlog/simple_blog/views/footer.cfm

    r1763 r1767  
    1 <div class="copyright">&copy; Henrik Joreteg <cfoutput>#year(now())#</cfoutput></div> 
     1<div class="copyright">&copy; Henrik Joreteg & Luis Majano <cfoutput>#year(now())#</cfoutput></div> 
  • coldbox/trunk/samples/applications/SimpleBlog/simple_blog_2/Application.cfc

    r1763 r1767  
    2121        <cfset this.sessionTimeout = createTimeSpan(0,0,30,0)> 
    2222        <cfset this.setClientCookies = true> 
     23         
     24        <!--- Mappings ---> 
     25        <cfset this.mappings["/simple_blog_2"] = getDirectoryFromPath(getCurrentTemplatePath())> 
    2326         
    2427        <!--- COLDBOX STATIC PROPERTY, DO NOT CHANGE UNLESS THIS IS NOT THE ROOT OF YOUR COLDBOX APP ---> 
  • coldbox/trunk/samples/applications/SimpleBlog/simple_blog_2/config/coldbox.xml.cfm

    r1763 r1767  
    44        <Settings> 
    55                <!--The name of your application.--> 
    6                 <Setting name="AppName"                                         value="simple_blog"/> 
     6                <Setting name="AppName"                                         value="simple_blog2"/> 
    77                <!-- ColdBox set-up information for J2EE installation. 
    88                        As context-root are actually virtual locations which does not correspond to physical location of files. for example  
     
    1717                        is not set, then coldbox will try to auto-calculate it for you. Please read the docs.--> 
    1818                         
    19                 <Setting name="AppMapping"                                      value="/simple_blog_2"/>       
    20                          
     19         
    2120                <!--Default Debugmode boolean flag (Set to false in production environments)--> 
    22                 <Setting name="DebugMode"                                       value="true" /> 
     21                <Setting name="DebugMode"                                       value="false" /> 
    2322                <!--The Debug Password to use in order to activate/deactivate debugmode,activated by url actions --> 
    2423                <Setting name="DebugPassword"                           value=""/> 
     
    4039                <Setting name="RequestStartHandler"             value="main.onRequestStart"/> 
    4140                <!--Event Handler to run at end of all requests, leave blank if not used. Emulates the Application.cfc onRequestEnd method--> 
    42                 <Setting name="RequestEndHandler"                       value="main.onRequestEnd"/> 
     41                <Setting name="RequestEndHandler"                       value=""/> 
    4342                <!--Event Handler to run at the start of an application, leave blank if not used. Emulates the Application.cfc onApplicationStart method        --> 
    4443                <Setting name="ApplicationStartHandler"         value="main.onAppInit"/> 
    4544                <!--Event Handler to run at the start of a session, leave blank if not used.--> 
    46                 <Setting name="SessionStartHandler"             value="main.onSessionStart"/> 
     45                <Setting name="SessionStartHandler"             value=""/> 
    4746                <!--Event Handler to run at the end of a session, leave blank if not used.--> 
    48                 <Setting name="SessionEndHandler"                       value="main.onSessionEnd"/> 
     47                <Setting name="SessionEndHandler"                       value=""/> 
    4948                <!--The Email address from which all outgoing framework emails will be sent. --> 
    50                 <Setting name="OwnerEmail"                                      value="hjoreteg@esri.com" /> 
     49                <Setting name="OwnerEmail"                                      value="myemail@email.com" /> 
    5150                <!-- Enable Bug Reports to be emailed out, set to true by default if left blank --> 
    5251                <Setting name="EnableBugReports"                        value="false"/> 
     
    5453                <Setting name="UDFLibraryFile"                          value="" /> 
    5554                <!--The event handler to execute on all framework exceptions. Event Handler syntax required.--> 
    56                 <Setting name="ExceptionHandler"                        value="main.onException" /> 
     55                <Setting name="ExceptionHandler"                        value="" /> 
    5756                <!--What event to fire when an invalid event is detected--> 
    5857                <Setting name="onInvalidEvent"                          value="" /> 
    5958                <!--Full path from the application's root to your custom error page, else leave blank. --> 
    60                 <Setting name="CustomErrorTemplate"                     value="includes/generic_error.cfm" /> 
     59                <Setting name="CustomErrorTemplate"                     value="" /> 
    6160                <!--Messagebox Style (css) class name to use. Look at the messagebox.cfm in the includes directory--> 
    6261                <Setting name="MessageboxStyleOverride"         value="false" /> 
     
    128127                maxPersistentRequestProfilers : Max records to keep in the profiler. Don't get gready. 
    129128              &nb