SAC:Setup OCS Custom Additions

From OSGeo
Jump to navigation Jump to search

For capturing some notes about trying to create a custom new set of forms for use in OCS Open Conference System. These tests are done on me local PC but will be merged into OSGeo code if/when ready.

These improvements attempt to address some of the system needs discussed in FOSS4G2008 Committee Issues

This is also a journal chronicling the adaptations.

Cloning a Core Class and Templates

To keep it as simple as possible I will take the existing Accommodations functions, make a copy and modify them from there. (At time of writing this was only available in CVS for upcoming OCS 2.2 release) My new functions will be for presenting a link to Transportation items alongside Accommodations in the Conference Information section of the site (both publicly and for managers to update).

cd OCSROOT/classes/manager/form

Replace all references to Accommodations and accommodations with Transportation:

sed -i .bak 's/Accommodation/Transportation/g'
sed -i .bak 's/accommodation/transportation/g'
cd OCSROOT/pages/manager
sed -i .bak 's/Accommodation/Transportation/g'
sed -i .bak 's/accommodation/transportation/g'
cd OCSROOT/templates/manager
cp accommodationSettings.tpl transportationSettings.tpl
sed -i .bak 's/Accommodation/Transportation/g' transportationSettings.tpl
sed -i .bak 's/accommodation/transportation/g' transportationSettings.tpl
cd OCSROOT/templates/schedConf
cp accommodation.tpl transportation.tpl
sed -i .bak 's/Accommodation/Transportation/g' transportation.tpl
sed -i .bak 's/accommodation/transportation/g' transportation.tpl

Update locale.xml file to populate UI:

         <message key="schedConf.accommodation">Accommodation</message>
        <message key="schedConf.accommodation.title">{$schedConfAbbrev} Accommodation</message>
        <!-- Accommodation settings -->  ---  Whole section
        <message key="manager.accommodation">Accommodation</message> 

Update ManagerHandler so options appear:

        // Accommodation
        ... entire section (2 functions)
        // Transportation
        function transportation() {
        function saveTransportationSettings() {

Add section to:

         * Display conference transportation page
        function transportation() {
                list($conference, $schedConf) = SchedConfHandler::validate(true, true);

                $templateMgr = &TemplateManager::getManager();
                $templateMgr->assign('pageHierarchy', array(
                        array(Request::url(null, 'index', 'index'), $conference->getConferenceTitle(), true),
                        array(Request::url(null, null, 'index'), $schedConf->getSchedConfTitle(), true)));
                $templateMgr->assign('transportationDescription', $schedConf->getLocalizedSetting('transportationDescription'));
                $templateMgr->assign('transportationFiles', $schedConf->getLocalizedSetting('transportationFiles'));

                $templateMgr->assign('helpTopicId', 'schedConf.transportation');

Finally, add it so that the new Transportation link shows up on the main manager page, by copying the accommodation line and modifying it:

                <li>» <a href="{url schedConf=$schedConf->getPath() page="manager" op="accommodation"}">{translate key="manager.accommodation"}</a></li>
                <li>» <a href="{url schedConf=$schedConf->getPath() page="manager" op="transportation"}">{translate key="manager.transportation"}</a></li>

Okay, so there is still one more step, do similar to above, but so this shows up on the public page too. I just threw in a dash between accommodation and transportation links since they are related:

  <li>» <a href="{url page="schedConf" op="accommodation"}">{translate key="schedConf.accommodation"}</a> – 
        <a href="{url page="schedConf" op="transportation"}">{translate key="schedConf.transportation"}</a></li>

Cloning and Customising a Simple Block for the sidebar

Blocks are the sections often used in the sidebar menus - i.e. showing you login information or a navigation menu or search box. In this learning exercise I will clone an existing simple block (plugins/blocks/developedBy) and make one that shows the latest announcement. I expect to find that I'll have to look at a different more complex example to learn how to get the data from the db... we'll see ... underway...