This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<!---Contact.cfc---> | |
<cfcomponent extends="Model" output="false"> | |
<cffunction name="init"> | |
<cfset property(name="createdBy", defaultValue=session.currentuser.id)> | |
<cfset property(name="updatedBy", defaultValue=session.currentuser.id)> | |
<cfset hasMany(name="emailaddresses", dependent="deleteAll")> | |
<cfset hasMany(name="categories", dependent="deleteAll")> | |
<cfset nestedProperties(associations="emailaddresses,categories", allowDelete=true)> | |
</cffunction> | |
</cfcomponent> |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<!---Contacts.cfc---> | |
<cffunction name="init"> | |
<cfset filters(through="getCategoryTypes", only="add,edit,update")> | |
<cfset filters(through="getCurrentContact", only="view,edit,update")> | |
<cfset verifies(only="getCurrentContact", params="key", paramsTypes="integer")> | |
</cffunction> | |
<cffunction name="add" hint="Add a New Contact"> | |
<cfset var newEmailaddress[1]=model("emailaddress").new()> | |
<cfset var newCategory[1]=model("category").new()> |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<!---Edit.cfm---> | |
<cfif params.action EQ "add"> | |
<h2>Add a New Contact</h2> | |
#startFormTag(action="create")# | |
<cfelse> | |
<h2>Editing Contact</h2> | |
#startFormTag(action="update", key=params.key)# | |
</cfif> | |
#errorMessagesFor("contact")# |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<!---_emailaddress.cfm---> | |
<cfoutput> | |
#textField(objectName="contact", association="emailaddresses", position=arguments.current, property="email", label="Email Address", size=62, class="email")# | |
#select(objectName="contact", association="emailaddresses", position=arguments.current, property="type", label="Type", options="Home,Work")# | |
#checkbox(objectName="contact", association="emailaddresses", position=arguments.current, property="preferred", label="Preferred")# | |
</cfoutput> |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<label for="contact-emailaddresses-1-email">Email Address</label> | |
<input type="text" value="" size="62" name="contact[emailaddresses][1][email]" maxlength="500" id="contact-emailaddresses-1-email" class="email valid"> | |
<label for="contact-emailaddresses-1-type">Type</label> | |
<select name="contact[emailaddresses][1][type]" id="contact-emailaddresses-1-type"> | |
<option value="Work" selected="selected">Work</option><option value="Home">Home</option> | |
</select> | |
<label for="contact-emailaddresses-1-preferred" class="checkboxLabel">Preferred</label> | |
<input type="checkbox" value="1" name="contact[emailaddresses][1][preferred]" id="contact-emailaddresses-1-preferred" class="checkbox" checked="checked"> |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<cfoutput> | |
<div id="emailedit[#arguments.current#]" class="emailtemplate clearfix"> | |
<div class="span-11"> | |
#textField(objectName="contact", association="emailaddresses", position=arguments.current, property="email", label="Email Address", size=62, class="email")# | |
</div> | |
<div class="span-3"> | |
#select(objectName="contact", association="emailaddresses", position=arguments.current, property="type", label="Type", options="Work,Home")# | |
</div> | |
<div class="span-3"> | |
#checkbox(objectName="contact", association="emailaddresses", position=arguments.current, property="preferred", label="Preferred")# |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<!--- Dynamic Email Field Template---> | |
<div id="email-templates" class=" clearfix" style="display: none ;"> | |
<div id="::FIELD1::" class="emailtemplate clearfix"> | |
<div class="span-11"> | |
<div class="field"> | |
<label for="contact-emailaddresses-::FIELD2::-email">Email Address</label> | |
<input type="text" value="" size="62" name="contact[emailaddresses][::FIELD12::][email]" maxlength="500" id="contact-emailaddresses-::FIELD3::-email" class="email"> | |
</div> | |
</div> | |
<div class="span-3"> |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<cfoutput> | |
<cfif params.action EQ "add"> | |
<h2>Add a New Contact</h2> | |
#startFormTag(class="generic", id="contact-edit", action="create")# | |
<cfelse> | |
<h2>Editing Contact</h2> | |
#startFormTag(class="generic", id="contact-edit", action="update", key=params.key)# | |
</cfif> | |
#errorMessagesFor("contact")# |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<cffunction name="update"> | |
<cfloop from=1 to="#arraylen(contact.emailaddresses)#" index="i"> | |
<cfset contact.emailaddresses[i].delete()> | |
</cfloop> | |
<cfset contact.update(params.contact)> | |
<cfif contact.hasErrors()> | |
<cfset renderPage(action="edit")> | |
<cfelse> | |
<cfset flashInsert(success="The contact was updated successfully.")> | |
<cfset redirectTo(action="view", key=contact.id)> |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<cfset n1 =0> | |
<cfset n2 =1> | |
<table> | |
<thead> | |
<tr><th>Row</th><th>No.</th><th>Length</th> | |
</thead> | |
<tbody> | |
<cfloop from="1" to="1000" index="i"> | |
<cfset x = (n1 + n2)> | |
<cfoutput> |
OlderNewer