Web   ·   Wiki   ·   Activities   ·   Blog   ·   Lists   ·   Chat   ·   Meeting   ·   Bugs   ·   Git   ·   Translate   ·   Archive   ·   People   ·   Donate
summaryrefslogtreecommitdiffstats
path: root/site/app/views/addons/display.thtml
blob: 0affbb4b52524d33e5bdf9752fc315dee7f0ae74 (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
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
<?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)) {
    $icon = ($addon['Addon']['addontype_id'] == ADDON_THEME) ?
        DEFAULT_THEME_ICON : DEFAULT_ADDON_ICON;
    $addonIconPath = $html->urlImage($icon);
}
?>

<div class="stand-alone-options">
  <?=$this->renderElement('amo2009/categories')?>
  <?=$this->renderElement('amo2009/search')?>
</div>

<?=$this->renderElement('amo2009/breadcrumbs', array())?>
<h2 <?=$addon['Translation']['name']['locale_html']?> class="addon">
  <img src="<?=$addonIconPath?>" class="icon" alt="" />
  <span>
    <?=$addon['Translation']['name']['string']?>
    <?=($hasversion ? $addon['Version'][0]['Version']['version'] : '')?>
  </span>
</h2>
<h4 class="author"><?=___('by')?> <?= $html->linkUsersFromModel($addon['User'], 0); ?></h4>

<?php
if (!empty($coll_addon_added)) {
    echo $this->renderElement('notification', array(
        'type' => 'success',
        'msg' => sprintf(___('%1$s has been added to the %2$s collection.'),
            $addon['Translation']['name']['string'],
            $html->link($coll_addon_added['Translation']['name']['string'],
                        "/collection/{$coll_addon_added['Collection']['uuid']}")
        )
    ));
  }
?>

