I'm having trouble getting my display method to fire.  For a given custom
rule, say 'ruleNTPSidebar', or <applicationName>/rules/ruleNTPSidebar.cfc, I have a
corresponding display method in <applicationName>/webskin/NTPSidebar.  The file is 
named
displayTeaserNTPSidebar.cfm.

My problem: the rule shows up, and I can add it to my container, update
the content, etc.  However, the display method isn't being called.

The rule:

// CODE -------------------------------------------------

<cfcomponent displayname="Sidebar Rule" 
extends="farcry.farcry_core.packages.rules.rules" hint="Display a sidebar for the NTP 
web site" bCustomRule="1">

        <cfproperty name="latestNewsTitle"      
                type="string" 
                hint="Latest News Section Title"        
                required="no">
        <cfproperty 
                name="pressCenterTitle" 
                type="string" 
                hint="Press Center Section Title"       
                required="no">
        <cfproperty 
                name="resourceTitle"    
                type="string" 
                hint="Resource Section Title"           
                required="no">
        <cfproperty 
                name="helpTitle"                
                type="string" 
                hint="Help Section Title"                       
                required="no">
        <cfproperty 
                name="displayMethod"    
                type="string" 
                hint="Display method to render this sidebar rule with." 
                required="yes" 
                default="displayTeaserNTPSidebar">

        <cffunction access="public" name="update" output="true" hint="Edit/Update 
method. Shows an edit form then passes structure to update method">
                <cfargument name="objectID" required="Yes" type="uuid" default="">
                                
                <!--- import tag library --->
                <cfimport taglib="/farcry/fourq/tags/" prefix="q4">
                <cfimport taglib="/farcry/farcry_core/tags/navajo/" prefix="nj">

                <cfset stObj = this.getData(arguments.objectID)> 
                
                <cfif isDefined("form.updateRule")>
                        <!--- create array for update --->
                        <cfscript>
                                stObj.displayMethod             = form.displayMethod;
                                stObj.latestNewsTitle   = form.latestNewsTitle;
                                stObj.pressCenterTitle  = form.pressCenterTitle;
                                stObj.resourceTitle     = form.resourceTitle;
                                stObj.helpTitle                 = form.helpTitle;
                        </cfscript>
                        <!--- update object --->
                        <q4:contentobjectdata 
typename="#application.custompackagepath#.rules.ruleNTPSidebar" stProperties="#stObj#" 
objectID="#stObj.objectID#">
                        
                        <!--- display success message --->                             
         
                        <strong>Update Successful</strong>
                </cfif>
                
                <!--- get the display methods for ntpSidebar type--->
                <nj:listTemplates typename="NTPSidebar" prefix="displayTeaser" 
r_qMethods="qDisplayTypes">
                 
                <!--- show form --->
                <form action="" method="POST">
                <input type="hidden" name="ruleID" value="#stObj.objectID#">
                <table width="100%" align="center" border="0">          
                        <tr>
                                <td width="20%" colspan="1" align="right"><b>Display 
method:</b></td>
                                <td>
                                <select name="displayMethod" size="1" class="field">
                                <!--- show available display methods --->
                                <cfloop query="qDisplayTypes">
                                        <option value="#methodName#" <cfif methodName 
is stObj.displayMethod>selected</cfif>>#displayName#</option>
                                </cfloop>
                                </select>
                                </td>
                        </tr>
                        <tr>
                                <td align="right"><b>Latest News Title:</b></td> 
                                <td><input type="Text" name="latestNewsTitle" 
value="#stObj.latestNewsTitle#" size="250"></td>
                        </tr>
                        <tr>
                                <td align="right"><b>Press Center Title:</b></td> 
                                <td><input type="Text" name="pressCenterTitle" 
value="#stObj.pressCenterTitle#" size="250"></td>
                        </tr>
                        <tr>
                                <td align="right"><b>Resources Title:</b></td> 
                                <td><input type="Text" name="resourceTitle" 
value="#stObj.resourceTitle#" size="250"></td>
                        </tr>                   
                        <tr>
                                <td align="right"><b>Help Title:</b></td> 
                                <td><input type="Text" name="helpTitle" 
value="#stObj.helpTitle#" size="250"></td>
                        </tr>                           
                </table>        
                <br>    
                <input class="normalbttnstyle" type="submit" value="Update" 
name="updateRule">
                </form>
        </cffunction> 
        
        <cffunction access="public" name="execute" output="true" hint="Execute method 
that gets title text for each sidebar item.">
                <cfargument name="objectID"             required="Yes"          
type="uuid">
                <cfargument name="latestNewsTitle"      required="Yes"          
type="String">
                <cfargument name="pressCenterTitle" required="Yes"              
type="String">
                <cfargument name="resourceTitle"        required="Yes"          
type="String">
                <cfargument name="helpTitle"            required="Yes"          
type="String">
                <cfargument name="dsn"                          required="Yes"  
type="string" default="#application.dsn#">
                
                <!--- get rule data --->
                <cfset stObj = this.getData(arguments.objectID)> 
                
                <cfset lStatus = 
"#ListChangeDelims(request.mode.lValidStatus,"','",",")#">
                
                <!--- get photos marked as use in random photo and with status --->
                <cfquery datasource="#arguments.dsn#" name="qGetSidebar">
                        SELECT * FROM rulentpsidebar limit 1;
                </cfquery>              
                
                <!-- Set up data array --->
                <cfset sideAr = ArrayNew(1)>
                <cfset sideAr[1] = qGetSidebar.latestNewsTitle>
                <cfset sideAr[2] = qGetSidebar.pressCenterTitle>
                <cfset sideAr[3] = qGetSidebar.resourceTitle>
                <cfset sideAr[4] = qGetSidebar.helpTitle>
                
                <cfif qGetSideBar.recordcount>
                        <cfoutput>#qGetSidebar.latestNewsTitle#</cfoutput>
                </cfif>
                
                <!--- display sidebar with chosen display method --->
                <cfscript>
                        o = createObject("component",
"#application.custompackagepath#.types.NTPSidebar");
                        o.getDisplay(sideAr, stObj.displayMethod);      
                </cfscript>
        </cffunction> 
        
</cfcomponent>


// END CODE ---------------------------------------------


Any help would be most appreciated.


Mike

---
You are currently subscribed to farcry-dev as: [EMAIL PROTECTED]
To unsubscribe send a blank email to [EMAIL PROTECTED]

MXDU2004 + Macromedia DevCon AsiaPac + Sydney, Australia
http://www.mxdu.com/ + 24-25 February, 2004

Reply via email to