home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Chip 2011 November
/
CHIP_2011_11.iso
/
Programy
/
Narzedzia
/
AIMP2
/
aimp_2.61.583.exe
/
$TEMP
/
YandexPackSetup.msi
/
fil30DDAB2C507C50CB9C33E46D22B5D685
< prev
next >
Wrap
Extensible Markup Language
|
2010-07-12
|
14KB
|
294 lines
<?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="install"
extends="../package-management.xml#package-management"
inheritstyle="false">
<resources>
<stylesheet src="install.css"/>
</resources>
<content>
<xul:vbox step="download-preset">
<xul:head title="&install.head.title;" description="&install.download.label;"/>
<xul:progressmeter class="download-preset-progressmeter" mode="undetermined" flex="1"/>
<xul:hbox class="buttons">
<xul:button label="&button.cancel;" oncommand="dialog.close();"/>
</xul:hbox>
</xul:vbox>
<xul:vbox step="confirm">
<xul:head class="confirm-head" crop="end" mode="preset"/>
<xul:disclaimer/>
<xul:hbox class="buttons">
<xul:button label="&button.install;" oncommand="_stepDownloadManifests();"/>
<xul:button label="&button.cancel;" oncommand="dialog.close();"/>
</xul:hbox>
</xul:vbox>
<xul:vbox step="download">
<xul:head class="download-head" crop="end" mode="preset"/>
<xul:label value="&install.download.label;"/>
<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="&install.conflict.head.title;" description="&install.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="&install.placement.head.title;" description="&install.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"/>
<xul:label value="&placement.list.label;"/>
<xul:components class="placement-widgets"/>
</xul:more>
</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>
<field name="mode">"install"</field>
<field name="_url">this.parameters.preset</field>
<constructor><![CDATA[
this._stepDownloadPreset();
]]></constructor>
<destructor><![CDATA[
]]></destructor>
<method name="_stepDownloadPreset">
<body><![CDATA[
var trusted = false;
try {
var uri = this._Cc["@mozilla.org/network/io-service;1"]
.getService(this._Ci.nsIIOService)
.newURI(this._url, null, null);
trusted = this._application.isTrustedPresetUri(uri);
}
catch (e) {
this._logger.warn("Failed checking preset address. " + this._application.core.Lib.misc.formatError(e));
}
if (trusted)
this.setAttribute("trusted", "true");
this.step("download-preset");
var context = this;
function callback(e) { context._stepConfirm(e); }
var request = Components.classes["@mozilla.org/xmlextras/xmlhttprequest;1"]
.createInstance(Components.interfaces.nsIXMLHttpRequest);
request.mozBackgroundRequest = true;
request.overrideMimeType("application/xml");
request.open("GET", this._url, true);
request.channel.loadFlags |= Components.interfaces.nsIRequest.LOAD_BYPASS_CACHE |
Components.interfaces.nsIRequest.INHIBIT_CACHING;
request.channel.QueryInterface(Components.interfaces.nsIWritablePropertyBag2);
request.channel.setPropertyAsBool("isXBInstallRequest", true);
var target = request.QueryInterface(Components.interfaces.nsIDOMEventTarget);
target.addEventListener("load", callback, false);
target.addEventListener("error", callback, false);
request.send(null);
]]></body>
</method>
<method name="_stepConfirm">
<parameter name="event"/>
<body><![CDATA[
var request = event.target;
try {
if (request.status >= 300)
throw new this._errors.EDownload(this._url, request.status);
let presetDoc = request.responseXML;
if (!(presetDoc instanceof Components.interfaces.nsIDOMDocument))
throw new this._errors.ECustom("Response is not an XML document");
this.preset = new this._application.core.Lib.XB.Preset(request.responseXML, this._url);
this.preset.text = request.responseText;
this.presets = [this.preset];
}
catch (e) {
this._logger.error(this._application.core.Lib.misc.formatError(e));
this._error(e);
return;
}
this.step("confirm");
this.info = {
image: this.preset.icon,
title: this.preset.name,
description: this._bundle.get("preset.description", [this.preset.author, this.preset.version])
};
this._nodeConfirmHead.info = this.info;
]]></body>
</method>
<method name="_stepDownloadManifests">
<body><![CDATA[
this.step("download");
this._nodeDownloadHead.info = this.info;
var packageIds = {__proto__: null},
items = [];
for each (info in this.preset.widgetsInfo) {
let packageId = info.packageID;
if (packageId in packageIds)
continue;
packageIds[packageId] = 1;
items.push({
info: info,
url: packageId
});
}
var context = this;
this.queue = new this._misc.DownloadQueue(
items,
function (items) { context._stepAnalyseManifests(items); },
this._nodeDownloadProgressmeter
);
]]></body>
</method>
<method name="_stepAnalyseManifests">
<parameter name="manifestItems"/>
<body><![CDATA[
var failed = false;
this.packages = [];
for each (let item in manifestItems) {
if (item.status === this._Cr.NS_OK) {
let info = item.info,
packageId = info.packageID;
try {
let manifest = new this._application.core.Lib.XB.PackageManifest(packageId, item.file);
let [packageInfo, packageInfo2] = this._application.selectBestPackage(manifest);
if (!packageInfo) {
this.flags.packageError = true;
this.flags.availableForModernPlatform = !!packageInfo2;
continue;
}
let install = true;
if (this._packageManager.isPackageInstalled(packageId)) {
let packageInfoInstalled = this._packageManager.getPackageInfo(packageId);
install = (this._compare(packageInfo.version, packageInfoInstalled.version) > 0);
}
if (install) {
this.packages.push({
type: "package",
manifest: manifest,
info: packageInfo,
widgets: this._knownWidgetsInPackage(manifest.packageID),
checked: true
});
}
}
catch (e) {
this._logger.error(this._application.core.Lib.misc.formatError(e));
this._error(e);
return;
}
}
else {
this.flags.downloadError = true;
}
}
this.queue.clean();
this._stepDownloadPackages();
]]></body>
</method>
<method name="_stepCheckErrors">
<body><![CDATA[
if (this.flags.widgetError || this.flags.packageError) {
if (this.flags.availableForModernPlatform) {
this._error("error.situation.install.old-platfrom",
this.widgets.length ? {
"accept": "_stepPlacement();",
"close": "dialog.close();"
} : null);
}
else if (this.widgets.length == 0)
this._error("error.situation.install.generic");
else
this._error("error.situation.install.partially", {
"accept": "_stepPlacement();",
"close": "dialog.close();"
});
return;
}
else {
if (this.widgets.length == 0) {
this._error("error.situation.install.no-widgets");
return;
}
}
this._stepPlacement();
]]></body>
</method>
<method name="_stepPlacement">
<body><![CDATA[
this.step("placement");
if (this.widgets.length == 1) {
this._nodePlacementPlacement.setAttribute("no-replace", "true");
}
else {
this._nodePlacementWidgets.items = this.widgets;
}
]]></body>
</method>
</implementation>
</binding>
</bindings>