Auto-Update (beta 1) - Dreamweaver MX and UltraDev Zone

Aug 17, 2001 - upgrade are requested and stored , when all files are download the files are .... Feel free to have a play and I hope this article is of use. Yours ... You can quickly apply bug-fixes and make them instantly available, not to.
553KB taille 9 téléchargements 147 vues
Home

News

Tutorials

General ● ● ● ●

Request a Tutorial Request an Extension Our Sponsors About Us

Search Enter Search:

Extensions

Projects

TalkZones

Books

Links

FAQ's

Polls

MyDMXzone

Welcome Visitor! Username: Share your knowledge with the Dreamweaver MX and UltraDev Community! Download/upload tutorials, extensions, faq's - whatever you Password: want! Registration allows you to fully customize your UDzone.com!

Search Users Stats Active Users: 94 Latest Projects ●

Login

Save Password? Forgot your Password?

● ●



Sign up / register

Go

● ● ● ●

Add News

Projects / Extensions / Auto-Update

Your Stuff Go

Our Main Sponsors

● ●

Auto-Update (beta 1)



1832 Users read it.

RTE On-Line Html Editor My mail application v: 2 Design Time Access for Ch Forms Floater 1.2 MonthTable MySQL Administrator Delete Multiple Records a FileRS ASP/VB Smart SBB Controls 1.2 Insert TOC

Paul R Boon (August 17, 2001)

Rating: 5 users

3.6 out of 5

Add an auto-update feature to your extensions. Having spent the better part of the last nine months just designing and developing extensions, and having reached over a quarter of a million extension downloads, I realized that a way was needed to inform extension users that an upgrade or patch for an extension they were using was available. It also had to be possible from within Dreamweaver/UltraDev itself.

Featured News New Zones LIVE! Properties

To serve you even better, we at the Dynamic Zones Network have built three more zones where you can meet and exchange your knowledge

Featured Tutorial .Net and Dreamweaver MX

Extension Auto Upgrade and Synchronization: By Paul R Boon : Public Domain Ltd : 14-08-01 Please be aware that this is a beta extension for extension developers only. The Problem: To produce a system that can be plugged into existing extensions or incorporated into new extensions to allow the Automatic Upgrade of the extension in the case of new releases or patches.

Over the last two years Microsoft has been funneling billions into developing and promoting it's new technology: .Net. In this article you will learn how to format Macromedia's Dreamweaver MX to work with .Net for your Microsoft Web Servers. By the end of this article you will be able to program a .Net web site.

The Theory: The User runs the extension,and click on the 'Check For Updates' Button/Image within the extensions dialog or from an option on the main Dreamweaver or UltraDev 'Help' menu. A xml file installed onto the users system, into the extension developers 'Shared' directory when the extension was installed via a traditional MXP file, is read using dreamweaver.getDocumentDOM(). this xml file holds the information for the extension including, ● ● ● ● ●



Name, Extension Version, Remote Server Address, Remote Directory, and a list of files that make up that version of the extension. Plus others



We will call this file the 'local xml file'

with your peers. No matter what you're into, there's a zone for you. The Zones focus on community and teamwork. So come on into the Zones. Ask questions. Find answers in the TalkZones. Learn more. Do more. Join the Zones and expand your possibilities.

Featured Tutorial StoreFront 6.0 Guide

StoreFront 6.0 was designed to drive profits for developers (by making it easier to build sophisticated e-commerce applications) and for merchants (by increasing web store sales through better shopper experience and marketing tools).

Featured Extension Smart Image Processor

Once these values are loaded into variables the remote server is contacted using the value supplied in the local extensions xml file, and the extensions xml file is requested from the remote server , we will call this the 'remote xml file.

Featured Extension Advanced Open Window 3

The remote xml files information again includes matching: ● ● ●

● ●

Smart Image Processor is a powerfull Image Resize extension that will allow you to quickly and easily resize images after you have uploaded them and create thumbnails of the uploaded files. Another great Add-On to Pure ASP Upload

You don't need to write any additional code, it is all click and use!

NEW: Check the Online HELP here on DMXzone!



Name, Extension Version, Remote Server Address, Remote Directory, and a list of files that make up that version of the extension. Plus others



Remember to include the path to an updated my extension.xml file in the remote xml file, if this is left out, your extension will be updated the first time the extension is run , but the local xml file will not be updated with the new extension information, for future upgrades to function correctly. The version number from the remote xml file, is compared to the version number in the local xml file and if the versions match, the extension displays an alert to the user stating 'No Updates currently available'. If the version numbers do not match, the user is asked if they would like to update their existing extension as a new version is available. Once the user has decided to update the extension, the files required by the upgrade are requested and stored , when all files are download the files are

