Add sidebar component directory (files were previously in rdf/resources).

This commit is contained in:
slamm%netscape.com 1999-08-03 22:36:12 +00:00
Родитель 2d8535834a
Коммит 07089b8341
27 изменённых файлов: 1612 добавлений и 0 удалений

Просмотреть файл

@ -0,0 +1,300 @@
// -*- Mode: Java -*-
// the rdf service
var RDF;
var NC = "http://home.netscape.com/NC-rdf#";
var sidebar;
function Init()
{
RDF=Components.classes['component://netscape/rdf/rdf-service'].getService();
RDF=RDF.QueryInterface(Components.interfaces.nsIRDFService);
sidebar = new Object;
sidebar.db = window.arguments[0];
sidebar.resource = window.arguments[1];
var registry;
try {
// First try to construct a new one and load it
// synchronously. nsIRDFService::GetDataSource() loads RDF/XML
// asynchronously by default.
registry = Components.classes['component://netscape/rdf/datasource?name=xml-datasource'].createInstance();
registry = registry.QueryInterface(Components.interfaces.nsIRDFDataSource);
var remote = registry.QueryInterface(Components.interfaces.nsIRDFRemoteDataSource);
remote.Init(sidebar.db); // this will throw if it's already been opened and registered.
// read it in synchronously.
remote.Refresh(true);
}
catch (ex) {
// if we get here, then the RDF/XML has been opened and read
// once. We just need to grab the datasource.
registry = RDF.GetDataSource(sidebar.db);
}
// Create a 'container' wrapper around the sidebar.resources
// resource so we can use some utility routines that make access a
// bit easier.
var sb_datasource = Components.classes['component://netscape/rdf/container'].createInstance();
sb_datasource = sb_datasource.QueryInterface(Components.interfaces.nsIRDFContainer);
sb_datasource.Init(registry, RDF.GetResource(sidebar.resource));
// Now enumerate all of the flash datasources.
var enumerator = sb_datasource.GetElements();
var count = 0;
while (enumerator.HasMoreElements()) {
count = ++count;
var service = enumerator.GetNext();
service = service.QueryInterface(Components.interfaces.nsIRDFResource);
addOption(registry, service);
}
enableButtons();
}
function addOption(registry, service) {
var option_title = getAttr(registry, service, 'title');
var option_customize = getAttr(registry, service, 'customize');
var option_content = getAttr(registry, service, 'content');
var optionSelect = createOptionTitle(option_title);
var option = document.createElement('html:option');
option.setAttribute('title', option_title);
option.setAttribute('customize', option_customize);
option.setAttribute('content', option_content);
option.appendChild(optionSelect);
var sideoption = document.getElementById('selectList');
sideoption.appendChild(option);
}
function createOptionTitle(titletext)
{
var title = document.createElement('html:option');
var textOption = document.createTextNode(titletext);
title.appendChild(textOption);
return textOption;
}
function getAttr(registry,service,attr_name) {
var attr = registry.GetTarget(service,
RDF.GetResource(NC + attr_name),
true);
if (attr)
attr = attr.QueryInterface(Components.interfaces.nsIRDFLiteral);
if (attr)
attr = attr.Value;
return attr;
}
function selectChange() {
enableButtons();
}
function moveUp() {
var list = document.getElementById('selectList');
var index = list.selectedIndex;
if (index > 0) {
var optionBefore = list.childNodes.item(index-1);
var selectedOption = list.childNodes.item(index);
list.remove(index);
list.insertBefore(selectedOption, optionBefore);
list.selectedIndex = index - 1;
enableButtons();
enableSave();
}
}
function moveDown() {
var list = document.getElementById('selectList');
var index = list.selectedIndex;
if (index != -1 &&
index != list.options.length - 1) {
var selectedOption = list.childNodes.item(index);
var optionAfter = list.childNodes.item(index+1);
list.remove(index+1);
list.insertBefore(optionAfter, selectedOption);
enableButtons();
enableSave();
}
}
function enableButtons() {
var up = document.getElementById('up');
var down = document.getElementById('down');
var list = document.getElementById('selectList');
var customize = document.getElementById('customize-button');
var index = list.selectedIndex;
var isFirst = index == 0;
var isLast = index == list.options.length - 1;
// up /\ button
if (isFirst) {
up.setAttribute('disabled', 'true');
} else {
up.setAttribute('disabled', '');
}
// down \/ button
if (isLast) {
down.setAttribute('disabled', 'true');
} else {
down.setAttribute('disabled', '');
}
// "Customize..." button
var customizeURL = null;
if (index != -1) {
var option = list.childNodes.item(index);
customizeURL = option.getAttribute('customize');
}
if (customizeURL == 'null') {
customize.setAttribute('disabled','true');
} else {
customize.setAttribute('disabled','');
}
}
function RemovePanel()
{
var list = document.getElementById('selectList');
var index = list.selectedIndex;
if (index != -1) {
// XXX prompt user
list.options[index] = null;
}
enableSave();
}
// Note that there is a bug with resource: URLs right now.
var FileURL = "file:////u/slamm/tt/sidebar-browser.rdf";
// var the "NC" namespace. Used to construct resources
function Save()
{
// Open the RDF file synchronously. This is tricky, because
// GetDataSource() will do it asynchronously. So, what we do is
// this. First try to manually construct the RDF/XML datasource
// and read it in. This might throw an exception if the datasource
// has already been read in once. In which case, we'll just get
// the existing datasource from the RDF service.
var datasource;
try {
datasource = Components.classes["component://netscape/rdf/datasource?name=xml-datasource"].createInstance();
datasource = datasource.QueryInterface(Components.interfaces.nsIRDFXMLDataSource);
//datasource.Init(FileURL);
datasource.Init(sidebar.db);
datasource.Open(true);
dump("datasource = " + datasource + ", opened for the first time.\n");
}
catch (ex) {
//datasource = RDF.GetDataSource(FileURL);
datasource = RDF.GetDataSource(sidebar.db);
dump("datasource = " + datasource + ", using registered datasource.\n");
}
// Create a "container" wrapper around the "NC:BrowserSidebarRoot"
// object. This makes it easier to manipulate the RDF:Seq correctly.
var container = Components.classes["component://netscape/rdf/container"].createInstance();
container = container.QueryInterface(Components.interfaces.nsIRDFContainer);
container.Init(datasource, RDF.GetResource(sidebar.resource));
dump("initialized container " + container + " on " + sidebar.resource+"\n");
// Remove all the current panels
//
var enumerator = container.GetElements();
while (enumerator.HasMoreElements()) {
var service = enumerator.GetNext();
service = service.QueryInterface(Components.interfaces.nsIRDFResource);
container.RemoveElement(service, true);
}
// Add the new panel list
//
var count = container.GetCount();
dump("container has " + count + " elements\n");
var list = document.getElementById('selectList');
var list_length = list.childNodes.length;
for (var ii=0; ii < list_length; ii++, count++) {
dump(list.childNodes.item(ii).getAttribute('title') + '\n');
var title = list.childNodes.item(ii).getAttribute('title');
var content = list.childNodes.item(ii).getAttribute('content');
var customize = list.childNodes.item(ii).getAttribute('customize');
var element = RDF.GetResource(FileURL + "#" + count);
dump(FileURL + "#" + count + "\n");
container.AppendElement(element);
dump("appended " + element + " to the container\n");
// Now make some sidebar-ish assertions about it...
datasource.Assert(element,
RDF.GetResource(NC + "title"),
RDF.GetLiteral(title + ' ' + count),
true);
datasource.Assert(element,
RDF.GetResource(NC + "content"),
RDF.GetLiteral(content),
true);
datasource.Assert(element,
RDF.GetResource(NC + "customize"),
RDF.GetLiteral(customize),
true);
dump("added assertions about " + element + "\n");
}
// Now serialize it back to disk
datasource.Flush();
dump("wrote " + FileURL + " back to disk.\n");
//window.close();
}
function selected()
{
var add_button = document.getElementById('add_button');
var preview_button = document.getElementById('preview_button');
var select_list = document.getElementsByAttribute("selected", "true");
if (select_list.length >= 1) {
add_button.setAttribute('disabled','');
preview_button.setAttribute('disabled','');
} else {
add_button.setAttribute('disabled','true');
preview_button.setAttribute('disabled','true');
}
}
function AddPanel()
{
var tree = document.getElementById('other-panels');
var database = tree.database;
var select_list = document.getElementsByAttribute("selected", "true");
for (var nodeIndex=0; nodeIndex<select_list.length; nodeIndex++) {
var node = select_list[nodeIndex];
if (!node) break;
var id = node.getAttribute("id");
if (!id) break;
var rdfNode = RDF.GetResource(id);
if (!rdfNode) break;
addOption(database,rdfNode);
}
enableSave();
}
function enableSave() {
var save_button = document.getElementById('save_button');
save_button.setAttribute('disabled','');
}