<div id="addon" class="primary" role="main">
  <div class="featured">
    <div class="featured-inner object-lead inverse">

    <div id="addon-summary-wrapper">
        <div id="addon-summary" class="primary <?=$html->extraClass($addon)?>">
            <p <?=$addon['Translation']['summary']['locale_html']?>>
              <?=nl2br($addon['Translation']['summary']['string'])?>
            </p>

            <?php if ($hasversion): ?>
            <div id="addon-install">
                <?php
                if (array_key_exists('collection_id', $_GET) && $this->controller->Collection->isValidUUID($_GET['collection_id'])) {
                    $_collection_uuid = $_GET['collection_id'];
                } else {
                    $_collection_uuid = '';
                }
                $flags = array($html->byStatus($addon, array('experimental' => 'experimental',
                                                             'recommended' => 'recommended',
                                                             'default' => '')));
                // Only api is valid right now
                $src = (array_key_exists('src', $_GET) && in_array($_GET['src'], array('api'))) ? $_GET['src'] : 'addondetail';
                
                $options = array(
                    'flags' => $flags,
                    'buttonClass' => 'significant',
                    'buttonSize'  => '16x16',
                    'addon' => $addon,
                    'collection_uuid' => $_collection_uuid,
                    'src' => $src,
                    'annoying' => $addon['Addon']['wants_contributions'] ? $addon['Addon']['annoying'] : 0,
                    'addonFiles' => $addon['Version'][0]['File'],
                    'loggedin' => $this->controller->Session->check('User')
                );
                
                echo $installButton->button($options);

                /* TODO: align View Privacy Policy w/ recommended & regular */
                if (!empty($addon['Translation']['privacypolicy']['string'])): ?>
                    <a class="privacy-policy"
                       href="<?=$html->url('/addons/policy/0/'.$addon['Addon']['id'])?>">
                      <strong><?=___('View privacy policy')?></strong>
                    </a>
                <?php endif; ?>
            </div>
                <?php
                $_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']
                );
            endif;
            ?>

            <?php
            if ($this->controller->Addon->acceptContributions($addon)) {
                echo $this->renderElement('amo2009/contribution', array(
                        'text' => ___('The developer of this add-on asks that you help support its continued development by making a small contribution.'),
                        'source' => 'addon-detail'));
            }
            ?>

            <table summary="<?=___('Add-on Information')?>">
              <tbody>
                <?php if ($hasversion): ?>
                    <tr>
                      <th><?=___('Version')?></th>
                      <td><?=$_version_data['version']?></td>
                    </tr>
                    <tr>
                      <th><?=___('Works with')?></th>
                      <td>
                        <?=$this->renderElement('app_versions',
                                                array('app' => $compatible_apps[0]))?>
                      </td>
                    </tr>
                    <tr>
                      <th><?=___('Updated')?></th>
                      <?php $updated = strtotime(str_replace('&#45;', '-', $_version_data['created'])) ?>
                      <td>
                        <span title="<?=strftime(___('%B %e, %Y, %I:%M %p'), $updated)?>">
                          <?=strftime(___('%B %e, %Y'), $updated)?>
                        </span>
                      </td>
                    </tr>
                <?php endif; ?>
                <tr>
                  <th>
                    <?=n___('Developer',
                            'Developers',
                            count($addon['User']))?>
                  </th>
                  <td><?=$html->linkUsersFromModel($addon['User'], 40)?></td>
                </tr>

                <?php if (!empty($addon['Translation']['homepage']['string'])): ?>
                  <tr>
                    <th><?=___('Homepage', 'addons_display_header_homepage')?></th>
                    <td><strong>
                      <?=$html->link($addon['Translation']['homepage']['string'])?>
                    </strong></td>
                  </tr>
                <?php endif ?>

                <?php if (!empty($addon['Addon']['suggested_amount'])): ?>
                  <tr>
                    <th><?=___('License')?></th>
                    <td><strong>
                      <?=$html->link($addon['Addon']['suggested_amount'], 'http://wiki.sugarlabs.org/go/Activity_Library/Editors/Policy/Licensing')?>
                    </strong></td>
                  </tr>
                <?php endif ?>

                <tr>
                  <th><?=___('Rating', 'advanced_search_form_rating')?></th>
                  <td><?=$this->renderElement('amo2009/reviews', array('addon' => $addon))?></td>
                </tr>
                <tr>
                  <th><?=___('Downloads', 'list_sortby_downloads')?></th>
                  <td>
                    <strong class="downloads">
                      <?=$html->number_format($addon['Addon']['totaldownloads'], 0)?>
                    </strong>
                    <?php if ($addon['Addon']['publicstats'] == 1): ?>
                      <?=$html->link(___('Statistics'),
                                     '/statistics/addon/'.$addon['Addon']['id']);?>
                    <?php endif; ?>
                  </td>
                </tr>
              </tbody>
            </table>
          </div> <!-- addon-summary -->
    </div> <!-- addon-summary-wrapper -->


      <div class="secondary">
          <?php if (count($previews) > 0): ?>
            <?php
            $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'];
            ?>
            <a class="screenshot thumbnail" rel="lightbox" href="<?=$full?>" title="<?=$caption?>">
              <img alt="" src="<?=$thumb?>" />
            </a>
          <?php else: ?>
            <img class="screenshot thumbnail" src="<?=$html->urlImage('no-preview.png')?>"
                 alt="" width="200" height="150" />
          <?php endif ?>

          <div class="share-this">
            <a class="share" href="#"><?=___('Share this Add-on')?></a>
            <div class="share-networks">
              <ul>
                <?php foreach ($link_sharing_services as $l_name => $l_details) :?>
                  <li class="<?= $l_name ?>">
                    <?php $share_url = str_replace('/addon/', '/addon/share/', $html->url()) ?>
                    <a class="uniquify" target="_blank" href="<?= $share_url . '?service=' . $l_name ?>">
                      <?php // Escaping here because these details came via set() ?>
                      <?=htmlentities($l_details['label'], ENT_COMPAT, 'UTF-8')?>
                    </a>
                  </li>
                <?php endforeach ?>
              </ul>
            </div>
          </div> <!-- share-this -->
        </div> <!-- secondary -->
    </div> <!-- featured-inner -->
  </div> <!-- featured -->

  <h3><?=___('More about this add-on')?></h3>
  <div class="article">
    <p <?=$addon['Translation']['description']['locale_html']?>>
      <?=nl2br($addon['Translation']['description']['string'])?>
    </p>
    <? if (count($previews) > 1): // Only show this if there are 2 or more images. ?>
      <h4><?=___('Image Gallery')?></h4>
      <?php
      foreach (array_slice($previews, 1) as $preview):
          $thumb = $this->controller->Image->getPreviewURL($preview['Preview']['id']);
          $full = $this->controller->Image->getPreviewURL($preview['Preview']['id'], 'full');
          $caption = $preview['Translation']['caption']['string'];
      ?>
        <a class="screenshot thumbnail" rel="jquery-lightbox"
           href="<?=$full?>" title="<?=$caption?>">
          <img src="<?=$thumb?>" alt="" />
        </a>
      <? endforeach; ?>
    <? endif; ?>

    <?php
    $support_email = $addon['Translation']['supportemail']['string'];
    $support_url = $addon['Translation']['supporturl']['string'];
    $has_email = !empty($support_email);
    $has_url = !empty($support_url);
    if ($has_email || $has_url):
    ?>
      <h4 id="support"><?=___('Support')?></h4>
      <p>
        <?php if ($has_email && $has_url): ?>
          <?=sprintf(___('Support for this add-on is provided by the developer at %1$s or by sending an e-mail to %2$s'),
                     $html->link($support_url),
                     $link->email($support_email));?>
        <?php elseif ($has_url): ?>
          <?=sprintf(___('Support for this add-on is provided by the developer at %s', 'addons_display_paragraph_supportinfoemail'),
                     $html->link($support_url));?>
        <?php elseif ($has_email): ?>
          <?=sprintf(___('Support for this add-on is provided by the developer at %s', 'addons_display_paragraph_supportinfoemail'),
                     $link->email($support_email));?>
        <?php endif; ?>
      </p>
    <?php endif; ?>

    <?php $comments = $addon['Translation']['developercomments']['string'] ?>
    <?php if (!empty($comments)): ?>
      <h4><?=___('Developer Comments', 'addons_display_developer_comments')?></h4>
      <p <?=$addon['Translation']['developercomments']['locale_html']?>>
        <?=nl2br($addon['Translation']['developercomments']['string'])?>
      </p>
    <?php endif; ?>
  </div> <!-- article -->

  <?php if (!empty($reviews)): ?>
    <h3 id="reviews"><?=___('Reviews')?></h3>
    <div class="article">
      <?php
      foreach ($reviews as $rev_no => $review):
        $review['Translation'] = (array_key_exists(LANG, $review['Translation']) ?
            $review['Translation'][LANG] : current($review['Translation']));
      ?>
        <div class="hreview">
          <?php if (!empty($review['Translation']['title']['string'])): ?>
            <h5><?=$review['Translation']['title']['string']?></h5>
          <?php endif; ?>
          <p class="description"><?=nl2br($review['Translation']['body']['string'])?></p>
          <p>
            <?=$this->renderElement('amo2009/stars',
                                    array('rating' => $review['Review']['rating']));?>
            <?=sprintf(___('by %1$s on %2$s'),
                       $html->linkUserFromModel($review['User']),
                       strftime(___('%B %e, %Y'), strtotime($review['Review']['created'])))?>
          </p>
        </div>
      <?php endforeach; ?>
      <p>
        <a class="more-info" href="<?=$html->url('/reviews/display/'.$addon['Addon']['id'])?>">
          <?=sprintf(___('See all %1$s reviews of this add-on'), $review_count)?>
        </a>
      </p>
    </div>
  <?php endif; /* reviews */ ?>


  <?php if(empty($isAuthor)): ?>
    <h3><?=___('What do you think?')?></h3>
    <div id="review-box" class="highlight">
      <?php if (!$loggedIn): ?>
        <p><?=sprintf(___('Please <a href="%1$s">log in</a> to submit a review'), $html->url($html->login_url()))?></p>
      <?php endif; ?>

      <form class="addon-feedback" method="post"
            action="<?=$html->url('/reviews/add/'.$addon['Addon']['id'])?>">
        <?=$html->hiddenSession() ?>

        <?php $disabled = $loggedIn ? '' : 'disabled="disabled"'; ?>
        <div class="container">
          <label for="review"><?=___('Review')?></label>
          <textarea name="data[Review][body]" id="review" <?=$disabled?>
                    cols="30" rows="6"></textarea>
        </div>
        <div class="container">
          <label for="review-rating"><?=___('Rating', 'advanced_search_form_rating')?></label>
          <select id="review-rating" name="data[Review][rating]">
            <option></option>
            <option value="1" class="worst">*</option>
            <option value="2" class="bad">**</option>
            <option value="3" class="fair">***</option>
            <option value="4" class="good">****</option>
            <option value="5" class="best">*****</option>
          </select>
          <input type="hidden" name="data[Review][id]"  value="" id="ReviewId"/>
          <input type="hidden" name="data[Review][title]"  value=" " id="ReviewTitle"/>
          <button <?=$disabled?>><?=___('Post Review')?></button>
        </div>
      </form>

      <p><?=___('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.');?></p>
      <?php if ($has_email || $has_url): ?>
        <p><?=sprintf(___('See the <a href="%1$s">support section</a> to find out where to get assistance for this add-on.'), '#support')?></p>
      <?php endif; ?>
      <p>
        <?=sprintf(___('<a href="%s">Review Guidelines</a>'), $html->url('/pages/review_guide'))?>
      </p>
      <p>
        <a href="<?=$html->url('/reviews/add/'.$addon['Addon']['id'])?>">
          <?=___('Detailed Review')?>
        </a>
      </p>
    </div> <!-- highlight -->
  <?php endif; /* isAuthor */ ?>

  <?php if ($hasversion): ?>
      <h3><?=___('Release Notes', 'addons_display_release_notes')?></h3>
      <div class="article">
        <?=$this->renderElement('addon_version_detail', $_version_data)?>
        <p id="release-notes" <?=$addon['Version'][0]['Translation']['releasenotes']['locale_html']?>>
          <?=nl2br($addon['Version'][0]['Translation']['releasenotes']['string'])?>
        </p>

        <ul class="further-navigation">
          <?php if ($addon['Addon']['viewsource'] == 1 &&
                    $this->controller->Session->check('User')): ?>
            <li>
              <a href="<?=$html->url('/files/browse/'.$addon['Version'][0]['File'][0]['id'])?>"><?=___('View the source')?></a>
            </li>
          <?php endif; ?>
          <li>
            <a href="<?=$html->url('/addons/versions/'.$addon['Addon']['id'])?>">
              <?=___('View Older Versions')?>
            </a>
          </li>
        </ul>
      </div> <!-- Release Notes -->
  <?php endif; ?>

