home *** CD-ROM | disk | FTP | other *** search
- <?xml version="1.0"?>
- <!DOCTYPE bindings [
- <!ENTITY % locale SYSTEM "chrome://yasearch/locale/package-management/package-management.dtd">
- %locale;
- ]>
-
- <bindings xmlns="http://www.mozilla.org/xbl"
- xmlns:xul="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul"
- xmlns:xbl="http://www.mozilla.org/xbl"
- xmlns:html="http://www.w3.org/1999/xhtml">
-
- <binding id="update"
- extends="../package-management.xml#package-management"
- inheritstyle="false">
-
- <resources>
- <stylesheet src="update.css"/>
- </resources>
-
- <content>
-
- <xul:vbox step="confirm">
- <xul:head class="confirm-head" title="&update.select.head.title;" description="&update.select.head.description;"/>
- <xul:hbox class="buttons">
- <xul:button label="&button.update;" oncommand="_stepSelect();"/>
- <xul:button label="&button.postpone;" oncommand="dialog.close();"/>
- </xul:hbox>
- <xul:more open="true" label-opened="&more.opened;" label-closed="&more.closed;">
- <xul:label value="&update.select.list.description;"/>
- <xul:components class="confirm-components"/>
- </xul:more>
- </xul:vbox>
-
- <xul:vbox step="download">
- <xul:head class="download-head" title="&update.download.head.title;" description="&update.download.head.description;"/>
- <xul:progressmeter class="download-progressmeter" mode="determined" max="100" value="0" flex="1"/>
- <xul:hbox class="buttons">
- <xul:button label="&button.cancel;" oncommand="dialog.close();"/>
- </xul:hbox>
- </xul:vbox>
-
- <xul:vbox step="conflict">
- <xul:head class="conflict-head" mode="warning" title="&update.conflict.head.title;" description="&update.conflict.head.description;"/>
- <xul:components class="conflict-deleted"/>
- <xul:hbox class="buttons">
- <xul:button label="&button.accept;" oncommand="_stepConflictResolved();"/>
- <xul:button label="&button.cancel;" oncommand="dialog.close();"/>
- </xul:hbox>
- </xul:vbox>
-
- <xul:vbox step="placement">
- <xul:head class="placement-head" title="&update.placement.head.title;" description="&update.placement.head.description;"/>
- <xul:hbox class="buttons">
- <xul:button label="&button.save;" oncommand="_stepApply();"/>
- <xul:button label="&button.cancel;" oncommand="dialog.close();"/>
- </xul:hbox>
- <xul:more label-opened="&more.opened;" label-closed="&more.closed;">
- <xul:label value="&placement.placement.label;"/>
- <xul:placement class="placement-placement" no-replace="true"/>
- <xul:label value="&placement.list.label;"/>
- <xul:components class="placement-widgets"/>
- </xul:more>
- </xul:vbox>
-
- <xul:vbox step="finish">
- <xul:head class="finish-head" title="&update.finish.head.title;" description="&update.finish.head.description;"/>
- <xul:hbox class="buttons">
- <xul:button label="&button.finish;" oncommand="dialog.close();"/>
- </xul:hbox>
- </xul:vbox>
-
- <xul:vbox step="error">
- <xul:head class="error-head" mode="warning" title="&error.head.title;" description="&error.head.description;"/>
- <xul:hbox class="buttons" anonid="error-buttons">
- <xul:button action="accept" label="&button.accept;" oncommand=""/>
- <xul:button action="repeat" label="&button.repeat;" oncommand=""/>
- <xul:button action="close" label="&button.finish;" oncommand=""/>
- </xul:hbox>
- <xul:more class="error-more" label-opened="&error.more.opened;" label-closed="&error.more.closed;">
- <xul:label flex="1" class="error-details"/>
- </xul:more>
- </xul:vbox>
-
- </content>
-
- <implementation implements="nsIDOMEventListener,nsIWebProgressListener">
- <field name="mode">"update"</field>
-
- <field name="simple">!!this.parameters.simple</field>
-
- <constructor><![CDATA[
- this._stepConfirm();
- ]]></constructor>
-
- <destructor><![CDATA[
- ]]></destructor>
-
- <method name="_stepConfirm">
- <body><![CDATA[
- if (!this.simple)
- this.step("confirm");
-
- this.components = [];
- var index = [];
-
- for each (let manifest in this.parameters.manifests) {
- let [info, info2] = this._application.selectBestPackage(manifest);
- let component = {
- type: "package",
- checked: true,
- manifest: manifest,
- info: info,
- version: info.version,
- widgets: []
- };
-
- index[manifest.packageID] = component;
- this.components.push(component);
- }
-
- for each (let id in this._widgetLibrary.getWidgetProtoIDs()) {
- let [widgetPackageID, ] = this._widgetLibrary.parseWidgetProtoID(id)
- let component = index[widgetPackageID];
- if (component) {
- component.widgets.push(this._widgetLibrary.getWidgetProto(id));
- }
- }
-
- for each (let preset in this.parameters.presets) {
- let component = {
- type: "preset",
- checked: true,
- preset: preset
- };
- this.components.push(component);
- }
-
- this._nodeConfirmComponents.items = this.components;
-
- if (this.simple)
- this._stepSelect();
- ]]></body>
- </method>
-
- <method name="_stepSelect">
- <body><![CDATA[
- this._filterComponent(this.components, function(component) {
- return !!component.checked;
- });
-
- this.presets = [];
- this.packages = [];
- for each (let component in this.components) {
- component.checked = false;
-
- if (component.type == "preset")
- this.presets.push(component.preset);
- if (component.type == "package")
- this.packages.push(component);
- }
-
- this.packages = this.packages.filter(function(component) {
- if (component.widgets.length > 0)
- return true;
-
- let used = false,
- packageID = component.manifest.packageID;
- loop: for each (let preset in this.presets)
- for each (let info in preset.widgetsInfo)
- if (packageID == info.packageID) {
- used = true;
- break loop;
- }
- return used;
- }, this);
-
- this._stepDownloadPackages();
- ]]></body>
- </method>
-
- <method name="_stepCheckErrors">
- <body><![CDATA[
- this._stepPlacement();
- ]]></body>
- </method>
-
- <method name="_stepPlacement">
- <body><![CDATA[
- if (this.widgets.length == 0) {
- if (this._stepInstall())
- this.step("finish");
- return;
- }
-
- this.step("placement");
-
- this._nodePlacementWidgets.items = this.widgets;
- ]]></body>
- </method>
-
- </implementation>
- </binding>
- </bindings>