From: vincent@cubedesigners.com Date: Wed, 31 Oct 2012 15:30:13 +0000 (+0000) Subject: (no commit message) X-Git-Url: http://git.cubedesigners.com/?a=commitdiff_plain;h=6142eabb6e4840938e0cd65f0e31d53a5157e37d;p=cubeextranet.git --- diff --git a/fluidbook/compile/_js/fluidbook.js b/fluidbook/compile/_js/fluidbook.js index c23ccd7c7..fcf695ab9 100644 --- a/fluidbook/compile/_js/fluidbook.js +++ b/fluidbook/compile/_js/fluidbook.js @@ -1,95 +1,95 @@ -var _GET=parseGet(); +var _GET = parseGet(); -function getWmode(){ - if(_GET['wmode']!=undefined){ +function getWmode() { + if (_GET['wmode'] != undefined) { return _GET['wmode']; } - - var ua=navigator.userAgent; - if(ua.search(/mac/i)>-1 && ua.search(/opera/i)>-1){ + + var ua = navigator.userAgent; + if (ua.search(/mac/i) > -1 && ua.search(/opera/i) > -1) { return 'normal'; - }else{ + } else { return 'direct'; } } -function getLocation(){ +function getLocation() { return window.location.toString(); } -function getFlashvars(junk,fv){ - - var res={}; - if(fv!=undefined){ - res=fv; +function getFlashvars(junk, fv) { + + var res = {}; + if (fv != undefined) { + res = fv; } - - res=parseGet(res); - res['junk']=junk; + res = parseGet(res); + + res['junk'] = junk; return res; } -function parseGet(res){ - if(res==undefined){ - res={}; +function parseGet(res) { + if (res == undefined) { + res = {}; } - var couples=window.location.search.substr(1).split('&'); - var couple=new Array(); - for (var i=0;i 2) ? argv[2] : date; - var path=(argc > 3) ? argv[3] : '/'; - var domain=(argc > 4) ? argv[4] : null; - var secure=(argc > 5) ? argv[5] : false; - document.cookie=nom+"="+escape(valeur)+ - ((expires==null) ? "" : ("; expires="+expires.toGMTString()))+ - ((path==null) ? "" : ("; path=/"))+ - ((domain==null) ? "" : ("; domain="+domain))+ - ((secure==true) ? "; secure" : ""); -} -function addThis(x){ - addthis_offset_left=parseFloat(x); + date = new Date; + date.setFullYear(date.getFullYear() + 10); + + var argv = setCookie.arguments; + var argc = setCookie.arguments.length; + var expires = (argc > 2) ? argv[2] : date; + var path = (argc > 3) ? argv[3] : '/'; + var domain = (argc > 4) ? argv[4] : null; + var secure = (argc > 5) ? argv[5] : false; + document.cookie = nom + "=" + escape(valeur) + + ((expires == null) ? "" : ("; expires=" + expires.toGMTString())) + + ((path == null) ? "" : ("; path=/")) + + ((domain == null) ? "" : ("; domain=" + domain)) + + ((secure == true) ? "; secure" : ""); +} +function addThis(x) { + addthis_offset_left = parseFloat(x); addthis_open(document.getElementById('addThisBt'), '', '[URL]', '[TITLE]'); } -function handleWheel(delta){ - try{ +function handleWheel(delta) { + try { document.getElementById('fluidbook').mouseWheel(delta); - }catch(e){ + } catch (e) { } } -function isMobile(){ - var devices = ['iphone', 'ipad', 'ipod', 'droid', 'blackberry', 'mobile','htc','samsung','nokia','archos','galaxy','motorola','pad','slate','symbian', 'phone', 'nintendo', 'playstation','touch','webos','ericsson','metro']; +function isMobile() { + var devices = ['iphone', 'ipad', 'ipod', 'droid', 'blackberry', 'mobile', 'htc', 'samsung', 'nokia', 'archos', 'galaxy', 'motorola', 'pad', 'slate', 'symbian', 'phone', 'nintendo', 'playstation', 'touch', 'webos', 'ericsson', 'metro']; return _isMobile(devices); } -function isBadMobile(){ +function isBadMobile() { var devices = ['kindle']; return _isMobile(devices); } -function _isMobile(devices){ - var ua=navigator.userAgent; +function _isMobile(devices) { + var ua = navigator.userAgent; var pattern; - for(i=0;i-1){ + for (i = 0; i < devices.length; i++) { + pattern = new RegExp(devices[i], 'i'); + if (ua.search(pattern) > -1) { return true; } } return false; } -function redirectPDF(){ - window.location='data/document.pdf'; +function redirectPDF() { + window.location = 'data/document.pdf'; } -function redirectMobile(){ - var get=parseGet(); - var page='index.html'; - if(get['widget']!=undefined && get['widget']=='1'){ - page='widget.html'; +function redirectMobile() { + var get = parseGet(); + var html = 'index.html'; + if (get['widget'] != undefined && get['widget'] == '1') { + html = 'widget.html'; + } + var pageNr = 0; + if (get.page != undefined) { + pageNr = parseInt(get.page); } - window.location='m/'+page; + if (window.location.hash != '') { + var e = window.location.hash.split('/'); + var pnr = parseInt(e[1]); + if (!isNaN(pnr)) { + pageNr = pnr; + } + } + + var page=''; + if(pageNr>0){ + page='#/page/'+pageNr; + } + + window.location = 'm/' + html + page; } -function wheel(event){ +function wheel(event) { var delta = 0; if (!event) /* For IE. */ event = window.event; if (event.wheelDelta) { /* IE/Opera. */ - delta = event.wheelDelta/120; + delta = event.wheelDelta / 120; /** In Opera 9, delta differs in sign as compared to IE. */ if (window.opera) @@ -175,33 +192,33 @@ function wheel(event){ /** In Mozilla, sign of delta is different than in IE. * Also, delta is multiple of 3. */ - delta = -event.detail/3; + delta = -event.detail / 3; } /** If delta is nonzero, handle it. * Basically, delta is now positive if wheel was scrolled up, * and negative, if wheel was scrolled down. */ - if (delta){ + if (delta) { handleWheel(delta); } /** Prevent default actions caused by mouse wheel. * That might be ugly, but we handle scrolls somehow * anyway, so don't bother here.. */ - if (event.preventDefault){ + if (event.preventDefault) { event.preventDefault(); } event.returnValue = false; } -function ready(){ - document.body.style.backgroundColor='#'+getBackgroundColor(); +function ready() { + document.body.style.backgroundColor = '#' + getBackgroundColor(); } -function getBackgroundColor(){ - if(_GET['background']!=undefined){ +function getBackgroundColor() { + if (_GET['background'] != undefined) { return _GET['background']; - }else{ + } else { return backgroundColor; } } @@ -209,21 +226,21 @@ function getBackgroundColor(){ /** Initialization code. * If you use your own event management code, change it as required. */ -if (window.addEventListener){ +if (window.addEventListener) { /** DOMMouseScroll is for mozilla. */ window.addEventListener('DOMMouseScroll', wheel, false); } /** IE/Opera. */ window.onmousewheel = document.onmousewheel = wheel; -window.onkeydown=key; -window.onkeypress=key; -window.onkeydown=key; +window.onkeydown = key; +window.onkeypress = key; +window.onkeydown = key; -function key(e){ - if(e.ctrlKey && (e.keyCode==80 || e.keyCode==112)){ +function key(e) { + if (e.ctrlKey && (e.keyCode == 80 || e.keyCode == 112)) { return false; } - + return true; } \ No newline at end of file diff --git a/fluidbook/tools/convertrn.pe b/fluidbook/tools/convertrn.pe index 9a192d89e..76065047d 100644 --- a/fluidbook/tools/convertrn.pe +++ b/fluidbook/tools/convertrn.pe @@ -1,6 +1,7 @@ #!/usr/local/bin/fontforge Open($1) Print("Open font ",$1) +SetOS2Value("FSType",0); if($argc>3) Print("Change name to ",$3) SetFontNames($3,$3,$3,'Regular','','1.0') diff --git a/inc/commons/class.common.tools.php b/inc/commons/class.common.tools.php index 5d26ed9e9..b4895ffc4 100644 --- a/inc/commons/class.common.tools.php +++ b/inc/commons/class.common.tools.php @@ -205,7 +205,8 @@ class commonTools { $res.=''; $res.=''; $res.=''; - $res.=''; + $res.=''; + $res.=''; $res.=''; $res.='
' . __('Générer un kit webfont') . '
' . __('Veuillez charger une police de caractères') . '
' . $core->typo->BoutonOK(__('Générer le kit webfont')) . '
'; $res.=''; @@ -221,33 +222,44 @@ class commonTools { mkdir($tmp, 0777, true); } - $ex = explode('.', strtolower($_FILES['file']['name'])); - $upext = array_pop($ex); - $fontName = implode('.', $ex); - - $fontFile = $tmp . '/' . strtolower($_FILES['file']['name']); - move_uploaded_file($_FILES['file']['tmp_name'], $fontFile); - - $ext = array('ttf', 'woff', 'eot'); - - foreach ($ext as $e) { - $out = $tmp . '/' . $fontName . '.' . $e; - if ($e != 'eot') { - $fontforge = new cubeCommandLine('convertrn.pe'); - $fontforge->setPath(CONVERTER_PATH); - $fontforge->setArg(null, $fontFile); - $fontforge->setArg(null, $out); - $fontforge->setArg(null, $fontName); - $fontforge->execute(); - fb($fontforge->commande); - fb($fontforge->output); - } else { - $ttf = $tmp . '/' . $fontName . '.ttf'; - `/usr/local/bin/ttf2eot < $ttf > $out`; + $rename = isset($_POST['rename']); + + + + foreach ($_FILES['file']['name'] as $k => $name) { + $tmp_name = $_FILES['file']['tmp_name'][$k]; + + $ex = explode('.', strtolower($name)); + $upext = array_pop($ex); + $fontName = implode('.', $ex); + + $fontFile = $tmp . '/' . strtolower($name); + move_uploaded_file($tmp_name, $fontFile); + + $ext = array('ttf', 'woff', 'eot'); + + foreach ($ext as $e) { + $out = $tmp . '/' . $fontName . '.' . $e; + if ($e != 'eot') { + + $fontforge = new cubeCommandLine('convertrn.pe'); + $fontforge->setPath(CONVERTER_PATH); + $fontforge->setArg(null, $fontFile); + $fontforge->setArg(null, $out); + if ($rename) { + $fontforge->setArg(null, $fontName); + } + $fontforge->execute(); + + fb($fontforge->commande); + fb($fontforge->output); + } else { + $ttf = $tmp . '/' . $fontName . '.ttf'; + `/usr/local/bin/ttf2eot < $ttf > $out`; + } } - } - $css = "@font-face { + $css = "@font-face { font-family: '$fontName'; src: url('$fontName.eot'); src: url('$fontName.eot?#iefix') format('embedded-opentype'), @@ -257,7 +269,8 @@ class commonTools { font-style: normal; }"; - file_put_contents($tmp . '/' . $fontName . '.css', $css); + file_put_contents($tmp . '/' . $fontName . '.css', $css); + } $tmpfile = cubeFiles::tempnam() . '.zip'; diff --git a/inc/ws/Controlleur/class.ws.ajax.php b/inc/ws/Controlleur/class.ws.ajax.php index 5fcb0b128..62ba48614 100644 --- a/inc/ws/Controlleur/class.ws.ajax.php +++ b/inc/ws/Controlleur/class.ws.ajax.php @@ -26,11 +26,14 @@ class wsAjax extends cubeAjax { $dao = new commonDAOEntreprise($core->con); // Creation de l'entreprise if ($_POST['entreprise_id'] == 'new') { - if (!isset($_POST['ws_admin'])) { + if (!isset($_POST['ws_admin']) || !$_POST['ws_admin']) { $_POST['ws_admin'] = $core->user->utilisateur_id; $_POST['ws_grade'] = 1; } } + if (isset($_POST['ws_admin']) && !$_POST['ws_admin']) { + $_POST['ws_admin'] = $core->user->utilisateur_id; + } $entreprise = $dao->sauve($_POST); // Si c'est une nouvelle entreprise, on crée également le contact if ($_POST['entreprise_id'] == 'new') { @@ -202,7 +205,7 @@ class wsAjax extends cubeAjax { commonDroits::error(); } - if (isset($_POST['valide']) && $book->status<1) { + if (isset($_POST['valide']) && $book->status < 1) { $book = $dao->setStatus($book_id, 1); } @@ -245,15 +248,15 @@ class wsAjax extends cubeAjax { $x->addOpenPopup($popup); return; } - - $version='html'; - if($book->parametres->version==1){ - $version='v1'; + + $version = 'html'; + if ($book->parametres->version == 1) { + $version = 'v1'; } - fb(time(),'start making package'); + fb(time(), 'start making package'); $package = wsPackager::package($book_id, $version, false); - fb(time(),'start transfert'); + fb(time(), 'start transfert'); if ($server == 'references') { $root = '/home/fluidbook/dev/references'; $url = 'http://www.fluidbook.com/references/'; @@ -285,8 +288,8 @@ class wsAjax extends cubeAjax { $cp->setArg(null, $package . '*'); $cp->setArg(null, $finalDir); $cp->execute(); - - fb(time(),'end transfert'); + + fb(time(), 'end transfert'); $x->addClosePopup(); $x->addTruePopup($url . $dir . '/'); diff --git a/inc/ws/Controlleur/class.ws.url.php b/inc/ws/Controlleur/class.ws.url.php index 87d175d4d..58a1cf3ff 100644 --- a/inc/ws/Controlleur/class.ws.url.php +++ b/inc/ws/Controlleur/class.ws.url.php @@ -1260,6 +1260,10 @@ html{height:100%}' . "\n"; $rev = $client->ws_revendeur == '' ? '-' : $client->ws_revendeur; $adm = $client->ws_administrateur == '' ? '-' : $client->ws_administrateur; + if ($client->ws_grade == 0) { + $rev = $adm = '-'; + } + $res .= '' . $core->ws_grades[$client->ws_grade] . ''; $res .= '' . $rev . ''; $res .= '' . $adm . '';