[Zope-CVS] CVS: Packages/Moztop/moztop/content/menu - commandset.xul:1.1 connection-wizard.js:1.1 connection-wizard.xul:1.1 keysetoverlay.xul:1.1 menuoverlay.xul:1.1 toolbar.js:1.1 toolbaroverlay.xul:1.1
Stephan Richter
srichter@cbu.edu
Thu, 20 Mar 2003 09:56:07 -0500
Update of /cvs-repository/Packages/Moztop/moztop/content/menu
In directory cvs.zope.org:/tmp/cvs-serv24970/menu
Added Files:
commandset.xul connection-wizard.js connection-wizard.xul
keysetoverlay.xul menuoverlay.xul toolbar.js
toolbaroverlay.xul
Log Message:
Renaming continues:
Rename Menu --> menu (and all contained files to lower case)
=== Added File Packages/Moztop/moztop/content/menu/commandset.xul ===
<?xml version="1.0"?>
<overlay id="CommandSetOverlay"
xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul">
<commandset id="moztop-commands">
<command id="menu-file-new-site:command"
oncommand="window.
openDialog('chrome://moztop/content/menu/connection-wizard.xul',
! 'Connection Wizard', 'chrome',sitesmanager);"/>
<command id="menu-file-new-folder:command"
oncommand="window
.openDialog('chrome://moztop/content/workspace/newfolder.xul',
'newcontent','chrome',sitesmanager);"/>
<command id="menu-file-new-file:command"
oncommand="window
.openDialog('chrome://moztop/content/workspace/newfile.xul',
'newcontent','chrome',sitesmanager);"/>
<command id="menu-file-new-image:command"
oncommand="window
.openDialog('chrome://moztop/content/workspace/newimage.xul',
'newcontent','chrome',sitesmanager);"/>
<command id="menu-file-new-zptpage:command"
oncommand="window
.openDialog('chrome://moztop/content/workspace/newzptpage.xul',
'newcontent','chrome',sitesmanager);"/>
<command id="menu-file-new-dtmlpage:command"
oncommand="window
.openDialog('chrome://moztop/content/workspace/newdtmlpage.xul',
'newcontent','chrome',sitesmanager);"/>
<command id="menu-file-new-sqlscript:command"
oncommand="window
.openDialog('chrome://moztop/content/workspace/newsqlscript.xul',
'newcontent','chrome',sitesmanager);"/>
<command id="menu-file-close:command" oncommand="closeProgram();"/>
<command id="menu-help-zope3:command" oncommand="showZope3();"/>
<command id="menu-help-about:command" oncommand="showAbout();"/>
<command id="menu-view-reload:command" oncommand="BrowserReload()"/>
<command id="menu-debug-dump:command" oncommand="dumpDataSourceManagers();"/>
</commandset>
</overlay>
=== Added File Packages/Moztop/moztop/content/menu/connection-wizard.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.
*
******************************************************************************
Handles that the wizard truely adds the new site.
$Id: connection-wizard.js,v 1.1 2003/03/20 14:56:06 srichter Exp $
******************************************************************************/
/* Create a site from the wizard */
function getSiteConfiguration () {
/* Connect to site and retrieve site configuration information */
var url = document.getElementById("newsite_url").value;
function myfunc (e) {
if (p.readyState != 4) {
return;
}
var status = p.status + ": " + p.statusText + "\n";
var status = status + p.getAllResponseHeaders() + "\n\n";
var status = status + p.responseText;
document.getElementById("responsetext").firstChild.nodeValue = status;
if (p.responseXML) {
var dcns = "http://www.purl.org/dc/1.1#";
var realm = p.responseXML.getElementsByTagName("realm")[0];
var realm = realm.firstChild.nodeValue;
var sitename = p.responseXML.getElementsByTagNameNS(dcns,"title")[0];
var sitename = sitename.firstChild.nodeValue;
document.getElementById("newsite_realm").value=realm;
document.getElementById("newsite_name").value=sitename;
dump("\nrealm and sitename are " + realm + " " + sitename);
}
}
var p = new XMLHttpRequest();
p.onreadystatechange = myfunc;
p.open("GET", url + "config.xml");
p.send(null);
}
function verifyValues () {
/* Before leaving the first page, make sure newsite_name is set */
var newsite_name = document.getElementById("newsite_name").value;
if (newsite_name == "Not connected.") {
alert("Must successfully connect");
return false;
}
return true;
}
function createSite() {
// The sitesmanager was passed in as an argument
var sm = window.arguments[0];
/* Setting up variables */
var newsite_name = document.getElementById("newsite_name").value;
var newsite_realm = document.getElementById("newsite_realm").value;
var newsite_url = document.getElementById("newsite_url").value;
var newsite_username = document.getElementById("newsite_username").value;
var newsite_password = document.getElementById("newsite_password").value;
// Now we call addSite in explorer/explorer.js
sm.addSite(newsite_name, newsite_realm, newsite_url,
newsite_username, newsite_password);
}
=== Added File Packages/Moztop/moztop/content/menu/connection-wizard.xul ===
<?xml version="1.0"?>
<?xml-stylesheet href="chrome://global/skin" type="text/css"?>
<?xml-stylesheet href="chrome://moztop/skin" type="text/css"?>
<wizard id="add-conn-wizard" title="Create a new Connection to Zope 3"
onwizardfinish="return createSite();"
xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul">
<script type="application/x-javascript" src="connection-wizard.js"/>
<wizardpage onpageadvanced="return verifyValues();">
<description>
This Wizard will help you to connect to a new site.
</description>
<hbox>
<label value="Site URL:"/>
<textbox flex="1" id="newsite_url" value="http://localhost:8080/"/>
</hbox>
<hbox>
<button id="getsiteconfiguration" label="Connect"
oncommand="getSiteConfiguration();"/><spacer flex="1"/>
</hbox>
<groupbox flex="1">
<caption label="Server Response"/>
<hbox>
<label value="Site name:"/>
<label id="newsite_name" style="font-weight: bold"
value="Not connected."/>
<label hidden="true" id="newsite_realm" value="Not connected."/>
</hbox>
<description style="font-size: xx-small; background-color: silver; white-space: pre;height: 3em; overflow: scroll"
id="responsetext">No response.</description>
</groupbox>
</wizardpage>
<wizardpage description="Available Users">
<label value="Please select a user:"/>
<menulist id="newsite_username" label="Username">
<menupopup>
<menuitem label="gandalf (Default Zope 3 Manager)" value="gandalf"/>
<menuitem label="ev (Paul Everitt)" value="ev"/>
<menuitem label="srichter (Stephan Richter)" value="srichter"/>
<menuitem label="zope3 (Zope 3 USer)" value="zope3"/>
</menupopup>
</menulist>
<label value="Enter the password:"/>
<textbox id="newsite_password" type="password" value="" />
</wizardpage>
</wizard>
=== Added File Packages/Moztop/moztop/content/menu/keysetoverlay.xul ===
<?xml version="1.0"?>
<overlay id="KeySetOverlay"
xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul">
<keyset id="menu-keyset">
<key id="new-key" key="N" modifiers="control"
oncommand="alert('You have pressed: Ctrl-N')"/>
<key id="open-key" key="O" modifiers="control"
oncommand="alert('You have pressed: Ctrl-O')"/>
<key id="close-key" key="C" modifiers="control"
oncommand="alert('You have pressed: Ctrl-C')"/>
<key id="save-key" key="S" modifiers="control"
oncommand="alert('You have pressed: Ctrl-S')"/>
<key id="quit-key" key="Q" modifiers="control"
command="menu-file-close:command"/>
</keyset>
</overlay>
=== Added File Packages/Moztop/moztop/content/menu/menuoverlay.xul ===
<?xml version="1.0"?>
<overlay id="MenuOverlay"
xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul">
<menubar id="moztop-menubar">
<menu id="file-menu" label="File">
<menupopup id="file-popup">
<menu id="new-menu" label="New">
<menupopup id="new-popup">
<menuitem label="Site" command="menu-file-new-site:command"/>
<menuseparator/>
<menuitem label="Folder" command="menu-file-new-folder:command"/>
<menuitem label="File" command="menu-file-new-file:command"/>
<menuitem label="Image" command="menu-file-new-image:command"/>
<menuitem label="ZPT Page" command="menu-file-new-zptpage:command"/>
<menuitem label="DTML Page" command="menu-file-new-dtmlpage:command"/>
<menuitem label="SQL Script" command="menu-file-new-sqlscript:command"/>
</menupopup>
</menu>
<menuitem label="Connect" key="close-key"
command="sitesmanager.connectSelectedSite();"/>
<menuitem label="Disconnect" key="quit-key"/>
<menuseparator/>
<menuitem label="Quit" key="quit-key"
command="menu-file-close:command" />
</menupopup>
</menu>
<menu id="edit-menu" label="Edit">
<menupopup id="edit-popup">
<menuitem label="Undo"/>
<menuitem label="Redo"/>
<menuseparator/>
<menuitem label="Copy"/>
<menuitem label="Cut"/>
<menuitem label="Paste"/>
<menuseparator/>
<menuitem label="Preferences"/>
</menupopup>
</menu>
<menu id="edit-menu" label="View">
<menupopup id="edit-popup">
<menuitem label="Reload Sites"/>
<menuitem id="history-view" label="History" type="checkbox"/>
</menupopup>
</menu>
<menu id="debug-menu" label="Debug">
<menupopup id="debug-popup">
<menuitem label="Dump Datasources"
command="menu-debug-dump:command"/>
</menupopup>
</menu>
<menu id="edit-menu" label="Help">
<menupopup id="edit-popup">
<menuitem label="Index"/>
<menuitem label="Search"/>
<menuseparator/>
<menuitem label="About Zope 3"
command="menu-help-zope3:command" />
<menuitem label="About Moztop"
command="menu-help-about:command" />
</menupopup>
</menu>
</menubar>
</overlay>
=== Added File Packages/Moztop/moztop/content/menu/toolbar.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.
*
******************************************************************************
What a mess! All these functions do not belong here.
$Id: toolbar.js,v 1.1 2003/03/20 14:56:06 srichter Exp $
******************************************************************************/
/* Remove the Welcome tab. */
function _removeWelcome() {
var tabs = document.getElementById("active-contents-tabs");
var tabpanels = document.getElementById("active-contents-tabpanels");
if (tabs.firstChild.label == "Welcome") {
tabs.removeChild(tabs.firstChild);
tabpanels.removeChild(tabpanels.firstChild);
}
}
/* Open selected content object. */
function openContentObject() {
var tree = document.getElementById("navigationtree");
var tabs = document.getElementById("active-contents-tabs");
var tabpanels = document.getElementById("active-contents-tabpanels");
index = tree.view.selection.currentIndex;
rdf = tree.view.getItemAtIndex(index).resource;
var ds = new RDFDataSource();
var sources = tree.database.GetDataSources();
sources.getNext()
ds.Init(sources.getNext().QueryInterface(
Components.interfaces.nsIRDFDataSource));
/* Get type of object */
node = ds.getNode(rdf.Value);
node = node.getTarget("http://home.netscape.com/NC-rdf#resourcetype");
var type = node.getValue();
type = type.split('#')[1];
var parent = rdf.Value.replace('urn:explorer:data', '');
while (parent.indexOf(":") > -1)
parent = parent.replace(":", "/");
// Unselect selected item; we have a new one
tabs.selectedItem.setAttribute('selected', false);
if (document.getElementById(parent+"-tab") != null) {
document.getElementById(parent+"-tab").setAttribute(
'selected', true);
tabpanels.selectedPanel = document.getElementById(parent+"-tabpanel");
return;
}
var newtab = document.createElement("tab");
newtab.setAttribute('id', parent+'-tab');
newtab.setAttribute('label', parent);
newtab.setAttribute('selected', true);
tabs.appendChild(newtab);
var newtabpanel = document.createElement("tabpanel");
newtabpanel.setAttribute('id', parent+'-tabpanel');
tabpanels.appendChild(newtabpanel);
createViewTabs(type, parent, newtabpanel);
_removeWelcome();
tabpanels.selectedPanel = newtabpanel;
}
/* Create all view tabs for a content object of the specified type */
function createViewTabs(type, name, parent_tabpanel) {
TypeRegistry = {"Folder":
["Content", "Preview", "MetaData", "Security"],
"File":
["Upload", "Preview", "MetaData", "Security"],
"Image":
["Upload", "Preview", "MetaData", "Security"],
"ZPTPage":
["Content", "Preview", "MetaData", "Security"],
"DTMLPage":
["Content", "Preview", "MetaData", "Security"],
"SQLScript":
["Source", "Test", "Cache", "MetaData", "Security"]
}
var tabbox = document.createElement("tabbox");
tabbox.setAttribute('id', name+'-tabbox');
tabbox.setAttribute('orient', 'vertical');
tabbox.setAttribute('flex', '1');
parent_tabpanel.appendChild(tabbox);
var tabs = document.createElement("tabs");
tabs.setAttribute('orient', 'horizontal');
tabbox.appendChild(tabs);
var tabpanels = document.createElement("tabpanels");
tabpanels.setAttribute('flex', '100%');
tabbox.appendChild(tabpanels);
for (var index = 0; index < 4; index++) {
var tab = document.createElement("tab");
tab.setAttribute("label", TypeRegistry[type][index]);
tabs.appendChild(tab);
var tabpanel = document.createElement("tabpanel");
tabpanels.appendChild(tabpanel);
var iframe = document.createElement("iframe");
iframe.setAttribute('src',
'chrome://moztop/content/ContentObjects/' + type + '/' +
TypeRegistry[type][index] + '.xul');
iframe.setAttribute('flex', '1');
tabpanel.appendChild(iframe);
}
tabs.firstChild.setAttribute("selected", true);
}
function removeActiveContentTab() {
var tabs = document.getElementById("active-contents-tabs");
var tabpanels = document.getElementById("active-contents-tabpanels");
tabs.removeChild(tabs.selectedItem);
tabpanels.removeChild(tabpanels.selectedPanel);
tabs.firstChild.setAttribute("selected", "true");
tabelpanels.selectedPanel = tabelpanels.firstChild;
}
=== Added File Packages/Moztop/moztop/content/menu/toolbaroverlay.xul ===
<?xml version="1.0"?>
<overlay id="ToolBarOverlay"
xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul">
<script src="chrome://moztop/content/menu/toolbar.js"/>
<toolbar id="moztop-toolbar">
<button label="New Site" command="menu-file-new-site:command" />
<button oncommand="sitesmanager.deleteResource();"
label="Delete" tooltiptext="Delete selected resource"/>
<button oncommand="sitesmanager.connectSelectedSite();"
label="Connect" tooltiptext="Connect or reload selected site"/>
<button oncommand="removeActiveContentTab();"
label="Remove Tab" />
<button oncommand="sitesmanager.PUT();"
label="PUT" />
<button oncommand="sitesmanager.DELETE('http://localhost:8000/somefolder',
'foo');"
label="Delete Foo" />
<spring flex="100%" />
<image src="chrome://moztop/skin/moztop.png" height="50" />
</toolbar>
</overlay>