forum.coppermine-gallery.net

Support => Français (French) => Language Specific Support => cpg1.4.x Français (French) => Topic started by: honnyvore on February 03, 2008, 06:38:17 pm

Title: Bouton Favori (MOD pour ajouter un bouton au dessus des images intermédiaires)
Post by: honnyvore on February 03, 2008, 06:38:17 pm
Bonsoir,

J'ai fait une recherche sur le forum en français, mais je n'ai rien trouvé. Pourriez-vous m'indiquer quelle instruction je dois utiliser pour faire figurer un bouton "Ajouter à mes favoris" en haut de chacune des photos ?
Mon thème actuel : ChaoticSoul
Title: Re: Bouton Favori
Post by: François Keller on February 03, 2008, 07:22:52 pm
un lien est disponible dans les infos sous les photos (si vous avez cliqué sur le i de la barre de menu)
Title: Re: Bouton Favori
Post by: honnyvore on February 03, 2008, 11:28:50 pm
Oui, en effet. Pardon, j'avais oublié de préciser que je le savais. En fait, la manipulation pour le visiteur lambda n'est pas des plus évidentes. Je cherche donc à simplifier la démarche en ajouter à côté du "I" (ou tout autre position), un bouton qui ferait le même travail sans avoir à "chercher".
Malheureusement, en parcourant les fichiers du thème, je ne suis pas parvenu à déterminer le lien utilisé.
Title: Re : Bouton Favori
Post by: Pascal YAP on February 04, 2008, 12:08:07 am
Vous pouvez faire un click Droit sur l'image du ' I ", constater l'emplacement de cette image sur votre web (en général dans le dossier IMAGES), puis la remplacer par une image de votre choix qui vous semble plus explicite et/ou plus volumineuse !
C'est tout simple  ;)

PYAP
Title: Re: Bouton Favori
Post by: honnyvore on February 04, 2008, 07:17:22 am
C'est aussi une idée ^^

