[Zope-CVS] CVS: Packages/Moztop/moztop/content/ContentObjects/Folder - MetaData.js:1.2 MetaData.xul:1.6
Stephan Richter
srichter@cbu.edu
Wed, 15 Jan 2003 23:11:56 -0500
Update of /cvs-repository/Packages/Moztop/moztop/content/ContentObjects/Folder
In directory cvs.zope.org:/tmp/cvs-serv10029/moztop/content/ContentObjects/Folder
Modified Files:
MetaData.js MetaData.xul
Log Message:
- Major code cleanup:
o Removed unused files.
o Added Headers to Javascript files.
o Reorganized Javascript a bit. However, there is still enough left
to do.
o Added Documentation strings.
- Finally got Connection Wizard working.
=== Packages/Moztop/moztop/content/ContentObjects/Folder/MetaData.js 1.1 => 1.2 ===
--- Packages/Moztop/moztop/content/ContentObjects/Folder/MetaData.js:1.1 Wed Jan 15 21:06:33 2003
+++ Packages/Moztop/moztop/content/ContentObjects/Folder/MetaData.js Wed Jan 15 23:11:24 2003
@@ -1,26 +1,31 @@
-function getDocumentOfWindowWithId(id) {
- var win = null;
+/*****************************************************************************
+*
+* Copyright (c) 2002, 2003 Zope Corporation and Contributors.
+* All Rights Reserved.
+*
+* This software is subject to the provisions of the Zope Public License,
+* Version 2.0 (ZPL). A copy of the ZPL should accompany this distribution.
+* THIS SOFTWARE IS PROVIDED "AS IS" AND ANY AND ALL EXPRESS OR IMPLIED
+* WARRANTIES ARE DISCLAIMED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
+* WARRANTIES OF TITLE, MERCHANTABILITY, AGAINST INFRINGEMENT, AND FITNESS
+* FOR A PARTICULAR PURPOSE.
+*
+******************************************************************************
+Meta Data Tab specific Javascript functions. With them you can load and save
+the meta data.
- var wmediator =
- Components.classes['@mozilla.org/appshell/window-mediator;1'].
- getService(Components.interfaces.nsIWindowMediator);
- var openwindows = wmediator.getEnumerator(null);
-
- while (openwindows.hasMoreElements()) {
- win = openwindows.getNext();
- if (win.document.getElementById(id) != null) {
- return win.document
- }
- }
- return null
-}
+$Id$
+
+******************************************************************************/
+/* Retrieve path of active content object. */
function getActiveContentObjectPath() {
doc = getDocumentOfWindowWithId("moztop-main-window");
var tabs = doc.getElementById("active-contents-tabs");
return tabs.selectedItem.getAttribute('label')
}
+/* XML-RPC setup stuff. */
function getClient() {
return Components.classes['@mozilla.org/xml-rpc/client;1']
.createInstance(Components.interfaces.nsIXmlRpcClient);
@@ -32,6 +37,7 @@
return xmlRpcClient;
}
+/* XML-RPC listener for loading meta data. */
var LoadListener = {
onResult: function(client, ctxt, result) {
result = result.QueryInterface(
@@ -51,45 +57,42 @@
modified = result.getValue('modified').QueryInterface(
Components.interfaces.nsISupportsCString);
document.getElementById("field_modified").value = modified;
-
},
-
onFault: function(client, ctxt, fault) {
alert('Fault! ' + fault + '\n');
},
-
onError: function(client, ctxt, status, errorMsg) {
alert('Error! <(' + status.toString(16) + ') ' + errorMsg + '>\n');
}
};
-
+/* Load meta data from server. */
function loadMetaData() {
path = getActiveContentObjectPath();
var xmlRpc = getXmlRpc();
- xmlRpc.init(ZOPE3_URL + path + '/');
+ xmlRpc.init(XMLRPC_BASE + path + '/');
xmlRpc.asyncCall(LoadListener, null, 'getMetaData', [], 0);
}
+/* XML-RPC listener for saving meta data. */
var SaveListener = {
onResult: function(client, ctxt, result) {
loadMetaData();
},
-
onFault: function(client, ctxt, fault) {
alert('Fault! ' + fault + '\n');
},
-
onError: function(client, ctxt, status, errorMsg) {
alert('Error! <(' + status.toString(16) + ') ' + errorMsg + '>\n');
}
};
+/* Save meta data to server. */
function saveMetaData() {
path = getActiveContentObjectPath();
var xmlRpc = getXmlRpc();
- xmlRpc.init(ZOPE3_URL + path + '/');
+ xmlRpc.init(XMLRPC_BASE + path + '/');
var title = xmlRpc.createType(xmlRpc.STRING, {});
title.data = document.getElementById("field_title").value;
var desc = xmlRpc.createType(xmlRpc.STRING, {});
=== Packages/Moztop/moztop/content/ContentObjects/Folder/MetaData.xul 1.5 => 1.6 ===
--- Packages/Moztop/moztop/content/ContentObjects/Folder/MetaData.xul:1.5 Wed Jan 15 21:06:33 2003
+++ Packages/Moztop/moztop/content/ContentObjects/Folder/MetaData.xul Wed Jan 15 23:11:24 2003
@@ -8,7 +8,9 @@
onload="loadMetaData();">
<script type="application/x-javascript"
- src="chrome://moztop/content/setup.js"/>
+ src="chrome://moztop/content/setup.js"/>
+ <script type="application/x-javascript"
+ src="chrome://moztop/content/global.js"/>
<script type="application/x-javascript" src="MetaData.js"/>
<groupbox>