2004-02-06 23:13:15 +03:00
|
|
|
/* ***************
|
|
|
|
Desc: Installation script
|
|
|
|
****************** */
|
2004-06-08 21:37:03 +04:00
|
|
|
const displayName = "Mozilla Calendar";
|
|
|
|
const name = "MozillaCalendar";
|
|
|
|
const version = "0.8";
|
|
|
|
const addLocales = new Array("cs-CZ", "cy-GB", "de-AT", "es-ES", "fr-FR", "hu-HU", "ja-JP", "lt-LT", "nl-NL", "pl-PL", "pt-BR", "sk-SK", "sl-SI", "sv-SE", "wen-DE");
|
|
|
|
const default_lang = "en-US";
|
2004-02-06 23:13:15 +03:00
|
|
|
|
2004-03-03 19:08:24 +03:00
|
|
|
var err = initInstall(displayName, name, version);
|
|
|
|
|
|
|
|
logComment("initInstall returned: " + err);
|
2001-12-20 23:13:53 +03:00
|
|
|
|
|
|
|
calendarDir = getFolder("Chrome","calendar");
|
|
|
|
|
2004-03-03 19:08:24 +03:00
|
|
|
logComment("calendarDir is: " + calendarDir);
|
|
|
|
|
2001-12-20 23:13:53 +03:00
|
|
|
setPackageFolder(calendarDir);
|
|
|
|
|
2004-06-03 01:51:21 +04:00
|
|
|
err = addDirectory("", "components", getFolder( "Components" ), "" );
|
2001-12-20 23:13:53 +03:00
|
|
|
|
2004-03-03 19:08:24 +03:00
|
|
|
logComment("addDirectory() for components returned: " + err);
|
2002-03-05 17:03:26 +03:00
|
|
|
|
2004-06-03 01:51:21 +04:00
|
|
|
err = addDirectory( "", "", "other_stuff/icons", getFolder( "Chrome", "icons" ), "", true );
|
2004-03-03 19:08:24 +03:00
|
|
|
|
|
|
|
logComment("addDirectory() for icons returned: " + err);
|
|
|
|
|
|
|
|
err = addFile( "Calendar Chrome",
|
2004-06-03 01:51:21 +04:00
|
|
|
"chrome/calendar.jar", // jar source folder
|
2004-02-06 23:13:15 +03:00
|
|
|
getFolder("Chrome"), // target folder
|
|
|
|
"");
|
|
|
|
|
2004-03-03 19:08:24 +03:00
|
|
|
logComment("addFile() for calendar.jar returned: " + err);
|
|
|
|
|
2002-01-30 18:22:19 +03:00
|
|
|
var err = getLastError();
|
2004-02-06 23:13:15 +03:00
|
|
|
|
2001-12-20 23:13:53 +03:00
|
|
|
if ( err == SUCCESS ) {
|
2002-01-30 18:22:19 +03:00
|
|
|
|
2004-02-06 23:13:15 +03:00
|
|
|
registerChrome(PACKAGE | DELAYED_CHROME, getFolder("Chrome","calendar.jar"), "content/calendar/");
|
|
|
|
registerChrome(SKIN | DELAYED_CHROME, getFolder("Chrome","calendar.jar"), "skin/classic/calendar/");
|
|
|
|
registerChrome(SKIN | DELAYED_CHROME, getFolder("Chrome","calendar.jar"), "skin/modern/calendar/");
|
2004-06-08 21:37:03 +04:00
|
|
|
registerChrome(LOCALE | DELAYED_CHROME, getFolder("Chrome","calendar.jar"), "locale/"+default_lang+"/calendar/");
|
2004-02-06 23:13:15 +03:00
|
|
|
|
2004-02-20 19:37:07 +03:00
|
|
|
for (var i = 0; i < addLocales.length; i++) {
|
2004-02-23 18:49:49 +03:00
|
|
|
|
|
|
|
// Check Mozilla 1.x, Mozilla Firefox (Browser)
|
2004-02-20 19:37:07 +03:00
|
|
|
chkJarFileName = addLocales[i] + ".jar";
|
|
|
|
tmp_f = getFolder("Chrome", chkJarFileName);
|
|
|
|
if ( File.exists(tmp_f) ) {
|
2004-06-03 01:51:21 +04:00
|
|
|
err = addFile( "Calendar Chrome-"+addLocales[i],
|
|
|
|
"chrome/calendar-"+addLocales[i]+".jar", // jar source folder
|
|
|
|
getFolder("Chrome"), // target folder
|
|
|
|
"");
|
2004-06-08 21:37:03 +04:00
|
|
|
logComment("addFile() for locale " + addLocales[i] + " returned: " + err);
|
|
|
|
if( err != SUCCESS )
|
|
|
|
alert( "addFile() for locale " + addLocales[i] + " returned: " + err );
|
|
|
|
else
|
|
|
|
registerChrome(LOCALE | DELAYED_CHROME, getFolder("Chrome","calendar-" +addLocales[i] + ".jar"),
|
|
|
|
"locale/" +addLocales[i] + "/calendar/");
|
2004-02-20 19:37:07 +03:00
|
|
|
}
|
2004-02-23 18:49:49 +03:00
|
|
|
|
|
|
|
// Check Mozilla Thunderbird (Mail/News)
|
|
|
|
chkJarFileName = addLocales[i] + "-mail.jar";
|
|
|
|
tmp_f = getFolder("Chrome", chkJarFileName);
|
|
|
|
if ( File.exists(tmp_f) ) {
|
2004-06-03 01:51:21 +04:00
|
|
|
err = addFile( "Calendar Chrome-"+addLocales[i],
|
|
|
|
"chrome/calendar-"+addLocales[i]+".jar", // jar source folder
|
|
|
|
getFolder("Chrome"), // target folder
|
|
|
|
"");
|
2004-06-08 21:37:03 +04:00
|
|
|
logComment("addFile() for locale " + addLocales[i] + " returned: " + err);
|
|
|
|
if( err != SUCCESS )
|
|
|
|
alert( "addFile() for locale " + addLocales[i] + " returned: " + err );
|
|
|
|
else
|
|
|
|
registerChrome(LOCALE | DELAYED_CHROME, getFolder("Chrome","calendar-" + addLocales[i]+".jar"),
|
|
|
|
"locale/" + addLocales[i]+"/calendar/");
|
2004-02-23 18:49:49 +03:00
|
|
|
}
|
2004-02-20 19:37:07 +03:00
|
|
|
}
|
2004-02-06 23:13:15 +03:00
|
|
|
|
2002-01-30 18:22:19 +03:00
|
|
|
err = performInstall();
|
2001-12-20 23:13:53 +03:00
|
|
|
|
2004-02-06 23:13:15 +03:00
|
|
|
if ( err == SUCCESS || err == 999 ) {
|
|
|
|
alert("The Mozilla Calendar has been successfully installed. \n"
|
|
|
|
+"Please restart your application to continue.");
|
|
|
|
} else {
|
|
|
|
alert("performInstall() failed. \n"
|
|
|
|
+"_____________________________\nError code:" + err);
|
|
|
|
cancelInstall(err);
|
2002-01-30 18:22:19 +03:00
|
|
|
}
|
2001-12-20 23:13:53 +03:00
|
|
|
}
|
2004-06-03 01:51:21 +04:00
|
|
|
else {
|
2004-06-08 21:37:03 +04:00
|
|
|
alert("Failed to add some/all files. \n"
|
2001-12-20 23:13:53 +03:00
|
|
|
+"You probably don't have appropriate permissions \n"
|
2004-02-06 23:13:15 +03:00
|
|
|
+"(write access to <mozilla>/chrome directory). \n"
|
2003-01-13 18:36:45 +03:00
|
|
|
+"If you installed Mozilla as root then you need to install calendar as root as well.\n"
|
|
|
|
+"Or, you can change ownership of your Mozilla directory to yourself and install calendar."
|
2001-12-20 23:13:53 +03:00
|
|
|
+"_____________________________\nError code:" + err);
|
|
|
|
cancelInstall(err);
|
|
|
|
}
|
|
|
|
|