Last page update: November 23, 2011
![]()
This XML file allows to create a menu for your project’s webpages.
If you have autocreated it (following the instructions of the autocreation of a package section) you will find this code:
<?xml version="1.0" encoding="UTF-8"?> <GenRoBag> </GenRoBag>All you have to do is to fill the introduction called <GenRoBag> with tags. Every webpage of your project has to fill a single tag. The syntax is:
<tagName label='labelName' file='packageName/fileName' />Where:
- tagName is the name of the tag (it doesn’t appear on menu view)
- label='' includes a string with the name of the menu voice
- file='' includes a string with the name of the package in which the webpage is defined followed by the name of the related webpage file (without its .py extension)
Note
you can omit the packageName if the menu.xml is included in the same package folder of the webpages you’re including in it.
Let’s see an example:
Example:
if you have a project with a package called office that includes three webpages called companies_page.py, staff_page.py and contacts_page.py:
![]()
then your menu will be:
<?xml version="1.0" encoding="UTF-8"?> <GenRoBag> <companies label="Companies" file="office/companies_page"/> <staff label="Staff" file="office/staff_page"/> <contacts label="Contacts" file="office/contacts_page"/> </GenRoBag>For what we have said in the previous note, you could also have written:
<?xml version="1.0" encoding="UTF-8"?> <GenRoBag> <companies label="Companies" file="companies_page"/> <staff label="Staff" file="staff_page"/> <contacts label="Contacts" file="contacts_page"/> </GenRoBag>omitting the package name (office).
There are many addictional attributes to improve your menu. In the next section we’ll see them.
Definition:
The basepath is a tag attribute that allows to define the path of your webpages into the menu when they are grouped in folders.
Syntax:
basepath="/packageName/webpageFolderName"Where:
- packageName is the name of your package
- webpageFolderName is the name of the webpage folder that contains your webpages
Example:
if you have a project called office with the following structure:
![]()
so, in the webpages folder you have:
A folder called agenda with three webpages:
- companies_page.py
- staff_page.py
- contacts_page.py
A folder called calendar with two webpages:
- recurrences_page.py
- management_page.py
Then you will have to write:
<?xml version="1.0" encoding="UTF-8"?> <GenRoBag> <agenda label='Agenda' basepath="/office/agenda" > <companies label="Companies" file="companies_page"/> <staff label="Staff" file="staff_page"/> <contacts label="Contacts" file="contacts_page"/> </agenda> <calendar label='Calendar' basepath="/office/calendar" > <recurrences label='Recurrences' file="recurrences_page"/> <management label='Management' file="management_page"/> </calendar> </GenRoBag>
If you have defined the permits [1] of your webpage, you can keep private some webpages according to the type of authorization. For example, you can create some pages visible only to developers and some pages visible only to the administrator.
To do this, you have to use the tags attribute.
Syntax:
tags="authorizationTag"where authorizationTag is a string with the name of the permit, defined in the <authentication> of the instanceconfig.xml file. For more information, please check the relative documentation page.
Example:
We refers now to the example of the basepath section.
If you want that the webpage called management.py is viewed only by the users with “admin” permits, you have to add the attribute tags="admin" to the <management> tag and you have to add the tags="user" to the folder that includes the <management> tag:
<?xml version="1.0" encoding="UTF-8"?> <GenRoBag> <agenda label='Agenda' basepath="/office/agenda" > ... </agenda> <calendar label='Calendar' basepath="/office/calendar" tags="user"> <!-- tags="staff": allow every user to see this folder --> <recurrences label='Recurrences' file="recurrences"/> <management label='Management' file="management" tags="admin"/> <!-- tags="admin": only admin user will see this menu line --> </calendar> </GenRoBag>
TODO you can use the outcodes to add icons to your menu
If you have created some resource pages, then the tag line in the menu is a little different from the one for the normal webpages.
In particular, the syntax of the tag is:
<tagName label='labelName' table='packageName.fileName' />Where:
tagName is the name of the tag (it doesn’t appear on menu view)
label='' includes a string with the name of the menu voice
table='' includes a string with the name of the package in which the resource page is defined followed by the name of the related resource page file (without its th_ prefix and its .py extension)
Example:
Let’s suppose to have a project called office with inside a package called office.
This package has two resource pages called th_development.py and th_management.py:
![]()
and three webpages called companies_page.py, contacts_page.py and staff_page.py:
![]()
then your menu can be:
<?xml version="1.0" encoding="UTF-8"?> <GenRoBag> <development label="Development" table="office.development"/> <staff label="Staff" file="office/staff_page"/> <management label="Management" table="office.management"/> <companies label="Companies" file="office/companies_page"/> <contacts label="Contacts" file="office/contacts_page"/> </GenRoBag>Note
please notice the different split character (besides the attribute name) for a resource pages respect to a normal webpages:
normal webpage:
- attribute name = file
- split character = / (slash)
Example:
<staff label="Staff" file="office/staff_page"/>resource webpage:
- attribute name = table
- split character = . (dot)
Example:
<staff label="Staff" table="office.staff"/>
Let’s see the image:
![]()
The current selected page is highlighted through a different color. Also, the menu supports a folder-hierarchy; there will be visualized only the contents of a single folder at a time.
In the image:
- the Invoices Tables and the Utility bars are the folders. In particular, the current folder selected is the first one
- Customers, Products, Products Type, Invoices, Single Record belong to the Invoices Tables folder and customers is the current opened page
Footnotes:
| [1] | You handle the permits through the <authentication> tag of the instanceconfig.xml file |
Enter search terms or a module, class or function name.