Advanced Open Window 3 offers the richest popup script available! Open any content - html pages, images, Quick Time or other movies and Flash movies automatically in a new popup window! Resize the popup window to fit the image/movie exactly! Make your own slideshows with cool transitions! Automatic popup size based on image dimensions! Position the window anywhere on the screen! And much more!

NEW: Check out the Live demos and usage tutorials

Featured Book Dynamic Dreamweaver MX

copied into the correct locations within the users system as stated by the installpath associated with each file, again this is held within the xml file. Also the user is informed that the upgrade is complete. Additional Options could be to store the type of extension within the xml files and depending on the extensions type, the dreamweaver.reloadExtensions() API call could be used to automatically reload the extension making the upgrade active or the user can be prompted to restart the application. The Code: The code making up the auto Upgrade feature that needs to be added into an existing extension project is included below and also can be generated by installing and running the Auto-Update.mxp provided.

Free preview of chapter 7: The Application panel

The upgrade process is started by calling the autoUpdateExtension() function found within the autoupdate.js file the autoupdate.js file is located within the /Configuration/Shared/publicdomain/ directory.

Poll Tutorials for UDzone

To make you, our visitors happy, we want to stimulate you and other people to write and upload tutorials to UDzone. Do nothing - I don't have time anyway I would love to contribute - but don't know how Improve the writing & uploading instructions Make the uploading more accessible Give the writers more exposure

This book covers "best practice" use of Dreamweaver MX for the web professional. It introduces server-side development with Dreamweaver MX to create dynamic, standardscompliant code that doesn't compromise visual design.

<script src="/Configuration/Shared/publicdomain/js/autoupdate.js" id="autoupdate"> Example of this function: <script id="autoupdate_example"> ///////////////////////////////////////////////////////////////////////// // This is an example of a function that could be used to call the auto-update feature. // The function could be called from a button's onClick event, or from a startup file. // function autoUpdateExtension(){ var sUpdateFile = dreamweaver.getConfigurationPath() + "/Shared/publicdomain/my extension.xml"; startAutoUpdate(sUpdateFile); } The autoupdate.js file contains all the code to perform the upgrade. (Please remember this is beta quality code so whilst tests run locally and by other UDzone users have proved successful, I wont guarantee it will work for you).

Pay the writers per tutorial ($25$100) Pay the writers depending how many users read the tutorial Other - please specify in a comment

Vote View Results

Poll Using ASP.NET already? You as a Dreamweaver MX user, have been programming in classic ASP - VBscript or Jscript. Have you switched to ASP.NET? Yes, I'm working in ASP.NET but also in Classic ASP Yes, I'm working in ASP.NET only now No, not yet will wait another 6 moths No, will wait another year No, will never switch - it is too difficult

Vote View Results

////////////////////////////////////////////////////////////////////////////////////////// // AutoUpdate.js // // // // Copyright 2000 Public Domain Ltd. All rights reserved. // // Author Paul R Boon & Justin Hillyard. // // Version 1.0.0 (beta) // // [email protected] // //////////////////////////////////////////////////////////////////////////////////////// function startAutoUpdate(updateFilepath){ //get the DOM of the local Extensions XML File, and setup required documents var localDom = dreamweaver.getDocumentDOM(updateFilepath); //get the details we require from the extension xml file var eExtension = localDom.getElementsByTagName('extension'); var eExtensionName = eExtension[0].getElementsByTagName('extensionname'); var sRemoteFilepath = eExtension[0].getAttribute('server') + '/' sRemoteFilepath += (eExtension[0].getAttribute('directory') != '') ? eExtension[0].getAttribute('directory') + '/' : ''; sRemoteFilepath += eExtensionName[0].getAttribute('name') + '.xml'; var httpReply = MMHttp.getFile(sRemoteFilepath); if(httpReply.statusCode == 200){ var remoteDom = dreamweaver.getDocumentDOM(httpReply.data); var eRemoteExtensionVersion = remoteDom.getElementsByTagName('extensionversion'); var nRemoteVersionNumber = parseFloat(eRemoteExtensionVersion[0].getAttribute('value')); var eLocalExtensionVersion = localDom.getElementsByTagName('extensionversion'); var nLocalVersionNumber = parseFloat(eLocalExtensionVersion[0].getAttribute('value')); if(nRemoteVersionNumber == nLocalVersionNumber){ alert('Your extension is currently up to date') } else if(nRemoteVersionNumber > nLocalVersionNumber){ if(confirm('There is a newer version of this extension available, would you like to update?')){ downloadFiles(sRemoteFilepath = eExtension[0].getAttribute('server') + '/' + eExtension[0].getAttribute('directory')

