From d648171dbc76268e39233384155e867023979503 Mon Sep 17 00:00:00 2001 From: "vincent@cubedesigners.com" Date: Fri, 15 Feb 2013 15:52:30 +0000 Subject: [PATCH] --- images/ws/online-offline.png | Bin 0 -> 2069 bytes inc/ws/Controlleur/class.ws.url.php | 43 ++++++++++---- inc/ws/DAO/class.ws.dao.collection.php | 6 +- js/common.js | 6 +- js/extranet.js | 71 +++++++++++++----------- js/ws.js | 17 +++++- style/ws/style.css | 74 ++++++++++++++++++++++++- 7 files changed, 168 insertions(+), 49 deletions(-) create mode 100644 images/ws/online-offline.png diff --git a/images/ws/online-offline.png b/images/ws/online-offline.png new file mode 100644 index 0000000000000000000000000000000000000000..36d1b56cf597d6229a29773dc7353fb8652a7038 GIT binary patch literal 2069 zcmaJ?dpJ~iAD<+}lw*W0=H@nx8DeHItz%uL62h1{%rs`sm^sW$ZoS365p6}R zNEddt7VA}dw+nemi{5sljm>3OLTP2Ao0j4|)24m@c)jO&&iP%Q&*$^KeV*s!1PA#W z8mu+IU@(T909GivnxHSRLJ$2~=DfL$E^82WI1&cOBTAke!uSZ_I0)cKcnMG_#1p8K zIv_d*vlI|kj954M4lEyR7qqg8-t;Ht7JUB7(#$JC_yA;;GbPV6%GaiOjr&9u0%3{Pj({%ZWJQL*@a4_Is#5)3YkQ9B2kRi2q=P}P)iY>iXc_kE-0`d z1z#?bAtG1`Xcc*Ja5BQcqnZ9$f<*RFR;u{WCbVHB6;DQ@5Xst-7Jwl5|Dh7eN3;S7 zh5pL-e+nzOY8gZdg%ohIoR1DJ-c}n*Mq|n$9sIkVke z-50nln4c_xq{sqS@E4c8C|7F)i42X*g5;tUNZ==jCBXZFX`;n*@m*B!16QzkF3d%_ zBs3Y4cC7z3=7lTNJKF6>)1rruwuhvs*X5|GyD)8j7>w>A4$FtD>Z{~N1{V68&du#s z*5D61t{s5PZ0>y?$EtHVzWLP-QtU>%x_q<1aV%$;iHn|%72_<$k=uT<*BG?6Ha{k!iKWY>IuS@|F4MWc6%X&t?pDUZ?y%U+yxt}yweJia=- zL8eKLDdLSefMMKkW(r(vR&G6r(f!s!qkgqF>9d%Ird8I>{mR!xRaYa%eR{s17@r23 z>v|$i_1JehrC}SxCMp7v*TuM{`Jb)`8qBytKUhRcdxIk z+2%hj+;aWd4DmMalvJH?j^Y>GRqq+*`cl&}5~uv9*z?4JrWOO4g(8;Jys^)>=Dn`VzEjku~bX-=#CG+`n1#i9? z=4ZVUVI2b=Jpbj;n0i2(^CYM*>p|;A|K)=XdbDop^x*!~$Fh_v!b;yJ;jCEcd0X>?nWarPGVdstldc%IbQ~TY3Q2o6>px~xef68{i-kRSx>&d+^DYayc1XV#*()KNw|}Y^om^2!*jAX zVEBU4=Ww2J!!GiZ4cJJ|=C7Is4s89&9Dzipjp&y3N`J144cP2JNyvZ;N;Lr0ce z-E%v8^)W*W9`;V0c~gK7eZCr-igmn<95FYzXfGX19?F9&n7Fw>bPu16nyRmskMh{a*8{UVdi)B^V{{ z`jv~teZ3^4J92}OHLwSEI8koD*3!13GAobYcF@=6?DNKs?SOX?R#GgRIs1VZKN z)uFAUXG=x|xg(DYdItiJnm^wtmzjg=P|?a2;raHNF6^TrS(mR9?cgovQZWy^R4z3h z;2S}|B3jsZfSh*5KP@HV7GCF&?i%UOxluoMmx+1ypIivjt)FF5{*jmAp_AeNrLOE| j?!`&Z^-T`?b7rxaLxjt8ilJs!`=jQtgIM4C#_scon); $collection = $dao->selectById($args[1]); - $shortcuts = array(); - $shortcuts[] = '
Gestion de la collection « ' . $collection->nom . ' » # ' . $collection->collection_id . '
'; - $shortcuts[] = '' . $core->typo->Ajouter('Nouveau groupe') . ''; + $shortcuts[] = '' . $core->typo->Ajouter('Nouveau groupe') . ''; $res = commonPage::barre(null, null, null, $shortcuts); $res .= commonPage::tMain(); @@ -229,28 +229,49 @@ class wsUrl { public static function collectionEdit($collection) { global $core; - $res = ''; + $res = '
    '; + $res.='

    Gestion de la collection « ' . $collection->nom . ' » # ' . $collection->collection_id . '

    '; $dao = new wsDAOCollection($core->con); $books = $dao->getPublications($collection->collection_id); - foreach ($collection->datas as $gid => $group) { - $res.='
    '; + $datas = $collection->datas; + $datas['new_'] = $dao->_emptyGroup(); + + foreach ($datas as $gid => $group) { + $class = 'group'; + if ($gid == 'new_') { + $class.=' empty'; + } + $res.='
  • '; $res.='
    '; + $res.=''; $g = 'group[' . $gid . ']'; $res.=__('Nom du groupe') . ' ' . form::field(array($g . '[label]'), 20, 64, $group['label']); $res.='
    '; + $res.='
      '; foreach ($group['publications'] as $pid => $publication) { $p = $g . '[publication][' . $pid . ']'; - $res.='
      '; - $book = $books[$publication['id']]; - $res.=mb_strtoupper($book['lang']); + $res.='
    • '; + if (isset($books[$publication['id']])) { + $book = $books[$publication['id']]; + } else { + $book = new stdClass(); + $book->lang = ''; + } + $res.=''; + $res.=mb_strtoupper($book->lang); $res.='# ' . form::field($p . '[id]', 20, 64, $publication['id']) . ''; $res.='' . __('Label') . ' ' . form::field($p . '[label]', 20, 64, $publication['label']) . ''; - $res.='
      '; + $res.=''; + $res.=''; + $res.='' . form::checkbox($p . '[online]', '1', $publication['online']) . ''; + $res.='
    • '; } - $res.='
  • '; + $res.='
'; + $res.=''; } + $res.=''; return $res; } diff --git a/inc/ws/DAO/class.ws.dao.collection.php b/inc/ws/DAO/class.ws.dao.collection.php index b85710ec5..d8080918e 100644 --- a/inc/ws/DAO/class.ws.dao.collection.php +++ b/inc/ws/DAO/class.ws.dao.collection.php @@ -30,7 +30,7 @@ class wsDAOCollection extends commonDAO { return array($this->_emptyGroup()); } - protected function _emptyGroup() { + public function _emptyGroup() { return array('label' => '', 'publications' => array($this->_emptyPublication())); } @@ -109,8 +109,8 @@ class wsDAOCollection extends commonDAO { $ids = array(); foreach ($collection->datas as $group) { foreach ($group['publications'] as $publication) { - if ($publication->id != '') { - $ids[] = $publication->id; + if ($publication['id'] != '') { + $ids[] = $publication['id']; } } } diff --git a/js/common.js b/js/common.js index 9fafe7fc2..b56a7c697 100644 --- a/js/common.js +++ b/js/common.js @@ -15,7 +15,11 @@ function load_common_extranet() { $('meta[name="viewport"]').attr('content', 'width=' + viewportWidth + 'px,initial-scale=' + is + ',maximum-scale:2.0'); if ($(".dashboard").length >= 1 && $("#dash").length >= 1) { - $("#dash").sortable('destroy'); + try { + $("#dash").sortable('destroy'); + } catch (err) { + + } if (FIRST_LOAD) { FIRST_LOAD = false; } else { diff --git a/js/extranet.js b/js/extranet.js index f460d6f00..f5beba03b 100644 --- a/js/extranet.js +++ b/js/extranet.js @@ -1,62 +1,69 @@ -TO_LOAD[TO_LOAD.length]='load_extranet();'; -FIRST_LOAD=true; -function load_extranet(){ - - if($("#devisAdresse #client_nom").length>0){ - $("#devisAdresse #client_nom").autocomplete(SITE_PATH+'autocomplete/client',{ - cacheLength : 0, - maxItemsToShow : 15, - onFindValue : findClient, - onItemSelect : findClient +TO_LOAD[TO_LOAD.length] = 'load_extranet();'; +FIRST_LOAD = true; +function load_extranet() { + + if ($("#devisAdresse #client_nom").length > 0) { + $("#devisAdresse #client_nom").autocomplete(SITE_PATH + 'autocomplete/client', { + cacheLength: 0, + maxItemsToShow: 15, + onFindValue: findClient, + onItemSelect: findClient }); } - if($("#factureAdresse #projet_nom").length>0){ - $("#factureAdresse #projet_nom").autocomplete(SITE_PATH+'autocomplete/projet',{ - cacheLength : 0, - maxItemsToShow : 15, - onFindValue : findProjet, - onItemSelect : findProjet + if ($("#factureAdresse #projet_nom").length > 0) { + $("#factureAdresse #projet_nom").autocomplete(SITE_PATH + 'autocomplete/projet', { + cacheLength: 0, + maxItemsToShow: 15, + onFindValue: findProjet, + onItemSelect: findProjet }); } - if($("#devisLignes").length>=1){ - $("#devisLignes").sortable('destroy'); + if ($("#devisLignes").length >= 1) { + try { + $("#devisLignes").sortable('destroy'); + } catch (err) { + } $("#devisLignes").sortable({ - opacity : 0.6, - axis : "y" + opacity: 0.6, + axis: "y" }); } } -function findClient(li){ - var client=li.selectValue.split(' - '); - if(client.length<=1){ +function findClient(li) { + var client = li.selectValue.split(' - '); + if (client.length <= 1) { return; } - var client_id=parseInt(client[0]); + var client_id = parseInt(client[0]); $("#client").val(client_id); $.ajax({ - url : SITE_PATH+'ajax/getAdresseForDevis/'+client_id, - success : function(data){MyAjax(data);} + url: SITE_PATH + 'ajax/getAdresseForDevis/' + client_id, + success: function(data) { + MyAjax(data); + } }); } -function findProjet(li){ - var projet=li.selectValue.split(' - '); - if(projet.length<=1){ +function findProjet(li) { + var projet = li.selectValue.split(' - '); + if (projet.length <= 1) { return; } - var projet_id=parseInt(projet[0]); + var projet_id = parseInt(projet[0]); $("#projet").val(projet_id); $.ajax({ - url : SITE_PATH+'ajax/getAdresseForFacture/'+projet_id, - success : function(data){MyAjax(data);} + url: SITE_PATH + 'ajax/getAdresseForFacture/' + projet_id, + success: function(data) { + MyAjax(data); + } }); } diff --git a/js/ws.js b/js/ws.js index e11bb4271..a1c76a2b9 100644 --- a/js/ws.js +++ b/js/ws.js @@ -3,11 +3,26 @@ TO_LOAD_ONCE[TO_LOAD_ONCE.length] = 'load_ws_once();'; FIRST_LOAD = true; function load_ws_once() { - $('form[action="exportbook"] select, form[action="exportbookExe"] select').live('change', function() { + $('form[action="exportbook"] select, form[action="exportbookExe"] select').on('change', function() { var form = $(this).parents('form'); $(form).find('#changed').val($(this).attr('name')); $(form).attr('action', 'exportbook').submit().attr('action', 'exportbookExe'); }); + + if ($("#collection").length > 0) { + $("#collection>ul").sortable({ + cancel: 'h3,input', + axis: 'y', + handle: '.move' + }); + + $("#collection>ul ul").sortable({ + cancel: 'h3,input', + axis: 'y', + handle: '.move', + connectWith: '#collection>ul ul' + }); + } } function load_ws() { diff --git a/style/ws/style.css b/style/ws/style.css index 9818fb181..b68df4486 100644 --- a/style/ws/style.css +++ b/style/ws/style.css @@ -537,7 +537,7 @@ th.stats_col{ font-family: UniversCondensedBold; text-decoration: none; text-transform: uppercase; - white-space: nowrap; + white-space: nowrap; -moz-box-shadow: 0px 0px 2px rgba(0,0,0,0.25); @@ -582,4 +582,76 @@ th.stats_col{ .liste .bouton a.btbook.edit>div{ background-image: url("../../images/ws/btedit.png"); +} + + + + +/* Page tree */ + +#collection{ + padding:5px; +} + +#collection h1{ + margin:5px 0 10px; + padding:0; +} + +#collection h3{margin:10px 0 10px 0 !important;} +#collection .group, +#collection .publication{ + padding:5px;border:1px solid #ccc;margin:2px 0;background-color:#eee; +} + +#collection .publication{ + background-color:#fff; +} + +#collection ul{ + list-style: none; +} + +#collection div{ + height:20px; +} + +#collection div span, +#collection div a{ + display:block; + height:16px; + float:left; +} + +#collection div .move, +#collection div .add, +#collection div .delete +{ + width:16px; +} + + +#collection div img{vertical-align:bottom;} +#collection div .move{margin-right:10px;background-image: url("/images/ws/tango16/actions/mail-send-receive.png")} +#collection div .add{float:right;margin-right:10px;background-image: url("/images/ws/tango16/actions/list-add.png")} +#collection div .online{float:right;margin-right:10px;} +#collection div .online .checkbox{ + background-image:url("/CubeIT/images/online-offline.png"); + background-repeat: no-repeat; + background-position: 0 100%; + width:16px; + height:16px; + cursor:pointer; +} +#collection div .online .checkbox[checked]{ + background-position: 0 0; +} + +#collection div .delete{float:right;margin-right:10px;background-image: url("/images/ws/tango16/actions/list-remove.png")} +#collection div .id{font-weight:bold;margin-right:10px;} +#collection div .name{margin-right:10px;} + +#collection input, +#collection select{ + width:auto; } \ No newline at end of file -- 2.39.5