I don't know PHP either, but this looks pretty straightforward.
I'm assuming that the "request" in this case is a form post, and I don't
know if the "save" action should do an APPEND or a WRITE (I'm guessing it's
a WRITE), but this looks close to me.
<cfset reportFile = expandPath(".") & "/" & form.reportName & "." &
form.reportID & "_sql" />
<cfswitch expression="#form.op#">
<cfcase value="load">
<cffile action="READ" file="#reportFile#" variable="ff" />
<cfoutput>#ff#</cfoutput>
</cfcase>
<cfcase value="save">
<cfset qry = form.queryToSave />
<cffile action="WRITE" file="#reportFile#" output="#qry#"
nameconflict="OVERWRITE" />
<cfoutput>#form.reportName#</cfoutput> saved ...
</cfcase>
<cfcase value="list">
<cfdirectory action="LIST" directory="#expandPath('.')#" name="files"
/>
<cfsavecontent variable="out">
<cfoutput>
<ul class="treeview" id="treeview_#form.reportID#">
<li class="list">
Saved sql files
<ul>
<cfloop query="files">
<cfif right(name, 4) is "_sql">
<li class="item">
#listFirst(name, ".")#
</li>
</cfif>
</cfloop>
</ul>
</li>
</ul>
</cfoutput>
</cfsavecontent>
</cfcase>
</cfswitch>
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~|
Want to reach the ColdFusion community with something they want? Let them know
on the House of Fusion mailing lists
Archive:
http://www.houseoffusion.com/groups/cf-talk/message.cfm/messageid:332409
Subscription: http://www.houseoffusion.com/groups/cf-talk/subscribe.cfm
Unsubscribe: http://www.houseoffusion.com/groups/cf-talk/unsubscribe.cfm