# HG changeset patch # User cavaliet # Date 1323266795 -3600 # Node ID 22377c9e2eae8c71229d4a4035ac60be03033aa1 # Parent e804ae133f27b5888c7645cf354a21bf5a2260a0 First step of column management in document tag list. Little debug on js for move up down. diff -r e804ae133f27 -r 22377c9e2eae Controller/WikiTagController.php --- a/Controller/WikiTagController.php Fri Dec 02 11:31:51 2011 +0100 +++ b/Controller/WikiTagController.php Wed Dec 07 15:06:35 2011 +0100 @@ -49,7 +49,7 @@ * @param unknown_type $tags_list * @return \Symfony\Bundle\FrameworkBundle\Controller\Response */ - public function addJavascriptAction($tags_list=false) + public function addJavascriptAction($tags_list=false, $profile_name=null) { $cats = $this->getDoctrine()->getRepository('WikiTagBundle:Category')->findOrderedCategories(); // $cats is {"Label":"Créateur"},{"Label":"Datation"},... @@ -61,7 +61,13 @@ } // ... so we create is json like {"":""},{"Créateur":"Créateur"},{"Datation":"Datation"},... $categories = json_encode($ar); - return $this->render('WikiTagBundle:WikiTag:javascript.html.twig', array('categories' => $categories, 'tags_list' => $tags_list)); + // Management of profiles for the list of displayed columns and reorder tag button + $profile_array = $this->container->getParameter("wiki_tag.document_list_profile"); + $columns_array = null; + if($profile_array!=null && $profile_name!=null && $profile_name!=""){ + $columns_array = $profile_array[$profile_name]; + } + return $this->render('WikiTagBundle:WikiTag:javascript.html.twig', array('categories' => $categories, 'tags_list' => $tags_list, 'columns' => $columns_array)); } /** @@ -100,7 +106,7 @@ } $ordered_tags = $this->getDoctrine()->getRepository('WikiTagBundle:DocumentTag')->findOrderedTagsForDoc($id_doc); - return $this->render('WikiTagBundle:WikiTag:documentTags.html.twig', array('ordered_tags' => $ordered_tags, 'doc_id' => $id_doc, 'profile_name' => $profile_name, 'columns' => $columns_array)); + return $this->render('WikiTagBundle:WikiTag:documentTags.html.twig', array('ordered_tags' => $ordered_tags, 'doc_id' => $id_doc, 'columns' => $columns_array)); } /** @@ -412,17 +418,11 @@ * Generic render partial template * @param unknown_type $id_doc */ - public function renderDocTags($id_doc, $profile_name) + public function renderDocTags($id_doc) { - // Management of profiles for the list of displayed columns and reorder tag button - $profile_array = $this->container->getParameter("wiki_tag.document_list_profile"); - $columns_array = null; - if($profile_array!=null && $profile_name!=null && $profile_name!=""){ - $columns_array = $profile_array[$profile_name]; - } // Get tags and render the table $ordered_tags = $this->getDoctrine()->getRepository('WikiTagBundle:DocumentTag')->findOrderedTagsForDoc($id_doc); - return $this->render('WikiTagBundle:WikiTag:tagTable.html.twig', array('ordered_tags' => $ordered_tags, 'doc_id' => $id_doc, 'columns' => $columns_array)); + return $this->render('WikiTagBundle:WikiTag:tagTable.html.twig', array('ordered_tags' => $ordered_tags, 'doc_id' => $id_doc)); } diff -r e804ae133f27 -r 22377c9e2eae Resources/public/css/clickmenu.css --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/Resources/public/css/clickmenu.css Wed Dec 07 15:06:35 2011 +0100 @@ -0,0 +1,115 @@ +div.cmDiv +{ + border: 1px solid black; + background-color: #eee; +} +.clickMenu +{ + margin: 0; + padding: 0; + cursor: default; +} +.clickMenu, .clickMenu ul +{ + list-style: none; +} +.clickMenu ul +{ + margin: 0; + padding: 2px; + border: 1px solid black; + background-color: #eee; + min-width: 100px; /* ie doesnt know this :/ */ + //float: left;/*ie again*/ + //width: 100%;/*and again*/ +} +.clickMenu div.outerbox +{ + display: none; + min-width: 106px; /* firefox produces animation-flickering when the box is bigger than this :/ */ +} +.clickMenu div.inner +{ + //top: 20px; /* for ie */ + left: 0; + margin: 0; +} +.clickMenu div.inner div.outerbox +{ + margin: 0; + left: 98px; + //left: 90px; /* for ie */ + top: -3px; +} +.clickMenu li +{ + position: relative; + padding: 0 20px 0 2px; + /*white-space: nowrap; does not really work in ie */ +} +.clickMenu li.main +{ + float: left; + padding: 0 10px; + background-color: #eee; + //height: 20px; /* for ie */ +} +.clickMenu li.main li +{ + z-index: 2; + min-width: 78px; +} +.clickMenu li.hover +{ + z-index: 1 !important; /* the hover z-index has to be below the normal one the hovering items may be drawn over a submenu */ + background-color: #aaa; +} +.clickMenu img.liArrow +{ + position: absolute; + right: 5px; + top: 0.41em; +} +.clickMenu a +{ + text-decoration: none; + color: black; + cursor: default; +} +/* thats for the shadowbox */ +html>body div.outerbox +{ + padding: 0 5px 5px 0; +} +html>body div.shadowbox1 +{ + position: absolute; + right: 0; + bottom: 5px; + width: 5px; + height: 100%; + background: url(../images/myshadow.png) no-repeat right top; +} +html>body div.shadowbox2 +{ + position: absolute; + bottom: 0; + right: 5px; + height: 5px; + width: 100%; + background: url(../images/myshadow.png) left bottom; +} +html>body div.shadowbox3 +{ + position: absolute; + bottom: 0; + right: 0; + height: 5px; + width: 5px; + background: url(../images/myshadow.png) no-repeat right bottom; +} +html>body .innerbox +{ + margin: 0; + display: inherit; +} \ No newline at end of file diff -r e804ae133f27 -r 22377c9e2eae Resources/public/css/wikiTag.css --- a/Resources/public/css/wikiTag.css Fri Dec 02 11:31:51 2011 +0100 +++ b/Resources/public/css/wikiTag.css Wed Dec 07 15:06:35 2011 +0100 @@ -35,6 +35,9 @@ color: yellow; background-color: black; } +.wikitag_hidden { + display: none; +} /* Styles for images in tables */ .wikitag_a_icon { @@ -55,6 +58,9 @@ .wikitag_wp_dbplink { background-image: url('../images/arrow_green_right.png'); } +.wikitag_wp_redirlink { + background-image: url('../images/arrow_redir.png'); +} .wikitag_td_icon { width: 16px; height: 16px; @@ -66,6 +72,9 @@ cursor: n-resize; background-image: url('../images/arrow_up_down.png'); } +.wikitag_updown_td span { + display: none; +} .wikitag_remove_wp_link { cursor: pointer; background-image: url('../images/red_cross.png'); @@ -75,6 +84,56 @@ background-image: url('../images/tag_remove.png'); } +/* Styles for the list of columns in document tag list*/ +#wikitag_ul_target +{ + list-style: none; + background-color: #eee; +} +#wikitag_ul_target li +{ + background-repeat: no-repeat; + padding-left: 20px; +} +#wikitag_thSelectColumn div.cmDiv +{ + display: inline; + background: none; + border: 0; +} +#wikitag_thSelectColumn li.main +{ + padding: 0; + background: none; + width: 100%; + text-align: right; +} +#wikitag_thSelectColumn li.main li +{ + text-align: left; + padding-right: 2px; +} +#wikitag_thSelectColumn +{ + padding-right: 2px; + width: 10px; +} +#wikitag_ulSelectColumn +{ + vertical-align: middle; +} +li.wikitag_advon +{ + background: url(../images/tick.png) 0 50%; +} +li.wikitag_advoff +{ + background: url(../images/cross.png) 0 50%; +} +.clickMenu div.inner { + left: -140px !important; +} + /* styles for the 4 types of STATUS */ .wikitag_null_result { diff -r e804ae133f27 -r 22377c9e2eae Resources/public/images/arrow_redir.png Binary file Resources/public/images/arrow_redir.png has changed diff -r e804ae133f27 -r 22377c9e2eae Resources/public/images/cross.png Binary file Resources/public/images/cross.png has changed diff -r e804ae133f27 -r 22377c9e2eae Resources/public/images/myshadow.png Binary file Resources/public/images/myshadow.png has changed diff -r e804ae133f27 -r 22377c9e2eae Resources/public/images/tick.png Binary file Resources/public/images/tick.png has changed diff -r e804ae133f27 -r 22377c9e2eae Resources/public/js/jquery.clickmenu.js --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/Resources/public/js/jquery.clickmenu.js Wed Dec 07 15:06:35 2011 +0100 @@ -0,0 +1,515 @@ +/* clickMenu - v0.1.6 + * Copyright (c) 2007 Roman Weich + * http://p.sohei.org + * + * Changelog: + * v 0.1.6 - 2007-09-06 + * -fix: having a link in the top-level menu would not open the menu but call the link instead + * v 0.1.5 - 2007-07-07 + * -change/fix: menu opening/closing now through simple show() and hide() calls - before fadeIn and fadeOut were used for which extra functions to stop a already running animation were created -> they were + * buggy (not working with the interface plugin in jquery1.1.2 and not working with jquery1.1.3 at all) and now removed + * -change: removed option: fadeTime + * -change: now using the bgiframe plugin for adding iframes in ie6 when available + * v 0.1.4 - 2007-03-20 + * -fix: the default options were overwritten by the context related options + * -fix: hiding a submenu all hover- and click-events were unbound, even the ones not defined in this plugin - unbinding should work now + * v 0.1.3 - 2007-03-13 + * -fix: some display problems ie had when no width was set on the submenu, so on ie the width for each submenu will be explicitely set + * -fix: the fix to the ie-width-problem is a fix to the "ie does not support css min-width stuff" problem too which displayed some submenus too narrow (it looked just not right) + * -fix: some bugs, when user the was too fast with the mouse + * v 0.1.2 - 2007-03-11 + * -change: made a lot changes in the traversing routines to speed things up (having better memory usage now as well) + * -change: added $.fn.clickMenu.setDefaults() for setting global defaults + * -fix: hoverbug when a main menu item had no submenu + * -fix: some bugs i found while rewriting most of the stuff + * v 0.1.1 - 2007-03-04 + * -change: the width of the submenus is no longer fixed, its set in the plugin now + * -change: the submenu-arrow is now an img, not the background-img of the list element - that allows better positioning, and background-changes on hover (you have to set the image through the arrowSrc option) + * -fix: clicking on a clickMenu while another was already open, didn't close the open one + * -change: clicking on the open main menu item will close it + * -fix: on an open menu moving the mouse to a main menu item and moving it fastly elsewere hid the whole menu + * v 0.1.0 - 2007-03-03 + */ + +(function($) +{ + var defaults = { + onClick: function(){ + $(this).find('>a').each(function(){ + if ( this.href ) + { + window.location = this.href; + } + }); + }, + arrowSrc: '', + subDelay: 300, + mainDelay: 10 + }; + + $.fn.clickMenu = function(options) + { + var shown = false; + var liOffset = ( ($.browser.msie) ? 4 : 2 ); + + var settings = $.extend({}, defaults, options); + + var hideDIV = function(div, delay) + { + //a timer running to show the div? + if ( div.timer && !div.isVisible ) + { + clearTimeout(div.timer); + } + else if (div.timer) + { + return; //hide-timer already running + } + if ( div.isVisible ) + { + div.timer = setTimeout(function() + { + //remove events + $(getAllChilds(getOneChild(div, 'UL'), 'LI')).unbind('mouseover', liHoverIn).unbind('mouseout', liHoverOut).unbind('click', settings.onClick); + //hide it + $(div).hide(); + div.isVisible = false; + div.timer = null; + }, delay); + } + }; + + var showDIV = function(div, delay) + { + if ( div.timer ) + { + clearTimeout(div.timer); + } + if ( !div.isVisible ) + { + div.timer = setTimeout(function() + { + //check if the mouse is still over the parent item - if not dont show the submenu + if ( !checkClass(div.parentNode, 'hover') ) + { + return; + } + //assign events to all div>ul>li-elements + $(getAllChilds(getOneChild(div, 'UL'), 'LI')).mouseover(liHoverIn).mouseout(liHoverOut).click(settings.onClick); + //positioning + if ( !checkClass(div.parentNode, 'main') ) + { + $(div).css('left', div.parentNode.offsetWidth - liOffset); + } + //show it + div.isVisible = true; //we use this over :visible to speed up traversing + $(div).show(); + if ( $.browser.msie ) //fixing a display-bug in ie6 and adding min-width + { + var cW = $(getOneChild(div, 'UL')).width(); + if ( cW < 100 ) + { + cW = 100; + } + $(div).css('width', cW); + } + div.timer = null; + }, delay); + } + }; + + //same as hover.handlehover in jquery - just can't use hover() directly - need the ability to unbind only the one hover event + var testHandleHover = function(e) + { + // Check if mouse(over|out) are still within the same parent element + var p = (e.type == "mouseover" ? e.fromElement : e.toElement) || e.relatedTarget; + // Traverse up the tree + while ( p && p != this ) + { + try + { + p = p.parentNode; + } + catch(e) + { + p = this; + } + } + // If we actually just moused on to a sub-element, ignore it + if ( p == this ) + { + return false; + } + return true; + }; + + var mainHoverIn = function(e) + { + //no need to test e.target==this, as no child has the same event binded + //its possible, that a main menu item still has hover (if it has no submenu) - thus remove it + var lis = getAllChilds(this.parentNode, 'LI'); + var pattern = new RegExp("(^|\\s)hover(\\s|$)"); + for (var i = 0; i < lis.length; i++) + { + if ( pattern.test(lis[i].className) ) + { + $(lis[i]).removeClass('hover'); + } + } + $(this).addClass('hover'); + if ( shown ) + { + hoverIn(this, settings.mainDelay); + } + }; + + var liHoverIn = function(e) + { + if ( !testHandleHover(e) ) + { + return false; + } + if ( e.target != this ) + { + //look whether the target is a direct child of this (maybe an image) + if ( !isChild(this, e.target) ) + { + return; + } + } + hoverIn(this, settings.subDelay); + }; + + var hoverIn = function(li, delay) + { + var innerDiv = getOneChild(li, 'DIV'); + //stop running timers from the other menus on the same level - a little faster than $('>*>div', li.parentNode) + var n = li.parentNode.firstChild; + for ( ; n; n = n.nextSibling ) + { + if ( n.nodeType == 1 && n.nodeName.toUpperCase() == 'LI' ) + { + var div = getOneChild(n, 'DIV'); + if ( div && div.timer && !div.isVisible ) //clear show-div timer + { + clearTimeout(div.timer); + div.timer = null; + } + } + } + //is there a timer running to hide one of the parent divs? stop it + var pNode = li.parentNode; + for ( ; pNode; pNode = pNode.parentNode ) + { + if ( pNode.nodeType == 1 && pNode.nodeName.toUpperCase() == 'DIV' ) + { + if (pNode.timer) + { + clearTimeout(pNode.timer); + pNode.timer = null; + $(pNode.parentNode).addClass('hover'); + } + } + } + //highlight the current element + $(li).addClass('hover'); + //is the submenu already visible? + if ( innerDiv && innerDiv.isVisible ) + { + //hide-timer running? + if ( innerDiv.timer ) + { + clearTimeout(innerDiv.timer); + innerDiv.timer = null; + } + else + { + return; + } + } + //hide all open menus on the same level and below and unhighlight the li item (but not the current submenu!) + $(li.parentNode.getElementsByTagName('DIV')).each(function(){ + if ( this != innerDiv && this.isVisible ) + { + hideDIV(this, delay); + $(this.parentNode).removeClass('hover'); + } + }); + //show the submenu, if there is one + if ( innerDiv ) + { + showDIV(innerDiv, delay); + } + }; + + var liHoverOut = function(e) + { + if ( !testHandleHover(e) ) + { + return false; + } + if ( e.target != this ) + { + if ( !isChild(this, e.target) ) //return only if the target is no direct child of this + { + return; + } + } + //remove the hover from the submenu item, if the mouse is hovering out of the menu (this is only for the last open (levelwise) (sub-)menu) + var div = getOneChild(this, 'DIV'); + if ( !div ) + { + $(this).removeClass('hover'); + } + else + { + if ( !div.isVisible ) + { + $(this).removeClass('hover'); + } + } + }; + + var mainHoverOut = function(e) + { + //no need to test e.target==this, as no child has the same event binded + //remove hover + var div = getOneChild(this, 'DIV'); + var relTarget = e.relatedTarget || e.toElement; //this is undefined sometimes (e.g. when the mouse moves out of the window), so dont remove hover then + var p; + if ( !shown ) + { + $(this).removeClass('hover'); + } + else if ( !div && relTarget ) //menuitem has no submenu, so dont remove the hover if the mouse goes outside the menu + { + p = findParentWithClass(e.target, 'UL', 'clickMenu'); + if ( p.contains(relTarget)) + { + $(this).removeClass('hover'); + } + } + else if ( relTarget ) + { + //remove hover only when moving to anywhere inside the clickmenu + p = findParentWithClass(e.target, 'UL', 'clickMenu'); + if ( !div.isVisible && (p.contains(relTarget)) ) + { + $(this).removeClass('hover'); + } + } + }; + + var mainClick = function() + { + var div = getOneChild(this, 'DIV'); + if ( div && div.isVisible ) //clicked on an open main-menu-item + { + clean(); + $(this).addClass('hover'); + } + else + { + hoverIn(this, settings.mainDelay); + shown = true; + $(document).bind('mousedown', checkMouse); + } + return false; + }; + + var checkMouse = function(e) + { + //is the mouse inside a clickmenu? if yes, is it an open (the current) one? + var vis = false; + var cm = findParentWithClass(e.target, 'UL', 'clickMenu'); + if ( cm ) + { + $(cm.getElementsByTagName('DIV')).each(function(){ + if ( this.isVisible ) + { + vis = true; + } + }); + } + if ( !vis ) + { + clean(); + } + }; + + var clean = function() + { + //remove timeout and hide the divs + $('ul.clickMenu div.outerbox').each(function(){ + if ( this.timer ) + { + clearTimeout(this.timer); + this.timer = null; + } + if ( this.isVisible ) + { + $(this).hide(); + this.isVisible = false; + } + }); + $('ul.clickMenu li').removeClass('hover'); + //remove events + $('ul.clickMenu>li li').unbind('mouseover', liHoverIn).unbind('mouseout', liHoverOut).unbind('click', settings.onClick); + $(document).unbind('mousedown', checkMouse); + shown = false; + }; + + var getOneChild = function(elem, name) + { + if ( !elem ) + { + return null; + } + var n = elem.firstChild; + for ( ; n; n = n.nextSibling ) + { + if ( n.nodeType == 1 && n.nodeName.toUpperCase() == name ) + { + return n; + } + } + return null; + }; + + var getAllChilds = function(elem, name) + { + if ( !elem ) + { + return []; + } + var r = []; + var n = elem.firstChild; + for ( ; n; n = n.nextSibling ) + { + if ( n.nodeType == 1 && n.nodeName.toUpperCase() == name ) + { + r[r.length] = n; + } + } + return r; + }; + + var findParentWithClass = function(elem, searchTag, searchClass) + { + var pNode = elem.parentNode; + var pattern = new RegExp("(^|\\s)" + searchClass + "(\\s|$)"); + for ( ; pNode; pNode = pNode.parentNode ) + { + if ( pNode.nodeType == 1 && pNode.nodeName.toUpperCase() == searchTag && pattern.test(pNode.className) ) + { + return pNode; + } + } + return null; + }; + + var checkClass = function(elem, searchClass) + { + var pattern = new RegExp("(^|\\s)" + searchClass + "(\\s|$)"); + if ( pattern.test(elem.className) ) + { + return true; + } + return false; + }; + + var isChild = function(elem, childElem) + { + var n = elem.firstChild; + for ( ; n; n = n.nextSibling ) + { + if ( n == childElem ) + { + return true; + } + } + return false; + }; + + return this.each(function() + { + //add .contains() to mozilla - http://www.quirksmode.org/blog/archives/2006/01/contains_for_mo.html + if (window.Node && Node.prototype && !Node.prototype.contains) + { + Node.prototype.contains = function(arg) + { + return !!(this.compareDocumentPosition(arg) & 16); + }; + } + //add class + if ( !checkClass(this, 'clickMenu') ) + { + $(this).addClass('clickMenu'); + } + //add shadows + $('ul', this).shadowBox(); + //ie6? - add iframes + if ( $.browser.msie && (!$.browser.version || parseInt($.browser.version) <= 6) ) + { + if ( $.fn.bgiframe ) + { + $('div.outerbox', this).bgiframe(); + } + else + { + /* thanks to Mark Gibson - http://www.nabble.com/forum/ViewPost.jtp?post=6504414&framed=y */ + $('div.outerbox', this).append('