From: vincent@cubedesigners.com Date: Mon, 7 Feb 2011 17:59:51 +0000 (+0000) Subject: (no commit message) X-Git-Url: http://git.cubedesigners.com/?a=commitdiff_plain;h=228a91babd5f5850e6d2480b1e58df4ca6dad217;p=cubeextranet.git --- diff --git a/images/ws/macos.png b/images/ws/macos.png new file mode 100644 index 000000000..a8577d79f Binary files /dev/null and b/images/ws/macos.png differ diff --git a/inc/commons/class.common.ajax.php b/inc/commons/class.common.ajax.php index 5ba325ee7..5438da740 100644 --- a/inc/commons/class.common.ajax.php +++ b/inc/commons/class.common.ajax.php @@ -1,6 +1,6 @@ '; $res .= commonPage::bf(); - echo $res; - exit; + if (!$return) { + echo $res; + exit; + } + return $res; } public static function page($liste, $page) diff --git a/inc/ws/Controlleur/_common.php b/inc/ws/Controlleur/_common.php index 898014015..99be5facb 100644 --- a/inc/ws/Controlleur/_common.php +++ b/inc/ws/Controlleur/_common.php @@ -9,5 +9,6 @@ $__autoload['wsStats'] = dirname(__FILE__) . '/class.ws.stats.php'; $__autoload['wsServices'] = dirname(__FILE__) . '/class.ws.services.php'; $__autoload['wsUsersTree'] = dirname(__FILE__) . '/class.ws.users.tree.php'; $__autoload['wsSecureSWF'] = dirname(__FILE__) . '/class.ws.secure.swf.php'; +$__autoload['wsBookPackager'] = dirname(__FILE__) . '/class.ws.book.packager.php'; ?> \ No newline at end of file diff --git a/inc/ws/Controlleur/class.ws.ajax.php b/inc/ws/Controlleur/class.ws.ajax.php index 6d5d86d05..3f2e25dd9 100644 --- a/inc/ws/Controlleur/class.ws.ajax.php +++ b/inc/ws/Controlleur/class.ws.ajax.php @@ -197,6 +197,39 @@ class wsAjax extends cubeAjax { $x->addContent('listeBooks', wsUrl::listeBooks()); } + public static function downbook($args, &$x) + { + global $core; + $book_id = $args[1]; + $version = $args[2]; + + $dao = new wsDAOBook($core->con); + $book = $dao->selectById($book_id); + + if (!in_array($book->proprietaire_id, explode(',', $core->user->ws_rights))) { + commonDroits::error(); + } + + if (isset($_POST['valide'])) { + $book = $dao->setStatus($book_id, 1); + } + + if (!wsDroits::admin()) { + if ($book->status < 1) { + $popup = commonAjax::form('downbook/' . $book_id . '/' . $version, + __('Téléchargement du Fluidbook'), + wsUrl::valideDownload($book_id, $version), + __('Télécharger'),2,'','',true); + + $x->addOpenPopup($popup); + return; + } + } + + $packager = new wsBookPackager($book_id); + $x->addRedirection($packager->makePackage($version)); + } + public static function changeLang($args, &$x) { $x->addContent('formLang', wsUrl::formLang($_POST['lang'])); diff --git a/inc/ws/Controlleur/class.ws.book.packager.php b/inc/ws/Controlleur/class.ws.book.packager.php new file mode 100644 index 000000000..c94960eaa --- /dev/null +++ b/inc/ws/Controlleur/class.ws.book.packager.php @@ -0,0 +1,12 @@ + \ No newline at end of file diff --git a/inc/ws/Controlleur/class.ws.url.php b/inc/ws/Controlleur/class.ws.url.php index 248795827..434499d13 100644 --- a/inc/ws/Controlleur/class.ws.url.php +++ b/inc/ws/Controlleur/class.ws.url.php @@ -40,13 +40,17 @@ class wsUrl { $settings = is_null($settings)?$core->user->getSettings('books'):$settings; $change = is_null($dashboard)?'Books':'Dashboard/' . $dashboard; $dao = new wsDAOBook($core->con); + $context_id = is_null($dashboard)?'contextBook':'contextDashboard_' . $dashboard; + if (isset($settings['search']) && !is_null($settings['search'])) { $dao->setSearch($settings['search']); } $dao->setFiltres($settings['filtres']); $liste = $dao->getListe($settings['orderby'], $settings['sens'], $settings['limit'], $core->user); - $res = ''; + $res = self::contextBookDownload($context_id); + + $res .= '
'; $res .= ''; $res .= ''; $res .= ''; @@ -96,7 +100,7 @@ class wsUrl { $res .= ''; $res .= ''; $res .= ''; - $res .= ''; + $res .= ''; if ($droits->creation) { $res .= ''; } @@ -114,20 +118,22 @@ class wsUrl { return $res; } - public static function contextBookDownload() + public static function contextBookDownload($id) { global $core; - $res = '
'; + + $versions = array(); + $versions['html'] = array('title' => __('Version online'), 'icon' => cubeMedia::silk('page_white_world.png')); + $versions['win-exe'] = array('title' => __('Version offline') . ' - ' . __('Executable Windows'), 'icon' => cubeMedia::silk('application_view_tile.png')); + $versions['win-ins'] = array('title' => __('Version offline') . ' - ' . __('Installeur Auto-executable Windows'), 'icon' => cubeMedia::silk('application_view_tile.png')); + $versions['mac-exe'] = array('title' => __('Version offline') . ' - ' . __('Exécutable Mac OS X'), 'icon' => cubeMedia::image(IMG . '/macos.png')); + $versions['win-cd'] = array('title' => __('Version offline') . ' - ' . __('CD-ROM') . ' / ' . __('Clé USB'), 'icon' => cubeMedia::silk('cd.png')); + + $res = '
'; $res .= '
'; return $res; @@ -434,6 +440,16 @@ html{height:100%}' . "\n"; return $res; } + public static function valideDownload() + { + global $core; + + $res .= '
'; + $res .= ''; + + return $res; + } + public static function testAS($args) { global $core; diff --git a/inc/ws/DAO/class.ws.dao.book.php b/inc/ws/DAO/class.ws.dao.book.php index 2d5c923fa..d303ba612 100644 --- a/inc/ws/DAO/class.ws.dao.book.php +++ b/inc/ws/DAO/class.ws.dao.book.php @@ -110,9 +110,9 @@ class wsDAOBook extends commonDAO { { $r = $this->con->select('SELECT * FROM books_vue WHERE book_id=\'' . $this->con->escape($book_id) . '\''); - $parametres=unserialize($r->parametres); + $parametres = unserialize($r->parametres); $parametres->setParent($this); - $parametres->title=$nom; + $parametres->title = $nom; $c = $this->con->openCursor('books'); $c->proprietaire = $createur; @@ -327,6 +327,14 @@ class wsDAOBook extends commonDAO { $c->update('WHERE book_id=\'' . $this->con->escape($book_id) . '\''); } + public function setStatus($book_id, $status) + { + $c = $this->con->openCursor('books'); + $c->status = $status; + $c->update('WHERE book_id=\'' . $this->con->escape($book_id) . '\''); + return $this->selectById($book_id); + } + public function setChaptersFromOldFluidbook($book_id) { $xml = simplexml_load_file('http://ws.fluidbook.com/books/' . $book_id . '/data/links.xml'); diff --git a/style/ws/style.css b/style/ws/style.css index 50ebfd107..a776abb3c 100644 --- a/style/ws/style.css +++ b/style/ws/style.css @@ -499,3 +499,12 @@ th.stats_col{ float:left; margin-left:0px; } + +/* Download book contextMenu */ +.downbookContextMenu li{ + height:auto; +} + +.downbookContextMenu a{ + text-decoration:none; +}
' . commonUrl::orderby('#', 'book_id', $settings, 'sort' . $change) . '' . commonUrl::orderby(__('Titre de la publication'), 'nom', $settings, 'sort' . $change) . '' . commonUrl::orderby(__(''), 'lang', $settings, 'sort' . $change) . '' . $btVoir . '' . $btEdit . '' . $btStats . '' . $btDownload . '' . $btDownload . '' . $btDel . '
' . __("Le téléchargement du fluidbook implique qu'il a été testé et définitivement validé.") . '
' . __("Si vous le téléchargez, il vous sera facturé selon les conditions stipulées dans votre contrat.") . '