Просмотреть файл

@ -0,0 +1 @@
Makefile

Просмотреть файл

@ -0,0 +1,29 @@
#!gmake
#
# The contents of this file are subject to the Netscape Public License
# Version 1.1 (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) 1999 Netscape Communications Corporation. All Rights
# Reserved.
DEPTH = ../../..
topsrcdir = @top_srcdir@
srcdir = @srcdir@
VPATH = @srcdir@
include $(DEPTH)/config/autoconf.mk
DIRS = resources
include $(topsrcdir)/config/config.mk
include $(topsrcdir)/config/rules.mk

Просмотреть файл

@ -0,0 +1,22 @@
#!nmake
#
# The contents of this file are subject to the Netscape Public License
# Version 1.1 (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) 1999 Netscape Communications Corporation. All Rights
# Reserved.
DEPTH=..\..\..
DIRS= resources
include <$(DEPTH)\config\rules.mak>

Просмотреть файл

@ -0,0 +1 @@
Makefile

Просмотреть файл

@ -0,0 +1,10 @@
customize.js
customize.xul
dummy-flash.rdf
flash-registry.rdf
flash.js
flash.xul
sidebar-browser.rdf
sidebar-browser.xul
sidebar-registry.rdf
sidebar.js

Просмотреть файл

@ -0,0 +1,9 @@
customize.css
flash.css
sidebar.css
flames.gif
list-down-dis.gif
list-down.gif
list-up-dis.gif
list-up.gif
online.gif

Просмотреть файл

@ -0,0 +1,62 @@
#!gmake
#
# 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=../../../..
topsrcdir = @top_srcdir@
srcdir = @srcdir@
VPATH = @srcdir@
CHROME_DIR = sidebar
CHROME_CONTENT_DIR = content/default
CHROME_SKIN_DIR = skin/default
CHROME_CONTENT = \
customize.js \
customize.xul \
dummy-flash.rdf \
flash-registry.rdf \
flash.js \
flash.xul \
sidebar-browser.rdf \
sidebar-browser.xul \
sidebar-registry.rdf \
sidebar.js \
$(NULL)
CHROME_SKIN = \
customize.css \
flash.css \
sidebar.css \
flames.gif \
list-down-dis.gif \
list-down.gif \
list-up-dis.gif \
list-up.gif \
online.gif \
$(NULL)
CHROME_L10N = \
./locale/en-US/customize.dtd \
./locale/en-US/flash.dtd \
./locale/en-US/sidebar-browser-rdf.dtd \
./locale/en-US/sidebar-browser.dtd \
./locale/en-US/sidebar-registry-rdf.dtd \
$(NULL)
include $(DEPTH)/config/autoconf.mk
include $(topsrcdir)/config/config.mk
include $(topsrcdir)/config/rules.mk

