Version Notes
Fixed a bug causing shareable being forced to Yes on other downloadables.
Download this release
Release Info
Developer | EditionGuard |
Extension | editionguard_drm |
Version | 1.0.2.3 |
Comparing to | |
See all releases |
Code changes from version 1.0.2.2 to 1.0.2.3
app/code/community/Editionguard/Editionguard/etc/config.xml
CHANGED
@@ -14,7 +14,7 @@
|
|
14 |
<config>
|
15 |
<modules>
|
16 |
<Editionguard_Editionguard>
|
17 |
-
<version>1.0.2.
|
18 |
</Editionguard_Editionguard>
|
19 |
</modules>
|
20 |
<frontend>
|
14 |
<config>
|
15 |
<modules>
|
16 |
<Editionguard_Editionguard>
|
17 |
+
<version>1.0.2.3</version>
|
18 |
</Editionguard_Editionguard>
|
19 |
</modules>
|
20 |
<frontend>
|
app/design/adminhtml/default/default/template/editionguard/downloadable/product/edit/downloadable/links.phtml
CHANGED
@@ -1 +1 @@
|
|
1 |
-
<?php
|
2 |
* EditionGuard
|
3 |
*
|
4 |
* This source file is proprietary property of EditionGuard. Any reuse or
|
5 |
* distribution of any part of this file without prior consent is prohibited.
|
6 |
*
|
7 |
* @category EditionGuard
|
8 |
* @package Editionguard_Editionguard
|
9 |
* @copyright Copyright (c) 2012 EditionGuard. All rights Reserved.
|
10 |
*/
|
11 |
* @see Editionguard_Editionguard_Block_Downloadable_Adminhtml_Catalog_Product_Edit_Tab_Downloadable_Links
|
12 |
*/
|
13 |
$this->getEditionguardResource()
|
14 |
$eSelectbox .= '<option value="' . $value->resource . '">' . $value->title . ' ('.$value->resource.')</option>';
|
15 |
<table cellspacing="0" class="form-list">
|
16 |
<tbody>
|
17 |
<tr class="headings">
|
18 |
<td class="label"><label for="name"><?php echo Mage::helper('downloadable')->__('Title') ?></label>
|
19 |
</td>
|
20 |
<td class="value">
|
21 |
<input type="text" class="input-text" id="downloadable_links_title" name="product[links_title]" value="<?php echo $_product->getId() ? $_product->getLinksTitle() : $this->getLinksTitle() ?>" <?php echo ($_product->getStoreId() && $this->getUsedDefault()) ? 'disabled="disabled"' : '' ?> />
|
22 |
</td>
|
23 |
<td class="scope-label"><?php if (!Mage::app()->isSingleStoreMode()): ?>[STORE VIEW]<?php endif; ?></td>
|
24 |
<td class="value use-default">
|
25 |
<?php if ($_product->getStoreId()): ?>
|
26 |
<input id="link_title_default" type="checkbox" name="use_default[]" value="links_title" onclick="toggleValueElements(this, this.parentNode.parentNode)" <?php echo $this->getUsedDefault() ? 'checked="checked"' : '' ?> />
|
27 |
<label class="normal" for="link_title_default"><?php echo Mage::helper('downloadable')->__('Use Default Value'); ?></label>
|
28 |
<?php endif; ?>
|
29 |
</td>
|
30 |
</tr>
|
31 |
</tbody>
|
32 |
</table>
|
33 |
<br />
|
34 |
<table cellspacing="0" class="form-list">
|
35 |
<tbody>
|
36 |
<tr class="headings">
|
37 |
<td class="label"><label for="name"><?php echo Mage::helper('downloadable')->__('Links can be purchased separately') ?></label>
|
38 |
</td>
|
39 |
<td class="value">
|
40 |
<?php echo $this->getPurchasedSeparatelySelect() ?>
|
41 |
</td>
|
42 |
<td class="scope-label"><?php if (!Mage::app()->isSingleStoreMode()): ?>[GLOBAL]<?php endif; ?></td>
|
43 |
<td><small> </small></td>
|
44 |
</tr>
|
45 |
</tbody>
|
46 |
</table>
|
47 |
<br />
|
48 |
<div class="grid">
|
49 |
<div class="hor-scroll">
|
50 |
<table cellspacing="0" class="data border">
|
51 |
<col width="33%" />
|
52 |
<col />
|
53 |
<col />
|
54 |
<col />
|
55 |
<col />
|
56 |
<col width="1" />
|
57 |
<col width="1" />
|
58 |
<col width="1" />
|
59 |
<col width="1" />
|
60 |
<thead>
|
61 |
<tr class="headings">
|
62 |
<th><?php echo Mage::helper('downloadable')->__('Title') ?> <span class="required">*</span></th>
|
63 |
<?php if ($this->getCanReadPrice() !== false) : ?>
|
64 |
<th><?php echo Mage::helper('downloadable')->__('Price') ?></th>
|
65 |
<?php endif; ?>
|
66 |
<th><span class="nobr"><?php echo Mage::helper('downloadable')->__('Max. Downloads') ?></span></th>
|
67 |
<th><?php echo Mage::helper('downloadable')->__('Shareable') ?></th>
|
68 |
<th><?php echo Mage::helper('downloadable')->__('EditionGuard') ?></th>
|
69 |
<th><?php echo Mage::helper('downloadable')->__('Sample') ?></th>
|
70 |
<th><?php echo Mage::helper('downloadable')->__('File') ?></th>
|
71 |
<th><span class="nobr"><?php echo Mage::helper('downloadable')->__('Sort Order') ?></span></th>
|
72 |
<th> </th>
|
73 |
</tr>
|
74 |
</thead>
|
75 |
<tfoot>
|
76 |
<tr>
|
77 |
<td colspan="9" class="a-right"><?php echo $this->getAddButtonHtml() ?> <?php echo $this->getUploadButtonHtml() ?></td>
|
78 |
</tr>
|
79 |
</tfoot>
|
80 |
<tbody id="link_items_body">
|
81 |
</tbody>
|
82 |
</table>
|
83 |
<div><small><?php echo Mage::helper('downloadable')->__('Alphanumeric, dash and underscore characters are recommended for filenames. Improper characters are replaced with \'_\'.') ?></small></div>
|
84 |
</div>
|
85 |
</div>
|
86 |
//<![CDATA[
|
87 |
var linkTemplate = '<tr>' +
|
88 |
'<td>' +
|
89 |
'<input type="hidden" class="__delete__" name="downloadable[link][{{id}}][is_delete]" value="" />' +
|
90 |
'<input type="hidden" name="downloadable[link][{{id}}][link_id]" value="{{link_id}}" />' +
|
91 |
'<input type="text" class="required-entry input-text" name="downloadable[link][{{id}}][title]" value="{{title}}" />' +
|
92 |
'<?php echo $_product->getStoreId() ? '<input type="checkbox" id="downloadable_link_{{id}}_title" name="downloadable[link][{{id}}][use_default_title]" value="1" /><label class="normal" for="downloadable_link_{{id}}_title">Use Default Value</label>' : '' ?>' +
|
93 |
'</td>' +
|
94 |
'<td class="input-price">' +
|
95 |
'<input type="text" id="downloadable_link_{{id}}_price_value" class="input-text validate-number link-prices<?php if ($this->getCanEditPrice() === false) : ?> disabled<?php endif; ?>" name="downloadable[link][{{id}}][price]" value="{{price}}"<?php if ($this->getCanEditPrice() === false) : ?> disabled="disabled"<?php endif; ?> /> ' +
|
96 |
'<label>[<?php echo Mage::app()->getStore($_product->getStoreId())->getBaseCurrencyCode() ?>]</label>' +
|
97 |
<?php if ($_product->getStoreId() && $this->getIsPriceWebsiteScope()) : ?>
|
98 |
'<br /><input type="checkbox" id="downloadable_link_{{id}}_price" name="downloadable[link][{{id}}][use_default_price]" value="1"<?php if ($this->getCanEditPrice() === false) : ?> disabled="disabled"<?php endif; ?> /> <label for="downloadable_link_{{id}}_price">Use Default Value</label>' +
|
99 |
<?php endif; ?>
|
100 |
'</td>' +
|
101 |
'<input type="hidden" id="downloadable_link_{{id}}_price_value" class="link-prices" name="downloadable[link][{{id}}][price]" value="0" />' +
|
102 |
<?php if ($_product->getStoreId() && $this->getIsPriceWebsiteScope()) : ?>
|
103 |
'<input type="hidden" id="downloadable_link_{{id}}_price" name="downloadable[link][{{id}}][use_default_price]" value="1" />' +
|
104 |
<?php endif; ?>
|
105 |
'<td><input type="text" id="downloadable_link_{{id}}_downloads" name="downloadable[link][{{id}}][number_of_downloads]" class="input-text downloads" value="{{number_of_downloads}}" />' +
|
106 |
'<p><input type="checkbox" class="checkbox" id="downloadable_link_{{id}}_is_unlimited" name="downloadable[link][{{id}}][is_unlimited]" value="1" {{is_unlimited}} /> <label for="downloadable_link_{{id}}_is_unlimited">Unlimited</label></p></td>' +
|
107 |
'<td class="a-center">' +
|
108 |
'<select id="downloadable_link _{{id}}_shareable" name="downloadable[link][{{id}}][is_shareable]">' +
|
109 |
'<option value="1">Yes</option>' +
|
110 |
'<option value="0">No</option>' +
|
111 |
'<option value="2" selected="selected">Use config</option>' +
|
112 |
'</select>' +
|
113 |
'</td>' +
|
114 |
'<td class="a-center">' +
|
115 |
'<input type="hidden" id="downloadable_link _{{id}}_old_use_editionguard" class="old_use_editionguard" name="downloadable[link][{{id}}][old_use_editionguard]" value="{{use_editionguard}}" />' +
|
116 |
'<select id="downloadable_link _{{id}}_editionguard" class="use_editionguard" name="downloadable[link][{{id}}][use_editionguard]">' +
|
117 |
'<option value="1" selected="selected">Yes</option>' +
|
118 |
'<option value="0">No</option>' +
|
119 |
'<option value="2">Use config</option>' +
|
120 |
'</select>' +
|
121 |
'</td>' +
|
122 |
'<td>' +
|
123 |
'<div class="files">' +
|
124 |
'<div class="row">' +
|
125 |
'<label for="downloadable_link_{{id}}_sample_file_type"><input type="radio" class="radio" id="downloadable_link_{{id}}_sample_file_type" name="downloadable[link][{{id}}][sample][type]" value="file"{{sample_file_checked}} checked="checked"/> File:</label>' +
|
126 |
'<input type="hidden" id="downloadable_link_{{id}}_sample_file_save" name="downloadable[link][{{id}}][sample][file]" value="{{sample_file_save}}" />' +
|
127 |
'<div id="downloadable_link_{{id}}_sample_file" class="uploader">' +
|
128 |
'<div id="downloadable_link_{{id}}_sample_file-old" class="file-row-info"></div>' +
|
129 |
'<div id="downloadable_link_{{id}}_sample_file-new" class="file-row-info"></div>' +
|
130 |
'<div class="buttons">' +
|
131 |
'<div id="downloadable_link_{{id}}_sample_file-install-flash" style="display:none">' +
|
132 |
'<?php echo $this->jsQuoteEscape(Mage::helper('media')->__('This content requires last version of Adobe Flash Player. <a href="%s">Get Flash</a>', 'http://www.adobe.com/go/getflash/')) ?>' +
|
133 |
'</div>' +
|
134 |
'</div>' +
|
135 |
'<div class="clear"></div>' +
|
136 |
'</div>' +
|
137 |
'</div>' +
|
138 |
'<div class="row">' +
|
139 |
'<label for="downloadable_link_{{id}}_sample_url_type"><input type="radio" class="radio" id="downloadable_link_{{id}}_sample_url_type" name="downloadable[link][{{id}}][sample][type]" value="url"{{sample_url_checked}} /> URL:</label><input type="text" class="input-text" name="downloadable[link][{{id}}][sample][url]" value="{{sample_url}}" /> ' +
|
140 |
'</div>' +
|
141 |
'<div>' +
|
142 |
'<span id="downloadable_link_{{id}}_sample_container"></span>' +
|
143 |
'</div>' +
|
144 |
'</div>' +
|
145 |
'</td>' +
|
146 |
'<td>' +
|
147 |
'<div class="files">' +
|
148 |
'<div class="row">' +
|
149 |
'<label for="downloadable_link_{{id}}_file_type"><input type="radio" class="radio validate-one-required-by-name" id="downloadable_link_{{id}}_file_type" name="downloadable[link][{{id}}][type]" value="file"{{file_checked}} checked="checked"/> File:</label>' +
|
150 |
'<input type="hidden" class="validate-downloadable-file" id="downloadable_link_{{id}}_file_save" name="downloadable[link][{{id}}][file]" value="{{file_save}}" />' +
|
151 |
'<div id="downloadable_link_{{id}}_file" class="uploader">' +
|
152 |
'<div id="downloadable_link_{{id}}_file-old" class="file-row-info"></div>' +
|
153 |
'<div id="downloadable_link_{{id}}_file-new" class="file-row-info new-file"></div>' +
|
154 |
'<div class="buttons">' +
|
155 |
'<div id="downloadable_link_{{id}}_file-install-flash" style="display:none">' +
|
156 |
'<?php echo $this->jsQuoteEscape(Mage::helper('media')->__('This content requires last version of Adobe Flash Player. <a href="%s">Get Flash</a>', 'http://www.adobe.com/go/getflash/')) ?>' +
|
157 |
'</div>' +
|
158 |
'</div></div>' +
|
159 |
'<div class="clear"></div>' +
|
160 |
'<div class="urlwrap" style="{{url_display}}"><label for="downloadable_link_{{id}}_url_type"><input type="radio" class="radio validate-one-required-by-name file-radio" id="downloadable_link_{{id}}_url_type" name="downloadable[link][{{id}}][type]" value="url"{{url_checked}} /> URL:</label><input type="text" class="validate-downloadable-url input-text" name="downloadable[link][{{id}}][link_url]" value="{{link_url}}" /></div>' +
|
161 |
'<div class="ebookwrap" style="{{ebook_display}}"><label for="downloadable_link_{{id}}_ebook_type"><input type="radio" class="radio validate-one-required-by-name ebook-radio" id="downloadable_link_{{id}}_url_type" name="downloadable[link][{{id}}][type]" value="ebook" {{ebook_checked}} /> eBook: </label><?php echo $eSelectbox ?></div></div>' +
|
162 |
'' +
|
163 |
'<div>' +
|
164 |
'<span id="downloadable_link_{{id}}_link_container"></span>' +
|
165 |
'</div>' +
|
166 |
'</div>' +
|
167 |
'</td>' +
|
168 |
'<td class="a-center"><input type="text" name="downloadable[link][{{id}}][sort_order]" value="{{sort_order}}" class="input-text sort" /></td>' +
|
169 |
'<td>' +
|
170 |
'<button id="downloadable_link_{{id}}_delete_button" type="button" class="scalable delete icon-btn delete-link-item"><span><?php echo Mage::helper('downloadable')->__('Delete'); ?></span></button>' +
|
171 |
'</td>' +
|
172 |
'</tr>';
|
173 |
var linkItems = {
|
174 |
tbody: $('link_items_body'),
|
175 |
templateSyntax: /(^|.|\r|\n)({{(\w+)}})/,
|
176 |
templateText: linkTemplate,
|
177 |
itemCount: 0,
|
178 |
add: function(data) {
|
179 |
alertAlreadyDisplayed = false;
|
180 |
this.template = new Template(this.templateText, this.templateSyntax);
|
181 |
if (!data.link_id) {
|
182 |
data = {};
|
183 |
data.link_id = 0;
|
184 |
data.link_type = 'ebook';
|
185 |
data.sample_type = 'none';
|
186 |
data.use_editionguard = 1;
|
187 |
data.number_of_downloads = '<?php echo $this->getConfigMaxDownloads() ?>';
|
188 |
}
|
189 |
data.id = this.itemCount;
|
190 |
if (data.link_type == 'url') {
|
191 |
data.url_checked = ' checked="checked"';
|
192 |
data.ebook_display = 'display:none';
|
193 |
} else if (data.link_type == 'file') {
|
194 |
data.file_checked = ' checked="checked"';
|
195 |
data.ebook_display = 'display:none';
|
196 |
}
|
197 |
else if (data.link_type == 'ebook') {
|
198 |
data.ebook_checked = ' checked="checked"';
|
199 |
data.url_display = 'display:none';
|
200 |
}
|
201 |
if (data.sample_type == 'url') {
|
202 |
data.sample_url_checked = ' checked="checked"';
|
203 |
} else if (data.sample_type == 'file') {
|
204 |
data.sample_file_checked = ' checked="checked"';
|
205 |
}
|
206 |
Element.insert(this.tbody, {'bottom': this.template.evaluate(data)});
|
207 |
scopeTitle = $('downloadable_link_' + data.id + '_title');
|
208 |
if (scopeTitle) {
|
209 |
Event.observe(scopeTitle, 'click', function(event) {
|
210 |
scopeElm = $(Event.findElement(event, 'input'));
|
211 |
titleField = scopeElm.up(0).down('input[type="text"]');
|
212 |
if (scopeElm.checked == true) {
|
213 |
titleField.disabled = true;
|
214 |
} else {
|
215 |
titleField.disabled = false;
|
216 |
}
|
217 |
});
|
218 |
}
|
219 |
if (!data.store_title && scopeTitle) {
|
220 |
scopeTitle.up(0).down('input[type="text"]').disabled = true;
|
221 |
scopeTitle.checked = true;
|
222 |
}
|
223 |
scopePrice = $('downloadable_link_' + data.id + '_price');
|
224 |
if (scopePrice) {
|
225 |
Event.observe(scopePrice, 'click', function(event) {
|
226 |
scopeElm = $(Event.findElement(event, 'input'));
|
227 |
priceField = scopeElm.up(0).down('input[type="text"]');
|
228 |
if (scopeElm.checked == true) {
|
229 |
priceField.disabled = true;
|
230 |
} else {
|
231 |
priceField.disabled = false;
|
232 |
}
|
233 |
});
|
234 |
}
|
235 |
if (!data.website_price && scopePrice) {
|
236 |
scopePrice.up(0).down('input[type="text"]').disabled = true;
|
237 |
scopePrice.checked = true;
|
238 |
}
|
239 |
downloadsElm = $('downloadable_link_' + data.id + '_downloads');
|
240 |
isUnlimitedElm = $('downloadable_link_' + data.id + '_is_unlimited');
|
241 |
if (data.is_unlimited) {
|
242 |
downloadsElm.disabled = true;
|
243 |
}
|
244 |
Event.observe(isUnlimitedElm, 'click', function(event) {
|
245 |
elm = Event.element(event);
|
246 |
elm.up('td').down('input[type="text"].downloads').disabled = elm.checked;
|
247 |
});
|
248 |
if (data.is_shareable) {
|
249 |
options = $('downloadable_link _' + data.id + '_shareable').options;
|
250 |
for (var i = 0; i < options.length; i++) {
|
251 |
//Made changes so that we can make Edition Guard to Yes bydefault
|
252 |
if (options[i].value == '1') {
|
253 |
options[i].selected = true;
|
254 |
}
|
255 |
}
|
256 |
}
|
257 |
if (data.editionguard_resource) {
|
258 |
options = $('downloadable_link_' + data.id + '_editionguard_resource').options;
|
259 |
for (var i = 0; i < options.length; i++) {
|
260 |
if (options[i].value == data.editionguard_resource) {
|
261 |
options[i].selected = true;
|
262 |
}
|
263 |
}
|
264 |
}
|
265 |
if (data.use_editionguard) {
|
266 |
options = $('downloadable_link _' + data.id + '_editionguard').options;
|
267 |
for (var i = 0; i < options.length; i++) {
|
268 |
//Made changes so that we can make Edition Guard to Yes bydefault
|
269 |
//if (options[i].value == data.use_editionguard) {
|
270 |
if (options[i].value == data.use_editionguard) {
|
271 |
options[i].selected = true;
|
272 |
}
|
273 |
}
|
274 |
}
|
275 |
sampleUrl = $('downloadable_link_' + data.id + '_sample_url_type');
|
276 |
linkUrl = $('downloadable_link_' + data.id + '_url_type');
|
277 |
if (!data.file_save) {
|
278 |
data.file_save = [];
|
279 |
}
|
280 |
if (!data.sample_file_save) {
|
281 |
data.sample_file_save = [];
|
282 |
}
|
283 |
// link sample file
|
284 |
new Downloadable.FileUploader(
|
285 |
'linkssample',
|
286 |
'linkssample_' + data.id,
|
287 |
sampleUrl.up('td'),
|
288 |
'downloadable[link][' + data.id + '][sample]',
|
289 |
data.sample_file_save,
|
290 |
'downloadable_link_' + data.id + '_sample_file',
|
291 |
);
|
292 |
// link file
|
293 |
new Downloadable.FileUploader(
|
294 |
'links',
|
295 |
'links_' + data.id,
|
296 |
linkUrl.up('td'),
|
297 |
'downloadable[link][' + data.id + ']',
|
298 |
data.file_save,
|
299 |
'downloadable_link_' + data.id + '_file',
|
300 |
);
|
301 |
linkFile = $('downloadable_link_' + data.id + '_file_type');
|
302 |
linkFile.advaiceContainer = 'downloadable_link_' + data.id + '_link_container';
|
303 |
linkUrl.advaiceContainer = 'downloadable_link_' + data.id + '_link_container';
|
304 |
$('downloadable_link_' + data.id + '_file_save').advaiceContainer = 'downloadable_link_' + data.id + '_link_container';
|
305 |
sampleFile = $('downloadable_link_' + data.id + '_sample_file_type');
|
306 |
this.itemCount++;
|
307 |
this.togglePriceFields();
|
308 |
this.bindRemoveButtons();
|
309 |
this.bindEditionguardSelect();
|
310 |
},
|
311 |
remove: function(event) {
|
312 |
var element = $(Event.findElement(event, 'tr'));
|
313 |
var use_editionguard = element.down('select.use_editionguard').value != 0;
|
314 |
var old_use_editionguard = element.down('input[type="hidden"].old_use_editionguard').value != 0;
|
315 |
if (!old_use_editionguard || !use_editionguard || confirm("This file is managed by Editionguard. If you delete it, previous customers will no longer be able to download their file. This cannot be undone.\n\nAre you sure?"))
|
316 |
{
|
317 |
alertAlreadyDisplayed = false;
|
318 |
if (element) {
|
319 |
element.down('input[type="hidden"].__delete__').value = '1';
|
320 |
Element.select(element, 'div.flex').each(function(elm) {
|
321 |
elm.remove();
|
322 |
});
|
323 |
element.addClassName('no-display');
|
324 |
element.addClassName('ignore-validate');
|
325 |
element.hide();
|
326 |
}
|
327 |
}
|
328 |
},
|
329 |
editionguardSelect: function(event) {
|
330 |
var element = $(Event.findElement(event, 'tr'));
|
331 |
var use_editionguard = element.down('select.use_editionguard').value == 1;
|
332 |
var old_use_editionguard = element.down('input[type="hidden"].old_use_editionguard').value != 0;
|
333 |
if (old_use_editionguard && !use_editionguard && !confirm("This file is managed by Editionguard. If you disable it, previous customers will no longer be able to download their file.\n\nAre you sure?"))
|
334 |
{
|
335 |
element.down('select.use_editionguard').value = element.down('input[type="hidden"].old_use_editionguard').value;
|
336 |
element.down('div.ebookwrap').show();
|
337 |
element.down('div.urlwrap').hide();
|
338 |
return false;
|
339 |
}
|
340 |
else {
|
341 |
element.down('div.ebookwrap').hide();
|
342 |
element.down('div.urlwrap').show();
|
343 |
element.down('input[type="radio"][value="url"].file-radio').checked = true;
|
344 |
}
|
345 |
if (element.down('select.use_editionguard').value == 1) {
|
346 |
element.down('div.ebookwrap').show();
|
347 |
element.down('div.urlwrap').hide();
|
348 |
element.down('input[type="radio"][value="ebook"].ebook-radio').checked = true;
|
349 |
}
|
350 |
if (element.down('select.use_editionguard').value != 1) {
|
351 |
element.down('select.editionguardebook').selectedIndex = 0;
|
352 |
}
|
353 |
return true;
|
354 |
},
|
355 |
bindRemoveButtons: function() {
|
356 |
var buttons = $$('tbody#link_items_body .delete-link-item');
|
357 |
for (var i = 0; i < buttons.length; i++) {
|
358 |
if (!$(buttons[i]).binded && !$(buttons[i]).hasClassName('disabled')) {
|
359 |
$(buttons[i]).binded = true;
|
360 |
Event.observe(buttons[i], 'click', this.remove.bind(this));
|
361 |
}
|
362 |
}
|
363 |
},
|
364 |
bindEditionguardSelect: function() {
|
365 |
var selects = $$('tbody#link_items_body select.use_editionguard');
|
366 |
for (var i = 0; i < selects.length; i++) {
|
367 |
if (!$(selects[i]).binded && !$(selects[i]).hasClassName('disabled')) {
|
368 |
$(selects[i]).binded = true;
|
369 |
Event.observe(selects[i], 'change', this.editionguardSelect.bind(this));
|
370 |
}
|
371 |
}
|
372 |
},
|
373 |
togglePriceFields: function() {
|
374 |
var toogleTo = $('downloadable_link_purchase_type').value;
|
375 |
var disableFlag = true;
|
376 |
if (toogleTo == '1') {
|
377 |
disableFlag = false;
|
378 |
}
|
379 |
$$('.link-prices[type="text"]').each(function(elm) {
|
380 |
var flag = disableFlag;
|
381 |
if (elm.hasClassName('disabled')) {
|
382 |
flag = true;
|
383 |
}
|
384 |
elm.disabled = flag;
|
385 |
});
|
386 |
}
|
387 |
}
|
388 |
linkItems.bindRemoveButtons();
|
389 |
linkItems.bindEditionguardSelect();
|
390 |
if ($('downloadable_link_purchase_type')) {
|
391 |
Event.observe('downloadable_link_purchase_type', 'change', linkItems.togglePriceFields.bind());
|
392 |
}
|
393 |
if ($('add_link_item')) {
|
394 |
Event.observe('add_link_item', 'click', linkItems.add.bind(linkItems));
|
395 |
}
|
396 |
linkItems.add(<?php echo $item->toJson() ?>);
|
397 |
Validation.addAllThese([
|
398 |
['validate-downloadable-link-sample-file', 'Please specify File.', function(v, element) {
|
399 |
fileSaveElm = element.up('div').next('input[type="hidden"]');
|
400 |
if (element.checked && (fileSaveElm.value == '' || fileSaveElm.value == '[]')) {
|
401 |
return false;
|
402 |
}
|
403 |
return true;
|
404 |
}]
|
405 |
]);
|
406 |
Validation.addAllThese([
|
407 |
['validate-downloadable-link-sample-url', 'Please specify Sample URL.', function(v, element) {
|
408 |
if (element.checked && element.up('p').down('input[type="text"]').value == '') {
|
409 |
return false;
|
410 |
}
|
411 |
return true;
|
412 |
}]
|
413 |
]);
|
414 |
Validation.addAllThese([
|
415 |
['validate-downloadable-ebook', 'Please Select an eBook', function(v, element) {
|
416 |
linkType = element.up(0).down('input[value="ebook"]');
|
417 |
if (linkType.checked && v == '') {
|
418 |
return false;
|
419 |
}
|
420 |
return true;
|
421 |
}]
|
422 |
]);
|
423 |
//]]>
|
|
|
424 |
* EditionGuard
|
425 |
*
|
426 |
* This source file is proprietary property of EditionGuard. Any reuse or
|
427 |
* distribution of any part of this file without prior consent is prohibited.
|
428 |
*
|
429 |
* @category EditionGuard
|
430 |
* @package Editionguard_Editionguard
|
431 |
* @copyright Copyright (c) 2012 EditionGuard. All rights Reserved.
|
432 |
*/
|
433 |
* @see Editionguard_Editionguard_Block_Downloadable_Adminhtml_Catalog_Product_Edit_Tab_Downloadable_Links
|
434 |
*/
|
435 |
$this->getEditionguardResource()
|
436 |
$eSelectbox .= '<option value="' . $value->resource . '">' . $value->title . ' ('.$value->resource.')</option>';
|
437 |
<table cellspacing="0" class="form-list">
|
438 |
<tbody>
|
439 |
<tr class="headings">
|
440 |
<td class="label"><label for="name"><?php echo Mage::helper('downloadable')->__('Title') ?></label>
|
441 |
</td>
|
442 |
<td class="value">
|
443 |
<input type="text" class="input-text" id="downloadable_links_title" name="product[links_title]" value="<?php echo $_product->getId() ? $_product->getLinksTitle() : $this->getLinksTitle() ?>" <?php echo ($_product->getStoreId() && $this->getUsedDefault()) ? 'disabled="disabled"' : '' ?> />
|
444 |
</td>
|
445 |
<td class="scope-label"><?php if (!Mage::app()->isSingleStoreMode()): ?>[STORE VIEW]<?php endif; ?></td>
|
446 |
<td class="value use-default">
|
447 |
<?php if ($_product->getStoreId()): ?>
|
448 |
<input id="link_title_default" type="checkbox" name="use_default[]" value="links_title" onclick="toggleValueElements(this, this.parentNode.parentNode)" <?php echo $this->getUsedDefault() ? 'checked="checked"' : '' ?> />
|
449 |
<label class="normal" for="link_title_default"><?php echo Mage::helper('downloadable')->__('Use Default Value'); ?></label>
|
450 |
<?php endif; ?>
|
451 |
</td>
|
452 |
</tr>
|
453 |
</tbody>
|
454 |
</table>
|
455 |
<br />
|
456 |
<table cellspacing="0" class="form-list">
|
457 |
<tbody>
|
458 |
<tr class="headings">
|
459 |
<td class="label"><label for="name"><?php echo Mage::helper('downloadable')->__('Links can be purchased separately') ?></label>
|
460 |
</td>
|
461 |
<td class="value">
|
462 |
<?php echo $this->getPurchasedSeparatelySelect() ?>
|
463 |
</td>
|
464 |
<td class="scope-label"><?php if (!Mage::app()->isSingleStoreMode()): ?>[GLOBAL]<?php endif; ?></td>
|
465 |
<td><small> </small></td>
|
466 |
</tr>
|
467 |
</tbody>
|
468 |
</table>
|
469 |
<br />
|
470 |
<div class="grid">
|
471 |
<div class="hor-scroll">
|
472 |
<table cellspacing="0" class="data border">
|
473 |
<col width="33%" />
|
474 |
<col />
|
475 |
<col />
|
476 |
<col />
|
477 |
<col />
|
478 |
<col width="1" />
|
479 |
<col width="1" />
|
480 |
<col width="1" />
|
481 |
<col width="1" />
|
482 |
<thead>
|
483 |
<tr class="headings">
|
484 |
<th><?php echo Mage::helper('downloadable')->__('Title') ?> <span class="required">*</span></th>
|
485 |
<?php if ($this->getCanReadPrice() !== false) : ?>
|
486 |
<th><?php echo Mage::helper('downloadable')->__('Price') ?></th>
|
487 |
<?php endif; ?>
|
488 |
<th><span class="nobr"><?php echo Mage::helper('downloadable')->__('Max. Downloads') ?></span></th>
|
489 |
<th><?php echo Mage::helper('downloadable')->__('Shareable') ?></th>
|
490 |
<th><?php echo Mage::helper('downloadable')->__('EditionGuard') ?></th>
|
491 |
<th><?php echo Mage::helper('downloadable')->__('Sample') ?></th>
|
492 |
<th><?php echo Mage::helper('downloadable')->__('File') ?></th>
|
493 |
<th><span class="nobr"><?php echo Mage::helper('downloadable')->__('Sort Order') ?></span></th>
|
494 |
<th> </th>
|
495 |
</tr>
|
496 |
</thead>
|
497 |
<tfoot>
|
498 |
<tr>
|
499 |
<td colspan="9" class="a-right"><?php echo $this->getAddButtonHtml() ?> <?php echo $this->getUploadButtonHtml() ?></td>
|
500 |
</tr>
|
501 |
</tfoot>
|
502 |
<tbody id="link_items_body">
|
503 |
</tbody>
|
504 |
</table>
|
505 |
<div><small><?php echo Mage::helper('downloadable')->__('Alphanumeric, dash and underscore characters are recommended for filenames. Improper characters are replaced with \'_\'.') ?></small></div>
|
506 |
</div>
|
507 |
</div>
|
508 |
//<![CDATA[
|
509 |
var linkTemplate = '<tr>' +
|
510 |
'<td>' +
|
511 |
'<input type="hidden" class="__delete__" name="downloadable[link][{{id}}][is_delete]" value="" />' +
|
512 |
'<input type="hidden" name="downloadable[link][{{id}}][link_id]" value="{{link_id}}" />' +
|
513 |
'<input type="text" class="required-entry input-text" name="downloadable[link][{{id}}][title]" value="{{title}}" />' +
|
514 |
'<?php echo $_product->getStoreId() ? '<input type="checkbox" id="downloadable_link_{{id}}_title" name="downloadable[link][{{id}}][use_default_title]" value="1" /><label class="normal" for="downloadable_link_{{id}}_title">Use Default Value</label>' : '' ?>' +
|
515 |
'</td>' +
|
516 |
'<td class="input-price">' +
|
517 |
'<input type="text" id="downloadable_link_{{id}}_price_value" class="input-text validate-number link-prices<?php if ($this->getCanEditPrice() === false) : ?> disabled<?php endif; ?>" name="downloadable[link][{{id}}][price]" value="{{price}}"<?php if ($this->getCanEditPrice() === false) : ?> disabled="disabled"<?php endif; ?> /> ' +
|
518 |
'<label>[<?php echo Mage::app()->getStore($_product->getStoreId())->getBaseCurrencyCode() ?>]</label>' +
|
519 |
<?php if ($_product->getStoreId() && $this->getIsPriceWebsiteScope()) : ?>
|
520 |
'<br /><input type="checkbox" id="downloadable_link_{{id}}_price" name="downloadable[link][{{id}}][use_default_price]" value="1"<?php if ($this->getCanEditPrice() === false) : ?> disabled="disabled"<?php endif; ?> /> <label for="downloadable_link_{{id}}_price">Use Default Value</label>' +
|
521 |
<?php endif; ?>
|
522 |
'</td>' +
|
523 |
'<input type="hidden" id="downloadable_link_{{id}}_price_value" class="link-prices" name="downloadable[link][{{id}}][price]" value="0" />' +
|
524 |
<?php if ($_product->getStoreId() && $this->getIsPriceWebsiteScope()) : ?>
|
525 |
'<input type="hidden" id="downloadable_link_{{id}}_price" name="downloadable[link][{{id}}][use_default_price]" value="1" />' +
|
526 |
<?php endif; ?>
|
527 |
'<td><input type="text" id="downloadable_link_{{id}}_downloads" name="downloadable[link][{{id}}][number_of_downloads]" class="input-text downloads" value="{{number_of_downloads}}" />' +
|
528 |
'<p><input type="checkbox" class="checkbox" id="downloadable_link_{{id}}_is_unlimited" name="downloadable[link][{{id}}][is_unlimited]" value="1" {{is_unlimited}} /> <label for="downloadable_link_{{id}}_is_unlimited">Unlimited</label></p></td>' +
|
529 |
'<td class="a-center">' +
|
530 |
'<select id="downloadable_link _{{id}}_shareable" name="downloadable[link][{{id}}][is_shareable]">' +
|
531 |
'<option value="1">Yes</option>' +
|
532 |
'<option value="0">No</option>' +
|
533 |
'<option value="2">Use config</option>' +
|
534 |
'</select>' +
|
535 |
'</td>' +
|
536 |
'<td class="a-center">' +
|
537 |
'<input type="hidden" id="downloadable_link _{{id}}_old_use_editionguard" class="old_use_editionguard" name="downloadable[link][{{id}}][old_use_editionguard]" value="{{use_editionguard}}" />' +
|
538 |
'<select id="downloadable_link _{{id}}_editionguard" class="use_editionguard" name="downloadable[link][{{id}}][use_editionguard]">' +
|
539 |
'<option value="1" selected="selected">Yes</option>' +
|
540 |
'<option value="0">No</option>' +
|
541 |
'<option value="2">Use config</option>' +
|
542 |
'</select>' +
|
543 |
'</td>' +
|
544 |
'<td>' +
|
545 |
'<div class="files">' +
|
546 |
'<div class="row">' +
|
547 |
'<label for="downloadable_link_{{id}}_sample_file_type"><input type="radio" class="radio" id="downloadable_link_{{id}}_sample_file_type" name="downloadable[link][{{id}}][sample][type]" value="file"{{sample_file_checked}} checked="checked"/> File:</label>' +
|
548 |
'<input type="hidden" id="downloadable_link_{{id}}_sample_file_save" name="downloadable[link][{{id}}][sample][file]" value="{{sample_file_save}}" />' +
|
549 |
'<div id="downloadable_link_{{id}}_sample_file" class="uploader">' +
|
550 |
'<div id="downloadable_link_{{id}}_sample_file-old" class="file-row-info"></div>' +
|
551 |
'<div id="downloadable_link_{{id}}_sample_file-new" class="file-row-info"></div>' +
|
552 |
'<div class="buttons">' +
|
553 |
'<div id="downloadable_link_{{id}}_sample_file-install-flash" style="display:none">' +
|
554 |
'<?php echo $this->jsQuoteEscape(Mage::helper('media')->__('This content requires last version of Adobe Flash Player. <a href="%s">Get Flash</a>', 'http://www.adobe.com/go/getflash/')) ?>' +
|
555 |
'</div>' +
|
556 |
'</div>' +
|
557 |
'<div class="clear"></div>' +
|
558 |
'</div>' +
|
559 |
'</div>' +
|
560 |
'<div class="row">' +
|
561 |
'<label for="downloadable_link_{{id}}_sample_url_type"><input type="radio" class="radio" id="downloadable_link_{{id}}_sample_url_type" name="downloadable[link][{{id}}][sample][type]" value="url"{{sample_url_checked}} /> URL:</label><input type="text" class="input-text" name="downloadable[link][{{id}}][sample][url]" value="{{sample_url}}" /> ' +
|
562 |
'</div>' +
|
563 |
'<div>' +
|
564 |
'<span id="downloadable_link_{{id}}_sample_container"></span>' +
|
565 |
'</div>' +
|
566 |
'</div>' +
|
567 |
'</td>' +
|
568 |
'<td>' +
|
569 |
'<div class="files">' +
|
570 |
'<div class="row">' +
|
571 |
'<label for="downloadable_link_{{id}}_file_type"><input type="radio" class="radio validate-one-required-by-name" id="downloadable_link_{{id}}_file_type" name="downloadable[link][{{id}}][type]" value="file"{{file_checked}} checked="checked"/> File:</label>' +
|
572 |
'<input type="hidden" class="validate-downloadable-file" id="downloadable_link_{{id}}_file_save" name="downloadable[link][{{id}}][file]" value="{{file_save}}" />' +
|
573 |
'<div id="downloadable_link_{{id}}_file" class="uploader">' +
|
574 |
'<div id="downloadable_link_{{id}}_file-old" class="file-row-info"></div>' +
|
575 |
'<div id="downloadable_link_{{id}}_file-new" class="file-row-info new-file"></div>' +
|
576 |
'<div class="buttons">' +
|
577 |
'<div id="downloadable_link_{{id}}_file-install-flash" style="display:none">' +
|
578 |
'<?php echo $this->jsQuoteEscape(Mage::helper('media')->__('This content requires last version of Adobe Flash Player. <a href="%s">Get Flash</a>', 'http://www.adobe.com/go/getflash/')) ?>' +
|
579 |
'</div>' +
|
580 |
'</div></div>' +
|
581 |
'<div class="clear"></div>' +
|
582 |
'<div class="urlwrap" style="{{url_display}}"><label for="downloadable_link_{{id}}_url_type"><input type="radio" class="radio validate-one-required-by-name file-radio" id="downloadable_link_{{id}}_url_type" name="downloadable[link][{{id}}][type]" value="url"{{url_checked}} /> URL:</label><input type="text" class="validate-downloadable-url input-text" name="downloadable[link][{{id}}][link_url]" value="{{link_url}}" /></div>' +
|
583 |
'<div class="ebookwrap" style="{{ebook_display}}"><label for="downloadable_link_{{id}}_ebook_type"><input type="radio" class="radio validate-one-required-by-name ebook-radio" id="downloadable_link_{{id}}_url_type" name="downloadable[link][{{id}}][type]" value="ebook" {{ebook_checked}} /> eBook: </label><?php echo $eSelectbox ?></div></div>' +
|
584 |
'' +
|
585 |
'<div>' +
|
586 |
'<span id="downloadable_link_{{id}}_link_container"></span>' +
|
587 |
'</div>' +
|
588 |
'</div>' +
|
589 |
'</td>' +
|
590 |
'<td class="a-center"><input type="text" name="downloadable[link][{{id}}][sort_order]" value="{{sort_order}}" class="input-text sort" /></td>' +
|
591 |
'<td>' +
|
592 |
'<button id="downloadable_link_{{id}}_delete_button" type="button" class="scalable delete icon-btn delete-link-item"><span><?php echo Mage::helper('downloadable')->__('Delete'); ?></span></button>' +
|
593 |
'</td>' +
|
594 |
'</tr>';
|
595 |
var linkItems = {
|
596 |
tbody: $('link_items_body'),
|
597 |
templateSyntax: /(^|.|\r|\n)({{(\w+)}})/,
|
598 |
templateText: linkTemplate,
|
599 |
itemCount: 0,
|
600 |
add: function(data) {
|
601 |
alertAlreadyDisplayed = false;
|
602 |
this.template = new Template(this.templateText, this.templateSyntax);
|
603 |
if (!data.link_id) {
|
604 |
data = {};
|
605 |
data.link_id = 0;
|
606 |
data.link_type = 'ebook';
|
607 |
data.sample_type = 'none';
|
608 |
data.use_editionguard = 1;
|
609 |
data.number_of_downloads = '<?php echo $this->getConfigMaxDownloads() ?>';
|
610 |
}
|
611 |
data.id = this.itemCount;
|
612 |
if (data.link_type == 'url') {
|
613 |
data.url_checked = ' checked="checked"';
|
614 |
data.ebook_display = 'display:none';
|
615 |
} else if (data.link_type == 'file') {
|
616 |
data.file_checked = ' checked="checked"';
|
617 |
data.ebook_display = 'display:none';
|
618 |
}
|
619 |
else if (data.link_type == 'ebook') {
|
620 |
data.ebook_checked = ' checked="checked"';
|
621 |
data.url_display = 'display:none';
|
622 |
}
|
623 |
if (data.sample_type == 'url') {
|
624 |
data.sample_url_checked = ' checked="checked"';
|
625 |
} else if (data.sample_type == 'file') {
|
626 |
data.sample_file_checked = ' checked="checked"';
|
627 |
}
|
628 |
Element.insert(this.tbody, {'bottom': this.template.evaluate(data)});
|
629 |
scopeTitle = $('downloadable_link_' + data.id + '_title');
|
630 |
if (scopeTitle) {
|
631 |
Event.observe(scopeTitle, 'click', function(event) {
|
632 |
scopeElm = $(Event.findElement(event, 'input'));
|
633 |
titleField = scopeElm.up(0).down('input[type="text"]');
|
634 |
if (scopeElm.checked == true) {
|
635 |
titleField.disabled = true;
|
636 |
} else {
|
637 |
titleField.disabled = false;
|
638 |
}
|
639 |
});
|
640 |
}
|
641 |
if (!data.store_title && scopeTitle) {
|
642 |
scopeTitle.up(0).down('input[type="text"]').disabled = true;
|
643 |
scopeTitle.checked = true;
|
644 |
}
|
645 |
scopePrice = $('downloadable_link_' + data.id + '_price');
|
646 |
if (scopePrice) {
|
647 |
Event.observe(scopePrice, 'click', function(event) {
|
648 |
scopeElm = $(Event.findElement(event, 'input'));
|
649 |
priceField = scopeElm.up(0).down('input[type="text"]');
|
650 |
if (scopeElm.checked == true) {
|
651 |
priceField.disabled = true;
|
652 |
} else {
|
653 |
priceField.disabled = false;
|
654 |
}
|
655 |
});
|
656 |
}
|
657 |
if (!data.website_price && scopePrice) {
|
658 |
scopePrice.up(0).down('input[type="text"]').disabled = true;
|
659 |
scopePrice.checked = true;
|
660 |
}
|
661 |
downloadsElm = $('downloadable_link_' + data.id + '_downloads');
|
662 |
isUnlimitedElm = $('downloadable_link_' + data.id + '_is_unlimited');
|
663 |
if (data.is_unlimited) {
|
664 |
downloadsElm.disabled = true;
|
665 |
}
|
666 |
Event.observe(isUnlimitedElm, 'click', function(event) {
|
667 |
elm = Event.element(event);
|
668 |
elm.up('td').down('input[type="text"].downloads').disabled = elm.checked;
|
669 |
});
|
670 |
|
671 |
options = $('downloadable_link _' + data.id + '_shareable').options;
|
672 |
for (var i = 0; i < options.length; i++) {
|
673 |
//Made changes so that we can make Edition Guard to Yes bydefault
|
674 |
if (options[i].value == data.is_shareable) {
|
675 |
options[i].selected = true;
|
676 |
}
|
677 |
}
|
678 |
|
679 |
if (data.editionguard_resource) {
|
680 |
options = $('downloadable_link_' + data.id + '_editionguard_resource').options;
|
681 |
for (var i = 0; i < options.length; i++) {
|
682 |
if (options[i].value == data.editionguard_resource) {
|
683 |
options[i].selected = true;
|
684 |
}
|
685 |
}
|
686 |
}
|
687 |
if (data.use_editionguard) {
|
688 |
options = $('downloadable_link _' + data.id + '_editionguard').options;
|
689 |
for (var i = 0; i < options.length; i++) {
|
690 |
//Made changes so that we can make Edition Guard to Yes bydefault
|
691 |
//if (options[i].value == data.use_editionguard) {
|
692 |
if (options[i].value == data.use_editionguard) {
|
693 |
options[i].selected = true;
|
694 |
}
|
695 |
}
|
696 |
}
|
697 |
sampleUrl = $('downloadable_link_' + data.id + '_sample_url_type');
|
698 |
linkUrl = $('downloadable_link_' + data.id + '_url_type');
|
699 |
if (!data.file_save) {
|
700 |
data.file_save = [];
|
701 |
}
|
702 |
if (!data.sample_file_save) {
|
703 |
data.sample_file_save = [];
|
704 |
}
|
705 |
// link sample file
|
706 |
new Downloadable.FileUploader(
|
707 |
'linkssample',
|
708 |
'linkssample_' + data.id,
|
709 |
sampleUrl.up('td'),
|
710 |
'downloadable[link][' + data.id + '][sample]',
|
711 |
data.sample_file_save,
|
712 |
'downloadable_link_' + data.id + '_sample_file',
|
713 |
);
|
714 |
// link file
|
715 |
new Downloadable.FileUploader(
|
716 |
'links',
|
717 |
'links_' + data.id,
|
718 |
linkUrl.up('td'),
|
719 |
'downloadable[link][' + data.id + ']',
|
720 |
data.file_save,
|
721 |
'downloadable_link_' + data.id + '_file',
|
722 |
);
|
723 |
linkFile = $('downloadable_link_' + data.id + '_file_type');
|
724 |
linkFile.advaiceContainer = 'downloadable_link_' + data.id + '_link_container';
|
725 |
linkUrl.advaiceContainer = 'downloadable_link_' + data.id + '_link_container';
|
726 |
$('downloadable_link_' + data.id + '_file_save').advaiceContainer = 'downloadable_link_' + data.id + '_link_container';
|
727 |
sampleFile = $('downloadable_link_' + data.id + '_sample_file_type');
|
728 |
this.itemCount++;
|
729 |
this.togglePriceFields();
|
730 |
this.bindRemoveButtons();
|
731 |
this.bindEditionguardSelect();
|
732 |
},
|
733 |
remove: function(event) {
|
734 |
var element = $(Event.findElement(event, 'tr'));
|
735 |
var use_editionguard = element.down('select.use_editionguard').value != 0;
|
736 |
var old_use_editionguard = element.down('input[type="hidden"].old_use_editionguard').value != 0;
|
737 |
if (!old_use_editionguard || !use_editionguard || confirm("This file is managed by Editionguard. If you delete it, previous customers will no longer be able to download their file. This cannot be undone.\n\nAre you sure?"))
|
738 |
{
|
739 |
alertAlreadyDisplayed = false;
|
740 |
if (element) {
|
741 |
element.down('input[type="hidden"].__delete__').value = '1';
|
742 |
Element.select(element, 'div.flex').each(function(elm) {
|
743 |
elm.remove();
|
744 |
});
|
745 |
element.addClassName('no-display');
|
746 |
element.addClassName('ignore-validate');
|
747 |
element.hide();
|
748 |
}
|
749 |
}
|
750 |
},
|
751 |
editionguardSelect: function(event) {
|
752 |
var element = $(Event.findElement(event, 'tr'));
|
753 |
var use_editionguard = element.down('select.use_editionguard').value == 1;
|
754 |
var old_use_editionguard = element.down('input[type="hidden"].old_use_editionguard').value != 0;
|
755 |
if (old_use_editionguard && !use_editionguard && !confirm("This file is managed by Editionguard. If you disable it, previous customers will no longer be able to download their file.\n\nAre you sure?"))
|
756 |
{
|
757 |
element.down('select.use_editionguard').value = element.down('input[type="hidden"].old_use_editionguard').value;
|
758 |
element.down('div.ebookwrap').show();
|
759 |
element.down('div.urlwrap').hide();
|
760 |
return false;
|
761 |
}
|
762 |
else {
|
763 |
element.down('div.ebookwrap').hide();
|
764 |
element.down('div.urlwrap').show();
|
765 |
element.down('input[type="radio"][value="url"].file-radio').checked = true;
|
766 |
}
|
767 |
if (element.down('select.use_editionguard').value == 1) {
|
768 |
element.down('div.ebookwrap').show();
|
769 |
element.down('div.urlwrap').hide();
|
770 |
element.down('input[type="radio"][value="ebook"].ebook-radio').checked = true;
|
771 |
}
|
772 |
if (element.down('select.use_editionguard').value != 1) {
|
773 |
element.down('select.editionguardebook').selectedIndex = 0;
|
774 |
}
|
775 |
return true;
|
776 |
},
|
777 |
bindRemoveButtons: function() {
|
778 |
var buttons = $$('tbody#link_items_body .delete-link-item');
|
779 |
for (var i = 0; i < buttons.length; i++) {
|
780 |
if (!$(buttons[i]).binded && !$(buttons[i]).hasClassName('disabled')) {
|
781 |
$(buttons[i]).binded = true;
|
782 |
Event.observe(buttons[i], 'click', this.remove.bind(this));
|
783 |
}
|
784 |
}
|
785 |
},
|
786 |
bindEditionguardSelect: function() {
|
787 |
var selects = $$('tbody#link_items_body select.use_editionguard');
|
788 |
for (var i = 0; i < selects.length; i++) {
|
789 |
if (!$(selects[i]).binded && !$(selects[i]).hasClassName('disabled')) {
|
790 |
$(selects[i]).binded = true;
|
791 |
Event.observe(selects[i], 'change', this.editionguardSelect.bind(this));
|
792 |
}
|
793 |
}
|
794 |
},
|
795 |
togglePriceFields: function() {
|
796 |
var toogleTo = $('downloadable_link_purchase_type').value;
|
797 |
var disableFlag = true;
|
798 |
if (toogleTo == '1') {
|
799 |
disableFlag = false;
|
800 |
}
|
801 |
$$('.link-prices[type="text"]').each(function(elm) {
|
802 |
var flag = disableFlag;
|
803 |
if (elm.hasClassName('disabled')) {
|
804 |
flag = true;
|
805 |
}
|
806 |
elm.disabled = flag;
|
807 |
});
|
808 |
}
|
809 |
}
|
810 |
linkItems.bindRemoveButtons();
|
811 |
linkItems.bindEditionguardSelect();
|
812 |
if ($('downloadable_link_purchase_type')) {
|
813 |
Event.observe('downloadable_link_purchase_type', 'change', linkItems.togglePriceFields.bind());
|
814 |
}
|
815 |
if ($('add_link_item')) {
|
816 |
Event.observe('add_link_item', 'click', linkItems.add.bind(linkItems));
|
817 |
}
|
818 |
linkItems.add(<?php echo $item->toJson() ?>);
|
819 |
Validation.addAllThese([
|
820 |
['validate-downloadable-link-sample-file', 'Please specify File.', function(v, element) {
|
821 |
fileSaveElm = element.up('div').next('input[type="hidden"]');
|
822 |
if (element.checked && (fileSaveElm.value == '' || fileSaveElm.value == '[]')) {
|
823 |
return false;
|
824 |
}
|
825 |
return true;
|
826 |
}]
|
827 |
]);
|
828 |
Validation.addAllThese([
|
829 |
['validate-downloadable-link-sample-url', 'Please specify Sample URL.', function(v, element) {
|
830 |
if (element.checked && element.up('p').down('input[type="text"]').value == '') {
|
831 |
return false;
|
832 |
}
|
833 |
return true;
|
834 |
}]
|
835 |
]);
|
836 |
Validation.addAllThese([
|
837 |
['validate-downloadable-ebook', 'Please Select an eBook', function(v, element) {
|
838 |
linkType = element.up(0).down('input[value="ebook"]');
|
839 |
if (linkType.checked && v == '') {
|
840 |
return false;
|
841 |
}
|
842 |
return true;
|
843 |
}]
|
844 |
]);
|
845 |
//]]>
|
|
|
1 |
* EditionGuard
|
2 |
*
|
3 |
* This source file is proprietary property of EditionGuard. Any reuse or
|
4 |
* distribution of any part of this file without prior consent is prohibited.
|
5 |
*
|
6 |
* @category EditionGuard
|
7 |
* @package Editionguard_Editionguard
|
8 |
* @copyright Copyright (c) 2012 EditionGuard. All rights Reserved.
|
9 |
*/
|
10 |
* @see Editionguard_Editionguard_Block_Downloadable_Adminhtml_Catalog_Product_Edit_Tab_Downloadable_Links
|
11 |
*/
|
12 |
$this->getEditionguardResource()
|
13 |
$eSelectbox .= '<option value="' . $value->resource . '">' . $value->title . ' ('.$value->resource.')</option>';
|
14 |
<table cellspacing="0" class="form-list">
|
15 |
<tbody>
|
16 |
<tr class="headings">
|
17 |
<td class="label"><label for="name"><?php echo Mage::helper('downloadable')->__('Title') ?></label>
|
18 |
</td>
|
19 |
<td class="value">
|
20 |
<input type="text" class="input-text" id="downloadable_links_title" name="product[links_title]" value="<?php echo $_product->getId() ? $_product->getLinksTitle() : $this->getLinksTitle() ?>" <?php echo ($_product->getStoreId() && $this->getUsedDefault()) ? 'disabled="disabled"' : '' ?> />
|
21 |
</td>
|
22 |
<td class="scope-label"><?php if (!Mage::app()->isSingleStoreMode()): ?>[STORE VIEW]<?php endif; ?></td>
|
23 |
<td class="value use-default">
|
24 |
<?php if ($_product->getStoreId()): ?>
|
25 |
<input id="link_title_default" type="checkbox" name="use_default[]" value="links_title" onclick="toggleValueElements(this, this.parentNode.parentNode)" <?php echo $this->getUsedDefault() ? 'checked="checked"' : '' ?> />
|
26 |
<label class="normal" for="link_title_default"><?php echo Mage::helper('downloadable')->__('Use Default Value'); ?></label>
|
27 |
<?php endif; ?>
|
28 |
</td>
|
29 |
</tr>
|
30 |
</tbody>
|
31 |
</table>
|
32 |
<br />
|
33 |
<table cellspacing="0" class="form-list">
|
34 |
<tbody>
|
35 |
<tr class="headings">
|
36 |
<td class="label"><label for="name"><?php echo Mage::helper('downloadable')->__('Links can be purchased separately') ?></label>
|
37 |
</td>
|
38 |
<td class="value">
|
39 |
<?php echo $this->getPurchasedSeparatelySelect() ?>
|
40 |
</td>
|
41 |
<td class="scope-label"><?php if (!Mage::app()->isSingleStoreMode()): ?>[GLOBAL]<?php endif; ?></td>
|
42 |
<td><small> </small></td>
|
43 |
</tr>
|
44 |
</tbody>
|
45 |
</table>
|
46 |
<br />
|
47 |
<div class="grid">
|
48 |
<div class="hor-scroll">
|
49 |
<table cellspacing="0" class="data border">
|
50 |
<col width="33%" />
|
51 |
<col />
|
52 |
<col />
|
53 |
<col />
|
54 |
<col />
|
55 |
<col width="1" />
|
56 |
<col width="1" />
|
57 |
<col width="1" />
|
58 |
<col width="1" />
|
59 |
<thead>
|
60 |
<tr class="headings">
|
61 |
<th><?php echo Mage::helper('downloadable')->__('Title') ?> <span class="required">*</span></th>
|
62 |
<?php if ($this->getCanReadPrice() !== false) : ?>
|
63 |
<th><?php echo Mage::helper('downloadable')->__('Price') ?></th>
|
64 |
<?php endif; ?>
|
65 |
<th><span class="nobr"><?php echo Mage::helper('downloadable')->__('Max. Downloads') ?></span></th>
|
66 |
<th><?php echo Mage::helper('downloadable')->__('Shareable') ?></th>
|
67 |
<th><?php echo Mage::helper('downloadable')->__('EditionGuard') ?></th>
|
68 |
<th><?php echo Mage::helper('downloadable')->__('Sample') ?></th>
|
69 |
<th><?php echo Mage::helper('downloadable')->__('File') ?></th>
|
70 |
<th><span class="nobr"><?php echo Mage::helper('downloadable')->__('Sort Order') ?></span></th>
|
71 |
<th> </th>
|
72 |
</tr>
|
73 |
</thead>
|
74 |
<tfoot>
|
75 |
<tr>
|
76 |
<td colspan="9" class="a-right"><?php echo $this->getAddButtonHtml() ?> <?php echo $this->getUploadButtonHtml() ?></td>
|
77 |
</tr>
|
78 |
</tfoot>
|
79 |
<tbody id="link_items_body">
|
80 |
</tbody>
|
81 |
</table>
|
82 |
<div><small><?php echo Mage::helper('downloadable')->__('Alphanumeric, dash and underscore characters are recommended for filenames. Improper characters are replaced with \'_\'.') ?></small></div>
|
83 |
</div>
|
84 |
</div>
|
85 |
//<![CDATA[
|
86 |
var linkTemplate = '<tr>' +
|
87 |
'<td>' +
|
88 |
'<input type="hidden" class="__delete__" name="downloadable[link][{{id}}][is_delete]" value="" />' +
|
89 |
'<input type="hidden" name="downloadable[link][{{id}}][link_id]" value="{{link_id}}" />' +
|
90 |
'<input type="text" class="required-entry input-text" name="downloadable[link][{{id}}][title]" value="{{title}}" />' +
|
91 |
'<?php echo $_product->getStoreId() ? '<input type="checkbox" id="downloadable_link_{{id}}_title" name="downloadable[link][{{id}}][use_default_title]" value="1" /><label class="normal" for="downloadable_link_{{id}}_title">Use Default Value</label>' : '' ?>' +
|
92 |
'</td>' +
|
93 |
'<td class="input-price">' +
|
94 |
'<input type="text" id="downloadable_link_{{id}}_price_value" class="input-text validate-number link-prices<?php if ($this->getCanEditPrice() === false) : ?> disabled<?php endif; ?>" name="downloadable[link][{{id}}][price]" value="{{price}}"<?php if ($this->getCanEditPrice() === false) : ?> disabled="disabled"<?php endif; ?> /> ' +
|
95 |
'<label>[<?php echo Mage::app()->getStore($_product->getStoreId())->getBaseCurrencyCode() ?>]</label>' +
|
96 |
<?php if ($_product->getStoreId() && $this->getIsPriceWebsiteScope()) : ?>
|
97 |
'<br /><input type="checkbox" id="downloadable_link_{{id}}_price" name="downloadable[link][{{id}}][use_default_price]" value="1"<?php if ($this->getCanEditPrice() === false) : ?> disabled="disabled"<?php endif; ?> /> <label for="downloadable_link_{{id}}_price">Use Default Value</label>' +
|
98 |
<?php endif; ?>
|
99 |
'</td>' +
|
100 |
'<input type="hidden" id="downloadable_link_{{id}}_price_value" class="link-prices" name="downloadable[link][{{id}}][price]" value="0" />' +
|
101 |
<?php if ($_product->getStoreId() && $this->getIsPriceWebsiteScope()) : ?>
|
102 |
'<input type="hidden" id="downloadable_link_{{id}}_price" name="downloadable[link][{{id}}][use_default_price]" value="1" />' +
|
103 |
<?php endif; ?>
|
104 |
'<td><input type="text" id="downloadable_link_{{id}}_downloads" name="downloadable[link][{{id}}][number_of_downloads]" class="input-text downloads" value="{{number_of_downloads}}" />' +
|
105 |
'<p><input type="checkbox" class="checkbox" id="downloadable_link_{{id}}_is_unlimited" name="downloadable[link][{{id}}][is_unlimited]" value="1" {{is_unlimited}} /> <label for="downloadable_link_{{id}}_is_unlimited">Unlimited</label></p></td>' +
|
106 |
'<td class="a-center">' +
|
107 |
'<select id="downloadable_link _{{id}}_shareable" name="downloadable[link][{{id}}][is_shareable]">' +
|
108 |
'<option value="1">Yes</option>' +
|
109 |
'<option value="0">No</option>' +
|
110 |
'<option value="2" selected="selected">Use config</option>' +
|
111 |
'</select>' +
|
112 |
'</td>' +
|
113 |
'<td class="a-center">' +
|
114 |
'<input type="hidden" id="downloadable_link _{{id}}_old_use_editionguard" class="old_use_editionguard" name="downloadable[link][{{id}}][old_use_editionguard]" value="{{use_editionguard}}" />' +
|
115 |
'<select id="downloadable_link _{{id}}_editionguard" class="use_editionguard" name="downloadable[link][{{id}}][use_editionguard]">' +
|
116 |
'<option value="1" selected="selected">Yes</option>' +
|
117 |
'<option value="0">No</option>' +
|
118 |
'<option value="2">Use config</option>' +
|
119 |
'</select>' +
|
120 |
'</td>' +
|
121 |
'<td>' +
|
122 |
'<div class="files">' +
|
123 |
'<div class="row">' +
|
124 |
'<label for="downloadable_link_{{id}}_sample_file_type"><input type="radio" class="radio" id="downloadable_link_{{id}}_sample_file_type" name="downloadable[link][{{id}}][sample][type]" value="file"{{sample_file_checked}} checked="checked"/> File:</label>' +
|
125 |
'<input type="hidden" id="downloadable_link_{{id}}_sample_file_save" name="downloadable[link][{{id}}][sample][file]" value="{{sample_file_save}}" />' +
|
126 |
'<div id="downloadable_link_{{id}}_sample_file" class="uploader">' +
|
127 |
'<div id="downloadable_link_{{id}}_sample_file-old" class="file-row-info"></div>' +
|
128 |
'<div id="downloadable_link_{{id}}_sample_file-new" class="file-row-info"></div>' +
|
129 |
'<div class="buttons">' +
|
130 |
'<div id="downloadable_link_{{id}}_sample_file-install-flash" style="display:none">' +
|
131 |
'<?php echo $this->jsQuoteEscape(Mage::helper('media')->__('This content requires last version of Adobe Flash Player. <a href="%s">Get Flash</a>', 'http://www.adobe.com/go/getflash/')) ?>' +
|
132 |
'</div>' +
|
133 |
'</div>' +
|
134 |
'<div class="clear"></div>' +
|
135 |
'</div>' +
|
136 |
'</div>' +
|
137 |
'<div class="row">' +
|
138 |
'<label for="downloadable_link_{{id}}_sample_url_type"><input type="radio" class="radio" id="downloadable_link_{{id}}_sample_url_type" name="downloadable[link][{{id}}][sample][type]" value="url"{{sample_url_checked}} /> URL:</label><input type="text" class="input-text" name="downloadable[link][{{id}}][sample][url]" value="{{sample_url}}" /> ' +
|
139 |
'</div>' +
|
140 |
'<div>' +
|
141 |
'<span id="downloadable_link_{{id}}_sample_container"></span>' +
|
142 |
'</div>' +
|
143 |
'</div>' +
|
144 |
'</td>' +
|
145 |
'<td>' +
|
146 |
'<div class="files">' +
|
147 |
'<div class="row">' +
|
148 |
'<label for="downloadable_link_{{id}}_file_type"><input type="radio" class="radio validate-one-required-by-name" id="downloadable_link_{{id}}_file_type" name="downloadable[link][{{id}}][type]" value="file"{{file_checked}} checked="checked"/> File:</label>' +
|
149 |
'<input type="hidden" class="validate-downloadable-file" id="downloadable_link_{{id}}_file_save" name="downloadable[link][{{id}}][file]" value="{{file_save}}" />' +
|
150 |
'<div id="downloadable_link_{{id}}_file" class="uploader">' +
|
151 |
'<div id="downloadable_link_{{id}}_file-old" class="file-row-info"></div>' +
|
152 |
'<div id="downloadable_link_{{id}}_file-new" class="file-row-info new-file"></div>' +
|
153 |
'<div class="buttons">' +
|
154 |
'<div id="downloadable_link_{{id}}_file-install-flash" style="display:none">' +
|
155 |
'<?php echo $this->jsQuoteEscape(Mage::helper('media')->__('This content requires last version of Adobe Flash Player. <a href="%s">Get Flash</a>', 'http://www.adobe.com/go/getflash/')) ?>' +
|
156 |
'</div>' +
|
157 |
'</div></div>' +
|
158 |
'<div class="clear"></div>' +
|
159 |
'<div class="urlwrap" style="{{url_display}}"><label for="downloadable_link_{{id}}_url_type"><input type="radio" class="radio validate-one-required-by-name file-radio" id="downloadable_link_{{id}}_url_type" name="downloadable[link][{{id}}][type]" value="url"{{url_checked}} /> URL:</label><input type="text" class="validate-downloadable-url input-text" name="downloadable[link][{{id}}][link_url]" value="{{link_url}}" /></div>' +
|
160 |
'<div class="ebookwrap" style="{{ebook_display}}"><label for="downloadable_link_{{id}}_ebook_type"><input type="radio" class="radio validate-one-required-by-name ebook-radio" id="downloadable_link_{{id}}_url_type" name="downloadable[link][{{id}}][type]" value="ebook" {{ebook_checked}} /> eBook: </label><?php echo $eSelectbox ?></div></div>' +
|
161 |
'' +
|
162 |
'<div>' +
|
163 |
'<span id="downloadable_link_{{id}}_link_container"></span>' +
|
164 |
'</div>' +
|
165 |
'</div>' +
|
166 |
'</td>' +
|
167 |
'<td class="a-center"><input type="text" name="downloadable[link][{{id}}][sort_order]" value="{{sort_order}}" class="input-text sort" /></td>' +
|
168 |
'<td>' +
|
169 |
'<button id="downloadable_link_{{id}}_delete_button" type="button" class="scalable delete icon-btn delete-link-item"><span><?php echo Mage::helper('downloadable')->__('Delete'); ?></span></button>' +
|
170 |
'</td>' +
|
171 |
'</tr>';
|
172 |
var linkItems = {
|
173 |
tbody: $('link_items_body'),
|
174 |
templateSyntax: /(^|.|\r|\n)({{(\w+)}})/,
|
175 |
templateText: linkTemplate,
|
176 |
itemCount: 0,
|
177 |
add: function(data) {
|
178 |
alertAlreadyDisplayed = false;
|
179 |
this.template = new Template(this.templateText, this.templateSyntax);
|
180 |
if (!data.link_id) {
|
181 |
data = {};
|
182 |
data.link_id = 0;
|
183 |
data.link_type = 'ebook';
|
184 |
data.sample_type = 'none';
|
185 |
data.use_editionguard = 1;
|
186 |
data.number_of_downloads = '<?php echo $this->getConfigMaxDownloads() ?>';
|
187 |
}
|
188 |
data.id = this.itemCount;
|
189 |
if (data.link_type == 'url') {
|
190 |
data.url_checked = ' checked="checked"';
|
191 |
data.ebook_display = 'display:none';
|
192 |
} else if (data.link_type == 'file') {
|
193 |
data.file_checked = ' checked="checked"';
|
194 |
data.ebook_display = 'display:none';
|
195 |
}
|
196 |
else if (data.link_type == 'ebook') {
|
197 |
data.ebook_checked = ' checked="checked"';
|
198 |
data.url_display = 'display:none';
|
199 |
}
|
200 |
if (data.sample_type == 'url') {
|
201 |
data.sample_url_checked = ' checked="checked"';
|
202 |
} else if (data.sample_type == 'file') {
|
203 |
data.sample_file_checked = ' checked="checked"';
|
204 |
}
|
205 |
Element.insert(this.tbody, {'bottom': this.template.evaluate(data)});
|
206 |
scopeTitle = $('downloadable_link_' + data.id + '_title');
|
207 |
if (scopeTitle) {
|
208 |
Event.observe(scopeTitle, 'click', function(event) {
|
209 |
scopeElm = $(Event.findElement(event, 'input'));
|
210 |
titleField = scopeElm.up(0).down('input[type="text"]');
|
211 |
if (scopeElm.checked == true) {
|
212 |
titleField.disabled = true;
|
213 |
} else {
|
214 |
titleField.disabled = false;
|
215 |
}
|
216 |
});
|
217 |
}
|
218 |
if (!data.store_title && scopeTitle) {
|
219 |
scopeTitle.up(0).down('input[type="text"]').disabled = true;
|
220 |
scopeTitle.checked = true;
|
221 |
}
|
222 |
scopePrice = $('downloadable_link_' + data.id + '_price');
|
223 |
if (scopePrice) {
|
224 |
Event.observe(scopePrice, 'click', function(event) {
|
225 |
scopeElm = $(Event.findElement(event, 'input'));
|
226 |
priceField = scopeElm.up(0).down('input[type="text"]');
|
227 |
if (scopeElm.checked == true) {
|
228 |
priceField.disabled = true;
|
229 |
} else {
|
230 |
priceField.disabled = false;
|
231 |
}
|
232 |
});
|
233 |
}
|
234 |
if (!data.website_price && scopePrice) {
|
235 |
scopePrice.up(0).down('input[type="text"]').disabled = true;
|
236 |
scopePrice.checked = true;
|
237 |
}
|
238 |
downloadsElm = $('downloadable_link_' + data.id + '_downloads');
|
239 |
isUnlimitedElm = $('downloadable_link_' + data.id + '_is_unlimited');
|
240 |
if (data.is_unlimited) {
|
241 |
downloadsElm.disabled = true;
|
242 |
}
|
243 |
Event.observe(isUnlimitedElm, 'click', function(event) {
|
244 |
elm = Event.element(event);
|
245 |
elm.up('td').down('input[type="text"].downloads').disabled = elm.checked;
|
246 |
});
|
247 |
if (data.is_shareable) {
|
248 |
options = $('downloadable_link _' + data.id + '_shareable').options;
|
249 |
for (var i = 0; i < options.length; i++) {
|
250 |
//Made changes so that we can make Edition Guard to Yes bydefault
|
251 |
if (options[i].value == '1') {
|
252 |
options[i].selected = true;
|
253 |
}
|
254 |
}
|
255 |
}
|
256 |
if (data.editionguard_resource) {
|
257 |
options = $('downloadable_link_' + data.id + '_editionguard_resource').options;
|
258 |
for (var i = 0; i < options.length; i++) {
|
259 |
if (options[i].value == data.editionguard_resource) {
|
260 |
options[i].selected = true;
|
261 |
}
|
262 |
}
|
263 |
}
|
264 |
if (data.use_editionguard) {
|
265 |
options = $('downloadable_link _' + data.id + '_editionguard').options;
|
266 |
for (var i = 0; i < options.length; i++) {
|
267 |
//Made changes so that we can make Edition Guard to Yes bydefault
|
268 |
//if (options[i].value == data.use_editionguard) {
|
269 |
if (options[i].value == data.use_editionguard) {
|
270 |
options[i].selected = true;
|
271 |
}
|
272 |
}
|
273 |
}
|
274 |
sampleUrl = $('downloadable_link_' + data.id + '_sample_url_type');
|
275 |
linkUrl = $('downloadable_link_' + data.id + '_url_type');
|
276 |
if (!data.file_save) {
|
277 |
data.file_save = [];
|
278 |
}
|
279 |
if (!data.sample_file_save) {
|
280 |
data.sample_file_save = [];
|
281 |
}
|
282 |
// link sample file
|
283 |
new Downloadable.FileUploader(
|
284 |
'linkssample',
|
285 |
'linkssample_' + data.id,
|
286 |
sampleUrl.up('td'),
|
287 |
'downloadable[link][' + data.id + '][sample]',
|
288 |
data.sample_file_save,
|
289 |
'downloadable_link_' + data.id + '_sample_file',
|
290 |
);
|
291 |
// link file
|
292 |
new Downloadable.FileUploader(
|
293 |
'links',
|
294 |
'links_' + data.id,
|
295 |
linkUrl.up('td'),
|
296 |
'downloadable[link][' + data.id + ']',
|
297 |
data.file_save,
|
298 |
'downloadable_link_' + data.id + '_file',
|
299 |
);
|
300 |
linkFile = $('downloadable_link_' + data.id + '_file_type');
|
301 |
linkFile.advaiceContainer = 'downloadable_link_' + data.id + '_link_container';
|
302 |
linkUrl.advaiceContainer = 'downloadable_link_' + data.id + '_link_container';
|
303 |
$('downloadable_link_' + data.id + '_file_save').advaiceContainer = 'downloadable_link_' + data.id + '_link_container';
|
304 |
sampleFile = $('downloadable_link_' + data.id + '_sample_file_type');
|
305 |
this.itemCount++;
|
306 |
this.togglePriceFields();
|
307 |
this.bindRemoveButtons();
|
308 |
this.bindEditionguardSelect();
|
309 |
},
|
310 |
remove: function(event) {
|
311 |
var element = $(Event.findElement(event, 'tr'));
|
312 |
var use_editionguard = element.down('select.use_editionguard').value != 0;
|
313 |
var old_use_editionguard = element.down('input[type="hidden"].old_use_editionguard').value != 0;
|
314 |
if (!old_use_editionguard || !use_editionguard || confirm("This file is managed by Editionguard. If you delete it, previous customers will no longer be able to download their file. This cannot be undone.\n\nAre you sure?"))
|
315 |
{
|
316 |
alertAlreadyDisplayed = false;
|
317 |
if (element) {
|
318 |
element.down('input[type="hidden"].__delete__').value = '1';
|
319 |
Element.select(element, 'div.flex').each(function(elm) {
|
320 |
elm.remove();
|
321 |
});
|
322 |
element.addClassName('no-display');
|
323 |
element.addClassName('ignore-validate');
|
324 |
element.hide();
|
325 |
}
|
326 |
}
|
327 |
},
|
328 |
editionguardSelect: function(event) {
|
329 |
var element = $(Event.findElement(event, 'tr'));
|
330 |
var use_editionguard = element.down('select.use_editionguard').value == 1;
|
331 |
var old_use_editionguard = element.down('input[type="hidden"].old_use_editionguard').value != 0;
|
332 |
if (old_use_editionguard && !use_editionguard && !confirm("This file is managed by Editionguard. If you disable it, previous customers will no longer be able to download their file.\n\nAre you sure?"))
|
333 |
{
|
334 |
element.down('select.use_editionguard').value = element.down('input[type="hidden"].old_use_editionguard').value;
|
335 |
element.down('div.ebookwrap').show();
|
336 |
element.down('div.urlwrap').hide();
|
337 |
return false;
|
338 |
}
|
339 |
else {
|
340 |
element.down('div.ebookwrap').hide();
|
341 |
element.down('div.urlwrap').show();
|
342 |
element.down('input[type="radio"][value="url"].file-radio').checked = true;
|
343 |
}
|
344 |
if (element.down('select.use_editionguard').value == 1) {
|
345 |
element.down('div.ebookwrap').show();
|
346 |
element.down('div.urlwrap').hide();
|
347 |
element.down('input[type="radio"][value="ebook"].ebook-radio').checked = true;
|
348 |
}
|
349 |
if (element.down('select.use_editionguard').value != 1) {
|
350 |
element.down('select.editionguardebook').selectedIndex = 0;
|
351 |
}
|
352 |
return true;
|
353 |
},
|
354 |
bindRemoveButtons: function() {
|
355 |
var buttons = $$('tbody#link_items_body .delete-link-item');
|
356 |
for (var i = 0; i < buttons.length; i++) {
|
357 |
if (!$(buttons[i]).binded && !$(buttons[i]).hasClassName('disabled')) {
|
358 |
$(buttons[i]).binded = true;
|
359 |
Event.observe(buttons[i], 'click', this.remove.bind(this));
|
360 |
}
|
361 |
}
|
362 |
},
|
363 |
bindEditionguardSelect: function() {
|
364 |
var selects = $$('tbody#link_items_body select.use_editionguard');
|
365 |
for (var i = 0; i < selects.length; i++) {
|
366 |
if (!$(selects[i]).binded && !$(selects[i]).hasClassName('disabled')) {
|
367 |
$(selects[i]).binded = true;
|
368 |
Event.observe(selects[i], 'change', this.editionguardSelect.bind(this));
|
369 |
}
|
370 |
}
|
371 |
},
|
372 |
togglePriceFields: function() {
|
373 |
var toogleTo = $('downloadable_link_purchase_type').value;
|
374 |
var disableFlag = true;
|
375 |
if (toogleTo == '1') {
|
376 |
disableFlag = false;
|
377 |
}
|
378 |
$$('.link-prices[type="text"]').each(function(elm) {
|
379 |
var flag = disableFlag;
|
380 |
if (elm.hasClassName('disabled')) {
|
381 |
flag = true;
|
382 |
}
|
383 |
elm.disabled = flag;
|
384 |
});
|
385 |
}
|
386 |
}
|
387 |
linkItems.bindRemoveButtons();
|
388 |
linkItems.bindEditionguardSelect();
|
389 |
if ($('downloadable_link_purchase_type')) {
|
390 |
Event.observe('downloadable_link_purchase_type', 'change', linkItems.togglePriceFields.bind());
|
391 |
}
|
392 |
if ($('add_link_item')) {
|
393 |
Event.observe('add_link_item', 'click', linkItems.add.bind(linkItems));
|
394 |
}
|
395 |
linkItems.add(<?php echo $item->toJson() ?>);
|
396 |
Validation.addAllThese([
|
397 |
['validate-downloadable-link-sample-file', 'Please specify File.', function(v, element) {
|
398 |
fileSaveElm = element.up('div').next('input[type="hidden"]');
|
399 |
if (element.checked && (fileSaveElm.value == '' || fileSaveElm.value == '[]')) {
|
400 |
return false;
|
401 |
}
|
402 |
return true;
|
403 |
}]
|
404 |
]);
|
405 |
Validation.addAllThese([
|
406 |
['validate-downloadable-link-sample-url', 'Please specify Sample URL.', function(v, element) {
|
407 |
if (element.checked && element.up('p').down('input[type="text"]').value == '') {
|
408 |
return false;
|
409 |
}
|
410 |
return true;
|
411 |
}]
|
412 |
]);
|
413 |
Validation.addAllThese([
|
414 |
['validate-downloadable-ebook', 'Please Select an eBook', function(v, element) {
|
415 |
linkType = element.up(0).down('input[value="ebook"]');
|
416 |
if (linkType.checked && v == '') {
|
417 |
return false;
|
418 |
}
|
419 |
return true;
|
420 |
}]
|
421 |
]);
|
422 |
//]]>
|
423 |
+
<?php
|
424 |
* EditionGuard
|
425 |
*
|
426 |
* This source file is proprietary property of EditionGuard. Any reuse or
|
427 |
* distribution of any part of this file without prior consent is prohibited.
|
428 |
*
|
429 |
* @category EditionGuard
|
430 |
* @package Editionguard_Editionguard
|
431 |
* @copyright Copyright (c) 2012 EditionGuard. All rights Reserved.
|
432 |
*/
|
433 |
* @see Editionguard_Editionguard_Block_Downloadable_Adminhtml_Catalog_Product_Edit_Tab_Downloadable_Links
|
434 |
*/
|
435 |
$this->getEditionguardResource()
|
436 |
$eSelectbox .= '<option value="' . $value->resource . '">' . $value->title . ' ('.$value->resource.')</option>';
|
437 |
<table cellspacing="0" class="form-list">
|
438 |
<tbody>
|
439 |
<tr class="headings">
|
440 |
<td class="label"><label for="name"><?php echo Mage::helper('downloadable')->__('Title') ?></label>
|
441 |
</td>
|
442 |
<td class="value">
|
443 |
<input type="text" class="input-text" id="downloadable_links_title" name="product[links_title]" value="<?php echo $_product->getId() ? $_product->getLinksTitle() : $this->getLinksTitle() ?>" <?php echo ($_product->getStoreId() && $this->getUsedDefault()) ? 'disabled="disabled"' : '' ?> />
|
444 |
</td>
|
445 |
<td class="scope-label"><?php if (!Mage::app()->isSingleStoreMode()): ?>[STORE VIEW]<?php endif; ?></td>
|
446 |
<td class="value use-default">
|
447 |
<?php if ($_product->getStoreId()): ?>
|
448 |
<input id="link_title_default" type="checkbox" name="use_default[]" value="links_title" onclick="toggleValueElements(this, this.parentNode.parentNode)" <?php echo $this->getUsedDefault() ? 'checked="checked"' : '' ?> />
|
449 |
<label class="normal" for="link_title_default"><?php echo Mage::helper('downloadable')->__('Use Default Value'); ?></label>
|
450 |
<?php endif; ?>
|
451 |
</td>
|
452 |
</tr>
|
453 |
</tbody>
|
454 |
</table>
|
455 |
<br />
|
456 |
<table cellspacing="0" class="form-list">
|
457 |
<tbody>
|
458 |
<tr class="headings">
|
459 |
<td class="label"><label for="name"><?php echo Mage::helper('downloadable')->__('Links can be purchased separately') ?></label>
|
460 |
</td>
|
461 |
<td class="value">
|
462 |
<?php echo $this->getPurchasedSeparatelySelect() ?>
|
463 |
</td>
|
464 |
<td class="scope-label"><?php if (!Mage::app()->isSingleStoreMode()): ?>[GLOBAL]<?php endif; ?></td>
|
465 |
<td><small> </small></td>
|
466 |
</tr>
|
467 |
</tbody>
|
468 |
</table>
|
469 |
<br />
|
470 |
<div class="grid">
|
471 |
<div class="hor-scroll">
|
472 |
<table cellspacing="0" class="data border">
|
473 |
<col width="33%" />
|
474 |
<col />
|
475 |
<col />
|
476 |
<col />
|
477 |
<col />
|
478 |
<col width="1" />
|
479 |
<col width="1" />
|
480 |
<col width="1" />
|
481 |
<col width="1" />
|
482 |
<thead>
|
483 |
<tr class="headings">
|
484 |
<th><?php echo Mage::helper('downloadable')->__('Title') ?> <span class="required">*</span></th>
|
485 |
<?php if ($this->getCanReadPrice() !== false) : ?>
|
486 |
<th><?php echo Mage::helper('downloadable')->__('Price') ?></th>
|
487 |
<?php endif; ?>
|
488 |
<th><span class="nobr"><?php echo Mage::helper('downloadable')->__('Max. Downloads') ?></span></th>
|
489 |
<th><?php echo Mage::helper('downloadable')->__('Shareable') ?></th>
|
490 |
<th><?php echo Mage::helper('downloadable')->__('EditionGuard') ?></th>
|
491 |
<th><?php echo Mage::helper('downloadable')->__('Sample') ?></th>
|
492 |
<th><?php echo Mage::helper('downloadable')->__('File') ?></th>
|
493 |
<th><span class="nobr"><?php echo Mage::helper('downloadable')->__('Sort Order') ?></span></th>
|
494 |
<th> </th>
|
495 |
</tr>
|
496 |
</thead>
|
497 |
<tfoot>
|
498 |
<tr>
|
499 |
<td colspan="9" class="a-right"><?php echo $this->getAddButtonHtml() ?> <?php echo $this->getUploadButtonHtml() ?></td>
|
500 |
</tr>
|
501 |
</tfoot>
|
502 |
<tbody id="link_items_body">
|
503 |
</tbody>
|
504 |
</table>
|
505 |
<div><small><?php echo Mage::helper('downloadable')->__('Alphanumeric, dash and underscore characters are recommended for filenames. Improper characters are replaced with \'_\'.') ?></small></div>
|
506 |
</div>
|
507 |
</div>
|
508 |
//<![CDATA[
|
509 |
var linkTemplate = '<tr>' +
|
510 |
'<td>' +
|
511 |
'<input type="hidden" class="__delete__" name="downloadable[link][{{id}}][is_delete]" value="" />' +
|
512 |
'<input type="hidden" name="downloadable[link][{{id}}][link_id]" value="{{link_id}}" />' +
|
513 |
'<input type="text" class="required-entry input-text" name="downloadable[link][{{id}}][title]" value="{{title}}" />' +
|
514 |
'<?php echo $_product->getStoreId() ? '<input type="checkbox" id="downloadable_link_{{id}}_title" name="downloadable[link][{{id}}][use_default_title]" value="1" /><label class="normal" for="downloadable_link_{{id}}_title">Use Default Value</label>' : '' ?>' +
|
515 |
'</td>' +
|
516 |
'<td class="input-price">' +
|
517 |
'<input type="text" id="downloadable_link_{{id}}_price_value" class="input-text validate-number link-prices<?php if ($this->getCanEditPrice() === false) : ?> disabled<?php endif; ?>" name="downloadable[link][{{id}}][price]" value="{{price}}"<?php if ($this->getCanEditPrice() === false) : ?> disabled="disabled"<?php endif; ?> /> ' +
|
518 |
'<label>[<?php echo Mage::app()->getStore($_product->getStoreId())->getBaseCurrencyCode() ?>]</label>' +
|
519 |
<?php if ($_product->getStoreId() && $this->getIsPriceWebsiteScope()) : ?>
|
520 |
'<br /><input type="checkbox" id="downloadable_link_{{id}}_price" name="downloadable[link][{{id}}][use_default_price]" value="1"<?php if ($this->getCanEditPrice() === false) : ?> disabled="disabled"<?php endif; ?> /> <label for="downloadable_link_{{id}}_price">Use Default Value</label>' +
|
521 |
<?php endif; ?>
|
522 |
'</td>' +
|
523 |
'<input type="hidden" id="downloadable_link_{{id}}_price_value" class="link-prices" name="downloadable[link][{{id}}][price]" value="0" />' +
|
524 |
<?php if ($_product->getStoreId() && $this->getIsPriceWebsiteScope()) : ?>
|
525 |
'<input type="hidden" id="downloadable_link_{{id}}_price" name="downloadable[link][{{id}}][use_default_price]" value="1" />' +
|
526 |
<?php endif; ?>
|
527 |
'<td><input type="text" id="downloadable_link_{{id}}_downloads" name="downloadable[link][{{id}}][number_of_downloads]" class="input-text downloads" value="{{number_of_downloads}}" />' +
|
528 |
'<p><input type="checkbox" class="checkbox" id="downloadable_link_{{id}}_is_unlimited" name="downloadable[link][{{id}}][is_unlimited]" value="1" {{is_unlimited}} /> <label for="downloadable_link_{{id}}_is_unlimited">Unlimited</label></p></td>' +
|
529 |
'<td class="a-center">' +
|
530 |
'<select id="downloadable_link _{{id}}_shareable" name="downloadable[link][{{id}}][is_shareable]">' +
|
531 |
'<option value="1">Yes</option>' +
|
532 |
'<option value="0">No</option>' +
|
533 |
'<option value="2">Use config</option>' +
|
534 |
'</select>' +
|
535 |
'</td>' +
|
536 |
'<td class="a-center">' +
|
537 |
'<input type="hidden" id="downloadable_link _{{id}}_old_use_editionguard" class="old_use_editionguard" name="downloadable[link][{{id}}][old_use_editionguard]" value="{{use_editionguard}}" />' +
|
538 |
'<select id="downloadable_link _{{id}}_editionguard" class="use_editionguard" name="downloadable[link][{{id}}][use_editionguard]">' +
|
539 |
'<option value="1" selected="selected">Yes</option>' +
|
540 |
'<option value="0">No</option>' +
|
541 |
'<option value="2">Use config</option>' +
|
542 |
'</select>' +
|
543 |
'</td>' +
|
544 |
'<td>' +
|
545 |
'<div class="files">' +
|
546 |
'<div class="row">' +
|
547 |
'<label for="downloadable_link_{{id}}_sample_file_type"><input type="radio" class="radio" id="downloadable_link_{{id}}_sample_file_type" name="downloadable[link][{{id}}][sample][type]" value="file"{{sample_file_checked}} checked="checked"/> File:</label>' +
|
548 |
'<input type="hidden" id="downloadable_link_{{id}}_sample_file_save" name="downloadable[link][{{id}}][sample][file]" value="{{sample_file_save}}" />' +
|
549 |
'<div id="downloadable_link_{{id}}_sample_file" class="uploader">' +
|
550 |
'<div id="downloadable_link_{{id}}_sample_file-old" class="file-row-info"></div>' +
|
551 |
'<div id="downloadable_link_{{id}}_sample_file-new" class="file-row-info"></div>' +
|
552 |
'<div class="buttons">' +
|
553 |
'<div id="downloadable_link_{{id}}_sample_file-install-flash" style="display:none">' +
|
554 |
'<?php echo $this->jsQuoteEscape(Mage::helper('media')->__('This content requires last version of Adobe Flash Player. <a href="%s">Get Flash</a>', 'http://www.adobe.com/go/getflash/')) ?>' +
|
555 |
'</div>' +
|
556 |
'</div>' +
|
557 |
'<div class="clear"></div>' +
|
558 |
'</div>' +
|
559 |
'</div>' +
|
560 |
'<div class="row">' +
|
561 |
'<label for="downloadable_link_{{id}}_sample_url_type"><input type="radio" class="radio" id="downloadable_link_{{id}}_sample_url_type" name="downloadable[link][{{id}}][sample][type]" value="url"{{sample_url_checked}} /> URL:</label><input type="text" class="input-text" name="downloadable[link][{{id}}][sample][url]" value="{{sample_url}}" /> ' +
|
562 |
'</div>' +
|
563 |
'<div>' +
|
564 |
'<span id="downloadable_link_{{id}}_sample_container"></span>' +
|
565 |
'</div>' +
|
566 |
'</div>' +
|
567 |
'</td>' +
|
568 |
'<td>' +
|
569 |
'<div class="files">' +
|
570 |
'<div class="row">' +
|
571 |
'<label for="downloadable_link_{{id}}_file_type"><input type="radio" class="radio validate-one-required-by-name" id="downloadable_link_{{id}}_file_type" name="downloadable[link][{{id}}][type]" value="file"{{file_checked}} checked="checked"/> File:</label>' +
|
572 |
'<input type="hidden" class="validate-downloadable-file" id="downloadable_link_{{id}}_file_save" name="downloadable[link][{{id}}][file]" value="{{file_save}}" />' +
|
573 |
'<div id="downloadable_link_{{id}}_file" class="uploader">' +
|
574 |
'<div id="downloadable_link_{{id}}_file-old" class="file-row-info"></div>' +
|
575 |
'<div id="downloadable_link_{{id}}_file-new" class="file-row-info new-file"></div>' +
|
576 |
'<div class="buttons">' +
|
577 |
'<div id="downloadable_link_{{id}}_file-install-flash" style="display:none">' +
|
578 |
'<?php echo $this->jsQuoteEscape(Mage::helper('media')->__('This content requires last version of Adobe Flash Player. <a href="%s">Get Flash</a>', 'http://www.adobe.com/go/getflash/')) ?>' +
|
579 |
'</div>' +
|
580 |
'</div></div>' +
|
581 |
'<div class="clear"></div>' +
|
582 |
'<div class="urlwrap" style="{{url_display}}"><label for="downloadable_link_{{id}}_url_type"><input type="radio" class="radio validate-one-required-by-name file-radio" id="downloadable_link_{{id}}_url_type" name="downloadable[link][{{id}}][type]" value="url"{{url_checked}} /> URL:</label><input type="text" class="validate-downloadable-url input-text" name="downloadable[link][{{id}}][link_url]" value="{{link_url}}" /></div>' +
|
583 |
'<div class="ebookwrap" style="{{ebook_display}}"><label for="downloadable_link_{{id}}_ebook_type"><input type="radio" class="radio validate-one-required-by-name ebook-radio" id="downloadable_link_{{id}}_url_type" name="downloadable[link][{{id}}][type]" value="ebook" {{ebook_checked}} /> eBook: </label><?php echo $eSelectbox ?></div></div>' +
|
584 |
'' +
|
585 |
'<div>' +
|
586 |
'<span id="downloadable_link_{{id}}_link_container"></span>' +
|
587 |
'</div>' +
|
588 |
'</div>' +
|
589 |
'</td>' +
|
590 |
'<td class="a-center"><input type="text" name="downloadable[link][{{id}}][sort_order]" value="{{sort_order}}" class="input-text sort" /></td>' +
|
591 |
'<td>' +
|
592 |
'<button id="downloadable_link_{{id}}_delete_button" type="button" class="scalable delete icon-btn delete-link-item"><span><?php echo Mage::helper('downloadable')->__('Delete'); ?></span></button>' +
|
593 |
'</td>' +
|
594 |
'</tr>';
|
595 |
var linkItems = {
|
596 |
tbody: $('link_items_body'),
|
597 |
templateSyntax: /(^|.|\r|\n)({{(\w+)}})/,
|
598 |
templateText: linkTemplate,
|
599 |
itemCount: 0,
|
600 |
add: function(data) {
|
601 |
alertAlreadyDisplayed = false;
|
602 |
this.template = new Template(this.templateText, this.templateSyntax);
|
603 |
if (!data.link_id) {
|
604 |
data = {};
|
605 |
data.link_id = 0;
|
606 |
data.link_type = 'ebook';
|
607 |
data.sample_type = 'none';
|
608 |
data.use_editionguard = 1;
|
609 |
data.number_of_downloads = '<?php echo $this->getConfigMaxDownloads() ?>';
|
610 |
}
|
611 |
data.id = this.itemCount;
|
612 |
if (data.link_type == 'url') {
|
613 |
data.url_checked = ' checked="checked"';
|
614 |
data.ebook_display = 'display:none';
|
615 |
} else if (data.link_type == 'file') {
|
616 |
data.file_checked = ' checked="checked"';
|
617 |
data.ebook_display = 'display:none';
|
618 |
}
|
619 |
else if (data.link_type == 'ebook') {
|
620 |
data.ebook_checked = ' checked="checked"';
|
621 |
data.url_display = 'display:none';
|
622 |
}
|
623 |
if (data.sample_type == 'url') {
|
624 |
data.sample_url_checked = ' checked="checked"';
|
625 |
} else if (data.sample_type == 'file') {
|
626 |
data.sample_file_checked = ' checked="checked"';
|
627 |
}
|
628 |
Element.insert(this.tbody, {'bottom': this.template.evaluate(data)});
|
629 |
scopeTitle = $('downloadable_link_' + data.id + '_title');
|
630 |
if (scopeTitle) {
|
631 |
Event.observe(scopeTitle, 'click', function(event) {
|
632 |
scopeElm = $(Event.findElement(event, 'input'));
|
633 |
titleField = scopeElm.up(0).down('input[type="text"]');
|
634 |
if (scopeElm.checked == true) {
|
635 |
titleField.disabled = true;
|
636 |
} else {
|
637 |
titleField.disabled = false;
|
638 |
}
|
639 |
});
|
640 |
}
|
641 |
if (!data.store_title && scopeTitle) {
|
642 |
scopeTitle.up(0).down('input[type="text"]').disabled = true;
|
643 |
scopeTitle.checked = true;
|
644 |
}
|
645 |
scopePrice = $('downloadable_link_' + data.id + '_price');
|
646 |
if (scopePrice) {
|
647 |
Event.observe(scopePrice, 'click', function(event) {
|
648 |
scopeElm = $(Event.findElement(event, 'input'));
|
649 |
priceField = scopeElm.up(0).down('input[type="text"]');
|
650 |
if (scopeElm.checked == true) {
|
651 |
priceField.disabled = true;
|
652 |
} else {
|
653 |
priceField.disabled = false;
|
654 |
}
|
655 |
});
|
656 |
}
|
657 |
if (!data.website_price && scopePrice) {
|
658 |
scopePrice.up(0).down('input[type="text"]').disabled = true;
|
659 |
scopePrice.checked = true;
|
660 |
}
|
661 |
downloadsElm = $('downloadable_link_' + data.id + '_downloads');
|
662 |
isUnlimitedElm = $('downloadable_link_' + data.id + '_is_unlimited');
|
663 |
if (data.is_unlimited) {
|
664 |
downloadsElm.disabled = true;
|
665 |
}
|
666 |
Event.observe(isUnlimitedElm, 'click', function(event) {
|
667 |
elm = Event.element(event);
|
668 |
elm.up('td').down('input[type="text"].downloads').disabled = elm.checked;
|
669 |
});
|
670 |
|
671 |
options = $('downloadable_link _' + data.id + '_shareable').options;
|
672 |
for (var i = 0; i < options.length; i++) {
|
673 |
//Made changes so that we can make Edition Guard to Yes bydefault
|
674 |
if (options[i].value == data.is_shareable) {
|
675 |
options[i].selected = true;
|
676 |
}
|
677 |
}
|
678 |
|
679 |
if (data.editionguard_resource) {
|
680 |
options = $('downloadable_link_' + data.id + '_editionguard_resource').options;
|
681 |
for (var i = 0; i < options.length; i++) {
|
682 |
if (options[i].value == data.editionguard_resource) {
|
683 |
options[i].selected = true;
|
684 |
}
|
685 |
}
|
686 |
}
|
687 |
if (data.use_editionguard) {
|
688 |
options = $('downloadable_link _' + data.id + '_editionguard').options;
|
689 |
for (var i = 0; i < options.length; i++) {
|
690 |
//Made changes so that we can make Edition Guard to Yes bydefault
|
691 |
//if (options[i].value == data.use_editionguard) {
|
692 |
if (options[i].value == data.use_editionguard) {
|
693 |
options[i].selected = true;
|
694 |
}
|
695 |
}
|
696 |
}
|
697 |
sampleUrl = $('downloadable_link_' + data.id + '_sample_url_type');
|
698 |
linkUrl = $('downloadable_link_' + data.id + '_url_type');
|
699 |
if (!data.file_save) {
|
700 |
data.file_save = [];
|
701 |
}
|
702 |
if (!data.sample_file_save) {
|
703 |
data.sample_file_save = [];
|
704 |
}
|
705 |
// link sample file
|
706 |
new Downloadable.FileUploader(
|
707 |
'linkssample',
|
708 |
'linkssample_' + data.id,
|
709 |
sampleUrl.up('td'),
|
710 |
'downloadable[link][' + data.id + '][sample]',
|
711 |
data.sample_file_save,
|
712 |
'downloadable_link_' + data.id + '_sample_file',
|
713 |
);
|
714 |
// link file
|
715 |
new Downloadable.FileUploader(
|
716 |
'links',
|
717 |
'links_' + data.id,
|
718 |
linkUrl.up('td'),
|
719 |
'downloadable[link][' + data.id + ']',
|
720 |
data.file_save,
|
721 |
'downloadable_link_' + data.id + '_file',
|
722 |
);
|
723 |
linkFile = $('downloadable_link_' + data.id + '_file_type');
|
724 |
linkFile.advaiceContainer = 'downloadable_link_' + data.id + '_link_container';
|
725 |
linkUrl.advaiceContainer = 'downloadable_link_' + data.id + '_link_container';
|
726 |
$('downloadable_link_' + data.id + '_file_save').advaiceContainer = 'downloadable_link_' + data.id + '_link_container';
|
727 |
sampleFile = $('downloadable_link_' + data.id + '_sample_file_type');
|
728 |
this.itemCount++;
|
729 |
this.togglePriceFields();
|
730 |
this.bindRemoveButtons();
|
731 |
this.bindEditionguardSelect();
|
732 |
},
|
733 |
remove: function(event) {
|
734 |
var element = $(Event.findElement(event, 'tr'));
|
735 |
var use_editionguard = element.down('select.use_editionguard').value != 0;
|
736 |
var old_use_editionguard = element.down('input[type="hidden"].old_use_editionguard').value != 0;
|
737 |
if (!old_use_editionguard || !use_editionguard || confirm("This file is managed by Editionguard. If you delete it, previous customers will no longer be able to download their file. This cannot be undone.\n\nAre you sure?"))
|
738 |
{
|
739 |
alertAlreadyDisplayed = false;
|
740 |
if (element) {
|
741 |
element.down('input[type="hidden"].__delete__').value = '1';
|
742 |
Element.select(element, 'div.flex').each(function(elm) {
|
743 |
elm.remove();
|
744 |
});
|
745 |
element.addClassName('no-display');
|
746 |
element.addClassName('ignore-validate');
|
747 |
element.hide();
|
748 |
}
|
749 |
}
|
750 |
},
|
751 |
editionguardSelect: function(event) {
|
752 |
var element = $(Event.findElement(event, 'tr'));
|
753 |
var use_editionguard = element.down('select.use_editionguard').value == 1;
|
754 |
var old_use_editionguard = element.down('input[type="hidden"].old_use_editionguard').value != 0;
|
755 |
if (old_use_editionguard && !use_editionguard && !confirm("This file is managed by Editionguard. If you disable it, previous customers will no longer be able to download their file.\n\nAre you sure?"))
|
756 |
{
|
757 |
element.down('select.use_editionguard').value = element.down('input[type="hidden"].old_use_editionguard').value;
|
758 |
element.down('div.ebookwrap').show();
|
759 |
element.down('div.urlwrap').hide();
|
760 |
return false;
|
761 |
}
|
762 |
else {
|
763 |
element.down('div.ebookwrap').hide();
|
764 |
element.down('div.urlwrap').show();
|
765 |
element.down('input[type="radio"][value="url"].file-radio').checked = true;
|
766 |
}
|
767 |
if (element.down('select.use_editionguard').value == 1) {
|
768 |
element.down('div.ebookwrap').show();
|
769 |
element.down('div.urlwrap').hide();
|
770 |
element.down('input[type="radio"][value="ebook"].ebook-radio').checked = true;
|
771 |
}
|
772 |
if (element.down('select.use_editionguard').value != 1) {
|
773 |
element.down('select.editionguardebook').selectedIndex = 0;
|
774 |
}
|
775 |
return true;
|
776 |
},
|
777 |
bindRemoveButtons: function() {
|
778 |
var buttons = $$('tbody#link_items_body .delete-link-item');
|
779 |
for (var i = 0; i < buttons.length; i++) {
|
780 |
if (!$(buttons[i]).binded && !$(buttons[i]).hasClassName('disabled')) {
|
781 |
$(buttons[i]).binded = true;
|
782 |
Event.observe(buttons[i], 'click', this.remove.bind(this));
|
783 |
}
|
784 |
}
|
785 |
},
|
786 |
bindEditionguardSelect: function() {
|
787 |
var selects = $$('tbody#link_items_body select.use_editionguard');
|
788 |
for (var i = 0; i < selects.length; i++) {
|
789 |
if (!$(selects[i]).binded && !$(selects[i]).hasClassName('disabled')) {
|
790 |
$(selects[i]).binded = true;
|
791 |
Event.observe(selects[i], 'change', this.editionguardSelect.bind(this));
|
792 |
}
|
793 |
}
|
794 |
},
|
795 |
togglePriceFields: function() {
|
796 |
var toogleTo = $('downloadable_link_purchase_type').value;
|
797 |
var disableFlag = true;
|
798 |
if (toogleTo == '1') {
|
799 |
disableFlag = false;
|
800 |
}
|
801 |
$$('.link-prices[type="text"]').each(function(elm) {
|
802 |
var flag = disableFlag;
|
803 |
if (elm.hasClassName('disabled')) {
|
804 |
flag = true;
|
805 |
}
|
806 |
elm.disabled = flag;
|
807 |
});
|
808 |
}
|
809 |
}
|
810 |
linkItems.bindRemoveButtons();
|
811 |
linkItems.bindEditionguardSelect();
|
812 |
if ($('downloadable_link_purchase_type')) {
|
813 |
Event.observe('downloadable_link_purchase_type', 'change', linkItems.togglePriceFields.bind());
|
814 |
}
|
815 |
if ($('add_link_item')) {
|
816 |
Event.observe('add_link_item', 'click', linkItems.add.bind(linkItems));
|
817 |
}
|
818 |
linkItems.add(<?php echo $item->toJson() ?>);
|
819 |
Validation.addAllThese([
|
820 |
['validate-downloadable-link-sample-file', 'Please specify File.', function(v, element) {
|
821 |
fileSaveElm = element.up('div').next('input[type="hidden"]');
|
822 |
if (element.checked && (fileSaveElm.value == '' || fileSaveElm.value == '[]')) {
|
823 |
return false;
|
824 |
}
|
825 |
return true;
|
826 |
}]
|
827 |
]);
|
828 |
Validation.addAllThese([
|
829 |
['validate-downloadable-link-sample-url', 'Please specify Sample URL.', function(v, element) {
|
830 |
if (element.checked && element.up('p').down('input[type="text"]').value == '') {
|
831 |
return false;
|
832 |
}
|
833 |
return true;
|
834 |
}]
|
835 |
]);
|
836 |
Validation.addAllThese([
|
837 |
['validate-downloadable-ebook', 'Please Select an eBook', function(v, element) {
|
838 |
linkType = element.up(0).down('input[value="ebook"]');
|
839 |
if (linkType.checked && v == '') {
|
840 |
return false;
|
841 |
}
|
842 |
return true;
|
843 |
}]
|
844 |
]);
|
845 |
//]]>
|
package.xml
CHANGED
@@ -1,18 +1,18 @@
|
|
1 |
<?xml version="1.0"?>
|
2 |
<package>
|
3 |
<name>editionguard_drm</name>
|
4 |
-
<version>1.0.2.
|
5 |
<stability>stable</stability>
|
6 |
<license>New BSD</license>
|
7 |
<channel>community</channel>
|
8 |
<extends/>
|
9 |
<summary>This extension is used to integrate Magento with EditionGuard, a cost-effective Adobe DRM service for eBooks.</summary>
|
10 |
<description>This extension will allow you to create eBooks protected with the industry standard Adobe Content Server DRM through the EditionGuard APIs. Through the admin interface, you will be able to manage your DRM enabled eBooks and put them up for sale as Downloadable Products. Your clients will then be able to purchase your eBooks, download them securely on the frontend and open them in Adobe Digital Editions.</description>
|
11 |
-
<notes>
|
12 |
<authors><author><name>EditionGuard</name><user>EditionGuard</user><email>support@editionguard.com</email></author></authors>
|
13 |
-
<date>2015-06-
|
14 |
-
<time>
|
15 |
-
<contents><target name="magecommunity"><dir><dir name="Editionguard"><dir name="Editionguard"><dir name="Block"><dir name="Downloadable"><dir name="Adminhtml"><dir name="Catalog"><dir name="Product"><dir name="Edit"><dir name="Tab"><dir name="Downloadable"><file name="Links.php" hash="cadc7871db136a3260392daf38a029aa"/></dir></dir></dir></dir></dir></dir><dir name="Customer"><dir name="Products"><file name="List.php" hash="427a1e5797d2bee3a2f64d2fb6f13b90"/></dir></dir></dir></dir><dir name="Helper"><file name="Data.php" hash="82a33f425e364617722a142415dfe40f"/></dir><dir name="Model"><dir name="Downloadable"><file name="Link.php" hash="4e683792593ec39e94cf02ad9c967cdc"/></dir><file name="Exception.php" hash="18afd5abedb9a0413481ea5255a89a53"/><dir name="Mysql4"><dir name="Editionguard"><file name="Collection.php" hash="de7c2d9c3aa413612a6473dafdf2f779"/></dir><file name="Editionguard.php" hash="adaa5e0d1718f506e89c657420c4d31a"/></dir><dir name="Resource"><dir name="Downloadable"><file name="Link.php" hash="cfc4b1417f2fd0adf93daf15b24681e1"/></dir><dir name="Eav"><dir name="Mysql4"><file name="Setup.php" hash="ff76c3213b9b428220578ba48a667365"/></dir></dir></dir></dir><dir name="controllers"><file name="DownloadController.php" hash="f7b27200e5ca4f612ab70e313631c2a9"/></dir><dir name="etc"><file name="config.xml" hash="
|
16 |
<compatible/>
|
17 |
<dependencies><required><php><min>5.2.17</min><max>6.0.0</max></php></required></dependencies>
|
18 |
</package>
|
1 |
<?xml version="1.0"?>
|
2 |
<package>
|
3 |
<name>editionguard_drm</name>
|
4 |
+
<version>1.0.2.3</version>
|
5 |
<stability>stable</stability>
|
6 |
<license>New BSD</license>
|
7 |
<channel>community</channel>
|
8 |
<extends/>
|
9 |
<summary>This extension is used to integrate Magento with EditionGuard, a cost-effective Adobe DRM service for eBooks.</summary>
|
10 |
<description>This extension will allow you to create eBooks protected with the industry standard Adobe Content Server DRM through the EditionGuard APIs. Through the admin interface, you will be able to manage your DRM enabled eBooks and put them up for sale as Downloadable Products. Your clients will then be able to purchase your eBooks, download them securely on the frontend and open them in Adobe Digital Editions.</description>
|
11 |
+
<notes>Fixed a bug causing shareable being forced to Yes on other downloadables.</notes>
|
12 |
<authors><author><name>EditionGuard</name><user>EditionGuard</user><email>support@editionguard.com</email></author></authors>
|
13 |
+
<date>2015-06-29</date>
|
14 |
+
<time>10:30:15</time>
|
15 |
+
<contents><target name="magecommunity"><dir><dir name="Editionguard"><dir name="Editionguard"><dir name="Block"><dir name="Downloadable"><dir name="Adminhtml"><dir name="Catalog"><dir name="Product"><dir name="Edit"><dir name="Tab"><dir name="Downloadable"><file name="Links.php" hash="cadc7871db136a3260392daf38a029aa"/></dir></dir></dir></dir></dir></dir><dir name="Customer"><dir name="Products"><file name="List.php" hash="427a1e5797d2bee3a2f64d2fb6f13b90"/></dir></dir></dir></dir><dir name="Helper"><file name="Data.php" hash="82a33f425e364617722a142415dfe40f"/></dir><dir name="Model"><dir name="Downloadable"><file name="Link.php" hash="4e683792593ec39e94cf02ad9c967cdc"/></dir><file name="Exception.php" hash="18afd5abedb9a0413481ea5255a89a53"/><dir name="Mysql4"><dir name="Editionguard"><file name="Collection.php" hash="de7c2d9c3aa413612a6473dafdf2f779"/></dir><file name="Editionguard.php" hash="adaa5e0d1718f506e89c657420c4d31a"/></dir><dir name="Resource"><dir name="Downloadable"><file name="Link.php" hash="cfc4b1417f2fd0adf93daf15b24681e1"/></dir><dir name="Eav"><dir name="Mysql4"><file name="Setup.php" hash="ff76c3213b9b428220578ba48a667365"/></dir></dir></dir></dir><dir name="controllers"><file name="DownloadController.php" hash="f7b27200e5ca4f612ab70e313631c2a9"/></dir><dir name="etc"><file name="config.xml" hash="6ead702c39fb05622ed5582e092e01ea"/><file name="system.xml" hash="e1a700fb181b7b11e318edd4612d93e3"/></dir><dir name="sql"><dir name="editionguard_setup"><file name="install-1.0.0.0.php" hash="9e9ccd8e5fb5f5f63b32fa6ccea92ce6"/></dir></dir></dir></dir></dir></target><target name="magedesign"><dir><dir name="adminhtml"><dir name="default"><dir name="default"><dir name="template"><dir name="editionguard"><dir name="downloadable"><dir name="product"><dir name="edit"><dir name="downloadable"><file name="links.phtml" hash="f6c0fdb07a16f44b01bb7efe29e3a151"/><file name="links.phtml.zip" hash="8c2249a9e77f11735222aca65a4a0577"/><file name=".DS_Store" hash="194577a7e20bdcc7afbb718f502c134c"/></dir><file name=".DS_Store" hash="15fac25ebcf2a7b1d7e9b86c7ff994ae"/></dir><file name=".DS_Store" hash="0a0b84ae758c5fd76efde758b41c2735"/></dir><file name=".DS_Store" hash="7688e3e1f70b35fc9717a876ffedb8e0"/></dir><file name=".DS_Store" hash="15fac25ebcf2a7b1d7e9b86c7ff994ae"/></dir></dir></dir></dir></dir></dir></target><target name="mageetc"><dir><dir name="modules"><file name="Editionguard_Editionguard.xml" hash="1d6aac7609bf2b57392b64213f3722ca"/></dir></dir></target></contents>
|
16 |
<compatible/>
|
17 |
<dependencies><required><php><min>5.2.17</min><max>6.0.0</max></php></required></dependencies>
|
18 |
</package>
|