[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[cobalt-users] RE: [cobalt-developers] UI Mods



My apologies for the cross post but I thought there might be some people
on the users list that might be interested in this. So, here we go...

If you want to add a new tab across the top of the web interface, here's
the steps that you have to take::

1) Get into the shell as root and goto
/usr/sausalito/ui/menu/base/carmel/. In there should be quite a few XML
files, these are what define the green tabs and buttons across the top
of the UI.

2) Make and edit a new XML file: pico testTab.xml. The code for the XML
should look as follows::
<item
  id="base_testTab"
  label="My tab"
  description="This is my tab."
  url="/splashTestTab.php">
  <parent id="root" order="50"/>
</item>

A couple things to note. The order attribute defines the placement of
the tab. Larger numbers get placed at the right end and I believe it
defaults to 1000. The id can be whatever you want it to be as long as
it's consistent in the other files we're going to build.

3) Do a 'cd ../../../web', then a 'ls'. You should see several files
named 'splash*.php'. copy one of these to the php file we named above,
'cp splashPrograms.php splashTestTab.php'. If you log into the web
interface you should now see a new tab on top labeled 'My tab'. Clicking
on it should show you the default splash page for the other tabs.

4) Now, let's add a menu item. We're still in the web directory so let's
do a 'cd base' then a 'mkdir test'. Goto the test dir and create and
edit a new file, 'pico testMenu.php'. The code is as follows:
<?php
include("ServerScriptHelper.php");

$servhelp = new ServerScriptHelper();
$factory  = $servhelp->getHtmlComponentFactory("base-am");
$page     = $factory->getPage();

print($page->toHeaderHtml());

$label = $factory->getLabel("This is my test page...", false);

print($label->toHtml());
print($page->toFooterHtml());
?>

5) Do 'cd ../../../menu/base' and create a new directory test. In that
directory we need to make an XML file, testMenu.xml. It should look as
follows::
<item
  id="base_testMenu"
  label="My Menu"
  description="This is my test menu..."
  url="/base/test/testMenu.php">
  <parent id="base_testTab" order="10"/>
</item>

Notice that the parent id attribute is the same as the id attribute in
the XML file we created for the tab. Sub menu items can be created by
adding additional XML files to this directory. They should have their
own unique id but the parent id should be set to 'base_testMenu'. Sub
menu items follow the same order attribute rules as other items. Action
pages for those sub items are defined in php files that you can create
in the same directory as the php file above.

For a more detailed discussion in creating menus and using the php UI
classes, I recommend checking out the developer docs that are posted on
the developer site. I believe the latest version is at::
http://developer.cobalt.com/sausalito/index.php

My apologies for the length of the post but I hope it made sense to
everyone. If you have questions, feel free to hollar and I'll do my best
to answer them.

8)
sean

-----Original Message-----
From: Matt Boise [mailto:my_hidden_email@xxxxxxxxx]
Sent: Tuesday, July 24, 2001 1:34 PM
To: cobalt-developers@xxxxxxxxxxxxxxx
Subject: Re: [cobalt-developers] UI Mods


Yeah, post them, I would be interested

Joe

----- Original Message ----- 
From: "Sean Slavin" <sslavin@xxxxxxxxxxx>
To: <cobalt-developers@xxxxxxxxxxxxxxx>
Sent: Tuesday, July 24, 2001 1:08 PM
Subject: RE: [cobalt-developers] UI Mods


Thanks but I just figured it out. If anyone's interested in adding new
tabs across the top, let me know and I'll post the steps.

8)
sean