,remoteDom.getElementsByTagName('file')); } } } else { alert('There was an error connecting to the server, please try again later.') } } function downloadFiles(sServerPath, fileElements){ var aFilepaths = new Array(); var sConfigPath = dreamweaver.getConfigurationPath(); for(i=0; i < fileElements.length; i++){ var sFilepath = (sServerPath.lastIndexOf('/') == sServerPath.length-1) ? sServerPath + fileElements[i].getAttribute('name') : sServerPath + '/' + fileElements[i].getAttribute('name'); var httpReply = MMHttp.getFile(sFilepath); if(httpReply.statusCode != 200){ alert('Error while downloading file, please try again later.'); return false; } aFilepaths[aFilepaths.length] = httpReply.data; } if(confirm('Files download Ok, would you like to install?')){ for(i=0; i < fileElements.length; i++){ var sFilepath = sConfigPath + '/' + fileElements[i].getAttribute('install-path') + '/' + fileElements[i].getAttribute('name'); DWfile.copy(aFilepaths[i], sFilepath); } } else { return false; } MMHttp.clearTemp(); return true; } Whilst you could cut and paste this code directly into your own projects and create all the xml files manually, we decided that the best way to use this

technology was to develope an extension that would handle the setup and configuration of this code, this extension can be download from Udzone the extension is called Auto-Update.mxp. This extension works like a standard windows wizard, simply follow the questions you are presented with an the extension will do the rest for you, Feel free to have a play and I hope this article is of use. Yours Paul R Boon Public Domain Ltd

Please rate this for us

Poor 1 Usefulness of Content

Post Review

2

3

4

5 Excellent Submit

Discuss

Other Auto-Update Projects ●

How to create Auto-Update extensions

DMXzone.com, All Rights Reserved. Content Management System by Dynamic Zones Design by Alion DMXzone.com liability, trademark, document use and software licensing rules apply. Your interactions with this site are in accordance with our public privacy statements. Copyright © 2001, 2002

Home

News

Tutorials

General ● ● ● ●

Request a Tutorial Request an Extension Our Sponsors About Us

Search Enter Search: Go

Extensions

Projects

TalkZones

Books

Links

Welcome Visitor! Share your knowledge with the Dreamweaver MX and UltraDev Community! Download/upload tutorials, extensions, faq's whatever you want! Registration allows you to fully customize your UDzone.com! Sign up / register

FAQ's

Polls

MyDMXzone

Search

Users Stats Active Users: 95

Username:

Latest Projects

Password:



Login

Save Password? Forgot your Password?

● ●



● ● ● ●

Add News

Projects / Extensions / Auto-Update

Your Stuff Go

Our Main Sponsors

How to create Auto-Update extensions 2165 Users read it.

● ● ●

RTE On-Line Html Editor My mail application v: 2 Design Time Access for Ch Forms Floater 1.2 MonthTable MySQL Administrator Delete Multiple Records a FileRS ASP/VB Smart SBB Controls 1.2 Insert TOC

jason parker (August 17, 2001)

Rating: 2 users

5 out of 5

Are you one of those insane characters that can be seen lurking about in the shadows by the Macromedia Exchange? Waiting............some people would say stalking...............for the next extension for Dreamweaver and UltraDev....

Featured News Properties

Featured Tutorial .Net and Dreamweaver MX

No more exchange lurking! Introduction Are you one of those insane characters that can be seen lurking about in the shadows by the Macromedia Exchange? Waiting............some people would say stalking...............for the next extension for Dreamweaver and UltraDev. If you are then this extension could change your life and pull you back into normal society........Welcome to the Auto-Update extension!

Over the last two years Microsoft has been funneling billions into developing and promoting it's new technology: .Net. In this article you will learn how to format Macromedia's Dreamweaver MX to work with .Net for your Microsoft Web Servers. By the end of this article you will be able to program a .Net web site.

New Zones LIVE!

