Bug 236613: change to MPL/LGPL/GPL tri-license.
This commit is contained in:
Родитель
372400a583
Коммит
1b148e0813
|
@ -1,854 +0,0 @@
|
|||
/*
|
||||
* Version: MPL 1.1/GPL 2.0/LGPL 2.1
|
||||
*
|
||||
* The contents of this file are subject to the Mozilla Public License Version
|
||||
* 1.1 (the "License"); you may not use this file except in compliance with
|
||||
* the License. You may obtain a copy of the License at
|
||||
* http://www.mozilla.org/MPL/
|
||||
*
|
||||
* Software distributed under the License is distributed on an "AS IS" basis,
|
||||
* WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
|
||||
* for the specific language governing rights and limitations under the
|
||||
* License.
|
||||
*
|
||||
* The Original Code is OEone Corporation.
|
||||
*
|
||||
* The Initial Developer of the Original Code is
|
||||
* OEone Corporation.
|
||||
* Portions created by OEone Corporation are Copyright (C) 2001
|
||||
* OEone Corporation. All Rights Reserved.
|
||||
*
|
||||
* Contributor(s): Mostafa Hosseini (mostafah@oeone.com)
|
||||
*
|
||||
* Alternatively, the contents of this file may be used under the terms of
|
||||
* either the GNU General Public License Version 2 or later (the "GPL"), or
|
||||
* the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
|
||||
* in which case the provisions of the GPL or the LGPL are applicable instead
|
||||
* of those above. If you wish to allow use of your version of this file only
|
||||
* under the terms of either the GPL or the LGPL, and not to allow others to
|
||||
* use your version of this file under the terms of the MPL, indicate your
|
||||
* decision by deleting the provisions above and replace them with the notice
|
||||
* and other provisions required by the GPL or the LGPL. If you do not delete
|
||||
* the provisions above, a recipient may use your version of this file under
|
||||
* the terms of any one of the MPL, the GPL or the LGPL.
|
||||
*
|
||||
*
|
||||
*/
|
||||
|
||||
const DEFAULT_SERVER="file:///tmp/.oecalendar";
|
||||
const DEFAULT_TITLE="Lunch Time";
|
||||
const DEFAULT_DESCRIPTION = "Will be out for one hour";
|
||||
const DEFAULT_LOCATION = "Restaurant";
|
||||
const DEFAULT_CATEGORY = "Personal";
|
||||
const DEFAULT_EMAIL = "mostafah@oeone.com";
|
||||
const DEFAULT_PRIVATE = false;
|
||||
const DEFAULT_ALLDAY = false;
|
||||
const DEFAULT_ALARM = true;
|
||||
const DEFAULT_ALARMUNITS = "minutes";
|
||||
const DEFAULT_ALARMLENGTH = 5;
|
||||
const DEFAULT_RECUR = true;
|
||||
const DEFAULT_RECURINTERVAL = 7;
|
||||
const DEFAULT_RECURUNITS = "days";
|
||||
const DEFAULT_RECURFOREVER = true;
|
||||
const DEFAULT_ATTACHMENT = DEFAULT_SERVER;
|
||||
|
||||
var iCalLib = null;
|
||||
var gObserver = null;
|
||||
var gTodoObserver = null;
|
||||
|
||||
function Observer()
|
||||
{
|
||||
}
|
||||
|
||||
Observer.prototype.onAddItem = function( icalevent )
|
||||
{
|
||||
dump( "Observer.prototype.onAddItem\n" );
|
||||
}
|
||||
|
||||
Observer.prototype.onModifyItem = function( icalevent, oldevent )
|
||||
{
|
||||
dump( "Observer.prototype.onModifyItem\n" );
|
||||
}
|
||||
|
||||
Observer.prototype.onDeleteItem = function( icalevent )
|
||||
{
|
||||
dump( "Observer.prototype.onDeleteItem\n" );
|
||||
}
|
||||
|
||||
Observer.prototype.onAlarm = function( icalevent )
|
||||
{
|
||||
dump( "Observer.prototype.onAlarm\n" );
|
||||
}
|
||||
|
||||
Observer.prototype.onLoad = function()
|
||||
{
|
||||
dump( "Observer.prototype.onLoad\n" );
|
||||
}
|
||||
|
||||
Observer.prototype.onStartBatch = function()
|
||||
{
|
||||
dump( "Observer.prototype.onStartBatch\n" );
|
||||
}
|
||||
|
||||
Observer.prototype.onEndBatch = function()
|
||||
{
|
||||
dump( "Observer.prototype.onEndBatch\n" );
|
||||
}
|
||||
|
||||
function Test()
|
||||
{
|
||||
netscape.security.PrivilegeManager.enablePrivilege("UniversalXPConnect");
|
||||
if( iCalLib == null ) {
|
||||
var iCalLibComponent = Components.classes["@mozilla.org/ical;1"].createInstance();
|
||||
iCalLib = iCalLibComponent.QueryInterface(Components.interfaces.oeIICal);
|
||||
}
|
||||
|
||||
iCalLib.server = DEFAULT_SERVER;
|
||||
iCalLib.Test();
|
||||
alert( "Finished Test" );
|
||||
}
|
||||
|
||||
function TestAll()
|
||||
{
|
||||
netscape.security.PrivilegeManager.enablePrivilege("UniversalXPConnect");
|
||||
if( iCalLib == null ) {
|
||||
var iCalLibComponent = Components.classes["@mozilla.org/ical;1"].createInstance();
|
||||
iCalLib = iCalLibComponent.QueryInterface(Components.interfaces.oeIICal);
|
||||
}
|
||||
if( gObserver == null ) {
|
||||
gObserver = new Observer();
|
||||
iCalLib.addObserver( gObserver );
|
||||
}
|
||||
if( gTodoObserver == null ) {
|
||||
gTodoObserver = new Observer();
|
||||
iCalLib.addTodoObserver( gTodoObserver );
|
||||
}
|
||||
if( !TestTimeConversion() ) {
|
||||
alert( "Stopped Test" );
|
||||
return;
|
||||
}
|
||||
|
||||
iCalLib.server = DEFAULT_SERVER;
|
||||
var id = TestAddEvent();
|
||||
if( id == 0 ) {
|
||||
alert( "Stopped Test" );
|
||||
return;
|
||||
}
|
||||
var iCalEvent = TestFetchEvent( id );
|
||||
if( iCalEvent == null ) {
|
||||
alert( "Stopped Test" );
|
||||
return;
|
||||
}
|
||||
id = TestUpdateEvent( iCalEvent );
|
||||
// TestSearchEvent();
|
||||
TestDeleteEvent( id );
|
||||
TestRecurring();
|
||||
|
||||
//Todo tests
|
||||
var id = TestAddTodo();
|
||||
var iCalTodo = TestFetchTodo( id );
|
||||
id = TestUpdateTodo( iCalTodo );
|
||||
TestDeleteTodo( id );
|
||||
TestFilterTodo( id );
|
||||
TestIcalString();
|
||||
alert( "Finished Test" );
|
||||
}
|
||||
|
||||
function TestTimeConversion() {
|
||||
netscape.security.PrivilegeManager.enablePrivilege("UniversalXPConnect");
|
||||
var dateTimeComponent = Components.classes["@mozilla.org/oedatetime;1"].createInstance();
|
||||
dateTime = dateTimeComponent.QueryInterface(Components.interfaces.oeIDateTime);
|
||||
var date1 = new Date();
|
||||
dateTime.setTime( date1 );
|
||||
var date1inms = parseInt( date1.getTime()/1000 );
|
||||
if( (dateTime.getTime()/1000) != date1inms ) {
|
||||
alert( "TestTimeConversion(): Step1 failed" );
|
||||
return false;
|
||||
}
|
||||
date1 = new Date( 1970, 0, 1, 0, 0, 0 );
|
||||
dateTime.setTime( date1 );
|
||||
date1inms = parseInt( date1.getTime()/1000 );
|
||||
if( (dateTime.getTime()/1000) != date1inms ) {
|
||||
alert( "TestTimeConversion(): Step2 failed" );
|
||||
return false;
|
||||
}
|
||||
date1 = new Date( 1969, 11, 31, 23, 59, 59 );
|
||||
dateTime.setTime( date1 );
|
||||
date1inms = parseInt( date1.getTime()/1000 );
|
||||
if( (dateTime.getTime()/1000) != date1inms ) {
|
||||
alert( "TestTimeConversion(): Step3 failed" );
|
||||
return false;
|
||||
}
|
||||
date1 = new Date( 1969, 11, 31, 19, 0, 0 );
|
||||
dateTime.setTime( date1 );
|
||||
date1inms = parseInt( date1.getTime()/1000 );
|
||||
if( (dateTime.getTime()/1000) != date1inms ) {
|
||||
alert( "TestTimeConversion(): Step4 failed" );
|
||||
return false;
|
||||
}
|
||||
date1 = new Date( 1962, 7, 03, 0, 0, 0 );
|
||||
dateTime.setTime( date1 );
|
||||
date1inms = parseInt( date1.getTime()/1000 );
|
||||
if( (dateTime.getTime()/1000) != date1inms ) {
|
||||
alert( "TestTimeConversion(): Step5 failed" );
|
||||
return false;
|
||||
}
|
||||
if( dateTime.hour != date1.getHours() ) {
|
||||
alert( "TestTimeConversion(): Step6 failed" );
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
function TestAddEvent()
|
||||
{
|
||||
var iCalEventComponent = Components.classes["@mozilla.org/icalevent;1"].createInstance();
|
||||
|
||||
var iCalEvent = iCalEventComponent.QueryInterface(Components.interfaces.oeIICalEvent);
|
||||
|
||||
iCalEvent.title = DEFAULT_TITLE;
|
||||
iCalEvent.description = DEFAULT_DESCRIPTION;
|
||||
iCalEvent.location = DEFAULT_LOCATION;
|
||||
iCalEvent.categories = DEFAULT_CATEGORY;
|
||||
iCalEvent.privateEvent = DEFAULT_PRIVATE;
|
||||
iCalEvent.allDay = DEFAULT_ALLDAY;
|
||||
iCalEvent.alarm = DEFAULT_ALARM;
|
||||
iCalEvent.alarmUnits = DEFAULT_ALARMUNITS;
|
||||
iCalEvent.alarmLength = DEFAULT_ALARMLENGTH;
|
||||
iCalEvent.alarmEmailAddress = DEFAULT_EMAIL;
|
||||
iCalEvent.inviteEmailAddress = DEFAULT_EMAIL;
|
||||
|
||||
iCalEvent.recur = DEFAULT_RECUR;
|
||||
iCalEvent.recurInterval = DEFAULT_RECURINTERVAL;
|
||||
iCalEvent.recurUnits = DEFAULT_RECURUNITS;
|
||||
iCalEvent.recurForever = DEFAULT_RECURFOREVER;
|
||||
|
||||
iCalEvent.start.year = 2001;
|
||||
iCalEvent.start.month = 10; //November
|
||||
iCalEvent.start.day = 1;
|
||||
iCalEvent.start.hour = 12;
|
||||
iCalEvent.start.minute = 24;
|
||||
|
||||
iCalEvent.end.year = 2001;
|
||||
iCalEvent.end.month = 10; //November
|
||||
iCalEvent.end.day = 1;
|
||||
iCalEvent.end.hour = 13;
|
||||
iCalEvent.end.minute = 24;
|
||||
|
||||
var snoozetime = new Date();
|
||||
iCalEvent.setSnoozeTime( snoozetime );
|
||||
|
||||
Attachment = Components.classes["@mozilla.org/messengercompose/attachment;1"].createInstance( Components.interfaces.nsIMsgAttachment );
|
||||
Attachment.url = DEFAULT_ATTACHMENT;
|
||||
iCalEvent.addAttachment( Attachment );
|
||||
|
||||
Contact = Components.classes["@mozilla.org/addressbook/cardproperty;1"].createInstance( Components.interfaces.nsIAbCard );
|
||||
Contact.primaryEmail = DEFAULT_EMAIL;
|
||||
iCalEvent.addContact( Contact );
|
||||
|
||||
var id = iCalLib.addEvent( iCalEvent );
|
||||
|
||||
if( id == null ){
|
||||
alert( "TestAddEvent(): Invalid Id" );
|
||||
return 0;
|
||||
}
|
||||
if( iCalEvent.title != DEFAULT_TITLE ){
|
||||
alert( "TestAddEvent(): Invalid Title" );
|
||||
return 0;
|
||||
}
|
||||
if( iCalEvent.description != DEFAULT_DESCRIPTION ){
|
||||
alert( "TestAddEvent(): Invalid Description" );
|
||||
return 0;
|
||||
}
|
||||
if( iCalEvent.location != DEFAULT_LOCATION ){
|
||||
alert( "TestAddEvent(): Invalid Location" );
|
||||
return 0;
|
||||
}
|
||||
if( iCalEvent.categories != DEFAULT_CATEGORY ){
|
||||
alert( "TestAddEvent(): Invalid Category" );
|
||||
return 0;
|
||||
}
|
||||
if( iCalEvent.privateEvent != DEFAULT_PRIVATE ){
|
||||
alert( "TestAddEvent(): Invalid PrivateEvent Setting" );
|
||||
return 0;
|
||||
}
|
||||
if( iCalEvent.allDay != DEFAULT_ALLDAY ){
|
||||
alert( "TestAddEvent(): Invalid AllDay Setting" );
|
||||
return 0;
|
||||
}
|
||||
if( iCalEvent.alarm != DEFAULT_ALARM ){
|
||||
alert( "TestAddEvent(): Invalid Alarm Setting" );
|
||||
return 0;
|
||||
}
|
||||
if( iCalEvent.alarmUnits != DEFAULT_ALARMUNITS ){
|
||||
alert( "TestAddEvent(): Invalid Alarm Units" );
|
||||
return 0;
|
||||
}
|
||||
if( iCalEvent.alarmLength != DEFAULT_ALARMLENGTH ){
|
||||
alert( "TestAddEvent(): Invalid Alarm Length" );
|
||||
return 0;
|
||||
}
|
||||
if( iCalEvent.alarmEmailAddress != DEFAULT_EMAIL ){
|
||||
alert( "TestAddEvent(): Invalid Alarm Email Address" );
|
||||
return 0;
|
||||
}
|
||||
if( iCalEvent.inviteEmailAddress != DEFAULT_EMAIL ){
|
||||
alert( "TestAddEvent(): Invalid Invite Email Address" );
|
||||
return 0;
|
||||
}
|
||||
if( iCalEvent.recur != DEFAULT_RECUR ){
|
||||
alert( "TestAddEvent(): Invalid Recur Setting" );
|
||||
return 0;
|
||||
}
|
||||
if( iCalEvent.recurInterval != DEFAULT_RECURINTERVAL ){
|
||||
alert( "TestAddEvent(): Invalid Recur Interval" );
|
||||
return 0;
|
||||
}
|
||||
if( iCalEvent.recurUnits != DEFAULT_RECURUNITS ){
|
||||
alert( "TestAddEvent(): Invalid Recur Units" );
|
||||
return 0;
|
||||
}
|
||||
if( iCalEvent.recurForever != DEFAULT_RECURFOREVER ){
|
||||
alert( "TestAddEvent(): Invalid Recur Forever" );
|
||||
return 0;
|
||||
}
|
||||
|
||||
//TODO: Check for start and end date
|
||||
|
||||
return id;
|
||||
}
|
||||
|
||||
function TestFetchEvent( id )
|
||||
{
|
||||
var iCalEvent = iCalLib.fetchEvent( id );
|
||||
if( id == null ){
|
||||
alert( "TestFetchEvent(): Invalid Id" );
|
||||
return null;
|
||||
}
|
||||
if( iCalEvent.title != DEFAULT_TITLE ){
|
||||
alert( "TestFetchEvent(): Invalid Title" );
|
||||
return null;
|
||||
}
|
||||
if( iCalEvent.description != DEFAULT_DESCRIPTION ){
|
||||
alert( "TestFetchEvent(): Invalid Description" );
|
||||
return null;
|
||||
}
|
||||
if( iCalEvent.location != DEFAULT_LOCATION ){
|
||||
alert( "TestFetchEvent(): Invalid Location" );
|
||||
return null;
|
||||
}
|
||||
if( iCalEvent.categories != DEFAULT_CATEGORY ){
|
||||
alert( "TestFetchEvent(): Invalid Category" );
|
||||
return null;
|
||||
}
|
||||
if( iCalEvent.privateEvent != DEFAULT_PRIVATE ){
|
||||
alert( "TestFetchEvent(): Invalid PrivateEvent Setting" );
|
||||
return null;
|
||||
}
|
||||
if( iCalEvent.allDay != DEFAULT_ALLDAY ){
|
||||
alert( "TestFetchEvent(): Invalid AllDay Setting" );
|
||||
return null;
|
||||
}
|
||||
if( iCalEvent.alarm != DEFAULT_ALARM ){
|
||||
alert( "TestFetchEvent(): Invalid Alarm Setting" );
|
||||
return null;
|
||||
}
|
||||
if( iCalEvent.alarmUnits != DEFAULT_ALARMUNITS ){
|
||||
alert( "TestFetchEvent(): Invalid Alarm Units" );
|
||||
return null;
|
||||
}
|
||||
if( iCalEvent.alarmLength != DEFAULT_ALARMLENGTH ){
|
||||
alert( "TestFetchEvent(): Invalid Alarm Length" );
|
||||
return null;
|
||||
}
|
||||
if( iCalEvent.alarmEmailAddress != DEFAULT_EMAIL ){
|
||||
alert( "TestFetchEvent(): Invalid Alarm Email Address" );
|
||||
return null;
|
||||
}
|
||||
if( iCalEvent.inviteEmailAddress != DEFAULT_EMAIL ){
|
||||
alert( "TestFetchEvent(): Invalid Invite Email Address" );
|
||||
return null;
|
||||
}
|
||||
if( iCalEvent.recur != DEFAULT_RECUR ){
|
||||
alert( "TestFetchEvent(): Invalid Recur Setting" );
|
||||
return null;
|
||||
}
|
||||
if( iCalEvent.recurInterval != DEFAULT_RECURINTERVAL ){
|
||||
alert( "TestFetchEvent(): Invalid Recur Interval" );
|
||||
return null;
|
||||
}
|
||||
if( iCalEvent.recurUnits != DEFAULT_RECURUNITS ){
|
||||
alert( "TestFetchEvent(): Invalid Recur Units" );
|
||||
return null;
|
||||
}
|
||||
if( iCalEvent.recurForever != DEFAULT_RECURFOREVER ){
|
||||
alert( "TestFetchEvent(): Invalid Recur Forever" );
|
||||
return null;
|
||||
}
|
||||
if( !iCalEvent.attachmentsArray.Count() ) {
|
||||
alert( "TestFetchEvent(): No attachment found" );
|
||||
return null;
|
||||
}
|
||||
attachment = iCalEvent.attachmentsArray.QueryElementAt( 0, Components.interfaces.nsIMsgAttachment );
|
||||
if ( attachment.url != DEFAULT_ATTACHMENT ) {
|
||||
alert( "TestFetchEvent(): Invalid attachment" );
|
||||
return null;
|
||||
}
|
||||
//TODO: Check for start and end date
|
||||
|
||||
return iCalEvent;
|
||||
}
|
||||
|
||||
function TestUpdateEvent( iCalEvent )
|
||||
{
|
||||
iCalEvent.title = DEFAULT_TITLE+"*NEW*";
|
||||
iCalEvent.description = DEFAULT_DESCRIPTION+"*NEW*";
|
||||
iCalEvent.location = DEFAULT_LOCATION+"*NEW*";
|
||||
iCalEvent.categories = DEFAULT_CATEGORY+"*NEW*";
|
||||
iCalEvent.privateEvent = !DEFAULT_PRIVATE;
|
||||
iCalEvent.allDay = !DEFAULT_ALLDAY;
|
||||
iCalEvent.alarm = !DEFAULT_ALARM;
|
||||
|
||||
iCalEvent.recur = !DEFAULT_RECUR;
|
||||
|
||||
iCalEvent.start.year = 2002;
|
||||
iCalEvent.start.month = 11; //December
|
||||
iCalEvent.start.day = 2;
|
||||
iCalEvent.start.hour = 13;
|
||||
iCalEvent.start.minute = 25;
|
||||
|
||||
iCalEvent.end.year = 2002;
|
||||
iCalEvent.end.month = 11; //December
|
||||
iCalEvent.end.day = 2;
|
||||
iCalEvent.end.hour = 14;
|
||||
iCalEvent.end.minute = 25;
|
||||
|
||||
var id = iCalLib.modifyEvent( iCalEvent );
|
||||
|
||||
if( id == null )
|
||||
alert( "TestUpdateEvent(): Invalid Id" );
|
||||
if( iCalEvent.title != DEFAULT_TITLE+"*NEW*" )
|
||||
alert( "TestUpdateEvent(): Invalid Title" );
|
||||
if( iCalEvent.description != DEFAULT_DESCRIPTION+"*NEW*" )
|
||||
alert( "TestUpdateEvent(): Invalid Description" );
|
||||
if( iCalEvent.location != DEFAULT_LOCATION+"*NEW*" )
|
||||
alert( "TestUpdateEvent(): Invalid Location" );
|
||||
if( iCalEvent.categories != DEFAULT_CATEGORY+"*NEW*" )
|
||||
alert( "TestUpdateEvent(): Invalid Category" );
|
||||
if( iCalEvent.privateEvent != !DEFAULT_PRIVATE )
|
||||
alert( "TestUpdateEvent(): Invalid PrivateEvent Setting" );
|
||||
if( iCalEvent.allDay != !DEFAULT_ALLDAY )
|
||||
alert( "TestUpdateEvent(): Invalid AllDay Setting" );
|
||||
if( iCalEvent.alarm != !DEFAULT_ALARM )
|
||||
alert( "TestUpdateEvent(): Invalid Alarm Setting" );
|
||||
if( iCalEvent.recur != !DEFAULT_RECUR )
|
||||
alert( "TestUpdateEvent(): Invalid Recur Setting" );
|
||||
|
||||
//TODO check start and end dates
|
||||
|
||||
return id;
|
||||
}
|
||||
/*
|
||||
function TestSearchEvent()
|
||||
{
|
||||
result = iCalLib.SearchBySQL( "SELECT * FROM VEVENT WHERE CATEGORIES = 'Personal'" );
|
||||
alert( "Result : " + result );
|
||||
}*/
|
||||
|
||||
function TestDeleteEvent( id )
|
||||
{
|
||||
iCalLib.deleteEvent( id );
|
||||
|
||||
var iCalEvent = iCalLib.fetchEvent( id );
|
||||
|
||||
if( iCalEvent != null )
|
||||
alert( "Delete failed" );
|
||||
}
|
||||
|
||||
function TestRecurring() {
|
||||
var iCalEventComponent = Components.classes["@mozilla.org/icalevent;1"].createInstance();
|
||||
this.iCalEvent = iCalEventComponent.QueryInterface(Components.interfaces.oeIICalEvent);
|
||||
|
||||
iCalEvent.allDay = true;
|
||||
iCalEvent.recur = true;
|
||||
iCalEvent.recurInterval = 1;
|
||||
iCalEvent.recurUnits = "years";
|
||||
iCalEvent.recurForever = true;
|
||||
|
||||
iCalEvent.start.year = 2001;
|
||||
iCalEvent.start.month = 0;
|
||||
iCalEvent.start.day = 1;
|
||||
iCalEvent.start.hour = 0;
|
||||
iCalEvent.start.minute = 0;
|
||||
|
||||
iCalEvent.end.year = 2001;
|
||||
iCalEvent.end.month = 0;
|
||||
iCalEvent.end.day = 1;
|
||||
iCalEvent.end.hour = 23;
|
||||
iCalEvent.end.minute = 59;
|
||||
|
||||
var id = iCalLib.addEvent( iCalEvent );
|
||||
|
||||
var displayDates = new Object();
|
||||
var checkdate = new Date( 2002, 0, 1, 0, 0, 0 );
|
||||
var eventList = iCalLib.getEventsForDay( checkdate );
|
||||
|
||||
if( !eventList.hasMoreElements() )
|
||||
alert( "Yearly Recur Test Failed" );
|
||||
|
||||
iCalLib.deleteEvent( id );
|
||||
}
|
||||
|
||||
function TestAddTodo()
|
||||
{
|
||||
var iCalTodoComponent = Components.classes["@mozilla.org/icaltodo;1"].createInstance();
|
||||
|
||||
var iCalTodo = iCalTodoComponent.QueryInterface(Components.interfaces.oeIICalTodo);
|
||||
|
||||
iCalTodo.title = DEFAULT_TITLE;
|
||||
iCalTodo.description = DEFAULT_DESCRIPTION;
|
||||
iCalTodo.location = DEFAULT_LOCATION;
|
||||
iCalTodo.categories = DEFAULT_CATEGORY;
|
||||
iCalTodo.privateEvent = DEFAULT_PRIVATE;
|
||||
iCalTodo.allDay = DEFAULT_ALLDAY;
|
||||
iCalTodo.alarm = DEFAULT_ALARM;
|
||||
iCalTodo.alarmUnits = DEFAULT_ALARMUNITS;
|
||||
iCalTodo.alarmLength = DEFAULT_ALARMLENGTH;
|
||||
iCalTodo.alarmEmailAddress = DEFAULT_EMAIL;
|
||||
iCalTodo.inviteEmailAddress = DEFAULT_EMAIL;
|
||||
|
||||
iCalTodo.recur = DEFAULT_RECUR;
|
||||
iCalTodo.recurInterval = DEFAULT_RECURINTERVAL;
|
||||
iCalTodo.recurUnits = DEFAULT_RECURUNITS;
|
||||
iCalTodo.recurForever = DEFAULT_RECURFOREVER;
|
||||
|
||||
iCalTodo.start.year = 2001;
|
||||
iCalTodo.start.month = 10; //November
|
||||
iCalTodo.start.day = 1;
|
||||
iCalTodo.start.hour = 12;
|
||||
iCalTodo.start.minute = 24;
|
||||
|
||||
iCalTodo.due.year = 2001;
|
||||
iCalTodo.due.month = 11; //December
|
||||
iCalTodo.due.day = 1;
|
||||
iCalTodo.due.hour = 23;
|
||||
iCalTodo.due.minute = 59;
|
||||
|
||||
var id = iCalLib.addTodo( iCalTodo );
|
||||
|
||||
if( id == null )
|
||||
alert( "TestAddTodo(): Invalid Id" );
|
||||
if( iCalTodo.title != DEFAULT_TITLE )
|
||||
alert( "TestAddTodo(): Invalid Title" );
|
||||
if( iCalTodo.description != DEFAULT_DESCRIPTION )
|
||||
alert( "TestAddTodo(): Invalid Description" );
|
||||
if( iCalTodo.location != DEFAULT_LOCATION )
|
||||
alert( "TestAddTodo(): Invalid Location" );
|
||||
if( iCalTodo.categories != DEFAULT_CATEGORY )
|
||||
alert( "TestAddTodo(): Invalid Category" );
|
||||
if( iCalTodo.privateEvent != DEFAULT_PRIVATE )
|
||||
alert( "TestAddTodo(): Invalid PrivateEvent Setting" );
|
||||
if( iCalTodo.allDay != DEFAULT_ALLDAY )
|
||||
alert( "TestAddTodo(): Invalid AllDay Setting" );
|
||||
if( iCalTodo.alarm != DEFAULT_ALARM )
|
||||
alert( "TestAddTodo(): Invalid Alarm Setting" );
|
||||
if( iCalTodo.alarmUnits != DEFAULT_ALARMUNITS )
|
||||
alert( "TestAddTodo(): Invalid Alarm Units" );
|
||||
if( iCalTodo.alarmLength != DEFAULT_ALARMLENGTH )
|
||||
alert( "TestAddTodo(): Invalid Alarm Length" );
|
||||
if( iCalTodo.alarmEmailAddress != DEFAULT_EMAIL )
|
||||
alert( "TestAddTodo(): Invalid Alarm Email Address" );
|
||||
if( iCalTodo.inviteEmailAddress != DEFAULT_EMAIL )
|
||||
alert( "TestAddTodo(): Invalid Invite Email Address" );
|
||||
if( iCalTodo.recur != DEFAULT_RECUR )
|
||||
alert( "TestAddTodo(): Invalid Recur Setting" );
|
||||
if( iCalTodo.recurInterval != DEFAULT_RECURINTERVAL )
|
||||
alert( "TestAddTodo(): Invalid Recur Interval" );
|
||||
if( iCalTodo.recurUnits != DEFAULT_RECURUNITS )
|
||||
alert( "TestAddTodo(): Invalid Recur Units" );
|
||||
if( iCalTodo.recurForever != DEFAULT_RECURFOREVER )
|
||||
alert( "TestAddTodo(): Invalid Recur Forever" );
|
||||
|
||||
//TODO: Check for start and end date
|
||||
|
||||
return id;
|
||||
}
|
||||
|
||||
function TestFetchTodo( id )
|
||||
{
|
||||
var iCalEvent = iCalLib.fetchTodo( id );
|
||||
if( id == null )
|
||||
alert( "TestFetchTodo(): Invalid Id" );
|
||||
if( iCalEvent.title != DEFAULT_TITLE )
|
||||
alert( "TestFetchTodo(): Invalid Title" );
|
||||
if( iCalEvent.description != DEFAULT_DESCRIPTION )
|
||||
alert( "TestFetchTodo(): Invalid Description" );
|
||||
if( iCalEvent.location != DEFAULT_LOCATION )
|
||||
alert( "TestFetchTodo(): Invalid Location" );
|
||||
if( iCalEvent.categories != DEFAULT_CATEGORY )
|
||||
alert( "TestFetchTodo(): Invalid Category" );
|
||||
if( iCalEvent.privateEvent != DEFAULT_PRIVATE )
|
||||
alert( "TestFetchTodo(): Invalid PrivateEvent Setting" );
|
||||
if( iCalEvent.allDay != DEFAULT_ALLDAY )
|
||||
alert( "TestFetchTodo(): Invalid AllDay Setting" );
|
||||
if( iCalEvent.alarm != DEFAULT_ALARM )
|
||||
alert( "TestFetchTodo(): Invalid Alarm Setting" );
|
||||
if( iCalEvent.alarmUnits != DEFAULT_ALARMUNITS )
|
||||
alert( "TestFetchTodo(): Invalid Alarm Units" );
|
||||
if( iCalEvent.alarmLength != DEFAULT_ALARMLENGTH )
|
||||
alert( "TestFetchTodo(): Invalid Alarm Length" );
|
||||
if( iCalEvent.alarmEmailAddress != DEFAULT_EMAIL )
|
||||
alert( "TestFetchTodo(): Invalid Alarm Email Address" );
|
||||
if( iCalEvent.inviteEmailAddress != DEFAULT_EMAIL )
|
||||
alert( "TestFetchTodo(): Invalid Invite Email Address" );
|
||||
if( iCalEvent.recur != DEFAULT_RECUR )
|
||||
alert( "TestFetchTodo(): Invalid Recur Setting" );
|
||||
if( iCalEvent.recurInterval != DEFAULT_RECURINTERVAL )
|
||||
alert( "TestFetchTodo(): Invalid Recur Interval" );
|
||||
if( iCalEvent.recurUnits != DEFAULT_RECURUNITS )
|
||||
alert( "TestFetchTodo(): Invalid Recur Units" );
|
||||
if( iCalEvent.recurForever != DEFAULT_RECURFOREVER )
|
||||
alert( "TestFetchTodo(): Invalid Recur Forever" );
|
||||
|
||||
//TODO: Check for start and end date
|
||||
|
||||
return iCalEvent;
|
||||
}
|
||||
|
||||
function TestUpdateTodo( iCalTodo )
|
||||
{
|
||||
iCalTodo.title = DEFAULT_TITLE+"*NEW*";
|
||||
iCalTodo.description = DEFAULT_DESCRIPTION+"*NEW*";
|
||||
iCalTodo.location = DEFAULT_LOCATION+"*NEW*";
|
||||
iCalTodo.categories = DEFAULT_CATEGORY+"*NEW*";
|
||||
iCalTodo.privateEvent = !DEFAULT_PRIVATE;
|
||||
iCalTodo.allDay = !DEFAULT_ALLDAY;
|
||||
iCalTodo.alarm = !DEFAULT_ALARM;
|
||||
|
||||
iCalTodo.recur = !DEFAULT_RECUR;
|
||||
|
||||
iCalTodo.start.year = 2002;
|
||||
iCalTodo.start.month = 0; //January
|
||||
iCalTodo.start.day = 2;
|
||||
iCalTodo.start.hour = 13;
|
||||
iCalTodo.start.minute = 25;
|
||||
|
||||
var id = iCalLib.modifyTodo( iCalTodo );
|
||||
|
||||
if( id == null )
|
||||
alert( "TestUpdateTodo(): Invalid Id" );
|
||||
if( iCalTodo.title != DEFAULT_TITLE+"*NEW*" )
|
||||
alert( "TestUpdateTodo(): Invalid Title" );
|
||||
if( iCalTodo.description != DEFAULT_DESCRIPTION+"*NEW*" )
|
||||
alert( "TestUpdateTodo(): Invalid Description" );
|
||||
if( iCalTodo.location != DEFAULT_LOCATION+"*NEW*" )
|
||||
alert( "TestUpdateTodo(): Invalid Location" );
|
||||
if( iCalTodo.categories != DEFAULT_CATEGORY+"*NEW*" )
|
||||
alert( "TestUpdateTodo(): Invalid Category" );
|
||||
if( iCalTodo.privateEvent != !DEFAULT_PRIVATE )
|
||||
alert( "TestUpdateTodo(): Invalid PrivateEvent Setting" );
|
||||
if( iCalTodo.allDay != !DEFAULT_ALLDAY )
|
||||
alert( "TestUpdateTodo(): Invalid AllDay Setting" );
|
||||
if( iCalTodo.alarm != !DEFAULT_ALARM )
|
||||
alert( "TestUpdateTodo(): Invalid Alarm Setting" );
|
||||
if( iCalTodo.recur != !DEFAULT_RECUR )
|
||||
alert( "TestUpdateTodo(): Invalid Recur Setting" );
|
||||
|
||||
//TODO check start and end dates
|
||||
|
||||
return id;
|
||||
}
|
||||
|
||||
function TestDeleteTodo( id )
|
||||
{
|
||||
iCalLib.deleteTodo( id );
|
||||
|
||||
var iCalEvent = iCalLib.fetchTodo( id );
|
||||
|
||||
if( iCalEvent != null )
|
||||
alert( "Delete failed" );
|
||||
}
|
||||
|
||||
function TestFilterTodo()
|
||||
{
|
||||
var iCalTodoComponent = Components.classes["@mozilla.org/icaltodo;1"].createInstance();
|
||||
|
||||
var iCalTodo = iCalTodoComponent.QueryInterface(Components.interfaces.oeIICalTodo);
|
||||
|
||||
iCalTodo.start.year = 2002;
|
||||
iCalTodo.start.month = 0;
|
||||
iCalTodo.start.day = 1;
|
||||
iCalTodo.start.hour = 0;
|
||||
iCalTodo.start.minute = 0;
|
||||
|
||||
iCalTodo.due.year = 2003;
|
||||
iCalTodo.due.month = 0;
|
||||
iCalTodo.due.day = 1;
|
||||
iCalTodo.due.hour = 0;
|
||||
iCalTodo.due.minute = 0;
|
||||
|
||||
var id = iCalLib.addTodo( iCalTodo );
|
||||
|
||||
var todoList = this.iCalLib.getAllTodos();
|
||||
|
||||
if ( !todoList.hasMoreElements() ) {
|
||||
alert( "TestFilterTodo-Step1: failed" );
|
||||
return;
|
||||
}
|
||||
|
||||
var now = Date();
|
||||
|
||||
iCalLib.filter.completed.setTime( now );
|
||||
|
||||
todoList = this.iCalLib.getAllTodos();
|
||||
|
||||
if ( !todoList.hasMoreElements() ) {
|
||||
alert( "TestFilterTodo-Step2: failed" );
|
||||
return;
|
||||
}
|
||||
|
||||
iCalTodo.completed.setTime( now );
|
||||
|
||||
now = Date();
|
||||
iCalLib.filter.completed.setTime( now );
|
||||
|
||||
todoList = this.iCalLib.getAllTodos();
|
||||
|
||||
if ( todoList.hasMoreElements() ) {
|
||||
alert( "TestFilterTodo-Step3: failed" );
|
||||
return;
|
||||
}
|
||||
|
||||
iCalTodo.completed.clear();
|
||||
|
||||
todoList = this.iCalLib.getAllTodos();
|
||||
|
||||
if ( !todoList.hasMoreElements() ) {
|
||||
alert( "TestFilterTodo-Step4: failed" );
|
||||
return;
|
||||
}
|
||||
|
||||
iCalLib.deleteTodo( id );
|
||||
}
|
||||
|
||||
function TestIcalString()
|
||||
{
|
||||
|
||||
var iCalEventComponent = Components.classes["@mozilla.org/icalevent;1"].createInstance();
|
||||
var iCalEvent = iCalEventComponent.QueryInterface(Components.interfaces.oeIICalEvent);
|
||||
|
||||
iCalEvent.id = 999999999;
|
||||
iCalEvent.title = DEFAULT_TITLE;
|
||||
iCalEvent.description = DEFAULT_DESCRIPTION;
|
||||
iCalEvent.location = DEFAULT_LOCATION;
|
||||
iCalEvent.categories = DEFAULT_CATEGORY;
|
||||
iCalEvent.privateEvent = DEFAULT_PRIVATE;
|
||||
iCalEvent.allDay = DEFAULT_ALLDAY;
|
||||
iCalEvent.alarm = DEFAULT_ALARM;
|
||||
iCalEvent.alarmUnits = DEFAULT_ALARMUNITS;
|
||||
iCalEvent.alarmLength = DEFAULT_ALARMLENGTH;
|
||||
iCalEvent.alarmEmailAddress = DEFAULT_EMAIL;
|
||||
iCalEvent.inviteEmailAddress = DEFAULT_EMAIL;
|
||||
|
||||
iCalEvent.recur = DEFAULT_RECUR;
|
||||
iCalEvent.recurInterval = DEFAULT_RECURINTERVAL;
|
||||
iCalEvent.recurUnits = DEFAULT_RECURUNITS;
|
||||
iCalEvent.recurForever = DEFAULT_RECURFOREVER;
|
||||
|
||||
iCalEvent.start.year = 2001;
|
||||
iCalEvent.start.month = 10; //November
|
||||
iCalEvent.start.day = 1;
|
||||
iCalEvent.start.hour = 12;
|
||||
iCalEvent.start.minute = 24;
|
||||
|
||||
iCalEvent.end.year = 2001;
|
||||
iCalEvent.end.month = 10; //November
|
||||
iCalEvent.end.day = 1;
|
||||
iCalEvent.end.hour = 13;
|
||||
iCalEvent.end.minute = 24;
|
||||
|
||||
var snoozetime = new Date();
|
||||
iCalEvent.setSnoozeTime( snoozetime );
|
||||
|
||||
var sCalenderData = iCalEvent.getIcalString();
|
||||
var iCalEventComponent = Components.classes["@mozilla.org/icalevent;1"].createInstance();
|
||||
var iCalParseEvent = iCalEventComponent.QueryInterface(Components.interfaces.oeIICalEvent);
|
||||
//alert(sCalenderData);
|
||||
iCalParseEvent.parseIcalString( sCalenderData );
|
||||
//alert("2" + iCalParseEvent.description);
|
||||
|
||||
if( iCalParseEvent.title != DEFAULT_TITLE )
|
||||
alert( "Invalid Title" );
|
||||
if( iCalParseEvent.description != DEFAULT_DESCRIPTION )
|
||||
alert( "Invalid Description" );
|
||||
if( iCalParseEvent.location != DEFAULT_LOCATION )
|
||||
alert( "Invalid Location" );
|
||||
if( iCalParseEvent.categories != DEFAULT_CATEGORY )
|
||||
alert( "Invalid Category" );
|
||||
if( iCalParseEvent.privateEvent != DEFAULT_PRIVATE )
|
||||
alert( "Invalid PrivateEvent Setting" );
|
||||
if( iCalParseEvent.allDay != DEFAULT_ALLDAY )
|
||||
alert( "Invalid AllDay Setting" );
|
||||
if( iCalParseEvent.alarm != DEFAULT_ALARM )
|
||||
alert( "Invalid Alarm Setting" );
|
||||
if( iCalParseEvent.alarmUnits != DEFAULT_ALARMUNITS )
|
||||
alert( "Invalid Alarm Units" );
|
||||
if( iCalParseEvent.alarmLength != DEFAULT_ALARMLENGTH )
|
||||
alert( "Invalid Alarm Length" );
|
||||
if( iCalParseEvent.alarmEmailAddress != DEFAULT_EMAIL )
|
||||
alert( "Invalid Alarm Email Address" );
|
||||
if( iCalParseEvent.inviteEmailAddress != DEFAULT_EMAIL )
|
||||
alert( "Invalid Invite Email Address" );
|
||||
if( iCalParseEvent.recur != DEFAULT_RECUR )
|
||||
alert( "Invalid Recur Setting" );
|
||||
if( iCalParseEvent.recurInterval != DEFAULT_RECURINTERVAL )
|
||||
alert( "Invalid Recur Interval" );
|
||||
if( iCalParseEvent.recurUnits != DEFAULT_RECURUNITS )
|
||||
alert( "Invalid Recur Units" );
|
||||
if( iCalParseEvent.recurForever != DEFAULT_RECURFOREVER )
|
||||
alert( "Invalid Recur Forever" );
|
||||
|
||||
var iCalTodoComponent = Components.classes["@mozilla.org/icaltodo;1"].createInstance();
|
||||
|
||||
var iCalTodo = iCalTodoComponent.QueryInterface(Components.interfaces.oeIICalTodo);
|
||||
|
||||
iCalTodo.title = DEFAULT_TITLE;
|
||||
iCalTodo.description = DEFAULT_DESCRIPTION;
|
||||
iCalTodo.location = DEFAULT_LOCATION;
|
||||
iCalTodo.categories = DEFAULT_CATEGORY;
|
||||
iCalTodo.privateEvent = DEFAULT_PRIVATE;
|
||||
|
||||
iCalTodo.start.year = 2001;
|
||||
iCalTodo.start.month = 10; //November
|
||||
iCalTodo.start.day = 1;
|
||||
iCalTodo.start.hour = 12;
|
||||
iCalTodo.start.minute = 24;
|
||||
|
||||
iCalTodo.due.year = 2001;
|
||||
iCalTodo.due.month = 11; //December
|
||||
iCalTodo.due.day = 1;
|
||||
iCalTodo.due.hour = 23;
|
||||
iCalTodo.due.minute = 59;
|
||||
|
||||
iCalTodo.id = 999999999;
|
||||
|
||||
var icalstring = iCalTodo.getTodoIcalString();
|
||||
iCalTodo.parseTodoIcalString( icalstring );
|
||||
|
||||
if( iCalTodo.id == null )
|
||||
alert( "TestAddTodo(): Invalid Id" );
|
||||
if( iCalTodo.title != DEFAULT_TITLE )
|
||||
alert( "TestAddTodo(): Invalid Title" );
|
||||
if( iCalTodo.description != DEFAULT_DESCRIPTION )
|
||||
alert( "TestAddTodo(): Invalid Description" );
|
||||
if( iCalTodo.location != DEFAULT_LOCATION )
|
||||
alert( "TestAddTodo(): Invalid Location" );
|
||||
if( iCalTodo.categories != DEFAULT_CATEGORY )
|
||||
alert( "TestAddTodo(): Invalid Category" );
|
||||
if( iCalTodo.privateEvent != DEFAULT_PRIVATE )
|
||||
alert( "TestAddTodo(): Invalid PrivateEvent Setting" );
|
||||
|
||||
//TODO: Check for start and end date
|
||||
|
||||
return true;
|
||||
}
|
|
@ -1,60 +0,0 @@
|
|||
<?xml version="1.0"?>
|
||||
<!-- ***** BEGIN LICENSE BLOCK *****
|
||||
- Version: MPL 1.1/GPL 2.0/LGPL 2.1
|
||||
-
|
||||
- The contents of this file are subject to the Mozilla Public License Version
|
||||
- 1.1 (the "License"); you may not use this file except in compliance with
|
||||
- the License. You may obtain a copy of the License at
|
||||
- http://www.mozilla.org/MPL/
|
||||
-
|
||||
- Software distributed under the License is distributed on an "AS IS" basis,
|
||||
- WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
|
||||
- for the specific language governing rights and limitations under the
|
||||
- License.
|
||||
-
|
||||
- The Original Code is OEone Calendar code, released October 31st, 2001.
|
||||
-
|
||||
- The Initial Developer of the Original Code is
|
||||
- OEone Corporation.
|
||||
- Portions created by OEone Corporation are Copyright (C) 2001
|
||||
- OEone Corporation. All Rights Reserved.
|
||||
-
|
||||
- Contributor(s): Mostafa Hosseini (mostafah@oeone.com)
|
||||
-
|
||||
- Alternatively, the contents of this file may be used under the terms of
|
||||
- either the GNU General Public License Version 2 or later (the "GPL"), or
|
||||
- the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
|
||||
- in which case the provisions of the GPL or the LGPL are applicable instead
|
||||
- of those above. If you wish to allow use of your version of this file only
|
||||
- under the terms of either the GPL or the LGPL, and not to allow others to
|
||||
- use your version of this file under the terms of the MPL, indicate your
|
||||
- decision by deleting the provisions above and replace them with the notice
|
||||
- and other provisions required by the LGPL or the GPL. If you do not delete
|
||||
- the provisions above, a recipient may use your version of this file under
|
||||
- the terms of any one of the MPL, the GPL or the LGPL.
|
||||
-
|
||||
-
|
||||
-->
|
||||
|
||||
<?xml-stylesheet href="chrome://global/skin/" type="text/css"?>
|
||||
<!DOCTYPE window>
|
||||
<window
|
||||
id="ICalendar"
|
||||
title="ICalendar"
|
||||
orient="vertical"
|
||||
xmlns:html="http://www.w3.org/1999/xhtml"
|
||||
xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul">
|
||||
|
||||
<script src="caltst.js"/>
|
||||
|
||||
<hbox>
|
||||
|
||||
<box align="left">
|
||||
<button label="Test Libical" onclick="Test();"/>
|
||||
<button label="Test XPIcal" onclick="TestAll();"/>
|
||||
</box>
|
||||
|
||||
<spacer flex="1"/>
|
||||
|
||||
</hbox>
|
||||
</window>
|
|
@ -1,274 +0,0 @@
|
|||
/*
|
||||
* Version: MPL 1.1/GPL 2.0/LGPL 2.1
|
||||
*
|
||||
* The contents of this file are subject to the Mozilla Public License Version
|
||||
* 1.1 (the "License"); you may not use this file except in compliance with
|
||||
* the License. You may obtain a copy of the License at
|
||||
* http://www.mozilla.org/MPL/
|
||||
*
|
||||
* Software distributed under the License is distributed on an "AS IS" basis,
|
||||
* WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
|
||||
* for the specific language governing rights and limitations under the
|
||||
* License.
|
||||
*
|
||||
* The Original Code is OEone Corporation.
|
||||
*
|
||||
* The Initial Developer of the Original Code is
|
||||
* OEone Corporation.
|
||||
* Portions created by OEone Corporation are Copyright (C) 2001
|
||||
* OEone Corporation. All Rights Reserved.
|
||||
*
|
||||
* Contributor(s): Mostafa Hosseini (mostafah@oeone.com)
|
||||
*
|
||||
* Alternatively, the contents of this file may be used under the terms of
|
||||
* either the GNU General Public License Version 2 or later (the "GPL"), or
|
||||
* the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
|
||||
* in which case the provisions of the GPL or the LGPL are applicable instead
|
||||
* of those above. If you wish to allow use of your version of this file only
|
||||
* under the terms of either the GPL or the LGPL, and not to allow others to
|
||||
* use your version of this file under the terms of the MPL, indicate your
|
||||
* decision by deleting the provisions above and replace them with the notice
|
||||
* and other provisions required by the GPL or the LGPL. If you do not delete
|
||||
* the provisions above, a recipient may use your version of this file under
|
||||
* the terms of any one of the MPL, the GPL or the LGPL.
|
||||
*
|
||||
*
|
||||
*/
|
||||
|
||||
/* This file implements a date-time XPCOM object used to pass date-time values between the frontend and the
|
||||
backend. It provides access to individual date-time fields from javascript and translates that data to a
|
||||
icaltimetype structure for the backend.*/
|
||||
|
||||
#ifndef WIN32
|
||||
#include <unistd.h>
|
||||
#endif
|
||||
|
||||
#include "oeDateTimeImpl.h"
|
||||
#include "nsMemory.h"
|
||||
#include "stdlib.h"
|
||||
|
||||
icaltimetype ConvertFromPrtime( PRTime indate );
|
||||
PRTime ConvertToPrtime ( icaltimetype indate );
|
||||
icaltimezone *currenttimezone = nsnull;
|
||||
|
||||
/* Implementation file */
|
||||
NS_IMPL_ISUPPORTS1(oeDateTimeImpl, oeIDateTime)
|
||||
|
||||
nsresult
|
||||
NS_NewDateTime( oeIDateTime** inst )
|
||||
{
|
||||
NS_PRECONDITION(inst != nsnull, "null ptr");
|
||||
if (! inst)
|
||||
return NS_ERROR_NULL_POINTER;
|
||||
|
||||
*inst = new oeDateTimeImpl();
|
||||
if (! *inst)
|
||||
return NS_ERROR_OUT_OF_MEMORY;
|
||||
|
||||
NS_ADDREF(*inst);
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
oeDateTimeImpl::oeDateTimeImpl()
|
||||
{
|
||||
/* member initializers and constructor code */
|
||||
m_datetime = icaltime_null_time();
|
||||
m_tzid = nsnull;
|
||||
}
|
||||
|
||||
oeDateTimeImpl::~oeDateTimeImpl()
|
||||
{
|
||||
if( m_tzid )
|
||||
nsMemory::Free( m_tzid );
|
||||
}
|
||||
|
||||
/* attribute short year; */
|
||||
NS_IMETHODIMP oeDateTimeImpl::GetYear(PRInt16 *retval)
|
||||
{
|
||||
*retval = m_datetime.year;
|
||||
return NS_OK;
|
||||
}
|
||||
NS_IMETHODIMP oeDateTimeImpl::SetYear(PRInt16 newval)
|
||||
{
|
||||
m_datetime.year = newval;
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
/* attribute short month; */
|
||||
NS_IMETHODIMP oeDateTimeImpl::GetMonth(PRInt16 *retval)
|
||||
{
|
||||
*retval = m_datetime.month - 1;
|
||||
return NS_OK;
|
||||
}
|
||||
NS_IMETHODIMP oeDateTimeImpl::SetMonth(PRInt16 newval)
|
||||
{
|
||||
m_datetime.month = newval + 1;
|
||||
if( m_datetime.month < 1 || m_datetime.month > 12 )
|
||||
m_datetime = icaltime_normalize( m_datetime );
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
/* attribute short day; */
|
||||
NS_IMETHODIMP oeDateTimeImpl::GetDay(PRInt16 *retval)
|
||||
{
|
||||
*retval = m_datetime.day;
|
||||
return NS_OK;
|
||||
}
|
||||
NS_IMETHODIMP oeDateTimeImpl::SetDay(PRInt16 newval)
|
||||
{
|
||||
m_datetime.day = newval;
|
||||
if( newval < 1 || newval > 31 )
|
||||
m_datetime = icaltime_normalize( m_datetime );
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
/* attribute short hour; */
|
||||
NS_IMETHODIMP oeDateTimeImpl::GetHour(PRInt16 *retval)
|
||||
{
|
||||
*retval = m_datetime.hour;
|
||||
return NS_OK;
|
||||
}
|
||||
NS_IMETHODIMP oeDateTimeImpl::SetHour(PRInt16 newval)
|
||||
{
|
||||
m_datetime.hour = newval;
|
||||
if( newval < 0 || newval > 23 )
|
||||
m_datetime = icaltime_normalize( m_datetime );
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
/* attribute short minute; */
|
||||
NS_IMETHODIMP oeDateTimeImpl::GetMinute(PRInt16 *retval)
|
||||
{
|
||||
*retval = m_datetime.minute;
|
||||
return NS_OK;
|
||||
}
|
||||
NS_IMETHODIMP oeDateTimeImpl::SetMinute(PRInt16 newval)
|
||||
{
|
||||
m_datetime.minute = newval;
|
||||
if( newval < 0 || newval > 59 )
|
||||
m_datetime = icaltime_normalize( m_datetime );
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP oeDateTimeImpl::GetTime(PRTime *retval)
|
||||
{
|
||||
*retval = ConvertToPrtime( m_datetime );
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP oeDateTimeImpl::ToString(char **retval)
|
||||
{
|
||||
char tmp[20];
|
||||
sprintf( tmp, "%04d/%02d/%02d %02d:%02d:%02d" , m_datetime.year, m_datetime.month, m_datetime.day, m_datetime.hour, m_datetime.minute, m_datetime.second );
|
||||
*retval= (char*) nsMemory::Clone( tmp, strlen(tmp)+1);
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP oeDateTimeImpl::SetTime( PRTime ms )
|
||||
{
|
||||
m_datetime = ConvertFromPrtime( ms );
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP oeDateTimeImpl::SetTimeInTimezone( PRTime ms, const char *tzid )
|
||||
{
|
||||
#ifdef ICAL_DEBUG_ALL
|
||||
printf( "SetTimeInTimezone( %s )\n", tzid );
|
||||
#endif
|
||||
if( m_tzid )
|
||||
nsMemory::Free( m_tzid );
|
||||
|
||||
if( tzid )
|
||||
m_tzid= (char*) nsMemory::Clone( tzid, strlen(tzid)+1);
|
||||
else
|
||||
m_tzid = nsnull;
|
||||
|
||||
icaltimetype newdatetime = ConvertFromPrtime( ms );
|
||||
|
||||
icaltimezone *from_zone = icaltimezone_get_builtin_timezone_from_tzid ( tzid );
|
||||
if( from_zone )
|
||||
icaltimezone_convert_time ( &newdatetime, from_zone, currenttimezone );
|
||||
else {
|
||||
if( m_tzid )
|
||||
nsMemory::Free( m_tzid );
|
||||
m_tzid = nsnull;
|
||||
}
|
||||
|
||||
m_datetime = newdatetime;
|
||||
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP oeDateTimeImpl::Clear()
|
||||
{
|
||||
m_datetime = icaltime_null_time();
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP oeDateTimeImpl::GetIsSet(PRBool *retval)
|
||||
{
|
||||
*retval = ! icaltime_is_null_time(m_datetime);
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP oeDateTimeImpl::GetUtc(PRBool *retval)
|
||||
{
|
||||
*retval = m_datetime.is_utc;
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP oeDateTimeImpl::SetUtc(PRBool newval)
|
||||
{
|
||||
m_datetime.is_utc = newval;
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
void oeDateTimeImpl::AdjustToWeekday( short weekday ) {
|
||||
short currentday = icaltime_day_of_week( m_datetime );
|
||||
while( currentday != weekday ) {
|
||||
m_datetime.day++;
|
||||
m_datetime = icaltime_normalize( m_datetime );
|
||||
currentday = icaltime_day_of_week( m_datetime );
|
||||
}
|
||||
}
|
||||
|
||||
/* readonly attribute string tzid; */
|
||||
NS_IMETHODIMP oeDateTimeImpl::GetTzID(char **aRetVal)
|
||||
{
|
||||
#ifdef ICAL_DEBUG_ALL
|
||||
printf( "GetTzID() = " );
|
||||
#endif
|
||||
if( m_tzid ) {
|
||||
*aRetVal= (char*) nsMemory::Clone( m_tzid, strlen(m_tzid)+1);
|
||||
if( *aRetVal == nsnull )
|
||||
return NS_ERROR_OUT_OF_MEMORY;
|
||||
} else
|
||||
*aRetVal= nsnull;
|
||||
#ifdef ICAL_DEBUG_ALL
|
||||
printf( "\"%s\"\n", *aRetVal );
|
||||
#endif
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
void oeDateTimeImpl::SetTzID(const char *aNewVal)
|
||||
{
|
||||
#ifdef ICAL_DEBUG_ALL
|
||||
printf( "SetTzID( %s )\n", aNewVal );
|
||||
#endif
|
||||
if( m_tzid )
|
||||
nsMemory::Free( m_tzid );
|
||||
|
||||
if( aNewVal )
|
||||
m_tzid= (char*) nsMemory::Clone( aNewVal, strlen(aNewVal)+1);
|
||||
else
|
||||
m_tzid = nsnull;
|
||||
}
|
||||
|
||||
int oeDateTimeImpl::CompareDate( oeDateTimeImpl *anotherdt ) {
|
||||
if( m_datetime.year == anotherdt->m_datetime.year &&
|
||||
m_datetime.month == anotherdt->m_datetime.month &&
|
||||
m_datetime.day == anotherdt->m_datetime.day )
|
||||
return 0;
|
||||
return 1;
|
||||
}
|
||||
|
|
@ -1,73 +0,0 @@
|
|||
/*
|
||||
* Version: MPL 1.1/GPL 2.0/LGPL 2.1
|
||||
*
|
||||
* The contents of this file are subject to the Mozilla Public License Version
|
||||
* 1.1 (the "License"); you may not use this file except in compliance with
|
||||
* the License. You may obtain a copy of the License at
|
||||
* http://www.mozilla.org/MPL/
|
||||
*
|
||||
* Software distributed under the License is distributed on an "AS IS" basis,
|
||||
* WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
|
||||
* for the specific language governing rights and limitations under the
|
||||
* License.
|
||||
*
|
||||
* The Original Code is OEone Corporation.
|
||||
*
|
||||
* The Initial Developer of the Original Code is
|
||||
* OEone Corporation.
|
||||
* Portions created by OEone Corporation are Copyright (C) 2001
|
||||
* OEone Corporation. All Rights Reserved.
|
||||
*
|
||||
* Contributor(s): Mostafa Hosseini (mostafah@oeone.com)
|
||||
*
|
||||
* Alternatively, the contents of this file may be used under the terms of
|
||||
* either the GNU General Public License Version 2 or later (the "GPL"), or
|
||||
* the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
|
||||
* in which case the provisions of the GPL or the LGPL are applicable instead
|
||||
* of those above. If you wish to allow use of your version of this file only
|
||||
* under the terms of either the GPL or the LGPL, and not to allow others to
|
||||
* use your version of this file under the terms of the MPL, indicate your
|
||||
* decision by deleting the provisions above and replace them with the notice
|
||||
* and other provisions required by the GPL or the LGPL. If you do not delete
|
||||
* the provisions above, a recipient may use your version of this file under
|
||||
* the terms of any one of the MPL, the GPL or the LGPL.
|
||||
*
|
||||
*
|
||||
*/
|
||||
|
||||
/* Header file for oeDateTimeImpl.cpp containing its CID and CONTRACTID.*/
|
||||
|
||||
#ifndef __OE_DATETIMEIMPL_H__
|
||||
#define __OE_DATETIMEIMPL_H__
|
||||
|
||||
#include "oeIICal.h"
|
||||
extern "C" {
|
||||
#include "ical.h"
|
||||
int icaltimezone_get_vtimezone_properties (icaltimezone *zone,
|
||||
icalcomponent *component);
|
||||
}
|
||||
|
||||
extern icaltimezone *currenttimezone;
|
||||
|
||||
#define OE_DATETIME_CID \
|
||||
{ 0x78b5b255, 0x7450, 0x47c0, { 0xba, 0x16, 0x0a, 0x6e, 0x7e, 0x80, 0x6e, 0x5d } }
|
||||
|
||||
#define OE_DATETIME_CONTRACTID "@mozilla.org/oedatetime;1"
|
||||
|
||||
class oeDateTimeImpl : public oeIDateTime
|
||||
{
|
||||
public:
|
||||
NS_DECL_ISUPPORTS
|
||||
NS_DECL_OEIDATETIME
|
||||
oeDateTimeImpl();
|
||||
virtual ~oeDateTimeImpl();
|
||||
void AdjustToWeekday( short weekday );
|
||||
int CompareDate( oeDateTimeImpl *anotherdt );
|
||||
void SetTzID(const char *aNewVal);
|
||||
/* additional members */
|
||||
struct icaltimetype m_datetime;
|
||||
private:
|
||||
char *m_tzid;
|
||||
};
|
||||
|
||||
#endif
|
Разница между файлами не показана из-за своего большого размера
Загрузить разницу
|
@ -1,126 +0,0 @@
|
|||
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN"
|
||||
"http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">
|
||||
|
||||
<!-- ***** BEGIN LICENSE BLOCK *****
|
||||
- Version: MPL 1.1/GPL 2.0/LGPL 2.1
|
||||
-
|
||||
- The contents of this file are subject to the Mozilla Public License Version
|
||||
- 1.1 (the "License"); you may not use this file except in compliance with
|
||||
- the License. You may obtain a copy of the License at
|
||||
- http://www.mozilla.org/MPL/
|
||||
-
|
||||
- Software distributed under the License is distributed on an "AS IS" basis,
|
||||
- WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
|
||||
- for the specific language governing rights and limitations under the
|
||||
- License.
|
||||
-
|
||||
- Contributor(s): Karl Guertin <grayrest@grayrest.com>
|
||||
- Henrik Gemal <mozilla@gemal.dk>
|
||||
- Daniel Veditz <dveditz@netscape.com>
|
||||
- Alexey Chernyak <alexeyc@bigfoot.com>
|
||||
- Chris Charabaruk <ccharabaruk@meldstar.com>
|
||||
-
|
||||
- Alternatively, the contents of this file may be used under the terms of
|
||||
- either the GNU General Public License Version 2 or later (the "GPL"), or
|
||||
- the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
|
||||
- in which case the provisions of the GPL or the LGPL are applicable instead
|
||||
- of those above. If you wish to allow use of your version of this file only
|
||||
- under the terms of either the GPL or the LGPL, and not to allow others to
|
||||
- use your version of this file under the terms of the MPL, indicate your
|
||||
- decision by deleting the provisions above and replace them with the notice
|
||||
- and other provisions required by the LGPL or the GPL. If you do not delete
|
||||
- the provisions above, a recipient may use your version of this file under
|
||||
- the terms of any one of the MPL, the GPL or the LGPL.
|
||||
-
|
||||
- ***** END LICENSE BLOCK ***** -->
|
||||
|
||||
<html>
|
||||
<head>
|
||||
<title>About:Calendar</title>
|
||||
<style type="text/css">
|
||||
table {
|
||||
margin: auto;
|
||||
text-align: center;
|
||||
}
|
||||
img {
|
||||
border: 0;
|
||||
}
|
||||
p {
|
||||
font-size: smaller;
|
||||
}
|
||||
h1 {
|
||||
margin: 0;
|
||||
}
|
||||
:link {
|
||||
color: #00e;
|
||||
}
|
||||
:visited {
|
||||
color: #551a8b;
|
||||
}
|
||||
:visited:active,
|
||||
:link:active {
|
||||
color: #f00;
|
||||
}
|
||||
</style>
|
||||
</head>
|
||||
<body>
|
||||
|
||||
<table>
|
||||
<tbody>
|
||||
<tr>
|
||||
|
||||
<td>
|
||||
<!--
|
||||
<a href="http://www.mozilla.org/">
|
||||
<img src="chrome://calendar/content/event.png" alt="Mozilla Calendar" width="200" height="200" />
|
||||
</a>
|
||||
-->
|
||||
</td>
|
||||
|
||||
<td id="mozver">
|
||||
<h1>
|
||||
<a id="mozlink" href="http://www.mozilla.org/projects/calendar/" target="_new">Mozilla Calendar 2004110405-cal</a>
|
||||
</h1>
|
||||
<script type="application/x-javascript">
|
||||
// using try..catch to handle empty useragents and other cases where the regex fails to apply
|
||||
try {
|
||||
document.getElementById("mozver").appendChild(document.createTextNode(navigator.userAgent));
|
||||
}
|
||||
catch (e) {}
|
||||
</script>
|
||||
</td>
|
||||
|
||||
</tr>
|
||||
</tbody>
|
||||
|
||||
</table>
|
||||
|
||||
<hr />
|
||||
|
||||
<ul>
|
||||
<li>Copyright © 1998-2002 by <a href="about:credits" target="_new">Contributors</a> to
|
||||
the Mozilla codebase under the <a href="about:license" target="_new">Mozilla
|
||||
Public License and Netscape Public License</a>. All Rights Reserved.</li>
|
||||
|
||||
<li>Portions of this software are copyright © 1994 The Regents of the
|
||||
University of California. All Rights Reserved.</li>
|
||||
<li>Portions of this software are copyright © 1997-1999
|
||||
<a href="http://www.support.com/" target="_new">Support.com, Inc. All Rights Reserved.</a></li>
|
||||
<li>Portions of this software are copyright © 2000-2002
|
||||
<a href="http://www.axentra.com/" target="_new">Axentra Corp. All Rights Reserved.</a></li>
|
||||
|
||||
</ul>
|
||||
|
||||
<p>
|
||||
U.S. GOVERNMENT END USERS. The Software is a "commercial
|
||||
item," as that term is defined in 48 C.F.R. 2.101 (Oct. 1995), consisting
|
||||
of "commercial computer software" and "commercial computer software
|
||||
documentation," as such terms are used in 48 C.F.R. 12.212 (Sept. 1995).
|
||||
Consistent with 48 C.F.R. 12.212 and 48 C.F.R. 227.7202-1 through 227.7202-4
|
||||
(June 1995), all U.S. Government End Users acquire the Software with only
|
||||
those rights set forth herein.
|
||||
|
||||
</p>
|
||||
|
||||
</body>
|
||||
</html>
|
|
@ -1,22 +1,40 @@
|
|||
/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*-
|
||||
* The contents of this file are subject to the Netscape Public
|
||||
* License Version 1.1 (the "License"); you may not use this file
|
||||
* except in compliance with the License. You may obtain a copy of
|
||||
* the License at http://www.mozilla.org/NPL/
|
||||
* ***** BEGIN LICENSE BLOCK *****
|
||||
* Version: MPL 1.1/GPL 2.0/LGPL 2.1
|
||||
*
|
||||
* Software distributed under the License is distributed on an "AS
|
||||
* IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
|
||||
* implied. See the License for the specific language governing
|
||||
* rights and limitations under the License.
|
||||
* The contents of this file are subject to the Mozilla Public License Version
|
||||
* 1.1 (the "License"); you may not use this file except in compliance with
|
||||
* the License. You may obtain a copy of the License at
|
||||
* http://www.mozilla.org/MPL/
|
||||
*
|
||||
* Software distributed under the License is distributed on an "AS IS" basis,
|
||||
* WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
|
||||
* for the specific language governing rights and limitations under the
|
||||
* License.
|
||||
*
|
||||
* The Original Code is Mozilla Communicator client code, released
|
||||
* March 31, 1998.
|
||||
*
|
||||
* The Initial Developer of the Original Code is Netscape
|
||||
* Communications Corporation. Portions created by Netscape are
|
||||
* Copyright (C) 1998-1999 Netscape Communications Corporation. All
|
||||
* Rights Reserved.
|
||||
*/
|
||||
* The Initial Developer of the Original Code is
|
||||
* Netscape Communications Corporation.
|
||||
* Portions created by the Initial Developer are Copyright (C) 1998-1999
|
||||
* the Initial Developer. All Rights Reserved.
|
||||
*
|
||||
* Contributor(s):
|
||||
*
|
||||
* Alternatively, the contents of this file may be used under the terms of
|
||||
* either the GNU General Public License Version 2 or later (the "GPL"), or
|
||||
* the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
|
||||
* in which case the provisions of the GPL or the LGPL are applicable instead
|
||||
* of those above. If you wish to allow use of your version of this file only
|
||||
* under the terms of either the GPL or the LGPL, and not to allow others to
|
||||
* use your version of this file under the terms of the MPL, indicate your
|
||||
* decision by deleting the provisions above and replace them with the notice
|
||||
* and other provisions required by the GPL or the LGPL. If you do not delete
|
||||
* the provisions above, a recipient may use your version of this file under
|
||||
* the terms of any one of the MPL, the GPL or the LGPL.
|
||||
*
|
||||
* ***** END LICENSE BLOCK ***** */
|
||||
|
||||
/**
|
||||
* In order to distinguish clearly globals that are initialized once when js load (static globals) and those that need to be
|
||||
|
|
|
@ -1,28 +0,0 @@
|
|||
/*
|
||||
* ***** BEGIN LICENSE BLOCK *****
|
||||
* Software distributed under the License is distributed on an "AS IS" basis,
|
||||
* WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
|
||||
* for the specific language governing rights and limitations under the
|
||||
* License.
|
||||
*
|
||||
* The Original Code is Mozilla Calendar Code.
|
||||
*
|
||||
* The Initial Developer of the Original Code is
|
||||
* Mozilla.org.
|
||||
* Portions created by the Initial Developer are Copyright (C) 1999-2002
|
||||
* the Initial Developer. All Rights Reserved.
|
||||
*
|
||||
* Contributor(s): Eric Belhaire (belhaire@ief.u-psud.fr)
|
||||
*
|
||||
* ***** END LICENSE BLOCK *****
|
||||
*/
|
||||
|
||||
|
||||
//Used by Mozilla Firebird
|
||||
function openCalendarInFirebird()
|
||||
{
|
||||
//window.openDialog("chrome://calendar/content", "_blank", "chrome,all,dialog=no");
|
||||
calendarWindow = window.open("chrome://calendar/content/calendar.xul", "calendar", "chrome,extrachrome,menubar,resizable,scrollbars,status,toolbar");
|
||||
//openCalendar();
|
||||
}
|
||||
|
|
@ -1,23 +1,40 @@
|
|||
<?xml version="1.0"?>
|
||||
<!--
|
||||
The contents of this file are subject to the Netscape Public
|
||||
License Version 1.1 (the "License"); you may not use this file
|
||||
except in compliance with the License. You may obtain a copy of
|
||||
the License at http://www.mozilla.org/NPL/
|
||||
<!-- ***** BEGIN LICENSE BLOCK *****
|
||||
Version: MPL 1.1/GPL 2.0/LGPL 2.1
|
||||
|
||||
Software distributed under the License is distributed on an "AS
|
||||
IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
|
||||
implied. See the License for the specific language governing
|
||||
rights and limitations under the License.
|
||||
The contents of this file are subject to the Mozilla Public License Version
|
||||
1.1 (the "License"); you may not use this file except in compliance with
|
||||
the License. You may obtain a copy of the License at
|
||||
http://www.mozilla.org/MPL/
|
||||
|
||||
The Original Code is Mozilla Communicator client code, released
|
||||
March 31, 1998.
|
||||
Software distributed under the License is distributed on an "AS IS" basis,
|
||||
WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
|
||||
for the specific language governing rights and limitations under the
|
||||
License.
|
||||
|
||||
The Initial Developer of the Original Code is Netscape
|
||||
Communications Corporation. Portions created by Netscape are
|
||||
Copyright (C) 1998-1999 Netscape Communications Corporation. All
|
||||
Rights Reserved.
|
||||
-->
|
||||
The Original Code is Mozilla Communicator client code, released
|
||||
March 31, 1998.
|
||||
|
||||
The Initial Developer of the Original Code is
|
||||
Netscape Communications Corporation.
|
||||
Portions created by the Initial Developer are Copyright (C) 1998-1999
|
||||
the Initial Developer. All Rights Reserved.
|
||||
|
||||
Contributor(s):
|
||||
|
||||
Alternatively, the contents of this file may be used under the terms of
|
||||
either the GNU General Public License Version 2 or later (the "GPL"), or
|
||||
the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
|
||||
in which case the provisions of the GPL or the LGPL are applicable instead
|
||||
of those above. If you wish to allow use of your version of this file only
|
||||
under the terms of either the GPL or the LGPL, and not to allow others to
|
||||
use your version of this file under the terms of the MPL, indicate your
|
||||
decision by deleting the provisions above and replace them with the notice
|
||||
and other provisions required by the GPL or the LGPL. If you do not delete
|
||||
the provisions above, a recipient may use your version of this file under
|
||||
the terms of any one of the MPL, the GPL or the LGPL.
|
||||
|
||||
***** END LICENSE BLOCK ***** -->
|
||||
|
||||
<?xml-stylesheet href="chrome://global/skin/global.css" type="text/css"?>
|
||||
<?xml-stylesheet href="chrome://calendar/skin/calendar.css" type="text/css"?>
|
||||
|
|
|
@ -1,46 +1,46 @@
|
|||
<?xml version="1.0"?>
|
||||
<!-- ***** BEGIN LICENSE BLOCK *****
|
||||
- Version: MPL 1.1/GPL 2.0/LGPL 2.1
|
||||
-
|
||||
- The contents of this file are subject to the Mozilla Public License Version
|
||||
- 1.1 (the "License"); you may not use this file except in compliance with
|
||||
- the License. You may obtain a copy of the License at
|
||||
- http://www.mozilla.org/MPL/
|
||||
-
|
||||
- Software distributed under the License is distributed on an "AS IS" basis,
|
||||
- WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
|
||||
- for the specific language governing rights and limitations under the
|
||||
- License.
|
||||
-
|
||||
- The Original Code is OEone Calendar Code, released October 31st, 2001.
|
||||
-
|
||||
- The Initial Developer of the Original Code is
|
||||
- OEone Corporation.
|
||||
- Portions created by the Initial Developer are Copyright (C) 2001
|
||||
- the Initial Developer. All Rights Reserved.
|
||||
-
|
||||
- Contributor(s): Garth Smedley <garths@oeone.com>
|
||||
- Mike Potter <mikep@oeone.com>
|
||||
- Colin Phillips <colinp@oeone.com>
|
||||
- Chris Charabaruk <coldacid@djfly.org>
|
||||
- Karl Guertin <grayrest@grayrest.com>
|
||||
- Dan Parent <danp@oeone.com>
|
||||
- ArentJan Banck <ajbanck@planet.nl>
|
||||
- Eric Belhaire <belhaire@ief.u-psud.fr>
|
||||
-
|
||||
- Alternatively, the contents of this file may be used under the terms of
|
||||
- either the GNU General Public License Version 2 or later (the "GPL"), or
|
||||
- the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
|
||||
- in which case the provisions of the GPL or the LGPL are applicable instead
|
||||
- of those above. If you wish to allow use of your version of this file only
|
||||
- under the terms of either the GPL or the LGPL, and not to allow others to
|
||||
- use your version of this file under the terms of the MPL, indicate your
|
||||
- decision by deleting the provisions above and replace them with the notice
|
||||
- and other provisions required by the LGPL or the GPL. If you do not delete
|
||||
- the provisions above, a recipient may use your version of this file under
|
||||
- the terms of any one of the MPL, the GPL or the LGPL.
|
||||
-
|
||||
- ***** END LICENSE BLOCK ***** -->
|
||||
- Version: MPL 1.1/GPL 2.0/LGPL 2.1
|
||||
-
|
||||
- The contents of this file are subject to the Mozilla Public License Version
|
||||
- 1.1 (the "License"); you may not use this file except in compliance with
|
||||
- the License. You may obtain a copy of the License at
|
||||
- http://www.mozilla.org/MPL/
|
||||
-
|
||||
- Software distributed under the License is distributed on an "AS IS" basis,
|
||||
- WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
|
||||
- for the specific language governing rights and limitations under the
|
||||
- License.
|
||||
-
|
||||
- The Original Code is OEone Calendar Code, released October 31st, 2001.
|
||||
-
|
||||
- The Initial Developer of the Original Code is
|
||||
- OEone Corporation.
|
||||
- Portions created by the Initial Developer are Copyright (C) 2001
|
||||
- the Initial Developer. All Rights Reserved.
|
||||
-
|
||||
- Contributor(s): Garth Smedley <garths@oeone.com>
|
||||
- Mike Potter <mikep@oeone.com>
|
||||
- Colin Phillips <colinp@oeone.com>
|
||||
- Chris Charabaruk <coldacid@djfly.org>
|
||||
- Karl Guertin <grayrest@grayrest.com>
|
||||
- Dan Parent <danp@oeone.com>
|
||||
- ArentJan Banck <ajbanck@planet.nl>
|
||||
- Eric Belhaire <belhaire@ief.u-psud.fr>
|
||||
-
|
||||
- Alternatively, the contents of this file may be used under the terms of
|
||||
- either the GNU General Public License Version 2 or later (the "GPL"), or
|
||||
- the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
|
||||
- in which case the provisions of the GPL or the LGPL are applicable instead
|
||||
- of those above. If you wish to allow use of your version of this file only
|
||||
- under the terms of either the GPL or the LGPL, and not to allow others to
|
||||
- use your version of this file under the terms of the MPL, indicate your
|
||||
- decision by deleting the provisions above and replace them with the notice
|
||||
- and other provisions required by the LGPL or the GPL. If you do not delete
|
||||
- the provisions above, a recipient may use your version of this file under
|
||||
- the terms of any one of the MPL, the GPL or the LGPL.
|
||||
-
|
||||
- ***** END LICENSE BLOCK ***** -->
|
||||
|
||||
<!-- Style sheets -->
|
||||
|
||||
|
|
|
@ -1,25 +1,41 @@
|
|||
/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*-
|
||||
* The contents of this file are subject to the Mozilla Public
|
||||
* License Version 1.1 (the "License"); you may not use this file
|
||||
* except in compliance with the License. You may obtain a copy of
|
||||
* the License at http://www.mozilla.org/MPL/
|
||||
* ***** BEGIN LICENSE BLOCK *****
|
||||
* Version: MPL 1.1/GPL 2.0/LGPL 2.1
|
||||
*
|
||||
* Software distributed under the License is distributed on an "AS
|
||||
* IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
|
||||
* implied. See the License for the specific language governing
|
||||
* rights and limitations under the License.
|
||||
* The contents of this file are subject to the Mozilla Public License Version
|
||||
* 1.1 (the "License"); you may not use this file except in compliance with
|
||||
* the License. You may obtain a copy of the License at
|
||||
* http://www.mozilla.org/MPL/
|
||||
*
|
||||
* Software distributed under the License is distributed on an "AS IS" basis,
|
||||
* WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
|
||||
* for the specific language governing rights and limitations under the
|
||||
* License.
|
||||
*
|
||||
* The Original Code is mozilla.org code.
|
||||
*
|
||||
* The Initial Developer of the Original Code is Netscape
|
||||
* Communications Corporation. Portions created by Netscape are
|
||||
* Copyright (C) 1999 Netscape Communications Corporation. All
|
||||
* Rights Reserved.
|
||||
* The Initial Developer of the Original Code is
|
||||
* Netscape Communications Corporation.
|
||||
* Portions created by the Initial Developer are Copyright (C) 1999
|
||||
* the Initial Developer. All Rights Reserved.
|
||||
*
|
||||
* Contributor(s):
|
||||
* Seth Spitzer <sspitzer@netscape.com>
|
||||
* Robert Ginda <rginda@netscape.com>
|
||||
*/
|
||||
* Seth Spitzer <sspitzer@netscape.com>
|
||||
* Robert Ginda <rginda@netscape.com>
|
||||
*
|
||||
* Alternatively, the contents of this file may be used under the terms of
|
||||
* either the GNU General Public License Version 2 or later (the "GPL"), or
|
||||
* the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
|
||||
* in which case the provisions of the GPL or the LGPL are applicable instead
|
||||
* of those above. If you wish to allow use of your version of this file only
|
||||
* under the terms of either the GPL or the LGPL, and not to allow others to
|
||||
* use your version of this file under the terms of the MPL, indicate your
|
||||
* decision by deleting the provisions above and replace them with the notice
|
||||
* and other provisions required by the GPL or the LGPL. If you do not delete
|
||||
* the provisions above, a recipient may use your version of this file under
|
||||
* the terms of any one of the MPL, the GPL or the LGPL.
|
||||
*
|
||||
* ***** END LICENSE BLOCK ***** */
|
||||
|
||||
/*
|
||||
* This file contains the following calendar related components:
|
||||
|
|
|
@ -1,43 +1,44 @@
|
|||
<?xml version="1.0"?>
|
||||
|
||||
<!--
|
||||
/* ***** BEGIN LICENSE BLOCK *****
|
||||
* Version: MPL 1.1/GPL 2.0/LGPL 2.1
|
||||
*
|
||||
* The contents of this file are subject to the Mozilla Public License Version
|
||||
* 1.1 (the "License"); you may not use this file except in compliance with
|
||||
* the License. You may obtain a copy of the License at
|
||||
* http://www.mozilla.org/MPL/
|
||||
*
|
||||
* Software distributed under the License is distributed on an "AS IS" basis,
|
||||
* WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
|
||||
* for the specific language governing rights and limitations under the
|
||||
* License.
|
||||
*
|
||||
* The Original Code is OEone Calendar Code, released October 31st, 2001.
|
||||
*
|
||||
* The Initial Developer of the Original Code is
|
||||
* OEone Corporation.
|
||||
* Portions created by the Initial Developer are Copyright (C) 2001
|
||||
* the Initial Developer. All Rights Reserved.
|
||||
*
|
||||
* Contributor(s): Garth Smedley <garths@oeone.com>
|
||||
* Mike Potter <mikep@oeone.com>
|
||||
*
|
||||
* Alternatively, the contents of this file may be used under the terms of
|
||||
* either the GNU General Public License Version 2 or later (the "GPL"), or
|
||||
* the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
|
||||
* in which case the provisions of the GPL or the LGPL are applicable instead
|
||||
* of those above. If you wish to allow use of your version of this file only
|
||||
* under the terms of either the GPL or the LGPL, and not to allow others to
|
||||
* use your version of this file under the terms of the MPL, indicate your
|
||||
* decision by deleting the provisions above and replace them with the notice
|
||||
* and other provisions required by the GPL or the LGPL. If you do not delete
|
||||
* the provisions above, a recipient may use your version of this file under
|
||||
* the terms of any one of the MPL, the GPL or the LGPL.
|
||||
*
|
||||
* ***** END LICENSE BLOCK ***** */
|
||||
<!-- ***** BEGIN LICENSE BLOCK *****
|
||||
- Version: MPL 1.1/GPL 2.0/LGPL 2.1
|
||||
-
|
||||
- The contents of this file are subject to the Mozilla Public License Version
|
||||
- 1.1 (the "License"); you may not use this file except in compliance with
|
||||
- the License. You may obtain a copy of the License at
|
||||
- http://www.mozilla.org/MPL/
|
||||
-
|
||||
- Software distributed under the License is distributed on an "AS IS" basis,
|
||||
- WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
|
||||
- for the specific language governing rights and limitations under the
|
||||
- License.
|
||||
-
|
||||
- The Original Code is OEone Calendar Code, released October 31st, 2001.
|
||||
-
|
||||
- The Initial Developer of the Original Code is
|
||||
- OEone Corporation.
|
||||
- Portions created by the Initial Developer are Copyright (C) 2001
|
||||
- the Initial Developer. All Rights Reserved.
|
||||
-
|
||||
- Contributor(s):
|
||||
- Garth Smedley <garths@oeone.com>
|
||||
- Mike Potter <mikep@oeone.com>
|
||||
-
|
||||
- Alternatively, the contents of this file may be used under the terms of
|
||||
- either the GNU General Public License Version 2 or later (the "GPL"), or
|
||||
- the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
|
||||
- in which case the provisions of the GPL or the LGPL are applicable instead
|
||||
- of those above. If you wish to allow use of your version of this file only
|
||||
- under the terms of either the GPL or the LGPL, and not to allow others to
|
||||
- use your version of this file under the terms of the MPL, indicate your
|
||||
- decision by deleting the provisions above and replace them with the notice
|
||||
- and other provisions required by the LGPL or the GPL. If you do not delete
|
||||
- the provisions above, a recipient may use your version of this file under
|
||||
- the terms of any one of the MPL, the GPL or the LGPL.
|
||||
-
|
||||
- ***** END LICENSE BLOCK ***** -->
|
||||
|
||||
<!--
|
||||
/* DatePicker: text box + grid button XBL component.
|
||||
Editing text box sets date if parseable as date using current
|
||||
numerical short date format (in operating system).
|
||||
|
|
|
@ -1,197 +0,0 @@
|
|||
<?xml version="1.0"?>
|
||||
|
||||
<!--
|
||||
/* ***** BEGIN LICENSE BLOCK *****
|
||||
* Version: MPL 1.1/GPL 2.0/LGPL 2.1
|
||||
*
|
||||
* The contents of this file are subject to the Mozilla Public License Version
|
||||
* 1.1 (the "License"); you may not use this file except in compliance with
|
||||
* the License. You may obtain a copy of the License at
|
||||
* http://www.mozilla.org/MPL/
|
||||
*
|
||||
* Software distributed under the License is distributed on an "AS IS" basis,
|
||||
* WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
|
||||
* for the specific language governing rights and limitations under the
|
||||
* License.
|
||||
*
|
||||
* The Original Code is OEone Calendar Code, released October 31st, 2001.
|
||||
*
|
||||
* The Initial Developer of the Original Code is
|
||||
* OEone Corporation.
|
||||
* Portions created by the Initial Developer are Copyright (C) 2001
|
||||
* the Initial Developer. All Rights Reserved.
|
||||
*
|
||||
* Contributor(s): Garth Smedley <garths@oeone.com>
|
||||
* Mike Potter <mikep@oeone.com>
|
||||
*
|
||||
* Alternatively, the contents of this file may be used under the terms of
|
||||
* either the GNU General Public License Version 2 or later (the "GPL"), or
|
||||
* the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
|
||||
* in which case the provisions of the GPL or the LGPL are applicable instead
|
||||
* of those above. If you wish to allow use of your version of this file only
|
||||
* under the terms of either the GPL or the LGPL, and not to allow others to
|
||||
* use your version of this file under the terms of the MPL, indicate your
|
||||
* decision by deleting the provisions above and replace them with the notice
|
||||
* and other provisions required by the GPL or the LGPL. If you do not delete
|
||||
* the provisions above, a recipient may use your version of this file under
|
||||
* the terms of any one of the MPL, the GPL or the LGPL.
|
||||
*
|
||||
* ***** END LICENSE BLOCK ***** */
|
||||
|
||||
/* DateTimePicker: datepicker + timepicker (+ timezone in future)
|
||||
|
||||
Used in calendar/content/eventDialog.xul
|
||||
|
||||
Requires:
|
||||
<?xml-stylesheet
|
||||
href="chrome://calendar/content/datetimepickers/datetimepicker.css" ?>
|
||||
May require (probably until bug 58757 fixed):
|
||||
<script type="application/x-javascript"
|
||||
src="chrome://global/content/strres.js" />
|
||||
<script type="application/x-javascript"
|
||||
src="chrome://calendar/content/dateUtils.js"/>
|
||||
|
||||
At site, can provide id, and code to run when changed by picker.
|
||||
<datetimepicker id="my-picker" onchange="myOnPick(this);"
|
||||
disabled="false" datepickerdisabled="false" timepickerdisabled="false"/>
|
||||
|
||||
May get/set value with
|
||||
document.getElementById("my-picker").value = new Date();
|
||||
May disable/enable from javascript with
|
||||
document.getElementById("my-picker").disabled = true;
|
||||
May also dis/enable datepicker and timepicker individually with
|
||||
document.getElementById("my-picker").datepickerdisabled = true;
|
||||
document.getElementById("my-picker").timepickerdisabled = true;
|
||||
*/
|
||||
-->
|
||||
|
||||
<!-- -->
|
||||
<bindings id="xulDateTimePicker"
|
||||
xmlns="http://www.mozilla.org/xbl"
|
||||
xmlns:xbl="http://www.mozilla.org/xbl"
|
||||
xmlns:html="http://www.w3.org/TR/REC-html40"
|
||||
xmlns:xul="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul">
|
||||
|
||||
<binding id="datetimepicker" extends="xul:box"
|
||||
inherits="value,onchange,disabled,datepickerdisabled,timepickerdisabled">
|
||||
<!-- ::::::::::::::::: CONTENT ::::::::::::::::::::::::: -->
|
||||
<!-- onchange was simply "onDatePick()" in Moz1.6, but stopped working in Moz1.7
|
||||
so had to add navigation by parents. -->
|
||||
<content id="content">
|
||||
<xul:hbox flex="1" id="hbox">
|
||||
<datepicker id="date-picker" onchange="this.parentNode.parentNode.onDatePick();"
|
||||
xbl:inherits="value,disabled,disabled=datepickerdisabled" />
|
||||
<timepicker id="time-picker" onchange="this.parentNode.parentNode.onTimePick();"
|
||||
xbl:inherits="value,disabled,disabled=timepickerdisabled" />
|
||||
<!-- timezonepicker -->
|
||||
</xul:hbox>
|
||||
</content>
|
||||
|
||||
<!-- ::::::::::::::::: INTERFACE ::::::::::::::::::::::::: -->
|
||||
<implementation>
|
||||
<property name="value"
|
||||
onset="this.update(val,false)"
|
||||
onget="return this.mValue"/>
|
||||
|
||||
<property name="disabled"
|
||||
onget="return this.mDisabled;"
|
||||
onset="this.setDisabled( val );" />
|
||||
|
||||
<property name="datepickerdisabled"
|
||||
onget="return this.kDatePicker.disabled;"
|
||||
onset="this.kDatePicker.disabled = val;" />
|
||||
|
||||
<!-- timepicker may be disabled alone for all day events -->
|
||||
<property name="timepickerdisabled"
|
||||
onget="return this.kTimePicker.disabled;"
|
||||
onset="this.kTimePicker.disabled = val;" />
|
||||
|
||||
<constructor><![CDATA[
|
||||
//java.lang.System.err.println(">>datetime()");
|
||||
this.kDatePicker =
|
||||
document.getAnonymousElementByAttribute(this, "id", "date-picker");
|
||||
this.kTimePicker =
|
||||
document.getAnonymousElementByAttribute(this, "id", "time-picker");
|
||||
|
||||
// init this.mValue:
|
||||
var val = this.getAttribute("value");
|
||||
this.mValue = (val ? new Date(val)
|
||||
: new Date());
|
||||
|
||||
// Make the function a member of the picker
|
||||
// so that 'this' will be the picker
|
||||
val = this.getAttribute("onchange");
|
||||
if (val) this.kCallback = function(){ eval( val ) };
|
||||
//java.lang.System.err.println("<<datetime()"+this.mValue);
|
||||
]]></constructor>
|
||||
|
||||
<!-- update values. If aRefresh is true, call user's onchange.
|
||||
(aRefresh is false if externally set from user program,
|
||||
aRefresh is true if internally updated from gui.) -->
|
||||
<method name="update">
|
||||
<parameter name="aValue"/>
|
||||
<parameter name="aRefresh"/>
|
||||
<body><![CDATA[
|
||||
if (aValue != null) {
|
||||
this.mValue = aValue;
|
||||
}
|
||||
// set textBox.value property, not attribute
|
||||
this.kDatePicker.value = this.mValue;
|
||||
this.kTimePicker.value = this.mValue;
|
||||
|
||||
if (aValue != null && this.kCallback && aRefresh != false) {
|
||||
this.kCallback();
|
||||
}
|
||||
]]></body>
|
||||
</method>
|
||||
|
||||
<!-- Date was changed by gui: update value. -->
|
||||
<method name="onDatePick">
|
||||
<body><![CDATA[
|
||||
var oldTime = new Date(this.mValue);
|
||||
var newDate = new Date(this.kDatePicker.value);
|
||||
// Note: create new date because setting month and date of month in
|
||||
// either order can lead to unexpected results (month may be advanced
|
||||
// automatically if day of month is temporarily out of range).
|
||||
var dateTime = new Date(newDate.getFullYear(),
|
||||
newDate.getMonth(),
|
||||
newDate.getDate(),
|
||||
oldTime.getHours(),
|
||||
oldTime.getMinutes(),
|
||||
oldTime.getSeconds());
|
||||
this.update(dateTime, true);
|
||||
]]></body>
|
||||
</method>
|
||||
|
||||
<!-- Time was changed by gui: update value -->
|
||||
<method name="onTimePick">
|
||||
<body><![CDATA[
|
||||
var dateTime = new Date(this.mValue);
|
||||
var newTime = this.kTimePicker.value;
|
||||
dateTime.setHours(newTime.getHours());
|
||||
dateTime.setMinutes(newTime.getMinutes());
|
||||
dateTime.setSeconds(newTime.getSeconds());
|
||||
this.update(dateTime, true);
|
||||
]]></body>
|
||||
</method>
|
||||
|
||||
<!-- Propagate aDisabled to datepicker and timepicker -->
|
||||
<method name="setDisabled">
|
||||
<parameter name="aDisabled" />
|
||||
<body><![CDATA[
|
||||
this.mDisabled = aDisabled;
|
||||
this.kDatePicker.disabled = aDisabled;
|
||||
this.kTimePicker.disabled = aDisabled;
|
||||
]]></body>
|
||||
</method>
|
||||
|
||||
</implementation>
|
||||
|
||||
<!-- ::::::::::::::::: HANDLERS ::::::::::::::::::::::::: -->
|
||||
|
||||
<handlers>
|
||||
<handler event="bindingattached" action="this.initialize();"/>
|
||||
</handlers>
|
||||
|
||||
</binding>
|
||||
</bindings>
|
Разница между файлами не показана из-за своего большого размера
Загрузить разницу
|
@ -1,231 +0,0 @@
|
|||
/*** -*- Mode: Javascript; tab-width: 2;
|
||||
|
||||
The contents of this file are subject to the Mozilla Public
|
||||
License Version 1.1 (the "License"); you may not use this file
|
||||
except in compliance with the License. You may obtain a copy of
|
||||
the License at http://www.mozilla.org/MPL/
|
||||
|
||||
Software distributed under the License is distributed on an "AS
|
||||
IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
|
||||
implied. See the License for the specific language governing
|
||||
rights and limitations under the License.
|
||||
|
||||
The Original Code is Collabnet code.
|
||||
The Initial Developer of the Original Code is Collabnet.
|
||||
|
||||
Portions created by Collabnet are Copyright (C) 2000 Collabnet.
|
||||
All Rights Reserved.
|
||||
|
||||
Contributor(s): Pete Collins, Doug Turner, Brendan Eich, Warren Harris,
|
||||
Eric Plaster, Martin Kutschker
|
||||
|
||||
|
||||
JS Directory Class API
|
||||
|
||||
dir.js
|
||||
|
||||
Function List
|
||||
|
||||
create(aPermissions); // permissions are optional
|
||||
|
||||
files(); // returns an array listing all files of a dirs contents
|
||||
dirs(); // returns an array listing all dirs of a dirs contents
|
||||
list(aDirPath); // returns an array listing of a dirs contents
|
||||
|
||||
// help!
|
||||
help(); // currently dumps a list of available functions
|
||||
|
||||
Instructions:
|
||||
|
||||
|
||||
*/
|
||||
|
||||
if (typeof(JS_LIB_LOADED)=='boolean') {
|
||||
|
||||
/************* INCLUDE FILESYSTEM *****************/
|
||||
if(typeof(JS_FILESYSTEM_LOADED)!='boolean')
|
||||
include(jslib_filesystem);
|
||||
/************* INCLUDE FILESYSTEM *****************/
|
||||
|
||||
|
||||
/****************** Globals **********************/
|
||||
const JS_DIR_FILE = "dir.js";
|
||||
const JS_DIR_LOADED = true;
|
||||
|
||||
const JS_DIR_LOCAL_CID = "@mozilla.org/file/local;1";
|
||||
const JS_DIR_LOCATOR_PROGID = '@mozilla.org/filelocator;1';
|
||||
const JS_DIR_CID = "@mozilla.org/file/directory_service;1";
|
||||
|
||||
const JS_DIR_I_LOCAL_FILE = "nsILocalFile";
|
||||
const JS_DIR_INIT_W_PATH = "initWithPath";
|
||||
|
||||
const JS_DIR_PREFS_DIR = 65539;
|
||||
|
||||
const JS_DIR_DIRECTORY = 0x01; // 1
|
||||
const JS_DIR_OK = true;
|
||||
|
||||
const JS_DIR_DEFAULT_PERMS = 0766;
|
||||
|
||||
const JS_DIR_FilePath = new C.Constructor(JS_DIR_LOCAL_CID,
|
||||
JS_DIR_I_LOCAL_FILE,
|
||||
JS_DIR_INIT_W_PATH);
|
||||
/****************** Globals **********************/
|
||||
|
||||
/****************** Dir Object Class *********************/
|
||||
// constructor
|
||||
function Dir(aPath) {
|
||||
|
||||
if(!aPath) {
|
||||
jslibError(null,
|
||||
"Please enter a local file path to initialize",
|
||||
"NS_ERROR_XPC_NOT_ENOUGH_ARGS", JS_DIR_FILE);
|
||||
throw C.results.NS_ERROR_XPC_NOT_ENOUGH_ARGS;
|
||||
}
|
||||
|
||||
return this.initPath(arguments);
|
||||
} // end constructor
|
||||
|
||||
Dir.prototype = new FileSystem;
|
||||
Dir.prototype.fileInst = null;
|
||||
|
||||
/********************* CREATE ****************************/
|
||||
Dir.prototype.create = function(aPermissions)
|
||||
{
|
||||
if(!this.mPath) {
|
||||
jslibError(null, "create (no file path defined)", "NS_ERROR_NOT_INITIALIZED");
|
||||
return C.results.NS_ERROR_NOT_INITIALIZED;
|
||||
}
|
||||
|
||||
if(this.exists()) {
|
||||
jslibError(null, "(Dir already exists", "NS_ERROR_FAILURE", JS_DIR_FILE+":create");
|
||||
return null;
|
||||
}
|
||||
|
||||
if (typeof(aPermissions) == "number") {
|
||||
var checkPerms = this.validatePermissions(aPermissions);
|
||||
|
||||
if(!checkPerms) {
|
||||
jslibError(null, "create (invalid permissions)",
|
||||
"NS_ERROR_INVALID_ARG", JS_DIR_FILE+":create");
|
||||
return C.results.NS_ERROR_INVALID_ARG;
|
||||
}
|
||||
} else {
|
||||
checkPerms = this.mFileInst.parent.permissions;
|
||||
}
|
||||
|
||||
var rv = null;
|
||||
|
||||
try {
|
||||
rv=this.mFileInst.create(JS_DIR_DIRECTORY, checkPerms);
|
||||
} catch (e) {
|
||||
jslibError(e, "(unable to create)", "NS_ERROR_FAILURE", JS_DIR_FILE+":create");
|
||||
rv=null;
|
||||
}
|
||||
|
||||
return rv;
|
||||
};
|
||||
|
||||
/********************* READDIR **************************/
|
||||
Dir.prototype.readDir = function ()
|
||||
{
|
||||
|
||||
if(!this.exists()) {
|
||||
jslibError(null, "(Dir already exists", "NS_ERROR_FAILURE", JS_DIR_FILE+":readDir");
|
||||
return null;
|
||||
}
|
||||
|
||||
var rv=null;
|
||||
|
||||
try {
|
||||
if(!this.isDir()) {
|
||||
jslibError(null, "(file is not a directory)", "NS_ERROR_FAILURE", JS_DIR_FILE+":readDir");
|
||||
return null;
|
||||
}
|
||||
|
||||
var files = this.mFileInst.directoryEntries;
|
||||
var listings = new Array();
|
||||
var file;
|
||||
|
||||
if(typeof(JS_FILE_LOADED)!='boolean')
|
||||
include(JS_LIB_PATH+'io/file.js');
|
||||
|
||||
while(files.hasMoreElements()) {
|
||||
file = files.getNext().QueryInterface(C.interfaces.nsILocalFile);
|
||||
if(file.isFile())
|
||||
listings.push(new File(file.path));
|
||||
|
||||
if(file.isDirectory())
|
||||
listings.push(new Dir(file.path));
|
||||
}
|
||||
|
||||
rv=listings;
|
||||
} catch(e) {
|
||||
jslibError(e, "(unexpected error)", "NS_ERROR_UNEXPECTED", JS_FILE_FILE+":readDir");
|
||||
rv=null;
|
||||
}
|
||||
|
||||
return rv;
|
||||
};
|
||||
|
||||
/********************* REMOVE *******************************/
|
||||
Dir.prototype.remove = function (aRecursive)
|
||||
{
|
||||
|
||||
if(typeof(aRecursive)!='boolean')
|
||||
aRecursive=false;
|
||||
|
||||
if(!this.checkInst())
|
||||
throw C.results.NS_ERROR_NOT_INITIALIZED;
|
||||
|
||||
if(!this.mPath)
|
||||
{
|
||||
jslibError(null, "remove (no path defined)",
|
||||
"NS_ERROR_INVALID_ARG", JS_DIR_FILE+":remove");
|
||||
return null;
|
||||
}
|
||||
|
||||
var rv=null
|
||||
|
||||
try {
|
||||
if(!this.exists()) {
|
||||
jslibError(null, "(directory doesn't exist)", "NS_ERROR_FAILURE", JS_DIR_FILE+":remove");
|
||||
return null;
|
||||
}
|
||||
|
||||
if(!this.isDir()) {
|
||||
jslibError(null, "(file is not a directory)", "NS_ERROR_FAILURE", JS_DIR_FILE+":remove");
|
||||
return null;
|
||||
}
|
||||
|
||||
rv=this.mFileInst.remove(aRecursive);
|
||||
} catch (e) {
|
||||
jslibError(e, "(dir not empty, use 'remove(true)' for recursion)", "NS_ERROR_UNEXPECTED",
|
||||
JS_DIR_FILE+":remove");
|
||||
rv=null;
|
||||
}
|
||||
|
||||
return rv;
|
||||
};
|
||||
|
||||
/********************* HELP *****************************/
|
||||
Dir.prototype.super_help = FileSystem.prototype.help;
|
||||
|
||||
Dir.prototype.__defineGetter__('help',
|
||||
function() {
|
||||
var help = this.super_help() +
|
||||
|
||||
" create(aPermissions);\n" +
|
||||
" remove(aRecursive);\n" +
|
||||
" readDir(aDirPath);\n";
|
||||
|
||||
return help;
|
||||
});
|
||||
|
||||
jslibDebug('*** load: '+JS_DIR_FILE+' OK');
|
||||
|
||||
} else {
|
||||
dump("JSLIB library not loaded:\n" +
|
||||
" \tTo load use: chrome://jslib/content/jslib.js\n" +
|
||||
" \tThen: include(jslib_dir);\n\n");
|
||||
}
|
||||
|
|
@ -1,185 +0,0 @@
|
|||
/*** -*- Mode: Javascript; tab-width: 2;
|
||||
|
||||
The contents of this file are subject to the Mozilla Public
|
||||
License Version 1.1 (the "License"); you may not use this file
|
||||
except in compliance with the License. You may obtain a copy of
|
||||
the License at http://www.mozilla.org/MPL/
|
||||
|
||||
Software distributed under the License is distributed on an "AS
|
||||
IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
|
||||
implied. See the License for the specific language governing
|
||||
rights and limitations under the License.
|
||||
|
||||
The Original Code is Collabnet code.
|
||||
The Initial Developer of the Original Code is Collabnet.
|
||||
|
||||
Portions created by Collabnet are Copyright (C) 2000 Collabnet.
|
||||
All Rights Reserved.
|
||||
|
||||
Contributor(s): Pete Collins, Doug Turner, Brendan Eich, Warren Harris,
|
||||
Eric Plaster, Martin Kutschker
|
||||
|
||||
|
||||
JS Directory Class API
|
||||
|
||||
dirUtils.js
|
||||
|
||||
Function List
|
||||
|
||||
|
||||
Instructions:
|
||||
|
||||
|
||||
*/
|
||||
|
||||
if(typeof(JS_LIB_LOADED)=='boolean') {
|
||||
|
||||
const JS_DIRUTILS_FILE = "dirUtils.js";
|
||||
const JS_DIRUTILS_LOADED = true;
|
||||
|
||||
const JS_DIRUTILS_FILE_LOCAL_CID = "@mozilla.org/file/local;1";
|
||||
const JS_DIRUTILS_FILE_DIR_CID = "@mozilla.org/file/directory_service;1";
|
||||
|
||||
const JS_DIRUTILS_FILE_I_LOCAL_FILE = "nsILocalFile";
|
||||
const JS_DIRUTILS_INIT_W_PATH = "initWithPath";
|
||||
const JS_DIRUTILS_I_PROPS = "nsIProperties";
|
||||
const JS_DIRUTILS_NSIFILE = C.interfaces.nsIFile;
|
||||
|
||||
const NS_APP_PREFS_50_DIR = "PrefD"; // /root/.mozilla/Default User/k1m30xaf.slt
|
||||
const NS_APP_CHROME_DIR = "AChrom"; // /usr/src/mozilla/dist/bin/chrome
|
||||
const NS_APP_USER_PROFILES_ROOT_DIR = "DefProfRt"; // /root/.mozilla
|
||||
const NS_APP_USER_PROFILE_50_DIR = "ProfD"; // /root/.mozilla/Default User/k1m30xaf.slt
|
||||
|
||||
const NS_APP_APPLICATION_REGISTRY_DIR = "AppRegD"; // /root/.mozilla
|
||||
const NS_APP_APPLICATION_REGISTRY_FILE = "AppRegF"; // /root/.mozilla/appreg
|
||||
const NS_APP_DEFAULTS_50_DIR = "DefRt"; // /usr/src/mozilla/dist/bin/defaults
|
||||
const NS_APP_PREF_DEFAULTS_50_DIR = "PrfDef"; // /usr/src/mozilla/dist/bin/defaults/pref
|
||||
const NS_APP_PROFILE_DEFAULTS_50_DIR = "profDef"; // /usr/src/mozilla/dist/bin/defaults/profile/US
|
||||
const NS_APP_PROFILE_DEFAULTS_NLOC_50_DIR = "ProfDefNoLoc"; // /usr/src/mozilla/dist/bin/defaults/profile
|
||||
const NS_APP_RES_DIR = "ARes"; // /usr/src/mozilla/dist/bin/res
|
||||
const NS_APP_PLUGINS_DIR = "APlugns"; // /usr/src/mozilla/dist/bin/plugins
|
||||
const NS_APP_SEARCH_DIR = "SrchPlugns"; // /usr/src/mozilla/dist/bin/searchplugins
|
||||
const NS_APP_PREFS_50_FILE = "PrefF"; // /root/.mozilla/Default User/k1m30xaf.slt/prefs.js
|
||||
const NS_APP_USER_CHROME_DIR = "UChrm"; // /root/.mozilla/Default User/k1m30xaf.slt/chrome
|
||||
const NS_APP_LOCALSTORE_50_FILE = "LclSt"; // /root/.mozilla/Default User/k1m30xaf.slt/localstore.rdf
|
||||
const NS_APP_HISTORY_50_FILE = "UHist"; // /root/.mozilla/Default User/k1m30xaf.slt/history.dat
|
||||
const NS_APP_USER_PANELS_50_FILE = "UPnls"; // /root/.mozilla/Default User/k1m30xaf.slt/panels.rdf
|
||||
const NS_APP_USER_MIMETYPES_50_FILE = "UMimTyp"; // /root/.mozilla/Default User/k1m30xaf.slt/mimeTypes.rdf
|
||||
const NS_APP_BOOKMARKS_50_FILE = "BMarks"; // /root/.mozilla/Default User/k1m30xaf.slt/bookmarks.html
|
||||
const NS_APP_SEARCH_50_FILE = "SrchF"; // /root/.mozilla/Default User/k1m30xaf.slt/search.rdf
|
||||
const NS_APP_MAIL_50_DIR = "MailD"; // /root/.mozilla/Default User/k1m30xaf.slt/Mail
|
||||
const NS_APP_IMAP_MAIL_50_DIR = "IMapMD"; // /root/.mozilla/Default User/k1m30xaf.slt/ImapMail
|
||||
const NS_APP_NEWS_50_DIR = "NewsD"; // /root/.mozilla/Default User/k1m30xaf.slt/News
|
||||
const NS_APP_MESSENGER_FOLDER_CACHE_50_DIR = "MFCaD"; // /root/.mozilla/Default User/k1m30xaf.slt/panacea.dat
|
||||
|
||||
// Useful OS System Dirs
|
||||
const NS_OS_CURRENT_PROCESS_DIR = "CurProcD"; // /usr/src/mozilla/dist/bin
|
||||
const NS_OS_HOME_DIR = "Home"; // /root
|
||||
const NS_OS_TEMP_DIR = "TmpD"; // /tmp
|
||||
const NS_XPCOM_COMPONENT_DIR = "ComsD"; // /usr/src/mozilla/dist/bin/components
|
||||
|
||||
const JS_DIRUTILS_FilePath = new C.Constructor(JS_DIRUTILS_FILE_LOCAL_CID,
|
||||
JS_DIRUTILS_FILE_I_LOCAL_FILE,
|
||||
JS_DIRUTILS_INIT_W_PATH);
|
||||
|
||||
const JS_DIRUTILS_DIR = new C.Constructor(JS_DIRUTILS_FILE_DIR_CID,
|
||||
JS_DIRUTILS_I_PROPS);
|
||||
|
||||
// constructor
|
||||
function DirUtils(){}
|
||||
|
||||
DirUtils.prototype = {
|
||||
|
||||
getPath : function (aAppID) {
|
||||
|
||||
if(!aAppID) {
|
||||
jslibError(null, "(no arg defined)", "NS_ERROR_INVALID_ARG", JS_FILE_FILE+":getPath");
|
||||
return null;
|
||||
}
|
||||
|
||||
var rv;
|
||||
|
||||
try {
|
||||
rv=(new JS_DIRUTILS_DIR()).get(aAppID, JS_DIRUTILS_NSIFILE).path;
|
||||
} catch (e) {
|
||||
jslibError(e, "(unexpected error)", "NS_ERROR_FAILURE", JS_DIRUTILS_FILE+":getPath");
|
||||
rv=null;
|
||||
}
|
||||
|
||||
return rv;
|
||||
},
|
||||
|
||||
getPrefsDir : function () { return this.getPath(NS_APP_PREFS_50_DIR); },
|
||||
getChromeDir : function () { return this.getPath(NS_APP_CHROME_DIR); },
|
||||
getMozHomeDir : function () { return this.getPath(NS_APP_USER_PROFILES_ROOT_DIR); },
|
||||
getMozUserHomeDir : function () { return this.getPath(NS_APP_USER_PROFILE_50_DIR); },
|
||||
getAppRegDir : function () { return this.getPath(NS_APP_APPLICATION_REGISTRY_FILE); },
|
||||
getAppDefaultDir : function () { return this.getPath(NS_APP_DEFAULTS_50_DIR); },
|
||||
getAppDefaultPrefDir : function () { return this.getPath(NS_APP_PREF_DEFAULTS_50_DIR); },
|
||||
getProfileDefaultsLocDir : function () { return this.getPath(NS_APP_PROFILE_DEFAULTS_50_DIR); },
|
||||
getProfileDefaultsDir : function () { return this.getPath(NS_APP_PROFILE_DEFAULTS_NLOC_50_DIR); },
|
||||
getAppResDir : function () { return this.getPath(NS_APP_RES_DIR); },
|
||||
getAppPluginsDir : function () { return this.getPath(NS_APP_PLUGINS_DIR); },
|
||||
getSearchPluginsDir : function () { return this.getPath(NS_APP_SEARCH_DIR); },
|
||||
getPrefsFile : function () { return this.getPath(NS_APP_PREFS_50_FILE); },
|
||||
getUserChromeDir : function () { return this.getPath(NS_APP_USER_CHROME_DIR); },
|
||||
getLocalStore : function () { return this.getPath(NS_APP_LOCALSTORE_50_FILE); },
|
||||
getHistoryFile : function () { return this.getPath(NS_APP_HISTORY_50_FILE); },
|
||||
getPanelsFile : function () { return this.getPath(NS_APP_USER_PANELS_50_FILE); },
|
||||
getMimeTypes : function () { return this.getPath(NS_APP_USER_MIMETYPES_50_FILE); },
|
||||
getBookmarks : function () { return this.getPath(NS_APP_BOOKMARKS_50_FILE); },
|
||||
getSearchFile : function () { return this.getPath(NS_APP_SEARCH_50_FILE); },
|
||||
getUserMailDir : function () { return this.getPath(NS_APP_MAIL_50_DIR); },
|
||||
getUserImapDir : function () { return this.getPath(NS_APP_IMAP_MAIL_50_DIR); },
|
||||
getUserNewsDir : function () { return this.getPath(NS_APP_NEWS_50_DIR); },
|
||||
getMessengerFolderCache : function () { return this.getPath(NS_APP_MESSENGER_FOLDER_CACHE_50_DIR); },
|
||||
getCurProcDir : function () { return this.getPath(NS_OS_CURRENT_PROCESS_DIR); },
|
||||
getHomeDir : function () { return this.getPath(NS_OS_HOME_DIR); },
|
||||
getTmpDir : function () { return this.getPath(NS_OS_TEMP_DIR); },
|
||||
getComponentsDir : function () { return this.getPath(NS_XPCOM_COMPONENT_DIR); },
|
||||
|
||||
get help() {
|
||||
const help =
|
||||
|
||||
"\n\nFunction and Attribute List:\n" +
|
||||
"\n" +
|
||||
" getPrefsDir()\n" +
|
||||
" getChromeDir()\n" +
|
||||
" getMozHomeDir()\n" +
|
||||
" getMozUserHomeDir()\n" +
|
||||
" getAppRegDir()\n" +
|
||||
" getAppDefaultDir()\n" +
|
||||
" getAppDefaultPrefDir()\n" +
|
||||
" getProfileDefaultsLocDir()\n" +
|
||||
" getProfileDefaultsDir()\n" +
|
||||
" getAppResDir()\n" +
|
||||
" getAppPluginsDir()\n" +
|
||||
" getSearchPluginsDir()\n" +
|
||||
" getPrefsFile()\n" +
|
||||
" getUserChromeDir()\n" +
|
||||
" getLocalStore()\n" +
|
||||
" getHistoryFile()\n" +
|
||||
" getPanelsFile()\n" +
|
||||
" getMimeTypes()\n" +
|
||||
" getBookmarks()\n" +
|
||||
" getSearchFile()\n" +
|
||||
" getUserMailDir()\n" +
|
||||
" getUserImapDir()\n" +
|
||||
" getUserNewsDir()\n" +
|
||||
" getMessengerFolderCache()\n\n";
|
||||
|
||||
return help;
|
||||
}
|
||||
|
||||
}; //END CLASS
|
||||
|
||||
jslibDebug('*** load: '+JS_DIRUTILS_FILE+' OK');
|
||||
|
||||
} // END BLOCK JS_LIB_LOADED CHECK
|
||||
|
||||
else {
|
||||
dump("JSLIB library not loaded:\n" +
|
||||
" \tTo load use: chrome://jslib/content/jslib.js\n" +
|
||||
" \tThen: include(jslib_dirutils);\n\n");
|
||||
}
|
||||
|
|
@ -1,928 +0,0 @@
|
|||
/*** -*- Mode: Javascript; tab-width: 2;
|
||||
The contents of this file are subject to the Mozilla Public
|
||||
License Version 1.1 (the "License"); you may not use this file
|
||||
except in compliance with the License. You may obtain a copy of
|
||||
the License at http://www.mozilla.org/MPL/
|
||||
|
||||
Software distributed under the License is distributed on an "AS
|
||||
IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
|
||||
implied. See the License for the specific language governing
|
||||
rights and limitations under the License.
|
||||
|
||||
The Original Code is jslib code.
|
||||
The Initial Developer of the Original Code is jslib team.
|
||||
|
||||
Portions created by jslib team are
|
||||
Copyright (C) 2000 jslib team. All
|
||||
Rights Reserved.
|
||||
|
||||
Contributor(s): Pete Collins,
|
||||
Doug Turner,
|
||||
Brendan Eich,
|
||||
Warren Harris,
|
||||
Eric Plaster,
|
||||
Martin Kutschker
|
||||
|
||||
The purpose of this file is to make it a little easier to use
|
||||
xpcom nsIFile file IO library from js
|
||||
|
||||
File API
|
||||
file.js
|
||||
|
||||
Base Class:
|
||||
FileSystem
|
||||
filesystem.js
|
||||
|
||||
Function List:
|
||||
// Constructor
|
||||
File(aPath) creates the File object and sets the file path
|
||||
|
||||
// file stream methods
|
||||
open(aMode, aPermissions); open a file handle for reading,
|
||||
writing or appending. permissions are optional.
|
||||
read(); returns the contents of a file
|
||||
readline(); returns the next line in the file.
|
||||
EOF; boolean check 'end of file' status
|
||||
write(aContents); writes the contents out to file.
|
||||
copy(aDest); copy the current file to a aDest
|
||||
close(); closes a file handle
|
||||
create(); creates a new file if one doesn't already exist
|
||||
exists(); check to see if a file exists
|
||||
|
||||
// file attributes
|
||||
size; read only attribute gets the file size
|
||||
ext; read only attribute gets a file extension if there is one
|
||||
permissions; attribute gets or sets the files permissions
|
||||
dateModified; read only attribute gets last modified date in locale string
|
||||
|
||||
// file path attributes
|
||||
leaf; read only attribute gets the file leaf
|
||||
path; read only attribute gets the path
|
||||
parent; read only attribute gets parent dir part of a path
|
||||
|
||||
// direct manipulation
|
||||
nsIFile returns an nsIFile obj
|
||||
|
||||
// utils
|
||||
remove(); removes the current file
|
||||
append(aLeaf); appends a leaf name to the current file
|
||||
appendRelativePath(aRelPath); appends a relitave path the the current file
|
||||
|
||||
// help!
|
||||
help; currently dumps a list of available functions
|
||||
|
||||
Instructions:
|
||||
|
||||
First include this js file in your xul file.
|
||||
Next, create an File object:
|
||||
|
||||
var file = new File("/path/file.ext");
|
||||
|
||||
To see if the file exists, call the exists() member.
|
||||
This is a good check before going into some
|
||||
deep code to try and extract information from a non-existant file.
|
||||
|
||||
To open a file for reading<"r">, writing<"w"> or appending<"a">,
|
||||
just call:
|
||||
|
||||
file.open("w", 0644);
|
||||
|
||||
where in this case you will be creating a new file called '/path/file.ext',
|
||||
with a mode of "w" which means you want to write a new file.
|
||||
|
||||
If you want to read from a file, just call:
|
||||
|
||||
file.open(); or
|
||||
file.open("r");
|
||||
var theFilesContents = file.read();
|
||||
|
||||
---- or ----
|
||||
|
||||
while(!file.EOF) {
|
||||
var theFileContentsLine = file.readline();
|
||||
dump("line: "+theFileContentsLine+"\n");
|
||||
}
|
||||
|
||||
The file contents will be returned to the caller so you can do something usefull with it.
|
||||
|
||||
file.close();
|
||||
|
||||
Calling 'close()' destroys any created objects. If you forget to use file.close() no probs
|
||||
all objects are discarded anyway.
|
||||
|
||||
Warning: these API's are not for religious types
|
||||
|
||||
************/
|
||||
|
||||
// insure jslib base is loaded
|
||||
if (typeof(JS_LIB_LOADED)=='boolean') {
|
||||
|
||||
// test to make sure filesystem base class is loaded
|
||||
if (typeof(JS_FILESYSTEM_LOADED)!='boolean')
|
||||
include(jslib_filesystem);
|
||||
|
||||
/****************** Globals **********************/
|
||||
const JS_FILE_LOADED = true;
|
||||
const JS_FILE_FILE = "file.js";
|
||||
|
||||
const JS_FILE_IOSERVICE_CID = "@mozilla.org/network/io-service;1";
|
||||
const JS_FILE_I_STREAM_CID = "@mozilla.org/scriptableinputstream;1";
|
||||
const JS_FILE_OUTSTREAM_CID = "@mozilla.org/network/file-output-stream;1";
|
||||
|
||||
const JS_FILE_F_TRANSPORT_SERVICE_CID = "@mozilla.org/network/file-transport-service;1";
|
||||
|
||||
const JS_FILE_I_IOSERVICE = C.interfaces.nsIIOService;
|
||||
const JS_FILE_I_SCRIPTABLE_IN_STREAM = "nsIScriptableInputStream";
|
||||
const JS_FILE_I_FILE_OUT_STREAM = C.interfaces.nsIFileOutputStream;
|
||||
|
||||
const JS_FILE_READ = 0x01; // 1
|
||||
const JS_FILE_WRITE = 0x08; // 8
|
||||
const JS_FILE_APPEND = 0x10; // 16
|
||||
|
||||
const JS_FILE_READ_MODE = "r";
|
||||
const JS_FILE_WRITE_MODE = "w";
|
||||
const JS_FILE_APPEND_MODE = "a";
|
||||
|
||||
const JS_FILE_FILE_TYPE = 0x00; // 0
|
||||
|
||||
const JS_FILE_CHUNK = 1024; // buffer for readline => set to 1k
|
||||
|
||||
const JS_FILE_DEFAULT_PERMS = 0644;
|
||||
|
||||
const JS_FILE_OK = true;
|
||||
|
||||
try {
|
||||
const JS_FILE_InputStream = new C.Constructor
|
||||
(JS_FILE_I_STREAM_CID, JS_FILE_I_SCRIPTABLE_IN_STREAM);
|
||||
|
||||
const JS_FILE_IOSERVICE = C.classes[JS_FILE_IOSERVICE_CID].
|
||||
getService(JS_FILE_I_IOSERVICE);
|
||||
|
||||
} catch (e) {
|
||||
jslibError (e, "open("+this.mMode+") (unable to get nsIFileChannel)",
|
||||
"NS_ERROR_FAILURE",
|
||||
JS_FILE_FILE);
|
||||
}
|
||||
|
||||
/***
|
||||
* Possible values for the ioFlags parameter
|
||||
* From:
|
||||
* http://lxr.mozilla.org/seamonkey/source/nsprpub/pr/include/prio.h#601
|
||||
*/
|
||||
|
||||
|
||||
// #define PR_RDONLY 0x01
|
||||
// #define PR_WRONLY 0x02
|
||||
// #define PR_RDWR 0x04
|
||||
// #define PR_CREATE_FILE 0x08
|
||||
// #define PR_APPEND 0x10
|
||||
// #define PR_TRUNCATE 0x20
|
||||
// #define PR_SYNC 0x40
|
||||
// #define PR_EXCL 0x80
|
||||
|
||||
const JS_FILE_NS_RDONLY = 0x01;
|
||||
const JS_FILE_NS_WRONLY = 0x02;
|
||||
const JS_FILE_NS_RDWR = 0x04;
|
||||
const JS_FILE_NS_CREATE_FILE = 0x08;
|
||||
const JS_FILE_NS_APPEND = 0x10;
|
||||
const JS_FILE_NS_TRUNCATE = 0x20;
|
||||
const JS_FILE_NS_SYNC = 0x40;
|
||||
const JS_FILE_NS_EXCL = 0x80;
|
||||
/****************** Globals **********************/
|
||||
|
||||
|
||||
/****************************************************************
|
||||
* void File(aPath) *
|
||||
* *
|
||||
* class constructor *
|
||||
* aPath is an argument of string local file path *
|
||||
* returns NS_OK on success, exception upon failure *
|
||||
* Ex: *
|
||||
* var p = '/tmp/foo.dat'; *
|
||||
* var f = new File(p); *
|
||||
* *
|
||||
* outputs: void(null) *
|
||||
****************************************************************/
|
||||
|
||||
function File(aPath) {
|
||||
|
||||
if (!aPath) {
|
||||
jslibError(null,
|
||||
"Please enter a local file path to initialize",
|
||||
"NS_ERROR_XPC_NOT_ENOUGH_ARGS", JS_FILE_FILE);
|
||||
throw - C.results.NS_ERROR_XPC_NOT_ENOUGH_ARGS;
|
||||
}
|
||||
return this.initPath(arguments);
|
||||
} // constructor
|
||||
|
||||
File.prototype = new FileSystem();
|
||||
|
||||
// member vars
|
||||
File.prototype.mMode = null;
|
||||
File.prototype.mFileChannel = null;
|
||||
File.prototype.mTransport = null;
|
||||
File.prototype.mURI = null;
|
||||
File.prototype.mOutStream = null;
|
||||
File.prototype.mInputStream = null;
|
||||
File.prototype.mLineBuffer = null;
|
||||
File.prototype.mPosition = 0;
|
||||
|
||||
/********************* OPEN *************************************
|
||||
* bool open(aMode, aPerms) *
|
||||
* *
|
||||
* opens a file handle to read, write or append *
|
||||
* aMode is an argument of string 'w', 'a', 'r' *
|
||||
* returns true on success, null on failure *
|
||||
* Ex: *
|
||||
* var p='/tmp/foo.dat'; *
|
||||
* var f=new File(p); *
|
||||
* *
|
||||
* outputs: void(null) *
|
||||
****************************************************************/
|
||||
|
||||
File.prototype.open = function(aMode, aPerms)
|
||||
{
|
||||
|
||||
if (!this.checkInst())
|
||||
throw C.results.NS_ERROR_NOT_INITIALIZED;
|
||||
|
||||
if (!this.mPath) {
|
||||
jslibError(null, "open("+this.mMode+") (no file path defined)",
|
||||
"NS_ERROR_NOT_INITIALIZED",
|
||||
JS_FILE_FILE+":open");
|
||||
return null;
|
||||
}
|
||||
|
||||
if (this.exists() && this.mFileInst.isDirectory()) {
|
||||
jslibError(null, "open("+this.mMode+") (cannot open directory)",
|
||||
"NS_ERROR_FAILURE",
|
||||
JS_FILE_FILE+":open");
|
||||
return null;
|
||||
}
|
||||
|
||||
if (this.mMode) {
|
||||
jslibError(null, "open("+this.mMode+") (already open)",
|
||||
"NS_ERROR_NOT_INITIALIZED",
|
||||
JS_FILE_FILE+":open");
|
||||
this.close();
|
||||
return null;
|
||||
}
|
||||
|
||||
this.close();
|
||||
|
||||
if (!this.mURI) {
|
||||
if (!this.exists())
|
||||
this.create();
|
||||
this.mURI = JS_FILE_IOSERVICE.newFileURI(this.mFileInst);
|
||||
}
|
||||
|
||||
if (!aMode)
|
||||
aMode=JS_FILE_READ_MODE;
|
||||
|
||||
this.resetCache();
|
||||
var rv;
|
||||
|
||||
switch(aMode) {
|
||||
case JS_FILE_WRITE_MODE:
|
||||
case JS_FILE_APPEND_MODE: {
|
||||
try {
|
||||
if (!this.mFileChannel)
|
||||
this.mFileChannel = JS_FILE_IOSERVICE.newChannelFromURI(this.mURI);
|
||||
} catch(e) {
|
||||
jslibError(e, "open("+this.mMode+") (unable to get nsIFileChannel)",
|
||||
"NS_ERROR_FAILURE",
|
||||
JS_FILE_FILE+":open");
|
||||
return null;
|
||||
}
|
||||
if (aPerms) {
|
||||
if (!this.validatePermissions(aPerms)) {
|
||||
jslibError(null, "open("+this.mMode+") (invalid permissions)",
|
||||
"NS_ERROR_INVALID_ARG",
|
||||
JS_FILE_FILE+":open");
|
||||
return null;
|
||||
}
|
||||
}
|
||||
if (!aPerms)
|
||||
aPerms=JS_FILE_DEFAULT_PERMS;
|
||||
// removing, i don't think we need this --pete
|
||||
//this.permissions = aPerms;
|
||||
try {
|
||||
var offSet=0;
|
||||
if (aMode == JS_FILE_WRITE_MODE) {
|
||||
this.mMode=JS_FILE_WRITE_MODE;
|
||||
// create a filestream
|
||||
var fs = C.classes[JS_FILE_OUTSTREAM_CID].
|
||||
createInstance(JS_FILE_I_FILE_OUT_STREAM);
|
||||
|
||||
fs.init(this.mFileInst, JS_FILE_NS_TRUNCATE |
|
||||
JS_FILE_NS_WRONLY, 00004, null);
|
||||
this.mOutStream = fs;
|
||||
} else {
|
||||
this.mMode=JS_FILE_APPEND_MODE;
|
||||
// create a filestream
|
||||
var fs = C.classes[JS_FILE_OUTSTREAM_CID].
|
||||
createInstance(JS_FILE_I_FILE_OUT_STREAM);
|
||||
|
||||
fs.init(this.mFileInst, JS_FILE_NS_RDWR |
|
||||
JS_FILE_NS_APPEND, 00004, null);
|
||||
this.mOutStream = fs;
|
||||
}
|
||||
} catch(e) {
|
||||
jslibError(e, "open("+this.mMode+") (unable to get file stream)",
|
||||
"NS_ERROR_FAILURE",
|
||||
JS_FILE_FILE+":open");
|
||||
return null;
|
||||
}
|
||||
try {
|
||||
// Use the previously created file transport to open an output
|
||||
// stream for writing to the file
|
||||
if (!this.mOutStream) {
|
||||
// this.mOutStream = this.mTransport.openOutputStream(offSet, -1, 0);
|
||||
// this.mOutStream =
|
||||
}
|
||||
} catch(e) {
|
||||
jslibError(e, "open("+this.mMode+") (unable to get outputstream)",
|
||||
"NS_ERROR_FAILURE",
|
||||
JS_FILE_FILE+":open");
|
||||
this.close();
|
||||
return null;
|
||||
}
|
||||
|
||||
rv = true;
|
||||
break;
|
||||
}
|
||||
|
||||
case JS_FILE_READ_MODE: {
|
||||
if (!this.exists()) {
|
||||
jslibError(null, "open(r) (file doesn't exist)",
|
||||
"NS_ERROR_FAILURE",
|
||||
JS_FILE_FILE+":open");
|
||||
return null;
|
||||
}
|
||||
this.mMode=JS_FILE_READ_MODE;
|
||||
try {
|
||||
jslibPrint('****** '+this.mURI);
|
||||
this.mFileChannel = JS_FILE_IOSERVICE.newChannelFromURI(this.mURI);
|
||||
this.mInputStream = new JS_FILE_InputStream();
|
||||
this.mInputStream.init(this.mFileChannel.open());
|
||||
this.mLineBuffer = new Array();
|
||||
rv=true;
|
||||
} catch (e) {
|
||||
jslibError(e, "open(r) (error setting permissions)",
|
||||
"NS_ERROR_FAILURE",
|
||||
JS_FILE_FILE+":open");
|
||||
return null;
|
||||
}
|
||||
break;
|
||||
}
|
||||
|
||||
default:
|
||||
jslibError(null, "open (must supply either w,r, or a)",
|
||||
"NS_ERROR_INVALID_ARG",
|
||||
JS_FILE_FILE+":open");
|
||||
return null;
|
||||
}
|
||||
return rv;
|
||||
}
|
||||
|
||||
/********************* READ *************************************
|
||||
* string read() *
|
||||
* *
|
||||
* reads a file if the file is binary it will *
|
||||
* return type ex: ELF *
|
||||
* takes no arguments needs an open read mode filehandle *
|
||||
* returns string on success, null on failure *
|
||||
* Ex: *
|
||||
* var p='/tmp/foo.dat'; *
|
||||
* var f=new File(p); *
|
||||
* f.open(p); *
|
||||
* f.read(); *
|
||||
* *
|
||||
* outputs: <string contents of foo.dat> *
|
||||
****************************************************************/
|
||||
|
||||
File.prototype.read = function(aSize)
|
||||
{
|
||||
|
||||
if (!this.checkInst())
|
||||
throw C.results.NS_ERROR_NOT_INITIALIZED;
|
||||
|
||||
if (this.mMode != JS_FILE_READ_MODE) {
|
||||
jslibError(null, "(mode is write/append)",
|
||||
"NS_ERROR_FAILURE",
|
||||
JS_FILE_FILE+":read");
|
||||
this.close();
|
||||
return null;
|
||||
}
|
||||
var rv = null;
|
||||
try {
|
||||
if (!this.mFileInst || !this.mInputStream) {
|
||||
jslibError(null, "(no file instance or input stream) ",
|
||||
"NS_ERROR_NOT_INITIALIZED",
|
||||
JS_FILE_FILE+":read");
|
||||
return null;
|
||||
}
|
||||
rv = this.mInputStream.read(aSize != undefined ? aSize : this.mFileInst.fileSize);
|
||||
this.mInputStream.close();
|
||||
} catch (e) {
|
||||
jslibError(e, "read (input stream read)",
|
||||
"NS_ERROR_FAILURE",
|
||||
JS_FILE_FILE+":read");
|
||||
return null;
|
||||
}
|
||||
return rv;
|
||||
}
|
||||
|
||||
/********************* READLINE**********************************
|
||||
* string readline() *
|
||||
* *
|
||||
* reads a file if the file is binary it will *
|
||||
* return type string *
|
||||
* takes no arguments needs an open read mode filehandle *
|
||||
* returns string on success, null on failure *
|
||||
* Ex: *
|
||||
* var p='/tmp/foo.dat'; *
|
||||
* var f=new File(p); *
|
||||
* f.open(); *
|
||||
* while(!f.EOF) *
|
||||
* dump("line: "+f.readline()+"\n"); *
|
||||
* *
|
||||
* outputs: <string line of foo.dat> *
|
||||
****************************************************************/
|
||||
|
||||
File.prototype.readline = function()
|
||||
{
|
||||
|
||||
if (!this.checkInst())
|
||||
throw C.results.NS_ERROR_NOT_INITIALIZED;
|
||||
|
||||
if (!this.mInputStream) {
|
||||
jslibError(null, "(no input stream)",
|
||||
"NS_ERROR_NOT_INITIALIZED",
|
||||
JS_FILE_FILE+":readline");
|
||||
return null;
|
||||
}
|
||||
var rv = null;
|
||||
var buf = null;
|
||||
var tmp = null;
|
||||
try {
|
||||
if (this.mLineBuffer.length < 2) {
|
||||
buf = this.mInputStream.read(JS_FILE_CHUNK);
|
||||
this.mPosition = this.mPosition + JS_FILE_CHUNK;
|
||||
if (this.mPosition > this.mFileInst.fileSize)
|
||||
this.mPosition = this.mFileInst.fileSize;
|
||||
if (buf) {
|
||||
if (this.mLineBuffer.length == 1) {
|
||||
tmp = this.mLineBuffer.shift();
|
||||
buf = tmp+buf;
|
||||
}
|
||||
this.mLineBuffer = buf.split(/[\n\r]/);
|
||||
}
|
||||
}
|
||||
rv = this.mLineBuffer.shift();
|
||||
} catch (e) {
|
||||
jslibError(e, "(problems reading from file)",
|
||||
"NS_ERROR_NOT_INITIALIZED",
|
||||
JS_FILE_FILE+":readline");
|
||||
rv = null;
|
||||
}
|
||||
return rv;
|
||||
}
|
||||
|
||||
/********************* EOF **************************************
|
||||
* bool getter EOF() *
|
||||
* *
|
||||
* boolean check 'end of file' status *
|
||||
* return type boolean *
|
||||
* takes no arguments needs an open read mode filehandle *
|
||||
* returns true on eof, false when not at eof *
|
||||
* Ex: *
|
||||
* var p='/tmp/foo.dat'; *
|
||||
* var f=new File(p); *
|
||||
* f.open(); *
|
||||
* while(!f.EOF) *
|
||||
* dump("line: "+f.readline()+"\n"); *
|
||||
* *
|
||||
* outputs: true or false *
|
||||
****************************************************************/
|
||||
|
||||
File.prototype.__defineGetter__('EOF',
|
||||
function()
|
||||
{
|
||||
|
||||
if (!this.checkInst())
|
||||
throw C.results.NS_ERROR_NOT_INITIALIZED;
|
||||
|
||||
if (!this.mInputStream) {
|
||||
jslibError(null, "(no input stream)",
|
||||
"NS_ERROR_NOT_INITIALIZED",
|
||||
JS_FILE_FILE+":EOF");
|
||||
throw C.results.NS_ERROR_NOT_INITIALIZED;
|
||||
}
|
||||
|
||||
if ((this.mLineBuffer.length > 0) || (this.mInputStream.available() > 0))
|
||||
return false;
|
||||
|
||||
else
|
||||
return true;
|
||||
|
||||
})
|
||||
|
||||
/********************* WRITE ************************************
|
||||
* bool write() *
|
||||
* *
|
||||
* reads a file if the file is binary it will *
|
||||
* return type ex: ELF *
|
||||
* takes no arguments needs an open read mode filehandle *
|
||||
* returns string on success, null on failure *
|
||||
* Ex: *
|
||||
* var p='/tmp/foo.dat'; *
|
||||
* var f=new File(p); *
|
||||
* f.open(p); *
|
||||
* f.read(); *
|
||||
* *
|
||||
* outputs: <string contents of foo.dat> *
|
||||
****************************************************************/
|
||||
|
||||
File.prototype.write = function(aBuffer, aPerms)
|
||||
{
|
||||
|
||||
if (!this.checkInst())
|
||||
throw C.results.NS_ERROR_NOT_INITIALIZED;
|
||||
|
||||
if (this.mMode == JS_FILE_READ_MODE) {
|
||||
jslibError(null, "(in read mode)",
|
||||
"NS_ERROR_FAILURE",
|
||||
JS_FILE_FILE+":write");
|
||||
this.close();
|
||||
return null;
|
||||
}
|
||||
|
||||
if (!this.mFileInst) {
|
||||
jslibError(null, "(no file instance)",
|
||||
"NS_ERROR_NOT_INITIALIZED",
|
||||
JS_FILE_FILE+":write");
|
||||
return null;
|
||||
}
|
||||
|
||||
if (!aBuffer)
|
||||
throw(JS_FILE_FILE+":write:ERROR: must have a buffer to write!\n");
|
||||
|
||||
var rv=null;
|
||||
|
||||
try {
|
||||
this.mOutStream.write(aBuffer, aBuffer.length);
|
||||
this.mOutStream.flush();
|
||||
//this.mOutStream.close();
|
||||
rv=true;
|
||||
} catch (e) {
|
||||
jslibError(e, "write (nsIOutputStream write/flush)",
|
||||
"NS_ERROR_UNEXPECTED",
|
||||
JS_FILE_FILE+":write");
|
||||
rv=false;
|
||||
}
|
||||
return rv;
|
||||
}
|
||||
|
||||
/********************* COPY *************************************
|
||||
* void copy(aDest) *
|
||||
* *
|
||||
* void file close *
|
||||
* return type void(null) *
|
||||
* takes no arguments closes an open file stream and *
|
||||
* deletes member var instances of objects *
|
||||
* Ex: *
|
||||
* var p='/tmp/foo.dat'; *
|
||||
* var f=new File(p); *
|
||||
* fopen(); *
|
||||
* f.close(); *
|
||||
* *
|
||||
* outputs: void(null) *
|
||||
****************************************************************/
|
||||
|
||||
File.prototype.copy = function (aDest)
|
||||
{
|
||||
|
||||
if (!this.checkInst())
|
||||
throw C.results.NS_ERROR_NOT_INITIALIZED;
|
||||
|
||||
if (!aDest) {
|
||||
jslibError(null, "(no dest defined)",
|
||||
"NS_ERROR_INVALID_ARG",
|
||||
JS_FILE_FILE+":copy");
|
||||
throw -C.results.NS_ERROR_INVALID_ARG;
|
||||
}
|
||||
|
||||
if (!this.exists()) {
|
||||
jslibError(null, "(file doesn't exist)",
|
||||
"NS_ERROR_FAILURE",
|
||||
JS_FILE_FILE+":copy");
|
||||
throw -C.results.NS_ERROR_FAILURE;
|
||||
}
|
||||
|
||||
var rv;
|
||||
try {
|
||||
var dest = new JS_FS_File_Path(aDest);
|
||||
jslibDebug(dest);
|
||||
var copyName = null;
|
||||
var dir = null;
|
||||
|
||||
if (dest.equals(this.mFileInst)) {
|
||||
jslibError(null, "(can't copy file to itself)",
|
||||
"NS_ERROR_FAILURE",
|
||||
JS_FILE_FILE+":copy");
|
||||
throw -C.results.NS_ERROR_FAILURE;
|
||||
}
|
||||
|
||||
if (dest.exists()) {
|
||||
jslibError(null, "(dest "+dest.path+" already exists)",
|
||||
"NS_ERROR_FAILURE",
|
||||
JS_FILE_FILE+":copy");
|
||||
throw -C.results.NS_ERROR_FAILURE;
|
||||
}
|
||||
|
||||
if (this.mFileInst.isDirectory()) {
|
||||
jslibError(null, "(cannot copy directory)",
|
||||
"NS_ERROR_FAILURE",
|
||||
JS_FILE_FILE+":copy");
|
||||
throw -C.results.NS_ERROR_FAILURE;
|
||||
}
|
||||
|
||||
if (!dest.exists()) {
|
||||
copyName = dest.leafName;
|
||||
dir = dest.parent;
|
||||
|
||||
if (!dir.exists()) {
|
||||
jslibError(null, "(dest "+dir.path+" doesn't exist)",
|
||||
"NS_ERROR_FAILURE",
|
||||
JS_FILE_FILE+":copy");
|
||||
throw -C.results.NS_ERROR_FAILURE;
|
||||
}
|
||||
|
||||
if (!dir.isDirectory()) {
|
||||
jslibError(null, "(dest "+dir.path+" is not a valid path)",
|
||||
"NS_ERROR_FAILURE",
|
||||
JS_FILE_FILE+":copy");
|
||||
throw -C.results.NS_ERROR_FAILURE;
|
||||
}
|
||||
}
|
||||
|
||||
if (!dir) {
|
||||
dir = dest;
|
||||
if (dest.equals(this.mFileInst)) {
|
||||
jslibError(null, "(can't copy file to itself)", "NS_ERROR_FAILURE", JS_FILE_FILE+":copy");
|
||||
throw -C.results.NS_ERROR_FAILURE;
|
||||
}
|
||||
}
|
||||
this.mFileInst.copyTo(dir, copyName);
|
||||
jslibDebug(JS_FILE_FILE+":copy successful!");
|
||||
} catch (e) {
|
||||
jslibError(e, "(unexpected error)", "NS_ERROR_UNEXPECTED", JS_FILE_FILE+":copy");
|
||||
}
|
||||
return;
|
||||
}
|
||||
|
||||
/********************* CLOSE ************************************
|
||||
* void close() *
|
||||
* *
|
||||
* void file close *
|
||||
* return type void(null) *
|
||||
* takes no arguments closes an open file stream and *
|
||||
* deletes member var instances of objects *
|
||||
* Ex: *
|
||||
* var p='/tmp/foo.dat'; *
|
||||
* var f=new File(p); *
|
||||
* fopen(); *
|
||||
* f.close(); *
|
||||
* *
|
||||
* outputs: void(null) *
|
||||
****************************************************************/
|
||||
|
||||
File.prototype.close = function()
|
||||
{
|
||||
/***************** Destroy Instances *********************/
|
||||
if (this.mFileChannel) delete this.mFileChannel;
|
||||
if (this.mInputStream) delete this.mInputStream;
|
||||
if (this.mTransport) delete this.mTransport;
|
||||
if (this.mMode) this.mMode=null;
|
||||
if (this.mOutStream) {
|
||||
this.mOutStream.close();
|
||||
delete this.mOutStream;
|
||||
}
|
||||
if (this.mLineBuffer) this.mLineBuffer=null;
|
||||
this.mPosition = 0;
|
||||
/***************** Destroy Instances *********************/
|
||||
|
||||
return void(null);
|
||||
}
|
||||
|
||||
/********************* CREATE *****************************/
|
||||
File.prototype.create = function()
|
||||
{
|
||||
|
||||
// We can probably implement this so that it can create a
|
||||
// file or dir if a long non-existent mPath is present
|
||||
|
||||
if (!this.checkInst())
|
||||
throw C.results.NS_ERROR_NOT_INITIALIZED;
|
||||
|
||||
if (this.exists()) {
|
||||
jslibError(null, "(file already exists)",
|
||||
"NS_ERROR_FAILURE",
|
||||
JS_FILE_FILE+":create");
|
||||
return null
|
||||
}
|
||||
|
||||
if (!this.mFileInst.parent.exists() && this.mFileInst.parent.isDirectory()) {
|
||||
jslibError(null, "(no such file or dir: '"+this.path+"' )",
|
||||
"NS_ERROR_INVALID_ARG",
|
||||
JS_FILE_FILE+":create");
|
||||
return null
|
||||
}
|
||||
|
||||
var rv=null;
|
||||
try {
|
||||
rv = this.mFileInst.create(JS_FILE_FILE_TYPE, JS_FILE_DEFAULT_PERMS);
|
||||
} catch (e) {
|
||||
jslibError(e, "(unexpected)",
|
||||
"NS_ERROR_UNEXPECTED",
|
||||
JS_FILE_FILE+":create");
|
||||
rv=null;
|
||||
}
|
||||
return rv;
|
||||
}
|
||||
|
||||
/********************* REMOVE *******************************/
|
||||
File.prototype.remove = function ()
|
||||
{
|
||||
if (!this.checkInst())
|
||||
throw C.results.NS_ERROR_NOT_INITIALIZED;
|
||||
|
||||
if (!this.mPath) {
|
||||
jslibError(null, "(no path defined)",
|
||||
"NS_ERROR_INVALID_ARG",
|
||||
JS_FILE_FILE+":remove");
|
||||
return null;
|
||||
}
|
||||
this.close();
|
||||
var rv;
|
||||
try {
|
||||
// this is a non recursive remove because we are only dealing w/ files.
|
||||
rv = this.mFileInst.remove(false);
|
||||
} catch (e) {
|
||||
jslibError(e, "(unexpected)",
|
||||
"NS_ERROR_UNEXPECTED",
|
||||
JS_FILE_FILE+":remove");
|
||||
rv=null;
|
||||
}
|
||||
return rv;
|
||||
}
|
||||
|
||||
/********************* POS **************************************
|
||||
* int getter POS() *
|
||||
* *
|
||||
* int file position *
|
||||
* return type int *
|
||||
* takes no arguments needs an open read mode filehandle *
|
||||
* returns current position, default is 0 set when *
|
||||
* close is called *
|
||||
* Ex: *
|
||||
* var p='/tmp/foo.dat'; *
|
||||
* var f=new File(p); *
|
||||
* f.open(); *
|
||||
* while(!f.EOF){ *
|
||||
* dump("pos: "+f.pos+"\n"); *
|
||||
* dump("line: "+f.readline()+"\n"); *
|
||||
* } *
|
||||
* *
|
||||
* outputs: int pos *
|
||||
****************************************************************/
|
||||
|
||||
File.prototype.__defineGetter__('pos', function(){ return this.mPosition; })
|
||||
|
||||
/********************* SIZE *************************************
|
||||
* int getter size() *
|
||||
* *
|
||||
* int file size *
|
||||
* return type int *
|
||||
* takes no arguments a getter only *
|
||||
* Ex: *
|
||||
* var p='/tmp/foo.dat'; *
|
||||
* var f=new File(p); *
|
||||
* f.size; *
|
||||
* *
|
||||
* outputs: int 16 *
|
||||
****************************************************************/
|
||||
|
||||
File.prototype.__defineGetter__('size',
|
||||
function()
|
||||
{
|
||||
|
||||
if (!this.checkInst())
|
||||
throw C.results.NS_ERROR_NOT_INITIALIZED;
|
||||
|
||||
if (!this.mPath) {
|
||||
jslibError(null, "size (no path defined)",
|
||||
"NS_ERROR_INVALID_ARG",
|
||||
JS_FILE_FILE);
|
||||
return null;
|
||||
}
|
||||
|
||||
if (!this.exists()) {
|
||||
jslibError(null, "size (file doesn't exist)", "NS_ERROR_FAILURE", JS_FILE_FILE);
|
||||
return null;
|
||||
}
|
||||
var rv=null;
|
||||
this.resetCache();
|
||||
try {
|
||||
rv=this.mFileInst.fileSize;
|
||||
} catch(e) {
|
||||
jslibError(e, "(problem getting file instance)", "NS_ERROR_UNEXPECTED", JS_FILE_FILE+":size");
|
||||
rv=null;
|
||||
}
|
||||
|
||||
return rv;
|
||||
}) //END size Getter
|
||||
|
||||
/********************* EXTENSION ********************************
|
||||
* string getter ext() *
|
||||
* *
|
||||
* string file extension *
|
||||
* return type string *
|
||||
* takes no arguments a getter only *
|
||||
* Ex: *
|
||||
* var p='/tmp/foo.dat'; *
|
||||
* var f=new File(p); *
|
||||
* f.ext; *
|
||||
* *
|
||||
* outputs: dat *
|
||||
****************************************************************/
|
||||
|
||||
File.prototype.__defineGetter__('ext',
|
||||
function()
|
||||
{
|
||||
|
||||
if (!this.checkInst())
|
||||
throw C.results.NS_ERROR_NOT_INITIALIZED;
|
||||
|
||||
if (!this.exists()) {
|
||||
jslibError(null, "(file doesn't exist)",
|
||||
"NS_ERROR_FAILURE",
|
||||
JS_FILE_FILE+":ext");
|
||||
return null;
|
||||
}
|
||||
if (!this.mPath) {
|
||||
jslibError(null, "(no path defined)",
|
||||
"NS_ERROR_INVALID_ARG",
|
||||
JS_FILE_FILE+":ext");
|
||||
return null;
|
||||
}
|
||||
var rv=null;
|
||||
try {
|
||||
var leafName = this.mFileInst.leafName;
|
||||
var dotIndex = leafName.lastIndexOf('.');
|
||||
rv=(dotIndex >= 0) ? leafName.substring(dotIndex+1) : "";
|
||||
} catch(e) {
|
||||
jslibError(e, "(problem getting file instance)",
|
||||
"NS_ERROR_UNEXPECTED",
|
||||
JS_FILE_FILE+":ext");
|
||||
rv=null;
|
||||
}
|
||||
return rv;
|
||||
})// END ext Getter
|
||||
|
||||
File.prototype.super_help = FileSystem.prototype.help;
|
||||
|
||||
/********************* HELP *****************************/
|
||||
File.prototype.__defineGetter__('help',
|
||||
function()
|
||||
{
|
||||
const help = this.super_help() +
|
||||
|
||||
" open(aMode);\n" +
|
||||
" read();\n" +
|
||||
" readline();\n" +
|
||||
" EOF;\n" +
|
||||
" write(aContents, aPermissions);\n" +
|
||||
" copy(aDest);\n" +
|
||||
" close();\n" +
|
||||
" create();\n" +
|
||||
" remove();\n" +
|
||||
" size;\n" +
|
||||
" ext;\n" +
|
||||
" help;\n";
|
||||
|
||||
return help;
|
||||
})
|
||||
|
||||
jslibDebug('*** load: '+JS_FILE_FILE+' OK');
|
||||
|
||||
} // END BLOCK JS_LIB_LOADED CHECK
|
||||
|
||||
// If jslib base library is not loaded, dump this error.
|
||||
else
|
||||
{
|
||||
dump("JS_FILE library not loaded:\n" +
|
||||
" \tTo load use: chrome://jslib/content/jslib.js\n" +
|
||||
" \tThen: include('chrome://jslib/content/io/file.js');\n\n");
|
||||
}
|
|
@ -1,652 +0,0 @@
|
|||
/*** -*- Mode: Javascript; tab-width: 2; -*-
|
||||
|
||||
The contents of this file are subject to the Mozilla Public
|
||||
License Version 1.1 (the "License"); you may not use this file
|
||||
except in compliance with the License. You may obtain a copy of
|
||||
the License at http://www.mozilla.org/MPL/
|
||||
|
||||
Software distributed under the License is distributed on an "AS
|
||||
IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
|
||||
implied. See the License for the specific language governing
|
||||
rights and limitations under the License.
|
||||
|
||||
The Original Code is Collabnet code.
|
||||
The Initial Developer of the Original Code is Collabnet.
|
||||
|
||||
Portions created by Collabnet are Copyright (C) 2000 Collabnet.
|
||||
All Rights Reserved.
|
||||
|
||||
Contributor(s): Pete Collins,
|
||||
Doug Turner,
|
||||
Brendan Eich,
|
||||
Warren Harris,
|
||||
Eric Plaster,
|
||||
Martin Kutschker
|
||||
Philip Lindsay
|
||||
|
||||
|
||||
JS FileUtils IO API (The purpose of this file is to make it a little easier to do file IO from js)
|
||||
|
||||
fileUtils.js
|
||||
|
||||
Function List
|
||||
|
||||
chromeToPath(aPath) // Converts a chrome://bob/content uri to a path.
|
||||
// NOTE: although this gives you the
|
||||
// path to a file in the chrome directory, you will
|
||||
// most likely not have permisions
|
||||
// to create or write to files there.
|
||||
urlToPath(aPath) // Converts a file:// url to a path
|
||||
exists(aPath); // check to see if a file exists
|
||||
append(aDirPath, aFileName); // append is for abstracting platform specific file paths
|
||||
remove(aPath); // remove a file
|
||||
copy(aSource, aDest); // copy a file from source to destination
|
||||
leaf(aPath); // leaf is the endmost file string
|
||||
// eg: foo.html in /myDir/foo.html
|
||||
permissions(aPath); // returns the files permissions
|
||||
dateModified(aPath); // returns the last modified date in locale string
|
||||
size(aPath); // returns the file size
|
||||
ext(aPath); // returns a file extension if there is one
|
||||
parent(aPath) // returns the dir part of a path
|
||||
dirPath(aPath) // *Depriciated* use parent
|
||||
spawn(aPath, aArgs) // spawns another program
|
||||
nsIFile(aPath) // returns an nsIFile obj
|
||||
help; // currently returns a list of available functions
|
||||
|
||||
Deprecated
|
||||
|
||||
chrome_to_path(aPath); // synonym for chromeToPath
|
||||
URL_to_path(aPath) // synonym for use urlToPath
|
||||
rm(aPath); // synonym for remove
|
||||
extension(aPath); // synonym for ext
|
||||
|
||||
Instructions:
|
||||
|
||||
First include this js file
|
||||
|
||||
var file = new FileUtils();
|
||||
|
||||
Examples:
|
||||
|
||||
var path='/usr/X11R6/bin/Eterm';
|
||||
file.spawn(path, ['-e/usr/bin/vi']);
|
||||
*note* all args passed to spawn must be in the form of an array
|
||||
|
||||
// to list help
|
||||
dump(file.help);
|
||||
|
||||
Warning: these API's are not for religious types
|
||||
|
||||
*/
|
||||
|
||||
// Make sure jslib is loaded
|
||||
if (typeof(JS_LIB_LOADED)=='boolean')
|
||||
{
|
||||
|
||||
/****************** Globals **********************/
|
||||
|
||||
const JS_FILEUTILS_FILE = "fileUtils.js";
|
||||
const JS_FILEUTILS_LOADED = true;
|
||||
|
||||
const JS_FILEUTILS_LOCAL_CID = "@mozilla.org/file/local;1";
|
||||
const JS_FILEUTILS_FILESPEC_PROGID = '@mozilla.org/filespec;1';
|
||||
const JS_FILEUTILS_NETWORK_STD_CID = '@mozilla.org/network/standard-url;1';
|
||||
const JS_FILEUTILS_SIMPLEURI_PROGID = "@mozilla.org/network/simple-uri;1";
|
||||
const JS_FILEUTILS_CHROME_REG_PROGID = '@mozilla.org/chrome/chrome-registry;1';
|
||||
const JS_FILEUTILS_DR_PROGID = "@mozilla.org/file/directory_service;1";
|
||||
const JS_FILEUTILS_PROCESS_CID = "@mozilla.org/process/util;1";
|
||||
|
||||
const JS_FILEUTILS_I_LOCAL_FILE = "nsILocalFile";
|
||||
const JS_FILEUTILS_INIT_W_PATH = "initWithPath";
|
||||
const JS_FILEUTILS_I_PROPS = "nsIProperties";
|
||||
|
||||
const JS_FILEUTILS_CHROME_DIR = "AChrom";
|
||||
|
||||
const JS_FILEUTILS_OK = true;
|
||||
const JS_FILEUTILS_FilePath = new
|
||||
C.Constructor(JS_FILEUTILS_LOCAL_CID, JS_FILEUTILS_I_LOCAL_FILE, JS_FILEUTILS_INIT_W_PATH);
|
||||
|
||||
const JS_FILEUTILS_I_URI = C.interfaces.nsIURI;
|
||||
const JS_FILEUTILS_I_FILEURL = C.interfaces.nsIFileURL;
|
||||
const JS_FILEUTILS_I_PROCESS = C.interfaces.nsIProcess;
|
||||
|
||||
/****************** FileUtils Object Class *********************/
|
||||
function FileUtils() {
|
||||
include (jslib_dirutils);
|
||||
this.mDirUtils = new DirUtils();
|
||||
} // constructor
|
||||
|
||||
FileUtils.prototype = {
|
||||
|
||||
mFileInst : null,
|
||||
mDirUtils : null,
|
||||
|
||||
/********************* CHROME_TO_PATH ***************************/
|
||||
// this is here for backward compatability but is deprecated --pete
|
||||
chrome_to_path : function (aPath) { return this.chromeToPath(aPath); },
|
||||
|
||||
chromeToPath : function (aPath)
|
||||
{
|
||||
if (!aPath) {
|
||||
jslibError(null, "(no path defined)", "NS_ERROR_INVALID_ARG", JS_FILEUTILS_FILE+":chromeToPath");
|
||||
return null;
|
||||
}
|
||||
|
||||
var uri = C.classes[JS_FILEUTILS_SIMPLEURI_PROGID].createInstance(JS_FILEUTILS_I_URI);
|
||||
var rv;
|
||||
|
||||
if (/^chrome:/.test(aPath)) {
|
||||
try {
|
||||
var cr = C.classes[JS_FILEUTILS_CHROME_REG_PROGID].getService();
|
||||
if (cr) {
|
||||
cr = cr.QueryInterface(C.interfaces.nsIChromeRegistry);
|
||||
uri.spec = aPath;
|
||||
uri.spec = cr.convertChromeURL(uri);
|
||||
rv = uri.path;
|
||||
}
|
||||
} catch(e) {}
|
||||
|
||||
if (/^\/|\\|:chrome/.test(rv)) {
|
||||
try {
|
||||
// prepend the system path to this process dir
|
||||
rv = "file://"+this.mDirUtils.getCurProcDir()+rv;
|
||||
} catch (e) {
|
||||
jslibError(e, "(problem getting file instance)", "NS_ERROR_UNEXPECTED",
|
||||
JS_FILEUTILS_FILE+":chromeToPath");
|
||||
rv = "";
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
else if (/^file:/.test(aPath)) {
|
||||
rv = this.urlToPath(aPath);
|
||||
} else
|
||||
rv = "";
|
||||
|
||||
return rv;
|
||||
},
|
||||
|
||||
/********************* URL_TO_PATH ***************************/
|
||||
URL_to_path : function (aPath){ return this.urlToPath(aPath); },
|
||||
|
||||
urlToPath : function (aPath)
|
||||
{
|
||||
if (!aPath) {
|
||||
jslibError(null, "(no path defined)", "NS_ERROR_INVALID_ARG", JS_FILEUTILS_FILE+":urlToPath");
|
||||
return null;
|
||||
}
|
||||
|
||||
var rv;
|
||||
if (aPath.search(/^file:/) == 0) {
|
||||
try {
|
||||
var uri = C.classes[JS_FILEUTILS_NETWORK_STD_CID].createInstance(JS_FILEUTILS_I_FILEURL);
|
||||
uri.spec = aPath;
|
||||
rv = uri.file.path;
|
||||
} catch (e) {
|
||||
jslibError(e, "(problem getting file instance)", "NS_ERROR_UNEXPECTED", JS_FILEUTILS_FILE+":urlToPath");
|
||||
rv=null;
|
||||
}
|
||||
}
|
||||
|
||||
return rv;
|
||||
},
|
||||
|
||||
/********************* EXISTS ***************************/
|
||||
exists : function (aPath)
|
||||
{
|
||||
if (!aPath) {
|
||||
jslibError(null, "(no path defined)", "NS_ERROR_INVALID_ARG", JS_FILEUTILS_FILE+":exists");
|
||||
return null;
|
||||
}
|
||||
|
||||
var rv;
|
||||
try {
|
||||
var file = new JS_FILEUTILS_FilePath(aPath);
|
||||
rv=file.exists();
|
||||
} catch(e) {
|
||||
jslibError(e, "(problem getting file instance)", "NS_ERROR_UNEXPECTED", JS_FILEUTILS_FILE+":exists");
|
||||
rv=null;
|
||||
}
|
||||
|
||||
return rv;
|
||||
},
|
||||
|
||||
/********************* RM *******************************/
|
||||
rm : function (aPath) { return this.remove(aPath); },
|
||||
|
||||
remove : function (aPath)
|
||||
{
|
||||
if (!aPath) {
|
||||
jslibError(null, "(no path defined)", "NS_ERROR_INVALID_ARG", JS_FILEUTILS_FILE+":remove");
|
||||
return null;
|
||||
}
|
||||
|
||||
if (!this.exists(aPath)) {
|
||||
jslibError(null, "(file doesn't exist)", "NS_ERROR_UNEXPECTED", JS_FILEUTILS_FILE+":remove");
|
||||
return null;
|
||||
}
|
||||
|
||||
var rv;
|
||||
|
||||
try {
|
||||
var fileInst = new JS_FILEUTILS_FilePath(aPath);
|
||||
if (fileInst.isDirectory()) {
|
||||
jslibError(null, "path is a dir. use rmdir()", "NS_ERROR_INVALID_ARG", JS_FILEUTILS_FILE+":remove");
|
||||
return null;
|
||||
}
|
||||
|
||||
fileInst.remove(false);
|
||||
rv = C.results.NS_OK;
|
||||
} catch (e) {
|
||||
jslibError(e, "(unexpected)", "NS_ERROR_UNEXPECTED", JS_FILEUTILS_FILE+":urlToPath");
|
||||
rv=null;
|
||||
}
|
||||
|
||||
return rv;
|
||||
},
|
||||
|
||||
/********************* COPY *****************************/
|
||||
copy : function (aSource, aDest)
|
||||
{
|
||||
if (!aSource || !aDest) {
|
||||
jslibError(null, "(no path defined)", "NS_ERROR_INVALID_ARG", JS_FILEUTILS_FILE+":copy");
|
||||
return null;
|
||||
}
|
||||
|
||||
if (!this.exists(aSource)) {
|
||||
jslibError(null, "(file doesn't exist)", "NS_ERROR_UNEXPECTED", JS_FILEUTILS_FILE+":copy");
|
||||
return null;
|
||||
}
|
||||
|
||||
var rv;
|
||||
|
||||
try {
|
||||
var fileInst = new JS_FILEUTILS_FilePath(aSource);
|
||||
var dir = new JS_FILEUTILS_FilePath(aDest);
|
||||
var copyName = fileInst.leafName;
|
||||
|
||||
if (fileInst.isDirectory()) {
|
||||
jslibError(null, "(cannot copy directory)", "NS_ERROR_FAILURE", JS_FILEUTILS_FILE+":copy");
|
||||
return null;
|
||||
}
|
||||
|
||||
if (!this.exists(aDest) || !dir.isDirectory()) {
|
||||
copyName = dir.leafName;
|
||||
dir = new JS_FILEUTILS_FilePath(dir.path.replace(copyName,''));
|
||||
|
||||
if (!this.exists(dir.path)) {
|
||||
jslibError(null, "(dest "+dir.path+" doesn't exist)", "NS_ERROR_FAILURE", JS_FILEUTILS_FILE+":copy");
|
||||
return null;
|
||||
}
|
||||
|
||||
if (!dir.isDirectory()) {
|
||||
jslibError(null, "(dest "+dir.path+" is not a valid path)", "NS_ERROR_FAILURE", JS_FILEUTILS_FILE+":copy");
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
if (this.exists(this.append(dir.path, copyName))) {
|
||||
jslibError(null, "(dest "+this.append(dir.path, copyName)+" already exists)", "NS_ERROR_FAILURE", JS_FILEUTILS_FILE+":copy");
|
||||
return null;
|
||||
}
|
||||
|
||||
rv=fileInst.copyTo(dir, copyName);
|
||||
rv = C.results.NS_OK;
|
||||
} catch (e) {
|
||||
jslibError(e, "(unexpected error)", "NS_ERROR_UNEXPECTED", JS_FILEUTILS_FILE+":copy");
|
||||
rv=null;
|
||||
}
|
||||
|
||||
return rv;
|
||||
},
|
||||
|
||||
/********************* LEAF *****************************/
|
||||
leaf : function (aPath)
|
||||
{
|
||||
if (!aPath) {
|
||||
jslibError(null, "(no path defined)", "NS_ERROR_INVALID_ARG", JS_FILEUTILS_FILE+":leaf");
|
||||
return null;
|
||||
}
|
||||
|
||||
if (!this.exists(aPath)) {
|
||||
jslibError(null, "(file doesn't exist)", "NS_ERROR_UNEXPECTED", JS_FILEUTILS_FILE+":leaf");
|
||||
return null;
|
||||
}
|
||||
|
||||
var rv;
|
||||
|
||||
try {
|
||||
var fileInst = new JS_FILEUTILS_FilePath(aPath);
|
||||
rv=fileInst.leafName;
|
||||
}
|
||||
|
||||
catch(e) {
|
||||
jslibError(e, "(unexpected error)", "NS_ERROR_UNEXPECTED", JS_FILEUTILS_FILE+":leaf");
|
||||
rv=null;
|
||||
}
|
||||
|
||||
return rv;
|
||||
},
|
||||
|
||||
/********************* APPEND ***************************/
|
||||
append : function (aDirPath, aFileName)
|
||||
{
|
||||
if (!aDirPath || !aFileName) {
|
||||
jslibError(null, "(no path defined)", "NS_ERROR_INVALID_ARG", JS_FILEUTILS_FILE+":append");
|
||||
return null;
|
||||
}
|
||||
|
||||
if (!this.exists(aDirPath)) {
|
||||
jslibError(null, "(file doesn't exist)", "NS_ERROR_UNEXPECTED", JS_FILEUTILS_FILE+":append");
|
||||
return null;
|
||||
}
|
||||
|
||||
var rv;
|
||||
|
||||
try {
|
||||
var fileInst = new JS_FILEUTILS_FilePath(aDirPath);
|
||||
if (fileInst.exists() && !fileInst.isDirectory()) {
|
||||
jslibError(null, aDirPath+" is not a dir", "NS_ERROR_INVALID_ARG", JS_FILEUTILS_FILE+":append");
|
||||
return null;
|
||||
}
|
||||
|
||||
fileInst.append(aFileName);
|
||||
rv=fileInst.path;
|
||||
delete fileInst;
|
||||
} catch(e) {
|
||||
jslibError(e?e:null, "(unexpected error)", "NS_ERROR_UNEXPECTED", JS_FILEUTILS_FILE+":append");
|
||||
rv=null;
|
||||
}
|
||||
|
||||
return rv;
|
||||
},
|
||||
|
||||
/********************* VALIDATE PERMISSIONS *************/
|
||||
validatePermissions : function(aNum)
|
||||
{
|
||||
if ( parseInt(aNum.toString(10).length) < 3 )
|
||||
return false;
|
||||
|
||||
return JS_FILEUTILS_OK;
|
||||
},
|
||||
|
||||
/********************* PERMISSIONS **********************/
|
||||
permissions : function (aPath)
|
||||
{
|
||||
if (!aPath) {
|
||||
jslibError(null, "(no path defined)", "NS_ERROR_INVALID_ARG", JS_FILEUTILS_FILE+":permissions");
|
||||
return null;
|
||||
}
|
||||
|
||||
if (!this.exists(aPath)) {
|
||||
jslibError(null, "(file doesn't exist)", "NS_ERROR_UNEXPECTED", JS_FILEUTILS_FILE+":permissions");
|
||||
return null;
|
||||
}
|
||||
|
||||
var rv;
|
||||
|
||||
try {
|
||||
rv=(new JS_FILEUTILS_FilePath(aPath)).permissions.toString(8);
|
||||
} catch(e) {
|
||||
jslibError(e, "(unexpected error)", "NS_ERROR_UNEXPECTED", JS_FILEUTILS_FILE+":permissions");
|
||||
rv=null;
|
||||
}
|
||||
|
||||
return rv;
|
||||
},
|
||||
|
||||
/********************* MODIFIED *************************/
|
||||
dateModified : function (aPath)
|
||||
{
|
||||
if (!aPath) {
|
||||
jslibError(null, "(no path defined)", "NS_ERROR_INVALID_ARG", JS_FILEUTILS_FILE+":dateModified");
|
||||
return null;
|
||||
}
|
||||
|
||||
if (!this.exists(aPath)) {
|
||||
jslibError(null, "(file doesn't exist)", "NS_ERROR_UNEXPECTED", JS_FILEUTILS_FILE+":dateModified");
|
||||
return null;
|
||||
}
|
||||
|
||||
var rv;
|
||||
|
||||
try {
|
||||
var date = new Date((new JS_FILEUTILS_FilePath(aPath)).lastModificationDate).toLocaleString();
|
||||
rv=date;
|
||||
} catch(e) {
|
||||
jslibError(e, "(unexpected error)", "NS_ERROR_UNEXPECTED", JS_FILEUTILS_FILE+":dateModified");
|
||||
rv=null;
|
||||
}
|
||||
|
||||
return rv;
|
||||
},
|
||||
|
||||
/********************* SIZE *****************************/
|
||||
size : function (aPath)
|
||||
{
|
||||
if (!aPath) {
|
||||
jslibError(null, "(no path defined)", "NS_ERROR_INVALID_ARG", JS_FILEUTILS_FILE+":size");
|
||||
return null;
|
||||
}
|
||||
|
||||
if (!this.exists(aPath)) {
|
||||
jslibError(null, "(file doesn't exist)", "NS_ERROR_UNEXPECTED", JS_FILEUTILS_FILE+":size");
|
||||
return null;
|
||||
}
|
||||
|
||||
var rv;
|
||||
|
||||
try {
|
||||
rv = (new JS_FILEUTILS_FilePath(aPath)).fileSize;
|
||||
} catch(e) {
|
||||
jslibError(e, "(unexpected error)", "NS_ERROR_UNEXPECTED", JS_FILEUTILS_FILE+":size");
|
||||
rv=0;
|
||||
}
|
||||
|
||||
return rv;
|
||||
},
|
||||
|
||||
/********************* EXTENSION ************************/
|
||||
extension : function (aPath){ return this.ext(aPath); },
|
||||
|
||||
ext : function (aPath)
|
||||
{
|
||||
if (!aPath) {
|
||||
jslibError(null, "(no path defined)", "NS_ERROR_INVALID_ARG", JS_FILEUTILS_FILE+":ext");
|
||||
return null;
|
||||
}
|
||||
|
||||
if (!this.exists(aPath)) {
|
||||
jslibError(null, "(file doesn't exist)", "NS_ERROR_UNEXPECTED", JS_FILEUTILS_FILE+":ext");
|
||||
return null;
|
||||
}
|
||||
|
||||
var rv;
|
||||
|
||||
try {
|
||||
var leafName = (new JS_FILEUTILS_FilePath(aPath)).leafName;
|
||||
var dotIndex = leafName.lastIndexOf('.');
|
||||
rv=(dotIndex >= 0) ? leafName.substring(dotIndex+1) : "";
|
||||
} catch(e) {
|
||||
jslibError(e, "(unexpected error)", "NS_ERROR_UNEXPECTED", JS_FILEUTILS_FILE+":ext");
|
||||
rv=null;
|
||||
}
|
||||
|
||||
return rv;
|
||||
},
|
||||
|
||||
/********************* DIRPATH **************************/
|
||||
dirPath : function (aPath){ return this.parent(aPath); },
|
||||
|
||||
parent : function (aPath)
|
||||
{
|
||||
if (!aPath) {
|
||||
jslibError(null, "(no path defined)", "NS_ERROR_INVALID_ARG", JS_FILEUTILS_FILE+":parent");
|
||||
return null;
|
||||
}
|
||||
|
||||
var rv;
|
||||
|
||||
try {
|
||||
var fileInst = new JS_FILEUTILS_FilePath(aPath);
|
||||
|
||||
if (!fileInst.exists()) {
|
||||
jslibError(null, "(file doesn't exist)", "NS_ERROR_FAILURE", JS_FILEUTILS_FILE+":parent");
|
||||
return null;
|
||||
}
|
||||
|
||||
if (fileInst.isFile())
|
||||
rv=fileInst.parent.path;
|
||||
|
||||
else if (fileInst.isDirectory())
|
||||
rv=fileInst.path;
|
||||
|
||||
else
|
||||
rv=null;
|
||||
}
|
||||
|
||||
catch (e) {
|
||||
jslibError(e, "(problem getting file instance)", "NS_ERROR_UNEXPECTED", JS_FILEUTILS_FILE+":parent");
|
||||
rv=null;
|
||||
}
|
||||
|
||||
return rv;
|
||||
},
|
||||
|
||||
/********************* SPAWN ****************************/
|
||||
run : function (aPath, aArgs) { this.spawn(aPath, aArgs); },
|
||||
spawn : function (aPath, aArgs)
|
||||
/*
|
||||
* Trys to execute the requested file as a separate *non-blocking* process.
|
||||
*
|
||||
* Passes the supplied *array* of arguments on the command line if
|
||||
* the OS supports it.
|
||||
*
|
||||
*/
|
||||
{
|
||||
if (!aPath) {
|
||||
jslibError(null, "(no path defined)", "NS_ERROR_INVALID_ARG",
|
||||
JS_FILEUTILS_FILE+":spawn");
|
||||
return null;
|
||||
}
|
||||
|
||||
if (!this.exists(aPath)) {
|
||||
jslibError(null, "(file doesn't exist)", "NS_ERROR_UNEXPECTED",
|
||||
JS_FILEUTILS_FILE+":spawn");
|
||||
return null;
|
||||
}
|
||||
|
||||
var len=0;
|
||||
|
||||
if (aArgs)
|
||||
len = aArgs.length;
|
||||
else
|
||||
aArgs=null;
|
||||
|
||||
var rv;
|
||||
|
||||
try {
|
||||
var fileInst = new JS_FILEUTILS_FilePath(aPath);
|
||||
|
||||
if (!fileInst.isExecutable()) {
|
||||
jslibError(null, "(File is not executable)", "NS_ERROR_INVALID_ARG",
|
||||
JS_FILEUTILS_FILE+":spawn");
|
||||
return null;
|
||||
}
|
||||
|
||||
if (fileInst.isDirectory()) {
|
||||
jslibError(null, "(File is not a program)", "NS_ERROR_UNEXPECTED",
|
||||
JS_FILEUTILS_FILE+":spawn");
|
||||
return null;
|
||||
} else {
|
||||
// Create and execute the process...
|
||||
/*
|
||||
* NOTE: The first argument of the process instance's 'run' method
|
||||
* below specifies the blocking state (false = non-blocking).
|
||||
* The last argument, in theory, contains the process ID (PID)
|
||||
* on return if a variable is supplied--not sure how to implement
|
||||
* this with JavaScript though.
|
||||
*/
|
||||
try {
|
||||
var theProcess = C.classes[JS_FILEUTILS_PROCESS_CID].
|
||||
createInstance(JS_FILEUTILS_I_PROCESS);
|
||||
|
||||
theProcess.init(fileInst);
|
||||
|
||||
rv = theProcess.run(false, aArgs, len);
|
||||
jslib_debug("rv="+rv);
|
||||
} catch (e) {
|
||||
jslibError(e, "(problem spawing process)", "NS_ERROR_UNEXPECTED",
|
||||
JS_FILEUTILS_FILE+":spawn");
|
||||
rv=null;
|
||||
}
|
||||
}
|
||||
} catch (e) {
|
||||
jslibError(e, "(problem getting file instance)", "NS_ERROR_UNEXPECTED",
|
||||
JS_FILEUTILS_FILE+":spawn");
|
||||
rv=null;
|
||||
}
|
||||
|
||||
return rv;
|
||||
},
|
||||
|
||||
/********************* nsIFILE **************************/
|
||||
nsIFile : function (aPath)
|
||||
{
|
||||
if (!aPath) {
|
||||
jslibError(null, "(no path defined)", "NS_ERROR_INVALID_ARG", JS_FILEUTILS_FILE+":nsIFile");
|
||||
return null;
|
||||
}
|
||||
|
||||
var rv;
|
||||
|
||||
try {
|
||||
rv = new JS_FILEUTILS_FilePath(aPath);
|
||||
} catch (e) {
|
||||
jslibError(e, "(problem getting file instance)", "NS_ERROR_UNEXPECTED", JS_FILEUTILS_FILE+":nsIFile");
|
||||
rv = null;
|
||||
}
|
||||
|
||||
return rv;
|
||||
},
|
||||
|
||||
/********************* HELP *****************************/
|
||||
get help()
|
||||
{
|
||||
var help =
|
||||
|
||||
"\n\nFunction List:\n" +
|
||||
"\n" +
|
||||
" exists(aPath);\n" +
|
||||
" chromeToPath(aPath);\n" +
|
||||
" urlToPath(aPath);\n" +
|
||||
" append(aDirPath, aFileName);\n" +
|
||||
" remove(aPath);\n" +
|
||||
" copy(aSource, aDest);\n" +
|
||||
" leaf(aPath);\n" +
|
||||
" permissions(aPath);\n" +
|
||||
" dateModified(aPath);\n" +
|
||||
" size(aPath);\n" +
|
||||
" ext(aPath);\n" +
|
||||
" parent(aPath);\n" +
|
||||
" run(aPath, aArgs);\n" +
|
||||
" nsIFile(aPath);\n" +
|
||||
" help;\n";
|
||||
|
||||
return help;
|
||||
}
|
||||
|
||||
};
|
||||
|
||||
jslibDebug('*** load: '+JS_FILEUTILS_FILE+' OK');
|
||||
|
||||
} // END BLOCK JS_LIB_LOADED CHECK
|
||||
|
||||
// If jslib base library is not loaded, dump this error.
|
||||
else
|
||||
{
|
||||
dump("JS_FILE library not loaded:\n" +
|
||||
" \tTo load use: chrome://jslib/content/jslib.js\n" +
|
||||
" \tThen: include('chrome://jslib/content/io/fileUtils.js');\n\n");
|
||||
}
|
||||
|
|
@ -1,667 +0,0 @@
|
|||
/*** -*- Mode: Javascript; tab-width: 2;
|
||||
|
||||
The contents of this file are subject to the Mozilla Public
|
||||
License Version 1.1 (the "License"); you may not use this file
|
||||
except in compliance with the License. You may obtain a copy of
|
||||
the License at http://www.mozilla.org/MPL/
|
||||
|
||||
Software distributed under the License is distributed on an "AS
|
||||
IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
|
||||
implied. See the License for the specific language governing
|
||||
rights and limitations under the License.
|
||||
|
||||
The Original Code is Collabnet code.
|
||||
The Initial Developer of the Original Code is Collabnet.
|
||||
|
||||
Portions created by Collabnet are
|
||||
Copyright (C) 2000 Collabnet. All
|
||||
Rights Reserved.
|
||||
|
||||
Contributor(s): Pete Collins,
|
||||
Doug Turner,
|
||||
Brendan Eich,
|
||||
Warren Harris,
|
||||
Eric Plaster,
|
||||
Martin Kutschker
|
||||
***/
|
||||
|
||||
if (typeof(JS_LIB_LOADED)=='boolean') {
|
||||
|
||||
/***************************
|
||||
* Globals *
|
||||
***************************/
|
||||
|
||||
const JS_FILESYSTEM_LOADED = true;
|
||||
const JS_FILESYSTEM_FILE = "filesystem.js";
|
||||
const JS_FS_LOCAL_CID = "@mozilla.org/file/local;1";
|
||||
const JS_FS_DIR_CID = "@mozilla.org/file/directory_service;1";
|
||||
const JS_FS_NETWORK_CID = '@mozilla.org/network/standard-url;1';
|
||||
const JS_FS_URL_COMP = "nsIURL";
|
||||
const JS_FS_I_LOCAL_FILE = "nsILocalFile";
|
||||
const JS_FS_DIR_I_PROPS = "nsIProperties";
|
||||
const JS_FS_INIT_W_PATH = "initWithPath";
|
||||
const JS_FS_CHROME_DIR = "AChrom";
|
||||
const JS_FS_USR_DEFAULT = "DefProfRt";
|
||||
const JS_FS_PREF_DIR = "PrefD";
|
||||
const JS_FS_OK = true;
|
||||
const JS_FS_File_Path = new Components.Constructor
|
||||
( JS_FS_LOCAL_CID, JS_FS_I_LOCAL_FILE, JS_FS_INIT_W_PATH);
|
||||
const JS_FS_Dir = new Components.Constructor
|
||||
(JS_FS_DIR_CID, JS_FS_DIR_I_PROPS);
|
||||
const JS_FS_URL = new Components.Constructor
|
||||
(JS_FS_NETWORK_CID, JS_FS_URL_COMP);
|
||||
|
||||
/***************************
|
||||
* Globals *
|
||||
***************************/
|
||||
|
||||
/***************************
|
||||
* FileSystem Object Class *
|
||||
***************************/
|
||||
function FileSystem(aPath) {
|
||||
|
||||
return (aPath?this.initPath(arguments):void(null));
|
||||
|
||||
} // constructor
|
||||
|
||||
/***************************
|
||||
* FileSystem Prototype *
|
||||
***************************/
|
||||
FileSystem.prototype = {
|
||||
|
||||
mPath : null,
|
||||
mFileInst : null,
|
||||
|
||||
|
||||
/***************************
|
||||
* INIT PATH *
|
||||
***************************/
|
||||
initPath : function(args)
|
||||
{
|
||||
|
||||
// check if the argument is a file:// url
|
||||
if(typeof(args)=='object') {
|
||||
for (var i=0; i<args.length; i++) {
|
||||
if(args[i].search(/^file:/) == 0) {
|
||||
try {
|
||||
var fileURL= new JS_FS_URL();
|
||||
fileURL.spec=args[i];
|
||||
args[i] = fileURL.path;
|
||||
} catch (e) {
|
||||
jslibError(e, "(problem getting file instance)",
|
||||
"NS_ERROR_UNEXPECTED", JS_FILESYSTEM_FILE+":initPath");
|
||||
rv=null;
|
||||
}
|
||||
}
|
||||
}
|
||||
} else {
|
||||
if(args.search(/^file:/) == 0) {
|
||||
try {
|
||||
var fileURL= new JS_FS_URL();
|
||||
fileURL.spec=args;
|
||||
args = fileURL.path;
|
||||
} catch (e) {
|
||||
jslibError(e, "(problem getting file instance)",
|
||||
"NS_ERROR_UNEXPECTED", JS_FILESYSTEM_FILE+":initPath");
|
||||
rv=null;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* If you are wondering what all this extra cruft is, well
|
||||
* this is here so you can reinitialize 'this' with a new path
|
||||
*/
|
||||
var rv = null;
|
||||
try {
|
||||
if (typeof(args)=='object') {
|
||||
this.mFileInst = new JS_FS_File_Path(args[0]?args[0]:this.mPath);
|
||||
if (args.length>1)
|
||||
for (i=1; i<args.length; i++)
|
||||
this.mFileInst.append(args[i]);
|
||||
(args[0] || this.mPath)?rv=this.mPath = this.mFileInst.path:rv=null;
|
||||
} else {
|
||||
this.mFileInst = new JS_FS_File_Path(args?args:this.mPath);
|
||||
this.mFileInst.path?rv=this.mPath = this.mFileInst.path:rv=null;
|
||||
}
|
||||
} catch(e) {
|
||||
jslibError(e?e:null,
|
||||
"initPath (nsILocalFile problem)",
|
||||
"NS_ERROR_UNEXPECTED",
|
||||
JS_FILESYSTEM_FILE+":initPath");
|
||||
rv = null;
|
||||
}
|
||||
return rv;
|
||||
},
|
||||
|
||||
/***************************
|
||||
* CHECK INST *
|
||||
***************************/
|
||||
checkInst : function ()
|
||||
{
|
||||
|
||||
if (!this.mFileInst) {
|
||||
jslibError(null,
|
||||
"(no path defined)",
|
||||
"NS_ERROR_NOT_INITIALIZED",
|
||||
JS_FILESYSTEM_FILE+":checkInstance");
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
},
|
||||
|
||||
/***************************
|
||||
* PATH *
|
||||
***************************/
|
||||
get path()
|
||||
{
|
||||
|
||||
if (!this.checkInst())
|
||||
throw Components.results.NS_ERROR_NOT_INITIALIZED;
|
||||
return this.mFileInst.path;
|
||||
},
|
||||
|
||||
/***************************
|
||||
* EXISTS *
|
||||
***************************/
|
||||
exists : function ()
|
||||
{
|
||||
|
||||
if (!this.checkInst())
|
||||
throw Components.results.NS_ERROR_NOT_INITIALIZED;
|
||||
var rv = false;
|
||||
try {
|
||||
rv = this.mFileInst.exists();
|
||||
} catch(e) {
|
||||
jslibError(e,
|
||||
"exists (nsILocalFile problem)",
|
||||
"NS_ERROR_UNEXPECTED",
|
||||
JS_FILESYSTEM_FILE+":exists");
|
||||
rv = false;
|
||||
}
|
||||
return rv;
|
||||
},
|
||||
|
||||
/***************************
|
||||
* GET LEAF *
|
||||
***************************/
|
||||
get leaf()
|
||||
{
|
||||
|
||||
if (!this.checkInst())
|
||||
throw Components.results.NS_ERROR_NOT_INITIALIZED;
|
||||
var rv = null;
|
||||
try {
|
||||
rv = this.mFileInst.leafName;
|
||||
} catch(e) {
|
||||
jslibError(e,
|
||||
"(problem getting file instance)",
|
||||
"NS_ERROR_FAILURE",
|
||||
JS_FILESYSTEM_FILE+":leaf");
|
||||
rv = null;
|
||||
}
|
||||
return rv;
|
||||
},
|
||||
|
||||
/***************************
|
||||
* SET LEAF *
|
||||
***************************/
|
||||
set leaf(aLeaf)
|
||||
{
|
||||
|
||||
if (!aLeaf) {
|
||||
jslibError(null,
|
||||
"(missing argument)",
|
||||
"NS_ERROR_INVALID_ARG",
|
||||
JS_FILESYSTEM_FILE+":leaf");
|
||||
return null;
|
||||
}
|
||||
if (!this.checkInst())
|
||||
throw Components.results.NS_ERROR_NOT_INITIALIZED;
|
||||
var rv = null;
|
||||
try {
|
||||
rv = (this.mFileInst.leafName=aLeaf);
|
||||
} catch(e) {
|
||||
jslibError(e,
|
||||
"(problem getting file instance)",
|
||||
"NS_ERROR_FAILURE",
|
||||
JS_FILESYSTEM_FILE+":leaf");
|
||||
rv = null;
|
||||
}
|
||||
return rv;
|
||||
},
|
||||
|
||||
/***************************
|
||||
* PARENT *
|
||||
***************************/
|
||||
get parent()
|
||||
{
|
||||
|
||||
if (!this.checkInst())
|
||||
throw Components.results.NS_ERROR_NOT_INITIALIZED;
|
||||
var rv = null;
|
||||
try {
|
||||
if (this.mFileInst.parent.isDirectory()) {
|
||||
if (typeof(JS_DIR_LOADED)!='boolean')
|
||||
include(JS_LIB_PATH+'io/dir.js');
|
||||
rv = new Dir(this.mFileInst.parent.path);
|
||||
}
|
||||
} catch (e) {
|
||||
jslibError(e,
|
||||
"(problem getting file parent)",
|
||||
"NS_ERROR_UNEXPECTED",
|
||||
JS_FILESYSTEM_FILE+":parent");
|
||||
rv = null;
|
||||
}
|
||||
return rv;
|
||||
},
|
||||
|
||||
/***************************
|
||||
* GET PERMISSIONS *
|
||||
***************************/
|
||||
get permissions()
|
||||
{
|
||||
|
||||
if (!this.checkInst())
|
||||
throw Components.results.NS_ERROR_NOT_INITIALIZED;
|
||||
if (!this.exists()) {
|
||||
jslibError(null,
|
||||
"(file doesn't exist)",
|
||||
"NS_ERROR_FAILURE",
|
||||
JS_FILESYSTEM_FILE+":permisions");
|
||||
return null;
|
||||
}
|
||||
var rv = null;
|
||||
try {
|
||||
rv = this.mFileInst.permissions.toString(8);
|
||||
} catch(e) {
|
||||
jslibError(e,
|
||||
"(problem getting file instance)",
|
||||
"NS_ERROR_UNEXPECTED",
|
||||
JS_FILESYSTEM_FILE+":permissions");
|
||||
rv = null;
|
||||
}
|
||||
return rv;
|
||||
},
|
||||
|
||||
/***************************
|
||||
* SET PERMISSIONS *
|
||||
***************************/
|
||||
set permissions(aPermission)
|
||||
{
|
||||
|
||||
if (!this.checkInst())
|
||||
throw Components.results.NS_ERROR_NOT_INITIALIZED;
|
||||
|
||||
if (!aPermission) {
|
||||
jslibError(null,
|
||||
"(no new permission defined)",
|
||||
"NS_ERROR_INVALID_ARG",
|
||||
JS_FILESYSTEM_FILE+":permissions");
|
||||
return null;
|
||||
}
|
||||
if (!this.exists()) {
|
||||
jslibError(null,
|
||||
"(file doesn't exist)",
|
||||
"NS_ERROR_FAILURE",
|
||||
JS_FILESYSTEM_FILE+":permisions");
|
||||
return null;
|
||||
}
|
||||
if (!this.validatePermissions(aPermission)) {
|
||||
jslibError(null,
|
||||
"(invalid permission argument)",
|
||||
"NS_ERROR_INVALID_ARG",
|
||||
JS_FILESYSTEM_FILE+":permissions");
|
||||
return null;
|
||||
}
|
||||
var rv = null;
|
||||
try {
|
||||
rv = this.mFileInst.permissions=aPermission;
|
||||
} catch(e) {
|
||||
jslibError(e,
|
||||
"(problem getting file instance)",
|
||||
"NS_ERROR_UNEXPECTED",
|
||||
JS_FILESYSTEM_FILE+":permissions");
|
||||
rv = null;
|
||||
}
|
||||
return rv;
|
||||
|
||||
},
|
||||
|
||||
/***************************
|
||||
* VALIDATE PERMISSIONS *
|
||||
***************************/
|
||||
validatePermissions : function (aNum)
|
||||
{
|
||||
if (typeof(aNum)!='number')
|
||||
return false;
|
||||
if (parseInt(aNum.toString(10).length) < 3 )
|
||||
return false;
|
||||
return true;
|
||||
},
|
||||
|
||||
/***************************
|
||||
* MODIFIED *
|
||||
***************************/
|
||||
get dateModified()
|
||||
{
|
||||
|
||||
if (!this.checkInst())
|
||||
throw Components.results.NS_ERROR_NOT_INITIALIZED;
|
||||
if (!this.exists()) {
|
||||
jslibError(null,
|
||||
"(file doesn't exist)",
|
||||
"NS_ERROR_FAILURE",
|
||||
JS_FILESYSTEM_FILE+":dateModified");
|
||||
return null;
|
||||
}
|
||||
var rv = null;
|
||||
try {
|
||||
rv = (new Date(this.mFileInst.lastModifiedTime));
|
||||
} catch(e) {
|
||||
jslibError(e,
|
||||
"(problem getting file instance)",
|
||||
"NS_ERROR_UNEXPECTED",
|
||||
JS_FILESYSTEM_FILE+":dateModified");
|
||||
rv = null;
|
||||
}
|
||||
return rv;
|
||||
},
|
||||
|
||||
/***************************
|
||||
* RESET CACHE *
|
||||
***************************/
|
||||
resetCache : function()
|
||||
{
|
||||
|
||||
if (!this.checkInst())
|
||||
throw Components.results.NS_ERROR_NOT_INITIALIZED;
|
||||
var rv = false;
|
||||
if (this.mPath) {
|
||||
delete this.mFileInst;
|
||||
try {
|
||||
this.mFileInst=new JS_FS_File_Path(this.mPath);
|
||||
rv = true;
|
||||
} catch(e) {
|
||||
jslibError(e,
|
||||
"(unable to get nsILocalFile)",
|
||||
"NS_ERROR_UNEXPECTED",
|
||||
JS_FILESYSTEM_FILE+":resetCache");
|
||||
rv = false;
|
||||
}
|
||||
}
|
||||
return rv;
|
||||
},
|
||||
|
||||
/***************************
|
||||
* nsIFILE *
|
||||
***************************/
|
||||
get nsIFile()
|
||||
{
|
||||
|
||||
if (!this.checkInst())
|
||||
throw Components.results.NS_ERROR_NOT_INITIALIZED;
|
||||
var rv = null;
|
||||
try {
|
||||
rv = this.mFileInst.clone();
|
||||
} catch (e) {
|
||||
jslibError(e,
|
||||
"(problem getting file instance)",
|
||||
"NS_ERROR_UNEXPECTED",
|
||||
JS_FILESYSTEM_FILE+":nsIFile");
|
||||
rv = null;
|
||||
}
|
||||
return rv;
|
||||
},
|
||||
|
||||
/***************************
|
||||
* NOTE: after a move *
|
||||
* successful, 'this' will *
|
||||
* be reinitialized *
|
||||
* to the moved file! *
|
||||
***************************/
|
||||
move : function (aDest)
|
||||
{
|
||||
|
||||
if (!this.checkInst())
|
||||
throw Components.results.NS_ERROR_NOT_INITIALIZED;
|
||||
if (!aDest) {
|
||||
jslibError(null,
|
||||
"(no destination path defined)",
|
||||
"NS_ERROR_INVALID_ARG",
|
||||
JS_FILESYSTEM_FILE+":move");
|
||||
return false;
|
||||
}
|
||||
if (!this.mPath) {
|
||||
jslibError(null,
|
||||
"(no path defined)",
|
||||
"NS_ERROR_INVALID_ARG",
|
||||
JS_FILESYSTEM_FILE+":move");
|
||||
return false;
|
||||
}
|
||||
var rv = null;
|
||||
var newName=null;
|
||||
try {
|
||||
var f = new JS_FS_File_Path(aDest);
|
||||
if (f.exists() && !f.isDirectory()) {
|
||||
jslibError(null,
|
||||
"(destination file exists remove it)",
|
||||
"NS_ERROR_INVALID_ARG",
|
||||
JS_FILESYSTEM_FILE+":move");
|
||||
return false;
|
||||
}
|
||||
if (f.equals(this.mFileInst)) {
|
||||
jslibError(null,
|
||||
"(destination file is this file)",
|
||||
"NS_ERROR_INVALID_ARG",
|
||||
JS_FILESYSTEM_FILE+":move");
|
||||
return false;
|
||||
}
|
||||
if (!f.exists() && f.parent.exists())
|
||||
newName=f.leafName;
|
||||
if (f.equals(this.mFileInst.parent) && !newName) {
|
||||
jslibError(null,
|
||||
"(destination file is this file)",
|
||||
"NS_ERROR_INVALID_ARG",
|
||||
JS_FILESYSTEM_FILE+":move");
|
||||
return false;
|
||||
}
|
||||
var dir=f.parent;
|
||||
if (dir.exists() && dir.isDirectory()) {
|
||||
jslibDebug(newName);
|
||||
this.mFileInst.moveTo(dir, newName);
|
||||
jslibDebug(JS_FILESYSTEM_FILE+':move successful!\n');
|
||||
this.mPath=f.path;
|
||||
this.resetCache();
|
||||
delete dir;
|
||||
rv = true;
|
||||
} else {
|
||||
jslibError(null,
|
||||
"(destination "+dir.parent.path+" doesn't exists)",
|
||||
"NS_ERROR_INVALID_ARG",
|
||||
JS_FILESYSTEM_FILE+":move");
|
||||
return false;
|
||||
}
|
||||
} catch (e) {
|
||||
jslibError(e,
|
||||
"(problem getting file instance)",
|
||||
"NS_ERROR_UNEXPECTED",
|
||||
JS_FILESYSTEM_FILE+":move");
|
||||
rv = false;
|
||||
}
|
||||
return rv;
|
||||
},
|
||||
|
||||
/***************************
|
||||
* APPEND *
|
||||
***************************/
|
||||
append : function(aLeaf)
|
||||
{
|
||||
|
||||
if (!this.checkInst())
|
||||
throw Components.results.NS_ERROR_NOT_INITIALIZED;
|
||||
if (!aLeaf) {
|
||||
jslibError(null,
|
||||
"(no argument defined)",
|
||||
"NS_ERROR_INVALID_ARG",
|
||||
JS_FILESYSTEM_FILE+":append");
|
||||
return null;
|
||||
}
|
||||
if (!this.mPath) {
|
||||
jslibError(null,
|
||||
"(no path defined)",
|
||||
"NS_ERROR_INVALID_ARG",
|
||||
JS_FILESYSTEM_FILE+":append");
|
||||
return null;
|
||||
}
|
||||
var rv = null;
|
||||
try {
|
||||
this.mFileInst.append(aLeaf);
|
||||
rv = this.mPath=this.path;
|
||||
} catch(e) {
|
||||
jslibError(null,
|
||||
"(unexpected error)",
|
||||
"NS_ERROR_UNEXPECTED",
|
||||
JS_FILESYSTEM_FILE+":append");
|
||||
rv = null;
|
||||
}
|
||||
return rv;
|
||||
},
|
||||
|
||||
/***************************
|
||||
* APPEND RELATIVE *
|
||||
***************************/
|
||||
appendRelativePath : function(aRelPath)
|
||||
{
|
||||
|
||||
if (!this.checkInst())
|
||||
throw Components.results.NS_ERROR_NOT_INITIALIZED;
|
||||
if (!aRelPath) {
|
||||
jslibError(null,
|
||||
"(no argument defined)",
|
||||
"NS_ERROR_INVALID_ARG",
|
||||
JS_FILESYSTEM_FILE+":appendRelativePath");
|
||||
return null;
|
||||
}
|
||||
if (!this.mPath) {
|
||||
jslibError(null,
|
||||
"(no path defined)",
|
||||
"NS_ERROR_INVALID_ARG",
|
||||
JS_FILESYSTEM_FILE+":appendRelativePath");
|
||||
return null;
|
||||
}
|
||||
var rv = null;
|
||||
try {
|
||||
this.mFileInst.appendRelativePath(aRelPath);
|
||||
rv = this.mPath=this.path;
|
||||
} catch(e) {
|
||||
jslibError(null,
|
||||
"(unexpected error)",
|
||||
"NS_ERROR_UNEXPECTED",
|
||||
JS_FILESYSTEM_FILE+":appendRelativePath");
|
||||
rv = null;
|
||||
}
|
||||
return rv;
|
||||
},
|
||||
|
||||
/***************************
|
||||
* GET URL *
|
||||
***************************/
|
||||
get URL()
|
||||
{
|
||||
return (this.path?'file://'+this.path.replace(/\ /g, "%20").replace(/\\/g, "\/"):'');
|
||||
},
|
||||
|
||||
/***************************
|
||||
* ISDIR *
|
||||
***************************/
|
||||
isDir : function()
|
||||
{
|
||||
var rv = false;
|
||||
try {
|
||||
rv = this.mFileInst.isDirectory();
|
||||
} catch (e) { rv = false; }
|
||||
|
||||
return rv;
|
||||
},
|
||||
|
||||
/***************************
|
||||
* ISFILE *
|
||||
***************************/
|
||||
isFile : function()
|
||||
{
|
||||
var rv = false;
|
||||
try {
|
||||
rv = this.mFileInst.isFile();
|
||||
} catch (e) { rv = false; }
|
||||
|
||||
return rv;
|
||||
},
|
||||
|
||||
/***************************
|
||||
* ISEXEC *
|
||||
***************************/
|
||||
isExec : function()
|
||||
{
|
||||
var rv = false;
|
||||
try {
|
||||
rv = this.mFileInst.isExecutable();
|
||||
} catch (e) { rv = false; }
|
||||
|
||||
return rv;
|
||||
},
|
||||
|
||||
/***************************
|
||||
* ISSYMLINK *
|
||||
***************************/
|
||||
isSymlink : function()
|
||||
{
|
||||
|
||||
var rv = false;
|
||||
try {
|
||||
rv = this.mFileInst.isSymlink();
|
||||
} catch (e) { rv = false; }
|
||||
|
||||
return rv;
|
||||
},
|
||||
|
||||
/***************************
|
||||
* HELP *
|
||||
***************************/
|
||||
help : function()
|
||||
{
|
||||
|
||||
const help =
|
||||
"\n\nFunction and Attribute List:\n" +
|
||||
"\n" +
|
||||
" initPath(aPath);\n" +
|
||||
" path;\n" +
|
||||
" exists();\n" +
|
||||
" leaf;\n" +
|
||||
" parent;\n" +
|
||||
" permissions;\n" +
|
||||
" dateModified;\n" +
|
||||
" nsIFile;\n" +
|
||||
" move(aDest);\n" +
|
||||
" append(aLeaf);\n" +
|
||||
" appendRelativePath(aRelPath);\n" +
|
||||
" URL;\n" +
|
||||
" isDir();\n" +
|
||||
" isFile();\n" +
|
||||
" isExec();\n" +
|
||||
" isSymlink();\n";
|
||||
return help;
|
||||
}
|
||||
|
||||
}; // END FileSystem Class
|
||||
|
||||
jslibDebug('*** load: '+JS_FILESYSTEM_FILE+' OK');
|
||||
|
||||
} // END BLOCK JS_LIB_LOADED CHECK
|
||||
|
||||
else {
|
||||
dump("JS_FILE library not loaded:\n" +
|
||||
" \tTo load use: chrome://jslib/content/jslib.js\n" +
|
||||
" \tThen: include('chrome://jslib/content/io/filesystem.js');\n\n");
|
||||
}
|
|
@ -1,41 +0,0 @@
|
|||
/*** -*- Mode: Javascript; tab-width: 2;
|
||||
|
||||
The contents of this file are subject to the Mozilla Public
|
||||
License Version 1.1 (the "License"); you may not use this file
|
||||
except in compliance with the License. You may obtain a copy of
|
||||
the License at http://www.mozilla.org/MPL/
|
||||
|
||||
Software distributed under the License is distributed on an "AS
|
||||
IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
|
||||
implied. See the License for the specific language governing
|
||||
rights and limitations under the License.
|
||||
|
||||
The Original Code is Collabnet code.
|
||||
The Initial Developer of the Original Code is Collabnet.
|
||||
|
||||
Portions created by Collabnet are
|
||||
Copyright (C) 2000 Collabnet. All
|
||||
Rights Reserved.
|
||||
|
||||
Contributor(s): Pete Collins, Doug Turner, Brendan Eich, Warren Harris
|
||||
|
||||
***/
|
||||
|
||||
if(typeof(JS_LIB_LOADED)=='boolean')
|
||||
{
|
||||
/********************* INCLUDED FILES **************/
|
||||
include(JS_LIB_PATH+'io/filesystem.js');
|
||||
include(JS_LIB_PATH+'io/file.js');
|
||||
include(JS_LIB_PATH+'io/dir.js');
|
||||
include(JS_LIB_PATH+'io/fileUtils.js');
|
||||
include(JS_LIB_PATH+'io/dirUtils.js');
|
||||
/********************* INCLUDED FILES **************/
|
||||
}
|
||||
|
||||
else
|
||||
{
|
||||
dump("JSLIB library not loaded:\n" +
|
||||
" \tTo load use: chrome://jslib/content/jslib.js\n" +
|
||||
" \tThen: include('chrome://jslib/content/io/io.js');\n\n");
|
||||
}
|
||||
|
|
@ -1,376 +0,0 @@
|
|||
/*** -*- Mode: Javascript; tab-width: 2;
|
||||
|
||||
The contents of this file are subject to the Mozilla Public
|
||||
License Version 1.1 (the "License"); you may not use this file
|
||||
except in compliance with the License. You may obtain a copy of
|
||||
the License at http://www.mozilla.org/MPL/
|
||||
|
||||
Software distributed under the License is distributed on an "AS
|
||||
IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
|
||||
implied. See the License for the specific language governing
|
||||
rights and limitations under the License.
|
||||
|
||||
The Original Code is jslib team code.
|
||||
The Initial Developer of the Original Code is jslib team.
|
||||
|
||||
Portions created by jslib team are
|
||||
Copyright (C) 2000 jslib team. All
|
||||
Rights Reserved.
|
||||
|
||||
Original Author: Pete Collins <pete@mozdev.org>
|
||||
Contributor(s): Martin Kutschker <Martin.T.Kutschker@blackbox.net>
|
||||
|
||||
***/
|
||||
|
||||
/**
|
||||
* insure jslib base is not already loaded
|
||||
*/
|
||||
if (typeof(JS_LIB_LOADED)!='boolean') {
|
||||
try {
|
||||
|
||||
/*************************** GLOBALS ***************************/
|
||||
const JS_LIB_LOADED = true;
|
||||
|
||||
const JS_LIBRARY = "jslib";
|
||||
const JS_LIB_FILE = "jslib.js"
|
||||
const JS_LIB_PATH = "chrome://calendar/content/jslib/";
|
||||
const JS_LIB_VERSION = "0.1.123";
|
||||
const JS_LIB_AUTHORS = "\tPete Collins <petejc@mozdevgroup.com>\n" +
|
||||
"\tEric Plaster <plaster@urbanrage.com>\n" +
|
||||
"\tMartin.T.Kutschker <Martin.T.Kutschker@blackbox.net>\n";
|
||||
const JS_LIB_BUILD = "mozilla 1.3+";
|
||||
const JS_LIB_ABOUT = "\tThis is an effort to provide a fully " +
|
||||
"functional js library\n" +
|
||||
"\tfor mozilla package authors to use " +
|
||||
"in their applications\n";
|
||||
const JS_LIB_HOME = "http://jslib.mozdev.org/";
|
||||
|
||||
// Hopefully there won't be any global namespace collisions here
|
||||
const ON = true;
|
||||
const OFF = false;
|
||||
const C = Components;
|
||||
const jslib_results = C.results;
|
||||
|
||||
if (typeof(JS_LIB_DEBUG)!='boolean')
|
||||
var JS_LIB_DEBUG = ON;
|
||||
var JS_LIB_DEBUG_ALERT = OFF;
|
||||
var JS_LIB_ERROR = ON;
|
||||
var JS_LIB_ERROR_ALERT = OFF;
|
||||
|
||||
const JS_LIB_HELP = "\n\nWelcome to jslib version "+JS_LIB_VERSION+"\n\n"
|
||||
+ "Global Constants:\n\n"
|
||||
+ "JS_LIBRARY \n\t"+JS_LIBRARY +"\n"
|
||||
+ "JS_LIB_FILE \n\t"+JS_LIB_FILE +"\n"
|
||||
+ "JS_LIB_PATH \n\t"+JS_LIB_PATH +"\n"
|
||||
+ "JS_LIB_VERSION \n\t"+JS_LIB_VERSION +"\n"
|
||||
+ "JS_LIB_AUTHORS \n" +JS_LIB_AUTHORS
|
||||
+ "JS_LIB_BUILD \n\t"+JS_LIB_BUILD +"\n"
|
||||
+ "JS_LIB_ABOUT \n" +JS_LIB_ABOUT
|
||||
+ "JS_LIB_HOME \n\t"+JS_LIB_HOME +"\n\n"
|
||||
+ "Global Variables:\n\n"
|
||||
+ " JS_LIB_DEBUG\n JS_LIB_ERROR\n\n";
|
||||
|
||||
// help identifier
|
||||
const jslib_help = "need to write some global help docs here\n";
|
||||
|
||||
// Library Identifiers
|
||||
|
||||
// io library modules
|
||||
const jslib_io = JS_LIB_PATH+'io/io.js';
|
||||
const jslib_filesystem = JS_LIB_PATH+'io/filesystem.js'
|
||||
const jslib_file = JS_LIB_PATH+'io/file.js';
|
||||
const jslib_fileutils = JS_LIB_PATH+'io/fileUtils.js';
|
||||
const jslib_dir = JS_LIB_PATH+'io/dir.js';
|
||||
const jslib_dirutils = JS_LIB_PATH+'io/dirUtils.js';
|
||||
|
||||
// data structures
|
||||
const jslib_dictionary = JS_LIB_PATH+'ds/dictionary.js';
|
||||
const jslib_chaindictionary = JS_LIB_PATH+'ds/chainDictionary.js';
|
||||
|
||||
// RDF library modules
|
||||
const jslib_rdf = JS_LIB_PATH+'rdf/rdf.js';
|
||||
const jslib_rdffile = JS_LIB_PATH+'rdf/rdfFile.js';
|
||||
const jslib_rdfcontainer = JS_LIB_PATH+'rdf/rdfContainer.js';
|
||||
const jslib_rdfresource = JS_LIB_PATH+'rdf/rdfResource.js';
|
||||
|
||||
// network library modules
|
||||
const jslib_remotefile = JS_LIB_PATH+'network/remoteFile.js';
|
||||
const jslib_socket = JS_LIB_PATH+'network/socket.js';
|
||||
|
||||
// network - http
|
||||
const jslib_http = JS_LIB_PATH+'network/http.js';
|
||||
const jslib_getrequest = JS_LIB_PATH+'network/getRequest.js';
|
||||
const jslib_postrequest = JS_LIB_PATH+'network/postRequest.js';
|
||||
const jslib_multipartrequest = JS_LIB_PATH+'network/multipartRequest.js';
|
||||
const jslib_filepart = JS_LIB_PATH+'network/parts/filePart.js';
|
||||
const jslib_textpart = JS_LIB_PATH+'network/parts/textPart.js';
|
||||
const jslib_urlparameterspart = JS_LIB_PATH+'network/parts/urlParametersPart.js';
|
||||
const jslib_bodyparameterspart = JS_LIB_PATH+'network/parts/bodyParametersPart.js';
|
||||
|
||||
|
||||
// xul dom library modules
|
||||
const jslib_dialog = JS_LIB_PATH+'xul/commonDialog.js';
|
||||
const jslib_filepicker = JS_LIB_PATH+'xul/commonFilePicker.js';
|
||||
const jslib_window = JS_LIB_PATH+'xul/commonWindow.js';
|
||||
const jslib_routines = JS_LIB_PATH+'xul/appRoutines.js';
|
||||
|
||||
// sound library modules
|
||||
const jslib_sound = JS_LIB_PATH+'sound/sound.js';
|
||||
|
||||
// utils library modules
|
||||
const jslib_date = JS_LIB_PATH+'utils/date.js';
|
||||
const jslib_prefs = JS_LIB_PATH+'utils/prefs.js';
|
||||
const jslib_validate = JS_LIB_PATH+'utils/validate.js';
|
||||
|
||||
// zip
|
||||
const jslib_zip = JS_LIB_PATH+'zip/zip.js';
|
||||
|
||||
// install/uninstall
|
||||
const jslib_install = JS_LIB_PATH+'install/install.js';
|
||||
const jslib_uninstall = JS_LIB_PATH+'install/uninstall.js';
|
||||
|
||||
/*************************** GLOBALS ***************************/
|
||||
|
||||
/****************************************************************
|
||||
* void include(aScriptPath) *
|
||||
* aScriptPath is an argument of string lib chrome path *
|
||||
* returns NS_OK on success, 1 if file is already loaded and *
|
||||
* - errorno or throws exception on failure *
|
||||
* Ex: *
|
||||
* var path='chrome://jslib/content/io/file.js'; *
|
||||
* include(path); *
|
||||
* *
|
||||
* outputs: void(null) *
|
||||
****************************************************************/
|
||||
|
||||
function include(aScriptPath) {
|
||||
|
||||
jslibPrint(aScriptPath);
|
||||
if (!aScriptPath) {
|
||||
jslibError(null, "Missing file path argument\n",
|
||||
"NS_ERROR_XPC_NOT_ENOUGH_ARGS",
|
||||
JS_LIB_FILE+": include");
|
||||
throw - C.results.NS_ERROR_XPC_NOT_ENOUGH_ARGS;
|
||||
}
|
||||
|
||||
if (aScriptPath==JS_LIB_PATH+JS_LIB_FILE) {
|
||||
jslibError(null, aScriptPath+" is already loaded!",
|
||||
"NS_ERROR_INVALID_ARG", JS_LIB_FILE+": include");
|
||||
throw - C.results.NS_ERROR_INVALID_ARG;
|
||||
}
|
||||
|
||||
var start = aScriptPath.lastIndexOf('/') + 1;
|
||||
var end = aScriptPath.lastIndexOf('.');
|
||||
var slice = aScriptPath.length - end;
|
||||
var loadID = aScriptPath.substring(start, (aScriptPath.length - slice));
|
||||
if (typeof(this['JS_'+loadID.toUpperCase()+'_LOADED']) == 'boolean') {
|
||||
jslibPrint (loadID+" library already loaded");
|
||||
return 1;
|
||||
}
|
||||
|
||||
var rv;
|
||||
try {
|
||||
const PROG_ID = "@mozilla.org/moz/jssubscript-loader;1";
|
||||
const INTERFACE = "mozIJSSubScriptLoader";
|
||||
jslibGetService(PROG_ID, INTERFACE).loadSubScript(aScriptPath);
|
||||
rv = C.results.NS_OK;
|
||||
} catch (e) {
|
||||
jslibDebug(e);
|
||||
const msg = aScriptPath+" is not a valid path or is already loaded";
|
||||
jslibError(e, msg, "NS_ERROR_INVALID_ARG", JS_LIB_FILE+": include");
|
||||
rv = - C.results.NS_ERROR_INVALID_ARG;
|
||||
}
|
||||
return rv;
|
||||
}
|
||||
|
||||
/****************************************************************
|
||||
* void jslibDebug(aOutString) *
|
||||
* aOutString is an argument of string debug message *
|
||||
* returns void *
|
||||
* Ex: *
|
||||
* var msg='Testing function'; *
|
||||
* jslibDebug(msg); *
|
||||
* *
|
||||
* outputs: Testing function *
|
||||
****************************************************************/
|
||||
|
||||
// this is here for backward compatability but is deprecated --masi
|
||||
function jslib_debug(aOutString) { return jslibDebug(aOutString); }
|
||||
|
||||
function jslibDebug(aOutString) {
|
||||
|
||||
if (!JS_LIB_DEBUG)
|
||||
return;
|
||||
|
||||
if (JS_LIB_DEBUG_ALERT)
|
||||
alert(aOutString);
|
||||
|
||||
dump(aOutString+'\n');
|
||||
return;
|
||||
}
|
||||
|
||||
// print to stdout
|
||||
function jslibPrint(aOutString) {
|
||||
return (dump(aOutString+'\n'));
|
||||
}
|
||||
|
||||
// Welcome message
|
||||
jslibDebug(JS_LIB_HELP);
|
||||
jslibDebug("\n\n*********************\nJS_LIB DEBUG IS ON\n*********************\n\n");
|
||||
|
||||
|
||||
/****************************************************************
|
||||
* void jslibError(e, aType, aResults, aCaller) *
|
||||
* e - argument of results exception *
|
||||
* aType - argument of string error type message *
|
||||
* aResults - argument of string Components.results name *
|
||||
* aCaller - argument of string caller filename and func name *
|
||||
* returns void *
|
||||
* Ex: *
|
||||
* jslibError(null, "Missing file path argument\n", *
|
||||
* "NS_ERROR_XPC_NOT_ENOUGH_ARGS", *
|
||||
* JS_LIB_FILE+": include"); *
|
||||
* *
|
||||
* outputs: *
|
||||
* -----======[ ERROR ]=====----- *
|
||||
* Error in jslib.js: include: Missing file path argument *
|
||||
* *
|
||||
* NS_ERROR_NUMBER: NS_ERROR_XPC_NOT_ENOUGH_ARGS *
|
||||
* ------------------------------ *
|
||||
* *
|
||||
****************************************************************/
|
||||
|
||||
function jslibError(e, aType, aResults, aCaller) {
|
||||
|
||||
if (!JS_LIB_ERROR)
|
||||
return void(null);
|
||||
|
||||
if (arguments.length==0)
|
||||
return (dump("JS_LIB_ERROR=ON\n"));
|
||||
|
||||
var errMsg="ERROR: "+(aCaller?"in "+aCaller:"")+" "+aType+"\n";
|
||||
if (e && typeof(e)=='object') {
|
||||
var m, n, r, l, ln, fn = "";
|
||||
try {
|
||||
r = e.result;
|
||||
m = e.message;
|
||||
fn = e.filename;
|
||||
l = e.location;
|
||||
ln = l.lineNumber;
|
||||
} catch (e) {}
|
||||
errMsg+="Name: "+e.name+"\n" +
|
||||
"Result: "+r+"\n" +
|
||||
"Message: "+m+"\n" +
|
||||
"FileName: "+fn+"\n" +
|
||||
"LineNumber: "+ln+"\n";
|
||||
}
|
||||
if (aResults)
|
||||
errMsg+="NS_ERROR_NUMBER: "+aResults+"\n";
|
||||
|
||||
if (JS_LIB_ERROR_ALERT)
|
||||
alert(errMsg);
|
||||
|
||||
errMsg = "\n-----======[ ERROR ]=====-----\n" + errMsg;
|
||||
errMsg += "------------------------------\n\n";
|
||||
|
||||
return (dump(errMsg));
|
||||
}
|
||||
|
||||
function jslibGetService (aURL, aInterface) {
|
||||
var rv;
|
||||
try {
|
||||
rv = C.classes[aURL].getService(C.interfaces[aInterface]);
|
||||
} catch (e) {
|
||||
jslibDebug("Error getting service: " + aURL + ", " + aInterface + "\n" + e);
|
||||
rv = -1;
|
||||
}
|
||||
return rv;
|
||||
}
|
||||
|
||||
function jslibCreateInstance (aURL, aInterface) {
|
||||
var rv;
|
||||
try {
|
||||
rv = C.classes[aURL].createInstance(C.interfaces[aInterface]);
|
||||
} catch (e) {
|
||||
jslibDebug("Error creating instance: " + aURL + ", " + aInterface + "\n" + e);
|
||||
rv = -1;
|
||||
}
|
||||
return rv;
|
||||
}
|
||||
|
||||
function jslibGetInterface (aInterface) {
|
||||
var rv;
|
||||
try {
|
||||
rv = C.interfaces[aInterface];
|
||||
} catch (e) {
|
||||
jslibDebug("Error getting interface: [" + aInterface + "]\n" + e);
|
||||
rv = -1;
|
||||
}
|
||||
return rv;
|
||||
}
|
||||
|
||||
/************
|
||||
QI: function(aEl, aIName)
|
||||
{
|
||||
try {
|
||||
return aEl.QueryInterface(Components.interfaces[aIName]);
|
||||
} catch (ex) {
|
||||
throw("Unable to QI " + aEl + " to " + aIName);
|
||||
}
|
||||
}
|
||||
************/
|
||||
|
||||
function jslibUninstall (aPackage, aCallback)
|
||||
{
|
||||
if (!aPackage || typeof(aPackage) != "string")
|
||||
throw jslib_results.NS_ERROR_INVALID_ARG;
|
||||
|
||||
include (jslib_window);
|
||||
var win = new CommonWindow(null, 400, 400);
|
||||
win.position = JS_MIDDLE_CENTER;
|
||||
win.openUninstallWindow(aPackage, aCallback);
|
||||
}
|
||||
|
||||
/*********** Launch JSLIB Splash ***************/
|
||||
function jslibLaunchSplash ()
|
||||
{
|
||||
include (jslib_window);
|
||||
const url = "chrome://jslib/content/splash.xul";
|
||||
var win = new CommonWindow(url, 400, 220);
|
||||
win.position = JS_MIDDLE_CENTER;
|
||||
win.openSplash();
|
||||
}
|
||||
|
||||
function jslib_turnDumpOn () {
|
||||
include (jslib_prefs);
|
||||
// turn on dump
|
||||
var pref = new Prefs();
|
||||
const prefStr = "browser.dom.window.dump.enabled"
|
||||
|
||||
// turn dump on if not enabled
|
||||
if (!pref.getBool(prefStr)) {
|
||||
pref.setBool(prefStr, true);
|
||||
pref.save();
|
||||
}
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
function jslib_turnDumpOff () {
|
||||
include (jslib_prefs);
|
||||
// turn off dump
|
||||
var pref = new Prefs();
|
||||
const prefStr = "browser.dom.window.dump.enabled"
|
||||
|
||||
// turn dump off if enabled
|
||||
if (pref.getBool(prefStr)) {
|
||||
pref.setBool(prefStr, false);
|
||||
pref.save();
|
||||
}
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
} catch (e) {}
|
||||
|
||||
} // end jslib load test
|
|
@ -1,321 +0,0 @@
|
|||
/*** -*- Mode: Javascript; tab-width: 2;
|
||||
|
||||
The contents of this file are subject to the Mozilla Public
|
||||
License Version 1.1 (the "License"); you may not use this file
|
||||
except in compliance with the License. You may obtain a copy of
|
||||
the License at http://www.mozilla.org/MPL/
|
||||
|
||||
Software distributed under the License is distributed on an "AS
|
||||
IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
|
||||
implied. See the License for the specific language governing
|
||||
rights and limitations under the License.
|
||||
|
||||
The Original Code is Urban Rage Software code.
|
||||
The Initial Developer of the Original Code is Eric Plaster.
|
||||
|
||||
Portions created by Urban Rage Software are
|
||||
Copyright (C) 2000 Urban Rage Software. All
|
||||
Rights Reserved.
|
||||
|
||||
Contributor(s): Eric Plaster <plaster@urbanrage.com)> (original author)
|
||||
Martin Kutschker <martin.t.kutschker@blackbox.net> (polishing)
|
||||
|
||||
*/
|
||||
|
||||
if(typeof(JS_LIB_LOADED)=='boolean')
|
||||
{
|
||||
// test to make sure rdf base classes are loaded
|
||||
if(typeof(JS_RDFBASE_LOADED)!='boolean')
|
||||
include(JS_LIB_PATH+'rdf/rdfBase.js');
|
||||
if(typeof(JS_RDFRESOURCE_LOADED)!='boolean')
|
||||
include(JS_LIB_PATH+'rdf/rdfResource.js');
|
||||
if(typeof(JS_RDFCONTAINER_LOADED)!='boolean')
|
||||
include(JS_LIB_PATH+'rdf/rdfContainer.js');
|
||||
|
||||
const JS_RDF_LOADED = true;
|
||||
const JS_RDF_FILE = "rdf.js";
|
||||
|
||||
const JS_RDF_FLAG_SYNC = 1; // load RDF source synchronously
|
||||
|
||||
function RDF(src, flags) {
|
||||
this.loaded = false;
|
||||
|
||||
if(src) {
|
||||
this._rdf_init(src, flags);
|
||||
}
|
||||
}
|
||||
|
||||
RDF.prototype = new RDFBase;
|
||||
|
||||
RDF.prototype.src = null;
|
||||
|
||||
RDF.prototype._rdf_init = function(src, flags) {
|
||||
flags = flags || 0;
|
||||
this.src = src;
|
||||
|
||||
var load = true; // load source
|
||||
jslibPrint("* RDFFile: Opening file \n");
|
||||
// Create an RDF/XML datasource using the XPCOM Component Manager
|
||||
this.dsource = C
|
||||
.classes[JS_RDFBASE_RDF_DS_PROGID]
|
||||
.createInstance(C.interfaces.nsIRDFDataSource);
|
||||
|
||||
// The nsIRDFRemoteDataSource interface has the interfaces
|
||||
// that we need to setup the datasource.
|
||||
var remote = this.dsource.QueryInterface(C.interfaces.nsIRDFRemoteDataSource);
|
||||
|
||||
try {
|
||||
jslibPrint("* RDFFile: doing remote init \n");
|
||||
remote.Init(src); // throws an exception if URL already in use
|
||||
}
|
||||
catch(err) {
|
||||
// loading already
|
||||
load = false;
|
||||
|
||||
jslibDebug(JS_RDF_FILE+":_rdf_init: Init of "+src+" failed.");
|
||||
}
|
||||
|
||||
if (load) {
|
||||
try {
|
||||
jslibPrint("* RDFFile: refresh remote \n");
|
||||
remote.Refresh((flags & JS_RDF_FLAG_SYNC) ? true: false);
|
||||
}
|
||||
catch(err) {
|
||||
this.dsource = null;
|
||||
|
||||
jslibError(err, "Error refreshing remote rdf: "+src, "NS_ERROR_UNEXPECTED",
|
||||
JS_RDF_FILE+":_rdf_init");
|
||||
return;
|
||||
}
|
||||
}
|
||||
else {
|
||||
try {
|
||||
jslibPrint("* RDFFile: getting ds \n");
|
||||
this.dsource = this.RDF.GetDataSource(src);
|
||||
remote = this.dsource.QueryInterface(C.interfaces.nsIRDFRemoteDataSource);
|
||||
}
|
||||
catch(err) {
|
||||
this.dsource = null;
|
||||
|
||||
jslibError(err, "Error getting datasource: "+src, "NS_ERROR_UNEXPECTED",
|
||||
JS_RDF_FILE+":_rdf_init");
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
try {
|
||||
if (remote.loaded) {
|
||||
this.loaded = true;
|
||||
this.setValid(true);
|
||||
}
|
||||
else {
|
||||
var obs = {
|
||||
rdf: this, // backreference to ourselves
|
||||
|
||||
onBeginLoad: function(aSink)
|
||||
{
|
||||
},
|
||||
|
||||
onInterrupt: function(aSink)
|
||||
{},
|
||||
|
||||
onResume: function(aSink)
|
||||
{},
|
||||
|
||||
onEndLoad: function(aSink)
|
||||
{
|
||||
this.rdf.loaded = true;
|
||||
this.rdf.setValid(true);
|
||||
},
|
||||
|
||||
onError: function(aSink, aStatus, aErrorMsg)
|
||||
{
|
||||
jslibError(null,"Error loading datasource: "+aErrorMsg,
|
||||
"NS_ERROR_UNEXPECTED", JS_RDF_FILE+":_rdf_init (observer)");
|
||||
}
|
||||
};
|
||||
|
||||
// RDF/XML Datasources are all nsIRDFXMLSinks
|
||||
var sink = this.dsource.QueryInterface(C.interfaces.nsIRDFXMLSink);
|
||||
|
||||
// Attach the observer to the datasource-as-sink
|
||||
sink.addXMLSinkObserver(obs);
|
||||
}
|
||||
}
|
||||
catch(err) {
|
||||
jslibError(err, "Error loading rdf!\n", "NS_ERROR_UNEXPECTED",
|
||||
JS_RDF_FILE+":_rdf_init");
|
||||
return;
|
||||
}
|
||||
};
|
||||
|
||||
RDF.prototype.getSource = function()
|
||||
{
|
||||
return this.src;
|
||||
};
|
||||
|
||||
RDF.prototype.getNode = function(aPath)
|
||||
{
|
||||
jslibDebug("entering getNode");
|
||||
if(this.isValid()) {
|
||||
var res = this.RDF.GetResource(aPath);
|
||||
return new RDFResource("node", res.Value, null, this.dsource);
|
||||
} else {
|
||||
jslibError(null, "RDF is no longer valid!\n", "NS_ERROR_UNEXPECTED",
|
||||
JS_RDF_FILE+":getNode");
|
||||
return null;
|
||||
}
|
||||
};
|
||||
|
||||
RDF.prototype.addRootSeq = function(aSeq)
|
||||
{
|
||||
return this.addRootContainer(aSeq, "seq");
|
||||
};
|
||||
|
||||
RDF.prototype.addRootAlt = function(aAlt)
|
||||
{
|
||||
return this.addRootContainer(aAlt, "alt");
|
||||
};
|
||||
|
||||
RDF.prototype.addRootBag = function(aBag)
|
||||
{
|
||||
return this.addRootContainer(aBag, "bag");
|
||||
};
|
||||
|
||||
RDF.prototype.addRootContainer = function(aContainer, aType)
|
||||
{
|
||||
if(this.isValid()) {
|
||||
if(!aContainer)
|
||||
jslibError(null, "Must supply a container path", null, JSRDFCONTAINER+":addRootContainer");
|
||||
|
||||
var res = this.RDF.GetResource(aContainer);
|
||||
|
||||
// FIXME: should test if exists and is already a container
|
||||
|
||||
if(aType == "bag") {
|
||||
this.RDFCUtils.MakeBag(this.dsource, res);
|
||||
} else if(aType == "alt") {
|
||||
this.RDFCUtils.MakeAlt(this.dsource, res);
|
||||
} else if(aType == "seq") {
|
||||
this.RDFCUtils.MakeSeq(this.dsource, res);
|
||||
} else {
|
||||
// FIXME: this.RDFCUtils.MakeContainer....
|
||||
}
|
||||
return new RDFContainer(aType, aContainer, null, this.dsource);
|
||||
} else {
|
||||
jslibError(null, "RDF is no longer valid!\n", "NS_ERROR_UNEXPECTED",
|
||||
JS_RDF_FILE+":addRootContainer");
|
||||
return null;
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
RDF.prototype.getRootSeq = function(aSeq)
|
||||
{
|
||||
return this.getContainer(aSeq, "seq");
|
||||
};
|
||||
|
||||
RDF.prototype.getRootAlt = function(aAlt)
|
||||
{
|
||||
return this.getContainer(aAlt, "alt");
|
||||
};
|
||||
|
||||
RDF.prototype.getRootBag = function(aBag)
|
||||
{
|
||||
return this.getContainer(aBag, "bag");
|
||||
};
|
||||
|
||||
RDF.prototype.getContainer = function(aContainer, aType)
|
||||
{
|
||||
var rv = null;
|
||||
if(this.isValid()) {
|
||||
var res = this.RDF.GetResource(aContainer);
|
||||
if(res) {
|
||||
rv = new RDFContainer(aType, aContainer, null, this.dsource);
|
||||
}
|
||||
}
|
||||
return rv;
|
||||
};
|
||||
|
||||
RDF.prototype.getAllSeqs = function()
|
||||
{
|
||||
return this.getRootContainers("seq");
|
||||
};
|
||||
|
||||
RDF.prototype.getAllAlts = function()
|
||||
{
|
||||
return this.getRootContainers("alt");
|
||||
};
|
||||
|
||||
RDF.prototype.getAllBags = function()
|
||||
{
|
||||
return this.getRootContainers("bag");
|
||||
};
|
||||
|
||||
RDF.prototype.getAllContainers = function()
|
||||
{
|
||||
return this.getRootContainers("all");
|
||||
};
|
||||
|
||||
RDF.prototype.getRootContainers = function(aType)
|
||||
{
|
||||
var rv = null;
|
||||
if(this.isValid()) {
|
||||
var list = new Array;
|
||||
var elems = this.dsource.GetAllResources();
|
||||
while(elems.hasMoreElements()) {
|
||||
var elem = elems.getNext();
|
||||
elem = elem.QueryInterface(C.interfaces.nsIRDFResource);
|
||||
if(aType == "bag") {
|
||||
if(this.RDFCUtils.IsBag(this.dsource, elem)) {
|
||||
list.push(new RDFContainer(aType, elem.Value, null, this.dsource));
|
||||
}
|
||||
} else if(aType == "alt") {
|
||||
if(this.RDFCUtils.IsAlt(this.dsource, elem)) {
|
||||
list.push(new RDFContainer(aType, elem.Value, null, this.dsource));
|
||||
}
|
||||
} else if(aType == "seq") {
|
||||
if(this.RDFCUtils.IsSeq(this.dsource, elem)) {
|
||||
list.push(new RDFContainer(aType, elem.Value, null, this.dsource));
|
||||
}
|
||||
} else if(aType == "all") {
|
||||
if(this.RDFCUtils.IsContainer(this.dsource, elem)) {
|
||||
list.push(new RDFContainer(aType, elem.Value, null, this.dsource));
|
||||
}
|
||||
} else {
|
||||
if(!this.RDFCUtils.IsContainer(this.dsource, elem)) {
|
||||
list.push(new RDFResource(aType, elem.Value, null, this.dsource));
|
||||
}
|
||||
}
|
||||
}
|
||||
return list;
|
||||
} else {
|
||||
jslibError(null, "RDF is no longer valid!\n", "NS_ERROR_UNEXPECTED",
|
||||
JS_RDF_FILE+":getRootContainers");
|
||||
return null;
|
||||
}
|
||||
};
|
||||
|
||||
RDF.prototype.flush = function()
|
||||
{
|
||||
if(this.isValid())
|
||||
this.dsource.QueryInterface(C.interfaces.nsIRDFRemoteDataSource).Flush();
|
||||
};
|
||||
|
||||
RDF.prototype.refresh = function(aBlocking)
|
||||
{
|
||||
if(this.isValid())
|
||||
this.dsource.QueryInterface(C.interfaces.nsIRDFRemoteDataSource).Refresh(aBlocking);
|
||||
};
|
||||
|
||||
jslibDebug('*** load: '+JS_RDF_FILE+' OK');
|
||||
|
||||
} // END BLOCK JS_LIB_LOADED CHECK
|
||||
|
||||
else
|
||||
{
|
||||
dump("JS_RDF library not loaded:\n" +
|
||||
" \tTo load use: chrome://jslib/content/jslib.js\n" +
|
||||
" \tThen: include('chrome://jslib/content/rdf/rdf.js');\n\n");
|
||||
}
|
||||
|
|
@ -1,137 +0,0 @@
|
|||
/*** -*- Mode: Javascript; tab-width: 2;
|
||||
|
||||
The contents of this file are subject to the Mozilla Public
|
||||
License Version 1.1 (the "License"); you may not use this file
|
||||
except in compliance with the License. You may obtain a copy of
|
||||
the License at http://www.mozilla.org/MPL/
|
||||
|
||||
Software distributed under the License is distributed on an "AS
|
||||
IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
|
||||
implied. See the License for the specific language governing
|
||||
rights and limitations under the License.
|
||||
|
||||
The Original Code is Urban Rage Software code.
|
||||
The Initial Developer of the Original Code is Eric Plaster.
|
||||
|
||||
Portions created by Urban Rage Software are
|
||||
Copyright (C) 2000 Urban Rage Software. All
|
||||
Rights Reserved.
|
||||
|
||||
Contributor(s): Eric Plaster <plaster@urbanrage.com)> (original author)
|
||||
Martin Kutschker <martin.t.kutschker@blackbox.net> (polishing)
|
||||
|
||||
*/
|
||||
|
||||
if(typeof(JS_LIB_LOADED)=='boolean')
|
||||
{
|
||||
const JS_RDFBASE_LOADED = true;
|
||||
const JS_RDFBASE_FILE = "rdfBase.js";
|
||||
|
||||
const JS_RDFBASE_CONTAINER_PROGID = '@mozilla.org/rdf/container;1';
|
||||
const JS_RDFBASE_CONTAINER_UTILS_PROGID = '@mozilla.org/rdf/container-utils;1';
|
||||
const JS_RDFBASE_LOCATOR_PROGID = '@mozilla.org/filelocator;1';
|
||||
const JS_RDFBASE_RDF_PROGID = '@mozilla.org/rdf/rdf-service;1';
|
||||
const JS_RDFBASE_RDF_DS_PROGID = '@mozilla.org/rdf/datasource;1?name=xml-datasource';
|
||||
|
||||
/***************************************
|
||||
* RDFBase is the base class for all RDF classes
|
||||
*
|
||||
*/
|
||||
function RDFBase(aDatasource) {
|
||||
this.RDF = Components.classes[JS_RDFBASE_RDF_PROGID].getService();
|
||||
this.RDF = this.RDF.QueryInterface(Components.interfaces.nsIRDFService);
|
||||
this.RDFC = Components.classes[JS_RDFBASE_CONTAINER_PROGID].getService();
|
||||
this.RDFC = this.RDFC.QueryInterface(Components.interfaces.nsIRDFContainer);
|
||||
this.RDFCUtils = Components.classes[JS_RDFBASE_CONTAINER_UTILS_PROGID].getService();
|
||||
this.RDFCUtils = this.RDFCUtils.QueryInterface(Components.interfaces.nsIRDFContainerUtils);
|
||||
if(aDatasource) {
|
||||
this._base_init(aDatasource);
|
||||
}
|
||||
}
|
||||
|
||||
RDFBase.prototype = {
|
||||
RDF : null,
|
||||
RDFC : null,
|
||||
RDFCUtils : null,
|
||||
dsource : null,
|
||||
valid : false,
|
||||
|
||||
_base_init : function(aDatasource) {
|
||||
this.dsource = aDatasource;
|
||||
},
|
||||
|
||||
getDatasource : function()
|
||||
{
|
||||
return this.dsource;
|
||||
},
|
||||
|
||||
isValid : function()
|
||||
{
|
||||
return this.valid;
|
||||
},
|
||||
|
||||
setValid : function(aTruth)
|
||||
{
|
||||
if(typeof(aTruth)=='boolean') {
|
||||
this.valid = aTruth;
|
||||
return this.valid;
|
||||
} else {
|
||||
return null;
|
||||
}
|
||||
},
|
||||
|
||||
flush : function()
|
||||
{
|
||||
if(this.isValid()) {
|
||||
this.dsource.QueryInterface(Components.interfaces.nsIRDFRemoteDataSource).Flush();
|
||||
}
|
||||
}
|
||||
|
||||
};
|
||||
|
||||
RDFBase.prototype.getAnonymousResource = function()
|
||||
{
|
||||
jslibDebug("entering getAnonymousNode");
|
||||
if(this.isValid()) {
|
||||
var res = this.RDF.GetAnonymousResource();
|
||||
return new RDFResource("node", res.Value, null, this.dsource);
|
||||
} else {
|
||||
jslibError(null, "RDF is no longer valid!\n", "NS_ERROR_UNEXPECTED",
|
||||
JS_RDF_FILE+":getNode");
|
||||
return null;
|
||||
}
|
||||
};
|
||||
|
||||
RDFBase.prototype.getAnonymousContainer = function(aType)
|
||||
{
|
||||
jslibDebug("entering getAnonymousContainer");
|
||||
if(this.isValid()) {
|
||||
var res = this.getAnonymousResource();
|
||||
jslibDebug("making Container");
|
||||
if(aType == "bag") {
|
||||
this.RDFCUtils.MakeBag(this.dsource, res.getResource());
|
||||
} else if(aType == "alt") {
|
||||
this.RDFCUtils.MakeAlt(this.dsource, res.getResource());
|
||||
} else {
|
||||
this.RDFCUtils.MakeSeq(this.dsource, res.getResource());
|
||||
}
|
||||
jslibPrint("* made cont ..."+res.getSubject()+"\n");
|
||||
return new RDFContainer(aType, res.getSubject(),null, this.dsource);
|
||||
} else {
|
||||
jslibError(null, "RDF is no longer valid!\n", "NS_ERROR_UNEXPECTED",
|
||||
JS_RDF_FILE+":getNode");
|
||||
return null;
|
||||
}
|
||||
};
|
||||
|
||||
jslibDebug('*** load: '+JS_RDFBASE_FILE+' OK');
|
||||
|
||||
} // END BLOCK JS_LIB_LOADED CHECK
|
||||
|
||||
else
|
||||
{
|
||||
jslibPrint("JS_RDFBase library not loaded:\n" +
|
||||
" \tTo load use: chrome://jslib/content/jslib.js\n" +
|
||||
" \tThen: include('chrome://jslib/content/rdf/rdf.js');\n\n");
|
||||
}
|
||||
|
|
@ -1,271 +0,0 @@
|
|||
/*** -*- Mode: Javascript; tab-width: 2;
|
||||
|
||||
The contents of this file are subject to the Mozilla Public
|
||||
License Version 1.1 (the "License"); you may not use this file
|
||||
except in compliance with the License. You may obtain a copy of
|
||||
the License at http://www.mozilla.org/MPL/
|
||||
|
||||
Software distributed under the License is distributed on an "AS
|
||||
IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
|
||||
implied. See the License for the specific language governing
|
||||
rights and limitations under the License.
|
||||
|
||||
The Original Code is Urban Rage Software code.
|
||||
The Initial Developer of the Original Code is Eric Plaster.
|
||||
|
||||
Portions created by Urban Rage Software are
|
||||
Copyright (C) 2000 Urban Rage Software. All
|
||||
Rights Reserved.
|
||||
|
||||
Contributor(s): Eric Plaster <plaster@urbanrage.com)> (original author)
|
||||
Martin Kutschker <martin.t.kutschker@blackbox.net>
|
||||
|
||||
*/
|
||||
|
||||
if(typeof(JS_LIB_LOADED)=='boolean')
|
||||
{
|
||||
|
||||
// test to make sure filesystem base class is loaded
|
||||
if(typeof(JS_RDFRESOURCE_LOADED)!='boolean')
|
||||
include(JS_LIB_PATH+'rdf/rdfResource.js');
|
||||
|
||||
const JS_RDFCONTAINER_LOADED = true;
|
||||
const JS_RDFCONTAINER_FILE = "rdfContainer.js";
|
||||
|
||||
function RDFContainer(aType, aPath, aParent, aDatasource) {
|
||||
if(aDatasource) {
|
||||
this._container_init(aType, aPath, aParent, aDatasource);
|
||||
}
|
||||
}
|
||||
|
||||
RDFContainer.prototype = new RDFResource;
|
||||
|
||||
RDFContainer.prototype._container_init = function(aType, aPath, aParent, aDatasource)
|
||||
{
|
||||
this._resource_init(aType, aPath, aParent, aDatasource);
|
||||
};
|
||||
|
||||
RDFContainer.prototype.addSeq = function(aSeq) {
|
||||
return this.addContainer(aSeq, "seq");
|
||||
};
|
||||
|
||||
RDFContainer.prototype.addBag = function(aBag) {
|
||||
return this.addContainer(aBag, "bag");
|
||||
};
|
||||
|
||||
RDFContainer.prototype.addAlt = function(aAlt) {
|
||||
return this.addContainer(aAlt, "alt");
|
||||
};
|
||||
|
||||
RDFContainer.prototype.addContainer = function(aContainer, aType)
|
||||
{
|
||||
if(this.isValid()) {
|
||||
if(!aContainer || !aType)
|
||||
jslibError(null, "Must supply two arguments", null, JS_RDFCONTAINER_FILE+":addContainer");
|
||||
|
||||
var res = this.RDF.GetResource(this.subject+":"+aContainer);
|
||||
|
||||
if( this.resource ) {
|
||||
this.RDFC.Init(this.dsource, this.resource );
|
||||
|
||||
if(aType == "bag") {
|
||||
this.RDFCUtils.MakeBag(this.dsource, res);
|
||||
} else if(aType == "alt") {
|
||||
this.RDFCUtils.MakeAlt(this.dsource, res);
|
||||
} else {
|
||||
this.RDFCUtils.MakeSeq(this.dsource, res);
|
||||
}
|
||||
this.RDFC.AppendElement(res);
|
||||
}
|
||||
return new RDFContainer(aType, this.subject+":"+aContainer, this.parent, this.dsource);
|
||||
} else {
|
||||
jslibError(null, "RDFContainer is no longer valid!\n", "NS_ERROR_UNEXPECTED",
|
||||
JS_RDFCONTAINER_FILE+":addContainer");
|
||||
return null;
|
||||
}
|
||||
};
|
||||
|
||||
RDFContainer.prototype.getNode = function(aNode) {
|
||||
var rv = null;
|
||||
if(this.isValid()) {
|
||||
var res = this.RDF.GetResource(this.subject+":"+aNode);
|
||||
if(res) {
|
||||
return new RDFResource("node", this.subject+":"+aNode, this.subject, this.dsource);
|
||||
}
|
||||
} else {
|
||||
jslibError(null, "RDFContainer is no longer valid!\n", "NS_ERROR_UNEXPECTED",
|
||||
JS_RDFCONTAINER_FILE+":getNode");
|
||||
return null;
|
||||
}
|
||||
};
|
||||
|
||||
RDFContainer.prototype.addNode = function(aNode) {
|
||||
if(this.isValid()) {
|
||||
var res = this.RDF.GetResource(this.subject+":"+aNode);
|
||||
this.RDFC.Init(this.dsource, this.resource);
|
||||
this.RDFC.AppendElement(res);
|
||||
return new RDFResource("node", this.subject+":"+aNode, this.subject, this.dsource);
|
||||
} else {
|
||||
jslibError(null, "RDFContainer is no longer valid!\n", "NS_ERROR_UNEXPECTED",
|
||||
JS_RDFCONTAINER_FILE+":addNode");
|
||||
return null;
|
||||
}
|
||||
};
|
||||
|
||||
RDFContainer.prototype.addResource = function(aResource) {
|
||||
if(this.isValid()) {
|
||||
var res = aResource.getResource();
|
||||
this.RDFC.Init(this.dsource, this.resource);
|
||||
this.RDFC.AppendElement(res);
|
||||
} else {
|
||||
jslibError(null, "RDFContainer is no longer valid!\n", "NS_ERROR_UNEXPECTED",
|
||||
JS_RDFCONTAINER_FILE+":addNode");
|
||||
return null;
|
||||
}
|
||||
};
|
||||
|
||||
// FIXME add a getSeq("relative:path");
|
||||
//
|
||||
RDFContainer.prototype.getSubSeqs = function()
|
||||
{
|
||||
return this.getSubResources("seq");
|
||||
};
|
||||
|
||||
RDFContainer.prototype.getSubBags = function()
|
||||
{
|
||||
return this.getSubResources("bag");
|
||||
};
|
||||
|
||||
RDFContainer.prototype.getSubAlts = function()
|
||||
{
|
||||
return this.getSubResources("alt");
|
||||
};
|
||||
|
||||
RDFContainer.prototype.getSubContainers = function()
|
||||
{
|
||||
return this.getSubResources("all");
|
||||
};
|
||||
|
||||
RDFContainer.prototype.getSubNodes = function()
|
||||
{
|
||||
return this.getSubResources("node");
|
||||
};
|
||||
|
||||
RDFContainer.prototype.getSubResources = function(aType)
|
||||
{
|
||||
if(this.isValid()) {
|
||||
var list = new Array;
|
||||
|
||||
this.RDFC.Init(this.dsource, this.resource);
|
||||
|
||||
var elems = this.RDFC.GetElements();
|
||||
while(elems.hasMoreElements()) {
|
||||
var elem = elems.getNext();
|
||||
elem = elem.QueryInterface(Components.interfaces.nsIRDFResource);
|
||||
if(aType == "bag") {
|
||||
if(this.RDFCUtils.IsBag(this.dsource, elem)) {
|
||||
list.push(new RDFContainer(aType, elem.Value, this.subject, this.dsource));
|
||||
}
|
||||
} else if(aType == "alt") {
|
||||
if(this.RDFCUtils.IsAlt(this.dsource, elem)) {
|
||||
list.push(new RDFContainer(aType, elem.Value, this.subject, this.dsource));
|
||||
}
|
||||
} else if(aType == "seq") {
|
||||
if(this.RDFCUtils.IsSeq(this.dsource, elem)) {
|
||||
list.push(new RDFContainer(aType, elem.Value, this.subject, this.dsource));
|
||||
}
|
||||
} else if(aType == "all") {
|
||||
if(this.RDFCUtils.IsContainer(this.dsource, elem)) {
|
||||
list.push(new RDFContainer(aType, elem.Value, this.subject, this.dsource));
|
||||
}
|
||||
} else {
|
||||
if(!this.RDFCUtils.IsContainer(this.dsource, elem)) {
|
||||
list.push(new RDFResource(aType, elem.Value, this.subject, this.dsource));
|
||||
}
|
||||
}
|
||||
}
|
||||
return list;
|
||||
} else {
|
||||
jslibError(null, "RDFContainer is no longer valid!\n", "NS_ERROR_UNEXPECTED",
|
||||
JS_RDFCONTAINER_FILE+":getSubResources");
|
||||
return null;
|
||||
}
|
||||
};
|
||||
|
||||
RDFContainer.prototype.remove_recursive = function(aPath)
|
||||
{
|
||||
if(this.isValid()) {
|
||||
var res = this.RDF.GetResource(aPath);
|
||||
this.RDFC.Init(this.dsource, res);
|
||||
|
||||
var elems = this.RDFC.GetElements();
|
||||
while(elems.hasMoreElements()) {
|
||||
var elem = elems.getNext();
|
||||
if(this.RDFCUtils.IsContainer(this.dsource, elem)) {
|
||||
this.remove_recursive(elem.QueryInterface(Components.interfaces.nsIRDFResource).Value);
|
||||
this.RDFC.Init(this.dsource, res);
|
||||
}
|
||||
var arcs = this.dsource.ArcLabelsOut(elem);
|
||||
while(arcs.hasMoreElements()) {
|
||||
var arc = arcs.getNext();
|
||||
var targets = this.dsource.GetTargets(elem, arc, true);
|
||||
while (targets.hasMoreElements()) {
|
||||
var target = targets.getNext();
|
||||
this.dsource.Unassert(elem, arc, target, true);
|
||||
}
|
||||
}
|
||||
this.RDFC.RemoveElement(elem, false);
|
||||
}
|
||||
this.RDFC.RemoveElement(res, false);
|
||||
} else {
|
||||
jslibError(null, "RDFContainer is no longer valid!\n", "NS_ERROR_UNEXPECTED",
|
||||
JS_RDFCONTAINER_FILE+":remove");
|
||||
return null;
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
RDFContainer.prototype.remove = function(aDeep)
|
||||
{
|
||||
if(this.isValid()) {
|
||||
if(this.parent != null) {
|
||||
var parentres = this.RDF.GetResource(this.parent);
|
||||
this.RDFC.Init(this.dsource, parentres);
|
||||
}
|
||||
|
||||
if(aDeep) {
|
||||
this.remove_recursive(this.subject);
|
||||
}
|
||||
|
||||
var arcs = this.dsource.ArcLabelsOut(this.resource);
|
||||
while(arcs.hasMoreElements()) {
|
||||
var arc = arcs.getNext();
|
||||
var targets = this.dsource.GetTargets(this.resource, arc, true);
|
||||
while (targets.hasMoreElements()) {
|
||||
var target = targets.getNext();
|
||||
this.dsource.Unassert(this.resource, arc, target, true);
|
||||
}
|
||||
}
|
||||
|
||||
if(this.parent != null) {
|
||||
this.RDFC.RemoveElement(this.resource, false);
|
||||
}
|
||||
this.setValid(false);
|
||||
} else {
|
||||
jslibError(null, "RDFContainer is no longer valid!\n", "NS_ERROR_UNEXPECTED",
|
||||
JS_RDFCONTAINER_FILE+":remove");
|
||||
return null;
|
||||
}
|
||||
};
|
||||
|
||||
jslibDebug('*** load: '+JS_RDFCONTAINER_FILE+' OK');
|
||||
|
||||
} // END BLOCK JS_LIB_LOADED CHECK
|
||||
|
||||
else
|
||||
{
|
||||
jslibPrint("JS_RDF library not loaded:\n" +
|
||||
" \tTo load use: chrome://jslib/content/jslib.js\n" +
|
||||
" \tThen: include('chrome://jslib/content/rdf/rdf.js');\n\n");
|
||||
}
|
||||
|
|
@ -1,104 +0,0 @@
|
|||
/*** -*- Mode: Javascript; tab-width: 2;
|
||||
|
||||
The contents of this file are subject to the Mozilla Public
|
||||
License Version 1.1 (the "License"); you may not use this file
|
||||
except in compliance with the License. You may obtain a copy of
|
||||
the License at http://www.mozilla.org/MPL/
|
||||
|
||||
Software distributed under the License is distributed on an "AS
|
||||
IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
|
||||
implied. See the License for the specific language governing
|
||||
rights and limitations under the License.
|
||||
|
||||
The Original Code is Urban Rage Software code.
|
||||
The Initial Developer of the Original Code is Eric Plaster.
|
||||
|
||||
Portions created by Urban Rage Software are
|
||||
Copyright (C) 2000 Urban Rage Software. All
|
||||
Rights Reserved.
|
||||
|
||||
Contributor(s): Eric Plaster <plaster@urbanrage.com)> (original author)
|
||||
Martin Kutschker <martin.t.kutschker@blackbox.net> (polishing)
|
||||
|
||||
*/
|
||||
|
||||
if(typeof(JS_LIB_LOADED)=='boolean')
|
||||
{
|
||||
|
||||
// test to make sure rdf base class is loaded
|
||||
if(typeof(JS_RDF_LOADED)!='boolean')
|
||||
include(JS_LIB_PATH+'rdf/rdf.js');
|
||||
|
||||
// test to make sure file class is loaded
|
||||
if (typeof(JS_FILE_LOADED)!='boolean')
|
||||
include(JS_LIB_PATH+'io/file.js');
|
||||
|
||||
|
||||
const JS_RDFFILE_FLAG_SYNC = 1; // load RDF source synchronously
|
||||
const JS_RDFFILE_FLAG_DONT_CREATE = 2; // don't create RDF file (RDFFile only)
|
||||
const JS_RDFFILE_FILE = "rdfFile.js";
|
||||
|
||||
function RDFFile(aPath, aFlags, aNameSpace, aID)
|
||||
{
|
||||
this.created = false;
|
||||
|
||||
if(aPath)
|
||||
this._file_init(aPath, aFlags, aNameSpace, aID);
|
||||
}
|
||||
RDFFile.prototype = new RDF;
|
||||
|
||||
RDFFile.prototype._file_init = function (aPath, aFlags, aNameSpace, aID) {
|
||||
aFlags = aFlags || JS_RDFFILE_FLAG_SYNC; // default to synchronous loading
|
||||
|
||||
if(aNameSpace == null) {
|
||||
aNameSpace = "http://jslib.mozdev.org/rdf#";
|
||||
}
|
||||
if(aID == null) {
|
||||
aID = "JSLIB";
|
||||
}
|
||||
// Ensure we have a base RDF file to work with
|
||||
var rdf_file = new File(aPath);
|
||||
|
||||
if (!rdf_file.exists() && !(aFlags & JS_RDFFILE_FLAG_DONT_CREATE)) {
|
||||
|
||||
if (rdf_file.open("w") != JS_FILE_OK) {
|
||||
return;
|
||||
}
|
||||
|
||||
var filestr =
|
||||
'<?xml version="1.0" ?>\n' +
|
||||
'<RDF:RDF\n' +
|
||||
' xmlns:'+ aID +'="'+ aNameSpace +'"\n' +
|
||||
' xmlns:RDF="http://www.w3.org/1999/02/22-rdf-syntax-ns#">\n' +
|
||||
'</RDF:RDF>\n';
|
||||
jslibPrint("here4!\n");
|
||||
if (rdf_file.write(filestr) != JS_FILE_OK) {
|
||||
rdf_file.close();
|
||||
return;
|
||||
}
|
||||
|
||||
this.created = true;
|
||||
}
|
||||
rdf_file.close();
|
||||
|
||||
// Get a reference to the available datasources
|
||||
var serv = Components.classes["@mozilla.org/network/io-service;1"].
|
||||
getService(Components.interfaces.nsIIOService);
|
||||
if (!serv) {
|
||||
throw Components.results.ERR_FAILURE;
|
||||
}
|
||||
var uri = serv.newFileURI(rdf_file.nsIFile);
|
||||
this._rdf_init(uri.spec, aFlags);
|
||||
};
|
||||
|
||||
jslibDebug('*** load: '+JS_RDFFILE_FILE+' OK');
|
||||
|
||||
} // END BLOCK JS_LIB_LOADED CHECK
|
||||
|
||||
// If jslib base library is not loaded, dump this error.
|
||||
else
|
||||
{
|
||||
dump("JS_RDFFILE library not loaded:\n" +
|
||||
" \tTo load use: chrome://jslib/content/jslib.js\n" +
|
||||
" \tThen: include('chrome://jslib/content/rdf/rdfFile.js');\n\n");
|
||||
}
|
|
@ -1,311 +0,0 @@
|
|||
/*** -*- Mode: Javascript; tab-width: 2;
|
||||
|
||||
The contents of this file are subject to the Mozilla Public
|
||||
License Version 1.1 (the "License"); you may not use this file
|
||||
except in compliance with the License. You may obtain a copy of
|
||||
the License at http://www.mozilla.org/MPL/
|
||||
|
||||
Software distributed under the License is distributed on an "AS
|
||||
IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
|
||||
implied. See the License for the specific language governing
|
||||
rights and limitations under the License.
|
||||
|
||||
The Original Code is Urban Rage Software code.
|
||||
The Initial Developer of the Original Code is Eric Plaster.
|
||||
|
||||
Portions created by Urban Rage Software are
|
||||
Copyright (C) 2000 Urban Rage Software. All
|
||||
Rights Reserved.
|
||||
|
||||
Contributor(s): Eric Plaster <plaster@urbanrage.com)> (original author)
|
||||
Martin Kutschker <martin.t.kutschker@blackbox.net> (polishing)
|
||||
|
||||
*/
|
||||
|
||||
if(typeof(JS_LIB_LOADED)=='boolean')
|
||||
{
|
||||
// test to make sure rdfBase base class is loaded
|
||||
if(typeof(JS_RDFBASE_LOADED)!='boolean')
|
||||
include(JS_LIB_PATH+'rdf/rdfBase.js');
|
||||
|
||||
const JS_RDFRESOURCE_LOADED = true;
|
||||
const JS_RDFRESOURCE_FILE = "rdfResource.js";
|
||||
|
||||
function RDFResource(aType, aPath, aParentPath, aDatasource) {
|
||||
if(aDatasource) {
|
||||
this._resource_init(aType, aPath, aParentPath, aDatasource);
|
||||
}
|
||||
}
|
||||
|
||||
RDFResource.prototype = new RDFBase;
|
||||
|
||||
RDFResource.prototype.type = null;
|
||||
RDFResource.prototype.parent = null;
|
||||
RDFResource.prototype.resource = null;
|
||||
RDFResource.prototype.subject = null;
|
||||
|
||||
RDFResource.prototype._resource_init = function(aType, aPath, aParentPath, aDatasource) {
|
||||
this.type = aType;
|
||||
this.parent = aParentPath;
|
||||
this.subject = aPath;
|
||||
this.resource = this.RDF.GetResource(aPath);
|
||||
|
||||
this._base_init(aDatasource);
|
||||
if(this.resource) {
|
||||
this.setValid(true);
|
||||
}
|
||||
};
|
||||
|
||||
RDFResource.prototype.getResource = function() {
|
||||
return this.resource;
|
||||
};
|
||||
|
||||
RDFResource.prototype.getSubject = function() {
|
||||
return this.subject;
|
||||
};
|
||||
|
||||
RDFResource.prototype.makeSeq = function(aSeq) {
|
||||
return this.makeContainer("seq");
|
||||
};
|
||||
|
||||
RDFResource.prototype.makeBag = function(aBag) {
|
||||
return this.makeContainer("bag");
|
||||
};
|
||||
|
||||
RDFResource.prototype.makeAlt = function(aAlt) {
|
||||
return this.makeContainer("alt");
|
||||
};
|
||||
|
||||
RDFResource.prototype.makeContainer = function(aType) {
|
||||
this.RDFC.Init(this.dsource, this.resource );
|
||||
|
||||
if(aType == "bag") {
|
||||
this.RDFCUtils.MakeBag(this.dsource, this.resource);
|
||||
} else if(aType == "alt") {
|
||||
this.RDFCUtils.MakeAlt(this.dsource, this.resource);
|
||||
} else {
|
||||
this.RDFCUtils.MakeSeq(this.dsource, this.resource);
|
||||
}
|
||||
jslibPrint("* made cont ...\n");
|
||||
return new RDFContainer(aType, this.resource_path+":"+aContainer, this.parent, this.dsource);
|
||||
this.setValid(false);
|
||||
};
|
||||
|
||||
RDFResource.prototype.setAttribute = function(aName, aValue)
|
||||
{
|
||||
if(this.isValid()) {
|
||||
var oldvalue = this.getAttribute(aName);
|
||||
|
||||
if(oldvalue) {
|
||||
this.dsource.Change(this.resource,
|
||||
this.RDF.GetResource(aName),
|
||||
this.RDF.GetLiteral(oldvalue),
|
||||
this.RDF.GetLiteral(aValue) );
|
||||
jslibPrint("\n Changing old value in "+this.subject+"\n");
|
||||
} else {
|
||||
this.dsource.Assert(this.resource,
|
||||
this.RDF.GetResource(aName),
|
||||
this.RDF.GetLiteral(aValue),
|
||||
true );
|
||||
jslibPrint("\n Adding a new value in "+this.subject+"\n");
|
||||
}
|
||||
return true;
|
||||
} else {
|
||||
return false;
|
||||
}
|
||||
};
|
||||
|
||||
RDFResource.prototype.getAttribute = function(aName)
|
||||
{
|
||||
if(this.isValid()) {
|
||||
var itemRes = this.RDF.GetResource(aName);
|
||||
if (!itemRes) { return null; }
|
||||
var target = this.dsource.GetTarget(this.resource, itemRes, true);
|
||||
if (target) target = target.QueryInterface(Components.interfaces.nsIRDFLiteral);
|
||||
if (!target) { return null; }
|
||||
return target.Value;
|
||||
} else {
|
||||
jslibError(null, "RDFResource is no longer valid!\n", "NS_ERROR_UNEXPECTED",
|
||||
JS_RDFRESOURCE_FILE+":getAttribute");
|
||||
return null;
|
||||
}
|
||||
};
|
||||
|
||||
RDFResource.prototype.getContainer = function(aName,aType)
|
||||
{
|
||||
if(this.isValid()) {
|
||||
var itemRes = this.RDF.GetResource(aName);
|
||||
if (!itemRes) { return null; }
|
||||
var target = this.dsource.GetTarget(this.resource, itemRes, true);
|
||||
if (target) target = target.QueryInterface(Components.interfaces.nsIRDFResource);
|
||||
if (!target) { return null; }
|
||||
if(!aType) aType = "bag";
|
||||
return new RDFContainer(aType, target.Value, null, this.dsource);
|
||||
} else {
|
||||
jslibError(null, "RDFResource is no longer valid!\n", "NS_ERROR_UNEXPECTED",
|
||||
JS_RDFRESOURCE_FILE+":getAttribute");
|
||||
return null;
|
||||
}
|
||||
};
|
||||
|
||||
RDFResource.prototype.addContainer = function(aName,aType)
|
||||
{
|
||||
if(this.isValid()) {
|
||||
//var oldvalue = this.getContainer(aName);
|
||||
var newC = this.getAnonymousContainer(aType);
|
||||
this.dsource.Assert( this.resource,this.RDF.GetResource(aName), newC.getResource(), true );
|
||||
jslibPrint("\n Adding a new value in "+this.subject+"\n");
|
||||
return newC;
|
||||
} else {
|
||||
jslibPrint("\n cudnt get anon container\n");
|
||||
return null;
|
||||
}
|
||||
};
|
||||
|
||||
RDFResource.prototype.getAssociationContainers = function(aName)
|
||||
{
|
||||
if(this.isValid()) {
|
||||
var list = new Array();
|
||||
var arcs = this.dsource.ArcLabelsIn(this.resource);
|
||||
while(arcs.hasMoreElements()) {
|
||||
var arc = arcs.getNext();
|
||||
arc = arc.QueryInterface(Components.interfaces.nsIRDFResource);
|
||||
jslibDebug("Got arc " +arc.Value);
|
||||
if(!this.RDFCUtils.IsOrdinalProperty(arc)) {
|
||||
continue;
|
||||
}
|
||||
var targets = this.dsource.GetSources(arc, this.resource, true);
|
||||
var itemRes = this.RDF.GetResource(aName);
|
||||
while (targets.hasMoreElements()) {
|
||||
var target = targets.getNext();
|
||||
target = target.QueryInterface(Components.interfaces.nsIRDFResource);
|
||||
if(this.RDFCUtils.IsContainer(this.dsource,target)) {
|
||||
if(this.dsource.hasArcIn( target, itemRes)) {
|
||||
target = new RDFContainer(null, target.Value, null, this.dsource);
|
||||
list.push(target);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
return list;
|
||||
} else {
|
||||
jslibError(null, "RDFResource is no longer valid!\n", "NS_ERROR_UNEXPECTED",
|
||||
JS_RDFRESOURCE_FILE+":getAttribute");
|
||||
return null;
|
||||
}
|
||||
};
|
||||
|
||||
RDFResource.prototype.removeAttribute = function(aName)
|
||||
{
|
||||
if(this.isValid()) {
|
||||
var itemRes = this.RDF.GetResource(aName, true);
|
||||
var target = this.dsource.GetTarget(this.resource, itemRes, true);
|
||||
this.dsource.Unassert(this.resource, itemRes, target);
|
||||
} else {
|
||||
jslibError(null, "RDFResource is no longer valid!\n", "NS_ERROR_UNEXPECTED",
|
||||
JS_RDFRESOURCE_FILE+":removeAttribute");
|
||||
return null;
|
||||
}
|
||||
};
|
||||
|
||||
RDFResource.prototype.setAllAttributes = function(aList)
|
||||
{
|
||||
var length = 0;
|
||||
try {
|
||||
length = aList.length;
|
||||
} catch(e) {
|
||||
return false;
|
||||
}
|
||||
if(this.isValid()) {
|
||||
var arcs = this.dsource.ArcLabelsOut(this.resource);
|
||||
while(arcs.hasMoreElements()) {
|
||||
var arc = arcs.getNext();
|
||||
arc = arc.QueryInterface(Components.interfaces.nsIRDFResource);
|
||||
var obj = new Object;
|
||||
var l = arc.Value.split("#");
|
||||
obj.name = l[l.length-1];
|
||||
var targets = this.dsource.GetTargets(this.resource, arc, true);
|
||||
while (targets.hasMoreElements()) {
|
||||
var target = targets.getNext();
|
||||
this.dsource.Unassert(this.resource, arc, target, true);
|
||||
}
|
||||
}
|
||||
for(var i=0; i<length; i++) {
|
||||
this.setAttribute(aList[i].name, aList[i].value);
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
RDFResource.prototype.getAllAttributes = function()
|
||||
{
|
||||
var list = new Array;
|
||||
if(this.isValid()) {
|
||||
var arcs = this.dsource.ArcLabelsOut(this.resource);
|
||||
while(arcs.hasMoreElements()) {
|
||||
var arc = arcs.getNext();
|
||||
arc = arc.QueryInterface(Components.interfaces.nsIRDFResource);
|
||||
var obj = new Object;
|
||||
var l = arc.Value.split("#");
|
||||
obj.name = l[l.length-1];
|
||||
var targets = this.dsource.GetTargets(this.resource, arc, true);
|
||||
while (targets.hasMoreElements()) {
|
||||
var target = targets.getNext();
|
||||
if(target) {
|
||||
try {
|
||||
target = target.QueryInterface(Components.interfaces.nsIRDFLiteral);
|
||||
}
|
||||
catch(e) {
|
||||
jslibPrint('not a literal');
|
||||
target = target.QueryInterface(Components.interfaces.nsIRDFResource);
|
||||
}
|
||||
obj.value = target.Value;
|
||||
list.push(obj);
|
||||
}
|
||||
}
|
||||
}
|
||||
return list;
|
||||
} else {
|
||||
jslibError(null, "RDFResource is no longer valid!\n", "NS_ERROR_UNEXPECTED",
|
||||
JS_RDFRESOURCE_FILE+":getAllAttributes");
|
||||
return null;
|
||||
}
|
||||
};
|
||||
|
||||
RDFResource.prototype.remove = function()
|
||||
{
|
||||
if(this.isValid()) {
|
||||
// FIXME: if we get this node from RDF, it has no parent...
|
||||
// try just removing all arcs and targets...
|
||||
// var parentres = this.RDF.GetResource(this.parent);
|
||||
// this.RDFC.Init(this.dsource, parentres);
|
||||
|
||||
var arcs = this.dsource.ArcLabelsOut(this.resource);
|
||||
while(arcs.hasMoreElements()) {
|
||||
var arc = arcs.getNext();
|
||||
var targets = this.dsource.GetTargets(this.resource, arc, true);
|
||||
while (targets.hasMoreElements()) {
|
||||
var target = targets.getNext();
|
||||
this.dsource.Unassert(this.resource, arc, target, true);
|
||||
}
|
||||
}
|
||||
this.RDFC.RemoveElement(this.resource, false); //removes the parent element
|
||||
this.setValid(false);
|
||||
} else {
|
||||
jslibError(null, "RDFResource is no longer valid!\n", "NS_ERROR_UNEXPECTED",
|
||||
JS_RDFRESOURCE_FILE+":remove");
|
||||
return null;
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
jslibDebug('*** load: '+JS_RDFRESOURCE_FILE+' OK');
|
||||
|
||||
} // END BLOCK JS_LIB_LOADED CHECK
|
||||
|
||||
else
|
||||
{
|
||||
dump("JS_RDFResource library not loaded:\n" +
|
||||
" \tTo load use: chrome://jslib/content/jslib.js\n" +
|
||||
" \tThen: include('chrome://jslib/content/rdf/rdf.js');\n\n");
|
||||
}
|
||||
|
|
@ -1,11 +1,11 @@
|
|||
/* -*- Mode: Java; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
|
||||
/* ***** BEGIN LICENSE BLOCK *****
|
||||
* Version: NPL 1.1/GPL 2.0/LGPL 2.1
|
||||
* Version: MPL 1.1/GPL 2.0/LGPL 2.1
|
||||
*
|
||||
* The contents of this file are subject to the Netscape Public License
|
||||
* Version 1.1 (the "License"); you may not use this file except in
|
||||
* compliance with the License. You may obtain a copy of the License at
|
||||
* http://www.mozilla.org/NPL/
|
||||
* The contents of this file are subject to the Mozilla Public License Version
|
||||
* 1.1 (the "License"); you may not use this file except in compliance with
|
||||
* the License. You may obtain a copy of the License at
|
||||
* http://www.mozilla.org/MPL/
|
||||
*
|
||||
* Software distributed under the License is distributed on an "AS IS" basis,
|
||||
* WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
|
||||
|
@ -19,7 +19,8 @@
|
|||
* Portions created by the Initial Developer are Copyright (C) 2001-2002
|
||||
* the Initial Developer. All Rights Reserved.
|
||||
*
|
||||
* Contributor(s): ArentJan Banck <ajbanck@planet.nl>
|
||||
* Contributor(s):
|
||||
* ArentJan Banck <ajbanck@planet.nl>
|
||||
*
|
||||
* Alternatively, the contents of this file may be used under the terms of
|
||||
* either the GNU General Public License Version 2 or later (the "GPL"), or
|
||||
|
@ -27,11 +28,11 @@
|
|||
* in which case the provisions of the GPL or the LGPL are applicable instead
|
||||
* of those above. If you wish to allow use of your version of this file only
|
||||
* under the terms of either the GPL or the LGPL, and not to allow others to
|
||||
* use your version of this file under the terms of the NPL, indicate your
|
||||
* use your version of this file under the terms of the MPL, indicate your
|
||||
* decision by deleting the provisions above and replace them with the notice
|
||||
* and other provisions required by the GPL or the LGPL. If you do not delete
|
||||
* the provisions above, a recipient may use your version of this file under
|
||||
* the terms of any one of the NPL, the GPL or the LGPL.
|
||||
* the terms of any one of the MPL, the GPL or the LGPL.
|
||||
*
|
||||
* ***** END LICENSE BLOCK ***** */
|
||||
|
||||
|
|
|
@ -1,56 +0,0 @@
|
|||
<!-- ***** BEGIN LICENSE BLOCK *****
|
||||
- Version: MPL 1.1/GPL 2.0/LGPL 2.1
|
||||
-
|
||||
- The contents of this file are subject to the Mozilla Public License Version
|
||||
- 1.1 (the "License"); you may not use this file except in compliance with
|
||||
- the License. You may obtain a copy of the License at
|
||||
- http://www.mozilla.org/MPL/
|
||||
-
|
||||
- Software distributed under the License is distributed on an "AS IS" basis,
|
||||
- WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
|
||||
- for the specific language governing rights and limitations under the
|
||||
- License.
|
||||
-
|
||||
- The Original Code is mozilla.org code.
|
||||
-
|
||||
- The Initial Developer of the Original Code is
|
||||
- the Mozilla Organization.
|
||||
- Portions created by the Initial Developer are Copyright (C) 1998-2002
|
||||
- the Initial Developer. All Rights Reserved.
|
||||
-
|
||||
- Contributor(s):
|
||||
- Hungarian translation by Gábor Ziegler <gziegler@freemail.hu>
|
||||
- Alternatively, the contents of this file may be used under the terms of
|
||||
- either the GNU General Public License Version 2 or later (the "GPL"), or
|
||||
- the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
|
||||
- in which case the provisions of the GPL or the LGPL are applicable instead
|
||||
- of those above. If you wish to allow use of your version of this file only
|
||||
- under the terms of either the GPL or the LGPL, and not to allow others to
|
||||
- use your version of this file under the terms of the MPL, indicate your
|
||||
- decision by deleting the provisions above and replace them with the notice
|
||||
- and other provisions required by the LGPL or the GPL. If you do not delete
|
||||
- the provisions above, a recipient may use your version of this file under
|
||||
- the terms of any one of the MPL, the GPL or the LGPL.
|
||||
-
|
||||
- ***** END LICENSE BLOCK ***** -->
|
||||
|
||||
<!-- Select addresses for mail message dialog -->
|
||||
<!ENTITY ab-selectAddressesDialog.title "E-mail címek kiválasztása">
|
||||
<!ENTITY ab-selectAddressesDialogHeader.label "Címzettek kiválasztása">
|
||||
<!ENTITY ab-selectAddressesDialogLookIn.label "Keresés itt: ">
|
||||
<!ENTITY ab-selectAddressesDialogNameColumn.label "Név">
|
||||
<!ENTITY ab-selectAddressesDialogEmailColumn.label "E-mail cím">
|
||||
<!ENTITY ab-selectAddressesDialogFor.label "számára: ">
|
||||
<!ENTITY ab-selectAddressesDialogClearButton.label "Törlés">
|
||||
<!ENTITY ab-selectAddressesDialogToButton.label "Címzett ">
|
||||
<!ENTITY ab-selectAddressesDialogCcButton.label "Másolat ">
|
||||
<!ENTITY ab-selectAddressesDialogBccButton.label "Rejtett másolat ">
|
||||
<!ENTITY ab-selectAddressesDialogRemoveButton.label "Eltávolítás">
|
||||
<!ENTITY ab-selectAddressesDialogAddressTo.label "Az üzenet címzettje:">
|
||||
<!ENTITY ab-selectAddressesDialogPrefixTo.label "Címzett: ">
|
||||
<!ENTITY ab-selectAddressesDialogPrefixCc.label "Másolat: ">
|
||||
<!ENTITY ab-selectAddressesDialogPrefixBcc.label "Rejtett másolat: ">
|
||||
<!ENTITY ab-selectAddressesDialogNoEmailMessage.label "Nincs e-mail cím">
|
||||
<!ENTITY ab-selectAddressesDialogInvite.label "Meghívó">
|
||||
<!ENTITY ab-selectAddressesDialogUninvite.label "Eltávolítás">
|
||||
<!ENTITY ab-selectAddressesDialogInviteList.label "Meghívottak listája:">
|
|
@ -1,56 +0,0 @@
|
|||
<!-- ***** BEGIN LICENSE BLOCK *****
|
||||
- Version: MPL 1.1/GPL 2.0/LGPL 2.1
|
||||
-
|
||||
- The contents of this file are subject to the Mozilla Public License Version
|
||||
- 1.1 (the "License"); you may not use this file except in compliance with
|
||||
- the License. You may obtain a copy of the License at
|
||||
- http://www.mozilla.org/MPL/
|
||||
-
|
||||
- Software distributed under the License is distributed on an "AS IS" basis,
|
||||
- WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
|
||||
- for the specific language governing rights and limitations under the
|
||||
- License.
|
||||
-
|
||||
- The Original Code is mozilla.org code.
|
||||
-
|
||||
- The Initial Developer of the Original Code is
|
||||
- the Mozilla Organization.
|
||||
- Portions created by the Initial Developer are Copyright (C) 1998-2002
|
||||
- the Initial Developer. All Rights Reserved.
|
||||
-
|
||||
- Contributor(s):
|
||||
- Translated to Japanese by Teiji Matsuba <matsuba@dream.com>
|
||||
- Alternatively, the contents of this file may be used under the terms of
|
||||
- either the GNU General Public License Version 2 or later (the "GPL"), or
|
||||
- the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
|
||||
- in which case the provisions of the GPL or the LGPL are applicable instead
|
||||
- of those above. If you wish to allow use of your version of this file only
|
||||
- under the terms of either the GPL or the LGPL, and not to allow others to
|
||||
- use your version of this file under the terms of the MPL, indicate your
|
||||
- decision by deleting the provisions above and replace them with the notice
|
||||
- and other provisions required by the LGPL or the GPL. If you do not delete
|
||||
- the provisions above, a recipient may use your version of this file under
|
||||
- the terms of any one of the MPL, the GPL or the LGPL.
|
||||
-
|
||||
- ***** END LICENSE BLOCK ***** -->
|
||||
|
||||
<!-- Select addresses for mail message dialog -->
|
||||
<!ENTITY ab-selectAddressesDialog.title "Internet 応用ダイアログ- アドレス選択">
|
||||
<!ENTITY ab-selectAddressesDialogHeader.label "アドレスを選択">
|
||||
<!ENTITY ab-selectAddressesDialogLookIn.label "場所: ">
|
||||
<!ENTITY ab-selectAddressesDialogNameColumn.label "名前">
|
||||
<!ENTITY ab-selectAddressesDialogEmailColumn.label "メールアドレス">
|
||||
<!ENTITY ab-selectAddressesDialogFor.label "for: ">
|
||||
<!ENTITY ab-selectAddressesDialogClearButton.label "クリア">
|
||||
<!ENTITY ab-selectAddressesDialogToButton.label "宛先 ">
|
||||
<!ENTITY ab-selectAddressesDialogCcButton.label "Cc ">
|
||||
<!ENTITY ab-selectAddressesDialogBccButton.label "Bcc ">
|
||||
<!ENTITY ab-selectAddressesDialogRemoveButton.label "削除">
|
||||
<!ENTITY ab-selectAddressesDialogAddressTo.label "メッセージ通知アドレス:">
|
||||
<!ENTITY ab-selectAddressesDialogPrefixTo.label "宛先: ">
|
||||
<!ENTITY ab-selectAddressesDialogPrefixCc.label "CC: ">
|
||||
<!ENTITY ab-selectAddressesDialogPrefixBcc.label "Bcc: ">
|
||||
<!ENTITY ab-selectAddressesDialogNoEmailMessage.label "メールアドレスなし">
|
||||
<!ENTITY ab-selectAddressesDialogInvite.label "招待">
|
||||
<!ENTITY ab-selectAddressesDialogUninvite.label "削除">
|
||||
<!ENTITY ab-selectAddressesDialogInviteList.label "招待リスト:">
|
|
@ -1,111 +0,0 @@
|
|||
<!-- ***** BEGIN LICENSE BLOCK *****
|
||||
- Version: MPL 1.1/GPL 2.0/LGPL 2.1
|
||||
-
|
||||
- The contents of this file are subject to the Mozilla Public License Version
|
||||
- 1.1 (the "License"); you may not use this file except in compliance with
|
||||
- the License. You may obtain a copy of the License at
|
||||
- http://www.mozilla.org/MPL/
|
||||
-
|
||||
- Software distributed under the License is distributed on an "AS IS" basis,
|
||||
- WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
|
||||
- for the specific language governing rights and limitations under the
|
||||
- License.
|
||||
-
|
||||
- The Original Code is OEone Calendar Code, released October 31st, 2001.
|
||||
-
|
||||
- The Initial Developer of the Original Code is
|
||||
- OEone Corporation.
|
||||
- Portions created by the Initial Developer are Copyright (C) 2001
|
||||
- the Initial Developer. All Rights Reserved.
|
||||
-
|
||||
- Contributor(s): Garth Smedley <garths@oeone.com>
|
||||
- Patrik Carlsson <patrik.carlsson@mail.com>
|
||||
- Alternatively, the contents of this file may be used under the terms of
|
||||
- either the GNU General Public License Version 2 or later (the "GPL"), or
|
||||
- the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
|
||||
- in which case the provisions of the GPL or the LGPL are applicable instead
|
||||
- of those above. If you wish to allow use of your version of this file only
|
||||
- under the terms of either the GPL or the LGPL, and not to allow others to
|
||||
- use your version of this file under the terms of the MPL, indicate your
|
||||
- decision by deleting the provisions above and replace them with the notice
|
||||
- and other provisions required by the LGPL or the GPL. If you do not delete
|
||||
- the provisions above, a recipient may use your version of this file under
|
||||
- the terms of any one of the MPL, the GPL or the LGPL.
|
||||
-
|
||||
- ***** END LICENSE BLOCK ***** -->
|
||||
|
||||
<!ENTITY time.midnight "Midnatt" >
|
||||
<!ENTITY time.1 "1:00" >
|
||||
<!ENTITY time.2 "2:00" >
|
||||
<!ENTITY time.3 "3:00" >
|
||||
<!ENTITY time.4 "4:00" >
|
||||
<!ENTITY time.5 "5:00" >
|
||||
<!ENTITY time.6 "6:00" >
|
||||
<!ENTITY time.7 "7:00" >
|
||||
<!ENTITY time.8 "8:00" >
|
||||
<!ENTITY time.9 "9:00" >
|
||||
<!ENTITY time.10 "10:00" >
|
||||
<!ENTITY time.11 "11:00" >
|
||||
<!ENTITY time.noon "12:00" >
|
||||
<!ENTITY time.13 "12:00" >
|
||||
<!ENTITY time.14 "14:00" >
|
||||
<!ENTITY time.15 "15:00" >
|
||||
<!ENTITY time.16 "16:00" >
|
||||
<!ENTITY time.17 "17:00" >
|
||||
<!ENTITY time.18 "18:00" >
|
||||
<!ENTITY time.19 "19:00" >
|
||||
<!ENTITY time.20 "20:00" >
|
||||
<!ENTITY time.21 "21:00" >
|
||||
<!ENTITY time.22 "22:00" >
|
||||
<!ENTITY time.23 "23:00" >
|
||||
|
||||
<!-- Month Names -->
|
||||
<!ENTITY day.1.Ddd "Sön" >
|
||||
<!ENTITY day.2.Ddd "Mån" >
|
||||
<!ENTITY day.3.Ddd "Tis" >
|
||||
<!ENTITY day.4.Ddd "Ons" >
|
||||
<!ENTITY day.5.Ddd "Tor" >
|
||||
<!ENTITY day.6.Ddd "Fre" >
|
||||
<!ENTITY day.7.Ddd "Lör" >
|
||||
|
||||
<!ENTITY day.1.DDD "SÖN" >
|
||||
<!ENTITY day.2.DDD "MÅN" >
|
||||
<!ENTITY day.3.DDD "TIS" >
|
||||
<!ENTITY day.4.DDD "ONS" >
|
||||
<!ENTITY day.5.DDD "TOR" >
|
||||
<!ENTITY day.6.DDD "FRE" >
|
||||
<!ENTITY day.7.DDD "LÖR" >
|
||||
|
||||
<!ENTITY day.1.name "Söndag" >
|
||||
<!ENTITY day.2.name "Måndag" >
|
||||
<!ENTITY day.3.name "Tisdag" >
|
||||
<!ENTITY day.4.name "Onsdag" >
|
||||
<!ENTITY day.5.name "Torsdag" >
|
||||
<!ENTITY day.6.name "Fredag" >
|
||||
<!ENTITY day.7.name "Lördag" >
|
||||
|
||||
<!ENTITY time.am "AM" >
|
||||
<!ENTITY time.pm "PM" >
|
||||
|
||||
<!ENTITY month.1.MMM "JAN" >
|
||||
<!ENTITY month.2.MMM "FEB" >
|
||||
<!ENTITY month.3.MMM "MAR" >
|
||||
<!ENTITY month.4.MMM "APR" >
|
||||
<!ENTITY month.5.MMM "MAJ" >
|
||||
<!ENTITY month.6.MMM "JUN" >
|
||||
<!ENTITY month.7.MMM "JUL" >
|
||||
<!ENTITY month.8.MMM "AUG" >
|
||||
<!ENTITY month.9.MMM "SEP" >
|
||||
<!ENTITY month.10.MMM "OKT" >
|
||||
<!ENTITY month.11.MMM "NOV" >
|
||||
<!ENTITY month.12.MMM "DEC" >
|
||||
|
||||
<!ENTITY time.AM "AM" >
|
||||
<!ENTITY time.PM "PM" >
|
||||
|
||||
<!ENTITY more.label "MER" >
|
||||
<!ENTITY less.label "MINDRE" >
|
||||
|
||||
<!ENTITY add.label "Add">
|
||||
<!ENTITY edit.label "Edit">
|
||||
<!ENTITY remove.label "Remove">
|
|
@ -1,22 +1,42 @@
|
|||
#!/bin/sh
|
||||
#
|
||||
# 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/
|
||||
# ***** BEGIN LICENSE BLOCK *****
|
||||
# Version: MPL 1.1/GPL 2.0/LGPL 2.1
|
||||
#
|
||||
# Software distributed under the NPL is distributed on an "AS IS" basis,
|
||||
# WITHOUT WARRANTY OF ANY KIND, either express or implied. See the NPL
|
||||
# The contents of this file are subject to the Mozilla Public License Version
|
||||
# 1.1 (the "License"); you may not use this file except in compliance with
|
||||
# the License. You may obtain a copy of the License at
|
||||
# http://www.mozilla.org/MPL/
|
||||
#
|
||||
# Software distributed under the License is distributed on an "AS IS" basis,
|
||||
# WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
|
||||
# for the specific language governing rights and limitations under the
|
||||
# NPL.
|
||||
# License.
|
||||
#
|
||||
# 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 Original Code is mozilla.org Code.
|
||||
#
|
||||
# The Initial Developer of the Original Code is
|
||||
# Netscape Communications Corporation.
|
||||
# Portions created by the Initial Developer are Copyright (C) 1998
|
||||
# the Initial Developer. All Rights Reserved.
|
||||
#
|
||||
# Contributor(s):
|
||||
#
|
||||
# Alternatively, the contents of this file may be used under the terms of
|
||||
# either the GNU General Public License Version 2 or later (the "GPL"), or
|
||||
# the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
|
||||
# in which case the provisions of the GPL or the LGPL are applicable instead
|
||||
# of those above. If you wish to allow use of your version of this file only
|
||||
# under the terms of either the GPL or the LGPL, and not to allow others to
|
||||
# use your version of this file under the terms of the MPL, indicate your
|
||||
# decision by deleting the provisions above and replace them with the notice
|
||||
# and other provisions required by the GPL or the LGPL. If you do not delete
|
||||
# the provisions above, a recipient may use your version of this file under
|
||||
# the terms of any one of the MPL, the GPL or the LGPL.
|
||||
#
|
||||
# ***** END LICENSE BLOCK *****
|
||||
|
||||
## $Id: mozilla.in,v 1.6 2004-08-05 21:17:47 mostafah%oeone.com Exp $
|
||||
## $Id: mozilla.in,v 1.7 2005-02-02 15:10:47 gerv%gerv.net Exp $
|
||||
##
|
||||
## Usage:
|
||||
##
|
||||
|
|
|
@ -1,41 +0,0 @@
|
|||
#
|
||||
# The contents of this file are subject to the Netscape Public
|
||||
# License Version 1.1 (the "License"); you may not use this file
|
||||
# except in compliance with the License. You may obtain a copy of
|
||||
# the License at http://www.mozilla.org/NPL/
|
||||
#
|
||||
# Software distributed under the License is distributed on an "AS
|
||||
# IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
|
||||
# implied. See the License for the specific language governing
|
||||
# rights and limitations under the License.
|
||||
#
|
||||
# The Original Code is mozilla.org code.
|
||||
#
|
||||
# The Initial Developer of the Original Code is Netscape
|
||||
# Communications Corporation. Portions created by Netscape are
|
||||
# Copyright (C) 1998 Netscape Communications Corporation. All
|
||||
# Rights Reserved.
|
||||
#
|
||||
# Contributor(s):
|
||||
#
|
||||
|
||||
DEPTH = ../../../..
|
||||
topsrcdir = @top_srcdir@
|
||||
srcdir = @srcdir@
|
||||
VPATH = @srcdir@
|
||||
|
||||
include $(DEPTH)/config/autoconf.mk
|
||||
|
||||
include $(topsrcdir)/config/rules.mk
|
||||
|
||||
FILES := mimeTypes.rdf
|
||||
|
||||
libs:: $(FILES)
|
||||
$(INSTALL) $^ $(DIST)/bin/defaults/profile
|
||||
$(INSTALL) $^ $(DIST)/bin/defaults/profile/US
|
||||
|
||||
install:: $(FILES)
|
||||
$(SYSINSTALL) $(IFLAGS1) $^ $(DESTDIR)$(mozappdir)/defaults/profile
|
||||
$(SYSINSTALL) $(IFLAGS1) $^ $(DESTDIR)$(mozappdir)/defaults/profile/US
|
||||
|
||||
|
|
@ -1,18 +1,39 @@
|
|||
#
|
||||
# The contents of this file are subject to the Mozilla Public
|
||||
# License Version 1.1 (the "License"); you may not use this file
|
||||
# except in compliance with the License. You may obtain a copy of
|
||||
# the License at http://www.mozilla.org/MPL/
|
||||
# ***** BEGIN LICENSE BLOCK *****
|
||||
# Version: MPL 1.1/GPL 2.0/LGPL 2.1
|
||||
#
|
||||
# Software distributed under the License is distributed on an "AS
|
||||
# IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
|
||||
# implied. See the License for the specific language governing
|
||||
# rights and limitations under the License.
|
||||
# The contents of this file are subject to the Mozilla Public License Version
|
||||
# 1.1 (the "License"); you may not use this file except in compliance with
|
||||
# the License. You may obtain a copy of the License at
|
||||
# http://www.mozilla.org/MPL/
|
||||
#
|
||||
# Software distributed under the License is distributed on an "AS IS" basis,
|
||||
# WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
|
||||
# for the specific language governing rights and limitations under the
|
||||
# License.
|
||||
#
|
||||
# The Original Code is mozilla.org code.
|
||||
#
|
||||
# Contributor(s):
|
||||
# The Initial Developer of the Original Code is
|
||||
# Netscape Communications Corporation.
|
||||
# Portions created by the Initial Developer are Copyright (C) 2001
|
||||
# the Initial Developer. All Rights Reserved.
|
||||
#
|
||||
# Contributor(s):
|
||||
#
|
||||
# Alternatively, the contents of this file may be used under the terms of
|
||||
# either the GNU General Public License Version 2 or later (the "GPL"), or
|
||||
# the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
|
||||
# in which case the provisions of the GPL or the LGPL are applicable instead
|
||||
# of those above. If you wish to allow use of your version of this file only
|
||||
# under the terms of either the GPL or the LGPL, and not to allow others to
|
||||
# use your version of this file under the terms of the MPL, indicate your
|
||||
# decision by deleting the provisions above and replace them with the notice
|
||||
# and other provisions required by the GPL or the LGPL. If you do not delete
|
||||
# the provisions above, a recipient may use your version of this file under
|
||||
# the terms of any one of the MPL, the GPL or the LGPL.
|
||||
#
|
||||
# ***** END LICENSE BLOCK *****
|
||||
|
||||
DEPTH = ../../../../..
|
||||
topsrcdir = @top_srcdir@
|
||||
|
|
|
@ -1,18 +1,39 @@
|
|||
#
|
||||
# The contents of this file are subject to the Mozilla Public
|
||||
# License Version 1.1 (the "License"); you may not use this file
|
||||
# except in compliance with the License. You may obtain a copy of
|
||||
# the License at http://www.mozilla.org/MPL/
|
||||
# ***** BEGIN LICENSE BLOCK *****
|
||||
# Version: MPL 1.1/GPL 2.0/LGPL 2.1
|
||||
#
|
||||
# Software distributed under the License is distributed on an "AS
|
||||
# IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
|
||||
# implied. See the License for the specific language governing
|
||||
# rights and limitations under the License.
|
||||
# The contents of this file are subject to the Mozilla Public License Version
|
||||
# 1.1 (the "License"); you may not use this file except in compliance with
|
||||
# the License. You may obtain a copy of the License at
|
||||
# http://www.mozilla.org/MPL/
|
||||
#
|
||||
# Software distributed under the License is distributed on an "AS IS" basis,
|
||||
# WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
|
||||
# for the specific language governing rights and limitations under the
|
||||
# License.
|
||||
#
|
||||
# The Original Code is mozilla.org code.
|
||||
#
|
||||
# Contributor(s):
|
||||
# The Initial Developer of the Original Code is
|
||||
# Netscape Communications Corporation.
|
||||
# Portions created by the Initial Developer are Copyright (C) 2001
|
||||
# the Initial Developer. All Rights Reserved.
|
||||
#
|
||||
# Contributor(s):
|
||||
#
|
||||
# Alternatively, the contents of this file may be used under the terms of
|
||||
# either the GNU General Public License Version 2 or later (the "GPL"), or
|
||||
# the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
|
||||
# in which case the provisions of the GPL or the LGPL are applicable instead
|
||||
# of those above. If you wish to allow use of your version of this file only
|
||||
# under the terms of either the GPL or the LGPL, and not to allow others to
|
||||
# use your version of this file under the terms of the MPL, indicate your
|
||||
# decision by deleting the provisions above and replace them with the notice
|
||||
# and other provisions required by the GPL or the LGPL. If you do not delete
|
||||
# the provisions above, a recipient may use your version of this file under
|
||||
# the terms of any one of the MPL, the GPL or the LGPL.
|
||||
#
|
||||
# ***** END LICENSE BLOCK *****
|
||||
|
||||
DEPTH = ../../../../../..
|
||||
topsrcdir = @top_srcdir@
|
||||
|
|
|
@ -1,11 +1,11 @@
|
|||
/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
|
||||
/* ***** BEGIN LICENSE BLOCK *****
|
||||
* Version: NPL 1.1/GPL 2.0/LGPL 2.1
|
||||
* Version: MPL 1.1/GPL 2.0/LGPL 2.1
|
||||
*
|
||||
* The contents of this file are subject to the Netscape Public License
|
||||
* Version 1.1 (the "License"); you may not use this file except in
|
||||
* compliance with the License. You may obtain a copy of the License at
|
||||
* http://www.mozilla.org/NPL/
|
||||
* The contents of this file are subject to the Mozilla Public License Version
|
||||
* 1.1 (the "License"); you may not use this file except in compliance with
|
||||
* the License. You may obtain a copy of the License at
|
||||
* http://www.mozilla.org/MPL/
|
||||
*
|
||||
* Software distributed under the License is distributed on an "AS IS" basis,
|
||||
* WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
|
||||
|
@ -14,7 +14,7 @@
|
|||
*
|
||||
* The Original Code is Mozilla Communicator client code.
|
||||
*
|
||||
* The Initial Developer of the Original Code is
|
||||
* The Initial Developer of the Original Code is
|
||||
* Netscape Communications Corporation.
|
||||
* Portions created by the Initial Developer are Copyright (C) 1998
|
||||
* the Initial Developer. All Rights Reserved.
|
||||
|
@ -24,16 +24,16 @@
|
|||
* Jonathan Wilson <jonwil@tpgi.com.au>
|
||||
*
|
||||
* Alternatively, the contents of this file may be used under the terms of
|
||||
* either the GNU General Public License Version 2 or later (the "GPL"), or
|
||||
* either the GNU General Public License Version 2 or later (the "GPL"), or
|
||||
* the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
|
||||
* in which case the provisions of the GPL or the LGPL are applicable instead
|
||||
* of those above. If you wish to allow use of your version of this file only
|
||||
* under the terms of either the GPL or the LGPL, and not to allow others to
|
||||
* use your version of this file under the terms of the NPL, indicate your
|
||||
* use your version of this file under the terms of the MPL, indicate your
|
||||
* decision by deleting the provisions above and replace them with the notice
|
||||
* and other provisions required by the GPL or the LGPL. If you do not delete
|
||||
* the provisions above, a recipient may use your version of this file under
|
||||
* the terms of any one of the NPL, the GPL or the LGPL.
|
||||
* the terms of any one of the MPL, the GPL or the LGPL.
|
||||
*
|
||||
* ***** END LICENSE BLOCK ***** */
|
||||
#include <windows.h>
|
||||
|
|
|
@ -1,26 +1,42 @@
|
|||
/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*-
|
||||
*
|
||||
* The contents of this file are subject to the Mozilla Public
|
||||
* License Version 1.1 (the "License"); you may not use this file
|
||||
* except in compliance with the License. You may obtain a copy of
|
||||
* the License at http://www.mozilla.org/MPL/
|
||||
* ***** BEGIN LICENSE BLOCK *****
|
||||
* Version: MPL 1.1/GPL 2.0/LGPL 2.1
|
||||
*
|
||||
* Software distributed under the License is distributed on an "AS
|
||||
* IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
|
||||
* implied. See the License for the specific language governing
|
||||
* rights and limitations under the License.
|
||||
* The contents of this file are subject to the Mozilla Public License Version
|
||||
* 1.1 (the "License"); you may not use this file except in compliance with
|
||||
* the License. You may obtain a copy of the License at
|
||||
* http://www.mozilla.org/MPL/
|
||||
*
|
||||
* Software distributed under the License is distributed on an "AS IS" basis,
|
||||
* WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
|
||||
* for the specific language governing rights and limitations under the
|
||||
* License.
|
||||
*
|
||||
* The Original Code is Mozilla Communicator client code.
|
||||
*
|
||||
* The Initial Developer of the Original Code is Netscape Communications
|
||||
* Corporation. Portions created by Netscape are
|
||||
* Copyright (C) 1998 Netscape Communications Corporation. All
|
||||
* Rights Reserved.
|
||||
* The Initial Developer of the Original Code is
|
||||
* Netscape Communications Corporation.
|
||||
* Portions created by the Initial Developer are Copyright (C) 1998
|
||||
* the Initial Developer. All Rights Reserved.
|
||||
*
|
||||
* Contributor(s):
|
||||
* Contributor(s):
|
||||
* Bill Law law@netscape.com
|
||||
* IBM Corp.
|
||||
*/
|
||||
*
|
||||
* Alternatively, the contents of this file may be used under the terms of
|
||||
* either the GNU General Public License Version 2 or later (the "GPL"), or
|
||||
* the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
|
||||
* in which case the provisions of the GPL or the LGPL are applicable instead
|
||||
* of those above. If you wish to allow use of your version of this file only
|
||||
* under the terms of either the GPL or the LGPL, and not to allow others to
|
||||
* use your version of this file under the terms of the MPL, indicate your
|
||||
* decision by deleting the provisions above and replace them with the notice
|
||||
* and other provisions required by the GPL or the LGPL. If you do not delete
|
||||
* the provisions above, a recipient may use your version of this file under
|
||||
* the terms of any one of the MPL, the GPL or the LGPL.
|
||||
*
|
||||
* ***** END LICENSE BLOCK ***** */
|
||||
#include <os2.h>
|
||||
|
||||
// Splash screen dialog ID.
|
||||
|
|
|
@ -1,23 +1,39 @@
|
|||
#
|
||||
# The contents of this file are subject to the Netscape Public
|
||||
# License Version 1.1 (the "License"); you may not use this file
|
||||
# except in compliance with the License. You may obtain a copy of
|
||||
# the License at http://www.mozilla.org/NPL/
|
||||
# ***** BEGIN LICENSE BLOCK *****
|
||||
# Version: MPL 1.1/GPL 2.0/LGPL 2.1
|
||||
#
|
||||
# Software distributed under the License is distributed on an "AS
|
||||
# IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
|
||||
# implied. See the License for the specific language governing
|
||||
# rights and limitations under the License.
|
||||
# The contents of this file are subject to the Mozilla Public License Version
|
||||
# 1.1 (the "License"); you may not use this file except in compliance with
|
||||
# the License. You may obtain a copy of the License at
|
||||
# http://www.mozilla.org/MPL/
|
||||
#
|
||||
# Software distributed under the License is distributed on an "AS IS" basis,
|
||||
# WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
|
||||
# for the specific language governing rights and limitations under the
|
||||
# License.
|
||||
#
|
||||
# The Original Code is mozilla.org code.
|
||||
#
|
||||
# The Initial Developer of the Original Code is Netscape
|
||||
# Communications Corporation. Portions created by Netscape are
|
||||
# Copyright (C) 1998 Netscape Communications Corporation. All
|
||||
# Rights Reserved.
|
||||
# The Initial Developer of the Original Code is
|
||||
# Netscape Communications Corporation.
|
||||
# Portions created by the Initial Developer are Copyright (C) 1998
|
||||
# the Initial Developer. All Rights Reserved.
|
||||
#
|
||||
# Contributor(s):
|
||||
# Contributor(s):
|
||||
#
|
||||
# Alternatively, the contents of this file may be used under the terms of
|
||||
# either the GNU General Public License Version 2 or later (the "GPL"), or
|
||||
# the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
|
||||
# in which case the provisions of the GPL or the LGPL are applicable instead
|
||||
# of those above. If you wish to allow use of your version of this file only
|
||||
# under the terms of either the GPL or the LGPL, and not to allow others to
|
||||
# use your version of this file under the terms of the MPL, indicate your
|
||||
# decision by deleting the provisions above and replace them with the notice
|
||||
# and other provisions required by the GPL or the LGPL. If you do not delete
|
||||
# the provisions above, a recipient may use your version of this file under
|
||||
# the terms of any one of the MPL, the GPL or the LGPL.
|
||||
#
|
||||
# ***** END LICENSE BLOCK *****
|
||||
|
||||
DEPTH = ../../..
|
||||
topsrcdir = @top_srcdir@
|
||||
|
|
|
@ -1,46 +1,46 @@
|
|||
<?xml version="1.0"?>
|
||||
<!-- ***** BEGIN LICENSE BLOCK *****
|
||||
- Version: MPL 1.1/GPL 2.0/LGPL 2.1
|
||||
-
|
||||
- The contents of this file are subject to the Mozilla Public License Version
|
||||
- 1.1 (the "License"); you may not use this file except in compliance with
|
||||
- the License. You may obtain a copy of the License at
|
||||
- http://www.mozilla.org/MPL/
|
||||
-
|
||||
- Software distributed under the License is distributed on an "AS IS" basis,
|
||||
- WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
|
||||
- for the specific language governing rights and limitations under the
|
||||
- License.
|
||||
-
|
||||
- The Original Code is OEone Calendar Code, released October 31st, 2001.
|
||||
-
|
||||
- The Initial Developer of the Original Code is
|
||||
- OEone Corporation.
|
||||
- Portions created by the Initial Developer are Copyright (C) 2001
|
||||
- the Initial Developer. All Rights Reserved.
|
||||
-
|
||||
- Contributor(s): Garth Smedley <garths@oeone.com>
|
||||
- Mike Potter <mikep@oeone.com>
|
||||
- Colin Phillips <colinp@oeone.com>
|
||||
- Chris Charabaruk <coldacid@djfly.org>
|
||||
- Karl Guertin <grayrest@grayrest.com>
|
||||
- Dan Parent <danp@oeone.com>
|
||||
- ArentJan Banck <ajbanck@planet.nl>
|
||||
- Eric Belhaire <belhaire@ief.u-psud.fr>
|
||||
-
|
||||
- Alternatively, the contents of this file may be used under the terms of
|
||||
- either the GNU General Public License Version 2 or later (the "GPL"), or
|
||||
- the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
|
||||
- in which case the provisions of the GPL or the LGPL are applicable instead
|
||||
- of those above. If you wish to allow use of your version of this file only
|
||||
- under the terms of either the GPL or the LGPL, and not to allow others to
|
||||
- use your version of this file under the terms of the MPL, indicate your
|
||||
- decision by deleting the provisions above and replace them with the notice
|
||||
- and other provisions required by the LGPL or the GPL. If you do not delete
|
||||
- the provisions above, a recipient may use your version of this file under
|
||||
- the terms of any one of the MPL, the GPL or the LGPL.
|
||||
-
|
||||
- ***** END LICENSE BLOCK ***** -->
|
||||
- Version: MPL 1.1/GPL 2.0/LGPL 2.1
|
||||
-
|
||||
- The contents of this file are subject to the Mozilla Public License Version
|
||||
- 1.1 (the "License"); you may not use this file except in compliance with
|
||||
- the License. You may obtain a copy of the License at
|
||||
- http://www.mozilla.org/MPL/
|
||||
-
|
||||
- Software distributed under the License is distributed on an "AS IS" basis,
|
||||
- WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
|
||||
- for the specific language governing rights and limitations under the
|
||||
- License.
|
||||
-
|
||||
- The Original Code is OEone Calendar Code, released October 31st, 2001.
|
||||
-
|
||||
- The Initial Developer of the Original Code is
|
||||
- OEone Corporation.
|
||||
- Portions created by the Initial Developer are Copyright (C) 2001
|
||||
- the Initial Developer. All Rights Reserved.
|
||||
-
|
||||
- Contributor(s): Garth Smedley <garths@oeone.com>
|
||||
- Mike Potter <mikep@oeone.com>
|
||||
- Colin Phillips <colinp@oeone.com>
|
||||
- Chris Charabaruk <coldacid@djfly.org>
|
||||
- Karl Guertin <grayrest@grayrest.com>
|
||||
- Dan Parent <danp@oeone.com>
|
||||
- ArentJan Banck <ajbanck@planet.nl>
|
||||
- Eric Belhaire <belhaire@ief.u-psud.fr>
|
||||
-
|
||||
- Alternatively, the contents of this file may be used under the terms of
|
||||
- either the GNU General Public License Version 2 or later (the "GPL"), or
|
||||
- the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
|
||||
- in which case the provisions of the GPL or the LGPL are applicable instead
|
||||
- of those above. If you wish to allow use of your version of this file only
|
||||
- under the terms of either the GPL or the LGPL, and not to allow others to
|
||||
- use your version of this file under the terms of the MPL, indicate your
|
||||
- decision by deleting the provisions above and replace them with the notice
|
||||
- and other provisions required by the LGPL or the GPL. If you do not delete
|
||||
- the provisions above, a recipient may use your version of this file under
|
||||
- the terms of any one of the MPL, the GPL or the LGPL.
|
||||
-
|
||||
- ***** END LICENSE BLOCK ***** -->
|
||||
|
||||
<!-- Style sheets -->
|
||||
|
||||
|
|
|
@ -1,26 +1,43 @@
|
|||
<?xml version="1.0"?>
|
||||
|
||||
# The contents of this file are subject to the Netscape Public
|
||||
# License Version 1.1 (the "License"); you may not use this file
|
||||
# except in compliance with the License. You may obtain a copy of
|
||||
# the License at http://www.mozilla.org/NPL/
|
||||
#
|
||||
# Software distributed under the License is distributed on an "AS
|
||||
# IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
|
||||
# implied. See the License for the specific language governing
|
||||
# rights and limitations under the License.
|
||||
#
|
||||
# ***** BEGIN LICENSE BLOCK *****
|
||||
# Version: MPL 1.1/GPL 2.0/LGPL 2.1
|
||||
#
|
||||
# The contents of this file are subject to the Mozilla Public License Version
|
||||
# 1.1 (the "License"); you may not use this file except in compliance with
|
||||
# the License. You may obtain a copy of the License at
|
||||
# http://www.mozilla.org/MPL/
|
||||
#
|
||||
# Software distributed under the License is distributed on an "AS IS" basis,
|
||||
# WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
|
||||
# for the specific language governing rights and limitations under the
|
||||
# License.
|
||||
#
|
||||
# The Original Code is Mozilla Communicator client code, released
|
||||
# March 31, 1998.
|
||||
#
|
||||
# The Initial Developer of the Original Code is Netscape
|
||||
# Communications Corporation. Portions created by Netscape are
|
||||
# Copyright (C) 1998-1999 Netscape Communications Corporation. All
|
||||
# Rights Reserved.
|
||||
#
|
||||
# Contributor(s):
|
||||
#
|
||||
# The Initial Developer of the Original Code is
|
||||
# Netscape Communications Corporation.
|
||||
# Portions created by the Initial Developer are Copyright (C) 1998-1999
|
||||
# the Initial Developer. All Rights Reserved.
|
||||
#
|
||||
# Contributor(s):
|
||||
# David Hyatt (hyatt@apple.com)
|
||||
# Blake Ross (blaker@netscape.com)
|
||||
#
|
||||
# Alternatively, the contents of this file may be used under the terms of
|
||||
# either the GNU General Public License Version 2 or later (the "GPL"), or
|
||||
# the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
|
||||
# in which case the provisions of the GPL or the LGPL are applicable instead
|
||||
# of those above. If you wish to allow use of your version of this file only
|
||||
# under the terms of either the GPL or the LGPL, and not to allow others to
|
||||
# use your version of this file under the terms of the MPL, indicate your
|
||||
# decision by deleting the provisions above and replace them with the notice
|
||||
# and other provisions required by the GPL or the LGPL. If you do not delete
|
||||
# the provisions above, a recipient may use your version of this file under
|
||||
# the terms of any one of the MPL, the GPL or the LGPL.
|
||||
#
|
||||
# ***** END LICENSE BLOCK *****
|
||||
|
||||
<!DOCTYPE dialog [
|
||||
<!ENTITY % customizeToolbarDTD SYSTEM "chrome://global/locale/customizeToolbar.dtd">
|
||||
|
|
|
@ -1,40 +1,44 @@
|
|||
#!/usr/bin/perl
|
||||
#
|
||||
# The contents of this file are subject to the Netscape Public
|
||||
# License Version 1.1 (the "License"); you may not use this file
|
||||
# except in compliance with the License. You may obtain a copy of
|
||||
# the License at http://www.mozilla.org/NPL/
|
||||
# ***** BEGIN LICENSE BLOCK *****
|
||||
# Version: MPL 1.1/GPL 2.0/LGPL 2.1
|
||||
#
|
||||
# Software distributed under the License is distributed on an "AS
|
||||
# IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
|
||||
# implied. See the License for the specific language governing
|
||||
# rights and limitations under the License.
|
||||
# The contents of this file are subject to the Mozilla Public License Version
|
||||
# 1.1 (the "License"); you may not use this file except in compliance with
|
||||
# the License. You may obtain a copy of the License at
|
||||
# http://www.mozilla.org/MPL/
|
||||
#
|
||||
# Software distributed under the License is distributed on an "AS IS" basis,
|
||||
# WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
|
||||
# for the specific language governing rights and limitations under the
|
||||
# License.
|
||||
#
|
||||
# The Original Code is JavaScript Core Tests.
|
||||
#
|
||||
# The Initial Developer of the Original Code is Netscape
|
||||
# Communications Corporation. Portions created by Netscape are
|
||||
# Copyright (C) 1997-1999 Netscape Communications Corporation. All
|
||||
# Rights Reserved.
|
||||
# The Initial Developer of the Original Code is
|
||||
# Netscape Communications Corporation.
|
||||
# Portions created by the Initial Developer are Copyright (C) 1997-1999
|
||||
# the Initial Developer. All Rights Reserved.
|
||||
#
|
||||
# Alternatively, the contents of this file may be used under the
|
||||
# terms of the GNU Public License (the "GPL"), in which case the
|
||||
# provisions of the GPL are applicable instead of those above.
|
||||
# If you wish to allow use of your version of this file only
|
||||
# under the terms of the GPL and not to allow others to use your
|
||||
# version of this file under the NPL, indicate your decision by
|
||||
# deleting the provisions above and replace them with the notice
|
||||
# and other provisions required by the GPL. If you do not delete
|
||||
# the provisions above, a recipient may use your version of this
|
||||
# file under either the NPL or the GPL.
|
||||
# Contributor(s):
|
||||
# Robert Ginda <rginda@netscape.com>
|
||||
# Second cut at runtests.pl script originally by
|
||||
# Christine Begle (cbegle@netscape.com)
|
||||
# Branched 11/01/99
|
||||
#
|
||||
# Contributers:
|
||||
# Robert Ginda <rginda@netscape.com>
|
||||
#
|
||||
# Second cut at runtests.pl script originally by
|
||||
# Christine Begle (cbegle@netscape.com)
|
||||
# Branched 11/01/99
|
||||
# Alternatively, the contents of this file may be used under the terms of
|
||||
# either the GNU General Public License Version 2 or later (the "GPL"), or
|
||||
# the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
|
||||
# in which case the provisions of the GPL or the LGPL are applicable instead
|
||||
# of those above. If you wish to allow use of your version of this file only
|
||||
# under the terms of either the GPL or the LGPL, and not to allow others to
|
||||
# use your version of this file under the terms of the MPL, indicate your
|
||||
# decision by deleting the provisions above and replace them with the notice
|
||||
# and other provisions required by the GPL or the LGPL. If you do not delete
|
||||
# the provisions above, a recipient may use your version of this file under
|
||||
# the terms of any one of the MPL, the GPL or the LGPL.
|
||||
#
|
||||
# ***** END LICENSE BLOCK *****
|
||||
|
||||
use strict;
|
||||
use Getopt::Mixed "nextOption";
|
||||
|
|
Загрузка…
Ссылка в новой задаче