Forums
This topic is locked
File Select icon
Posted 24 Jul 2001 23:43:30
1
has voted
24 Jul 2001 23:43:30 Bruno Mairlot posted:
In the form design of an extension, how can I have an icon to select file instead of a poor Browse button ?Replies
Replied 25 Jul 2001 01:26:24
25 Jul 2001 01:26:24 Waldo Smeets replied:
<input name="myFile" type="text" style="width:230px">
<img src="theSrc.gif" onClick="browseFile(document.myFile,true)">
Don't forget to put the following link in the head of your document (make sure that it links to the correct folder):
<SCRIPT SRC="configuration/Shared/MM/Scripts/CMN/file.js"></SCRIPT>
You can find a nice icon named browsefolder.gif in /configuration/inspectors/ I think.
Waldo Smeets - www.UDzone.com Webmaster
------------------------------------------
www.UDzone.com : A dynamic Dreamweaver,
Ultradev and Fireworks site for developers
by developers.
------------------------------------------
<img src="theSrc.gif" onClick="browseFile(document.myFile,true)">
Don't forget to put the following link in the head of your document (make sure that it links to the correct folder):
<SCRIPT SRC="configuration/Shared/MM/Scripts/CMN/file.js"></SCRIPT>
You can find a nice icon named browsefolder.gif in /configuration/inspectors/ I think.
Waldo Smeets - www.UDzone.com Webmaster
------------------------------------------
www.UDzone.com : A dynamic Dreamweaver,
Ultradev and Fireworks site for developers
by developers.
------------------------------------------
Replied 25 Jul 2001 19:22:56
25 Jul 2001 19:22:56 Bruno Mairlot replied:
Thanks the icon is now correct. I should have though to. I've already done it that way.
But, the onClick="browseFile(document.myFile,true)" doesn't work. The pointer doesn't change, and nothing happen <img src=../images/dmxzone/forum/icon_smile_question.gif border=0 align=middle>
I looked at the doc and found that there is a function dreamweaver.browseForFileURL() that allows the user to select file...But it doesn't work either. I've even tried to put the img into a <a href="#" onClick="dreamweaver.browseForFileURL()"... but nothing too.
But there is more...When I'm using the <input type="file" It works, but I cannot receive the DOM of this file...Strange. All I have managed to do is to read the content of the file. But being able to get all the Node of the files would be really helpful.
My goal is to scan some HTML file that the user select. Actually it is not needed that the user select a file, but I think it might be better for the user.
But, the onClick="browseFile(document.myFile,true)" doesn't work. The pointer doesn't change, and nothing happen <img src=../images/dmxzone/forum/icon_smile_question.gif border=0 align=middle>
I looked at the doc and found that there is a function dreamweaver.browseForFileURL() that allows the user to select file...But it doesn't work either. I've even tried to put the img into a <a href="#" onClick="dreamweaver.browseForFileURL()"... but nothing too.
But there is more...When I'm using the <input type="file" It works, but I cannot receive the DOM of this file...Strange. All I have managed to do is to read the content of the file. But being able to get all the Node of the files would be really helpful.
My goal is to scan some HTML file that the user select. Actually it is not needed that the user select a file, but I think it might be better for the user.
Replied 25 Jul 2001 19:48:41
25 Jul 2001 19:48:41 Bruno Mairlot replied:
Self Answer...but for Waldo too
Waldo, the Event you have to set is not onClick but onMouseUp (onMouseDown and onMouseOut works too).
I still have to find a way to have the Nodes of the file...
Do you have any pointer. Suppose I have the file URL,I want to know about some specific tag...How would you do that ?
If I find before answer, I'll post a second self-answer <img src=../images/dmxzone/forum/icon_smile_big.gif border=0 align=middle>
"First they laugh at you, then they fight you, then you Win..." Ghandi
Waldo, the Event you have to set is not onClick but onMouseUp (onMouseDown and onMouseOut works too).
I still have to find a way to have the Nodes of the file...
Do you have any pointer. Suppose I have the file URL,I want to know about some specific tag...How would you do that ?
If I find before answer, I'll post a second self-answer <img src=../images/dmxzone/forum/icon_smile_big.gif border=0 align=middle>
"First they laugh at you, then they fight you, then you Win..." Ghandi
Replied 26 Jul 2001 00:47:17
26 Jul 2001 00:47:17 Waldo Smeets replied:
Ai! I forgot about that. That is correct. Strange thing is that I just copied the script from a Macromedia extension that used a browse button. Maybe that makes the difference... the Dreamweaver events model does not seem to be like Netscape.
About your other question: I am sorry but I have absolutely no idea. When I come up with something I'll let you know.
Waldo Smeets - www.UDzone.com Webmaster
------------------------------------------
www.UDzone.com : A dynamic Dreamweaver,
Ultradev and Fireworks site for developers
by developers.
------------------------------------------
About your other question: I am sorry but I have absolutely no idea. When I come up with something I'll let you know.
Waldo Smeets - www.UDzone.com Webmaster
------------------------------------------
www.UDzone.com : A dynamic Dreamweaver,
Ultradev and Fireworks site for developers
by developers.
------------------------------------------
Replied 26 Jul 2001 10:12:21
26 Jul 2001 10:12:21 Bruno Mairlot replied:
<BLOCKQUOTE id=quote><font size=1 face="Verdana, Arial, Helvetica" id=quote>quote:<hr height=1 noshade id=quote>
About your other question: I am sorry but I have absolutely no idea. When I come up with something I'll let you know.
<hr height=1 noshade id=quote></BLOCKQUOTE id=quote></font id=quote><font face="Verdana, Arial, Helvetica" size=2 id=quote>
After having spend part of the late evening yesterday I found my way <img src=../images/dmxzone/forum/icon_smile.gif border=0 align=middle>
Well actually the way to do that is :
1. use dreamweaver.browsForFileURL() to get the file URL
2. use dreamweaver.openFileFromSite() to get the DOM of the document.
3. Then you have the DOM, you can use the function getElementsByTagName(<i>name</i> to get a NodeList (which is an array of Node)
You could use other function to work on the DOM, but it worked fine for my purpose, so I'm happy.
I have finalized the first beta of my extension. I'll work on it a little today.
Do you think I should finalize it completely before releasing on UD or should I release more often ? I'll probably need betatester <img src=../images/dmxzone/forum/icon_smile_wink.gif border=0 align=middle>
Are you interested ?
"First they laugh at you, then they fight you, then you Win..." Ghandi
About your other question: I am sorry but I have absolutely no idea. When I come up with something I'll let you know.
<hr height=1 noshade id=quote></BLOCKQUOTE id=quote></font id=quote><font face="Verdana, Arial, Helvetica" size=2 id=quote>
After having spend part of the late evening yesterday I found my way <img src=../images/dmxzone/forum/icon_smile.gif border=0 align=middle>
Well actually the way to do that is :
1. use dreamweaver.browsForFileURL() to get the file URL
2. use dreamweaver.openFileFromSite() to get the DOM of the document.
3. Then you have the DOM, you can use the function getElementsByTagName(<i>name</i> to get a NodeList (which is an array of Node)
You could use other function to work on the DOM, but it worked fine for my purpose, so I'm happy.
I have finalized the first beta of my extension. I'll work on it a little today.
Do you think I should finalize it completely before releasing on UD or should I release more often ? I'll probably need betatester <img src=../images/dmxzone/forum/icon_smile_wink.gif border=0 align=middle>
Are you interested ?
"First they laugh at you, then they fight you, then you Win..." Ghandi
Replied 26 Jul 2001 10:35:16
26 Jul 2001 10:35:16 Waldo Smeets replied:
Cool, so openFileFromSite() is the function that gets the document. That's what I have never done myself. Nice.
About the extension and test it: We have a beta extensions list at UDzone that you could post your extension to. ANd when you think it is ready and you submit it to our site then we also do some tests on it. So does the Macromedia Exchange.
So my advice: go for the beta extensions mailinglist (see our news archive for the link, or do a search on our site) and post your beta there.
Waldo Smeets - www.UDzone.com Webmaster
------------------------------------------
www.UDzone.com : A dynamic Dreamweaver,
Ultradev and Fireworks site for developers
by developers.
------------------------------------------
About the extension and test it: We have a beta extensions list at UDzone that you could post your extension to. ANd when you think it is ready and you submit it to our site then we also do some tests on it. So does the Macromedia Exchange.
So my advice: go for the beta extensions mailinglist (see our news archive for the link, or do a search on our site) and post your beta there.
Waldo Smeets - www.UDzone.com Webmaster
------------------------------------------
www.UDzone.com : A dynamic Dreamweaver,
Ultradev and Fireworks site for developers
by developers.
------------------------------------------
Replied 26 Jul 2001 12:35:08
26 Jul 2001 12:35:08 Bruno Mairlot replied:
Well the function is indeed openFileFromSite()
but you have to be careful about the fileURL because, it will send you a relative url (relative to your site root), but when you'll try to open it with openFileFromSite, then it will be relative to your extension folder.
I'm developping a floater, so the extension file is in %dreamweaver/Configuration/Floaters and if I want to open help.html, it says that %dreamweaver/Configuration/Floaters/test.html doesn't exist.
So you have to concatenate getSiteRoot and fileURl to be sure you have the right file.
Another point I haven't solutionned up to now is : When the file you select is already open in DW you can't use openFileFromSite() to get theDOM. How can I get the DOM of a already open document that has not the focus of the user ?
Is there a function to know every opened document or something like that that I could compare against the selected file ?
Thank you
"First they laugh at you, then they fight you, then you Win..." Ghandi
but you have to be careful about the fileURL because, it will send you a relative url (relative to your site root), but when you'll try to open it with openFileFromSite, then it will be relative to your extension folder.
I'm developping a floater, so the extension file is in %dreamweaver/Configuration/Floaters and if I want to open help.html, it says that %dreamweaver/Configuration/Floaters/test.html doesn't exist.
So you have to concatenate getSiteRoot and fileURl to be sure you have the right file.
Another point I haven't solutionned up to now is : When the file you select is already open in DW you can't use openFileFromSite() to get theDOM. How can I get the DOM of a already open document that has not the focus of the user ?
Is there a function to know every opened document or something like that that I could compare against the selected file ?
Thank you
"First they laugh at you, then they fight you, then you Win..." Ghandi
Replied 26 Jul 2001 12:52:16
26 Jul 2001 12:52:16 Waldo Smeets replied:
Do you really want to do that? I think it would consume very much recourses when it is possible. We have an extension in our productivity category that remembers all used files in a DW session. Maybe that helps you.
Personally I would just add a note to the extensions interface stating that the file you are browsing to should not be open in dreamweaver already.
Waldo Smeets - www.UDzone.com Webmaster
------------------------------------------
www.UDzone.com : A dynamic Dreamweaver,
Ultradev and Fireworks site for developers
by developers.
------------------------------------------
Personally I would just add a note to the extensions interface stating that the file you are browsing to should not be open in dreamweaver already.
Waldo Smeets - www.UDzone.com Webmaster
------------------------------------------
www.UDzone.com : A dynamic Dreamweaver,
Ultradev and Fireworks site for developers
by developers.
------------------------------------------
Replied 26 Jul 2001 13:09:02
26 Jul 2001 13:09:02 Bruno Mairlot replied:
<BLOCKQUOTE id=quote><font size=1 face="Verdana, Arial, Helvetica" id=quote>quote:<hr height=1 noshade id=quote>
Do you really want to do that? I think it would consume very much recourses when it is possible. We have an extension in our productivity category that remembers all used files in a DW session. Maybe that helps you.
<hr height=1 noshade id=quote></BLOCKQUOTE id=quote></font id=quote><font face="Verdana, Arial, Helvetica" size=2 id=quote>
Well I just want to compare file name, not file content <img src=../images/dmxzone/forum/icon_smile.gif border=0 align=middle> This shouldn't use much ressources, should it ?
"First they laugh at you, then they fight you, then you Win..." Ghandi
Do you really want to do that? I think it would consume very much recourses when it is possible. We have an extension in our productivity category that remembers all used files in a DW session. Maybe that helps you.
<hr height=1 noshade id=quote></BLOCKQUOTE id=quote></font id=quote><font face="Verdana, Arial, Helvetica" size=2 id=quote>
Well I just want to compare file name, not file content <img src=../images/dmxzone/forum/icon_smile.gif border=0 align=middle> This shouldn't use much ressources, should it ?
"First they laugh at you, then they fight you, then you Win..." Ghandi