</div> <!-- primary -->

<div class="secondary" role="secondary">

<?php if(!empty($addon['Translation']['the_reason']['string']) && !empty($addon['Translation']['the_future']['string'])): ?>
<div class="highlight">
  <?php
  $devs = $addon['User'];
  $dev = $addon['User'][array_rand($addon['User'])];
  $dev = $this->controller->User->getUser($dev['id']);
  ?>
  <h3 class="compact-bottom"><?=n___('Meet the Developer', 'Meet the Developers', count($devs))?></h3>
  <img class="avatar" alt="<?=$dev['User']['display_name']?>" height="64" width="64"
       src="<?=$html->url('/users/picture/'.$dev['User']['id'])?>" />
  <p><?=sprintf(___('Learn why %1$s was created and find out what\'s next for this add-on.'),
                $addon['Translation']['name']['string'])?></p>
  <p>
    <a class="more-info" href="<?=$html->url('/addon/'.$addon_id.'/developers')?>">
        <? if (count($devs) > 1): ?>
          <?=n___('Meet the Developer', 'Meet the Developers', count($devs))?>
        <? else: ?>
          <?=sprintf(___('Meet %1$s'), $dev['User']['display_name'])?>
        <? endif; ?>
    </a>
  </p>
</div>
<?php endif; ?>

