|
Sybernet / Supplied Procedures Reference
Release 3.00 Dec 04, 2005 |
|
This procedure creates the Sybernet menu bar. It provides a standard and consistent interface for your users that allows them to return to the main menu, change their preferences, access your help text, cancel a request, and logout from Sybernet.
You can override the default Instructions when calling the menubar by specifying the name of the stored procedure that will provide instructions.
procedure sp_html_menubar
(
@PROCNAME VARCHAR(255)
, @SEARCH VARCHAR(255)
, @TARGET VARCHAR(30)
, @WIDTH VARCHAR(6)
, @HEIGHT VARCHAR(6)
, @SCROLLBARS VARCHAR(6)
, @RESIZEABLE VARCHAR(6)
, @STATUS VARCHAR(255)
, @GROUPNAME VARCHAR(92)
, @HEADER VARCHAR(6)
, @FOOTER VARCHAR(6)
, @CANCEL VARCHAR(30)
, @PREFERENCES VARCHAR(255)
)
| Parameter | Description |
|---|---|
procname |
PROCNAME is the name of the stored procedure that should be executed when the user clicks on the Instructions image on the menubar. When PROCNAME is NULL, you get the default instructions for Sybernet. If PROCNAME is a URL, that URL is opened in a new window. PROCNAME can also be a stored procedure that is either invoked inline (because TARGET is NULL) or in its own window. |
search |
SEARCH are any arguments that you wish to pass to this procedure; for
example, you might wish to have one help procedure defined that displays
help text based on the parameter passed to it.
While the SEARCH string could be appended to PROCNAME in the usual way, passing it separately guarantees that this string will be valid because it will automatically be URL Encoded. |
target |
When TARGET is specified, a new window is created which will be used for the output text of your stored procedure. When NULL, output is sent to the same window. |
width |
WIDTH specifies the width of your new window in pixels. The default is 200. WIDTH is ignored if TARGET is NUL |
height |
HEIGHT specifies the height of your new window in pixels. The default is 400. HEIGHT is ignored if TARGET is NULL. |
scrollbars |
SCROLLBARS determines if the new window created will have scroll bars. Allowed values are yes and no. The default is no. |
resizeable |
RESIZEABLE determines if the new window created can be resized. Allowed values are yes and no. The defulat is yes |
status |
STATUS is written to the window's status line when a mouseOver event occurs on this link. |
groupname |
This option allows you to control what menu screen is displayed when a user clicks the Main Menu button. To specify otherwise, attach the fully qualified procedure name that controls this directory. The MYSELF package can be used to determine this name. |
header |
Determines (yes or no) if a HR tag is created. |
footer |
Determines (yes or no) if a HR tag is created. |
cancel |
Determines the name of the window (a target) where the cancel results are sent. |
preferences |
Allows you to override the preferences button on the menu screen. Preferences can be a stored procedure or a javascript function that you wrote. |
The first example is how you would direct output of your help procedure to the same window.
exec http.dbo.sp_html_menubar
@PROCNAME = 'sp_html_help'
, @SEARCH = 'Step 3'
, @STATUS = 'Click here for information on how to use this tool!'
Notice that the parameter "Step 3" is passed to "sp_html_help."
The next example works exactly the same way except that it creates a new browser window to send this information.
exec http.dbo.sp_html_menubar
@PROCNAME = 'sp_html_help'
, @SEARCH = 'Step 3'
, @TARGET = 'HelpWindow'
, @WIDTH = '400'
, @HEIGHT = '600'
GROUPNAME is important if you want the Main Menu image to go back to the parent (or folder) that this procedure was invoked from. This is the fully qualified procedure name for this parent. To do this dynamically you can use the MYSELF package to retrieve this name. The following example illustrates how this is done:
DECLARE
@PROCID INT
, @GROUPNAME VARCHAR(92)
BEGIN
SELECT @PROCID = @@PROCID
EXEC sp_myself
@PROCID = @PROCID
, @GROUPNAME = @GROUPNAME OUTPUT
EXEC http.dbo.sp_html_menubar
@GROUPNAME = @GROUPNAME
END
This seems like a lot of work, but in reality your stored procedure should be calling sp_myself to retrieve other things that you might want to use while your procedure is running. Requesting the groupname then is just another output parameter to sp_myself.
You may wish to use the Preferences button for your own purposes. In fact, this is encouraged. You can override the preferences button by passing a procedure name or javascript function. Here is how that is accomplished:
BEGIN
SELECT CHAR(10) + '<script type="text/javascript">'
EXEC http.javascript.openWindow
SELECT CHAR(10) + 'function pref()'
, CHAR(10) + '{'
, CHAR(10) + ' var newWindow=openWindow("","preferences",460,500,1,1,0,0,0,0,0);'
, CHAR(10) + ' newWindow.document.writeln("<html>");'
, CHAR(10) + ' newWindow.document.writeln("<body bgcolor=white>");'
, CHAR(10) + ' newWindow.document.writeln("<h1>Hello?</h1>");'
, CHAR(10) + ' newWindow.document.writeln("</body>");'
, CHAR(10) + ' newWindow.document.writeln("</html>");'
, CHAR(10) + ' return;'
, CHAR(10) + '}'
, CHAR(10) + '</script>'
EXEC http.dbo.sp_html_menubar
@PREFERENCES = 'javascript:pref();'
END
The following example illustrates how to pass a URL that points to your instructions:
BEGIN
EXEC http.dbo.sp_html_menubar
@PROCNAME = 'http://Sybernet.sri.com/sybase/procedures/SP_HTML_MENUBAR.html'
, @WIDTH = '400'
, @HEIGHT = '600'
END