cf_window additions

Word Count: 522

I decided to throw in a couple of additions as well as a solution for a problem some people where having. The first thing I added was a source attribute. This will be an external URL that you can load into a window. You may be asking yourself, what about the autoLoad attribute. Right now the updater will only load files from the same domain and I believe there are security reasons behind that. If you try and pass an external URL to the autoLoad attribute it will not work. That is where the source comes in, it will trick the window and load the URL into and iframe that fills the window. I may remove autoLoad later and based the domain of the source figure out if I should auto load it or throw it in an iframe but we will visit that another time. Here is a quick example of how to use the source attribute.

<cfimport prefix="ext" taglib="cfext">
<html>
<head>
   <title>cf_window / External SRC Example</title>
   <ext:include widget="cfwindow"/>
</head>

<body>
   
   <ext:window id="adobe" title="www.adobe.com" width="800" height="600" modal="true"
            closeAction="hide" collapsible="true" bodyStyle="padding:0px;" source="http://www.adobe.com">

   </ext:window>   
   
   <a href="##" onclick="adobe.show();">www.adobe.com</a>
   <br /><br />
   
</body>
</html>

Next I added some features to the include library. The first is the ability to pass in a theme name. Themes change the appearance of the windows. Right now the only other option is the gray theme so you can just pass in gray as the theme. Also many people were having issues with path issues and the include files. This would happen if you had the cfext folder placed in the root and tried to call the tag from somewhere else in your application. I think (and the jury is still out so let me know) an easy fix for this is to pass in a full path to the cfext folder. An example would be I placed the folder under folder whatever from the root. My Path would be http://www.danvega.org/whatever/. This should just give full paths to the includes and should resolve that issue. Again please let me know for those of you having that problem. Here is an example of combining both of these features.
<cfimport prefix="ext" taglib="cfext">
<html>
<head>
   <title>cf_window / Full Path</title>
   <ext:include widget="cfwindow" path="http://www.danvega.org/examples/" theme="gray"/>

</head>

<body>
   
   <ext:window title="A Basic Window" width="300" height="200">
      I am <strong>html</strong>
   </ext:window>
   
</body>
</html>
Finally I have added all of these examples to the demo page. Let me know how everything looks. I think I am finally close to focusing on planning out a full library.
http://www.danvega.org/examples/cfwindow/

Comments

#1 Posted By: Trond Ulseth Posted On: 1/11/08 4:30 AM
Hi Dan,

I ran into the problem you describe where the cfext was directly under the root, but called from a page deeper down in the site structure.

What I did was change a couple of lines in the include.cfm code. I changed

<script type="text/javascript" language="javascript" src="cfext/ext/window.js"></script>
   <link href="cfext/ext/resources/css/ext-all.css" type="text/css" rel="stylesheet"/>

to

<script type="text/javascript" language="javascript" src="/cfext/ext/window.js"></script>
   <link href="/cfext/ext/resources/css/ext-all.css" type="text/css" rel="stylesheet"/>

And that solved the problem for me. Now it will run only if cfext is directly under the root, but that is not an issue for me.

It's probably not a big thing to make it figure out the correct path at runtime either, just I am lazy and took the easy way out :)
#2 Posted By: Michael Brennan-White Posted On: 1/11/08 8:18 AM
I love the window examples using the ext 2.0 instead of 1.1. Is there a way that I could use these examples in CF8 and still be able to use the newer CF8 functionality like ColdFusion.Window.hide by passing in the Window Name?
#3 Posted By: Dan Vega Posted On: 1/11/08 8:21 AM |
Author Comment
The windows both have the same functionality, they just go about it a different way. If you want to hide the window all you have to do is give your window and id.

<ext:window id="mywindow">
</ext:window>
<a href="##" onclick="mywindow.show()">Show Window</a>
<a href="##" onclick="mywindow.hide()">Hide Window</a>

If that does not work for you let me know!
#4 Posted By: Nicole Rutter Posted On: 3/21/08 1:48 PM
I am trying to assign my own unique ID to the windows but it keeps erroring on me. I am using coldFusion to output a userID. How do I assign a unique ID to this so that it creates a unique id each time?

   <cfoutput query="myList">
      #myList.myID#
   <ext:include widget="cfwindow"/>
   <ext:window id="windowa#myList.myID#" title="Window A" width="600" height="400" collapsible="true" closeAction="hide">
      <table width="300" border="1" cellpadding="0" cellspacing="0">
         <tr>
            <td>List</td>
         </tr>
      </table>
      <table width="300" border="1" cellpadding="0" cellspacing="0">
            <tr>
               <td>My ID:#myID.id#</td>
               <td>Customer Name:#myID.name#</td>
            </tr>
      </table><br/>
   </ext:window>   
   
   <a href="##" onclick="windowa#myList.myID#.show();">Window A</a>
   <br /><br />
   </cfoutput>
#5 Posted By: Dan Vega Posted On: 3/21/08 1:52 PM |
Author Comment
Everything looks ok..What is the error your getting?
#6 Posted By: Igor Mazor Posted On: 11/16/08 11:42 AM
I try to using you cf-window custom tag, it very impressive. I like better then coldfusion 8 tag. I have a little problem. I'm using html form inside of my source file, after I submit my form I get result on the screen fine. I close open window, then when I open window again window display result of the form submission instead of form.
#7 Posted By: AKi Posted On: 4/20/09 12:55 PM
I am trying to have a quite few cf_windows on one page with specified source and I would like to use the same window instance but to be able to pass source variable. Is this possible at all? All my attempts have failed.


Post Your Comment

Leave this field empty







Show Captcha

If you subscribe, any new posts to this thread will be sent to your email address.

Copyright © 2007 Dan Vega | BlogCFC was created by Raymond Camden. This blog is running version 5.8.001.