We have a CF 9 project that got upgraded to CF 2016 couple of weeks back. Original developers and the person who upgraded the project left our company. No one in our company ever worked with ColdFusion. So I was asked to do some research in fixing couple of bugs.
Whenever user clicks on different cflayout tabs, source content is getting disappeared after fraction of seconds. If I validate the page source code using IE developer tools, these tabs markup (markup generated by the tab sourceurl)already exists in the markup. But something is stopping this markup from appearing in UI. Can anyone please help me solve this issue?
P.S: First tab (test1) data is always appearing as expected. Other tabs content is always getting disappeared after some time.
Source code is as follows:
<cflayout type="tab" >
<cflayoutarea title="Test1">
<cfinclude template="./grids/test1Grid.cfm">
</cflayoutarea>
<cfif valuationRuns.recordCount gt 0>
<cfif StructKeyExists(URL,'ID')>
<cfset variables.ID = '&ID='&URL.ID>
<cfelse>
<cfset variables.ID = ''>
</cfif>
<cflayoutarea title="Valuation Summary" source="./valuations.cfm?test_record_id=#testId#&test_name=#URLEncodedFormat(test_name)#&runId=summary"
refreshonactivate="true" overflow="hidden" style="height:570px;" ></cflayoutarea>
<cfloop query="valuationRuns">
<cfset RunID = valuationRuns.RunId[currentrow]>
<cfset RunName = valuationRuns.RunName[currentrow]>
<cflayoutarea title="Run #valuationRuns.RunId[currentrow]##IIF(Left(valuationRuns.RunName[currentrow],5) NEQ 'RunID',DE(' - #valuationRuns.RunName[currentrow]#'),DE(''))#" source="./valuations.cfm?test_record_id=#testId#&test_name=#URLEncodedFormat(test_name)#&runId=#RunId#&runName=#URLEncodedFormat(RunName)##IIF(StructKeyExists(URL,'ID'),DE('#variables.ID#'),DE(''))#"
refreshonactivate="true" overflow="hidden" style="height:570px;" ></cflayoutarea>
</cfloop>
</cfif>
Related
OK, so I've spent the last couple of days researching this issue on various websites including this one and I'm still no closer to having an answer. I have seen claims that this was a bug and was fixed on Adobe's end in one of the CF11 patches and I have even seen one answer that claimed that Adobe was emailing the fix directly to individuals - though no information on how to go about getting Adobe to do that was provided on that webpage.
We just updated our intranet to Coldfusion 11 and pages that have a cfgrid using the HTML format and bind data from a cfc no longer show the cfgrid on the page. Other pages that use the Flash format with cfgrid (which apparently can't use the bind attribute with Flash) do work. These HTML cfgrid pages were working properly in Coldfusion 9 before we migrated to 11.
I have simplified the code as much as I can to eliminate other error possibilities - i.e. I've stripped out formatting and am pulling only a couple columns from the database. Here is the code I am currently working on in my dev sandbox:
<cfgrid format="html"
name="userGrid"
bind="cfc:editorFunc.getGridData({cfgridpage},{cfgridpagesize},{cfgridsortcolumn},{cfgridsortdirection})"
pagesize="20">
<cfgridcolumn name="REGION" header="Region">
<cfgridcolumn name="managmentArea" header="Management Area">
</cfgrid>
Here is the code in the cfc (the query does produce results when dumped to the page):
<cffunction name="getGridData" access="remote">
<cfargument name="page">
<cfargument name="pageSize">
<cfargument name="gridsortcolumn">
<cfargument name="gridsortdir">
<cfquery name="records" datasource="webData">
SELECT REGION, managmentArea
FROM areaDesc
ORDER BY Region ASC
</cfquery>
<cfset result = queryConvertForGrid(duplicate(records), arguments.page, arguments.pagesize)>
<cfreturn result>
</cffunction>
Has anyone had any luck getting a cfgrid like this to work in CF11? I could try a JQuery solution like JGrid, however I would prefer to figure out the existing issue with this code if possible.
Any help is much appreciated.
Add this..
<cfif not len(trim(arguments.gridsortcolumn))>
<cfset arguments.gridsortcolumn = "REGION">
<cfset arguments.gridsortdir = "desc">
</cfif>
query....
ORDER BY #arguments.gridsortcolumn# #arguments.gridsortdir#
Is there a way to exclude certain items by filetype in a list in Coldfusion?
Background: I just integrated a compression tool into an existing application and ran into the problem of the person's prior code would automatically grab the file from the upload destination on the server and push it to the Network Attached Storage. The aim now is to stop their NAS migration code from moving all files to the NAS, only those which are not PDF's. What I want to do is loop through their variable that stores the names of the files uploaded, and exclude the pdf's from the list then pass the list onto the NAS code, so all non pdf's are moved and all pdf's uploaded remain on the server. Working with their code is a challenge as no one commented or documented anything and I've been trying several approaches.
<cffile action="upload" destination= "c:\uploads\" result="myfiles" nameconflict="makeunique" >
<cfset fileSys = CreateObject('component','cfc.FileManagement')>
<cfif Len(get.realec_transactionid)>
<cfset internalOnly=1 >
</cfif>
**This line below is what I want to loop through and exclude file names
with pdf extensions **
<cfset uploadedfilenames='#myfiles.clientFile#' >
<CFSET a_insert_time = #TimeFormat(Now(), "HH:mm:ss")#>
<CFSET a_insert_date = #DateFormat(Now(), "mm-dd-yyyy")#>
**This line calls their method from another cfc that has all the file
migration methods.**
<cfset new_file_name = #fileSys.MoveFromUploads(uploadedfilenames)#>
**Once it moves the file to the NAS, it inserts the file info into the
DB table here**
<cfquery name="addFile" datasource="#request.dsn#">
INSERT INTO upload_many (title_id, fileDate, filetime, fileupload)
VALUES('#get.title_id#', '#dateTimeStamp#', '#a_insert_time#', '#new_file_name#')
</cfquery>
<cfelse>
<cffile action="upload" destination= #ExpandPath("./uploaded_files/zip.txt")# nameconflict="overwrite" >
</cfif>
Update 6/18
Trying the recommended code helps with the issue of sorting out filetypes when tested outside of the application, but anytime its integrated into the application to operate on the variable uploadedfilenames the rest of the application fails and the multi-file upload module just throws a status 500 error and no errors are reported in the CF logs. I've found that simply trying to run a cfloop on another variable not related to anything in the code still causes it to error.
As per my understanding, you want to filter-out file names with a specific file type/extension (ex: pdf) from the main list uploadedfilenames. This is one of the easiest ways:
<cfset lFileNames = "C:\myfiles\proj\icon-img-12.png,C:\myfiles\proj\sample-file.ppt,C:\myfiles\proj\fin-doc1.docx,C:\myfiles\proj\fin-doc2.pdf,C:\myfiles\proj\invoice-temp.docx,C:\myfiles\proj\invoice-final.pdf" />
<cfset lResultList = "" />
<cfset fileExtToExclude = "pdf" />
<cfloop list="#lFileNames#" index="fileItem" delimiters=",">
<cfif ListLast(ListLast(fileItem,'\'),'.') NEQ fileExtToExclude>
<cfset lResultList = ListAppend(lResultList,"#fileItem#") />
</cfif>
</cfloop>
Using only List Function provided by ColdFusion this is easily done, you can test and try the code here. I would recommend you to wrap this code around a function for easy handling. Another way to do it would be to use some complex regular expression on the list (if you're looking for a more general solution, outside the context of ColdFusion).
Now, applying the solution to your problem:
<cfset uploadedfilenames='#myfiles.clientFile#' >
<cfset lResultList = "" />
<cfset fileExtToExclude = "pdf" />
<cfloop list="#uploadedfilenames#" index="fileItem" delimiters=",">
<cfif ListLast(ListLast(fileItem,'\'),'.') NEQ fileExtToExclude>
<cfset lResultList = ListAppend(lResultList,fileItem) />
</cfif>
</cfloop>
<cfset uploadedfilenames = lResultList />
<!--- rest of your code continues --->
The result list lResultList is copied to the original variable uploadedfilenames.
I hope I'm not misunderstanding the question, but why don't you just wrap all of that in an if-statement that reads the full file name? Whether the files are coming one by one or through a delimited list, it should be easy to work around.
<cfif !listContains(ListName, '.pdf')>
OR
<cfif FileName does not contain '.pdf'>
then
all the code you posted
I am severely new to ColdFusion... I have searched for help on this statement and have found a bunch of material, but still don't understand what is going on. All of the parts of this statement make sense, but when I put them all together, it's confusing... the ColdFusion 8: IsDefined("URL.variable) and is not"" thread is the closest, but I still don't understand. This is the 1st statement in the index.cfm file of my application. It's not throwing an error, I just want to understand how it works. Thank you.
I have yet to be able to successfully post code here, so here is a link to a text version of the index.cfm.
Edit:
The code below should be the relevant sections related to URL.openFile
<cfif isdefined("URL.openFile")>
<cfquery name="getFile" datasource="xxxxxxxx">
SELECT filename, filename2, filecontent, filesize
FROM Help_FooterInfo
WHERE Help_id=5 and Section='Registration'
</cfquery>
<cfset sproot=#getDirectoryFromPath(getTemplatePath())#>
<cfset newDest = #sproot#&"temp\">
<cfoutput query="getFile">
<cfheader name="Content-Disposition" value="attachment; filename=#getfile.FileName2#">
<cfcontent type="application/msword" variable="#getfile.filecontent#">
</cfoutput>
</cfif>
...
<cfquery name="getRegistration" datasource="xxxxxxxx">
select * from help_footerinfo where help_id=5
</cfquery>
....
<cfoutput>#getRegistration.Content#</cfoutput><br>
<a href="<cfif #getRegistration.filename2# neq "">index.cfm?openfile=Yes</cfif>" target="_blank">
<u><cfoutput>#getRegistration.FileName#</cfoutput></u>
</a>
The error message I am receiving (see comment below): ORA-00942: table or view does not exist (ColdFusion application)
This:
<cfif IsDefined("URL.variable") and URL.variable is not "" >
means, "If url.variable actually exists and is not an empty string".
A better alternative for isDefined("URL.variable") is StructKeyExists(url,"variable").
Other alternatives for is not "" include len(trim(url.variable)) gt 0, and isNumeric(url.variable).
My customer is encountering the error The 2 parameter of the Left function, which is now -1, must be a positive integer after migrating from ColdFusion 8 to ColdFusion 10. The page performs as expected in Firefox 31 and Chrome 36 on Windows 7. However, this error occurs in IE9 but not IE7. Are there different security settings in IE9 that prohibit the processing of the code?
The snippet of code in question is:
<!--- Populate the UserInfo struct --->
<cfloop INDEX="item" LIST="#COOKIE.MYELVIS_USERINFO#" DELIMITERS="&">
<cfset delim = #FindOneOf("=",item)#>
<cfif (len(item)-delim)>
<cfset UserInfo[UCase(left(item,delim-1))] = right(item,len(item)-delim)>
<cfelse>
<cfset UserInfo[UCase(left(item,delim-1))] = "">
</cfif>
</cfloop>
I'm torn to say it's a code error when it works in other browsers, just not IE9. Any thoughts? Thank you.
Perhaps have him clear cookies, he might have a holdover from cf 8 and perhaps the two versions encode differently. It looks like, if this is possible, one of the values doesn't contain a =.
Upon reviewing your code, I think this is what you need.
<cfloop INDEX="item" LIST="#COOKIE.MYELVIS_USERINFO#" DELIMITERS="&">
<cfset delim = #FindOneOf("=",item)#>
<cfif (delim) and (len(item)-delim)>
<cfset UserInfo[UCase(left(item,delim-1))] = right(item,len(item)-delim)>
<cfelse>
<cfset UserInfo[UCase(item)] = "">
</cfif>
</cfloop>
I am using Coldfusion 8 and I am trying to serve a file of 15mo with cf_content. The problem is that the download freezes randomly. At the moment, I only tried locally, therefore the network is not the problem. I have tried with smaller files and freezes happen less often. I have no idea of the root of the problem. Here is my coldfusion code:
<cfheader name="Content-Disposition" value="attachment; filename=test.zip">
<cfcontent type="application/zip" file="C:\Test.zip" deletefile="no">
I tried to download the file with Chrome, IE and with a piece of java code to download the file (freeze on the read method after some iteration).
Do you have any idea of how I can easily stream a file using Coldfusion? Maybe it is possible using a Java Custom tags but how to write bytes to page as the custom tag write method of the Response object only allows to write a String?
I did this for a client. I am gathering a number of documents and zipping them for download. Rather than stream them, I save the zip file on the server:
<cfzip action="zip" file="#expandpath('/data/briefcase/')##session.order_id#.zip" source="#expandpath('/data/briefcase/')##session.order_id#" overwrite="yes" storepath="no">
Then I provide the user a link to download the file. That way, if it fails, they can always try again.
I then wrote a scheduled task that runs every day and delete any zip files more than 24 hours old.
<cfdirectory action="list" directory="#expandpath('/data/briefcase/')#" name="filelist" >
<cfquery name="filter_file" dbtype="query" >
SELECT * from filelist WHERE datelastmodified < #dateadd("h", -48, now())# AND type = 'File'
</cfquery>
<cfquery name="filter_dir" dbtype="query" >
SELECT * from filelist WHERE datelastmodified < #dateadd("h", -48, now())# AND type = 'Dir'
</cfquery>
<cfset path = expandpath('/data/briefcase/')>
<cfoutput query="filter_file">
<cfif fileexists('#directory#/#name#')>
<cffile action="delete" file="#directory#/#name#" >
</cfif>
</cfoutput>
<cfoutput query="filter_dir">
<cfif directoryexists('#directory#/#name#')>
<cfdirectory action="delete" directory="#directory#/#name#" recurse="true" >
</cfif>
</cfoutput>
See if helps to prepend your code with:
<cfheader name="Content-Length" value="#GetFileInfo('C:\Test.zip').size#">
That tells the browser how much data to expect.