Overview
Comment:Galerie et liste des fichiers de la page wiki
Downloads: Tarball | ZIP archive | SQL archive
Timelines: family | ancestors | descendants | both | trunk
Files: files | file ages | folders
SHA1: 71cc771f9e7d0c8bb9cb24161c27ee7b1c19713b
User & Date: bohwaz on 2015-04-08 07:01:30
Other Links: manifest | tags
Context
2015-04-09
15:00
Correction affichage type de fichier check-in: 300c6d64a6 user: bohwaz tags: trunk
2015-04-08
07:01
Galerie et liste des fichiers de la page wiki check-in: 71cc771f9e user: bohwaz tags: trunk
05:20
Séparation du javascript, et gestion complète des fichiers dans le wiki check-in: 37b834a9d6 user: bohwaz tags: trunk
Changes

Modified src/include/lib/Garradin/Fichiers.php from [1e13d85657] to [6c066bdc3a].

520
521
522
523
524
525
526
527

528

529
530
531
532
533
534
535
		if (!in_array($type, $check))
		{
			throw new \LogicException('Type de lien de fichier inconnu.');
		}

    	$images = is_null($images) ? '' : ' AND image = ' . (int)$images;

        $files = DB::getInstance()->simpleStatementFetch('SELECT fichiers.* FROM fichiers 

            INNER JOIN fichiers_'.$type.' AS fwp ON fwp.fichier = fichiers.id

            WHERE fwp.id = ? '.$images.'
            ORDER BY fichiers.nom COLLATE NOCASE;', \SQLITE3_ASSOC, (int)$id);

        foreach ($files as &$file)
        {
        	$file['url'] = self::_getURL($file['id'], $file['nom']);
        	$file['thumb'] = $file['image'] ? self::_getURL($file['id'], $file['nom'], 200) : false;







|
>

>







520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
		if (!in_array($type, $check))
		{
			throw new \LogicException('Type de lien de fichier inconnu.');
		}

    	$images = is_null($images) ? '' : ' AND image = ' . (int)$images;

        $files = DB::getInstance()->simpleStatementFetch('SELECT fichiers.*, c.hash, c.taille
        	FROM fichiers 
            INNER JOIN fichiers_'.$type.' AS fwp ON fwp.fichier = fichiers.id
            INNER JOIN fichiers_contenu AS c ON c.id = fichiers.id_contenu
            WHERE fwp.id = ? '.$images.'
            ORDER BY fichiers.nom COLLATE NOCASE;', \SQLITE3_ASSOC, (int)$id);

        foreach ($files as &$file)
        {
        	$file['url'] = self::_getURL($file['id'], $file['nom']);
        	$file['thumb'] = $file['image'] ? self::_getURL($file['id'], $file['nom'], 200) : false;

Modified src/templates/admin/wiki/page.tpl from [d9ada2768f] to [3fe9a88ab2].

84
85
86
87
88
89
90






























91
92
93
94
95
96
97
98
99
100
101
102
                </div>
            {else}
                <div class="wikiContent">
                    {$page.contenu.contenu|format_wiki|liens_wiki:'?'}
                </div>
            {/if}































            <p class="wikiFooter">
                Dernière modification le {$page.date_modification|date_fr:'d/m/Y à H:i'}
                {if $user.droits.membres >= Garradin\Membres::DROIT_ACCES}
                par <a href="{$www_url}admin/membres/fiche.php?id={$page.contenu.id_auteur|escape}">{$auteur|escape}</a>
                {/if}
            </p>
        {/if}
    {/if}
{/if}


{include file="admin/_foot.tpl"}







>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>












84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
                </div>
            {else}
                <div class="wikiContent">
                    {$page.contenu.contenu|format_wiki|liens_wiki:'?'}
                </div>
            {/if}


            {if !empty($images) || !empty($fichiers)}
            <div class="wikiFiles">
                <h3>Fichiers liés à cette page</h3>

                {if !empty($images)}
                <ul class="gallery">
                    {foreach from=$images item="file"}
                        <li>
                            <figure>
                                <a href="{$file.url|escape}"><img src="{$file.thumb|escape}" alt="" title="{$file.nom|escape}" /></a>
                            </figure>
                        </li>
                    {/foreach}
                </ul>
                {/if}

                {if !empty($fichiers)}
                <ul class="files">
                    {foreach from=$fichiers item="file"}
                        <li>
                            <aside class="fichier" class="internal-file"><a href="{$file.url|escape}">{$file.nom|escape}</a>
                            <small>({$file.type|escape}, {$file.taille|format_bytes})</small>
                       </li>
                    {/foreach}
                </ul>
                {/if}
            </div>
            {/if}

            <p class="wikiFooter">
                Dernière modification le {$page.date_modification|date_fr:'d/m/Y à H:i'}
                {if $user.droits.membres >= Garradin\Membres::DROIT_ACCES}
                par <a href="{$www_url}admin/membres/fiche.php?id={$page.contenu.id_auteur|escape}">{$auteur|escape}</a>
                {/if}
            </p>
        {/if}
    {/if}
{/if}


{include file="admin/_foot.tpl"}

Modified src/www/admin/static/admin.css from [8189de5a0c] to [25a35e4a52].

817
818
819
820
821
822
823




824
825
826
827
828
829
830
831
    clear: both;
}

fieldset.wikiRevision #f_modification {
    width: 90%;
}





.wikiFooter {
    font-size: 0.8em;
    color: #666;
    border-top: 0.1em solid #ccc;
    clear: both;
}

.wikiMain samp {







>
>
>
>
|







817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
    clear: both;
}

fieldset.wikiRevision #f_modification {
    width: 90%;
}

.wikiFiles {
    text-align: center;
}

.wikiFooter, .wikiFiles {
    font-size: 0.8em;
    color: #666;
    border-top: 0.1em solid #ccc;
    clear: both;
}

.wikiMain samp {
1275
1276
1277
1278
1279
1280
1281


































form#insertImage .align input:hover, form#insertImage .cancel input:hover,  {
    cursor: pointer;
    background-color: #eee;
    color: darkred;
}









































>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
1279
1280
1281
1282
1283
1284
1285
1286
1287
1288
1289
1290
1291
1292
1293
1294
1295
1296
1297
1298
1299
1300
1301
1302
1303
1304
1305
1306
1307
1308
1309
1310
1311
1312
1313
1314
1315
1316
1317
1318

form#insertImage .align input:hover, form#insertImage .cancel input:hover,  {
    cursor: pointer;
    background-color: #eee;
    color: darkred;
}

