Update notifier to work again.

adding makefiles so that we can soon become part of the build.
added a new dugif for the package.
This commit is contained in:
dougt%netscape.com 1999-07-21 20:40:01 +00:00
parent 898032e6d1
commit 17b802bf7f
12 changed files with 288 additions and 125 deletions

View File

@ -0,0 +1,39 @@
#!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@
include $(DEPTH)/config/autoconf.mk
include $(topsrcdir)/config/config.mk
include $(topsrcdir)/config/rules.mk
EXPORT_RESOURCE_NOTIFIER = \
$(srcdir)/folder-closed.gif \
$(srcdir)/folder-open.gif \
$(srcdir)/package.gif \
$(srcdir)/SoftwareUpdate.css \
$(srcdir)/SoftwareUpdate.js \
$(srcdir)/SoftwareUpdate.xul \
$(srcdir)/SoftwareUpdates.rdf \
$(srcdir)/SoftwareUpdate-Source-1.rdf \
$(NULL)
install::
$(INSTALL) $(EXPORT_RESOURCE_NOTIFIER) $(DIST)/bin/res/xpinstall

View File

@ -0,0 +1,8 @@
folder-closed.gif
folder-open.gif
package.gif
SoftwareUpdate.css
SoftwareUpdate.js
SoftwareUpdate.xul
SoftwareUpdates.rdf
SoftwareUpdate-Source-1.rdf

View File

@ -3,29 +3,29 @@
<RDF:Bag about="NC:SoftwareUpdateRoot">
<RDF:li>
<RDF:Bag about="NC:NewSoftwareToday" NC:title="New Software">
<RDF:Bag about="NC:SoftwarePackages" NC:title="New Software">
<RDF:li>
<RDF:Description ID="AimUpdate344">
<NC:type resource="http://home.netscape.com/NC-rdf#SoftwarePackage" />
<NC:title>AOL AIM</NC:title>
<NC:description>An Instant Message Client</NC:description>
<NC:version>3.4.1.12</NC:version>
<NC:registryKey>/AOL/AIM/</NC:registryKey>
<NC:url>http://home.netscape.com/index.html</NC:url>
</RDF:Description>
</RDF:li>
<RDF:li>
<RDF:Description ID="AimUpdate344">
<NC:type resource="http://home.netscape.com/NC-rdf#SoftwarePackage" />
<NC:title>AOL AIM</NC:title>
<NC:description>An Instant Message Client</NC:description>
<NC:version>3.4.1.12</NC:version>
<NC:registryKey>/AOL/AIM/</NC:registryKey>
<NC:url>http://home.netscape.com/index.html</NC:url>
</RDF:Description>
</RDF:li>
<RDF:li>
<RDF:Description ID="PGPPlugin345">
<NC:type resource="http://home.netscape.com/NC-rdf#SoftwarePackage" />
<NC:title>PGP Plugin For Mozilla</NC:title>
<NC:description>A high grade encryption plugin</NC:description>
<NC:version>1.1.2.0</NC:version>
<NC:registryKey>/PGP/ROCKS/</NC:registryKey>
<NC:url>http://home.netscape.com/index.html</NC:url>
</RDF:Description>
</RDF:li>
<RDF:li>
<RDF:Description ID="PGPPlugin345">
<NC:type resource="http://home.netscape.com/NC-rdf#SoftwarePackage" />
<NC:title>PGP Plugin For Mozilla</NC:title>
<NC:description>A high grade encryption plugin</NC:description>
<NC:version>1.1.2.0</NC:version>
<NC:registryKey>/PGP/ROCKS/</NC:registryKey>
<NC:url>http://home.netscape.com/index.html</NC:url>
</RDF:Description>
</RDF:li>
</RDF:Bag>
</RDF:li>

View File