Auto-Update (beta 1) your extensions. Although this extension is aimed at the extension developer I think you'll agree that the end user can also benefit greatly by having input into it's development. Created by Paul R Boon ( Public Domain Ltd ) it gives the extension developer a way of directly linking with users to offer them the latest versions of his/her work. By simply going through a wizard and uploading content to a web server you can feed your own extension community from one centralised place. You can quickly apply bug-fixes and make them instantly available, not to mention the possibilities for commercial extensions. At the moment the update can be activated when the extension has loaded, or triggered by the user. Requests for other options can be seen on the Auto-Update (beta 1) Forum on Udzone. Show me it in action then? If you are not a developer but would like to see the extension in action then simply download my completed Set Server Timeout extension, install it (make a note of it's version number in the Extension Manager!), run the update and then check the version number again If you agree with me that this is pretty awesome and have any requests, questions, bugs or would simply like to know more then check out both the Auto-Update (beta 1) page and the Auto-Update (beta 1) Forum on UDzone.

To serve you even better, we at the Dynamic Zones Network have built three more zones where you can meet and exchange your knowledge with your peers. No matter what you're into, there's a zone for you. The Zones focus on community and teamwork. So come on into the Zones. Ask questions. Find answers in the TalkZones. Learn more. Do more. Join the Zones and expand your possibilities.

Featured Extension Smart Image Processor

How's it done? As with everything the easiest way to learn is to have a go. First of all download Auto-Update, a copy of my old Set Server Timeout extension and it's code. Unzip the code into a directory, install the Set Server The Timeout and the auto-update extension and we're ready to go auto-update extension works by integrating it's code into our own extension. We then update the extension code to create a new version, and finally upload our new extension code to our server which makes it accessible for all users.

Smart Image Processor is a powerfull Image Resize extension that will allow you to quickly and easily resize images after you have uploaded them and create thumbnails of the uploaded files. Another great Add-On to Pure ASP Upload

You don't need to write any additional code, it is all click and use!

First, we need to integrate the code from the auto-update extension into our already created Server Behaviour. As the updating will be done from our extensions interface we need to load this into DW/UD. Open up the Set "ServerTimeout.htm" file from the ServerTimeout_v1.0 directory and then runCommands > Create Auto-Updateto launch the auto-update process. Screen one simply asks for your extension details. However, you cannot give the auto-update extension code the same name as your extension! This restriction is because all files created have to reside in one directory on the server for the update to work. Normally in DW you can use files with the same name in different folders for your extension, because they now all have to be put in the same folder on the server you can't. My extension is called "Set ServerTimeout" and my update code will be called "Set Server Timeout" (notice the extra space!).

Featured Tutorial StoreFront 6.0 Guide

StoreFront 6.0 was designed to drive profits for developers (by making it easier to build sophisticated e-commerce applications) and for merchants (by increasing web store sales through better shopper experience and marketing tools).

Featured Extension Advanced Open Window 3

NEW: Check the Online HELP here on DMXzone! Advanced Open Window 3 offers the richest popup script available! Open any content - html pages, images, Quick Time or

other movies and Flash movies automatically in a new popup window! Resize the popup window to fit the image/movie exactly!

Featured Book Dynamic Dreamweaver MX

Make your own slideshows with cool transitions! Automatic popup size based on image dimensions! Position the window anywhere on the screen! And much more! Free preview of chapter 7: The Application panel This book covers "best practice" use of Dreamweaver MX for the web professional. It introduces server-side development with Dreamweaver MX to create dynamic, standardscompliant code that doesn't compromise visual design.

NEW: Check out the Live demos and usage tutorials

Next we need to give the location of where we will store our extension remotely by providing the server address and directory (you can enter your own server details here! ).

Poll Tutorials for UDzone

To make you, our visitors happy, we want to stimulate you and other people to write and upload tutorials to UDzone. Do nothing - I don't have time anyway I would love to contribute - but don't know how Improve the writing & uploading instructions Make the uploading more accessible

Poll Using ASP.NET already?

Give the writers more exposure Pay the writers per tutorial ($25$100) Pay the writers depending how many users read the tutorial Other - please specify in a comment

You as a Dreamweaver MX user, have been programming in classic ASP - VBscript or Jscript. Have you switched to ASP.NET?

Vote

View Results

Yes, I'm working in ASP.NET but also in Classic ASP Yes, I'm working in ASP.NET only now No, not yet will wait another 6 moths No, will wait another year No, will never switch - it is too difficult

Vote

View Results

Now we need to add all the files that make up the extension we are applying the auto-update to. If we load our "Set_ServerTimeout.mxi" file into our editor we can use this to find the Install Path for our extension files.

For each file from the ServerTimeout_v1.0 directory select it by using the Browse button and then give it it's install directory. This is simply telling the auto-update extension builder where each element of our own extension should go when we are updating it from the remote server. Once you have added your file information hit the OK button which will take you back to the Add Files dialog. At present (beta 1) the "-" icon on the Add Files page does not work!

Notice that we have also included our mxi file that we use to create the extension with. We need to add this to the installation process to ensure that the Extension Manager will also be updated with the right information and stay in-sync. All installed extensions have their mxi file installed into the following directory: \Configuration\Extensions\ Next we give a location for the auto-update code to be installed. As we have already installed v1.0 of our Set Server Timeout extension we can see the following directories within our DW/UD configuration folder. \Configuration\Shared\Ultra-Dumb\ We will use this to store our code by adding a new directory called

"autoupdates". Add this to your file directory like so: \Configuration\Shared\UltraDumb\autoupdates\

Now go back to DW/UD and give this as the storage location for our autoupdate code.

Finally we get the auto-update extension to insert all the right code for our Set Server Timeout interface. If we now take a look at the "Set Server Timeout.htm" file we can see that it now contains the auto-update code

However, it has given the script source location on line 70 an absolute path that won't be relevant when the new extension has been installed on another machine. We need to set this to be relative to it's installed position.

What we need to do now is give the user a way of activating the update procedure! We'll create a new icon for our extension, add this to the interface and link it to the auto-update javascript code. We will have to do is repackage the extension after we have added this. Split the cell containing the Ultra-Dumb logo and place the new update icon next to it. Add the icon and then set the right path for it which is based on it's location when the extension has been installed. We can see what path to use by viewing the source location of the "ud_logo.gif" file Finally set an onMouseDown event to the image which will activate the auto-update procedure. After saving "Set Server Timeout.htm" repackage the whole extension with the new autoupdate code and images we have just included. Copy the code from the autoupdates directory to our unzipped

ServerTimeout_v1.0 directory ready for repackaging

Fire up your favorite text/html editor and load the "Set_ServerTimeout.mxi" file into it. The 3 new files we have to package are as follows: autoupdate.js Set Server Timeout.xml update_anim.gif Add them to your mxi file like so:

Notice that we are making the "autoupdate.js" and "update_anim.gif" shared files! Whilst we have the mxi file open you can also check the version number located on line 3.

Finally, we have to add the above 3 files to our "Set Server timeout.xml" Open this file in your editor code to ensure these are updated as well and add the following lines.

Before we repackage our extension lets just go back to our shared files location and remove the "autoupdates" directory that was created. We do this to make sure that all our extension code is installed properly \Configuration\Shared\Ultra-Dumb\ Lets open up the Extension Manager and repackage our extension then install it into DW or UD If we run the extension and click on the update icon we should see the following error. We have not set up our remote

files on our server yet!

By using an FTP client log-on to our remote server and upload all the files for our extension to the location we specified earlier. In my example I am uploading all these file's:

To this full location: www.ultra-dumb.co.uk/tutorials/autoupdate/code/ They have to be put into one directory on the server! If we now try to update our extension we will get a pop-up notifying us that we already have the latest version.

To simulate an update we will simply adjust our extensions version in the mxi file and our auto-update xml file. We won't actually alter the extension's functionality but just test that everything is working fine Make a copy of "Set_ServerTimeout.mxi" and "Set Server Timeout.xml" files. Open up the mxi file first and alter line 3 to read as follows: version="1.1" Then open "Set Server Timeout.xml" and set the extension-version tag to: Now upload these 2 files to our remote server (over write the ones on the server!) and then activate the update procedure!

You'll be notified that a newer version of the extension is available and asked if you wish to update. If you agree you will then be asked to download the files.

Yippee!!! We now have a updateable extension. Any new code changes can be simply updated to the server giving the user the power to have the latest version always installed Conclusion. I think you have to admit that this can give developers some real power when creating extensions. New features requested include password protection and FTP transfers. If after playing with this and have some ideas, requests or questions then why not submit them to the forum on

UDzone. This was brought to you by a Web Chimp @ Ultra-Dumb [ you can download this tutorial and all related code here! ]

Please rate this for us

Poor 1

2

3

4

5 Excellent

Usefulness of Content

Submit

Read it at the external site... Discuss

Post Review

Other Auto-Update Projects ●

Auto-Update (beta 1)

Copyright © 2001, 2002 DMXzone.com, All Rights Reserved. Content Management System by Dynamic Zones Design by Alion DMXzone.com liability, trademark, document use and software licensing rules apply. Your interactions with this site are in accordance with our public privacy statements.