]> _ Git - cubeextranet.git/commitdiff
(no commit message)
authorvincent@cubedesigners.com <vincent@cubedesigners.com@f5622870-0f3c-0410-866d-9cb505b7a8ef>
Fri, 15 Feb 2013 15:52:30 +0000 (15:52 +0000)
committervincent@cubedesigners.com <vincent@cubedesigners.com@f5622870-0f3c-0410-866d-9cb505b7a8ef>
Fri, 15 Feb 2013 15:52:30 +0000 (15:52 +0000)
images/ws/online-offline.png [new file with mode: 0644]
inc/ws/Controlleur/class.ws.url.php
inc/ws/DAO/class.ws.dao.collection.php
js/common.js
js/extranet.js
js/ws.js
style/ws/style.css

diff --git a/images/ws/online-offline.png b/images/ws/online-offline.png
new file mode 100644 (file)
index 0000000..36d1b56
Binary files /dev/null and b/images/ws/online-offline.png differ
index bfec654c94acb981fb32dc8914324d441542eb54..bb7fd0c6fd00bebcfcf5df2dd21fb38b231b6622 100644 (file)
@@ -206,14 +206,14 @@ class wsUrl {
        public static function collection($args) {\r
                global $core;\r
                commonDroits::min(1);\r
+               cubePage::ui('Sortable');\r
+               //cubePage::checkbox();\r
 \r
                $dao = new wsDAOCollection($core->con);\r
                $collection = $dao->selectById($args[1]);\r
 \r
-\r
                $shortcuts = array();\r
-               $shortcuts[] = '<div class="label">Gestion de la collection &laquo; ' . $collection->nom . ' &raquo; <em># ' . $collection->collection_id . '</em></div>';\r
-               $shortcuts[] = '<a href="#">' . $core->typo->Ajouter('Nouveau groupe') . '</a>';\r
+               $shortcuts[] = '<a href="#" id="newGroup">' . $core->typo->Ajouter('Nouveau groupe') . '</a>';\r
 \r
                $res = commonPage::barre(null, null, null, $shortcuts);\r
                $res .= commonPage::tMain();\r
@@ -229,28 +229,49 @@ class wsUrl {
        public static function collectionEdit($collection) {\r
                global $core;\r
 \r
-               $res = '';\r
+               $res = '<ul>';\r
+               $res.='<h1>Gestion de la collection &laquo; ' . $collection->nom . ' &raquo; <em># ' . $collection->collection_id . '</em></h1>';\r
 \r
                $dao = new wsDAOCollection($core->con);\r
                $books = $dao->getPublications($collection->collection_id);\r
 \r
-               foreach ($collection->datas as $gid => $group) {\r
-                       $res.='<div class="group">';\r
+               $datas = $collection->datas;\r
+               $datas['new_'] = $dao->_emptyGroup();\r
+\r
+               foreach ($datas as $gid => $group) {\r
+                       $class = 'group';\r
+                       if ($gid == 'new_') {\r
+                               $class.=' empty';\r
+                       }\r
+                       $res.='<li class="group">';\r
                        $res.='<div class="g">';\r
+                       $res.='<a href="#" class="move"></a>';\r
                        $g = 'group[' . $gid . ']';\r
                        $res.=__('Nom du groupe') . ' ' . form::field(array($g . '[label]'), 20, 64, $group['label']);\r
                        $res.='</div>';\r
+                       $res.='<ul>';\r
                        foreach ($group['publications'] as $pid => $publication) {\r
                                $p = $g . '[publication][' . $pid . ']';\r
-                               $res.='<div class="publication">';\r
-                               $book = $books[$publication['id']];\r
-                               $res.=mb_strtoupper($book['lang']);\r
+                               $res.='<li class="publication"><div>';\r
+                               if (isset($books[$publication['id']])) {\r
+                                       $book = $books[$publication['id']];\r
+                               } else {\r
+                                       $book = new stdClass();\r
+                                       $book->lang = '';\r
+                               }\r
+                               $res.='<a href="#" class="move"></a>';\r
+                               $res.=mb_strtoupper($book->lang);\r
                                $res.='<span class="id"># ' . form::field($p . '[id]', 20, 64, $publication['id']) . '</span>';\r
                                $res.='<span class="label">' . __('Label') . ' ' . form::field($p . '[label]', 20, 64, $publication['label']) . '</span>';\r
-                               $res.='</div>';\r
+                               $res.='<a href="#" class="delete"></a>';\r
+                               $res.='<a href="#" class="add"></a>';\r
+                               $res.='<span class="online">' . form::checkbox($p . '[online]', '1', $publication['online']) . '</span>';\r
+                               $res.='</div></li>';\r
                        }\r
-                       $res.='</div>';\r
+                       $res.='</ul>';\r
+                       $res.='</li>';\r
                }\r
+               $res.='</ul>';\r
                return $res;\r
        }\r
 \r
index b85710ec5db7aac0503170ce98c2a0221a1941a7..d8080918e9ba9fec260a6d34da6d1b929889119e 100644 (file)
@@ -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'];
                                }
                        }
                }
index 9fafe7fc2b91177bebeb59b221fbc256a1443642..b56a7c697ef2d7d9b3ae815e57e14ee273a9c393 100644 (file)
@@ -15,7 +15,11 @@ function load_common_extranet() {
        $('meta[name="viewport"]').attr('content', 'width=' + viewportWidth + 'px,initial-scale=' + is + ',maximum-scale:2.0');\r
 \r
        if ($(".dashboard").length >= 1 && $("#dash").length >= 1) {\r
-               $("#dash").sortable('destroy');\r
+               try {\r
+                       $("#dash").sortable('destroy');\r
+               } catch (err) {\r
+\r
+               }\r
                if (FIRST_LOAD) {\r
                        FIRST_LOAD = false;\r
                } else {\r
index f460d6f000c9c81cf306d423db76a33022c52403..f5beba03bbae7393ac75465e2167a2ec5b9ee8f6 100644 (file)
@@ -1,62 +1,69 @@
-TO_LOAD[TO_LOAD.length]='load_extranet();';\r
-FIRST_LOAD=true;\r
-function load_extranet(){\r
-\r
-       if($("#devisAdresse #client_nom").length>0){\r
-               $("#devisAdresse #client_nom").autocomplete(SITE_PATH+'autocomplete/client',{\r
-                       cacheLength             :       0,\r
-                       maxItemsToShow  :       15,\r
-                       onFindValue             :       findClient,\r
-                       onItemSelect    :       findClient\r
+TO_LOAD[TO_LOAD.length] = 'load_extranet();';\r
+FIRST_LOAD = true;\r
+function load_extranet() {\r
+\r
+       if ($("#devisAdresse #client_nom").length > 0) {\r
+               $("#devisAdresse #client_nom").autocomplete(SITE_PATH + 'autocomplete/client', {\r
+                       cacheLength: 0,\r
+                       maxItemsToShow: 15,\r
+                       onFindValue: findClient,\r
+                       onItemSelect: findClient\r
                });\r
        }\r
 \r
 \r
-       if($("#factureAdresse #projet_nom").length>0){\r
-               $("#factureAdresse #projet_nom").autocomplete(SITE_PATH+'autocomplete/projet',{\r
-                       cacheLength             :       0,\r
-                       maxItemsToShow  :       15,\r
-                       onFindValue             :       findProjet,\r
-                       onItemSelect    :       findProjet\r
+       if ($("#factureAdresse #projet_nom").length > 0) {\r
+               $("#factureAdresse #projet_nom").autocomplete(SITE_PATH + 'autocomplete/projet', {\r
+                       cacheLength: 0,\r
+                       maxItemsToShow: 15,\r
+                       onFindValue: findProjet,\r
+                       onItemSelect: findProjet\r
                });\r
        }\r
 \r
 \r
-       if($("#devisLignes").length>=1){\r
-               $("#devisLignes").sortable('destroy');\r
+       if ($("#devisLignes").length >= 1) {\r
+               try {\r
+                       $("#devisLignes").sortable('destroy');\r
+               } catch (err) {\r
+               }\r
 \r
                $("#devisLignes").sortable({\r
-                       opacity :       0.6,\r
-                       axis    :       "y"\r
+                       opacity: 0.6,\r
+                       axis: "y"\r
                });\r
        }\r
 }\r
 \r
-function findClient(li){\r
-       var client=li.selectValue.split(' - ');\r
-       if(client.length<=1){\r
+function findClient(li) {\r
+       var client = li.selectValue.split(' - ');\r
+       if (client.length <= 1) {\r
                return;\r
        }\r
-       var client_id=parseInt(client[0]);\r
+       var client_id = parseInt(client[0]);\r
        $("#client").val(client_id);\r
 \r
        $.ajax({\r
-               url             :       SITE_PATH+'ajax/getAdresseForDevis/'+client_id,\r
-               success :       function(data){MyAjax(data);}\r
+               url: SITE_PATH + 'ajax/getAdresseForDevis/' + client_id,\r
+               success: function(data) {\r
+                       MyAjax(data);\r
+               }\r
        });\r
 }\r
 \r
-function findProjet(li){\r
-       var projet=li.selectValue.split(' - ');\r
-       if(projet.length<=1){\r
+function findProjet(li) {\r
+       var projet = li.selectValue.split(' - ');\r
+       if (projet.length <= 1) {\r
                return;\r
        }\r
-       var projet_id=parseInt(projet[0]);\r
+       var projet_id = parseInt(projet[0]);\r
        $("#projet").val(projet_id);\r
 \r
        $.ajax({\r
-               url             :       SITE_PATH+'ajax/getAdresseForFacture/'+projet_id,\r
-               success :       function(data){MyAjax(data);}\r
+               url: SITE_PATH + 'ajax/getAdresseForFacture/' + projet_id,\r
+               success: function(data) {\r
+                       MyAjax(data);\r
+               }\r
        });\r
 }\r
 \r
index e11bb427146adb330302f358923d768b6e055d30..a1c76a2b941791322b8ce50bfbea3fc455340b3a 100644 (file)
--- 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;\r
 \r
 function load_ws_once() {\r
-       $('form[action="exportbook"] select, form[action="exportbookExe"] select').live('change', function() {\r
+       $('form[action="exportbook"] select, form[action="exportbookExe"] select').on('change', function() {\r
                var form = $(this).parents('form');\r
                $(form).find('#changed').val($(this).attr('name'));\r
                $(form).attr('action', 'exportbook').submit().attr('action', 'exportbookExe');\r
        });\r
+\r
+       if ($("#collection").length > 0) {\r
+               $("#collection>ul").sortable({\r
+                       cancel: 'h3,input',\r
+                       axis: 'y',\r
+                       handle: '.move'\r
+               });\r
+\r
+               $("#collection>ul ul").sortable({\r
+                       cancel: 'h3,input',\r
+                       axis: 'y',\r
+                       handle: '.move',\r
+                       connectWith: '#collection>ul ul'\r
+               });\r
+       }\r
 }\r
 \r
 function load_ws() {\r
index 9818fb1814bf0390b4b88d9f662aa6a27a2f7d36..b68df448628ba937266292dbba4e0424299f69ee 100644 (file)
@@ -537,7 +537,7 @@ th.stats_col{
        font-family: UniversCondensedBold;\r
        text-decoration: none;\r
        text-transform: uppercase;\r
-        white-space: nowrap;\r
+       white-space: nowrap;\r
 \r
 \r
        -moz-box-shadow: 0px 0px 2px rgba(0,0,0,0.25);\r
@@ -582,4 +582,76 @@ th.stats_col{
 \r
 .liste .bouton a.btbook.edit>div{\r
        background-image: url("../../images/ws/btedit.png");\r
+}\r
+\r
+\r
+\r
+\r
+/* Page tree */\r
+\r
+#collection{\r
+       padding:5px;\r
+}\r
+\r
+#collection h1{\r
+       margin:5px 0 10px;\r
+       padding:0;\r
+}\r
+\r
+#collection h3{margin:10px 0 10px 0 !important;}\r
+#collection .group,\r
+#collection .publication{\r
+       padding:5px;border:1px solid #ccc;margin:2px 0;background-color:#eee;\r
+}\r
+\r
+#collection .publication{\r
+       background-color:#fff;\r
+}\r
+\r
+#collection ul{\r
+       list-style: none;\r
+}\r
+\r
+#collection div{\r
+       height:20px;\r
+}\r
+\r
+#collection div span,\r
+#collection div a{\r
+       display:block;\r
+       height:16px;\r
+       float:left;\r
+}\r
+\r
+#collection div .move,\r
+#collection div .add,\r
+#collection div .delete\r
+{\r
+       width:16px;\r
+}\r
+\r
+\r
+#collection div img{vertical-align:bottom;}\r
+#collection div .move{margin-right:10px;background-image: url("/images/ws/tango16/actions/mail-send-receive.png")}\r
+#collection div .add{float:right;margin-right:10px;background-image: url("/images/ws/tango16/actions/list-add.png")}\r
+#collection div .online{float:right;margin-right:10px;}\r
+#collection div .online .checkbox{\r
+       background-image:url("/CubeIT/images/online-offline.png");\r
+       background-repeat: no-repeat;\r
+       background-position: 0 100%;\r
+       width:16px;\r
+       height:16px;\r
+       cursor:pointer;\r
+}\r
+#collection div .online .checkbox[checked]{\r
+       background-position: 0 0;\r
+}\r
+\r
+#collection div .delete{float:right;margin-right:10px;background-image: url("/images/ws/tango16/actions/list-remove.png")}\r
+#collection div .id{font-weight:bold;margin-right:10px;}\r
+#collection div .name{margin-right:10px;}\r
+\r
+#collection input,\r
+#collection select{\r
+       width:auto;\r
 }
\ No newline at end of file