.imageBrowser {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    z-index: 9999;
    background: rgb(0, 0, 0);
    background: rgba(0, 0, 0, 0.75);
    text-align: center;
}

.imageBrowser figure {
    margin: 5%;
    width: 90%;
    height: 90%;
}

.imageBrowser figure img {
    top: 50%;
    transform: translateY(-50%);
    position: relative;
    max-width: 100%;
    width: auto;
    height: auto;
    background: #fff;
    padding: 2%;
    max-height: 90%;
    max-width: 90%;
    border-radius: .5em;
    cursor: pointer;
    transition: all .5s;
}

Added src/www/admin/static/scripts/wiki_gallery.js version [ad323652ad].









































































































































>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
(function () {
    g.onload(function () {
        var gallery = document.getElementsByClassName('gallery');

        if (gallery.length == 1 && document.querySelector)
        {
            var items = gallery[0].getElementsByTagName('li');

            for (var i = 0; i < items.length; i++)
            {
                var a = items[i].querySelector('figure > a');
                a.pos = i;
                a.onclick= function (e) {
                    e.preventDefault();
                    openImageBrowser(items, this.pos);
                    return false;
                };
            }
        }
    });

    function openImageBrowser(items, pos)
    {
        var div = document.createElement('div');
        div.className = 'imageBrowser';

        var img = document.createElement('img');
        img.pos = pos-1;

        img.onclick = function (e) {
            e.stopPropagation();
            openImage(img, items);
        };

        var fig = document.createElement('figure');

        div.onclick = function (e) {
            div.parentNode.removeChild(div);
        };

        fig.appendChild(img);
        div.appendChild(fig);
        document.body.appendChild(div);

        openImage(img, items);
    }

    function openImage(img, items)
    {
        // Pour animation
        img.style.opacity = 0;

        if (++img.pos == items.length)
        {
            img.pos = 0;
        }

        var newImg = new Image;
        newImg.onload = function (e) {
            img.src = e.target.src;
            img.style.opacity = 1;
        };

        newImg.src = items[img.pos].querySelector('figure > a').href;
        return false;   
    }

}());

