diff --git a/application/portalwebpage.class.inc.php b/application/portalwebpage.class.inc.php new file mode 100644 index 000000000..b6a443b75 --- /dev/null +++ b/application/portalwebpage.class.inc.php @@ -0,0 +1,170 @@ + + * @author Romain Quetiez + * @author Denis Flaven + * @license http://www.opensource.org/licenses/gpl-3.0.html LGPL + */ + +require_once("../application/nicewebpage.class.inc.php"); +require_once("../application/applicationcontext.class.inc.php"); +require_once("../application/user.preferences.class.inc.php"); +/** + * Web page with some associated CSS and scripts (jquery) for a fancier display + * of the Portal web page + */ +class PortalWebPage extends NiceWebPage +{ + /** + * Portal menu + */ + protected $m_aMenuButtons; + + public function __construct($sTitle) + { + $this->m_aMenuButtons = array(); + parent::__construct($sTitle); + $this->add_header("Content-type: text/html; charset=utf-8"); + $this->add_header("Cache-control: no-cache"); + $this->add_linked_stylesheet("../css/jquery.treeview.css"); + $this->add_linked_stylesheet("../css/jquery.autocomplete.css"); + $this->add_linked_stylesheet("../portal/portal.css"); + $this->add_linked_script('../js/jquery.layout.min.js'); + $this->add_linked_script('../js/jquery.ba-bbq.min.js'); + $this->add_linked_script("../js/jquery.tablehover.js"); + $this->add_linked_script("../js/jquery.treeview.js"); + $this->add_linked_script("../js/jquery.autocomplete.js"); + $this->add_linked_script("../js/jquery.bgiframe.js"); + $this->add_linked_script("../js/jquery.positionBy.js"); + $this->add_linked_script("../js/jquery.popupmenu.js"); + $this->add_linked_script("../js/date.js"); + $this->add_linked_script("../js/jquery.tablesorter.min.js"); + $this->add_linked_script("../js/jquery.blockUI.js"); + $this->add_linked_script("../js/utils.js"); + $this->add_linked_script("../js/forms-json-utils.js"); + $this->add_linked_script("../js/swfobject.js"); + $this->add_ready_script( +<< 0) + { + this.truncatedList = true; + } + if (this.truncatedList) + { + $("tr td",table).removeClass('truncated'); + $("tr:last td",table).addClass('truncated'); + } + } + }); + + + $.tablesorter.addWidget({ + // give the widget a id + id: "myZebra", + // format is called when the on init and when a sorting has finished + format: function(table) + { + // Replace the 'red even' lines by 'red_even' since most browser do not support 2 classes selector in CSS, etc.. + $("tbody tr:even",table).addClass('even'); + $("tbody tr.red:even",table).removeClass('red').removeClass('even').addClass('red_even'); + $("tbody tr.orange:even",table).removeClass('orange').removeClass('even').addClass('orange_even'); + $("tbody tr.green:even",table).removeClass('green').removeClass('even').addClass('green_even'); + } + }); + + $("table.listResults").tableHover(); // hover tables + $(".listResults").tablesorter( { widgets: ['myZebra', 'truncatedList']} ); // sortable and zebra tables + $(".date-pick").datepicker({ + showOn: 'button', + buttonImage: '../images/calendar.png', + buttonImageOnly: true, + dateFormat: 'yy-mm-dd', + constrainInput: false, + changeMonth: true, + changeYear: true + }); + $('.resizable').resizable(); // Make resizable everything that claims to be resizable ! +} +catch(err) +{ + // Do something with the error ! + alert(err); +} +EOF +); + + $this->add_script( +<< 0); + if (!bResult) + { + alert(sMessage); + } + return bResult; + } + + function GoBack() + { + var form = $('#request_form'); + var step = $('input[name=step]'); + + form.unbind('submit'); // De-activate validation + step.val(step.val() -2); // To go Back one step: next step is x, current step is x-1, previous step is x-2 + form.submit(); // Go + } +EOF +); + + } + + /** + * Add a button to the portal's main menu + */ + public function AddMenuButton($sId, $sLabel, $sHyperlink) + { + $this->m_aMenuButtons[] = array('id' => $sId, 'label' => $sLabel, 'hyperlink' => $sHyperlink); + } + + public function output() + { + $this->AddMenuButton('logoff', 'Portal:Disconnect', '../pages/logoff.php?portal=1'); // This menu is always present and is the last one + $sMenu = '