Web   ·   Wiki   ·   Activities   ·   Blog   ·   Lists   ·   Chat   ·   Meeting   ·   Bugs   ·   Git   ·   Translate   ·   Archive   ·   People   ·   Donate
summaryrefslogtreecommitdiffstats
path: root/site/app/views/developers/addon_edit_properties.thtml
blob: 68504411a8301e5d3070407b6d403a554eef0ec0 (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
<?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) 2008
 * the Initial Developer. All Rights Reserved.
 *
 * Contributor(s):
 *      Justin Scott <fligtar@mozilla.com> (Original Author)
 *
 * 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 ***** */
?>
<div id="content">
    <?=$this->renderElement('developers/sidebar', array('addons' => $all_addons, 'extra' => 'developers/editbox'));?>

    <div id="content-main" class="<?=($author_role >= AUTHOR_ROLE_DEV ? 'privs' : 'no-privs')?>">
        <?=$this->renderElement('developers/addonheader', array('title' => "Edit {$addon_name}", 'addon_id' => $addon_id));?>
        <?php
        if (!empty($success)) {
            echo '<div class="notice-success rounded"><span>Your changes have been saved.</span><br />Please note that some changes may take several hours to appear in all areas of the website.</div>';
        }
        if (!empty($errors)) {
            echo '<div class="notice-error rounded"><span>One or more of your changes couldn\'t be saved.</span><br />Please look for the errors below. The rest of your changes were successfully saved.</div>';
        }
        ?>
        <h2>Edit Add-on Properties</h2>
        <?=$this->renderElement('noscript')?>
        <?=$this->renderElement('developers/rolecheck')?>
        <form id="addon-edit-properties-form" action="" method="post" enctype="multipart/form-data">
        <?=$html->hiddenSession();?>
        <?php
            // Retrieve language arrays from bootstrap.
            global $valid_languages, $native_languages;
            foreach (array_keys($valid_languages) as $key) {
                $languages[$key] = $native_languages[$key]['native'];
            }
            ksort($languages);
            
            $this->translationBox = array(
                                'defaultLocale' => $addon['Addon']['defaultlocale'],
                                'languages' => $languages,
                                'table' => 'Addon',
                                'loaded' => false
                            );
        
        // Name
        echo $this->renderElement('developers/translationbox', array(
                    'field' => 'name',
                    'translations' => $translations['name'],
                    'type' => 'textbox',
                    'displayName' => 'Add-on Name',
                    'description' => 'The name of your add-on is displayed everywhere your add-on is listed.'
                ));
        ?>
        
        <div class="field graybox rounded spaced" style="width: 600px;">
            <h4>Default Locale</h4>
            <p>An add-on's default locale is the main locale in which translations must be present. If translations for your add-on's descriptions are unavailable in a user's selected language, they will fall back to this default locale.</p>
            <select name="data[Addon][defaultlocale]">
            <?php
            // Retrieve language arrays from bootstrap.
            global $valid_languages, $native_languages;
            foreach (array_keys($valid_languages) as $key) {
                $languages[$key] = $native_languages[$key]['native'];
            }
            ksort($languages);
            
            foreach ($languages as $lang_key => $lang_name) {
                echo '<option value="'.$lang_key.'"'.($addon['Addon']['defaultlocale'] == $lang_key ? ' selected="selected"' : '').'>'.$lang_name.' ('.$lang_key.')</option>';
            }
            ?>
            </select>
            
        </div>
        
        <div class="field graybox rounded spaced<?=(!empty($errors['icon']) ? ' errors' : '')?>" style="width: 600px;">
            <h4>Add-on Icon</h4>
            <?=(!empty($errors['icon']) ? '<div class="error-message">'.$errors['icon'].'</div>' : '')?>
            <p>The add-on icon is a small image that is displayed next to your add-on's name in browse and search results, display pages, and in the add-on installation dialog. The image will automatically be resized to 32 x 32 pixels. Please use one of the following image types: <?=implode(', ', $this->controller->Developers->imageExtensions)?></p>
            <table width="100%" id="edit-properties-icon-table">
                <tr>
                    <th style="width: 20%;">Current icon:</th>
                    <th>New icon:</th>
                </tr>
                <tr>
                    <td style="text-align: center;">
                    <?php
                    $addonIconPath = $this->controller->Image->getAddonIconURL($addon_id);
                    echo '<img id="addon-icon" src="'.$addonIconPath.'" alt="" />';
                    if (!empty($addon['Addon']['icontype'])) {
                        echo '<div id="delete-icon-area" class="require-privs"><a href="#" onclick="addon_edit_properties.deleteIcon(); return false;">Remove Icon</a></div>';
                        echo '<div id="undelete-icon-area" style="display: none;">Icon will be deleted on save. <a href="#" onclick="addon_edit_properties.undeleteIcon(); return false;">Cancel?</a></div>';
                        echo '<input id="delete-icon" type="hidden" name="data[Addon][deleteIcon]" value="0" />';
                    }
                    ?>
                    </td>
                    <td><input type="file" name="data[Addon][icon]" /></td>
                </tr>
            </table>
        </div>
        
        <?php
        // Homepage
        echo $this->renderElement('developers/translationbox', array(
                    'field' => 'homepage',
                    'translations' => $translations['homepage'],
                    'type' => 'textbox',
                    'displayName' => 'Add-on Homepage',
                    'description' => 'If your add-on has another homepage, enter its address here. Adding other translations is not necessary unless your website is localized into other languages.'
                ));
        
        // Support Email
        echo $this->renderElement('developers/translationbox', array(
                    'field' => 'supportemail',
                    'translations' => $translations['supportemail'],
                    'type' => 'textbox',
                    'displayName' => 'Support Email Address',
                    'description' => 'If you have an email address for support inquiries, enter it here. Adding other translations is not necessary unless you have different email addresses for different languages.'
                ));
        
        // Support URL
        echo $this->renderElement('developers/translationbox', array(
                    'field' => 'supporturl',
                    'translations' => $translations['supporturl'],
                    'type' => 'textbox',
                    'displayName' => 'Support Website',
                    'description' => 'If your add-on has a support website or forum, enter its address here. Adding other translations is not necessary unless your website is localized into other languages.'
                ));
        ?>
        
        <div class="field graybox rounded spaced" style="width: 600px;">
            <h4>Other Settings</h4>
            <h5>View Source Online</h5>
            <p class="smallmargin">The source of your add-on files can be viewed online by any logged in user if you wish.</p>
            <label class="indented"><input type="radio" name="data[Addon][viewsource]" value="1" <?=($addon['Addon']['viewsource'] == 0 ? '' : 'checked="checked"')?>/>&nbsp;Allow online source viewing</label>
            <label class="indented"><input type="radio" name="data[Addon][viewsource]" value="0" <?=($addon['Addon']['viewsource'] == 0 ? 'checked="checked"' : '')?>/>&nbsp;Do not allow online source viewing</label>
            
            <?php if ($addon['Addon']['addontype_id'] != ADDON_SEARCH): ?>
            <h5>Add-on Flags</h5>
            <p class="smallmargin">These flags are used to filter and classify add-ons.</p>
            <label class="indented"><input type="checkbox" name="data[Addon][prerelease]" value="1"  <?=($addon['Addon']['prerelease'] == 1 ? 'checked="checked"' : '')?>/>&nbsp;<?=_('devcp_edit_label_prerelease')?></label>
            <label class="indented"><input type="checkbox" name="data[Addon][sitespecific]" value="1"  <?=($addon['Addon']['sitespecific'] == 1 ? 'checked="checked"' : '')?>/>&nbsp;<?=_('devcp_edit_label_sitespecific')?></label>
            <label class="indented"><input type="checkbox" name="data[Addon][externalsoftware]" value="1" <?=($addon['Addon']['externalsoftware'] == 1 ? 'checked="checked"' : '')?> />&nbsp;<?=_('devcp_edit_label_externalsoftware')?></label>
            <label class="indented"><input type="checkbox" name="data[Addon][binary]" value="1" <?=($addon['Addon']['binary'] == 1 ? 'checked="checked"' : '')?> />&nbsp;This add-on contains binary components</label>
            
            <h5>Add-on GUID</h5>
            <p class="smallmargin">The GUID of your add-on is specified in its install.rdf and uniquely identifies it. You cannot change your GUID once it is listed on <?=SITE_NAME?>.</p>
            <label class="indented"><tt><?=$addon['Addon']['guid']?></tt></label>
            <?php endif; ?>
        </div>
        
        <?php if ($this->controller->SimpleAcl->actionAllowed('Admin', 'ConfigureAnyAddon', $this->controller->Session->read('User'))): ?>
        <div class="field graybox rounded spaced" style="width: 600px;">
            <h4>Admin Settings</h4>
            <h5>Trusted Add-on?</h5>
            <p class="smallmargin">Trusted add-ons can become public without Editor review.</p>
            <label class="indented"><input type="radio" name="data[Addon][trusted]" value="1" <?=($addon['Addon']['trusted'] == 1 ? 'checked="checked"' : '')?>/>&nbsp;Trusted</label>
            <label class="indented"><input type="radio" name="data[Addon][trusted]" value="0" <?=($addon['Addon']['trusted'] == 1 ? '' : 'checked="checked"')?>/>&nbsp;Not Trusted</label>
            <h5>Add-on Type</h5>
            <select name="data[Addon][addontype_id]">
            <?php
            if (!empty($addontypes)) {
                foreach ($addontypes as $addontype_id => $addontype_name) {
                    echo '<option value="'.$addontype_id.'"'.($addon['Addon']['addontype_id'] == $addontype_id ? ' selected="selected"' : '').'>'.$addontype_name.'</option>';
                }
            }
            ?>
            </select>
            
            <h5>Add-on GUID</h5>
            <p class="smallmargin">Only change if you understand all of the consequences.</p>
            <input type="text" name="data[Addon][guid]" value="<?=$addon['Addon']['guid']?>" size="50" />
            
            <?php if (in_array($addon['Addon']['addontype_id'], array(ADDON_DICT, ADDON_LPAPP))): ?>
            <h5><?=_('devcp_edit_label_target_locale')?></h5>
            <p class="smallmargin">Only applicable to dictionaries and language packs, this identifies the language and, optionally, region that this add-on is written for. Examples: en-US, fr, and de-AT</p>
            <label><input type="text" name="data[Addon][target_locale]" value="<?=$html->entities($addon['Addon']['target_locale'])?>" /></label>
            <h5><?=_('devcp_edit_label_locale_disambiguation')?></h5>
            <p class="smallmargin">Only applicable to dictionaries and language packs, this is a short identifier to differentiate this add-on from other similar add-ons (for example, different dialects). This field is not required. Please limit the length of the field to a few short words.</p>
            <label><input type="text" name="data[Addon][locale_disambiguation]" value="<?=$html->entities($addon['Addon']['locale_disambiguation'])?>" /></label>
            <?php endif; ?>
        </div>
        <?php endif; ?>
        
        <div class="action-button-container centered" style="width: 600px;"><a href="#" onclick="addon_edit_properties.save(); return false;" class="action-button rounded">Update Properties</a></div>
        </form>
    </div>
</div>