]> _ Git - cubeextranet.git/commitdiff
(no commit message)
authorvincent@cubedesigners.com <vincent@cubedesigners.com@f5622870-0f3c-0410-866d-9cb505b7a8ef>
Wed, 25 May 2011 13:59:22 +0000 (13:59 +0000)
committervincent@cubedesigners.com <vincent@cubedesigners.com@f5622870-0f3c-0410-866d-9cb505b7a8ef>
Wed, 25 May 2011 13:59:22 +0000 (13:59 +0000)
inc/ws/Controlleur/class.ws.ajax.php
inc/ws/Controlleur/class.ws.url.php
inc/ws/DAO/class.ws.dao.document.php
js/ws.js

index 133f72d178dfd0a79d5a094b31c8fdb23c97b213..c9ccd20f08f915b233db17dcb7c7461b34ac1762 100644 (file)
@@ -1,8 +1,8 @@
 <?php\r
 \r
 class wsAjax extends cubeAjax {\r
-       public static function formClient($args, &$x)\r
-       {\r
+\r
+       public static function formClient($args, &$x) {\r
                global $core;\r
                if ($args[1] == 'new') {\r
                        $extra = '';\r
@@ -14,16 +14,14 @@ class wsAjax extends cubeAjax {
                commonAjax::form('saveClient', __("Edition d'un client"), wsUrl::formClient($args[1]), false, 2, '', $extra);\r
        }\r
 \r
-       public static function formContact($args, &$x)\r
-       {\r
+       public static function formContact($args, &$x) {\r
                if (!isset($args[2])) {\r
                        $args[2] = null;\r
                }\r
                commonAjax::form('saveContact', __("Edition d'un contact"), wsUrl::formContact($args[1], $args[2]));\r
        }\r
 \r
-       public static function saveClient($args, &$x)\r
-       {\r
+       public static function saveClient($args, &$x) {\r
                global $core;\r
                $dao = new commonDAOEntreprise($core->con);\r
                // Creation de l'entreprise\r
@@ -47,8 +45,7 @@ class wsAjax extends cubeAjax {
                        $daoClient = new commonDAOClient($core->con);\r
                        try {\r
                                $daoClient->sauve($data);\r
-                       }\r
-                       catch(exception $e) {\r
+                       } catch (exception $e) {\r
                                $dao->supprime($entreprise->entreprise_id);\r
                        }\r
                }\r
@@ -59,8 +56,7 @@ class wsAjax extends cubeAjax {
                $x->addClosePopup();\r
        }\r
 \r
-       public static function saveContact($args, &$x)\r
-       {\r
+       public static function saveContact($args, &$x) {\r
                global $core;\r
                $dao = new commonDAOClient($core->con);\r
                $client = $dao->sauve($_POST);\r
@@ -70,7 +66,7 @@ class wsAjax extends cubeAjax {
                $x->addContent('listeContacts', wsUrl::listeContacts($client->entreprise));\r
                $contacts = array();\r
                $client_contacts = $dao->getContactsOfEntreprise($client->entreprise);\r
-               foreach($client_contacts as $c) {\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
@@ -80,8 +76,7 @@ class wsAjax extends cubeAjax {
                $x->addPopupDimensions();\r
        }\r
 \r
-       public static function supprimeClient($args, &$x)\r
-       {\r
+       public static function supprimeClient($args, &$x) {\r
                global $core;\r
 \r
                $dao = new commonDAOEntreprise($core->con);\r
@@ -92,31 +87,26 @@ class wsAjax extends cubeAjax {
                $x->addContent('listeClients', wsUrl::listeClients());\r
        }\r
 \r
-       public static function searchClients($args, &$x)\r
-       {\r
+       public static function searchClients($args, &$x) {\r
                $x->addContent('listeClients', wsUrl::listeClients());\r
        }\r
 \r
-       public static function sortClient($args, &$x)\r
-       {\r
+       public static function sortClient($args, &$x) {\r
                commonAjax::sort('clients_ws', $args[1]);\r
                $x->addContent('listeClients', wsUrl::listeClients());\r
        }\r
 \r
-       public static function pageClient($args, &$x)\r
-       {\r
+       public static function pageClient($args, &$x) {\r
                commonAjax::page('clients_ws', $args[1]);\r
                $x->addContent('listeClients', wsUrl::listeClients());\r
        }\r
 \r
-       public static function parPageClient($args, &$x)\r
-       {\r
+       public static function parPageClient($args, &$x) {\r
                commonAjax::parPage('clients_ws', $_POST['par_page']);\r
                $x->addContent('listeClients', wsUrl::listeClients());\r
        }\r
 \r
-       public static function filtreClients($args, &$x)\r
-       {\r
+       public static function filtreClients($args, &$x) {\r
                if (isset($args[1]) && $args[1] == 'efface') {\r
                        commonAjax::filtre('clients_ws');\r
                        $x->addReload();\r
@@ -127,49 +117,41 @@ class wsAjax extends cubeAjax {
                }\r
        }\r
 \r
-       public static function supprimeBook($args, &$x)\r
-       {\r
+       public static function supprimeBook($args, &$x) {\r
                global $core;\r
                $dao = new wsDAOBook($core->con);\r
                $dao->supprime($args[1]);\r
                $x->addContent('listeBooks', wsUrl::listeBooks());\r
        }\r
 \r
-       public static function searchPublications($args, &$x)\r
-       {\r
+       public static function searchPublications($args, &$x) {\r
                $x->addContent('listeBooks', wsUrl::listeBooks());\r
        }\r
 \r
-       public static function pageBooks($args, &$x)\r
-       {\r
+       public static function pageBooks($args, &$x) {\r
                commonAjax::page('books', $args[1]);\r
                $x->addContent('listeBooks', wsUrl::listeBooks());\r
        }\r
 \r
-       public static function parPageBooks($args, &$x)\r
-       {\r
+       public static function parPageBooks($args, &$x) {\r
                commonAjax::parPage('books', $_POST['par_page']);\r
                $x->addContent('listeBooks', wsUrl::listeBooks());\r
        }\r
 \r
-       public static function sortBooks($args, &$x)\r
-       {\r
+       public static function sortBooks($args, &$x) {\r
                commonAjax::sort('books', $args[1]);\r
                $x->addContent('listeBooks', wsUrl::listeBooks());\r
        }\r
 \r
-       public static function newBookForm($args, &$x)\r
-       {\r
+       public static function newBookForm($args, &$x) {\r
                commonAjax::form('newBook', __("Créer une nouvelle publication à partir d'une existante"), wsUrl::chooseExistingBook(), __('Créer une nouvelle publication'), 3);\r
        }\r
 \r
-       public static function formChangeBookProprietaire($args, &$x)\r
-       {\r
+       public static function formChangeBookProprietaire($args, &$x) {\r
                commonAjax::form('changeBookProprietaire/' . $args[1], __("Modifier le propriétaire de la publication"), wsUrl::changeBookProprietaire($args[1]), __('Enregistrer'), 3);\r
        }\r
 \r
-       public static function filtreBooks($args, &$x)\r
-       {\r
+       public static function filtreBooks($args, &$x) {\r
                if (isset($args[1]) && $args[1] == 'efface') {\r
                        commonAjax::filtre('books');\r
                        $x->addReload();\r
@@ -180,8 +162,7 @@ class wsAjax extends cubeAjax {
                }\r
        }\r
 \r
-       public static function newBook($args, &$x)\r
-       {\r
+       public static function newBook($args, &$x) {\r
                global $core;\r
                $dao = new wsDAOBook($core->con);\r
                if ($_POST['book'] != '') {\r
@@ -195,8 +176,7 @@ class wsAjax extends cubeAjax {
                $x->addTruePopup(SITE_PATH . 'editor/' . $book->book_id);\r
        }\r
 \r
-       public static function changeBookProprietaire($args, &$x)\r
-       {\r
+       public static function changeBookProprietaire($args, &$x) {\r
                global $core;\r
                if ($_POST['proprietaire'] == '') {\r
                        $x->addError('book_proprietaire');\r
@@ -209,8 +189,7 @@ class wsAjax extends cubeAjax {
                $x->addContent('listeBooks', wsUrl::listeBooks());\r
        }\r
 \r
-       public static function downbook($args, &$x)\r
-       {\r
+       public static function downbook($args, &$x) {\r
                global $core;\r
                $book_id = $args[1];\r
                $version = $args[2];\r
@@ -228,10 +207,7 @@ class wsAjax extends cubeAjax {
 \r
                if (!wsDroits::admin()) {\r
                        if ($book->status < 1) {\r
-                               $popup = commonAjax::form('downbook/' . $book_id . '/' . $version,\r
-                                       __('Téléchargement du Fluidbook'),\r
-                                       wsUrl::valideDownload($book_id, $version),\r
-                                       __('Télécharger'), 2, '', '', true);\r
+                               $popup = commonAjax::form('downbook/' . $book_id . '/' . $version, __('Téléchargement du Fluidbook'), wsUrl::valideDownload($book_id, $version), __('Télécharger'), 2, '', '', true);\r
 \r
                                $x->addOpenPopup($popup);\r
                                return;\r
@@ -242,8 +218,7 @@ class wsAjax extends cubeAjax {
                $x->addRedirection($url);\r
        }\r
 \r
-       public static function statusBook($args, &$x)\r
-       {\r
+       public static function statusBook($args, &$x) {\r
                global $core;\r
 \r
                $book_id = $args[1];\r
@@ -259,13 +234,11 @@ class wsAjax extends cubeAjax {
                $x->addContent('listeBooks', wsUrl::listeBooks());\r
        }\r
 \r
-       public static function formBookChooseProject($book_id)\r
-       {\r
+       public static function formBookChooseProject($book_id) {\r
                return commonAjax::form('bookChooseProject', __("Selection d'un projet"), wsUrl::chooseBookProject($book_id), __('Suivant'), 3, '', '', true);\r
        }\r
 \r
-       public static function bookChooseProject($args, &$x)\r
-       {\r
+       public static function bookChooseProject($args, &$x) {\r
                global $core;\r
 \r
                $book_id = $_POST['book_id'];\r
@@ -296,13 +269,11 @@ class wsAjax extends cubeAjax {
                $x->addChangePopup(self::formBookChooseTache($book_id, $project));\r
        }\r
 \r
-       public static function formBookChooseTache($book_id, $project)\r
-       {\r
+       public static function formBookChooseTache($book_id, $project) {\r
                return commonAjax::form('bookChooseTache', __("Selection d'une tâche"), wsUrl::chooseBookTache($book_id, $project), __('Enregistrer'), 3, '', '', true);\r
        }\r
 \r
-       public static function bookChooseTache($args, &$x)\r
-       {\r
+       public static function bookChooseTache($args, &$x) {\r
                global $core;\r
 \r
                $book_id = $_POST['book_id'];\r
@@ -349,13 +320,11 @@ class wsAjax extends cubeAjax {
                $x->addContent('listeBooks', wsUrl::listeBooks());\r
        }\r
 \r
-       public static function changeLang($args, &$x)\r
-       {\r
+       public static function changeLang($args, &$x) {\r
                $x->addContent('formLang', wsUrl::formLang($_POST['lang']));\r
        }\r
 \r
-       public static function saveLang($args, &$x)\r
-       {\r
+       public static function saveLang($args, &$x) {\r
                global $core;\r
                $dao = new wsDAOLang($core->con);\r
                $data['lang_id'] = $_POST['lang'];\r
@@ -367,8 +336,7 @@ class wsAjax extends cubeAjax {
                $x->addAlert(__('Paramètres de la langue et traductions enregistrées'));\r
        }\r
 \r
-       public static function demandeDevis($args, &$x)\r
-       {\r
+       public static function demandeDevis($args, &$x) {\r
                global $core;\r
                if (!self::valideDemandeDevis($x)) {\r
                        return;\r
@@ -452,7 +420,7 @@ class wsAjax extends cubeAjax {
                $mail->to = FROM_EMAIL;\r
                $mail->subject = '[' . EMAIL_SUBJECT . '] Demande de devis';\r
                $body = 'Une demande de devis a été envoyée avec les informations suivantes :' . "\r\n\r\n";\r
-               foreach($fields as $f => $d) {\r
+               foreach ($fields as $f => $d) {\r
                        if ($_POST[$f] != '') {\r
                                if ($f == 'pays') {\r
                                        $body .= ' * ' . $d . ' : ' . cubeCountry::getCountry($_POST[$f], 'fr') . "\r\n";\r
@@ -470,11 +438,10 @@ class wsAjax extends cubeAjax {
                $core->refreshWSUsersTree();\r
        }\r
 \r
-       public static function valideDemandeDevis(&$x)\r
-       {\r
+       public static function valideDemandeDevis(&$x) {\r
                $d = unserialize(base64_decode($_GET['devis_form']));\r
                $d = cubeArray::array_flatten($d);\r
-               foreach($d as $k => $v) {\r
+               foreach ($d as $k => $v) {\r
                        $_POST[$k] = trim($v);\r
                }\r
                if (isset($_POST['pages'])) {\r
@@ -486,7 +453,7 @@ class wsAjax extends cubeAjax {
                // Validation des champs de formulaires\r
                $ok = true;\r
                $non_vides = array('nombre_pages', 'nom', 'adresse', 'code_postal', 'ville', 'pays');\r
-               foreach($non_vides as $nv) {\r
+               foreach ($non_vides as $nv) {\r
                        if (!isset($_POST[$nv]) || $_POST[$nv] == '') {\r
                                $x->addError($nv);\r
                                $ok = false;\r
@@ -508,31 +475,26 @@ class wsAjax extends cubeAjax {
                return $ok;\r
        }\r
 \r
-       public static function searchDemandes($args, &$x)\r
-       {\r
+       public static function searchDemandes($args, &$x) {\r
                $x->addContent('listeDemandes', wsUrl::listeDemandes());\r
        }\r
 \r
-       public static function sortDemandes($args, &$x)\r
-       {\r
+       public static function sortDemandes($args, &$x) {\r
                commonAjax::sort('demandes', $args[1]);\r
                $x->addContent('listeDemandes', wsUrl::listeDemandes());\r
        }\r
 \r
-       public static function pageDemandes($args, &$x)\r
-       {\r
+       public static function pageDemandes($args, &$x) {\r
                commonAjax::page('demandes', $args[1]);\r
                $x->addContent('listeDemandes', wsUrl::listeDemandes());\r
        }\r
 \r
-       public static function parPageDemandes($args, &$x)\r
-       {\r
+       public static function parPageDemandes($args, &$x) {\r
                commonAjax::parPage('demandes', $_POST['par_page']);\r
                $x->addContent('listeDemandes', wsUrl::listeDemandes());\r
        }\r
 \r
-       public static function supprimeDemande($args, &$x)\r
-       {\r
+       public static function supprimeDemande($args, &$x) {\r
                global $core;\r
                $demande_id = $args[1];\r
 \r
@@ -542,8 +504,7 @@ class wsAjax extends cubeAjax {
                $x->addContent('listeDemandes', wsUrl::listeDemandes());\r
        }\r
 \r
-       public static function filtreDemandes($args, &$x)\r
-       {\r
+       public static function filtreDemandes($args, &$x) {\r
                if (isset($args[1]) && $args[1] == 'efface') {\r
                        commonAjax::filtre('demandes');\r
                        $x->addReload();\r
@@ -554,16 +515,14 @@ class wsAjax extends cubeAjax {
                }\r
        }\r
 \r
-       public static function formDemande($args, &$x)\r
-       {\r
+       public static function formDemande($args, &$x) {\r
                if (!isset($args[2])) {\r
                        $args[2] = null;\r
                }\r
                commonAjax::form('saveDemande', __("Edition d'une demande"), wsUrl::formDemande($args[1], $args[2]));\r
        }\r
 \r
-       public static function saveDemande($args, &$x)\r
-       {\r
+       public static function saveDemande($args, &$x) {\r
                global $core;\r
                $dao = new wsDAODemande($core->con);\r
 \r
@@ -578,12 +537,11 @@ class wsAjax extends cubeAjax {
                        $demande = $dao->setRevendeur($_POST['demande_id'], $_POST['revendeur']);\r
                }\r
 \r
-               $x->addContent('listeDemandes' , wsUrl::listeDemandes());\r
+               $x->addContent('listeDemandes', wsUrl::listeDemandes());\r
                $x->addClosePopup();\r
        }\r
 \r
-       public static function sendDemandeToRevendeur($demande, $revendeur)\r
-       {\r
+       public static function sendDemandeToRevendeur($demande, $revendeur) {\r
                global $core;\r
 \r
                $dao = new commonDAOUtilisateur($core->con);\r
@@ -600,7 +558,7 @@ class wsAjax extends cubeAjax {
                        'liens' => __('Liens'),\r
                        'langues' => __('Langues'),\r
                        'details' => __('Commentaires'));\r
-               foreach($fields as $p => $t) {\r
+               foreach ($fields as $p => $t) {\r
                        if ($demande->$p != '') {\r
                                $body .= ' * ' . $t . ' : ' . $demande->$p . "\r\n";\r
                        }\r
@@ -614,7 +572,7 @@ class wsAjax extends cubeAjax {
                        'code_postal' => __('Code postal'),\r
                        'ville' => __('Ville'),\r
                        'pays' => 'Pays');\r
-               foreach($fields as $p => $t) {\r
+               foreach ($fields as $p => $t) {\r
                        if ($utilisateur->$p != '') {\r
                                if ($p == 'pays') {\r
                                        $body .= ' * ' . $t . ' : ' . cubeCountry::getCountry($utilisateur->$p, $revendeur->lang) . "\r\n";\r
@@ -636,8 +594,7 @@ class wsAjax extends cubeAjax {
                fb($mail->send());\r
        }\r
 \r
-       public static function reponseDemande($args, &$x)\r
-       {\r
+       public static function reponseDemande($args, &$x) {\r
                global $core;\r
 \r
                $demande_id = $args[1];\r
@@ -661,31 +618,92 @@ class wsAjax extends cubeAjax {
                if (!isset($args[4])) {\r
                        $x->addRedirection(SITE_PATH);\r
                } else {\r
-                       $x->addContent('listeDemandes' , wsUrl::listeDemandes());\r
+                       $x->addContent('listeDemandes', wsUrl::listeDemandes());\r
                }\r
        }\r
 \r
-       public static function resetDemande($args, &$x)\r
-       {\r
+       public static function resetDemande($args, &$x) {\r
                global $core;\r
 \r
                $demande_id = $args[1];\r
 \r
                $dao = new wsDAODemande($core->con);\r
                $dao->reinitDemande($demande_id);\r
-               $x->addContent('listeDemandes' , wsUrl::listeDemandes());\r
+               $x->addContent('listeDemandes', wsUrl::listeDemandes());\r
        }\r
 \r
-       public static function restoreLinksVersion($args, &$x)\r
-       {\r
+       public static function restoreLinksVersion($args, &$x) {\r
                global $core;\r
 \r
                $book_id = $args[1];\r
                $date = $args[2];\r
 \r
                $dao = new wsDAODocument($core->con);\r
-               $dao->restoreLinksVersion($book_id, $date,$core->user->utilisateur_id);\r
+               $dao->restoreLinksVersion($book_id, $date, $core->user->utilisateur_id);\r
+       }\r
+\r
+       public static function importLinksAsExcel($args) {\r
+               global $core;\r
+               $book_id = $args[1];\r
+\r
+               $xls = new PHPExcel();\r
+               $reader = new PHPExcel_Reader_Excel2007();\r
+               $xls = $reader->load($_FILES['file']['tmp_name']);\r
+\r
+               $s = $xls->setActiveSheetIndexByName('Links');\r
+               $i = 0;\r
+               $links = array();\r
+               foreach ($s->getRowIterator() as $row) {\r
+                       $cellIterator = $row->getCellIterator();\r
+                       $cellIterator->setIterateOnlyExistingCells(false);\r
+                       if ($i == 0) {\r
+                               $cols = array();\r
+                               foreach ($cellIterator as $cell) {\r
+                                       $cols[] = $cell->getValue();\r
+                               }\r
+                       } else {\r
+                               $link = array();\r
+                               $j = 0;\r
+                               foreach ($cellIterator as $cell) {\r
+                                       $link[$cols[$j]] = $cell->getValue();\r
+                                       $j++;\r
+                               }\r
+                               $links[] = $link;\r
+                       }\r
+\r
+                       $i++;\r
+               }\r
+\r
+               $i = 0;\r
+               $rulers = array();\r
+               $s = $xls->setActiveSheetIndexByName('Rulers');\r
+               foreach ($s->getRowIterator() as $row) {\r
+                       $cellIterator = $row->getCellIterator();\r
+                       $cellIterator->setIterateOnlyExistingCells(false);\r
+                       if ($i == 0) {\r
+                               $cols = array();\r
+                               foreach ($cellIterator as $cell) {\r
+                                       $cols[] = $cell->getValue();\r
+                               }\r
+                       } else {\r
+                               $link = array();\r
+                               $j = 0;\r
+                               foreach ($cellIterator as $cell) {\r
+                                       $ruler[$cols[$j]] = $cell->getValue();\r
+                                       $j++;\r
+                               }\r
+\r
+                               $rulers[] = $ruler;\r
+                       }\r
+                       $i++;\r
+               }\r
+\r
+\r
+\r
+               $dao = new wsDAODocument($core->con);\r
+               $dao->setLinksAndRulers($book_id, json_encode($links), json_encode($rulers), 'Import from excel', $core->user->utilisateur_id);\r
        }\r
+\r
 }\r
 \r
 ?>
\ No newline at end of file
index 23300e0591db8f7251c3d42442481528b8dee510..e376ad592c145417bbb48b7f660991c8d0073a8c 100644 (file)
@@ -343,7 +343,7 @@ html{height:100%}' . "\n";
                $res .= '<body onload="this.focus();">';\r
                $res .= '<div id="restoreLinks">';\r
                $res.='<div class="center" style="padding:15px;">';\r
-               $res.='<form action="' . SITE_PATH . 'importLinksAsExcel/' . $book_id . '" method="post" enctype="multipart/form-data" class="notajax">';\r
+               $res.='<form action="importLinksAsExcel/' . $book_id . '" method="post" enctype="multipart/form-data" class="notajax" id="importLinksAsExcel">';\r
                $res.=__("Importer des liens à partir d'un fichier Excel") . ' : <input type="file" name="file" accept="*.xlsx" />';\r
                $res.='<input type="submit" value="' . __('Importer') . '" />';\r
                $res.='</form>';\r
@@ -486,76 +486,11 @@ html{height:100%}' . "\n";
                exit;\r
        }\r
 \r
-       public static function importLinksAsExcel($args) {\r
-               global $core;\r
-               $book_id = $args[1];\r
-\r
-               $xls = new PHPExcel();\r
-               $reader = new PHPExcel_Reader_Excel2007();\r
-               $xls = $reader->load($_FILES['file']['tmp_name']);\r
-\r
-               $s = $xls->setActiveSheetIndexByName('Links');\r
-               $i = 0;\r
-               $links = array();\r
-               foreach ($s->getRowIterator() as $row) {\r
-                       $cellIterator = $row->getCellIterator();\r
-                       $cellIterator->setIterateOnlyExistingCells(false);\r
-                       if ($i == 0) {\r
-                               $cols = array();\r
-                               foreach ($cellIterator as $cell) {\r
-                                       $cols[] = $cell->getValue();\r
-                               }\r
-                       } else {\r
-                               $link = array();\r
-                               $j = 0;\r
-                               foreach ($cellIterator as $cell) {\r
-                                       $link[$cols[$j]] = $cell->getValue();\r
-                                       $j++;\r
-                               }\r
-                               $links[] = $link;\r
-                       }\r
-\r
-                       $i++;\r
-               }\r
-\r
-               $i = 0;\r
-               $rulers = array();\r
-               $s = $xls->setActiveSheetIndexByName('Rulers');\r
-               foreach ($s->getRowIterator() as $row) {\r
-                       $cellIterator = $row->getCellIterator();\r
-                       $cellIterator->setIterateOnlyExistingCells(false);\r
-                       if ($i == 0) {\r
-                               $cols = array();\r
-                               foreach ($cellIterator as $cell) {\r
-                                       $cols[] = $cell->getValue();\r
-                               }\r
-                       } else {\r
-                               $link = array();\r
-                               $j = 0;\r
-                               foreach ($cellIterator as $cell) {\r
-                                       $ruler[$cols[$j]] = $cell->getValue();\r
-                                       $j++;\r
-                               }\r
-\r
-                               $rulers[] = $ruler;\r
-                       }\r
-                       $i++;\r
-               }\r
-\r
-\r
-\r
-               $dao = new wsDAODocument($core->con);\r
-               $dao->setLinksAndRulers($book_id, json_encode($links), json_encode($rulers), 'Import from excel',$core->user->utilisateur_id);\r
-\r
-               http::redirect(SITE_PATH . 'restoreLinks/' . $book_id);\r
-       }\r
-\r
        public static function editComposition($args) {\r
                $fv = array(session_name() => session_id(),\r
                        'book_id' => $args[0]);\r
 \r
                $mtime = filemtime(ROOT . '/swf/composer.swf');\r
-\r
                $res = cubeMedia::flash2(WEBROOT . '/swf/composer.swf?junk=' . $mtime, '100%', '100%', $fv, 'composerSwf', 'swfPanel', 10, '#d2d3c7', '', 'false', 'noscale', 'normal', array(), false, true, true);\r
                return $res;\r
        }\r
index defabeb16935a61547e6e2a56fdd11174bf9bc36..179581e4047299bc9dd79db0e42d854c15e084b0 100644 (file)
@@ -34,7 +34,7 @@ class wsDAODocument extends commonDAO {
        }\r
 \r
        public function restoreLinksVersion($book_id, $update, $user=0) {\r
-               $sql = 'INSERT INTO document_links_versions (document_id,links,rulers,update,comments,user) SELECT document_id,links,rulers,' . TIME . ',\'Links from a previous version\',' . $user . ' FROM document_links_versions WHERE `update`=' . $update . ' AND document_id IN (SELECT document_id FROM book_pages WHERE book_id=' . $book_id . ')';\r
+               $sql = 'INSERT INTO document_links_versions (document_id,links,rulers,`update`,comments,user) SELECT document_id,links,rulers,' . TIME . ',\'Links from a previous version\',' . $user . ' FROM document_links_versions WHERE `update`=' . $update . ' AND document_id IN (SELECT document_id FROM book_pages WHERE book_id=' . $book_id . ')';\r
                $this->con->execute($sql);\r
        }\r
 \r
index e473944ef1f394f5297829e4a28120afa2a46196..fc2de7cc1011fe8e382442a926cc9c39d261e2dc 100644 (file)
--- a/js/ws.js
+++ b/js/ws.js
@@ -30,6 +30,17 @@ function load_ws(){
                        onItemSelect:findWSAdmin\r
                });\r
        }\r
+       \r
+       $("#importLinksAsExcel").submit(function(){\r
+               $(this).ajaxSubmit({\r
+                       url             :       SITE_PATH+'ajax/'+$(this).attr('action'),\r
+                       success :       function(data){\r
+                               window.opener.document.getElementById("composerSwf").reloadLinks();\r
+                               window.close(); \r
+                       }\r
+               });\r
+               return false;\r
+       });\r
 \r
        $(".restoreLink").click(restoreLink);\r
 }\r
@@ -37,7 +48,11 @@ function load_ws(){
 function restoreLink(){\r
        $.ajax({\r
                url             :       SITE_PATH+'ajax/restoreLinksVersion/'+$(this).attr('rel'),\r
-               success :       function(data){window.opener.location=window.opener.location;window.close();}\r
+               success :       function(data){\r
+                       //window.opener.location=window.opener.location;\r
+                       window.opener.document.getElementById("composerSwf").reloadLinks();\r
+                       window.close();\r
+               }\r
        });\r
        return false;\r
 }\r