<?php if (!empty($relatedCategories) || count($authorAddons) > 1): ?>
    <div class="highlight">

      <?php
      if (is_array($relatedCategories)) {
          $_sort_opt = ($addon['Addon']['addontype_id'] == ADDON_SEARCH) ? '?sort=rated' : '';
          echo '<ul>';
          foreach ($relatedCategories as $category) {
              echo '<li>'.$html->link(sprintf(___('See All %1$s Add-ons'),$category['Translation']['name']['string']), '/browse/' . "type:" . $category['Category']['addontype_id'] . '/' . "cat:" . $category['Category']['id'] . $_sort_opt , array('class'=>'more-info')) . "</li>\n";
          }
          echo '</ul>';
      }
      ?>

      <?php if (count($authorAddons) > 1): ?>
          <div class="other-author-addons">
              <h4><?=sprintf(n___('Other add-ons by %1$s', 'Other add-ons by these authors', count($addon['User'])),
                             $html->linkUsersFromModel($addon['User'], 0));?>
              </h4>
          <?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="'.___('Go', 'addons_author_addons_submit').'"/>';
              echo '</form>';
          } else {
              echo '<ul class="addon-otheraddons">';
              echo $this->renderElement('addon_author_addons', array('tag' => 'li', 'class' => 'addonitem'));
              echo '</ul>';
          }
          ?>
          </div>
      <?php endif; ?>
    </div>
<?php endif; ?>

<div class="clearboth">
<h3 class="compact-bottom"><?=___('Tags', 'tags_header_tags_title')?></h3>

    <script type="text/javascript">
        <?=$this->renderElement('tags_js_init')?>
    </script>

    <div id='tags'>
        <?=$this->renderElement('addon_tags',array('userTags'=>$userTags, 'developerTags'=>$developerTags,'addon_id'=>$addon_id, 'origin'=>'users')); ?>
    </div>

    <? if ($loggedIn): ?>
        <a href="#" id="addatag"><?=___('Add a tag');?></a>
        <div class="addtagform ">
            <form id='tagForm' action="<?=$html->url("/tags/add/")?>" method="POST">
                <?=$html->hiddenSession() ?>
                <input type="text" id='newTag' name="newTag" />
                <input type="hidden" name="addonid" id="addtagformaddonid" value="<?=$addon['Addon']['id']?>" />
                <button id="addtagbutton"><?=___('Add', 'tags_add_tag_button');?></button>
            </form>
            <span class="hint"><?=___('Comma-separated, minimum of 2 characters.  Example: <span class="example">ocean, sail boat, water</span>')?></span>
        </div>
    <? else: ?>
        <?echo sprintf(
            ___('<a href="%1$s">Register</a> or <a href="%2$s">Log in</a> to add tags'),
            $html->url('/users/register', false), $html->url($html->login_url())); ?>
    <? endif; ?>

