[Fusionforge-commits] r14336 - in trunk/src: common/docman common/docman/views lib/vendor lib/vendor/jquery-simpletreemenu lib/vendor/jquery-simpletreemenu/css lib/vendor/jquery-simpletreemenu/css/simpleTreeMenu lib/vendor/jquery-simpletreemenu/js www/themes/funky

Franck VILLAUME nerville at fusionforge.org
Sun Sep 11 20:34:31 CEST 2011


Author: nerville
Date: 2011-09-11 20:34:31 +0200 (Sun, 11 Sep 2011)
New Revision: 14336

Added:
   trunk/src/lib/vendor/jquery-simpletreemenu/
   trunk/src/lib/vendor/jquery-simpletreemenu/css/
   trunk/src/lib/vendor/jquery-simpletreemenu/css/jquery-simpleTreeMenu-1.1.0.css
   trunk/src/lib/vendor/jquery-simpletreemenu/css/simpleTreeMenu/
   trunk/src/lib/vendor/jquery-simpletreemenu/css/simpleTreeMenu/menu-arrow-down.png
   trunk/src/lib/vendor/jquery-simpletreemenu/css/simpleTreeMenu/menu-arrow-right.png
   trunk/src/lib/vendor/jquery-simpletreemenu/css/simpleTreeMenu/menu-dot.png
   trunk/src/lib/vendor/jquery-simpletreemenu/js/
   trunk/src/lib/vendor/jquery-simpletreemenu/js/jquery-simpleTreeMenu-1.1.0.js
Modified:
   trunk/src/common/docman/DocumentManager.class.php
   trunk/src/common/docman/views/tree.php
   trunk/src/www/themes/funky/Theme.class.php
Log:
first implementation of jquery simpletreemenu in docman. offers js and none js browser support as standardi. need to implement in others themes.

Modified: trunk/src/common/docman/DocumentManager.class.php
===================================================================
--- trunk/src/common/docman/DocumentManager.class.php	2011-09-11 18:19:10 UTC (rev 14335)
+++ trunk/src/common/docman/DocumentManager.class.php	2011-09-11 18:34:31 UTC (rev 14336)
@@ -145,7 +145,6 @@
 		}
 		$subGroupIdArr = $dg->getSubgroup($docGroupId, $stateId);
 		if (sizeof($subGroupIdArr)) {
-			echo '<ul>';
 			foreach ($subGroupIdArr as $subGroupIdValue) {
 				$localDg = new DocumentGroup($this->Group, $subGroupIdValue);
 				$liclass = 'docman_li_treecontent';
@@ -169,12 +168,16 @@
 					$nbDocsLabel = '<span class="tabtitle" title="'._('Number of documents in this folder').'" >('.$nbDocs.')</span>';
 				}
 				if (isset($nbDocsPending) && isset($nbDocsHidden) && isset($nbDocsPrivate)) {
-					$nbDocsLabel = '<span class="tabtitle" title="'._('Number of documents in this folder per status. active/pending/hidden/private').'" >('.$nbDocs.'/'.$nbDocsPending.'/'.$nbDocsHidden.'/'.$nbDocsPrivate.')';
+					$nbDocsLabel = '<span class="tabtitle" title="'._('Number of documents in this folder per status. active/pending/hidden/private').'" >('.$nbDocs.'/'.$nbDocsPending.'/'.$nbDocsHidden.'/'.$nbDocsPrivate.')</span>';
 				}
-				echo '<li class="'.$liclass.'">'.util_make_link($link, $localDg->getName()).$nbDocsLabel.'</li>';
-				$this->getTree($selecteddir, $linkmenu, $subGroupIdValue);
+				echo '<li id="leaf-'.$subGroupIdValue.'" class="'.$liclass.'">'.util_make_link($link, $localDg->getName()).$nbDocsLabel;
+				if ($dg->getSubgroup($subGroupIdValue, $stateId)) {
+					echo '<ul>';
+					$this->getTree($selecteddir, $linkmenu, $subGroupIdValue);
+					echo '</ul>';
+				}
+				echo '</li>';
 			}
-			echo '</ul>';
 		}
 	}
 }

Modified: trunk/src/common/docman/views/tree.php
===================================================================
--- trunk/src/common/docman/views/tree.php	2011-09-11 18:19:10 UTC (rev 14335)
+++ trunk/src/common/docman/views/tree.php	2011-09-11 18:34:31 UTC (rev 14336)
@@ -38,7 +38,16 @@
 
 echo '<div id="documenttree" style="height:100%">';
 $dm = new DocumentManager($g);
+echo '<ul id="'.$g->getUnixname().'-tree">';
 $dm->getTree($dirid, $linkmenu);
