[Fusionforge-commits] FusionForge branch feature/ twig-template-engine updated. 208097d Implement quickNav with Twig

Roland Mas lolando at libremir.placard.fr.eu.org
Thu Jun 11 16:22:29 CEST 2015


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  208097d6f8ef31d29444d86cc44203d1b8d9420a (commit)
       via  1a5aaf7c1d15df89c8d07cf2f6ebec8d1b78dfc9 (commit)
      from  90750c7e132eff7e42d0b7a878d0a434c0f65d25 (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 208097d6f8ef31d29444d86cc44203d1b8d9420a
Author: Roland Mas <lolando at debian.org>
Date:   Thu Jun 11 16:22:02 2015 +0200

    Implement quickNav with Twig

diff --git a/src/www/themes/funky-twig/Theme.class.php b/src/www/themes/funky-twig/Theme.class.php
index b6ca824..c21525e 100644
--- a/src/www/themes/funky-twig/Theme.class.php
+++ b/src/www/themes/funky-twig/Theme.class.php
@@ -307,6 +307,33 @@ class Theme extends Layout {
 		$vars['rowattrs'] = array();
 		$vars['cell_data'] = $cells;
 
+		$vars['session_loggedin'] = session_loggedin();
+
+		$groups = session_get_user()->getGroups();
+		sortProjectList($groups);
+		
+		$naventries = array();
+
+		foreach ($groups as $g) {
+			$menu = $this->navigation->getProjectMenu($g->getID());
+			$naventries[] = array('url' => $menu['starturl'],
+								'title' => $menu['name'],
+								'indent' => 0);
+			
+			for ($j = 0; $j < count($menu['urls']); $j++) {
+				$naventries[] = array('url' => $menu['urls'][$j],
+									'title' => $menu['titles'][$j],
+									'indent' => 1);
+				if (@$menu['adminurls'][$j]) {
+					$naventries[] = array('url' => $menu['adminurls'][$j],
+										'title' => _('Admin'),
+										'indent' => 2);
+				}
+			}
+		}
+
+		$vars['naventries'] = $naventries;
+
 		$vars['error_msg'] = $GLOBALS['error_msg'];
 		$vars['warning_msg'] = $GLOBALS['warning_msg'];
 		$vars['feedback'] = $GLOBALS['feedback'];
@@ -395,10 +422,6 @@ class Theme extends Layout {
 		// TODO -- not used directly by pages, can be inlined in this file (unless used in several places)
 		return parent::outerTabs($params);
 	}
-	function quickNav() {
-		// TODO -- not used directly by pages, can be inlined in this file (unless used in several places)
-		return parent::quickNav();
-	}
 	function projectTabs($toptab, $group_id) {
 		// TODO -- not used directly by pages, can be inlined in this file (unless used in several places)
 		return parent::projectTabs($toptab, $group_id);
diff --git a/src/www/themes/funky-twig/templates/bodyHeader.html b/src/www/themes/funky-twig/templates/bodyHeader.html
index b1e90b7..28f55f8 100644
--- a/src/www/themes/funky-twig/templates/bodyHeader.html
+++ b/src/www/themes/funky-twig/templates/bodyHeader.html
@@ -1,6 +1,29 @@
 {% include 'ListTableTop.html' with { 'class': 'fullwidth', 'id': 'header' } only %}
 
-{% include 'multiTableRow.html' %}
+      {% include 'multiTableRow.html' %}
+
+      {% if session_loggedin %}
+
+{% if naventries|length > 0 %}
+{% set indentarray = { 0: '', 1: '   ↳ ', 2: '      ↳ ' } %}
+      <tr>
+	<td id="header-line2" colspan="2">
+<form id="quicknavform" name="quicknavform" action="">
+  <div>
+    <select name="quicknav" id="quicknav" onchange="location.href=document.quicknavform.quicknav.value">
+      <option value="">Quick Jump To...</option>
+      {% for e in naventries %}
+      <option value="{{ e.url }}">{{ indentarray[e.indent]|raw }}{{ e.title }}</option>
+      {% endfor %}
+    </select>
+  </div>
+	  </form>
+	</td>
+      </tr>
+
+{% endif %}
+
+{% endif %}      
 
 {% include 'ListTableBottom.html' only %}
 

commit 1a5aaf7c1d15df89c8d07cf2f6ebec8d1b78dfc9
Author: Roland Mas <lolando at debian.org>
Date:   Thu Jun 11 15:28:41 2015 +0200

    Document that some methods can be removed and inlined

diff --git a/src/www/themes/funky-twig/Theme.class.php b/src/www/themes/funky-twig/Theme.class.php
index e3720ba..b6ca824 100644
--- a/src/www/themes/funky-twig/Theme.class.php
+++ b/src/www/themes/funky-twig/Theme.class.php
@@ -169,10 +169,6 @@ class Theme extends Layout {
 		return $template->render($vars);
 	}
 	function header($params) {
-		$this->headerStart($params);
-		$this->bodyHeader($params);
-	}
-	function headerStart($params) {
 		$this->headerHTMLDeclaration();
 
 		$template = $this->twig->loadTemplate('headerStart.html');
@@ -254,6 +250,8 @@ class Theme extends Layout {
 		}
 		
 		print $template->render($vars);
+
+		$this->bodyHeader($params);
 	}
 	function headerHTMLDeclaration() {
 		global $sysDTDs, $sysXMLNSs;
@@ -394,15 +392,15 @@ class Theme extends Layout {
 		return $template->render($vars);
 	}
 	function outerTabs($params) {
-		// TODO
+		// TODO -- not used directly by pages, can be inlined in this file (unless used in several places)
 		return parent::outerTabs($params);
 	}
 	function quickNav() {
-		// TODO
+		// TODO -- not used directly by pages, can be inlined in this file (unless used in several places)
 		return parent::quickNav();
 	}
 	function projectTabs($toptab, $group_id) {
-		// TODO
+		// TODO -- not used directly by pages, can be inlined in this file (unless used in several places)
 		return parent::projectTabs($toptab, $group_id);
 	}
 	function searchBox() {
@@ -506,11 +504,11 @@ class Theme extends Layout {
 		return parent::html_textarea($name, $id, $label, $value, $extra_params);
 	}
 	function html_table_top($cols, $summary = '', $class = '', $extra_params = '') {
-		// TODO
+		// TODO -- not used directly by pages, can be inlined in this file (unless used in several places)
 		return parent::html_table_top($cols, $summary, $class, $extra_params);
 	}
 	function getMonitorPic($title = '', $alt = '') {
-		// TODO
+		// TODO -- not used directly by pages, can be inlined in this file (unless used in several places)
 		return parent::getMonitorPic($title, $alt);
 	}
 	function getStartMonitoringPic($title = '', $alt = '') {
@@ -590,11 +588,11 @@ class Theme extends Layout {
 		return parent::getNewPic($title, $alt, $otherAttr);
 	}
 	function getFolderPic($title = '', $alt = '', $otherAttr = array()) {
-		// TODO
+		// TODO -- not used directly by pages, can be inlined in this file (unless used in several places)
 		return parent::getFolderPic($title, $alt, $otherAttr);
 	}
 	function getPicto($url, $title, $alt, $width = '20', $height = '20', $otherAttr = array()) {
-		// TODO
+		// TODO -- not used directly by pages, can be inlined in this file (unless used in several places)
 		return parent::getPicto($url, $title, $alt, $width, $height, $otherAttr);
 	}
 	function toSlug($string, $space = "-") {
@@ -606,11 +604,11 @@ class Theme extends Layout {
 		return parent::widget($widget, $layout_id, $readonly, $column_id, $is_minimized, $display_preferences, $owner_id, $owner_type);
 	}
 	function _getTogglePlusForWidgets() {
-		// TODO
+		// TODO -- not used directly by pages, can be inlined in this file (unless used in several places)
 		return parent::_getTogglePlusForWidgets();
 	}
 	function _getToggleMinusForWidgets() {
-		// TODO
+		// TODO -- not used directly by pages, can be inlined in this file (unless used in several places)
 		return parent::_getToggleMinusForWidgets();
 	}
 	function printSoftwareMapLinks() {

-----------------------------------------------------------------------

Summary of changes:
 src/www/themes/funky-twig/Theme.class.php          | 53 +++++++++++++++-------
 .../themes/funky-twig/templates/bodyHeader.html    | 25 +++++++++-
 2 files changed, 61 insertions(+), 17 deletions(-)

diff --git a/src/www/themes/funky-twig/Theme.class.php b/src/www/themes/funky-twig/Theme.class.php
index e3720ba..c21525e 100644
--- a/src/www/themes/funky-twig/Theme.class.php
+++ b/src/www/themes/funky-twig/Theme.class.php
@@ -169,10 +169,6 @@ class Theme extends Layout {
 		return $template->render($vars);
 	}
 	function header($params) {
-		$this->headerStart($params);
-		$this->bodyHeader($params);
-	}
-	function headerStart($params) {
 		$this->headerHTMLDeclaration();
 
 		$template = $this->twig->loadTemplate('headerStart.html');
@@ -254,6 +250,8 @@ class Theme extends Layout {
 		}
 		
 		print $template->render($vars);
+
+		$this->bodyHeader($params);
 	}
 	function headerHTMLDeclaration() {
 		global $sysDTDs, $sysXMLNSs;
@@ -309,6 +307,33 @@ class Theme extends Layout {
 		$vars['rowattrs'] = array();
 		$vars['cell_data'] = $cells;
 
+		$vars['session_loggedin'] = session_loggedin();
+
+		$groups = session_get_user()->getGroups();
+		sortProjectList($groups);
+		
+		$naventries = array();
+
+		foreach ($groups as $g) {
+			$menu = $this->navigation->getProjectMenu($g->getID());
+			$naventries[] = array('url' => $menu['starturl'],
+								'title' => $menu['name'],
+								'indent' => 0);
+			
+			for ($j = 0; $j < count($menu['urls']); $j++) {
+				$naventries[] = array('url' => $menu['urls'][$j],
+									'title' => $menu['titles'][$j],
+									'indent' => 1);
+				if (@$menu['adminurls'][$j]) {
+					$naventries[] = array('url' => $menu['adminurls'][$j],
+										'title' => _('Admin'),
+										'indent' => 2);
+				}
+			}
+		}
+
+		$vars['naventries'] = $naventries;
+
 		$vars['error_msg'] = $GLOBALS['error_msg'];
 		$vars['warning_msg'] = $GLOBALS['warning_msg'];
 		$vars['feedback'] = $GLOBALS['feedback'];
@@ -394,15 +419,11 @@ class Theme extends Layout {
 		return $template->render($vars);
 	}
 	function outerTabs($params) {
-		// TODO
+		// TODO -- not used directly by pages, can be inlined in this file (unless used in several places)
 		return parent::outerTabs($params);
 	}
-	function quickNav() {
-		// TODO
-		return parent::quickNav();
-	}
 	function projectTabs($toptab, $group_id) {
-		// TODO
+		// TODO -- not used directly by pages, can be inlined in this file (unless used in several places)
 		return parent::projectTabs($toptab, $group_id);
 	}
 	function searchBox() {
@@ -506,11 +527,11 @@ class Theme extends Layout {
 		return parent::html_textarea($name, $id, $label, $value, $extra_params);
 	}
 	function html_table_top($cols, $summary = '', $class = '', $extra_params = '') {
-		// TODO
+		// TODO -- not used directly by pages, can be inlined in this file (unless used in several places)
 		return parent::html_table_top($cols, $summary, $class, $extra_params);
 	}
 	function getMonitorPic($title = '', $alt = '') {
-		// TODO
+		// TODO -- not used directly by pages, can be inlined in this file (unless used in several places)
 		return parent::getMonitorPic($title, $alt);
 	}
 	function getStartMonitoringPic($title = '', $alt = '') {
@@ -590,11 +611,11 @@ class Theme extends Layout {
 		return parent::getNewPic($title, $alt, $otherAttr);
 	}
 	function getFolderPic($title = '', $alt = '', $otherAttr = array()) {
-		// TODO
+		// TODO -- not used directly by pages, can be inlined in this file (unless used in several places)
 		return parent::getFolderPic($title, $alt, $otherAttr);
 	}
 	function getPicto($url, $title, $alt, $width = '20', $height = '20', $otherAttr = array()) {
-		// TODO
+		// TODO -- not used directly by pages, can be inlined in this file (unless used in several places)
 		return parent::getPicto($url, $title, $alt, $width, $height, $otherAttr);
 	}
 	function toSlug($string, $space = "-") {
@@ -606,11 +627,11 @@ class Theme extends Layout {
 		return parent::widget($widget, $layout_id, $readonly, $column_id, $is_minimized, $display_preferences, $owner_id, $owner_type);
 	}
 	function _getTogglePlusForWidgets() {
-		// TODO
+		// TODO -- not used directly by pages, can be inlined in this file (unless used in several places)
 		return parent::_getTogglePlusForWidgets();
 	}
 	function _getToggleMinusForWidgets() {
-		// TODO
+		// TODO -- not used directly by pages, can be inlined in this file (unless used in several places)
 		return parent::_getToggleMinusForWidgets();
 	}
 	function printSoftwareMapLinks() {
diff --git a/src/www/themes/funky-twig/templates/bodyHeader.html b/src/www/themes/funky-twig/templates/bodyHeader.html
index b1e90b7..28f55f8 100644
--- a/src/www/themes/funky-twig/templates/bodyHeader.html
+++ b/src/www/themes/funky-twig/templates/bodyHeader.html
@@ -1,6 +1,29 @@
 {% include 'ListTableTop.html' with { 'class': 'fullwidth', 'id': 'header' } only %}
 
-{% include 'multiTableRow.html' %}
+      {% include 'multiTableRow.html' %}
+
+      {% if session_loggedin %}
+
+{% if naventries|length > 0 %}
+{% set indentarray = { 0: '', 1: '   ↳ ', 2: '      ↳ ' } %}
+      <tr>
+	<td id="header-line2" colspan="2">
+<form id="quicknavform" name="quicknavform" action="">
+  <div>
+    <select name="quicknav" id="quicknav" onchange="location.href=document.quicknavform.quicknav.value">
+      <option value="">Quick Jump To...</option>
+      {% for e in naventries %}
+      <option value="{{ e.url }}">{{ indentarray[e.indent]|raw }}{{ e.title }}</option>
+      {% endfor %}
+    </select>
+  </div>
+	  </form>
+	</td>
+      </tr>
+
+{% endif %}
+
+{% endif %}      
 
 {% include 'ListTableBottom.html' only %}
 


hooks/post-receive
-- 
FusionForge



More information about the Fusionforge-commits mailing list