home *** CD-ROM | disk | FTP | other *** search
- // Copyright 2002, 2003 Macromedia, Inc. All rights reserved.
-
- //*************** GLOBALS *****************
-
-
- //******************* API **********************
-
- function commandButtons()
- {
- var btns = new Array(BTN_OK, "okClicked()", BTN_Cancel, "cancelClicked()");
- return btns;
- }
-
- //***************** LOCAL FUNCTIONS ******************
-
- function initializeUI()
- {
- var pgTitleObj = findObject("pgTitle"); //find our title textbox in UI
- var titleObj = getTitleObj(); //find the title tag for the current doc
- if (titleObj)
- {
- var theTitle = titleObj.innerHTML; //extract the title
- pgTitleObj.value = theTitle; //store title in UI
- }
- else
- {
- alert("The current document has no title tags, so we can't do this right now.");
- cancelClicked();
- }
- }
-
-
-
- function okClicked()
- {
- var pgTitleObj = findObject("pgTitle");
- var titleObj = getTitleObj(); //get the title tag
- var changedTitle = false;
-
- if (titleObj)
- {
- var newTitle = pgTitleObj.value;
- if (titleObj.innerHTML != newTitle) //if title changed
- {
- titleObj.innerHTML = newTitle; //store in doc
- changedTitle = true;
- }
- }
- window.close();
- if (changedTitle) CCWorkspaceManager.getManager(dw.getDocumentDOM()).refreshPanes();
- }
-
-
- function cancelClicked()
- {
- window.close();
- }
-
-
- //find the title tag for the current document
- function getTitleObj()
- {
- var retObj = null;
-
- var DOM = dw.getDocumentDOM();
- if (DOM)
- {
- var titleObjs = DOM.getElementsByTagName("TITLE");
- if (titleObjs && titleObjs.length)
- {
- retObj = titleObjs[0];
- }
- }
-
- return retObj;
- }
-