Web   ·   Wiki   ·   Activities   ·   Blog   ·   Lists   ·   Chat   ·   Meeting   ·   Bugs   ·   Git   ·   Translate   ·   Archive   ·   People   ·   Donate
summaryrefslogtreecommitdiffstats
path: root/site/app/views/addons/display.thtml
blob: c06b38918056f9c704bf0819062506cf88b213d4 (plain)
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
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
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
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
<?php
/* ***** BEGIN LICENSE BLOCK *****
 * Version: MPL 1.1/GPL 2.0/LGPL 2.1
 *
 * The contents of this file are subject to the Mozilla Public License Version
 * 1.1 (the "License"); you may not use this file except in compliance with
 * the License. You may obtain a copy of the License at
 * http://www.mozilla.org/MPL/
 *
 * Software distributed under the License is distributed on an "AS IS" basis,
 * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
 * for the specific language governing rights and limitations under the
 * License.
 *
 * The Original Code is addons.mozilla.org site.
 *
 * The Initial Developer of the Original Code is
 * The Mozilla Foundation.
 * Portions created by the Initial Developer are Copyright (C) 2006
 * the Initial Developer. All Rights Reserved.
 *
 * Contributor(s):
 *   Andrei Hajdukewycz <sancus@off.net> (Original Author)
 *   Mike Morgan <morgamic@mozilla.com>
 *   Frederic Wenzel <fwenzel@mozilla.com>
 *   Justin Scott <fligtar@gmail.com>
 *
 * Alternatively, the contents of this file may be used under the terms of
 * either the GNU General Public License Version 2 or later (the "GPL"), or
 * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
 * in which case the provisions of the GPL or the LGPL are applicable instead
 * of those above. If you wish to allow use of your version of this file only
 * under the terms of either the GPL or the LGPL, and not to allow others to
 * use your version of this file under the terms of the MPL, indicate your
 * decision by deleting the provisions above and replace them with the notice
 * and other provisions required by the GPL or the LGPL. If you do not delete
 * the provisions above, a recipient may use your version of this file under
 * the terms of any one of the MPL, the GPL or the LGPL.
 *
 * ***** END LICENSE BLOCK ***** */
?>

<?php
        
    if (empty($addonIconPath))
        $addonIconPath = ($addon['Addon']['addontype_id'] == ADDON_THEME ? $html->urlImage(DEFAULT_THEME_ICON) : $html->urlImage(DEFAULT_ADDON_ICON));

// is addon experimental?
global $experimental_status;
if (in_array($addon['Addon']['status'], $experimental_status)) {
    $flag = _('addon_listitem_flag_experimental');
    $box_extraclass = 'exp';
} else {
    $flag = '';
    $box_extraclass = '';
}

?>

  <div id="content" class="detail-page">