+echo '</ul>';
+echo '
+<script type="text/javascript">
+	$(document).ready(function() {
+		jQuery(\'#'.$g->getUnixname().'-tree\').simpleTreeMenu();
+	});
+</script>
+';
 if ($g->usesPlugin('projects-hierarchy')) {
 	$projectsHierarchy = plugin_get_object('projects-hierarchy');
 	$projectIDsArray = $projectsHierarchy->getFamily($group_id, 'child', true, 'validated');
@@ -51,9 +60,36 @@
 			echo '<hr>';
 			echo '<h5>'._('Child project: ').util_make_link('/docman/?group_id='.$groupObject->getID(),$groupObject->getPublicName(), array('class'=>'tabtitle', 'title'=>_('Browse document manager in this project'))).'</h5>';
 			$dm = new DocumentManager($groupObject);
+			echo '<ul id="'.$groupObject->getUnixname().'-tree">';
 			$dm->getTree($dirid, $linkmenu);
+			echo '</ul>';
+			echo '
+			<script type="text/javascript">
+				$(document).ready(function() {
+					jQuery(\'#'.$groupObject->getUnixname().'-tree\').simpleTreeMenu();
+				});
+			</script>
+			';
 		}
 	}
 }
+if (isset($childgroup_id) && $childgroup_id) {
+	$groupObject = group_get_object($childgroup_id);
+	echo '
+		<script type="text/javascript">
+			$(document).ready(function() {
+				jQuery(\'#'.$groupObject->getUnixname().'-tree\').simpleTreeMenu(\'expandToNode\', jQuery(\'#leaf-'.$dirid.'\'));
+			});
+		</script>
+	';
+} else {
+	echo '
+		<script type="text/javascript">
+			$(document).ready(function() {
+				jQuery(\'#'.$g->getUnixname().'-tree\').simpleTreeMenu(\'expandToNode\', jQuery(\'#leaf-'.$dirid.'\'));
+			});
+		</script>
+	';
+}
 echo '</div>';
 ?>

Added: trunk/src/lib/vendor/jquery-simpletreemenu/css/jquery-simpleTreeMenu-1.1.0.css
===================================================================
--- trunk/src/lib/vendor/jquery-simpletreemenu/css/jquery-simpleTreeMenu-1.1.0.css	                        (rev 0)
+++ trunk/src/lib/vendor/jquery-simpletreemenu/css/jquery-simpleTreeMenu-1.1.0.css	2011-09-11 18:34:31 UTC (rev 14336)
@@ -0,0 +1,47 @@
+/* simpleTreeMenu */
+
+ul.simpleTreeMenu {
+	line-height: 1.75em;
+	margin-top: 0px;
+	margin-bottom: 0px;
+}
+
+ul.simpleTreeMenu, ul.simpleTreeMenu ul {
+	margin-left: 0px;
+	padding-left: 15px;
+}
+
+ul.simpleTreeMenu li.Node {
+	list-style-image: url("simpleTreeMenu/menu-arrow-right.png");
+	margin-left: 5px;
+	padding: 0px;	
+}
+
+ul.simpleTreeMenu li.Node span {
+	cursor: pointer;
+	display: block;
+}
+
+ul.simpleTreeMenu li.Node span:hover {
+	background-color: #e0e0e0;
+}
+
+ul.simpleTreeMenu li.expanded {
+	list-style-image: url("simpleTreeMenu/menu-arrow-down.png");
+}
+
+ul.simpleTreeMenu li.Leaf {
+	list-style-image: url("simpleTreeMenu/menu-dot.png");
+	margin-left: 5px;
+	padding: 0px;	
+}
+
+ul.simpleTreeMenu a, ul.simpleTreeMenu a:visited {
+	display: block;
+	text-decoration: none;
+	color: #3333AA;
+}
+
+ul.simpleTreeMenu a:hover {
+	background-color: #e0e0e0;
+}

Added: trunk/src/lib/vendor/jquery-simpletreemenu/css/simpleTreeMenu/menu-arrow-down.png
===================================================================
(Binary files differ)


Property changes on: trunk/src/lib/vendor/jquery-simpletreemenu/css/simpleTreeMenu/menu-arrow-down.png
___________________________________________________________________
Added: svn:mime-type
   + image/png

Added: trunk/src/lib/vendor/jquery-simpletreemenu/css/simpleTreeMenu/menu-arrow-right.png
===================================================================
(Binary files differ)


Property changes on: trunk/src/lib/vendor/jquery-simpletreemenu/css/simpleTreeMenu/menu-arrow-right.png
___________________________________________________________________
Added: svn:mime-type
   + image/png

Added: trunk/src/lib/vendor/jquery-simpletreemenu/css/simpleTreeMenu/menu-dot.png
===================================================================
(Binary files differ)


Property changes on: trunk/src/lib/vendor/jquery-simpletreemenu/css/simpleTreeMenu/menu-dot.png
___________________________________________________________________
Added: svn:mime-type
   + image/png

Added: trunk/src/lib/vendor/jquery-simpletreemenu/js/jquery-simpleTreeMenu-1.1.0.js
===================================================================
--- trunk/src/lib/vendor/jquery-simpletreemenu/js/jquery-simpleTreeMenu-1.1.0.js	                        (rev 0)
+++ trunk/src/lib/vendor/jquery-simpletreemenu/js/jquery-simpleTreeMenu-1.1.0.js	2011-09-11 18:34:31 UTC (rev 14336)
@@ -0,0 +1,97 @@
+/* SimpleTreeMenu */
+
+(function($) {
+
+	var methods = {
+		
+		init: function() {
+	    	return this.each(function() {
+	    		var $this = $(this);
+				if ($this.hasClass("simpleTreeMenu") === false) {
+					$this.hide();
+					$(this).addClass("simpleTreeMenu");
+					$this.children("li").each(function() {
+						methods.buildNode($(this));
+					});	
+					$(this).show();	
+				}
+	    	});		
+		},
+		
+		buildNode: function($li) {
+			if ($li.children("ul").length > 0) {
+				$li.children("ul").hide();
+				$li.addClass("Node").click(function(event) {
+					var $t = $(this);
+					if ($t.hasClass("expanded")) {
+						$t.removeClass("expanded");
+						$t.children("ul").hide();
+					} else {
+						$t.addClass("expanded");
+						$t.children("ul").show();
+					}
+					event.stopPropagation();
+				});    
+				$li.children("ul").children("li").each(function() {
+					methods.buildNode($(this));
+				});
+			} else {
+				$li.addClass("Leaf").click(function(event) {
+					event.stopPropagation();
+				});
+				return;
+			}		
+		},
+		
+		expandToNode: function($li) {
+			if ($li.parent().hasClass("simpleTreeMenu")) {
+				if (!$li.hasClass("expanded")) {
+					$li.addClass("expanded");
+					$li.children("ul").show();
+				}
+			}
+			$li.parents("li", "ul.simpleTreeMenu").each(function() {
+				var $t = jQuery(this);
+				if (!$t.hasClass("expanded")) {
+					$t.addClass("expanded");
+					$t.children("ul").show();
+				}
+			});
+		},
+		
+		expandAll: function() {
+			jQuery(this).find("li.Node").each(function() {
+				$t = jQuery(this);
+				if (!$t.hasClass("expanded")) {
+					$t.addClass("expanded");
+					$t.children("ul").show();
+				}
+			});	
+		},
+		
+		closeAll: function() {
+			jQuery("ul", jQuery(this)).hide();
+			var $li = jQuery("li.Node");
+			if ($li.hasClass("expanded")) {
+				$li.removeClass("expanded");
+			}
+		}		
+		
+	};
+	
+	$.fn.simpleTreeMenu = function(method) {
+	    if (methods[method]) {
+			return methods[method].apply(this, Array.prototype.slice.call(arguments, 1));
+	    } else if (typeof method === 'object' || !method) {
+			return methods.init.apply(this, arguments);
+	    } else {
+			$.error('Method ' +  method + ' does not exist on jQuery.simpleTreeMenu');
+	    }    	
+	};
+	
+})(jQuery);
+
+
+			
+			
+	
\ No newline at end of file

Modified: trunk/src/www/themes/funky/Theme.class.php
===================================================================
--- trunk/src/www/themes/funky/Theme.class.php	2011-09-11 18:19:10 UTC (rev 14335)
+++ trunk/src/www/themes/funky/Theme.class.php	2011-09-11 18:34:31 UTC (rev 14336)
@@ -434,8 +434,10 @@
 		echo '<script type="text/javascript" src="/scripts/jquery/jquery-1.4.2.min.js"></script>';
 		echo '<script type="text/javascript" src="/scripts/jquery-tipsy/src/javascripts/jquery.tipsy.js"></script>';
 		echo '<script type="text/javascript" src="/scripts/jquery-storage/jquery.Storage.js"></script>';
+		echo '<script type="text/javascript" src="/scripts/jquery-simpletreemenu/js/jquery-simpleTreeMenu-1.1.0.js"></script>';
 		echo '<script type="text/javascript" src="/js/tooltips.js"></script>';
 		echo '<link rel="stylesheet" href="/scripts/jquery-tipsy/src/stylesheets/tipsy.css" type="text/css">';
+		echo '<link rel="stylesheet" href="/scripts/jquery-simpletreemenu/css/jquery-simpleTreeMenu-1.1.0.css" type="text/css">';
 		?>
 		<script language="JavaScript" type="text/javascript">/* <![CDATA[ */
 		jQuery.noConflict();




More information about the Fusionforge-commits mailing list