</div>
<!-- /.highlight-->

    <?php if (!empty($addon['Recommendations'])): ?>
      <div>
        <h3 class="compact-bottom"><?=___('Often Used with&hellip;')?></h3>
        <ul class="addon-otheraddons">
          <?php foreach ($addon['Recommendations'] as $rec): ?>
            <li>
              <a href="<?=$html->url('/addon/'.$rec['Addon']['id'].'?src=reco')?>" class="addonitem">
                <?=$rec['Translation']['name']['string']?>
              </a>
            </li>
          <?php endforeach; ?>
        </ul>
      </div>
    <?php endif; ?>

    <div class="collections-add">
        <h3 class="compact-bottom"><?=___('Related Collections')?></h3>

        <?php if (empty($pop_collections)): ?>
            <p><?=___('This add-on is not yet in any collections.')?></p>
        <?php else: ?>
            <ul class="addon-collections">
                <?php foreach($pop_collections as &$_coll): ?>
                    <li><?=$link->collection($_coll, null, array('class' => 'collectionitem'))?></li>
                <?php endforeach; ?>
            <?php if (($_othercolls = $collection_count - count($pop_collections)) > 0): ?>
                <li>
                    <a href="<?=$html->url('/collections/addon/'.$addon['Addon']['id'])?>">
                        <?=sprintf(n___('and %1$s more collection',
                                        'and %1$s more collections',
                                        $_othercolls),
                                   $_othercolls)?>
                    </a>
                </li>

        <?php endif; ?>
        </ul>
        <?php endif; ?>
        <?php if ($loggedIn): ?>
        <form action="<?= $html->url('/collections/addtocollection') ?>" method="post" id="coll_publish">
            <div>
            <?=$html->link(___('What\'s this?', 'addons_display_a_license_what'), '/collections/')?>
            <h3><label for="publish_to"><?=___('Add to a collection:')?></label></h3>
            <?=$html->hiddenSession() ?>
            <input name="data[addon_id]" type="hidden" value="<?= $addon['Addon']['id'] ?>" />
            <select name="data[collection_uuid]" id="publish_to">
                <option value="" selected="selected"><?=___('Select a collection...')?></option>
                <?php foreach ($userCollections as $collection): ?>
                <option value="<?=$collection['Collection']['uuid'] ?>"><?=$collection['Translation']['name']['string'] ?></option>
                <?php endforeach; ?>
                <option value="new"><?=___('New Collection...')?></option>
            </select>
            <button><?=___('Publish')?></button>
            </div>
        </form>
        <?php endif; ?>
    </div>

</div>
<script type="text/javascript" charset="utf-8">
    // <![CDATA[
    $(function(){
        addons_display.init({
            jsonURL: '<?=$html->url('/collections/json')?>',
            collViewURL: '<?=$html->url('/collection/')?>',
            loggedIn: <?=(int)$loggedIn?>
            });
        $("a[rel=jquery-lightbox]").lightBox({
            overlayOpacity: 0.6,
            imageBlank: "<?= $html->urlImage('jquery-lightbox/lightbox-blank.gif') ?>",
            imageLoading: "<?= $html->urlImage('jquery-lightbox/lightbox-ico-loading.gif')?>",
            imageBtnClose: "<?= $html->urlImage('jquery-lightbox/close.png')?>",
            imageBtnPrev: "<?= $html->urlImage('jquery-lightbox/goleft.png')?>",
            imageBtnNext: "<?= $html->urlImage('jquery-lightbox/goright.png')?>",
            containerResizeSpeed: 350
        });

        $(document).ready(function() {
            var etiquette_box = $("#addons-display-review-etiquette").hide();
            $("#short-review").focus(function() { etiquette_box.show("fast"); } );
        });

        // This function toggles an element's text between two values
        jQuery.fn.textToggle = function(text1, text2) {
            jQuery(this).text( ( jQuery(this).text() == text1 ? text2 : text1 ) );
        };
    });
    // ]]>
</script>
<!-- /#content -->