[Zope-CVS] CVS: Packages/Moztop/moztop/content/Content/Folder - Content.js:1.1 Content.xul:1.1 MetaData.js:1.1 MetaData.xul:1.1 Preview.js:1.1 Preview.xul:1.1 Security.xul:1.1
Paul Everitt
paul@zope.com
Sat, 15 Feb 2003 05:44:24 -0500
Update of /cvs-repository/Packages/Moztop/moztop/content/Content/Folder
In directory cvs.zope.org:/tmp/cvs-serv15538/Folder
Added Files:
Content.js Content.xul MetaData.js MetaData.xul Preview.js
Preview.xul Security.xul
Log Message:
Rearranging directories, landing first cut at XBL
=== Added File Packages/Moztop/moztop/content/Content/Folder/Content.js ===
/*****************************************************************************
*
* 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.
*
******************************************************************************
Contents Tab specific Javascript functions.
$Id: Content.js,v 1.1 2003/02/15 10:44:23 paul Exp $
******************************************************************************/
/* 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')
}
/* Init contents tree */
function initContentsTree() {
path = getActiveContentObjectPath();
var ds = RDF.GetDataSource(RDF_BASE + path + '/@@contents.rdf');
var tree = document.getElementById('navigationtree');
tree.database.AddDataSource(ds);
tree.setAttribute("ref", "urn:explorer:data");
tree.builder.rebuild();
}
/* Load contents tree */
function loadContentsTree() {
var tree = document.getElementById('navigationtree');
var sources = tree.database.GetDataSources();
sources.getNext(); // Hack, we should find this out in a better way.
var ds = sources.getNext();
ds = ds.QueryInterface(
Components.interfaces.nsIRDFRemoteDataSource);
ds.Refresh(false);
/* We need this alert, so the RDF has time to load, otherwise the tree
will be empty. We have find a better way of doing this.
This happens because the DS is loaded asynchronically.
*/
alert('Done reloading Content Tree.');
tree.builder.rebuild();
}
=== Added File Packages/Moztop/moztop/content/Content/Folder/Content.xul ===
<?xml version="1.0"?>
<?xml-stylesheet href="chrome://global/skin" type="text/css"?>
<?xml-stylesheet href="chrome://moztop/skin" type="text/css"?>
<window
onload = "initContentsTree();"
xmlns = "http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul">
<script type="application/x-javascript"
src="chrome://moztop/content/setup.js"/>
<script type="application/x-javascript"
src="chrome://moztop/content/global.js"/>
<script type="application/x-javascript" src="Content.js"/>
<tree flex="1" style="width:20em;"
id="navigationtree"
datasources="rdf:null"
containment="http://home.netscape.com/NC-rdf#subitems">
<treecols>
<treecol id="ResourceNameColumn" label="Name" primary="true" flex="1"/>
<splitter class="tree-splitter"/>
<treecol id="TypeColumn" label="Type" flex="1"/>
</treecols>
<template>
<rule>
<conditions>
<content uri="?uri" />
<triple subject="?uri"
predicate="http://home.netscape.com/NC-rdf#subitems"
object="?subitems" />
<member container="?subitems" child="?subitem" />
<triple subject="?subitem"
predicate="http://home.netscape.com/NC-rdf#resourcetype"
object="?resourcetype" />
</conditions>
<bindings>
<binding subject="?subitem"
predicate="http://www.purl.org/dc/1.1#title"
object="?name" />
<binding subject="?resourcetype"
predicate="http://www.purl.org/dc/1.1#title"
object="?resourcetypetitle"/>
<binding subject="?subitem"
predicate="http://home.netscape.com/NC-rdf#objecttype"
object="?objecttype"/>
</bindings>
<action>
<treechildren flex="1">
<treeitem uri="?subitem">
<treerow>
<treecell label="?name" properties="zope-?objecttype"/>
<treecell label="?resourcetypetitle"/>
</treerow>
</treeitem>
</treechildren>
</action>
</rule>
</template>
</tree>
<box orient="horizontal">
<button onclick="loadContentsTree();" label="Refresh" />
<spring flex="100%" />
</box>
</window>
=== Added File Packages/Moztop/moztop/content/Content/Folder/MetaData.js ===
/*****************************************************************************
*
* 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.
$Id: MetaData.js,v 1.1 2003/02/15 10:44:23 paul Exp $
******************************************************************************/
/* 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);
}
var xmlRpcClient;
function getXmlRpc() {
if (!xmlRpcClient) xmlRpcClient = getClient();
return xmlRpcClient;
}
/* XML-RPC listener for loading meta data. */
var LoadListener = {
onResult: function(client, ctxt, result) {
result = result.QueryInterface(
Components.interfaces.nsIDictionary);
title = result.getValue('title').QueryInterface(
Components.interfaces.nsISupportsCString);
document.getElementById("field_title").value = title;
desc = result.getValue('description').QueryInterface(
Components.interfaces.nsISupportsCString);
document.getElementById("field_description").value = desc;
created = result.getValue('created').QueryInterface(
Components.interfaces.nsISupportsCString);
document.getElementById("field_created").value = created;
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(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(XMLRPC_BASE + path + '/');
var title = xmlRpc.createType(xmlRpc.STRING, {});
title.data = document.getElementById("field_title").value;
var desc = xmlRpc.createType(xmlRpc.STRING, {});
desc.data = document.getElementById("field_description").value;
xmlRpc.asyncCall(SaveListener, null, 'setMetaData', [title, desc], 2);
}
=== Added File Packages/Moztop/moztop/content/Content/Folder/MetaData.xul ===
<?xml version="1.0"?>
<?xml-stylesheet href="chrome://global/skin" type="text/css"?>
<?xml-stylesheet href="chrome://moztop/skin" type="text/css"?>
<window
xmlns = "http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul"
onload="loadMetaData();">
<script type="application/x-javascript"
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>
<caption label="Edit"/>
<grid flex="1">
<columns>
<column/>
<column flex="1"/>
</columns>
<rows>
<row>
<label control="field_title" value="Title"/>
<textbox id="field_title" flex="1"/>
</row>
<row>
<label control="field_description" value="Description"/>
<textbox id="field_description" flex="1"/>
</row>
<row>
<label value="Created on:" />
<label id="field_created" value="01/01/2003" />
</row>
<row>
<label value="Last modified on:" />
<label id="field_modified" value="01/01/2003" />
</row>
</rows>
</grid>
<box orient="horizontal">
<button onclick="saveMetaData()" label="Save" />
<button onclick="loadMetaData()" label="Refresh" />
<spring flex="100%" />
</box>
</groupbox>
</window>
=== Added File Packages/Moztop/moztop/content/Content/Folder/Preview.js ===
/*****************************************************************************
*
* 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.
*
******************************************************************************
Preview Tab specific Javascript functions.
$Id: Preview.js,v 1.1 2003/02/15 10:44:23 paul Exp $
******************************************************************************/
/* 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')
}
/* Load preview in IFrame */
function loadPreview() {
iframe = document.getElementById('preview-frame');
iframe.setAttribute('src', HTML_BASE + getActiveContentObjectPath());
}
=== Added File Packages/Moztop/moztop/content/Content/Folder/Preview.xul ===
<?xml version="1.0"?>
<?xml-stylesheet href="chrome://global/skin" type="text/css"?>
<?xml-stylesheet href="chrome://moztop/skin" type="text/css"?>
<window
orient = "vertical"
onload = "loadPreview();"
xmlns = "http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul">
<script type="application/x-javascript"
src="chrome://moztop/content/setup.js"/>
<script type="application/x-javascript"
src="chrome://moztop/content/global.js"/>
<script type="application/x-javascript" src="Preview.js"/>
<iframe id="preview-frame" flex="1"/>
<box orient="horizontal">
<button onclick="loadPreview();" label="Reload Content" />
<spring flex="100%" />
</box>
</window>
=== Added File Packages/Moztop/moztop/content/Content/Folder/Security.xul ===
<?xml version="1.0"?>
<?xml-stylesheet href="chrome://global/skin" type="text/css"?>
<?xml-stylesheet href="chrome://moztop/skin" type="text/css"?>
<window
xmlns = "http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul">
<label value="Security" />
<image src="chrome://moztop/content/moztop.png" />
</window>