From 6db881c09d45a744822a3e735cb970e51c474500 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Wed, 20 Feb 2013 18:34:54 +0100 Subject: [PATCH 1/5] New: Add link collapse all - expand all. Fix: Add missing images. --- htdocs/admin/menus/index.php | 4 +++- htdocs/core/lib/treeview.lib.php | 15 ++++++++------- .../jquerytreeview/images/ajax-loader.gif | Bin 0 -> 847 bytes .../plugins/jquerytreeview/images/file.gif | Bin 0 -> 110 bytes .../jquerytreeview/images/folder-closed.gif | Bin 0 -> 105 bytes .../plugins/jquerytreeview/images/folder.gif | Bin 0 -> 106 bytes .../plugins/jquerytreeview/images/minus.gif | Bin 0 -> 837 bytes .../plugins/jquerytreeview/images/plus.gif | Bin 0 -> 841 bytes .../images/treeview-black-line.gif | Bin 0 -> 1877 bytes .../jquerytreeview/images/treeview-black.gif | Bin 0 -> 1216 bytes .../images/treeview-default-line.gif | Bin 0 -> 1993 bytes .../jquerytreeview/images/treeview-default.gif | Bin 0 -> 1222 bytes .../images/treeview-famfamfam-line.gif | Bin 0 -> 807 bytes .../jquerytreeview/images/treeview-famfamfam.gif | Bin 0 -> 1280 bytes .../jquerytreeview/images/treeview-gray-line.gif | Bin 0 -> 1877 bytes .../jquerytreeview/images/treeview-gray.gif | Bin 0 -> 1230 bytes .../jquerytreeview/images/treeview-red-line.gif | Bin 0 -> 1877 bytes .../jquerytreeview/images/treeview-red.gif | Bin 0 -> 1230 bytes 18 files changed, 11 insertions(+), 8 deletions(-) create mode 100644 htdocs/includes/jquery/plugins/jquerytreeview/images/ajax-loader.gif create mode 100644 htdocs/includes/jquery/plugins/jquerytreeview/images/file.gif create mode 100644 htdocs/includes/jquery/plugins/jquerytreeview/images/folder-closed.gif create mode 100644 htdocs/includes/jquery/plugins/jquerytreeview/images/folder.gif create mode 100644 htdocs/includes/jquery/plugins/jquerytreeview/images/minus.gif create mode 100644 htdocs/includes/jquery/plugins/jquerytreeview/images/plus.gif create mode 100644 htdocs/includes/jquery/plugins/jquerytreeview/images/treeview-black-line.gif create mode 100644 htdocs/includes/jquery/plugins/jquerytreeview/images/treeview-black.gif create mode 100644 htdocs/includes/jquery/plugins/jquerytreeview/images/treeview-default-line.gif create mode 100644 htdocs/includes/jquery/plugins/jquerytreeview/images/treeview-default.gif create mode 100644 htdocs/includes/jquery/plugins/jquerytreeview/images/treeview-famfamfam-line.gif create mode 100644 htdocs/includes/jquery/plugins/jquerytreeview/images/treeview-famfamfam.gif create mode 100644 htdocs/includes/jquery/plugins/jquerytreeview/images/treeview-gray-line.gif create mode 100644 htdocs/includes/jquery/plugins/jquerytreeview/images/treeview-gray.gif create mode 100644 htdocs/includes/jquery/plugins/jquerytreeview/images/treeview-red-line.gif create mode 100644 htdocs/includes/jquery/plugins/jquerytreeview/images/treeview-red.gif diff --git a/htdocs/admin/menus/index.php b/htdocs/admin/menus/index.php index 1fd5365e272..b4536901da3 100644 --- a/htdocs/admin/menus/index.php +++ b/htdocs/admin/menus/index.php @@ -271,10 +271,12 @@ print ''; print ''; print ''; +print ''; print ''; print ''; -print ''; print ''; print ''; - print ''; + print ''; print ''; print ''; print ''; @@ -122,7 +122,7 @@ if ($resql) print "\n"; print ''; - print '';
'.$langs->trans("TreeMenuPersonalized").'
'; +print ''; // ARBORESCENCE diff --git a/htdocs/core/lib/treeview.lib.php b/htdocs/core/lib/treeview.lib.php index 7f8ed742fc6..2e6671f4550 100644 --- a/htdocs/core/lib/treeview.lib.php +++ b/htdocs/core/lib/treeview.lib.php @@ -180,19 +180,20 @@ function tree_showline($tab,$rang) */ function tree_recur($tab,$pere,$rang) { - if (empty($pere['rowid'])) + if (empty($pere['rowid'])) { - // Test also done with jstree and dynatree (not able to have inside label) + // Test also done with jstree and dynatree (not able to have inside label) print ''; - + print '
    '; } @@ -207,7 +208,7 @@ function tree_recur($tab,$pere,$rang) // If an element has $pere for parent if ($tab[$x]['fk_menu'] != -1 && $tab[$x]['fk_menu'] == $pere['rowid']) { - if (empty($ulprinted) && ! empty($pere['rowid'])) { print ''; $ulprinted++; } + if (empty($ulprinted) && ! empty($pere['rowid'])) { print ''; $ulprinted++; } print "\n".'
  • '; // We shot it with an offset tree_showline($tab[$x],$rang); @@ -218,7 +219,7 @@ function tree_recur($tab,$pere,$rang) } elseif (! empty($tab[$x]['rowid']) && $tab[$x]['fk_menu'] == -1 && $tab[$x]['fk_mainmenu'] == $pere['mainmenu'] && $tab[$x]['fk_leftmenu'] == $pere['leftmenu']) { - if (empty($ulprinted) && ! empty($pere['rowid'])) { print ''; $ulprinted++; } + if (empty($ulprinted) && ! empty($pere['rowid'])) { print ''; $ulprinted++; } print "\n".'
  • '; // We shot it with an offset tree_showline($tab[$x],$rang); @@ -229,7 +230,7 @@ function tree_recur($tab,$pere,$rang) } } if (! empty($ulprinted) && ! empty($pere['rowid'])) { print '
