]> _ Git - cubeextranet.git/commitdiff
(no commit message)
authorvincent@cubedesigners.com <vincent@cubedesigners.com@f5622870-0f3c-0410-866d-9cb505b7a8ef>
Thu, 10 Feb 2011 10:11:39 +0000 (10:11 +0000)
committervincent@cubedesigners.com <vincent@cubedesigners.com@f5622870-0f3c-0410-866d-9cb505b7a8ef>
Thu, 10 Feb 2011 10:11:39 +0000 (10:11 +0000)
inc/commons/class.common.url.php
inc/ws/Controlleur/_common.php
inc/ws/Controlleur/class.ws.ajax.php
inc/ws/Controlleur/class.ws.url.php
inc/ws/Controlleur/url/_common.php [new file with mode: 0644]
inc/ws/Controlleur/url/class.ws.url.book.php [new file with mode: 0644]
inc/ws/Controlleur/url/class.ws.url.client.php [new file with mode: 0644]
inc/ws/Controlleur/url/class.ws.url.demande.php [new file with mode: 0644]
inc/ws/Controlleur/url/class.ws.url.traduction.php [new file with mode: 0644]
inc/ws/DAO/class.ws.dao.demande.php

index d4330f27ce24e3fe8872d19e76917e65810d4152..4379c058b8c696b533454c2a571604b928a315a2 100644 (file)
@@ -3,6 +3,8 @@ class commonUrl {
        public static function hub($args)\r
        {\r
                global $core;\r
+               global $urlClasses;\r
+\r
                $args = cubePage::getArgs($args);\r
                // Si l'utilisateur n'est pas connecté, on affiche le formulaire\r
                // de login\r
@@ -28,7 +30,7 @@ class commonUrl {
 \r
                $f = $args[0];\r
 \r
-               $classes = array(MODE . 'Url', 'commonUrl');\r
+               $classes = array_merge(array(MODE . 'Url', 'commonUrl'),array_keys($urlClasses));\r
 \r
                echo commonPage::header($args);\r
 \r
index 551049511d73624e77cb91ed4c67995126f66101..e0e838ecca83deacaf565e2a4baf9a8a61235394 100644 (file)
@@ -1,5 +1,6 @@
 <?php\r
 include_once(dirname(__FILE__) . '/packager/_common.php');\r
+include_once(dirname(__FILE__) . '/url/_common.php');\r
 // Workshop\r
 $__autoload['wsFlash'] = dirname(__FILE__) . '/class.ws.flash.php';\r
 $__autoload['wsAjax'] = dirname(__FILE__) . '/class.ws.ajax.php';\r
index 3684b7771119e85043d5a9a9aa4bc8538fbfe86e..24bdc524efc8b5e95334a3d334689d75e2dc019f 100644 (file)
@@ -641,12 +641,14 @@ class wsAjax extends cubeAjax {
 \r
                if ($reponse == '0') {\r
                        $dao->reinitDemande($demande_id);\r
-               } else {\r
+               } elseif ($reponse == '1') {\r
                        $dao->accepteDemande($demande_id, $revendeur_id);\r
+               } elseif ($reponse == '-1') {\r
+                       $dao->setStatus($demande_id, 1);\r
                }\r
 \r
-               $x->addAlert(__('Votre choix a bien été prise en compte.'));\r
                if (!isset($args[4])) {\r
+                       $x->addAlert(__('Votre choix a bien été prise en compte.'));\r
                        $x->addRedirection(SITE_PATH);\r
                } else {\r
                        $x->addContent('listeDemandes' , wsUrl::listeDemandes());\r
index 5b4ea8db8bb6f8cfdf3a65c950babf366b6e7ccf..2eedb13b0b1093d2deabeef16a594de6b9b08b5b 100644 (file)
 <?php\r
 class wsUrl {\r
-       public static function publications($args)\r
-       {\r
-               global $core;\r
-\r
-               $settings = $core->user->getSettings('books');\r
-\r
-               $shortcuts = array();\r
-               if (wsDroits::creation()) {\r
-                       $shortcuts[] = '<a href="#" class="popup" rel="newBookForm">' . $core->typo->Ajouter(__('Créer une nouvelle publication')) . '</a>';\r
-               }\r
-\r
-               $filtres = array();\r
-               if (wsDroits::revendeur(false)) {\r
-                       $filtres[] = new commonFiltre(__('Status'), 'status_book', $settings['filtres']);\r
-               }\r
-               $filtres[] = new commonFiltre(__('Année'), 'annee_book', $settings['filtres']);\r
-               $res = commonPage::barre($filtres , 'filtreBooks', 'books', $shortcuts);\r
-               $res .= commonPage::tMain(null, true);\r
-               $res .= commonPage::bh();\r
-               $res .= '<div id="listeBooks">';\r
-               $res .= self::listeBooks();\r
-               $res .= '</div>';\r
-               $res .= commonPage::bf();\r
-               $res .= commonPage::bMain();\r
-               return $res;\r
-       }\r
-\r
-       public static function listeBooks($dashboard = null, $settings = null)\r
-       {\r
-               global $core;\r
-               cubePage::truePopup();\r
-               cubePage::autocomplete();\r
-               cubePage::contextMenu();\r
-\r
-               $droits = wsDroits::getDroits();\r
-\r
-               commonDroits::min(1);\r
-               $settings = is_null($settings)?$core->user->getSettings('books'):$settings;\r
-               $change = is_null($dashboard)?'Books':'Dashboard/' . $dashboard;\r
-               $dao = new wsDAOBook($core->con);\r
-               $context_download_id = is_null($dashboard)?'contextDownloadBook':'contextDashboard_Download' . $dashboard;\r
-               $context_status_id = is_null($dashboard)?'contextStatusBook':'contextDashboard_Status' . $dashboard;\r
-\r
-               if (isset($settings['search']) && !is_null($settings['search'])) {\r
-                       $dao->setSearch($settings['search']);\r
-               }\r
-               $dao->setFiltres($settings['filtres']);\r
-               $liste = $dao->getListe($settings['orderby'], $settings['sens'], $settings['limit'], $core->user);\r
-\r
-               $res = self::contextBookDownload($context_download_id);\r
-               $res = self::contextBookStatus($context_status_id);\r
-\r
-               $res .= '<table class="liste">';\r
-               $res .= '<tr><th>' . commonUrl::orderby('#', 'book_id', $settings, 'sort' . $change) . '</th>';\r
-               $res .= '<th>' . commonUrl::orderby(__('Titre de la publication'), 'nom', $settings, 'sort' . $change) . '</th>';\r
-               $res .= '<th>' . commonUrl::orderby(__(''), 'lang', $settings, 'sort' . $change) . '</th>';\r
-               $res .= '<th>' . __('Pages') . '</th>';\r
-               if ($droits->revendeur) {\r
-                       $res .= '<th>' . commonUrl::orderby(__('Proprietaire'), 'proprietaire_nom', $settings, 'sort' . $change) . '</th>';\r
-               } else {\r
-                       $res .= '<th>' . commonUrl::orderby(__('Proprietaire'), 'proprietaire_utilisateur', $settings, 'sort' . $change) . '</th>';\r
-               }\r
-               if ($droits->admin) {\r
-                       $res .= '<th>' . commonUrl::orderby(__('Facturation'), 'facturable', $settings, 'sort' . $change) . '</th>';\r
-               }\r
-               if ($droits->revendeur) {\r
-                       $res .= '<th>' . commonUrl::orderby(__('Status'), 'status', $settings, 'sort' . $change) . '</th>';\r
-               }\r
-               $res .= str_repeat('<th class="min"></th>', $droits->creation?5:4);\r
-               $res .= '</tr>';\r
-               $i = 0;\r
-\r
-               $btVoir = cubeMedia::cssRollover($core->typo->Voir('voir', '', false));\r
-               $btEdit = cubeMedia::cssRollover($core->typo->Editer('éditer', '', false));\r
-               $btStats = cubeMedia::cssRollover($core->typo->Stats('stats', '', false));\r
-               $btDownload = cubeMedia::cssRollover($core->typo->BookTelecharger('télécharger', '', false));\r
-               if ($droits->creation) {\r
-                       $btDel = cubeMedia::cssRollover($core->typo->Supprimer('suppr.', '', false));\r
-               }\r
-\r
-               foreach($liste as $id => $book) {\r
-                       $odd = cubeMath::isOdd($i)?' class="odd"':'';\r
-                       $res .= '<tr' . $odd . '>';\r
-                       $res .= '<td>' . $book->book_id . '</td>';\r
-                       $res .= '<td>' . $book->nom . '</td>';\r
-                       $res .= '<td>' . mb_strtoupper($book->lang) . '</td>';\r
-                       $res .= '<td>' . $book->parametres->pages . '</td>';\r
-\r
-                       if ($droits->revendeur) {\r
-                               $p = str_replace(" (", '<br />', $book->proprietaire);\r
-                               $p = trim($p, ')');\r
-                               $res .= '<td><a href="#" class="popup" rel="formChangeBookProprietaire/' . $book->book_id . '" title="' . __('Mofifier le proprietaire') . '">' . $p . '</a></td>';\r
-                       } else {\r
-                               $res .= '<td>' . $book->proprietaire_utilisateur . '</td>';\r
-                       }\r
-                       if ($droits->admin) {\r
-                               $res .= '<td>' . $book->facturable . '</td>';\r
-                       }\r
-                       if ($droits->revendeur) {\r
-                               if ($droits->admin || $book->status <= 1) {\r
-                                       $p = '';\r
-                                       if (!is_null($book->projet)) {\r
-                                               $p = ' <a href="' . EXTRANET_URL . '/projet/' . $book->projet . '" title="' . __('Voir les détails du projet') . '" class="blank icon">' . cubeMedia::silk('arrow_right.png') . '</a>';\r
-                                       }\r
-\r
-                                       $res .= '<td><a href="#" class="openContextMenu" rel="' . $context_status_id . '" rev="' . $book->book_id . '">' . $core->books_status[$book->status] . '</a>' . $p . '</td>';\r
-                               } else if ($book->status > 1) {\r
-                                       $res .= '<td>' . $core->books_status[1] . '</td>';\r
-                               }\r
-                       }\r
-                       $res .= '<td class="bouton"><a class="popupFS" rel="toolbar=yes" rev="viewer_' . $book->book_id . '" href="' . SITE_PATH . 'viewer/' . $book->book_id . '_' . $book->hash . '/">' . $btVoir . '</a></td>';\r
-                       $res .= '<td class="bouton"><a class="popupFS" rel="toolbar=yes" rev="editor_' . $book->book_id . '" href="' . SITE_PATH . 'editor/' . $book->book_id . '">' . $btEdit . '</a></td>';\r
-                       $res .= '<td class="bouton"><a href="' . SITE_PATH . 'stats/' . $book->book_id . '">' . $btStats . '</a></td>';\r
-                       $res .= '<td class="bouton"><a href="#" class="openContextMenu" rel="' . $context_download_id . '" rev="' . $book->book_id . '">' . $btDownload . '</a></td>';\r
-                       if ($droits->creation) {\r
-                               $res .= '<td class="bouton"><a href="#" rel="supprimeBook/' . $book->book_id . '" class="ajax" title="' . __('Êtes-vous certain de vouloir supprimer cette publication ?') . '">' . $btDel . '</a></td>';\r
-                       }\r
-                       $res .= '</tr>';\r
-                       $i++;\r
-               }\r
-               if (!isset($settings['search']) || is_null($settings['search'])) {\r
-                       $odd = cubeMath::isOdd($i)?' class="odd"':'';\r
-                       $res .= '<tr' . $odd . '><td colspan="12">';\r
-                       $res .= commonPage::pager($settings['page'], $dao->count($core->user) , $settings['par_page'], 'page' . $change . '/%d');\r
-                       $res .= commonUrl::formParPage('parPage' . $change, $settings['par_page'], __('publications'), false);\r
-                       $res .= '</td></tr>';\r
-               }\r
-               $res .= '</table>';\r
-               return $res;\r
-       }\r
-\r
-       public static function contextBookDownload($id)\r
-       {\r
-               global $core;\r
-\r
-               $versions = array();\r
-               $versions['html'] = array('title' => __('Version online'), 'icon' => cubeMedia::silk('page_white_world.png'));\r
-               $versions['win-exe'] = array('title' => __('Version offline') . ' - ' . __('Executable Windows'), 'icon' => cubeMedia::silk('application_view_tile.png'));\r
-               $versions['win-ins'] = array('title' => __('Version offline') . ' - ' . __('Installeur Auto-executable Windows'), 'icon' => cubeMedia::silk('application_view_tile.png'));\r
-               $versions['mac-exe'] = array('title' => __('Version offline') . ' - ' . __('Exécutable Mac OS X'), 'icon' => cubeMedia::image(IMG . '/macos.png'));\r
-               $versions['win-cd'] = array('title' => __('Version offline') . ' - ' . __('CD-ROM') . ' / ' . __('Clé USB'), 'icon' => cubeMedia::silk('cd.png'));\r
-\r
-               $res = '<div class="contextMenu downbookContextMenu" id="' . $id . '">';\r
-               $res .= '<ul>';\r
-               $res .= '<li class="head">' . __("Sélectionnez une version") . '</li>';\r
-               foreach($versions as $k => $v) {\r
-                       $res .= '<li><a href="#" rel="downbook/$1/' . $k . '" class="ajax">' . $v['icon'] . $v['title'] . '</a></li>';\r
-               }\r
-               $res .= '</ul></div>';\r
-               return $res;\r
-       }\r
-\r
-       public static function contextBookStatus($id)\r
-       {\r
-               global $core;\r
-\r
-               if (wsDroits::admin()) {\r
-                       $status = $core->books_status;\r
-                       $status[2] = __('Facturé (associé à un projet)');\r
-               } else {\r
-                       $status = array();\r
-                       $status[-1] = $core->books_status[-1];\r
-                       $status[0] = $core->books_status[0];\r
-               }\r
-\r
-               $res = '<div class="contextMenu statusbookContextMenu" id="' . $id . '">';\r
-               $res .= '<ul>';\r
-               $res .= '<li class="head">' . __("Changer le status de la publication") . '</li>';\r
-               foreach($status as $s => $title) {\r
-                       $res .= '<li><a href="#" rel="statusBook/$1/' . $s . '" class="ajax">' . $title . '</a></li>';\r
-               }\r
-               $res .= '</ul></div>';\r
-               return $res;\r
-       }\r
-\r
-       public static function traductions($args)\r
-       {\r
-               global $core;\r
-\r
-               commonDroits::min(5);\r
-\r
-               if (count($args) < 2) {\r
-                       $args[1] = 'fr';\r
-               }\r
-\r
-               $allLangs = cubeLang::getCodes($core->user->lang);\r
-               $existingLangs = array();\r
-\r
-               $dao = new wsDAOLang($core->con);\r
-               $langs = $dao->selectAll();\r
-               foreach($langs as $lang) {\r
-                       if (!isset($allLangs[$lang->lang_id])) {\r
-                               continue;\r
-                       }\r
-                       $existingLangs[$lang->lang_id] = $allLangs[$lang->lang_id];\r
-\r
-                       unset($allLangs[$lang->lang_id]);\r
-               }\r
-\r
-               $langs = array(__('Langues configurées') => array_flip($existingLangs), __('Autres langues') => array_flip($allLangs));\r
-\r
-               $res = commonPage::barre();\r
-               $res .= commonPage::tMain(null, false);\r
-\r
-               $res .= commonPage::bh();\r
-               $res .= '<form action="changeLang" method="post" class="submitonchange">';\r
-               $res .= '<table class="liste">';\r
-               $res .= '<tr><td class="center">' . __('Sélectionnez la langue à configurer') . ' : ' . form::combo('lang', $langs, $args[1]) . ' </td></tr>';\r
-               $res .= '</table>';\r
-               $res .= '</form>';\r
-               $res .= commonPage::bf();\r
-\r
-               $res .= '<div id="formLang">';\r
-               $res .= self::formLang($args[1]);\r
-               $res .= '</div>';\r
-               $res .= commonPage::bMain(true);\r
-\r
-               return $res;\r
-       }\r
-\r
-       public static function formLang($lang_id)\r
-       {\r
-               commonDroits::min(5);\r
-               global $core;\r
-               $dao = new wsDAOLang($core->con);\r
-               $lang = $dao->selectById($lang_id);\r
-\r
-               $res = '<form action="saveLang" method="post">';\r
-\r
-               $res .= commonPage::bh();\r
-               $res .= '<table class="liste">';\r
-               $res .= '<tr><td>' . __('Police de caractères') . ' : </td><td>' . form::hidden('lang', $lang_id) . form::combo('font', self::getFonts(), $lang->font) . '</td></tr>';\r
-               $res .= '<tr class="odd"><td>' . __('Jeux de caractères') . ' : </td><td>' . form::combo('charset', self::getCharsets(), $lang->charset) . '</td></tr>';\r
-               $res .= '<tr><td>' . __("Langue de l'installeur") . ' : </td><td>' . form::combo('nsis', self::getNSISLangs(), $lang->nsis) . '</td></tr>';\r
-               $res .= '<tr><td colspan="2" class="right odd"><a href="#" class="submit">' . $core->typo->Ajouter('Valider') . '</a></td></tr>';\r
-               $res .= '</table>';\r
-               $res .= commonPage::bf();\r
-\r
-               $res .= commonPage::bh();\r
-               $res .= cubeLang::translationForm(PLAYER_SOURCES, $lang_id , null, 'liste', array(), '<a href="#" class="submit">' . $core->typo->Ajouter(__('Enregistrer')) . '</a>', $lang->traductions);\r
-               $res .= commonPage::bf();\r
-               $res .= '</form>';\r
-               return $res;\r
-       }\r
-\r
-       public static function getFonts()\r
-       {\r
-               $formats = array('ttf', 'otf', 'TTF', 'OTF');\r
-\r
-               $dr = opendir(FONT_PATH);\r
-               $fonts = array();\r
-               while ($file = readdir($dr)) {\r
-                       if ($file == '.' || $file == '..' || !in_array(files::getExtension($file), $formats)) {\r
-                               continue;\r
-                       }\r
-                       $fonts[$file] = $file;\r
-               }\r
-               return $fonts;\r
-       }\r
-\r
-       protected static function getCharsets()\r
-       {\r
-               $sets = cubeFlexFontAsset::getSets();\r
-               $res = array();\r
-               foreach($sets as $k => $v) {\r
-                       $res[$k] = $k;\r
-               }\r
-               return $res;\r
-       }\r
-\r
-       protected static function getNSISLangs()\r
-       {\r
-               $res = array();\r
-               $dir = WS_FILES . '/nsislangs';\r
-               $dr = opendir($dir);\r
-               while ($file = readdir($dr)) {\r
-                       if ($file == '.' || $file == '..') {\r
-                               continue;\r
-                       }\r
-                       $e = explode('.', $file);\r
-                       $res[$e[0]] = $e[0];\r
-               }\r
-\r
-               ksort($res);\r
-               return $res;\r
-       }\r
-\r
-       public static function editor($args)\r
-       {\r
-               commonDroits::min(1);\r
-\r
-               global $core;\r
-\r
-               $args = cubePage::getArgs($args);\r
-               $book_id = $args[0];\r
-\r
-               self::checkDocumentVersionOfBook($book_id);\r
-\r
-               if ($book_id == 'new') {\r
-                       $dao = new wsDAOBook($core->con);\r
-                       $book = $dao->creeEmpty($core->user->utilisateur_id, $core->user->lang);\r
-                       http::redirect(SITE_PATH . 'editor/' . $book->book_id);\r
-               }\r
-\r
-               $res = '<html><head><style type="text/css">';\r
-               $res .= '#composerSwf{width:100%;height:100%;margin:0 auto;}\r
-body{margin:0;padding:0;height:100%;overflow:hidden;background:#d2d3c7;}\r
-html{height:100%}' . "\n";\r
-               $res .= '</style>';\r
-               $res .= '<title>' . __('Edition de la publication') . ' #' . $args[0] . '</title>';\r
-               $res .= '</head>';\r
-               $res .= '<body onload="this.focus();">';\r
-               $res .= self::editComposition($args);\r
-               $res .= '</body>';\r
-               $res .= '</html>';\r
-               echo $res;\r
-       }\r
-\r
-       public static function editComposition($args)\r
-       {\r
-               $fv = array(session_name() => session_id(),\r
-                       'book_id' => $args[0]);\r
-               $res = cubeMedia::flash2(WEBROOT . '/swf/composer.swf?junk=' . TIME, '100%', '100%', $fv, 'composerSwf', 'swfPanel', 10, '#d2d3c7', '', 'false', 'noscale', 'normal', array(), false, true, true);\r
-               return $res;\r
-       }\r
-\r
-       public static function stats($args)\r
-       {\r
-               $bid = (isset($args[1]))?$args[1]:null;\r
-               $annee = (isset($args[2]))?$args[2]:null;\r
-               $mois = (isset($args[3]))?$args[3]:null;\r
-               return wsStats::display($bid, $annee, $mois);\r
-       }\r
-\r
-       public static function viewerp($args)\r
-       {\r
-               commonDroits::min(5);\r
-\r
-               $args = cubePage::getArgs($args);\r
-\r
-               $e = explode('_', $args[0]);\r
-               if (count($e) == 2 || $e[2] < TIME-10) {\r
-                       $e[2] = TIME;\r
-                       http::redirect(SITE_PATH . 'viewerp/' . implode('_', $e) . '/');\r
-                       exit;\r
-               }\r
-\r
-               $book_id = $e[0];\r
-\r
-               self::checkDocumentVersionOfBook($book_id);\r
-\r
-               echo self::commonViewer($book_id, $e[1]);\r
-       }\r
-\r
-       public static function vieweru($args)\r
-       {\r
-               commonDroits::min(5);\r
-\r
-               $args = cubePage::getArgs($args);\r
-\r
-               $e = explode('_', $args[0]);\r
-               if (count($e) == 2 || $e[2] < TIME-10) {\r
-                       $e[2] = TIME;\r
-                       http::redirect(SITE_PATH . 'vieweru/' . implode('_', $e) . '/');\r
-                       exit;\r
-               }\r
-\r
-               $book_id = $e[0];\r
-\r
-               self::checkDocumentVersionOfBook($book_id);\r
-\r
-               echo self::commonViewer($book_id, $e[1]);\r
-       }\r
-\r
-       public static function viewer($args)\r
-       {\r
-               $args = cubePage::getArgs($args);\r
-\r
-               $e = explode('_', $args[0]);\r
-               if (count($e) == 2 || $e[2] < TIME-10) {\r
-                       $e[2] = TIME;\r
-                       http::redirect(SITE_PATH . 'viewer/' . implode('_', $e) . '/');\r
-                       exit;\r
-               }\r
-\r
-               $book_id = $e[0];\r
-\r
-               self::checkDocumentVersionOfBook($book_id);\r
-               wsSecureSWF::checkProtectedSWF();\r
-\r
-               echo self::commonViewer($book_id, $e[1]);\r
-       }\r
-\r
-       public static function commonViewer($book_id, $hash)\r
-       {\r
-               if (!defined('MINIMIZE_JS')) {\r
-                       define('MINIMIZE_JS', false);\r
-               }\r
-               if (!defined('MINIMIZE_CSS')) {\r
-                       define('MINIMIZE_CSS', false);\r
-               }\r
-               if (!defined('JQUERY')) {\r
-                       define('JQUERY', false);\r
-               }\r
-\r
-               global $core;\r
-               global $css;\r
-               global $js;\r
-               global $standard;\r
-               global $meta;\r
-               global $jsvar;\r
-\r
-               $dao = new wsDAOBook($core->con);\r
-\r
-               $book = $dao->selectById($book_id);\r
-               if ($book->hash != $hash) {\r
-                       commonDroits::error();\r
-               }\r
-\r
-               if (!$dao->isUpToDate($book_id)) {\r
-                       $dao->compile($book_id);\r
-                       $dao->touchCompile($book_id);\r
-               }\r
-\r
-               $daoTheme = new wsDAOTheme($core->con);\r
-               $theme = $daoTheme->getThemeOfBook($book_id, false);\r
-\r
-               $webcompile = WEBROOT . '/fluidbook/compile/';\r
-\r
-               $standard = 'XHTML 1.0 Transitional';\r
-               $css = $js = array();\r
-               $css[] = $webcompile . 'style.css';\r
-               $fv = array();\r
-\r
-               $res = '<html>';\r
-               $res .= '<head>';\r
-               $res .= '<title>' . $book->parametres->title . '</title>';\r
-               // Entêtes Facebook\r
-               if ($book->parametres->facebook) {\r
-                       $meta['og:title'] = ($book->parametres->facebook_title == '')?$book->parametres->title:$book->parametres->facebook_title;\r
-                       if ($book->parametres->facebook_description != '') {\r
-                               $meta['og:description'] = $book->parametres->facebook_description;\r
-                       }\r
-                       $meta['og:image'] = 'http://dev.ws.fluidbook.com/services/facebook_thumbnail?id=' . $book->book_id ;\r
-               }\r
-\r
-               $res .= '</head>';\r
-               $res .= '<body style="background-color:#' . $theme->parametres->loadingBackColor . '" onload="this.focus();">';\r
-               $res .= cubeMedia::flash2('index.swf', '100%', '100%', $fv, 'fluidbook', '', 10, '#' . $theme->parametres->loadingBackColor, '', 'true', 'noscale', 'gpu', array('allowScriptAccess' => 'always'));\r
-               $js = array($webcompile . 'fluidbook.js');\r
-               $jsvar = array();\r
-\r
-               $gacodes = array(GA);\r
-               if ($book->parametres->googleAnalytics != '') {\r
-                       $gacodes[] = $book->parametres->googleAnalytics;\r
-               }\r
-               $res .= cubePage::googleAnalytics($gacodes, false);\r
-               $res .= '</body>';\r
-               $res .= '</html>';\r
-\r
-               return $res;\r
-       }\r
-\r
        public static function statsxls($args)\r
        {\r
                $bid = (isset($args[1]))?$args[1]:null;\r
                wsStats::exportXLS($bid);\r
        }\r
 \r
-       public static function chooseExistingBook()\r
-       {\r
-               wsDroits::creation(true);\r
-               $res = '<tr><td colspan="2"><p style="width:600px;text-align:justify;"><em>' . __("Si votre nouvelle publication a des paramètres en commun avec une publication existante, veuillez rechercher cette publication afin d'attribuer par défaut à votre nouvelle publication les paramètres de l'existante") . '</em></p></td></tr>';\r
-               $res .= '<tr><td>' . __('Rechercher une publication') . ' : </td><td>' . form::field('book_nom', 64, 1024) . form::hidden('book', '') . '</td></tr>';\r
-               // $res .= '<tr><td colspan="2"><hr /></td></tr>';\r
-               $res .= '<tr><td>' . __('Indiquez le titre de votre nouvelle publication') . '</td><td>' . form::field('title', 64, 1024) . '</td></tr>';\r
-               return $res;\r
-       }\r
-\r
-       public static function changeBookProprietaire($book_id)\r
-       {\r
-               global $core;\r
-               commonDroits::min(3);\r
-\r
-               $dao = new wsDAOBook($core->con);\r
-               $book = $dao->selectById($book_id);\r
-\r
-               $res = '<tr><td>' . __('Propriétaire actuel') . ' : </td><td>' . $book->proprietaire . '</td></tr>';\r
-               $res .= '<tr><td>' . __('Rechercher un utilisateur') . ' : </td><td>' . form::field('book_proprietaire', 64, 1024) . form::hidden('proprietaire', '') . '</td></tr>';\r
-               return $res;\r
-       }\r
-\r
-       public static function chooseBookProject($book_id)\r
-       {\r
-               global $core;\r
-\r
-               wsDroits::admin(true);\r
-\r
-               $dao = new wsDAOBook($core->con);\r
-               $book = $dao->selectById($book_id);\r
-\r
-               $projects = array("--" => '0');\r
-               $r = $core->con->select('SELECT * FROM projets WHERE client IN(SELECT entreprise FROM utilisateurs WHERE utilisateur_id IN( SELECT facturable_id FROM ws_users_tree WHERE utilisateur_id IN (SELECT utilisateur_id FROM utilisateurs WHERE entreprise=\'' . $core->con->escape($book->proprietaire_id) . '\'))) ORDER BY projet_id DESC');\r
-               while ($r->fetch()) {\r
-                       $projects[$r->projet_id . ' - ' . $r->nom] = $r->projet_id;\r
-               }\r
-\r
-               $res = '<tr><td>' . __('Choisir un projet') . ' : </td><td>' . form::hidden('book_id', $book_id) . form::combo('book_project', $projects, $book->projet) . '</td></tr>';\r
-               $res .= '<tr><td>' . __('ou créer un nouveau projet') . ' : </td><td>' . form::field('new_book_project_nom', 64, 1024, $book->nom) . '</td></tr>';\r
-               return $res;\r
-       }\r
-\r
-       public static function chooseBookTache($book_id, $projet_id)\r
-       {\r
-               global $core;\r
-               wsDroits::admin(true);\r
-\r
-               $dao = new wsDAOBook($core->con);\r
-               $book = $dao->selectById($book_id);\r
-\r
-               $taches = array("--" => '0');\r
-               $r = $core->con->select('SELECT * FROM taches WHERE projet=\'' . $core->con->escape($projet_id) . '\' AND categorie=8');\r
-               while ($r->fetch()) {\r
-                       $taches[$r->nom] = $r->tache_id;\r
-               }\r
-\r
-               $res = '';\r
-\r
-               if ($r->count() > 0) {\r
-                       $res .= '<tr><td>' . __('Choisir une tâche') . ' : </td><td>' . form::hidden('book_id', $book_id) . form::hidden('projet_id', $projet_id) . form::combo('tache', $taches) . '</td></tr>';\r
-                       $res .= '<tr><td>' . __('ou créer une nouvelle tâche') . ' : </td><td>' . form::field('nom', 32, 1024, 'Fluidbook #' . $book->book_id . ' : ' . $book->nom) . ' ' . __('ayant le budget suivant') . ' ' . form::field('budget', 6, 6) . '</td></tr>';\r
-               } else {\r
-                       $res .= '<tr><td>' . __('Créer une tâche') . ' : </td><td>'\r
-                        . form::hidden('book_id', $book_id)\r
-                        . form::hidden('projet_id', $projet_id)\r
-                        . form::hidden('tache', '0')\r
-                        . form::field('nom', 32, 1024, 'Fluidbook #' . $book->book_id . ' : ' . $book->nom)\r
-                        . ' ' . __('ayant le budget suivant')\r
-                        . ' ' . form::field('budget', 6, 6) . '</td></tr>';\r
-               }\r
-\r
-               return $res;\r
-       }\r
-\r
-       public static function valideDownload()\r
-       {\r
-               global $core;\r
-\r
-               $res .= '<tr><td>' . __("Le téléchargement du fluidbook implique qu'il a été testé et définitivement validé.") . '<br />' . __("Si vous le téléchargez, il vous sera facturé selon les conditions stipulées dans votre contrat.") . '</td></tr>';\r
-               $res .= '<tr><td class="right"><label>' . __("Oui, ce fluidbook est validé, je souhaite le télécharger et il me sera facturé.") . ' ' . form::checkbox('valide', 1, false) . '</label></td></tr>';\r
-\r
-               return $res;\r
-       }\r
-\r
        public static function testAS($args)\r
        {\r
                global $core;\r
@@ -658,408 +110,6 @@ html{height:100%}' . "\n";
                }\r
                return $res;\r
        }\r
-\r
-       public static function clients($args)\r
-       {\r
-               global $core;\r
-               cubePage::truePopup();\r
-               cubePage::autoComplete();\r
-               cubePage::emptyfield();\r
-               commonDroits::min(3);\r
-               $settings = $core->user->getSettings('clients');\r
-\r
-               $shortcuts = array();\r
-               $shortcuts[] = '<a href="#" class="popup" rel="formClient/new">' . $core->typo->Ajouter('Créer un nouveau client') . '</a>';\r
-\r
-               $filtres = array();\r
-\r
-               $res = commonPage::barre($filtres, 'filtreClients', 'clients', $shortcuts);\r
-               $res .= commonPage::tMain();\r
-               $res .= commonPage::bh();\r
-               $res .= '<div id="listeClients">';\r
-               $res .= self::listeClients();\r
-               $res .= '</div>';\r
-               $res .= commonPage::bf();\r
-               $res .= commonPage::bMain();\r
-               return $res;\r
-       }\r
-\r
-       public static function listeClients($dashboard = null, $settings = null)\r
-       {\r
-               global $core;\r
-               commonDroits::min(3);\r
-               $settings = is_null($settings)?$core->user->getSettings('clients'):$settings;\r
-               $change = is_null($dashboard)?'Client':'Dashboard/' . $dashboard;\r
-               $dao = new commonDAOEntreprise($core->con);\r
-               if (isset($settings['search']) && !is_null($settings['search'])) {\r
-                       $dao->setSearch($settings['search']);\r
-               }\r
-               $dao->setFiltres($settings['filtres']);\r
-               $liste = $dao->getListe($settings['orderby'], $settings['sens'], $settings['limit'], $core->user);\r
-\r
-               $res = '<table class="liste">';\r
-               $res .= '<tr><th>' . commonUrl::orderby('#', 'entreprise_id', $settings, 'sort' . $change) . '</th>';\r
-               $res .= '<th>' . commonUrl::orderby(__('Raison sociale'), 'nom', $settings, 'sort' . $change) . '</th>';\r
-               $res .= '<th>' . __('Contacts') . '</th>';\r
-               $res .= '<th class="min"></th><th class="min"></th></tr>';\r
-               $i = 0;\r
-               foreach($liste as $id => $client) {\r
-                       if (!is_array($client->contacts)) {\r
-                               continue;\r
-                       }\r
-                       $odd = cubeMath::isOdd($i)?' class="odd"':'';\r
-                       $res .= '<tr' . $odd . '>';\r
-                       $res .= '<td>' . $client->entreprise_id . '</td>';\r
-                       $res .= '<td>' . $client->nom . '</td>';\r
-                       $contacts = array();\r
-\r
-                       foreach($client->contacts as $c) {\r
-                               $contacts[] = '<a href="#" class="popup" rel="formContact/' . $c->utilisateur_id . '">' . $c->prenom . ' ' . $c->nom . '</a>';\r
-                       }\r
-\r
-                       $res .= '<td id="contacts_' . $client->entreprise_id . '">' . implode(', ', $contacts) . '</td>';\r
-                       $res .= '<td class="nowrap">';\r
-                       $res .= '</td>';\r
-                       $res .= '<td class="action"><a href="#" class="popup" rel="formClient/' . $client->entreprise_id . '">' . cubeMedia::image(IMG . '/edit.png') . '</a></td>';\r
-                       $res .= '</tr>';\r
-                       $i++;\r
-               }\r
-               if (!isset($settings['search']) || is_null($settings['search'])) {\r
-                       $odd = cubeMath::isOdd($i)?' class="odd"':'';\r
-                       $res .= '<tr' . $odd . '><td colspan="10">';\r
-                       $res .= commonPage::pager($settings['page'], $dao->count($core->user) , $settings['par_page'], 'page' . $change . '/%d');\r
-                       $res .= commonUrl::formParPage('parPage' . $change, $settings['par_page'], __('clients'));\r
-                       $res .= '</td></tr>';\r
-               }\r
-               $res .= '</table>';\r
-               return $res;\r
-       }\r
-\r
-       public static function formClient($entreprise_id = 'new')\r
-       {\r
-               global $core;\r
-               commonDroits::min(3);\r
-               $dao = new commonDAOEntreprise($core->con);\r
-               $daoUtilisateur = new commonDAOUtilisateur($core->con);\r
-               if ($entreprise_id == 'new') {\r
-                       $client = $dao->cree();\r
-               } else {\r
-                       $client = $dao->selectById($entreprise_id);\r
-               }\r
-\r
-               $res = '<tr><td>' . __('Numéro de client') . '</td><td>' . form::hidden('entreprise_id', $client->entreprise_id) . '' . $client->entreprise_id . '</td></tr>';\r
-               $res .= '<tr><td>' . __('Raison sociale') . '</td><td>' . form::field('nom', 30, 128, $client->nom) . '</td></tr>';\r
-               $res .= '<tr><td>' . __('Adresse') . '</td><td>' . form::textarea('adresse', 40, 3, $client->adresse) . '</td></tr>';\r
-               $res .= '<tr><td>' . __('Code postal') . '</td><td>' . form::field('code_postal', 10, 20, $client->code_postal) . '</td></tr>';\r
-               $res .= '<tr><td>' . __('Ville') . '</td><td>' . form::field('ville', 30, 128, $client->ville) . '</td></tr>';\r
-               $res .= '<tr><td>' . __('Pays') . '</td><td>' . form::combo('pays', cubeCountry::getList(), $client->pays) . '</td></tr>';\r
-               if (wsDroits::admin(false)) {\r
-                       $res .= '<tr><td>' . __('Adresse de facturation') . '</td><td>' . form::textarea('adresse_facturation', 40, 3, $client->adresse_facturation) . '</td></tr>';\r
-                       $res .= '<tr><td>' . __('Numéro de TVA intracommunautaire') . '</td><td>' . form::field('tva_intra', 15, 13, $client->tva_intra) . '</td></tr>';\r
-               }\r
-               // Bloc Fluidbook Workshop\r
-               if (wsDroits::admin(false)) {\r
-                       $res .= '<tr class="light"><th colspan="2" class="light"><strong>' . __('Fluidbook Workshop') . '</strong></th></tr>';\r
-                       $res .= '<tr class="odd"><td>' . __('Grade') . '</td><td>' . form::combo('ws_grade', array_flip($core->ws_grades), $client->ws_grade) . '</td></tr>';\r
-                       if ($entreprise_id == 'new' || !$client->ws_admin) {\r
-                               $class = 'empty-field';\r
-                               $default_id = '';\r
-                               $default = __('Entrez le nom du revendeur ou de l\'administrateur');\r
-                       } else {\r
-                               $class = '';\r
-                               $default_id = $client->ws_admin;\r
-                               $wsa = $daoUtilisateur->selectById($client->ws_admin, 'utilisateurs_entreprise');\r
-                               $default = $wsa->utilisateur_id . ' - ' . $wsa->rs . ' (' . $wsa->prenom . ' ' . $wsa->nom . ')';\r
-                       }\r
-\r
-                       $d = $dao->getWSDatas($entreprise_id);\r
-\r
-                       $res .= '<tr class="odd"><td>' . __('Revendeur / Administrateur') . '</td><td>' . form::field('ws_admin_nom', 60, 128, $default, $class) . form::hidden('ws_admin', $default_id) . '</td></tr>';\r
-                       if (!is_null($d)) {\r
-                               $res .= '<tr class="odd"><td>' . __('Entité facturable') . '</td><td>' . $d->facturable->prenom . ' ' . $d->facturable->nom . ' (' . $d->facturable->rs . ')</td></tr>';\r
-                               $res .= '<tr class="odd"><td>' . __('Administrateur responsable') . '</td><td>' . $d->administrateur->prenom . ' ' . $d->administrateur->nom . ' (' . $d->administrateur->rs . ')</td></tr>';\r
-                       }\r
-\r
-                       $daoSignature = new wsDAOSignature($core->con);\r
-                       $signaturesList = $daoSignature->selectAll();\r
-\r
-                       $signatures = array();\r
-                       foreach($signaturesList as $s) {\r
-                               $signatures[$s->nom] = $s->signature_id;\r
-                       }\r
-\r
-                       $res .= '<tr class="odd"><td>' . __('Signatures Fluidbook') . '</td><td>' . cubeForm::checkMultiple('ws_signatures', $signatures, 5, explode(',', $client->ws_signatures)) . '</td></tr>';\r
-               }\r
-               if ($entreprise_id == 'new') {\r
-                       $daoContact = new commonDAOClient($core->con);\r
-                       $contact = $daoContact->cree();\r
-                       $res .= '<tr><th colspan="2" class="light"><strong>' . __('Contact') . '</strong></th></tr>';\r
-                       $res .= '<tr><td>' . __('Adresse e-mail') . '</td><td>' . form::field(array('contact[email]'), 30, 128, $contact->email) . '</td></tr>';\r
-                       $res .= '<tr><td>' . __('Mot de passe') . '</td><td>' . form::field(array('contact[password]'), 30, 128, $contact->password) . '</td></tr>';\r
-                       $res .= '<tr><td>' . __('Prénom') . '</td><td>' . form::field(array('contact[prenom]'), 30, 128, $contact->prenom) . '</td></tr>';\r
-                       $res .= '<tr><td>' . __('Nom') . '</td><td>' . form::field(array('contact[nom]'), 30, 128, $contact->nom) . '</td></tr>';\r
-                       $res .= '<tr><td>' . __('Téléphone') . '</td><td>' . form::field(array('contact[telephone]'), 20, 128, $contact->telephone) . '</td></tr>';\r
-                       $res .= '<tr><td>' . __('Mobile') . '</td><td>' . form::field(array('contact[mobile]'), 20, 128, $contact->mobile) . '</td></tr>';\r
-                       $res .= '<tr><td>' . __('Fax') . '</td><td>' . form::field(array('contact[fax]'), 20, 128, $contact->fax) . '</td></tr>';\r
-                       $res .= '<tr><td>' . __('Langue') . '</td><td>' . form::combo(array('contact[lang]'), cubeLang::getAvailableLangs(true), $contact->lang) . '</td></tr>';\r
-               }\r
-               return $res;\r
-       }\r
-\r
-       public static function listeContacts($entreprise_id)\r
-       {\r
-               global $core;\r
-               commonDroits::min(3);\r
-               $dao = new commonDAOEntreprise($core->con);\r
-               $contacts = $dao->getContacts($entreprise_id);\r
-\r
-               $res = '<table class="liste light">';\r
-               $res .= '<tr class="light"><th colspan="4"><a href="" class="popup" rel="formContact/new/' . $entreprise_id . '">' . $core->typo->Contact('Ajouter un contact') . '</a></th></tr>';\r
-               $i = 0;\r
-               foreach($contacts as $contact) {\r
-                       $odd = cubeMath::isOdd($i)?' class="odd"':'';\r
-                       $res .= '<tr' . $odd . '><td>' . trim($contact->prenom . ' ' . $contact->nom) . '</td>';\r
-                       $res .= '<td><a href="mailto:' . trim($contact->prenom . ' ' . $contact->nom) . '<' . $contact->email . '>">' . $contact->email . '</a></td>';\r
-                       $res .= '<td class="min"><a href="' . SITE_PATH . 'fichiers/' . $contact->utilisateur_id . '">FTP</a></td>';\r
-                       $res .= '<td><a class="ajax" href="#" rel="connectAs/' . $contact->utilisateur_id . '">Se connecter comme ...</a></td>';\r
-                       $res .= '<td class="right"><a href="#" rel="formContact/' . $contact->utilisateur_id . '" class="popup">' . cubeMedia::image(IMG . '/edit.png') . '</a></td></tr>';\r
-                       $i++;\r
-               }\r
-               $res .= '</table>';\r
-               return $res;\r
-       }\r
-\r
-       public static function formContact($client_id = 'new', $entreprise_id = null)\r
-       {\r
-               global $core;\r
-               commonDroits::min(3);\r
-\r
-               $dao = new commonDAOClient($core->con);\r
-               if ($client_id == 'new') {\r
-                       $client = $dao->creeFromEntreprise($entreprise_id);\r
-               } else {\r
-                       $client = $dao->selectById($client_id);\r
-               }\r
-\r
-               $res = '<tr><td>' . __('Numéro de client') . '</td><td>' . form::hidden('grade', 0) . form::hidden('entreprise', $client->entreprise) . form::hidden('utilisateur_id', $client->utilisateur_id) . '' . $client->utilisateur_id . '</td></tr>';\r
-               $res .= '<tr><td>' . __('Adresse e-mail') . '</td><td>' . form::field('email', 30, 128, $client->email) . '</td></tr>';\r
-               $res .= '<tr><td>' . __('Mot de passe') . '</td><td>' . form::field('password', 30, 128, $client->password) . '</td></tr>';\r
-               $res .= '<tr><td>' . __('Prénom du contact') . '</td><td>' . form::field('prenom', 30, 128, $client->prenom) . '</td></tr>';\r
-               $res .= '<tr><td>' . __('Nom du contact') . '</td><td>' . form::field('nom', 30, 128, $client->nom) . '</td></tr>';\r
-               $res .= '<tr><td>' . __('Adresse') . '</td><td>' . form::textarea('adresse', 40, 3, $client->adresse) . '</td></tr>';\r
-               $res .= '<tr><td>' . __('Code postal') . '</td><td>' . form::field('code_postal', 10, 20, $client->code_postal) . '</td></tr>';\r
-               $res .= '<tr><td>' . __('Ville') . '</td><td>' . form::field('ville', 30, 128, $client->ville) . '</td></tr>';\r
-               $res .= '<tr><td>' . __('Pays') . '</td><td>' . form::combo('pays', cubeCountry::getList(), $client->pays) . '</td></tr>';\r
-               $res .= '<tr><td>' . __('Téléphone') . '</td><td>' . form::field('telephone', 20, 128, $client->telephone) . '</td></tr>';\r
-               $res .= '<tr><td>' . __('Mobile') . '</td><td>' . form::field('mobile', 20, 128, $client->mobile) . '</td></tr>';\r
-               $res .= '<tr><td>' . __('Fax') . '</td><td>' . form::field('fax', 20, 128, $client->fax) . '</td></tr>';\r
-               $res .= '<tr><td>' . __('Langue') . '</td><td>' . form::combo('lang', cubeLang::getAvailableLangs(true), $client->lang) . '</td></tr>';\r
-               if ($client_id != 'new') {\r
-                       $res .= '<tr><td colspan="2">' . cubeMedia::spacer(10, 10) . '</td></tr>';\r
-                       $res .= '<tr><td></td><td><a href="' . SITE_PATH . 'fichiers/' . $client->utilisateur_id . '">' . __('FTP') . '</a></td></tr>';\r
-                       $res .= '<tr><td></td><td><a href="#" class="ajax" rel="connectAs/' . $client->utilisateur_id . '">' . __('Se connecter comme ...') . '</a></td></tr>';\r
-                       $res .= '<tr><td>' . __("Paramètres de connexion au Fluidbook Workshop") . '</td><td>' . __('Adresse') . ' : http://' . $_SERVER['HTTP_HOST'] . '/<br />' . __("Nom d'utilisateur") . ' : ' . $client->email . '<br />' . __('Mot de passe') . ' : ' . $client->password . '</td></tr>';\r
-                       $res .= '<tr><td colspan="2">' . cubeMedia::spacer(10, 10) . '</td></tr>';\r
-               }\r
-               return $res;\r
-       }\r
-\r
-       public static function demandes()\r
-       {\r
-               global $core;\r
-               cubePage::truePopup();\r
-               cubePage::autoComplete();\r
-               cubePage::emptyfield();\r
-               commonDroits::min(5);\r
-               $settings = $core->user->getSettings('demandes');\r
-\r
-               $shortcuts = array();\r
-\r
-               $filtres = array();\r
-               $filtres[] = new commonFiltre(__('Statut'), 'status_demande', $settings['filtres']);\r
-               $filtres[] = new commonFiltre(__('Confiées à'), 'demande_moi', $settings['filtres']);\r
-\r
-               $res = commonPage::barre($filtres, 'filtreDemandes', 'demandes', $shortcuts);\r
-               $res .= commonPage::tMain();\r
-               $res .= commonPage::bh();\r
-               $res .= '<div id="listeDemandes">';\r
-               $res .= self::listeDemandes();\r
-               $res .= '</div>';\r
-               $res .= commonPage::bf();\r
-               $res .= commonPage::bMain();\r
-               return $res;\r
-       }\r
-\r
-       public static function listeDemandes($dashboard = null, $settings = null)\r
-       {\r
-               global $core;\r
-               commonDroits::min(5);\r
-               $settings = is_null($settings)?$core->user->getSettings('demandes'):$settings;\r
-               $change = is_null($dashboard)?'Demandes':'Dashboard/' . $dashboard;\r
-               $dao = new wsDAODemande($core->con);\r
-               if (isset($settings['search']) && !is_null($settings['search'])) {\r
-                       $dao->setSearch($settings['search']);\r
-               }\r
-               $dao->setFiltres($settings['filtres']);\r
-               $liste = $dao->getListe($settings['orderby'], $settings['sens'], $settings['limit'], $core->user);\r
-\r
-               $res = '<table class="liste">';\r
-               $res .= '<tr><th>' . commonUrl::orderby('#', 'demande_id', $settings, 'sort' . $change) . '</th>';\r
-               $res .= '<th>' . commonUrl::orderby(__('Date') , 'date', $settings, 'sort' . $change) . '</th>';\r
-               $res .= '<th>' . commonUrl::orderby(__('Type') , 'type', $settings, 'sort' . $change) . '</th>';\r
-               $res .= '<th>' . commonUrl::orderby(__('Prospect') . '/' . __('Client'), 'utilisateur_nom', $settings, 'sort' . $change) . '</th>';\r
-               $res .= '<th>' . commonUrl::orderby(__('Confiée à'), 'revendeur_nom', $settings, 'sort' . $change) . '</th>';\r
-               $res .= '<th>' . commonUrl::orderby(__('Gérée par'), 'administrateur_nom', $settings, 'sort' . $change) . '</th>';\r
-               $res .= '<th>' . commonUrl::orderby(__('Statut'), 'status', $settings, 'sort' . $change) . '</th>';\r
-               $res .= '<th class="min"></th><th class="min"></th></tr>';\r
-               $i = 0;\r
-               foreach($liste as $id => $demande) {\r
-                       $odd = cubeMath::isOdd($i)?' class="odd"':'';\r
-                       $res .= '<tr' . $odd . '>';\r
-                       $res .= '<td>' . $demande->demande_id . '</td>';\r
-                       $res .= '<td>' . date(__('d/m/Y H:i'), $demande->date) . '</td>';\r
-                       $res .= '<td>' . $core->demandes_type[$demande->type] . '</td>';\r
-                       $res .= '<td><a href="#" class="popup" rel="formClient/' . $demande->entreprise . '">' . $demande->utilisateur_nom . '</a></td>';\r
-                       $revendeur = $demande->revendeur == 0?'-':$demande->revendeur_nom;\r
-                       $res .= '<td>' . $revendeur . '</td>';\r
-                       $administrateur = $demande->administrateur == 0?'-':$demande->administrateur_nom;\r
-                       $res .= '<td>' . $administrateur . '</td>';\r
-                       // Affichage du status\r
-                       // Si non traitée ou traitée, pas la possibilité de changer le status\r
-                       if ($demande->status == 0 || $demande->status == 2) {\r
-                               $res .= '<td>' . $core->demandes_status[$demande->status] . '</td>';\r
-                       } else if ($demande->status == 1) {\r
-                               if ($demande->revendeur == $core->user->utilisateur_id) {\r
-                                       $res .= '<td><a href="#" class="ajax" rel="reponseDemande/' . $demande->demande_id . '/' . $demande->revendeur . '/1/1">' . __('Je me suis chargé de cette demande') . '</a></td>';\r
-                               } else {\r
-                                       $res .= '<td>' . $core->demandes_status[$demande->status] . ' (<a href="#" class="ajax" rel="resetDemande/' . $demande->demande_id . '" title="' . __('Réinitialiser la demande') . '">x</a>)</td>';\r
-                               }\r
-                       }\r
-                       // On ne peut éditer que si la facture est non traitée et qu'elle n'a pas commencé à être éditée par un autre administrateur\r
-                       if (($demande->administrateur == 0 || $demande->administrateur == $core->user->utilisateur_id) && $demande->status == 0) {\r
-                               $res .= '<td class="action"><a href="#" class="popup" rel="formDemande/' . $demande->demande_id . '">' . cubeMedia::image(IMG . '/edit.png') . '</a></td>';\r
-                       } else {\r
-                               $res .= '<td></td>';\r
-                       }\r
-                       // On n'affiche le bouton "Supprimer" que si la demande est non-traitée\r
-                       if (($demande->administrateur == 0 || $demande->administrateur == $core->user->utilisateur_id) && $demande->status == 0) {\r
-                               $res .= '<td class="action"><a href="#" class="ajax" rel="supprimeDemande/' . $demande->demande_id . '" title="' . __('Êtes-vous certain de vouloir supprimer cette demande ?') . '">' . cubeMedia::image(IMG . '/delete.png') . '</a></td>';\r
-                       } else {\r
-                               $res .= '<td></td>';\r
-                       }\r
-                       $res .= '</tr>';\r
-                       $i++;\r
-               }\r
-               if (!isset($settings['search']) || is_null($settings['search'])) {\r
-                       $odd = cubeMath::isOdd($i)?' class="odd"':'';\r
-                       $res .= '<tr' . $odd . '><td colspan="10">';\r
-                       $res .= commonPage::pager($settings['page'], $dao->count($core->user) , $settings['par_page'], 'page' . $change . '/%d');\r
-                       $res .= commonUrl::formParPage('parPage' . $change, $settings['par_page'], __('demandes'));\r
-                       $res .= '</td></tr>';\r
-               }\r
-               $res .= '</table>';\r
-               return $res;\r
-       }\r
-\r
-       public static function formDemande($demande_id = 'new')\r
-       {\r
-               global $core;\r
-               commonDroits::min(5);\r
-               $dao = new wsDAODemande($core->con);\r
-               $daoUtilisateur = new commonDAOUtilisateur($core->con);\r
-               $demande = $dao->selectById($demande_id);\r
-               if ($demande->administrateur != 0 && $demande->administrateur != $core->user->utilisateur_id) {\r
-                       $res = '<tr><td colspan="2"><p class="center">' . __("Cette demande est actuellement en cours d'édition par un autre administrateur") . '</p></td></tr>';\r
-                       return $res;\r
-               }\r
-               if ($demande->status > 1) {\r
-                       $res = '<tr><td colspan="2"><p class="center">' . __("Cette demande est actuellement en cours de traitement") . '</p></td></tr>';\r
-                       return $res;\r
-               }\r
-               // On place la demande comme en cours d'édition\r
-               $dao->setAdministrateur($demande_id, $core->user->utilisateur_id);\r
-               // On vérifie que l'utilisateur n'est pas déjà géré par un revendeur\r
-               $demandeur = $daoUtilisateur->selectById($demande->utilisateur, 'utilisateurs_entreprise');\r
-               $administrateurs = $daoUtilisateur->selectWSAdministrateursId();\r
-               if (!is_null($demandeur->ws_admin) && !in_array($demandeur->ws_admin, $administrateurs)) {\r
-                       // Si déjà géré par un revendeur\r
-                       $revendeur = $daoUtilisateur->selectById($demandeur->ws_admin, 'utilisateurs_entreprise');\r
-                       $actions[__('Je confie la demande à ' . $revendeur->rs . ' (' . $revendeur->prenom . ' ' . $revendeur->nom . ')')] = $demandeur->ws_admin;\r
-               } else {\r
-                       $liste = $daoUtilisateur->selectWSRevendeursFacturables();\r
-                       $revendeurs = array();\r
-                       foreach($liste as $revendeur) {\r
-                               $revendeurs[$revendeur->rs . '(' . $revendeur->prenom . ' ' . $revendeur->nom . ')'] = $revendeur->utilisateur_id;\r
-                       }\r
-\r
-                       $actions = array(__('Je vais me charger de cette demande') => $core->user->utilisateur_id);\r
-                       $actions[' '] = array();\r
-                       $actions[__('Je confie la demande à') . ' : '] = $revendeurs;\r
-               }\r
-\r
-               $res = '<tr><td>' . __('Numéro de demande') . '</td><td>' . form::hidden('demande_id', $demande->demande_id) . '' . $demande->demande_id . '</td></tr>';\r
-               $res .= '<tr><td>' . __('Date de la demande') . '</td><td>' . date(__('d/m/Y H:i'), $demande->date) . '</td></tr>';\r
-               $res .= '<tr><td>' . __('Emetteur de la demande') . '</td><td><a href="#" class="popup" rel="formClient/' . $demande->entreprise . '">' . $demande->utilisateur_nom . '</a></td></tr>';\r
-               $res .= '<tr><td>' . __('Nombre de pages') . '</td><td>' . $demande->pages . '</td></tr>';\r
-               $res .= '<tr><td>' . __('Nombre de liens') . '</td><td>' . $demande->liens . '</td></tr>';\r
-               $res .= '<tr><td>' . __('Nombre de langues') . '</td><td>' . $demande->langues . '</td></tr>';\r
-               $res .= '<tr><td>' . __('Détails') . '</td><td>' . $demande->details . '</td></tr>';\r
-               $res .= '<tr><td>' . __('Action') . '</td><td>' . form::combo('revendeur', $actions) . '</td></tr>';\r
-               $res .= '<tr><td></td></tr>';\r
-\r
-               return $res;\r
-       }\r
-\r
-       public static function reponseDemande($args)\r
-       {\r
-               global $core;\r
-\r
-               commonDroits::min(3);\r
-\r
-               $res = commonPage::barre();\r
-               $res .= commonPage::tMain(null, false);\r
-\r
-               $res .= commonPage::bh();\r
-\r
-               $demande_id = $args[1];\r
-               $revendeur_id = $args[2];\r
-\r
-               $dao = new wsDAODemande($core->con);\r
-               $demande = $dao->selectById($demande_id);\r
-               if ($demande->revendeur != $revendeur_id || $demande->revendeur != $core->user->utilisateur_id) {\r
-                       commonDroits::error();\r
-                       exit;\r
-               }\r
-\r
-               $res = commonPage::barre();\r
-               $res .= commonPage::tMain();\r
-               $res .= commonPage::bh();\r
-               $res .= '<div id="accepteDemandes">';\r
-               $res .= '<h2>' . $core->typo->Titre(__('Prendre en charge une demande de devis')) . '</h2>';\r
-               $res .= '<br /><br />';\r
-               $res .= '<p>' . __('Si vous acceptez de traiter la demande suivante, veuillez cliquer sur le bouton "Accepter la demande" situé à droite de la description.');\r
-               $res .= ' ' . __('Vous avez également la possibilité de décliner la demande en cliquant sur le bouton "Décliner la demande"') . "</p>";\r
-               $res .= '<br /><br />';\r
-\r
-               $res .= '<table>';\r
-               $res .= '<tr><th class="left" colspan="2">' . __("Détails de la demande") . '</th><th class="left" style="width:40%">' . __('Votre action') . '</th></tr>';\r
-               $res .= '<tr><td>' . __('Numéro de demande') . '</td><td>' . $demande->demande_id . '</td>';\r
-               $res .= '<td>' . '<a href="#" class="ajax" rel="reponseDemande/' . $demande_id . '/' . $revendeur_id . '/1" >' . cubeMedia::cssRollover($core->typo->BookTelecharger('Accepter la demande', '', false)) . '</a>' . '</td></tr>';\r
-               $res .= '<tr><td>' . __('Date de la demande') . '</td><td>' . date(__('d/m/Y H:i'), $demande->date) . '</td>';\r
-               $res .= '<td>' . '<a href="#" class="ajax" rel="reponseDemande/' . $demande_id . '/' . $revendeur_id . '/0">' . cubeMedia::cssRollover($core->typo->Supprimer('Décliner la demande', '', false)) . '</a>' . '</td>';\r
-               $res .= '</tr>';\r
-               $res .= '<tr><td>' . __('Client') . ' / ' . __('Prospect') . '</td><td><a href="#" class="popup" rel="formClient/' . $demande->entreprise . '">' . $demande->utilisateur_nom . '</a></td></tr>';\r
-               $res .= '<tr><td>' . __('Nombre de pages') . '</td><td>' . $demande->pages . '</td></tr>';\r
-               $res .= '<tr><td>' . __('Nombre de liens') . '</td><td>' . $demande->liens . '</td></tr>';\r
-               $res .= '<tr><td>' . __('Nombre de langues') . '</td><td>' . $demande->langues . '</td></tr>';\r
-               $res .= '<tr><td>' . __('Détails') . '</td><td>' . $demande->details . '</td></tr>';\r
-               $res .= '</table>';\r
-\r
-               $res .= '</div>';\r
-               $res .= commonPage::bf();\r
-               $res .= commonPage::bMain();\r
-               return $res;\r
-       }\r
 }\r
 \r
 ?>
\ No newline at end of file
diff --git a/inc/ws/Controlleur/url/_common.php b/inc/ws/Controlleur/url/_common.php
new file mode 100644 (file)
index 0000000..d8a3ff2
--- /dev/null
@@ -0,0 +1,9 @@
+<?php\r
+$urlClasses['wsUrlBook'] = dirname(__FILE__) . '/class.ws.url.book.php';\r
+$urlClasses['wsUrlClient'] = dirname(__FILE__) . '/class.ws.url.client.php';\r
+$urlClasses['wsUrlDemande'] = dirname(__FILE__) . '/class.ws.url.demande.php';\r
+$urlClasses['wsUrlTraduction'] = dirname(__FILE__) . '/class.ws.url.traduction.php';\r
+\r
+$__autoload += $urlClasses;\r
+\r
+?>
\ No newline at end of file
diff --git a/inc/ws/Controlleur/url/class.ws.url.book.php b/inc/ws/Controlleur/url/class.ws.url.book.php
new file mode 100644 (file)
index 0000000..3af2514
--- /dev/null
@@ -0,0 +1,440 @@
+<?php\r
+class wsUrlBook {\r
+       public static function publications($args)\r
+       {\r
+               global $core;\r
+\r
+               $settings = $core->user->getSettings('books');\r
+\r
+               $shortcuts = array();\r
+               if (wsDroits::creation()) {\r
+                       $shortcuts[] = '<a href="#" class="popup" rel="newBookForm">' . $core->typo->Ajouter(__('Créer une nouvelle publication')) . '</a>';\r
+               }\r
+\r
+               $filtres = array();\r
+               if (wsDroits::revendeur(false)) {\r
+                       $filtres[] = new commonFiltre(__('Status'), 'status_book', $settings['filtres']);\r
+               }\r
+               $filtres[] = new commonFiltre(__('Année'), 'annee_book', $settings['filtres']);\r
+               $res = commonPage::barre($filtres , 'filtreBooks', 'books', $shortcuts);\r
+               $res .= commonPage::tMain(null, true);\r
+               $res .= commonPage::bh();\r
+               $res .= '<div id="listeBooks">';\r
+               $res .= self::listeBooks();\r
+               $res .= '</div>';\r
+               $res .= commonPage::bf();\r
+               $res .= commonPage::bMain();\r
+               return $res;\r
+       }\r
+\r
+       public static function listeBooks($dashboard = null, $settings = null)\r
+       {\r
+               global $core;\r
+               cubePage::truePopup();\r
+               cubePage::autocomplete();\r
+               cubePage::contextMenu();\r
+\r
+               $droits = wsDroits::getDroits();\r
+\r
+               commonDroits::min(1);\r
+               $settings = is_null($settings)?$core->user->getSettings('books'):$settings;\r
+               $change = is_null($dashboard)?'Books':'Dashboard/' . $dashboard;\r
+               $dao = new wsDAOBook($core->con);\r
+               $context_download_id = is_null($dashboard)?'contextDownloadBook':'contextDashboard_Download' . $dashboard;\r
+               $context_status_id = is_null($dashboard)?'contextStatusBook':'contextDashboard_Status' . $dashboard;\r
+\r
+               if (isset($settings['search']) && !is_null($settings['search'])) {\r
+                       $dao->setSearch($settings['search']);\r
+               }\r
+               $dao->setFiltres($settings['filtres']);\r
+               $liste = $dao->getListe($settings['orderby'], $settings['sens'], $settings['limit'], $core->user);\r
+\r
+               $res = self::contextBookDownload($context_download_id);\r
+               $res = self::contextBookStatus($context_status_id);\r
+\r
+               $res .= '<table class="liste">';\r
+               $res .= '<tr><th>' . commonUrl::orderby('#', 'book_id', $settings, 'sort' . $change) . '</th>';\r
+               $res .= '<th>' . commonUrl::orderby(__('Titre de la publication'), 'nom', $settings, 'sort' . $change) . '</th>';\r
+               $res .= '<th>' . commonUrl::orderby(__(''), 'lang', $settings, 'sort' . $change) . '</th>';\r
+               $res .= '<th>' . __('Pages') . '</th>';\r
+               if ($droits->revendeur) {\r
+                       $res .= '<th>' . commonUrl::orderby(__('Proprietaire'), 'proprietaire_nom', $settings, 'sort' . $change) . '</th>';\r
+               } else {\r
+                       $res .= '<th>' . commonUrl::orderby(__('Proprietaire'), 'proprietaire_utilisateur', $settings, 'sort' . $change) . '</th>';\r
+               }\r
+               if ($droits->admin) {\r
+                       $res .= '<th>' . commonUrl::orderby(__('Facturation'), 'facturable', $settings, 'sort' . $change) . '</th>';\r
+               }\r
+               if ($droits->revendeur) {\r
+                       $res .= '<th>' . commonUrl::orderby(__('Status'), 'status', $settings, 'sort' . $change) . '</th>';\r
+               }\r
+               $res .= str_repeat('<th class="min"></th>', $droits->creation?5:4);\r
+               $res .= '</tr>';\r
+               $i = 0;\r
+\r
+               $btVoir = cubeMedia::cssRollover($core->typo->Voir('voir', '', false));\r
+               $btEdit = cubeMedia::cssRollover($core->typo->Editer('éditer', '', false));\r
+               $btStats = cubeMedia::cssRollover($core->typo->Stats('stats', '', false));\r
+               $btDownload = cubeMedia::cssRollover($core->typo->BookTelecharger('télécharger', '', false));\r
+               if ($droits->creation) {\r
+                       $btDel = cubeMedia::cssRollover($core->typo->Supprimer('suppr.', '', false));\r
+               }\r
+\r
+               foreach($liste as $id => $book) {\r
+                       $odd = cubeMath::isOdd($i)?' class="odd"':'';\r
+                       $res .= '<tr' . $odd . '>';\r
+                       $res .= '<td>' . $book->book_id . '</td>';\r
+                       $res .= '<td>' . $book->nom . '</td>';\r
+                       $res .= '<td>' . mb_strtoupper($book->lang) . '</td>';\r
+                       $res .= '<td>' . $book->parametres->pages . '</td>';\r
+\r
+                       if ($droits->revendeur) {\r
+                               $p = str_replace(" (", '<br />', $book->proprietaire);\r
+                               $p = trim($p, ')');\r
+                               $res .= '<td><a href="#" class="popup" rel="formChangeBookProprietaire/' . $book->book_id . '" title="' . __('Mofifier le proprietaire') . '">' . $p . '</a></td>';\r
+                       } else {\r
+                               $res .= '<td>' . $book->proprietaire_utilisateur . '</td>';\r
+                       }\r
+                       if ($droits->admin) {\r
+                               $res .= '<td>' . $book->facturable . '</td>';\r
+                       }\r
+                       if ($droits->revendeur) {\r
+                               if ($droits->admin || $book->status <= 1) {\r
+                                       $p = '';\r
+                                       if (!is_null($book->projet)) {\r
+                                               $p = ' <a href="' . EXTRANET_URL . '/projet/' . $book->projet . '" title="' . __('Voir les détails du projet') . '" class="blank icon">' . cubeMedia::silk('arrow_right.png') . '</a>';\r
+                                       }\r
+\r
+                                       $res .= '<td><a href="#" class="openContextMenu" rel="' . $context_status_id . '" rev="' . $book->book_id . '">' . $core->books_status[$book->status] . '</a>' . $p . '</td>';\r
+                               } else if ($book->status > 1) {\r
+                                       $res .= '<td>' . $core->books_status[1] . '</td>';\r
+                               }\r
+                       }\r
+                       $res .= '<td class="bouton"><a class="popupFS" rel="toolbar=yes" rev="viewer_' . $book->book_id . '" href="' . SITE_PATH . 'viewer/' . $book->book_id . '_' . $book->hash . '/">' . $btVoir . '</a></td>';\r
+                       $res .= '<td class="bouton"><a class="popupFS" rel="toolbar=yes" rev="editor_' . $book->book_id . '" href="' . SITE_PATH . 'editor/' . $book->book_id . '">' . $btEdit . '</a></td>';\r
+                       $res .= '<td class="bouton"><a href="' . SITE_PATH . 'stats/' . $book->book_id . '">' . $btStats . '</a></td>';\r
+                       $res .= '<td class="bouton"><a href="#" class="openContextMenu" rel="' . $context_download_id . '" rev="' . $book->book_id . '">' . $btDownload . '</a></td>';\r
+                       if ($droits->creation) {\r
+                               $res .= '<td class="bouton"><a href="#" rel="supprimeBook/' . $book->book_id . '" class="ajax" title="' . __('Êtes-vous certain de vouloir supprimer cette publication ?') . '">' . $btDel . '</a></td>';\r
+                       }\r
+                       $res .= '</tr>';\r
+                       $i++;\r
+               }\r
+               if (!isset($settings['search']) || is_null($settings['search'])) {\r
+                       $odd = cubeMath::isOdd($i)?' class="odd"':'';\r
+                       $res .= '<tr' . $odd . '><td colspan="12">';\r
+                       $res .= commonPage::pager($settings['page'], $dao->count($core->user) , $settings['par_page'], 'page' . $change . '/%d');\r
+                       $res .= commonUrl::formParPage('parPage' . $change, $settings['par_page'], __('publications'), false);\r
+                       $res .= '</td></tr>';\r
+               }\r
+               $res .= '</table>';\r
+               return $res;\r
+       }\r
+\r
+       public static function contextBookDownload($id)\r
+       {\r
+               global $core;\r
+\r
+               $versions = array();\r
+               $versions['html'] = array('title' => __('Version online'), 'icon' => cubeMedia::silk('page_white_world.png'));\r
+               $versions['win-exe'] = array('title' => __('Version offline') . ' - ' . __('Executable Windows'), 'icon' => cubeMedia::silk('application_view_tile.png'));\r
+               $versions['win-ins'] = array('title' => __('Version offline') . ' - ' . __('Installeur Auto-executable Windows'), 'icon' => cubeMedia::silk('application_view_tile.png'));\r
+               $versions['mac-exe'] = array('title' => __('Version offline') . ' - ' . __('Exécutable Mac OS X'), 'icon' => cubeMedia::image(IMG . '/macos.png'));\r
+               $versions['win-cd'] = array('title' => __('Version offline') . ' - ' . __('CD-ROM') . ' / ' . __('Clé USB'), 'icon' => cubeMedia::silk('cd.png'));\r
+\r
+               $res = '<div class="contextMenu downbookContextMenu" id="' . $id . '">';\r
+               $res .= '<ul>';\r
+               $res .= '<li class="head">' . __("Sélectionnez une version") . '</li>';\r
+               foreach($versions as $k => $v) {\r
+                       $res .= '<li><a href="#" rel="downbook/$1/' . $k . '" class="ajax">' . $v['icon'] . $v['title'] . '</a></li>';\r
+               }\r
+               $res .= '</ul></div>';\r
+               return $res;\r
+       }\r
+\r
+       public static function contextBookStatus($id)\r
+       {\r
+               global $core;\r
+\r
+               if (wsDroits::admin()) {\r
+                       $status = $core->books_status;\r
+                       $status[2] = __('Facturé (associé à un projet)');\r
+               } else {\r
+                       $status = array();\r
+                       $status[-1] = $core->books_status[-1];\r
+                       $status[0] = $core->books_status[0];\r
+               }\r
+\r
+               $res = '<div class="contextMenu statusbookContextMenu" id="' . $id . '">';\r
+               $res .= '<ul>';\r
+               $res .= '<li class="head">' . __("Changer le status de la publication") . '</li>';\r
+               foreach($status as $s => $title) {\r
+                       $res .= '<li><a href="#" rel="statusBook/$1/' . $s . '" class="ajax">' . $title . '</a></li>';\r
+               }\r
+               $res .= '</ul></div>';\r
+               return $res;\r
+       }\r
+\r
+       public static function chooseExistingBook()\r
+       {\r
+               wsDroits::creation(true);\r
+               $res = '<tr><td colspan="2"><p style="width:600px;text-align:justify;"><em>' . __("Si votre nouvelle publication a des paramètres en commun avec une publication existante, veuillez rechercher cette publication afin d'attribuer par défaut à votre nouvelle publication les paramètres de l'existante") . '</em></p></td></tr>';\r
+               $res .= '<tr><td>' . __('Rechercher une publication') . ' : </td><td>' . form::field('book_nom', 64, 1024) . form::hidden('book', '') . '</td></tr>';\r
+               // $res .= '<tr><td colspan="2"><hr /></td></tr>';\r
+               $res .= '<tr><td>' . __('Indiquez le titre de votre nouvelle publication') . '</td><td>' . form::field('title', 64, 1024) . '</td></tr>';\r
+               return $res;\r
+       }\r
+\r
+       public static function changeBookProprietaire($book_id)\r
+       {\r
+               global $core;\r
+               commonDroits::min(3);\r
+\r
+               $dao = new wsDAOBook($core->con);\r
+               $book = $dao->selectById($book_id);\r
+\r
+               $res = '<tr><td>' . __('Propriétaire actuel') . ' : </td><td>' . $book->proprietaire . '</td></tr>';\r
+               $res .= '<tr><td>' . __('Rechercher un utilisateur') . ' : </td><td>' . form::field('book_proprietaire', 64, 1024) . form::hidden('proprietaire', '') . '</td></tr>';\r
+               return $res;\r
+       }\r
+\r
+       public static function chooseBookProject($book_id)\r
+       {\r
+               global $core;\r
+\r
+               wsDroits::admin(true);\r
+\r
+               $dao = new wsDAOBook($core->con);\r
+               $book = $dao->selectById($book_id);\r
+\r
+               $projects = array("--" => '0');\r
+               $r = $core->con->select('SELECT * FROM projets WHERE client IN(SELECT entreprise FROM utilisateurs WHERE utilisateur_id IN( SELECT facturable_id FROM ws_users_tree WHERE utilisateur_id IN (SELECT utilisateur_id FROM utilisateurs WHERE entreprise=\'' . $core->con->escape($book->proprietaire_id) . '\'))) ORDER BY projet_id DESC');\r
+               while ($r->fetch()) {\r
+                       $projects[$r->projet_id . ' - ' . $r->nom] = $r->projet_id;\r
+               }\r
+\r
+               $res = '<tr><td>' . __('Choisir un projet') . ' : </td><td>' . form::hidden('book_id', $book_id) . form::combo('book_project', $projects, $book->projet) . '</td></tr>';\r
+               $res .= '<tr><td>' . __('ou créer un nouveau projet') . ' : </td><td>' . form::field('new_book_project_nom', 64, 1024, $book->nom) . '</td></tr>';\r
+               return $res;\r
+       }\r
+\r
+       public static function chooseBookTache($book_id, $projet_id)\r
+       {\r
+               global $core;\r
+               wsDroits::admin(true);\r
+\r
+               $dao = new wsDAOBook($core->con);\r
+               $book = $dao->selectById($book_id);\r
+\r
+               $taches = array("--" => '0');\r
+               $r = $core->con->select('SELECT * FROM taches WHERE projet=\'' . $core->con->escape($projet_id) . '\' AND categorie=8');\r
+               while ($r->fetch()) {\r
+                       $taches[$r->nom] = $r->tache_id;\r
+               }\r
+\r
+               $res = '';\r
+\r
+               if ($r->count() > 0) {\r
+                       $res .= '<tr><td>' . __('Choisir une tâche') . ' : </td><td>' . form::hidden('book_id', $book_id) . form::hidden('projet_id', $projet_id) . form::combo('tache', $taches) . '</td></tr>';\r
+                       $res .= '<tr><td>' . __('ou créer une nouvelle tâche') . ' : </td><td>' . form::field('nom', 32, 1024, 'Fluidbook #' . $book->book_id . ' : ' . $book->nom) . ' ' . __('ayant le budget suivant') . ' ' . form::field('budget', 6, 6) . '</td></tr>';\r
+               } else {\r
+                       $res .= '<tr><td>' . __('Créer une tâche') . ' : </td><td>'\r
+                        . form::hidden('book_id', $book_id)\r
+                        . form::hidden('projet_id', $projet_id)\r
+                        . form::hidden('tache', '0')\r
+                        . form::field('nom', 32, 1024, 'Fluidbook #' . $book->book_id . ' : ' . $book->nom)\r
+                        . ' ' . __('ayant le budget suivant')\r
+                        . ' ' . form::field('budget', 6, 6) . '</td></tr>';\r
+               }\r
+\r
+               return $res;\r
+       }\r
+\r
+       public static function editor($args)\r
+       {\r
+               commonDroits::min(1);\r
+\r
+               global $core;\r
+\r
+               $args = cubePage::getArgs($args);\r
+               $book_id = $args[0];\r
+\r
+               self::checkDocumentVersionOfBook($book_id);\r
+\r
+               if ($book_id == 'new') {\r
+                       $dao = new wsDAOBook($core->con);\r
+                       $book = $dao->creeEmpty($core->user->utilisateur_id, $core->user->lang);\r
+                       http::redirect(SITE_PATH . 'editor/' . $book->book_id);\r
+               }\r
+\r
+               $res = '<html><head><style type="text/css">';\r
+               $res .= '#composerSwf{width:100%;height:100%;margin:0 auto;}\r
+body{margin:0;padding:0;height:100%;overflow:hidden;background:#d2d3c7;}\r
+html{height:100%}' . "\n";\r
+               $res .= '</style>';\r
+               $res .= '<title>' . __('Edition de la publication') . ' #' . $args[0] . '</title>';\r
+               $res .= '</head>';\r
+               $res .= '<body onload="this.focus();">';\r
+               $res .= self::editComposition($args);\r
+               $res .= '</body>';\r
+               $res .= '</html>';\r
+               echo $res;\r
+       }\r
+\r
+       public static function editComposition($args)\r
+       {\r
+               $fv = array(session_name() => session_id(),\r
+                       'book_id' => $args[0]);\r
+               $res = cubeMedia::flash2(WEBROOT . '/swf/composer.swf?junk=' . TIME, '100%', '100%', $fv, 'composerSwf', 'swfPanel', 10, '#d2d3c7', '', 'false', 'noscale', 'normal', array(), false, true, true);\r
+               return $res;\r
+       }\r
+\r
+       public static function stats($args)\r
+       {\r
+               $bid = (isset($args[1]))?$args[1]:null;\r
+               $annee = (isset($args[2]))?$args[2]:null;\r
+               $mois = (isset($args[3]))?$args[3]:null;\r
+               return wsStats::display($bid, $annee, $mois);\r
+       }\r
+\r
+       public static function viewerp($args)\r
+       {\r
+               commonDroits::min(5);\r
+\r
+               $args = cubePage::getArgs($args);\r
+\r
+               $e = explode('_', $args[0]);\r
+               if (count($e) == 2 || $e[2] < TIME-10) {\r
+                       $e[2] = TIME;\r
+                       http::redirect(SITE_PATH . 'viewerp/' . implode('_', $e) . '/');\r
+                       exit;\r
+               }\r
+\r
+               $book_id = $e[0];\r
+\r
+               self::checkDocumentVersionOfBook($book_id);\r
+\r
+               echo self::commonViewer($book_id, $e[1]);\r
+       }\r
+\r
+       public static function vieweru($args)\r
+       {\r
+               commonDroits::min(5);\r
+\r
+               $args = cubePage::getArgs($args);\r
+\r
+               $e = explode('_', $args[0]);\r
+               if (count($e) == 2 || $e[2] < TIME-10) {\r
+                       $e[2] = TIME;\r
+                       http::redirect(SITE_PATH . 'vieweru/' . implode('_', $e) . '/');\r
+                       exit;\r
+               }\r
+\r
+               $book_id = $e[0];\r
+\r
+               self::checkDocumentVersionOfBook($book_id);\r
+\r
+               echo self::commonViewer($book_id, $e[1]);\r
+       }\r
+\r
+       public static function viewer($args)\r
+       {\r
+               $args = cubePage::getArgs($args);\r
+\r
+               $e = explode('_', $args[0]);\r
+               if (count($e) == 2 || $e[2] < TIME-10) {\r
+                       $e[2] = TIME;\r
+                       http::redirect(SITE_PATH . 'viewer/' . implode('_', $e) . '/');\r
+                       exit;\r
+               }\r
+\r
+               $book_id = $e[0];\r
+\r
+               self::checkDocumentVersionOfBook($book_id);\r
+               wsSecureSWF::checkProtectedSWF();\r
+\r
+               echo self::commonViewer($book_id, $e[1]);\r
+       }\r
+\r
+       public static function commonViewer($book_id, $hash)\r
+       {\r
+               if (!defined('MINIMIZE_JS')) {\r
+                       define('MINIMIZE_JS', false);\r
+               }\r
+               if (!defined('MINIMIZE_CSS')) {\r
+                       define('MINIMIZE_CSS', false);\r
+               }\r
+               if (!defined('JQUERY')) {\r
+                       define('JQUERY', false);\r
+               }\r
+\r
+               global $core;\r
+               global $css;\r
+               global $js;\r
+               global $standard;\r
+               global $meta;\r
+               global $jsvar;\r
+\r
+               $dao = new wsDAOBook($core->con);\r
+\r
+               $book = $dao->selectById($book_id);\r
+               if ($book->hash != $hash) {\r
+                       commonDroits::error();\r
+               }\r
+\r
+               if (!$dao->isUpToDate($book_id)) {\r
+                       $dao->compile($book_id);\r
+                       $dao->touchCompile($book_id);\r
+               }\r
+\r
+               $daoTheme = new wsDAOTheme($core->con);\r
+               $theme = $daoTheme->getThemeOfBook($book_id, false);\r
+\r
+               $webcompile = WEBROOT . '/fluidbook/compile/';\r
+\r
+               $standard = 'XHTML 1.0 Transitional';\r
+               $css = $js = array();\r
+               $css[] = $webcompile . 'style.css';\r
+               $fv = array();\r
+\r
+               $res = '<html>';\r
+               $res .= '<head>';\r
+               $res .= '<title>' . $book->parametres->title . '</title>';\r
+               // Entêtes Facebook\r
+               if ($book->parametres->facebook) {\r
+                       $meta['og:title'] = ($book->parametres->facebook_title == '')?$book->parametres->title:$book->parametres->facebook_title;\r
+                       if ($book->parametres->facebook_description != '') {\r
+                               $meta['og:description'] = $book->parametres->facebook_description;\r
+                       }\r
+                       $meta['og:image'] = 'http://dev.ws.fluidbook.com/services/facebook_thumbnail?id=' . $book->book_id ;\r
+               }\r
+\r
+               $res .= '</head>';\r
+               $res .= '<body style="background-color:#' . $theme->parametres->loadingBackColor . '" onload="this.focus();">';\r
+               $res .= cubeMedia::flash2('index.swf', '100%', '100%', $fv, 'fluidbook', '', 10, '#' . $theme->parametres->loadingBackColor, '', 'true', 'noscale', 'gpu', array('allowScriptAccess' => 'always'));\r
+               $js = array($webcompile . 'fluidbook.js');\r
+               $jsvar = array();\r
+\r
+               $gacodes = array(GA);\r
+               if ($book->parametres->googleAnalytics != '') {\r
+                       $gacodes[] = $book->parametres->googleAnalytics;\r
+               }\r
+               $res .= cubePage::googleAnalytics($gacodes, false);\r
+               $res .= '</body>';\r
+               $res .= '</html>';\r
+\r
+               return $res;\r
+       }\r
+\r
+       public static function valideDownload()\r
+       {\r
+               global $core;\r
+\r
+               $res .= '<tr><td>' . __("Le téléchargement du fluidbook implique qu'il a été testé et définitivement validé.") . '<br />' . __("Si vous le téléchargez, il vous sera facturé selon les conditions stipulées dans votre contrat.") . '</td></tr>';\r
+               $res .= '<tr><td class="right"><label>' . __("Oui, ce fluidbook est validé, je souhaite le télécharger et il me sera facturé.") . ' ' . form::checkbox('valide', 1, false) . '</label></td></tr>';\r
+\r
+               return $res;\r
+       }\r
+}\r
+\r
+?>
\ No newline at end of file
diff --git a/inc/ws/Controlleur/url/class.ws.url.client.php b/inc/ws/Controlleur/url/class.ws.url.client.php
new file mode 100644 (file)
index 0000000..6fbba87
--- /dev/null
@@ -0,0 +1,209 @@
+<?php\r
+class wsUrlClient {\r
+       public static function clients($args)\r
+       {\r
+               global $core;\r
+               cubePage::truePopup();\r
+               cubePage::autoComplete();\r
+               cubePage::emptyfield();\r
+               commonDroits::min(3);\r
+               $settings = $core->user->getSettings('clients');\r
+\r
+               $shortcuts = array();\r
+               $shortcuts[] = '<a href="#" class="popup" rel="formClient/new">' . $core->typo->Ajouter('Créer un nouveau client') . '</a>';\r
+\r
+               $filtres = array();\r
+\r
+               $res = commonPage::barre($filtres, 'filtreClients', 'clients', $shortcuts);\r
+               $res .= commonPage::tMain();\r
+               $res .= commonPage::bh();\r
+               $res .= '<div id="listeClients">';\r
+               $res .= self::listeClients();\r
+               $res .= '</div>';\r
+               $res .= commonPage::bf();\r
+               $res .= commonPage::bMain();\r
+               return $res;\r
+       }\r
+\r
+       public static function listeClients($dashboard = null, $settings = null)\r
+       {\r
+               global $core;\r
+               commonDroits::min(3);\r
+               $settings = is_null($settings)?$core->user->getSettings('clients'):$settings;\r
+               $change = is_null($dashboard)?'Client':'Dashboard/' . $dashboard;\r
+               $dao = new commonDAOEntreprise($core->con);\r
+               if (isset($settings['search']) && !is_null($settings['search'])) {\r
+                       $dao->setSearch($settings['search']);\r
+               }\r
+               $dao->setFiltres($settings['filtres']);\r
+               $liste = $dao->getListe($settings['orderby'], $settings['sens'], $settings['limit'], $core->user);\r
+\r
+               $res = '<table class="liste">';\r
+               $res .= '<tr><th>' . commonUrl::orderby('#', 'entreprise_id', $settings, 'sort' . $change) . '</th>';\r
+               $res .= '<th>' . commonUrl::orderby(__('Raison sociale'), 'nom', $settings, 'sort' . $change) . '</th>';\r
+               $res .= '<th>' . __('Contacts') . '</th>';\r
+               $res .= '<th class="min"></th><th class="min"></th></tr>';\r
+               $i = 0;\r
+               foreach($liste as $id => $client) {\r
+                       if (!is_array($client->contacts)) {\r
+                               continue;\r
+                       }\r
+                       $odd = cubeMath::isOdd($i)?' class="odd"':'';\r
+                       $res .= '<tr' . $odd . '>';\r
+                       $res .= '<td>' . $client->entreprise_id . '</td>';\r
+                       $res .= '<td>' . $client->nom . '</td>';\r
+                       $contacts = array();\r
+\r
+                       foreach($client->contacts as $c) {\r
+                               $contacts[] = '<a href="#" class="popup" rel="formContact/' . $c->utilisateur_id . '">' . $c->prenom . ' ' . $c->nom . '</a>';\r
+                       }\r
+\r
+                       $res .= '<td id="contacts_' . $client->entreprise_id . '">' . implode(', ', $contacts) . '</td>';\r
+                       $res .= '<td class="nowrap">';\r
+                       $res .= '</td>';\r
+                       $res .= '<td class="action"><a href="#" class="popup" rel="formClient/' . $client->entreprise_id . '">' . cubeMedia::image(IMG . '/edit.png') . '</a></td>';\r
+                       $res .= '</tr>';\r
+                       $i++;\r
+               }\r
+               if (!isset($settings['search']) || is_null($settings['search'])) {\r
+                       $odd = cubeMath::isOdd($i)?' class="odd"':'';\r
+                       $res .= '<tr' . $odd . '><td colspan="10">';\r
+                       $res .= commonPage::pager($settings['page'], $dao->count($core->user) , $settings['par_page'], 'page' . $change . '/%d');\r
+                       $res .= commonUrl::formParPage('parPage' . $change, $settings['par_page'], __('clients'));\r
+                       $res .= '</td></tr>';\r
+               }\r
+               $res .= '</table>';\r
+               return $res;\r
+       }\r
+\r
+       public static function formClient($entreprise_id = 'new')\r
+       {\r
+               global $core;\r
+               commonDroits::min(3);\r
+               $dao = new commonDAOEntreprise($core->con);\r
+               $daoUtilisateur = new commonDAOUtilisateur($core->con);\r
+               if ($entreprise_id == 'new') {\r
+                       $client = $dao->cree();\r
+               } else {\r
+                       $client = $dao->selectById($entreprise_id);\r
+               }\r
+\r
+               $res = '<tr><td>' . __('Numéro de client') . '</td><td>' . form::hidden('entreprise_id', $client->entreprise_id) . '' . $client->entreprise_id . '</td></tr>';\r
+               $res .= '<tr><td>' . __('Raison sociale') . '</td><td>' . form::field('nom', 30, 128, $client->nom) . '</td></tr>';\r
+               $res .= '<tr><td>' . __('Adresse') . '</td><td>' . form::textarea('adresse', 40, 3, $client->adresse) . '</td></tr>';\r
+               $res .= '<tr><td>' . __('Code postal') . '</td><td>' . form::field('code_postal', 10, 20, $client->code_postal) . '</td></tr>';\r
+               $res .= '<tr><td>' . __('Ville') . '</td><td>' . form::field('ville', 30, 128, $client->ville) . '</td></tr>';\r
+               $res .= '<tr><td>' . __('Pays') . '</td><td>' . form::combo('pays', cubeCountry::getList(), $client->pays) . '</td></tr>';\r
+               if (wsDroits::admin(false)) {\r
+                       $res .= '<tr><td>' . __('Adresse de facturation') . '</td><td>' . form::textarea('adresse_facturation', 40, 3, $client->adresse_facturation) . '</td></tr>';\r
+                       $res .= '<tr><td>' . __('Numéro de TVA intracommunautaire') . '</td><td>' . form::field('tva_intra', 15, 13, $client->tva_intra) . '</td></tr>';\r
+               }\r
+               // Bloc Fluidbook Workshop\r
+               if (wsDroits::admin(false)) {\r
+                       $res .= '<tr class="light"><th colspan="2" class="light"><strong>' . __('Fluidbook Workshop') . '</strong></th></tr>';\r
+                       $res .= '<tr class="odd"><td>' . __('Grade') . '</td><td>' . form::combo('ws_grade', array_flip($core->ws_grades), $client->ws_grade) . '</td></tr>';\r
+                       if ($entreprise_id == 'new' || !$client->ws_admin) {\r
+                               $class = 'empty-field';\r
+                               $default_id = '';\r
+                               $default = __('Entrez le nom du revendeur ou de l\'administrateur');\r
+                       } else {\r
+                               $class = '';\r
+                               $default_id = $client->ws_admin;\r
+                               $wsa = $daoUtilisateur->selectById($client->ws_admin, 'utilisateurs_entreprise');\r
+                               $default = $wsa->utilisateur_id . ' - ' . $wsa->rs . ' (' . $wsa->prenom . ' ' . $wsa->nom . ')';\r
+                       }\r
+\r
+                       $d = $dao->getWSDatas($entreprise_id);\r
+\r
+                       $res .= '<tr class="odd"><td>' . __('Revendeur / Administrateur') . '</td><td>' . form::field('ws_admin_nom', 60, 128, $default, $class) . form::hidden('ws_admin', $default_id) . '</td></tr>';\r
+                       if (!is_null($d)) {\r
+                               $res .= '<tr class="odd"><td>' . __('Entité facturable') . '</td><td>' . $d->facturable->prenom . ' ' . $d->facturable->nom . ' (' . $d->facturable->rs . ')</td></tr>';\r
+                               $res .= '<tr class="odd"><td>' . __('Administrateur responsable') . '</td><td>' . $d->administrateur->prenom . ' ' . $d->administrateur->nom . ' (' . $d->administrateur->rs . ')</td></tr>';\r
+                       }\r
+\r
+                       $daoSignature = new wsDAOSignature($core->con);\r
+                       $signaturesList = $daoSignature->selectAll();\r
+\r
+                       $signatures = array();\r
+                       foreach($signaturesList as $s) {\r
+                               $signatures[$s->nom] = $s->signature_id;\r
+                       }\r
+\r
+                       $res .= '<tr class="odd"><td>' . __('Signatures Fluidbook') . '</td><td>' . cubeForm::checkMultiple('ws_signatures', $signatures, 5, explode(',', $client->ws_signatures)) . '</td></tr>';\r
+               }\r
+               if ($entreprise_id == 'new') {\r
+                       $daoContact = new commonDAOClient($core->con);\r
+                       $contact = $daoContact->cree();\r
+                       $res .= '<tr><th colspan="2" class="light"><strong>' . __('Contact') . '</strong></th></tr>';\r
+                       $res .= '<tr><td>' . __('Adresse e-mail') . '</td><td>' . form::field(array('contact[email]'), 30, 128, $contact->email) . '</td></tr>';\r
+                       $res .= '<tr><td>' . __('Mot de passe') . '</td><td>' . form::field(array('contact[password]'), 30, 128, $contact->password) . '</td></tr>';\r
+                       $res .= '<tr><td>' . __('Prénom') . '</td><td>' . form::field(array('contact[prenom]'), 30, 128, $contact->prenom) . '</td></tr>';\r
+                       $res .= '<tr><td>' . __('Nom') . '</td><td>' . form::field(array('contact[nom]'), 30, 128, $contact->nom) . '</td></tr>';\r
+                       $res .= '<tr><td>' . __('Téléphone') . '</td><td>' . form::field(array('contact[telephone]'), 20, 128, $contact->telephone) . '</td></tr>';\r
+                       $res .= '<tr><td>' . __('Mobile') . '</td><td>' . form::field(array('contact[mobile]'), 20, 128, $contact->mobile) . '</td></tr>';\r
+                       $res .= '<tr><td>' . __('Fax') . '</td><td>' . form::field(array('contact[fax]'), 20, 128, $contact->fax) . '</td></tr>';\r
+                       $res .= '<tr><td>' . __('Langue') . '</td><td>' . form::combo(array('contact[lang]'), cubeLang::getAvailableLangs(true), $contact->lang) . '</td></tr>';\r
+               }\r
+               return $res;\r
+       }\r
+\r
+       public static function listeContacts($entreprise_id)\r
+       {\r
+               global $core;\r
+               commonDroits::min(3);\r
+               $dao = new commonDAOEntreprise($core->con);\r
+               $contacts = $dao->getContacts($entreprise_id);\r
+\r
+               $res = '<table class="liste light">';\r
+               $res .= '<tr class="light"><th colspan="4"><a href="" class="popup" rel="formContact/new/' . $entreprise_id . '">' . $core->typo->Contact('Ajouter un contact') . '</a></th></tr>';\r
+               $i = 0;\r
+               foreach($contacts as $contact) {\r
+                       $odd = cubeMath::isOdd($i)?' class="odd"':'';\r
+                       $res .= '<tr' . $odd . '><td>' . trim($contact->prenom . ' ' . $contact->nom) . '</td>';\r
+                       $res .= '<td><a href="mailto:' . trim($contact->prenom . ' ' . $contact->nom) . '<' . $contact->email . '>">' . $contact->email . '</a></td>';\r
+                       $res .= '<td class="min"><a href="' . SITE_PATH . 'fichiers/' . $contact->utilisateur_id . '">FTP</a></td>';\r
+                       $res .= '<td><a class="ajax" href="#" rel="connectAs/' . $contact->utilisateur_id . '">Se connecter comme ...</a></td>';\r
+                       $res .= '<td class="right"><a href="#" rel="formContact/' . $contact->utilisateur_id . '" class="popup">' . cubeMedia::image(IMG . '/edit.png') . '</a></td></tr>';\r
+                       $i++;\r
+               }\r
+               $res .= '</table>';\r
+               return $res;\r
+       }\r
+\r
+       public static function formContact($client_id = 'new', $entreprise_id = null)\r
+       {\r
+               global $core;\r
+               commonDroits::min(3);\r
+\r
+               $dao = new commonDAOClient($core->con);\r
+               if ($client_id == 'new') {\r
+                       $client = $dao->creeFromEntreprise($entreprise_id);\r
+               } else {\r
+                       $client = $dao->selectById($client_id);\r
+               }\r
+\r
+               $res = '<tr><td>' . __('Numéro de client') . '</td><td>' . form::hidden('grade', 0) . form::hidden('entreprise', $client->entreprise) . form::hidden('utilisateur_id', $client->utilisateur_id) . '' . $client->utilisateur_id . '</td></tr>';\r
+               $res .= '<tr><td>' . __('Adresse e-mail') . '</td><td>' . form::field('email', 30, 128, $client->email) . '</td></tr>';\r
+               $res .= '<tr><td>' . __('Mot de passe') . '</td><td>' . form::field('password', 30, 128, $client->password) . '</td></tr>';\r
+               $res .= '<tr><td>' . __('Prénom du contact') . '</td><td>' . form::field('prenom', 30, 128, $client->prenom) . '</td></tr>';\r
+               $res .= '<tr><td>' . __('Nom du contact') . '</td><td>' . form::field('nom', 30, 128, $client->nom) . '</td></tr>';\r
+               $res .= '<tr><td>' . __('Adresse') . '</td><td>' . form::textarea('adresse', 40, 3, $client->adresse) . '</td></tr>';\r
+               $res .= '<tr><td>' . __('Code postal') . '</td><td>' . form::field('code_postal', 10, 20, $client->code_postal) . '</td></tr>';\r
+               $res .= '<tr><td>' . __('Ville') . '</td><td>' . form::field('ville', 30, 128, $client->ville) . '</td></tr>';\r
+               $res .= '<tr><td>' . __('Pays') . '</td><td>' . form::combo('pays', cubeCountry::getList(), $client->pays) . '</td></tr>';\r
+               $res .= '<tr><td>' . __('Téléphone') . '</td><td>' . form::field('telephone', 20, 128, $client->telephone) . '</td></tr>';\r
+               $res .= '<tr><td>' . __('Mobile') . '</td><td>' . form::field('mobile', 20, 128, $client->mobile) . '</td></tr>';\r
+               $res .= '<tr><td>' . __('Fax') . '</td><td>' . form::field('fax', 20, 128, $client->fax) . '</td></tr>';\r
+               $res .= '<tr><td>' . __('Langue') . '</td><td>' . form::combo('lang', cubeLang::getAvailableLangs(true), $client->lang) . '</td></tr>';\r
+               if ($client_id != 'new') {\r
+                       $res .= '<tr><td colspan="2">' . cubeMedia::spacer(10, 10) . '</td></tr>';\r
+                       $res .= '<tr><td></td><td><a href="' . SITE_PATH . 'fichiers/' . $client->utilisateur_id . '">' . __('FTP') . '</a></td></tr>';\r
+                       $res .= '<tr><td></td><td><a href="#" class="ajax" rel="connectAs/' . $client->utilisateur_id . '">' . __('Se connecter comme ...') . '</a></td></tr>';\r
+                       $res .= '<tr><td>' . __("Paramètres de connexion au Fluidbook Workshop") . '</td><td>' . __('Adresse') . ' : http://' . $_SERVER['HTTP_HOST'] . '/<br />' . __("Nom d'utilisateur") . ' : ' . $client->email . '<br />' . __('Mot de passe') . ' : ' . $client->password . '</td></tr>';\r
+                       $res .= '<tr><td colspan="2">' . cubeMedia::spacer(10, 10) . '</td></tr>';\r
+               }\r
+               return $res;\r
+       }\r
+}\r
+\r
+?>
\ No newline at end of file
diff --git a/inc/ws/Controlleur/url/class.ws.url.demande.php b/inc/ws/Controlleur/url/class.ws.url.demande.php
new file mode 100644 (file)
index 0000000..3b69a16
--- /dev/null
@@ -0,0 +1,207 @@
+<?php\r
+class wsUrlDemande {\r
+       public static function demandes()\r
+       {\r
+               global $core;\r
+               cubePage::truePopup();\r
+               cubePage::autoComplete();\r
+               cubePage::emptyfield();\r
+               commonDroits::min(5);\r
+               $settings = $core->user->getSettings('demandes');\r
+\r
+               $shortcuts = array();\r
+\r
+               $filtres = array();\r
+               $filtres[] = new commonFiltre(__('Statut'), 'status_demande', $settings['filtres']);\r
+               $filtres[] = new commonFiltre(__('Confiées à'), 'demande_moi', $settings['filtres']);\r
+\r
+               $res = commonPage::barre($filtres, 'filtreDemandes', 'demandes', $shortcuts);\r
+               $res .= commonPage::tMain();\r
+               $res .= commonPage::bh();\r
+               $res .= '<div id="listeDemandes">';\r
+               $res .= self::listeDemandes();\r
+               $res .= '</div>';\r
+               $res .= commonPage::bf();\r
+               $res .= commonPage::bMain();\r
+               return $res;\r
+       }\r
+\r
+       public static function listeDemandes($dashboard = null, $settings = null)\r
+       {\r
+               global $core;\r
+               commonDroits::min(5);\r
+               $settings = is_null($settings)?$core->user->getSettings('demandes'):$settings;\r
+               $change = is_null($dashboard)?'Demandes':'Dashboard/' . $dashboard;\r
+               $dao = new wsDAODemande($core->con);\r
+               if (isset($settings['search']) && !is_null($settings['search'])) {\r
+                       $dao->setSearch($settings['search']);\r
+               }\r
+               $dao->setFiltres($settings['filtres']);\r
+               $liste = $dao->getListe($settings['orderby'], $settings['sens'], $settings['limit'], $core->user);\r
+\r
+               $res = '<table class="liste">';\r
+               $res .= '<tr><th>' . commonUrl::orderby('#', 'demande_id', $settings, 'sort' . $change) . '</th>';\r
+               $res .= '<th>' . commonUrl::orderby(__('Date') , 'date', $settings, 'sort' . $change) . '</th>';\r
+               $res .= '<th>' . commonUrl::orderby(__('Type') , 'type', $settings, 'sort' . $change) . '</th>';\r
+               $res .= '<th>' . commonUrl::orderby(__('Prospect') . '/' . __('Client'), 'utilisateur_nom', $settings, 'sort' . $change) . '</th>';\r
+               $res .= '<th>' . commonUrl::orderby(__('Confiée à'), 'revendeur_nom', $settings, 'sort' . $change) . '</th>';\r
+               $res .= '<th>' . commonUrl::orderby(__('Gérée par'), 'administrateur_nom', $settings, 'sort' . $change) . '</th>';\r
+               $res .= '<th>' . commonUrl::orderby(__('Statut'), 'status', $settings, 'sort' . $change) . '</th>';\r
+               $res .= '<th class="min"></th><th class="min"></th></tr>';\r
+               $i = 0;\r
+               foreach($liste as $id => $demande) {\r
+                       $odd = cubeMath::isOdd($i)?' class="odd"':'';\r
+                       $res .= '<tr' . $odd . '>';\r
+                       $res .= '<td>' . $demande->demande_id . '</td>';\r
+                       $res .= '<td>' . date(__('d/m/Y H:i'), $demande->date) . '</td>';\r
+                       $res .= '<td>' . $core->demandes_type[$demande->type] . '</td>';\r
+                       $res .= '<td><a href="#" class="popup" rel="formClient/' . $demande->entreprise . '">' . $demande->utilisateur_nom . '</a></td>';\r
+                       $revendeur = $demande->revendeur == 0?'-':$demande->revendeur_nom;\r
+                       $res .= '<td>' . $revendeur . '</td>';\r
+                       $administrateur = $demande->administrateur == 0?'-':$demande->administrateur_nom;\r
+                       $res .= '<td>' . $administrateur . '</td>';\r
+                       // Affichage du status\r
+                       // Si non traitée ou traitée, pas la possibilité de changer le status\r
+                       if ($demande->status == 0) {\r
+                               $res .= '<td>' . $core->demandes_status[$demande->status] . '</td>';\r
+                       } else if ($demande->status == 1) {\r
+                               if ($demande->revendeur == $core->user->utilisateur_id) {\r
+                                       $res .= '<td><a href="#" class="ajax" rel="reponseDemande/' . $demande->demande_id . '/' . $demande->revendeur . '/1/1">' . __('Je me suis chargé de cette demande') . '</a></td>';\r
+                               } else {\r
+                                       $res .= '<td>' . $core->demandes_status[$demande->status] . ' (<a href="#" class="ajax" rel="resetDemande/' . $demande->demande_id . '" title="' . __('Réinitialiser la demande') . '">x</a>)</td>';\r
+                               }\r
+                       } elseif ($demande->status == 2) {\r
+                               if ($demande->revendeur == $core->user->utilisateur_id) {\r
+                                       $res .= '<td><a href="#" class="ajax" rel="reponseDemande/' . $demande->demande_id . '/' . $demande->revendeur . '/-1/1">' . $core->demandes_status[$demande->status] . '</a></td>';\r
+                               } else {\r
+                                       $res .= '<td>' . $core->demandes_status[$demande->status] . '</td>';\r
+                               }\r
+                       }\r
+                       // On ne peut éditer que si la facture est non traitée et qu'elle n'a pas commencé à être éditée par un autre administrateur\r
+                       if (($demande->administrateur == 0 || $demande->administrateur == $core->user->utilisateur_id) && $demande->status == 0) {\r
+                               $res .= '<td class="action"><a href="#" class="popup" rel="formDemande/' . $demande->demande_id . '">' . cubeMedia::image(IMG . '/edit.png') . '</a></td>';\r
+                       } else {\r
+                               $res .= '<td></td>';\r
+                       }\r
+                       // On n'affiche le bouton "Supprimer" que si la demande est non-traitée\r
+                       if (($demande->administrateur == 0 || $demande->administrateur == $core->user->utilisateur_id) && $demande->status == 0) {\r
+                               $res .= '<td class="action"><a href="#" class="ajax" rel="supprimeDemande/' . $demande->demande_id . '" title="' . __('Êtes-vous certain de vouloir supprimer cette demande ?') . '">' . cubeMedia::image(IMG . '/delete.png') . '</a></td>';\r
+                       } else {\r
+                               $res .= '<td></td>';\r
+                       }\r
+                       $res .= '</tr>';\r
+                       $i++;\r
+               }\r
+               if (!isset($settings['search']) || is_null($settings['search'])) {\r
+                       $odd = cubeMath::isOdd($i)?' class="odd"':'';\r
+                       $res .= '<tr' . $odd . '><td colspan="10">';\r
+                       $res .= commonPage::pager($settings['page'], $dao->count($core->user) , $settings['par_page'], 'page' . $change . '/%d');\r
+                       $res .= commonUrl::formParPage('parPage' . $change, $settings['par_page'], __('demandes'));\r
+                       $res .= '</td></tr>';\r
+               }\r
+               $res .= '</table>';\r
+               return $res;\r
+       }\r
+\r
+       public static function formDemande($demande_id = 'new')\r
+       {\r
+               global $core;\r
+               commonDroits::min(5);\r
+               $dao = new wsDAODemande($core->con);\r
+               $daoUtilisateur = new commonDAOUtilisateur($core->con);\r
+               $demande = $dao->selectById($demande_id);\r
+               if ($demande->administrateur != 0 && $demande->administrateur != $core->user->utilisateur_id) {\r
+                       $res = '<tr><td colspan="2"><p class="center">' . __("Cette demande est actuellement en cours d'édition par un autre administrateur") . '</p></td></tr>';\r
+                       return $res;\r
+               }\r
+               if ($demande->status > 1) {\r
+                       $res = '<tr><td colspan="2"><p class="center">' . __("Cette demande est actuellement en cours de traitement") . '</p></td></tr>';\r
+                       return $res;\r
+               }\r
+               // On place la demande comme en cours d'édition\r
+               $dao->setAdministrateur($demande_id, $core->user->utilisateur_id);\r
+               // On vérifie que l'utilisateur n'est pas déjà géré par un revendeur\r
+               $demandeur = $daoUtilisateur->selectById($demande->utilisateur, 'utilisateurs_entreprise');\r
+               $administrateurs = $daoUtilisateur->selectWSAdministrateursId();\r
+               if (!is_null($demandeur->ws_admin) && !in_array($demandeur->ws_admin, $administrateurs)) {\r
+                       // Si déjà géré par un revendeur\r
+                       $revendeur = $daoUtilisateur->selectById($demandeur->ws_admin, 'utilisateurs_entreprise');\r
+                       $actions[__('Je confie la demande à ' . $revendeur->rs . ' (' . $revendeur->prenom . ' ' . $revendeur->nom . ')')] = $demandeur->ws_admin;\r
+               } else {\r
+                       $liste = $daoUtilisateur->selectWSRevendeursFacturables();\r
+                       $revendeurs = array();\r
+                       foreach($liste as $revendeur) {\r
+                               $revendeurs[$revendeur->rs . '(' . $revendeur->prenom . ' ' . $revendeur->nom . ')'] = $revendeur->utilisateur_id;\r
+                       }\r
+\r
+                       $actions = array(__('Je vais me charger de cette demande') => $core->user->utilisateur_id);\r
+                       $actions[' '] = array();\r
+                       $actions[__('Je confie la demande à') . ' : '] = $revendeurs;\r
+               }\r
+\r
+               $res = '<tr><td>' . __('Numéro de demande') . '</td><td>' . form::hidden('demande_id', $demande->demande_id) . '' . $demande->demande_id . '</td></tr>';\r
+               $res .= '<tr><td>' . __('Date de la demande') . '</td><td>' . date(__('d/m/Y H:i'), $demande->date) . '</td></tr>';\r
+               $res .= '<tr><td>' . __('Emetteur de la demande') . '</td><td><a href="#" class="popup" rel="formClient/' . $demande->entreprise . '">' . $demande->utilisateur_nom . '</a></td></tr>';\r
+               $res .= '<tr><td>' . __('Nombre de pages') . '</td><td>' . $demande->pages . '</td></tr>';\r
+               $res .= '<tr><td>' . __('Nombre de liens') . '</td><td>' . $demande->liens . '</td></tr>';\r
+               $res .= '<tr><td>' . __('Nombre de langues') . '</td><td>' . $demande->langues . '</td></tr>';\r
+               $res .= '<tr><td>' . __('Détails') . '</td><td>' . $demande->details . '</td></tr>';\r
+               $res .= '<tr><td>' . __('Action') . '</td><td>' . form::combo('revendeur', $actions) . '</td></tr>';\r
+               $res .= '<tr><td></td></tr>';\r
+\r
+               return $res;\r
+       }\r
+\r
+       public static function reponseDemande($args)\r
+       {\r
+               global $core;\r
+\r
+               commonDroits::min(3);\r
+\r
+               $res = commonPage::barre();\r
+               $res .= commonPage::tMain(null, false);\r
+\r
+               $res .= commonPage::bh();\r
+\r
+               $demande_id = $args[1];\r
+               $revendeur_id = $args[2];\r
+\r
+               $dao = new wsDAODemande($core->con);\r
+               $demande = $dao->selectById($demande_id);\r
+               if ($demande->revendeur != $revendeur_id || $demande->revendeur != $core->user->utilisateur_id) {\r
+                       commonDroits::error();\r
+                       exit;\r
+               }\r
+\r
+               $res = commonPage::barre();\r
+               $res .= commonPage::tMain();\r
+               $res .= commonPage::bh();\r
+               $res .= '<div id="accepteDemandes">';\r
+               $res .= '<h2>' . $core->typo->Titre(__('Prendre en charge une demande de devis')) . '</h2>';\r
+               $res .= '<br /><br />';\r
+               $res .= '<p>' . __('Si vous acceptez de traiter la demande suivante, veuillez cliquer sur le bouton "Accepter la demande" situé à droite de la description.');\r
+               $res .= ' ' . __('Vous avez également la possibilité de décliner la demande en cliquant sur le bouton "Décliner la demande"') . "</p>";\r
+               $res .= '<br /><br />';\r
+\r
+               $res .= '<table>';\r
+               $res .= '<tr><th class="left" colspan="2">' . __("Détails de la demande") . '</th><th class="left" style="width:40%">' . __('Votre action') . '</th></tr>';\r
+               $res .= '<tr><td>' . __('Numéro de demande') . '</td><td>' . $demande->demande_id . '</td>';\r
+               $res .= '<td>' . '<a href="#" class="ajax" rel="reponseDemande/' . $demande_id . '/' . $revendeur_id . '/1" >' . cubeMedia::cssRollover($core->typo->BookTelecharger('Accepter la demande', '', false)) . '</a>' . '</td></tr>';\r
+               $res .= '<tr><td>' . __('Date de la demande') . '</td><td>' . date(__('d/m/Y H:i'), $demande->date) . '</td>';\r
+               $res .= '<td>' . '<a href="#" class="ajax" rel="reponseDemande/' . $demande_id . '/' . $revendeur_id . '/0">' . cubeMedia::cssRollover($core->typo->Supprimer('Décliner la demande', '', false)) . '</a>' . '</td>';\r
+               $res .= '</tr>';\r
+               $res .= '<tr><td>' . __('Client') . ' / ' . __('Prospect') . '</td><td><a href="#" class="popup" rel="formClient/' . $demande->entreprise . '">' . $demande->utilisateur_nom . '</a></td></tr>';\r
+               $res .= '<tr><td>' . __('Nombre de pages') . '</td><td>' . $demande->pages . '</td></tr>';\r
+               $res .= '<tr><td>' . __('Nombre de liens') . '</td><td>' . $demande->liens . '</td></tr>';\r
+               $res .= '<tr><td>' . __('Nombre de langues') . '</td><td>' . $demande->langues . '</td></tr>';\r
+               $res .= '<tr><td>' . __('Détails') . '</td><td>' . $demande->details . '</td></tr>';\r
+               $res .= '</table>';\r
+\r
+               $res .= '</div>';\r
+               $res .= commonPage::bf();\r
+               $res .= commonPage::bMain();\r
+               return $res;\r
+       }\r
+}\r
+\r
+?>
\ No newline at end of file
diff --git a/inc/ws/Controlleur/url/class.ws.url.traduction.php b/inc/ws/Controlleur/url/class.ws.url.traduction.php
new file mode 100644 (file)
index 0000000..7efd737
--- /dev/null
@@ -0,0 +1,115 @@
+<?php\r
+class wsUrlTraduction{\r
+       public static function traductions($args)\r
+       {\r
+               global $core;\r
+\r
+               commonDroits::min(5);\r
+\r
+               if (count($args) < 2) {\r
+                       $args[1] = 'fr';\r
+               }\r
+\r
+               $allLangs = cubeLang::getCodes($core->user->lang);\r
+               $existingLangs = array();\r
+\r
+               $dao = new wsDAOLang($core->con);\r
+               $langs = $dao->selectAll();\r
+               foreach($langs as $lang) {\r
+                       if (!isset($allLangs[$lang->lang_id])) {\r
+                               continue;\r
+                       }\r
+                       $existingLangs[$lang->lang_id] = $allLangs[$lang->lang_id];\r
+\r
+                       unset($allLangs[$lang->lang_id]);\r
+               }\r
+\r
+               $langs = array(__('Langues configurées') => array_flip($existingLangs), __('Autres langues') => array_flip($allLangs));\r
+\r
+               $res = commonPage::barre();\r
+               $res .= commonPage::tMain(null, false);\r
+\r
+               $res .= commonPage::bh();\r
+               $res .= '<form action="changeLang" method="post" class="submitonchange">';\r
+               $res .= '<table class="liste">';\r
+               $res .= '<tr><td class="center">' . __('Sélectionnez la langue à configurer') . ' : ' . form::combo('lang', $langs, $args[1]) . ' </td></tr>';\r
+               $res .= '</table>';\r
+               $res .= '</form>';\r
+               $res .= commonPage::bf();\r
+\r
+               $res .= '<div id="formLang">';\r
+               $res .= self::formLang($args[1]);\r
+               $res .= '</div>';\r
+               $res .= commonPage::bMain(true);\r
+\r
+               return $res;\r
+       }\r
+\r
+       public static function formLang($lang_id)\r
+       {\r
+               commonDroits::min(5);\r
+               global $core;\r
+               $dao = new wsDAOLang($core->con);\r
+               $lang = $dao->selectById($lang_id);\r
+\r
+               $res = '<form action="saveLang" method="post">';\r
+\r
+               $res .= commonPage::bh();\r
+               $res .= '<table class="liste">';\r
+               $res .= '<tr><td>' . __('Police de caractères') . ' : </td><td>' . form::hidden('lang', $lang_id) . form::combo('font', self::getFonts(), $lang->font) . '</td></tr>';\r
+               $res .= '<tr class="odd"><td>' . __('Jeux de caractères') . ' : </td><td>' . form::combo('charset', self::getCharsets(), $lang->charset) . '</td></tr>';\r
+               $res .= '<tr><td>' . __("Langue de l'installeur") . ' : </td><td>' . form::combo('nsis', self::getNSISLangs(), $lang->nsis) . '</td></tr>';\r
+               $res .= '<tr><td colspan="2" class="right odd"><a href="#" class="submit">' . $core->typo->Ajouter('Valider') . '</a></td></tr>';\r
+               $res .= '</table>';\r
+               $res .= commonPage::bf();\r
+\r
+               $res .= commonPage::bh();\r
+               $res .= cubeLang::translationForm(PLAYER_SOURCES, $lang_id , null, 'liste', array(), '<a href="#" class="submit">' . $core->typo->Ajouter(__('Enregistrer')) . '</a>', $lang->traductions);\r
+               $res .= commonPage::bf();\r
+               $res .= '</form>';\r
+               return $res;\r
+       }\r
+\r
+       public static function getFonts()\r
+       {\r
+               $formats = array('ttf', 'otf', 'TTF', 'OTF');\r
+\r
+               $dr = opendir(FONT_PATH);\r
+               $fonts = array();\r
+               while ($file = readdir($dr)) {\r
+                       if ($file == '.' || $file == '..' || !in_array(files::getExtension($file), $formats)) {\r
+                               continue;\r
+                       }\r
+                       $fonts[$file] = $file;\r
+               }\r
+               return $fonts;\r
+       }\r
+\r
+       protected static function getCharsets()\r
+       {\r
+               $sets = cubeFlexFontAsset::getSets();\r
+               $res = array();\r
+               foreach($sets as $k => $v) {\r
+                       $res[$k] = $k;\r
+               }\r
+               return $res;\r
+       }\r
+\r
+       protected static function getNSISLangs()\r
+       {\r
+               $res = array();\r
+               $dir = WS_FILES . '/nsislangs';\r
+               $dr = opendir($dir);\r
+               while ($file = readdir($dr)) {\r
+                       if ($file == '.' || $file == '..') {\r
+                               continue;\r
+                       }\r
+                       $e = explode('.', $file);\r
+                       $res[$e[0]] = $e[0];\r
+               }\r
+\r
+               ksort($res);\r
+               return $res;\r
+       }\r
+}\r
+?>
\ No newline at end of file
index 44867a15a491f9bc45b96c86b07bcd3d0c85c8a4..e39de15826a733f9c75cdf05f3dc59faf40831bb 100644 (file)
@@ -102,17 +102,22 @@ class wsDAODemande extends commonDAO {
 \r
        public function accepteDemande($demande_id, $revendeur)\r
        {\r
-               $c = $this->con->openCursor('demandes');\r
-               $c->status = 2;\r
-               $c->update('WHERE demande_id=\'' . $this->con->escape($demande_id) . '\'');\r
-\r
-               $demande = $this->selectById($demande_id);\r
+               $demande = $this->setStatus($demande_id, 2);\r
                // Mets également à jour l'entreprise afin d'associer client et revendeur\r
                $daoEntreprise = new commonDAOEntreprise($this->con);\r
                $daoEntreprise->setWSAdmin($demande->entreprise, $revendeur);\r
                return $demande;\r
        }\r
 \r
+       public function setStatus($demande_id, $status)\r
+       {\r
+               $c = $this->con->openCursor('demandes');\r
+               $c->status = $status;\r
+               $c->update('WHERE demande_id=\'' . $this->con->escape($demande_id) . '\'');\r
+\r
+               return $this->selectById($demande_id);\r
+       }\r
+\r
        public function setRevendeur($demande_id, $revendeur)\r
        {\r
                // Mets à jour l'entreprise\r