Mais ce que je cherche, c'est faire un lien direct "Ajouter à mes favoris" avec un seul bouton ;)
Title: Re: Bouton Favori
Post by: François Keller on February 04, 2008, 07:58:15 am
ok, il faudra certainement modifier le code. Je regardes ça et je poste une solution (dès que possible et si c'est possible  :D)
Title: Re: Bouton Favori
Post by: honnyvore on February 04, 2008, 01:23:29 pm
ok, il faudra certainement modifier le code. Je regardes ça et je poste une solution (dès que possible et si c'est possible  :D)
;D Mille merci par avance !!!
Title: Re: Bouton Favori
Post by: François Keller on February 04, 2008, 03:28:16 pm
Voilà, c'est assez simple:
ouvrez le fichier theme.php de votre theme
si les fonctions ci dessous n'y sont pas, collez le code ci dessous juste avant la balise ?> de fin de fichier
Code: [Select]
$template_img_navbar = <<<EOT

        <tr>
                <td align="center" valign="middle" class="navmenu" width="48">
                        <a href="{THUMB_TGT}" class="navmenu_pic" title="{THUMB_TITLE}"><img src="{LOCATION}images/thumbnails.gif" align="middle" border="0" alt="{THUMB_TITLE}" /></a>
                </td>
                <td align="center" valign="middle" class="navmenu" width="48">
                        <a href="javascript:;" class="navmenu_pic" onclick="blocking('picinfo','yes', 'block'); return false;" title="{PIC_INFO_TITLE}"><img src="{LOCATION}images/info.gif" border="0" align="middle" alt="{PIC_INFO_TITLE}" /></a>
                </td>
<!-- DEBUT lien vers les favorits (ajout FRANTZ) -->
                <td align="center" valign="middle" class="navmenu" width="48">
                        <a href="{FAV_TGT}" class="navmenu_pic" title="{FAV_TITLE}"><img src="{LOCATION}images/favorites.png" border="0" align="middle" alt="{FAV_TITLE}" /></a>
                </td>
<!-- FIN Lien favorits (ajout FRANTZ) -->
                <td align="center" valign="middle" class="navmenu" width="48">
                        <a href="{SLIDESHOW_TGT}" class="navmenu_pic" title="{SLIDESHOW_TITLE}"><img src="{LOCATION}images/slideshow.gif" border="0" align="middle" alt="{SLIDESHOW_TITLE}" /></a>
                </td>
               
                <td align="center" valign="middle" class="navmenu" width="100%">
                        {PIC_POS}
                </td>
<!-- BEGIN report_file_button -->
                <td align="center" valign="middle" class="navmenu" width="48">
                        <a href="{REPORT_TGT}" class="navmenu_pic" title="{REPORT_TITLE}"><img src="{LOCATION}images/report.gif" border="0" align="middle" alt="{REPORT_TITLE}" /></a>
                </td>
<!-- END report_file_button -->
<!-- BEGIN ecard_button -->
                <td align="center" valign="middle" class="navmenu" width="48">
                        <a href="{ECARD_TGT}" class="navmenu_pic" title="{ECARD_TITLE}"><img src="{LOCATION}images/ecard.gif"  border="0" align="middle" alt="{ECARD_TITLE}" /></a>
                </td>
<!-- END ecard_button -->
                <td align="center" valign="middle" class="navmenu" width="48">
                        <a href="{PREV_TGT}" class="navmenu_pic" title="{PREV_TITLE}"><img src="{LOCATION}images/prev.gif"  border="0" align="middle" alt="{PREV_TITLE}" /></a>
                </td>
                <td align="center" valign="middle" class="navmenu" width="48">
                        <a href="{NEXT_TGT}" class="navmenu_pic" title="{NEXT_TITLE}"><img src="{LOCATION}images/next.gif"  border="0" align="middle" alt="{NEXT_TITLE}" /></a>
                </td>
        </tr>

EOT;


function theme_html_img_nav_menu()
{
    global $CONFIG, $CURRENT_PIC_DATA, $meta_nav, $THEME_DIR ; //$PHP_SELF,
    global $album, $cat, $pos, $pic_count, $lang_img_nav_bar, $lang_text_dir, $template_img_navbar;
    global $lang_picinfo, $FAVPICS ;//ajout pour icone favorits

    $cat_link = is_numeric($album) ? '' : '&amp;cat=' . $cat;
        $uid_link = is_numeric($_GET['uid']) ? '&amp;uid=' . $_GET['uid'] : '';

    $human_pos = $pos + 1;
    $page = ceil(($pos + 1) / ($CONFIG['thumbrows'] * $CONFIG['thumbcols']));
    $pid = $CURRENT_PIC_DATA['pid'];

    $start = 0;
        $start_tgt = "{$_SERVER['PHP_SELF']}?album=$album$cat_link&amp;pos=$start";
        $start_title = $lang_img_nav_bar['go_album_start'];
        $meta_nav .= "<link rel=\"start\" href=\"$start_tgt\" title=\"$start_title\" />
        ";
        $end = $pic_count - 1;
        $end_tgt = "{$_SERVER['PHP_SELF']}?album=$album$cat_link&amp;pos=$end";
        $end_title = $lang_img_nav_bar['go_album_end'];
        $meta_nav .= "<link rel=\"last\" href=\"$end_tgt\" title=\"$end_title\" />
        ";

    if ($pos > 0) {
        $prev = $pos - 1;
        $prev_tgt = "{$_SERVER['PHP_SELF']}?album=$album$cat_link&amp;pos=$prev$uid_link";
        $prev_title = $lang_img_nav_bar['prev_title'];
                                $meta_nav .= "<link rel=\"prev\" href=\"$prev_tgt\" title=\"$prev_title\" />
                                ";
    } else {
        $prev_tgt = "javascript:;";
        $prev_title = "";
    }

    if ($pos < ($pic_count -1)) {
        $next = $pos + 1;
        $next_tgt = "{$_SERVER['PHP_SELF']}?album=$album$cat_link&amp;pos=$next$uid_link";
        $next_title = $lang_img_nav_bar['next_title'];
                                $meta_nav .= "<link rel=\"next\" href=\"$next_tgt\" title=\"$next_title\"/>
                                ";
    } else {
        $next_tgt = "javascript:;";
        $next_title = "";
    }

    if (USER_CAN_SEND_ECARDS) {
        $ecard_tgt = "ecard.php?album=$album$cat_link&amp;pid=$pid&amp;pos=$pos";
        $ecard_title = $lang_img_nav_bar['ecard_title'];
    } else {
        template_extract_block($template_img_navbar, 'ecard_button'); // added to remove button if cannot send ecard
        /*$ecard_tgt = "javascript:alert('" . addslashes($lang_img_nav_bar['ecard_disabled_msg']) . "');";
        $ecard_title = $lang_img_nav_bar['ecard_disabled'];*/
    }

                //report to moderator buttons
    if (($CONFIG['report_post']==1) && (USER_CAN_SEND_ECARDS)) {
        $report_tgt = "report_file.php?album=$album$cat_link&amp;pid=$pid&amp;pos=$pos";
    } else { // remove button if report toggle is off
        template_extract_block($template_img_navbar, 'report_file_button');

    }

                    $thumb_tgt = "thumbnails.php?album=$album$cat_link&amp;page=$page$uid_link";
        $meta_nav .= "<link rel=\"up\" href=\"$thumb_tgt\" title=\"".$lang_img_nav_bar['thumb_title']."\"/>
        ";

    $slideshow_tgt = "{$_SERVER['PHP_SELF']}?album=$album$cat_link$uid_link&amp;pid=$pid&amp;slideshow=".$CONFIG['slideshow_interval'];

    $pic_pos = sprintf($lang_img_nav_bar['pic_pos'], $human_pos, $pic_count);

    if (defined('THEME_HAS_NAVBAR_GRAPHICS')) {
            $location= $THEME_DIR;
        } else {
            $location= '';
        }
//ajout pour lien vers favorits (Frantz)
// Create the add to fav link
       
    if (!in_array($CURRENT_PIC_DATA['pid'], $FAVPICS)) {
        $fav_tgt  = "addfav.php?album=$album$cat_link&amp;pid=$pid&amp;pos=$pos";
        $fav_title = $lang_picinfo['addFav'];
    } else {
        $fav_tgt = "addfav.php?album=$album$cat_link&amp;pid=$pid&amp;pos=$pos";
        $fav_title = $lang_picinfo['remFav'];
    }
//fin ajout
    $params = array('{THUMB_TGT}' => $thumb_tgt,
        '{THUMB_TITLE}' => $lang_img_nav_bar['thumb_title'],
        '{PIC_INFO_TITLE}' => $lang_img_nav_bar['pic_info_title'],
        '{SLIDESHOW_TGT}' => $slideshow_tgt,
        '{SLIDESHOW_TITLE}' => $lang_img_nav_bar['slideshow_title'],
        '{PIC_POS}' => $pic_pos,
        '{ECARD_TGT}' => $ecard_tgt,
        '{ECARD_TITLE}' => $ecard_title,
        '{PREV_TGT}' => $prev_tgt,
        '{PREV_TITLE}' => $prev_title,
        '{NEXT_TGT}' => $next_tgt,
        '{NEXT_TITLE}' => $next_title,
        '{PREV_IMAGE}' => ($lang_text_dir=='ltr') ? 'prev' : 'next',
        '{NEXT_IMAGE}' => ($lang_text_dir=='ltr') ? 'next' : 'prev',
        '{REPORT_TGT}' => $report_tgt,
        '{REPORT_TITLE}' => $lang_img_nav_bar['report_title'],
        '{LOCATION}' => $location,
        '{FAV_TGT}' => $fav_tgt,//ajout Frantz
      '{FAV_TITLE}' => $fav_title,//ajout Frantz
        );

    return template_eval($template_img_navbar, $params);
}
Si une ou plusieurs de ces fonctions s'y trouvent, cherchez les parties commentées du code ajouté et ajoutez les à votre code.
sauvegardez le fichier.
Placez l'icone attachée (https://forum.coppermine-gallery.net/index.php?action=dlattach;topic=50236.0;attach=10330;image) ci-dessous dans le répertoire images de votre Coppermine. (si vous souhaitez mettre une autre image, pas de problèmes, mais nommez là favorites.png ou changez son nom dans le code.
Voilà c'est tout.
Si l'image n'est pas déjà dans "mes favoris", elle est ajoutée après le clic sur le bouton, sinon, elle est supprimée des favorits.
Title: Re: Bouton Favori (MOD pour ajouter un bouton au dessus des images intermédiaire
Post by: honnyvore on February 16, 2008, 01:17:01 am
Merci pour la réponse apportée.
Cependant, dans Themes.php, je ne trouve pas la fonction "function theme_html_img_nav_menu()".

Est-ce que ce bout de code va bien dans le fichier Theme ? Car cela me génére une erreur 404 si je tente cette manipulation.
Title: Re: Bouton Favori (MOD pour ajouter un bouton au dessus des images intermédiaire
Post by: honnyvore on February 16, 2008, 01:28:07 am
Merci pour la réponse apportée.
Cependant, dans Themes.php, je ne trouve pas la fonction "function theme_html_img_nav_menu()".

Est-ce que ce bout de code va bien dans le fichier Theme ? Car cela me génére une erreur 404 si je tente cette manipulation.
C'est dans le fichier themes.inc.php que se trouve cette fonction ^^
Et l'icône à afficher est à placer... dans le répertoire Images du Themes choisis (j'avais cru comprendre dans le répertoire Images de Coppermine).

Ca fonctionne parfaitement !
MERCI !!!
Title: Re: Bouton Favori (MOD pour ajouter un bouton au dessus des images intermédiaire
Post by: François Keller on February 16, 2008, 09:03:43 am
c'est bien dans le fichier theme.php de votre theme qu'il faut placer le code? Ne changez pas le code du fichier theme.inc.php
Title: Re: Bouton Favori (MOD pour ajouter un bouton au dessus des images intermédiaire
Post by: honnyvore on February 16, 2008, 09:52:28 am
c'est bien dans le fichier theme.php de votre theme qu'il faut placer le code? Ne changez pas le code du fichier theme.inc.php

??? Pourtant si je met tout le code dans le themes.php, cela me génére une erreur 404 quand je veux ajouter en favoris.

Voici ce que j'ai fait :
Theme.php:
Code: [Select]
<!-- DEBUT lien vers les favorits (ajout FRANTZ) -->
                <td align="center" valign="middle" class="navmenu" width="48">
                        <a href="{FAV_TGT}" class="navmenu_pic" title="{FAV_TITLE}"><img src="{LOCATION}images/favorites.png" border="0" align="middle" alt="{FAV_TITLE}" /></a>
                </td>
<!-- FIN Lien favorits (ajout FRANTZ) -->

Theme.inc.php:
Code: [Select]
function theme_html_img_nav_menu()
{
(...)
Code: [Select]
    global $lang_picinfo, $FAVPICS ;//ajout pour icone favorits
(...)
Code: [Select]
//ajout pour lien vers favorits (Frantz)
// Create the add to fav link
       
    if (!in_array($CURRENT_PIC_DATA['pid'], $FAVPICS)) {
        $fav_tgt  = "addfav.php?album=$album$cat_link&amp;pid=$pid&amp;pos=$pos";
        $fav_title = $lang_picinfo['addFav'];
    } else {
        $fav_tgt = "addfav.php?album=$album$cat_link&amp;pid=$pid&amp;pos=$pos";
        $fav_title = $lang_picinfo['remFav'];
    }
//fin ajout
(...)
Code: [Select]
        '{FAV_TGT}' => $fav_tgt,//ajout Frantz
      '{FAV_TITLE}' => $fav_title,//ajout Frantz
:)
Et l'image dans le répertoire Images du theme. Et ca fonctionne bien ^^
Title: Re: Bouton Favori (MOD pour ajouter un bouton au dessus des images intermédiaire
Post by: François Keller on February 16, 2008, 09:55:30 am
oui, bien sur ça fonctionne, mais à la prochaine mise à jour de coppermine, il faudra tout refaire.
je regardes ça pour le theme chaoticsoul et je l'attache à mon prochain post
Title: Re: Bouton Favori (MOD pour ajouter un bouton au dessus des images intermédiaire
Post by: honnyvore on February 16, 2008, 01:33:50 pm
En effet, je n'avais pas pensé à la mise à jour de coppermine  :'(
Title: Re: Bouton Favori (MOD pour ajouter un bouton au dessus des images intermédiaire
Post by: François Keller on February 16, 2008, 04:07:50 pm
essaye le theme attaché à ce post (chez moi ça marche)