Просмотреть файл

@ -0,0 +1,64 @@
/* -*- Mode: C; c-basic-offset: 2 -*-
*
* 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.
*/
/*
Style rules specific to the Customize dialog.
*/
#main-box {
padding: 1px;
}
div.title {
font: 4mm tahoma,arial,helvetica,sans-serif;
margin: 2px;
}
box.box-group {
padding: 2px;
}
box.button-group {
padding: 1mm;
}
#selectList {
width: 12em;
}
#tree {
width: 17em;
}
titledbutton.up {
list-style-image:url(chrome://sidebar/skin/list-up.gif);
}
titledbutton.up[disabled="true"] {
list-style-image:url(chrome://sidebar/skin/list-up-dis.gif);
}
titledbutton.down {
list-style-image:url(chrome://sidebar/skin/list-down.gif);
}
titledbutton.down[disabled="true"] {
list-style-image:url(chrome://sidebar/skin/list-down-dis.gif);
}

Просмотреть файл

@ -0,0 +1,300 @@
// -*- Mode: Java -*-
// the rdf service
var RDF;
var NC = "http://home.netscape.com/NC-rdf#";
var sidebar;
function Init()
{
RDF=Components.classes['component://netscape/rdf/rdf-service'].getService();
RDF=RDF.QueryInterface(Components.interfaces.nsIRDFService);
sidebar = new Object;
sidebar.db = window.arguments[0];
sidebar.resource = window.arguments[1];
var registry;
try {
// First try to construct a new one and load it
// synchronously. nsIRDFService::GetDataSource() loads RDF/XML
// asynchronously by default.
registry = Components.classes['component://netscape/rdf/datasource?name=xml-datasource'].createInstance();
registry = registry.QueryInterface(Components.interfaces.nsIRDFDataSource);
var remote = registry.QueryInterface(Components.interfaces.nsIRDFRemoteDataSource);
remote.Init(sidebar.db); // this will throw if it's already been opened and registered.
// read it in synchronously.
remote.Refresh(true);
}
catch (ex) {
// if we get here, then the RDF/XML has been opened and read
// once. We just need to grab the datasource.
registry = RDF.GetDataSource(sidebar.db);
}
// Create a 'container' wrapper around the sidebar.resources
// resource so we can use some utility routines that make access a
// bit easier.
var sb_datasource = Components.classes['component://netscape/rdf/container'].createInstance();
sb_datasource = sb_datasource.QueryInterface(Components.interfaces.nsIRDFContainer);
sb_datasource.Init(registry, RDF.GetResource(sidebar.resource));
// Now enumerate all of the flash datasources.
var enumerator = sb_datasource.GetElements();
var count = 0;
while (enumerator.HasMoreElements()) {
count = ++count;
var service = enumerator.GetNext();
service = service.QueryInterface(Components.interfaces.nsIRDFResource);
addOption(registry, service);
}
enableButtons();
}
function addOption(registry, service) {
var option_title = getAttr(registry, service, 'title');
var option_customize = getAttr(registry, service, 'customize');
var option_content = getAttr(registry, service, 'content');
var optionSelect = createOptionTitle(option_title);
var option = document.createElement('html:option');
option.setAttribute('title', option_title);
option.setAttribute('customize', option_customize);
option.setAttribute('content', option_content);
option.appendChild(optionSelect);
var sideoption = document.getElementById('selectList');
sideoption.appendChild(option);
}
function createOptionTitle(titletext)
{
var title = document.createElement('html:option');
var textOption = document.createTextNode(titletext);
title.appendChild(textOption);
return textOption;
}
function getAttr(registry,service,attr_name) {
var attr = registry.GetTarget(service,
RDF.GetResource(NC + attr_name),
true);
if (attr)
attr = attr.QueryInterface(Components.interfaces.nsIRDFLiteral);
if (attr)
attr = attr.Value;
return attr;
}
function selectChange() {
enableButtons();
}
function moveUp() {
var list = document.getElementById('selectList');
var index = list.selectedIndex;
if (index > 0) {
var optionBefore = list.childNodes.item(index-1);
var selectedOption = list.childNodes.item(index);
list.remove(index);
list.insertBefore(selectedOption, optionBefore);
list.selectedIndex = index - 1;
enableButtons();
enableSave();
}
}
function moveDown() {
var list = document.getElementById('selectList');
var index = list.selectedIndex;
if (index != -1 &&
index != list.options.length - 1) {
var selectedOption = list.childNodes.item(index);
var optionAfter = list.childNodes.item(index+1);
list.remove(index+1);
list.insertBefore(optionAfter, selectedOption);
enableButtons();
enableSave();
}
}
function enableButtons() {
var up = document.getElementById('up');
var down = document.getElementById('down');
var list = document.getElementById('selectList');
var customize = document.getElementById('customize-button');
var index = list.selectedIndex;
var isFirst = index == 0;
var isLast = index == list.options.length - 1;
// up /\ button
if (isFirst) {
up.setAttribute('disabled', 'true');
} else {
up.setAttribute('disabled', '');
}
// down \/ button
if (isLast) {
down.setAttribute('disabled', 'true');
} else {
down.setAttribute('disabled', '');
}
// "Customize..." button
var customizeURL = null;
if (index != -1) {
var option = list.childNodes.item(index);
customizeURL = option.getAttribute('customize');
}
if (customizeURL == 'null') {
customize.setAttribute('disabled','true');
} else {
customize.setAttribute('disabled','');
}
}
function RemovePanel()
{
var list = document.getElementById('selectList');
var index = list.selectedIndex;
if (index != -1) {
// XXX prompt user
list.options[index] = null;
}
enableSave();
}
// Note that there is a bug with resource: URLs right now.
var FileURL = "file:////u/slamm/tt/sidebar-browser.rdf";
// var the "NC" namespace. Used to construct resources
function Save()
{
// Open the RDF file synchronously. This is tricky, because
// GetDataSource() will do it asynchronously. So, what we do is
// this. First try to manually construct the RDF/XML datasource
// and read it in. This might throw an exception if the datasource
// has already been read in once. In which case, we'll just get
// the existing datasource from the RDF service.
var datasource;
try {
datasource = Components.classes["component://netscape/rdf/datasource?name=xml-datasource"].createInstance();
datasource = datasource.QueryInterface(Components.interfaces.nsIRDFXMLDataSource);
//datasource.Init(FileURL);
datasource.Init(sidebar.db);
datasource.Open(true);
dump("datasource = " + datasource + ", opened for the first time.\n");
}
catch (ex) {
//datasource = RDF.GetDataSource(FileURL);
datasource = RDF.GetDataSource(sidebar.db);
dump("datasource = " + datasource + ", using registered datasource.\n");
}
// Create a "container" wrapper around the "NC:BrowserSidebarRoot"
// object. This makes it easier to manipulate the RDF:Seq correctly.
var container = Components.classes["component://netscape/rdf/container"].createInstance();
container = container.QueryInterface(Components.interfaces.nsIRDFContainer);
container.Init(datasource, RDF.GetResource(sidebar.resource));
dump("initialized container " + container + " on " + sidebar.resource+"\n");
// Remove all the current panels
//
var enumerator = container.GetElements();
while (enumerator.HasMoreElements()) {
var service = enumerator.GetNext();
service = service.QueryInterface(Components.interfaces.nsIRDFResource);
container.RemoveElement(service, true);
}
// Add the new panel list
//
var count = container.GetCount();
dump("container has " + count + " elements\n");
var list = document.getElementById('selectList');
var list_length = list.childNodes.length;
for (var ii=0; ii < list_length; ii++, count++) {
dump(list.childNodes.item(ii).getAttribute('title') + '\n');
var title = list.childNodes.item(ii).getAttribute('title');
var content = list.childNodes.item(ii).getAttribute('content');
var customize = list.childNodes.item(ii).getAttribute('customize');
var element = RDF.GetResource(FileURL + "#" + count);
dump(FileURL + "#" + count + "\n");
container.AppendElement(element);
dump("appended " + element + " to the container\n");
// Now make some sidebar-ish assertions about it...
datasource.Assert(element,
RDF.GetResource(NC + "title"),
RDF.GetLiteral(title + ' ' + count),
true);
datasource.Assert(element,
RDF.GetResource(NC + "content"),
RDF.GetLiteral(content),
true);
datasource.Assert(element,
RDF.GetResource(NC + "customize"),
RDF.GetLiteral(customize),
true);
dump("added assertions about " + element + "\n");
}
// Now serialize it back to disk
datasource.Flush();
dump("wrote " + FileURL + " back to disk.\n");
//window.close();
}
function selected()
{
var add_button = document.getElementById('add_button');
var preview_button = document.getElementById('preview_button');
var select_list = document.getElementsByAttribute("selected", "true");
if (select_list.length >= 1) {
add_button.setAttribute('disabled','');
preview_button.setAttribute('disabled','');
} else {
add_button.setAttribute('disabled','true');
preview_button.setAttribute('disabled','true');
}
}
function AddPanel()
{
var tree = document.getElementById('other-panels');
var database = tree.database;
var select_list = document.getElementsByAttribute("selected", "true");
for (var nodeIndex=0; nodeIndex<select_list.length; nodeIndex++) {
var node = select_list[nodeIndex];
if (!node) break;
var id = node.getAttribute("id");
if (!id) break;
var rdfNode = RDF.GetResource(id);
if (!rdfNode) break;
addOption(database,rdfNode);
}
enableSave();
}
function enableSave() {
var save_button = document.getElementById('save_button');
save_button.setAttribute('disabled','');
}

Просмотреть файл

@ -0,0 +1,15 @@
<?xml version="1.0"?> <!-- Mode: SGML -->
<RDF:RDF xmlns:RDF="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
xmlns:NC="http://home.netscape.com/NC-rdf#">
<RDF:Description about="NC:FlashRoot">
<NC:child>
<RDF:Description ID="flash">
<NC:type resource='http://www.mozilla.org/RDF#Flash' />
<NC:source>Dummy</NC:source>
<NC:description>Testing 1-2-3</NC:description>
<NC:timestamp>Jul 30 15:02 1999</NC:timestamp>
</RDF:Description>
</NC:child>
</RDF:Description>
</RDF:RDF>

Двоичные данные
xpfe/components/sidebar/resources/flames.gif Normal file

Двоичный файл не отображается.

После

Ширина:  |  Высота:  |  Размер: 2.8 KiB

Просмотреть файл

@ -0,0 +1,30 @@
<?xml version="1.0"?> <!-- -*- Mode: SGML; -*- -->
<RDF:RDF xmlns:RDF="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
xmlns:NC="http://home.netscape.com/NC-rdf#">
<RDF:Bag about="NC:FlashDataSources">
<RDF:li>
<!-- The Tinderbox Flash -->
<RDF:Description about="http://cvs-mirror.mozilla.org/webtools/tinderbox/SeaMonkey/flash.rdf">
<NC:poll-interval>300</NC:poll-interval>
</RDF:Description>
</RDF:li>
<RDF:li>
<!-- Messenger Flashes -->
<RDF:Description about="rdf:msgnotifications" />
</RDF:li>
<!-- for testing purposes only -->
<!--
<RDF:li>
<RDF:Description about="chrome://sidebar/content/dummy-flash.rdf">
<NC:poll-interval>15</NC:poll-interval>
</RDF:Description>
</RDF:li>
-->
</RDF:Bag>
<RDF:Bag about="NC:FlashStyleSheets">
</RDF:Bag>
</RDF:RDF>

Просмотреть файл

@ -0,0 +1,21 @@
/* -*- Mode: C; c-basic-offset: 2 -*-
Style rules specific to the Flash Panel. These are kludged right now.
*/
window {
background-color: white;
}
treeitem[type="http://www.mozilla.org/RDF#TinderboxFlash"] > treerow > treecell > titledbutton {
list-style-image: url("chrome://sidebar/skin/flames.gif");
}
treeitem[type="http://home.netscape.com/NC-rdf#MsgNewMessages"] > treerow > treecell > titledbutton {
list-style-image: url("chrome://messenger/skin/folderHasMail.gif");
}
treeitem[type="http://www.mozilla.org/rdf#XPInstallNotification"] > treerow > treecell > titledbutton {
list-style-image: url("resource:/res/rdf/document.gif");
}

Просмотреть файл

@ -0,0 +1,156 @@
/* -*- Mode: Java; tab-width: 4; 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.
*/
// the rdf service
var RDF = Components.classes['component://netscape/rdf/rdf-service'].getService();
RDF = RDF.QueryInterface(Components.interfaces.nsIRDFService);
// the current profile directory
// XXX obviously, this shouldn't be hard-coded
var profiledir = 'chrome://sidebar/content/';
// the location of the flash registry.
var flashdb = profiledir + 'flash-registry.rdf';
function Init()
{
// Initialize the Flash panel.
dump('Init!\n');
var tree = document.getElementById('tree');
// Install all the datasources named in the Flash Registry into
// the tree control. Datasources are listed as members of the
// NC:FlashDataSources sequence, and are loaded in the order that
// they appear in that sequence.
var registry;
try {
// First try to construct a new one and load it
// synchronously. nsIRDFService::GetDataSource() loads RDF/XML
// asynchronously by default.
registry = Components.classes['component://netscape/rdf/datasource?name=xml-datasource'].createInstance();
registry = registry.QueryInterface(Components.interfaces.nsIRDFDataSource);
var remote = registry.QueryInterface(Components.interfaces.nsIRDFRemoteDataSource);
remote.Init(flashdb); // this will throw if it's already been opened and registered.
// read it in synchronously.
remote.Refresh(true);
}
catch (ex) {
// if we get here, then the RDF/XML has been opened and read
// once. We just need to grab the datasource.
registry = RDF.GetDataSource(flashdb);
}
// Create a 'container' wrapper around the NC:FlashDataSources
// resource so we can use some utility routines that make access a
// bit easier.
var flashdatasources = Components.classes['component://netscape/rdf/container'].createInstance();
flashdatasources = flashdatasources.QueryInterface(Components.interfaces.nsIRDFContainer);
flashdatasources.Init(registry, RDF.GetResource('NC:FlashDataSources'));
// Now enumerate all of the flash datasources.
var enumerator = flashdatasources.GetElements();
while (enumerator.HasMoreElements()) {
var service = enumerator.GetNext();
service = service.QueryInterface(Components.interfaces.nsIRDFResource);
dump('adding "' + service.Value + '" to the tree\n');
try {
// Create a new RDF/XML datasource. If this is a 'remote'
// datasource (e.g., a 'http:' URL), it will be loaded
// asynchronously.
var flashservice = RDF.GetDataSource(service.Value);
flashservice = flashservice.QueryInterface(Components.interfaces.nsIRDFDataSource);
// Add it to the tree control's composite datasource.
tree.database.AddDataSource(flashservice);
var pollInterval =
registry.GetTarget(service,
RDF.GetResource('http://home.netscape.com/NC-rdf#poll-interval'),
true);
if (pollInterval)
pollInterval = pollInterval.QueryInterface(Components.interfaces.nsIRDFLiteral);
if (pollInterval)
pollInterval = pollInterval.Value;
if (pollInterval) {
dump(service.Value + ': setting poll interval to ' + pollInterval + 'sec.\n');
Schedule(service.Value, pollInterval);
}
}
catch (ex) {
dump('an exception occurred trying to load "' + service.Value + '":\n');
dump(ex + '\n');
}
}
// Install all of the stylesheets in the Flash Registry into the
// panel.
// TODO
// XXX hack to force the tree to rebuild
tree.setAttribute('ref', 'NC:FlashRoot');
}
function Reload(url, pollInterval)
{
// Reload the specified datasource and reschedule.
dump('Reload(' + url + ', ' + pollInterval + ')\n');
var datasource = RDF.GetDataSource(url);
datasource = datasource.QueryInterface(Components.interfaces.nsIRDFRemoteDataSource);
// Reload, asynchronously.
datasource.Refresh(false);
// Reschedule
Schedule(url, pollInterval);
}
function Schedule(url, pollInterval)
{
setTimeout('Reload("' + url + '", ' + pollInterval + ')', pollInterval * 1000);
}
function OpenURL(node)
{
dump("open-url(" + node + ")\n");
}
// To get around "window.onload" not working in viewer.
function Boot()
{
var tree = document.getElementById('tree');
if (tree == null) {
setTimeout(Boot, 0);
}
else {
Init();
}
}
setTimeout('Boot()', 0);

Просмотреть файл

@ -0,0 +1,74 @@
<?xml version="1.0"?> <!-- -*- Mode: SGML -*- -->
<!--
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.
-->
<?xml-stylesheet href="chrome://global/skin/" type="text/css"?>
<?xml-stylesheet href="chrome://sidebar/skin/" type="text/css"?>
<?xml-stylesheet href="chrome://sidebar/skin/flash.css" type="text/css"?>
<!DOCTYPE window SYSTEM "chrome://sidebar/locale/flash.dtd" >
<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"
align="vertical">
<html:script src="flash.js" />
<tree id="tree"
ref="NC:FlashRoot"
flex="100%"
style="height: 100%"
datasources="rdf:null"
rdf:containment="http://home.netscape.com/NC-rdf#child"
onclick="OpenURL(event.target.parentNode.parentNode);">
<template>
<treechildren>
<treeitem uri="..." type="rdf:http://home.netscape.com/NC-rdf#type">
<treerow>
<treecell>
<treeindentation />
<titledbutton value="rdf:http://home.netscape.com/NC-rdf#source" align="left" />
</treecell>
<treecell>
<titledbutton value="rdf:http://home.netscape.com/NC-rdf#description" align="left"
style="list-style-image: none;" />
</treecell>
<treecell>
<titledbutton value="rdf:http://home.netscape.com/NC-rdf#timestamp" align="left"
style="list-style-image: none;" />
</treecell>
</treerow>
</treeitem>
</treechildren>
</template>
<!-- remove the TREEHEAD when bug 9923 is fixed. -->
<treehead>
<treerow>
<treecell/>
<treecell/>
<treecell/>
</treerow>
</treehead>
</tree>
</window>

Двоичные данные
xpfe/components/sidebar/resources/list-down-dis.gif Normal file

Двоичный файл не отображается.

После

Ширина:  |  Высота:  |  Размер: 76 B

Двоичные данные
xpfe/components/sidebar/resources/list-down.gif Normal file

Двоичный файл не отображается.

После

Ширина:  |  Высота:  |  Размер: 77 B

Двоичные данные
xpfe/components/sidebar/resources/list-up-dis.gif Normal file

Двоичный файл не отображается.

После

Ширина:  |  Высота:  |  Размер: 77 B

Двоичные данные
xpfe/components/sidebar/resources/list-up.gif Normal file

Двоичный файл не отображается.

После

Ширина:  |  Высота:  |  Размер: 79 B

Просмотреть файл

@ -0,0 +1,58 @@
#!gmake
#
# 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=..\..\..\..
CHROME_DIR = sidebar
CHROME_CONTENT_DIR = content\default
CHROME_SKIN_DIR = skin\default
CHROME_CONTENT = \
customize.js \
customize.xul \
dummy-flash.rdf \
flash-registry.rdf \
flash.js \
flash.xul \
sidebar-browser.rdf \
sidebar-browser.xul \
sidebar-registry.rdf \
sidebar.js \
$(NULL)
CHROME_SKIN = \
customize.css \
flash.css \
sidebar.css \
flames.gif \
list-down-dis.gif \
list-down.gif \
list-up-dis.gif \
list-up.gif \
online.gif \
$(NULL)
CHROME_L10N = \
.\locale\en-US\customize.dtd \
.\locale\en-US\flash.dtd \
.\locale\en-US\sidebar-browser-rdf.dtd \
.\locale\en-US\sidebar-browser.dtd \
.\locale\en-US\sidebar-registry-rdf.dtd \
$(NULL)
include <$(DEPTH)\config\rules.mak>

Просмотреть файл

@ -0,0 +1,67 @@
window {
display: block;
background-color: white;
}
iframe {
height: 110px;
border: 0px;
}
box.sidebartitle {
background-color: #505888;
padding: 2px 3px 3px 3px;
border: 0px;
margin: 0px;
font: 10pt sans-serif;
}
box.panelbar {
background-color: #006870;
padding: 2px 3px 3px 3px;
border: 0px;
margin: 0px;
font: 10pt sans-serif;
}
box#sidebox {
width: 100%;
height: 100%;
display:block;
}
titledbutton.sidebartitle:hover {
border: 0px;
margin: 1px;
}
titledbutton.active {
color: yellow;
border: 0px;
margin: 1px;
padding: 3px 2px 0px 1px
}
titledbutton[disabled] {
color: black;
}
titledbutton:hover[disabled] {
border: 0px;
margin: 1px;
}
titledbutton.paneltitle {
horizontal-align: left;
}
titledbutton {
color: white;
margin: 1px;
padding: 2px 1px 1px 2px
}
titledbutton:hover {
border: 1px outset white;
margin: 0px;
}

Просмотреть файл

@ -0,0 +1,36 @@
<?xml version="1.0"?>
<!DOCTYPE RDF SYSTEM "chrome://sidebar/locale/sidebar-browser-rdf.dtd" >
<RDF:RDF xmlns:RDF="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
xmlns:NC="http://home.netscape.com/NC-rdf#">
<RDF:Seq about="NC:BrowserSidebarRoot">
<RDF:li>
<RDF:Description ID="whats-related">
<NC:title>&sidebar.whats-related.label;</NC:title>
<NC:content>resource:/res/samples/related-panel.xul</NC:content>
<NC:customize>resource:/res/samples/related-panel-cust.xul</NC:customize>
</RDF:Description>
</RDF:li>
<RDF:li>
<RDF:Description ID="flash">
<NC:title>&sidebar.flash.label;</NC:title>
<NC:content>chrome://sidebar/content/flash.xul</NC:content>
<NC:height>5em</NC:height>
</RDF:Description>
</RDF:li>
<RDF:li>
<RDF:Description ID="tinderbox">
<NC:title>&sidebar.tinderbox.label;</NC:title>
<NC:content>http://cvs-mirror.mozilla.org/webtools/tinderbox/SeaMonkey/panel.html</NC:content>
</RDF:Description>
</RDF:li>
<RDF:li>
<RDF:Description ID="bookmarks">
<NC:title>&sidebar.bookmarks.label;</NC:title>
<NC:content>resource:/res/samples/bm-panel.xul</NC:content>
<NC:customize>resource:/res/samples/bm-panel-cust.xul</NC:customize>
</RDF:Description>
</RDF:li>
</RDF:Seq>
</RDF:RDF>

Просмотреть файл

@ -0,0 +1,25 @@
<?xml version="1.0"?>
<?xml-stylesheet href="chrome://global/skin/" type="text/css"?>
<?xml-stylesheet href="chrome://sidebar/skin/" type="text/css"?>
<!DOCTYPE window SYSTEM "chrome://sidebar/locale/sidebar-browser.dtd" >
<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"
onload="Init('chrome://sidebar/content/sidebar-browser.rdf',
'NC:BrowserSidebarRoot');" align="vertical">
<html:script src="chrome://sidebar/content/sidebar.js" />
<box id="sidebox" align="vertical" flex="100%">
<box class="sidebartitle">
<spring flex="100%"/>
<titledbutton class="borderless paneltitle"
value="&sidebar.reload.label;"
onclick="window.location.reload()" />
<titledbutton class="borderless paneltitle"
value="&sidebar.customize.label;"
onclick="dialogWindow=customize();" />
</box>
</box>
</window>

Просмотреть файл

@ -0,0 +1,28 @@
<?xml version="1.0"?>
<!DOCTYPE RDF SYSTEM "chrome://sidebar/locale/sidebar-registry-rdf.dtd" >
<RDF:RDF xmlns:RDF="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
xmlns:NC="http://home.netscape.com/NC-rdf#">
<RDF:Seq about="NC:SidebarRoot">
<RDF:li>
<RDF:Description ID="&sidebar.headlines.label;">
<NC:title>&sidebar.headlines.label;</NC:title>
<NC:content>http://my.netscape.com/topstories_subchannel.tmpl</NC:content>
<NC:customize>resource:/res/samples/related-panel-cust.xul</NC:customize>
</RDF:Description>
</RDF:li>
<RDF:li>
<RDF:Description ID="&sidebar.news.label;">
<NC:title>&sidebar.news.label;</NC:title>
<NC:content>http://my.netscape.com/localnews_content.tmpl</NC:content>
</RDF:Description>
</RDF:li>
<RDF:li>
<RDF:Description ID="&sidebar.weather.label;">
<NC:title>&sidebar.weather.label;</NC:title>
<NC:content>http://my.netscape.com/weather_content.tmpl</NC:content>
</RDF:Description>
</RDF:li>
</RDF:Seq>
</RDF:RDF>

Просмотреть файл

@ -0,0 +1,142 @@
/* -*- Mode: C; c-basic-offset: 2 -*-
*
* 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.
*/
/*
Style rules specific to the Sidebar.
*/
iframe
{
height: 125px;
border: 0px;
}
treecell
{
font-family: Verdana, Sans-Serif;
font-size: 8pt;
}
treecell[sortActive="true"][sortDirection="ascending"]
{
background-color: green;
}
treecell[sortActive="true"][sortDirection="descending"]
{
background-color: red;
}
treecol[sortActive="true"]
{
background-color: lightgreen;
}
treehead > treerow > treecell
{
background-color: #c0c0c0;
border: outset 1px;
border-color: white #707070 #707070 white;
vertical-align: middle;
}
treeitem[container="true"][open="true"][loading="true"] > treerow > treecell > titledbutton
{
list-style-image: url("resource:/res/rdf/loading.gif") ! important ;
}
treeitem[type="http://home.netscape.com/NC-rdf#FileSystemObject"][container="true"][open="true"] > treerow > treecell > titledbutton
{
list-style-image: url("resource:/res/rdf/folder-open.gif");
}
treeitem[type="http://home.netscape.com/NC-rdf#FileSystemObject"][container="true"] > treerow > treecell > titledbutton
{
list-style-image: url("resource:/resrdf/folder-closed.gif");
}
treeitem[type="http://home.netscape.com/NC-rdf#FileSystemObject"] > treerow > treecell > titledbutton
{
list-style-image: url("resource:/res/rdf/article.gif");
}
treeitem[container="true"][open="true"] > treerow > treecell > titledbutton
{
list-style-image: url("resource:/res/rdf/folder-open.gif");
}
treeitem[container="true"] > treerow > treecell > titledbutton
{
list-style-image: url("resource:/res/rdf/folder-closed.gif");
}
treeitem > treerow > treecell > titledbutton
{
height: 16px;
width: 16px;
color: inherit;
border: none;
padding: 0px;
margin: 0px;
font: inherit;
}
/*
* Sidebar and Panel title buttons
*/
box#sidebox
{
width: 100%;
height: 100%;
}
box.sidebartitle
{
background-color: #505888;
font: 10pt sans-serif;
}
box.panelbar
{
background-color: #006870;
font: 10pt sans-serif;
}
div.sidebartitlelabel
{
color: white;
padding: 5px;
font: 3mm tahoma,arial,helvetica,sans-serif;
}
titledbutton.paneltitle
{
margin: 1px;
padding: 1px;
color: white;
font: 3mm tahoma,arial,helvetica,sans-serif;
}
treecell titledbutton
{
color: inherit;
}

Просмотреть файл

@ -0,0 +1,162 @@
/* -*- Mode: Java; tab-width: 2; c-basic-offset: 2 -*-
*
* 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.
*/
// the rdf service
var RDF = Components.classes['component://netscape/rdf/rdf-service'].getService();
RDF = RDF.QueryInterface(Components.interfaces.nsIRDFService);
var sidebar = new Object;
function Init(sidebar_db, sidebar_resource)
{
// Initialize the Sidebar
sidebar.db = sidebar_db;
sidebar.resource = sidebar_resource;
var registry;
try {
// First try to construct a new one and load it
// synchronously. nsIRDFService::GetDataSource() loads RDF/XML
// asynchronously by default.
registry = Components.classes['component://netscape/rdf/datasource?name=xml-datasource'].createInstance();
registry = registry.QueryInterface(Components.interfaces.nsIRDFDataSource);
var remote = registry.QueryInterface(Components.interfaces.nsIRDFRemoteDataSource);
remote.Init(sidebar.db); // this will throw if it's already been opened and registered.
// read it in synchronously.
remote.Refresh(true);
}
catch (ex) {
// if we get here, then the RDF/XML has been opened and read
// once. We just need to grab the datasource.
registry = RDF.GetDataSource(sidebar.db);
}
// Create a 'container' wrapper around the sidebar.resources
// resource so we can use some utility routines that make access a
// bit easier.
var sb_datasource = Components.classes['component://netscape/rdf/container'].createInstance();
sb_datasource = sb_datasource.QueryInterface(Components.interfaces.nsIRDFContainer);
sb_datasource.Init(registry, RDF.GetResource(sidebar.resource));
var sidebox = document.getElementById('sidebox');
// Now enumerate all of the flash datasources.
var enumerator = sb_datasource.GetElements();
while (enumerator.HasMoreElements()) {
var service = enumerator.GetNext();
service = service.QueryInterface(Components.interfaces.nsIRDFResource);
var new_panel = createPanel(registry, service);
if (new_panel) {
sidebox.appendChild(new_panel);
}
}
}
function createPanel(registry, service) {
var panel_title = getAttr(registry, service, 'title');
var panel_content = getAttr(registry, service, 'content');
var panel_height = getAttr(registry, service, 'height');
var box = document.createElement('box');
var iframe = document.createElement('html:iframe');
var iframeId = iframe.getAttribute('id');
var panelbar = createPanelTitle(panel_title, iframeId);
box.setAttribute('align', 'vertical');
iframe.setAttribute('src', panel_content);
if (panel_height) {
var height_style = 'height:' + panel_height + ';';
iframe.setAttribute('style', height_style);
iframe.setAttribute('save_height', height_style);
}
box.appendChild(panelbar);
box.appendChild(iframe);
return box;
}
function createPanelTitle(titletext, id)
{
var panelbar = document.createElement('box');
var title = document.createElement('titledbutton');
var spring = document.createElement('spring');
title.setAttribute('value', titletext);
title.setAttribute('class', 'borderless paneltitle');
title.setAttribute('onclick', 'resize("'+id+'")');
spring.setAttribute('flex', '100%');
panelbar.setAttribute('class', 'panelbar');
panelbar.appendChild(title);
panelbar.appendChild(spring);
return panelbar;
}
function getAttr(registry,service,attr_name) {
var attr = registry.GetTarget(service,
RDF.GetResource('http://home.netscape.com/NC-rdf#' + attr_name),
true);
if (attr)
attr = attr.QueryInterface(
Components.interfaces.nsIRDFLiteral);
if (attr)
attr = attr.Value;
return attr;
}
function resize(id) {
var box = document.getElementById('sidebox');
var iframe = document.getElementById(id);
if (iframe.getAttribute('display') == 'none') {
var height_style = iframe.getAttribute('save_height');
iframe.setAttribute('style', height_style + 'visibility:visible');
iframe.setAttribute('display','block');
} else {
iframe.setAttribute('style', 'height:0px; visibility:hidden');
iframe.setAttribute('display','none');
}
}
function customize() {
var newWin = window.openDialog('chrome://sidebar/content/customize.xul','New','chrome', sidebar.db, sidebar.resource);
return newWin;
}
function dumpTree(node, depth) {
var indent = "| | | | | | | | | | | | | | | | | | | | | | | | | | | | | + ";
var kids = node.childNodes;
dump(indent.substr(indent.length - depth*2));
// Print your favorite attributes here
dump(node.nodeName)
dump(" "+node.getAttribute('id'));
dump("\n");
for (var ii=0; ii < kids.length; ii++) {
dumpTree(kids[ii], depth + 1);
}
}