Modified src/www/admin/static/wiki.css from [93c5aa3121] to [515065cfdc].

11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
    list-style-type: disc;
}

.wikiContent ol {
    list-style-type: decimal;
}

.wikiContent aside.fichier {
    margin: 1em;
}

.wikiContent aside.fichier small {
    opacity: 0.7;
}

.wikiContent aside.fichier a {
    display: inline-block;
    margin-right: 1em;
    padding: .5em;
    padding-left: 1.8em;
    border: 1px solid #ccc;
    border-radius: .5em;
    background-repeat: no-repeat;
    background-position: .5em center;
    background-image: url("data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAsAAAAQCAYAAADAvYV+AAAAd0lEQVQoz2NgQAVNQDwDCTcw4AF3gPg/Er4xSBWnAXEHFL9HU/wWSS4FpFgZiJ+jKULHT4BYAWa6LhC/w6HwNRBrojvHEoi/oCn8BMQmuDzoBsQ/oQq/A7E9AwEQDMQ/gNiHgUggx0AN8IVI/AGkeA+ReCdJTgAAgMhKhf6mzTIAAAAASUVORK5CYII=");
    transition: background-color .2s, color .2s;
}

.wikiContent aside.fichier a:hover {
    background-color: #eee;
    color: darkred;
}

.wikiContent figure.image {
    text-align: center;
}







|



|



|












|







11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
    list-style-type: disc;
}

.wikiContent ol {
    list-style-type: decimal;
}

aside.fichier {
    margin: 1em;
}

aside.fichier small {
    opacity: 0.7;
}

aside.fichier a {
    display: inline-block;
    margin-right: 1em;
    padding: .5em;
    padding-left: 1.8em;
    border: 1px solid #ccc;
    border-radius: .5em;
    background-repeat: no-repeat;
    background-position: .5em center;
    background-image: url("data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAsAAAAQCAYAAADAvYV+AAAAd0lEQVQoz2NgQAVNQDwDCTcw4AF3gPg/Er4xSBWnAXEHFL9HU/wWSS4FpFgZiJ+jKULHT4BYAWa6LhC/w6HwNRBrojvHEoi/oCn8BMQmuDzoBsQ/oQq/A7E9AwEQDMQ/gNiHgUggx0AN8IVI/AGkeA+ReCdJTgAAgMhKhf6mzTIAAAAASUVORK5CYII=");
    transition: background-color .2s, color .2s;
}

aside.fichier a:hover {
    background-color: #eee;
    color: darkred;
}

.wikiContent figure.image {
    text-align: center;
}

Modified src/www/admin/wiki/index.php from [decb582e7c] to [c8d1109620].

42
43
44
45
46
47
48
49


50
    }

    $tpl->assign('images', $images);
    $tpl->assign('fichiers', $fichiers);
}

$tpl->assign('page', $page);



$tpl->display('admin/wiki/page.tpl');








>
>

42
43
44
45
46
47
48
49
50
51
52
    }

    $tpl->assign('images', $images);
    $tpl->assign('fichiers', $fichiers);
}

$tpl->assign('page', $page);

$tpl->assign('custom_js', ['wiki_gallery.js']);

$tpl->display('admin/wiki/page.tpl');