'."\n"; } - + if (empty($pere['rowid'])) print ''; } diff --git a/htdocs/includes/jquery/plugins/jquerytreeview/images/ajax-loader.gif b/htdocs/includes/jquery/plugins/jquerytreeview/images/ajax-loader.gif new file mode 100644 index 0000000000000000000000000000000000000000..bc545850add6bc46ed3eca7b55445c4a99362a7c GIT binary patch literal 847 zcmZ?wbhEHb6krfw_`<;O|Nnmm28JI$eppyow6wIav9YPCsa?BvZN-WeVq#)tWo2n; zX-}R!nK5I=v17+PJUqg}!hq_D2a5lsoQqNuOHxx5$}>wc6cV!%D{}G^Q}iNI#p{aB=u^kJ9BqzM)+D@@g7D>_ZH z6>Nk>K2^#dec$f{wU-guk_-ifF85148Cp_DAFNp6pyFD4;K0FaN0~T!rZl8xhzRi< zJfPqp$mMgO;X`tudoz>MmZ#eSOlK(AtTGKv3EZarLTTUP^eF}_#MUiZ*zcGva9-Jw zf!ij)+<@JNlcm9cFOtndi}(JSX|zKPdEhy7ru zZb`FNQ?sj-h`^G=x)&2xbR-;L`YB-8$sw^}x!0m5Y~9sd L;uWgGz+epk&R;19 literal 0 HcmV?d00001 diff --git a/htdocs/includes/jquery/plugins/jquerytreeview/images/folder-closed.gif b/htdocs/includes/jquery/plugins/jquerytreeview/images/folder-closed.gif new file mode 100644 index 0000000000000000000000000000000000000000..541107888e6739a7b367ad3d208e1efa933f877d GIT binary patch literal 105 zcmZ?wbhEHb6ky4lrdiO0bk3ZcRLy6E?4f Hg~1vCyv-@{ literal 0 HcmV?d00001 diff --git a/htdocs/includes/jquery/plugins/jquerytreeview/images/folder.gif b/htdocs/includes/jquery/plugins/jquerytreeview/images/folder.gif new file mode 100644 index 0000000000000000000000000000000000000000..2b31631ca2bfec3a8afb1bfdd4f8ed4c5bcc3a18 GIT binary patch literal 106 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 literal 0 HcmV?d00001 diff --git a/htdocs/includes/jquery/plugins/jquerytreeview/images/treeview-gray-line.gif b/htdocs/includes/jquery/plugins/jquerytreeview/images/treeview-gray-line.gif new file mode 100644 index 0000000000000000000000000000000000000000..37600447dc002bbc0dd16e1391b711360aae2e34 GIT binary patch literal 1877 zcmeH``8OK|0LL@bF~qSc#n50?JXNI+k>{#)#go3O{g`&sTA06+?`JRv{%1VB*=kSggPTmbZ?E2@Hm10RaqGJr~M_swEK9(fuU z9bXMur@nY#Xn3Qp;v6X2AT> zA>EM+>y@m1^a49s_E1X&+bZH^!_a=e{N6Su)s&U>sDnd!~=b?JFEB#FT8 zioZMFaK52~t&52oqdWW~2MJ1ue%%?en#qCfU7u!nC|sSJi5E`}X3h8)ly{+5*|mp+ zYqNE`8MkZN-)k};oze-j%*tB&sNuZif|=0wM%!=l0sXF(V)Zg+3_ zjbW;EBEX2ytHG=$Dx2Ha{HE%5V3a1hHnd2R32m%R*9#gFWf^4tEW&~!6yIiV)*e*l zireg~b4-8KL1b9Tn<4TQc-aUN7>=bBxE!0Aep)ES$dA>bZ zlac_>GSf$}Amq|xpG2f_X<$)PU0E=BExZ&}FuYP8&bwD%fgJCOsK5%!A}jIpO{>+( zGV75wBp|A>JOyOlNY1dq-7SE-P1iq3bVQx6%Yk<{*5}84F?-+_`Yq}S#U}_=SCzX? zX`+&GsCqhDsvFh7AWWM#ck=(Rps}W(-f3)-hf$w$i>58wymeug)RAsnbE^=j9L-?f zpi-Z);Tuuyqj4L}9YcZxTIWO&p4K%*X3?0-?f4ef8jtm%XgkyEBd6Ds8uOK?%`{)>0D(Cr`A4IcZoG`&U18YKqjoYtzQo|Dt=**7zk597IbK9sJXFyhNi zwtW@gRcSW?gGKMW@kxrlG#OY-do~qJ*-V&3Js8`Y3GYwom_@$iB+g=ml}U5>1u1QR zAzAiA(jrL>&74Uwwqm}`xJ1AT;O_GsONn5#!*ULyhq;oEIkp%2g#mF(6lf@Jxhn4i zV~t87;8y4{2KZG5ao+KL=SUTJlQq*4|E@_PjJ3`!o(GG)^}?JsMpy*)mQYPCf1;Sk`8-A8at@Xm#Gb>oe(v%3b{156)aykj?nu&|IbZfh z!lZx$?iVd}BHwuNSkmco3iwy5Drr$xV-lid6PqT(u95$N>8c#Jm2RMN_SB1WJe9Oq z(x$uU@TQLQX@QVr>U~Sa;vEmbZ_QL7odp^*-BsqVXSqmf)oqYES3tl*66F0YO=#d1 rlgk$~puxAlhuJ^ZHqgioD1o1DVtQEUit~KllU0$5nh)jV0N{TCC3Zqn literal 0 HcmV?d00001 diff --git a/htdocs/includes/jquery/plugins/jquerytreeview/images/treeview-gray.gif b/htdocs/includes/jquery/plugins/jquerytreeview/images/treeview-gray.gif new file mode 100644 index 0000000000000000000000000000000000000000..cfb8a2f0961b880d9ecc9e59f831d0c0bf9d06db GIT binary patch literal 1230 zcmZ?wbhEHbOkikb_|5F}1vNN-#bFE}n2rob1X65+pkEe*DZwLSXy)sc-G6LrLE|#j%ny@ltx#{|>*k3`b zudj+f+$8$@s#fHh^zF++cYjOsT#=i)PgZ*SBbQFk<=6g7TzYe_x%fYqoR5WW_>5Nf zsIRkcJbHA@c(c>D3XzqU)=k#8J9nngIK5|{y|vw$2$RE?mT4~XtDRLEe|<_~c?_?$ zLGJZ!!S{W4%zp58Z=>w%X})`Qe0&`0sXRUALwVLJuj#KvHA1S2+ow&BYJYdfr2O^1 zna!)!@5=7^`T51=)#j2iwbhrWRX*39_q(R{^Y??#w#k`8!n#b?Ah=gT4^b_6Je!p-pqnUi6)T{Kw4)JLb3tD)cb}Z;R&ALM=NKo^J zQum3S7LQAK7iB!^v-vhdvhxz-&N&k%mqtvOXdV2 literal 0 HcmV?d00001 diff --git a/htdocs/includes/jquery/plugins/jquerytreeview/images/treeview-red-line.gif b/htdocs/includes/jquery/plugins/jquerytreeview/images/treeview-red-line.gif new file mode 100644 index 0000000000000000000000000000000000000000..df9e749a8f1f58862588efc64988003efad01d51 GIT binary patch literal 1877 zcmeH``BxGK0LPh{$5cGF%CuRcF0W^1+Eb91Y0har@ns%QJPI-bCps}CP-u#GY96he zH{=x}8cR_?6wMSBHp}~@d8B5Ec_ztT`#0A2hwu02&*#0br`JzT&Np-c8>+j2FWJW9 z|J$$i)xiJGfXTkfHvoVFVDp9i%O?Qp3V=f6d5==7Sk4KMl>Ucik`YxtvJ<)$%#TPKR% zdeBegW3Nr-TZ$_DvX!7#=EQu`)|{{_NO4?Hnuz--`I}N3UjF&+?uwLk+=>GJd{B_Tc2OKbjN9H> z96NPSF%oo|+^NT@plDh-RsN>!ws$&N>eV+-RSK`GN-+xQlcpP|{VXMbZmGY?Sg+bE z&yqDeRb-m~Xn;($Rkc9os0lNWR0x7V&viYtFw425?`)O{#Xnxi^Z-rV%z`xuPf1K3U`ignx^9LiY{9RF`M1 z((4&CBBq9gRTxIqvdNQH4XvU-teM=&r#I{BRpE@Mf`UowW*aYDTj; zR~d}wJj7bmv%$EvhL%3@95+YnP@jZFjkyaK?LZqem&Cp}E@#J}7%>obDszfKXbSed{!N zqe%A5h1G9<<|OWgt(pyPNUi%mt_OllWQ$!DHV#9VzJogSLla83`aMi%;zcml$vXr7 zf<%YcL08HgN8s@2tufz(==0;jh0Ny@q4f1T-P5MdE9;FzHSA-Pm3Wn^KX5K-#%-h+YndE*c}A#} z97|nymmXX*xOhw~p_=<#*Rp;q1c;i_)TkyvQ;xgVtY5mTyh_&|ZEzU`%%?)%UDt;N sUpBjNE)^Df<9oQ%i{r+6SwTgJWAz*lYeQMK?>m|{T3!EviV6VoFXq=mv;Y7A literal 0 HcmV?d00001 diff --git a/htdocs/includes/jquery/plugins/jquerytreeview/images/treeview-red.gif b/htdocs/includes/jquery/plugins/jquerytreeview/images/treeview-red.gif new file mode 100644 index 0000000000000000000000000000000000000000..3bbb3a157f1568d59d6db02b55a3b3fe9a1ff7a7 GIT binary patch literal 1230 zcmZ?wbhEHbOkikb_|5q9rFMYXq;dkzBCUd%AXV z7f->2WoKqf=UU0E5MF-1&C2oHA5RfQ-wyu&du5`wWCYCfT`X0jHDP7Qa?|x$vA=>= zUtbk}xJmT)RjtT1>D!lu?*5kMxgs}ppRDxuM=qV7%dh>Fxb)^;bMb#JIUft%@ENV{ zQD0}@c=YI)@n)xQ6(TDyt(&ZGckWD~aeB`@duzKh5hjN(Ez?}&S39dT{`!=}@)%xg zgWT)eg75q8nEl}G-bUHi(|q^r`1m-~Q+ayKhw`jdUejNTYJ^l3w@;fM)&A~|N%`x2 zGn-ed-<93-^Ye?#tIZ{4YO60#t9-6I?{`h@=kEuf$II8+R(@HSYaUSgyf$2+OgK}0 zZsRjUi+L5dHILtK5edt9=qI|b{eIzIMl<7PRm>?O4!tnstX#kf7!b zrS20uEgqNfF3Nb+XY*}_WalNuopUBkE{&Kl(L5+ZuF(6`HI*Fyu5b4nE$kweHiYk+ hA)Dse=Ki!azG~* Date: Wed, 20 Feb 2013 19:01:29 +0100 Subject: [PATCH 2/5] Qual: Code to output tree is now generic --- htdocs/admin/menus/index.php | 18 ++++++++++++- htdocs/core/lib/treeview.lib.php | 44 +++++--------------------------- 2 files changed, 24 insertions(+), 38 deletions(-) diff --git a/htdocs/admin/menus/index.php b/htdocs/admin/menus/index.php index b4536901da3..f0ba051450c 100644 --- a/htdocs/admin/menus/index.php +++ b/htdocs/admin/menus/index.php @@ -318,7 +318,23 @@ if ($conf->use_javascript_ajax) { if (! empty($menu['langs'])) $langs->load($menu['langs']); $titre = $langs->trans($menu['titre']); - $data[] = array('rowid'=>$menu['rowid'],'fk_menu'=>$menu['fk_menu'],'title'=>$titre,'mainmenu'=>$menu['mainmenu'],'leftmenu'=>$menu['leftmenu'],'fk_mainmenu'=>$menu['fk_mainmenu'],'fk_leftmenu'=>$menu['fk_leftmenu']); + $data[] = array( + 'rowid'=>$menu['rowid'], + 'fk_menu'=>$menu['fk_menu'], + 'title'=>$titre, + 'mainmenu'=>$menu['mainmenu'], + 'leftmenu'=>$menu['leftmenu'], + 'fk_mainmenu'=>$menu['fk_mainmenu'], + 'fk_leftmenu'=>$menu['fk_leftmenu'], + 'entry'=>'
'. + '   '.$titre.''. + ''. + ''.img_edit('default',0,'class="menuEdit" id="edit'.$menu['rowid'].'"').' '. + ''.img_edit_add('default',0,'class="menuNew" id="new'.$menu['rowid'].'"').' '. + ''.img_delete('default',0,'class="menuDel" id="del'.$menu['rowid'].'"').' '. + ''.img_picto("Monter","1uparrow").''.img_picto("Descendre","1downarrow").''. + '
' + ); $i++; } } diff --git a/htdocs/core/lib/treeview.lib.php b/htdocs/core/lib/treeview.lib.php index 2e6671f4550..65b2ca5d502 100644 --- a/htdocs/core/lib/treeview.lib.php +++ b/htdocs/core/lib/treeview.lib.php @@ -145,56 +145,30 @@ function tree_showpad(&$fulltree,$key,$silent=0) // ------------------------------- Used by menu editor ----------------- /** - * Show an element with correct offset - * - * @param array $tab Array of element - * @param int $rang Level of offset - * @return void - */ -function tree_showline($tab,$rang) -{ - global $conf, $rangLast, $idLast, $menu_handler; - - // Content of line - print '
'; - print '   '.$tab['title'].''; - print ''; - print ''.img_edit('default',0,'class="menuEdit" id="edit'.$tab['rowid'].'"').' '; - print ''.img_edit_add('default',0,'class="menuNew" id="new'.$tab['rowid'].'"').' '; - print ''.img_delete('default',0,'class="menuDel" id="del'.$tab['rowid'].'"').' '; - print ''.img_picto("Monter","1uparrow").''.img_picto("Descendre","1downarrow").''; - print '
'; - - $rangLast = $rang; - $idLast = $tab['rowid']; -} - - -/** - * Recursive function to output menu tree + * Recursive function to output menu tree.
  • ...
