\n";
$logo = $chercher_logo($id, $id_objet, 'on');
$logo_s = $chercher_logo($id, $id_objet, 'off');
if (!$logo) {
if ($flag_modif AND $GLOBALS['meta']['activer_logos'] != 'non') {
$masque = indiquer_logo($texteon, $id_objet, 'on', $id, $script, $iframe);
$masque = "
$masque
";
$bouton = bouton_block_depliable($texteon, $visible, "on-$id_objet-$id");
$res = debut_block_depliable($visible,"on-$id_objet-$id") . $masque . fin_block();
}
} else {
list($img, $clic) = decrire_logo($id_objet,'on',$id, 170, 170, $logo, $texteon, $script, $flag_modif AND !$logo_s);
$bouton = bouton_block_depliable($texteon, $visible, "on-$id_objet-$id");
$survol = '';
$texteoff = _T('logo_survol');
if (!$logo = $logo_s) {
if ($flag_modif AND $GLOBALS['meta']['activer_logos_survol'] == 'oui') {
$masque = "
".indiquer_logo($texteoff, $id_objet, 'off', $id, $script, $iframe);
$survol .= "
".block_parfois_visible("off-$id_objet-$id", $texteoff, $masque, null, $visible);
}
$masque = debut_block_depliable($visible,"on-$id_objet-$id")
. ""
. $clic . $survol . "
" . fin_block();
} else {
list($imgoff, $clicoff) = decrire_logo($id_objet, 'off', $id, 170, 170, $logo, $texteoff, $script, $flag_modif);
$masque = debut_block_depliable($visible, "off-$id_objet-$id") . $clicoff . fin_block();
$survol .= "
".bouton_block_depliable($texteoff, $visible, "off-$id_objet-$id")
. "".$imgoff.$masque."
";
$masque = debut_block_depliable($visible,"on-$id_objet-$id") . $clic . fin_block() . $survol;
}
$res = "$img$masque";
}
if ($res) {
$res = debut_cadre('r', 'image-24.gif', '', $bouton, '', '', false)
. $res
. fin_cadre_relief(true);
if(_request("exec")!="iconifier") {
$js = http_script('', 'async_upload.js')
. http_script('$("form.form_upload_icon").async_upload(async_upload_icon)');
} else $js = "";
return ajax_action_greffe("iconifier", $id, $res).$js;
}
else return '';
}
// http://doc.spip.org/@indiquer_logo
function indiquer_logo($titre, $id_objet, $mode, $id, $script, $iframe_script) {
global $formats_logos;
$afficher = "";
$reg = '[.](' . join('|', $formats_logos) . ')$';
/*
# CODE MORT SI ON DECIDE DE NE PAS LAISSER UPLOADER DES LOGOS PAR FTP
if ($GLOBALS['flag_upload']
AND $dir_ftp = determine_upload('logos')
AND $fichiers = preg_files($dir_ftp, $reg)) {
foreach ($fichiers as $f) {
$f = substr($f, strlen($dir_ftp));
$afficher .= "\n";
}
}
if (!$afficher) {
if ($dir_ftp) {
$afficher = _T('info_installer_images_dossier',
array('upload' => '' . joli_repertoire($dir_ftp) . ''));
}
} else {
$afficher = "\n" .
_T('info_selectionner_fichier',
array('upload' => '' . joli_repertoire($dir_ftp) . '')) .
":
" .
"\n" .
"\n";
}
*/
$afficher = "\n
" .
"\n" .
"" .
"\n
" .
$afficher;
$type = type_du_logo($id_objet);
return redirige_action_post('iconifier',
"$id+$type$mode$id",
$script,
"$id_objet=$id",
$iframe_script.$afficher,
" enctype='multipart/form-data' class='form_upload_icon'");
}
// http://doc.spip.org/@decrire_logo
function decrire_logo($id_objet, $mode, $id, $width, $height, $img, $titre="", $script="", $flag_modif=true) {
list($fid, $dir, $nom, $format, $timestamp) = $img;
include_spip('inc/filtres_images_mini');
$res = image_reduire("", $width, $height);
if ($res){
$src = extraire_attribut($res,'src');
$res = inserer_attribut($res, 'src', "$src?$timestamp");
$res = "";
}
else
$res = "';
if ($taille = @getimagesize($fid))
$taille = _T('info_largeur_vignette', array('largeur_vignette' => $taille[0], 'hauteur_vignette' => $taille[1]));
return array($res,
"" . $taille
. ($flag_modif
? "\n
["
. ajax_action_auteur("iconifier", "$id-$nom.$format",
$script, "$id_objet=$id&type=$id_objet",
array(_T('lien_supprimer')),
'',"function(r,status) {this.innerHTML = r; \$('form.form_upload_icon',this).async_upload(async_upload_icon);}") ."]"
: '')
. "
");
}
?>