This is an automated email from the git hooks/post-receive script. It was
generated because a ref change was pushed to the repository containing
the project "FusionForge".
The branch, feature/twig-template-engine has been updated
via af14a2d8f4981c2390bd32e8ac106fc3fd1f26e8 (commit)
via f05700d3475b141b0bed8369348d6b46aa3a387b (commit)
via 01d49f03fed0316b6c383872f3a18dcf74e3bb83 (commit)
via ed83dd61857dfc2659e965e3e651fbf540b6245d (commit)
from 7efdcac428aacf1aa998819794fa0464b233a925 (commit)
Those revisions listed above that are new to this repository have
not appeared on any other notification email; so we list those
revisions in full, below.
- Log -----------------------------------------------------------------
commit af14a2d8f4981c2390bd32e8ac106fc3fd1f26e8
Author: Roland Mas <[email protected]>
Date: Fri Jun 12 09:46:30 2015 +0200
Implement submenu with Twig
diff --git a/src/www/themes/funky-twig/Theme.class.php
b/src/www/themes/funky-twig/Theme.class.php
index 538421b..fbe3ebe 100644
--- a/src/www/themes/funky-twig/Theme.class.php
+++ b/src/www/themes/funky-twig/Theme.class.php
@@ -90,8 +90,8 @@ class Theme extends Layout {
}
$vars = array('href' => $href,
- 'text' => $text,
- 'extra_params' => $extra_params);
+ 'text' => $text,
+ 'extra_params' => $extra_params);
return $this->renderTemplate('Link.html', $vars);
}
@@ -359,6 +359,8 @@ class Theme extends Layout {
$vars['warning_msg'] = $GLOBALS['warning_msg'];
$vars['feedback'] = $GLOBALS['feedback'];
+ $vars['submenu'] = $params['submenu'];
+
print $this->renderTemplate('bodyHeader.html', $vars);
}
function footer($params = array()) {
@@ -439,24 +441,32 @@ class Theme extends Layout {
return parent::searchBox();
}
function beginSubMenu() {
- // TODO
- return parent::beginSubMenu();
+ return $this->renderTemplate('beginSubMenu.html');
}
function endSubMenu() {
- // TODO
- return parent::endSubMenu();
+ return $this->renderTemplate('endSubMenu.html');
}
function printSubMenu($title_arr, $links_arr, $attr_arr) {
- // TODO
- return parent::printSubMenu($title_arr, $links_arr, $attr_arr);
+ $submenuentries = array();
+
+ for ($i=0; $i < count($title_arr); $i++) {
+ $submenuentries[] = array('title' => $title_arr[$i],
+ 'url'
=> util_make_uri($links_arr[$i]),
+
'attrs' => $attr_arr[$i]);
+ }
+
+ $vars = array('submenuentries' => $submenuentries);
+
+ return $this->renderTemplate('printSubMenu.html', $vars);
}
function subMenuSeparator() {
- // TODO
- return parent::subMenuSeparator();
+ return $this->renderTemplate('subMenuSeparator.html');
}
function subMenu($title_arr, $links_arr, $attr_arr = array()) {
- // TODO
- return parent::subMenu($title_arr, $links_arr, $attr_arr);
+ $return = $this->beginSubMenu();
+ $return .= $this->printSubMenu($title_arr, $links_arr,
$attr_arr);
+ $return .= $this->endSubMenu();
+ return $return;
}
function multiTableRow($row_attrs, $cell_data, $istitle = false) {
if (!isset($row_attrs['class'])) {
diff --git a/src/www/themes/funky-twig/templates/beginSubMenu.html
b/src/www/themes/funky-twig/templates/beginSubMenu.html
new file mode 100644
index 0000000..d29c58d
--- /dev/null
+++ b/src/www/themes/funky-twig/templates/beginSubMenu.html
@@ -0,0 +1 @@
+<p><strong>
diff --git a/src/www/themes/funky-twig/templates/bodyHeader.html
b/src/www/themes/funky-twig/templates/bodyHeader.html
index 84c6be9..c7b1873 100644
--- a/src/www/themes/funky-twig/templates/bodyHeader.html
+++ b/src/www/themes/funky-twig/templates/bodyHeader.html
@@ -47,4 +47,5 @@
{% else %}
<h1 class="hide">{{ title }}</h1>
{% endif %}
-
\ No newline at end of file
+
+ {{ submenu|raw }}
\ No newline at end of file
diff --git a/src/www/themes/funky-twig/templates/endSubMenu.html
b/src/www/themes/funky-twig/templates/endSubMenu.html
new file mode 100644
index 0000000..976811c
--- /dev/null
+++ b/src/www/themes/funky-twig/templates/endSubMenu.html
@@ -0,0 +1 @@
+</strong></p>
diff --git a/src/www/themes/funky-twig/templates/printSubMenu.html
b/src/www/themes/funky-twig/templates/printSubMenu.html
new file mode 100644
index 0000000..787bada
--- /dev/null
+++ b/src/www/themes/funky-twig/templates/printSubMenu.html
@@ -0,0 +1,4 @@
+ {% for entry in submenuentries %}
+ {% include 'Link.html' with { 'text': entry.title, 'href': entry.url,
'extra_params': entry.attrs, 'use_tooltips': use_tooltips } only %}
+ {% if not loop.last %}{% include 'subMenuSeparator.html' only %}{% endif
%}
+ {% endfor %}
\ No newline at end of file
diff --git a/src/www/themes/funky-twig/templates/subMenuSeparator.html
b/src/www/themes/funky-twig/templates/subMenuSeparator.html
new file mode 100644
index 0000000..62d2e39
--- /dev/null
+++ b/src/www/themes/funky-twig/templates/subMenuSeparator.html
@@ -0,0 +1 @@
+ |
commit f05700d3475b141b0bed8369348d6b46aa3a387b
Author: Roland Mas <[email protected]>
Date: Fri Jun 12 09:25:39 2015 +0200
Fixed lists
diff --git a/src/www/themes/funky-twig/Theme.class.php
b/src/www/themes/funky-twig/Theme.class.php
index 9250ee1..538421b 100644
--- a/src/www/themes/funky-twig/Theme.class.php
+++ b/src/www/themes/funky-twig/Theme.class.php
@@ -99,15 +99,12 @@ class Theme extends Layout {
function html_list($elements, $attrs = array(), $type = 'ul') {
$items = array();
for ($i = 0; $i < count($elements); $i++) {
- $items[$i]['element'] = $elements[$i];
- if ($i <= count($attrs)) {
- $items[$i]['attr'] = $attrs[$i];
- } else {
- $items[$i]['attr'] = '';
- }
+ $items[$i]['element'] = $elements[$i]['content'];
+ $items[$i]['attrs'] = $elements[$i]['attrs'];
}
- $vars = array('items' => $items);
+ $vars = array('items' => $items,
+ 'attrs' => $attrs);
if ($type == 'ol') {
return $this->renderTemplate('OrderedList.html', $vars);
diff --git a/src/www/themes/funky-twig/templates/OrderedList.html
b/src/www/themes/funky-twig/templates/OrderedList.html
index 52ddffc..ca893d4 100644
--- a/src/www/themes/funky-twig/templates/OrderedList.html
+++ b/src/www/themes/funky-twig/templates/OrderedList.html
@@ -1,7 +1,7 @@
-<ol>
+<ol {% for k,v in attrs %}{{ k }}="{{ v }}"{% endfor %}>
{% for i in items %}
- <li {{ i.attr }}>
- {{ i.element }}
+ <li {% for k,v in i.attrs %}{{ k }}="{{ v }}"{% endfor %}>
+ {{ i.element|raw }}
</li>
{% endfor %}
</ol>
diff --git a/src/www/themes/funky-twig/templates/UnorderedList.html
b/src/www/themes/funky-twig/templates/UnorderedList.html
index ee6ebcb..76233fe 100644
--- a/src/www/themes/funky-twig/templates/UnorderedList.html
+++ b/src/www/themes/funky-twig/templates/UnorderedList.html
@@ -1,7 +1,7 @@
-<ul>
+<ul {% for k,v in attrs %}{{ k }}="{{ v }}"{% endfor %}>
{% for i in items %}
- <li {{ i.attr }}>
- {{ i.element }}
+ <li {% for k,v in i.attrs %}{{ k }}="{{ v }}"{% endfor %}>
+ {{ i.element|raw }}
</li>
{% endfor %}
</ul>
commit 01d49f03fed0316b6c383872f3a18dcf74e3bb83
Author: Roland Mas <[email protected]>
Date: Fri Jun 12 09:17:36 2015 +0200
Refactor a bit, and export a couple of variables to all templates
automatically
diff --git a/src/www/themes/funky-twig/Theme.class.php
b/src/www/themes/funky-twig/Theme.class.php
index 87d919c..9250ee1 100644
--- a/src/www/themes/funky-twig/Theme.class.php
+++ b/src/www/themes/funky-twig/Theme.class.php
@@ -42,18 +42,23 @@ class Theme extends Layout {
$this->twig_loader = new
Twig_Loader_Filesystem(forge_get_config('themes_root').'/funky-twig/templates');
$this->twig = new Twig_Environment($this->twig_loader);
-
}
- function tabGenerator($TABS_DIRS, $TABS_TITLES, $TABS_TOOLTIPS,
$nested=false, $selected=false, $sel_tab_bgcolor='WHITE',
$total_width='100%') {
+ function renderTemplate($file, $vars = array()) {
global $use_tooltips;
- $template = $this->twig->loadTemplate('Tabs.html');
+ $vars['use_tooltips'] = $use_tooltips;
+ $vars['session_loggedin'] = session_loggedin();
+
+ $t = $this->twig->loadTemplate($file);
- $vars = array('use_tooltips' => $use_tooltips,
- 'nested' => $nested,
- 'total_width' => $total_width);
+ return $t->render($vars);
+ }
+ function tabGenerator($TABS_DIRS, $TABS_TITLES, $TABS_TOOLTIPS,
$nested=false, $selected=false, $sel_tab_bgcolor='WHITE',
$total_width='100%') {
+ $vars = array('nested' => $nested,
+ 'total_width' => $total_width);
+
$tabs = array();
for ($i = 0; $i < count($TABS_DIRS); $i++) {
$tab = array('href' => $TABS_DIRS[$i],
@@ -70,14 +75,10 @@ class Theme extends Layout {
}
$vars['tabs'] = $tabs;
- return $template->render($vars);
+ return $this->renderTemplate('Tabs.html', $vars);
}
function makeLink($path, $text, $extra_params = false, $absolute =
false) {
- global $use_tooltips;
-
- $template = $this->twig->loadTemplate('Link.html');
-
if (!is_array($extra_params)) {
$extra_params = array();
}
@@ -90,19 +91,12 @@ class Theme extends Layout {
$vars = array('href' => $href,
'text' => $text,
- 'extra_params' => $extra_params,
- 'use_tooltips' => $use_tooltips);
+ 'extra_params' => $extra_params);
- return $template->render($vars);
+ return $this->renderTemplate('Link.html', $vars);
}
function html_list($elements, $attrs = array(), $type = 'ul') {
- if ($type == 'ol') {
- $template =
$this->twig->loadTemplate('OrderedList.html');
- } else {
- $template =
$this->twig->loadTemplate('UnorderedList.html');
- }
-
$items = array();
for ($i = 0; $i < count($elements); $i++) {
$items[$i]['element'] = $elements[$i];
@@ -115,16 +109,18 @@ class Theme extends Layout {
$vars = array('items' => $items);
- return $template->render($vars);
+ if ($type == 'ol') {
+ return $this->renderTemplate('OrderedList.html', $vars);
+ } else {
+ return $this->renderTemplate('UnorderedList.html',
$vars);
+ }
}
function html_chartid($id = 0, $title = '') {
- $template = $this->twig->loadTemplate('ChartId.html');
-
$vars = array('chart_id' => $id,
'title' => $title);
- return $template->render($vars);
+ return $this->renderTemplate('ChartId.html', $vars);
}
// Methods to reimplement (if relevant)
@@ -137,8 +133,6 @@ class Theme extends Layout {
return parent::addStylesheet($css, $media);
}
function getJavascripts() {
- $template = $this->twig->loadTemplate('JavaScripts.html');
-
$scripts = array();
foreach ($this->javascripts as $js) {
$scripts[] = util_make_uri($js);
@@ -147,11 +141,9 @@ class Theme extends Layout {
$vars = array('js' => $scripts);
- return $template->render($vars);
+ return $this->renderTemplate('JavaScripts.html', $vars);
}
function getStylesheets() {
- $template = $this->twig->loadTemplate('StyleSheets.html');
-
$sheets = array();
foreach ($this->stylesheets as $c) {
$sheet = array('css' => util_make_uri($c['css']));
@@ -166,13 +158,11 @@ class Theme extends Layout {
$vars = array('sheets' => $sheets);
- return $template->render($vars);
+ return $this->renderTemplate('StyleSheets.html', $vars);
}
function header($params) {
$this->headerHTMLDeclaration();
- $template = $this->twig->loadTemplate('headerStart.html');
-
$vars = array();
$vars['forge_name'] = forge_get_config('forge_name');
@@ -249,15 +239,13 @@ class Theme extends Layout {
$vars['alt_representations'] = $p2['return'];
}
- print $template->render($vars);
+ print $this->renderTemplate('headerStart.html', $vars);
$this->bodyHeader($params);
}
function headerHTMLDeclaration() {
global $sysDTDs, $sysXMLNSs;
- $template = $this->twig->loadTemplate('HTMLDeclaration.html');
-
$vars = array();
if (!util_ifsetor($this->doctype) ||
!util_ifsetor($sysDTDs[$this->doctype])) {
@@ -267,16 +255,10 @@ class Theme extends Layout {
$vars['lang'] = _('en');
$vars['ns'] = $sysXMLNSs;
- print $template->render($vars);
+ print $this->renderTemplate('HTMLDeclaration.html', $vars);
}
function bodyHeader($params){
- global $use_tooltips;
-
- $template = $this->twig->loadTemplate('bodyHeader.html');
-
$vars = array();
-
- $vars['use_tooltips'] = $use_tooltips;
if (isset($params['h1'])) {
$vars['h1'] = $params['h1'];
@@ -310,8 +292,6 @@ class Theme extends Layout {
$vars['rowattrs'] = array();
$vars['siteheader_celldata'] = $cells;
- $vars['session_loggedin'] = session_loggedin();
-
if (session_loggedin()) {
$groups = session_get_user()->getGroups();
} else {
@@ -382,14 +362,12 @@ class Theme extends Layout {
$vars['warning_msg'] = $GLOBALS['warning_msg'];
$vars['feedback'] = $GLOBALS['feedback'];
- print $template->render($vars);
+ print $this->renderTemplate('bodyHeader.html', $vars);
}
function footer($params = array()) {
- $template = $this->twig->loadTemplate('footer.html');
-
$vars = array('imgurl' =>
util_make_uri('/images/pow-fusionforge.png'));
- print $template->render($vars);
+ print $this->renderTemplate('footer.html', $vars);
}
function footerEnd() {
// TODO
@@ -400,35 +378,25 @@ class Theme extends Layout {
return parent::getRootIndex();
}
function boxTop($title, $id='') {
- $template = $this->twig->loadTemplate('BoxTop.html');
-
$vars = array('id' => $id,
'title' => $title);
- return $template->render($vars);
+ return $this->renderTemplate('BoxTop.html', $vars);
}
function boxMiddle($title, $id='') {
- $template = $this->twig->loadTemplate('BoxMiddle.html');
-
$vars = array('id' => $id,
'title' => $title);
- return $template->render($vars);
+ return $this->renderTemplate('BoxMiddle.html', $vars);
}
function boxBottom() {
- $template = $this->twig->loadTemplate('BoxBottom.html');
-
- $vars = array();
-
- return $template->render($vars);
+ return $this->renderTemplate('BoxBottom.html');
}
function boxGetAltRowStyle($i, $classonly = false) {
// TODO
return parent::boxGetAltRowStyle($i, $classonly);
}
function listTableTop($titleArray = array(), $linksArray = array(),
$class = '', $id = '', $thClassArray = array(), $thTitleArray = array(),
$thOtherAttrsArray = array()) {
- $template = $this->twig->loadTemplate('ListTableTop.html');
-
$vars = array('id' => $id,
'class' => $class);
@@ -456,14 +424,10 @@ class Theme extends Layout {
$vars['data'] = $data;
- return $template->render($vars);
+ return $this->renderTemplate('ListTableTop.html', $vars);
}
function listTableBottom() {
- $template = $this->twig->loadTemplate('ListTableBottom.html');
-
- $vars = array();
-
- return $template->render($vars);
+ return $this->renderTemplate('ListTableBottom.html');
}
function outerTabs($params) {
// TODO -- not used directly by pages, can be inlined in this
file (unless used in several places)
@@ -498,8 +462,6 @@ class Theme extends Layout {
return parent::subMenu($title_arr, $links_arr, $attr_arr);
}
function multiTableRow($row_attrs, $cell_data, $istitle = false) {
- $template = $this->twig->loadTemplate('multiTableRow.html');
-
if (!isset($row_attrs['class'])) {
$row_attrs['class'] = '';
}
@@ -522,39 +484,29 @@ class Theme extends Layout {
'cells' => $cells,
'istitle' => $istitle);
- return $template->render($vars);
+ return $this->renderTemplate('multiTableRow.html', $vars);
}
function feedback($msg) {
- $template = $this->twig->loadTemplate('feedback.html');
-
$vars = array('message' => strip_tags($msg, '<br>'));
- return $template->render($vars);
+ return $this->renderTemplate('feedback.html', $vars);
}
function warning_msg($msg) {
- $template = $this->twig->loadTemplate('warningMessage.html');
-
$vars = array('message' => strip_tags($msg, '<br>'));
- return $template->render($vars);
+ return $this->renderTemplate('warningMessage.html', $vars);
}
function error_msg($msg) {
- $template = $this->twig->loadTemplate('errorMessage.html');
-
$vars = array('message' => strip_tags($msg, '<br>'));
- return $template->render($vars);
+ return $this->renderTemplate('errorMessage.html', $vars);
}
function information($msg) {
- $template = $this->twig->loadTemplate('information.html');
-
$vars = array('message' => strip_tags($msg, '<br>'));
- return $template->render($vars);
+ return $this->renderTemplate('information.html', $vars);
}
function confirmBox($msg, $params, $buttons, $image='*none*') {
- $template = $this->twig->loadTemplate('ConfirmBox.html');
-
if ($image == '*none*') {
$image = html_image('stop.png','48','48',array());
}
@@ -565,16 +517,14 @@ class Theme extends Layout {
'msg' => $msg,
'action' =>
getStringFromServer('PHP_SELF'));
- return $template->render($vars);
+ return $this->renderTemplate('ConfirmBox.html', $vars);
}
function jQueryUIconfirmBox($id = 'dialog-confirm', $title = 'Confirm
your action', $message = 'Do you confirm your action?') {
- $template =
$this->twig->loadTemplate('jQueryUIConfirmBox.html');
-
$vars = array('id' => $id,
'title' => $title,
'message' => $message);
- return $template->render($vars);
+ return $this->renderTemplate('jQueryUIConfirmBox.html', $vars);
}
function html_input($name, $id = '', $label = '', $type = 'text',
$value = '', $extra_params = '') {
// TODO
commit ed83dd61857dfc2659e965e3e651fbf540b6245d
Author: Roland Mas <[email protected]>
Date: Thu Jun 11 18:56:19 2015 +0200
Fixed header
diff --git a/src/www/themes/funky-twig/Theme.class.php
b/src/www/themes/funky-twig/Theme.class.php
index 7946156..87d919c 100644
--- a/src/www/themes/funky-twig/Theme.class.php
+++ b/src/www/themes/funky-twig/Theme.class.php
@@ -308,7 +308,7 @@ class Theme extends Layout {
'attrs' => array('id' =>
'header-col2'));
$vars['rowattrs'] = array();
- $vars['cell_data'] = $cells;
+ $vars['siteheader_celldata'] = $cells;
$vars['session_loggedin'] = session_loggedin();
@@ -344,7 +344,7 @@ class Theme extends Layout {
$outertabsdata = array();
$menu = $this->navigation->getSiteMenu();
- for ($i = 0; $i < count($menu); $i++) {
+ for ($i = 0; $i < count($menu['urls']); $i++) {
$d = array('href' => $menu['urls'][$i],
'id' => md5($menu['urls'][$i]),
'title' => $menu['titles'][$i],
diff --git a/src/www/themes/funky-twig/templates/bodyHeader.html
b/src/www/themes/funky-twig/templates/bodyHeader.html
index 3c1aeae..84c6be9 100644
--- a/src/www/themes/funky-twig/templates/bodyHeader.html
+++ b/src/www/themes/funky-twig/templates/bodyHeader.html
@@ -1,6 +1,6 @@
{% include 'ListTableTop.html' with { 'class': 'fullwidth', 'id': 'header' }
only %}
- {% include 'multiTableRow.html' %}
+ {% include 'multiTableRow.html' with { 'rowattrs': {}, 'cells':
siteheader_celldata } only %}
{% if session_loggedin %}
-----------------------------------------------------------------------
Summary of changes:
src/www/themes/funky-twig/Theme.class.php | 173 ++++++++-------------
.../themes/funky-twig/templates/OrderedList.html | 6 +-
.../themes/funky-twig/templates/UnorderedList.html | 6 +-
.../themes/funky-twig/templates/beginSubMenu.html | 1 +
.../themes/funky-twig/templates/bodyHeader.html | 5 +-
.../themes/funky-twig/templates/endSubMenu.html | 1 +
.../themes/funky-twig/templates/printSubMenu.html | 4 +
.../funky-twig/templates/subMenuSeparator.html | 1 +
8 files changed, 81 insertions(+), 116 deletions(-)
create mode 100644 src/www/themes/funky-twig/templates/beginSubMenu.html
create mode 100644 src/www/themes/funky-twig/templates/endSubMenu.html
create mode 100644 src/www/themes/funky-twig/templates/printSubMenu.html
create mode 100644 src/www/themes/funky-twig/templates/subMenuSeparator.html
diff --git a/src/www/themes/funky-twig/Theme.class.php
b/src/www/themes/funky-twig/Theme.class.php
index 7946156..fbe3ebe 100644
--- a/src/www/themes/funky-twig/Theme.class.php
+++ b/src/www/themes/funky-twig/Theme.class.php
@@ -42,18 +42,23 @@ class Theme extends Layout {
$this->twig_loader = new
Twig_Loader_Filesystem(forge_get_config('themes_root').'/funky-twig/templates');
$this->twig = new Twig_Environment($this->twig_loader);
-
}
- function tabGenerator($TABS_DIRS, $TABS_TITLES, $TABS_TOOLTIPS,
$nested=false, $selected=false, $sel_tab_bgcolor='WHITE',
$total_width='100%') {
+ function renderTemplate($file, $vars = array()) {
global $use_tooltips;
- $template = $this->twig->loadTemplate('Tabs.html');
+ $vars['use_tooltips'] = $use_tooltips;
+ $vars['session_loggedin'] = session_loggedin();
+
+ $t = $this->twig->loadTemplate($file);
- $vars = array('use_tooltips' => $use_tooltips,
- 'nested' => $nested,
- 'total_width' => $total_width);
+ return $t->render($vars);
+ }
+ function tabGenerator($TABS_DIRS, $TABS_TITLES, $TABS_TOOLTIPS,
$nested=false, $selected=false, $sel_tab_bgcolor='WHITE',
$total_width='100%') {
+ $vars = array('nested' => $nested,
+ 'total_width' => $total_width);
+
$tabs = array();
for ($i = 0; $i < count($TABS_DIRS); $i++) {
$tab = array('href' => $TABS_DIRS[$i],
@@ -70,14 +75,10 @@ class Theme extends Layout {
}
$vars['tabs'] = $tabs;
- return $template->render($vars);
+ return $this->renderTemplate('Tabs.html', $vars);
}
function makeLink($path, $text, $extra_params = false, $absolute =
false) {
- global $use_tooltips;
-
- $template = $this->twig->loadTemplate('Link.html');
-
if (!is_array($extra_params)) {
$extra_params = array();
}
@@ -89,42 +90,34 @@ class Theme extends Layout {
}
$vars = array('href' => $href,
- 'text' => $text,
- 'extra_params' => $extra_params,
- 'use_tooltips' => $use_tooltips);
+ 'text' => $text,
+ 'extra_params' => $extra_params);
- return $template->render($vars);
+ return $this->renderTemplate('Link.html', $vars);
}
function html_list($elements, $attrs = array(), $type = 'ul') {
- if ($type == 'ol') {
- $template =
$this->twig->loadTemplate('OrderedList.html');
- } else {
- $template =
$this->twig->loadTemplate('UnorderedList.html');
- }
-
$items = array();
for ($i = 0; $i < count($elements); $i++) {
- $items[$i]['element'] = $elements[$i];
- if ($i <= count($attrs)) {
- $items[$i]['attr'] = $attrs[$i];
- } else {
- $items[$i]['attr'] = '';
- }
+ $items[$i]['element'] = $elements[$i]['content'];
+ $items[$i]['attrs'] = $elements[$i]['attrs'];
}
- $vars = array('items' => $items);
+ $vars = array('items' => $items,
+ 'attrs' => $attrs);
- return $template->render($vars);
+ if ($type == 'ol') {
+ return $this->renderTemplate('OrderedList.html', $vars);
+ } else {
+ return $this->renderTemplate('UnorderedList.html',
$vars);
+ }
}
function html_chartid($id = 0, $title = '') {
- $template = $this->twig->loadTemplate('ChartId.html');
-
$vars = array('chart_id' => $id,
'title' => $title);
- return $template->render($vars);
+ return $this->renderTemplate('ChartId.html', $vars);
}
// Methods to reimplement (if relevant)
@@ -137,8 +130,6 @@ class Theme extends Layout {
return parent::addStylesheet($css, $media);
}
function getJavascripts() {
- $template = $this->twig->loadTemplate('JavaScripts.html');
-
$scripts = array();
foreach ($this->javascripts as $js) {
$scripts[] = util_make_uri($js);
@@ -147,11 +138,9 @@ class Theme extends Layout {
$vars = array('js' => $scripts);
- return $template->render($vars);
+ return $this->renderTemplate('JavaScripts.html', $vars);
}
function getStylesheets() {
- $template = $this->twig->loadTemplate('StyleSheets.html');
-
$sheets = array();
foreach ($this->stylesheets as $c) {
$sheet = array('css' => util_make_uri($c['css']));
@@ -166,13 +155,11 @@ class Theme extends Layout {
$vars = array('sheets' => $sheets);
- return $template->render($vars);
+ return $this->renderTemplate('StyleSheets.html', $vars);
}
function header($params) {
$this->headerHTMLDeclaration();
- $template = $this->twig->loadTemplate('headerStart.html');
-
$vars = array();
$vars['forge_name'] = forge_get_config('forge_name');
@@ -249,15 +236,13 @@ class Theme extends Layout {
$vars['alt_representations'] = $p2['return'];
}
- print $template->render($vars);
+ print $this->renderTemplate('headerStart.html', $vars);
$this->bodyHeader($params);
}
function headerHTMLDeclaration() {
global $sysDTDs, $sysXMLNSs;
- $template = $this->twig->loadTemplate('HTMLDeclaration.html');
-
$vars = array();
if (!util_ifsetor($this->doctype) ||
!util_ifsetor($sysDTDs[$this->doctype])) {
@@ -267,16 +252,10 @@ class Theme extends Layout {
$vars['lang'] = _('en');
$vars['ns'] = $sysXMLNSs;
- print $template->render($vars);
+ print $this->renderTemplate('HTMLDeclaration.html', $vars);
}
function bodyHeader($params){
- global $use_tooltips;
-
- $template = $this->twig->loadTemplate('bodyHeader.html');
-
$vars = array();
-
- $vars['use_tooltips'] = $use_tooltips;
if (isset($params['h1'])) {
$vars['h1'] = $params['h1'];
@@ -308,9 +287,7 @@ class Theme extends Layout {
'attrs' => array('id' =>
'header-col2'));
$vars['rowattrs'] = array();
- $vars['cell_data'] = $cells;
-
- $vars['session_loggedin'] = session_loggedin();
+ $vars['siteheader_celldata'] = $cells;
if (session_loggedin()) {
$groups = session_get_user()->getGroups();
@@ -344,7 +321,7 @@ class Theme extends Layout {
$outertabsdata = array();
$menu = $this->navigation->getSiteMenu();
- for ($i = 0; $i < count($menu); $i++) {
+ for ($i = 0; $i < count($menu['urls']); $i++) {
$d = array('href' => $menu['urls'][$i],
'id' => md5($menu['urls'][$i]),
'title' => $menu['titles'][$i],
@@ -382,14 +359,14 @@ class Theme extends Layout {
$vars['warning_msg'] = $GLOBALS['warning_msg'];
$vars['feedback'] = $GLOBALS['feedback'];
- print $template->render($vars);
+ $vars['submenu'] = $params['submenu'];
+
+ print $this->renderTemplate('bodyHeader.html', $vars);
}
function footer($params = array()) {
- $template = $this->twig->loadTemplate('footer.html');
-
$vars = array('imgurl' =>
util_make_uri('/images/pow-fusionforge.png'));
- print $template->render($vars);
+ print $this->renderTemplate('footer.html', $vars);
}
function footerEnd() {
// TODO
@@ -400,35 +377,25 @@ class Theme extends Layout {
return parent::getRootIndex();
}
function boxTop($title, $id='') {
- $template = $this->twig->loadTemplate('BoxTop.html');
-
$vars = array('id' => $id,
'title' => $title);
- return $template->render($vars);
+ return $this->renderTemplate('BoxTop.html', $vars);
}
function boxMiddle($title, $id='') {
- $template = $this->twig->loadTemplate('BoxMiddle.html');
-
$vars = array('id' => $id,
'title' => $title);
- return $template->render($vars);
+ return $this->renderTemplate('BoxMiddle.html', $vars);
}
function boxBottom() {
- $template = $this->twig->loadTemplate('BoxBottom.html');
-
- $vars = array();
-
- return $template->render($vars);
+ return $this->renderTemplate('BoxBottom.html');
}
function boxGetAltRowStyle($i, $classonly = false) {
// TODO
return parent::boxGetAltRowStyle($i, $classonly);
}
function listTableTop($titleArray = array(), $linksArray = array(),
$class = '', $id = '', $thClassArray = array(), $thTitleArray = array(),
$thOtherAttrsArray = array()) {
- $template = $this->twig->loadTemplate('ListTableTop.html');
-
$vars = array('id' => $id,
'class' => $class);
@@ -456,14 +423,10 @@ class Theme extends Layout {
$vars['data'] = $data;
- return $template->render($vars);
+ return $this->renderTemplate('ListTableTop.html', $vars);
}
function listTableBottom() {
- $template = $this->twig->loadTemplate('ListTableBottom.html');
-
- $vars = array();
-
- return $template->render($vars);
+ return $this->renderTemplate('ListTableBottom.html');
}
function outerTabs($params) {
// TODO -- not used directly by pages, can be inlined in this
file (unless used in several places)
@@ -478,28 +441,34 @@ class Theme extends Layout {
return parent::searchBox();
}
function beginSubMenu() {
- // TODO
- return parent::beginSubMenu();
+ return $this->renderTemplate('beginSubMenu.html');
}
function endSubMenu() {
- // TODO
- return parent::endSubMenu();
+ return $this->renderTemplate('endSubMenu.html');
}
function printSubMenu($title_arr, $links_arr, $attr_arr) {
- // TODO
- return parent::printSubMenu($title_arr, $links_arr, $attr_arr);
+ $submenuentries = array();
+
+ for ($i=0; $i < count($title_arr); $i++) {
+ $submenuentries[] = array('title' => $title_arr[$i],
+ 'url'
=> util_make_uri($links_arr[$i]),
+
'attrs' => $attr_arr[$i]);
+ }
+
+ $vars = array('submenuentries' => $submenuentries);
+
+ return $this->renderTemplate('printSubMenu.html', $vars);
}
function subMenuSeparator() {
- // TODO
- return parent::subMenuSeparator();
+ return $this->renderTemplate('subMenuSeparator.html');
}
function subMenu($title_arr, $links_arr, $attr_arr = array()) {
- // TODO
- return parent::subMenu($title_arr, $links_arr, $attr_arr);
+ $return = $this->beginSubMenu();
+ $return .= $this->printSubMenu($title_arr, $links_arr,
$attr_arr);
+ $return .= $this->endSubMenu();
+ return $return;
}
function multiTableRow($row_attrs, $cell_data, $istitle = false) {
- $template = $this->twig->loadTemplate('multiTableRow.html');
-
if (!isset($row_attrs['class'])) {
$row_attrs['class'] = '';
}
@@ -522,39 +491,29 @@ class Theme extends Layout {
'cells' => $cells,
'istitle' => $istitle);
- return $template->render($vars);
+ return $this->renderTemplate('multiTableRow.html', $vars);
}
function feedback($msg) {
- $template = $this->twig->loadTemplate('feedback.html');
-
$vars = array('message' => strip_tags($msg, '<br>'));
- return $template->render($vars);
+ return $this->renderTemplate('feedback.html', $vars);
}
function warning_msg($msg) {
- $template = $this->twig->loadTemplate('warningMessage.html');
-
$vars = array('message' => strip_tags($msg, '<br>'));
- return $template->render($vars);
+ return $this->renderTemplate('warningMessage.html', $vars);
}
function error_msg($msg) {
- $template = $this->twig->loadTemplate('errorMessage.html');
-
$vars = array('message' => strip_tags($msg, '<br>'));
- return $template->render($vars);
+ return $this->renderTemplate('errorMessage.html', $vars);
}
function information($msg) {
- $template = $this->twig->loadTemplate('information.html');
-
$vars = array('message' => strip_tags($msg, '<br>'));
- return $template->render($vars);
+ return $this->renderTemplate('information.html', $vars);
}
function confirmBox($msg, $params, $buttons, $image='*none*') {
- $template = $this->twig->loadTemplate('ConfirmBox.html');
-
if ($image == '*none*') {
$image = html_image('stop.png','48','48',array());
}
@@ -565,16 +524,14 @@ class Theme extends Layout {
'msg' => $msg,
'action' =>
getStringFromServer('PHP_SELF'));
- return $template->render($vars);
+ return $this->renderTemplate('ConfirmBox.html', $vars);
}
function jQueryUIconfirmBox($id = 'dialog-confirm', $title = 'Confirm
your action', $message = 'Do you confirm your action?') {
- $template =
$this->twig->loadTemplate('jQueryUIConfirmBox.html');
-
$vars = array('id' => $id,
'title' => $title,
'message' => $message);
- return $template->render($vars);
+ return $this->renderTemplate('jQueryUIConfirmBox.html', $vars);
}
function html_input($name, $id = '', $label = '', $type = 'text',
$value = '', $extra_params = '') {
// TODO
diff --git a/src/www/themes/funky-twig/templates/OrderedList.html
b/src/www/themes/funky-twig/templates/OrderedList.html
index 52ddffc..ca893d4 100644
--- a/src/www/themes/funky-twig/templates/OrderedList.html
+++ b/src/www/themes/funky-twig/templates/OrderedList.html
@@ -1,7 +1,7 @@
-<ol>
+<ol {% for k,v in attrs %}{{ k }}="{{ v }}"{% endfor %}>
{% for i in items %}
- <li {{ i.attr }}>
- {{ i.element }}
+ <li {% for k,v in i.attrs %}{{ k }}="{{ v }}"{% endfor %}>
+ {{ i.element|raw }}
</li>
{% endfor %}
</ol>
diff --git a/src/www/themes/funky-twig/templates/UnorderedList.html
b/src/www/themes/funky-twig/templates/UnorderedList.html
index ee6ebcb..76233fe 100644
--- a/src/www/themes/funky-twig/templates/UnorderedList.html
+++ b/src/www/themes/funky-twig/templates/UnorderedList.html
@@ -1,7 +1,7 @@
-<ul>
+<ul {% for k,v in attrs %}{{ k }}="{{ v }}"{% endfor %}>
{% for i in items %}
- <li {{ i.attr }}>
- {{ i.element }}
+ <li {% for k,v in i.attrs %}{{ k }}="{{ v }}"{% endfor %}>
+ {{ i.element|raw }}
</li>
{% endfor %}
</ul>
diff --git a/src/www/themes/funky-twig/templates/beginSubMenu.html
b/src/www/themes/funky-twig/templates/beginSubMenu.html
new file mode 100644
index 0000000..d29c58d
--- /dev/null
+++ b/src/www/themes/funky-twig/templates/beginSubMenu.html
@@ -0,0 +1 @@
+<p><strong>
diff --git a/src/www/themes/funky-twig/templates/bodyHeader.html
b/src/www/themes/funky-twig/templates/bodyHeader.html
index 3c1aeae..c7b1873 100644
--- a/src/www/themes/funky-twig/templates/bodyHeader.html
+++ b/src/www/themes/funky-twig/templates/bodyHeader.html
@@ -1,6 +1,6 @@
{% include 'ListTableTop.html' with { 'class': 'fullwidth', 'id': 'header' }
only %}
- {% include 'multiTableRow.html' %}
+ {% include 'multiTableRow.html' with { 'rowattrs': {}, 'cells':
siteheader_celldata } only %}
{% if session_loggedin %}
@@ -47,4 +47,5 @@
{% else %}
<h1 class="hide">{{ title }}</h1>
{% endif %}
-
\ No newline at end of file
+
+ {{ submenu|raw }}
\ No newline at end of file
diff --git a/src/www/themes/funky-twig/templates/endSubMenu.html
b/src/www/themes/funky-twig/templates/endSubMenu.html
new file mode 100644
index 0000000..976811c
--- /dev/null
+++ b/src/www/themes/funky-twig/templates/endSubMenu.html
@@ -0,0 +1 @@
+</strong></p>
diff --git a/src/www/themes/funky-twig/templates/printSubMenu.html
b/src/www/themes/funky-twig/templates/printSubMenu.html
new file mode 100644
index 0000000..787bada
--- /dev/null
+++ b/src/www/themes/funky-twig/templates/printSubMenu.html
@@ -0,0 +1,4 @@
+ {% for entry in submenuentries %}
+ {% include 'Link.html' with { 'text': entry.title, 'href': entry.url,
'extra_params': entry.attrs, 'use_tooltips': use_tooltips } only %}
+ {% if not loop.last %}{% include 'subMenuSeparator.html' only %}{% endif
%}
+ {% endfor %}
\ No newline at end of file
diff --git a/src/www/themes/funky-twig/templates/subMenuSeparator.html
b/src/www/themes/funky-twig/templates/subMenuSeparator.html
new file mode 100644
index 0000000..62d2e39
--- /dev/null
+++ b/src/www/themes/funky-twig/templates/subMenuSeparator.html
@@ -0,0 +1 @@
+ |
hooks/post-receive
--
FusionForge
_______________________________________________
Fusionforge-commits mailing list
[email protected]
http://lists.fusionforge.org/cgi-bin/mailman/listinfo/fusionforge-commits