This article illustrates how to create a simple page in sipXconfig, for both user and admin portal.
Notes
Throughout this article I will consider the '/main/sipXconfig' the root directory.
Intro
We use test-driven development (TDD) in order to create / modify a page or fix a issue.
...
ant test-all -Dtest.name=MyTest
I Admin portal
1. Add a new menu (MyMenu) and a new entry (MyPage) to the new page
a. Add a test for the new menu and the new page
Under '/sipXconfig/web/test' directory, create a new package org.sipfoundry.sipxconfig.site.admin.mypackage and a new test class in this package (MyPageTestUi.java):
...
............
[~lceausescu@itcnetworks.ro:concat] testcase: MyPageTestUi
[~lceausescu@itcnetworks.ro:concat] junit.framework.AssertionFailedErrorjunit.framework.AssertionFailedError: Unable to find link with id [~lceausescu@itcnetworks.ro:menu.myPage]
b. Create the menu entry and the page
In sipXconfig/web/context/WEB-INF/common/AdminNavigation.html file, add the next piece of code:
...
Now MyPageTestUi test will pass and changes can be seen below:
2. Add tabs for this page
a. Modify the unit test
MyPageTestUi.java
Code Block | ||||
---|---|---|---|---|
| ||||
public void testDisplay() { SiteTestHelper.assertNoException(tester); SiteTestHelper.assertNoUserError(tester); assertLinkPresent("link:first"); assertLinkPresent("link:second"); } |
...
[~lceausescu@itcnetworks.ro:concat] testcase: MyPageTestUi
[~lceausescu@itcnetworks.ro:concat] junit.framework.AssertionFailedErrorjunit.framework.AssertionFailedError: Unable to find link with id [link:first]
b. Add the tabs
We will modify previously created files as follows:
...
Now MyPageTestUi test will pass and changes can be seen below:
II User portal
Adding a page in User portal is similar to adding a page in the Admin portal
1. Add a new entry to the new page (MyUserPage)
Under '/sipXconfig/web/test/org/sipfoundry/sipxconfig/site/user_portal' package create a new test class (MyUserPageTestUi.java):
...
Now MyUserPageTestUi test will pass and changes can be seen below:
2. Add tabs for this page
Modify MyUserPageTestUi.java test class:
...