~ubuntu-branches/ubuntu/precise/kompozer/precise

« back to all changes in this revision

Viewing changes to mozilla/toolkit/mozapps/downloads/content/downloadProperties.js

  • Committer: Bazaar Package Importer
  • Author(s): Anthony Yarusso
  • Date: 2007-08-27 01:11:03 UTC
  • Revision ID: james.westby@ubuntu.com-20070827011103-2jgf4s6532gqu2ka
Tags: upstream-0.7.10
ImportĀ upstreamĀ versionĀ 0.7.10

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
# -*- Mode: Java; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*-
 
2
# Version: MPL 1.1/GPL 2.0/LGPL 2.1
 
3
 
4
# The contents of this file are subject to the Mozilla Public License Version
 
5
# 1.1 (the "License"); you may not use this file except in compliance with
 
6
# the License. You may obtain a copy of the License at
 
7
# http://www.mozilla.org/MPL/
 
8
 
9
# Software distributed under the License is distributed on an "AS IS" basis,
 
10
# WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
 
11
# for the specific language governing rights and limitations under the
 
12
# License.
 
13
 
14
# The Original Code is Mozilla.org Code.
 
15
 
16
# The Initial Developer of the Original Code is.
 
17
# Portions created by the Initial Developer are Copyright (C) 2001
 
18
# the Initial Developer. All Rights Reserved.
 
19
 
20
# Contributor(s):
 
21
#   Blake Ross <blakeross@telocity.com>
 
22
 
23
# Alternatively, the contents of this file may be used under the terms of
 
24
# either the GNU General Public License Version 2 or later (the "GPL"), or
 
25
# the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
 
26
# in which case the provisions of the GPL or the LGPL are applicable instead
 
27
# of those above. If you wish to allow use of your version of this file only
 
28
# under the terms of either the GPL or the LGPL, and not to allow others to
 
29
# use your version of this file under the terms of the MPL, indicate your
 
30
# decision by deleting the provisions above and replace them with the notice
 
31
# and other provisions required by the GPL or the LGPL. If you do not delete
 
32
# the provisions above, a recipient may use your version of this file under
 
33
# the terms of any one of the MPL, the GPL or the LGPL.
 
34
 
35
# ***** END LICENSE BLOCK *****
 
36
 
 
37
function Startup()
 
38
{
 
39
  const NC_NS = "http://home.netscape.com/NC-rdf#";
 
40
  const rdfSvcContractID = "@mozilla.org/rdf/rdf-service;1";
 
41
  const rdfSvcIID = Components.interfaces.nsIRDFService;
 
42
  var rdfService = Components.classes[rdfSvcContractID].getService(rdfSvcIID);
 
43
 
 
44
  const dlmgrContractID = "@mozilla.org/download-manager;1";
 
45
  const dlmgrIID = Components.interfaces.nsIDownloadManager;
 
46
  var downloadMgr = Components.classes[dlmgrContractID].getService(dlmgrIID);
 
47
  var ds = downloadMgr.datasource;
 
48
  
 
49
  const dateTimeContractID = "@mozilla.org/intl/scriptabledateformat;1";
 
50
  const dateTimeIID = Components.interfaces.nsIScriptableDateFormat;
 
51
  var dateTimeService = Components.classes[dateTimeContractID].getService(dateTimeIID);  
 
52
 
 
53
  var resource = rdfService.GetUnicodeResource(window.arguments[0]);
 
54
  var dateStartedRes = rdfService.GetResource(NC_NS + "DateStarted");
 
55
  var dateEndedRes = rdfService.GetResource(NC_NS + "DateEnded");
 
56
  var sourceRes = rdfService.GetResource(NC_NS + "URL");
 
57
 
 
58
  var dateStartedField = document.getElementById("dateStarted");
 
59
  var dateEndedField = document.getElementById("dateEnded");
 
60
  var pathField = document.getElementById("path");
 
61
  var sourceField = document.getElementById("source");
 
62
 
 
63
  try {
 
64
    var dateStarted = ds.GetTarget(resource, dateStartedRes, true).QueryInterface(Components.interfaces.nsIRDFDate).Value;
 
65
    dateStarted = new Date(dateStarted/1000);
 
66
    dateStarted = dateTimeService.FormatDateTime("", dateTimeService.dateFormatShort, dateTimeService.timeFormatSeconds, dateStarted.getFullYear(), dateStarted.getMonth()+1, dateStarted.getDate(), dateStarted.getHours(), dateStarted.getMinutes(), dateStarted.getSeconds());
 
67
    dateStartedField.setAttribute("value", dateStarted);
 
68
  }
 
69
  catch (e) {
 
70
  }
 
71
  
 
72
  try {
 
73
    var dateEnded = ds.GetTarget(resource, dateEndedRes, true).QueryInterface(Components.interfaces.nsIRDFDate).Value;
 
74
    dateEnded = new Date(dateEnded/1000);
 
75
    dateEnded = dateTimeService.FormatDateTime("", dateTimeService.dateFormatShort, dateTimeService.timeFormatSeconds, dateEnded.getFullYear(), dateEnded.getMonth()+1, dateEnded.getDate(), dateEnded.getHours(), dateEnded.getMinutes(), dateEnded.getSeconds());
 
76
    dateEndedField.setAttribute("value", dateEnded);
 
77
  }
 
78
  catch (e) {
 
79
  }
 
80
  
 
81
  var source = ds.GetTarget(resource, sourceRes, true).QueryInterface(Components.interfaces.nsIRDFResource).Value;
 
82
 
 
83
  pathField.value = window.arguments[0];
 
84
  sourceField.value = source;
 
85
  
 
86
  var dl = window.opener.gDownloadManager.getDownload(window.arguments[0]);
 
87
  if (dl) {
 
88
    document.getElementById("dateEndedRow").hidden = true;
 
89
    document.getElementById("dateEndedSeparator").hidden = true;
 
90
  }
 
91
  
 
92
  document.documentElement.getButton("accept").label = document.documentElement.getAttribute("acceptbuttontext");
 
93
  
 
94
  document.documentElement.getButton("accept").focus();
 
95
}
 
96
  
 
 
b'\\ No newline at end of file'