@ -1,57 +1,21 @@
/* -*- Mode: C; c-basic-offset: 2 -*-
Style rules specific to the SoftwareUpdate Panel. These are kludged right now.
*/
window {
display: block;
}
tree {
display: table;
background-color: #FFFFFF;
border: none;
border-spacing: 0px;
width: 100%;
background-color: white;
}
treecol {
display: table-column;
width: 200px;
treeitem[type="http://home.netscape.com/NC-rdf#SoftwarePackage"] > treerow > treecell > titledbutton {
list-style-image: url("resource:/res/xpinstall/SoftwareUpdatePackage.gif");
}
treeitem {
display: table-row;
}
treeitem[type="http://home.netscape.com/NC-rdf#Folder"] > treerow > treecell > titledbutton {
list-style-image: url("resource:/res/xpinstall/folder-closed.gif");
treehead {
display: table-header-group;
}
treebody {
display: table-row-group;
}
treecell {
display: table-cell;
font-family: Verdana, Sans-Serif;
font-size: 8pt;
}
treecell[selectedcell] {
background-color: yellow;
}
treehead treeitem treecell {
background-color: #c0c0c0;
border: outset 1px;
border-color: white #707070 #707070 white;
padding-left: 4px;
}
treeitem[type="http://home.netscape.com/NC-rdf#SoftwarePackage"] > treecell > titledbutton {
list-style-image: url("resource:/res/rdf/SoftwareUpdatePackage.gif");
}
treeitem[type="http://home.netscape.com/NC-rdf#Folder"] > treecell > titledbutton {
list-style-image: url("resource:/res/rdf/bookmark-folder-closed.gif");
treeitem[type="http://home.netscape.com/NC-rdf#Folder"][open="true"] > treecell > titledbutton {
list-style-image: url("resource:/res/rdf/bookmark-folder-open.gif");
treeitem[type="http://home.netscape.com/NC-rdf#Folder"][open="true"] > treerow > treecell > titledbutton {
list-style-image: url("resource:/res/xpinstall/folder-open.gif");
}

View File

@ -4,6 +4,7 @@
function getAttr(registry,service,attr_name)
{
var attr = registry.GetTarget(service,
RDF.GetResource('http://home.netscape.com/NC-rdf#' + attr_name),
true);
@ -12,29 +13,35 @@
if (attr)
attr = attr.Value;
return attr;
}
// the location of the flash registry.
var localSoftwareUpdateRegistry = 'resource:/res/rdf/SoftwareUpdates.rdf';
function Init()
{
// this is the main rdf file.
dump("Software Notification!");
var tree = document.getElementById('tree');
var mainRegistry;
try
{
// First try to construct a new one and load it
// synchronously. nsIRDFService::GetDataSource() loads RDF/XML
// asynchronously by default.
mainRegistry = Components.classes['component://netscape/rdf/datasource?name=xml-datasource'].createInstance();
mainRegistry = mainRegistry.QueryInterface(Components.interfaces.nsIRDFXMLDataSource);
mainRegistry.Init(localSoftwareUpdateRegistry); // this will throw if it's already been opened and registered.
mainRegistry = mainRegistry.QueryInterface(Components.interfaces.nsIRDFDataSource);
var remote = mainRegistry.QueryInterface(Components.interfaces.nsIRDFRemoteDataSource);
remote.Init(localSoftwareUpdateRegistry); // this will throw if it's already been opened and registered.
// read it in synchronously.
mainRegistry.Open(true);
remote.Refresh(true);
}
catch (ex)
{
@ -42,13 +49,17 @@
// once. We just need to grab the datasource.
mainRegistry = RDF.GetDataSource(localSoftwareUpdateRegistry);
}
// Create a 'container' wrapper around the NC:SoftwareUpdateDataSources
// resource so we can use some utility routines that make access a
// bit easier.
var mainContainer = Components.classes['component://netscape/rdf/container'].createInstance();
mainContainer = mainContainer.QueryInterface(Components.interfaces.nsIRDFContainer);
mainContainer.Init(mainRegistry, RDF.GetResource('NC:SoftwareUpdateDataSources'));
// Now enumerate all of the softwareupdate datasources.
var mainEnumerator = mainContainer.GetElements();
while (mainEnumerator.HasMoreElements())
@ -56,45 +67,87 @@
var aDistributor = mainEnumerator.GetNext();
aDistributor = aDistributor.QueryInterface(Components.interfaces.nsIRDFResource);
var distributorContainer = Components.classes['component://netscape/rdf/container'].createInstance();
distributorContainer = distributorContainer.QueryInterface(Components.interfaces.nsIRDFContainer);
dump('Contacting Distributor: "' + aDistributor.Value + '"...\n');
var distributorRegistry = RDF.GetDataSource(aDistributor.Value);
var distributorResource = RDF.GetResource('NC:SoftwareUpdateRoot');
var distributorRegistry;
distributorContainer.Init(distributorRegistry, distributorResource);
// Now enumerate all of the distributorContainer's packages.
var distributorEnumerator = distributorContainer.GetElements();
while (distributorEnumerator.HasMoreElements())
try
{
var aPackage = distributorEnumerator.GetNext();
aPackage = aPackage.QueryInterface(Components.interfaces.nsIRDFResource);
// remove any that we do not want.
if (getAttr(distributorRegistry, aPackage, 'title') == "AOL AIM")
{
//distributorContainer.RemoveElement(aPackage, true);
}
// First try to construct a new one and load it
// synchronously. nsIRDFService::GetDataSource() loads RDF/XML
// asynchronously by default.
distributorRegistry = Components.classes['component://netscape/rdf/datasource?name=xml-datasource'].createInstance();
distributorRegistry = distributorRegistry.QueryInterface(Components.interfaces.nsIRDFDataSource);
var remote = distributorRegistry.QueryInterface(Components.interfaces.nsIRDFRemoteDataSource);
remote.Init(aDistributor.Value); // 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.
distributorRegistry = RDF.GetDataSource(aDistributor.Value);
}
var tree = document.getElementById('tree');
// Add it to the tree control's composite datasource.
tree.database.AddDataSource(distributorRegistry);
}
try
{
// Create a 'container' wrapper around the NC:SoftwareUpdateRoot
// resource so we can use some utility routines that make access a
// bit easier.
var distributorContainer = Components.classes['component://netscape/rdf/container'].createInstance();
distributorContainer = distributorContainer.QueryInterface(Components.interfaces.nsIRDFContainer);
distributorContainer.Init(distributorRegistry, RDF.GetResource('NC:SoftwarePackages'));
// Now enumerate all of the distributorContainer's packages.
var distributorEnumerator = distributorContainer.GetElements();
dump('Parsing "' + aDistributor.Value + '" \n');
dump('Contatiner "' + distributorContainer + '" \n');
dump('Enumerator "' + distributorEnumerator + '" \n');
while (distributorEnumerator.HasMoreElements())
{
// Create a new RDF/XML datasource.
var aPackage = distributorEnumerator.GetNext();
aPackage = aPackage.QueryInterface(Components.interfaces.nsIRDFResource);
// remove any that we do not want.
dump('package name "' + getAttr(distributorRegistry, aPackage, 'title') + '" \n');
// var InstallTrigger.CompareVersion(getAttr(distributorRegistry, aPackage, 'registryKey'),
// getAttr(distributorRegistry, aPackage, 'version'));
if (getAttr(distributorRegistry, aPackage, 'title') == "AOL AIM")
{
distributorContainer.RemoveElement(aPackage, true);
}
}
tree.database.AddDataSource(distributorRegistry);
}
catch (ex)
{
dump('an exception occurred trying to load "' + aDistributor.Value + '":\n');
dump(ex + '\n');
}
// Install all of the stylesheets in the softwareupdate Registry into the
// panel.
// TODO
// TODO
// XXX hack to force the tree to rebuild
var treebody = document.getElementById('NC:SoftwareUpdateRoot');
treebody.setAttribute('id', 'NC:SoftwareUpdateRoot');
// XXX hack to force the tree to rebuild
var treebody = document.getElementById('NC:SoftwareUpdateRoot');
treebody.setAttribute('id', 'NC:SoftwareUpdateRoot');
}
}
@ -128,15 +181,38 @@
return false;
}
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);
}
// To get around "window.onload" not working in viewer.
function Boot()
{
var tree = document.getElementById('tree');
if (tree == null) {
if (tree == null)
{
setTimeout(Boot, 0);
}
else {
else
{
Init();
}
}

View File

@ -1,30 +1,64 @@
<?xml version="1.0"?>
<?xml-stylesheet href="resource:/res/rdf/sidebar.css" type="text/css"?>
<?xml-stylesheet href="resource:/res/rdf/SoftwareUpdate.css" type="text/css"?>
<?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="resource://res/xpinstall/SoftwareUpdate.css" type="text/css"?>
<!DOCTYPE window
[
<!ENTITY tree.header.title.label "Title">
<!ENTITY tree.header.description.label "Description">
<!ENTITY tree.header.version.label "Version">
]>
<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">
xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul"
align="vertical">
<html:script src="SoftwareUpdate.js"/>
<tree id="tree"
<tree id="tree"
flex="100%"
style="height: 100%"
datasources="rdf:softwareupdates"
ondblclick="return OpenURL(event, event.target.parentNode);">
onclick="OpenURL(event, event.target.parentNode);">
<treecol rdf:resource="http://home.netscape.com/NC-rdf#title" />
<treecol rdf:resource="http://home.netscape.com/NC-rdf#description" />
<treecol rdf:resource="http://home.netscape.com/NC-rdf#version" />
<treehead>
<treeitem>
<treecell>Title</treecell>
<treecell>Description</treecell>
<treecell>Version</treecell>
</treeitem>
<treerow>
<treecell>&tree.header.title.label;</treecell>
<treecell>&tree.header.description.label;</treecell>
<treecell>&tree.header.version.label;</treecell>
</treerow>
</treehead>
<treebody id="NC:SoftwareUpdateRoot" rdf:containment="http://home.netscape.com/NC-rdf#child" />
<treechildren ref="NC:SoftwareUpdateRoot" rdf:containment="http://home.netscape.com/NC-rdf#child" open="true" />
</tree>
</window>

Binary file not shown.

Before

Width:  |  Height:  |  Size: 201 B

View File

@ -2,6 +2,6 @@
xmlns:NC="http://home.netscape.com/softwareupdate-schema#">
<RDF:Bag about="NC:SoftwareUpdateDataSources">
<RDF:li resource="resource:/res/rdf/SoftwareUpdate-Source-1.rdf" />
<RDF:li resource="resource://res/xpinstall/SoftwareUpdate-Source-1.rdf" />
</RDF:Bag>
</RDF:RDF>

Binary file not shown.

After

Width:  |  Height:  |  Size: 120 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 159 B

View File

@ -0,0 +1,42 @@
#!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=..\..
IGNORE_MANIFEST=1
include <$(DEPTH)\config\rules.mak>
install:: $(DLL)
$(MAKE_INSTALL) folder-closed.gif $(DIST)\bin\res\xpinstall
$(MAKE_INSTALL) folder-open.gif $(DIST)\bin\res\xpinstall
$(MAKE_INSTALL) package.gif $(DIST)\bin\res\xpinstall
$(MAKE_INSTALL) SoftwareUpdate.css $(DIST)\bin\res\xpinstall
$(MAKE_INSTALL) SoftwareUpdate.js $(DIST)\bin\res\xpinstall
$(MAKE_INSTALL) SoftwareUpdate.xul $(DIST)\bin\res\xpinstall
$(MAKE_INSTALL) SoftwareUpdates.rdf $(DIST)\bin\res\xpinstall
$(MAKE_INSTALL) SoftwareUpdate-Source-1.rdf $(DIST)\bin\res\xpinstall
clobber::
rm -f $(DIST)\res\xpinstall\folder-closed.gif
rm -f $(DIST)\res\xpinstall\folder-open.gif
rm -f $(DIST)\res\xpinstall\package.gif
rm -f $(DIST)\res\xpinstall\SoftwareUpdatePackage.gif
rm -f $(DIST)\res\xpinstall\SoftwareUpdate.css
rm -f $(DIST)\res\xpinstall\SoftwareUpdate.js
rm -f $(DIST)\res\xpinstall\SoftwareUpdate.xul
rm -f $(DIST)\res\xpinstall\SoftwareUpdates.rdf
rm -f $(DIST)\res\xpinstall\SoftwareUpdate-Source-1.rdf

Binary file not shown.

After

Width:  |  Height:  |  Size: 800 B