1<?php
2/**
3 * codologic Image Detail Template
4 *
5 * @link     http://dokuwiki.org/template
6 *
7 * Author: Avinash D'Silva <avinash.roshan.dsilva@gmail.com|codologic.com>
8 *
9 * Previous Authors:
10 * @author   Anika Henke <anika@selfthinker.org>
11 * @author   Clarence Lee <clarencedglee@gmail.com>
12 * @license  GPL 2 (http://www.gnu.org/licenses/gpl.html)
13 */
14
15// require functions
16require_once(dirname(__FILE__) . DIRECTORY_SEPARATOR .'bootstrap.php');
17
18// must be run from within DokuWiki
19if (!defined('DOKU_INC')) die();
20header('X-UA-Compatible: IE=edge,chrome=1');
21
22?><!DOCTYPE html>
23<html lang="<?php echo $conf['lang']?>" dir="<?php echo $lang['direction'] ?>" class="no-js">
24<head>
25    <meta charset="utf-8" />
26    <title>
27        <?php echo hsc(tpl_img_getTag('IPTC.Headline',$IMG))?>
28        [<?php echo strip_tags($conf['title'])?>]
29    </title>
30    <script>(function(H){H.className=H.className.replace(/\bno-js\b/,'js')})(document.documentElement)</script>
31    <?php tpl_metaheaders()?>
32    <meta name="viewport" content="width=device-width,initial-scale=1" />
33    <?php echo tpl_favicon(array('favicon', 'mobile')) ?>
34    <?php tpl_includeFile('meta.html') ?>
35</head>
36
37<body>
38    <!--[if lte IE 7 ]><div id="IE7"><![endif]--><!--[if IE 8 ]><div id="IE8"><![endif]-->
39    <div id="dokuwiki__site"><div id="dokuwiki__top" class="site <?php echo tpl_classes(); ?>">
40
41        <?php include('tpl_header.php') ?>
42
43        <div class="wrapper group" id="dokuwiki__detail">
44
45            <!-- ********** CONTENT ********** -->
46            <div id="dokuwiki__content"><div class="pad group">
47
48                <?php if(!$ERROR): ?>
49                    <div class="pageId"><span><?php echo hsc(tpl_img_getTag('IPTC.Headline',$IMG)); ?></span></div>
50                <?php endif; ?>
51
52                <div class="page group">
53                    <?php tpl_flush() ?>
54                    <?php tpl_includeFile('pageheader.html') ?>
55                    <!-- detail start -->
56                    <?php
57                    if($ERROR):
58                        echo '<h1>'.$ERROR.'</h1>';
59                    else: ?>
60
61                        <h1><?php echo nl2br(hsc(tpl_img_getTag('simple.title'))); ?></h1>
62
63                        <?php tpl_img(900,700); /* parameters: maximum width, maximum height (and more) */ ?>
64
65                        <div class="img_detail">
66                            <dl>
67                                <?php
68                                    // @todo: logic should be transferred to backend
69                                    $config_files = getConfigFiles('mediameta');
70                                    foreach ($config_files as $config_file) {
71                                        if(@file_exists($config_file)) {
72                                            include($config_file);
73                                        }
74                                    }
75
76                                    foreach($fields as $key => $tag){
77                                        $t = array();
78                                        if (!empty($tag[0])) {
79                                            $t = array($tag[0]);
80                                        }
81                                        if(is_array($tag[3])) {
82                                            $t = array_merge($t,$tag[3]);
83                                        }
84                                        $value = tpl_img_getTag($t);
85                                        if ($value) {
86                                            echo '<dt>'.$lang[$tag[1]].':</dt><dd>';
87                                            if ($tag[2] == 'date') {
88                                                echo dformat($value);
89                                            } else {
90                                                echo hsc($value);
91                                            }
92                                            echo '</dd>';
93                                        }
94                                    }
95                                ?>
96                            </dl>
97                        </div>
98                        <?php //Comment in for Debug// dbg(tpl_img_getTag('Simple.Raw'));?>
99                    <?php endif; ?>
100                </div>
101                <!-- detail stop -->
102                <?php tpl_includeFile('pagefooter.html') ?>
103                <?php tpl_flush() ?>
104
105                <?php /* doesn't make sense like this; @todo: maybe add tpl_imginfo()?
106                <div class="docInfo"><?php tpl_pageinfo(); ?></div>
107                */ ?>
108
109            </div></div><!-- /content -->
110
111            <hr class="a11y" />
112
113            <!-- PAGE ACTIONS -->
114            <?php if (!$ERROR): ?>
115                <div id="dokuwiki__pagetools">
116                    <h3 class="a11y"><?php echo $lang['page_tools']; ?></h3>
117                    <div class="tools">
118                        <ul>
119                            <?php
120                                $data = array();
121                                $data['view'] = 'detail';
122
123                                // View in media manager; @todo: transfer logic to backend
124                                $imgNS = getNS($IMG);
125                                $authNS = auth_quickaclcheck("$imgNS:*");
126                                if (($authNS >= AUTH_UPLOAD) && function_exists('media_managerURL')) {
127                                    $mmURL = media_managerURL(array('ns' => $imgNS, 'image' => $IMG));
128                                    $data['items']['mediaManager'] = '<li><a href="'.$mmURL.'" class="mediaManager"><span>'.$lang['img_manager'].'</span></a></li>';
129                                }
130
131                                // Back to [ID]; @todo: transfer logic to backend
132                                $data['items']['img_backto'] = '<li><a href="'.wl($ID).'" class="back"><span>'.$lang['img_backto'].' '.$ID.'</span></a></li>';
133
134                                // the page tools can be amended through a custom plugin hook
135                                $evt = new Doku_Event('TEMPLATE_PAGETOOLS_DISPLAY', $data);
136                                if($evt->advise_before()){
137                                    foreach($evt->data['items'] as $k => $html) echo $html;
138                                }
139                                $evt->advise_after();
140                                unset($data);
141                                unset($evt);
142                            ?>
143                        </ul>
144                    </div>
145                </div>
146            <?php endif; ?>
147        </div><!-- /wrapper -->
148
149        <?php include('tpl_footer.php') ?>
150    </div></div><!-- /site -->
151
152    <!--[if ( lte IE 7 | IE 8 ) ]></div><![endif]-->
153</body>
154</html>
155