This topic will walk you through the steps to use the #ew_create_record
macro to create a record submission form for the Tasks table.
The basic steps for adding a new page to the EUI are:
To create a page in the EUI that gives end users the ability to submit a task:
The <iframe> tag which contains the #ew_create_record macro will be similar to the following:
<iframe src='#ew_create_record("contacts.employees" "/eui2template/main.php" "parent")' name="content_frame" id="frameres" width="100%" frameborder="0"></iframe> |
Replace contacts.employees (the first parameter) with "task" (the logical table name of the Tasks table).
The next step in making this page accessible is to add a link from the menu by making a few changes to menu.htm. Each menu tab is a list item <li> containing a link to a template page. Menu.htm makes heavy use of conditionals and the method $ewUser.isInGroup to ensure that different types of end users see only the tabs relevant to them.
In the initial default setup, the EUI is configured for users in several different groups. The table below outlines the available functions and navigational tabs each user group sees when accessing the EUI:
Group | Default EUI Tabs |
---|---|
Guest |
|
Internal Customer |
|
Document Creator |
|
Contract Creator |
|
Repair Customer |
|
Any groups not listed above will see the following tabs:
Let's look at the first <li> item in menu.htm:
<li id="main"><a href='#ew_forward("main.php")'>$ewText.get("menu.home")</a></li>
There are a few things to note about the code.
The link's href attribute is formed with the #ew_forward
macro. This macro forwards the user to the page specified by the $templateName parameter.
Using |
The link text is referenced by the method $ewText.get()
. We will return to $ewText.get
in more detail a little later.
The menu tab's ID is used in part by the JavaScript function menuChange()
. This simple script allows the browser to recognize the current page and highlight the corresponding menu tab:
In menu.htm, scroll to the Body field. Locate the <script> section and the block of text beginning function menuChange()
.
function menuChange() { if (document.getElementById && document.createTextNode) { if (homepage || location.href.match('main.php')) { document.getElementById('main').className='active'; } else if (location.href.match('new_user')) { document.getElementById('new_user').className='active'; } else if (location.href.match('new_')) { document.getElementById('new').className='active'; } else if (location.href.match('-faq')) { document.getElementById('faq').className='active'; } else if (location.href.match('my_profile')) { document.getElementById('my_profile').className='active'; }else if (location.href.match('my_') || location.href.match('open') || location.href.match('all_')) { document.getElementById('view').className='active'; } else if (location.href.match('chat')) { document.getElementById('chat').className='active'; } } } |
This piece of JavaScript looks at the browser's current URL.
The stylesheet style.css holds a rule that sets the background color of an 'active' menu tab.
Let's create a link to new_task.html:
|
The next step in creating a task submission page is to create an end user layout and give the appropriate users access permissions to the Tasks table.