Initial revision. Not yet in the build.
git-svn-id: svn://10.0.0.236/trunk@33990 18797224-902f-48f8-a5cc-f745e15eee43
This commit is contained in:
80
mozilla/suite/common/related/related-panel.js
Normal file
80
mozilla/suite/common/related/related-panel.js
Normal file
@@ -0,0 +1,80 @@
|
||||
/* -*- Mode: Java; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*-
|
||||
*
|
||||
* The contents of this file are subject to the Netscape Public License
|
||||
* Version 1.0 (the "NPL"); you may not use this file except in
|
||||
* compliance with the NPL. You may obtain a copy of the NPL at
|
||||
* http://www.mozilla.org/NPL/
|
||||
*
|
||||
* Software distributed under the NPL is distributed on an "AS IS" basis,
|
||||
* WITHOUT WARRANTY OF ANY KIND, either express or implied. See the NPL
|
||||
* for the specific language governing rights and limitations under the
|
||||
* NPL.
|
||||
*
|
||||
* The Initial Developer of this code under the NPL is Netscape
|
||||
* Communications Corporation. Portions created by Netscape are
|
||||
* Copyright (C) 1998 Netscape Communications Corporation. All Rights
|
||||
* Reserved.
|
||||
*/
|
||||
|
||||
/*
|
||||
|
||||
Code for the Related Links Sidebar Panel
|
||||
|
||||
*/
|
||||
|
||||
// The content window that we're supposed to be observing. This is
|
||||
// god-awful fragile. The logic goes something like this. Our parent
|
||||
// is the sidebar, whose parent is the content frame, whose frame[1]
|
||||
// is the content area.
|
||||
var ContentWindow = window.parent.parent.frames[1];
|
||||
|
||||
// The related links handler
|
||||
var Handler = Components.classes["component://netscape/related-links-handler"].createInstance();
|
||||
Handler = Handler.QueryInterface(Components.interfaces.nsIRelatedLinksHandler);
|
||||
|
||||
// Our observer object
|
||||
var Observer = {
|
||||
Observe: function(subject, topic, data) {
|
||||
//dump("_Observe(" + subject + ", " + topic + ", " + data + ")\n");
|
||||
|
||||
subject = subject.QueryInterface(Components.interfaces.nsIDOMWindow);
|
||||
//dump("subject = " + subject + "\n");
|
||||
//dump("ContentWindow = " + ContentWindow + "\n");
|
||||
|
||||
// We can't use '==' until the DOM is converted to XPIDL.
|
||||
if (subject.Equals(ContentWindow)) {
|
||||
Handler.URL = data;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
function Init() {
|
||||
// Initialize the Related Links panel
|
||||
|
||||
// Create a Related Links handler, and install it in the tree
|
||||
var Tree = document.getElementById("Tree");
|
||||
Tree.database.AddDataSource(Handler.QueryInterface(Components.interfaces.nsIRDFDataSource));
|
||||
|
||||
Handler.URL = ContentWindow.location;
|
||||
|
||||
// Install the observer so we'll be notified when new content is loaded.
|
||||
var ObserverService = Components.classes["component://netscape/observer-service"].getService();
|
||||
ObserverService = ObserverService.QueryInterface(Components.interfaces.nsIObserverService);
|
||||
dump("got observer service\n");
|
||||
|
||||
ObserverService.AddObserver(Observer, "EndDocumentLoad");
|
||||
dump("added observer\n");
|
||||
}
|
||||
|
||||
|
||||
function Boot() {
|
||||
// Kludge to deal with no onload in XUL.
|
||||
if (document.getElementById("Tree")) {
|
||||
Init();
|
||||
}
|
||||
else {
|
||||
setTimeout("Boot();", 0);
|
||||
}
|
||||
}
|
||||
|
||||
Boot();
|
||||
57
mozilla/suite/common/related/related-panel.xul
Normal file
57
mozilla/suite/common/related/related-panel.xul
Normal file
@@ -0,0 +1,57 @@
|
||||
<?xml version="1.0"?>
|
||||
<?xml-stylesheet href="resource:/res/rdf/sidebar.css" type="text/css"?>
|
||||
|
||||
<window
|
||||
xmlns:html="http://www.w3.org/TR/REC-html40"
|
||||
xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
|
||||
xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul">
|
||||
|
||||
<html:script src="related-panel.js" />
|
||||
|
||||
<!--
|
||||
Note that the empty "datasources='rdf:null'" will ensure that a composite
|
||||
datasource is created and a content model builder is installed, even
|
||||
though there is no datasource from which to build content yet.
|
||||
-->
|
||||
<tree id="Tree"
|
||||
flex="100%"
|
||||
datasources="rdf:null"
|
||||
ondblclick="return OpenuRL(event.target.parentNode);">
|
||||
|
||||
<template>
|
||||
<!-- XXX need a rule for separators -->
|
||||
<rule rootcontainment="treebody" subcontainment="treechildren">
|
||||
<treeitem uri="...">
|
||||
<treecell>
|
||||
<treeindentation />
|
||||
<titledbutton value="rdf:http://home.netscape.com/NC-rdf#Name" align="right" />
|
||||
</treecell>
|
||||
|
||||
<treecell>
|
||||
<titledbutton value="rdf:http://home.netscape.com/NC-rdf#URL" align="right"
|
||||
style="list-style-image: none;" />
|
||||
</treecell>
|
||||
</treeitem>
|
||||
</rule>
|
||||
</template>
|
||||
|
||||
<treehead>
|
||||
<treeitem>
|
||||
<treecell>Name</treecell>
|
||||
<treecell>URL</treecell>
|
||||
</treeitem>
|
||||
</treehead>
|
||||
|
||||
<treebody>
|
||||
<treeitem id="NC:RelatedLinks">
|
||||
<treecell><treeindentation/>Related Links</treecell>
|
||||
<treecell></treecell>
|
||||
</treeitem>
|
||||
|
||||
<treeitem id="NC:SiteMapRoot">
|
||||
<treecell><treeindentation/>Site Map</treecell>
|
||||
<treecell></treecell>
|
||||
</treeitem>
|
||||
</treebody>
|
||||
</tree>
|
||||
</window>
|
||||
27
mozilla/xpfe/components/related/resources/makefile.win
Normal file
27
mozilla/xpfe/components/related/resources/makefile.win
Normal file
@@ -0,0 +1,27 @@
|
||||
#!nmake
|
||||
#
|
||||
# The contents of this file are subject to the Netscape Public License
|
||||
# Version 1.0 (the "NPL"); you may not use this file except in
|
||||
# compliance with the NPL. You may obtain a copy of the NPL at
|
||||
# http://www.mozilla.org/NPL/
|
||||
#
|
||||
# Software distributed under the NPL is distributed on an "AS IS" basis,
|
||||
# WITHOUT WARRANTY OF ANY KIND, either express or implied. See the NPL
|
||||
# for the specific language governing rights and limitations under the
|
||||
# NPL.
|
||||
#
|
||||
# The Initial Developer of this code under the NPL is Netscape
|
||||
# Communications Corporation. Portions created by Netscape are
|
||||
# Copyright (C) 1998 Netscape Communications Corporation. All Rights
|
||||
# Reserved.
|
||||
|
||||
DEPTH=..\..\..\..
|
||||
|
||||
include <$(DEPTH)\config\rules.mak>
|
||||
|
||||
install:: $(FILES:/=\)
|
||||
!@$(MAKE_INSTALL) $** $(DIST)\bin\res\samples
|
||||
|
||||
clobber:: $(FILES:/=\)
|
||||
!@$(RM) $(DIST)\bin\res\samples\$**
|
||||
|
||||
5
mozilla/xpfe/components/related/resources/manifest.mn
Normal file
5
mozilla/xpfe/components/related/resources/manifest.mn
Normal file
@@ -0,0 +1,5 @@
|
||||
FILES=\
|
||||
related-panel.xul \
|
||||
related-panel.js \
|
||||
$(NULL)
|
||||
|
||||
80
mozilla/xpfe/components/related/resources/related-panel.js
Normal file
80
mozilla/xpfe/components/related/resources/related-panel.js
Normal file
@@ -0,0 +1,80 @@
|
||||
/* -*- Mode: Java; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*-
|
||||
*
|
||||
* The contents of this file are subject to the Netscape Public License
|
||||
* Version 1.0 (the "NPL"); you may not use this file except in
|
||||
* compliance with the NPL. You may obtain a copy of the NPL at
|
||||
* http://www.mozilla.org/NPL/
|
||||
*
|
||||
* Software distributed under the NPL is distributed on an "AS IS" basis,
|
||||
* WITHOUT WARRANTY OF ANY KIND, either express or implied. See the NPL
|
||||
* for the specific language governing rights and limitations under the
|
||||
* NPL.
|
||||
*
|
||||
* The Initial Developer of this code under the NPL is Netscape
|
||||
* Communications Corporation. Portions created by Netscape are
|
||||
* Copyright (C) 1998 Netscape Communications Corporation. All Rights
|
||||
* Reserved.
|
||||
*/
|
||||
|
||||
/*
|
||||
|
||||
Code for the Related Links Sidebar Panel
|
||||
|
||||
*/
|
||||
|
||||
// The content window that we're supposed to be observing. This is
|
||||
// god-awful fragile. The logic goes something like this. Our parent
|
||||
// is the sidebar, whose parent is the content frame, whose frame[1]
|
||||
// is the content area.
|
||||
var ContentWindow = window.parent.parent.frames[1];
|
||||
|
||||
// The related links handler
|
||||
var Handler = Components.classes["component://netscape/related-links-handler"].createInstance();
|
||||
Handler = Handler.QueryInterface(Components.interfaces.nsIRelatedLinksHandler);
|
||||
|
||||
// Our observer object
|
||||
var Observer = {
|
||||
Observe: function(subject, topic, data) {
|
||||
//dump("_Observe(" + subject + ", " + topic + ", " + data + ")\n");
|
||||
|
||||
subject = subject.QueryInterface(Components.interfaces.nsIDOMWindow);
|
||||
//dump("subject = " + subject + "\n");
|
||||
//dump("ContentWindow = " + ContentWindow + "\n");
|
||||
|
||||
// We can't use '==' until the DOM is converted to XPIDL.
|
||||
if (subject.Equals(ContentWindow)) {
|
||||
Handler.URL = data;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
function Init() {
|
||||
// Initialize the Related Links panel
|
||||
|
||||
// Create a Related Links handler, and install it in the tree
|
||||
var Tree = document.getElementById("Tree");
|
||||
Tree.database.AddDataSource(Handler.QueryInterface(Components.interfaces.nsIRDFDataSource));
|
||||
|
||||
Handler.URL = ContentWindow.location;
|
||||
|
||||
// Install the observer so we'll be notified when new content is loaded.
|
||||
var ObserverService = Components.classes["component://netscape/observer-service"].getService();
|
||||
ObserverService = ObserverService.QueryInterface(Components.interfaces.nsIObserverService);
|
||||
dump("got observer service\n");
|
||||
|
||||
ObserverService.AddObserver(Observer, "EndDocumentLoad");
|
||||
dump("added observer\n");
|
||||
}
|
||||
|
||||
|
||||
function Boot() {
|
||||
// Kludge to deal with no onload in XUL.
|
||||
if (document.getElementById("Tree")) {
|
||||
Init();
|
||||
}
|
||||
else {
|
||||
setTimeout("Boot();", 0);
|
||||
}
|
||||
}
|
||||
|
||||
Boot();
|
||||
57
mozilla/xpfe/components/related/resources/related-panel.xul
Normal file
57
mozilla/xpfe/components/related/resources/related-panel.xul
Normal file
@@ -0,0 +1,57 @@
|
||||
<?xml version="1.0"?>
|
||||
<?xml-stylesheet href="resource:/res/rdf/sidebar.css" type="text/css"?>
|
||||
|
||||
<window
|
||||
xmlns:html="http://www.w3.org/TR/REC-html40"
|
||||
xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
|
||||
xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul">
|
||||
|
||||
<html:script src="related-panel.js" />
|
||||
|
||||
<!--
|
||||
Note that the empty "datasources='rdf:null'" will ensure that a composite
|
||||
datasource is created and a content model builder is installed, even
|
||||
though there is no datasource from which to build content yet.
|
||||
-->
|
||||
<tree id="Tree"
|
||||
flex="100%"
|
||||
datasources="rdf:null"
|
||||
ondblclick="return OpenuRL(event.target.parentNode);">
|
||||
|
||||
<template>
|
||||
<!-- XXX need a rule for separators -->
|
||||
<rule rootcontainment="treebody" subcontainment="treechildren">
|
||||
<treeitem uri="...">
|
||||
<treecell>
|
||||
<treeindentation />
|
||||
<titledbutton value="rdf:http://home.netscape.com/NC-rdf#Name" align="right" />
|
||||
</treecell>
|
||||
|
||||
<treecell>
|
||||
<titledbutton value="rdf:http://home.netscape.com/NC-rdf#URL" align="right"
|
||||
style="list-style-image: none;" />
|
||||
</treecell>
|
||||
</treeitem>
|
||||
</rule>
|
||||
</template>
|
||||
|
||||
<treehead>
|
||||
<treeitem>
|
||||
<treecell>Name</treecell>
|
||||
<treecell>URL</treecell>
|
||||
</treeitem>
|
||||
</treehead>
|
||||
|
||||
<treebody>
|
||||
<treeitem id="NC:RelatedLinks">
|
||||
<treecell><treeindentation/>Related Links</treecell>
|
||||
<treecell></treecell>
|
||||
</treeitem>
|
||||
|
||||
<treeitem id="NC:SiteMapRoot">
|
||||
<treecell><treeindentation/>Site Map</treecell>
|
||||
<treecell></treecell>
|
||||
</treeitem>
|
||||
</treebody>
|
||||
</tree>
|
||||
</window>
|
||||
Reference in New Issue
Block a user