From: Pierre Habouzit (MadCoder Date: Fri, 7 Jan 2005 08:08:57 +0000 (+0000) Subject: work on photos X-Git-Tag: xorg/old~525 X-Git-Url: http://git.polytechnique.org/?a=commitdiff_plain;h=c88364b3da069d1f0bedb6586d0b3bbe6599631a;p=platal.git work on photos * Photo Submission : - Rework of the form. -MC - Photo is resized on the fly, instead of dropping too big images. -MC git-archimport-id: opensource@polytechnique.org--2005/platal--mainline--0.9--patch-225 --- diff --git a/ChangeLog b/ChangeLog index c811549..5d7607f 100644 --- a/ChangeLog +++ b/ChangeLog @@ -14,6 +14,10 @@ New : - Brand new PDF of the contact list (using FPDF). -MC - Even include Photos in the PDF (kludgy !). -MC + * Photo Submission : + - Rework of the form. -MC + - Photo is resized on the fly, instead of dropping too big images. -MC + * Skins : - Openweb : update. -MC diff --git a/htdocs/trombino.php b/htdocs/trombino.php index b8e6ffe..3143256 100644 --- a/htdocs/trombino.php +++ b/htdocs/trombino.php @@ -24,36 +24,33 @@ new_skinned_page('trombino.tpl', AUTH_MDP); require_once('validations.inc.php'); -if (Env::has('ordi') and isset($_FILES['userfile']['tmp_name'])) { - $data = file_get_contents($_FILES['userfile']['tmp_name']); - if ($myphoto = new PhotoReq(Session::getInt('uid'), $data)) { - $myphoto->submit(); - } -} elseif (Env::has('web') and Env::has('photo')) { - // net - if ($s = file_get_contents(Env::get('photo'))) { - if ($myphoto = new PhotoReq(Session::getInt('uid'), $s)) { +$trombi_x = '/home/web/trombino/photos'.Session::get('promo').'/'.Session::get('forlife').'.jpg'; + +if (Env::has('upload')) { + $file = isset($_FILES['userfile']['tmp_name']) ? $_FILES['userfile']['tmp_name'] : Env::get('photo'); + if ($data = file_get_contents($file)) { + if ($myphoto = new PhotoReq(Session::getInt('uid'), $data)) { $myphoto->submit(); } } else { $page->trig('Fichier inexistant ou vide'); } } elseif (Env::has('trombi')) { - // Fichier à récupérer dans les archives trombi + commit immédiat - $file = '/home/web/trombino/photos'.Session::get('promo').'/'.Session::get('forlife').'.jpg'; - $myphoto = new PhotoReq(Session::getInt('uid'), file_get_contents($file)); - if ($myphoto) {// There was no errors, we can go on + $myphoto = new PhotoReq(Session::getInt('uid'), file_get_contents($trombi_x)); + if ($myphoto) { $myphoto->commit(); $myphoto->clean(); } } elseif (Env::get('suppr')) { - // effacement de la photo $globals->xdb->execute('DELETE FROM photo WHERE uid = {?}', Session::getInt('uid')); $globals->xdb->execute('DELETE FROM requests WHERE user_id = {?} AND type="photo"', Session::getInt('uid')); +} elseif (Env::get('cancel')) { + $sql = $globals->xdb->query('DELETE FROM requests WHERE user_id={?} AND type="photo"', Session::getInt('uid')); } $sql = $globals->xdb->query('SELECT COUNT(*) FROM requests WHERE user_id={?} AND type="photo"', Session::getInt('uid')); $page->assign('submited', $sql->fetchOneCell()); +$page->assign('has_trombi_x', file_exists($trombi_x)); $page->run(); diff --git a/templates/trombino.tpl b/templates/trombino.tpl index 84ec721..9f3db6b 100644 --- a/templates/trombino.tpl +++ b/templates/trombino.tpl @@ -48,26 +48,17 @@ -  [ PHOTO ] +  [ PHOTO ] {if $submited} -  [ PHOTO ] +  [ PHOTO ] {else} Pas d'image soumise {/if} - - Si tu ne souhaites plus montrer cette photo tu peux aussi l'effacer en la remplaçant par :
- {if ($session.promo ge 1995) or ($session.promo le 2002)} -
- {/if} - - - - * Les photos sont soumises à une validation manuelle en raison des législations relatives aux droits d'auteur et à la protection des mineurs. Il faut donc attendre l'intervention @@ -75,16 +66,33 @@ photo aura été contrôlée. - - - - + + + + {if $submited} + + {/if} + + + - - - - - - - - - + +
+ + Actions immédiates +
+ Si tu ne souhaites plus montrer cette photo tu peux aussi l'effacer en la remplaçant par :
+ {if $has_trombi_x} +
+ {/if} + +
+ Tu peux annuler ta soumission et garder ta photo actuelle :
+ +
Changement de ta photo
+

Nous te proposons deux possibilités pour mettre à jour ta photo (30 Ko maximum). Tout dépend de savoir où se trouve ta photo. Si elle est sur ton poste de travail local, c'est la première @@ -100,31 +108,25 @@

Sur ton ordinateur
- -
- -
Sur Internet
+ +
- + + +