* * @param array $tab Array of all elements * @param int $pere Array with parent ids ('rowid'=>,'mainmenu'=>,'leftmenu'=>,'fk_mainmenu=>,'fk_leftmenu=>) * @param int $rang Level of element * @return void */ -function tree_recur($tab,$pere,$rang) +function tree_recur($tab, $pere, $rang, $iddivjstree='iddivjstree') { if (empty($pere['rowid'])) { // Test also done with jstree and dynatree (not able to have
inside label) print ''; - print '
    '; + print '
      '; } if ($rang > 10) return; // Protection contre boucle infinie @@ -210,9 +184,7 @@ function tree_recur($tab,$pere,$rang) { if (empty($ulprinted) && ! empty($pere['rowid'])) { print ''; $ulprinted++; } print "\n".'
    • '; - // We shot it with an offset - tree_showline($tab[$x],$rang); - + print $tab[$x]['entry']; // And now we search all its sons of lower level tree_recur($tab,$tab[$x],$rang+1); print '
    • '; @@ -221,9 +193,7 @@ function tree_recur($tab,$pere,$rang) { if (empty($ulprinted) && ! empty($pere['rowid'])) { print ''; $ulprinted++; } print "\n".'
    • '; - // We shot it with an offset - tree_showline($tab[$x],$rang); - + print $tab[$x]['entry']; // And now we search all its sons of lower level tree_recur($tab,$tab[$x],$rang+1); print '
    • '; From 2852aded3ad5a94d9ee8bbab54200040121e39d9 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Wed, 20 Feb 2013 21:16:31 +0100 Subject: [PATCH 3/5] New: Add button collapse/expand for menu, category and user views. --- ChangeLog | 22 +- htdocs/admin/menus/index.php | 4 +- htdocs/categories/index.php | 217 ++++------------- htdocs/core/lib/treeview.lib.php | 72 ++---- .../jquerytreeview/lib/jquery.cookie.js | 92 +++++++ .../install/mysql/migration/3.3.0-3.4.0.sql | 2 +- htdocs/user/class/user.class.php | 10 +- htdocs/user/hierarchy.php | 229 ++++-------------- 8 files changed, 229 insertions(+), 419 deletions(-) create mode 100644 htdocs/includes/jquery/plugins/jquerytreeview/lib/jquery.cookie.js diff --git a/ChangeLog b/ChangeLog index bf58724de36..f1a44ef58e0 100644 --- a/ChangeLog +++ b/ChangeLog @@ -6,15 +6,27 @@ English Dolibarr ChangeLog For users: - New: Some performance enhancements. - New: Can attach files onto trip and expenses modules. -- New: Add option MAIN_PDF_TITLE_BACKGROUND_COLOR -- New: Can define a hierarchical responsible on user -- New: Merge tab customer and prospect -- New: Add ES formated address country rule - +- New: Add option MAIN_PDF_TITLE_BACKGROUND_COLOR. +- New: Merge tab customer and prospect. +- New: Add ES formated address country rule. +- New: Can define a hierarchical responsible on user. +- New: Add a hierarchical view for users. +- New: Can expand/collapse menus, categories and users list. +- New: extra parameters are supported into ODT templates. +- New: total per vat rate are available as tags for ODT templates. +- New: Add more types for extra parameters (lists, phone, emails, checkbox, prices) +- New: Some part of interface use more CSS3 (ie: agenda) + For developers: - System of menu managers has been rewritten to reduce code to do same things. - An external module can force its theme. - Add function dol_set_focus('#xxx'). +- A mymodule can bring its own core/modules/mymodule/modules_mymodule.php file. +- Removed not used libraries. +- More web services. +- Renamed some french fields into english. +- First change to manage margins on contracts. +- Add hook getFormMail. For translators: - Update language files. diff --git a/htdocs/admin/menus/index.php b/htdocs/admin/menus/index.php index f0ba051450c..5a042a65679 100644 --- a/htdocs/admin/menus/index.php +++ b/htdocs/admin/menus/index.php @@ -209,8 +209,8 @@ elseif ($action == 'confirm_delete' && $confirm == 'yes') $form=new Form($db); $formadmin=new FormAdmin($db); -$arrayofjs=array('/includes/jquery/plugins/jquerytreeview/jquery.treeview.js?lang='.$langs->defaultlang); -$arrayofcss=array('/includes/jquery/plugins/jquerytreeview/jquery.treeview.css?lang='.$langs->defaultlang); +$arrayofjs=array('/includes/jquery/plugins/jquerytreeview/jquery.treeview.js', '/includes/jquery/plugins/jquerytreeview/lib/jquery.cookie.js'); +$arrayofcss=array('/includes/jquery/plugins/jquerytreeview/jquery.treeview.css'); llxHeader('',$langs->trans("Menus"),'','',0,0,$arrayofjs,$arrayofcss); diff --git a/htdocs/categories/index.php b/htdocs/categories/index.php index c9102fdaa17..520619580a9 100644 --- a/htdocs/categories/index.php +++ b/htdocs/categories/index.php @@ -52,7 +52,11 @@ elseif ($type == 2) $title=$langs->trans("CustomersCategoriesArea"); elseif ($type == 3) $title=$langs->trans("MembersCategoriesArea"); else $title=$langs->trans("CategoriesArea"); -llxHeader("","",$title); +$arrayofjs=array('/includes/jquery/plugins/jquerytreeview/jquery.treeview.js', '/includes/jquery/plugins/jquerytreeview/lib/jquery.cookie.js'); +$arrayofcss=array('/includes/jquery/plugins/jquerytreeview/jquery.treeview.css'); + +llxHeader('',$title,'','',0,0,$arrayofjs,$arrayofcss); + print_fiche_titre($title); @@ -128,187 +132,56 @@ $cate_arbo = $categstatic->get_full_arbo($type); // Define fulltree array $fulltree=$cate_arbo; +// Define data (format for treeview) +$data=array(); +$data[] = array('rowid'=>0,'fk_menu'=>-1,'title'=>"racine",'mainmenu'=>'','leftmenu'=>'','fk_mainmenu'=>'','fk_leftmenu'=>''); +foreach($fulltree as $key => $val) +{ + $categstatic->id=$val['id']; + $categstatic->ref=$val['label']; + $categstatic->type=$type; + $li=$categstatic->getNomUrl(1,'',60); + + $data[] = array( + 'rowid'=>$val['rowid'], + 'fk_menu'=>$val['fk_parent'], + 'entry'=>''. + ''. + '
      '.$li. + ''. + ' '.$val['description'].''.img_view().'
      ' + ); +} + + print ''; -print ''; +print ''; +$nbofentries=(count($data) - 1); -// ----- This section will show a tree from a fulltree array ----- -// $section must also be defined -// --------------------------------------------------------------- - - -// Root title line -print ''; -print ''; -print ''; -//print ''; -print ''; - - - -// Define fullpathselected ( _x_y_z ) of $section parameter -$fullpathselected=''; -if (! empty($section)) +if ($nbofentries > 0) { - foreach($fulltree as $key => $val) - { - //print $val['id']."-".$section."
      "; - if ($val['id'] == $section) - { - $fullpathselected=$val['fullpath']; - break; - } - } + print ''; } -//print "fullpathselected=".$fullpathselected."
      "; - -// Update expandedsectionarray in session -$expandedsectionarray=array(); -if (isset($_SESSION['dol_catexpandedsectionarray'.$type])) $expandedsectionarray=explode(',',$_SESSION['dol_catexpandedsectionarray'.$type]); - -if (! empty($section) && $_GET['sectionexpand'] == 'true') +else { - // We add all sections that are parent of opened section - $pathtosection=explode('_',$fullpathselected); - foreach($pathtosection as $idcursor) - { - if ($idcursor && ! in_array($idcursor,$expandedsectionarray)) // Not already in array - { - $expandedsectionarray[]=$idcursor; - } - } - $_SESSION['dol_catexpandedsectionarray'.$type]=join(',',$expandedsectionarray); -} -if (! empty($section) && $_GET['sectionexpand'] == 'false') -{ - // We removed all expanded sections that are child of the closed section - $oldexpandedsectionarray=$expandedsectionarray; - $expandedsectionarray=array(); - foreach($oldexpandedsectionarray as $sectioncursor) - { - // is_in_subtree(fulltree,sectionparent,sectionchild) - if ($sectioncursor && ! is_in_subtree($fulltree,$section,$sectioncursor)) $expandedsectionarray[]=$sectioncursor; - } - $_SESSION['dol_catexpandedsectionarray'.$type]=join(',',$expandedsectionarray); -} -//print $_SESSION['dol_catexpandedsectionarray'.$type].'
      '; - -$nbofentries=0; -$oldvallevel=0; -$var=true; -foreach($fulltree as $key => $val) -{ - //$fullpathparent=preg_replace('/_[^_]+$/i','',$val['fullpath']); - - // Define showline - $showline=0; - - //var_dump($expandedsectionarray); - - // If directory is son of expanded directory, we show line - if (isset($val['fk_parent']) && in_array($val['fk_parent'],$expandedsectionarray)) $showline=4; - // If directory is parent of selected directory or is selected directory, we show line - elseif (preg_match('/'.$val['fullpath'].'_/i',$fullpathselected.'_')) $showline=2; - // If we are level one we show line - elseif ($val['level'] < 2) $showline=1; - //print 'xxx '.$val['level'].' - '.$fullpathselected.' - '.$val['fullpath'].' - '.$val['fk_parent'].' showline='.$showline.'
      '."\n"; - - if ($showline) - { - $var=!$var; - - if (in_array($val['id'],$expandedsectionarray)) $option='indexexpanded'; - else $option='indexnotexpanded'; - //print $option; - - print ""; - - // Show tree graph pictos - print '\n"; - - // Description - print ''; - - // Link to category card - print ''; - - // Add link - //print ''; - //print ''; - - print "\n"; - } - - $oldvallevel=$val['level']; - $nbofentries++; -} - - -// If nothing to show -if ($nbofentries == 0) -{ - print ''; - print ''; - print ''; - print ''; -} - -// ----- End of section ----- -// -------------------------- + print ''; + print ''; + print ''; +} print "
      '.$langs->trans("Categories").''.$langs->trans("Description").'
      '.$langs->trans("Categories").''.$langs->trans("Description").'
      '; -print ''; -print ''; -print '
      '; -print img_picto_common('','treemenu/base.gif'); -print ''.$langs->trans("AllCats"); -print '
         
      '; + tree_recur($data,$data[0],0); + print '
      '; - print ''; - - // Show picto - print ''; - // Show link - print ''; - print '
      '; - $resarray=tree_showpad($fulltree,$key); - $a=$resarray[0]; - $nbofsubdir=$resarray[1]; - $nboffilesinsubdir=$resarray[2]; - print ''; - //print $val['fullpath']."(".$showline.")"; - $n='2'; - if (! in_array($val['id'],$expandedsectionarray)) $n='3'; - if (! in_array($val['id'],$expandedsectionarray)) $ref=img_picto('',DOL_URL_ROOT.'/theme/common/treemenu/plustop'.$n.'.gif','',1); - else $ref=img_picto('',DOL_URL_ROOT.'/theme/common/treemenu/minustop'.$n.'.gif','',1); - if ($option == 'indexexpanded') $lien = ''; - if ($option == 'indexnotexpanded') $lien = ''; - $newref=str_replace('_',' ',$ref); - $lienfin=''; - print $lien.$newref.$lienfin; - if (! in_array($val['id'],$expandedsectionarray)) print img_picto('','object_category'); - else print img_picto('','object_category-expanded'); - print ''; - //if ($section == $val['id']) print ' '; - // We don't want a link ... why ? - $categstatic->id=$val['id']; - $categstatic->ref=$val['label']; - $categstatic->type=$type; - print '  '.$categstatic->getNomUrl(0,'',60); - - //print '  '.dol_trunc($val['label'],28); - //if ($section == $val['id']) print ''; - print '
      '; - print "
      '; - print dol_trunc($val['description'],48); - print ''.img_view().''.img_edit_add().' 
      '; - print ''; - print ''; - print ''; - print '
      '.img_picto_common('','treemenu/branchbottom.gif').''.img_picto('',DOL_URL_ROOT.'/theme/common/treemenu/minustop3.gif','',1).''; - print $langs->trans("NoCategoryYet"); - print ' 
       
      '; + print ''; + print ''; + print '
      '.img_picto_common('','treemenu/branchbottom.gif').''; + print $langs->trans("NoCategoryYet"); + print ' 
      "; llxFooter(); + $db->close(); ?> diff --git a/htdocs/core/lib/treeview.lib.php b/htdocs/core/lib/treeview.lib.php index 65b2ca5d502..f565467575e 100644 --- a/htdocs/core/lib/treeview.lib.php +++ b/htdocs/core/lib/treeview.lib.php @@ -23,55 +23,7 @@ */ -// ------------------------------- Used by category tree view ----------------- - -/** - * Return if a child id is in descendance of parentid - * - * @param array $fulltree Full tree. Tree must be an array of records that looks like: - * id = id record - * id_mere = id record mother - * id_children = array of direct child id - * label = record label - * fullpath = Full path of id - * level = Level of record - * @param int $parentid Parent id - * @param int $childid Child id - * @return int 1=Yes, 0=No - */ -function is_in_subtree($fulltree,$parentid,$childid) -{ - if ($parentid == $childid) return 1; - - // Get fullpath of parent - $fullpathparent=''; - foreach($fulltree as $key => $val) - { - //print $val['id']."-".$section."
      "; - if ($val['id'] == $parentid) - { - $fullpathparent=$val['fullpath']; - break; - } - } - //print '> parent='.$parentid.' - child='.$childid.' - '.$fullpathparent.'
      '; - - foreach($fulltree as $record) - { - if ($record['id'] == $childid) - { - //print $record['fullpath'].'_'.' - '.$fullpathparent.'_'; - if (preg_match('/'.$fullpathparent.'_/i',$record['fullpath'].'_')) - { - //print 'DEL='.$childid; - return 1; - } - } - } - - return 0; -} - +// ------------------------------- Used by ajax tree view ----------------- /** * Show indent and picto of a tree line. Return array with information of line. @@ -145,11 +97,16 @@ function tree_showpad(&$fulltree,$key,$silent=0) // ------------------------------- Used by menu editor ----------------- /** - * Recursive function to output menu tree.
      • ...
      + * Recursive function to output menu tree.
      • ...
      + * Note: To have this function working, check you have loaded the js and css for treeview. + * $arrayofjs=array('/includes/jquery/plugins/jquerytreeview/jquery.treeview.js', + * '/includes/jquery/plugins/jquerytreeview/lib/jquery.cookie.js'); + * $arrayofcss=array('/includes/jquery/plugins/jquerytreeview/jquery.treeview.css'); * - * @param array $tab Array of all elements - * @param int $pere Array with parent ids ('rowid'=>,'mainmenu'=>,'leftmenu'=>,'fk_mainmenu=>,'fk_leftmenu=>) - * @param int $rang Level of element + * @param array $tab Array of all elements + * @param int $pere Array with parent ids ('rowid'=>,'mainmenu'=>,'leftmenu'=>,'fk_mainmenu=>,'fk_leftmenu=>) + * @param int $rang Level of element + * @param string $iddivjstree Id to use for parent ul element * @return void */ function tree_recur($tab, $pere, $rang, $iddivjstree='iddivjstree') @@ -162,13 +119,16 @@ function tree_recur($tab, $pere, $rang, $iddivjstree='iddivjstree') $("#'.$iddivjstree.'").treeview({ collapsed: true, animated: "fast", - persist: "location", - control: "#'.$iddivjstree.'control" + persist: "cookie", + control: "#'.$iddivjstree.'control", + toggle: function() { + /* window.console && console.log("%o was toggled", this); */ + } }); }) '; - print '
        '; + print '
          '; } if ($rang > 10) return; // Protection contre boucle infinie diff --git a/htdocs/includes/jquery/plugins/jquerytreeview/lib/jquery.cookie.js b/htdocs/includes/jquery/plugins/jquerytreeview/lib/jquery.cookie.js new file mode 100644 index 00000000000..8e8e1d9e01f --- /dev/null +++ b/htdocs/includes/jquery/plugins/jquerytreeview/lib/jquery.cookie.js @@ -0,0 +1,92 @@ +/** + * Cookie plugin + * + * Copyright (c) 2006 Klaus Hartl (stilbuero.de) + * Dual licensed under the MIT and GPL licenses: + * http://www.opensource.org/licenses/mit-license.php + * http://www.gnu.org/licenses/gpl.html + * + */ + +/** + * Create a cookie with the given name and value and other optional parameters. + * + * @example $.cookie('the_cookie', 'the_value'); + * @desc Set the value of a cookie. + * @example $.cookie('the_cookie', 'the_value', {expires: 7, path: '/', domain: 'jquery.com', secure: true}); + * @desc Create a cookie with all available options. + * @example $.cookie('the_cookie', 'the_value'); + * @desc Create a session cookie. + * @example $.cookie('the_cookie', null); + * @desc Delete a cookie by passing null as value. + * + * @param String name The name of the cookie. + * @param String value The value of the cookie. + * @param Object options An object literal containing key/value pairs to provide optional cookie attributes. + * @option Number|Date expires Either an integer specifying the expiration date from now on in days or a Date object. + * If a negative value is specified (e.g. a date in the past), the cookie will be deleted. + * If set to null or omitted, the cookie will be a session cookie and will not be retained + * when the the browser exits. + * @option String path The value of the path atribute of the cookie (default: path of page that created the cookie). + * @option String domain The value of the domain attribute of the cookie (default: domain of page that created the cookie). + * @option Boolean secure If true, the secure attribute of the cookie will be set and the cookie transmission will + * require a secure protocol (like HTTPS). + * @type undefined + * + * @name $.cookie + * @cat Plugins/Cookie + * @author Klaus Hartl/klaus.hartl@stilbuero.de + */ + +/** + * Get the value of a cookie with the given name. + * + * @example $.cookie('the_cookie'); + * @desc Get the value of a cookie. + * + * @param String name The name of the cookie. + * @return The value of the cookie. + * @type String + * + * @name $.cookie + * @cat Plugins/Cookie + * @author Klaus Hartl/klaus.hartl@stilbuero.de + */ +jQuery.cookie = function(name, value, options) { + if (typeof value != 'undefined') { // name and value given, set cookie + options = options || {}; + if (value === null) { + value = ''; + options.expires = -1; + } + var expires = ''; + if (options.expires && (typeof options.expires == 'number' || options.expires.toUTCString)) { + var date; + if (typeof options.expires == 'number') { + date = new Date(); + date.setTime(date.getTime() + (options.expires * 24 * 60 * 60 * 1000)); + } else { + date = options.expires; + } + expires = '; expires=' + date.toUTCString(); // use expires attribute, max-age is not supported by IE + } + var path = options.path ? '; path=' + options.path : ''; + var domain = options.domain ? '; domain=' + options.domain : ''; + var secure = options.secure ? '; secure' : ''; + document.cookie = [name, '=', encodeURIComponent(value), expires, path, domain, secure].join(''); + } else { // only name given, get cookie + var cookieValue = null; + if (document.cookie && document.cookie != '') { + var cookies = document.cookie.split(';'); + for (var i = 0; i < cookies.length; i++) { + var cookie = jQuery.trim(cookies[i]); + // Does this cookie string begin with the name we want? + if (cookie.substring(0, name.length + 1) == (name + '=')) { + cookieValue = decodeURIComponent(cookie.substring(name.length + 1)); + break; + } + } + } + return cookieValue; + } +}; \ No newline at end of file diff --git a/htdocs/install/mysql/migration/3.3.0-3.4.0.sql b/htdocs/install/mysql/migration/3.3.0-3.4.0.sql index f7fe723b9b6..cad2ac40bb4 100755 --- a/htdocs/install/mysql/migration/3.3.0-3.4.0.sql +++ b/htdocs/install/mysql/migration/3.3.0-3.4.0.sql @@ -44,4 +44,4 @@ alter table llx_extrafields add column param text after pos; alter table llx_propal CHANGE COLUMN fk_adresse_livraison fk_delivery_address integer; alter table llx_commande CHANGE COLUMN fk_adresse_livraison fk_delivery_address integer; alter table llx_don CHANGE COLUMN adresse address text; - +alter table llx_adherent CHANGE COLUMN adresse address text; diff --git a/htdocs/user/class/user.class.php b/htdocs/user/class/user.class.php index 59641c1bbc1..5569f1b6784 100644 --- a/htdocs/user/class/user.class.php +++ b/htdocs/user/class/user.class.php @@ -1785,7 +1785,7 @@ class User extends CommonObject /** * Retourne le libelle du statut d'un user (actif, inactif) * - * @param int $mode 0=libelle long, 1=libelle court, 2=Picto + Libelle court, 3=Picto, 4=Picto + Libelle long + * @param int $mode 0=libelle long, 1=libelle court, 2=Picto + Libelle court, 3=Picto, 4=Picto + Libelle long, 5=Libelle court + Picto * @return string Label of status */ function getLibStatut($mode=0) @@ -2191,7 +2191,7 @@ class User extends CommonObject $this->load_parentof(); // Init $this->users array - $sql = "SELECT DISTINCT u.rowid, u.firstname, u.name, u.fk_user"; // Distinct reduce pb with old tables with duplicates + $sql = "SELECT DISTINCT u.rowid, u.firstname, u.name, u.fk_user, u.login, u.statut"; // Distinct reduce pb with old tables with duplicates $sql.= " FROM ".MAIN_DB_PREFIX."user as u"; $sql.= " WHERE u.entity IN (".getEntity('user',1).")"; @@ -2204,9 +2204,11 @@ class User extends CommonObject { $this->users[$obj->rowid]['rowid'] = $obj->rowid; $this->users[$obj->rowid]['id'] = $obj->rowid; - $this->users[$obj->rowid]['fk_user'] = $obj->fk_parent; + $this->users[$obj->rowid]['fk_user'] = $obj->fk_user; $this->users[$obj->rowid]['firstname'] = $obj->firstname; $this->users[$obj->rowid]['name'] = $obj->name; + $this->users[$obj->rowid]['login'] = $obj->login; + $this->users[$obj->rowid]['statut'] = $obj->statut; $i++; } } @@ -2297,7 +2299,7 @@ class User extends CommonObject { print 'id: '.$this->users[$key]['id']; print ' name: '.$this->users[$key]['name']; - print ' parent: '.$this->users[$key]['fk_parent']; + print ' parent: '.$this->users[$key]['fk_user']; print ' fullpath: '.$this->users[$key]['fullpath']; print ' fullname: '.$this->users[$key]['fullname']; print "
          \n"; diff --git a/htdocs/user/hierarchy.php b/htdocs/user/hierarchy.php index f95d877859b..ad5584483fc 100644 --- a/htdocs/user/hierarchy.php +++ b/htdocs/user/hierarchy.php @@ -53,9 +53,12 @@ $companystatic = new Societe($db); $form = new Form($db); -llxHeader(); +$arrayofjs=array('/includes/jquery/plugins/jquerytreeview/jquery.treeview.js', '/includes/jquery/plugins/jquerytreeview/lib/jquery.cookie.js'); +$arrayofcss=array('/includes/jquery/plugins/jquerytreeview/jquery.treeview.css'); + +llxHeader('',$langs->trans("ListOfUsers"). ' ('.$langs->trans("HierarchicView").')','','',0,0,$arrayofjs,$arrayofcss); -print_fiche_titre($langs->trans("ListOfUsers"). ' ('.$langs->trans("HierarchicView").')', '
          '); +print_fiche_titre($langs->trans("ListOfUsers"). ' ('.$langs->trans("HierarchicView").')', '
          '); @@ -64,187 +67,55 @@ $user_arbo = $userstatic->get_full_tree(); // Define fulltree array $fulltree=$user_arbo; - -print ''; - - -// ----- This section will show a tree from a fulltree array ----- -// $section must also be defined -// --------------------------------------------------------------- - - -// Root title line -print ''; -print ''; -print ''; -//print ''; -print ''; - - - -// Define fullpathselected ( _x_y_z ) of $section parameter -$fullpathselected=''; -if (! empty($section)) + +// Define data (format for treeview) +$data=array(); +$data[] = array('rowid'=>0,'fk_menu'=>-1,'title'=>"racine",'mainmenu'=>'','leftmenu'=>'','fk_mainmenu'=>'','fk_leftmenu'=>''); +foreach($fulltree as $key => $val) { - foreach($fulltree as $key => $val) - { - //print $val['id']."-".$section."
          "; - if ($val['id'] == $section) - { - $fullpathselected=$val['fullpath']; - break; - } - } -} -//print "fullpathselected=".$fullpathselected."
          "; - -// Update expandedsectionarray in session -$expandedsectionarray=array(); -if (isset($_SESSION['dol_catexpandedsectionarray'.$type])) $expandedsectionarray=explode(',',$_SESSION['dol_catexpandedsectionarray'.$type]); - -if (! empty($section) && $_GET['sectionexpand'] == 'true') -{ - // We add all sections that are parent of opened section - $pathtosection=explode('_',$fullpathselected); - foreach($pathtosection as $idcursor) - { - if ($idcursor && ! in_array($idcursor,$expandedsectionarray)) // Not already in array - { - $expandedsectionarray[]=$idcursor; - } - } - $_SESSION['dol_catexpandedsectionarray'.$type]=join(',',$expandedsectionarray); -} -if (! empty($section) && $_GET['sectionexpand'] == 'false') -{ - // We removed all expanded sections that are child of the closed section - $oldexpandedsectionarray=$expandedsectionarray; - $expandedsectionarray=array(); - foreach($oldexpandedsectionarray as $sectioncursor) - { - // is_in_subtree(fulltree,sectionparent,sectionchild) - if ($sectioncursor && ! is_in_subtree($fulltree,$section,$sectioncursor)) $expandedsectionarray[]=$sectioncursor; - } - $_SESSION['dol_catexpandedsectionarray'.$type]=join(',',$expandedsectionarray); -} -//print $_SESSION['dol_catexpandedsectionarray'.$type].'
          '; - -$nbofentries=0; -$oldvallevel=0; -$var=true; -foreach($fulltree as $key => $val) -{ - //$fullpathparent=preg_replace('/_[^_]+$/i','',$val['fullpath']); - - // Define showline - $showline=0; - - //var_dump($expandedsectionarray); - - // If directory is son of expanded directory, we show line - if (isset($val['fk_parent']) && in_array($val['fk_parent'],$expandedsectionarray)) $showline=4; - // If directory is parent of selected directory or is selected directory, we show line - elseif (preg_match('/'.$val['fullpath'].'_/i',$fullpathselected.'_')) $showline=2; - // If we are level one we show line - elseif ($val['level'] < 2) $showline=1; - //print 'xxx '.$val['level'].' - '.$fullpathselected.' - '.$val['fullpath'].' - '.$val['fk_parent'].' showline='.$showline.'
          '."\n"; - - if ($showline) - { - $var=!$var; - - if (in_array($val['id'],$expandedsectionarray)) $option='indexexpanded'; - else $option='indexnotexpanded'; - //print $option; - - print ""; - - // Show tree graph pictos - print '\n"; - - // Description - print ''; - - // Link to category card - print ''; - - // Add link - //print ''; - //print ''; - - print "\n"; - } - - $oldvallevel=$val['level']; - $nbofentries++; -} - - -// If nothing to show -if ($nbofentries == 0) -{ - print ''; - print ''; - print ''; - print ''; -} - -// ----- End of section ----- -// -------------------------- - + $userstatic->id=$val['id']; + $userstatic->ref=$val['label']; + $userstatic->firstname=$val['firstname']; + $userstatic->lastname=$val['name']; + $userstatic->statut=$val['statut']; + $li=$userstatic->getNomUrl(1,'').' ('.$val['login'].')'; + + $data[] = array( + 'rowid'=>$val['rowid'], + 'fk_menu'=>$val['fk_user'], + 'entry'=>'
          '; -print ''; -print ''; -print '
          '; -print img_picto_common('','treemenu/base.gif'); -print ''.$langs->trans("All"); -print '
             
          '; - print ''; - - // Show picto - print ''; - // Show link - print ''; - print '
          '; - $resarray=tree_showpad($fulltree,$key); - $a=$resarray[0]; - $nbofsubdir=$resarray[1]; - $nboffilesinsubdir=$resarray[2]; - print ''; - //print $val['fullpath']."(".$showline.")"; - $n='2'; - if (! in_array($val['id'],$expandedsectionarray)) $n='3'; - if (! in_array($val['id'],$expandedsectionarray)) $ref=img_picto('',DOL_URL_ROOT.'/theme/common/treemenu/plustop'.$n.'.gif','',1); - else $ref=img_picto('',DOL_URL_ROOT.'/theme/common/treemenu/minustop'.$n.'.gif','',1); - if ($option == 'indexexpanded') $lien = ''; - if ($option == 'indexnotexpanded') $lien = ''; - $newref=str_replace('_',' ',$ref); - $lienfin=''; - print $lien.$newref.$lienfin; - if (! in_array($val['id'],$expandedsectionarray)) print img_picto('','object_category'); - else print img_picto('','object_category-expanded'); - print ''; - //if ($section == $val['id']) print ' '; - // We don't want a link ... why ? - $userstatic->id=$val['id']; - $userstatic->ref=$val['label']; - $userstatic->type=$type; - print '  '.$userstatic->getNomUrl(0,'',60); - - //print '  '.dol_trunc($val['label'],28); - //if ($section == $val['id']) print ''; - print '
          '; - print "
          '; - print dol_trunc($val['description'],48); - print ''.img_view().''.img_edit_add().' 
          '; - print ''; - print ''; - print ''; - print '
          '.img_picto_common('','treemenu/branchbottom.gif').''.img_picto('',DOL_URL_ROOT.'/theme/common/treemenu/minustop3.gif','',1).''; - print $langs->trans("NoCategoryYet"); - print ' 
           
          '.$li.''.$userstatic->getLibStatut(5).'
          ' + ); +} + + +print ''; +print ''; + +$nbofentries=(count($data) - 1); + +if ($nbofentries > 0) +{ + print ''; +} +else +{ + print ''; + print ''; + print ''; +} + print "
          '.$langs->trans("HierarchicView").'
          '; + tree_recur($data,$data[0],0); + print '
          '; + print ''; + print ''; + print '
          '.img_picto_common('','treemenu/branchbottom.gif').''; + print $langs->trans("NoCategoryYet"); + print ' 
          "; llxFooter(); + $db->close(); ?> From af26c4ce6dbea4be2c291f0e5f58fe1ea51954db Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Wed, 20 Feb 2013 21:41:50 +0100 Subject: [PATCH 4/5] Fix: Missing translation --- htdocs/comm/action/index.php | 1 + htdocs/comm/action/rapport/index.php | 3 ++- 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/htdocs/comm/action/index.php b/htdocs/comm/action/index.php index 2dc15e536a1..de55231f101 100644 --- a/htdocs/comm/action/index.php +++ b/htdocs/comm/action/index.php @@ -88,6 +88,7 @@ if (GETPOST('viewday')) { $action='show_day'; $day=($day?$day:date("d")); } // View by day +$langs->load("agenda"); $langs->load("other"); $langs->load("commercial"); diff --git a/htdocs/comm/action/rapport/index.php b/htdocs/comm/action/rapport/index.php index 60597db8c59..514a99cb6a7 100644 --- a/htdocs/comm/action/rapport/index.php +++ b/htdocs/comm/action/rapport/index.php @@ -30,7 +30,8 @@ require_once DOL_DOCUMENT_ROOT.'/contact/class/contact.class.php'; require_once DOL_DOCUMENT_ROOT.'/comm/action/class/actioncomm.class.php'; require_once DOL_DOCUMENT_ROOT.'/core/modules/action/rapport.pdf.php'; -$langs->load("commercial"); +$langs->load("agenda"); +$langs->load("commercial"); $action=GETPOST('action','alpha'); $month=GETPOST('month'); From 66ca0ba0e26ea10743b86dd825c0cb692dc3481f Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Wed, 20 Feb 2013 21:58:13 +0100 Subject: [PATCH 5/5] Fix: alignement --- htdocs/comm/action/rapport/index.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/htdocs/comm/action/rapport/index.php b/htdocs/comm/action/rapport/index.php index 514a99cb6a7..9d82fb21ab9 100644 --- a/htdocs/comm/action/rapport/index.php +++ b/htdocs/comm/action/rapport/index.php @@ -104,7 +104,7 @@ if ($resql) print '
'.$langs->trans("Date").''.$langs->trans("EventsNb").''.$langs->trans("Action").''.$langs->trans("Action").''.$langs->trans("PDF").''.$langs->trans("Date").''.$langs->trans("Size").'".$obj->df."'.$obj->cc.''; + print ''; print 'month.'&year='.$obj->year.'">'.img_picto($langs->trans('GenerateReport'),'filenew').''; print '