Difference between revisions of "BookmarkPage"

From CDOT Wiki
Jump to: navigation, search
 
Line 1: Line 1:
 
==Bookmark > Bookmark This Page==
 
==Bookmark > Bookmark This Page==
  
[http://landfill.mozilla.org/mxr-test/mozilla1.8.x/source/extensions/cck/browser/resources/content/cckwizard/bookmark.xul  /extensions/cck/browser/resources/content/cckwizard/bookmark.xul]
+
* [http://landfill.mozilla.org/mxr-test/mozilla1.8.x/source/extensions/cck/browser/resources/content/cckwizard/bookmark.xul  /extensions/cck/browser/resources/content/cckwizard/bookmark.xul]
 
<code>
 
<code>
 
   45 <dialog id="createbookmark" title="&bookmark.label;"
 
   45 <dialog id="createbookmark" title="&bookmark.label;"
Line 24: Line 24:
 
- Defines the the Add Bookmark dialog box.
 
- Defines the the Add Bookmark dialog box.
  
[http://landfill.mozilla.org/mxr-test/mozilla1.8.x/source/extensions/cck/browser/resources/content/cckwizard/cckwizard.js /extensions/cck/browser/resources/content/cckwizard/cckwizard.js]
+
* [http://landfill.mozilla.org/mxr-test/mozilla1.8.x/source/extensions/cck/browser/resources/content/cckwizard/cckwizard.js /extensions/cck/browser/resources/content/cckwizard/cckwizard.js]
 
<code>
 
<code>
 
  538 function bookmarkCheckOKButton()
 
  538 function bookmarkCheckOKButton()
Line 36: Line 36:
 
</code>
 
</code>
 
- Enable the OK button only if the bookmark name and URL is defined.
 
- Enable the OK button only if the bookmark name and URL is defined.
 +
 +
<code>
 +
547 function OnBookmarkOK()
 +
548 {
 +
549
 +
550  listbox = this.opener.document.getElementById(getPageId() +'.bookmarkList');
 +
551  var listitem;
 +
552  if (window.name == 'newbookmark') {
 +
553    listitem = listbox.appendItem(document.getElementById('bookmarkname').value, document.getElementById('bookmarkurl').value);
 +
554    listitem.setAttribute("class", "listitem-iconic");
 +
555  } else {
 +
556    listitem = listbox.selectedItem;
 +
557    listitem.setAttribute("label", document.getElementById('bookmarkname').value);
 +
558    listitem.setAttribute("value", document.getElementById('bookmarkurl').value);
 +
559  }
 +
560  if (document.getElementById('liveBookmark').checked) {
 +
561    listitem.cck['type'] = "live";
 +
562    listitem.setAttribute("image", "chrome://browser/skin/page-livemarks.png");
 +
563  } else {
 +
564    listitem.setAttribute("image", "chrome://browser/skin/Bookmarks-folder.png");
 +
565    listitem.cck['type'] = "";
 +
566  }
 +
567 }
 +
</code>
 +
- After you click OK,

Revision as of 11:32, 29 September 2006

Bookmark > Bookmark This Page

 45 <dialog id="createbookmark" title="&bookmark.label;"
 46         xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul"
 47         buttons="accept,cancel"
 48         ondialogaccept="return OnBookmarkOK()"
 49         onload="OnBookmarkLoad();"
 50         width="500"
 51         height="200"
 52         >
 53   <script src="chrome://cckwizard/content/cckwizard.js"/>
 54   <vbox>
 55     <label>&bookmark.description;</label>
 56     <label control="bookmarkname">&bookmarkTitle.label;</label>
 57     <textbox flex="1" id="bookmarkname" onchange="bookmarkCheckOKButton();" onkeyup="bookmarkCheckOKButton();"/>
 58     <label control="bookmarkurl">&bookmarkURL.label;</label>
 59     <textbox flex="1" id="bookmarkurl" onchange="bookmarkCheckOKButton();" onkeyup="bookmarkCheckOKButton();"/>
 60     <checkbox id="liveBookmark" label="Live Bookmark"/>
 61   </vbox>
 62 </dialog>

- Defines the the Add Bookmark dialog box.

538 function bookmarkCheckOKButton()
539 {
540   if ((document.getElementById("bookmarkname").value) && (document.getElementById("bookmarkurl").value)) {
541     document.documentElement.getButton("accept").setAttribute( "disabled", "false" );
542   } else {
543     document.documentElement.getButton("accept").setAttribute( "disabled", "true" );  
544   }
545 }

- Enable the OK button only if the bookmark name and URL is defined.

547 function OnBookmarkOK()
548 {
549 
550   listbox = this.opener.document.getElementById(getPageId() +'.bookmarkList');
551   var listitem;
552   if (window.name == 'newbookmark') {
553     listitem = listbox.appendItem(document.getElementById('bookmarkname').value, document.getElementById('bookmarkurl').value);
554     listitem.setAttribute("class", "listitem-iconic");
555   } else {
556     listitem = listbox.selectedItem;
557     listitem.setAttribute("label", document.getElementById('bookmarkname').value);
558     listitem.setAttribute("value", document.getElementById('bookmarkurl').value);
559   }
560   if (document.getElementById('liveBookmark').checked) {
561     listitem.cck['type'] = "live";
562     listitem.setAttribute("image", "chrome://browser/skin/page-livemarks.png");
563   } else {
564     listitem.setAttribute("image", "chrome://browser/skin/Bookmarks-folder.png");
565     listitem.cck['type'] = "";
566   }
567 }

- After you click OK,