PHP WinBinder 4: Final Tray Menu

From The Uniform Server Wiki
Jump to navigation Jump to search

 

UniServer 5-Nano
PHP WinBinder 4 - Tray Menu.

WinBinder Part 4 - Final Tray Menu

Introduction

The tutorial download includes a generic working tray-menu. All tray-menu files are located in folder tray_menu_2.

Code is written in a classical style, any “c” type constructs have been avoided along with object-orientated code. This makes code easier to read and modifiable by PHP web programmers with little or no experience in CLI coding.

This tray-menu is portable and may be run from a USB memory stick. Thanks to the new version of WinBinder the menu supports UTF-8 allowing displayed menu items to be configured for any language.

General Purpose use

If you wish delete the following two files they are specific to Uniform Server and not required for general-purpose use.

  • unitray_info.php
  • tray_menu.exe (see below to compile your own)

A configuration file (tray_menu.ini) is provided as an example again its specific to Uniform Server. Save this file for reference and create a new file named tray_menu.ini add menu items as required.

The tray-menu is run from a batch file tray menu.bat double click to run. This is ideal for testing however you may wish to convert this file to an executable. You have he following two options:

  • Preferred method is to compile the project using phpack
    check out WinBinder forum for full details.
    Using phpack takes just a few mouse clicks. Select the “tiny” stub to produce a very compact exe.
  • Alternative convert batch file to an exe as explained on this page Create a single EXE file

Top

Uniform Server Demo

As mentioned above the tray-menu demo is biased toward Uniform Server.

To run this demo; preferably extract a new copy of Uniform Server or if you wish run on an existing installation.

  • Copy folder tray_menu_2 and all its content to folder UniServer\unicon\tray_menu_2
  • Copy file UniServer\unicon\tray_menu_2\tray_menu.exe to folder UniServer
  • To run double click on file UniServer\tray_menu.exe

Configuration file

The configuration file (tray_menu.ini) provided has Multi-server operation disabled modifications are required to implement this feature (on going design).

All other Uniform Server functions and features are controllable.

Below is a snippet from the configuration file to show what is required to produce the sub-menu. Image on the right is the full menu with sub-menu displayed.

; This is a sample configuration file
; Comments start with ';', as in php.ini
; Demo configuration file for Uniform Server

title = "US Menu"    ; Application name

[main_menu]

item[]      = "Start UniServer (Apache MySQL Program)"
action[]    = "runh"   
file[]      = "../../usr/local/php/php.exe" 
parameter[] = "-n ../main/start_servers.php 7" 
icon[]      = "7"                   

item[]      = "Stop  UniServer (Apache MySQLProgram)"
action[]    = "runh"
file[]      = "../../usr/local/php/php.exe"
parameter[] = "-n ../main/stop_servers.php 7"
icon[]      = "6"  

item[]      = "Individual Server Control"
action[]    = "sub"
file[]      = "Individual_program"
parameter[] = ""
icon[]      = "13"

;------------------------
action[]    = "separator"  

item[]      = "Service Control"
action[]    = "sub"
file[]      = "service"
parameter[] = ""
icon[]      = "13"

; etc ...............

;=== Run serveres as a service  ====================
[service]

item[]      = "Start UniServer (Service)"  
action[]    = "runh"                        
file[]      = "../../usr/local/php/php.exe"  
parameter[] = "-n ../main/service_install_run.php 7" 
icon[]      = "9"                       

item[]      = "Stop  UniServer (Service"
action[]    = "runh"
file[]      = "../../usr/local/php/php.exe"
parameter[] = "-n ../main/service_stop_uninstall.php  7"
icon[]      = "8" 

;------------------------
action[]    = "separator"


item[]      = "Install Start Apache Service" 
action[]    = "runh"                         
file[]      = "../../usr/local/php/php.exe"   
parameter[] = "-n ../main/service_install_run.php 1" 
icon[]      = "9"                 

item[]      = "Stop  Uninstall Apache Service"
action[]    = "runh"
file[]      = "../../usr/local/php/php.exe"
parameter[] = "-n ../main/service_stop_uninstall.php  1"
icon[]      = "8" 

;etc ...............................

 

Top

Summary

The Uniform Server tray-menu demo has a few rough edges these require resolving.

The menu is stable enough to serve as a template for a Uniform Server specific menu.

See follow-up tutorial US Tray Menu.

Top