<?=$this->renderElement('search')?>

  <div id="content-main">

    <div id="addon-summary" class="addon <?=$box_extraclass?>">
    <h3 class="name"<?=$addon['Translation']['name']['locale_html']?>><img src="<?=$addonIconPath?>" class="addon-icon" alt="" /><?=$addon['Translation']['name']['string']?> <?=($hasversion?$addon['Version'][0]['Version']['version']:'')?></h3>
    <h4 class="author"><?=_('addons_home_by')?> <?= $html->linkUsersFromModel($addon['User'], 0); ?></h4>
    <? if (!empty($flag)) echo '<h5 class="flag">'.$flag.'</h5>'; ?>

    <?php if (count($previews) > 0) {
        $shown = 0;
        $_js_string = '';
        
        $thumb = $this->controller->Image->getPreviewURL($previews[0]['Preview']['id']);
        $full = $this->controller->Image->getPreviewURL($previews[0]['Preview']['id'], 'full');
        $caption = $previews[0]['Translation']['caption']['string'];
        // Lightbox supports HTML in their captions, but we strip it
        // out in the dev cp.
    ?>

    <p class="preview-img">
      <a rel="jquery-lightbox" href="<?=$full?>" title="<?=$caption?>">
        <img src="<?=$thumb?>" alt=""/>
      </a>
    </p>
    <?php } else { ?>
    <p class="preview-img">
      <img src="<?=$html->urlImage('no-preview.png')?>" alt="" width="200" height="150" />
    </p>
    <?php } ?>

    <h4 class="hidden"><?=_('addons_display_categories')?></h4>
    <?=$this->renderElement('addon_categories', array('tags' => $relatedTags)); ?>

    <p class="desc"<?=$addon['Translation']['summary']['locale_html']?>><?=nl2br($addon['Translation']['summary']['string'])?> </p>

    <p class="rating"><?=$this->renderElement('stars',array('rating' => $addon['Addon']['averagerating']))?> <?php if ($review_count > 0) { ?> <a href="<?=$html->url('/addon/'.$addon['Addon']['id'].'#reviews')?>"><?=sprintf(ngettext('feature_reviews','feature_reviews', $review_count), $review_count)?></a><?php } ?></p>
    <? if ($hasversion): ?>
    <p class="updated">
        <?php
        // @partial 5/08/08, bug 425527
        $_update_string = (_('addon_detail_last_updated') == 'addon_detail_last_updated') ? 'Updated %s' : _('addon_detail_last_updated');
        echo sprintf($_update_string, strftime(_('date'), strtotime($addon['Version'][0]['Version']['created'])));
        ?>
    </p>
    <? endif; ?>
    <p class="stats">
        <em><?=$html->number_format($addon['Addon']['weeklydownloads'], 0)?></em>
        <?php
        /* @partial 4/25/08
           Only show total downloads if string has been translated to avoid
           showing two "downloads" with different numbers */
        if (_('addon_downloads_weekly') == 'addon_downloads_weekly') {
            echo _('addon_downloads');
        }
        else {
            echo _('addon_downloads_weekly');
            echo '<br /><em>'.$html->number_format($addon['Addon']['totaldownloads'], 0).'</em> '._('addon_downloads_total');
        }
        ?>
    </p>

    <?php
    if ($hasversion) {

        $_install_render_options = array(
            'addonIconPath' => $addonIconPath, 
            'addonName'     => $addon['Translation']['name']['string'],
            'addonId'       => $addon['Addon']['id'],
            'addonFiles'    => ($hasversion?$addon['Version'][0]['File']:''),
            'is_latest'     => true,
            'addonEULA'     => $addon['Translation']['eula']['string'],
            'addonStatus'   => $addon['Addon']['status'],
            'addonType'     => $addon['Addon']['addontype_id'],
            'allPlatforms'  => $platforms,
            'compatible_apps'=> $compatible_apps
            );
        echo $this->renderElement('install', $_install_render_options);

        if (!empty($addon['Translation']['privacypolicy']['string'])) {
            echo '<div class="privacypolicy">';
            echo $html->link(_('addons_display_has_privacy'), "/addons/policy/0/{$addon['Addon']['id']}");
            echo '</div>';
        }
    }
    ?>

    <div class="vex"><span><!-- bottom edge --></span></div>
  </div>
  <!-- /#addon-summary -->

  <div id="addon-info">

    <? if (count($previews) > 1): // Only show this if there are 2 or more images. ?>
    <h4><?=_('addons_display_more_images')?></h4>
    <ul class="addon-images">
    <?php
        $shown = 0;
        $_js_string = '';

        foreach ($previews as $preview):

            // Skip the first one, which is the preview.
            if ($shown < 1) {
                $shown++;
                continue;
            }

            $thumb = $this->controller->Image->getPreviewURL($preview['Preview']['id']);
            $full = $this->controller->Image->getPreviewURL($preview['Preview']['id'], 'full');
            $caption = $preview['Translation']['caption']['string'];
            // Lightbox supports HTML in their captions, but we strip it
            // out in the dev cp.
            $_js_string .= empty($_js_string) ? "['{$full}','{$caption}']" : ", ['{$full}','{$caption}']";
            $shown++;
    ?>

      <li><a rel="jquery-lightbox" href="<?=$full?>" title="<?=$caption?>"><img src="<?=$thumb?>" alt="" /></a></li>

        <? endforeach; ?>
    </ul>
    <? endif; ?>


    <h4><?=_('addons_display_long_description')?></h4>
    <p<?=$addon['Translation']['description']['locale_html']?>><?=nl2br($addon['Translation']['description']['string'])?></p>

    <?=$this->renderElement('app_compatibility', array('compatible_apps' => $compatible_apps)) ?>

    <div id="addon_app_compatibility" ><?php
    // link to complete version history
    if ($hasversion) {
        // @partial, 4/9/08
        $_versionhistory_linktext = (_('addons_display_see_all_versions') ==
            'addons_display_see_all_versions' ? _('addons_display_version_history') :
            _('addons_display_see_all_versions'));
        echo '<h4 class="version-link">'.$html->link($_versionhistory_linktext,
            "/addons/versions/{$addon['Addon']['id']}", array('class'=>'view'))."</h4>";
    }
    ?></div>

    <?php 
    /* Homepage URL link */
    if (!empty($addon['Translation']['homepage']['string'])): ?>

        <?php //@partial, 5/12/08, bug 425537
            if (_('addons_display_header_homepage') == 'addons_display_header_homepage') {
                echo '<h4 id="homepage">Homepage</h4>';
            } else {
                echo '<h4 id="homepage">'._('addons_display_header_homepage').'</h4>';
            }
        ?>
        <p><?=$html->link($addon['Translation']['homepage']['string'])?></p>

    <?php endif; // h4:Homepage ?>


    <?php
    $has_supportemail = !empty($addon['Translation']['supportemail']['string']);
    $has_supporturl = !empty($addon['Translation']['supporturl']['string']);
    if ($has_supportemail || $has_supporturl): ?>

        <?php //@partial, 4/25/08, bug 425510
            if (_('addons_display_header_support') == 'addons_display_header_support') {
                echo '<h4 id="support">Support</h4>';
            } else {
                echo '<h4 id="support">'._('addons_display_header_support').'</h4>';
            }
        ?>

        <?php
        /* Support email/URL link */
        if ($has_supportemail && $has_supporturl) {
            // both support email and support URL present
        ?>
        <p>
            <?=sprintf(_('addons_display_paragraph_supportinfoemailurl'),
                $html->link($addon['Translation']['supporturl']['string']),
                $link->email($addon['Translation']['supportemail']['string']));?>
        </p>
        <?php
        } else if ($has_supporturl) {
            // support URL only
        ?>
        <p>
            <?=sprintf(_('addons_display_paragraph_supportinfourl'),
                $html->link($addon['Translation']['supporturl']['string']));?>
        </p>
        <?php
        } else if ($has_supportemail) {
            // support email only
        ?>
        <p>
            <?=sprintf(_('addons_display_paragraph_supportinfoemail'),
                $link->email($addon['Translation']['supportemail']['string']));?>
        </p>
        <?php } ?>

    <?php endif; // h4:Support ?>

    <?php if (!empty($reviews)): ?>

    <h4 id="reviews"><?=_('addons_display_header_reviews')?></h4>

    <ul class="addon-reviews">

    <?php
    foreach ($reviews as $rev_no => $review):
        $review['Translation'] = (array_key_exists(LANG, $review['Translation']) ?
            $review['Translation'][LANG] : current($review['Translation']));
    ?>
        <li id="review-<?=$rev_no?>">
          <blockquote>
            <?php if (!empty($review['Translation']['title']['string'])): ?>
            <h5><?=$review['Translation']['title']['string']?></h5>
            <?php endif; ?>
            <p><?=$review['Translation']['body']['string']?></p>
          </blockquote>
          <p class="cite">
            <?=$this->renderElement('stars',array('rating' => $review['Review']['rating']))?>
            <cite>
            <?php
                // @partial: translation fallback for bug 427376, 04/24/08
                if (_('addon_reviewed_by_u_on_d') == 'addon_reviewed_by_u_on_d') {
                    echo $html->linkUserFromModel($review['User']).", ".strftime(_('date'), strtotime($review['Review']['created']));
                } else {
                    echo sprintf(_('addon_reviewed_by_u_on_d'),
                             $html->linkUserFromModel($review['User']),
                             strftime(_('date'), strtotime($review['Review']['created'])));
                }
            ?>
            </cite>
          </p>
        </li>
    <?php
    endforeach;
    ?>
        
    </ul>

    <? echo '<p>'.$html->link(sprintf(_('addons_display_see_all_reviews'), $review_count), '/reviews/display/'.$addon['Addon']['id'], array('class'=>'view')).'</p>'; ?>
    
    <?php endif; ?>



    </div>
    <!-- /#addon-info -->

    <div id="addon-advanced">
      <h4><?=_('addons_display_advanced_details')?></h4>

      <?php if (!empty($addon['Translation']['developercomments']['string'])) { ?>
      <h5><?=_('addons_display_header_developer_comments')?></h5>
      <p<?=$addon['Translation']['developercomments']['locale_html']?>>
        <?=nl2br($addon['Translation']['developercomments']['string'])?>
      </p>
      <?php } ?>

      <?php if ($hasversion):
          $_version_data = array(
              'addonid' => $addon['Addon']['id'],
              'version' => $addon['Version'][0]['Version']['version'],
              'created' => $addon['Version'][0]['Version']['created'],
              'fileSize' => $addon['Version'][0]['File'][0]['size'] 
          );
      ?>
      <h5><?=$this->renderElement('addon_version_detail', $_version_data)?></h5>
      <p <?=$addon['Version'][0]['Translation']['releasenotes']['locale_html']?>><?=nl2br($addon['Version'][0]['Translation']['releasenotes']['string'])?></p>
      <p>
      <?php
          $additionalLinks = array();
          if ($addon['Addon']['viewsource'] == 1 && $this->controller->Session->check('User')) {
            $additionalLinks[] = $html->link(_('addons_display_view_source'), "/files/browse/{$addon['Version'][0]['File'][0]['id']}");
          }
          if ($addon['Addon']['publicstats'] == 1) {
            $additionalLinks[] = $html->link(_('addons_display_view_stats'), "/statistics/addon/{$addon['Addon']['id']}");
          }
          
          if (!empty($additionalLinks)) {
            echo implode($additionalLinks, ' | ');
          }
      ?>
      </p>
      <? endif; ?>
  


    </div>
    <!-- /#addon-advanced -->

    <div id="content-extra">

      <?php if(empty($isAuthor)) { ?>
      <form id="form-review" action="<?=$html->url('/reviews/add/'.$addon['Addon']['id'])?>" method="post">
        <?=$html->hiddenSession() ?>       
        <h3><?=_('addons_display_what_do_you_think')?></h3>
        <?php if(!$loggedIn) { ?>
            <p class="login">(<?php echo $html->link(_('header_navlink_login'), $html->login_url());?>)</p>
        <?php } ?>
        <p><input type="hidden" name="data[Review][id]"  value="" id="ReviewId"/></p>
        <p><input type="hidden" name="data[Review][title]"  value=" " id="ReviewTitle"/></p>
        <fieldset id="rate-it">
            <h4><?=_('addons_display_rate_it')?></h4>
            <div class="stars degrade">
                <p><input class="star" type="radio" name="data[Review][rating]" value="1" title="<?=_('addons_display_hate_it')?>" /> <?=_('addons_display_hate_it')?></p>
                <p><input class="star" type="radio" name="data[Review][rating]" value="2" title="<?=_('addons_display_dont_like_it')?>"/> <?=_('addons_display_dont_like_it')?></p>
                <p><input class="star" type="radio" name="data[Review][rating]" value="3" title="<?=_('addons_display_like_it')?>"/> <?=_('addons_display_like_it')?></p>
                <p><input class="star" type="radio" name="data[Review][rating]" value="4" title="<?=_('addons_display_really_like_it')?>"/> <?=_('addons_display_really_like_it')?></p>
                <p><input class="star" type="radio" name="data[Review][rating]" value="5" title="<?=_('addons_display_love_it')?>"/> <?=_('addons_display_love_it')?></p>
            </div>
            <?=$html->tagErrorMsg('Review/rating', _('error_review_rating_required')) ?>
        </fieldset>
        <p><textarea name="data[Review][body]"  cols="30" rows="6" id="short-review" <?php if(!$loggedIn) { ?>disabled="disabled" class="disabled" <?php } ?>></textarea></p>
        <p id="review-submit">
            <?php
            //@partial
                $_submit_value = (_('addons_display_review_submit') == 'addons_display_review_submit') ? _('forum_save') : _('addons_display_review_submit');
            ?>
            <input type='submit' value='<?=$_submit_value?>' class="amo-submit" <?php if(!$loggedIn) { ?>disabled="disabled" <?php } ?> />

            <a href="<?=$html->url('/reviews/add/'.$addon['Addon']['id'])?>"><?=_('addons_display_detailed_review')?></a></p>
            <div id="addons-display-review-etiquette">
                <p>
                <?php // @partial 5/12/08
                    if (_('addons_display_review_etiquette') == 'addons_display_review_etiquette'): ?>
                    Please do not post bug reports in reviews. We do not make your email address available to add-on developers and they may need to contact you to help resolve your issue. 
                <?php else: ?>
                    <?php echo _('addons_display_review_etiquette'); ?>
                <?php endif; ?>
                </p>
                <?php
                if ($has_supportemail || $has_supporturl) {
                    // @partial 5/13/08
                    if (_('addons_display_review_see_support') == 'addons_display_review_see_support'): ?>
                    <p>See the <a href="#support">support section</a> to find out where to get assistance for this add-on.</p>
                    <?php
                    else:
                    echo '<p>'.sprintf(_('addons_display_review_see_support'),
                        '#support').'</p>';
                    endif;
                }
                ?>
                <p><?=sprintf(___('addons_display_review_guidelines_link', '<a href="%s">Review Guidelines</a>'), $html->url('/pages/review_guide')) /* @partial, 6/25/08 */ ?></p>
            </div>
      </form> 
      <?php } ?>

    <div class="more-addons">

      <?php 
      if (is_array($relatedTags)) {
          foreach ($relatedTags as $tag) {
              echo '<h3>'.$html->link(sprintf(_('addons_display_see_all_addons'),$tag['Translation']['name']['string']), '/browse/' . "type:" . $tag['Tag']['addontype_id'] . '/' . "cat:" . $tag['Tag']['id'], array('class'=>'view')) . '</h3>'."\n";
          }
      }
      ?>

     <?php if (count($authorAddons) > 1): ?>
     <h4><?=sprintf(n___('addons_display_other_addons_by', 'addons_display_other_addons_by', count($addon['User'])),
                    $html->linkUsersFromModel($addon['User'], 0));?>
     </h4>
     <ul>
     <?php
        if (count($authorAddons) > 3) {
            echo '<form id="addons-author-addons" method="get" action="">';
            echo '<select id="addons-author-addons-select" name="addons-author-addons-select" onchange="this.form.submit()">';
            echo $this->renderElement('addon_author_addons', array('tag' => 'option'));
            echo '</select>';
            echo '<input class="hidden" type="submit" value="'._('addons_author_addons_submit').'"/>';
            echo '</form>';
        } else {
            echo $this->renderElement('addon_author_addons', array('tag' => 'li'));
        }
     ?>
     </ul>
     <?php endif; ?>

    </div>
    <!-- /#more-addons-->

  
    </div>
    <!-- /#content-extra -->

  </div>
  <!-- /#content-main -->

<?=$this->renderElement('sidebar')?>

<?=$this->renderElement('app_chooser')?>

</div>
<script type="text/javascript" charset="utf-8">
    $(function(){ $('.stars').rating(<?php if(!$loggedIn) { ?> {readOnly:true}<?php } ?>); });
</script>
<!-- /#content -->