Version Description
Download this release
Release Info
Developer | pasyuk |
Plugin | Gallery – Flagallery Photo Portfolio |
Version | 6.0.0 |
Comparing to | |
See all releases |
Code changes from version 5.4.0 to 6.0.0
- admin/addgallery.php +379 -373
- admin/admin.php +395 -438
- admin/ajax.php +485 -456
- admin/banner.functions.php +13 -12
- admin/blocks/assets/icon-128x128.png +0 -0
- admin/blocks/dist/blocks.build.js +1 -0
- admin/blocks/dist/blocks.build.style.css +4 -0
- admin/blocks/init.php +87 -0
- admin/css/flagadmin.css +641 -599
- admin/css/flagallery-block.css +7 -0
- admin/flag_install.php +332 -319
- admin/flagframe-tool.php +360 -278
- admin/functions.php +1459 -1458
- admin/images/woowbox-promote.png +0 -0
- admin/js/Jcrop/js/jquery.Jcrop.js +3 -4
- admin/js/flagallery-block.js +54 -3
- admin/js/jquery.tablesorter.js +231 -238
- admin/js/plupload/Moxie.swf +0 -0
- admin/js/plupload/Moxie.xap +0 -0
- admin/js/plupload/i18n/ar.js +1 -1
- admin/js/plupload/i18n/az.js +2 -0
- admin/js/plupload/i18n/bg.js +2 -0
- admin/js/plupload/i18n/bs.js +1 -1
- admin/js/plupload/i18n/ca.js +1 -1
- admin/js/plupload/i18n/cs.js +1 -1
- admin/js/plupload/i18n/cy.js +1 -1
- admin/js/plupload/i18n/da.js +1 -1
- admin/js/plupload/i18n/de.js +1 -1
- admin/js/plupload/i18n/el.js +1 -1
- admin/js/plupload/i18n/en.js +1 -1
- admin/js/plupload/i18n/es.js +1 -1
- admin/js/plupload/i18n/et.js +1 -1
- admin/js/plupload/i18n/fa.js +1 -1
- admin/js/plupload/i18n/fi.js +1 -1
- admin/js/plupload/i18n/fr.js +1 -1
- admin/js/plupload/i18n/he.js +1 -1
- admin/js/plupload/i18n/hr.js +1 -1
- admin/js/plupload/i18n/hu.js +1 -1
- admin/js/plupload/i18n/hy.js +1 -1
- admin/js/plupload/i18n/id.js +1 -1
- admin/js/plupload/i18n/it.js +1 -1
- admin/js/plupload/i18n/ja.js +1 -1
- admin/js/plupload/i18n/ka.js +1 -1
- admin/js/plupload/i18n/kk.js +1 -1
- admin/js/plupload/i18n/km.js +2 -0
- admin/js/plupload/i18n/ko.js +1 -1
- admin/js/plupload/i18n/ku_IQ.js +2 -0
- admin/js/plupload/i18n/lt.js +1 -1
- admin/js/plupload/i18n/lv.js +1 -1
- admin/js/plupload/i18n/ms.js +2 -0
- admin/js/plupload/i18n/nl.js +1 -1
- admin/js/plupload/i18n/pl.js +1 -1
- admin/js/plupload/i18n/pt.js +2 -0
- admin/js/plupload/i18n/pt_BR.js +1 -1
- admin/js/plupload/i18n/ro.js +1 -1
- admin/js/plupload/i18n/ru.js +1 -1
- admin/js/plupload/i18n/sk.js +1 -1
- admin/js/plupload/i18n/sl.js +2 -0
- admin/js/plupload/i18n/sq.js +2 -0
- admin/js/plupload/i18n/sr.js +1 -1
- admin/js/plupload/i18n/sv.js +1 -1
- admin/js/plupload/i18n/th_TH.js +1 -1
- admin/js/plupload/i18n/tr.js +1 -1
- admin/js/plupload/i18n/uk_UA.js +1 -1
- admin/js/plupload/i18n/vi.js +2 -0
- admin/js/plupload/i18n/zh_CN.js +1 -1
- admin/js/plupload/i18n/zh_TW.js +1 -1
- admin/js/plupload/jquery.plupload.queue/css/jquery.plupload.queue.css +185 -0
- admin/js/plupload/jquery.plupload.queue/img/backgrounds.gif +0 -0
- admin/js/plupload/jquery.plupload.queue/img/buttons-disabled.png +0 -0
- admin/js/plupload/jquery.plupload.queue/img/buttons.png +0 -0
- admin/js/plupload/jquery.plupload.queue/img/delete.gif +0 -0
- admin/js/plupload/jquery.plupload.queue/img/done.gif +0 -0
- admin/js/plupload/jquery.plupload.queue/img/error.gif +0 -0
- admin/js/plupload/jquery.plupload.queue/img/throbber.gif +0 -0
- admin/js/plupload/jquery.plupload.queue/img/transp50.png +0 -0
- admin/js/plupload/jquery.plupload.queue/jquery.plupload.queue.js +433 -0
- admin/js/plupload/jquery.plupload.queue/jquery.plupload.queue.min.js +1 -0
- admin/js/plupload/jquery.ui.plupload/css/jquery.ui.plupload.css +51 -34
- admin/js/plupload/jquery.ui.plupload/img/plupload.png +0 -0
- admin/js/plupload/jquery.ui.plupload/jquery.ui.plupload.js +337 -286
- admin/js/plupload/jquery.ui.plupload/jquery.ui.plupload.min.js +1 -1
- admin/js/plupload/moxie.js +11714 -0
- admin/js/plupload/moxie.min.js +5 -5
admin/addgallery.php
CHANGED
@@ -1,373 +1,379 @@
|
|
1 |
-
<?php
|
2 |
-
if ( preg_match( '#' . basename( __FILE__ ) . '#', $_SERVER['PHP_SELF'] ) ) {
|
3 |
-
die( 'You are not allowed to call this page directly.' );
|
4 |
-
}
|
5 |
-
|
6 |
-
// sometimes a error feedback is better than a white screen
|
7 |
-
@ini_set( 'error_reporting', E_ALL ^ E_NOTICE );
|
8 |
-
|
9 |
-
function flag_admin_add_gallery() {
|
10 |
-
|
11 |
-
global $wpdb, $flagdb, $flag;
|
12 |
-
|
13 |
-
// same as $_SERVER['REQUEST_URI'], but should work under IIS 6.0
|
14 |
-
$filepath = admin_url() . 'admin.php?page=' . urlencode( $_GET['page'] );
|
15 |
-
|
16 |
-
// check for the max image size
|
17 |
-
$maxsize = flagGallery::check_memory_limit();
|
18 |
-
|
19 |
-
$defaultpath = $flag->options['galleryPath'];
|
20 |
-
|
21 |
-
if ( $_POST['addgallery'] ) {
|
22 |
-
check_admin_referer( 'flag_addgallery' );
|
23 |
-
$newgallery = trim( $_POST['galleryname'] );
|
24 |
-
if ( ! empty( $newgallery ) ) {
|
25 |
-
flagAdmin::create_gallery( $newgallery, $defaultpath );
|
26 |
-
}
|
27 |
-
}
|
28 |
-
if ( $_POST['uploadimage'] ) {
|
29 |
-
check_admin_referer( 'flag_upload' );
|
30 |
-
|
31 |
-
$flag->options['thumbWidth'] = intval( $_POST['thumbWidth'] ) ? intval( $_POST['thumbWidth'] ) : 300;
|
32 |
-
$flag->options['thumbHeight'] = intval( $_POST['thumbHeight'] ) ? intval( $_POST['thumbHeight'] ) : 300;
|
33 |
-
update_option( 'flag_options', $flag->options );
|
34 |
-
|
35 |
-
if ( $_FILES['MF__F_0_0']['error'] == 0 ) {
|
36 |
-
flagAdmin::upload_images();
|
37 |
-
} else {
|
38 |
-
flagGallery::show_error( __( 'Upload failed!', 'flash-album-gallery' ) );
|
39 |
-
}
|
40 |
-
}
|
41 |
-
if ( $_POST['importfolder'] ) {
|
42 |
-
check_admin_referer( 'flag_addgallery' );
|
43 |
-
$galleryfolder = $_POST['galleryfolder'];
|
44 |
-
if ( ( ! empty( $galleryfolder ) ) AND ( $defaultpath != $galleryfolder ) AND false === strpos( $galleryfolder, '..' ) ) {
|
45 |
-
flagAdmin::import_gallery( $galleryfolder );
|
46 |
-
}
|
47 |
-
}
|
48 |
-
|
49 |
-
|
50 |
-
if ( isset( $_POST['disable_flash'] ) ) {
|
51 |
-
check_admin_referer( 'flag_upload' );
|
52 |
-
$flag->options['swfUpload'] = false;
|
53 |
-
update_option( 'flag_options', $flag->options );
|
54 |
-
}
|
55 |
-
|
56 |
-
if ( isset( $_POST['enable_flash'] ) ) {
|
57 |
-
check_admin_referer( 'flag_upload' );
|
58 |
-
$flag->options['swfUpload'] = true;
|
59 |
-
update_option( 'flag_options', $flag->options );
|
60 |
-
}
|
61 |
-
|
62 |
-
//get all galleries (after we added new ones)
|
63 |
-
$gallerylist = $flagdb->find_all_galleries( $flag->options['albSort'], $flag->options['albSortDir'], false, 0, 0, 0, true );
|
64 |
-
|
65 |
-
?>
|
66 |
-
|
67 |
-
<?php if ( ! IS_WPMU || current_user_can( 'FlAG Import folder' ) ) { ?>
|
68 |
-
<link rel="stylesheet" type="text/css" href="<?php echo FLAG_URLPATH; ?>admin/js/jqueryFileTree/jqueryFileTree.css"/>
|
69 |
-
<script type="text/javascript" src="<?php echo FLAG_URLPATH; ?>admin/js/jqueryFileTree/jqueryFileTree.js"></script>
|
70 |
-
<script type="text/javascript">
|
71 |
-
/* <![CDATA[ */
|
72 |
-
jQuery(function(){
|
73 |
-
jQuery("span.browsefiles").show().click(function(){
|
74 |
-
jQuery("#file_browser").fileTree({
|
75 |
-
script: "admin-ajax.php?action=flag_file_browser&nonce=<?php echo wp_create_nonce( 'flag-ajax' ) ;?>",
|
76 |
-
root: jQuery("#galleryfolder").val()
|
77 |
-
}, function(file){
|
78 |
-
//var path = file.replace("<?php echo WINABSPATH; ?>", "");
|
79 |
-
jQuery("#galleryfolder").val(file);
|
80 |
-
});
|
81 |
-
|
82 |
-
jQuery("#file_browser").show("slide");
|
83 |
-
});
|
84 |
-
});
|
85 |
-
/* ]]> */
|
86 |
-
</script>
|
87 |
-
<?php }
|
88 |
-
if ( ! is_plugin_active( '
|
89 |
-
?>
|
90 |
-
<div class="promote-woowbox" style="padding-top:10px"><a href="
|
91 |
-
<?php
|
92 |
-
}
|
93 |
-
?>
|
94 |
-
<div id="slider" class="flag-wrap">
|
95 |
-
|
96 |
-
<ul id="tabs" class="tabs">
|
97 |
-
<li class="selected"><a href="#" rel="addgallery"><?php _e( 'Add new gallery', 'flash-album-gallery' ); ?></a></li>
|
98 |
-
<li><a href="#" rel="uploadimage"><?php _e( 'Upload Images', 'flash-album-gallery' ); ?></a></li>
|
99 |
-
<?php if ( ! IS_WPMU || current_user_can( 'FlAG Import folder' ) ) { ?>
|
100 |
-
<li><a href="#" rel="importfolder"><?php _e( 'Import image folder', 'flash-album-gallery' ); ?></a></li>
|
101 |
-
<?php } ?>
|
102 |
-
</ul>
|
103 |
-
|
104 |
-
<!-- create gallery -->
|
105 |
-
<div id="addgallery" class="cptab">
|
106 |
-
<h2><?php _e( 'Create a new gallery', 'flash-album-gallery' ); ?></h2>
|
107 |
-
|
108 |
-
<form name="addgallery" id="addgallery_form" method="POST" action="<?php echo $filepath; ?>" accept-charset="utf-8">
|
109 |
-
<?php wp_nonce_field( 'flag_addgallery' ); ?>
|
110 |
-
<table class="form-table" style="width: auto;">
|
111 |
-
<tr>
|
112 |
-
<th scope="col" colspan="2" style="padding-bottom: 0;">
|
113 |
-
<strong><?php _e( 'New Gallery', 'flash-album-gallery' ); ?></strong></th>
|
114 |
-
</tr>
|
115 |
-
<tr valign="top">
|
116 |
-
<td><input type="text" size="65" name="galleryname" value=""/><br/>
|
117 |
-
<?php if ( ! IS_WPMU ) { ?>
|
118 |
-
<?php _e( 'Create a new , empty gallery below the folder', 'flash-album-gallery' ); ?>
|
119 |
-
<strong><?php echo $defaultpath; ?></strong><br/>
|
120 |
-
<?php } ?>
|
121 |
-
<i>( <?php _e( 'Allowed characters for file and folder names are', 'flash-album-gallery' ); ?>: a-z, A-Z, 0-9, -, _ )</i>
|
122 |
-
</td>
|
123 |
-
<?php do_action( 'flag_add_new_gallery_form' ); ?>
|
124 |
-
<td style="vertical-align:top;">
|
125 |
-
<div class="submit" style="margin: 0; padding: 0;">
|
126 |
-
<input class="button-primary" type="submit" name="addgallery" value="<?php _e( 'Add gallery', 'flash-album-gallery' ); ?>"/>
|
127 |
-
</div>
|
128 |
-
</td>
|
129 |
-
</tr>
|
130 |
-
</table>
|
131 |
-
<p> </p>
|
132 |
-
</form>
|
133 |
-
</div>
|
134 |
-
<!-- upload images -->
|
135 |
-
<div id="uploadimage" class="cptab">
|
136 |
-
<h2><?php _e( 'Upload images', 'flash-album-gallery' ); ?></h2>
|
137 |
-
|
138 |
-
<form name="uploadimage" id="gmUpload" method="POST" enctype="multipart/form-data" action="<?php echo $filepath; ?>" accept-charset="utf-8">
|
139 |
-
<?php wp_nonce_field( 'flag_upload' ); ?>
|
140 |
-
<table class="flag-form-table">
|
141 |
-
<tr valign="top">
|
142 |
-
<td style="width: 216px;">
|
143 |
-
<label for="galleryselect"><?php _e( 'Upload images in', 'flash-album-gallery' ); ?> *</label>
|
144 |
-
<select name="galleryselect" id="galleryselect" style="width: 200px">
|
145 |
-
<option value="0"><?php _e( 'Choose gallery', 'flash-album-gallery' ); ?></option>
|
146 |
-
<?php $ingallery = isset( $_GET['gid'] ) ? (int) $_GET['gid'] : '';
|
147 |
-
foreach ( $gallerylist as $gallery ) {
|
148 |
-
if ( ! flagAdmin::can_manage_this_gallery( $gallery->author ) ) {
|
149 |
-
continue;
|
150 |
-
}
|
151 |
-
$name = ( empty( $gallery->title ) ) ? $gallery->name : esc_html( stripslashes( $gallery->title ) );
|
152 |
-
if ( $flag->options['albSort'] == 'gid' ) {
|
153 |
-
$name = '#' . $gallery->gid . ' - ' . $name;
|
154 |
-
}
|
155 |
-
if ( $flag->options['albSort'] == 'title' ) {
|
156 |
-
$name = $name . ' (#' . $gallery->gid . ')';
|
157 |
-
}
|
158 |
-
$sel = ( $ingallery == $gallery->gid ) ? 'selected="selected" ' : '';
|
159 |
-
echo '<option ' . $sel . 'value="' . $gallery->gid . '" >' . $name . '</option>' . "\n";
|
160 |
-
} ?>
|
161 |
-
</select>
|
162 |
-
<?php echo $maxsize; ?>
|
163 |
-
<br/><?php if ( ( IS_WPMU ) && flagGallery::flag_wpmu_enable_function( 'wpmuQuotaCheck' ) ) {
|
164 |
-
display_space_usage();
|
165 |
-
} ?>
|
166 |
-
<br/>
|
167 |
-
|
168 |
-
<p><?php _e( 'Thumbnail WIDTH x HEIGHT (in pixel)', 'flash-album-gallery' ); ?> *
|
169 |
-
<br/><input type="number" size="5" maxlength="5" min="300" max="800" name="thumbWidth" id="thumbWidth" value="<?php echo $flag->options['thumbWidth']; ?>"/> x
|
170 |
-
<input type="number" size="5" maxlength="5" min="300" max="800" name="thumbHeight" id="thumbHeight" value="<?php echo $flag->options['thumbHeight']; ?>"/>
|
171 |
-
<br/>
|
172 |
-
<small><?php _e( 'These values are maximum values ', 'flash-album-gallery' ); ?></small>
|
173 |
-
</p>
|
174 |
-
|
175 |
-
<div class="submit">
|
176 |
-
<span class="useflashupload">
|
177 |
-
<?php if ( $flag->options['swfUpload'] ) { ?>
|
178 |
-
<input type="submit" class="button-secondary" name="disable_flash" id="disable_flash" title="<?php _e( 'The batch upload via Plupload, disable it if you have problems', 'flash-album-gallery' ); ?>" value="<?php _e( 'Switch to Browser Upload', 'flash-album-gallery' ); ?>"/>
|
179 |
-
<?php } else { ?>
|
180 |
-
<input type="submit" class="button-secondary" name="enable_flash" id="enable_flash" title="<?php _e( 'Upload multiple files at once by ctrl/shift-selecting in dialog', 'flash-album-gallery' ); ?>" value="<?php _e( 'Switch to Plupload based Upload', 'flash-album-gallery' ); ?>"/>
|
181 |
-
<?php } ?>
|
182 |
-
</span>
|
183 |
-
|
184 |
-
<div class="clear"></div>
|
185 |
-
</div>
|
186 |
-
|
187 |
-
</td>
|
188 |
-
|
189 |
-
<td>
|
190 |
-
<div id="pluploadUploader">
|
191 |
-
<?php if ( ! $flag->options['swfUpload']) { ?>
|
192 |
-
<strong><?php _e( 'Upload image(s):', 'flash-album-gallery' ); ?></strong><br>
|
193 |
-
<input type="file" name="imagefiles[]" id="imagefiles" size="35" class="imagefiles"/>
|
194 |
-
</div>
|
195 |
-
<span id="choosegalfirst">
|
196 |
-
<input class="button-primary" type="submit" name="uploadimage" id="uploadimage_btn" value="<?php _e( 'Upload images', 'flash-album-gallery' ); ?>"/>
|
197 |
-
<span class="disabledbut" style="display: none;"></span>
|
198 |
-
</span>
|
199 |
-
<?php } ?>
|
200 |
-
</td>
|
201 |
-
</tr>
|
202 |
-
</table>
|
203 |
-
<div id="pl-message"></div>
|
204 |
-
</form>
|
205 |
-
<?php if ( $flag->options['swfUpload'] ) {
|
206 |
-
$nonce = wp_create_nonce( 'flag_upload' );
|
207 |
-
?>
|
208 |
-
<script type="text/javascript">
|
209 |
-
// Convert divs to queue widgets when the DOM is ready
|
210 |
-
jQuery(function($){
|
211 |
-
var files_remaining = 0;
|
212 |
-
$("#pluploadUploader").plupload({
|
213 |
-
runtimes: 'html5,flash,html4',
|
214 |
-
url: '<?php echo str_replace( '&', '&', wp_nonce_url( admin_url('admin-ajax.php?action=plupload_uploader'), 'flag_upload' ) ); ?>',
|
215 |
-
multipart: true,
|
216 |
-
multipart_params: {postData: '', pluploadimage: 1},
|
217 |
-
max_file_size: '<?php echo (floor( wp_max_upload_size() * 0.99 / 1024 / 1024 ) - 1); ?>Mb',
|
218 |
-
unique_names: false,
|
219 |
-
rename: true,
|
220 |
-
chunk_size:
|
221 |
-
max_retries: 2,
|
222 |
-
sortable: true,
|
223 |
-
dragdrop: true,
|
224 |
-
views: {
|
225 |
-
list: true,
|
226 |
-
thumbs: true,
|
227 |
-
active: 'thumbs'
|
228 |
-
},
|
229 |
-
filters: [{title: "Images", extensions: "jpg,gif,png"}],
|
230 |
-
flash_swf_url: '<?php echo plugins_url( FLAGFOLDER. '/admin/js/plupload/plupload.flash.swf'); ?>'
|
231 |
-
|
232 |
-
});
|
233 |
-
|
234 |
-
var uploader = $("#pluploadUploader").plupload('getUploader');
|
235 |
-
uploader.bind('QueueChanged StateChanged', function(up){
|
236 |
-
if(up.state == plupload.QUEUED){
|
237 |
-
files_remaining = up.files.length;
|
238 |
-
}
|
239 |
-
if(up.state == plupload.STARTED){
|
240 |
-
up.settings.multipart_params = {
|
241 |
-
galleryselect: jQuery('#galleryselect').val(),
|
242 |
-
thumbw: jQuery('#thumbWidth').val(),
|
243 |
-
thumbh: jQuery('#thumbHeight').val(),
|
244 |
-
last: files_remaining,
|
245 |
-
action: 'flag_plupload_uploader',
|
246 |
-
_wpnonce: '<?php echo $nonce; ?>'
|
247 |
-
};
|
248 |
-
}
|
249 |
-
if($("#galleryselect").val() == 0){
|
250 |
-
$("#pluploadUploader_start").addClass('ui-button-disabled ui-state-disabled');
|
251 |
-
}
|
252 |
-
console.log('[StateChanged]', up.state, up.settings.multipart_params);
|
253 |
-
});
|
254 |
-
uploader.bind('ChunkUploaded', function(up, file, info){
|
255 |
-
console.log('[ChunkUploaded] File:', file, "Info:", info);
|
256 |
-
var response =
|
257 |
-
|
258 |
-
|
259 |
-
|
260 |
-
|
261 |
-
|
262 |
-
|
263 |
-
up.
|
264 |
-
|
265 |
-
|
266 |
-
|
267 |
-
|
268 |
-
|
269 |
-
|
270 |
-
|
271 |
-
|
272 |
-
|
273 |
-
|
274 |
-
|
275 |
-
|
276 |
-
|
277 |
-
|
278 |
-
|
279 |
-
|
280 |
-
|
281 |
-
|
282 |
-
|
283 |
-
|
284 |
-
|
285 |
-
|
286 |
-
|
287 |
-
|
288 |
-
|
289 |
-
|
290 |
-
|
291 |
-
});
|
292 |
-
|
293 |
-
|
294 |
-
|
295 |
-
|
296 |
-
|
297 |
-
|
298 |
-
|
299 |
-
|
300 |
-
|
301 |
-
|
302 |
-
|
303 |
-
|
304 |
-
|
305 |
-
|
306 |
-
|
307 |
-
|
308 |
-
|
309 |
-
|
310 |
-
|
311 |
-
|
312 |
-
|
313 |
-
|
314 |
-
|
315 |
-
|
316 |
-
|
317 |
-
|
318 |
-
|
319 |
-
|
320 |
-
|
321 |
-
|
322 |
-
|
323 |
-
|
324 |
-
|
325 |
-
|
326 |
-
|
327 |
-
|
328 |
-
|
329 |
-
|
330 |
-
|
331 |
-
|
332 |
-
|
333 |
-
|
334 |
-
|
335 |
-
|
336 |
-
|
337 |
-
|
338 |
-
|
339 |
-
|
340 |
-
|
341 |
-
|
342 |
-
|
343 |
-
|
344 |
-
|
345 |
-
|
346 |
-
|
347 |
-
|
348 |
-
|
349 |
-
|
350 |
-
|
351 |
-
|
352 |
-
|
353 |
-
|
354 |
-
|
355 |
-
|
356 |
-
|
357 |
-
|
358 |
-
|
359 |
-
|
360 |
-
|
361 |
-
|
362 |
-
|
363 |
-
|
364 |
-
|
365 |
-
|
366 |
-
|
367 |
-
|
368 |
-
|
369 |
-
|
370 |
-
|
371 |
-
|
372 |
-
|
373 |
-
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
if ( preg_match( '#' . basename( __FILE__ ) . '#', $_SERVER['PHP_SELF'] ) ) {
|
3 |
+
die( 'You are not allowed to call this page directly.' );
|
4 |
+
}
|
5 |
+
|
6 |
+
// sometimes a error feedback is better than a white screen
|
7 |
+
@ini_set( 'error_reporting', E_ALL ^ E_NOTICE );
|
8 |
+
|
9 |
+
function flag_admin_add_gallery() {
|
10 |
+
|
11 |
+
global $wpdb, $flagdb, $flag;
|
12 |
+
|
13 |
+
// same as $_SERVER['REQUEST_URI'], but should work under IIS 6.0
|
14 |
+
$filepath = admin_url() . 'admin.php?page=' . urlencode( $_GET['page'] );
|
15 |
+
|
16 |
+
// check for the max image size
|
17 |
+
$maxsize = flagGallery::check_memory_limit();
|
18 |
+
|
19 |
+
$defaultpath = $flag->options['galleryPath'];
|
20 |
+
|
21 |
+
if ( $_POST['addgallery'] ) {
|
22 |
+
check_admin_referer( 'flag_addgallery' );
|
23 |
+
$newgallery = trim( $_POST['galleryname'] );
|
24 |
+
if ( ! empty( $newgallery ) ) {
|
25 |
+
flagAdmin::create_gallery( $newgallery, $defaultpath );
|
26 |
+
}
|
27 |
+
}
|
28 |
+
if ( $_POST['uploadimage'] ) {
|
29 |
+
check_admin_referer( 'flag_upload' );
|
30 |
+
|
31 |
+
$flag->options['thumbWidth'] = intval( $_POST['thumbWidth'] ) ? intval( $_POST['thumbWidth'] ) : 300;
|
32 |
+
$flag->options['thumbHeight'] = intval( $_POST['thumbHeight'] ) ? intval( $_POST['thumbHeight'] ) : 300;
|
33 |
+
update_option( 'flag_options', $flag->options );
|
34 |
+
|
35 |
+
if ( $_FILES['MF__F_0_0']['error'] == 0 ) {
|
36 |
+
flagAdmin::upload_images();
|
37 |
+
} else {
|
38 |
+
flagGallery::show_error( __( 'Upload failed!', 'flash-album-gallery' ) );
|
39 |
+
}
|
40 |
+
}
|
41 |
+
if ( $_POST['importfolder'] ) {
|
42 |
+
check_admin_referer( 'flag_addgallery' );
|
43 |
+
$galleryfolder = $_POST['galleryfolder'];
|
44 |
+
if ( ( ! empty( $galleryfolder ) ) AND ( $defaultpath != $galleryfolder ) AND false === strpos( $galleryfolder, '..' ) ) {
|
45 |
+
flagAdmin::import_gallery( $galleryfolder );
|
46 |
+
}
|
47 |
+
}
|
48 |
+
|
49 |
+
|
50 |
+
if ( isset( $_POST['disable_flash'] ) ) {
|
51 |
+
check_admin_referer( 'flag_upload' );
|
52 |
+
$flag->options['swfUpload'] = false;
|
53 |
+
update_option( 'flag_options', $flag->options );
|
54 |
+
}
|
55 |
+
|
56 |
+
if ( isset( $_POST['enable_flash'] ) ) {
|
57 |
+
check_admin_referer( 'flag_upload' );
|
58 |
+
$flag->options['swfUpload'] = true;
|
59 |
+
update_option( 'flag_options', $flag->options );
|
60 |
+
}
|
61 |
+
|
62 |
+
//get all galleries (after we added new ones)
|
63 |
+
$gallerylist = $flagdb->find_all_galleries( $flag->options['albSort'], $flag->options['albSortDir'], false, 0, 0, 0, true );
|
64 |
+
|
65 |
+
?>
|
66 |
+
|
67 |
+
<?php if ( ! IS_WPMU || current_user_can( 'FlAG Import folder' ) ) { ?>
|
68 |
+
<link rel="stylesheet" type="text/css" href="<?php echo FLAG_URLPATH; ?>admin/js/jqueryFileTree/jqueryFileTree.css"/>
|
69 |
+
<script type="text/javascript" src="<?php echo FLAG_URLPATH; ?>admin/js/jqueryFileTree/jqueryFileTree.js"></script>
|
70 |
+
<script type="text/javascript">
|
71 |
+
/* <![CDATA[ */
|
72 |
+
jQuery(function(){
|
73 |
+
jQuery("span.browsefiles").show().click(function(){
|
74 |
+
jQuery("#file_browser").fileTree({
|
75 |
+
script: "admin-ajax.php?action=flag_file_browser&nonce=<?php echo wp_create_nonce( 'flag-ajax' ) ;?>",
|
76 |
+
root: jQuery("#galleryfolder").val()
|
77 |
+
}, function(file){
|
78 |
+
//var path = file.replace("<?php echo WINABSPATH; ?>", "");
|
79 |
+
jQuery("#galleryfolder").val(file);
|
80 |
+
});
|
81 |
+
|
82 |
+
jQuery("#file_browser").show("slide");
|
83 |
+
});
|
84 |
+
});
|
85 |
+
/* ]]> */
|
86 |
+
</script>
|
87 |
+
<?php }
|
88 |
+
if ( ! ( is_plugin_active( 'woowgallery/woowgallery.php' ) || ! empty( $flag->options['hide_woow'] ) ) ){
|
89 |
+
?>
|
90 |
+
<div class="promote-woowbox" style="padding-top:10px"><a href="https://bit.ly/flag-woowgallery" target="_blank"><img src="<?php echo plugins_url('/flash-album-gallery/admin/images/woowbox-promote.png') ?>" alt="Try WoowGallery plugin" /></a></div>
|
91 |
+
<?php
|
92 |
+
}
|
93 |
+
?>
|
94 |
+
<div id="slider" class="flag-wrap">
|
95 |
+
|
96 |
+
<ul id="tabs" class="tabs">
|
97 |
+
<li class="selected"><a href="#" rel="addgallery"><?php _e( 'Add new gallery', 'flash-album-gallery' ); ?></a></li>
|
98 |
+
<li><a href="#" rel="uploadimage"><?php _e( 'Upload Images', 'flash-album-gallery' ); ?></a></li>
|
99 |
+
<?php if ( ! IS_WPMU || current_user_can( 'FlAG Import folder' ) ) { ?>
|
100 |
+
<li><a href="#" rel="importfolder"><?php _e( 'Import image folder', 'flash-album-gallery' ); ?></a></li>
|
101 |
+
<?php } ?>
|
102 |
+
</ul>
|
103 |
+
|
104 |
+
<!-- create gallery -->
|
105 |
+
<div id="addgallery" class="cptab">
|
106 |
+
<h2><?php _e( 'Create a new gallery', 'flash-album-gallery' ); ?></h2>
|
107 |
+
|
108 |
+
<form name="addgallery" id="addgallery_form" method="POST" action="<?php echo $filepath; ?>" accept-charset="utf-8">
|
109 |
+
<?php wp_nonce_field( 'flag_addgallery' ); ?>
|
110 |
+
<table class="form-table" style="width: auto;">
|
111 |
+
<tr>
|
112 |
+
<th scope="col" colspan="2" style="padding-bottom: 0;">
|
113 |
+
<strong><?php _e( 'New Gallery', 'flash-album-gallery' ); ?></strong></th>
|
114 |
+
</tr>
|
115 |
+
<tr valign="top">
|
116 |
+
<td><input type="text" size="65" name="galleryname" value=""/><br/>
|
117 |
+
<?php if ( ! IS_WPMU ) { ?>
|
118 |
+
<?php _e( 'Create a new , empty gallery below the folder', 'flash-album-gallery' ); ?>
|
119 |
+
<strong><?php echo $defaultpath; ?></strong><br/>
|
120 |
+
<?php } ?>
|
121 |
+
<i>( <?php _e( 'Allowed characters for file and folder names are', 'flash-album-gallery' ); ?>: a-z, A-Z, 0-9, -, _ )</i>
|
122 |
+
</td>
|
123 |
+
<?php do_action( 'flag_add_new_gallery_form' ); ?>
|
124 |
+
<td style="vertical-align:top;">
|
125 |
+
<div class="submit" style="margin: 0; padding: 0;">
|
126 |
+
<input class="button-primary" type="submit" name="addgallery" value="<?php _e( 'Add gallery', 'flash-album-gallery' ); ?>"/>
|
127 |
+
</div>
|
128 |
+
</td>
|
129 |
+
</tr>
|
130 |
+
</table>
|
131 |
+
<p> </p>
|
132 |
+
</form>
|
133 |
+
</div>
|
134 |
+
<!-- upload images -->
|
135 |
+
<div id="uploadimage" class="cptab">
|
136 |
+
<h2><?php _e( 'Upload images', 'flash-album-gallery' ); ?></h2>
|
137 |
+
|
138 |
+
<form name="uploadimage" id="gmUpload" method="POST" enctype="multipart/form-data" action="<?php echo $filepath; ?>" accept-charset="utf-8">
|
139 |
+
<?php wp_nonce_field( 'flag_upload' ); ?>
|
140 |
+
<table class="flag-form-table">
|
141 |
+
<tr valign="top">
|
142 |
+
<td style="width: 216px;">
|
143 |
+
<label for="galleryselect"><?php _e( 'Upload images in', 'flash-album-gallery' ); ?> *</label>
|
144 |
+
<select name="galleryselect" id="galleryselect" style="width: 200px">
|
145 |
+
<option value="0"><?php _e( 'Choose gallery', 'flash-album-gallery' ); ?></option>
|
146 |
+
<?php $ingallery = isset( $_GET['gid'] ) ? (int) $_GET['gid'] : '';
|
147 |
+
foreach ( $gallerylist as $gallery ) {
|
148 |
+
if ( ! flagAdmin::can_manage_this_gallery( $gallery->author ) ) {
|
149 |
+
continue;
|
150 |
+
}
|
151 |
+
$name = ( empty( $gallery->title ) ) ? $gallery->name : esc_html( stripslashes( $gallery->title ) );
|
152 |
+
if ( $flag->options['albSort'] == 'gid' ) {
|
153 |
+
$name = '#' . $gallery->gid . ' - ' . $name;
|
154 |
+
}
|
155 |
+
if ( $flag->options['albSort'] == 'title' ) {
|
156 |
+
$name = $name . ' (#' . $gallery->gid . ')';
|
157 |
+
}
|
158 |
+
$sel = ( $ingallery == $gallery->gid ) ? 'selected="selected" ' : '';
|
159 |
+
echo '<option ' . $sel . 'value="' . $gallery->gid . '" >' . $name . '</option>' . "\n";
|
160 |
+
} ?>
|
161 |
+
</select>
|
162 |
+
<?php echo $maxsize; ?>
|
163 |
+
<br/><?php if ( ( IS_WPMU ) && flagGallery::flag_wpmu_enable_function( 'wpmuQuotaCheck' ) ) {
|
164 |
+
display_space_usage();
|
165 |
+
} ?>
|
166 |
+
<br/>
|
167 |
+
|
168 |
+
<p><?php _e( 'Thumbnail WIDTH x HEIGHT (in pixel)', 'flash-album-gallery' ); ?> *
|
169 |
+
<br/><input type="number" size="5" maxlength="5" min="300" max="800" name="thumbWidth" id="thumbWidth" value="<?php echo $flag->options['thumbWidth']; ?>"/> x
|
170 |
+
<input type="number" size="5" maxlength="5" min="300" max="800" name="thumbHeight" id="thumbHeight" value="<?php echo $flag->options['thumbHeight']; ?>"/>
|
171 |
+
<br/>
|
172 |
+
<small><?php _e( 'These values are maximum values ', 'flash-album-gallery' ); ?></small>
|
173 |
+
</p>
|
174 |
+
|
175 |
+
<div class="submit">
|
176 |
+
<span class="useflashupload">
|
177 |
+
<?php if ( $flag->options['swfUpload'] ) { ?>
|
178 |
+
<input type="submit" class="button-secondary" name="disable_flash" id="disable_flash" title="<?php _e( 'The batch upload via Plupload, disable it if you have problems', 'flash-album-gallery' ); ?>" value="<?php _e( 'Switch to Browser Upload', 'flash-album-gallery' ); ?>"/>
|
179 |
+
<?php } else { ?>
|
180 |
+
<input type="submit" class="button-secondary" name="enable_flash" id="enable_flash" title="<?php _e( 'Upload multiple files at once by ctrl/shift-selecting in dialog', 'flash-album-gallery' ); ?>" value="<?php _e( 'Switch to Plupload based Upload', 'flash-album-gallery' ); ?>"/>
|
181 |
+
<?php } ?>
|
182 |
+
</span>
|
183 |
+
|
184 |
+
<div class="clear"></div>
|
185 |
+
</div>
|
186 |
+
|
187 |
+
</td>
|
188 |
+
|
189 |
+
<td>
|
190 |
+
<div id="pluploadUploader">
|
191 |
+
<?php if ( ! $flag->options['swfUpload']) { ?>
|
192 |
+
<strong><?php _e( 'Upload image(s):', 'flash-album-gallery' ); ?></strong><br>
|
193 |
+
<input type="file" name="imagefiles[]" id="imagefiles" size="35" class="imagefiles"/>
|
194 |
+
</div>
|
195 |
+
<span id="choosegalfirst">
|
196 |
+
<input class="button-primary" type="submit" name="uploadimage" id="uploadimage_btn" value="<?php _e( 'Upload images', 'flash-album-gallery' ); ?>"/>
|
197 |
+
<span class="disabledbut" style="display: none;"></span>
|
198 |
+
</span>
|
199 |
+
<?php } ?>
|
200 |
+
</td>
|
201 |
+
</tr>
|
202 |
+
</table>
|
203 |
+
<div id="pl-message"></div>
|
204 |
+
</form>
|
205 |
+
<?php if ( $flag->options['swfUpload'] ) {
|
206 |
+
$nonce = wp_create_nonce( 'flag_upload' );
|
207 |
+
?>
|
208 |
+
<script type="text/javascript">
|
209 |
+
// Convert divs to queue widgets when the DOM is ready
|
210 |
+
jQuery(function($){
|
211 |
+
var files_remaining = 0;
|
212 |
+
$("#pluploadUploader").plupload({
|
213 |
+
runtimes: 'html5,flash,html4',
|
214 |
+
url: '<?php echo str_replace( '&', '&', wp_nonce_url( admin_url('admin-ajax.php?action=plupload_uploader'), 'flag_upload' ) ); ?>',
|
215 |
+
multipart: true,
|
216 |
+
multipart_params: {postData: '', pluploadimage: 1},
|
217 |
+
max_file_size: '<?php echo (floor( wp_max_upload_size() * 0.99 / 1024 / 1024 ) - 1); ?>Mb',
|
218 |
+
unique_names: false,
|
219 |
+
rename: true,
|
220 |
+
chunk_size: 0,
|
221 |
+
max_retries: 2,
|
222 |
+
sortable: true,
|
223 |
+
dragdrop: true,
|
224 |
+
views: {
|
225 |
+
list: true,
|
226 |
+
thumbs: true,
|
227 |
+
active: 'thumbs'
|
228 |
+
},
|
229 |
+
filters: [{title: "Images", extensions: "jpeg,jpg,gif,png"}],
|
230 |
+
flash_swf_url: '<?php echo plugins_url( FLAGFOLDER. '/admin/js/plupload/plupload.flash.swf'); ?>'
|
231 |
+
|
232 |
+
});
|
233 |
+
|
234 |
+
var uploader = $("#pluploadUploader").plupload('getUploader');
|
235 |
+
uploader.bind('QueueChanged StateChanged', function(up){
|
236 |
+
if(up.state == plupload.QUEUED){
|
237 |
+
files_remaining = up.files.length;
|
238 |
+
}
|
239 |
+
if(up.state == plupload.STARTED){
|
240 |
+
up.settings.multipart_params = {
|
241 |
+
galleryselect: jQuery('#galleryselect').val(),
|
242 |
+
thumbw: jQuery('#thumbWidth').val(),
|
243 |
+
thumbh: jQuery('#thumbHeight').val(),
|
244 |
+
last: files_remaining,
|
245 |
+
action: 'flag_plupload_uploader',
|
246 |
+
_wpnonce: '<?php echo $nonce; ?>'
|
247 |
+
};
|
248 |
+
}
|
249 |
+
if($("#galleryselect").val() == 0){
|
250 |
+
$("#pluploadUploader_start").addClass('ui-button-disabled ui-state-disabled');
|
251 |
+
}
|
252 |
+
console.log('[StateChanged]', up.state, up.settings.multipart_params);
|
253 |
+
});
|
254 |
+
uploader.bind('ChunkUploaded', function(up, file, info){
|
255 |
+
console.log('[ChunkUploaded] File:', file, "Info:", info);
|
256 |
+
var response = {};
|
257 |
+
try {
|
258 |
+
response = jQuery.parseJSON(info.response);
|
259 |
+
} catch(e) {
|
260 |
+
response.error = info.response;
|
261 |
+
}
|
262 |
+
if(response && response.error){
|
263 |
+
up.stop();
|
264 |
+
file.status = plupload.FAILED;
|
265 |
+
jQuery('<div/>').addClass('error').html('<span><u><em>' + file.name + ':</em></u> ' + response.error + '</span>').appendTo('#pl-message');
|
266 |
+
console.log(response.error);
|
267 |
+
up.trigger('QueueChanged StateChanged');
|
268 |
+
up.trigger('UploadProgress', file);
|
269 |
+
up.start();
|
270 |
+
}
|
271 |
+
});
|
272 |
+
uploader.bind('FileUploaded', function(up, file, info){
|
273 |
+
console.log('[FileUploaded] File:', file, "Info:", info);
|
274 |
+
files_remaining--;
|
275 |
+
if(info.response){
|
276 |
+
file.status = plupload.FAILED;
|
277 |
+
jQuery('<div/>').addClass('error').html('<span><u><em>' + file.name + ':</em></u> ' + info.response + '</span>').appendTo('#pl-message');
|
278 |
+
}
|
279 |
+
});
|
280 |
+
uploader.bind('UploadProgress', function(up, file){
|
281 |
+
var percent = uploader.total.percent;
|
282 |
+
$('#total-progress-info .progress-bar').css('width', percent + "%").attr('aria-valuenow', percent);
|
283 |
+
});
|
284 |
+
uploader.bind('Error', function(up, args){
|
285 |
+
jQuery('<div/>').addClass('error').html('<span><u><em>' + args.file.name + ':</em></u> ' + args.message + ' ' + args.status + '</span>').appendTo('#pl-message');
|
286 |
+
console.log('[error] ', args);
|
287 |
+
});
|
288 |
+
uploader.bind('UploadComplete', function(up, files){
|
289 |
+
console.log('[UploadComplete]', files);
|
290 |
+
jQuery('<div/>').addClass('success').html('<?php _e('Done!', 'flash-album-gallery'); ?> <a href="<?php echo wp_nonce_url( $flag->manage_page->base_page . "&mode=edit", 'flag_editgallery'); ?>&gid=' + jQuery("#galleryselect").val() + '">Open Gallery</a>').appendTo('#pl-message');
|
291 |
+
});
|
292 |
+
|
293 |
+
jQuery("#gmUpload").on('click', '.ui-button-disabled', function(e){
|
294 |
+
if(files_remaining){
|
295 |
+
alert("Choose gallery, please.")
|
296 |
+
}
|
297 |
+
});
|
298 |
+
jQuery("#galleryselect").change(function(){
|
299 |
+
if(jQuery(this).val() == 0){
|
300 |
+
jQuery("#pluploadUploader_start").addClass('ui-button-disabled ui-state-disabled');
|
301 |
+
} else{
|
302 |
+
if(files_remaining){
|
303 |
+
jQuery("#pluploadUploader_start").removeClass('ui-button-disabled ui-state-disabled');
|
304 |
+
}
|
305 |
+
}
|
306 |
+
});
|
307 |
+
|
308 |
+
});
|
309 |
+
</script>
|
310 |
+
<?php } else { ?>
|
311 |
+
<!-- MultiFile script -->
|
312 |
+
<script type="text/javascript">
|
313 |
+
/* <![CDATA[ */
|
314 |
+
jQuery(document).ready(function(){
|
315 |
+
jQuery('#imagefiles').MultiFile({
|
316 |
+
STRING: {
|
317 |
+
remove: '<?php _e('remove', 'flash-album-gallery'); ?>'
|
318 |
+
}
|
319 |
+
});
|
320 |
+
|
321 |
+
if(jQuery("#galleryselect").val() == 0){
|
322 |
+
jQuery("#choosegalfirst").animate({opacity: "0.5"}, 600);
|
323 |
+
jQuery("#choosegalfirst .disabledbut").show();
|
324 |
+
}
|
325 |
+
jQuery("#choosegalfirst .disabledbut").click(function(){
|
326 |
+
alert("Choose gallery, please.")
|
327 |
+
});
|
328 |
+
jQuery("#galleryselect").change(function(){
|
329 |
+
if(jQuery(this).val() == 0){
|
330 |
+
jQuery("#choosegalfirst .disabledbut").show();
|
331 |
+
jQuery("#choosegalfirst").animate({opacity: "0.5"}, 600);
|
332 |
+
} else{
|
333 |
+
jQuery("#choosegalfirst .disabledbut").hide();
|
334 |
+
jQuery("#choosegalfirst").animate({opacity: "1"}, 600);
|
335 |
+
}
|
336 |
+
});
|
337 |
+
});
|
338 |
+
/* ]]> */
|
339 |
+
</script>
|
340 |
+
|
341 |
+
<?php } ?>
|
342 |
+
</div>
|
343 |
+
<?php if ( ! IS_WPMU || current_user_can( 'FlAG Import folder' ) ) { ?>
|
344 |
+
<!-- import folder -->
|
345 |
+
<div id="importfolder" class="cptab">
|
346 |
+
<h2><?php _e( 'Import image folder', 'flash-album-gallery' ); ?></h2>
|
347 |
+
|
348 |
+
<form name="importfolder" id="importfolder_form" method="POST" action="<?php echo $filepath; ?>" accept-charset="utf-8">
|
349 |
+
<?php wp_nonce_field( 'flag_addgallery' ); ?>
|
350 |
+
<table class="form-table">
|
351 |
+
<tr valign="top">
|
352 |
+
<th scope="row"><?php _e( 'Import from Server path:', 'flash-album-gallery' ); ?></th>
|
353 |
+
<td>
|
354 |
+
<input type="text" size="35" id="galleryfolder" name="galleryfolder" value="<?php echo $defaultpath; ?>"/><span class="browsefiles button" style="display:none"><?php _e( 'Browse...', "flash-album-gallery" ); ?></span>
|
355 |
+
|
356 |
+
<div id="file_browser"></div>
|
357 |
+
<div><?php echo $maxsize; ?>
|
358 |
+
<?php if ( FLAG_SAFE_MODE ) { ?>
|
359 |
+
<br/><?php _e( ' Please note : For safe-mode = ON you need to add the subfolder thumbs manually', 'flash-album-gallery' ); ?><?php }; ?>
|
360 |
+
</div>
|
361 |
+
</td>
|
362 |
+
</tr>
|
363 |
+
</table>
|
364 |
+
<div class="submit">
|
365 |
+
<input class="button-primary" type="submit" name="importfolder" value="<?php _e( 'Import folder', 'flash-album-gallery' ); ?>"/>
|
366 |
+
</div>
|
367 |
+
</form>
|
368 |
+
</div>
|
369 |
+
<?php } ?>
|
370 |
+
|
371 |
+
<script type="text/javascript">
|
372 |
+
var cptabs = new ddtabcontent("tabs");
|
373 |
+
cptabs.setpersist(true);
|
374 |
+
cptabs.setselectedClassTarget("linkparent");
|
375 |
+
cptabs.init();
|
376 |
+
</script>
|
377 |
+
</div>
|
378 |
+
<?php
|
379 |
+
}
|
admin/admin.php
CHANGED
@@ -1,438 +1,395 @@
|
|
1 |
-
<?php
|
2 |
-
|
3 |
-
/**
|
4 |
-
* flagAdminPanel - Admin Section for FlaGallery
|
5 |
-
*
|
6 |
-
*/
|
7 |
-
class flagAdminPanel {
|
8 |
-
|
9 |
-
// constructor
|
10 |
-
function __construct() {
|
11 |
-
|
12 |
-
// Add the admin menu
|
13 |
-
add_action( 'admin_menu',
|
14 |
-
add_action( 'init',
|
15 |
-
|
16 |
-
|
17 |
-
|
18 |
-
|
19 |
-
// Add the script and style files
|
20 |
-
add_action( 'admin_print_scripts',
|
21 |
-
add_action( 'admin_print_styles',
|
22 |
-
|
23 |
-
|
24 |
-
|
25 |
-
add_filter( '
|
26 |
-
|
27 |
-
|
28 |
-
|
29 |
-
|
30 |
-
|
31 |
-
|
32 |
-
|
33 |
-
|
34 |
-
|
35 |
-
|
36 |
-
|
37 |
-
|
38 |
-
|
39 |
-
|
40 |
-
|
41 |
-
|
42 |
-
|
43 |
-
|
44 |
-
|
45 |
-
|
46 |
-
|
47 |
-
|
48 |
-
|
49 |
-
|
50 |
-
|
51 |
-
|
52 |
-
|
53 |
-
|
54 |
-
|
55 |
-
|
56 |
-
|
57 |
-
|
58 |
-
|
59 |
-
|
60 |
-
|
61 |
-
|
62 |
-
|
63 |
-
|
64 |
-
|
65 |
-
|
66 |
-
|
67 |
-
|
68 |
-
|
69 |
-
|
70 |
-
|
71 |
-
|
72 |
-
|
73 |
-
|
74 |
-
|
75 |
-
|
76 |
-
|
77 |
-
|
78 |
-
|
79 |
-
|
80 |
-
|
81 |
-
|
82 |
-
|
83 |
-
|
84 |
-
|
85 |
-
)
|
86 |
-
|
87 |
-
|
88 |
-
|
89 |
-
) )
|
90 |
-
|
91 |
-
|
92 |
-
|
93 |
-
) )
|
94 |
-
|
95 |
-
|
96 |
-
|
97 |
-
) )
|
98 |
-
|
99 |
-
|
100 |
-
|
101 |
-
|
102 |
-
|
103 |
-
|
104 |
-
'
|
105 |
-
|
106 |
-
|
107 |
-
|
108 |
-
|
109 |
-
) )
|
110 |
-
|
111 |
-
|
112 |
-
|
113 |
-
|
114 |
-
|
115 |
-
|
116 |
-
|
117 |
-
|
118 |
-
|
119 |
-
|
120 |
-
|
121 |
-
|
122 |
-
|
123 |
-
|
124 |
-
|
125 |
-
|
126 |
-
|
127 |
-
|
128 |
-
|
129 |
-
|
130 |
-
|
131 |
-
|
132 |
-
|
133 |
-
|
134 |
-
|
135 |
-
|
136 |
-
|
137 |
-
|
138 |
-
|
139 |
-
|
140 |
-
|
141 |
-
|
142 |
-
|
143 |
-
|
144 |
-
|
145 |
-
|
146 |
-
|
147 |
-
|
148 |
-
|
149 |
-
|
150 |
-
|
151 |
-
|
152 |
-
|
153 |
-
|
154 |
-
|
155 |
-
|
156 |
-
|
157 |
-
|
158 |
-
|
159 |
-
|
160 |
-
|
161 |
-
|
162 |
-
|
163 |
-
|
164 |
-
|
165 |
-
|
166 |
-
|
167 |
-
|
168 |
-
|
169 |
-
|
170 |
-
|
171 |
-
|
172 |
-
|
173 |
-
|
174 |
-
|
175 |
-
|
176 |
-
|
177 |
-
|
178 |
-
|
179 |
-
|
180 |
-
|
181 |
-
|
182 |
-
|
183 |
-
|
184 |
-
|
185 |
-
|
186 |
-
|
187 |
-
|
188 |
-
|
189 |
-
|
190 |
-
|
191 |
-
|
192 |
-
|
193 |
-
|
194 |
-
|
195 |
-
|
196 |
-
|
197 |
-
|
198 |
-
|
199 |
-
|
200 |
-
|
201 |
-
|
202 |
-
|
203 |
-
|
204 |
-
|
205 |
-
|
206 |
-
|
207 |
-
|
208 |
-
|
209 |
-
|
210 |
-
|
211 |
-
|
212 |
-
|
213 |
-
|
214 |
-
|
215 |
-
|
216 |
-
|
217 |
-
|
218 |
-
|
219 |
-
$
|
220 |
-
'
|
221 |
-
|
222 |
-
|
223 |
-
|
224 |
-
|
225 |
-
|
226 |
-
|
227 |
-
|
228 |
-
|
229 |
-
|
230 |
-
|
231 |
-
|
232 |
-
|
233 |
-
|
234 |
-
|
235 |
-
|
236 |
-
|
237 |
-
|
238 |
-
|
239 |
-
|
240 |
-
|
241 |
-
|
242 |
-
'
|
243 |
-
'
|
244 |
-
'
|
245 |
-
'
|
246 |
-
'
|
247 |
-
'
|
248 |
-
'
|
249 |
-
|
250 |
-
|
251 |
-
|
252 |
-
|
253 |
-
|
254 |
-
|
255 |
-
|
256 |
-
|
257 |
-
|
258 |
-
|
259 |
-
|
260 |
-
|
261 |
-
|
262 |
-
|
263 |
-
|
264 |
-
|
265 |
-
|
266 |
-
|
267 |
-
|
268 |
-
'jquery
|
269 |
-
|
270 |
-
|
271 |
-
|
272 |
-
|
273 |
-
|
274 |
-
'
|
275 |
-
|
276 |
-
|
277 |
-
|
278 |
-
|
279 |
-
wp_enqueue_script( '
|
280 |
-
wp_enqueue_script( '
|
281 |
-
wp_enqueue_script( 'flag-
|
282 |
-
|
283 |
-
|
284 |
-
|
285 |
-
|
286 |
-
wp_enqueue_script( '
|
287 |
-
|
288 |
-
|
289 |
-
|
290 |
-
wp_enqueue_script( '
|
291 |
-
|
292 |
-
|
293 |
-
|
294 |
-
|
295 |
-
|
296 |
-
|
297 |
-
|
298 |
-
|
299 |
-
|
300 |
-
|
301 |
-
|
302 |
-
|
303 |
-
|
304 |
-
|
305 |
-
|
306 |
-
|
307 |
-
|
308 |
-
|
309 |
-
|
310 |
-
|
311 |
-
|
312 |
-
|
313 |
-
|
314 |
-
case
|
315 |
-
|
316 |
-
|
317 |
-
|
318 |
-
case "flag-
|
319 |
-
case "flag-
|
320 |
-
wp_enqueue_style( '
|
321 |
-
|
322 |
-
|
323 |
-
case "flag-
|
324 |
-
wp_enqueue_style( 'thickbox' );
|
325 |
-
wp_enqueue_style( '
|
326 |
-
|
327 |
-
|
328 |
-
|
329 |
-
|
330 |
-
|
331 |
-
|
332 |
-
|
333 |
-
|
334 |
-
|
335 |
-
|
336 |
-
|
337 |
-
|
338 |
-
|
339 |
-
|
340 |
-
|
341 |
-
|
342 |
-
|
343 |
-
case "
|
344 |
-
|
345 |
-
|
346 |
-
|
347 |
-
|
348 |
-
|
349 |
-
|
350 |
-
|
351 |
-
|
352 |
-
|
353 |
-
|
354 |
-
|
355 |
-
|
356 |
-
|
357 |
-
|
358 |
-
|
359 |
-
|
360 |
-
|
361 |
-
|
362 |
-
|
363 |
-
|
364 |
-
|
365 |
-
|
366 |
-
|
367 |
-
|
368 |
-
|
369 |
-
|
370 |
-
|
371 |
-
|
372 |
-
|
373 |
-
|
374 |
-
|
375 |
-
|
376 |
-
|
377 |
-
|
378 |
-
|
379 |
-
|
380 |
-
|
381 |
-
|
382 |
-
|
383 |
-
|
384 |
-
|
385 |
-
|
386 |
-
|
387 |
-
|
388 |
-
|
389 |
-
|
390 |
-
|
391 |
-
|
392 |
-
|
393 |
-
|
394 |
-
|
395 |
-
|
396 |
-
|
397 |
-
$_wp_column_headers[ $screen ] = $columns;
|
398 |
-
}
|
399 |
-
|
400 |
-
function register_columns() {
|
401 |
-
include_once( dirname( __FILE__ ) . '/manage-images.php' );
|
402 |
-
$this->register_column_headers( 'flag-manage-images', flag_manage_gallery_columns() );
|
403 |
-
}
|
404 |
-
|
405 |
-
function wp_flag_ins_button() {
|
406 |
-
|
407 |
-
if( strpos($_SERVER['REQUEST_URI'], 'post.php')
|
408 |
-
|| strstr($_SERVER['PHP_SELF'], 'page-new.php')
|
409 |
-
|| strstr($_SERVER['PHP_SELF'], 'page.php')
|
410 |
-
|| strstr($_SERVER['PHP_SELF'], 'post-new.php') )
|
411 |
-
{
|
412 |
-
?>
|
413 |
-
<script type="text/javascript">
|
414 |
-
<!--
|
415 |
-
function bind_resize() {
|
416 |
-
if(!window.flag_bind_resize){
|
417 |
-
jQuery(window).bind("resize", tb_position);
|
418 |
-
}
|
419 |
-
window.flag_bind_resize = true;
|
420 |
-
}
|
421 |
-
//-->
|
422 |
-
</script>
|
423 |
-
<?php
|
424 |
-
}
|
425 |
-
}
|
426 |
-
|
427 |
-
}
|
428 |
-
|
429 |
-
function flag_wpmu_site_admin() {
|
430 |
-
// Check for site admin
|
431 |
-
if ( function_exists( 'is_site_admin' ) ) {
|
432 |
-
if ( is_super_admin() ) {
|
433 |
-
return true;
|
434 |
-
}
|
435 |
-
}
|
436 |
-
|
437 |
-
return false;
|
438 |
-
}
|
1 |
+
<?php
|
2 |
+
|
3 |
+
/**
|
4 |
+
* flagAdminPanel - Admin Section for FlaGallery
|
5 |
+
*
|
6 |
+
*/
|
7 |
+
class flagAdminPanel {
|
8 |
+
|
9 |
+
// constructor
|
10 |
+
function __construct() {
|
11 |
+
|
12 |
+
// Add the admin menu
|
13 |
+
add_action( 'admin_menu', [ &$this, 'add_menu' ] );
|
14 |
+
add_action( 'init', [ &$this, 'wp_flag_check_options' ], 2 );
|
15 |
+
|
16 |
+
// Add the script and style files
|
17 |
+
add_action( 'admin_enqueue_scripts', [ &$this, 'enqueue_scripts' ], 20 );
|
18 |
+
|
19 |
+
// Add the script and style files
|
20 |
+
add_action( 'admin_print_scripts', [ &$this, 'load_scripts' ] );
|
21 |
+
add_action( 'admin_print_styles', [ &$this, 'load_styles' ] );
|
22 |
+
|
23 |
+
add_filter( 'screen_meta_screen', [ &$this, 'edit_screen_meta' ] );
|
24 |
+
|
25 |
+
add_filter( 'admin_head', [ &$this, 'wp_flag_ins_button' ], 5 );
|
26 |
+
}
|
27 |
+
|
28 |
+
function wp_flag_check_options() {
|
29 |
+
global $flag;
|
30 |
+
require_once( dirname( __FILE__ ) . '/flag_install.php' );
|
31 |
+
|
32 |
+
if ( isset( $_GET['page'] ) && 'flag-overview' === $_GET['page'] && isset( $_POST['uninstall'] ) ) {
|
33 |
+
check_admin_referer( 'flag_uninstall' );
|
34 |
+
flag_uninstall();
|
35 |
+
}
|
36 |
+
|
37 |
+
|
38 |
+
$default_options = flag_list_options();
|
39 |
+
$flag_db_options = get_option( 'flag_options' );
|
40 |
+
if ( $flag_db_options ) {
|
41 |
+
if ( function_exists( 'array_diff_key' ) ) {
|
42 |
+
$flag_new_options = array_diff_key( $default_options, $flag_db_options );
|
43 |
+
} else {
|
44 |
+
$flag_new_options = $this->PHP4_array_diff_key( $default_options, $flag_db_options );
|
45 |
+
}
|
46 |
+
$flag_options = array_merge( $flag_db_options, $flag_new_options );
|
47 |
+
update_option( 'flag_options', $flag_options );
|
48 |
+
} else {
|
49 |
+
update_option( 'flag_options', $default_options );
|
50 |
+
}
|
51 |
+
}
|
52 |
+
|
53 |
+
function PHP4_array_diff_key() {
|
54 |
+
$arrs = func_get_args();
|
55 |
+
$result = array_shift( $arrs );
|
56 |
+
foreach ( $arrs as $array ) {
|
57 |
+
foreach ( $result as $key => $v ) {
|
58 |
+
if ( array_key_exists( $key, $array ) ) {
|
59 |
+
unset( $result[ $key ] );
|
60 |
+
}
|
61 |
+
}
|
62 |
+
}
|
63 |
+
|
64 |
+
return $result;
|
65 |
+
}
|
66 |
+
|
67 |
+
// integrate the menu
|
68 |
+
function add_menu() {
|
69 |
+
|
70 |
+
$count = '';
|
71 |
+
$flag_options = get_option( 'flag_options' );
|
72 |
+
if ( current_user_can( 'FlAG Add skins' ) ) {
|
73 |
+
|
74 |
+
$update_skins = ! empty( $flag_options['update_skins'] ) ? count( $flag_options['update_skins'] ) : 0;
|
75 |
+
$new_skins = ! empty( $flag_options['new_skins'] ) ? count( $flag_options['new_skins'] ) : 0;
|
76 |
+
|
77 |
+
if ( $update_skins ) {
|
78 |
+
$count .= " <span class='update-plugins count-{$update_skins}' style='background-color: #bb391b;'><span class='plugin-count flag-skins-count flag-skins-update-count' title='" . __( 'Skins Updates', 'flash-album-gallery' ) . "'>{$update_skins}</span></span>";
|
79 |
+
}
|
80 |
+
if ( $new_skins ) {
|
81 |
+
$count .= " <span class='update-plugins count-{$new_skins}' style='background-color: #367236;'><span class='plugin-count flag-skins-count flag-skins-new-count' title='" . __( 'New Skins', 'flash-album-gallery' ) . "'>{$new_skins}</span></span>";
|
82 |
+
}
|
83 |
+
}
|
84 |
+
|
85 |
+
add_menu_page( __( 'GRAND FlaGallery overview', 'flash-album-gallery' ), "FlAGallery$count", 'FlAG overview', 'flag-overview', [
|
86 |
+
&$this,
|
87 |
+
'show_menu',
|
88 |
+
], FLAG_URLPATH . 'admin/images/flag.png' );
|
89 |
+
add_submenu_page( 'flag-overview', __( 'GRAND FlaGallery overview', 'flash-album-gallery' ), __( 'Overview', 'flash-album-gallery' ), 'FlAG overview', 'flag-overview', [
|
90 |
+
&$this,
|
91 |
+
'show_menu',
|
92 |
+
] );
|
93 |
+
add_submenu_page( 'flag-overview', __( 'FlAG Manage gallery', 'flash-album-gallery' ), __( 'Manage Galleries', 'flash-album-gallery' ), 'FlAG Manage gallery', 'flag-manage-gallery', [
|
94 |
+
&$this,
|
95 |
+
'show_menu',
|
96 |
+
] );
|
97 |
+
if ( ! empty( $flag_options['show_music_box'] ) ) {
|
98 |
+
add_submenu_page( 'flag-overview', __( 'FlAG Music Box', 'flash-album-gallery' ), __( 'Music Box', 'flash-album-gallery' ), 'FlAG Manage music', 'flag-music-box', [
|
99 |
+
&$this,
|
100 |
+
'show_menu',
|
101 |
+
] );
|
102 |
+
}
|
103 |
+
if ( ! empty( $flag_options['show_video_box'] ) ) {
|
104 |
+
add_submenu_page( 'flag-overview', __( 'FlAG Video Box', 'flash-album-gallery' ), __( 'Video Box', 'flash-album-gallery' ), 'FlAG Manage video', 'flag-video-box', [
|
105 |
+
&$this,
|
106 |
+
'show_menu',
|
107 |
+
] );
|
108 |
+
}
|
109 |
+
if ( ! empty( $flag_options['show_banner_box'] ) ) {
|
110 |
+
add_submenu_page( 'flag-overview', __( 'FlAG Banner Box', 'flash-album-gallery' ), __( 'Banner Box', 'flash-album-gallery' ), 'FlAG Manage banners', 'flag-banner-box', [
|
111 |
+
&$this,
|
112 |
+
'show_menu',
|
113 |
+
] );
|
114 |
+
}
|
115 |
+
add_submenu_page( 'flag-overview', __( 'FlAG Manage skins', 'flash-album-gallery' ), __( 'Skins', 'flash-album-gallery' ) . $count, 'FlAG Change skin', 'flag-skins', [
|
116 |
+
&$this,
|
117 |
+
'show_menu',
|
118 |
+
] );
|
119 |
+
add_submenu_page( 'flag-overview', __( 'FlAG Change options', 'flash-album-gallery' ), __( 'Options', 'flash-album-gallery' ), 'FlAG Change options', 'flag-options', [
|
120 |
+
&$this,
|
121 |
+
'show_menu',
|
122 |
+
] );
|
123 |
+
add_submenu_page( 'flag-overview', __( 'Flagallery Shortcode Generator', 'flash-album-gallery' ), __( 'Shortcode Generator', 'flash-album-gallery' ), 'FlAG Manage gallery', 'flag-shortcode-generator', [
|
124 |
+
&$this,
|
125 |
+
'show_menu',
|
126 |
+
] );
|
127 |
+
add_submenu_page( 'flag-overview', __( 'Flagallery in iframe', 'flash-album-gallery' ), __( 'Iframe', 'flash-album-gallery' ), 'FlAG iFrame page', 'flag-iframe', [
|
128 |
+
&$this,
|
129 |
+
'show_menu',
|
130 |
+
] );
|
131 |
+
if ( flag_wpmu_site_admin() ) {
|
132 |
+
add_submenu_page( 'wpmu-admin.php', __( 'GRAND FlaGallery', 'flash-album-gallery' ), __( 'Grand Flagallery', 'flash-album-gallery' ), 'activate_plugins', 'flag-wpmu', [
|
133 |
+
&$this,
|
134 |
+
'show_menu',
|
135 |
+
] );
|
136 |
+
}
|
137 |
+
|
138 |
+
//register the column fields
|
139 |
+
$this->register_columns();
|
140 |
+
}
|
141 |
+
|
142 |
+
// load the script for the defined page and load only this code
|
143 |
+
|
144 |
+
function register_columns() {
|
145 |
+
include_once( dirname( __FILE__ ) . '/manage-images.php' );
|
146 |
+
$this->register_column_headers( 'flag-manage-images', flag_manage_gallery_columns() );
|
147 |
+
}
|
148 |
+
|
149 |
+
function register_column_headers( $screen, $columns ) {
|
150 |
+
global $_wp_column_headers;
|
151 |
+
|
152 |
+
if ( ! isset( $_wp_column_headers ) ) {
|
153 |
+
$_wp_column_headers = [];
|
154 |
+
}
|
155 |
+
|
156 |
+
$_wp_column_headers[ $screen ] = $columns;
|
157 |
+
}
|
158 |
+
|
159 |
+
function show_menu() {
|
160 |
+
|
161 |
+
global $flag;
|
162 |
+
|
163 |
+
// Set installation date
|
164 |
+
if ( empty( $flag->options['installDate'] ) ) {
|
165 |
+
$flag->options['installDate'] = time();
|
166 |
+
update_option( 'flag_options', $flag->options );
|
167 |
+
}
|
168 |
+
|
169 |
+
switch ( $_GET['page'] ) {
|
170 |
+
case "flag-manage-gallery":
|
171 |
+
include_once( dirname( __FILE__ ) . '/functions.php' ); // admin functions
|
172 |
+
include_once( dirname( __FILE__ ) . '/manage.php' ); // flag_admin_manage_gallery
|
173 |
+
// Initate the Manage Gallery page
|
174 |
+
$flag->manage_page = new flagManageGallery();
|
175 |
+
// Render the output now, because you cannot access a object during the constructor is not finished
|
176 |
+
$flag->manage_page->controller();
|
177 |
+
|
178 |
+
break;
|
179 |
+
case "flag-music-box":
|
180 |
+
include_once( dirname( __FILE__ ) . '/music-box.php' ); // flag_music_box
|
181 |
+
flag_music_controler();
|
182 |
+
break;
|
183 |
+
case "flag-video-box":
|
184 |
+
include_once( dirname( __FILE__ ) . '/video-box.php' ); // flag_video_box
|
185 |
+
flag_video_controler();
|
186 |
+
break;
|
187 |
+
case "flag-banner-box":
|
188 |
+
include_once( dirname( __FILE__ ) . '/banner-box.php' ); // flag_banner_box
|
189 |
+
flag_banner_controler();
|
190 |
+
break;
|
191 |
+
case "flag-options":
|
192 |
+
include_once( dirname( __FILE__ ) . '/settings.php' ); // flag_admin_options
|
193 |
+
flag_admin_options();
|
194 |
+
break;
|
195 |
+
case "flag-skins":
|
196 |
+
include_once( dirname( __FILE__ ) . '/skins.php' ); // flag_manage_skins
|
197 |
+
break;
|
198 |
+
case "flag-shortcode-generator":
|
199 |
+
include_once( dirname( __FILE__ ) . '/shortcode-tool.php' ); // shortcode-tool
|
200 |
+
break;
|
201 |
+
case "flag-iframe":
|
202 |
+
include_once( dirname( __FILE__ ) . '/flagframe-tool.php' ); // flagframe-tool
|
203 |
+
break;
|
204 |
+
case "flag-wpmu":
|
205 |
+
include_once( dirname( __FILE__ ) . '/wpmu.php' ); // flag_wpmu_admin
|
206 |
+
flag_wpmu_setup();
|
207 |
+
break;
|
208 |
+
default:
|
209 |
+
include_once( dirname( __FILE__ ) . '/overview.php' ); // flag_admin_overview
|
210 |
+
flag_admin_overview();
|
211 |
+
break;
|
212 |
+
}
|
213 |
+
}
|
214 |
+
|
215 |
+
function enqueue_scripts( $hook ) {
|
216 |
+
// no need to go on if it's not a plugin page
|
217 |
+
if ( 'admin.php' != $hook && isset( $_GET['page'] ) && in_array( $_GET['page'], [ 'flag-overview', 'flag-manage-gallery', 'flag-music-box', 'flag-video-box', 'flag-banner-box', 'flag-skins', 'flag-options', 'flag-iframe' ] ) ) {
|
218 |
+
global $wp_scripts, $wp_styles;
|
219 |
+
foreach ( $wp_scripts->registered as $handle => $wp_script ) {
|
220 |
+
if ( ( ( false !== strpos( $wp_script->src, '/plugins/' ) ) || ( false !== strpos( $wp_script->src, '/themes/' ) ) ) && ( false === strpos( $wp_script->src, 'flash-album-gallery' ) ) ) {
|
221 |
+
if ( in_array( $handle, $wp_scripts->queue ) ) {
|
222 |
+
wp_dequeue_script( $handle );
|
223 |
+
}
|
224 |
+
wp_deregister_script( $handle );
|
225 |
+
}
|
226 |
+
}
|
227 |
+
foreach ( $wp_styles->registered as $handle => $wp_style ) {
|
228 |
+
if ( ( ( false !== strpos( $wp_style->src, '/plugins/' ) ) || ( false !== strpos( $wp_style->src, '/themes/' ) ) ) && ( false === strpos( $wp_style->src, 'flash-album-gallery' ) ) ) {
|
229 |
+
if ( in_array( $handle, $wp_styles->queue ) ) {
|
230 |
+
wp_dequeue_style( $handle );
|
231 |
+
}
|
232 |
+
wp_deregister_style( $handle );
|
233 |
+
}
|
234 |
+
}
|
235 |
+
}
|
236 |
+
}
|
237 |
+
|
238 |
+
function load_scripts() {
|
239 |
+
|
240 |
+
wp_register_script( 'flag-ajax', FLAG_URLPATH . 'admin/js/flag.ajax.js', [ 'jquery' ], '1.4.1' );
|
241 |
+
wp_localize_script( 'flag-ajax', 'flagAjaxSetup', [
|
242 |
+
'url' => admin_url( 'admin-ajax.php' ),
|
243 |
+
'action' => 'flag_ajax_operation',
|
244 |
+
'operation' => '',
|
245 |
+
'nonce' => wp_create_nonce( 'flag-ajax' ),
|
246 |
+
'ids' => '',
|
247 |
+
'permission' => __( 'You do not have the correct permission', 'flash-album-gallery' ),
|
248 |
+
'error' => __( 'Unexpected Error', 'flash-album-gallery' ),
|
249 |
+
'failure' => __( 'A failure occurred', 'flash-album-gallery' ),
|
250 |
+
] );
|
251 |
+
wp_register_script( 'flag-progressbar', FLAG_URLPATH . 'admin/js/flag.progressbar.js', [ 'jquery' ], '1.0.1' );
|
252 |
+
|
253 |
+
if ( isset( $_GET['page'] ) ) {
|
254 |
+
switch ( $_GET['page'] ) {
|
255 |
+
case 'flag-overview':
|
256 |
+
wp_enqueue_script( 'postbox' );
|
257 |
+
case "flag-manage-gallery":
|
258 |
+
print "<script type='text/javascript' src='" . FLAG_URLPATH . "admin/js/tabs.js'></script>\n";
|
259 |
+
|
260 |
+
wp_enqueue_style( 'jquery-ui-smoothness', '//ajax.googleapis.com/ajax/libs/jqueryui/1.10.4/themes/smoothness/jquery-ui.min.css', [], '1.10.4', 'screen' );
|
261 |
+
wp_enqueue_script( 'jquery-ui-full', '//ajax.googleapis.com/ajax/libs/jqueryui/1.10.4/jquery-ui.min.js', [ 'jquery' ], '1.10.4' );
|
262 |
+
|
263 |
+
wp_enqueue_script( 'jquery-ui-droppable' );
|
264 |
+
|
265 |
+
wp_enqueue_script( 'multifile', FLAG_URLPATH . 'admin/js/jquery.MultiFile.js', [ 'jquery' ], '1.4.6' );
|
266 |
+
|
267 |
+
wp_enqueue_script( 'flag-plupload', FLAG_URLPATH . 'admin/js/plupload/plupload.full.min.js', [
|
268 |
+
'jquery',
|
269 |
+
'jquery-ui-full',
|
270 |
+
], '2.3.6' );
|
271 |
+
|
272 |
+
wp_enqueue_style( 'jquery.ui.plupload', FLAG_URLPATH . 'admin/js/plupload/jquery.ui.plupload/css/jquery.ui.plupload.css', [ 'jquery-ui-smoothness' ], '2.3.6', 'screen' );
|
273 |
+
wp_enqueue_script( 'jquery.ui.plupload', FLAG_URLPATH . 'admin/js/plupload/jquery.ui.plupload/jquery.ui.plupload.min.js', [
|
274 |
+
'flag-plupload',
|
275 |
+
'jquery-ui-full',
|
276 |
+
], '2.3.6' );
|
277 |
+
|
278 |
+
|
279 |
+
wp_enqueue_script( 'dataset', FLAG_URLPATH . 'admin/js/jquery.dataset.js', [ 'jquery' ], '0.1.0' );
|
280 |
+
wp_enqueue_script( 'postbox' );
|
281 |
+
wp_enqueue_script( 'flag-ajax' );
|
282 |
+
wp_enqueue_script( 'flag-progressbar' );
|
283 |
+
add_thickbox();
|
284 |
+
break;
|
285 |
+
case "flag-music-box":
|
286 |
+
wp_enqueue_script( 'swfobject' );
|
287 |
+
wp_enqueue_script( 'thickbox' );
|
288 |
+
break;
|
289 |
+
case "flag-video-box":
|
290 |
+
wp_enqueue_script( 'swfobject' );
|
291 |
+
wp_enqueue_script( 'thickbox' );
|
292 |
+
break;
|
293 |
+
case "flag-banner-box":
|
294 |
+
wp_enqueue_script( 'thickbox' );
|
295 |
+
break;
|
296 |
+
case "flag-options":
|
297 |
+
print "<script type='text/javascript' src='" . FLAG_URLPATH . "admin/js/tabs.js'></script>\n";
|
298 |
+
break;
|
299 |
+
case "flag-skins":
|
300 |
+
wp_enqueue_script( 'thickbox' );
|
301 |
+
print "<script type='text/javascript' src='" . FLAG_URLPATH . "admin/js/tabs.js'></script>\n";
|
302 |
+
break;
|
303 |
+
case "flag-shortcode-generator":
|
304 |
+
wp_enqueue_script( 'jquery-ui-sortable' );
|
305 |
+
break;
|
306 |
+
}
|
307 |
+
}
|
308 |
+
}
|
309 |
+
|
310 |
+
function load_styles() {
|
311 |
+
|
312 |
+
if ( isset( $_GET['page'] ) ) {
|
313 |
+
switch ( $_GET['page'] ) {
|
314 |
+
case 'flag-overview':
|
315 |
+
wp_enqueue_style( 'flagadmin', FLAG_URLPATH . 'admin/css/flagadmin.css', false, '5.0.0', 'screen' );
|
316 |
+
wp_admin_css( 'css/dashboard' );
|
317 |
+
break;
|
318 |
+
case "flag-options":
|
319 |
+
case "flag-manage-gallery":
|
320 |
+
wp_enqueue_style( 'flagtabs', FLAG_URLPATH . 'admin/css/tabs.css', false, '5.0.0', 'screen' );
|
321 |
+
case "flag-music-box":
|
322 |
+
case "flag-video-box":
|
323 |
+
case "flag-banner-box":
|
324 |
+
wp_enqueue_style( 'thickbox' );
|
325 |
+
wp_enqueue_style( 'flagadmin', FLAG_URLPATH . 'admin/css/flagadmin.css', false, '5.0.0', 'screen' );
|
326 |
+
break;
|
327 |
+
case "flag-skins":
|
328 |
+
wp_enqueue_style( 'thickbox' );
|
329 |
+
wp_enqueue_style( 'flagtabs', FLAG_URLPATH . 'admin/css/tabs.css', false, '5.0.0', 'screen' );
|
330 |
+
wp_enqueue_style( 'flagadmin', FLAG_URLPATH . 'admin/css/flagadmin.css', false, '5.0.0', 'screen' );
|
331 |
+
wp_admin_css( 'css/dashboard' );
|
332 |
+
break;
|
333 |
+
}
|
334 |
+
}
|
335 |
+
}
|
336 |
+
|
337 |
+
function edit_screen_meta( $screen ) {
|
338 |
+
|
339 |
+
// menu title is localized, so we need to change the toplevel name
|
340 |
+
$i18n = strtolower( _n( 'Gallery', 'Galleries', 1, 'flash-album-gallery' ) );
|
341 |
+
|
342 |
+
switch ( $screen ) {
|
343 |
+
case "{$i18n}_page_flag-manage-gallery":
|
344 |
+
// we would like to have screen option only at the manage images / gallery page
|
345 |
+
if ( isset( $_POST['sortGallery'] ) ) {
|
346 |
+
//$screen = $screen;
|
347 |
+
} elseif ( ( $_GET['mode'] == 'edit' ) || isset( $_POST['backToGallery'] ) ) {
|
348 |
+
$screen = 'flag-manage-images';
|
349 |
+
} elseif ( ( $_GET['mode'] == 'sort' ) ) {
|
350 |
+
//$screen = $screen;
|
351 |
+
} else {
|
352 |
+
$screen = 'flag-manage-gallery';
|
353 |
+
}
|
354 |
+
break;
|
355 |
+
}
|
356 |
+
|
357 |
+
return $screen;
|
358 |
+
}
|
359 |
+
|
360 |
+
function wp_flag_ins_button() {
|
361 |
+
|
362 |
+
if (
|
363 |
+
strpos( $_SERVER['REQUEST_URI'], 'post.php' )
|
364 |
+
|| strstr( $_SERVER['PHP_SELF'], 'page-new.php' )
|
365 |
+
|| strstr( $_SERVER['PHP_SELF'], 'page.php' )
|
366 |
+
|| strstr( $_SERVER['PHP_SELF'], 'post-new.php' )
|
367 |
+
) {
|
368 |
+
?>
|
369 |
+
<script type="text/javascript">
|
370 |
+
<!--
|
371 |
+
function bind_resize() {
|
372 |
+
if (!window.flag_bind_resize) {
|
373 |
+
jQuery(window).bind('resize', tb_position);
|
374 |
+
}
|
375 |
+
window.flag_bind_resize = true;
|
376 |
+
}
|
377 |
+
|
378 |
+
//
|
379 |
+
-->
|
380 |
+
</script>
|
381 |
+
<?php
|
382 |
+
}
|
383 |
+
}
|
384 |
+
}
|
385 |
+
|
386 |
+
function flag_wpmu_site_admin() {
|
387 |
+
// Check for site admin
|
388 |
+
if ( function_exists( 'is_site_admin' ) ) {
|
389 |
+
if ( is_super_admin() ) {
|
390 |
+
return true;
|
391 |
+
}
|
392 |
+
}
|
393 |
+
|
394 |
+
return false;
|
395 |
+
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
admin/ajax.php
CHANGED
@@ -1,456 +1,485 @@
|
|
1 |
-
<?php
|
2 |
-
|
3 |
-
add_action( 'wp_ajax_flag_ajax_operation', 'flag_ajax_operation' );
|
4 |
-
|
5 |
-
function flag_ajax_operation() {
|
6 |
-
global $wpdb;
|
7 |
-
// if nonce is not correct it returns -1
|
8 |
-
check_ajax_referer( "flag-ajax" );
|
9 |
-
// check for correct capability
|
10 |
-
if ( ! is_user_logged_in() ) {
|
11 |
-
die( '-1' );
|
12 |
-
}
|
13 |
-
// check for correct FlAG capability
|
14 |
-
if ( ! current_user_can( 'FlAG Upload images' ) || ! current_user_can( 'FlAG Manage gallery' ) ) {
|
15 |
-
die( '-1' );
|
16 |
-
}
|
17 |
-
// include the flag function
|
18 |
-
include_once( dirname( __FILE__ ) . '/functions.php' );
|
19 |
-
// Get the image id
|
20 |
-
if ( isset( $_POST['image'] ) ) {
|
21 |
-
$id = (int) $_POST['image'];
|
22 |
-
// let's get the image data
|
23 |
-
$picture = flagdb::find_image( $id );
|
24 |
-
// what do you want to do ?
|
25 |
-
switch ( $_POST['operation'] ) {
|
26 |
-
case 'create_thumbnail' :
|
27 |
-
$result = flagAdmin::create_thumbnail( $picture );
|
28 |
-
break;
|
29 |
-
case 'resize_image' :
|
30 |
-
$result = flagAdmin::resize_image( $picture );
|
31 |
-
break;
|
32 |
-
case 'webview_image' :
|
33 |
-
$result = flagAdmin::webview_image( $picture );
|
34 |
-
break;
|
35 |
-
case 'import_metadata' :
|
36 |
-
$result = flagAdmin::import_MetaData( $id );
|
37 |
-
break;
|
38 |
-
case 'copy_metadata' :
|
39 |
-
$result = flagAdmin::copy_MetaData( $id );
|
40 |
-
break;
|
41 |
-
case 'get_image_ids' :
|
42 |
-
$result = flagAdmin::get_image_ids( $id );
|
43 |
-
break;
|
44 |
-
default :
|
45 |
-
do_action( 'flag_ajax_' . sanitize_key( $_POST['operation'] ) );
|
46 |
-
die( '-1' );
|
47 |
-
break;
|
48 |
-
}
|
49 |
-
// A success should return a '1'
|
50 |
-
die ( $result );
|
51 |
-
}
|
52 |
-
// The script should never stop here
|
53 |
-
die( '0' );
|
54 |
-
}
|
55 |
-
|
56 |
-
add_action( 'wp_ajax_flagCreateNewThumb', 'flagCreateNewThumb' );
|
57 |
-
|
58 |
-
function flagCreateNewThumb() {
|
59 |
-
|
60 |
-
global $wpdb;
|
61 |
-
|
62 |
-
// check for correct capability
|
63 |
-
if ( ! is_user_logged_in() ) {
|
64 |
-
die( '-1' );
|
65 |
-
}
|
66 |
-
// check for correct FlAG capability
|
67 |
-
if ( ! current_user_can( 'FlAG Manage gallery' ) ) {
|
68 |
-
die( '-1' );
|
69 |
-
}
|
70 |
-
|
71 |
-
require_once( dirname( dirname( __FILE__ ) ) . '/flag-config.php' );
|
72 |
-
include_once( flagGallery::graphic_library() );
|
73 |
-
|
74 |
-
$flag_options = get_option( 'flag_options' );
|
75 |
-
|
76 |
-
$id = (int) $_POST['id'];
|
77 |
-
$picture = flagdb::find_image( $id );
|
78 |
-
|
79 |
-
|
80 |
-
|
81 |
-
|
82 |
-
|
83 |
-
|
84 |
-
|
85 |
-
|
86 |
-
|
87 |
-
|
88 |
-
|
89 |
-
|
90 |
-
if ( $thumb->save( $picture->thumbPath, 100 ) ) {
|
91 |
-
//read the new sizes
|
92 |
-
$new_size = @getimagesize( $picture->thumbPath );
|
93 |
-
$size['width'] = $new_size[0];
|
94 |
-
$size['height'] = $new_size[1];
|
95 |
-
|
96 |
-
// add them to the database
|
97 |
-
flagdb::update_image_meta( $picture->pid,
|
98 |
-
|
99 |
-
echo "OK";
|
100 |
-
} else {
|
101 |
-
header( 'HTTP/1.1 500 Internal Server Error' );
|
102 |
-
echo "KO";
|
103 |
-
}
|
104 |
-
|
105 |
-
exit();
|
106 |
-
|
107 |
-
}
|
108 |
-
|
109 |
-
add_action( 'wp_ajax_flag_save_album', 'flag_save_album' );
|
110 |
-
|
111 |
-
function flag_save_album() {
|
112 |
-
|
113 |
-
global $wpdb;
|
114 |
-
|
115 |
-
// check for correct capability
|
116 |
-
if ( ! is_user_logged_in() ) {
|
117 |
-
die( '-1' );
|
118 |
-
}
|
119 |
-
// check for correct FlAG capability
|
120 |
-
if ( ! current_user_can( 'FlAG Manage others gallery' ) ) {
|
121 |
-
die( '-1' );
|
122 |
-
}
|
123 |
-
|
124 |
-
if ( isset( $_POST['form'] ) ) {
|
125 |
-
parse_str( $_POST['form'], $output );
|
126 |
-
}
|
127 |
-
$result = false;
|
128 |
-
$album_id = isset($output['album_id'])? intval( $output['album_id'] ) : 0;
|
129 |
-
$album_name = wp_check_invalid_utf8(wp_strip_all_tags( $output['album_name'] ));
|
130 |
-
$g = isset($output['g'])? (array) $output['g'] :
|
131 |
-
if ( $album_name && $album_id ) {
|
132 |
-
if ( count( $g ) ) {
|
133 |
-
$galstring = implode( ',', $g );
|
134 |
-
} else {
|
135 |
-
$galstring = '';
|
136 |
-
}
|
137 |
-
$result = $wpdb->query( $wpdb->prepare( "UPDATE {$wpdb->flagalbum} SET name = %s, categories = %s WHERE id = %s", $album_name, $galstring, $album_id ) );
|
138 |
-
}
|
139 |
-
|
140 |
-
if ( $result ) {
|
141 |
-
_e( 'Success', 'flash-album-gallery' );
|
142 |
-
}
|
143 |
-
|
144 |
-
exit();
|
145 |
-
|
146 |
-
}
|
147 |
-
|
148 |
-
add_action( 'wp_ajax_flag_delete_album', 'flag_delete_album' );
|
149 |
-
|
150 |
-
function flag_delete_album() {
|
151 |
-
|
152 |
-
global $wpdb;
|
153 |
-
|
154 |
-
// check for correct capability
|
155 |
-
if ( ! is_user_logged_in() ) {
|
156 |
-
die( '-1' );
|
157 |
-
}
|
158 |
-
// check for correct FlAG capability
|
159 |
-
if ( ! current_user_can( 'FlAG Manage gallery' ) ) {
|
160 |
-
die( '-1' );
|
161 |
-
}
|
162 |
-
|
163 |
-
$result = false;
|
164 |
-
if ( isset( $_POST['post'] ) ) {
|
165 |
-
$result = $wpdb->query( $wpdb->prepare( "DELETE FROM {$wpdb->flagalbum} WHERE id = %d", $_POST['post'] ) );
|
166 |
-
}
|
167 |
-
|
168 |
-
if ( $result ) {
|
169 |
-
_e( 'Success', 'flash-album-gallery' );
|
170 |
-
}
|
171 |
-
|
172 |
-
exit();
|
173 |
-
|
174 |
-
}
|
175 |
-
|
176 |
-
add_action( 'wp_ajax_flag_banner_crunch', 'flag_banner_crunch' );
|
177 |
-
|
178 |
-
function flag_banner_crunch() {
|
179 |
-
|
180 |
-
// check for correct capability
|
181 |
-
if ( ! is_user_logged_in() ) {
|
182 |
-
die( '-1' );
|
183 |
-
}
|
184 |
-
// check for correct FlAG capability
|
185 |
-
if ( ! current_user_can( 'FlAG Manage gallery' ) ) {
|
186 |
-
die( '-1' );
|
187 |
-
}
|
188 |
-
|
189 |
-
if ( isset( $_POST['path'] ) ) {
|
190 |
-
include_once( dirname( __FILE__ ) . '/functions.php' );
|
191 |
-
$id = flagAdmin::handle_import_file( $_POST['path'] );
|
192 |
-
$file = basename( $_POST['path'] );
|
193 |
-
if ( is_wp_error( $id ) ) {
|
194 |
-
echo '<p class="error">' . sprintf( __( '<em>%s</em> was <strong>not</strong> imported due to an error: %s', 'flash-album-gallery' ), $file, $id->get_error_message() ) . '</p>';
|
195 |
-
} else {
|
196 |
-
echo '<p class="success">' . sprintf( __( '<em>%s</em> has been added to Media library', 'flash-album-gallery' ), $file ) . '</p>';
|
197 |
-
}
|
198 |
-
}
|
199 |
-
|
200 |
-
exit();
|
201 |
-
}
|
202 |
-
|
203 |
-
add_action( 'wp_ajax_flag_file_browser', 'flag_ajax_file_browser' );
|
204 |
-
|
205 |
-
/**
|
206 |
-
* jQuery File Tree PHP Connector
|
207 |
-
*
|
208 |
-
* @
|
209 |
-
*
|
210 |
-
*
|
211 |
-
|
212 |
-
|
213 |
-
|
214 |
-
|
215 |
-
|
216 |
-
|
217 |
-
|
218 |
-
|
219 |
-
|
220 |
-
|
221 |
-
|
222 |
-
|
223 |
-
|
224 |
-
|
225 |
-
|
226 |
-
|
227 |
-
|
228 |
-
|
229 |
-
|
230 |
-
|
231 |
-
|
232 |
-
|
233 |
-
|
234 |
-
|
235 |
-
|
236 |
-
|
237 |
-
|
238 |
-
|
239 |
-
|
240 |
-
|
241 |
-
|
242 |
-
|
243 |
-
|
244 |
-
|
245 |
-
|
246 |
-
|
247 |
-
|
248 |
-
|
249 |
-
|
250 |
-
|
251 |
-
|
252 |
-
|
253 |
-
|
254 |
-
|
255 |
-
|
256 |
-
|
257 |
-
|
258 |
-
|
259 |
-
|
260 |
-
|
261 |
-
|
262 |
-
|
263 |
-
|
264 |
-
|
265 |
-
|
266 |
-
|
267 |
-
|
268 |
-
|
269 |
-
|
270 |
-
|
271 |
-
|
272 |
-
|
273 |
-
|
274 |
-
|
275 |
-
|
276 |
-
|
277 |
-
|
278 |
-
|
279 |
-
|
280 |
-
|
281 |
-
|
282 |
-
|
283 |
-
|
284 |
-
|
285 |
-
|
286 |
-
|
287 |
-
|
288 |
-
|
289 |
-
|
290 |
-
|
291 |
-
|
292 |
-
|
293 |
-
|
294 |
-
|
295 |
-
|
296 |
-
|
297 |
-
|
298 |
-
|
299 |
-
|
300 |
-
|
301 |
-
|
302 |
-
|
303 |
-
|
304 |
-
|
305 |
-
|
306 |
-
|
307 |
-
|
308 |
-
|
309 |
-
|
310 |
-
|
311 |
-
|
312 |
-
|
313 |
-
|
314 |
-
|
315 |
-
|
316 |
-
|
317 |
-
|
318 |
-
|
319 |
-
|
320 |
-
|
321 |
-
|
322 |
-
|
323 |
-
|
324 |
-
|
325 |
-
|
326 |
-
|
327 |
-
|
328 |
-
|
329 |
-
|
330 |
-
|
331 |
-
|
332 |
-
|
333 |
-
|
334 |
-
|
335 |
-
|
336 |
-
|
337 |
-
|
338 |
-
|
339 |
-
|
340 |
-
|
341 |
-
|
342 |
-
|
343 |
-
|
344 |
-
|
345 |
-
|
346 |
-
|
347 |
-
|
348 |
-
|
349 |
-
|
350 |
-
|
351 |
-
|
352 |
-
|
353 |
-
|
354 |
-
|
355 |
-
|
356 |
-
|
357 |
-
|
358 |
-
|
359 |
-
|
360 |
-
|
361 |
-
|
362 |
-
|
363 |
-
|
364 |
-
|
365 |
-
|
366 |
-
|
367 |
-
|
368 |
-
|
369 |
-
|
370 |
-
|
371 |
-
|
372 |
-
|
373 |
-
|
374 |
-
|
375 |
-
|
376 |
-
|
377 |
-
|
378 |
-
|
379 |
-
|
380 |
-
|
381 |
-
|
382 |
-
|
383 |
-
|
384 |
-
|
385 |
-
|
386 |
-
|
387 |
-
|
388 |
-
|
389 |
-
|
390 |
-
|
391 |
-
|
392 |
-
|
393 |
-
|
394 |
-
|
395 |
-
|
396 |
-
|
397 |
-
|
398 |
-
|
399 |
-
|
400 |
-
|
401 |
-
|
402 |
-
|
403 |
-
|
404 |
-
|
405 |
-
|
406 |
-
|
407 |
-
|
408 |
-
|
409 |
-
|
410 |
-
|
411 |
-
|
412 |
-
|
413 |
-
|
414 |
-
|
415 |
-
|
416 |
-
|
417 |
-
|
418 |
-
|
419 |
-
|
420 |
-
|
421 |
-
|
422 |
-
|
423 |
-
|
424 |
-
|
425 |
-
|
426 |
-
|
427 |
-
|
428 |
-
|
429 |
-
|
430 |
-
|
431 |
-
|
432 |
-
|
433 |
-
|
434 |
-
|
435 |
-
|
436 |
-
|
437 |
-
|
438 |
-
|
439 |
-
|
440 |
-
|
441 |
-
|
442 |
-
|
443 |
-
|
444 |
-
|
445 |
-
|
446 |
-
|
447 |
-
|
448 |
-
|
449 |
-
|
450 |
-
|
451 |
-
|
452 |
-
|
453 |
-
|
454 |
-
|
455 |
-
|
456 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
add_action( 'wp_ajax_flag_ajax_operation', 'flag_ajax_operation' );
|
4 |
+
|
5 |
+
function flag_ajax_operation() {
|
6 |
+
global $wpdb;
|
7 |
+
// if nonce is not correct it returns -1
|
8 |
+
check_ajax_referer( "flag-ajax" );
|
9 |
+
// check for correct capability
|
10 |
+
if ( ! is_user_logged_in() ) {
|
11 |
+
die( '-1' );
|
12 |
+
}
|
13 |
+
// check for correct FlAG capability
|
14 |
+
if ( ! current_user_can( 'FlAG Upload images' ) || ! current_user_can( 'FlAG Manage gallery' ) ) {
|
15 |
+
die( '-1' );
|
16 |
+
}
|
17 |
+
// include the flag function
|
18 |
+
include_once( dirname( __FILE__ ) . '/functions.php' );
|
19 |
+
// Get the image id
|
20 |
+
if ( isset( $_POST['image'] ) ) {
|
21 |
+
$id = (int) $_POST['image'];
|
22 |
+
// let's get the image data
|
23 |
+
$picture = flagdb::find_image( $id );
|
24 |
+
// what do you want to do ?
|
25 |
+
switch ( $_POST['operation'] ) {
|
26 |
+
case 'create_thumbnail' :
|
27 |
+
$result = flagAdmin::create_thumbnail( $picture );
|
28 |
+
break;
|
29 |
+
case 'resize_image' :
|
30 |
+
$result = flagAdmin::resize_image( $picture );
|
31 |
+
break;
|
32 |
+
case 'webview_image' :
|
33 |
+
$result = flagAdmin::webview_image( $picture );
|
34 |
+
break;
|
35 |
+
case 'import_metadata' :
|
36 |
+
$result = flagAdmin::import_MetaData( $id );
|
37 |
+
break;
|
38 |
+
case 'copy_metadata' :
|
39 |
+
$result = flagAdmin::copy_MetaData( $id );
|
40 |
+
break;
|
41 |
+
case 'get_image_ids' :
|
42 |
+
$result = flagAdmin::get_image_ids( $id );
|
43 |
+
break;
|
44 |
+
default :
|
45 |
+
do_action( 'flag_ajax_' . sanitize_key( $_POST['operation'] ) );
|
46 |
+
die( '-1' );
|
47 |
+
break;
|
48 |
+
}
|
49 |
+
// A success should return a '1'
|
50 |
+
die ( $result );
|
51 |
+
}
|
52 |
+
// The script should never stop here
|
53 |
+
die( '0' );
|
54 |
+
}
|
55 |
+
|
56 |
+
add_action( 'wp_ajax_flagCreateNewThumb', 'flagCreateNewThumb' );
|
57 |
+
|
58 |
+
function flagCreateNewThumb() {
|
59 |
+
|
60 |
+
global $wpdb;
|
61 |
+
|
62 |
+
// check for correct capability
|
63 |
+
if ( ! is_user_logged_in() ) {
|
64 |
+
die( '-1' );
|
65 |
+
}
|
66 |
+
// check for correct FlAG capability
|
67 |
+
if ( ! current_user_can( 'FlAG Manage gallery' ) ) {
|
68 |
+
die( '-1' );
|
69 |
+
}
|
70 |
+
|
71 |
+
require_once( dirname( dirname( __FILE__ ) ) . '/flag-config.php' );
|
72 |
+
include_once( flagGallery::graphic_library() );
|
73 |
+
|
74 |
+
$flag_options = get_option( 'flag_options' );
|
75 |
+
|
76 |
+
$id = (int) $_POST['id'];
|
77 |
+
$picture = flagdb::find_image( $id );
|
78 |
+
|
79 |
+
$x = round( $_POST['x'] * $_POST['rr'], 0 );
|
80 |
+
$y = round( $_POST['y'] * $_POST['rr'], 0 );
|
81 |
+
$w = round( $_POST['w'] * $_POST['rr'], 0 );
|
82 |
+
$h = round( $_POST['h'] * $_POST['rr'], 0 );
|
83 |
+
|
84 |
+
$thumb = new flag_Thumbnail( $picture->imagePath, true );
|
85 |
+
|
86 |
+
$thumb->crop( $x, $y, $w, $h );
|
87 |
+
|
88 |
+
$thumb->resize( $flag_options['thumbWidth'], $flag_options['thumbHeight'] );
|
89 |
+
|
90 |
+
if ( $thumb->save( $picture->thumbPath, 100 ) ) {
|
91 |
+
//read the new sizes
|
92 |
+
$new_size = @getimagesize( $picture->thumbPath );
|
93 |
+
$size['width'] = $new_size[0];
|
94 |
+
$size['height'] = $new_size[1];
|
95 |
+
|
96 |
+
// add them to the database
|
97 |
+
flagdb::update_image_meta( $picture->pid, [ 'thumbnail' => $size ] );
|
98 |
+
|
99 |
+
echo "OK";
|
100 |
+
} else {
|
101 |
+
header( 'HTTP/1.1 500 Internal Server Error' );
|
102 |
+
echo "KO";
|
103 |
+
}
|
104 |
+
|
105 |
+
exit();
|
106 |
+
|
107 |
+
}
|
108 |
+
|
109 |
+
add_action( 'wp_ajax_flag_save_album', 'flag_save_album' );
|
110 |
+
|
111 |
+
function flag_save_album() {
|
112 |
+
|
113 |
+
global $wpdb;
|
114 |
+
|
115 |
+
// check for correct capability
|
116 |
+
if ( ! is_user_logged_in() ) {
|
117 |
+
die( '-1' );
|
118 |
+
}
|
119 |
+
// check for correct FlAG capability
|
120 |
+
if ( ! current_user_can( 'FlAG Manage others gallery' ) ) {
|
121 |
+
die( '-1' );
|
122 |
+
}
|
123 |
+
|
124 |
+
if ( isset( $_POST['form'] ) ) {
|
125 |
+
parse_str( $_POST['form'], $output );
|
126 |
+
}
|
127 |
+
$result = false;
|
128 |
+
$album_id = isset( $output['album_id'] ) ? intval( $output['album_id'] ) : 0;
|
129 |
+
$album_name = wp_check_invalid_utf8( wp_strip_all_tags( $output['album_name'] ) );
|
130 |
+
$g = isset( $output['g'] ) ? (array) $output['g'] : [];
|
131 |
+
if ( $album_name && $album_id ) {
|
132 |
+
if ( count( $g ) ) {
|
133 |
+
$galstring = implode( ',', $g );
|
134 |
+
} else {
|
135 |
+
$galstring = '';
|
136 |
+
}
|
137 |
+
$result = $wpdb->query( $wpdb->prepare( "UPDATE {$wpdb->flagalbum} SET name = %s, categories = %s WHERE id = %s", $album_name, $galstring, $album_id ) );
|
138 |
+
}
|
139 |
+
|
140 |
+
if ( $result ) {
|
141 |
+
_e( 'Success', 'flash-album-gallery' );
|
142 |
+
}
|
143 |
+
|
144 |
+
exit();
|
145 |
+
|
146 |
+
}
|
147 |
+
|
148 |
+
add_action( 'wp_ajax_flag_delete_album', 'flag_delete_album' );
|
149 |
+
|
150 |
+
function flag_delete_album() {
|
151 |
+
|
152 |
+
global $wpdb;
|
153 |
+
|
154 |
+
// check for correct capability
|
155 |
+
if ( ! is_user_logged_in() ) {
|
156 |
+
die( '-1' );
|
157 |
+
}
|
158 |
+
// check for correct FlAG capability
|
159 |
+
if ( ! current_user_can( 'FlAG Manage gallery' ) ) {
|
160 |
+
die( '-1' );
|
161 |
+
}
|
162 |
+
|
163 |
+
$result = false;
|
164 |
+
if ( isset( $_POST['post'] ) ) {
|
165 |
+
$result = $wpdb->query( $wpdb->prepare( "DELETE FROM {$wpdb->flagalbum} WHERE id = %d", $_POST['post'] ) );
|
166 |
+
}
|
167 |
+
|
168 |
+
if ( $result ) {
|
169 |
+
_e( 'Success', 'flash-album-gallery' );
|
170 |
+
}
|
171 |
+
|
172 |
+
exit();
|
173 |
+
|
174 |
+
}
|
175 |
+
|
176 |
+
add_action( 'wp_ajax_flag_banner_crunch', 'flag_banner_crunch' );
|
177 |
+
|
178 |
+
function flag_banner_crunch() {
|
179 |
+
|
180 |
+
// check for correct capability
|
181 |
+
if ( ! is_user_logged_in() ) {
|
182 |
+
die( '-1' );
|
183 |
+
}
|
184 |
+
// check for correct FlAG capability
|
185 |
+
if ( ! current_user_can( 'FlAG Manage gallery' ) ) {
|
186 |
+
die( '-1' );
|
187 |
+
}
|
188 |
+
|
189 |
+
if ( isset( $_POST['path'] ) ) {
|
190 |
+
include_once( dirname( __FILE__ ) . '/functions.php' );
|
191 |
+
$id = flagAdmin::handle_import_file( $_POST['path'] );
|
192 |
+
$file = basename( $_POST['path'] );
|
193 |
+
if ( is_wp_error( $id ) ) {
|
194 |
+
echo '<p class="error">' . sprintf( __( '<em>%s</em> was <strong>not</strong> imported due to an error: %s', 'flash-album-gallery' ), $file, $id->get_error_message() ) . '</p>';
|
195 |
+
} else {
|
196 |
+
echo '<p class="success">' . sprintf( __( '<em>%s</em> has been added to Media library', 'flash-album-gallery' ), $file ) . '</p>';
|
197 |
+
}
|
198 |
+
}
|
199 |
+
|
200 |
+
exit();
|
201 |
+
}
|
202 |
+
|
203 |
+
add_action( 'wp_ajax_flag_file_browser', 'flag_ajax_file_browser' );
|
204 |
+
|
205 |
+
/**
|
206 |
+
* jQuery File Tree PHP Connector
|
207 |
+
*
|
208 |
+
* @author Cory S.N. LaViska - A Beautiful Site (http://abeautifulsite.net/)
|
209 |
+
* @version 1.0.1
|
210 |
+
*
|
211 |
+
* @return string folder content
|
212 |
+
*/
|
213 |
+
function flag_ajax_file_browser() {
|
214 |
+
|
215 |
+
// check for correct NextGEN capability
|
216 |
+
if ( ! current_user_can( 'FlAG Import folder' ) ) {
|
217 |
+
die( 'No access' );
|
218 |
+
}
|
219 |
+
|
220 |
+
if ( ! defined( 'ABSPATH' ) ) {
|
221 |
+
die( 'No access' );
|
222 |
+
}
|
223 |
+
|
224 |
+
// if nonce is not correct it returns -1
|
225 |
+
check_ajax_referer( 'flag-ajax', 'nonce' );
|
226 |
+
|
227 |
+
//PHP4 compat script
|
228 |
+
if ( ! function_exists( 'scandir' ) ) {
|
229 |
+
function scandir( $dir, $listDirectories = false, $skipDots = true ) {
|
230 |
+
$dirArray = [];
|
231 |
+
if ( $handle = opendir( $dir ) ) {
|
232 |
+
while ( false !== ( $file = readdir( $handle ) ) ) {
|
233 |
+
if ( ( $file != '.' && $file != '..' ) || $skipDots == true ) {
|
234 |
+
if ( $listDirectories == false ) {
|
235 |
+
if ( is_dir( $file ) ) {
|
236 |
+
continue;
|
237 |
+
}
|
238 |
+
}
|
239 |
+
array_push( $dirArray, basename( $file ) );
|
240 |
+
}
|
241 |
+
}
|
242 |
+
closedir( $handle );
|
243 |
+
}
|
244 |
+
|
245 |
+
return $dirArray;
|
246 |
+
}
|
247 |
+
}
|
248 |
+
|
249 |
+
// start from the default path
|
250 |
+
$root = trailingslashit( WINABSPATH );
|
251 |
+
// get the current directory
|
252 |
+
$dir = trailingslashit( urldecode( $_POST['dir'] ) );
|
253 |
+
|
254 |
+
if ( file_exists( $root . $dir ) && false === strpos( $dir, '..' ) ) {
|
255 |
+
$files = scandir( $root . $dir );
|
256 |
+
natcasesort( $files );
|
257 |
+
|
258 |
+
// The 2 counts for . and ..
|
259 |
+
if ( count( $files ) > 2 ) {
|
260 |
+
echo "<ul class=\"jqueryDirTree\" style=\"display: none;\">";
|
261 |
+
|
262 |
+
// return only directories
|
263 |
+
foreach ( $files as $file ) {
|
264 |
+
|
265 |
+
//reserved name for the thumnbnails, don't use it as folder name
|
266 |
+
if ( $file == 'thumbs' ) {
|
267 |
+
continue;
|
268 |
+
}
|
269 |
+
|
270 |
+
if ( file_exists( $root . $dir . $file ) && $file != '.' && $file != '..' && is_dir( $root . $dir . $file ) ) {
|
271 |
+
echo "<li class=\"directory collapsed\"><a href=\"#\" rel=\"" . esc_html( $dir . $file ) . "/\">" . esc_html( $file ) . "</a></li>";
|
272 |
+
}
|
273 |
+
}
|
274 |
+
|
275 |
+
echo "</ul>";
|
276 |
+
}
|
277 |
+
}
|
278 |
+
|
279 |
+
die();
|
280 |
+
}
|
281 |
+
|
282 |
+
add_action( 'wp_ajax_flag_plupload_uploader', 'flag_ajax_plupload_uploader' );
|
283 |
+
function flag_ajax_plupload_uploader() {
|
284 |
+
global $flag;
|
285 |
+
|
286 |
+
//check for correct capability
|
287 |
+
if ( ! is_user_logged_in() ) {
|
288 |
+
die( 'Login failure. -1' );
|
289 |
+
}
|
290 |
+
//check for correct capability
|
291 |
+
if ( ! current_user_can( 'FlAG Upload images' ) ) {
|
292 |
+
die( 'You do not have permission to upload files. -2' );
|
293 |
+
}
|
294 |
+
//check for correct nonce
|
295 |
+
check_ajax_referer( 'flag_upload' );
|
296 |
+
|
297 |
+
include_once( FLAG_ABSPATH . 'admin/functions.php' );
|
298 |
+
// get the gallery
|
299 |
+
$galleryID = (int) $_POST['galleryselect'];
|
300 |
+
|
301 |
+
echo flagAdmin::swfupload_image( $galleryID );
|
302 |
+
die();
|
303 |
+
}
|
304 |
+
|
305 |
+
add_action( 'wp_ajax_flagallery_shortcode_html', 'flagallery_ajax_shortcode_html' );
|
306 |
+
function flagallery_ajax_shortcode_html() {
|
307 |
+
|
308 |
+
//check for correct capability.
|
309 |
+
if ( ! is_user_logged_in() ) {
|
310 |
+
die( 'Login failure. -1' );
|
311 |
+
}
|
312 |
+
|
313 |
+
check_ajax_referer( 'FlaGallery' );
|
314 |
+
|
315 |
+
if ( isset( $_POST['shortcode'] ) ) {
|
316 |
+
global $flag;
|
317 |
+
require_once (dirname (dirname (__FILE__) ) . '/lib/skinobject.php');
|
318 |
+
require_once (dirname (dirname (__FILE__) ) . '/lib/shortcodes.php');
|
319 |
+
|
320 |
+
// Compatibilbity.
|
321 |
+
add_filter( 'jetpack_lazy_images_skip_image_with_attributes', array( $flag, 'jetpack_no_lazy_src' ), 10, 2 );
|
322 |
+
add_filter( 'jetpack_lazy_images_blacklisted_classes', array( $flag, 'jetpack_no_lazy_classes' ), 10 );
|
323 |
+
add_filter( 'a3_lazy_load_skip_images_classes', array( $flag, 'a3_no_lazy' ), 10 );
|
324 |
+
|
325 |
+
$shortcode = sanitize_text_field( $_POST['shortcode'] );
|
326 |
+
echo do_shortcode( $shortcode );
|
327 |
+
|
328 |
+
print_late_styles();
|
329 |
+
}
|
330 |
+
die();
|
331 |
+
}
|
332 |
+
|
333 |
+
add_action( 'wp_ajax_flag_shortcode_helper', 'flag_ajax_shortcode_helper' );
|
334 |
+
function flag_ajax_shortcode_helper() {
|
335 |
+
//check for correct capability
|
336 |
+
if ( ! is_user_logged_in() ) {
|
337 |
+
die( 'Login failure. -1' );
|
338 |
+
}
|
339 |
+
//check for correct capability
|
340 |
+
if ( ! current_user_can( 'FlAG Use TinyMCE' ) ) {
|
341 |
+
die( 'You do not have permission to upload files. -2' );
|
342 |
+
}
|
343 |
+
|
344 |
+
$media_button = isset( $_GET['media_button'] ) && $_GET['media_button'] == 'true' ? true : false;
|
345 |
+
$riched = isset( $_GET['riched'] ) && $_GET['riched'] == 'true' ? true : false;
|
346 |
+
|
347 |
+
include_once( FLAG_ABSPATH . 'admin/tinymce/window.php' );
|
348 |
+
|
349 |
+
die();
|
350 |
+
}
|
351 |
+
|
352 |
+
add_action( 'wp_ajax_flagallery_skin_interaction', 'flagallery_skin_interaction' );
|
353 |
+
add_action( 'wp_ajax_nopriv_flagallery_skin_interaction', 'flagallery_skin_interaction' );
|
354 |
+
add_action( 'wp_ajax_flagallery_module_interaction', 'flagallery_module_interaction' );
|
355 |
+
add_action( 'wp_ajax_nopriv_flagallery_module_interaction', 'flagallery_module_interaction' );
|
356 |
+
function flagallery_module_interaction() {
|
357 |
+
global $wpdb;
|
358 |
+
|
359 |
+
if ( empty( $_SERVER['HTTP_REFERER'] ) ) {
|
360 |
+
header( $_SERVER['SERVER_PROTOCOL'] . ' 400 Bad Request' );
|
361 |
+
die();
|
362 |
+
}
|
363 |
+
|
364 |
+
$ref = $_SERVER['HTTP_REFERER'];
|
365 |
+
//$uip = str_replace('.', '', $_SERVER['REMOTE_ADDR'])
|
366 |
+
if ( ( false === strpos( $ref, get_home_url() ) ) && ( false === strpos( $ref, get_site_url() ) ) ) {
|
367 |
+
header( $_SERVER['SERVER_PROTOCOL'] . ' 400 Bad Request' );
|
368 |
+
die();
|
369 |
+
}
|
370 |
+
if ( ( 'POST' !== $_SERVER['REQUEST_METHOD'] ) || ! isset( $_SERVER['HTTP_HOST'] ) || ! strpos( get_home_url(), $_SERVER['HTTP_HOST'] ) ) {
|
371 |
+
header( $_SERVER['SERVER_PROTOCOL'] . ' 400 Bad Request' );
|
372 |
+
die();
|
373 |
+
}
|
374 |
+
|
375 |
+
$upd = [ 'pid' => false, 'vote' => false, 'hit' => false, 'reset' => false ];
|
376 |
+
|
377 |
+
if ( ( $pid = intval( $_POST['hit'] ) ) ) {
|
378 |
+
$upd['pid'] = $pid;
|
379 |
+
$upd['hit'] = isset( $_POST['hit'] );
|
380 |
+
$upd['vote'] = isset( $_POST['vote'] );
|
381 |
+
|
382 |
+
flag_update_counter( $upd );
|
383 |
+
|
384 |
+
$result = $wpdb->get_results( "SELECT hitcounter, total_votes FROM $wpdb->flagpictures WHERE `pid` = $pid" );
|
385 |
+
|
386 |
+
$meta['views'] = intval( $result[0]->hitcounter );
|
387 |
+
$meta['likes'] = intval( $result[0]->total_votes );
|
388 |
+
$meta = array_map( 'intval', $meta );
|
389 |
+
|
390 |
+
header( 'Content-Type: application/json; charset=' . get_option( 'blog_charset' ), true );
|
391 |
+
echo json_encode( $meta );
|
392 |
+
die();
|
393 |
+
}
|
394 |
+
|
395 |
+
die();
|
396 |
+
}
|
397 |
+
|
398 |
+
/**
|
399 |
+
* Update image hitcounter in the database
|
400 |
+
*
|
401 |
+
* @param $upd
|
402 |
+
*/
|
403 |
+
function flag_update_counter( $upd ) {
|
404 |
+
global $wpdb;
|
405 |
+
|
406 |
+
if ( $pid = abs( intval( $upd['pid'] ) ) ) {
|
407 |
+
if ( $upd['reset'] == false ) {
|
408 |
+
if ( $upd['hit'] ) {
|
409 |
+
$wpdb->query( "UPDATE $wpdb->flagpictures SET `hitcounter` = `hitcounter`+1 WHERE pid = $pid" );
|
410 |
+
}
|
411 |
+
if ( $upd['vote'] ) {
|
412 |
+
$wpdb->query( "UPDATE $wpdb->flagpictures SET `total_votes` = IF(hitcounter > total_votes, total_votes+1, hitcounter) WHERE pid = $pid" );
|
413 |
+
}
|
414 |
+
} else {
|
415 |
+
if ( $upd['hit'] ) {
|
416 |
+
$hit = abs( intval( $upd['hit'] ) );
|
417 |
+
$wpdb->query( "UPDATE $wpdb->flagpictures SET `hitcounter` = $hit WHERE pid = $pid" );
|
418 |
+
}
|
419 |
+
if ( $upd['vote'] == 1 ) {
|
420 |
+
$vote = abs( intval( $upd['vote'] ) );
|
421 |
+
$wpdb->query( "UPDATE $wpdb->flagpictures SET `total_votes` = IF(hitcounter > $vote, $vote, hitcounter) WHERE pid = $pid" );
|
422 |
+
}
|
423 |
+
}
|
424 |
+
}
|
425 |
+
|
426 |
+
}
|
427 |
+
|
428 |
+
add_action( 'wp_ajax_flagallery_update_counters', 'flagallery_update_counters' );
|
429 |
+
add_action( 'wp_ajax_nopriv_flagallery_update_counters', 'flagallery_update_counters' );
|
430 |
+
function flagallery_update_counters() {
|
431 |
+
global $wpdb;
|
432 |
+
|
433 |
+
if ( empty( $_SERVER['HTTP_REFERER'] ) ) {
|
434 |
+
header( $_SERVER['SERVER_PROTOCOL'] . ' 400 Bad Request' );
|
435 |
+
die();
|
436 |
+
}
|
437 |
+
|
438 |
+
$ref = $_SERVER['HTTP_REFERER'];
|
439 |
+
//$uip = str_replace('.', '', $_SERVER['REMOTE_ADDR'])
|
440 |
+
if ( ( false === strpos( $ref, get_home_url() ) ) && ( false === strpos( $ref, get_site_url() ) ) ) {
|
441 |
+
header( $_SERVER['SERVER_PROTOCOL'] . ' 400 Bad Request' );
|
442 |
+
die();
|
443 |
+
}
|
444 |
+
if ( ( 'POST' !== $_SERVER['REQUEST_METHOD'] ) || ! isset( $_SERVER['HTTP_HOST'] ) || ! strpos( get_home_url(), $_SERVER['HTTP_HOST'] ) ) {
|
445 |
+
header( $_SERVER['SERVER_PROTOCOL'] . ' 400 Bad Request' );
|
446 |
+
die();
|
447 |
+
}
|
448 |
+
|
449 |
+
$json = (array) json_decode( stripslashes( $_POST['json'] ) );
|
450 |
+
//$upd = array('pid'=>false,'vote'=>false,'hit'=>false,'reset'=>false);
|
451 |
+
$upd_array = [];
|
452 |
+
if ( is_array( $json ) ) {
|
453 |
+
if ( isset( $json['views'] ) && is_array( $json['views'] ) ) {
|
454 |
+
foreach ( $json['views'] as $id ) {
|
455 |
+
if ( (int) $id ) {
|
456 |
+
$upd_array[ $id ] = [ 'pid' => $id, 'hit' => 1, 'vote' => false, 'reset' => false ];
|
457 |
+
}
|
458 |
+
}
|
459 |
+
}
|
460 |
+
if ( isset( $json['likes'] ) && is_array( $json['likes'] ) ) {
|
461 |
+
foreach ( $json['likes'] as $id ) {
|
462 |
+
if ( isset( $upd_array[ $id ] ) ) {
|
463 |
+
$upd_array[ $id ]['vote'] = 1;
|
464 |
+
}
|
465 |
+
}
|
466 |
+
}
|
467 |
+
}
|
468 |
+
|
469 |
+
$meta = [];
|
470 |
+
foreach ( $upd_array as $upd ) {
|
471 |
+
$pid = (int) $upd['pid'];
|
472 |
+
flag_update_counter( $upd );
|
473 |
+
$result = $wpdb->get_results( "SELECT hitcounter, total_votes FROM $wpdb->flagpictures WHERE `pid` = $pid" );
|
474 |
+
if ( $result ) {
|
475 |
+
$meta[ $pid ] = [
|
476 |
+
'views' => intval( $result[0]->hitcounter ),
|
477 |
+
'likes' => intval( $result[0]->total_votes ),
|
478 |
+
];
|
479 |
+
}
|
480 |
+
}
|
481 |
+
|
482 |
+
header( 'Content-Type: application/json; charset=' . get_option( 'blog_charset' ), true );
|
483 |
+
echo json_encode( $meta );
|
484 |
+
die();
|
485 |
+
}
|
admin/banner.functions.php
CHANGED
@@ -132,8 +132,7 @@ function flagSave_bPlaylist($title, $descr, $data, $file = '', $skinaction = '')
|
|
132 |
}
|
133 |
$properties = json_encode($settings);
|
134 |
|
135 |
-
|
136 |
-
$content = '<gallery>
|
137 |
<settings><![CDATA[' . $properties . ']]></settings>
|
138 |
<category id="' . $file . '">
|
139 |
<properties>
|
@@ -143,6 +142,7 @@ function flagSave_bPlaylist($title, $descr, $data, $file = '', $skinaction = '')
|
|
143 |
</properties>
|
144 |
<items>';
|
145 |
|
|
|
146 |
foreach((array) $data as $id){
|
147 |
$ban = get_post($id);
|
148 |
if($ban->ID){
|
@@ -159,20 +159,21 @@ function flagSave_bPlaylist($title, $descr, $data, $file = '', $skinaction = '')
|
|
159 |
</item>';
|
160 |
}
|
161 |
}
|
162 |
-
|
|
|
|
|
163 |
</items>
|
164 |
</category>
|
165 |
</gallery>';
|
166 |
-
|
167 |
-
|
168 |
-
|
169 |
-
|
170 |
-
|
171 |
-
|
172 |
-
}
|
173 |
-
} else{
|
174 |
-
flagGallery::show_message(__('Create directory please:', 'flash-album-gallery') . '"/' . $flag_options['galleryPath'] . 'playlists/banner/"');
|
175 |
}
|
|
|
|
|
176 |
}
|
177 |
}
|
178 |
|
132 |
}
|
133 |
$properties = json_encode($settings);
|
134 |
|
135 |
+
$content = '<gallery>
|
|
|
136 |
<settings><![CDATA[' . $properties . ']]></settings>
|
137 |
<category id="' . $file . '">
|
138 |
<properties>
|
142 |
</properties>
|
143 |
<items>';
|
144 |
|
145 |
+
if(count($data)){
|
146 |
foreach((array) $data as $id){
|
147 |
$ban = get_post($id);
|
148 |
if($ban->ID){
|
159 |
</item>';
|
160 |
}
|
161 |
}
|
162 |
+
}
|
163 |
+
|
164 |
+
$content .= '
|
165 |
</items>
|
166 |
</category>
|
167 |
</gallery>';
|
168 |
+
//$content = str_replace(array('\\\'','\"'), array('\'','"'), $content);
|
169 |
+
// Save options
|
170 |
+
$flag_options = get_option('flag_options');
|
171 |
+
if(wp_mkdir_p(ABSPATH . $flag_options['galleryPath'] . 'playlists/banner/')){
|
172 |
+
if(flagGallery::saveFile($playlistPath, $content, 'w')){
|
173 |
+
flagGallery::show_message(__('Playlist Saved Successfully', 'flash-album-gallery'));
|
|
|
|
|
|
|
174 |
}
|
175 |
+
} else{
|
176 |
+
flagGallery::show_message(__('Create directory please:', 'flash-album-gallery') . '"/' . $flag_options['galleryPath'] . 'playlists/banner/"');
|
177 |
}
|
178 |
}
|
179 |
|
admin/blocks/assets/icon-128x128.png
ADDED
Binary file
|
admin/blocks/dist/blocks.build.js
ADDED
@@ -0,0 +1 @@
|
|
|
1 |
+
!function(e){var t={};function n(r){if(t[r])return t[r].exports;var o=t[r]={i:r,l:!1,exports:{}};return e[r].call(o.exports,o,o.exports,n),o.l=!0,o.exports}n.m=e,n.c=t,n.d=function(e,t,r){n.o(e,t)||Object.defineProperty(e,t,{enumerable:!0,get:r})},n.r=function(e){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},n.t=function(e,t){if(1&t&&(e=n(e)),8&t)return e;if(4&t&&"object"==typeof e&&e&&e.__esModule)return e;var r=Object.create(null);if(n.r(r),Object.defineProperty(r,"default",{enumerable:!0,value:e}),2&t&&"string"!=typeof e)for(var o in e)n.d(r,o,function(t){return e[t]}.bind(null,o));return r},n.n=function(e){var t=e&&e.__esModule?function(){return e.default}:function(){return e};return n.d(t,"a",t),t},n.o=function(e,t){return Object.prototype.hasOwnProperty.call(e,t)},n.p="",n(n.s=2)}([function(e,t,n){},function(e,t,n){},function(e,t,n){"use strict";n.r(t);var r={};n.r(r),n.d(r,"name",(function(){return Je})),n.d(r,"title",(function(){return Ke})),n.d(r,"icon",(function(){return Qe})),n.d(r,"settings",(function(){return et}));n(0);function o(e){return(o="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e})(e)}function l(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function a(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}function i(e,t){return(i=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e})(e,t)}function c(e){var t=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Date.prototype.toString.call(Reflect.construct(Date,[],(function(){}))),!0}catch(e){return!1}}();return function(){var n,r=u(e);if(t){var o=u(this).constructor;n=Reflect.construct(r,arguments,o)}else n=r.apply(this,arguments);return s(this,n)}}function s(e,t){return!t||"object"!==o(t)&&"function"!=typeof t?function(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}(e):t}function u(e){return(u=Object.setPrototypeOf?Object.getPrototypeOf:function(e){return e.__proto__||Object.getPrototypeOf(e)})(e)}var f=function(e){!function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),t&&i(e,t)}(s,e);var t,n,r,o=c(s);function s(){return l(this,s),o.apply(this,arguments)}return t=s,(n=[{key:"render",value:function(){var e=this.props.attributes;return""===e.id?"":wp.element.createElement("div",{className:"flagallery-shortcode"},e.shortcode)}}])&&a(t.prototype,n),r&&a(t,r),s}(wp.element.Component);function p(e){return(p="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e})(e)}function y(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function m(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}function b(e,t){return(b=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e})(e,t)}function d(e){var t=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Date.prototype.toString.call(Reflect.construct(Date,[],(function(){}))),!0}catch(e){return!1}}();return function(){var n,r=g(e);if(t){var o=g(this).constructor;n=Reflect.construct(r,arguments,o)}else n=r.apply(this,arguments);return h(this,n)}}function h(e,t){return!t||"object"!==p(t)&&"function"!=typeof t?function(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}(e):t}function g(e){return(g=Object.setPrototypeOf?Object.getPrototypeOf:function(e){return e.__proto__||Object.getPrototypeOf(e)})(e)}var w=wp.element.Component,v=window.FlaGallery,O=function(e){!function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),t&&b(e,t)}(l,e);var t,n,r,o=d(l);function l(){return y(this,l),o.apply(this,arguments)}return t=l,(n=[{key:"createShortCode",value:function(e){var t,n=e.id,r=e.type,o=e.galleryname||"",l=e.skin||"",a=e.preset||"",i=e.align||"",c=e.width||"",s="",u="",f="";return t="gallery"===r?" gid=".concat(n):" album=".concat(n),o&&o.indexOf(" ")>=0&&(o="'".concat(o,"'")),o&&(o=" name=".concat(o)),f=c?" w=".concat(c):"",l?s=" skin=".concat(l):(s="",l=v.default_skin),a?u=a.indexOf(" ")>=0?" preset='".concat(a,"'"):" preset=".concat(a):(u="",a=""),i=i?" align=".concat(i):"","[flagallery".concat(t).concat(o).concat(f).concat(s).concat(u).concat(i,"]")}},{key:"render",value:function(){return""===this.props.attributes.id?"":wp.element.createElement("div",{className:"flagallery-shortcode"},this.createShortCode(this.props.attributes))}}])&&m(t.prototype,n),r&&m(t,r),l}(w);function k(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),n.push.apply(n,r)}return n}function R(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?k(Object(n),!0).forEach((function(t){P(e,t,n[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):k(Object(n)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))}))}return e}function P(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}var j=console.log,E={amron:!0,albumnavigator:!0,albumwiz:!0,horizon:!0,paginator:!0};function S(e){var t=window.FlaGallery,n=""===e?t.default_skin:e;return!!t.skins[n]&&E[n]}function _(e){var t=function(e){var t="".concat("gallery"===e.type?" gid=":" album=").concat(e.id.split("-").pop());""===e.id&&(t="");var n=""!==e.galleryname?" name=".concat(e.galleryname):"",r=""===e.skin?"":" skin=".concat(e.skin),o=""!==e.preset?" preset=".concat(e.preset):"";return""===t?"":"[flagallery".concat(t+n+r+o,"]")}(R(R({},this.props.attributes),e));e=R(R({},e),{shortcode:t}),this.props.setAttributes(e)}function A(e){var t=window.FlaGallery;if(S(e))if(t||t.skins){e=""===e?t.default_skin:e;var n="".concat(t.skins[e].screenshot.split("screenshot.png")[0],"js/").concat(e,".js");if(!function(e,t){var n=window.FlaGallery;if(t&&n&&n.skins&&n.skins[t].js)return!0;for(var r=new URL(e).pathname,o=document.getElementsByTagName("script"),l=0;l<o.length;l+=1){var a=o[l];if(a.src)if(new URL(a.src).pathname===r)return l=o.length,!0}return!1}(n,e)){var r=document.createElement("script");r.setAttribute("type","text/javascript"),r.src=n,r.async=!0,document.body.appendChild(r),j("Plug start load Script",e||"")}t.skins[e]?t.skins[e].js=!0:j("Unable to load script - missing FlaGallery")}else j("Unable to load script - missing FlaGallery")}n(1);function C(e){return(C="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e})(e)}function x(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function D(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}function G(e,t){return(G=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e})(e,t)}function W(e){var t=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Date.prototype.toString.call(Reflect.construct(Date,[],(function(){}))),!0}catch(e){return!1}}();return function(){var n,r=L(e);if(t){var o=L(this).constructor;n=Reflect.construct(r,arguments,o)}else n=r.apply(this,arguments);return N(this,n)}}function N(e,t){return!t||"object"!==C(t)&&"function"!=typeof t?T(e):t}function T(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}function L(e){return(L=Object.setPrototypeOf?Object.getPrototypeOf:function(e){return e.__proto__||Object.getPrototypeOf(e)})(e)}var M=wp.element,F=M.Component,B=M.createRef,U=wp.components,H=U.SelectControl,q=U.TextControl,I="flag-sh-code-bilder-",V=window.FlaGallery,Z=V.skins,z=function(e){!function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),t&&G(e,t)}(l,e);var t,n,r,o=W(l);function l(){var e;if(x(this,l),(e=o.apply(this,arguments)).setSomeAttributes=_.bind(T(e)),e.panelRef=B(),e.panel=void 0,e.albumsAndGalleries=[{value:"",label:"- Select your album / gallery -"}],e.albums=[{value:null,label:"Albums",disabled:!0}],Object.keys(V.albums).length>0)for(var t in V.albums)if(V.albums.hasOwnProperty(t)){var n=V.albums[t];e.albums.push({value:"album-".concat(n.id),label:n.name})}if(e.galleries=[{value:null,label:"Galleries",disabled:!0},{value:"gallery-all",label:"Show All Galleries"}],Object.keys(V.galleries).length>0)for(var r in V.galleries)if(V.galleries.hasOwnProperty(r)){var a=V.galleries[r];e.galleries.push({value:"gallery-".concat(a.gid),label:a.title})}e.albums.length>1&&(e.albumsAndGalleries=e.albumsAndGalleries.concat(e.albums)),e.albumsAndGalleries=e.albumsAndGalleries.concat(e.galleries);var i=V.skins[V.default_skin].name;if(e.skins=[{label:"".concat(i," - Default Skin"),value:""}],Object.keys(V.skins).length>0)for(var c in V.skins)if(V.skins.hasOwnProperty(c)){var s=V.skins[c],u={value:s.id,label:s.name};e.skins.push(u)}return e}return t=l,(n=[{key:"componentDidMount",value:function(){if(!this.panel&&this.panelRef&&this.panelRef.current){this.panel=this.panelRef.current;var e=document.createElement("style");this.panel.appendChild(e);var t="";for(var n in E)Object.prototype.hasOwnProperty.call(E,n)&&(t+='select option[value="'.concat(n,'"] { font-weight: 600;\tcolor: #007cba;}'));e.innerHTML=t}}},{key:"getPresetsBySkins",value:function(e){var t=[{label:"Default preset",value:""}];if(Object.keys(V.presets).length>0)for(var n in V.presets)if(V.presets.hasOwnProperty(n)){var r=V.presets[n];r.id===e&&t.push({value:r.name,label:r.name})}return t}},{key:"render",value:function(){var e=this,t=this.props.attributes,n=""===t.skin?V.default_skin:t.skin,r=Z&&Z[n]?Z[n]:void 0,o=this.getPresetsBySkins(t.skin);return wp.element.createElement("div",{className:"".concat(I,"gallery-tool")},wp.element.createElement("div",{className:"".concat(I,"skin-img")},r&&wp.element.createElement("img",{width:"320px",height:"240px",alt:r.name,src:r.screenshot})),wp.element.createElement("div",{ref:this.panelRef,className:"".concat(I,"panel")},wp.element.createElement(H,{options:this.albumsAndGalleries,value:t.id,onChange:function(t){var n=t.split("-")[0];e.setSomeAttributes({id:t,type:n,galleryRAW:"",loadingRAW:!1})}}),wp.element.createElement(H,{disabled:""===t.id,label:"Choose skin",options:this.skins,value:t.skin,onChange:function(t){A(""===t?V.default_skin:t);var n={skin:t,galleryRAW:"",loadingRAW:!1};""===t&&(n.preset=""),e.setSomeAttributes(n)}}),wp.element.createElement(H,{disabled:1===o.length||""===t.id,label:"Choose preset for gallery",options:o,onChange:function(t){e.setSomeAttributes({preset:t,galleryRAW:"",loadingRAW:!1})}}),wp.element.createElement(q,{disabled:""===t.id,label:"Gallery Title (optional)",value:t.galleryname,onChange:function(t){return e.setSomeAttributes({galleryname:t})}})),wp.element.createElement("div",{className:"".concat(I,"gallery-srtcode")},""===t.id?"":t.shortcode))}}])&&D(t.prototype,n),r&&D(t,r),l}(F);function X(e){return(X="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e})(e)}function Y(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function $(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}function J(e,t){return(J=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e})(e,t)}function K(e){var t=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Date.prototype.toString.call(Reflect.construct(Date,[],(function(){}))),!0}catch(e){return!1}}();return function(){var n,r=ee(e);if(t){var o=ee(this).constructor;n=Reflect.construct(r,arguments,o)}else n=r.apply(this,arguments);return Q(this,n)}}function Q(e,t){return!t||"object"!==X(t)&&"function"!=typeof t?function(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}(e):t}function ee(e){return(ee=Object.setPrototypeOf?Object.getPrototypeOf:function(e){return e.__proto__||Object.getPrototypeOf(e)})(e)}var te=window.FlaGallery,ne=wp.element,re=ne.Component,oe=ne.Fragment,le=wp.blockEditor.InspectorControls,ae=wp.components,ie=ae.PanelBody,ce=ae.Button,se=function(e){!function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),t&&J(e,t)}(l,e);var t,n,r,o=K(l);function l(){return Y(this,l),o.apply(this,arguments)}return t=l,(n=[{key:"componentDidUpdate",value:function(){var e=this;this.props.isSelected&&(window.tb_showIframe=function(){var t=document.getElementById("TB_iframeContent"),n=(t.contentDocument?t.contentDocument:t.contentWindow.document).getElementById("message");if(n){var r=n.getElementsByTagName("P")[0].textContent;r&&"Update Successfully"===r&&(window.tb_remove&&window.tb_remove(),e.props.setAttributes({galleryRAW:""}))}})}},{key:"render",value:function(){var e=this,t=this.props.attributes,n=new URL("".concat(te.assets.split("flash-album-gallery/")[0],"flash-album-gallery/admin/skin_options.php"));return n.searchParams.set("show_options","1"),n.searchParams.set("skin",""===t.skin?te.default_skin:t.skin),""!==t.preset&&n.searchParams.set("preset",t.preset),n.searchParams.set("TB_iframe","1"),n.searchParams.set("width","753"),n.searchParams.set("height","700"),wp.element.createElement(le,null,wp.element.createElement(oe,null,t.previewMode&&wp.element.createElement(oe,null,wp.element.createElement(ie,{className:"flag-inspector",title:"Gallery Picker"},wp.element.createElement(z,this.props)),wp.element.createElement("div",{className:"flag-sub-menu"},wp.element.createElement(ce,{isPrimary:!0,disabled:""===t.id,className:"thickbox",href:n},"Edit Skin Preset"),S(t.skin)&&wp.element.createElement(oe,null,wp.element.createElement(ce,{isSecondary:!0,onClick:function(){e.props.setAttributes({galleryRAW:"",loadingRAW:!1})}},"Refresh Preview"),wp.element.createElement("div",{className:"flag-notification"},"* In some cases, only part of the images will be shown in preview mode. But on the published page everything will be displayed in full."))))))}}])&&$(t.prototype,n),r&&$(t,r),l}(re);function ue(e){return(ue="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e})(e)}function fe(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function pe(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}function ye(e,t){return(ye=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e})(e,t)}function me(e){var t=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Date.prototype.toString.call(Reflect.construct(Date,[],(function(){}))),!0}catch(e){return!1}}();return function(){var n,r=de(e);if(t){var o=de(this).constructor;n=Reflect.construct(r,arguments,o)}else n=r.apply(this,arguments);return be(this,n)}}function be(e,t){return!t||"object"!==ue(t)&&"function"!=typeof t?function(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}(e):t}function de(e){return(de=Object.setPrototypeOf?Object.getPrototypeOf:function(e){return e.__proto__||Object.getPrototypeOf(e)})(e)}var he=window.FlaGallery,ge=wp.element,we=ge.Component,ve=ge.Fragment,Oe=wp.components.Button,ke="wp-block-flagallery-",Re=function(e){!function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),t&&ye(e,t)}(l,e);var t,n,r,o=me(l);function l(){return fe(this,l),o.apply(this,arguments)}return t=l,(n=[{key:"render",value:function(){var e=this,t=this.props.attributes,n=""!==he.license&&""!==he.pack;return wp.element.createElement("div",{className:"".concat(ke,"placeholder")},wp.element.createElement("img",{className:"".concat(ke,"logo"),width:"128px",height:"128px",src:"".concat(he.assets,"/icon-128x128.png"),alt:"flagallery logo"}),wp.element.createElement("h3",{className:"".concat(ke,"title")},"FLAGallery Photo Portfolio"),!n&&wp.element.createElement(ve,null,wp.element.createElement("div",{className:"".concat(ke,"get-premium")},wp.element.createElement("div",{className:"".concat(ke,"description")},"Help make the plugin better - become a member of our",wp.element.createElement("span",null," Premium Club "),"and get all our best solutions for your website."),wp.element.createElement("div",{className:"".concat(ke,"promo")},"You can use this promo code",wp.element.createElement("span",null," 30OFF "),"to get 30% discount and save $9. It’s a limited time offer."),wp.element.createElement(Oe,{className:"".concat(ke,"button-premium"),isPrimary:!0,href:"http://bit.ly/2jPNRB0",target:"_blank"},"Get Premium"))),n&&wp.element.createElement(ve,null,wp.element.createElement("div",{className:"flag-support"},wp.element.createElement(Oe,{isSecondary:!0,href:"https://mypgc.co/contact-fm/"},"Support for Premium Members"))),wp.element.createElement("h5",{className:"".concat(ke,"title")},"Gallery Picker"),wp.element.createElement(z,this.props),""!==t.id&&!t.previewMode&&S(t.skin)&&wp.element.createElement(Oe,{isPrimary:!0,style:{margin:"0 0 0 auto"},onClick:function(){return e.props.setAttributes({previewMode:!t.previewMode})}},"Preview Gallery"))}}])&&pe(t.prototype,n),r&&pe(t,r),l}(we);function Pe(e){return(Pe="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e})(e)}function je(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function Ee(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}function Se(e,t){return(Se=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e})(e,t)}function _e(e){var t=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Date.prototype.toString.call(Reflect.construct(Date,[],(function(){}))),!0}catch(e){return!1}}();return function(){var n,r=Ce(e);if(t){var o=Ce(this).constructor;n=Reflect.construct(r,arguments,o)}else n=r.apply(this,arguments);return Ae(this,n)}}function Ae(e,t){return!t||"object"!==Pe(t)&&"function"!=typeof t?function(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}(e):t}function Ce(e){return(Ce=Object.setPrototypeOf?Object.getPrototypeOf:function(e){return e.__proto__||Object.getPrototypeOf(e)})(e)}var xe=wp.element,De=xe.Component,Ge=xe.RawHTML,We=xe.createRef,Ne=wp.components.Spinner,Te=window.FlaGallery,Le=function(e){!function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),t&&Se(e,t)}(l,e);var t,n,r,o=_e(l);function l(){var e;return je(this,l),(e=o.apply(this,arguments)).galleryRef=We(),e.galleryVp=void 0,e}return t=l,(n=[{key:"componentDidMount",value:function(){!this.galleryVp&&this.galleryRef&&this.galleryRef.current&&(this.galleryVp=this.galleryRef.current)}},{key:"componentDidUpdate",value:function(){var e=this.props.attributes,t=""===e.skin?Te.default_skin:e.skin;if(""!==e.galleryRAW){var n=this.galleryVp.getElementsByClassName("".concat(t,"_skin"))[0],r=n?n.id:void 0;if(!r)return;window["fla_module_".concat(t)]&&window["fla_module_".concat(t)].initVPbyID(r)}}},{key:"render",value:function(){var e=this.props.attributes;return wp.element.createElement("div",{ref:this.galleryRef,className:"flagallery-block-raw-wrap"},""===e.galleryRAW&&wp.element.createElement("div",{className:"flag-preloader"},wp.element.createElement(Ne,null)),""!==e.galleryRAW&&wp.element.createElement(Ge,{key:"html".concat(e.is).concat(e.skin),className:"flag-block-raw"},e.galleryRAW))}}])&&Ee(t.prototype,n),r&&Ee(t,r),l}(De);function Me(e){return(Me="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e})(e)}function Fe(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function Be(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}function Ue(e,t){return(Ue=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e})(e,t)}function He(e){var t=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Date.prototype.toString.call(Reflect.construct(Date,[],(function(){}))),!0}catch(e){return!1}}();return function(){var n,r=Ve(e);if(t){var o=Ve(this).constructor;n=Reflect.construct(r,arguments,o)}else n=r.apply(this,arguments);return qe(this,n)}}function qe(e,t){return!t||"object"!==Me(t)&&"function"!=typeof t?Ie(e):t}function Ie(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}function Ve(e){return(Ve=Object.setPrototypeOf?Object.getPrototypeOf:function(e){return e.__proto__||Object.getPrototypeOf(e)})(e)}var Ze=wp.element,ze=Ze.Component,Xe=Ze.Fragment,Ye=window.FlaGallery,$e=function(e){!function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),t&&Ue(e,t)}(l,e);var t,n,r,o=He(l);function l(){var e;return Fe(this,l),(e=o.apply(this,arguments)).setSomeAttributes=_.bind(Ie(e)),e.requestGalleryRAWHndler=e.requestGalleryRAWHndler.bind(Ie(e)),e.props.attributes.galleryRAW="",e.props.attributes.loadingRAW=!1,""!==e.props.attributes.id&&1===e.props.attributes.id.split("-").length&&e.setSomeAttributes({id:"".concat(e.props.attributes.type,"-").concat(e.props.attributes.id)}),e}return t=l,(n=[{key:"componentDidMount",value:function(){var e=this.props.attributes;e.skin,A(e.skin),e.previewMode&&S(e.skin)&&""===e.galleryRAW&&!e.loadingRAW&&this.getRAWforShortcode()}},{key:"componentDidUpdate",value:function(){var e=this.props.attributes;""!==e.shortcode&&e.previewMode&&S(e.skin)&&""===e.galleryRAW&&!e.loadingRAW&&this.getRAWforShortcode()}},{key:"getRAWforShortcode",value:function(){var e=this.props.attributes;""!==e.shortcode&&(this.props.setAttributes({loadingRAW:!0}),function(e,t,n,r,o){var l=new URL(e),a=new XMLHttpRequest;a.open("POST",l,!0),a.setRequestHeader("Content-Type","application/x-www-form-urlencoded; charset=UTF-8"),a.onreadystatechange=function(){if(4===a.readyState){var e={};200!==a.status?e.error=a.statusText:e.data=a.responseText,r&&(e.params=r),o&&"function"==typeof o&&o(e)}},a.onerror=function(){j("An error occurred while transferring the file.")};try{j("request=".concat(n)),a.send("action=flagallery_shortcode_html&_wpnonce=".concat(t,"&shortcode=").concat(n))}catch(e){j(e)}}(Ye.ajaxurl,Ye.nonce,e.shortcode,null,this.requestGalleryRAWHndler))}},{key:"requestGalleryRAWHndler",value:function(e){this.props.setAttributes({loadingRAW:!1,galleryRAW:e.data?e.data:"ERROR"})}},{key:"render",value:function(){var e=this.props.attributes;return wp.element.createElement(Xe,null,wp.element.createElement(se,this.props),wp.element.createElement("div",{className:this.props.className},wp.element.createElement(Xe,null,(!e.previewMode||!S(e.skin))&&wp.element.createElement(Re,this.props),e.previewMode&&S(e.skin)&&wp.element.createElement(Le,this.props))))}}])&&Be(t.prototype,n),r&&Be(t,r),l}(ze),Je="gallery",Ke="GRAND FlAGallery",Qe={foreground:"#007cba",src:wp.element.createElement("svg",{xmlns:"http://www.w3.org/2000/svg",height:"24px",version:"1.1",viewBox:"0 0 24 24",width:"24px"},wp.element.createElement("title",null),wp.element.createElement("desc",null),wp.element.createElement("defs",null),wp.element.createElement("g",{fillRule:"evenodd",id:"miu",stroke:"none",strokeWidth:"1"},wp.element.createElement("g",{id:"Artboard-1",transform:"translate(-395.000000, -299.000000)"},wp.element.createElement("g",{id:"slice",transform:"translate(215.000000, 119.000000)"}),wp.element.createElement("path",{d:"M396.140488,305 C396.062898,305 396,305.057936 396,305.128791 L396,320.871209 C396,320.942338 396.06311,321 396.140488,321 L417.859512,321 C417.937102,321 418,320.942064 418,320.871209 L418,305.128791 C418,305.057662 417.93689,305 417.859512,305 L396.140488,305 Z M404.311468,308.965573 L407.568023,314.589603 C407.608096,314.658809 407.694647,314.676887 407.758887,314.631708 L410.521394,312.688868 C410.650699,312.59793 410.822887,312.629655 410.909233,312.764808 L415.929855,318.623341 C416.014748,318.75622 415.953368,318.863939 415.803474,318.863939 L398.147227,318.863939 C397.992123,318.863939 397.924733,318.751431 397.997976,318.6102 L404.035029,308.969159 C404.107704,308.829023 404.232913,308.829911 404.311468,308.965573 Z M413.5,310 C414.328427,310 415,309.328427 415,308.5 C415,307.671573 414.328427,307 413.5,307 C412.671573,307 412,307.671573 412,308.5 C412,309.328427 412.671573,310 413.5,310 Z M398,301 L398,302 L416,302 L416,301 L398,301 Z M397,303 L397,304 L417,304 L417,303 L397,303 Z",id:"editor-images-pictures-photos-collection-glyph"}))))},et={title:Ke,description:"Displaying GRAND FLA Galleries or FLA Albums",keywords:["lightbox","gallery","fla","images","youtube","vimeo","album","slider","grand"],attributes:{galleryname:{type:"string",default:""},id:{type:"string",default:""},type:{type:"string",default:"gallery"},skin:{type:"string",default:""},preset:{type:"string",default:""},shortcode:{type:"string",default:""},previewMode:{type:"boolean",default:!1}},supports:{align:["wide","full"],html:!1},deprecated:[{attributes:{galleryname:{type:"string",default:""},id:{type:"string",default:""},type:{type:"string",default:"gallery"},skin:{type:"string",default:""},preset:{type:"string",default:""},align:{type:"string",default:"none"},width:{type:"string",default:"100%"}},save:O}],edit:$e,save:f};function tt(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),n.push.apply(n,r)}return n}function nt(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}var rt=wp.blocks.registerBlockType,ot=(0,wp.blocks.getCategories)().some((function(e){return"media"===e.slug}));[r].forEach((function(e){if(e){var t=e.name,n=e.icon,r=e.settings;rt("flagallery/".concat(t),function(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?tt(Object(n),!0).forEach((function(t){nt(e,t,n[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):tt(Object(n)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))}))}return e}({category:ot?"media":"common",icon:n},r))}}))}]);
|
admin/blocks/dist/blocks.build.style.css
ADDED
@@ -0,0 +1,4 @@
|
|
|
|
|
|
|
|
|
1 |
+
.wp-block-flagallery-gallery{min-height:200px}.wp-block-flagallery-gallery .wp-block-flagallery-placeholder{display:flex;flex-direction:column;box-shadow:-2px 2px 10px 0px rgba(68,68,68,0.4);background:white;padding:20px}.wp-block-flagallery-gallery .wp-block-flagallery-placeholder .wp-block-flagallery-logo{margin:15px auto;width:70px;height:70px}.wp-block-flagallery-gallery .wp-block-flagallery-placeholder .wp-block-flagallery-title{margin:10px auto}.wp-block-flagallery-gallery .wp-block-flagallery-placeholder .flag-support{display:flex;justify-content:center;margin:0 auto 15px}.wp-block-flagallery-gallery .wp-block-flagallery-placeholder .flag-support a{margin:9 10px}.wp-block-flagallery-gallery .wp-block-flagallery-placeholder .wp-block-flagallery-get-premium{max-width:570px;display:flex;flex-direction:column;margin:0 auto}.wp-block-flagallery-gallery .wp-block-flagallery-placeholder .wp-block-flagallery-description{font-size:17px;font-family:system-ui;margin:7px;color:#ffffff;text-align:center;background-color:#007cba;border-radius:3px;line-height:1.4;padding:10px}.wp-block-flagallery-gallery .wp-block-flagallery-placeholder .wp-block-flagallery-description span{font-weight:500}.wp-block-flagallery-gallery .wp-block-flagallery-placeholder .wp-block-flagallery-promo{font-size:14px;padding:0 20px;font-style:italic}.wp-block-flagallery-gallery .wp-block-flagallery-placeholder .wp-block-flagallery-promo span{font-weight:700}.wp-block-flagallery-gallery .wp-block-flagallery-placeholder .wp-block-flagallery-button-premium{margin:5px auto;padding:20px 50px;font-size:16px;background-color:#eb4c48;font-weight:600}.flag-notification{font-style:italic;color:#007cba}.flag-sub-menu{display:flex;flex-direction:column;padding:0 15px 15px}.flag-sub-menu *{margin:5px auto}.flagallery-block-raw-wrap{position:relative}.flagallery-block-raw-wrap .flag-preloader{min-height:670px}.flagallery-block-raw-wrap .flag-preloader span{position:absolute;top:50%;left:50%;transform:translate(-50%, -50%)}.flag-block-raw{pointer-events:none}.is-selected .flag-block-raw{pointer-events:unset}
|
2 |
+
|
3 |
+
.flag-sh-code-bilder-gallery-tool{max-width:570px;display:flex;flex-direction:row;flex-wrap:wrap;justify-content:space-around;margin:10px auto}.flag-sh-code-bilder-gallery-tool .flag-sh-code-bilder-title{text-align:center;margin:20px 0 !important;width:100%}.flag-sh-code-bilder-gallery-tool .flag-sh-code-bilder-gallery-srtcode{width:100%;font-size:13px;font-family:monospace;background-color:aliceblue;line-height:2;padding:0 10px}.flag-sh-code-bilder-panel select option:disabled{background-color:#eae9e9 !important;font-weight:600 !important}.wp-block-flagallery-placeholder .flag-sh-code-bilder-gallery-tool .flag-sh-code-bilder-skin-img{min-width:200px;max-width:40%}.wp-block-flagallery-placeholder .flag-sh-code-bilder-gallery-tool .flag-sh-code-bilder-panel{padding:0 0 0 10px;max-width:60%}.wp-block-flagallery-placeholder .flag-sh-code-bilder-gallery-tool .flag-sh-code-bilder-panel label{font-weight:unset !important;margin-bottom:2px !important}.flag-inspector .flag-sh-code-bilder-gallery-tool .flag-sh-code-bilder-skin-img{width:100%;margin-bottom:18px}.flag-inspector .flag-sh-code-bilder-gallery-tool .flag-sh-code-bilder-panel{width:100%}.flag-inspector .flag-sh-code-bilder-gallery-tool .flag-sh-code-bilder-gallery-srtcode{font-size:11px}.flag-inspector .flag-sh-code-bilder-gallery-tool .components-base-control{margin-bottom:0}
|
4 |
+
|
admin/blocks/init.php
ADDED
@@ -0,0 +1,87 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
/**
|
4 |
+
* Gutenberg block init.
|
5 |
+
*
|
6 |
+
*/
|
7 |
+
class flagGutenberg
|
8 |
+
{
|
9 |
+
|
10 |
+
// constructor.
|
11 |
+
public function __construct()
|
12 |
+
{
|
13 |
+
add_action('enqueue_block_editor_assets', [$this, 'gutenberg_assets']);
|
14 |
+
}
|
15 |
+
|
16 |
+
/**
|
17 |
+
* Enqueue the block's assets for the gutenberg editor.
|
18 |
+
*/
|
19 |
+
public function gutenberg_assets()
|
20 |
+
{
|
21 |
+
global $flagdb, $flag;
|
22 |
+
$flag_version = $flag->version;
|
23 |
+
wp_register_style(
|
24 |
+
'flagallery-block-editor',
|
25 |
+
plugins_url('blocks/dist/blocks.build.style.css', dirname(__FILE__)),
|
26 |
+
[],
|
27 |
+
$flag_version
|
28 |
+
);
|
29 |
+
|
30 |
+
require_once(dirname(dirname(__FILE__)) . '/get_skin.php');
|
31 |
+
|
32 |
+
$flag_options = get_option('flag_options');
|
33 |
+
$all_skins = get_skins();
|
34 |
+
$skins = [];
|
35 |
+
$presets = [];
|
36 |
+
foreach ($all_skins as $skin_file => $skin_data) {
|
37 |
+
$id = dirname($skin_file);
|
38 |
+
$is_default = ($id == $flag_options['flashSkin']);
|
39 |
+
$skins[$id] = [
|
40 |
+
'id' => $id,
|
41 |
+
'name' => $skin_data['Name'],
|
42 |
+
'is_default' => $is_default,
|
43 |
+
'screenshot' => WP_PLUGIN_URL . '/flagallery-skins/' . $id . '/screenshot.png',
|
44 |
+
];
|
45 |
+
if (empty($flag_options["{$id}_options"]['presets'])) {
|
46 |
+
continue;
|
47 |
+
}
|
48 |
+
foreach ($flag_options["{$id}_options"]['presets'] as $preset_name => $settings) {
|
49 |
+
$key = $id . ' ' . $preset_name;
|
50 |
+
$presets[$key] = [
|
51 |
+
'id' => $id,
|
52 |
+
'name' => $preset_name,
|
53 |
+
];
|
54 |
+
}
|
55 |
+
}
|
56 |
+
$data = [
|
57 |
+
'default_skin' => $flag_options['flashSkin'],
|
58 |
+
'skins' => (object) $skins,
|
59 |
+
'presets' => (object) $presets,
|
60 |
+
'galleries' => $flagdb->find_all_galleries($flag->options['albSort'], $flag->options['albSortDir']),
|
61 |
+
'albums' => $flagdb->find_all_albums('id', 'ASC'),
|
62 |
+
'assets' => FLAG_URLPATH . 'admin/blocks/assets',
|
63 |
+
'ajaxurl' => admin_url('admin-ajax.php'),
|
64 |
+
'nonce' => wp_create_nonce('FlaGallery'),
|
65 |
+
'license' => strtolower($flag_options['license_key']),
|
66 |
+
'pack' => $flag_options['license_name'],
|
67 |
+
];
|
68 |
+
wp_register_script(
|
69 |
+
'flagallery-blocks-script',
|
70 |
+
plugins_url('blocks/dist/blocks.build.js', dirname(__FILE__)),
|
71 |
+
['wp-blocks', 'wp-element', 'wp-editor'],
|
72 |
+
$flag_version,
|
73 |
+
false
|
74 |
+
);
|
75 |
+
|
76 |
+
wp_localize_script('flagallery-blocks-script', 'FlaGallery', $data);
|
77 |
+
add_thickbox();
|
78 |
+
|
79 |
+
register_block_type(
|
80 |
+
'flagallery/gallery',
|
81 |
+
[
|
82 |
+
'editor_script' => 'flagallery-blocks-script',
|
83 |
+
'editor_style' => 'flagallery-block-editor',
|
84 |
+
]
|
85 |
+
);
|
86 |
+
}
|
87 |
+
}
|
admin/css/flagadmin.css
CHANGED
@@ -1,599 +1,641 @@
|
|
1 |
-
/*
|
2 |
-
** FlaGallery Admin StyleSheet
|
3 |
-
*/
|
4 |
-
|
5 |
-
/* SETTINGS FOR SKIN PAGE */
|
6 |
-
.skins .inactive,
|
7 |
-
.skins .inactive th,
|
8 |
-
.skins .inactive td {
|
9 |
-
background-color: #ebeeef;
|
10 |
-
}
|
11 |
-
.skins .active,
|
12 |
-
.skins .active th,
|
13 |
-
.skins .active td {
|
14 |
-
color: #000;
|
15 |
-
}
|
16 |
-
.skins .inactive a:not(.button) {
|
17 |
-
color: #557799;
|
18 |
-
}
|
19 |
-
.skins .inactive a:not(.button):hover {
|
20 |
-
color: #d54e21;
|
21 |
-
}
|
22 |
-
.skins tr.first td {border-bottom:1px solid #F9F9F9;}
|
23 |
-
.skins tr.second td {border-top:none; border-bottom: 30px solid #f1f1f1;}
|
24 |
-
.skins td img { max-width:
|
25 |
-
|
26 |
-
fieldset {
|
27 |
-
padding: 0;
|
28 |
-
margin: 0;
|
29 |
-
border: 0;
|
30 |
-
min-width: 0;
|
31 |
-
}
|
32 |
-
legend {
|
33 |
-
display: block;
|
34 |
-
width: 100%;
|
35 |
-
padding: 0;
|
36 |
-
margin-bottom: 20px;
|
37 |
-
font-size: 21px;
|
38 |
-
line-height: inherit;
|
39 |
-
color: #333333;
|
40 |
-
border: 0;
|
41 |
-
border-bottom: 1px solid #e5e5e5;
|
42 |
-
}
|
43 |
-
label {
|
44 |
-
display: inline-block;
|
45 |
-
max-width: 100%;
|
46 |
-
margin-bottom: 5px;
|
47 |
-
font-weight: bold;
|
48 |
-
}
|
49 |
-
.form-control {
|
50 |
-
display: block;
|
51 |
-
width: 100%;
|
52 |
-
height: 34px;
|
53 |
-
padding: 6px 12px;
|
54 |
-
font-size: 14px;
|
55 |
-
line-height: 1.42857143;
|
56 |
-
color: #555555;
|
57 |
-
background-color: #ffffff;
|
58 |
-
background-image: none;
|
59 |
-
border: 1px solid #cccccc;
|
60 |
-
border-radius: 4px;
|
61 |
-
box-sizing: border-box;
|
62 |
-
-webkit-box-shadow: inset 0 1px 1px rgba(0, 0, 0, 0.075);
|
63 |
-
box-shadow: inset 0 1px 1px rgba(0, 0, 0, 0.075);
|
64 |
-
-webkit-transition: border-color ease-in-out .15s, -webkit-box-shadow ease-in-out .15s;
|
65 |
-
-o-transition: border-color ease-in-out .15s, box-shadow ease-in-out .15s;
|
66 |
-
transition: border-color ease-in-out .15s, box-shadow ease-in-out .15s;
|
67 |
-
}
|
68 |
-
.form-control:focus {
|
69 |
-
border-color: #66afe9;
|
70 |
-
outline: 0;
|
71 |
-
-webkit-box-shadow: inset 0 1px 1px rgba(0,0,0,.075), 0 0 8px rgba(102, 175, 233, 0.6);
|
72 |
-
box-shadow: inset 0 1px 1px rgba(0,0,0,.075), 0 0 8px rgba(102, 175, 233, 0.6);
|
73 |
-
}
|
74 |
-
.form-control::-moz-placeholder {
|
75 |
-
color: #999999;
|
76 |
-
opacity: 1;
|
77 |
-
}
|
78 |
-
.form-control:-ms-input-placeholder {
|
79 |
-
color: #999999;
|
80 |
-
}
|
81 |
-
.form-control::-webkit-input-placeholder {
|
82 |
-
color: #999999;
|
83 |
-
}
|
84 |
-
.form-control::-ms-expand {
|
85 |
-
border: 0;
|
86 |
-
background-color: transparent;
|
87 |
-
}
|
88 |
-
.form-control[disabled],
|
89 |
-
.form-control[readonly],
|
90 |
-
fieldset[disabled] .form-control {
|
91 |
-
background-color: #eeeeee;
|
92 |
-
opacity: 1;
|
93 |
-
}
|
94 |
-
.form-control[disabled],
|
95 |
-
fieldset[disabled] .form-control {
|
96 |
-
cursor: not-allowed;
|
97 |
-
}
|
98 |
-
textarea.form-control {
|
99 |
-
height: auto;
|
100 |
-
}
|
101 |
-
.form-group {
|
102 |
-
margin-bottom: 15px;
|
103 |
-
}
|
104 |
-
.radio,
|
105 |
-
.checkbox {
|
106 |
-
position: relative;
|
107 |
-
display: block;
|
108 |
-
margin-top: 10px;
|
109 |
-
margin-bottom: 10px;
|
110 |
-
}
|
111 |
-
.radio label,
|
112 |
-
.checkbox label {
|
113 |
-
min-height: 20px;
|
114 |
-
padding-left: 20px;
|
115 |
-
margin-bottom: 0;
|
116 |
-
font-weight:
|
117 |
-
cursor: pointer;
|
118 |
-
}
|
119 |
-
.radio input[type="radio"],
|
120 |
-
.radio-inline input[type="radio"],
|
121 |
-
.checkbox input[type="checkbox"],
|
122 |
-
.checkbox-inline input[type="checkbox"] {
|
123 |
-
position: absolute;
|
124 |
-
margin: 0 0 0 -20px;
|
125 |
-
margin-top: 4px \9;
|
126 |
-
width:16px;
|
127 |
-
height:16px;
|
128 |
-
}
|
129 |
-
.radio + .radio,
|
130 |
-
.checkbox + .checkbox {
|
131 |
-
margin-top: -5px;
|
132 |
-
}
|
133 |
-
.radio-inline,
|
134 |
-
.checkbox-inline {
|
135 |
-
position: relative;
|
136 |
-
display: inline-block;
|
137 |
-
padding-left: 20px;
|
138 |
-
margin-bottom: 0;
|
139 |
-
vertical-align: middle;
|
140 |
-
font-weight: normal;
|
141 |
-
cursor: pointer;
|
142 |
-
}
|
143 |
-
.radio-inline + .radio-inline,
|
144 |
-
.checkbox-inline + .checkbox-inline {
|
145 |
-
margin-top: 0;
|
146 |
-
margin-left: 10px;
|
147 |
-
}
|
148 |
-
input[type="radio"][disabled],
|
149 |
-
input[type="checkbox"][disabled],
|
150 |
-
input[type="radio"].disabled,
|
151 |
-
input[type="checkbox"].disabled,
|
152 |
-
fieldset[disabled] input[type="radio"],
|
153 |
-
fieldset[disabled] input[type="checkbox"] {
|
154 |
-
cursor: not-allowed;
|
155 |
-
}
|
156 |
-
.radio-inline.disabled,
|
157 |
-
.checkbox-inline.disabled,
|
158 |
-
fieldset[disabled] .radio-inline,
|
159 |
-
fieldset[disabled] .checkbox-inline {
|
160 |
-
cursor: not-allowed;
|
161 |
-
}
|
162 |
-
.radio.disabled label,
|
163 |
-
.checkbox.disabled label,
|
164 |
-
fieldset[disabled] .radio label,
|
165 |
-
fieldset[disabled] .checkbox label {
|
166 |
-
cursor: not-allowed;
|
167 |
-
}
|
168 |
-
.form-control-static {
|
169 |
-
padding-top: 7px;
|
170 |
-
padding-bottom: 7px;
|
171 |
-
margin-bottom: 0;
|
172 |
-
min-height: 34px;
|
173 |
-
}
|
174 |
-
.form-control-static.input-lg,
|
175 |
-
.form-control-static.input-sm {
|
176 |
-
padding-left: 0;
|
177 |
-
padding-right: 0;
|
178 |
-
}
|
179 |
-
.input-sm {
|
180 |
-
height: 30px;
|
181 |
-
padding: 5px 10px;
|
182 |
-
font-size: 12px;
|
183 |
-
line-height: 1.5;
|
184 |
-
border-radius: 3px;
|
185 |
-
box-sizing:border-box;
|
186 |
-
}
|
187 |
-
select.input-sm {
|
188 |
-
height: 30px;
|
189 |
-
line-height: 30px;
|
190 |
-
}
|
191 |
-
textarea.input-sm,
|
192 |
-
select[multiple].input-sm {
|
193 |
-
height: auto;
|
194 |
-
}
|
195 |
-
.form-group-sm .form-control {
|
196 |
-
height: 30px;
|
197 |
-
padding: 5px 10px;
|
198 |
-
font-size: 12px;
|
199 |
-
line-height: 1.5;
|
200 |
-
border-radius: 3px;
|
201 |
-
}
|
202 |
-
.form-group-sm select.form-control {
|
203 |
-
height: 30px;
|
204 |
-
line-height: 30px;
|
205 |
-
}
|
206 |
-
.form-group-sm textarea.form-control,
|
207 |
-
.form-group-sm select[multiple].form-control {
|
208 |
-
height: auto;
|
209 |
-
}
|
210 |
-
.form-group-sm .form-control-static {
|
211 |
-
height: 30px;
|
212 |
-
min-height: 32px;
|
213 |
-
padding: 6px 10px;
|
214 |
-
font-size: 12px;
|
215 |
-
line-height: 1.5;
|
216 |
-
}
|
217 |
-
.input-lg {
|
218 |
-
height: 46px;
|
219 |
-
padding: 10px 16px;
|
220 |
-
font-size: 18px;
|
221 |
-
line-height: 1.3333333;
|
222 |
-
border-radius: 6px;
|
223 |
-
}
|
224 |
-
select.input-lg {
|
225 |
-
height: 46px;
|
226 |
-
line-height: 46px;
|
227 |
-
}
|
228 |
-
textarea.input-lg,
|
229 |
-
select[multiple].input-lg {
|
230 |
-
height: auto;
|
231 |
-
}
|
232 |
-
.form-group-lg .form-control {
|
233 |
-
height: 46px;
|
234 |
-
padding: 10px 16px;
|
235 |
-
font-size: 18px;
|
236 |
-
line-height: 1.3333333;
|
237 |
-
border-radius: 6px;
|
238 |
-
}
|
239 |
-
.form-group-lg select.form-control {
|
240 |
-
height: 46px;
|
241 |
-
line-height: 46px;
|
242 |
-
}
|
243 |
-
.form-group-lg textarea.form-control,
|
244 |
-
.form-group-lg select[multiple].form-control {
|
245 |
-
height: auto;
|
246 |
-
}
|
247 |
-
.form-group-lg .form-control-static {
|
248 |
-
height: 46px;
|
249 |
-
min-height: 38px;
|
250 |
-
padding: 11px 16px;
|
251 |
-
font-size: 18px;
|
252 |
-
line-height: 1.3333333;
|
253 |
-
}
|
254 |
-
.has-feedback {
|
255 |
-
position: relative;
|
256 |
-
}
|
257 |
-
.has-feedback .form-control {
|
258 |
-
padding-right: 42.5px;
|
259 |
-
}
|
260 |
-
.form-control-feedback {
|
261 |
-
position: absolute;
|
262 |
-
top: 0;
|
263 |
-
right: 0;
|
264 |
-
z-index: 2;
|
265 |
-
display: block;
|
266 |
-
width: 34px;
|
267 |
-
height: 34px;
|
268 |
-
line-height: 34px;
|
269 |
-
text-align: center;
|
270 |
-
pointer-events: none;
|
271 |
-
}
|
272 |
-
.input-lg + .form-control-feedback,
|
273 |
-
.input-group-lg + .form-control-feedback,
|
274 |
-
.form-group-lg .form-control + .form-control-feedback {
|
275 |
-
width: 46px;
|
276 |
-
height: 46px;
|
277 |
-
line-height: 46px;
|
278 |
-
}
|
279 |
-
.input-sm + .form-control-feedback,
|
280 |
-
.input-group-sm + .form-control-feedback,
|
281 |
-
.form-group-sm .form-control + .form-control-feedback {
|
282 |
-
width: 30px;
|
283 |
-
height: 30px;
|
284 |
-
line-height: 30px;
|
285 |
-
}
|
286 |
-
.help-block {
|
287 |
-
display: block;
|
288 |
-
margin-top: 5px;
|
289 |
-
margin-bottom: 10px;
|
290 |
-
|
291 |
-
|
292 |
-
|
293 |
-
.form-horizontal .
|
294 |
-
.form-horizontal .
|
295 |
-
.form-horizontal .
|
296 |
-
|
297 |
-
margin-
|
298 |
-
|
299 |
-
|
300 |
-
|
301 |
-
.form-horizontal .
|
302 |
-
|
303 |
-
|
304 |
-
|
305 |
-
|
306 |
-
margin-
|
307 |
-
|
308 |
-
|
309 |
-
.clearfix:
|
310 |
-
.
|
311 |
-
.form-horizontal .form-group:
|
312 |
-
|
313 |
-
|
314 |
-
|
315 |
-
|
316 |
-
.
|
317 |
-
|
318 |
-
|
319 |
-
|
320 |
-
|
321 |
-
|
322 |
-
margin-
|
323 |
-
|
324 |
-
|
325 |
-
|
326 |
-
|
327 |
-
|
328 |
-
|
329 |
-
|
330 |
-
|
331 |
-
|
332 |
-
|
333 |
-
.
|
334 |
-
|
335 |
-
|
336 |
-
|
337 |
-
|
338 |
-
|
339 |
-
|
340 |
-
|
341 |
-
|
342 |
-
}
|
343 |
-
|
344 |
-
|
345 |
-
|
346 |
-
|
347 |
-
|
348 |
-
|
349 |
-
|
350 |
-
|
351 |
-
|
352 |
-
|
353 |
-
|
354 |
-
|
355 |
-
}
|
356 |
-
|
357 |
-
|
358 |
-
|
359 |
-
|
360 |
-
|
361 |
-
|
362 |
-
|
363 |
-
|
364 |
-
|
365 |
-
|
366 |
-
|
367 |
-
|
368 |
-
|
369 |
-
|
370 |
-
|
371 |
-
.
|
372 |
-
|
373 |
-
|
374 |
-
|
375 |
-
|
376 |
-
}
|
377 |
-
|
378 |
-
|
379 |
-
|
380 |
-
|
381 |
-
|
382 |
-
|
383 |
-
|
384 |
-
|
385 |
-
|
386 |
-
|
387 |
-
|
388 |
-
|
389 |
-
|
390 |
-
}
|
391 |
-
|
392 |
-
|
393 |
-
|
394 |
-
|
395 |
-
|
396 |
-
|
397 |
-
|
398 |
-
|
399 |
-
|
400 |
-
|
401 |
-
|
402 |
-
|
403 |
-
|
404 |
-
|
405 |
-
|
406 |
-
|
407 |
-
|
408 |
-
|
409 |
-
|
410 |
-
|
411 |
-
|
412 |
-
|
413 |
-
|
414 |
-
}
|
415 |
-
|
416 |
-
|
417 |
-
|
418 |
-
}
|
419 |
-
|
420 |
-
.fixed .column-
|
421 |
-
|
422 |
-
}
|
423 |
-
|
424 |
-
|
425 |
-
|
426 |
-
|
427 |
-
|
428 |
-
|
429 |
-
|
430 |
-
|
431 |
-
|
432 |
-
|
433 |
-
|
434 |
-
|
435 |
-
|
436 |
-
|
437 |
-
|
438 |
-
|
439 |
-
|
440 |
-
|
441 |
-
|
442 |
-
|
443 |
-
.fixed .column-
|
444 |
-
|
445 |
-
}
|
446 |
-
|
447 |
-
.fixed
|
448 |
-
|
449 |
-
|
450 |
-
|
451 |
-
.fixed .column-
|
452 |
-
width:
|
453 |
-
}
|
454 |
-
.
|
455 |
-
|
456 |
-
|
457 |
-
|
458 |
-
|
459 |
-
.
|
460 |
-
|
461 |
-
|
462 |
-
|
463 |
-
|
464 |
-
|
465 |
-
.
|
466 |
-
.
|
467 |
-
.
|
468 |
-
.
|
469 |
-
|
470 |
-
|
471 |
-
|
472 |
-
.albums_table
|
473 |
-
.albums_table .
|
474 |
-
.albums_table .
|
475 |
-
|
476 |
-
.
|
477 |
-
.
|
478 |
-
.
|
479 |
-
|
480 |
-
.
|
481 |
-
.
|
482 |
-
.
|
483 |
-
|
484 |
-
|
485 |
-
.
|
486 |
-
|
487 |
-
|
488 |
-
|
489 |
-
|
490 |
-
|
491 |
-
|
492 |
-
|
493 |
-
|
494 |
-
|
495 |
-
|
496 |
-
|
497 |
-
|
498 |
-
|
499 |
-
|
500 |
-
|
501 |
-
|
502 |
-
|
503 |
-
|
504 |
-
}
|
505 |
-
|
506 |
-
div .progressbar
|
507 |
-
|
508 |
-
|
509 |
-
|
510 |
-
|
511 |
-
|
512 |
-
}
|
513 |
-
|
514 |
-
|
515 |
-
|
516 |
-
|
517 |
-
|
518 |
-
|
519 |
-
|
520 |
-
|
521 |
-
|
522 |
-
|
523 |
-
|
524 |
-
|
525 |
-
|
526 |
-
|
527 |
-
|
528 |
-
|
529 |
-
|
530 |
-
|
531 |
-
|
532 |
-
|
533 |
-
|
534 |
-
|
535 |
-
|
536 |
-
|
537 |
-
|
538 |
-
|
539 |
-
|
540 |
-
|
541 |
-
|
542 |
-
|
543 |
-
|
544 |
-
|
545 |
-
|
546 |
-
|
547 |
-
background-
|
548 |
-
background-
|
549 |
-
|
550 |
-
|
551 |
-
|
552 |
-
|
553 |
-
|
554 |
-
background-
|
555 |
-
background-
|
556 |
-
|
557 |
-
|
558 |
-
|
559 |
-
|
560 |
-
|
561 |
-
|
562 |
-
|
563 |
-
background
|
564 |
-
|
565 |
-
margin:
|
566 |
-
|
567 |
-
|
568 |
-
|
569 |
-
|
570 |
-
|
571 |
-
|
572 |
-
|
573 |
-
|
574 |
-
|
575 |
-
|
576 |
-
|
577 |
-
|
578 |
-
|
579 |
-
|
580 |
-
|
581 |
-
|
582 |
-
|
583 |
-
|
584 |
-
|
585 |
-
|
586 |
-
|
587 |
-
|
588 |
-
.
|
589 |
-
|
590 |
-
|
591 |
-
|
592 |
-
|
593 |
-
|
594 |
-
}
|
595 |
-
|
596 |
-
|
597 |
-
|
598 |
-
|
599 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
/*
|
2 |
+
** FlaGallery Admin StyleSheet
|
3 |
+
*/
|
4 |
+
|
5 |
+
/* SETTINGS FOR SKIN PAGE */
|
6 |
+
.skins .inactive,
|
7 |
+
.skins .inactive th,
|
8 |
+
.skins .inactive td {
|
9 |
+
background-color: #ebeeef;
|
10 |
+
}
|
11 |
+
.skins .active,
|
12 |
+
.skins .active th,
|
13 |
+
.skins .active td {
|
14 |
+
color: #000;
|
15 |
+
}
|
16 |
+
.skins .inactive a:not(.button) {
|
17 |
+
color: #557799;
|
18 |
+
}
|
19 |
+
.skins .inactive a:not(.button):hover {
|
20 |
+
color: #d54e21;
|
21 |
+
}
|
22 |
+
.skins tr.first td {border-bottom:1px solid #F9F9F9;}
|
23 |
+
.skins tr.second td {border-top:none; border-bottom: 30px solid #f1f1f1;}
|
24 |
+
.skins td img { max-width:250px;}
|
25 |
+
|
26 |
+
fieldset {
|
27 |
+
padding: 0;
|
28 |
+
margin: 0;
|
29 |
+
border: 0;
|
30 |
+
min-width: 0;
|
31 |
+
}
|
32 |
+
legend {
|
33 |
+
display: block;
|
34 |
+
width: 100%;
|
35 |
+
padding: 0;
|
36 |
+
margin-bottom: 20px;
|
37 |
+
font-size: 21px;
|
38 |
+
line-height: inherit;
|
39 |
+
color: #333333;
|
40 |
+
border: 0;
|
41 |
+
border-bottom: 1px solid #e5e5e5;
|
42 |
+
}
|
43 |
+
label {
|
44 |
+
display: inline-block;
|
45 |
+
max-width: 100%;
|
46 |
+
margin-bottom: 5px;
|
47 |
+
font-weight: bold;
|
48 |
+
}
|
49 |
+
.form-control {
|
50 |
+
display: block;
|
51 |
+
width: 100%;
|
52 |
+
height: 34px;
|
53 |
+
padding: 6px 12px;
|
54 |
+
font-size: 14px;
|
55 |
+
line-height: 1.42857143;
|
56 |
+
color: #555555;
|
57 |
+
background-color: #ffffff;
|
58 |
+
background-image: none;
|
59 |
+
border: 1px solid #cccccc;
|
60 |
+
border-radius: 4px;
|
61 |
+
box-sizing: border-box;
|
62 |
+
-webkit-box-shadow: inset 0 1px 1px rgba(0, 0, 0, 0.075);
|
63 |
+
box-shadow: inset 0 1px 1px rgba(0, 0, 0, 0.075);
|
64 |
+
-webkit-transition: border-color ease-in-out .15s, -webkit-box-shadow ease-in-out .15s;
|
65 |
+
-o-transition: border-color ease-in-out .15s, box-shadow ease-in-out .15s;
|
66 |
+
transition: border-color ease-in-out .15s, box-shadow ease-in-out .15s;
|
67 |
+
}
|
68 |
+
.form-control:focus {
|
69 |
+
border-color: #66afe9;
|
70 |
+
outline: 0;
|
71 |
+
-webkit-box-shadow: inset 0 1px 1px rgba(0,0,0,.075), 0 0 8px rgba(102, 175, 233, 0.6);
|
72 |
+
box-shadow: inset 0 1px 1px rgba(0,0,0,.075), 0 0 8px rgba(102, 175, 233, 0.6);
|
73 |
+
}
|
74 |
+
.form-control::-moz-placeholder {
|
75 |
+
color: #999999;
|
76 |
+
opacity: 1;
|
77 |
+
}
|
78 |
+
.form-control:-ms-input-placeholder {
|
79 |
+
color: #999999;
|
80 |
+
}
|
81 |
+
.form-control::-webkit-input-placeholder {
|
82 |
+
color: #999999;
|
83 |
+
}
|
84 |
+
.form-control::-ms-expand {
|
85 |
+
border: 0;
|
86 |
+
background-color: transparent;
|
87 |
+
}
|
88 |
+
.form-control[disabled],
|
89 |
+
.form-control[readonly],
|
90 |
+
fieldset[disabled] .form-control {
|
91 |
+
background-color: #eeeeee;
|
92 |
+
opacity: 1;
|
93 |
+
}
|
94 |
+
.form-control[disabled],
|
95 |
+
fieldset[disabled] .form-control {
|
96 |
+
cursor: not-allowed;
|
97 |
+
}
|
98 |
+
textarea.form-control {
|
99 |
+
height: auto;
|
100 |
+
}
|
101 |
+
.form-group {
|
102 |
+
margin-bottom: 15px;
|
103 |
+
}
|
104 |
+
.radio,
|
105 |
+
.checkbox {
|
106 |
+
position: relative;
|
107 |
+
display: block;
|
108 |
+
margin-top: 10px;
|
109 |
+
margin-bottom: 10px;
|
110 |
+
}
|
111 |
+
.radio label,
|
112 |
+
.checkbox label {
|
113 |
+
min-height: 20px;
|
114 |
+
padding-left: 20px;
|
115 |
+
margin-bottom: 0;
|
116 |
+
font-weight: bold;
|
117 |
+
cursor: pointer;
|
118 |
+
}
|
119 |
+
.radio input[type="radio"],
|
120 |
+
.radio-inline input[type="radio"],
|
121 |
+
.checkbox input[type="checkbox"],
|
122 |
+
.checkbox-inline input[type="checkbox"] {
|
123 |
+
position: absolute;
|
124 |
+
margin: 0 0 0 -20px;
|
125 |
+
margin-top: 4px \9;
|
126 |
+
width:16px;
|
127 |
+
height:16px;
|
128 |
+
}
|
129 |
+
.radio + .radio,
|
130 |
+
.checkbox + .checkbox {
|
131 |
+
margin-top: -5px;
|
132 |
+
}
|
133 |
+
.radio-inline,
|
134 |
+
.checkbox-inline {
|
135 |
+
position: relative;
|
136 |
+
display: inline-block;
|
137 |
+
padding-left: 20px;
|
138 |
+
margin-bottom: 0;
|
139 |
+
vertical-align: middle;
|
140 |
+
font-weight: normal;
|
141 |
+
cursor: pointer;
|
142 |
+
}
|
143 |
+
.radio-inline + .radio-inline,
|
144 |
+
.checkbox-inline + .checkbox-inline {
|
145 |
+
margin-top: 0;
|
146 |
+
margin-left: 10px;
|
147 |
+
}
|
148 |
+
input[type="radio"][disabled],
|
149 |
+
input[type="checkbox"][disabled],
|
150 |
+
input[type="radio"].disabled,
|
151 |
+
input[type="checkbox"].disabled,
|
152 |
+
fieldset[disabled] input[type="radio"],
|
153 |
+
fieldset[disabled] input[type="checkbox"] {
|
154 |
+
cursor: not-allowed;
|
155 |
+
}
|
156 |
+
.radio-inline.disabled,
|
157 |
+
.checkbox-inline.disabled,
|
158 |
+
fieldset[disabled] .radio-inline,
|
159 |
+
fieldset[disabled] .checkbox-inline {
|
160 |
+
cursor: not-allowed;
|
161 |
+
}
|
162 |
+
.radio.disabled label,
|
163 |
+
.checkbox.disabled label,
|
164 |
+
fieldset[disabled] .radio label,
|
165 |
+
fieldset[disabled] .checkbox label {
|
166 |
+
cursor: not-allowed;
|
167 |
+
}
|
168 |
+
.form-control-static {
|
169 |
+
padding-top: 7px;
|
170 |
+
padding-bottom: 7px;
|
171 |
+
margin-bottom: 0;
|
172 |
+
min-height: 34px;
|
173 |
+
}
|
174 |
+
.form-control-static.input-lg,
|
175 |
+
.form-control-static.input-sm {
|
176 |
+
padding-left: 0;
|
177 |
+
padding-right: 0;
|
178 |
+
}
|
179 |
+
.input-sm {
|
180 |
+
height: 30px;
|
181 |
+
padding: 5px 10px;
|
182 |
+
font-size: 12px;
|
183 |
+
line-height: 1.5;
|
184 |
+
border-radius: 3px;
|
185 |
+
box-sizing:border-box;
|
186 |
+
}
|
187 |
+
select.input-sm {
|
188 |
+
height: 30px;
|
189 |
+
line-height: 30px;
|
190 |
+
}
|
191 |
+
textarea.input-sm,
|
192 |
+
select[multiple].input-sm {
|
193 |
+
height: auto;
|
194 |
+
}
|
195 |
+
.form-group-sm .form-control {
|
196 |
+
height: 30px;
|
197 |
+
padding: 5px 10px;
|
198 |
+
font-size: 12px;
|
199 |
+
line-height: 1.5;
|
200 |
+
border-radius: 3px;
|
201 |
+
}
|
202 |
+
.form-group-sm select.form-control {
|
203 |
+
height: 30px;
|
204 |
+
line-height: 30px;
|
205 |
+
}
|
206 |
+
.form-group-sm textarea.form-control,
|
207 |
+
.form-group-sm select[multiple].form-control {
|
208 |
+
height: auto;
|
209 |
+
}
|
210 |
+
.form-group-sm .form-control-static {
|
211 |
+
height: 30px;
|
212 |
+
min-height: 32px;
|
213 |
+
padding: 6px 10px;
|
214 |
+
font-size: 12px;
|
215 |
+
line-height: 1.5;
|
216 |
+
}
|
217 |
+
.input-lg {
|
218 |
+
height: 46px;
|
219 |
+
padding: 10px 16px;
|
220 |
+
font-size: 18px;
|
221 |
+
line-height: 1.3333333;
|
222 |
+
border-radius: 6px;
|
223 |
+
}
|
224 |
+
select.input-lg {
|
225 |
+
height: 46px;
|
226 |
+
line-height: 46px;
|
227 |
+
}
|
228 |
+
textarea.input-lg,
|
229 |
+
select[multiple].input-lg {
|
230 |
+
height: auto;
|
231 |
+
}
|
232 |
+
.form-group-lg .form-control {
|
233 |
+
height: 46px;
|
234 |
+
padding: 10px 16px;
|
235 |
+
font-size: 18px;
|
236 |
+
line-height: 1.3333333;
|
237 |
+
border-radius: 6px;
|
238 |
+
}
|
239 |
+
.form-group-lg select.form-control {
|
240 |
+
height: 46px;
|
241 |
+
line-height: 46px;
|
242 |
+
}
|
243 |
+
.form-group-lg textarea.form-control,
|
244 |
+
.form-group-lg select[multiple].form-control {
|
245 |
+
height: auto;
|
246 |
+
}
|
247 |
+
.form-group-lg .form-control-static {
|
248 |
+
height: 46px;
|
249 |
+
min-height: 38px;
|
250 |
+
padding: 11px 16px;
|
251 |
+
font-size: 18px;
|
252 |
+
line-height: 1.3333333;
|
253 |
+
}
|
254 |
+
.has-feedback {
|
255 |
+
position: relative;
|
256 |
+
}
|
257 |
+
.has-feedback .form-control {
|
258 |
+
padding-right: 42.5px;
|
259 |
+
}
|
260 |
+
.form-control-feedback {
|
261 |
+
position: absolute;
|
262 |
+
top: 0;
|
263 |
+
right: 0;
|
264 |
+
z-index: 2;
|
265 |
+
display: block;
|
266 |
+
width: 34px;
|
267 |
+
height: 34px;
|
268 |
+
line-height: 34px;
|
269 |
+
text-align: center;
|
270 |
+
pointer-events: none;
|
271 |
+
}
|
272 |
+
.input-lg + .form-control-feedback,
|
273 |
+
.input-group-lg + .form-control-feedback,
|
274 |
+
.form-group-lg .form-control + .form-control-feedback {
|
275 |
+
width: 46px;
|
276 |
+
height: 46px;
|
277 |
+
line-height: 46px;
|
278 |
+
}
|
279 |
+
.input-sm + .form-control-feedback,
|
280 |
+
.input-group-sm + .form-control-feedback,
|
281 |
+
.form-group-sm .form-control + .form-control-feedback {
|
282 |
+
width: 30px;
|
283 |
+
height: 30px;
|
284 |
+
line-height: 30px;
|
285 |
+
}
|
286 |
+
.help-block {
|
287 |
+
display: block;
|
288 |
+
margin-top: 5px;
|
289 |
+
margin-bottom: 10px;
|
290 |
+
color: #007cba;
|
291 |
+
font-style: italic;
|
292 |
+
}
|
293 |
+
.form-horizontal .radio,
|
294 |
+
.form-horizontal .checkbox,
|
295 |
+
.form-horizontal .radio-inline,
|
296 |
+
.form-horizontal .checkbox-inline {
|
297 |
+
margin-top: 0;
|
298 |
+
margin-bottom: 0;
|
299 |
+
padding-top: 7px;
|
300 |
+
}
|
301 |
+
.form-horizontal .radio,
|
302 |
+
.form-horizontal .checkbox {
|
303 |
+
min-height: 27px;
|
304 |
+
}
|
305 |
+
.form-horizontal .form-group {
|
306 |
+
margin-left: -15px;
|
307 |
+
margin-right: -15px;
|
308 |
+
}
|
309 |
+
.clearfix:before,
|
310 |
+
.clearfix:after,
|
311 |
+
.form-horizontal .form-group:before,
|
312 |
+
.form-horizontal .form-group:after {
|
313 |
+
content: " ";
|
314 |
+
display: table;
|
315 |
+
}
|
316 |
+
.clearfix:after,
|
317 |
+
.form-horizontal .form-group:after {
|
318 |
+
clear: both;
|
319 |
+
}
|
320 |
+
.center-block {
|
321 |
+
display: block;
|
322 |
+
margin-left: auto;
|
323 |
+
margin-right: auto;
|
324 |
+
}
|
325 |
+
#skinOptions .wp-picker-container, #skinOptions .wp-picker-container:active {
|
326 |
+
display:block;
|
327 |
+
}
|
328 |
+
#skinOptions .wp-picker-container input[type="text"].wp-color-picker {
|
329 |
+
float: left;
|
330 |
+
height: 25px;
|
331 |
+
}
|
332 |
+
|
333 |
+
.premium-only {
|
334 |
+
color: #ff0000;
|
335 |
+
font-size: 110%;
|
336 |
+
font-style: italic;
|
337 |
+
font-weight: bold;
|
338 |
+
}
|
339 |
+
|
340 |
+
/* SETTINGS FOR Overview Gallery */
|
341 |
+
.flag-wrap {margin:20px 20px 0 2px}
|
342 |
+
.flag-wrap h2.overview-title {margin:0}
|
343 |
+
.has-sidebar {
|
344 |
+
clear:left;
|
345 |
+
float:left;
|
346 |
+
width:100%;
|
347 |
+
}
|
348 |
+
.has-sidebar .has-sidebar-content {
|
349 |
+
padding-right:300px;
|
350 |
+
}
|
351 |
+
|
352 |
+
.postbox .misc-pub-section .icon { background-position:left top;background-repeat:no-repeat;padding-left:18px;}
|
353 |
+
#plugin-home {background-image:url(../images/browser.png)}
|
354 |
+
#plugin-comments {background-image:url(../images/notes.png)}
|
355 |
+
#rate-plugin {background-image:url(../images/wallpaper.png)}
|
356 |
+
#my-plugins {background-image:url(../images/map.png)}
|
357 |
+
#contact-me {background-image:url(../images/mail.png)}
|
358 |
+
|
359 |
+
#dashboard_server_settings ul.settings span {
|
360 |
+
padding-left : 10px;
|
361 |
+
color:#2583AD;
|
362 |
+
font-weight:bold;
|
363 |
+
}
|
364 |
+
|
365 |
+
.flag-overview .postbox .handlediv {
|
366 |
+
float:right;
|
367 |
+
height:24px;
|
368 |
+
width:24px;
|
369 |
+
}
|
370 |
+
|
371 |
+
#dashboard_primary .inside { margin: 0; }
|
372 |
+
|
373 |
+
#photogallerycreator .theme > p { margin: 0; padding: 0; }
|
374 |
+
#photogallerycreator .theme { overflow: hidden; padding: 7px 0; border-bottom: 1px solid #000000; }
|
375 |
+
#photogallerycreator .theme .img { margin-top: 25px; }
|
376 |
+
#photogallerycreator .theme .txt > *:first-child { display: block; margin: 0 0 -20px; padding: 0; text-align: center; position: relative; top: -204px; }
|
377 |
+
|
378 |
+
/* SETTING FOR UPLOAD PAGE */
|
379 |
+
.flag-form-table {
|
380 |
+
border-collapse: collapse;
|
381 |
+
clear: both;
|
382 |
+
margin-top: 0.5em;
|
383 |
+
width: 100%;
|
384 |
+
}
|
385 |
+
.useflashupload {float:left;}
|
386 |
+
.swfupload {
|
387 |
+
position:absolute;
|
388 |
+
z-index:1;
|
389 |
+
vertical-align:top;
|
390 |
+
}
|
391 |
+
#uploadQueue {}
|
392 |
+
#choosegalfirst {display:block; position:relative; margin:20px 0; overflow:hidden;}
|
393 |
+
#choosegalfirst .disabledbut {position:absolute; top:0; left:0; right:0; bottom:0; width:100%; height:100%;}
|
394 |
+
|
395 |
+
/* SETTINGS FOR THE OPTIONS TABLE */
|
396 |
+
.flag-options th {
|
397 |
+
width:30%;
|
398 |
+
}
|
399 |
+
.cptab h3 {margin-top:0; padding-top:20px;}
|
400 |
+
|
401 |
+
/* SETTINGS FOR MANAGE TABLE */
|
402 |
+
.flag_draft, .alt.flag_draft {background-color: #FFEBE8;}
|
403 |
+
|
404 |
+
p#flag-inlinebutton {
|
405 |
+
float:right;
|
406 |
+
margin:0pt;
|
407 |
+
position:relative;
|
408 |
+
top:-25pt;
|
409 |
+
}
|
410 |
+
|
411 |
+
.flag-tablenav .button-secondary {
|
412 |
+
padding:2px 8px;
|
413 |
+
vertical-align: top;
|
414 |
+
}
|
415 |
+
|
416 |
+
#flag-listitems td, #flag-listitems th {
|
417 |
+
|
418 |
+
}
|
419 |
+
|
420 |
+
.fixed tbody th.column-cb {
|
421 |
+
padding:7px 0 22px;
|
422 |
+
}
|
423 |
+
.fixed .column-cb {
|
424 |
+
padding:0;
|
425 |
+
width:2.2em;
|
426 |
+
}
|
427 |
+
|
428 |
+
.fixed .column-thumbnail{
|
429 |
+
width:80px;
|
430 |
+
}
|
431 |
+
|
432 |
+
.fixed .column-thumbnail img{
|
433 |
+
height:auto;
|
434 |
+
width: 100%;
|
435 |
+
max-width:80px;
|
436 |
+
}
|
437 |
+
|
438 |
+
.fixed .column-id {
|
439 |
+
width: 3em;
|
440 |
+
}
|
441 |
+
|
442 |
+
.fixed .column-rating { width:100px; text-align: center; }
|
443 |
+
.fixed td.column-rating { background-color: #CCFFCC; }
|
444 |
+
.fixed .column-views_likes { width:150px; padding-left: 0; padding-right: 0; }
|
445 |
+
.fixed .column-views_likes input { width:45px; font-size: 10px; }
|
446 |
+
|
447 |
+
.fixed .column-alt_title_desc {
|
448 |
+
|
449 |
+
}
|
450 |
+
|
451 |
+
.fixed .column-exclude, .fixed .column-action, .fixed .column-delete {
|
452 |
+
width: 2.2em; text-align: center;
|
453 |
+
}
|
454 |
+
.fixed .column-exclude { width: 70px; white-space: nowrap; }
|
455 |
+
.fixed th.column-exclude img { vertical-align: text-top; }
|
456 |
+
.fixed .column-exclude input {
|
457 |
+
margin-top:4px;
|
458 |
+
}
|
459 |
+
.fixed .column-views {
|
460 |
+
width: 4em; text-align: center;
|
461 |
+
}
|
462 |
+
.flag-table tr > * {
|
463 |
+
border-bottom:1px solid #ddd;
|
464 |
+
}
|
465 |
+
.flag-table td,
|
466 |
+
.flag-table th {padding:4px 7px; text-align:left;}
|
467 |
+
.flag-table th {font-weight:bold; padding:6px 7px; vertical-align:top;}
|
468 |
+
.flag-table th p {margin:0;}
|
469 |
+
|
470 |
+
#flag-listmusic tbody td { height: 50px; }
|
471 |
+
|
472 |
+
.albums_table { width: 600px; position: relative; background: #ffffff; border: 1px solid #cccccc; border-radius: 4px; margin: 7px 0; padding: 1px 3px; float: left; max-height: 550px; overflow: auto; }
|
473 |
+
.albums_table .album { position: relative; background: #f8f8f8; border: 1px solid #cccccc; border-radius: 4px; margin:2px 0; padding: 3px 3px 3px 36px; }
|
474 |
+
.albums_table .album form { margin: 0; padding: 0; display: inline; }
|
475 |
+
.albums_table .albID { position: absolute; display: block; width: 30px; top: 6px; left: 0px; text-align: right; }
|
476 |
+
.albums_table .album_actions { position: absolute; display: block; top: 3px; right: 3px; text-align: right; }
|
477 |
+
.albums_table .album_categoties { background: #fefefe; border: 1px solid #cccccc; margin:1px 0; padding: 0px; min-height: 14px; }
|
478 |
+
.albums_table .album_categoties .acat { border-top: 1px solid #cccccc; padding: 3px 6px; cursor: move; position: relative; }
|
479 |
+
.albums_table .album_categoties .acat .drop { display: none; position: absolute; right: 3px; top: 1px; font-size: 18px; line-height: 100%; color: #ff0000; cursor: pointer; }
|
480 |
+
.albums_table .album_categoties .acat:hover { background-color: #FFFFEE; }
|
481 |
+
.albums_table .album_categoties .acat:hover .drop { display: block; }
|
482 |
+
.albums_table .album_categoties .acat:first-child { border-top: none; }
|
483 |
+
|
484 |
+
.alb_msg { font-size: 10px; color: #006600; }
|
485 |
+
.flag-ajax-post { cursor: pointer; text-decoration: underline; }
|
486 |
+
.flag-ajax-post:hover { color: #ff0000; }
|
487 |
+
|
488 |
+
.all_galleries { float: left; white-space: nowrap; margin: 0 0 0px 50px; max-height: 550px; overflow: auto; padding-right: 20px; min-width:30%; }
|
489 |
+
.all_galleries .acat { border: 1px solid #cccccc; padding: 3px 6px; margin: 3px 0; background: #fefefe; cursor: move; min-width:15%; }
|
490 |
+
.all_galleries .acat .drop { display: none; }
|
491 |
+
.all_galleries .acat:hover { background-color: #FFFFEE; }
|
492 |
+
|
493 |
+
.floatholder { overflow: hidden; }
|
494 |
+
/* SETTINGS FOR PROGRESS BAR */
|
495 |
+
|
496 |
+
div .progressborder {
|
497 |
+
border: 1px inset ;
|
498 |
+
display: block;
|
499 |
+
height: 20px;
|
500 |
+
background-color: #464646;
|
501 |
+
width: 100%;
|
502 |
+
margin-top: 15px;
|
503 |
+
margin-bottom: 15px;
|
504 |
+
}
|
505 |
+
|
506 |
+
div .progressbar {
|
507 |
+
border: medium none ;
|
508 |
+
display: block;
|
509 |
+
height: 20px;
|
510 |
+
background-color: #D54E21;
|
511 |
+
width: 0%;
|
512 |
+
}
|
513 |
+
|
514 |
+
div .progressbar span {
|
515 |
+
display: inline;
|
516 |
+
position: relative;
|
517 |
+
color: white;
|
518 |
+
font-weight: bold;
|
519 |
+
padding-left: 5px;
|
520 |
+
}
|
521 |
+
|
522 |
+
|
523 |
+
.show_details
|
524 |
+
{
|
525 |
+
height: 16px;
|
526 |
+
line-height: 20px;
|
527 |
+
overflow: hidden;
|
528 |
+
min-width: 8em;
|
529 |
+
padding: 3px;
|
530 |
+
cursor:pointer;
|
531 |
+
}
|
532 |
+
|
533 |
+
.show_details span
|
534 |
+
{
|
535 |
+
border-bottom:1px solid #999;
|
536 |
+
white-space:pre;
|
537 |
+
}
|
538 |
+
.show_details:hover
|
539 |
+
{
|
540 |
+
height: auto;
|
541 |
+
overflow: visible;
|
542 |
+
border: 1px solid #999;
|
543 |
+
}
|
544 |
+
|
545 |
+
/* SETTINGS FOR SORT GALLERY */
|
546 |
+
#flag-listitems .header p {
|
547 |
+
background-image:url(../images/sortbg.gif);
|
548 |
+
background-position:right center;
|
549 |
+
background-repeat:no-repeat;
|
550 |
+
cursor:pointer;
|
551 |
+
margin:0;
|
552 |
+
}
|
553 |
+
#flag-listitems .headerSortDown p {
|
554 |
+
background-image:url(../images/desc.gif) !important;
|
555 |
+
background-position:right center;
|
556 |
+
background-repeat:no-repeat;
|
557 |
+
cursor:pointer;
|
558 |
+
margin:0;
|
559 |
+
}
|
560 |
+
#flag-listitems .headerSortUp p {
|
561 |
+
background-image:url(../images/asc.gif) !important;
|
562 |
+
background-position:right center;
|
563 |
+
background-repeat:no-repeat;
|
564 |
+
cursor:pointer;
|
565 |
+
margin:0;
|
566 |
+
}
|
567 |
+
|
568 |
+
/* UPGRADE PAGE */
|
569 |
+
|
570 |
+
.error_inline {
|
571 |
+
background:#FFEBE8 none repeat scroll 0%;
|
572 |
+
border:1px solid #CC0000;
|
573 |
+
margin:5px auto;
|
574 |
+
padding:10px;
|
575 |
+
}
|
576 |
+
|
577 |
+
/* MEDIA BOX */
|
578 |
+
|
579 |
+
p.row-actions {
|
580 |
+
margin:0px;
|
581 |
+
padding:10px 4px 0;
|
582 |
+
}
|
583 |
+
|
584 |
+
div#TB_window iframe#TB_iframeContent { width: 100% !important; }
|
585 |
+
div.message { background: #ffffee; border: 1px solid #cccccc; border-radius: 4px; padding: 1px 10px; margin: 24px 20px 10px 0; font-size: 12px; }
|
586 |
+
div.message .flag_progress { position: relative; height: 18px; width: 400px; border: 1px solid #0066FF; background-color: #ffffff; margin: 7px 0; }
|
587 |
+
div.message .flag_progress .txt { position: absolute; left: 10px; top: 0; line-height: 18px; font-weight: bold; height: 18px; z-index: 10; }
|
588 |
+
div.message .flag_progress .flag_complete { position: absolute; left: 0; top: 0; height: 18px; width: 0px; overflow: hidden; background: #00FFB7; z-index: 5; }
|
589 |
+
div#license div p { font-size: 13px; }
|
590 |
+
.highlight_new { background-color: #E4F2FD; color: #000000; font-weight: bold; }
|
591 |
+
.success { background-color: #CCFFCC; border: 1px solid darkgreen; border-radius: 3px; margin: 5px 15px; padding: 3px 7px; }
|
592 |
+
|
593 |
+
#gmUpload { padding-top:10px }
|
594 |
+
#gmUpload table td { font-size: 11px !important; }
|
595 |
+
|
596 |
+
.already-added {background-color:#DDFFBB;}
|
597 |
+
|
598 |
+
a.button.button-primary.button-red {
|
599 |
+
background: red;
|
600 |
+
border-color: darkred;
|
601 |
+
text-shadow: 0 -1px 1px darkred, 1px 0 1px darkred, 0 1px 1px darkred, -1px 0 1px darkred;
|
602 |
+
}
|
603 |
+
|
604 |
+
a.button.button-primary.button-red:hover {
|
605 |
+
background: orangered;
|
606 |
+
border-color: darkred;
|
607 |
+
}
|
608 |
+
|
609 |
+
.skin-delete.action-links a {
|
610 |
+
white-space: nowrap;
|
611 |
+
}
|
612 |
+
.flag-options-footer {
|
613 |
+
padding: 10px 30px 5px;
|
614 |
+
position: fixed;
|
615 |
+
left: 0;
|
616 |
+
bottom: 0;
|
617 |
+
width: 100%;
|
618 |
+
box-sizing: border-box;
|
619 |
+
background-color: #fcfcfc;
|
620 |
+
border-top: 1px solid #bbb;
|
621 |
+
}
|
622 |
+
|
623 |
+
form.addnewpreset {
|
624 |
+
display: flex;
|
625 |
+
}
|
626 |
+
|
627 |
+
form.addnewpreset button {
|
628 |
+
border: none;
|
629 |
+
background: transparent;
|
630 |
+
cursor: pointer;
|
631 |
+
padding: 3px 6px !important;
|
632 |
+
height: 26px !important;
|
633 |
+
}
|
634 |
+
|
635 |
+
.ui-button-disabled {
|
636 |
+
pointer-events: none;
|
637 |
+
}
|
638 |
+
|
639 |
+
#flag-overview .handle-actions {
|
640 |
+
display: none;
|
641 |
+
}
|
admin/css/flagallery-block.css
CHANGED
@@ -16,6 +16,13 @@ form.flagallery-preview select {
|
|
16 |
box-sizing: border-box;
|
17 |
}
|
18 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
19 |
.flagallery-required {
|
20 |
border-color: red !important;
|
21 |
}
|
16 |
box-sizing: border-box;
|
17 |
}
|
18 |
|
19 |
+
form.flagallery-preview select.flagallery-preset option {
|
20 |
+
display: none;
|
21 |
+
}
|
22 |
+
form.flagallery-preview select.flagallery-preset option.default-preset {
|
23 |
+
display: initial !important;
|
24 |
+
}
|
25 |
+
|
26 |
.flagallery-required {
|
27 |
border-color: red !important;
|
28 |
}
|
admin/flag_install.php
CHANGED
@@ -1,319 +1,332 @@
|
|
1 |
-
<?php
|
2 |
-
// Stop direct call
|
3 |
-
if(preg_match('#' . basename(__FILE__) . '#', $_SERVER['PHP_SELF'])){
|
4 |
-
|
5 |
-
}
|
6 |
-
|
7 |
-
/**
|
8 |
-
* creates all tables for the gallery
|
9 |
-
*
|
10 |
-
*
|
11 |
-
* @
|
12 |
-
|
13 |
-
|
14 |
-
|
15 |
-
|
16 |
-
|
17 |
-
|
18 |
-
|
19 |
-
|
20 |
-
|
21 |
-
|
22 |
-
|
23 |
-
|
24 |
-
|
25 |
-
|
26 |
-
|
27 |
-
|
28 |
-
|
29 |
-
|
30 |
-
|
31 |
-
|
32 |
-
|
33 |
-
|
34 |
-
|
35 |
-
|
36 |
-
|
37 |
-
|
38 |
-
|
39 |
-
|
40 |
-
|
41 |
-
|
42 |
-
|
43 |
-
|
44 |
-
|
45 |
-
|
46 |
-
|
47 |
-
|
48 |
-
|
49 |
-
|
50 |
-
|
51 |
-
|
52 |
-
|
53 |
-
|
54 |
-
|
55 |
-
|
56 |
-
|
57 |
-
|
58 |
-
|
59 |
-
|
60 |
-
|
61 |
-
|
62 |
-
|
63 |
-
|
64 |
-
|
65 |
-
|
66 |
-
|
67 |
-
|
68 |
-
|
69 |
-
|
70 |
-
|
71 |
-
|
72 |
-
|
73 |
-
|
74 |
-
|
75 |
-
|
76 |
-
|
77 |
-
|
78 |
-
|
79 |
-
|
80 |
-
|
81 |
-
|
82 |
-
|
83 |
-
|
84 |
-
|
85 |
-
|
86 |
-
|
87 |
-
|
88 |
-
|
89 |
-
|
90 |
-
)
|
91 |
-
|
92 |
-
|
93 |
-
|
94 |
-
|
95 |
-
|
96 |
-
|
97 |
-
|
98 |
-
ownerid
|
99 |
-
|
100 |
-
|
101 |
-
|
102 |
-
|
103 |
-
|
104 |
-
|
105 |
-
|
106 |
-
|
107 |
-
)
|
108 |
-
|
109 |
-
|
110 |
-
|
111 |
-
|
112 |
-
|
113 |
-
|
114 |
-
|
115 |
-
|
116 |
-
|
117 |
-
|
118 |
-
|
119 |
-
|
120 |
-
|
121 |
-
)
|
122 |
-
|
123 |
-
|
124 |
-
|
125 |
-
|
126 |
-
|
127 |
-
|
128 |
-
|
129 |
-
|
130 |
-
|
131 |
-
|
132 |
-
|
133 |
-
|
134 |
-
|
135 |
-
|
136 |
-
|
137 |
-
|
138 |
-
|
139 |
-
|
140 |
-
|
141 |
-
|
142 |
-
|
143 |
-
|
144 |
-
|
145 |
-
|
146 |
-
|
147 |
-
|
148 |
-
|
149 |
-
|
150 |
-
|
151 |
-
|
152 |
-
|
153 |
-
|
154 |
-
|
155 |
-
|
156 |
-
|
157 |
-
|
158 |
-
|
159 |
-
|
160 |
-
|
161 |
-
|
162 |
-
|
163 |
-
|
164 |
-
|
165 |
-
|
166 |
-
|
167 |
-
|
168 |
-
|
169 |
-
|
170 |
-
|
171 |
-
|
172 |
-
|
173 |
-
|
174 |
-
|
175 |
-
|
176 |
-
|
177 |
-
|
178 |
-
|
179 |
-
|
180 |
-
|
181 |
-
|
182 |
-
|
183 |
-
|
184 |
-
|
185 |
-
|
186 |
-
|
187 |
-
|
188 |
-
|
189 |
-
|
190 |
-
|
191 |
-
|
192 |
-
|
193 |
-
|
194 |
-
|
195 |
-
|
196 |
-
|
197 |
-
|
198 |
-
|
199 |
-
|
200 |
-
|
201 |
-
|
202 |
-
|
203 |
-
|
204 |
-
|
205 |
-
|
206 |
-
|
207 |
-
|
208 |
-
|
209 |
-
|
210 |
-
|
211 |
-
|
212 |
-
|
213 |
-
|
214 |
-
|
215 |
-
|
216 |
-
|
217 |
-
|
218 |
-
|
219 |
-
|
220 |
-
|
221 |
-
|
222 |
-
|
223 |
-
|
224 |
-
|
225 |
-
|
226 |
-
|
227 |
-
|
228 |
-
|
229 |
-
|
230 |
-
|
231 |
-
|
232 |
-
|
233 |
-
|
234 |
-
|
235 |
-
|
236 |
-
|
237 |
-
|
238 |
-
|
239 |
-
|
240 |
-
|
241 |
-
|
242 |
-
|
243 |
-
|
244 |
-
|
245 |
-
|
246 |
-
|
247 |
-
|
248 |
-
|
249 |
-
|
250 |
-
|
251 |
-
|
252 |
-
|
253 |
-
|
254 |
-
|
255 |
-
|
256 |
-
|
257 |
-
|
258 |
-
|
259 |
-
|
260 |
-
|
261 |
-
|
262 |
-
|
263 |
-
|
264 |
-
|
265 |
-
|
266 |
-
|
267 |
-
|
268 |
-
|
269 |
-
|
270 |
-
|
271 |
-
|
272 |
-
|
273 |
-
|
274 |
-
|
275 |
-
|
276 |
-
|
277 |
-
|
278 |
-
|
279 |
-
|
280 |
-
|
281 |
-
|
282 |
-
|
283 |
-
|
284 |
-
|
285 |
-
|
286 |
-
|
287 |
-
|
288 |
-
|
289 |
-
|
290 |
-
|
291 |
-
|
292 |
-
|
293 |
-
|
294 |
-
|
295 |
-
|
296 |
-
|
297 |
-
|
298 |
-
|
299 |
-
|
300 |
-
|
301 |
-
|
302 |
-
|
303 |
-
|
304 |
-
|
305 |
-
|
306 |
-
|
307 |
-
|
308 |
-
|
309 |
-
|
310 |
-
|
311 |
-
|
312 |
-
|
313 |
-
|
314 |
-
|
315 |
-
|
316 |
-
|
317 |
-
|
318 |
-
|
319 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
// Stop direct call
|
3 |
+
if ( preg_match( '#' . basename( __FILE__ ) . '#', $_SERVER['PHP_SELF'] ) ) {
|
4 |
+
die( 'You are not allowed to call this page directly.' );
|
5 |
+
}
|
6 |
+
|
7 |
+
/**
|
8 |
+
* creates all tables for the gallery
|
9 |
+
*
|
10 |
+
* @access internal
|
11 |
+
* @return void
|
12 |
+
**/
|
13 |
+
|
14 |
+
function flag_create_tables() {
|
15 |
+
global $wpdb;
|
16 |
+
|
17 |
+
// upgrade function changed in WordPress 2.3
|
18 |
+
require_once( ABSPATH . 'wp-admin/includes/upgrade.php' );
|
19 |
+
|
20 |
+
// add charset & collate like wp core
|
21 |
+
$charset_collate = '';
|
22 |
+
|
23 |
+
if ( $wpdb->has_cap( 'collation' ) ) {
|
24 |
+
if ( ! empty( $wpdb->charset ) ) {
|
25 |
+
$charset_collate = "DEFAULT CHARACTER SET $wpdb->charset";
|
26 |
+
}
|
27 |
+
if ( ! empty( $wpdb->collate ) ) {
|
28 |
+
$charset_collate .= " COLLATE $wpdb->collate";
|
29 |
+
}
|
30 |
+
}
|
31 |
+
|
32 |
+
$flagpictures = $wpdb->prefix . 'flag_pictures';
|
33 |
+
$flaggallery = $wpdb->prefix . 'flag_gallery';
|
34 |
+
$flagcomments = $wpdb->prefix . 'flag_comments';
|
35 |
+
$flagalbum = $wpdb->prefix . 'flag_album';
|
36 |
+
|
37 |
+
if ( $wpdb->get_var( "show tables like '$flagpictures'" ) != $flagpictures ) {
|
38 |
+
|
39 |
+
$sql = "CREATE TABLE " . $flagpictures . " (
|
40 |
+
pid BIGINT(20) NOT NULL AUTO_INCREMENT ,
|
41 |
+
galleryid BIGINT(20) DEFAULT '0' NOT NULL ,
|
42 |
+
filename VARCHAR(255) NOT NULL ,
|
43 |
+
description MEDIUMTEXT NULL ,
|
44 |
+
alttext MEDIUMTEXT NULL ,
|
45 |
+
link TEXT NULL ,
|
46 |
+
imagedate DATETIME NOT NULL DEFAULT '0000-00-00 00:00:00',
|
47 |
+
modified TIMESTAMP NOT NULL ON UPDATE CURRENT_TIMESTAMP,
|
48 |
+
exclude TINYINT NULL DEFAULT '0',
|
49 |
+
sortorder BIGINT(20) DEFAULT '0' NOT NULL ,
|
50 |
+
location TEXT,
|
51 |
+
city TINYTEXT,
|
52 |
+
state TINYTEXT,
|
53 |
+
country TINYTEXT,
|
54 |
+
credit TEXT,
|
55 |
+
copyright TEXT,
|
56 |
+
commentson INT(1) UNSIGNED NOT NULL DEFAULT '1',
|
57 |
+
hitcounter INT(11) UNSIGNED DEFAULT '0',
|
58 |
+
total_value INT(11) UNSIGNED DEFAULT '0',
|
59 |
+
total_votes INT(11) UNSIGNED DEFAULT '0',
|
60 |
+
used_ips LONGTEXT,
|
61 |
+
meta_data LONGTEXT,
|
62 |
+
PRIMARY KEY pid (pid)
|
63 |
+
) $charset_collate;";
|
64 |
+
|
65 |
+
dbDelta( $sql );
|
66 |
+
}
|
67 |
+
|
68 |
+
|
69 |
+
if ( $wpdb->get_var( "show tables like '$flaggallery'" ) != $flaggallery ) {
|
70 |
+
|
71 |
+
$sql = "CREATE TABLE " . $flaggallery . " (
|
72 |
+
gid BIGINT(20) NOT NULL AUTO_INCREMENT ,
|
73 |
+
name VARCHAR(255) NOT NULL ,
|
74 |
+
path MEDIUMTEXT NULL ,
|
75 |
+
title MEDIUMTEXT NULL ,
|
76 |
+
galdesc MEDIUMTEXT NULL ,
|
77 |
+
previewpic BIGINT(20) NULL DEFAULT '0' ,
|
78 |
+
sortorder BIGINT(20) DEFAULT '0' NOT NULL ,
|
79 |
+
author BIGINT(20) NOT NULL DEFAULT '0' ,
|
80 |
+
status TINYINT NULL DEFAULT '0' ,
|
81 |
+
PRIMARY KEY gid (gid)
|
82 |
+
) $charset_collate;";
|
83 |
+
|
84 |
+
dbDelta( $sql );
|
85 |
+
}
|
86 |
+
|
87 |
+
if ( $wpdb->get_var( "show tables like '$flagcomments'" ) != $flagcomments ) {
|
88 |
+
$sql = "CREATE TABLE " . $flagcomments . " (
|
89 |
+
cid int(11) unsigned NOT NULL auto_increment,
|
90 |
+
ownerid int(11) unsigned NOT NULL default '0',
|
91 |
+
name varchar(255) NOT NULL default '',
|
92 |
+
email varchar(255) NOT NULL default '',
|
93 |
+
website varchar(255) default NULL,
|
94 |
+
date datetime default NULL,
|
95 |
+
comment text,
|
96 |
+
inmoderation int(1) unsigned NOT NULL default '0',
|
97 |
+
PRIMARY KEY (cid),
|
98 |
+
KEY ownerid (ownerid)
|
99 |
+
) $charset_collate;";
|
100 |
+
|
101 |
+
dbDelta( $sql );
|
102 |
+
}
|
103 |
+
|
104 |
+
if ( ! $wpdb->get_var( "SHOW TABLES LIKE '$flagalbum'" ) ) {
|
105 |
+
|
106 |
+
$sql = "CREATE TABLE " . $flagalbum . " (
|
107 |
+
id BIGINT(20) NOT NULL AUTO_INCREMENT ,
|
108 |
+
name VARCHAR(255) NOT NULL ,
|
109 |
+
previewpic BIGINT(20) DEFAULT '0' NOT NULL ,
|
110 |
+
albumdesc MEDIUMTEXT NULL ,
|
111 |
+
categories LONGTEXT NOT NULL,
|
112 |
+
PRIMARY KEY id (id)
|
113 |
+
) $charset_collate;";
|
114 |
+
|
115 |
+
dbDelta( $sql );
|
116 |
+
}
|
117 |
+
|
118 |
+
|
119 |
+
// check one table again, to be sure
|
120 |
+
if ( ! $wpdb->get_var( "SHOW TABLES LIKE '$flagpictures'" ) ) {
|
121 |
+
update_option( "flag_init_check", __( 'FlaGallery : Tables could not created, please check your database settings', 'flash-album-gallery' ) );
|
122 |
+
|
123 |
+
return;
|
124 |
+
}
|
125 |
+
|
126 |
+
}
|
127 |
+
|
128 |
+
/**
|
129 |
+
* creates all tables for the gallery
|
130 |
+
* called during register_activation hook
|
131 |
+
*
|
132 |
+
* @access internal
|
133 |
+
* @return void
|
134 |
+
**/
|
135 |
+
|
136 |
+
function flag_install() {
|
137 |
+
|
138 |
+
flag_capabilities();
|
139 |
+
|
140 |
+
flag_create_tables();
|
141 |
+
|
142 |
+
$options = get_option( 'flag_options' );
|
143 |
+
// set the default settings, if we didn't upgrade
|
144 |
+
if ( empty( $options ) ) {
|
145 |
+
flag_default_options();
|
146 |
+
}
|
147 |
+
|
148 |
+
|
149 |
+
delete_transient( 'flagallery_uninstalled' );
|
150 |
+
// if all is passed , save the VERSIONs
|
151 |
+
add_option( "flag_db_version", FLAG_DBVERSION );
|
152 |
+
add_option( "flagVersion", FLAGVERSION );
|
153 |
+
|
154 |
+
include_once( dirname( __FILE__ ) . '/tuning.php' );
|
155 |
+
flag_tune( false );
|
156 |
+
}
|
157 |
+
|
158 |
+
function flag_capabilities() {
|
159 |
+
global $wp_roles;
|
160 |
+
|
161 |
+
// Set the capabilities for the administrator
|
162 |
+
$role = get_role( 'administrator' );
|
163 |
+
// We need this role, no other chance
|
164 |
+
if ( empty( $role ) ) {
|
165 |
+
update_option( "flag_init_check", __( 'Sorry, FlaGallery works only with a role called administrator', 'flash-album-gallery' ) );
|
166 |
+
|
167 |
+
return;
|
168 |
+
}
|
169 |
+
|
170 |
+
$role->add_cap( 'FlAG overview' );
|
171 |
+
$role->add_cap( 'FlAG Use TinyMCE' );
|
172 |
+
$role->add_cap( 'FlAG Upload images' );
|
173 |
+
$role->add_cap( 'FlAG Import folder' );
|
174 |
+
$role->add_cap( 'FlAG Manage gallery' );
|
175 |
+
$role->add_cap( 'FlAG Manage others gallery' );
|
176 |
+
$role->add_cap( 'FlAG Change skin' );
|
177 |
+
$role->add_cap( 'FlAG Add skins' );
|
178 |
+
$role->add_cap( 'FlAG Delete skins' );
|
179 |
+
$role->add_cap( 'FlAG Change options' );
|
180 |
+
$role->add_cap( 'FlAG Manage music' );
|
181 |
+
$role->add_cap( 'FlAG Manage video' );
|
182 |
+
$role->add_cap( 'FlAG Manage banners' );
|
183 |
+
$role->add_cap( 'FlAG iFrame page' );
|
184 |
+
|
185 |
+
}
|
186 |
+
|
187 |
+
/**
|
188 |
+
* Setup the default option array for the gallery
|
189 |
+
*
|
190 |
+
* @access internal
|
191 |
+
* @return void
|
192 |
+
*/
|
193 |
+
function flag_default_options() {
|
194 |
+
|
195 |
+
global $blog_id, $flag;
|
196 |
+
|
197 |
+
$flag_options = flag_list_options();
|
198 |
+
// special overrides for WPMU
|
199 |
+
if ( IS_WPMU ) {
|
200 |
+
// get the site options
|
201 |
+
$flag_wpmu_options = get_site_option( 'flag_options' );
|
202 |
+
// get the default value during installation
|
203 |
+
//if (!is_array($flag_wpmu_options)) {
|
204 |
+
//$flag_wpmu_options['galleryPath'] = 'wp-content/blogs.dir/%BLOG_ID%/files/';
|
205 |
+
update_site_option( 'flag_options', $flag_wpmu_options );
|
206 |
+
//}
|
207 |
+
//$flag_options['galleryPath'] = str_replace("%BLOG_ID%", $blog_id , $flag_wpmu_options['galleryPath']);
|
208 |
+
}
|
209 |
+
|
210 |
+
update_option( 'flag_options', $flag_options );
|
211 |
+
|
212 |
+
}
|
213 |
+
|
214 |
+
function flag_list_options() {
|
215 |
+
$wp_content = basename( WP_CONTENT_DIR );
|
216 |
+
$flag_options['galleryPath'] = $wp_content . '/flagallery/'; // set default path to the gallery
|
217 |
+
$flag_options['swfUpload'] = true; // activate the batch upload
|
218 |
+
$flag_options['deleteImg'] = true; // delete Images
|
219 |
+
$flag_options['deepLinks'] = true;
|
220 |
+
$flag_options['access_key'] = '';
|
221 |
+
$flag_options['license_key'] = '';
|
222 |
+
$flag_options['license_name'] = '';
|
223 |
+
$flag_options['useMediaRSS'] = false; // activate the global Media RSS file
|
224 |
+
|
225 |
+
$flag_options['gp_jscode'] = ''; // GRAND Pages: google analytics code
|
226 |
+
|
227 |
+
// Sort Settings
|
228 |
+
$flag_options['albSort'] = 'title'; // Galleries Sort order
|
229 |
+
$flag_options['albSortDir'] = 'ASC'; // Galleries Sort dir
|
230 |
+
$flag_options['albPerPage'] = '50'; // Galleries per page
|
231 |
+
$flag_options['galSort'] = 'sortorder'; // Images Sort order
|
232 |
+
$flag_options['galSortDir'] = 'ASC'; // Images Sort direction
|
233 |
+
|
234 |
+
// Flash settings
|
235 |
+
$flag_options['skinsDirABS'] = str_replace( "\\", "/", WP_PLUGIN_DIR . '/flagallery-skins/' );
|
236 |
+
$flag_options['skinsDirURL'] = WP_PLUGIN_URL . '/flagallery-skins/';
|
237 |
+
$flag_options['flashSkin'] = 'amron';
|
238 |
+
$flag_options['flashWidth'] = '100%';
|
239 |
+
$flag_options['flashHeight'] = '500';
|
240 |
+
|
241 |
+
// Image Settings
|
242 |
+
$flag_options['imgWidth'] = 2200; // Image Width
|
243 |
+
$flag_options['imgHeight'] = 2200; // Image height
|
244 |
+
$flag_options['imgQuality'] = 87; // Image Quality
|
245 |
+
|
246 |
+
// Thumbnail Settings
|
247 |
+
$flag_options['thumbWidth'] = 400; // Thumb Width
|
248 |
+
$flag_options['thumbHeight'] = 400; // Thumb height
|
249 |
+
$flag_options['thumbQuality'] = 100; // Thumb Quality
|
250 |
+
|
251 |
+
$flag_options['mpAutoplay'] = 'false';
|
252 |
+
$flag_options['vmAutoplay'] = 'false';
|
253 |
+
$flag_options['vmWidth'] = '640';
|
254 |
+
$flag_options['vmHeight'] = '480';
|
255 |
+
|
256 |
+
$flag_options['advanced'] = false; // Advanced options
|
257 |
+
$flag_options['hide_woow'] = '0';
|
258 |
+
$flag_options['show_music_box'] = '0';
|
259 |
+
$flag_options['show_video_box'] = '0';
|
260 |
+
$flag_options['show_banner_box'] = '0';
|
261 |
+
|
262 |
+
return $flag_options;
|
263 |
+
}
|
264 |
+
|
265 |
+
/**
|
266 |
+
* Deregister a capability from all classic roles
|
267 |
+
*
|
268 |
+
* @access internal
|
269 |
+
*
|
270 |
+
* @param string $capability name of the capability which should be deregister
|
271 |
+
*
|
272 |
+
* @return void
|
273 |
+
*/
|
274 |
+
function flag_remove_capability( $capability ) {
|
275 |
+
// this function remove the $capability only from the classic roles
|
276 |
+
$check_order = [ "subscriber", "contributor", "author", "editor", "administrator" ];
|
277 |
+
|
278 |
+
foreach ( $check_order as $role ) {
|
279 |
+
|
280 |
+
$role = get_role( $role );
|
281 |
+
$role->remove_cap( $capability );
|
282 |
+
}
|
283 |
+
|
284 |
+
}
|
285 |
+
|
286 |
+
/**
|
287 |
+
* Uninstall all settings and tables
|
288 |
+
* Called via Setup and register_unstall hook
|
289 |
+
*
|
290 |
+
* @access internal
|
291 |
+
* @return void
|
292 |
+
*/
|
293 |
+
function flag_uninstall() {
|
294 |
+
global $wpdb;
|
295 |
+
|
296 |
+
// first remove all tables
|
297 |
+
$wpdb->query( "DROP TABLE IF EXISTS {$wpdb->prefix}flag_pictures" );
|
298 |
+
$wpdb->query( "DROP TABLE IF EXISTS {$wpdb->prefix}flag_gallery" );
|
299 |
+
$wpdb->query( "DROP TABLE IF EXISTS {$wpdb->prefix}flag_comments" );
|
300 |
+
$wpdb->query( "DROP TABLE IF EXISTS {$wpdb->prefix}flag_album" );
|
301 |
+
|
302 |
+
// then remove all options
|
303 |
+
delete_option( 'flag_options' );
|
304 |
+
delete_option( 'flag_db_version' );
|
305 |
+
delete_option( 'flagVersion' );
|
306 |
+
delete_option( 'flag_plugin_error' );
|
307 |
+
|
308 |
+
// now remove the capability
|
309 |
+
flag_remove_capability( "FlAG overview" );
|
310 |
+
flag_remove_capability( "FlAG Use TinyMCE" );
|
311 |
+
flag_remove_capability( "FlAG Upload images" );
|
312 |
+
flag_remove_capability( "FlAG Import folder" );
|
313 |
+
flag_remove_capability( "FlAG Manage gallery" );
|
314 |
+
flag_remove_capability( 'FlAG Manage others gallery' );
|
315 |
+
flag_remove_capability( "FlAG Change skin" );
|
316 |
+
flag_remove_capability( 'FlAG Add skins' );
|
317 |
+
flag_remove_capability( 'FlAG Delete skins' );
|
318 |
+
flag_remove_capability( "FlAG Change options" );
|
319 |
+
flag_remove_capability( "FlAG Manage music" );
|
320 |
+
flag_remove_capability( "FlAG Manage video" );
|
321 |
+
flag_remove_capability( "FlAG Manage banners" );
|
322 |
+
flag_remove_capability( "FlAG iFrame page" );
|
323 |
+
|
324 |
+
require_once ABSPATH . '/wp-admin/includes/plugin.php';
|
325 |
+
if ( is_plugin_active( FLAGFOLDER . '/flag.php' ) ) {
|
326 |
+
// Deactivate plugin
|
327 |
+
deactivate_plugins( FLAGFOLDER . '/flag.php' );
|
328 |
+
$plugins_url = admin_url( 'plugins.php' );
|
329 |
+
wp_redirect( $plugins_url );
|
330 |
+
exit();
|
331 |
+
}
|
332 |
+
}
|
admin/flagframe-tool.php
CHANGED
@@ -1,278 +1,360 @@
|
|
1 |
-
<?php if(preg_match('#' . basename(__FILE__) . '#', $_SERVER['PHP_SELF'])) {
|
2 |
-
|
3 |
-
|
4 |
-
|
5 |
-
|
6 |
-
|
7 |
-
|
8 |
-
|
9 |
-
|
10 |
-
|
11 |
-
if(
|
12 |
-
|
13 |
-
|
14 |
-
|
15 |
-
|
16 |
-
|
17 |
-
|
18 |
-
|
19 |
-
|
20 |
-
|
21 |
-
|
22 |
-
|
23 |
-
|
24 |
-
|
25 |
-
|
26 |
-
|
27 |
-
$
|
28 |
-
|
29 |
-
|
30 |
-
|
31 |
-
|
32 |
-
|
33 |
-
|
34 |
-
|
35 |
-
|
36 |
-
|
37 |
-
|
38 |
-
|
39 |
-
|
40 |
-
|
41 |
-
var
|
42 |
-
|
43 |
-
|
44 |
-
|
45 |
-
|
46 |
-
|
47 |
-
|
48 |
-
|
49 |
-
|
50 |
-
|
51 |
-
|
52 |
-
|
53 |
-
|
54 |
-
|
55 |
-
|
56 |
-
|
57 |
-
|
58 |
-
|
59 |
-
|
60 |
-
|
61 |
-
jQuery('#
|
62 |
-
|
63 |
-
|
64 |
-
|
65 |
-
|
66 |
-
|
67 |
-
|
68 |
-
|
69 |
-
|
70 |
-
|
71 |
-
|
72 |
-
|
73 |
-
|
74 |
-
|
75 |
-
|
76 |
-
|
77 |
-
|
78 |
-
|
79 |
-
|
80 |
-
|
81 |
-
|
82 |
-
|
83 |
-
|
84 |
-
|
85 |
-
|
86 |
-
|
87 |
-
|
88 |
-
|
89 |
-
|
90 |
-
|
91 |
-
|
92 |
-
|
93 |
-
|
94 |
-
|
95 |
-
|
96 |
-
|
97 |
-
|
98 |
-
|
99 |
-
|
100 |
-
|
101 |
-
|
102 |
-
|
103 |
-
|
104 |
-
|
105 |
-
|
106 |
-
|
107 |
-
|
108 |
-
|
109 |
-
|
110 |
-
|
111 |
-
|
112 |
-
|
113 |
-
|
114 |
-
|
115 |
-
|
116 |
-
|
117 |
-
|
118 |
-
|
119 |
-
|
120 |
-
|
121 |
-
jQuery('#
|
122 |
-
|
123 |
-
|
124 |
-
|
125 |
-
|
126 |
-
|
127 |
-
|
128 |
-
|
129 |
-
|
130 |
-
|
131 |
-
|
132 |
-
|
133 |
-
|
134 |
-
|
135 |
-
|
136 |
-
|
137 |
-
|
138 |
-
|
139 |
-
|
140 |
-
|
141 |
-
|
142 |
-
|
143 |
-
|
144 |
-
|
145 |
-
|
146 |
-
|
147 |
-
|
148 |
-
|
149 |
-
|
150 |
-
|
151 |
-
|
152 |
-
|
153 |
-
|
154 |
-
|
155 |
-
|
156 |
-
|
157 |
-
|
158 |
-
|
159 |
-
|
160 |
-
|
161 |
-
|
162 |
-
|
163 |
-
|
164 |
-
|
165 |
-
|
166 |
-
|
167 |
-
|
168 |
-
|
169 |
-
|
170 |
-
|
171 |
-
|
172 |
-
|
173 |
-
|
174 |
-
|
175 |
-
|
176 |
-
|
177 |
-
|
178 |
-
|
179 |
-
|
180 |
-
|
181 |
-
|
182 |
-
|
183 |
-
|
184 |
-
|
185 |
-
|
186 |
-
|
187 |
-
|
188 |
-
<
|
189 |
-
|
190 |
-
|
191 |
-
|
192 |
-
|
193 |
-
|
194 |
-
|
195 |
-
|
196 |
-
|
197 |
-
|
198 |
-
|
199 |
-
|
200 |
-
|
201 |
-
|
202 |
-
|
203 |
-
|
204 |
-
|
205 |
-
|
206 |
-
|
207 |
-
|
208 |
-
|
209 |
-
|
210 |
-
|
211 |
-
|
212 |
-
|
213 |
-
|
214 |
-
|
215 |
-
|
216 |
-
|
217 |
-
</
|
218 |
-
<
|
219 |
-
|
220 |
-
|
221 |
-
|
222 |
-
|
223 |
-
<
|
224 |
-
|
225 |
-
|
226 |
-
|
227 |
-
|
228 |
-
|
229 |
-
|
230 |
-
|
231 |
-
|
232 |
-
|
233 |
-
|
234 |
-
|
235 |
-
|
236 |
-
|
237 |
-
|
238 |
-
|
239 |
-
|
240 |
-
|
241 |
-
|
242 |
-
|
243 |
-
|
244 |
-
|
245 |
-
|
246 |
-
|
247 |
-
|
248 |
-
|
249 |
-
|
250 |
-
|
251 |
-
|
252 |
-
|
253 |
-
|
254 |
-
|
255 |
-
|
256 |
-
|
257 |
-
|
258 |
-
|
259 |
-
|
260 |
-
|
261 |
-
|
262 |
-
|
263 |
-
|
264 |
-
|
265 |
-
|
266 |
-
|
267 |
-
|
268 |
-
|
269 |
-
|
270 |
-
|
271 |
-
|
272 |
-
|
273 |
-
|
274 |
-
|
275 |
-
|
276 |
-
|
277 |
-
|
278 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php if ( preg_match( '#' . basename( __FILE__ ) . '#', $_SERVER['PHP_SELF'] ) ) {
|
2 |
+
die( 'You are not allowed to call this page directly.' );
|
3 |
+
}
|
4 |
+
|
5 |
+
// check for correct capability
|
6 |
+
if ( ! is_user_logged_in() ) {
|
7 |
+
die( '-1' );
|
8 |
+
}
|
9 |
+
|
10 |
+
// check for correct FlAG capability
|
11 |
+
if ( ! current_user_can( 'FlAG iFrame page' ) ) {
|
12 |
+
die( '-1' );
|
13 |
+
}
|
14 |
+
|
15 |
+
if ( isset( $_POST['copy_file'] ) ) {
|
16 |
+
if ( copy( FLAG_ABSPATH . 'flagframe.php', ABSPATH . 'flagframe.php' ) ) {
|
17 |
+
flagGallery::show_message( __( 'Success', 'flash-album-gallery' ) );
|
18 |
+
} else {
|
19 |
+
flagGallery::show_error( __( 'Failure', 'flash-album-gallery' ) );
|
20 |
+
}
|
21 |
+
}
|
22 |
+
global $flag, $flagdb;
|
23 |
+
require_once( dirname( __FILE__ ) . '/get_skin.php' );
|
24 |
+
require_once( dirname( __FILE__ ) . '/playlist.functions.php' );
|
25 |
+
require_once( dirname( __FILE__ ) . '/video.functions.php' );
|
26 |
+
require_once( dirname( __FILE__ ) . '/banner.functions.php' );
|
27 |
+
$i_skins = get_skins();
|
28 |
+
$all_m_playlists = get_playlists();
|
29 |
+
$all_v_playlists = get_v_playlists();
|
30 |
+
$all_b_playlists = get_b_playlists();
|
31 |
+
$fb_url = plugins_url() . '/flash-album-gallery/flagframe.php';
|
32 |
+
if ( file_exists( ABSPATH . 'flagframe.php' ) ) {
|
33 |
+
$fb_url = home_url() . '/flagframe.php';
|
34 |
+
}
|
35 |
+
?>
|
36 |
+
<script type="text/javascript">/*<![CDATA[*/
|
37 |
+
var url = '<?php echo $fb_url; ?>';
|
38 |
+
jQuery(document).ready(function() {
|
39 |
+
jQuery('#galleries input[value="all"]').attr('checked', 'checked').parent().siblings('.row').find('input').removeAttr('checked');
|
40 |
+
jQuery('#items_array').val('all');
|
41 |
+
var galleries = '?i=' + jQuery('#items_array').val().split(',').join('_');
|
42 |
+
var skin = jQuery('#skinname option:selected').val();
|
43 |
+
if (skin) {
|
44 |
+
skin = '&f=' + skin;
|
45 |
+
}
|
46 |
+
else {
|
47 |
+
skin = '';
|
48 |
+
}
|
49 |
+
var w = jQuery('#gallerywidth').val();
|
50 |
+
var h = jQuery('#galleryheight').val();
|
51 |
+
fb_url(galleries, skin, w, h);
|
52 |
+
jQuery('#galleries :checkbox').click(function() {
|
53 |
+
var cur, arr, del;
|
54 |
+
if (jQuery(this).is(':checked')) {
|
55 |
+
cur = jQuery(this).val();
|
56 |
+
if (cur == 'all') {
|
57 |
+
jQuery(this).parent().siblings('.row').find('input').removeAttr('checked');
|
58 |
+
jQuery('#items_array').val(cur);
|
59 |
+
}
|
60 |
+
else {
|
61 |
+
jQuery('#galleries input[value="all"]').removeAttr('checked');
|
62 |
+
arr = jQuery('#items_array').val();
|
63 |
+
if (arr && arr != 'all') { del = ','; }
|
64 |
+
else {
|
65 |
+
arr = '';
|
66 |
+
del = '';
|
67 |
+
}
|
68 |
+
jQuery('#items_array').val(arr + del + cur);
|
69 |
+
}
|
70 |
+
}
|
71 |
+
else {
|
72 |
+
cur = jQuery(this).val();
|
73 |
+
arr = jQuery('#items_array').val().split(',');
|
74 |
+
arr = jQuery.grep(arr, function(a) { return a != cur; }).join(',');
|
75 |
+
if (arr) {
|
76 |
+
jQuery('#items_array').val(arr);
|
77 |
+
}
|
78 |
+
else {
|
79 |
+
jQuery('#galleries input[value="all"]').attr('checked', 'checked');
|
80 |
+
jQuery('#items_array').val('all');
|
81 |
+
}
|
82 |
+
}
|
83 |
+
galleries = '?i=' + jQuery('#items_array').val().split(',').join('_');
|
84 |
+
skin = jQuery('#skinname option:selected').val();
|
85 |
+
if (skin) {
|
86 |
+
skin = '&f=' + skin;
|
87 |
+
}
|
88 |
+
else {
|
89 |
+
skin = '';
|
90 |
+
}
|
91 |
+
w = jQuery('#gallerywidth').val();
|
92 |
+
h = jQuery('#galleryheight').val();
|
93 |
+
fb_url(galleries, skin, w, h);
|
94 |
+
});
|
95 |
+
jQuery('#skinname').change(function() {
|
96 |
+
var skin = jQuery(this).val();
|
97 |
+
if (skin) {
|
98 |
+
skin = '&f=' + skin;
|
99 |
+
}
|
100 |
+
else {
|
101 |
+
skin = '';
|
102 |
+
}
|
103 |
+
galleries = '?i=' + jQuery('#items_array').val().split(',').join('_');
|
104 |
+
w = jQuery('#gallerywidth').val();
|
105 |
+
h = jQuery('#galleryheight').val();
|
106 |
+
fb_url(galleries, skin, w, h);
|
107 |
+
});
|
108 |
+
jQuery('#gallerywidth, #galleryheight').bind('keyup', function() {
|
109 |
+
var w = jQuery('#gallerywidth').val();
|
110 |
+
var h = jQuery('#galleryheight').val();
|
111 |
+
galleries = '?i=' + jQuery('#items_array').val().split(',').join('_');
|
112 |
+
skin = jQuery('#skinname option:selected').val();
|
113 |
+
if (skin) {
|
114 |
+
skin = '&f=' + skin;
|
115 |
+
}
|
116 |
+
else {
|
117 |
+
skin = '';
|
118 |
+
}
|
119 |
+
fb_url(galleries, skin, w, h);
|
120 |
+
});
|
121 |
+
jQuery('#m_playlist, #gallerywidth2, #galleryheight2').change(function() {
|
122 |
+
var playlist = jQuery('#m_playlist').val();
|
123 |
+
if (playlist) {
|
124 |
+
playlist = '?m=' + playlist;
|
125 |
+
}
|
126 |
+
else {
|
127 |
+
playlist = '';
|
128 |
+
}
|
129 |
+
fb_url2(playlist, 2);
|
130 |
+
});
|
131 |
+
jQuery('#v_playlist, #gallerywidth3, #galleryheight3').change(function() {
|
132 |
+
var playlist = jQuery('#v_playlist').val();
|
133 |
+
if (playlist) {
|
134 |
+
playlist = '?v=' + playlist;
|
135 |
+
}
|
136 |
+
else {
|
137 |
+
playlist = '';
|
138 |
+
}
|
139 |
+
fb_url2(playlist, 3);
|
140 |
+
});
|
141 |
+
jQuery('#b_playlist, #gallerywidth4, #galleryheight4').change(function() {
|
142 |
+
var playlist = jQuery('#b_playlist').val();
|
143 |
+
if (playlist) {
|
144 |
+
playlist = '?b=' + playlist;
|
145 |
+
}
|
146 |
+
else {
|
147 |
+
playlist = '';
|
148 |
+
}
|
149 |
+
fb_url2(playlist, 4);
|
150 |
+
});
|
151 |
+
});
|
152 |
+
|
153 |
+
function fb_url(galleries, skin, w, h) {
|
154 |
+
jQuery('#fb1_url0').val(url + galleries + skin);
|
155 |
+
jQuery('#fb1_ifr0').val('<iframe src="' + url + galleries + skin + '" allowfullscreen allowtransparency frameborder="0" width="' + w + '" height="' + h + '"></iframe>');
|
156 |
+
}
|
157 |
+
|
158 |
+
function fb_url2(playlist, fieldset_id) {
|
159 |
+
if (playlist) {
|
160 |
+
var w = jQuery('#gallerywidth' + fieldset_id).val();
|
161 |
+
var h = jQuery('#galleryheight' + fieldset_id).val();
|
162 |
+
jQuery('#fb' + fieldset_id + '_url0').val(url + playlist);
|
163 |
+
jQuery('#fb' + fieldset_id + '_ifr0').val('<iframe src="' + url + playlist + '" allowfullscreen allowtransparency frameborder="0" width="' + w + '" height="' + h + '"></iframe>');
|
164 |
+
}
|
165 |
+
else {
|
166 |
+
jQuery('#fb' + fieldset_id + '_url0').val(url);
|
167 |
+
jQuery('#fb' + fieldset_id + '_ifr0').val('');
|
168 |
+
}
|
169 |
+
}
|
170 |
+
|
171 |
+
/*]]>*/</script>
|
172 |
+
<div class="flag-wrap">
|
173 |
+
<h2><?php _e( 'Flagallery iFrame', 'flash-album-gallery' ); ?></h2>
|
174 |
+
<form id="flagframe_copy" name="flagframe_copy" method="POST" class="alignright">
|
175 |
+
<p>Optional: <input type="submit" name="copy_file" class="button-primary" value="<?php _e( 'Copy flagframe.php file to root directory', 'flash-album-gallery' ); ?>"/><br/>
|
176 |
+
(makes iframe url shorter)</p>
|
177 |
+
</form>
|
178 |
+
<form id="generator1">
|
179 |
+
<fieldset style="clear:both; margin:0 0 20px 0; padding: 20px; border: 1px solid #888888;">
|
180 |
+
<legend style="font-size: 18px; padding: 0 5px;"><?php _e( "Photo Gallery iFrame Generator", 'flash-album-gallery' ); ?></legend>
|
181 |
+
<table border="0" cellpadding="4" cellspacing="0">
|
182 |
+
<tr>
|
183 |
+
<td nowrap="nowrap" valign="top">
|
184 |
+
<div><?php _e( "Select galleries", 'flash-album-gallery' ); ?>:<span style="color:red;"> *</span><br/><small><?php _e( "(album categories)", 'flash-album-gallery' ); ?></small></div>
|
185 |
+
</td>
|
186 |
+
<td valign="top">
|
187 |
+
<div id="galleries" style="width: 214px; height: 160px; overflow: auto; white-space: nowrap;">
|
188 |
+
<div class="row"><input type="checkbox" value="all" checked="checked"/> <strong><span style="display:inline-block; width:3em;">*</span> - <?php _e( "all galleries", 'flash-album-gallery' ); ?></strong></div>
|
189 |
+
<?php
|
190 |
+
$gallerylist = $flagdb->find_all_galleries( $flag->options['albSort'], $flag->options['albSortDir'] );
|
191 |
+
if ( is_array( $gallerylist ) ) {
|
192 |
+
foreach ( $gallerylist as $gallery ) {
|
193 |
+
$name = ( empty( $gallery->title ) ) ? $gallery->name : esc_html( stripslashes( $gallery->title ) );
|
194 |
+
echo '<div class="row"><input type="checkbox" value="' . $gallery->gid . '" /> <span><span style="display:inline-block; width:3em;">' . $gallery->gid . '</span> - ' . $name . '</span></div>' . "\n";
|
195 |
+
}
|
196 |
+
}
|
197 |
+
?>
|
198 |
+
</div>
|
199 |
+
</td>
|
200 |
+
</tr>
|
201 |
+
<tr>
|
202 |
+
<td nowrap="nowrap" valign="top"><p style="padding-top:3px;"><?php _e( "Galleries order", 'flash-album-gallery' ); ?>: </p></td>
|
203 |
+
<td valign="top"><p><input readonly="readonly" type="text" id="items_array" value="all" style="width: 214px;"/></p></td>
|
204 |
+
</tr>
|
205 |
+
<tr>
|
206 |
+
<td nowrap="nowrap" valign="top"><p style="padding-top:3px;"><label for="skinname"><?php _e( "Choose skin", 'flash-album-gallery' ); ?>:</label></p></td>
|
207 |
+
<td valign="top">
|
208 |
+
<p><select id="skinname" name="skinname" style="width: 214px;">
|
209 |
+
<option value="" selected="selected"><?php _e( "skin active by default", 'flash-album-gallery' ); ?></option>
|
210 |
+
<?php
|
211 |
+
foreach ( (array) $i_skins as $skin_file => $skin_data ) {
|
212 |
+
echo '<option value="' . dirname( $skin_file ) . '">' . $skin_data['Name'] . '</option>' . "\n";
|
213 |
+
}
|
214 |
+
?>
|
215 |
+
</select></p>
|
216 |
+
</td>
|
217 |
+
</tr>
|
218 |
+
<tr>
|
219 |
+
<td valign="top"><p style="padding-top:3px;"><?php _e( "iFrame size", 'flash-album-gallery' ); ?>:<br/><span style="font-size:9px">(<?php _e( "blank for default", 'flash-album-gallery' ); ?>)</span></p></td>
|
220 |
+
<td valign="top"><p><?php _e( "width", 'flash-album-gallery' ); ?>: <input id="gallerywidth" type="text" style="width: 50px" value="100%"/> <?php _e( "height", 'flash-album-gallery' ); ?>: <input id="galleryheight" type="text" style="width: 50px" value="500"/></p></td>
|
221 |
+
</tr>
|
222 |
+
<tr>
|
223 |
+
<td valign="top">
|
224 |
+
<div style="padding-top:3px;"><strong><?php _e( "iFrame Url", 'flash-album-gallery' ); ?>: </strong></div>
|
225 |
+
</td>
|
226 |
+
<td valign="top"><input id="fb1_url0" type="text" style="width: 780px; font-size: 10px;" value="<?php echo $fb_url . '?i=all'; ?>" readonly/></td>
|
227 |
+
</tr>
|
228 |
+
<tr>
|
229 |
+
<td valign="top">
|
230 |
+
<div style="padding-top:3px;"><strong><?php _e( "Embed iFrame code", 'flash-album-gallery' ); ?>: </strong></div>
|
231 |
+
</td>
|
232 |
+
<td valign="top"><textarea id="fb1_ifr0" style="width: 600px; height:60px; font-size: 12px;" readonly></textarea></td>
|
233 |
+
</tr>
|
234 |
+
</table>
|
235 |
+
</fieldset>
|
236 |
+
</form>
|
237 |
+
<?php if ( ! empty( $flag->options['show_music_box'] ) ) { ?>
|
238 |
+
<form id="generator2">
|
239 |
+
<fieldset style="padding: 20px; margin:0 0 20px 0; border: 1px solid #888888;">
|
240 |
+
<legend style="font-size: 18px; padding: 0 5px;"><?php _e( "mp3 Gallery iFrame Generator", 'flash-album-gallery' ); ?></legend>
|
241 |
+
<table border="0" cellpadding="4" cellspacing="0">
|
242 |
+
<tr>
|
243 |
+
<td nowrap="nowrap" valign="top"><p style="padding-top:3px;"><label><?php _e( "Choose playlist", 'flash-album-gallery' ); ?>:</label></p></td>
|
244 |
+
<td valign="top">
|
245 |
+
<p><select id="m_playlist" style="width: 214px;">
|
246 |
+
<option value="" selected="selected"><?php _e( 'Choose playlist', 'flash-album-gallery' ); ?></option>
|
247 |
+
<?php
|
248 |
+
foreach ( (array) $all_m_playlists as $playlist_file => $playlist_data ) {
|
249 |
+
$playlist_name = basename( $playlist_file, '.xml' );
|
250 |
+
?>
|
251 |
+
<option value="<?php echo $playlist_name; ?>"><?php echo esc_html( stripslashes( $playlist_data['title'] ) ); ?></option>
|
252 |
+
<?php
|
253 |
+
}
|
254 |
+
?>
|
255 |
+
</select></p>
|
256 |
+
</td>
|
257 |
+
</tr>
|
258 |
+
<tr>
|
259 |
+
<td valign="top"><p style="padding-top:3px;"><?php _e( "iFrame size", 'flash-album-gallery' ); ?>:<br/><span style="font-size:9px">(<?php _e( "blank for default", 'flash-album-gallery' ); ?>)</span></p></td>
|
260 |
+
<td valign="top"><p><?php _e( "width", 'flash-album-gallery' ); ?>: <input id="gallerywidth2" type="text" style="width: 50px" value="100%"/> <?php _e( "height", 'flash-album-gallery' ); ?>: <input id="galleryheight2" type="text" style="width: 50px" value="500"/></p></td>
|
261 |
+
</tr>
|
262 |
+
<tr>
|
263 |
+
<td valign="top">
|
264 |
+
<div style="padding-top:3px;"><strong><?php _e( "iFrame Url", 'flash-album-gallery' ); ?>: </strong></div>
|
265 |
+
</td>
|
266 |
+
<td valign="top"><input id="fb2_url0" type="text" style="width: 600px; font-size: 10px;" value="<?php echo $fb_url . '?m='; ?>" readonly/></td>
|
267 |
+
</tr>
|
268 |
+
<tr>
|
269 |
+
<td valign="top">
|
270 |
+
<div style="padding-top:3px;"><strong><?php _e( "Embed iFrame code", 'flash-album-gallery' ); ?>: </strong></div>
|
271 |
+
</td>
|
272 |
+
<td valign="top"><textarea id="fb2_ifr0" style="width: 600px; height:60px; font-size: 12px;" readonly></textarea></td>
|
273 |
+
</tr>
|
274 |
+
</table>
|
275 |
+
</fieldset>
|
276 |
+
</form>
|
277 |
+
<?php } ?>
|
278 |
+
<?php if ( ! empty( $flag->options['show_video_box'] ) ) { ?>
|
279 |
+
<form id="generator3">
|
280 |
+
<fieldset style="padding: 20px; margin:0 0 20px 0; border: 1px solid #888888;">
|
281 |
+
<legend style="font-size: 18px; padding: 0 5px;"><?php _e( "Video Blog Gallery iFrame Generator", 'flash-album-gallery' ); ?></legend>
|
282 |
+
<table border="0" cellpadding="4" cellspacing="0">
|
283 |
+
<tr>
|
284 |
+
<td nowrap="nowrap" valign="top"><p style="padding-top:3px;"><label><?php _e( "Choose playlist", 'flash-album-gallery' ); ?>:</label></p></td>
|
285 |
+
<td valign="top">
|
286 |
+
<p><select id="v_playlist" style="width: 214px;">
|
287 |
+
<option value="" selected="selected"><?php _e( 'Choose playlist', 'flash-album-gallery' ); ?></option>
|
288 |
+
<?php
|
289 |
+
foreach ( (array) $all_v_playlists as $playlist_file => $playlist_data ) {
|
290 |
+
$playlist_name = basename( $playlist_file, '.xml' );
|
291 |
+
?>
|
292 |
+
<option value="<?php echo $playlist_name; ?>"><?php echo esc_html( stripslashes( $playlist_data['title'] ) ); ?></option>
|
293 |
+
<?php
|
294 |
+
}
|
295 |
+
?>
|
296 |
+
</select></p>
|
297 |
+
</td>
|
298 |
+
</tr>
|
299 |
+
<tr>
|
300 |
+
<td valign="top"><p style="padding-top:3px;"><?php _e( "iFrame size", 'flash-album-gallery' ); ?>:<br/><span style="font-size:9px">(<?php _e( "blank for default", 'flash-album-gallery' ); ?>)</span></p></td>
|
301 |
+
<td valign="top"><p><?php _e( "width", 'flash-album-gallery' ); ?>: <input id="gallerywidth3" type="text" style="width: 50px" value="100%"/> <?php _e( "height", 'flash-album-gallery' ); ?>: <input id="galleryheight3" type="text" style="width: 50px" value="500"/></p></td>
|
302 |
+
</tr>
|
303 |
+
<tr>
|
304 |
+
<td valign="top">
|
305 |
+
<div style="padding-top:3px;"><strong><?php _e( "iFrame Url", 'flash-album-gallery' ); ?>: </strong></div>
|
306 |
+
</td>
|
307 |
+
<td valign="top"><input id="fb3_url0" type="text" style="width: 600px; font-size: 10px;" value="<?php echo $fb_url . '?v='; ?>" readonly/></td>
|
308 |
+
</tr>
|
309 |
+
<tr>
|
310 |
+
<td valign="top">
|
311 |
+
<div style="padding-top:3px;"><strong><?php _e( "Embed iFrame code", 'flash-album-gallery' ); ?>: </strong></div>
|
312 |
+
</td>
|
313 |
+
<td valign="top"><textarea id="fb3_ifr0" style="width: 600px; height:60px; font-size: 12px;" readonly</textarea></td>
|
314 |
+
</tr>
|
315 |
+
</table>
|
316 |
+
</fieldset>
|
317 |
+
</form>
|
318 |
+
<?php } ?>
|
319 |
+
<?php if ( ! empty( $flag->options['show_banner_box'] ) ) { ?>
|
320 |
+
<form id="generator4">
|
321 |
+
<fieldset style="padding: 20px; margin:0 0 20px 0; border: 1px solid #888888;">
|
322 |
+
<legend style="font-size: 18px; padding: 0 5px;"><?php _e( "Banner Box iFrame Generator", 'flash-album-gallery' ); ?></legend>
|
323 |
+
<table border="0" cellpadding="4" cellspacing="0">
|
324 |
+
<tr>
|
325 |
+
<td nowrap="nowrap" valign="top"><p style="padding-top:3px;"><label><?php _e( "Choose xml", 'flash-album-gallery' ); ?>:</label></p></td>
|
326 |
+
<td valign="top">
|
327 |
+
<p><select id="b_playlist" style="width: 214px;">
|
328 |
+
<option value="" selected="selected"><?php _e( 'Choose XML', 'flash-album-gallery' ); ?></option>
|
329 |
+
<?php
|
330 |
+
foreach ( (array) $all_b_playlists as $playlist_file => $playlist_data ) {
|
331 |
+
$playlist_name = basename( $playlist_file, '.xml' );
|
332 |
+
?>
|
333 |
+
<option value="<?php echo $playlist_name; ?>"><?php echo esc_html( stripslashes( $playlist_data['title'] ) ); ?></option>
|
334 |
+
<?php
|
335 |
+
}
|
336 |
+
?>
|
337 |
+
</select></p>
|
338 |
+
</td>
|
339 |
+
</tr>
|
340 |
+
<tr>
|
341 |
+
<td valign="top"><p style="padding-top:3px;"><?php _e( "iFrame size", 'flash-album-gallery' ); ?>:<br/><span style="font-size:9px">(<?php _e( "blank for default", 'flash-album-gallery' ); ?>)</span></p></td>
|
342 |
+
<td valign="top"><p><?php _e( "width", 'flash-album-gallery' ); ?>: <input id="gallerywidth4" type="text" style="width: 50px" value="100%"/> <?php _e( "height", 'flash-album-gallery' ); ?>: <input id="galleryheight4" type="text" style="width: 50px" value="500"/></p></td>
|
343 |
+
</tr>
|
344 |
+
<tr>
|
345 |
+
<td valign="top">
|
346 |
+
<div style="padding-top:3px;"><strong><?php _e( "iFrame Url", 'flash-album-gallery' ); ?>: </strong></div>
|
347 |
+
</td>
|
348 |
+
<td valign="top"><input id="fb4_url0" type="text" style="width: 600px; font-size: 10px;" value="<?php echo $fb_url . '?b='; ?>" readonly/></td>
|
349 |
+
</tr>
|
350 |
+
<tr>
|
351 |
+
<td valign="top">
|
352 |
+
<div style="padding-top:3px;"><strong><?php _e( "Embed iFrame code", 'flash-album-gallery' ); ?>: </strong></div>
|
353 |
+
</td>
|
354 |
+
<td valign="top"><textarea id="fb4_ifr0" style="width: 600px; height:60px; font-size: 12px;" readonly></textarea></td>
|
355 |
+
</tr>
|
356 |
+
</table>
|
357 |
+
</fieldset>
|
358 |
+
</form>
|
359 |
+
<?php } ?>
|
360 |
+
</div>
|
admin/functions.php
CHANGED
@@ -1,1458 +1,1459 @@
|
|
1 |
-
<?php
|
2 |
-
|
3 |
-
if(preg_match('#' . basename(__FILE__) . '#', $_SERVER['PHP_SELF'])) { die('You are not allowed to call this page directly.'); }
|
4 |
-
|
5 |
-
/**
|
6 |
-
* flagAdmin - Class for admin operation
|
7 |
-
*/
|
8 |
-
if ( ! class_exists( 'flagAdmin' ) ) {
|
9 |
-
class flagAdmin{
|
10 |
-
|
11 |
-
/**
|
12 |
-
* create a new gallery & folder
|
13 |
-
*
|
14 |
-
* @class flagAdmin
|
15 |
-
* @param string $gallery
|
16 |
-
* @param string $defaultpath
|
17 |
-
* @param bool $output if the function should show an error messsage or not
|
18 |
-
* @return bool|int
|
19 |
-
*/
|
20 |
-
public static function create_gallery($gallery, $defaultpath, $output = true) {
|
21 |
-
global $wpdb, $user_ID;
|
22 |
-
|
23 |
-
// get the current user ID
|
24 |
-
wp_get_current_user();
|
25 |
-
|
26 |
-
$description = '';
|
27 |
-
$status = 0;
|
28 |
-
if(is_array($gallery)){
|
29 |
-
$gallerytitle = $gallery['title'];
|
30 |
-
$description = $gallery['description'];
|
31 |
-
$status = intval($gallery['status']);
|
32 |
-
} else {
|
33 |
-
$gallerytitle = $gallery;
|
34 |
-
}
|
35 |
-
//cleanup pathname
|
36 |
-
$galleryname = sanitize_flagname( $gallerytitle );
|
37 |
-
$galleryname = apply_filters('flag_gallery_name', $galleryname);
|
38 |
-
$galleryname = preg_replace('/[^\w\._-]+/', '', $galleryname);
|
39 |
-
if(!$galleryname) $galleryname = date('y-m-j_h-i-s');
|
40 |
-
|
41 |
-
$flagpath = $defaultpath . $galleryname;
|
42 |
-
$flagpath = trim($flagpath, '/');
|
43 |
-
$flagRoot = WINABSPATH . $defaultpath;
|
44 |
-
$txt = '';
|
45 |
-
|
46 |
-
// No gallery name ?
|
47 |
-
if (empty($galleryname)) {
|
48 |
-
if ($output) flagGallery::show_error( __('No valid gallery name!', 'flash-album-gallery') );
|
49 |
-
return false;
|
50 |
-
}
|
51 |
-
|
52 |
-
// check for main folder
|
53 |
-
if ( !is_dir($flagRoot) ) {
|
54 |
-
if ( !wp_mkdir_p( $flagRoot ) ) {
|
55 |
-
$txt = __('Directory', 'flash-album-gallery').' <strong>' . $defaultpath . '</strong> '.__('didn\'t exist. Please create first the main gallery folder ', 'flash-album-gallery').'!<br />';
|
56 |
-
$txt .= __('Check this link, if you didn\'t know how to set the permission :', 'flash-album-gallery').' <a href="http://codex.wordpress.org/Changing_File_Permissions">http://codex.wordpress.org/Changing_File_Permissions</a> ';
|
57 |
-
if ($output) flagGallery::show_error($txt);
|
58 |
-
return false;
|
59 |
-
}
|
60 |
-
}
|
61 |
-
|
62 |
-
// check for permission settings, Safe mode limitations are not taken into account.
|
63 |
-
if ( !is_writeable( $flagRoot ) ) {
|
64 |
-
$txt = __('Directory', 'flash-album-gallery').' <strong>' . $defaultpath . '</strong> '.__('is not writeable !', 'flash-album-gallery').'<br />';
|
65 |
-
$txt .= __('Check this link, if you didn\'t know how to set the permission :', 'flash-album-gallery').' <a href="http://codex.wordpress.org/Changing_File_Permissions">http://codex.wordpress.org/Changing_File_Permissions</a> ';
|
66 |
-
if ($output) flagGallery::show_error($txt);
|
67 |
-
return false;
|
68 |
-
}
|
69 |
-
|
70 |
-
// 1. Create new gallery folder
|
71 |
-
if ( !is_dir(WINABSPATH . $flagpath) ) {
|
72 |
-
if ( !wp_mkdir_p (WINABSPATH . $flagpath) )
|
73 |
-
$txt = __('Unable to create directory ', 'flash-album-gallery').$flagpath.'!<br />';
|
74 |
-
}
|
75 |
-
|
76 |
-
// 2. Check folder permission
|
77 |
-
if ( !is_writeable(WINABSPATH . $flagpath ) )
|
78 |
-
$txt .= __('Directory', 'flash-album-gallery').' <strong>'.$flagpath.'</strong> '.__('is not writeable !', 'flash-album-gallery').'<br />';
|
79 |
-
|
80 |
-
// 3. Now create "thumbs" folder inside
|
81 |
-
if ( !is_dir(WINABSPATH . $flagpath . '/thumbs') ) {
|
82 |
-
if ( !wp_mkdir_p ( WINABSPATH . $flagpath . '/thumbs') )
|
83 |
-
$txt .= __('Unable to create directory ', 'flash-album-gallery').' <strong>' . $flagpath . '/thumbs !</strong>';
|
84 |
-
}
|
85 |
-
|
86 |
-
// 4. Now create "webview" folder inside
|
87 |
-
if ( !is_dir(WINABSPATH . $flagpath . '/webview') ) {
|
88 |
-
if ( !wp_mkdir_p ( WINABSPATH . $flagpath . '/webview') )
|
89 |
-
$txt .= __('Unable to create directory ', 'flash-album-gallery').' <strong>' . $flagpath . '/webview !</strong>';
|
90 |
-
}
|
91 |
-
|
92 |
-
if (FLAG_SAFE_MODE) {
|
93 |
-
$help = __('The server setting Safe-Mode is on !', 'flash-album-gallery');
|
94 |
-
$help .= '<br />'.__('If you have problems, please create directory', 'flash-album-gallery').' <strong>' . $flagpath . '</strong> ';
|
95 |
-
$help .= __('and the thumbnails directory', 'flash-album-gallery').' <strong>' . $flagpath . '/thumbs</strong> '.__('with permission 777 manually !', 'flash-album-gallery');
|
96 |
-
if ($output) flagGallery::show_message($help);
|
97 |
-
}
|
98 |
-
|
99 |
-
// show an error message
|
100 |
-
if ( !empty($txt) ) {
|
101 |
-
if (FLAG_SAFE_MODE) {
|
102 |
-
// for safe_mode , better delete folder, both folder must be created manually
|
103 |
-
@rmdir(WINABSPATH . $flagpath . '/thumbs');
|
104 |
-
@rmdir(WINABSPATH . $flagpath);
|
105 |
-
}
|
106 |
-
if ($output) flagGallery::show_error($txt);
|
107 |
-
return false;
|
108 |
-
}
|
109 |
-
|
110 |
-
$result = $wpdb->get_var($wpdb->prepare("SELECT `name` FROM `{$wpdb->flaggallery}` WHERE `name` = '%s' ", $galleryname));
|
111 |
-
|
112 |
-
if ($result) {
|
113 |
-
if ($output) flagGallery::show_error( _n( 'Gallery', 'Galleries', 1, 'flash-album-gallery' ) .' <strong>' . $galleryname . '</strong> '.__('already exists', 'flash-album-gallery'));
|
114 |
-
return true;
|
115 |
-
} else {
|
116 |
-
if(empty($user_ID)){
|
117 |
-
$user_ID = $wpdb->get_var("SELECT ID FROM $wpdb->users ORDER BY ID");
|
118 |
-
}
|
119 |
-
$result = $wpdb->query( $wpdb->prepare("INSERT INTO $wpdb->flaggallery (name, path, title, galdesc, author, status) VALUES (%s, %s, %s, %s, %s, %d)", $galleryname, $flagpath, $gallerytitle, $description, $user_ID, $status) );
|
120 |
-
// and give me the new id
|
121 |
-
$gallery_id = (int) $wpdb->insert_id;
|
122 |
-
// here you can inject a custom function
|
123 |
-
do_action('flag_created_new_gallery', $gallery_id);
|
124 |
-
|
125 |
-
if ($result) {
|
126 |
-
$message = __('Gallery \'%1$s\' successfully created.<br/>You can show this gallery with the tag %2$s.<br/>','flash-album-gallery');
|
127 |
-
$message = sprintf($message, esc_html(stripcslashes($gallerytitle)), '[flagallery gid=' . $gallery_id . ']');
|
128 |
-
$message .= '<a href="' . admin_url() . 'admin.php?page=flag-manage-gallery&mode=edit&gid=' . $gallery_id . '" >';
|
129 |
-
$message .= __('Edit gallery','flash-album-gallery');
|
130 |
-
$message .= '</a>';
|
131 |
-
|
132 |
-
if ($output) flagGallery::show_message($message);
|
133 |
-
}
|
134 |
-
// return only the id if defined
|
135 |
-
if ($gallery_id)
|
136 |
-
return $gallery_id;
|
137 |
-
|
138 |
-
return true;
|
139 |
-
}
|
140 |
-
}
|
141 |
-
|
142 |
-
/**
|
143 |
-
* flagAdmin::import_gallery()
|
144 |
-
* TODO: Check permission of existing thumb folder & images
|
145 |
-
*
|
146 |
-
* @class flagAdmin
|
147 |
-
* @param string $galleryfolder contains relative path
|
148 |
-
* @return void
|
149 |
-
*/
|
150 |
-
public static function import_gallery($galleryfolder) {
|
151 |
-
|
152 |
-
global $wpdb, $user_ID;
|
153 |
-
|
154 |
-
// get the current user ID
|
155 |
-
wp_get_current_user();
|
156 |
-
|
157 |
-
$created_msg = '';
|
158 |
-
|
159 |
-
// remove trailing slashes, if somebody use it
|
160 |
-
$galleryfolder = str_replace('../','', $galleryfolder );
|
161 |
-
$galleryfolder = trim($galleryfolder, '/');
|
162 |
-
$gallerypath = WINABSPATH . $galleryfolder;
|
163 |
-
|
164 |
-
if (!is_dir($gallerypath)) {
|
165 |
-
flagGallery::show_error(__('Directory', 'flash-album-gallery').' <strong>'.esc_html($gallerypath).'</strong> '.__('doesn`t exist!', 'flash-album-gallery').' '.__('Or imported folder name contains special characters.', 'flash-album-gallery'));
|
166 |
-
return ;
|
167 |
-
}
|
168 |
-
|
169 |
-
// read list of images
|
170 |
-
$new_imageslist = flagAdmin::scandir($gallerypath);
|
171 |
-
if (empty($new_imageslist)) {
|
172 |
-
flagGallery::show_message(__('Directory', 'flash-album-gallery').' <strong>'.esc_html($gallerypath).'</strong> '.__('contains no pictures', 'flash-album-gallery'));
|
173 |
-
return;
|
174 |
-
}
|
175 |
-
|
176 |
-
// check & create thumbnail folder
|
177 |
-
if ( !flagGallery::create_thumbnail_folder($gallerypath) )
|
178 |
-
return;
|
179 |
-
|
180 |
-
// take folder name as gallery name
|
181 |
-
$galleryname = basename($galleryfolder);
|
182 |
-
|
183 |
-
// check for existing gallery folder
|
184 |
-
$gallery_id = $wpdb->get_var($wpdb->prepare("SELECT gid FROM {$wpdb->flaggallery} WHERE path = '%s' ", $galleryfolder));
|
185 |
-
|
186 |
-
if (!$gallery_id) {
|
187 |
-
$result = $wpdb->query( $wpdb->prepare("INSERT INTO {$wpdb->flaggallery} (name, path, title, author) VALUES (%s, %s, %s, %s)", $galleryname, $galleryfolder, $galleryname , $user_ID) );
|
188 |
-
if (!$result) {
|
189 |
-
flagGallery::show_error(__('Database error. Could not add gallery!','flash-album-gallery'));
|
190 |
-
return;
|
191 |
-
}
|
192 |
-
$created_msg = _n( 'Gallery', 'Galleries', 1, 'flash-album-gallery' ) . ' <strong>' . $galleryname . '</strong> ' . __('successfully created!','flash-album-gallery') . '<br />';
|
193 |
-
$gallery_id = $wpdb->insert_id; // get index_id
|
194 |
-
}
|
195 |
-
|
196 |
-
// Look for existing image list
|
197 |
-
$old_imageslist = $wpdb->get_col($wpdb->prepare("SELECT filename FROM {$wpdb->flagpictures} WHERE galleryid = %d ", $gallery_id));
|
198 |
-
|
199 |
-
// if no images are there, create empty array
|
200 |
-
if ($old_imageslist == NULL)
|
201 |
-
$old_imageslist = array();
|
202 |
-
|
203 |
-
// check difference
|
204 |
-
$new_images = array_diff($new_imageslist, $old_imageslist);
|
205 |
-
|
206 |
-
// all images must be valid files
|
207 |
-
foreach($new_images as $key => $picture) {
|
208 |
-
if (!@getimagesize($gallerypath . '/' . $picture) ) {
|
209 |
-
unset($new_images[$key]);
|
210 |
-
@unlink($gallerypath . '/' . $picture);
|
211 |
-
}
|
212 |
-
}
|
213 |
-
|
214 |
-
// add images to database
|
215 |
-
$image_ids = flagAdmin::add_Images($gallery_id, $new_images);
|
216 |
-
|
217 |
-
//add the preview image if needed
|
218 |
-
flagAdmin::set_gallery_preview ( $gallery_id );
|
219 |
-
|
220 |
-
// now create thumbnails
|
221 |
-
flagAdmin::do_ajax_operation( 'create_thumbnail' , $image_ids, __('Create new thumbnails','flash-album-gallery') );
|
222 |
-
|
223 |
-
//TODO:Message will not shown, because AJAX routine require more time, message should be passed to AJAX
|
224 |
-
flagGallery::show_message( $created_msg . count($image_ids) .__(' picture(s) successfully added','flash-album-gallery') );
|
225 |
-
|
226 |
-
return;
|
227 |
-
|
228 |
-
}
|
229 |
-
|
230 |
-
/**
|
231 |
-
* flagAdmin::import_video()
|
232 |
-
*
|
233 |
-
* @class flagAdmin
|
234 |
-
* @param string $folder contains relative path
|
235 |
-
* @return void
|
236 |
-
*/
|
237 |
-
public static function import_video($folder) {
|
238 |
-
|
239 |
-
|
240 |
-
$created_msg = '';
|
241 |
-
// remove trailing slash at the end, if somebody use it
|
242 |
-
$folder = str_replace(array('../','\'','"','<','>','$','%','='),'', $folder);
|
243 |
-
$folder = rtrim($folder, '/');
|
244 |
-
$path = WINABSPATH . $folder;
|
245 |
-
if (!is_dir($path)) {
|
246 |
-
echo '<p class="message">'.__('Directory', 'flash-album-gallery').' <strong>'.$path.'</strong> '.__('doesn`t exist!', 'flash-album-gallery').' '.__('Or imported folder name contains special characters.', 'flash-album-gallery').'</p>';
|
247 |
-
return ;
|
248 |
-
}
|
249 |
-
// read list of files
|
250 |
-
$ext = array('mp4','ogg','webm','flv');
|
251 |
-
$new_filelist = flagAdmin::scandir($path, $ext);
|
252 |
-
if (empty($new_filelist)) {
|
253 |
-
echo '<p class="message">'.__('Directory', 'flash-album-gallery').' <strong>'.$path.'</strong> '.__('does not contain video files', 'flash-album-gallery').'</p>';
|
254 |
-
return;
|
255 |
-
}
|
256 |
-
$i=0;
|
257 |
-
foreach($new_filelist as $key => $file) {
|
258 |
-
//$new_filelist[$key] = $path . '/' . $file;
|
259 |
-
$filename = $path . '/' . $file;
|
260 |
-
$id = flagAdmin::handle_import_file($filename);
|
261 |
-
if ( is_wp_error($id) ) {
|
262 |
-
$created_msg .= '<p>' . sprintf(__('<em>%s</em> was <strong>not</strong> imported due to an error: %s', 'flash-album-gallery'), $file, $id->get_error_message() ) . '</p>';
|
263 |
-
} else {
|
264 |
-
$i++;
|
265 |
-
$created_msg .= '<p>' . sprintf(__('<em>%s</em> has been added to Media library', 'flash-album-gallery'), $file) . '</p>';
|
266 |
-
}
|
267 |
-
}
|
268 |
-
$created_msg .= '<p class="message">'.$i.__(' file(s) successfully added','flash-album-gallery').'</p><div class="hidden">'.$created_msg.'</div>';
|
269 |
-
echo $created_msg;
|
270 |
-
}
|
271 |
-
|
272 |
-
/**
|
273 |
-
* flagAdmin::import_mp3()
|
274 |
-
*
|
275 |
-
* @class flagAdmin
|
276 |
-
* @param string $folder contains relative path
|
277 |
-
* @return void
|
278 |
-
*/
|
279 |
-
public static function import_mp3($folder) {
|
280 |
-
|
281 |
-
$created_msg = '';
|
282 |
-
// remove trailing slash at the end, if somebody use it
|
283 |
-
$folder = str_replace(array('../','\'','"','<','>','$','%','='),'', $folder);
|
284 |
-
$folder = rtrim($folder, '/');
|
285 |
-
$path = WINABSPATH . $folder;
|
286 |
-
if (!is_dir($path)) {
|
287 |
-
echo '<p class="message">'.__('Directory', 'flash-album-gallery').' <strong>'.$path.'</strong> '.__('doesn`t exist!', 'flash-album-gallery').' '.__('Or imported folder name contains special characters.', 'flash-album-gallery').'</p>';
|
288 |
-
return ;
|
289 |
-
}
|
290 |
-
// read list of files
|
291 |
-
$ext = array('mp3', 'ogg', 'wav');
|
292 |
-
$new_filelist = flagAdmin::scandir($path, $ext);
|
293 |
-
if (empty($new_filelist)) {
|
294 |
-
echo '<p class="message">'.__('Directory', 'flash-album-gallery').' <strong>'.$path.'</strong> '.__('does not contain audio files', 'flash-album-gallery').'</p>';
|
295 |
-
return;
|
296 |
-
}
|
297 |
-
$i=0;
|
298 |
-
foreach($new_filelist as $key => $file) {
|
299 |
-
//$new_filelist[$key] = $path . '/' . $file;
|
300 |
-
$filename = $path . '/' . $file;
|
301 |
-
$id = flagAdmin::handle_import_file($filename);
|
302 |
-
if ( is_wp_error($id) ) {
|
303 |
-
$created_msg .= '<p>' . sprintf(__('<em>%s</em> was <strong>not</strong> imported due to an error: %s', 'flash-album-gallery'), $file, $id->get_error_message() ) . '</p>';
|
304 |
-
} else {
|
305 |
-
$i++;
|
306 |
-
$created_msg .= '<p>' . sprintf(__('<em>%s</em> has been added to Media library', 'flash-album-gallery'), $file) . '</p>';
|
307 |
-
}
|
308 |
-
}
|
309 |
-
$created_msg .= '<p class="message">'.$i.__(' file(s) successfully added','flash-album-gallery').'</p><div class="hidden">'.$created_msg.'</div>';
|
310 |
-
echo $created_msg;
|
311 |
-
}
|
312 |
-
|
313 |
-
/**
|
314 |
-
* flagAdmin::import_banner()
|
315 |
-
*
|
316 |
-
* @class flagAdmin
|
317 |
-
* @param string $folder contains relative path
|
318 |
-
* @return array
|
319 |
-
*/
|
320 |
-
public static function import_banner($folder) {
|
321 |
-
|
322 |
-
$created_msg = '';
|
323 |
-
// remove trailing slash at the end, if somebody use it
|
324 |
-
$folder = str_replace(array('../','\'','"','<','>','$','%','='),'', $folder);
|
325 |
-
$folder = rtrim($folder, '/');
|
326 |
-
$path = WINABSPATH . $folder;
|
327 |
-
if (!is_dir($path)) {
|
328 |
-
echo '<p class="message">'.__('Directory', 'flash-album-gallery').' <strong>'.$path.'</strong> '.__('doesn`t exist!', 'flash-album-gallery').' '.__('Or imported folder name contains special characters.', 'flash-album-gallery').'</p>';
|
329 |
-
return false;
|
330 |
-
}
|
331 |
-
// read list of files
|
332 |
-
$new_filelist = flagAdmin::scandir($path);
|
333 |
-
if (empty($new_filelist)) {
|
334 |
-
echo '<p class="message">'.__('Directory', 'flash-album-gallery').' <strong>'.$path.'</strong> '.__('does not contain image files', 'flash-album-gallery').'</p>';
|
335 |
-
return false;
|
336 |
-
}
|
337 |
-
$created_msg .= '<div class="message"><p>'.count($new_filelist).' '.__('image(s) in the folder','flash-album-gallery').':</p><div class="flag_crunching"><div class="flag_progress"><span class="flag_complete"></span><span class="txt">'.__('Crunching...','flash-album-gallery').'</span></div></div></div>';
|
338 |
-
echo $created_msg;
|
339 |
-
return $new_filelist;
|
340 |
-
}
|
341 |
-
|
342 |
-
//Handle an individual file import.
|
343 |
-
public static function handle_import_file($file, $post_id = 0) {
|
344 |
-
set_time_limit(120);
|
345 |
-
$time = current_time('mysql');
|
346 |
-
if ( $post = get_post($post_id) ) {
|
347 |
-
if ( substr( $post->post_date, 0, 4 ) > 0 )
|
348 |
-
$time = $post->post_date;
|
349 |
-
}
|
350 |
-
|
351 |
-
// A writable uploads dir will pass this test. Again, there's no point overriding this one.
|
352 |
-
if ( ! ( ( $uploads = wp_upload_dir($time) ) && false === $uploads['error'] ) )
|
353 |
-
return new WP_Error($uploads['error']);
|
354 |
-
|
355 |
-
$wp_filetype = wp_check_filetype( $file, null );
|
356 |
-
|
357 |
-
/** @var $type
|
358 |
-
* @var $ext */
|
359 |
-
extract( $wp_filetype );
|
360 |
-
|
361 |
-
if ( ( !$type || !$ext ) && !current_user_can( 'unfiltered_upload' ) )
|
362 |
-
return new WP_Error('wrong_file_type', __( 'File type does not meet security guidelines. Try another.' ) ); //A WP-core string..
|
363 |
-
|
364 |
-
$match = preg_match('|^' . preg_quote(str_replace('\\', '/', $uploads['basedir'])) . '(.*)$|i', $file, $mat);
|
365 |
-
//Is the file allready in the uploads folder?
|
366 |
-
if( $match ) {
|
367 |
-
|
368 |
-
$filename = basename($file);
|
369 |
-
$new_file = $file;
|
370 |
-
|
371 |
-
$url = $uploads['baseurl'] . $mat[1];
|
372 |
-
|
373 |
-
$attachment = get_posts(array( 'post_type' => 'attachment', 'meta_key' => '_wp_attached_file', 'meta_value' => $uploads['subdir'] . '/' . $filename ));
|
374 |
-
if ( !empty($attachment) )
|
375 |
-
return $attachment[0]->ID;
|
376 |
-
|
377 |
-
//Ok, Its in the uploads folder, But NOT in WordPress's media library.
|
378 |
-
if ( preg_match("|(\d+)/(\d+)|", $mat[1], $datemat) ) //So lets set the date of the import to the date folder its in, IF its in a date folder.
|
379 |
-
$time = mktime(0, 0, 0, $datemat[2], 1, $datemat[1]);
|
380 |
-
else //Else, set the date based on the date of the files time.
|
381 |
-
$time = @filemtime($file);
|
382 |
-
|
383 |
-
if ( $time ) {
|
384 |
-
$post_date = date( 'Y-m-d H:i:s', $time);
|
385 |
-
$post_date_gmt = gmdate( 'Y-m-d H:i:s', $time);
|
386 |
-
}
|
387 |
-
} else {
|
388 |
-
$filename = wp_unique_filename( $uploads['path'], basename($file));
|
389 |
-
|
390 |
-
// copy the file to the uploads dir
|
391 |
-
$new_file = $uploads['path'] . '/' . $filename;
|
392 |
-
if ( false === @copy( $file, $new_file ) ){
|
393 |
-
wp_die(sprintf(__('The selected file could not be copied to %s.', 'flash-album-gallery'), $uploads['path']));
|
394 |
-
}
|
395 |
-
|
396 |
-
// Set correct file permissions
|
397 |
-
$stat = stat( dirname( $new_file ));
|
398 |
-
$perms = $stat['mode'] & 0000666;
|
399 |
-
@ chmod( $new_file, $perms );
|
400 |
-
// Compute the URL
|
401 |
-
$url = $uploads['url'] . '/' . rawurlencode($filename);
|
402 |
-
}
|
403 |
-
|
404 |
-
// Compute the URL
|
405 |
-
//Apply upload filters
|
406 |
-
$return = apply_filters( 'wp_handle_upload', array( 'file' => $new_file, 'url' => $url, 'type' => $type ) );
|
407 |
-
$new_file = $return['file'];
|
408 |
-
$url = $return['url'];
|
409 |
-
$type = $return['type'];
|
410 |
-
|
411 |
-
$title = preg_replace('!\.[^.]+$!', '', basename($file));
|
412 |
-
$content = '';
|
413 |
-
|
414 |
-
// use image exif/iptc data for title and caption defaults if possible
|
415 |
-
if ( $image_meta = @wp_read_image_metadata($new_file) ) {
|
416 |
-
if ( '' != trim($image_meta['title']) )
|
417 |
-
$title = trim($image_meta['title']);
|
418 |
-
if ( '' != trim($image_meta['caption']) )
|
419 |
-
$content = trim($image_meta['caption']);
|
420 |
-
}
|
421 |
-
|
422 |
-
if ( empty($post_date) )
|
423 |
-
$post_date = current_time('mysql');
|
424 |
-
if ( empty($post_date_gmt) )
|
425 |
-
$post_date_gmt = current_time('mysql', 1);
|
426 |
-
|
427 |
-
// Construct the attachment array
|
428 |
-
$attachment = array(
|
429 |
-
'post_mime_type' => $type,
|
430 |
-
'guid' => $url,
|
431 |
-
'post_parent' => $post_id,
|
432 |
-
'post_title' => $title,
|
433 |
-
'post_name' => $title,
|
434 |
-
'post_content' => $content,
|
435 |
-
'post_date' => $post_date,
|
436 |
-
'post_date_gmt' => $post_date_gmt
|
437 |
-
);
|
438 |
-
|
439 |
-
// Save the data
|
440 |
-
$id = wp_insert_attachment($attachment, $new_file, $post_id);
|
441 |
-
if ( !is_wp_error($id) ) {
|
442 |
-
$data = wp_generate_attachment_metadata( $id, $new_file );
|
443 |
-
wp_update_attachment_metadata( $id, $data );
|
444 |
-
if( !$match && isset($_POST['delete_files']) ) {
|
445 |
-
@unlink($file);
|
446 |
-
}
|
447 |
-
}
|
448 |
-
|
449 |
-
return $id;
|
450 |
-
}
|
451 |
-
|
452 |
-
/**
|
453 |
-
* flagAdmin::scandir()
|
454 |
-
*
|
455 |
-
* @class flagAdmin
|
456 |
-
* @param string $dirname
|
457 |
-
* @param array $ext
|
458 |
-
* @return array
|
459 |
-
*/
|
460 |
-
public static function scandir($dirname = '.', $ext = array()) {
|
461 |
-
// thx to php.net :-)
|
462 |
-
if(empty($ext))
|
463 |
-
$ext = array('jpeg', 'jpg', 'png', 'gif');
|
464 |
-
$files = array();
|
465 |
-
if($handle = opendir($dirname)) {
|
466 |
-
while(false !== ($file = readdir($handle)))
|
467 |
-
for($i=0;$i<sizeof($ext);$i++)
|
468 |
-
if(stristr($file, '.' . $ext[$i]))
|
469 |
-
$files[] = utf8_encode($file);
|
470 |
-
closedir($handle);
|
471 |
-
}
|
472 |
-
sort($files);
|
473 |
-
return ($files);
|
474 |
-
}
|
475 |
-
|
476 |
-
/**
|
477 |
-
* flagAdmin::createThumbnail() - function to create or recreate a thumbnail
|
478 |
-
*
|
479 |
-
* @param object | int $image contain all information about the image or the id
|
480 |
-
* @return string result code
|
481 |
-
*/
|
482 |
-
public static function create_thumbnail($image) {
|
483 |
-
|
484 |
-
global $flag;
|
485 |
-
|
486 |
-
if ( is_numeric($image) )
|
487 |
-
$image = flagdb::find_image( $image );
|
488 |
-
|
489 |
-
if ( !is_object($image) )
|
490 |
-
return __('Object didn\'t contain correct data','flash-album-gallery');
|
491 |
-
|
492 |
-
$dest_path = dirname($image->webimagePath);
|
493 |
-
if(!is_dir($dest_path)){
|
494 |
-
flagGallery::create_webview_folder(dirname($image->imagePath));
|
495 |
-
@chmod( $dest_path, 0755 );
|
496 |
-
}
|
497 |
-
|
498 |
-
if(! class_exists('flag_Thumbnail'))
|
499 |
-
require_once( flagGallery::graphic_library() );
|
500 |
-
|
501 |
-
// check for existing thumbnail
|
502 |
-
if (file_exists($image->thumbPath))
|
503 |
-
if (!is_writable($image->thumbPath))
|
504 |
-
return $image->filename . __(' is not writeable ','flash-album-gallery');
|
505 |
-
|
506 |
-
$thumb = new flag_Thumbnail($image->imagePath, TRUE);
|
507 |
-
$img_size = @getimagesize ( $image->imagePath );
|
508 |
-
|
509 |
-
// skip if file is not there
|
510 |
-
if (!$thumb->error) {
|
511 |
-
$thumb->resize($flag->options['thumbWidth'],$flag->options['thumbHeight']);
|
512 |
-
|
513 |
-
// save the new thumbnail
|
514 |
-
$thumb->save($image->thumbPath, $flag->options['thumbQuality']);
|
515 |
-
flagAdmin::chmod ($image->thumbPath);
|
516 |
-
|
517 |
-
//read the new sizes
|
518 |
-
$new_size = @getimagesize ( $image->thumbPath );
|
519 |
-
$size['width'] = $new_size[0];
|
520 |
-
$size['height'] = $new_size[1];
|
521 |
-
|
522 |
-
// add them to the database
|
523 |
-
flagdb::update_image_meta($image->pid, array( 'thumbnail' => $size) );
|
524 |
-
}
|
525 |
-
|
526 |
-
$thumb->destruct();
|
527 |
-
|
528 |
-
if ( !empty($thumb->errmsg) )
|
529 |
-
return $image->filename . ' (Error : '.$thumb->errmsg .')';
|
530 |
-
|
531 |
-
do_action('flag_thumbnail_created', $image);
|
532 |
-
|
533 |
-
flagAdmin::webview_image($image);
|
534 |
-
|
535 |
-
// success
|
536 |
-
return '1';
|
537 |
-
}
|
538 |
-
|
539 |
-
/**
|
540 |
-
* flagAdmin::resize_image() - create a new image, based on the height /width
|
541 |
-
*
|
542 |
-
* @class flagAdmin
|
543 |
-
* @param object | int $image contain all information about the image or the id
|
544 |
-
* @param integer $width optional
|
545 |
-
* @param integer $height optional
|
546 |
-
* @return string result code
|
547 |
-
*/
|
548 |
-
public static function resize_image($image, $width = 0, $height = 0) {
|
549 |
-
|
550 |
-
global $flag;
|
551 |
-
|
552 |
-
if(! class_exists('flag_Thumbnail'))
|
553 |
-
require_once( flagGallery::graphic_library() );
|
554 |
-
|
555 |
-
if ( is_numeric($image) )
|
556 |
-
$image = flagdb::find_image( $image );
|
557 |
-
|
558 |
-
if ( !is_object($image) )
|
559 |
-
return __('Object didn\'t contain correct data','flash-album-gallery');
|
560 |
-
|
561 |
-
// before we start we import the meta data to database (required for uploads before V0.40)
|
562 |
-
flagAdmin::maybe_import_meta( $image->pid );
|
563 |
-
|
564 |
-
// if no parameter is set, take global settings
|
565 |
-
$width = ($width == 0) ? $flag->options['imgWidth'] : $width;
|
566 |
-
$height = ($height == 0) ? $flag->options['imgHeight'] : $height;
|
567 |
-
|
568 |
-
if (!is_writable($image->imagePath))
|
569 |
-
return ' <strong>' . $image->filename . __(' is not writeable','flash-album-gallery') . '</strong>';
|
570 |
-
|
571 |
-
$file = new flag_Thumbnail($image->imagePath, TRUE);
|
572 |
-
|
573 |
-
// skip if file is not there
|
574 |
-
if (!$file->error) {
|
575 |
-
$file->resize($width, $height, 4);
|
576 |
-
$file->save($image->imagePath, $flag->options['imgQuality']);
|
577 |
-
// read the new sizes
|
578 |
-
$size = @getimagesize ( $image->imagePath );
|
579 |
-
// add them to the database
|
580 |
-
flagdb::update_image_meta($image->pid, array( 'width' => $size[0], 'height' => $size[1] ) );
|
581 |
-
$file->destruct();
|
582 |
-
} else {
|
583 |
-
$file->destruct();
|
584 |
-
return ' <strong>' . $image->filename . ' (Error : ' . $file->errmsg . ')</strong>';
|
585 |
-
}
|
586 |
-
|
587 |
-
do_action('flag_image_resized', $image);
|
588 |
-
|
589 |
-
return '1';
|
590 |
-
}
|
591 |
-
|
592 |
-
/**
|
593 |
-
* flagAdmin::webview_image() - create a new image, based on the height /width
|
594 |
-
*
|
595 |
-
* @class flagAdmin
|
596 |
-
*
|
597 |
-
* @param object | int $image contain all information about the image or the id
|
598 |
-
* @param bool $return_size
|
599 |
-
*
|
600 |
-
* @return string result code
|
601 |
-
*/
|
602 |
-
public static function webview_image($image, $return_size = false) {
|
603 |
-
|
604 |
-
global $flag;
|
605 |
-
|
606 |
-
if ( is_numeric($image) )
|
607 |
-
$image = flagdb::find_image( $image );
|
608 |
-
|
609 |
-
if ( !is_object($image) )
|
610 |
-
return __('Object didn\'t contain correct data','flash-album-gallery');
|
611 |
-
|
612 |
-
$img_size = @getimagesize ( $image->imagePath );
|
613 |
-
$webviewsize = '0';
|
614 |
-
$dest_path = dirname($image->webimagePath);
|
615 |
-
if(flagGallery::create_webview_folder(dirname($image->imagePath))){
|
616 |
-
if (! is_writable( $dest_path ) ) {
|
617 |
-
@chmod( $dest_path, 0755 );
|
618 |
-
}
|
619 |
-
|
620 |
-
if (file_exists($image->webimagePath)){
|
621 |
-
$webviewsize = @getimagesize ( $image->webimagePath );
|
622 |
-
flagdb::update_image_meta($image->pid, array( 'webview' => $webviewsize) );
|
623 |
-
if($return_size){
|
624 |
-
return $webviewsize;
|
625 |
-
} else {
|
626 |
-
return '1';
|
627 |
-
}
|
628 |
-
}
|
629 |
-
|
630 |
-
$imgquality = $flag->options['imgQuality'];
|
631 |
-
$max_width = ($img_size[0] < 2000)? $img_size[0] : 2000;
|
632 |
-
$max_height = ($img_size[1] < 2000)? $img_size[1] : 2000;
|
633 |
-
if( function_exists('wp_get_image_editor') ) {
|
634 |
-
$editor = wp_get_image_editor( $image->imagePath );
|
635 |
-
if ( ! is_wp_error( $editor ) ) {
|
636 |
-
$editor->set_quality( $imgquality );
|
637 |
-
$editor->resize( $max_width, $max_height, 0 );
|
638 |
-
$saved = $editor->save( $image->webimagePath );
|
639 |
-
if($saved['path'] !== $image->webimagePath) {
|
640 |
-
@rename($saved['path'], $image->webimagePath);
|
641 |
-
}
|
642 |
-
if(@filesize($image->webimagePath) > @filesize($image->imagePath)) {
|
643 |
-
@copy($image->imagePath, $image->webimagePath);
|
644 |
-
}
|
645 |
-
$webviewsize = @getimagesize ( $image->webimagePath );
|
646 |
-
flagdb::update_image_meta($image->pid, array( 'webview' => $webviewsize) );
|
647 |
-
|
648 |
-
do_action('flag_image_optimized', $image);
|
649 |
-
}
|
650 |
-
}
|
651 |
-
}
|
652 |
-
|
653 |
-
if($return_size){
|
654 |
-
return $webviewsize;
|
655 |
-
} else {
|
656 |
-
return '1';
|
657 |
-
}
|
658 |
-
}
|
659 |
-
|
660 |
-
/**
|
661 |
-
* Add images to database
|
662 |
-
*
|
663 |
-
* @class flagAdmin
|
664 |
-
* @param int $galleryID
|
665 |
-
* @param array $imageslist
|
666 |
-
* @param bool $name2alt
|
667 |
-
* @return array $image_ids Id's which are sucessful added
|
668 |
-
*/
|
669 |
-
public static function add_Images($galleryID, $imageslist, $name2alt = false) {
|
670 |
-
global $wpdb;
|
671 |
-
|
672 |
-
$alttext = '';
|
673 |
-
$image_ids = array();
|
674 |
-
|
675 |
-
if ( is_array($imageslist) ) {
|
676 |
-
foreach($imageslist as $picture) {
|
677 |
-
if($name2alt) {
|
678 |
-
// strip off the extension of the filename
|
679 |
-
$path_parts = pathinfo( $picture );
|
680 |
-
$alttext = ( !isset($path_parts['filename']) ) ? substr($path_parts['basename'], 0,strpos($path_parts['basename'], '.')) : $path_parts['filename'];
|
681 |
-
}
|
682 |
-
// save it to the database
|
683 |
-
$result = $wpdb->query( $wpdb->prepare("INSERT INTO $wpdb->flagpictures (galleryid, filename, alttext, exclude) VALUES (%s, %s, %s, 0)", $galleryID, $picture, $alttext) );
|
684 |
-
// and give me the new id
|
685 |
-
$pic_id = (int) $wpdb->insert_id;
|
686 |
-
if ($result)
|
687 |
-
$image_ids[] = $pic_id;
|
688 |
-
|
689 |
-
// add the metadata
|
690 |
-
flagAdmin::import_MetaData($pic_id);
|
691 |
-
|
692 |
-
// action hook for post process after the image is added to the database
|
693 |
-
$image = array( 'id' => $pic_id, 'filename' => $picture, 'galleryID' => $galleryID);
|
694 |
-
do_action('flag_added_new_image', $image);
|
695 |
-
|
696 |
-
}
|
697 |
-
} // is_array
|
698 |
-
|
699 |
-
return $image_ids;
|
700 |
-
|
701 |
-
}
|
702 |
-
|
703 |
-
/**
|
704 |
-
* Import some metadata into the database (if avialable)
|
705 |
-
*
|
706 |
-
* @class flagAdmin
|
707 |
-
* @param array|int $imagesIds
|
708 |
-
* @return bool
|
709 |
-
*/
|
710 |
-
public static function import_MetaData($imagesIds) {
|
711 |
-
|
712 |
-
global $wpdb;
|
713 |
-
|
714 |
-
require_once(FLAG_ABSPATH . 'lib/image.php');
|
715 |
-
|
716 |
-
if (!is_array($imagesIds))
|
717 |
-
$imagesIds = array($imagesIds);
|
718 |
-
|
719 |
-
foreach($imagesIds as $imageID) {
|
720 |
-
$image = flagdb::find_image($imageID);
|
721 |
-
if (!$image->error) {
|
722 |
-
|
723 |
-
$meta = flagAdmin::get_MetaData($image->pid);
|
724 |
-
|
725 |
-
// get the title
|
726 |
-
$alttext = empty( $meta['title'] ) ? $image->alttext : $meta['title'];
|
727 |
-
// get the caption / description field
|
728 |
-
$description = empty( $meta['caption'] ) ? $image->description : $meta['caption'];
|
729 |
-
// get the file date/time from exif
|
730 |
-
$timestamp = $meta['timestamp'];
|
731 |
-
// update database
|
732 |
-
$result = $wpdb->query( $wpdb->prepare("UPDATE $wpdb->flagpictures SET alttext = %s, description = %s, imagedate = %s WHERE pid = %d", $alttext, $description, $timestamp, $image->pid) );
|
733 |
-
if ($result === false)
|
734 |
-
return ' <strong>' . $image->filename . ' ' . __('(Error : Couldn\'t not update data base)', 'flash-album-gallery') . '</strong>';
|
735 |
-
|
736 |
-
//this flag will inform us the import is already one time performed
|
737 |
-
$meta['common']['saved'] = true;
|
738 |
-
$result = flagdb::update_image_meta($image->pid, $meta['common']);
|
739 |
-
|
740 |
-
if ($result === false)
|
741 |
-
return ' <strong>' . $image->filename . ' ' . __('(Error : Couldn\'t not update meta data)', 'flash-album-gallery') . '</strong>';
|
742 |
-
} else
|
743 |
-
return ' <strong>' . $image->filename . ' ' . __('(Error : Couldn\'t not find image)', 'flash-album-gallery') . '</strong>';// error check
|
744 |
-
}
|
745 |
-
|
746 |
-
return '1';
|
747 |
-
|
748 |
-
}
|
749 |
-
|
750 |
-
/**
|
751 |
-
* Copy some metadata into the image description (if avialable)
|
752 |
-
*
|
753 |
-
* @class flagAdmin
|
754 |
-
* @param array|int $imagesIds
|
755 |
-
* @return bool
|
756 |
-
*/
|
757 |
-
public static function copy_MetaData($imagesIds) {
|
758 |
-
|
759 |
-
global $wpdb;
|
760 |
-
|
761 |
-
/** @var $meta */
|
762 |
-
require_once(FLAG_ABSPATH . 'lib/meta.php');
|
763 |
-
require_once(FLAG_ABSPATH . 'lib/image.php');
|
764 |
-
|
765 |
-
if (!is_array($imagesIds))
|
766 |
-
$imagesIds = array($imagesIds);
|
767 |
-
|
768 |
-
foreach($imagesIds as $imageID) {
|
769 |
-
|
770 |
-
$image = flagdb::find_image($imageID);
|
771 |
-
if (!$image->error) {
|
772 |
-
/** @var $makedescription
|
773 |
-
* @var $timestamp */
|
774 |
-
require_once(FLAG_ABSPATH . 'admin/grab_meta.php');
|
775 |
-
|
776 |
-
// get the title
|
777 |
-
$alttext = empty( $alttext ) ? $image->alttext : $meta['title'];
|
778 |
-
if($alttext) $alttext = '<font size="16"><b>'.$alttext."</b></font>\n";
|
779 |
-
// get the caption / description field
|
780 |
-
$description = empty($description ) ? $image->description : $meta['caption'];
|
781 |
-
if($description) $description = $description."<br>\n";
|
782 |
-
// get the file date/time from exif
|
783 |
-
$makedescription = $alttext.$description.$makedescription;
|
784 |
-
// update database
|
785 |
-
$result = $wpdb->query( $wpdb->prepare("UPDATE $wpdb->flagpictures SET alttext = %s, description = %s, imagedate = %s WHERE pid = %d", '', $makedescription, $timestamp, $image->pid) );
|
786 |
-
if ($result === false)
|
787 |
-
return ' <strong>' . $image->filename . ' ' . __('(Error : Couldn\'t not update data base)', 'flash-album-gallery') . '</strong>';
|
788 |
-
|
789 |
-
} else
|
790 |
-
return ' <strong>' . $image->filename . ' ' . __('(Error : Couldn\'t not find image)', 'flash-album-gallery') . '</strong>';// error check
|
791 |
-
}
|
792 |
-
|
793 |
-
return '1';
|
794 |
-
|
795 |
-
}
|
796 |
-
|
797 |
-
/**
|
798 |
-
* flagAdmin::get_MetaData()
|
799 |
-
*
|
800 |
-
* @class flagAdmin
|
801 |
-
* @require Meta class
|
802 |
-
* @param $id
|
803 |
-
* @return array metadata
|
804 |
-
*/
|
805 |
-
public static function get_MetaData($id) {
|
806 |
-
|
807 |
-
require_once(FLAG_ABSPATH . 'lib/meta.php');
|
808 |
-
|
809 |
-
$meta = array();
|
810 |
-
|
811 |
-
$pdata = new flagMeta( $id );
|
812 |
-
|
813 |
-
$meta['title'] = trim ( $pdata->get_META('title') );
|
814 |
-
$meta['caption'] = trim ( $pdata->get_META('caption') );
|
815 |
-
$meta['keywords'] = trim ( $pdata->get_META('keywords') );
|
816 |
-
$meta['timestamp'] = $pdata->get_date_time();
|
817 |
-
// this contain other useful meta information
|
818 |
-
$meta['common'] = $pdata->get_common_meta();
|
819 |
-
|
820 |
-
return $meta;
|
821 |
-
|
822 |
-
}
|
823 |
-
|
824 |
-
/**
|
825 |
-
* Maybe import some meta data to the database. The functions checks the flag 'saved'
|
826 |
-
* and if based on compat reason (pre V0.40) we save then some meta datas to the database
|
827 |
-
*
|
828 |
-
* @param int $id
|
829 |
-
* @return mixed result
|
830 |
-
*/
|
831 |
-
public static function maybe_import_meta( $id ) {
|
832 |
-
|
833 |
-
require_once(FLAG_ABSPATH . 'lib/meta.php');
|
834 |
-
|
835 |
-
$meta_obj = new flagMeta( $id );
|
836 |
-
|
837 |
-
if ( $meta_obj->image->meta_data['saved'] != true ) {
|
838 |
-
$common = $meta_obj->get_common_meta();
|
839 |
-
//this flag will inform us that the import is already one time performed
|
840 |
-
$common['saved'] = true;
|
841 |
-
$result = flagdb::update_image_meta($id, $common);
|
842 |
-
} else
|
843 |
-
return false;
|
844 |
-
|
845 |
-
return $result;
|
846 |
-
|
847 |
-
}
|
848 |
-
|
849 |
-
/**
|
850 |
-
* flagAdmin::getOnlyImages()
|
851 |
-
*
|
852 |
-
* @class flagAdmin
|
853 |
-
* @param mixed $p_event
|
854 |
-
* @param mixed $p_header
|
855 |
-
* @return bool
|
856 |
-
*/
|
857 |
-
public static function getOnlyImages($p_event, $p_header) {
|
858 |
-
|
859 |
-
$info = pathinfo($p_header['filename']);
|
860 |
-
// check for extension
|
861 |
-
$ext = array('jpeg', 'jpg', 'png', 'gif');
|
862 |
-
if ( in_array( strtolower($info['extension']), $ext) ) {
|
863 |
-
// For MAC skip the ".image" files
|
864 |
-
if ($info['basename']{0} == '.' )
|
865 |
-
return 0;
|
866 |
-
else
|
867 |
-
return 1;
|
868 |
-
}
|
869 |
-
// ----- all other files are skipped
|
870 |
-
else {
|
871 |
-
return 0;
|
872 |
-
}
|
873 |
-
}
|
874 |
-
|
875 |
-
/**
|
876 |
-
* Function for uploading of images via the upload form
|
877 |
-
*
|
878 |
-
* @class flagAdmin
|
879 |
-
* @return void
|
880 |
-
*/
|
881 |
-
public static function upload_images() {
|
882 |
-
|
883 |
-
global $wpdb;
|
884 |
-
|
885 |
-
// WPMU action
|
886 |
-
if (flagAdmin::check_quota())
|
887 |
-
return;
|
888 |
-
|
889 |
-
// Images must be an array
|
890 |
-
$imageslist = array();
|
891 |
-
|
892 |
-
// get selected gallery
|
893 |
-
$galleryID = (int) $_POST['galleryselect'];
|
894 |
-
|
895 |
-
if ($galleryID == 0) {
|
896 |
-
flagGallery::show_error(__('No gallery selected !','flash-album-gallery'));
|
897 |
-
return;
|
898 |
-
}
|
899 |
-
|
900 |
-
// get the path to the gallery
|
901 |
-
$gallery = flagdb::find_gallery($galleryID);
|
902 |
-
|
903 |
-
if ( empty($gallery->path) ){
|
904 |
-
flagGallery::show_error(__('Failure in database, no gallery path set !','flash-album-gallery'));
|
905 |
-
return;
|
906 |
-
}
|
907 |
-
|
908 |
-
// read list of images
|
909 |
-
$dirlist = flagAdmin::scandir(WINABSPATH.$gallery->path);
|
910 |
-
|
911 |
-
$imagefiles = $_FILES['imagefiles'];
|
912 |
-
|
913 |
-
if (is_array($imagefiles)) {
|
914 |
-
foreach ($imagefiles['name'] as $key => $value) {
|
915 |
-
|
916 |
-
// look only for uploded files
|
917 |
-
if ($imagefiles['error'][$key] == 0) {
|
918 |
-
|
919 |
-
$temp_file = $imagefiles['tmp_name'][$key];
|
920 |
-
|
921 |
-
//clean filename and extract extension
|
922 |
-
$filepart = flagGallery::fileinfo( $imagefiles['name'][$key] );
|
923 |
-
$filename = sanitize_title($filepart['filename']) . '.' . $filepart['extension'];
|
924 |
-
|
925 |
-
// check for allowed extension and if it's an image file
|
926 |
-
$ext = array('jpg', 'jpeg', 'png', 'gif');
|
927 |
-
if ( !in_array(strtolower($filepart['extension']), $ext) || !@getimagesize($temp_file) ){
|
928 |
-
flagGallery::show_error('<strong>' . $imagefiles['name'][$key] . ' </strong>' . __('is no valid image file!','flash-album-gallery'));
|
929 |
-
continue;
|
930 |
-
}
|
931 |
-
|
932 |
-
// check if this filename already exist in the folder
|
933 |
-
$i = 0;
|
934 |
-
while ( in_array( $filename, $dirlist ) ) {
|
935 |
-
$filename = $filepart['filename'] . '_' . $i++ . '.' .$filepart['extension'];
|
936 |
-
}
|
937 |
-
|
938 |
-
$dest_file = $gallery->abspath . '/' . $filename;
|
939 |
-
|
940 |
-
//check for folder permission
|
941 |
-
if ( !is_writeable($gallery->abspath) ) {
|
942 |
-
$message = sprintf(__('Unable to write to directory %s. Is this directory writable by the server?', 'flash-album-gallery'), $gallery->abspath);
|
943 |
-
flagGallery::show_error($message);
|
944 |
-
return;
|
945 |
-
}
|
946 |
-
|
947 |
-
// save temp file to gallery
|
948 |
-
if ( !@move_uploaded_file($temp_file, $dest_file) ){
|
949 |
-
if( !file_exists($dest_file)){
|
950 |
-
flagGallery::show_error(__('Error, the file could not moved to : ','flash-album-gallery') . $dest_file);
|
951 |
-
flagAdmin::check_safemode( $gallery->abspath );
|
952 |
-
continue;
|
953 |
-
}
|
954 |
-
}
|
955 |
-
if ( !flagAdmin::chmod($dest_file) ) {
|
956 |
-
flagGallery::show_error(__('Error, the file permissions could not set','flash-album-gallery'));
|
957 |
-
continue;
|
958 |
-
}
|
959 |
-
|
960 |
-
// add to imagelist & dirlist
|
961 |
-
$imageslist[] = $filename;
|
962 |
-
$dirlist[] = $filename;
|
963 |
-
}
|
964 |
-
}
|
965 |
-
}
|
966 |
-
|
967 |
-
if (count($imageslist) > 0) {
|
968 |
-
|
969 |
-
// add images to database
|
970 |
-
$image_ids = flagAdmin::add_Images($galleryID, $imageslist);
|
971 |
-
|
972 |
-
//create thumbnails
|
973 |
-
flagAdmin::do_ajax_operation( 'create_thumbnail' , $image_ids, __('Create new thumbnails','flash-album-gallery') );
|
974 |
-
//add the preview image if needed
|
975 |
-
flagAdmin::set_gallery_preview ( $galleryID );
|
976 |
-
|
977 |
-
flagGallery::show_message( count($image_ids) . __(' Image(s) successfully added','flash-album-gallery'));
|
978 |
-
}
|
979 |
-
|
980 |
-
return;
|
981 |
-
|
982 |
-
} // end function
|
983 |
-
|
984 |
-
/**
|
985 |
-
* Upload function will be called via the Flash uploader
|
986 |
-
*
|
987 |
-
* @class flagAdmin
|
988 |
-
* @param integer $galleryID
|
989 |
-
* @return string $result
|
990 |
-
*/
|
991 |
-
static function swfupload_image($galleryID = 0) {
|
992 |
-
|
993 |
-
global $wpdb, $flag;
|
994 |
-
|
995 |
-
if ($galleryID == 0) {
|
996 |
-
//@unlink($temp_file);
|
997 |
-
return __('No gallery selected!','flash-album-gallery');
|
998 |
-
}
|
999 |
-
|
1000 |
-
// WPMU action
|
1001 |
-
if (flagAdmin::check_quota())
|
1002 |
-
return '0';
|
1003 |
-
|
1004 |
-
// Check the upload
|
1005 |
-
if (!isset($_FILES['file']) || !is_uploaded_file($_FILES["file"]["tmp_name"]) || $_FILES["file"]["error"]
|
1006 |
-
flagAdmin::file_upload_error_message($_FILES['file']['error']);
|
1007 |
-
|
1008 |
-
|
1009 |
-
|
1010 |
-
|
1011 |
-
|
1012 |
-
$
|
1013 |
-
|
1014 |
-
|
1015 |
-
|
1016 |
-
|
1017 |
-
|
1018 |
-
|
1019 |
-
|
1020 |
-
|
1021 |
-
|
1022 |
-
|
1023 |
-
|
1024 |
-
|
1025 |
-
|
1026 |
-
|
1027 |
-
|
1028 |
-
|
1029 |
-
|
1030 |
-
|
1031 |
-
|
1032 |
-
|
1033 |
-
|
1034 |
-
|
1035 |
-
|
1036 |
-
|
1037 |
-
|
1038 |
-
|
1039 |
-
|
1040 |
-
|
1041 |
-
|
1042 |
-
|
1043 |
-
|
1044 |
-
|
1045 |
-
|
1046 |
-
|
1047 |
-
|
1048 |
-
|
1049 |
-
|
1050 |
-
|
1051 |
-
|
1052 |
-
$
|
1053 |
-
|
1054 |
-
|
1055 |
-
|
1056 |
-
|
1057 |
-
|
1058 |
-
|
1059 |
-
|
1060 |
-
|
1061 |
-
|
1062 |
-
|
1063 |
-
|
1064 |
-
|
1065 |
-
|
1066 |
-
|
1067 |
-
|
1068 |
-
|
1069 |
-
|
1070 |
-
$editor->
|
1071 |
-
$editor->
|
1072 |
-
|
1073 |
-
|
1074 |
-
|
1075 |
-
|
1076 |
-
|
1077 |
-
$
|
1078 |
-
|
1079 |
-
|
1080 |
-
|
1081 |
-
|
1082 |
-
$flag->options['
|
1083 |
-
|
1084 |
-
|
1085 |
-
|
1086 |
-
|
1087 |
-
|
1088 |
-
|
1089 |
-
if
|
1090 |
-
|
1091 |
-
|
1092 |
-
|
1093 |
-
|
1094 |
-
|
1095 |
-
|
1096 |
-
|
1097 |
-
|
1098 |
-
*
|
1099 |
-
*
|
1100 |
-
* @
|
1101 |
-
* @
|
1102 |
-
|
1103 |
-
|
1104 |
-
|
1105 |
-
|
1106 |
-
|
1107 |
-
|
1108 |
-
|
1109 |
-
|
1110 |
-
|
1111 |
-
|
1112 |
-
|
1113 |
-
|
1114 |
-
|
1115 |
-
|
1116 |
-
|
1117 |
-
|
1118 |
-
|
1119 |
-
|
1120 |
-
|
1121 |
-
|
1122 |
-
|
1123 |
-
|
1124 |
-
|
1125 |
-
|
1126 |
-
*
|
1127 |
-
*
|
1128 |
-
* @
|
1129 |
-
|
1130 |
-
|
1131 |
-
|
1132 |
-
|
1133 |
-
|
1134 |
-
|
1135 |
-
|
1136 |
-
|
1137 |
-
|
1138 |
-
|
1139 |
-
|
1140 |
-
|
1141 |
-
|
1142 |
-
*
|
1143 |
-
*
|
1144 |
-
* @
|
1145 |
-
* @
|
1146 |
-
|
1147 |
-
|
1148 |
-
|
1149 |
-
|
1150 |
-
$
|
1151 |
-
$perms = $
|
1152 |
-
|
1153 |
-
|
1154 |
-
|
1155 |
-
|
1156 |
-
|
1157 |
-
|
1158 |
-
|
1159 |
-
|
1160 |
-
*
|
1161 |
-
*
|
1162 |
-
*
|
1163 |
-
* @
|
1164 |
-
* @
|
1165 |
-
|
1166 |
-
|
1167 |
-
|
1168 |
-
|
1169 |
-
|
1170 |
-
|
1171 |
-
|
1172 |
-
$
|
1173 |
-
|
1174 |
-
|
1175 |
-
|
1176 |
-
$message
|
1177 |
-
|
1178 |
-
|
1179 |
-
|
1180 |
-
|
1181 |
-
|
1182 |
-
|
1183 |
-
|
1184 |
-
|
1185 |
-
|
1186 |
-
|
1187 |
-
*
|
1188 |
-
*
|
1189 |
-
* @
|
1190 |
-
* @
|
1191 |
-
|
1192 |
-
|
1193 |
-
|
1194 |
-
|
1195 |
-
|
1196 |
-
|
1197 |
-
|
1198 |
-
|
1199 |
-
|
1200 |
-
|
1201 |
-
|
1202 |
-
|
1203 |
-
|
1204 |
-
|
1205 |
-
|
1206 |
-
|
1207 |
-
|
1208 |
-
*
|
1209 |
-
*
|
1210 |
-
* @param int $
|
1211 |
-
* @
|
1212 |
-
|
1213 |
-
|
1214 |
-
|
1215 |
-
|
1216 |
-
$
|
1217 |
-
|
1218 |
-
|
1219 |
-
|
1220 |
-
|
1221 |
-
|
1222 |
-
|
1223 |
-
$
|
1224 |
-
|
1225 |
-
|
1226 |
-
|
1227 |
-
|
1228 |
-
|
1229 |
-
|
1230 |
-
|
1231 |
-
|
1232 |
-
|
1233 |
-
|
1234 |
-
|
1235 |
-
|
1236 |
-
|
1237 |
-
|
1238 |
-
|
1239 |
-
|
1240 |
-
|
1241 |
-
|
1242 |
-
|
1243 |
-
$
|
1244 |
-
|
1245 |
-
|
1246 |
-
|
1247 |
-
|
1248 |
-
|
1249 |
-
$
|
1250 |
-
|
1251 |
-
|
1252 |
-
|
1253 |
-
$
|
1254 |
-
|
1255 |
-
|
1256 |
-
|
1257 |
-
|
1258 |
-
|
1259 |
-
|
1260 |
-
|
1261 |
-
|
1262 |
-
|
1263 |
-
|
1264 |
-
|
1265 |
-
|
1266 |
-
|
1267 |
-
|
1268 |
-
|
1269 |
-
|
1270 |
-
|
1271 |
-
|
1272 |
-
|
1273 |
-
|
1274 |
-
|
1275 |
-
$
|
1276 |
-
|
1277 |
-
|
1278 |
-
|
1279 |
-
|
1280 |
-
|
1281 |
-
|
1282 |
-
|
1283 |
-
*
|
1284 |
-
*
|
1285 |
-
* @
|
1286 |
-
* @param int $
|
1287 |
-
* @
|
1288 |
-
|
1289 |
-
|
1290 |
-
|
1291 |
-
|
1292 |
-
|
1293 |
-
|
1294 |
-
|
1295 |
-
|
1296 |
-
|
1297 |
-
|
1298 |
-
|
1299 |
-
|
1300 |
-
|
1301 |
-
|
1302 |
-
|
1303 |
-
|
1304 |
-
|
1305 |
-
|
1306 |
-
|
1307 |
-
|
1308 |
-
|
1309 |
-
|
1310 |
-
|
1311 |
-
|
1312 |
-
$
|
1313 |
-
|
1314 |
-
|
1315 |
-
|
1316 |
-
|
1317 |
-
|
1318 |
-
|
1319 |
-
|
1320 |
-
$
|
1321 |
-
$
|
1322 |
-
|
1323 |
-
|
1324 |
-
$
|
1325 |
-
|
1326 |
-
|
1327 |
-
|
1328 |
-
$
|
1329 |
-
|
1330 |
-
|
1331 |
-
|
1332 |
-
|
1333 |
-
|
1334 |
-
|
1335 |
-
|
1336 |
-
|
1337 |
-
|
1338 |
-
|
1339 |
-
|
1340 |
-
|
1341 |
-
|
1342 |
-
|
1343 |
-
|
1344 |
-
|
1345 |
-
|
1346 |
-
|
1347 |
-
|
1348 |
-
|
1349 |
-
|
1350 |
-
|
1351 |
-
|
1352 |
-
|
1353 |
-
|
1354 |
-
|
1355 |
-
|
1356 |
-
|
1357 |
-
|
1358 |
-
|
1359 |
-
|
1360 |
-
|
1361 |
-
$
|
1362 |
-
|
1363 |
-
|
1364 |
-
|
1365 |
-
|
1366 |
-
|
1367 |
-
|
1368 |
-
|
1369 |
-
|
1370 |
-
|
1371 |
-
|
1372 |
-
|
1373 |
-
|
1374 |
-
|
1375 |
-
*
|
1376 |
-
*
|
1377 |
-
* @
|
1378 |
-
* @param
|
1379 |
-
* @param
|
1380 |
-
* @
|
1381 |
-
|
1382 |
-
|
1383 |
-
|
1384 |
-
|
1385 |
-
|
1386 |
-
|
1387 |
-
|
1388 |
-
|
1389 |
-
|
1390 |
-
|
1391 |
-
|
1392 |
-
|
1393 |
-
|
1394 |
-
|
1395 |
-
|
1396 |
-
|
1397 |
-
|
1398 |
-
|
1399 |
-
|
1400 |
-
|
1401 |
-
|
1402 |
-
|
1403 |
-
|
1404 |
-
|
1405 |
-
|
1406 |
-
|
1407 |
-
|
1408 |
-
|
1409 |
-
|
1410 |
-
|
1411 |
-
|
1412 |
-
|
1413 |
-
|
1414 |
-
|
1415 |
-
*
|
1416 |
-
*
|
1417 |
-
* @
|
1418 |
-
* @
|
1419 |
-
|
1420 |
-
|
1421 |
-
|
1422 |
-
|
1423 |
-
|
1424 |
-
$
|
1425 |
-
|
1426 |
-
|
1427 |
-
|
1428 |
-
|
1429 |
-
|
1430 |
-
|
1431 |
-
|
1432 |
-
|
1433 |
-
|
1434 |
-
|
1435 |
-
|
1436 |
-
|
1437 |
-
|
1438 |
-
|
1439 |
-
|
1440 |
-
*
|
1441 |
-
*
|
1442 |
-
* @
|
1443 |
-
|
1444 |
-
|
1445 |
-
|
1446 |
-
|
1447 |
-
|
1448 |
-
|
1449 |
-
|
1450 |
-
|
1451 |
-
|
1452 |
-
|
1453 |
-
|
1454 |
-
|
1455 |
-
|
1456 |
-
|
1457 |
-
|
1458 |
-
}
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
if(preg_match('#' . basename(__FILE__) . '#', $_SERVER['PHP_SELF'])) { die('You are not allowed to call this page directly.'); }
|
4 |
+
|
5 |
+
/**
|
6 |
+
* flagAdmin - Class for admin operation
|
7 |
+
*/
|
8 |
+
if ( ! class_exists( 'flagAdmin' ) ) {
|
9 |
+
class flagAdmin{
|
10 |
+
|
11 |
+
/**
|
12 |
+
* create a new gallery & folder
|
13 |
+
*
|
14 |
+
* @class flagAdmin
|
15 |
+
* @param string $gallery
|
16 |
+
* @param string $defaultpath
|
17 |
+
* @param bool $output if the function should show an error messsage or not
|
18 |
+
* @return bool|int
|
19 |
+
*/
|
20 |
+
public static function create_gallery($gallery, $defaultpath, $output = true) {
|
21 |
+
global $wpdb, $user_ID;
|
22 |
+
|
23 |
+
// get the current user ID
|
24 |
+
wp_get_current_user();
|
25 |
+
|
26 |
+
$description = '';
|
27 |
+
$status = 0;
|
28 |
+
if(is_array($gallery)){
|
29 |
+
$gallerytitle = $gallery['title'];
|
30 |
+
$description = $gallery['description'];
|
31 |
+
$status = intval($gallery['status']);
|
32 |
+
} else {
|
33 |
+
$gallerytitle = $gallery;
|
34 |
+
}
|
35 |
+
//cleanup pathname
|
36 |
+
$galleryname = sanitize_flagname( $gallerytitle );
|
37 |
+
$galleryname = apply_filters('flag_gallery_name', $galleryname);
|
38 |
+
$galleryname = preg_replace('/[^\w\._-]+/', '', $galleryname);
|
39 |
+
if(!$galleryname) $galleryname = date('y-m-j_h-i-s');
|
40 |
+
|
41 |
+
$flagpath = $defaultpath . $galleryname;
|
42 |
+
$flagpath = trim($flagpath, '/');
|
43 |
+
$flagRoot = WINABSPATH . $defaultpath;
|
44 |
+
$txt = '';
|
45 |
+
|
46 |
+
// No gallery name ?
|
47 |
+
if (empty($galleryname)) {
|
48 |
+
if ($output) flagGallery::show_error( __('No valid gallery name!', 'flash-album-gallery') );
|
49 |
+
return false;
|
50 |
+
}
|
51 |
+
|
52 |
+
// check for main folder
|
53 |
+
if ( !is_dir($flagRoot) ) {
|
54 |
+
if ( !wp_mkdir_p( $flagRoot ) ) {
|
55 |
+
$txt = __('Directory', 'flash-album-gallery').' <strong>' . $defaultpath . '</strong> '.__('didn\'t exist. Please create first the main gallery folder ', 'flash-album-gallery').'!<br />';
|
56 |
+
$txt .= __('Check this link, if you didn\'t know how to set the permission :', 'flash-album-gallery').' <a href="http://codex.wordpress.org/Changing_File_Permissions">http://codex.wordpress.org/Changing_File_Permissions</a> ';
|
57 |
+
if ($output) flagGallery::show_error($txt);
|
58 |
+
return false;
|
59 |
+
}
|
60 |
+
}
|
61 |
+
|
62 |
+
// check for permission settings, Safe mode limitations are not taken into account.
|
63 |
+
if ( !is_writeable( $flagRoot ) ) {
|
64 |
+
$txt = __('Directory', 'flash-album-gallery').' <strong>' . $defaultpath . '</strong> '.__('is not writeable !', 'flash-album-gallery').'<br />';
|
65 |
+
$txt .= __('Check this link, if you didn\'t know how to set the permission :', 'flash-album-gallery').' <a href="http://codex.wordpress.org/Changing_File_Permissions">http://codex.wordpress.org/Changing_File_Permissions</a> ';
|
66 |
+
if ($output) flagGallery::show_error($txt);
|
67 |
+
return false;
|
68 |
+
}
|
69 |
+
|
70 |
+
// 1. Create new gallery folder
|
71 |
+
if ( !is_dir(WINABSPATH . $flagpath) ) {
|
72 |
+
if ( !wp_mkdir_p (WINABSPATH . $flagpath) )
|
73 |
+
$txt = __('Unable to create directory ', 'flash-album-gallery').$flagpath.'!<br />';
|
74 |
+
}
|
75 |
+
|
76 |
+
// 2. Check folder permission
|
77 |
+
if ( !is_writeable(WINABSPATH . $flagpath ) )
|
78 |
+
$txt .= __('Directory', 'flash-album-gallery').' <strong>'.$flagpath.'</strong> '.__('is not writeable !', 'flash-album-gallery').'<br />';
|
79 |
+
|
80 |
+
// 3. Now create "thumbs" folder inside
|
81 |
+
if ( !is_dir(WINABSPATH . $flagpath . '/thumbs') ) {
|
82 |
+
if ( !wp_mkdir_p ( WINABSPATH . $flagpath . '/thumbs') )
|
83 |
+
$txt .= __('Unable to create directory ', 'flash-album-gallery').' <strong>' . $flagpath . '/thumbs !</strong>';
|
84 |
+
}
|
85 |
+
|
86 |
+
// 4. Now create "webview" folder inside
|
87 |
+
if ( !is_dir(WINABSPATH . $flagpath . '/webview') ) {
|
88 |
+
if ( !wp_mkdir_p ( WINABSPATH . $flagpath . '/webview') )
|
89 |
+
$txt .= __('Unable to create directory ', 'flash-album-gallery').' <strong>' . $flagpath . '/webview !</strong>';
|
90 |
+
}
|
91 |
+
|
92 |
+
if (FLAG_SAFE_MODE) {
|
93 |
+
$help = __('The server setting Safe-Mode is on !', 'flash-album-gallery');
|
94 |
+
$help .= '<br />'.__('If you have problems, please create directory', 'flash-album-gallery').' <strong>' . $flagpath . '</strong> ';
|
95 |
+
$help .= __('and the thumbnails directory', 'flash-album-gallery').' <strong>' . $flagpath . '/thumbs</strong> '.__('with permission 777 manually !', 'flash-album-gallery');
|
96 |
+
if ($output) flagGallery::show_message($help);
|
97 |
+
}
|
98 |
+
|
99 |
+
// show an error message
|
100 |
+
if ( !empty($txt) ) {
|
101 |
+
if (FLAG_SAFE_MODE) {
|
102 |
+
// for safe_mode , better delete folder, both folder must be created manually
|
103 |
+
@rmdir(WINABSPATH . $flagpath . '/thumbs');
|
104 |
+
@rmdir(WINABSPATH . $flagpath);
|
105 |
+
}
|
106 |
+
if ($output) flagGallery::show_error($txt);
|
107 |
+
return false;
|
108 |
+
}
|
109 |
+
|
110 |
+
$result = $wpdb->get_var($wpdb->prepare("SELECT `name` FROM `{$wpdb->flaggallery}` WHERE `name` = '%s' ", $galleryname));
|
111 |
+
|
112 |
+
if ($result) {
|
113 |
+
if ($output) flagGallery::show_error( _n( 'Gallery', 'Galleries', 1, 'flash-album-gallery' ) .' <strong>' . $galleryname . '</strong> '.__('already exists', 'flash-album-gallery'));
|
114 |
+
return true;
|
115 |
+
} else {
|
116 |
+
if(empty($user_ID)){
|
117 |
+
$user_ID = $wpdb->get_var("SELECT ID FROM $wpdb->users ORDER BY ID");
|
118 |
+
}
|
119 |
+
$result = $wpdb->query( $wpdb->prepare("INSERT INTO $wpdb->flaggallery (name, path, title, galdesc, author, status) VALUES (%s, %s, %s, %s, %s, %d)", $galleryname, $flagpath, $gallerytitle, $description, $user_ID, $status) );
|
120 |
+
// and give me the new id
|
121 |
+
$gallery_id = (int) $wpdb->insert_id;
|
122 |
+
// here you can inject a custom function
|
123 |
+
do_action('flag_created_new_gallery', $gallery_id);
|
124 |
+
|
125 |
+
if ($result) {
|
126 |
+
$message = __('Gallery \'%1$s\' successfully created.<br/>You can show this gallery with the tag %2$s.<br/>','flash-album-gallery');
|
127 |
+
$message = sprintf($message, esc_html(stripcslashes($gallerytitle)), '[flagallery gid=' . $gallery_id . ']');
|
128 |
+
$message .= '<a href="' . admin_url() . 'admin.php?page=flag-manage-gallery&mode=edit&gid=' . $gallery_id . '" >';
|
129 |
+
$message .= __('Edit gallery','flash-album-gallery');
|
130 |
+
$message .= '</a>';
|
131 |
+
|
132 |
+
if ($output) flagGallery::show_message($message);
|
133 |
+
}
|
134 |
+
// return only the id if defined
|
135 |
+
if ($gallery_id)
|
136 |
+
return $gallery_id;
|
137 |
+
|
138 |
+
return true;
|
139 |
+
}
|
140 |
+
}
|
141 |
+
|
142 |
+
/**
|
143 |
+
* flagAdmin::import_gallery()
|
144 |
+
* TODO: Check permission of existing thumb folder & images
|
145 |
+
*
|
146 |
+
* @class flagAdmin
|
147 |
+
* @param string $galleryfolder contains relative path
|
148 |
+
* @return void
|
149 |
+
*/
|
150 |
+
public static function import_gallery($galleryfolder) {
|
151 |
+
|
152 |
+
global $wpdb, $user_ID;
|
153 |
+
|
154 |
+
// get the current user ID
|
155 |
+
wp_get_current_user();
|
156 |
+
|
157 |
+
$created_msg = '';
|
158 |
+
|
159 |
+
// remove trailing slashes, if somebody use it
|
160 |
+
$galleryfolder = str_replace('../','', $galleryfolder );
|
161 |
+
$galleryfolder = trim($galleryfolder, '/');
|
162 |
+
$gallerypath = WINABSPATH . $galleryfolder;
|
163 |
+
|
164 |
+
if (!is_dir($gallerypath)) {
|
165 |
+
flagGallery::show_error(__('Directory', 'flash-album-gallery').' <strong>'.esc_html($gallerypath).'</strong> '.__('doesn`t exist!', 'flash-album-gallery').' '.__('Or imported folder name contains special characters.', 'flash-album-gallery'));
|
166 |
+
return ;
|
167 |
+
}
|
168 |
+
|
169 |
+
// read list of images
|
170 |
+
$new_imageslist = flagAdmin::scandir($gallerypath);
|
171 |
+
if (empty($new_imageslist)) {
|
172 |
+
flagGallery::show_message(__('Directory', 'flash-album-gallery').' <strong>'.esc_html($gallerypath).'</strong> '.__('contains no pictures', 'flash-album-gallery'));
|
173 |
+
return;
|
174 |
+
}
|
175 |
+
|
176 |
+
// check & create thumbnail folder
|
177 |
+
if ( !flagGallery::create_thumbnail_folder($gallerypath) )
|
178 |
+
return;
|
179 |
+
|
180 |
+
// take folder name as gallery name
|
181 |
+
$galleryname = basename($galleryfolder);
|
182 |
+
|
183 |
+
// check for existing gallery folder
|
184 |
+
$gallery_id = $wpdb->get_var($wpdb->prepare("SELECT gid FROM {$wpdb->flaggallery} WHERE path = '%s' ", $galleryfolder));
|
185 |
+
|
186 |
+
if (!$gallery_id) {
|
187 |
+
$result = $wpdb->query( $wpdb->prepare("INSERT INTO {$wpdb->flaggallery} (name, path, title, author) VALUES (%s, %s, %s, %s)", $galleryname, $galleryfolder, $galleryname , $user_ID) );
|
188 |
+
if (!$result) {
|
189 |
+
flagGallery::show_error(__('Database error. Could not add gallery!','flash-album-gallery'));
|
190 |
+
return;
|
191 |
+
}
|
192 |
+
$created_msg = _n( 'Gallery', 'Galleries', 1, 'flash-album-gallery' ) . ' <strong>' . $galleryname . '</strong> ' . __('successfully created!','flash-album-gallery') . '<br />';
|
193 |
+
$gallery_id = $wpdb->insert_id; // get index_id
|
194 |
+
}
|
195 |
+
|
196 |
+
// Look for existing image list
|
197 |
+
$old_imageslist = $wpdb->get_col($wpdb->prepare("SELECT filename FROM {$wpdb->flagpictures} WHERE galleryid = %d ", $gallery_id));
|
198 |
+
|
199 |
+
// if no images are there, create empty array
|
200 |
+
if ($old_imageslist == NULL)
|
201 |
+
$old_imageslist = array();
|
202 |
+
|
203 |
+
// check difference
|
204 |
+
$new_images = array_diff($new_imageslist, $old_imageslist);
|
205 |
+
|
206 |
+
// all images must be valid files
|
207 |
+
foreach($new_images as $key => $picture) {
|
208 |
+
if (!@getimagesize($gallerypath . '/' . $picture) ) {
|
209 |
+
unset($new_images[$key]);
|
210 |
+
@unlink($gallerypath . '/' . $picture);
|
211 |
+
}
|
212 |
+
}
|
213 |
+
|
214 |
+
// add images to database
|
215 |
+
$image_ids = flagAdmin::add_Images($gallery_id, $new_images);
|
216 |
+
|
217 |
+
//add the preview image if needed
|
218 |
+
flagAdmin::set_gallery_preview ( $gallery_id );
|
219 |
+
|
220 |
+
// now create thumbnails
|
221 |
+
flagAdmin::do_ajax_operation( 'create_thumbnail' , $image_ids, __('Create new thumbnails','flash-album-gallery') );
|
222 |
+
|
223 |
+
//TODO:Message will not shown, because AJAX routine require more time, message should be passed to AJAX
|
224 |
+
flagGallery::show_message( $created_msg . count($image_ids) .__(' picture(s) successfully added','flash-album-gallery') );
|
225 |
+
|
226 |
+
return;
|
227 |
+
|
228 |
+
}
|
229 |
+
|
230 |
+
/**
|
231 |
+
* flagAdmin::import_video()
|
232 |
+
*
|
233 |
+
* @class flagAdmin
|
234 |
+
* @param string $folder contains relative path
|
235 |
+
* @return void
|
236 |
+
*/
|
237 |
+
public static function import_video($folder) {
|
238 |
+
|
239 |
+
|
240 |
+
$created_msg = '';
|
241 |
+
// remove trailing slash at the end, if somebody use it
|
242 |
+
$folder = str_replace(array('../','\'','"','<','>','$','%','='),'', $folder);
|
243 |
+
$folder = rtrim($folder, '/');
|
244 |
+
$path = WINABSPATH . $folder;
|
245 |
+
if (!is_dir($path)) {
|
246 |
+
echo '<p class="message">'.__('Directory', 'flash-album-gallery').' <strong>'.$path.'</strong> '.__('doesn`t exist!', 'flash-album-gallery').' '.__('Or imported folder name contains special characters.', 'flash-album-gallery').'</p>';
|
247 |
+
return ;
|
248 |
+
}
|
249 |
+
// read list of files
|
250 |
+
$ext = array('mp4','ogg','webm','flv');
|
251 |
+
$new_filelist = flagAdmin::scandir($path, $ext);
|
252 |
+
if (empty($new_filelist)) {
|
253 |
+
echo '<p class="message">'.__('Directory', 'flash-album-gallery').' <strong>'.$path.'</strong> '.__('does not contain video files', 'flash-album-gallery').'</p>';
|
254 |
+
return;
|
255 |
+
}
|
256 |
+
$i=0;
|
257 |
+
foreach($new_filelist as $key => $file) {
|
258 |
+
//$new_filelist[$key] = $path . '/' . $file;
|
259 |
+
$filename = $path . '/' . $file;
|
260 |
+
$id = flagAdmin::handle_import_file($filename);
|
261 |
+
if ( is_wp_error($id) ) {
|
262 |
+
$created_msg .= '<p>' . sprintf(__('<em>%s</em> was <strong>not</strong> imported due to an error: %s', 'flash-album-gallery'), $file, $id->get_error_message() ) . '</p>';
|
263 |
+
} else {
|
264 |
+
$i++;
|
265 |
+
$created_msg .= '<p>' . sprintf(__('<em>%s</em> has been added to Media library', 'flash-album-gallery'), $file) . '</p>';
|
266 |
+
}
|
267 |
+
}
|
268 |
+
$created_msg .= '<p class="message">'.$i.__(' file(s) successfully added','flash-album-gallery').'</p><div class="hidden">'.$created_msg.'</div>';
|
269 |
+
echo $created_msg;
|
270 |
+
}
|
271 |
+
|
272 |
+
/**
|
273 |
+
* flagAdmin::import_mp3()
|
274 |
+
*
|
275 |
+
* @class flagAdmin
|
276 |
+
* @param string $folder contains relative path
|
277 |
+
* @return void
|
278 |
+
*/
|
279 |
+
public static function import_mp3($folder) {
|
280 |
+
|
281 |
+
$created_msg = '';
|
282 |
+
// remove trailing slash at the end, if somebody use it
|
283 |
+
$folder = str_replace(array('../','\'','"','<','>','$','%','='),'', $folder);
|
284 |
+
$folder = rtrim($folder, '/');
|
285 |
+
$path = WINABSPATH . $folder;
|
286 |
+
if (!is_dir($path)) {
|
287 |
+
echo '<p class="message">'.__('Directory', 'flash-album-gallery').' <strong>'.$path.'</strong> '.__('doesn`t exist!', 'flash-album-gallery').' '.__('Or imported folder name contains special characters.', 'flash-album-gallery').'</p>';
|
288 |
+
return ;
|
289 |
+
}
|
290 |
+
// read list of files
|
291 |
+
$ext = array('mp3', 'ogg', 'wav');
|
292 |
+
$new_filelist = flagAdmin::scandir($path, $ext);
|
293 |
+
if (empty($new_filelist)) {
|
294 |
+
echo '<p class="message">'.__('Directory', 'flash-album-gallery').' <strong>'.$path.'</strong> '.__('does not contain audio files', 'flash-album-gallery').'</p>';
|
295 |
+
return;
|
296 |
+
}
|
297 |
+
$i=0;
|
298 |
+
foreach($new_filelist as $key => $file) {
|
299 |
+
//$new_filelist[$key] = $path . '/' . $file;
|
300 |
+
$filename = $path . '/' . $file;
|
301 |
+
$id = flagAdmin::handle_import_file($filename);
|
302 |
+
if ( is_wp_error($id) ) {
|
303 |
+
$created_msg .= '<p>' . sprintf(__('<em>%s</em> was <strong>not</strong> imported due to an error: %s', 'flash-album-gallery'), $file, $id->get_error_message() ) . '</p>';
|
304 |
+
} else {
|
305 |
+
$i++;
|
306 |
+
$created_msg .= '<p>' . sprintf(__('<em>%s</em> has been added to Media library', 'flash-album-gallery'), $file) . '</p>';
|
307 |
+
}
|
308 |
+
}
|
309 |
+
$created_msg .= '<p class="message">'.$i.__(' file(s) successfully added','flash-album-gallery').'</p><div class="hidden">'.$created_msg.'</div>';
|
310 |
+
echo $created_msg;
|
311 |
+
}
|
312 |
+
|
313 |
+
/**
|
314 |
+
* flagAdmin::import_banner()
|
315 |
+
*
|
316 |
+
* @class flagAdmin
|
317 |
+
* @param string $folder contains relative path
|
318 |
+
* @return array
|
319 |
+
*/
|
320 |
+
public static function import_banner($folder) {
|
321 |
+
|
322 |
+
$created_msg = '';
|
323 |
+
// remove trailing slash at the end, if somebody use it
|
324 |
+
$folder = str_replace(array('../','\'','"','<','>','$','%','='),'', $folder);
|
325 |
+
$folder = rtrim($folder, '/');
|
326 |
+
$path = WINABSPATH . $folder;
|
327 |
+
if (!is_dir($path)) {
|
328 |
+
echo '<p class="message">'.__('Directory', 'flash-album-gallery').' <strong>'.$path.'</strong> '.__('doesn`t exist!', 'flash-album-gallery').' '.__('Or imported folder name contains special characters.', 'flash-album-gallery').'</p>';
|
329 |
+
return false;
|
330 |
+
}
|
331 |
+
// read list of files
|
332 |
+
$new_filelist = flagAdmin::scandir($path);
|
333 |
+
if (empty($new_filelist)) {
|
334 |
+
echo '<p class="message">'.__('Directory', 'flash-album-gallery').' <strong>'.$path.'</strong> '.__('does not contain image files', 'flash-album-gallery').'</p>';
|
335 |
+
return false;
|
336 |
+
}
|
337 |
+
$created_msg .= '<div class="message"><p>'.count($new_filelist).' '.__('image(s) in the folder','flash-album-gallery').':</p><div class="flag_crunching"><div class="flag_progress"><span class="flag_complete"></span><span class="txt">'.__('Crunching...','flash-album-gallery').'</span></div></div></div>';
|
338 |
+
echo $created_msg;
|
339 |
+
return $new_filelist;
|
340 |
+
}
|
341 |
+
|
342 |
+
//Handle an individual file import.
|
343 |
+
public static function handle_import_file($file, $post_id = 0) {
|
344 |
+
set_time_limit(120);
|
345 |
+
$time = current_time('mysql');
|
346 |
+
if ( $post = get_post($post_id) ) {
|
347 |
+
if ( substr( $post->post_date, 0, 4 ) > 0 )
|
348 |
+
$time = $post->post_date;
|
349 |
+
}
|
350 |
+
|
351 |
+
// A writable uploads dir will pass this test. Again, there's no point overriding this one.
|
352 |
+
if ( ! ( ( $uploads = wp_upload_dir($time) ) && false === $uploads['error'] ) )
|
353 |
+
return new WP_Error($uploads['error']);
|
354 |
+
|
355 |
+
$wp_filetype = wp_check_filetype( $file, null );
|
356 |
+
|
357 |
+
/** @var $type
|
358 |
+
* @var $ext */
|
359 |
+
extract( $wp_filetype );
|
360 |
+
|
361 |
+
if ( ( !$type || !$ext ) && !current_user_can( 'unfiltered_upload' ) )
|
362 |
+
return new WP_Error('wrong_file_type', __( 'File type does not meet security guidelines. Try another.' ) ); //A WP-core string..
|
363 |
+
|
364 |
+
$match = preg_match('|^' . preg_quote(str_replace('\\', '/', $uploads['basedir'])) . '(.*)$|i', $file, $mat);
|
365 |
+
//Is the file allready in the uploads folder?
|
366 |
+
if( $match ) {
|
367 |
+
|
368 |
+
$filename = basename($file);
|
369 |
+
$new_file = $file;
|
370 |
+
|
371 |
+
$url = $uploads['baseurl'] . $mat[1];
|
372 |
+
|
373 |
+
$attachment = get_posts(array( 'post_type' => 'attachment', 'meta_key' => '_wp_attached_file', 'meta_value' => $uploads['subdir'] . '/' . $filename ));
|
374 |
+
if ( !empty($attachment) )
|
375 |
+
return $attachment[0]->ID;
|
376 |
+
|
377 |
+
//Ok, Its in the uploads folder, But NOT in WordPress's media library.
|
378 |
+
if ( preg_match("|(\d+)/(\d+)|", $mat[1], $datemat) ) //So lets set the date of the import to the date folder its in, IF its in a date folder.
|
379 |
+
$time = mktime(0, 0, 0, $datemat[2], 1, $datemat[1]);
|
380 |
+
else //Else, set the date based on the date of the files time.
|
381 |
+
$time = @filemtime($file);
|
382 |
+
|
383 |
+
if ( $time ) {
|
384 |
+
$post_date = date( 'Y-m-d H:i:s', $time);
|
385 |
+
$post_date_gmt = gmdate( 'Y-m-d H:i:s', $time);
|
386 |
+
}
|
387 |
+
} else {
|
388 |
+
$filename = wp_unique_filename( $uploads['path'], basename($file));
|
389 |
+
|
390 |
+
// copy the file to the uploads dir
|
391 |
+
$new_file = $uploads['path'] . '/' . $filename;
|
392 |
+
if ( false === @copy( $file, $new_file ) ){
|
393 |
+
wp_die(sprintf(__('The selected file could not be copied to %s.', 'flash-album-gallery'), $uploads['path']));
|
394 |
+
}
|
395 |
+
|
396 |
+
// Set correct file permissions
|
397 |
+
$stat = stat( dirname( $new_file ));
|
398 |
+
$perms = $stat['mode'] & 0000666;
|
399 |
+
@ chmod( $new_file, $perms );
|
400 |
+
// Compute the URL
|
401 |
+
$url = $uploads['url'] . '/' . rawurlencode($filename);
|
402 |
+
}
|
403 |
+
|
404 |
+
// Compute the URL
|
405 |
+
//Apply upload filters
|
406 |
+
$return = apply_filters( 'wp_handle_upload', array( 'file' => $new_file, 'url' => $url, 'type' => $type ) );
|
407 |
+
$new_file = $return['file'];
|
408 |
+
$url = $return['url'];
|
409 |
+
$type = $return['type'];
|
410 |
+
|
411 |
+
$title = preg_replace('!\.[^.]+$!', '', basename($file));
|
412 |
+
$content = '';
|
413 |
+
|
414 |
+
// use image exif/iptc data for title and caption defaults if possible
|
415 |
+
if ( $image_meta = @wp_read_image_metadata($new_file) ) {
|
416 |
+
if ( '' != trim($image_meta['title']) )
|
417 |
+
$title = trim($image_meta['title']);
|
418 |
+
if ( '' != trim($image_meta['caption']) )
|
419 |
+
$content = trim($image_meta['caption']);
|
420 |
+
}
|
421 |
+
|
422 |
+
if ( empty($post_date) )
|
423 |
+
$post_date = current_time('mysql');
|
424 |
+
if ( empty($post_date_gmt) )
|
425 |
+
$post_date_gmt = current_time('mysql', 1);
|
426 |
+
|
427 |
+
// Construct the attachment array
|
428 |
+
$attachment = array(
|
429 |
+
'post_mime_type' => $type,
|
430 |
+
'guid' => $url,
|
431 |
+
'post_parent' => $post_id,
|
432 |
+
'post_title' => $title,
|
433 |
+
'post_name' => $title,
|
434 |
+
'post_content' => $content,
|
435 |
+
'post_date' => $post_date,
|
436 |
+
'post_date_gmt' => $post_date_gmt
|
437 |
+
);
|
438 |
+
|
439 |
+
// Save the data
|
440 |
+
$id = wp_insert_attachment($attachment, $new_file, $post_id);
|
441 |
+
if ( !is_wp_error($id) ) {
|
442 |
+
$data = wp_generate_attachment_metadata( $id, $new_file );
|
443 |
+
wp_update_attachment_metadata( $id, $data );
|
444 |
+
if( !$match && isset($_POST['delete_files']) ) {
|
445 |
+
@unlink($file);
|
446 |
+
}
|
447 |
+
}
|
448 |
+
|
449 |
+
return $id;
|
450 |
+
}
|
451 |
+
|
452 |
+
/**
|
453 |
+
* flagAdmin::scandir()
|
454 |
+
*
|
455 |
+
* @class flagAdmin
|
456 |
+
* @param string $dirname
|
457 |
+
* @param array $ext
|
458 |
+
* @return array
|
459 |
+
*/
|
460 |
+
public static function scandir($dirname = '.', $ext = array()) {
|
461 |
+
// thx to php.net :-)
|
462 |
+
if(empty($ext))
|
463 |
+
$ext = array('jpeg', 'jpg', 'png', 'gif');
|
464 |
+
$files = array();
|
465 |
+
if($handle = opendir($dirname)) {
|
466 |
+
while(false !== ($file = readdir($handle)))
|
467 |
+
for($i=0;$i<sizeof($ext);$i++)
|
468 |
+
if(stristr($file, '.' . $ext[$i]))
|
469 |
+
$files[] = utf8_encode($file);
|
470 |
+
closedir($handle);
|
471 |
+
}
|
472 |
+
sort($files);
|
473 |
+
return ($files);
|
474 |
+
}
|
475 |
+
|
476 |
+
/**
|
477 |
+
* flagAdmin::createThumbnail() - function to create or recreate a thumbnail
|
478 |
+
*
|
479 |
+
* @param object | int $image contain all information about the image or the id
|
480 |
+
* @return string result code
|
481 |
+
*/
|
482 |
+
public static function create_thumbnail($image) {
|
483 |
+
|
484 |
+
global $flag;
|
485 |
+
|
486 |
+
if ( is_numeric($image) )
|
487 |
+
$image = flagdb::find_image( $image );
|
488 |
+
|
489 |
+
if ( !is_object($image) )
|
490 |
+
return __('Object didn\'t contain correct data','flash-album-gallery');
|
491 |
+
|
492 |
+
$dest_path = dirname($image->webimagePath);
|
493 |
+
if(!is_dir($dest_path)){
|
494 |
+
flagGallery::create_webview_folder(dirname($image->imagePath));
|
495 |
+
@chmod( $dest_path, 0755 );
|
496 |
+
}
|
497 |
+
|
498 |
+
if(! class_exists('flag_Thumbnail'))
|
499 |
+
require_once( flagGallery::graphic_library() );
|
500 |
+
|
501 |
+
// check for existing thumbnail
|
502 |
+
if (file_exists($image->thumbPath))
|
503 |
+
if (!is_writable($image->thumbPath))
|
504 |
+
return $image->filename . __(' is not writeable ','flash-album-gallery');
|
505 |
+
|
506 |
+
$thumb = new flag_Thumbnail($image->imagePath, TRUE);
|
507 |
+
$img_size = @getimagesize ( $image->imagePath );
|
508 |
+
|
509 |
+
// skip if file is not there
|
510 |
+
if (!$thumb->error) {
|
511 |
+
$thumb->resize($flag->options['thumbWidth'],$flag->options['thumbHeight']);
|
512 |
+
|
513 |
+
// save the new thumbnail
|
514 |
+
$thumb->save($image->thumbPath, $flag->options['thumbQuality']);
|
515 |
+
flagAdmin::chmod ($image->thumbPath);
|
516 |
+
|
517 |
+
//read the new sizes
|
518 |
+
$new_size = @getimagesize ( $image->thumbPath );
|
519 |
+
$size['width'] = $new_size[0];
|
520 |
+
$size['height'] = $new_size[1];
|
521 |
+
|
522 |
+
// add them to the database
|
523 |
+
flagdb::update_image_meta($image->pid, array( 'thumbnail' => $size) );
|
524 |
+
}
|
525 |
+
|
526 |
+
$thumb->destruct();
|
527 |
+
|
528 |
+
if ( !empty($thumb->errmsg) )
|
529 |
+
return $image->filename . ' (Error : '.$thumb->errmsg .')';
|
530 |
+
|
531 |
+
do_action('flag_thumbnail_created', $image);
|
532 |
+
|
533 |
+
flagAdmin::webview_image($image);
|
534 |
+
|
535 |
+
// success
|
536 |
+
return '1';
|
537 |
+
}
|
538 |
+
|
539 |
+
/**
|
540 |
+
* flagAdmin::resize_image() - create a new image, based on the height /width
|
541 |
+
*
|
542 |
+
* @class flagAdmin
|
543 |
+
* @param object | int $image contain all information about the image or the id
|
544 |
+
* @param integer $width optional
|
545 |
+
* @param integer $height optional
|
546 |
+
* @return string result code
|
547 |
+
*/
|
548 |
+
public static function resize_image($image, $width = 0, $height = 0) {
|
549 |
+
|
550 |
+
global $flag;
|
551 |
+
|
552 |
+
if(! class_exists('flag_Thumbnail'))
|
553 |
+
require_once( flagGallery::graphic_library() );
|
554 |
+
|
555 |
+
if ( is_numeric($image) )
|
556 |
+
$image = flagdb::find_image( $image );
|
557 |
+
|
558 |
+
if ( !is_object($image) )
|
559 |
+
return __('Object didn\'t contain correct data','flash-album-gallery');
|
560 |
+
|
561 |
+
// before we start we import the meta data to database (required for uploads before V0.40)
|
562 |
+
flagAdmin::maybe_import_meta( $image->pid );
|
563 |
+
|
564 |
+
// if no parameter is set, take global settings
|
565 |
+
$width = ($width == 0) ? $flag->options['imgWidth'] : $width;
|
566 |
+
$height = ($height == 0) ? $flag->options['imgHeight'] : $height;
|
567 |
+
|
568 |
+
if (!is_writable($image->imagePath))
|
569 |
+
return ' <strong>' . $image->filename . __(' is not writeable','flash-album-gallery') . '</strong>';
|
570 |
+
|
571 |
+
$file = new flag_Thumbnail($image->imagePath, TRUE);
|
572 |
+
|
573 |
+
// skip if file is not there
|
574 |
+
if (!$file->error) {
|
575 |
+
$file->resize($width, $height, 4);
|
576 |
+
$file->save($image->imagePath, $flag->options['imgQuality']);
|
577 |
+
// read the new sizes
|
578 |
+
$size = @getimagesize ( $image->imagePath );
|
579 |
+
// add them to the database
|
580 |
+
flagdb::update_image_meta($image->pid, array( 'width' => $size[0], 'height' => $size[1] ) );
|
581 |
+
$file->destruct();
|
582 |
+
} else {
|
583 |
+
$file->destruct();
|
584 |
+
return ' <strong>' . $image->filename . ' (Error : ' . $file->errmsg . ')</strong>';
|
585 |
+
}
|
586 |
+
|
587 |
+
do_action('flag_image_resized', $image);
|
588 |
+
|
589 |
+
return '1';
|
590 |
+
}
|
591 |
+
|
592 |
+
/**
|
593 |
+
* flagAdmin::webview_image() - create a new image, based on the height /width
|
594 |
+
*
|
595 |
+
* @class flagAdmin
|
596 |
+
*
|
597 |
+
* @param object | int $image contain all information about the image or the id
|
598 |
+
* @param bool $return_size
|
599 |
+
*
|
600 |
+
* @return string result code
|
601 |
+
*/
|
602 |
+
public static function webview_image($image, $return_size = false) {
|
603 |
+
|
604 |
+
global $flag;
|
605 |
+
|
606 |
+
if ( is_numeric($image) )
|
607 |
+
$image = flagdb::find_image( $image );
|
608 |
+
|
609 |
+
if ( !is_object($image) )
|
610 |
+
return __('Object didn\'t contain correct data','flash-album-gallery');
|
611 |
+
|
612 |
+
$img_size = @getimagesize ( $image->imagePath );
|
613 |
+
$webviewsize = '0';
|
614 |
+
$dest_path = dirname($image->webimagePath);
|
615 |
+
if(flagGallery::create_webview_folder(dirname($image->imagePath))){
|
616 |
+
if (! is_writable( $dest_path ) ) {
|
617 |
+
@chmod( $dest_path, 0755 );
|
618 |
+
}
|
619 |
+
|
620 |
+
if (file_exists($image->webimagePath)){
|
621 |
+
$webviewsize = @getimagesize ( $image->webimagePath );
|
622 |
+
flagdb::update_image_meta($image->pid, array( 'webview' => $webviewsize) );
|
623 |
+
if($return_size){
|
624 |
+
return $webviewsize;
|
625 |
+
} else {
|
626 |
+
return '1';
|
627 |
+
}
|
628 |
+
}
|
629 |
+
|
630 |
+
$imgquality = $flag->options['imgQuality'];
|
631 |
+
$max_width = ($img_size[0] < 2000)? $img_size[0] : 2000;
|
632 |
+
$max_height = ($img_size[1] < 2000)? $img_size[1] : 2000;
|
633 |
+
if( function_exists('wp_get_image_editor') ) {
|
634 |
+
$editor = wp_get_image_editor( $image->imagePath );
|
635 |
+
if ( ! is_wp_error( $editor ) ) {
|
636 |
+
$editor->set_quality( $imgquality );
|
637 |
+
$editor->resize( $max_width, $max_height, 0 );
|
638 |
+
$saved = $editor->save( $image->webimagePath );
|
639 |
+
if($saved['path'] !== $image->webimagePath) {
|
640 |
+
@rename($saved['path'], $image->webimagePath);
|
641 |
+
}
|
642 |
+
if(@filesize($image->webimagePath) > @filesize($image->imagePath)) {
|
643 |
+
@copy($image->imagePath, $image->webimagePath);
|
644 |
+
}
|
645 |
+
$webviewsize = @getimagesize ( $image->webimagePath );
|
646 |
+
flagdb::update_image_meta($image->pid, array( 'webview' => $webviewsize) );
|
647 |
+
|
648 |
+
do_action('flag_image_optimized', $image);
|
649 |
+
}
|
650 |
+
}
|
651 |
+
}
|
652 |
+
|
653 |
+
if($return_size){
|
654 |
+
return $webviewsize;
|
655 |
+
} else {
|
656 |
+
return '1';
|
657 |
+
}
|
658 |
+
}
|
659 |
+
|
660 |
+
/**
|
661 |
+
* Add images to database
|
662 |
+
*
|
663 |
+
* @class flagAdmin
|
664 |
+
* @param int $galleryID
|
665 |
+
* @param array $imageslist
|
666 |
+
* @param bool $name2alt
|
667 |
+
* @return array $image_ids Id's which are sucessful added
|
668 |
+
*/
|
669 |
+
public static function add_Images($galleryID, $imageslist, $name2alt = false) {
|
670 |
+
global $wpdb;
|
671 |
+
|
672 |
+
$alttext = '';
|
673 |
+
$image_ids = array();
|
674 |
+
|
675 |
+
if ( is_array($imageslist) ) {
|
676 |
+
foreach($imageslist as $picture) {
|
677 |
+
if($name2alt) {
|
678 |
+
// strip off the extension of the filename
|
679 |
+
$path_parts = pathinfo( $picture );
|
680 |
+
$alttext = ( !isset($path_parts['filename']) ) ? substr($path_parts['basename'], 0,strpos($path_parts['basename'], '.')) : $path_parts['filename'];
|
681 |
+
}
|
682 |
+
// save it to the database
|
683 |
+
$result = $wpdb->query( $wpdb->prepare("INSERT INTO $wpdb->flagpictures (galleryid, filename, alttext, exclude) VALUES (%s, %s, %s, 0)", $galleryID, $picture, $alttext) );
|
684 |
+
// and give me the new id
|
685 |
+
$pic_id = (int) $wpdb->insert_id;
|
686 |
+
if ($result)
|
687 |
+
$image_ids[] = $pic_id;
|
688 |
+
|
689 |
+
// add the metadata
|
690 |
+
flagAdmin::import_MetaData($pic_id);
|
691 |
+
|
692 |
+
// action hook for post process after the image is added to the database
|
693 |
+
$image = array( 'id' => $pic_id, 'filename' => $picture, 'galleryID' => $galleryID);
|
694 |
+
do_action('flag_added_new_image', $image);
|
695 |
+
|
696 |
+
}
|
697 |
+
} // is_array
|
698 |
+
|
699 |
+
return $image_ids;
|
700 |
+
|
701 |
+
}
|
702 |
+
|
703 |
+
/**
|
704 |
+
* Import some metadata into the database (if avialable)
|
705 |
+
*
|
706 |
+
* @class flagAdmin
|
707 |
+
* @param array|int $imagesIds
|
708 |
+
* @return bool
|
709 |
+
*/
|
710 |
+
public static function import_MetaData($imagesIds) {
|
711 |
+
|
712 |
+
global $wpdb;
|
713 |
+
|
714 |
+
require_once(FLAG_ABSPATH . 'lib/image.php');
|
715 |
+
|
716 |
+
if (!is_array($imagesIds))
|
717 |
+
$imagesIds = array($imagesIds);
|
718 |
+
|
719 |
+
foreach($imagesIds as $imageID) {
|
720 |
+
$image = flagdb::find_image($imageID);
|
721 |
+
if (!$image->error) {
|
722 |
+
|
723 |
+
$meta = flagAdmin::get_MetaData($image->pid);
|
724 |
+
|
725 |
+
// get the title
|
726 |
+
$alttext = empty( $meta['title'] ) ? $image->alttext : $meta['title'];
|
727 |
+
// get the caption / description field
|
728 |
+
$description = empty( $meta['caption'] ) ? $image->description : $meta['caption'];
|
729 |
+
// get the file date/time from exif
|
730 |
+
$timestamp = $meta['timestamp'];
|
731 |
+
// update database
|
732 |
+
$result = $wpdb->query( $wpdb->prepare("UPDATE $wpdb->flagpictures SET alttext = %s, description = %s, imagedate = %s WHERE pid = %d", $alttext, $description, $timestamp, $image->pid) );
|
733 |
+
if ($result === false)
|
734 |
+
return ' <strong>' . $image->filename . ' ' . __('(Error : Couldn\'t not update data base)', 'flash-album-gallery') . '</strong>';
|
735 |
+
|
736 |
+
//this flag will inform us the import is already one time performed
|
737 |
+
$meta['common']['saved'] = true;
|
738 |
+
$result = flagdb::update_image_meta($image->pid, $meta['common']);
|
739 |
+
|
740 |
+
if ($result === false)
|
741 |
+
return ' <strong>' . $image->filename . ' ' . __('(Error : Couldn\'t not update meta data)', 'flash-album-gallery') . '</strong>';
|
742 |
+
} else
|
743 |
+
return ' <strong>' . $image->filename . ' ' . __('(Error : Couldn\'t not find image)', 'flash-album-gallery') . '</strong>';// error check
|
744 |
+
}
|
745 |
+
|
746 |
+
return '1';
|
747 |
+
|
748 |
+
}
|
749 |
+
|
750 |
+
/**
|
751 |
+
* Copy some metadata into the image description (if avialable)
|
752 |
+
*
|
753 |
+
* @class flagAdmin
|
754 |
+
* @param array|int $imagesIds
|
755 |
+
* @return bool
|
756 |
+
*/
|
757 |
+
public static function copy_MetaData($imagesIds) {
|
758 |
+
|
759 |
+
global $wpdb;
|
760 |
+
|
761 |
+
/** @var $meta */
|
762 |
+
require_once(FLAG_ABSPATH . 'lib/meta.php');
|
763 |
+
require_once(FLAG_ABSPATH . 'lib/image.php');
|
764 |
+
|
765 |
+
if (!is_array($imagesIds))
|
766 |
+
$imagesIds = array($imagesIds);
|
767 |
+
|
768 |
+
foreach($imagesIds as $imageID) {
|
769 |
+
|
770 |
+
$image = flagdb::find_image($imageID);
|
771 |
+
if (!$image->error) {
|
772 |
+
/** @var $makedescription
|
773 |
+
* @var $timestamp */
|
774 |
+
require_once(FLAG_ABSPATH . 'admin/grab_meta.php');
|
775 |
+
|
776 |
+
// get the title
|
777 |
+
$alttext = empty( $alttext ) ? $image->alttext : $meta['title'];
|
778 |
+
if($alttext) $alttext = '<font size="16"><b>'.$alttext."</b></font>\n";
|
779 |
+
// get the caption / description field
|
780 |
+
$description = empty($description ) ? $image->description : $meta['caption'];
|
781 |
+
if($description) $description = $description."<br>\n";
|
782 |
+
// get the file date/time from exif
|
783 |
+
$makedescription = $alttext.$description.$makedescription;
|
784 |
+
// update database
|
785 |
+
$result = $wpdb->query( $wpdb->prepare("UPDATE $wpdb->flagpictures SET alttext = %s, description = %s, imagedate = %s WHERE pid = %d", '', $makedescription, $timestamp, $image->pid) );
|
786 |
+
if ($result === false)
|
787 |
+
return ' <strong>' . $image->filename . ' ' . __('(Error : Couldn\'t not update data base)', 'flash-album-gallery') . '</strong>';
|
788 |
+
|
789 |
+
} else
|
790 |
+
return ' <strong>' . $image->filename . ' ' . __('(Error : Couldn\'t not find image)', 'flash-album-gallery') . '</strong>';// error check
|
791 |
+
}
|
792 |
+
|
793 |
+
return '1';
|
794 |
+
|
795 |
+
}
|
796 |
+
|
797 |
+
/**
|
798 |
+
* flagAdmin::get_MetaData()
|
799 |
+
*
|
800 |
+
* @class flagAdmin
|
801 |
+
* @require Meta class
|
802 |
+
* @param $id
|
803 |
+
* @return array metadata
|
804 |
+
*/
|
805 |
+
public static function get_MetaData($id) {
|
806 |
+
|
807 |
+
require_once(FLAG_ABSPATH . 'lib/meta.php');
|
808 |
+
|
809 |
+
$meta = array();
|
810 |
+
|
811 |
+
$pdata = new flagMeta( $id );
|
812 |
+
|
813 |
+
$meta['title'] = trim ( $pdata->get_META('title') );
|
814 |
+
$meta['caption'] = trim ( $pdata->get_META('caption') );
|
815 |
+
$meta['keywords'] = trim ( $pdata->get_META('keywords') );
|
816 |
+
$meta['timestamp'] = $pdata->get_date_time();
|
817 |
+
// this contain other useful meta information
|
818 |
+
$meta['common'] = $pdata->get_common_meta();
|
819 |
+
|
820 |
+
return $meta;
|
821 |
+
|
822 |
+
}
|
823 |
+
|
824 |
+
/**
|
825 |
+
* Maybe import some meta data to the database. The functions checks the flag 'saved'
|
826 |
+
* and if based on compat reason (pre V0.40) we save then some meta datas to the database
|
827 |
+
*
|
828 |
+
* @param int $id
|
829 |
+
* @return mixed result
|
830 |
+
*/
|
831 |
+
public static function maybe_import_meta( $id ) {
|
832 |
+
|
833 |
+
require_once(FLAG_ABSPATH . 'lib/meta.php');
|
834 |
+
|
835 |
+
$meta_obj = new flagMeta( $id );
|
836 |
+
|
837 |
+
if ( $meta_obj->image->meta_data['saved'] != true ) {
|
838 |
+
$common = $meta_obj->get_common_meta();
|
839 |
+
//this flag will inform us that the import is already one time performed
|
840 |
+
$common['saved'] = true;
|
841 |
+
$result = flagdb::update_image_meta($id, $common);
|
842 |
+
} else
|
843 |
+
return false;
|
844 |
+
|
845 |
+
return $result;
|
846 |
+
|
847 |
+
}
|
848 |
+
|
849 |
+
/**
|
850 |
+
* flagAdmin::getOnlyImages()
|
851 |
+
*
|
852 |
+
* @class flagAdmin
|
853 |
+
* @param mixed $p_event
|
854 |
+
* @param mixed $p_header
|
855 |
+
* @return bool
|
856 |
+
*/
|
857 |
+
public static function getOnlyImages($p_event, $p_header) {
|
858 |
+
|
859 |
+
$info = pathinfo($p_header['filename']);
|
860 |
+
// check for extension
|
861 |
+
$ext = array('jpeg', 'jpg', 'png', 'gif');
|
862 |
+
if ( in_array( strtolower($info['extension']), $ext) ) {
|
863 |
+
// For MAC skip the ".image" files
|
864 |
+
if ($info['basename']{0} == '.' )
|
865 |
+
return 0;
|
866 |
+
else
|
867 |
+
return 1;
|
868 |
+
}
|
869 |
+
// ----- all other files are skipped
|
870 |
+
else {
|
871 |
+
return 0;
|
872 |
+
}
|
873 |
+
}
|
874 |
+
|
875 |
+
/**
|
876 |
+
* Function for uploading of images via the upload form
|
877 |
+
*
|
878 |
+
* @class flagAdmin
|
879 |
+
* @return void
|
880 |
+
*/
|
881 |
+
public static function upload_images() {
|
882 |
+
|
883 |
+
global $wpdb;
|
884 |
+
|
885 |
+
// WPMU action
|
886 |
+
if (flagAdmin::check_quota())
|
887 |
+
return;
|
888 |
+
|
889 |
+
// Images must be an array
|
890 |
+
$imageslist = array();
|
891 |
+
|
892 |
+
// get selected gallery
|
893 |
+
$galleryID = (int) $_POST['galleryselect'];
|
894 |
+
|
895 |
+
if ($galleryID == 0) {
|
896 |
+
flagGallery::show_error(__('No gallery selected !','flash-album-gallery'));
|
897 |
+
return;
|
898 |
+
}
|
899 |
+
|
900 |
+
// get the path to the gallery
|
901 |
+
$gallery = flagdb::find_gallery($galleryID);
|
902 |
+
|
903 |
+
if ( empty($gallery->path) ){
|
904 |
+
flagGallery::show_error(__('Failure in database, no gallery path set !','flash-album-gallery'));
|
905 |
+
return;
|
906 |
+
}
|
907 |
+
|
908 |
+
// read list of images
|
909 |
+
$dirlist = flagAdmin::scandir(WINABSPATH.$gallery->path);
|
910 |
+
|
911 |
+
$imagefiles = $_FILES['imagefiles'];
|
912 |
+
|
913 |
+
if (is_array($imagefiles)) {
|
914 |
+
foreach ($imagefiles['name'] as $key => $value) {
|
915 |
+
|
916 |
+
// look only for uploded files
|
917 |
+
if ($imagefiles['error'][$key] == 0) {
|
918 |
+
|
919 |
+
$temp_file = $imagefiles['tmp_name'][$key];
|
920 |
+
|
921 |
+
//clean filename and extract extension
|
922 |
+
$filepart = flagGallery::fileinfo( $imagefiles['name'][$key] );
|
923 |
+
$filename = sanitize_title($filepart['filename']) . '.' . $filepart['extension'];
|
924 |
+
|
925 |
+
// check for allowed extension and if it's an image file
|
926 |
+
$ext = array('jpg', 'jpeg', 'png', 'gif');
|
927 |
+
if ( !in_array(strtolower($filepart['extension']), $ext) || !@getimagesize($temp_file) ){
|
928 |
+
flagGallery::show_error('<strong>' . $imagefiles['name'][$key] . ' </strong>' . __('is no valid image file!','flash-album-gallery'));
|
929 |
+
continue;
|
930 |
+
}
|
931 |
+
|
932 |
+
// check if this filename already exist in the folder
|
933 |
+
$i = 0;
|
934 |
+
while ( in_array( $filename, $dirlist ) ) {
|
935 |
+
$filename = $filepart['filename'] . '_' . $i++ . '.' .$filepart['extension'];
|
936 |
+
}
|
937 |
+
|
938 |
+
$dest_file = $gallery->abspath . '/' . $filename;
|
939 |
+
|
940 |
+
//check for folder permission
|
941 |
+
if ( !is_writeable($gallery->abspath) ) {
|
942 |
+
$message = sprintf(__('Unable to write to directory %s. Is this directory writable by the server?', 'flash-album-gallery'), $gallery->abspath);
|
943 |
+
flagGallery::show_error($message);
|
944 |
+
return;
|
945 |
+
}
|
946 |
+
|
947 |
+
// save temp file to gallery
|
948 |
+
if ( !@move_uploaded_file($temp_file, $dest_file) ){
|
949 |
+
if( !file_exists($dest_file)){
|
950 |
+
flagGallery::show_error(__('Error, the file could not moved to : ','flash-album-gallery') . $dest_file);
|
951 |
+
flagAdmin::check_safemode( $gallery->abspath );
|
952 |
+
continue;
|
953 |
+
}
|
954 |
+
}
|
955 |
+
if ( !flagAdmin::chmod($dest_file) ) {
|
956 |
+
flagGallery::show_error(__('Error, the file permissions could not set','flash-album-gallery'));
|
957 |
+
continue;
|
958 |
+
}
|
959 |
+
|
960 |
+
// add to imagelist & dirlist
|
961 |
+
$imageslist[] = $filename;
|
962 |
+
$dirlist[] = $filename;
|
963 |
+
}
|
964 |
+
}
|
965 |
+
}
|
966 |
+
|
967 |
+
if (count($imageslist) > 0) {
|
968 |
+
|
969 |
+
// add images to database
|
970 |
+
$image_ids = flagAdmin::add_Images($galleryID, $imageslist);
|
971 |
+
|
972 |
+
//create thumbnails
|
973 |
+
flagAdmin::do_ajax_operation( 'create_thumbnail' , $image_ids, __('Create new thumbnails','flash-album-gallery') );
|
974 |
+
//add the preview image if needed
|
975 |
+
flagAdmin::set_gallery_preview ( $galleryID );
|
976 |
+
|
977 |
+
flagGallery::show_message( count($image_ids) . __(' Image(s) successfully added','flash-album-gallery'));
|
978 |
+
}
|
979 |
+
|
980 |
+
return;
|
981 |
+
|
982 |
+
} // end function
|
983 |
+
|
984 |
+
/**
|
985 |
+
* Upload function will be called via the Flash uploader
|
986 |
+
*
|
987 |
+
* @class flagAdmin
|
988 |
+
* @param integer $galleryID
|
989 |
+
* @return string $result
|
990 |
+
*/
|
991 |
+
static function swfupload_image($galleryID = 0) {
|
992 |
+
|
993 |
+
global $wpdb, $flag;
|
994 |
+
|
995 |
+
if ($galleryID == 0) {
|
996 |
+
//@unlink($temp_file);
|
997 |
+
return __('No gallery selected!','flash-album-gallery');
|
998 |
+
}
|
999 |
+
|
1000 |
+
// WPMU action
|
1001 |
+
if (flagAdmin::check_quota())
|
1002 |
+
return '0';
|
1003 |
+
|
1004 |
+
// Check the upload
|
1005 |
+
if (!isset($_FILES['file']) || !is_uploaded_file($_FILES["file"]["tmp_name"]) || $_FILES["file"]["error"] !== UPLOAD_ERR_OK) {
|
1006 |
+
return flagAdmin::file_upload_error_message( $_FILES['file']['error'] );
|
1007 |
+
}
|
1008 |
+
|
1009 |
+
// get the filename and extension
|
1010 |
+
$temp_file = $_FILES["file"]['tmp_name'];
|
1011 |
+
|
1012 |
+
$filepart = flagGallery::fileinfo( $_FILES['file']['name'] );
|
1013 |
+
$filename = sanitize_title($filepart['filename']) . '.' . $filepart['extension'];
|
1014 |
+
|
1015 |
+
// check for allowed extension
|
1016 |
+
$ext = array('jpeg', 'jpg', 'png', 'gif');
|
1017 |
+
if (!in_array(strtolower($filepart['extension']), $ext)){
|
1018 |
+
if(!@getimagesize($temp_file))
|
1019 |
+
return $filename . ' '. __('is no valid image file!','flash-album-gallery');
|
1020 |
+
}
|
1021 |
+
|
1022 |
+
// get the path to the gallery
|
1023 |
+
$gallerypath = $wpdb->get_var($wpdb->prepare("SELECT path FROM {$wpdb->flaggallery} WHERE gid = %d ", $galleryID));
|
1024 |
+
if (!$gallerypath){
|
1025 |
+
@unlink($temp_file);
|
1026 |
+
return __('Failure in database, no gallery path set !','flash-album-gallery');
|
1027 |
+
}
|
1028 |
+
|
1029 |
+
// read list of images
|
1030 |
+
$imageslist = flagAdmin::scandir( WINABSPATH.$gallerypath );
|
1031 |
+
|
1032 |
+
// check if this filename already exist
|
1033 |
+
$i = 0;
|
1034 |
+
while (in_array($filename,$imageslist)) {
|
1035 |
+
$filename = sanitize_title($filepart['filename']) . '_' . $i++ . '.' . $filepart['extension'];
|
1036 |
+
}
|
1037 |
+
|
1038 |
+
$dest_file = WINABSPATH . $gallerypath . '/' . $filename;
|
1039 |
+
|
1040 |
+
// save temp file to gallery
|
1041 |
+
if ( !@move_uploaded_file($temp_file, $dest_file) ){
|
1042 |
+
if( !file_exists($dest_file)){
|
1043 |
+
flagAdmin::check_safemode(WINABSPATH.$gallerypath);
|
1044 |
+
return __('Error, the file could not moved to : ','flash-album-gallery').$dest_file;
|
1045 |
+
}
|
1046 |
+
}
|
1047 |
+
|
1048 |
+
if ( !flagAdmin::chmod($dest_file) )
|
1049 |
+
return __('Error, the file permissions could not set','flash-album-gallery');
|
1050 |
+
|
1051 |
+
require_once(ABSPATH . 'wp-admin/includes/image.php');
|
1052 |
+
$angle = 0;
|
1053 |
+
$image_meta = wp_read_image_metadata($dest_file);
|
1054 |
+
if(!empty($image_meta['orientation'])){
|
1055 |
+
switch($image_meta['orientation']){
|
1056 |
+
case 3:
|
1057 |
+
$angle = 180;
|
1058 |
+
break;
|
1059 |
+
case 6:
|
1060 |
+
$angle = 270;
|
1061 |
+
break;
|
1062 |
+
case 8:
|
1063 |
+
$angle = 90;
|
1064 |
+
break;
|
1065 |
+
}
|
1066 |
+
}
|
1067 |
+
if($angle){
|
1068 |
+
$editor = wp_get_image_editor($dest_file);
|
1069 |
+
if(!is_wp_error($editor)){
|
1070 |
+
$editor->rotate($angle);
|
1071 |
+
$editor->set_quality(90);
|
1072 |
+
$editor->save($dest_file);
|
1073 |
+
}
|
1074 |
+
}
|
1075 |
+
|
1076 |
+
// add images to database
|
1077 |
+
$image_ids = flagAdmin::add_Images($galleryID, array($filename));
|
1078 |
+
$return = '';
|
1079 |
+
//create thumbnails
|
1080 |
+
|
1081 |
+
//save the thumb size values
|
1082 |
+
$flag->options['thumbWidth'] = intval($_POST['thumbw'])? intval($_POST['thumbw']) : 300;
|
1083 |
+
$flag->options['thumbHeight'] = intval($_POST['thumbh'])? intval($_POST['thumbh']) : 300;
|
1084 |
+
update_option('flag_options', $flag->options);
|
1085 |
+
|
1086 |
+
foreach($image_ids as $picture){
|
1087 |
+
$return = flagAdmin::create_thumbnail($picture);
|
1088 |
+
}
|
1089 |
+
//add the preview image if needed
|
1090 |
+
if(intval($_POST['last']) == 1)
|
1091 |
+
flagAdmin::set_gallery_preview ( $galleryID );
|
1092 |
+
|
1093 |
+
return (intval($return) == 1)? '' : $return;
|
1094 |
+
|
1095 |
+
}
|
1096 |
+
|
1097 |
+
/**
|
1098 |
+
* File upload error message
|
1099 |
+
*
|
1100 |
+
* @class flagAdmin
|
1101 |
+
* @param $error_code
|
1102 |
+
* @return string $result
|
1103 |
+
*/
|
1104 |
+
public static function file_upload_error_message($error_code) {
|
1105 |
+
switch ($error_code) {
|
1106 |
+
case UPLOAD_ERR_INI_SIZE:
|
1107 |
+
return __('The uploaded file exceeds the upload_max_filesize directive in php.ini','flash-album-gallery');
|
1108 |
+
case UPLOAD_ERR_FORM_SIZE:
|
1109 |
+
return __('The uploaded file exceeds the MAX_FILE_SIZE directive that was specified in the HTML form','flash-album-gallery');
|
1110 |
+
case UPLOAD_ERR_PARTIAL:
|
1111 |
+
return __('The uploaded file was only partially uploaded','flash-album-gallery');
|
1112 |
+
case UPLOAD_ERR_NO_FILE:
|
1113 |
+
return __('No file was uploaded','flash-album-gallery');
|
1114 |
+
case UPLOAD_ERR_NO_TMP_DIR:
|
1115 |
+
return __('Missing a temporary folder','flash-album-gallery');
|
1116 |
+
case UPLOAD_ERR_CANT_WRITE:
|
1117 |
+
return __('Failed to write file to disk','flash-album-gallery');
|
1118 |
+
case UPLOAD_ERR_EXTENSION:
|
1119 |
+
return __('File upload stopped by extension','flash-album-gallery');
|
1120 |
+
default:
|
1121 |
+
return __('Unknown upload error','flash-album-gallery');
|
1122 |
+
}
|
1123 |
+
}
|
1124 |
+
|
1125 |
+
/**
|
1126 |
+
* Check the Quota under WPMU. Only needed for this case
|
1127 |
+
*
|
1128 |
+
* @class flagAdmin
|
1129 |
+
* @return bool $result
|
1130 |
+
*/
|
1131 |
+
public static function check_quota() {
|
1132 |
+
|
1133 |
+
if ( (IS_WPMU) && flagGallery::flag_wpmu_enable_function('wpmuQuotaCheck'))
|
1134 |
+
if( $error = upload_is_user_over_quota( false ) ) {
|
1135 |
+
flagGallery::show_error( __( 'Sorry, you have used your space allocation. Please delete some files to upload more files.','flash-album-gallery' ) );
|
1136 |
+
return true;
|
1137 |
+
}
|
1138 |
+
return false;
|
1139 |
+
}
|
1140 |
+
|
1141 |
+
/**
|
1142 |
+
* Set correct file permissions (taken from wp core)
|
1143 |
+
*
|
1144 |
+
* @class flagAdmin
|
1145 |
+
* @param string $filename
|
1146 |
+
* @return bool $result
|
1147 |
+
*/
|
1148 |
+
public static function chmod($filename = '') {
|
1149 |
+
|
1150 |
+
$stat = @ stat(dirname($filename));
|
1151 |
+
$perms = $stat['mode'] & 0007777;
|
1152 |
+
$perms = $perms & 0000666;
|
1153 |
+
if ( @chmod($filename, $perms) )
|
1154 |
+
return true;
|
1155 |
+
|
1156 |
+
return false;
|
1157 |
+
}
|
1158 |
+
|
1159 |
+
/**
|
1160 |
+
* Check UID in folder and Script
|
1161 |
+
* Read http://www.php.net/manual/en/features.safe-mode.php to understand safe_mode
|
1162 |
+
*
|
1163 |
+
* @class flagAdmin
|
1164 |
+
* @param string $foldername
|
1165 |
+
* @return bool $result
|
1166 |
+
*/
|
1167 |
+
public static function check_safemode($foldername) {
|
1168 |
+
|
1169 |
+
if ( FLAG_SAFE_MODE ) {
|
1170 |
+
|
1171 |
+
//$script_uid = ( ini_get('safe_mode_gid') ) ? getmygid() : getmyuid();
|
1172 |
+
$script_uid = getmyuid();
|
1173 |
+
$folder_uid = fileowner($foldername);
|
1174 |
+
|
1175 |
+
if ($script_uid != $folder_uid) {
|
1176 |
+
$message = sprintf(__('SAFE MODE Restriction in effect! You need to create the folder <strong>%s</strong> manually','flash-album-gallery'), $foldername);
|
1177 |
+
$message .= '<br />' . sprintf(__('When safe_mode is on, PHP checks to see if the owner (%s) of the current script matches the owner (%s) of the file to be operated on by a file function or its directory','flash-album-gallery'), $script_uid, $folder_uid );
|
1178 |
+
flagGallery::show_error($message);
|
1179 |
+
return false;
|
1180 |
+
}
|
1181 |
+
}
|
1182 |
+
|
1183 |
+
return true;
|
1184 |
+
}
|
1185 |
+
|
1186 |
+
/**
|
1187 |
+
* Capability check. Check is the ID fit's to the user_ID
|
1188 |
+
*
|
1189 |
+
* @class flagAdmin
|
1190 |
+
* @param int $check_ID is the user_id
|
1191 |
+
* @return bool $result
|
1192 |
+
*/
|
1193 |
+
public static function can_manage_this_gallery($check_ID) {
|
1194 |
+
|
1195 |
+
global $user_ID, $wp_roles;
|
1196 |
+
|
1197 |
+
if ( !current_user_can('FlAG Manage others gallery') ) {
|
1198 |
+
// get the current user ID
|
1199 |
+
wp_get_current_user();
|
1200 |
+
|
1201 |
+
if ( $user_ID != $check_ID)
|
1202 |
+
return false;
|
1203 |
+
}
|
1204 |
+
return true;
|
1205 |
+
}
|
1206 |
+
|
1207 |
+
/**
|
1208 |
+
* Move images from one folder to another
|
1209 |
+
*
|
1210 |
+
* @param array|int $pic_ids ID's of the images
|
1211 |
+
* @param int $dest_gid destination gallery
|
1212 |
+
* @return void
|
1213 |
+
*/
|
1214 |
+
public static function move_images($pic_ids, $dest_gid) {
|
1215 |
+
|
1216 |
+
$errors = '';
|
1217 |
+
$count = 0;
|
1218 |
+
|
1219 |
+
if (!is_array($pic_ids))
|
1220 |
+
$pic_ids = array($pic_ids);
|
1221 |
+
|
1222 |
+
// Get destination gallery
|
1223 |
+
$destination = flagdb::find_gallery( $dest_gid );
|
1224 |
+
$dest_abspath = WINABSPATH . $destination->path;
|
1225 |
+
|
1226 |
+
if ( $destination == null ) {
|
1227 |
+
flagGallery::show_error(__('The destination gallery does not exist','flash-album-gallery'));
|
1228 |
+
return;
|
1229 |
+
}
|
1230 |
+
|
1231 |
+
// Check for folder permission
|
1232 |
+
if ( !is_writeable( $dest_abspath ) ) {
|
1233 |
+
$message = sprintf(__('Unable to write to directory %s. Is this directory writable by the server?', 'flash-album-gallery'), $dest_abspath );
|
1234 |
+
flagGallery::show_error($message);
|
1235 |
+
return;
|
1236 |
+
}
|
1237 |
+
|
1238 |
+
// Get pictures
|
1239 |
+
$images = flagdb::find_images_in_list($pic_ids);
|
1240 |
+
|
1241 |
+
foreach ($images as $image) {
|
1242 |
+
|
1243 |
+
$i = 0;
|
1244 |
+
$tmp_prefix = '';
|
1245 |
+
|
1246 |
+
$destination_file_name = $image->filename;
|
1247 |
+
// check if the filename already exist, then we add a copy_ prefix
|
1248 |
+
while (file_exists( $dest_abspath . '/' . $destination_file_name)) {
|
1249 |
+
$tmp_prefix = 'copy_' . ($i++) . '_';
|
1250 |
+
$destination_file_name = $tmp_prefix . $image->filename;
|
1251 |
+
}
|
1252 |
+
|
1253 |
+
$destination_path = $dest_abspath . '/' . $destination_file_name;
|
1254 |
+
$destination_thumbnail = $dest_abspath . '/thumbs/thumbs_' . $destination_file_name;
|
1255 |
+
|
1256 |
+
// Move files
|
1257 |
+
if ( !@rename($image->imagePath, $destination_path) ) {
|
1258 |
+
$errors .= sprintf(__('Failed to move image %1$s to %2$s','flash-album-gallery'),
|
1259 |
+
'<strong>' . $image->filename . '</strong>', $destination_path) . '<br />';
|
1260 |
+
continue;
|
1261 |
+
}
|
1262 |
+
|
1263 |
+
// Move the thumbnail, if possible
|
1264 |
+
@rename($image->thumbPath, $destination_thumbnail);
|
1265 |
+
|
1266 |
+
// Change the gallery id in the database , maybe the filename
|
1267 |
+
if ( flagdb::update_image($image->pid, $dest_gid, $destination_file_name) )
|
1268 |
+
$count++;
|
1269 |
+
|
1270 |
+
}
|
1271 |
+
|
1272 |
+
if ( $errors != '' )
|
1273 |
+
flagGallery::show_error($errors);
|
1274 |
+
|
1275 |
+
$link = '<a href="' . admin_url() . 'admin.php?page=flag-manage-gallery&mode=edit&gid=' . $destination->gid . '" >' . $destination->title . '</a>';
|
1276 |
+
$messages = sprintf(__('Moved %1$s picture(s) to gallery : %2$s .','flash-album-gallery'), $count, $link);
|
1277 |
+
flagGallery::show_message($messages);
|
1278 |
+
|
1279 |
+
return;
|
1280 |
+
}
|
1281 |
+
|
1282 |
+
/**
|
1283 |
+
* Copy images to another gallery
|
1284 |
+
*
|
1285 |
+
* @class flagAdmin
|
1286 |
+
* @param array|int $pic_ids ID's of the images
|
1287 |
+
* @param int $dest_gid destination gallery
|
1288 |
+
* @return void
|
1289 |
+
*/
|
1290 |
+
public static function copy_images($pic_ids, $dest_gid) {
|
1291 |
+
|
1292 |
+
$errors = $messages = '';
|
1293 |
+
|
1294 |
+
if (!is_array($pic_ids))
|
1295 |
+
$pic_ids = array($pic_ids);
|
1296 |
+
|
1297 |
+
// Get destination gallery
|
1298 |
+
$destination = flagdb::find_gallery( $dest_gid );
|
1299 |
+
if ( $destination == null ) {
|
1300 |
+
flagGallery::show_error(__('The destination gallery does not exist','flash-album-gallery'));
|
1301 |
+
return;
|
1302 |
+
}
|
1303 |
+
|
1304 |
+
// Check for folder permission
|
1305 |
+
if (!is_writeable(WINABSPATH.$destination->path)) {
|
1306 |
+
$message = sprintf(__('Unable to write to directory %s. Is this directory writable by the server?', 'flash-album-gallery'), WINABSPATH.$destination->path);
|
1307 |
+
flagGallery::show_error($message);
|
1308 |
+
return;
|
1309 |
+
}
|
1310 |
+
|
1311 |
+
// Get pictures
|
1312 |
+
$images = flagdb::find_images_in_list($pic_ids);
|
1313 |
+
$destination_path = WINABSPATH . $destination->path;
|
1314 |
+
|
1315 |
+
foreach ($images as $image) {
|
1316 |
+
// WPMU action
|
1317 |
+
if ( flagAdmin::check_quota() )
|
1318 |
+
return;
|
1319 |
+
|
1320 |
+
$i = 0;
|
1321 |
+
$tmp_prefix = '';
|
1322 |
+
$destination_file_name = $image->filename;
|
1323 |
+
while (file_exists($destination_path . '/' . $destination_file_name)) {
|
1324 |
+
$tmp_prefix = 'copy_' . ($i++) . '_';
|
1325 |
+
$destination_file_name = $tmp_prefix . $image->filename;
|
1326 |
+
}
|
1327 |
+
|
1328 |
+
$destination_file_path = $destination_path . '/' . $destination_file_name;
|
1329 |
+
$destination_thumb_file_path = $destination_path . '/' . $image->thumbFolder . $image->thumbPrefix . $destination_file_name;
|
1330 |
+
|
1331 |
+
// Copy files
|
1332 |
+
if ( !@copy($image->imagePath, $destination_file_path) ) {
|
1333 |
+
$errors .= sprintf(__('Failed to copy image %1$s to %2$s','flash-album-gallery'),
|
1334 |
+
$image->filename, $destination_file_path) . '<br />';
|
1335 |
+
continue;
|
1336 |
+
}
|
1337 |
+
|
1338 |
+
// Copy the thumbnail if possible
|
1339 |
+
@copy($image->thumbPath, $destination_thumb_file_path);
|
1340 |
+
|
1341 |
+
// Create new database entry for the image
|
1342 |
+
$new_pid = flagdb::insert_image( $destination->gid, $destination_file_name, $image->alttext, $image->description, $image->exclude);
|
1343 |
+
|
1344 |
+
if (!isset($new_pid)) {
|
1345 |
+
$errors .= sprintf(__('Failed to copy database row for picture %s','flash-album-gallery'), $image->pid) . '<br />';
|
1346 |
+
continue;
|
1347 |
+
}
|
1348 |
+
|
1349 |
+
if ( $tmp_prefix != '' ) {
|
1350 |
+
$messages .= sprintf(__('Image %1$s (%2$s) copied as image %3$s (%4$s) » The file already existed in the destination gallery.','flash-album-gallery'),
|
1351 |
+
$image->pid, $image->filename, $new_pid, $destination_file_name) . '<br />';
|
1352 |
+
} else {
|
1353 |
+
$messages .= sprintf(__('Image %1$s (%2$s) copied as image %3$s (%4$s)','flash-album-gallery'),
|
1354 |
+
$image->pid, $image->filename, $new_pid, $destination_file_name) . '<br />';
|
1355 |
+
}
|
1356 |
+
|
1357 |
+
}
|
1358 |
+
|
1359 |
+
// Finish by showing errors or success
|
1360 |
+
if ( $errors == '' ) {
|
1361 |
+
$link = '<a href="' . admin_url() . 'admin.php?page=flag-manage-gallery&mode=edit&gid=' . $destination->gid . '" >' . $destination->title . '</a>';
|
1362 |
+
$messages .= '<hr />' . sprintf(__('Copied %1$s picture(s) to gallery: %2$s .','flash-album-gallery'), count($images), $link);
|
1363 |
+
}
|
1364 |
+
|
1365 |
+
if ( $messages != '' )
|
1366 |
+
flagGallery::show_message($messages);
|
1367 |
+
|
1368 |
+
if ( $errors != '' )
|
1369 |
+
flagGallery::show_error($errors);
|
1370 |
+
|
1371 |
+
return;
|
1372 |
+
}
|
1373 |
+
|
1374 |
+
/**
|
1375 |
+
* Initate the Ajax operation
|
1376 |
+
*
|
1377 |
+
* @class flagAdmin
|
1378 |
+
* @param string $operation name of the function which should be executed
|
1379 |
+
* @param array $image_array
|
1380 |
+
* @param string $title name of the operation
|
1381 |
+
* @return string the javascript output
|
1382 |
+
*/
|
1383 |
+
public static function do_ajax_operation( $operation, $image_array, $title = '' ) {
|
1384 |
+
|
1385 |
+
if ( !is_array($image_array) || empty($image_array) )
|
1386 |
+
return;
|
1387 |
+
|
1388 |
+
$js_array = implode('","', $image_array);
|
1389 |
+
|
1390 |
+
// send out some JavaScript, which initate the ajax operation
|
1391 |
+
?>
|
1392 |
+
<script type="text/javascript">
|
1393 |
+
|
1394 |
+
Images = new Array("<?php echo $js_array; ?>");
|
1395 |
+
|
1396 |
+
flagAjaxOptions = {
|
1397 |
+
operation: "<?php echo $operation; ?>",
|
1398 |
+
ids: Images,
|
1399 |
+
header: "<?php echo $title; ?>",
|
1400 |
+
maxStep: Images.length
|
1401 |
+
};
|
1402 |
+
|
1403 |
+
jQuery(document).ready( function(){
|
1404 |
+
flagProgressBar.init( flagAjaxOptions );
|
1405 |
+
flagAjax.init( flagAjaxOptions );
|
1406 |
+
} );
|
1407 |
+
</script>
|
1408 |
+
|
1409 |
+
<div id="progressbar_container" class="wrap"></div>
|
1410 |
+
|
1411 |
+
<?php
|
1412 |
+
}
|
1413 |
+
|
1414 |
+
/**
|
1415 |
+
* flagAdmin::set_gallery_preview() - define a preview pic after the first upload, can be changed in the gallery settings
|
1416 |
+
*
|
1417 |
+
* @class flagAdmin
|
1418 |
+
* @param int $galleryID
|
1419 |
+
* @return void
|
1420 |
+
*/
|
1421 |
+
public static function set_gallery_preview( $galleryID ) {
|
1422 |
+
global $wpdb;
|
1423 |
+
|
1424 |
+
$galleryID = intval($galleryID);
|
1425 |
+
$gallery = flagdb::find_gallery( $galleryID );
|
1426 |
+
|
1427 |
+
// in the case no preview image is setup, we do this now
|
1428 |
+
if ($gallery->previewpic == 0) {
|
1429 |
+
$firstImage = $wpdb->get_var($wpdb->prepare("SELECT `pid` FROM `{$wpdb->flagpictures}` WHERE `exclude` != 1 AND `galleryid` = '%d' ORDER by `pid` DESC limit 0,1", $galleryID));
|
1430 |
+
if ($firstImage) {
|
1431 |
+
$wpdb->query($wpdb->prepare("UPDATE `{$wpdb->flaggallery}` SET `previewpic` = '%s' WHERE `gid` = '%d'", $firstImage, $galleryID));
|
1432 |
+
wp_cache_delete($galleryID, 'flag_gallery');
|
1433 |
+
}
|
1434 |
+
}
|
1435 |
+
|
1436 |
+
return;
|
1437 |
+
}
|
1438 |
+
|
1439 |
+
/**
|
1440 |
+
* Return a JSON coded array of Image ids for a requested gallery
|
1441 |
+
*
|
1442 |
+
* @param int $galleryID
|
1443 |
+
* @return array (JSON)
|
1444 |
+
*/
|
1445 |
+
public static function get_image_ids( $galleryID ) {
|
1446 |
+
|
1447 |
+
if ( !function_exists('json_encode') )
|
1448 |
+
return(-2);
|
1449 |
+
|
1450 |
+
$gallery = flagdb::get_ids_from_gallery($galleryID, 'pid', 'ASC', false);
|
1451 |
+
|
1452 |
+
header('Content-Type: text/plain; charset=' . get_option('blog_charset'), true);
|
1453 |
+
$output = json_encode($gallery);
|
1454 |
+
|
1455 |
+
return $output;
|
1456 |
+
}
|
1457 |
+
|
1458 |
+
} // END class flagAdmin
|
1459 |
+
}
|
admin/images/woowbox-promote.png
CHANGED
Binary file
|
admin/js/Jcrop/js/jquery.Jcrop.js
CHANGED
@@ -44,9 +44,8 @@ btndown=true;docOffset=getPos($img);Selection.disableHandles();Tracker.setCursor
|
|
44 |
function selectDrag(pos)
|
45 |
{Coords.setCurrent(pos);Selection.update();}
|
46 |
function newTracker()
|
47 |
-
{var trk=$('<div></div>').addClass(cssClass('tracker'));
|
48 |
return trk;}
|
49 |
-
if($.browser.msie&&($.browser.version.split('.')[0]==='6')){ie6mode=true;}
|
50 |
if(typeof(obj)!=='object'){obj=$(obj)[0];}
|
51 |
if(typeof(opt)!=='object'){opt={};}
|
52 |
setOptions(opt);var img_css={border:'none',margin:0,padding:0,position:'absolute'};var $origimg=$(obj);var $img=$origimg.clone().removeAttr('id').css(img_css);$img.width($origimg.width());$img.height($origimg.height());$origimg.after($img).hide();presize($img,options.boxWidth,options.boxHeight);var boundx=$img.width(),boundy=$img.height(),$div=$('<div />').width(boundx).height(boundy).addClass(cssClass('holder')).css({position:'relative',backgroundColor:options.bgColor}).insertAfter($origimg).append($img);if(options.addClass){$div.addClass(options.addClass);}
|
@@ -244,7 +243,7 @@ Shade.refresh();if(options.bgColor!=bgcolor){colorChangeMacro(options.shade?Shad
|
|
244 |
if(bgopacity!=options.bgOpacity){bgopacity=options.bgOpacity;if(options.shade)Shade.refresh();else Selection.setBgOpacity(bgopacity);}
|
245 |
xlimit=options.maxSize[0]||0;ylimit=options.maxSize[1]||0;xmin=options.minSize[0]||0;ymin=options.minSize[1]||0;if(options.hasOwnProperty('outerImage')){$img.attr('src',options.outerImage);delete(options.outerImage);}
|
246 |
Selection.refresh();}
|
247 |
-
if(Touch.support)$trk.bind('touchstart',Touch.newSelection);$hdl_holder.hide();interfaceUpdate(true);var api={setImage:setImage,animateTo:animateTo,setSelect:setSelect,setOptions:setOptionsNew,tellSelect:tellSelect,tellScaled:tellScaled,setClass:setClass,disable:disableCrop,enable:enableCrop,cancel:cancelCrop,release:Selection.release,destroy:destroy,focus:KeyManager.watchKeys,getBounds:function(){return[boundx*xscale,boundy*yscale];},getWidgetSize:function(){return[boundx,boundy];},getScaleFactor:function(){return[xscale,yscale];},ui:{holder:$div,selection:$sel}};
|
248 |
$origimg.data('Jcrop',api);return api;};$.fn.Jcrop=function(options,callback)
|
249 |
{function attachWhenDone(from)
|
250 |
{var opt=(typeof(options)==='object')?options:{};var loadsrc=opt.useImg||from.src;var img=new Image();img.onload=function(){function attachJcrop(){var api=$.Jcrop(from,opt);if(typeof(callback)==='function'){callback.call(api);}}
|
@@ -252,4 +251,4 @@ function attachAttempt(){if(!img.width||!img.height){window.setTimeout(attachAtt
|
|
252 |
window.setTimeout(attachAttempt,50);};img.src=loadsrc;}
|
253 |
this.each(function(){if($(this).data('Jcrop')){if(options==='api'){return $(this).data('Jcrop');}
|
254 |
else{$(this).data('Jcrop').setOptions(options);}}
|
255 |
-
else{attachWhenDone(this);}});return this;};$.Jcrop.defaults={allowSelect:true,allowMove:true,allowResize:true,trackDocument:true,baseClass:'jcrop',addClass:null,bgColor:'black',bgOpacity:0.6,bgFade:false,borderOpacity:0.4,handleOpacity:0.5,handleSize:7,handleOffset:5,aspectRatio:0,keySupport:true,cornerHandles:true,sideHandles:true,drawBorders:true,dragEdges:true,fixedSupport:true,touchSupport:null,shade:false,boxWidth:0,boxHeight:0,boundary:2,fadeTime:400,animationDelay:20,swingSpeed:3,minSelect:[0,0],maxSize:[0,0],minSize:[0,0],onChange:function(){},onSelect:function(){},onDblClick:function(){},onRelease:function(){}};}(jQuery));
|
44 |
function selectDrag(pos)
|
45 |
{Coords.setCurrent(pos);Selection.update();}
|
46 |
function newTracker()
|
47 |
+
{var trk=$('<div></div>').addClass(cssClass('tracker'));
|
48 |
return trk;}
|
|
|
49 |
if(typeof(obj)!=='object'){obj=$(obj)[0];}
|
50 |
if(typeof(opt)!=='object'){opt={};}
|
51 |
setOptions(opt);var img_css={border:'none',margin:0,padding:0,position:'absolute'};var $origimg=$(obj);var $img=$origimg.clone().removeAttr('id').css(img_css);$img.width($origimg.width());$img.height($origimg.height());$origimg.after($img).hide();presize($img,options.boxWidth,options.boxHeight);var boundx=$img.width(),boundy=$img.height(),$div=$('<div />').width(boundx).height(boundy).addClass(cssClass('holder')).css({position:'relative',backgroundColor:options.bgColor}).insertAfter($origimg).append($img);if(options.addClass){$div.addClass(options.addClass);}
|
243 |
if(bgopacity!=options.bgOpacity){bgopacity=options.bgOpacity;if(options.shade)Shade.refresh();else Selection.setBgOpacity(bgopacity);}
|
244 |
xlimit=options.maxSize[0]||0;ylimit=options.maxSize[1]||0;xmin=options.minSize[0]||0;ymin=options.minSize[1]||0;if(options.hasOwnProperty('outerImage')){$img.attr('src',options.outerImage);delete(options.outerImage);}
|
245 |
Selection.refresh();}
|
246 |
+
if(Touch.support)$trk.bind('touchstart',Touch.newSelection);$hdl_holder.hide();interfaceUpdate(true);var api={setImage:setImage,animateTo:animateTo,setSelect:setSelect,setOptions:setOptionsNew,tellSelect:tellSelect,tellScaled:tellScaled,setClass:setClass,disable:disableCrop,enable:enableCrop,cancel:cancelCrop,release:Selection.release,destroy:destroy,focus:KeyManager.watchKeys,getBounds:function(){return[boundx*xscale,boundy*yscale];},getWidgetSize:function(){return[boundx,boundy];},getScaleFactor:function(){return[xscale,yscale];},ui:{holder:$div,selection:$sel}};
|
247 |
$origimg.data('Jcrop',api);return api;};$.fn.Jcrop=function(options,callback)
|
248 |
{function attachWhenDone(from)
|
249 |
{var opt=(typeof(options)==='object')?options:{};var loadsrc=opt.useImg||from.src;var img=new Image();img.onload=function(){function attachJcrop(){var api=$.Jcrop(from,opt);if(typeof(callback)==='function'){callback.call(api);}}
|
251 |
window.setTimeout(attachAttempt,50);};img.src=loadsrc;}
|
252 |
this.each(function(){if($(this).data('Jcrop')){if(options==='api'){return $(this).data('Jcrop');}
|
253 |
else{$(this).data('Jcrop').setOptions(options);}}
|
254 |
+
else{attachWhenDone(this);}});return this;};$.Jcrop.defaults={allowSelect:true,allowMove:true,allowResize:true,trackDocument:true,baseClass:'jcrop',addClass:null,bgColor:'black',bgOpacity:0.6,bgFade:false,borderOpacity:0.4,handleOpacity:0.5,handleSize:7,handleOffset:5,aspectRatio:0,keySupport:true,cornerHandles:true,sideHandles:true,drawBorders:true,dragEdges:true,fixedSupport:true,touchSupport:null,shade:false,boxWidth:0,boxHeight:0,boundary:2,fadeTime:400,animationDelay:20,swingSpeed:3,minSelect:[0,0],maxSize:[0,0],minSize:[0,0],onChange:function(){},onSelect:function(){},onDblClick:function(){},onRelease:function(){}};}(jQuery));
|
admin/js/flagallery-block.js
CHANGED
@@ -1,4 +1,4 @@
|
|
1 |
-
(function(blocks, element) {
|
2 |
var el = element.createElement,
|
3 |
source = blocks.source;
|
4 |
|
@@ -9,10 +9,12 @@
|
|
9 |
var type = atts.type;
|
10 |
var galleryname = atts.galleryname || '';
|
11 |
var skin = atts.skin || '';
|
|
|
12 |
var skinalign = atts.align || '';
|
13 |
var gallerywidth = atts.width || '';
|
14 |
|
15 |
var skinname = '';
|
|
|
16 |
var gallerysize = '';
|
17 |
if('gallery' == type) {
|
18 |
scid = ' gid=' + id;
|
@@ -40,6 +42,17 @@
|
|
40 |
skinname = '';
|
41 |
skin = flagallery_data.default_skin;
|
42 |
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
43 |
if(skinalign) {
|
44 |
skinalign = ' align=' + skinalign;
|
45 |
}
|
@@ -47,7 +60,7 @@
|
|
47 |
skinalign = '';
|
48 |
}
|
49 |
|
50 |
-
tagtext = '[flagallery' + scid + galleryname + gallerysize + skinname + skinalign + ']';
|
51 |
|
52 |
return el('div', {className: 'flagallery-shortcode'}, tagtext);
|
53 |
}
|
@@ -69,6 +82,9 @@
|
|
69 |
skin: {
|
70 |
type: 'string',
|
71 |
},
|
|
|
|
|
|
|
72 |
align: {
|
73 |
type: 'string',
|
74 |
},
|
@@ -82,6 +98,7 @@
|
|
82 |
var type = props.attributes.type;
|
83 |
var id = props.attributes.id;
|
84 |
var skin = props.attributes.skin;
|
|
|
85 |
var align = props.attributes.align;
|
86 |
var width = props.attributes.width;
|
87 |
var elclass = '';
|
@@ -108,6 +125,7 @@
|
|
108 |
id: id,
|
109 |
type: type,
|
110 |
skin: form.find('.flagallery-skin').val(),
|
|
|
111 |
align: form.find('.flagallery-align').val(),
|
112 |
galleryname: galleryname,
|
113 |
width: form.find('.flagallery-width').val(),
|
@@ -115,6 +133,20 @@
|
|
115 |
event.preventDefault();
|
116 |
}
|
117 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
118 |
// Choose galleries
|
119 |
options.push(
|
120 |
el('option', {value: ''}, '- Select your album / gallery -'),
|
@@ -159,7 +191,25 @@
|
|
159 |
);
|
160 |
});
|
161 |
children.push(
|
162 |
-
el('select', {className: 'flagallery-skin', value: skin, onChange:
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
163 |
);
|
164 |
|
165 |
// skin align
|
@@ -212,4 +262,5 @@
|
|
212 |
})(
|
213 |
window.wp.blocks,
|
214 |
window.wp.element,
|
|
|
215 |
);
|
1 |
+
(function(blocks, element, $) {
|
2 |
var el = element.createElement,
|
3 |
source = blocks.source;
|
4 |
|
9 |
var type = atts.type;
|
10 |
var galleryname = atts.galleryname || '';
|
11 |
var skin = atts.skin || '';
|
12 |
+
var preset = atts.preset || '';
|
13 |
var skinalign = atts.align || '';
|
14 |
var gallerywidth = atts.width || '';
|
15 |
|
16 |
var skinname = '';
|
17 |
+
var skinpreset = '';
|
18 |
var gallerysize = '';
|
19 |
if('gallery' == type) {
|
20 |
scid = ' gid=' + id;
|
42 |
skinname = '';
|
43 |
skin = flagallery_data.default_skin;
|
44 |
}
|
45 |
+
if(preset) {
|
46 |
+
if(preset.indexOf(' ') >= 0) {
|
47 |
+
skinpreset = ' preset=\'' + preset + '\'';
|
48 |
+
} else {
|
49 |
+
skinpreset = ' preset=' + preset;
|
50 |
+
}
|
51 |
+
}
|
52 |
+
else {
|
53 |
+
skinpreset = '';
|
54 |
+
preset = '';
|
55 |
+
}
|
56 |
if(skinalign) {
|
57 |
skinalign = ' align=' + skinalign;
|
58 |
}
|
60 |
skinalign = '';
|
61 |
}
|
62 |
|
63 |
+
tagtext = '[flagallery' + scid + galleryname + gallerysize + skinname + skinpreset + skinalign + ']';
|
64 |
|
65 |
return el('div', {className: 'flagallery-shortcode'}, tagtext);
|
66 |
}
|
82 |
skin: {
|
83 |
type: 'string',
|
84 |
},
|
85 |
+
preset: {
|
86 |
+
type: 'string',
|
87 |
+
},
|
88 |
align: {
|
89 |
type: 'string',
|
90 |
},
|
98 |
var type = props.attributes.type;
|
99 |
var id = props.attributes.id;
|
100 |
var skin = props.attributes.skin;
|
101 |
+
var preset = props.attributes.preset;
|
102 |
var align = props.attributes.align;
|
103 |
var width = props.attributes.width;
|
104 |
var elclass = '';
|
125 |
id: id,
|
126 |
type: type,
|
127 |
skin: form.find('.flagallery-skin').val(),
|
128 |
+
preset: form.find('.flagallery-preset').val(),
|
129 |
align: form.find('.flagallery-align').val(),
|
130 |
galleryname: galleryname,
|
131 |
width: form.find('.flagallery-width').val(),
|
133 |
event.preventDefault();
|
134 |
}
|
135 |
|
136 |
+
function setSkin(event) {
|
137 |
+
setPreset($(event.target));
|
138 |
+
setGallery(event);
|
139 |
+
}
|
140 |
+
|
141 |
+
function setPreset(skinSelect) {
|
142 |
+
var form = skinSelect.closest('form.flagallery-preview');
|
143 |
+
var skin = skinSelect.val();
|
144 |
+
form.find('.flagallery-preset').val('').find('option').removeAttr('style');
|
145 |
+
if(skin) {
|
146 |
+
form.find('.flagallery-preset option').filter('.' + skin).show();
|
147 |
+
}
|
148 |
+
}
|
149 |
+
|
150 |
// Choose galleries
|
151 |
options.push(
|
152 |
el('option', {value: ''}, '- Select your album / gallery -'),
|
191 |
);
|
192 |
});
|
193 |
children.push(
|
194 |
+
el('select', {className: 'flagallery-skin', value: skin, onChange: setSkin}, options),
|
195 |
+
);
|
196 |
+
|
197 |
+
// preset
|
198 |
+
options = [];
|
199 |
+
options.push(
|
200 |
+
el('option', {className:'default-preset', value: ''}, 'Default preset'),
|
201 |
+
);
|
202 |
+
Object.keys(flagallery_data.presets).forEach(function(key) {
|
203 |
+
options.push(
|
204 |
+
el('option', {
|
205 |
+
className: flagallery_data.presets[key].id,
|
206 |
+
value: flagallery_data.presets[key].name,
|
207 |
+
style: { display: flagallery_data.presets[key].id === skin? 'block' : false }
|
208 |
+
}, flagallery_data.presets[key].name),
|
209 |
+
);
|
210 |
+
});
|
211 |
+
children.push(
|
212 |
+
el('select', {className: 'flagallery-preset', value: preset, onChange: setGallery}, options),
|
213 |
);
|
214 |
|
215 |
// skin align
|
262 |
})(
|
263 |
window.wp.blocks,
|
264 |
window.wp.element,
|
265 |
+
jQuery
|
266 |
);
|
admin/js/jquery.tablesorter.js
CHANGED
@@ -1,71 +1,71 @@
|
|
1 |
/*
|
2 |
-
*
|
3 |
* TableSorter 2.0 - Client-side table sorting with ease!
|
4 |
* Version 2.0.3
|
5 |
* @requires jQuery v1.2.3
|
6 |
-
*
|
7 |
* Copyright (c) 2007 Christian Bach
|
8 |
* Examples and docs at: http://tablesorter.com
|
9 |
* Dual licensed under the MIT and GPL licenses:
|
10 |
* http://www.opensource.org/licenses/mit-license.php
|
11 |
* http://www.gnu.org/licenses/gpl.html
|
12 |
-
*
|
13 |
*/
|
14 |
/**
|
15 |
*
|
16 |
* @description Create a sortable table with multi-column sorting capabilitys
|
17 |
-
*
|
18 |
* @example $('table').tablesorter();
|
19 |
* @desc Create a simple tablesorter interface.
|
20 |
*
|
21 |
* @example $('table').tablesorter({ sortList:[[0,0],[1,0]] });
|
22 |
* @desc Create a tablesorter interface and sort on the first and secound column in ascending order.
|
23 |
-
*
|
24 |
* @example $('table').tablesorter({ headers: { 0: { sorter: false}, 1: {sorter: false} } });
|
25 |
* @desc Create a tablesorter interface and disableing the first and secound column headers.
|
26 |
-
*
|
27 |
* @example $('table').tablesorter({ 0: {sorter:"integer"}, 1: {sorter:"currency"} });
|
28 |
* @desc Create a tablesorter interface and set a column parser for the first and secound column.
|
29 |
-
*
|
30 |
-
*
|
31 |
* @param Object settings An object literal containing key/value pairs to provide optional settings.
|
32 |
-
*
|
33 |
-
* @option String cssHeader (optional) A string of the class name to be appended to sortable tr elements in the thead of the table.
|
34 |
* Default value: "header"
|
35 |
-
*
|
36 |
-
* @option String cssAsc (optional) A string of the class name to be appended to sortable tr elements in the thead on a ascending sort.
|
37 |
* Default value: "headerSortUp"
|
38 |
-
*
|
39 |
-
* @option String cssDesc (optional) A string of the class name to be appended to sortable tr elements in the thead on a descending sort.
|
40 |
* Default value: "headerSortDown"
|
41 |
-
*
|
42 |
-
* @option String sortInitialOrder (optional) A string of the inital sorting order can be asc or desc.
|
43 |
* Default value: "asc"
|
44 |
-
*
|
45 |
-
* @option String sortMultisortKey (optional) A string of the multi-column sort key.
|
46 |
* Default value: "shiftKey"
|
47 |
-
*
|
48 |
-
* @option String textExtraction (optional) A string of the text-extraction method to use.
|
49 |
-
* For complex html structures inside td cell set this option to "complex",
|
50 |
-
* on large tables the complex option can be slow.
|
51 |
* Default value: "simple"
|
52 |
-
*
|
53 |
-
* @option Object headers (optional) An array containing the forces sorting rules.
|
54 |
-
* This option let's you specify a default sorting rule.
|
55 |
* Default value: null
|
56 |
-
*
|
57 |
-
* @option Array sortList (optional) An array containing the forces sorting rules.
|
58 |
-
* This option let's you specify a default sorting rule.
|
59 |
* Default value: null
|
60 |
-
*
|
61 |
-
* @option Array sortForce (optional) An array containing forced sorting rules.
|
62 |
* This option let's you specify a default sorting rule, which is prepended to user-selected rules.
|
63 |
* Default value: null
|
64 |
-
*
|
65 |
-
* @option Array sortAppend (optional) An array containing forced sorting rules.
|
66 |
* This option let's you specify a default sorting rule, which is appended to user-selected rules.
|
67 |
* Default value: null
|
68 |
-
*
|
69 |
* @option Boolean widthFixed (optional) Boolean flag indicating if tablesorter should apply fixed widths to the table columns.
|
70 |
* This is usefull when using the pager companion plugin.
|
71 |
* This options requires the dimension jquery plugin.
|
@@ -79,18 +79,18 @@
|
|
79 |
* @type jQuery
|
80 |
*
|
81 |
* @name tablesorter
|
82 |
-
*
|
83 |
* @cat Plugins/Tablesorter
|
84 |
-
*
|
85 |
* @author Christian Bach/christian.bach@polyester.se
|
86 |
*/
|
87 |
|
88 |
(function($) {
|
89 |
$.extend({
|
90 |
tablesorter: new function() {
|
91 |
-
|
92 |
var parsers = [], widgets = [];
|
93 |
-
|
94 |
this.defaults = {
|
95 |
cssHeader: "header",
|
96 |
cssAsc: "headerSortUp",
|
@@ -100,8 +100,8 @@
|
|
100 |
sortForce: null,
|
101 |
sortAppend: null,
|
102 |
textExtraction: "simple",
|
103 |
-
parsers: {},
|
104 |
-
widgets: [],
|
105 |
widgetZebra: {css: ["even","odd"]},
|
106 |
headers: {},
|
107 |
widthFixed: false,
|
@@ -112,14 +112,14 @@
|
|
112 |
decimal: '.',
|
113 |
debug: false
|
114 |
};
|
115 |
-
|
116 |
/* debuging utils */
|
117 |
function benchmark(s,d) {
|
118 |
log(s + "," + (new Date().getTime() - d.getTime()) + "ms");
|
119 |
}
|
120 |
-
|
121 |
this.benchmark = benchmark;
|
122 |
-
|
123 |
function log(s) {
|
124 |
if (typeof console != "undefined" && typeof console.debug != "undefined") {
|
125 |
console.log(s);
|
@@ -127,44 +127,44 @@
|
|
127 |
alert(s);
|
128 |
}
|
129 |
}
|
130 |
-
|
131 |
/* parsers utils */
|
132 |
function buildParserCache(table,$headers) {
|
133 |
-
|
134 |
if(table.config.debug) { var parsersDebug = ""; }
|
135 |
-
|
136 |
var rows = table.tBodies[0].rows;
|
137 |
-
|
138 |
if(table.tBodies[0].rows[0]) {
|
139 |
|
140 |
var list = [], cells = rows[0].cells, l = cells.length;
|
141 |
-
|
142 |
for (var i=0;i < l; i++) {
|
143 |
var p = false;
|
144 |
-
|
145 |
if($.metadata && ($($headers[i]).metadata() && $($headers[i]).metadata().sorter) ) {
|
146 |
-
|
147 |
-
p = getParserById($($headers[i]).metadata().sorter);
|
148 |
-
|
149 |
} else if((table.config.headers[i] && table.config.headers[i].sorter)) {
|
150 |
-
|
151 |
p = getParserById(table.config.headers[i].sorter);
|
152 |
}
|
153 |
if(!p) {
|
154 |
p = detectParserForColumn(table,cells[i]);
|
155 |
}
|
156 |
-
|
157 |
if(table.config.debug) { parsersDebug += "column:" + i + " parser:" +p.id + "\n"; }
|
158 |
-
|
159 |
list.push(p);
|
160 |
}
|
161 |
}
|
162 |
-
|
163 |
if(table.config.debug) { log(parsersDebug); }
|
164 |
|
165 |
return list;
|
166 |
};
|
167 |
-
|
168 |
function detectParserForColumn(table,node) {
|
169 |
var l = parsers.length;
|
170 |
for(var i=1; i < l; i++) {
|
@@ -175,55 +175,55 @@
|
|
175 |
// 0 is always the generic parser (text)
|
176 |
return parsers[0];
|
177 |
}
|
178 |
-
|
179 |
function getParserById(name) {
|
180 |
var l = parsers.length;
|
181 |
for(var i=0; i < l; i++) {
|
182 |
-
if(parsers[i].id.toLowerCase() == name.toLowerCase()) {
|
183 |
return parsers[i];
|
184 |
}
|
185 |
}
|
186 |
return false;
|
187 |
}
|
188 |
-
|
189 |
/* utils */
|
190 |
function buildCache(table) {
|
191 |
-
|
192 |
if(table.config.debug) { var cacheTime = new Date(); }
|
193 |
-
|
194 |
-
|
195 |
var totalRows = (table.tBodies[0] && table.tBodies[0].rows.length) || 0,
|
196 |
totalCells = (table.tBodies[0].rows[0] && table.tBodies[0].rows[0].cells.length) || 0,
|
197 |
-
parsers = table.config.parsers,
|
198 |
cache = {row: [], normalized: []};
|
199 |
-
|
200 |
for (var i=0;i < totalRows; ++i) {
|
201 |
-
|
202 |
/** Add the table data to main data array */
|
203 |
var c = table.tBodies[0].rows[i], cols = [];
|
204 |
-
|
205 |
cache.row.push($(c));
|
206 |
-
|
207 |
for(var j=0; j < totalCells; ++j) {
|
208 |
-
cols.push(parsers[j].format(getElementText(table.config,c.cells[j]),table,c.cells[j]));
|
209 |
}
|
210 |
-
|
211 |
cols.push(i); // add position for rowCache
|
212 |
cache.normalized.push(cols);
|
213 |
cols = null;
|
214 |
};
|
215 |
-
|
216 |
if(table.config.debug) { benchmark("Building cache for " + totalRows + " rows:", cacheTime); }
|
217 |
-
|
218 |
return cache;
|
219 |
};
|
220 |
-
|
221 |
function getElementText(config,node) {
|
222 |
-
|
223 |
if(!node) return "";
|
224 |
-
|
225 |
var t = "";
|
226 |
-
|
227 |
if(config.textExtraction == "simple") {
|
228 |
if(node.childNodes[0] && node.childNodes[0].hasChildNodes()) {
|
229 |
t = node.childNodes[0].innerHTML;
|
@@ -233,99 +233,99 @@
|
|
233 |
} else {
|
234 |
if(typeof(config.textExtraction) == "function") {
|
235 |
t = config.textExtraction(node);
|
236 |
-
} else {
|
237 |
t = $(node).text();
|
238 |
-
}
|
239 |
}
|
240 |
return t;
|
241 |
}
|
242 |
-
|
243 |
function appendToTable(table,cache) {
|
244 |
-
|
245 |
if(table.config.debug) {var appendTime = new Date()}
|
246 |
-
|
247 |
-
var c = cache,
|
248 |
-
r = c.row,
|
249 |
-
n= c.normalized,
|
250 |
-
totalRows = n.length,
|
251 |
-
checkCell = (n[0].length-1),
|
252 |
tableBody = $(table.tBodies[0]),
|
253 |
rows = [];
|
254 |
-
|
255 |
for (var i=0;i < totalRows; i++) {
|
256 |
-
rows.push(r[n[i][checkCell]]);
|
257 |
if(!table.config.appender) {
|
258 |
-
|
259 |
var o = r[n[i][checkCell]];
|
260 |
var l = o.length;
|
261 |
for(var j=0; j < l; j++) {
|
262 |
-
|
263 |
tableBody[0].appendChild(o[j]);
|
264 |
-
|
265 |
}
|
266 |
-
|
267 |
//tableBody.append(r[n[i][checkCell]]);
|
268 |
}
|
269 |
-
}
|
270 |
-
|
271 |
if(table.config.appender) {
|
272 |
-
|
273 |
-
table.config.appender(table,rows);
|
274 |
}
|
275 |
-
|
276 |
rows = null;
|
277 |
-
|
278 |
if(table.config.debug) { benchmark("Rebuilt table:", appendTime); }
|
279 |
-
|
280 |
//apply table widgets
|
281 |
applyWidget(table);
|
282 |
-
|
283 |
// trigger sortend
|
284 |
setTimeout(function() {
|
285 |
-
$(table).trigger("sortEnd");
|
286 |
},0);
|
287 |
-
|
288 |
};
|
289 |
-
|
290 |
function buildHeaders(table) {
|
291 |
-
|
292 |
if(table.config.debug) { var time = new Date(); }
|
293 |
-
|
294 |
var meta = ($.metadata) ? true : false, tableHeadersRows = [];
|
295 |
-
|
296 |
for(var i = 0; i < table.tHead.rows.length; i++) { tableHeadersRows[i]=0; };
|
297 |
-
|
298 |
$tableHeaders = $("thead th",table);
|
299 |
-
|
300 |
$tableHeaders.each(function(index) {
|
301 |
-
|
302 |
this.count = 0;
|
303 |
this.column = index;
|
304 |
this.order = formatSortingOrder(table.config.sortInitialOrder);
|
305 |
-
|
306 |
if(checkHeaderMetadata(this) || checkHeaderOptions(table,index)) this.sortDisabled = true;
|
307 |
-
|
308 |
if(!this.sortDisabled) {
|
309 |
$(this).addClass(table.config.cssHeader);
|
310 |
}
|
311 |
-
|
312 |
// add cell to headerList
|
313 |
table.config.headerList[index]= this;
|
314 |
});
|
315 |
-
|
316 |
if(table.config.debug) { benchmark("Built headers:", time); log($tableHeaders); }
|
317 |
-
|
318 |
return $tableHeaders;
|
319 |
-
|
320 |
};
|
321 |
-
|
322 |
function checkCellColSpan(table, rows, row) {
|
323 |
var arr = [], r = table.tHead.rows, c = r[row].cells;
|
324 |
-
|
325 |
for(var i=0; i < c.length; i++) {
|
326 |
var cell = c[i];
|
327 |
-
|
328 |
-
if ( cell.colSpan > 1) {
|
329 |
arr = arr.concat(checkCellColSpan(table, headerArr,row++));
|
330 |
} else {
|
331 |
if(table.tHead.length == 1 || (cell.rowSpan > 1 || !r[row+1])) {
|
@@ -336,38 +336,38 @@
|
|
336 |
}
|
337 |
return arr;
|
338 |
};
|
339 |
-
|
340 |
function checkHeaderMetadata(cell) {
|
341 |
if(($.metadata) && ($(cell).metadata().sorter === false)) { return true; };
|
342 |
return false;
|
343 |
}
|
344 |
-
|
345 |
-
function checkHeaderOptions(table,i) {
|
346 |
if((table.config.headers[i]) && (table.config.headers[i].sorter === false)) { return true; };
|
347 |
return false;
|
348 |
}
|
349 |
-
|
350 |
function applyWidget(table) {
|
351 |
var c = table.config.widgets;
|
352 |
var l = c.length;
|
353 |
for(var i=0; i < l; i++) {
|
354 |
-
|
355 |
getWidgetById(c[i]).format(table);
|
356 |
}
|
357 |
-
|
358 |
}
|
359 |
-
|
360 |
function getWidgetById(name) {
|
361 |
var l = widgets.length;
|
362 |
for(var i=0; i < l; i++) {
|
363 |
if(widgets[i].id.toLowerCase() == name.toLowerCase() ) {
|
364 |
-
return widgets[i];
|
365 |
}
|
366 |
}
|
367 |
};
|
368 |
-
|
369 |
function formatSortingOrder(v) {
|
370 |
-
|
371 |
if(typeof(v) != "Number") {
|
372 |
i = (v.toLowerCase() == "desc") ? 1 : 0;
|
373 |
} else {
|
@@ -375,34 +375,34 @@
|
|
375 |
}
|
376 |
return i;
|
377 |
}
|
378 |
-
|
379 |
function isValueInArray(v, a) {
|
380 |
var l = a.length;
|
381 |
for(var i=0; i < l; i++) {
|
382 |
if(a[i][0] == v) {
|
383 |
-
return true;
|
384 |
}
|
385 |
}
|
386 |
return false;
|
387 |
}
|
388 |
-
|
389 |
function setHeadersCss(table,$headers, list, css) {
|
390 |
// remove all header information
|
391 |
$headers.removeClass(css[0]).removeClass(css[1]);
|
392 |
-
|
393 |
var h = [];
|
394 |
$headers.each(function(offset) {
|
395 |
if(!this.sortDisabled) {
|
396 |
-
h[this.column] = $(this);
|
397 |
}
|
398 |
});
|
399 |
-
|
400 |
-
var l = list.length;
|
401 |
for(var i=0; i < l; i++) {
|
402 |
h[list[i][0]].addClass(css[list[i][1]]);
|
403 |
}
|
404 |
}
|
405 |
-
|
406 |
function fixColumnWidth(table,$headers) {
|
407 |
var c = table.config;
|
408 |
if(c.widthFixed) {
|
@@ -413,7 +413,7 @@
|
|
413 |
$(table).prepend(colgroup);
|
414 |
};
|
415 |
}
|
416 |
-
|
417 |
function updateHeaderSortCount(table,sortList) {
|
418 |
var c = table.config, l = sortList.length;
|
419 |
for(var i=0; i < l; i++) {
|
@@ -422,142 +422,142 @@
|
|
422 |
o.count++;
|
423 |
}
|
424 |
}
|
425 |
-
|
426 |
/* sorting methods */
|
427 |
function multisort(table,sortList,cache) {
|
428 |
-
|
429 |
if(table.config.debug) { var sortTime = new Date(); }
|
430 |
-
|
431 |
var dynamicExp = "var sortWrapper = function(a,b) {", l = sortList.length;
|
432 |
-
|
433 |
for(var i=0; i < l; i++) {
|
434 |
-
|
435 |
var c = sortList[i][0];
|
436 |
var order = sortList[i][1];
|
437 |
var s = (getCachedSortType(table.config.parsers,c) == "text") ? ((order == 0) ? "sortText" : "sortTextDesc") : ((order == 0) ? "sortNumeric" : "sortNumericDesc");
|
438 |
-
|
439 |
var e = "e" + i;
|
440 |
-
|
441 |
dynamicExp += "var " + e + " = " + s + "(a[" + c + "],b[" + c + "]); ";
|
442 |
dynamicExp += "if(" + e + ") { return " + e + "; } ";
|
443 |
dynamicExp += "else { ";
|
444 |
}
|
445 |
-
|
446 |
-
// if value is the same keep orignal order
|
447 |
var orgOrderCol = cache.normalized[0].length - 1;
|
448 |
dynamicExp += "return a[" + orgOrderCol + "]-b[" + orgOrderCol + "];";
|
449 |
-
|
450 |
for(var i=0; i < l; i++) {
|
451 |
dynamicExp += "}; ";
|
452 |
}
|
453 |
-
|
454 |
-
dynamicExp += "return 0; ";
|
455 |
-
dynamicExp += "}; ";
|
456 |
-
|
457 |
eval(dynamicExp);
|
458 |
-
|
459 |
cache.normalized.sort(sortWrapper);
|
460 |
-
|
461 |
if(table.config.debug) { benchmark("Sorting on " + sortList.toString() + " and dir " + order+ " time:", sortTime); }
|
462 |
-
|
463 |
return cache;
|
464 |
};
|
465 |
-
|
466 |
function sortText(a,b) {
|
467 |
return ((a < b) ? -1 : ((a > b) ? 1 : 0));
|
468 |
};
|
469 |
-
|
470 |
function sortTextDesc(a,b) {
|
471 |
return ((b < a) ? -1 : ((b > a) ? 1 : 0));
|
472 |
-
};
|
473 |
-
|
474 |
function sortNumeric(a,b) {
|
475 |
return a-b;
|
476 |
};
|
477 |
-
|
478 |
function sortNumericDesc(a,b) {
|
479 |
return b-a;
|
480 |
};
|
481 |
-
|
482 |
function getCachedSortType(parsers,i) {
|
483 |
return parsers[i].type;
|
484 |
};
|
485 |
-
|
486 |
/* public methods */
|
487 |
this.construct = function(settings) {
|
488 |
|
489 |
return this.each(function() {
|
490 |
-
|
491 |
if(!this.tHead || !this.tBodies) return;
|
492 |
-
|
493 |
var $this, $document,$headers, cache, config, shiftDown = 0, sortOrder;
|
494 |
-
|
495 |
this.config = {};
|
496 |
-
|
497 |
config = $.extend(this.config, $.tablesorter.defaults, settings);
|
498 |
-
|
499 |
-
// store common expression for speed
|
500 |
$this = $(this);
|
501 |
-
|
502 |
// build headers
|
503 |
$headers = buildHeaders(this);
|
504 |
-
|
505 |
// try to auto detect column type, and store in tables config
|
506 |
this.config.parsers = buildParserCache(this,$headers);
|
507 |
-
|
508 |
-
|
509 |
// build the cache for the tbody cells
|
510 |
cache = buildCache(this);
|
511 |
-
|
512 |
// get the css class names, could be done else where.
|
513 |
var sortCSS = [config.cssDesc,config.cssAsc];
|
514 |
-
|
515 |
// fixate columns if the users supplies the fixedWidth option
|
516 |
fixColumnWidth(this);
|
517 |
-
|
518 |
// apply event handling to headers
|
519 |
// this is to big, perhaps break it out?
|
520 |
$headers.click(function(e) {
|
521 |
-
|
522 |
$this.trigger("sortStart");
|
523 |
-
|
524 |
var totalRows = ($this[0].tBodies[0] && $this[0].tBodies[0].rows.length) || 0;
|
525 |
-
|
526 |
if(!this.sortDisabled && totalRows > 0) {
|
527 |
-
|
528 |
-
|
529 |
// store exp, for speed
|
530 |
var $cell = $(this);
|
531 |
-
|
532 |
// get current column index
|
533 |
var i = this.column;
|
534 |
-
|
535 |
// get current column sort order
|
536 |
this.order = this.count++ % 2;
|
537 |
-
|
538 |
// user only whants to sort on one column
|
539 |
if(!e[config.sortMultiSortKey]) {
|
540 |
-
|
541 |
// flush the sort list
|
542 |
config.sortList = [];
|
543 |
-
|
544 |
if(config.sortForce != null) {
|
545 |
-
var a = config.sortForce;
|
546 |
for(var j=0; j < a.length; j++) {
|
547 |
if(a[j][0] != i) {
|
548 |
config.sortList.push(a[j]);
|
549 |
}
|
550 |
}
|
551 |
}
|
552 |
-
|
553 |
// add column to sort list
|
554 |
config.sortList.push([i,this.order]);
|
555 |
-
|
556 |
// multi column sorting
|
557 |
} else {
|
558 |
// the user has clicked on an all ready sortet column.
|
559 |
-
if(isValueInArray(i,config.sortList)) {
|
560 |
-
|
561 |
// revers the sorting direction for all tables.
|
562 |
for(var j=0; j < config.sortList.length; j++) {
|
563 |
var s = config.sortList[j], o = config.headerList[s[0]];
|
@@ -566,7 +566,7 @@
|
|
566 |
o.count++;
|
567 |
s[1] = o.count % 2;
|
568 |
}
|
569 |
-
}
|
570 |
} else {
|
571 |
// add column to sort list array
|
572 |
config.sortList.push([i,this.order]);
|
@@ -580,68 +580,68 @@
|
|
580 |
// stop normal event by returning false
|
581 |
return false;
|
582 |
}
|
583 |
-
// cancel selection
|
584 |
}).mousedown(function() {
|
585 |
if(config.cancelSelection) {
|
586 |
this.onselectstart = function() {return false};
|
587 |
return false;
|
588 |
}
|
589 |
});
|
590 |
-
|
591 |
// apply easy methods that trigger binded events
|
592 |
$this.bind("update",function() {
|
593 |
-
|
594 |
// rebuild parsers.
|
595 |
this.config.parsers = buildParserCache(this,$headers);
|
596 |
-
|
597 |
// rebuild the cache map
|
598 |
cache = buildCache(this);
|
599 |
-
|
600 |
}).bind("sorton",function(e,list) {
|
601 |
-
|
602 |
$(this).trigger("sortStart");
|
603 |
-
|
604 |
config.sortList = list;
|
605 |
-
|
606 |
// update and store the sortlist
|
607 |
var sortList = config.sortList;
|
608 |
-
|
609 |
// update header count index
|
610 |
updateHeaderSortCount(this,sortList);
|
611 |
-
|
612 |
//set css for headers
|
613 |
setHeadersCss(this,$headers,sortList,sortCSS);
|
614 |
-
|
615 |
-
|
616 |
// sort the table and append it to the dom
|
617 |
appendToTable(this,multisort(this,sortList,cache));
|
618 |
|
619 |
}).bind("appendCache",function() {
|
620 |
-
|
621 |
appendToTable(this,cache);
|
622 |
-
|
623 |
}).bind("applyWidgetId",function(e,id) {
|
624 |
-
|
625 |
getWidgetById(id).format(this);
|
626 |
-
|
627 |
}).bind("applyWidgets",function() {
|
628 |
// apply widgets
|
629 |
applyWidget(this);
|
630 |
});
|
631 |
-
|
632 |
if($.metadata && ($(this).metadata() && $(this).metadata().sortlist)) {
|
633 |
config.sortList = $(this).metadata().sortlist;
|
634 |
}
|
635 |
// if user has supplied a sort list to constructor.
|
636 |
if(config.sortList.length > 0) {
|
637 |
-
$this.trigger("sorton",[config.sortList]);
|
638 |
}
|
639 |
-
|
640 |
// apply widgets
|
641 |
applyWidget(this);
|
642 |
});
|
643 |
};
|
644 |
-
|
645 |
this.addParser = function(parser) {
|
646 |
var l = parsers.length, a = true;
|
647 |
for(var i=0; i < l; i++) {
|
@@ -651,11 +651,11 @@
|
|
651 |
}
|
652 |
if(a) { parsers.push(parser); };
|
653 |
};
|
654 |
-
|
655 |
this.addWidget = function(widget) {
|
656 |
widgets.push(widget);
|
657 |
};
|
658 |
-
|
659 |
this.formatFloat = function(s) {
|
660 |
var i = parseFloat(s);
|
661 |
return (isNaN(i)) ? 0 : i;
|
@@ -664,33 +664,26 @@
|
|
664 |
var i = parseInt(s);
|
665 |
return (isNaN(i)) ? 0 : i;
|
666 |
};
|
667 |
-
|
668 |
this.isDigit = function(s,config) {
|
669 |
var DECIMAL = '\\' + config.decimal;
|
670 |
var exp = '/(^[+]?0(' + DECIMAL +'0+)?$)|(^([-+]?[1-9][0-9]*)$)|(^([-+]?((0?|[1-9][0-9]*)' + DECIMAL +'(0*[1-9][0-9]*)))$)|(^[-+]?[1-9]+[0-9]*' + DECIMAL +'0+$)/';
|
671 |
return RegExp(exp).test($.trim(s));
|
672 |
};
|
673 |
-
|
674 |
this.clearTableBody = function(table) {
|
675 |
-
|
676 |
-
function empty() {
|
677 |
-
while ( this.firstChild ) this.removeChild( this.firstChild );
|
678 |
-
}
|
679 |
-
empty.apply(table.tBodies[0]);
|
680 |
-
} else {
|
681 |
-
table.tBodies[0].innerHTML = "";
|
682 |
-
}
|
683 |
};
|
684 |
}
|
685 |
});
|
686 |
-
|
687 |
// extend plugin scope
|
688 |
$.fn.extend({
|
689 |
tablesorter: $.tablesorter.construct
|
690 |
});
|
691 |
-
|
692 |
var ts = $.tablesorter;
|
693 |
-
|
694 |
// add default parsers
|
695 |
ts.addParser({
|
696 |
id: "text",
|
@@ -702,7 +695,7 @@
|
|
702 |
},
|
703 |
type: "text"
|
704 |
});
|
705 |
-
|
706 |
ts.addParser({
|
707 |
id: "digit",
|
708 |
is: function(s,table) {
|
@@ -714,7 +707,7 @@
|
|
714 |
},
|
715 |
type: "numeric"
|
716 |
});
|
717 |
-
|
718 |
ts.addParser({
|
719 |
id: "currency",
|
720 |
is: function(s) {
|
@@ -725,7 +718,7 @@
|
|
725 |
},
|
726 |
type: "numeric"
|
727 |
});
|
728 |
-
|
729 |
ts.addParser({
|
730 |
id: "ipAddress",
|
731 |
is: function(s) {
|
@@ -745,7 +738,7 @@
|
|
745 |
},
|
746 |
type: "numeric"
|
747 |
});
|
748 |
-
|
749 |
ts.addParser({
|
750 |
id: "url",
|
751 |
is: function(s) {
|
@@ -756,7 +749,7 @@
|
|
756 |
},
|
757 |
type: "text"
|
758 |
});
|
759 |
-
|
760 |
ts.addParser({
|
761 |
id: "isoDate",
|
762 |
is: function(s) {
|
@@ -767,10 +760,10 @@
|
|
767 |
},
|
768 |
type: "numeric"
|
769 |
});
|
770 |
-
|
771 |
ts.addParser({
|
772 |
id: "percent",
|
773 |
-
is: function(s) {
|
774 |
return /\%$/.test($.trim(s));
|
775 |
},
|
776 |
format: function(s) {
|
@@ -805,7 +798,7 @@
|
|
805 |
//reformat the string in ISO format
|
806 |
s = s.replace(/(\d{1,2})[\/\-](\d{1,2})[\/\-](\d{4})/, "$3/$2/$1");
|
807 |
} else if(c.dateFormat == "dd/mm/yy" || c.dateFormat == "dd-mm-yy") {
|
808 |
-
s = s.replace(/(\d{1,2})[\/\-](\d{1,2})[\/\-](\d{2})/, "$1/$2/$3");
|
809 |
}
|
810 |
return $.tablesorter.formatFloat(new Date(s).getTime());
|
811 |
},
|
@@ -822,8 +815,8 @@
|
|
822 |
},
|
823 |
type: "numeric"
|
824 |
});
|
825 |
-
|
826 |
-
|
827 |
ts.addParser({
|
828 |
id: "metadata",
|
829 |
is: function(s) {
|
@@ -835,7 +828,7 @@
|
|
835 |
},
|
836 |
type: "numeric"
|
837 |
});
|
838 |
-
|
839 |
// add default widgets
|
840 |
ts.addWidget({
|
841 |
id: "zebra",
|
@@ -848,5 +841,5 @@
|
|
848 |
.removeClass(table.config.widgetZebra.css[0]).addClass(table.config.widgetZebra.css[1]);
|
849 |
if(table.config.debug) { $.tablesorter.benchmark("Applying Zebra widget", time); }
|
850 |
}
|
851 |
-
});
|
852 |
-
})(jQuery);
|
1 |
/*
|
2 |
+
*
|
3 |
* TableSorter 2.0 - Client-side table sorting with ease!
|
4 |
* Version 2.0.3
|
5 |
* @requires jQuery v1.2.3
|
6 |
+
*
|
7 |
* Copyright (c) 2007 Christian Bach
|
8 |
* Examples and docs at: http://tablesorter.com
|
9 |
* Dual licensed under the MIT and GPL licenses:
|
10 |
* http://www.opensource.org/licenses/mit-license.php
|
11 |
* http://www.gnu.org/licenses/gpl.html
|
12 |
+
*
|
13 |
*/
|
14 |
/**
|
15 |
*
|
16 |
* @description Create a sortable table with multi-column sorting capabilitys
|
17 |
+
*
|
18 |
* @example $('table').tablesorter();
|
19 |
* @desc Create a simple tablesorter interface.
|
20 |
*
|
21 |
* @example $('table').tablesorter({ sortList:[[0,0],[1,0]] });
|
22 |
* @desc Create a tablesorter interface and sort on the first and secound column in ascending order.
|
23 |
+
*
|
24 |
* @example $('table').tablesorter({ headers: { 0: { sorter: false}, 1: {sorter: false} } });
|
25 |
* @desc Create a tablesorter interface and disableing the first and secound column headers.
|
26 |
+
*
|
27 |
* @example $('table').tablesorter({ 0: {sorter:"integer"}, 1: {sorter:"currency"} });
|
28 |
* @desc Create a tablesorter interface and set a column parser for the first and secound column.
|
29 |
+
*
|
30 |
+
*
|
31 |
* @param Object settings An object literal containing key/value pairs to provide optional settings.
|
32 |
+
*
|
33 |
+
* @option String cssHeader (optional) A string of the class name to be appended to sortable tr elements in the thead of the table.
|
34 |
* Default value: "header"
|
35 |
+
*
|
36 |
+
* @option String cssAsc (optional) A string of the class name to be appended to sortable tr elements in the thead on a ascending sort.
|
37 |
* Default value: "headerSortUp"
|
38 |
+
*
|
39 |
+
* @option String cssDesc (optional) A string of the class name to be appended to sortable tr elements in the thead on a descending sort.
|
40 |
* Default value: "headerSortDown"
|
41 |
+
*
|
42 |
+
* @option String sortInitialOrder (optional) A string of the inital sorting order can be asc or desc.
|
43 |
* Default value: "asc"
|
44 |
+
*
|
45 |
+
* @option String sortMultisortKey (optional) A string of the multi-column sort key.
|
46 |
* Default value: "shiftKey"
|
47 |
+
*
|
48 |
+
* @option String textExtraction (optional) A string of the text-extraction method to use.
|
49 |
+
* For complex html structures inside td cell set this option to "complex",
|
50 |
+
* on large tables the complex option can be slow.
|
51 |
* Default value: "simple"
|
52 |
+
*
|
53 |
+
* @option Object headers (optional) An array containing the forces sorting rules.
|
54 |
+
* This option let's you specify a default sorting rule.
|
55 |
* Default value: null
|
56 |
+
*
|
57 |
+
* @option Array sortList (optional) An array containing the forces sorting rules.
|
58 |
+
* This option let's you specify a default sorting rule.
|
59 |
* Default value: null
|
60 |
+
*
|
61 |
+
* @option Array sortForce (optional) An array containing forced sorting rules.
|
62 |
* This option let's you specify a default sorting rule, which is prepended to user-selected rules.
|
63 |
* Default value: null
|
64 |
+
*
|
65 |
+
* @option Array sortAppend (optional) An array containing forced sorting rules.
|
66 |
* This option let's you specify a default sorting rule, which is appended to user-selected rules.
|
67 |
* Default value: null
|
68 |
+
*
|
69 |
* @option Boolean widthFixed (optional) Boolean flag indicating if tablesorter should apply fixed widths to the table columns.
|
70 |
* This is usefull when using the pager companion plugin.
|
71 |
* This options requires the dimension jquery plugin.
|
79 |
* @type jQuery
|
80 |
*
|
81 |
* @name tablesorter
|
82 |
+
*
|
83 |
* @cat Plugins/Tablesorter
|
84 |
+
*
|
85 |
* @author Christian Bach/christian.bach@polyester.se
|
86 |
*/
|
87 |
|
88 |
(function($) {
|
89 |
$.extend({
|
90 |
tablesorter: new function() {
|
91 |
+
|
92 |
var parsers = [], widgets = [];
|
93 |
+
|
94 |
this.defaults = {
|
95 |
cssHeader: "header",
|
96 |
cssAsc: "headerSortUp",
|
100 |
sortForce: null,
|
101 |
sortAppend: null,
|
102 |
textExtraction: "simple",
|
103 |
+
parsers: {},
|
104 |
+
widgets: [],
|
105 |
widgetZebra: {css: ["even","odd"]},
|
106 |
headers: {},
|
107 |
widthFixed: false,
|
112 |
decimal: '.',
|
113 |
debug: false
|
114 |
};
|
115 |
+
|
116 |
/* debuging utils */
|
117 |
function benchmark(s,d) {
|
118 |
log(s + "," + (new Date().getTime() - d.getTime()) + "ms");
|
119 |
}
|
120 |
+
|
121 |
this.benchmark = benchmark;
|
122 |
+
|
123 |
function log(s) {
|
124 |
if (typeof console != "undefined" && typeof console.debug != "undefined") {
|
125 |
console.log(s);
|
127 |
alert(s);
|
128 |
}
|
129 |
}
|
130 |
+
|
131 |
/* parsers utils */
|
132 |
function buildParserCache(table,$headers) {
|
133 |
+
|
134 |
if(table.config.debug) { var parsersDebug = ""; }
|
135 |
+
|
136 |
var rows = table.tBodies[0].rows;
|
137 |
+
|
138 |
if(table.tBodies[0].rows[0]) {
|
139 |
|
140 |
var list = [], cells = rows[0].cells, l = cells.length;
|
141 |
+
|
142 |
for (var i=0;i < l; i++) {
|
143 |
var p = false;
|
144 |
+
|
145 |
if($.metadata && ($($headers[i]).metadata() && $($headers[i]).metadata().sorter) ) {
|
146 |
+
|
147 |
+
p = getParserById($($headers[i]).metadata().sorter);
|
148 |
+
|
149 |
} else if((table.config.headers[i] && table.config.headers[i].sorter)) {
|
150 |
+
|
151 |
p = getParserById(table.config.headers[i].sorter);
|
152 |
}
|
153 |
if(!p) {
|
154 |
p = detectParserForColumn(table,cells[i]);
|
155 |
}
|
156 |
+
|
157 |
if(table.config.debug) { parsersDebug += "column:" + i + " parser:" +p.id + "\n"; }
|
158 |
+
|
159 |
list.push(p);
|
160 |
}
|
161 |
}
|
162 |
+
|
163 |
if(table.config.debug) { log(parsersDebug); }
|
164 |
|
165 |
return list;
|
166 |
};
|
167 |
+
|
168 |
function detectParserForColumn(table,node) {
|
169 |
var l = parsers.length;
|
170 |
for(var i=1; i < l; i++) {
|
175 |
// 0 is always the generic parser (text)
|
176 |
return parsers[0];
|
177 |
}
|
178 |
+
|
179 |
function getParserById(name) {
|
180 |
var l = parsers.length;
|
181 |
for(var i=0; i < l; i++) {
|
182 |
+
if(parsers[i].id.toLowerCase() == name.toLowerCase()) {
|
183 |
return parsers[i];
|
184 |
}
|
185 |
}
|
186 |
return false;
|
187 |
}
|
188 |
+
|
189 |
/* utils */
|
190 |
function buildCache(table) {
|
191 |
+
|
192 |
if(table.config.debug) { var cacheTime = new Date(); }
|
193 |
+
|
194 |
+
|
195 |
var totalRows = (table.tBodies[0] && table.tBodies[0].rows.length) || 0,
|
196 |
totalCells = (table.tBodies[0].rows[0] && table.tBodies[0].rows[0].cells.length) || 0,
|
197 |
+
parsers = table.config.parsers,
|
198 |
cache = {row: [], normalized: []};
|
199 |
+
|
200 |
for (var i=0;i < totalRows; ++i) {
|
201 |
+
|
202 |
/** Add the table data to main data array */
|
203 |
var c = table.tBodies[0].rows[i], cols = [];
|
204 |
+
|
205 |
cache.row.push($(c));
|
206 |
+
|
207 |
for(var j=0; j < totalCells; ++j) {
|
208 |
+
cols.push(parsers[j].format(getElementText(table.config,c.cells[j]),table,c.cells[j]));
|
209 |
}
|
210 |
+
|
211 |
cols.push(i); // add position for rowCache
|
212 |
cache.normalized.push(cols);
|
213 |
cols = null;
|
214 |
};
|
215 |
+
|
216 |
if(table.config.debug) { benchmark("Building cache for " + totalRows + " rows:", cacheTime); }
|
217 |
+
|
218 |
return cache;
|
219 |
};
|
220 |
+
|
221 |
function getElementText(config,node) {
|
222 |
+
|
223 |
if(!node) return "";
|
224 |
+
|
225 |
var t = "";
|
226 |
+
|
227 |
if(config.textExtraction == "simple") {
|
228 |
if(node.childNodes[0] && node.childNodes[0].hasChildNodes()) {
|
229 |
t = node.childNodes[0].innerHTML;
|
233 |
} else {
|
234 |
if(typeof(config.textExtraction) == "function") {
|
235 |
t = config.textExtraction(node);
|
236 |
+
} else {
|
237 |
t = $(node).text();
|
238 |
+
}
|
239 |
}
|
240 |
return t;
|
241 |
}
|
242 |
+
|
243 |
function appendToTable(table,cache) {
|
244 |
+
|
245 |
if(table.config.debug) {var appendTime = new Date()}
|
246 |
+
|
247 |
+
var c = cache,
|
248 |
+
r = c.row,
|
249 |
+
n= c.normalized,
|
250 |
+
totalRows = n.length,
|
251 |
+
checkCell = (n[0].length-1),
|
252 |
tableBody = $(table.tBodies[0]),
|
253 |
rows = [];
|
254 |
+
|
255 |
for (var i=0;i < totalRows; i++) {
|
256 |
+
rows.push(r[n[i][checkCell]]);
|
257 |
if(!table.config.appender) {
|
258 |
+
|
259 |
var o = r[n[i][checkCell]];
|
260 |
var l = o.length;
|
261 |
for(var j=0; j < l; j++) {
|
262 |
+
|
263 |
tableBody[0].appendChild(o[j]);
|
264 |
+
|
265 |
}
|
266 |
+
|
267 |
//tableBody.append(r[n[i][checkCell]]);
|
268 |
}
|
269 |
+
}
|
270 |
+
|
271 |
if(table.config.appender) {
|
272 |
+
|
273 |
+
table.config.appender(table,rows);
|
274 |
}
|
275 |
+
|
276 |
rows = null;
|
277 |
+
|
278 |
if(table.config.debug) { benchmark("Rebuilt table:", appendTime); }
|
279 |
+
|
280 |
//apply table widgets
|
281 |
applyWidget(table);
|
282 |
+
|
283 |
// trigger sortend
|
284 |
setTimeout(function() {
|
285 |
+
$(table).trigger("sortEnd");
|
286 |
},0);
|
287 |
+
|
288 |
};
|
289 |
+
|
290 |
function buildHeaders(table) {
|
291 |
+
|
292 |
if(table.config.debug) { var time = new Date(); }
|
293 |
+
|
294 |
var meta = ($.metadata) ? true : false, tableHeadersRows = [];
|
295 |
+
|
296 |
for(var i = 0; i < table.tHead.rows.length; i++) { tableHeadersRows[i]=0; };
|
297 |
+
|
298 |
$tableHeaders = $("thead th",table);
|
299 |
+
|
300 |
$tableHeaders.each(function(index) {
|
301 |
+
|
302 |
this.count = 0;
|
303 |
this.column = index;
|
304 |
this.order = formatSortingOrder(table.config.sortInitialOrder);
|
305 |
+
|
306 |
if(checkHeaderMetadata(this) || checkHeaderOptions(table,index)) this.sortDisabled = true;
|
307 |
+
|
308 |
if(!this.sortDisabled) {
|
309 |
$(this).addClass(table.config.cssHeader);
|
310 |
}
|
311 |
+
|
312 |
// add cell to headerList
|
313 |
table.config.headerList[index]= this;
|
314 |
});
|
315 |
+
|
316 |
if(table.config.debug) { benchmark("Built headers:", time); log($tableHeaders); }
|
317 |
+
|
318 |
return $tableHeaders;
|
319 |
+
|
320 |
};
|
321 |
+
|
322 |
function checkCellColSpan(table, rows, row) {
|
323 |
var arr = [], r = table.tHead.rows, c = r[row].cells;
|
324 |
+
|
325 |
for(var i=0; i < c.length; i++) {
|
326 |
var cell = c[i];
|
327 |
+
|
328 |
+
if ( cell.colSpan > 1) {
|
329 |
arr = arr.concat(checkCellColSpan(table, headerArr,row++));
|
330 |
} else {
|
331 |
if(table.tHead.length == 1 || (cell.rowSpan > 1 || !r[row+1])) {
|
336 |
}
|
337 |
return arr;
|
338 |
};
|
339 |
+
|
340 |
function checkHeaderMetadata(cell) {
|
341 |
if(($.metadata) && ($(cell).metadata().sorter === false)) { return true; };
|
342 |
return false;
|
343 |
}
|
344 |
+
|
345 |
+
function checkHeaderOptions(table,i) {
|
346 |
if((table.config.headers[i]) && (table.config.headers[i].sorter === false)) { return true; };
|
347 |
return false;
|
348 |
}
|
349 |
+
|
350 |
function applyWidget(table) {
|
351 |
var c = table.config.widgets;
|
352 |
var l = c.length;
|
353 |
for(var i=0; i < l; i++) {
|
354 |
+
|
355 |
getWidgetById(c[i]).format(table);
|
356 |
}
|
357 |
+
|
358 |
}
|
359 |
+
|
360 |
function getWidgetById(name) {
|
361 |
var l = widgets.length;
|
362 |
for(var i=0; i < l; i++) {
|
363 |
if(widgets[i].id.toLowerCase() == name.toLowerCase() ) {
|
364 |
+
return widgets[i];
|
365 |
}
|
366 |
}
|
367 |
};
|
368 |
+
|
369 |
function formatSortingOrder(v) {
|
370 |
+
|
371 |
if(typeof(v) != "Number") {
|
372 |
i = (v.toLowerCase() == "desc") ? 1 : 0;
|
373 |
} else {
|
375 |
}
|
376 |
return i;
|
377 |
}
|
378 |
+
|
379 |
function isValueInArray(v, a) {
|
380 |
var l = a.length;
|
381 |
for(var i=0; i < l; i++) {
|
382 |
if(a[i][0] == v) {
|
383 |
+
return true;
|
384 |
}
|
385 |
}
|
386 |
return false;
|
387 |
}
|
388 |
+
|
389 |
function setHeadersCss(table,$headers, list, css) {
|
390 |
// remove all header information
|
391 |
$headers.removeClass(css[0]).removeClass(css[1]);
|
392 |
+
|
393 |
var h = [];
|
394 |
$headers.each(function(offset) {
|
395 |
if(!this.sortDisabled) {
|
396 |
+
h[this.column] = $(this);
|
397 |
}
|
398 |
});
|
399 |
+
|
400 |
+
var l = list.length;
|
401 |
for(var i=0; i < l; i++) {
|
402 |
h[list[i][0]].addClass(css[list[i][1]]);
|
403 |
}
|
404 |
}
|
405 |
+
|
406 |
function fixColumnWidth(table,$headers) {
|
407 |
var c = table.config;
|
408 |
if(c.widthFixed) {
|
413 |
$(table).prepend(colgroup);
|
414 |
};
|
415 |
}
|
416 |
+
|
417 |
function updateHeaderSortCount(table,sortList) {
|
418 |
var c = table.config, l = sortList.length;
|
419 |
for(var i=0; i < l; i++) {
|
422 |
o.count++;
|
423 |
}
|
424 |
}
|
425 |
+
|
426 |
/* sorting methods */
|
427 |
function multisort(table,sortList,cache) {
|
428 |
+
|
429 |
if(table.config.debug) { var sortTime = new Date(); }
|
430 |
+
|
431 |
var dynamicExp = "var sortWrapper = function(a,b) {", l = sortList.length;
|
432 |
+
|
433 |
for(var i=0; i < l; i++) {
|
434 |
+
|
435 |
var c = sortList[i][0];
|
436 |
var order = sortList[i][1];
|
437 |
var s = (getCachedSortType(table.config.parsers,c) == "text") ? ((order == 0) ? "sortText" : "sortTextDesc") : ((order == 0) ? "sortNumeric" : "sortNumericDesc");
|
438 |
+
|
439 |
var e = "e" + i;
|
440 |
+
|
441 |
dynamicExp += "var " + e + " = " + s + "(a[" + c + "],b[" + c + "]); ";
|
442 |
dynamicExp += "if(" + e + ") { return " + e + "; } ";
|
443 |
dynamicExp += "else { ";
|
444 |
}
|
445 |
+
|
446 |
+
// if value is the same keep orignal order
|
447 |
var orgOrderCol = cache.normalized[0].length - 1;
|
448 |
dynamicExp += "return a[" + orgOrderCol + "]-b[" + orgOrderCol + "];";
|
449 |
+
|
450 |
for(var i=0; i < l; i++) {
|
451 |
dynamicExp += "}; ";
|
452 |
}
|
453 |
+
|
454 |
+
dynamicExp += "return 0; ";
|
455 |
+
dynamicExp += "}; ";
|
456 |
+
|
457 |
eval(dynamicExp);
|
458 |
+
|
459 |
cache.normalized.sort(sortWrapper);
|
460 |
+
|
461 |
if(table.config.debug) { benchmark("Sorting on " + sortList.toString() + " and dir " + order+ " time:", sortTime); }
|
462 |
+
|
463 |
return cache;
|
464 |
};
|
465 |
+
|
466 |
function sortText(a,b) {
|
467 |
return ((a < b) ? -1 : ((a > b) ? 1 : 0));
|
468 |
};
|
469 |
+
|
470 |
function sortTextDesc(a,b) {
|
471 |
return ((b < a) ? -1 : ((b > a) ? 1 : 0));
|
472 |
+
};
|
473 |
+
|
474 |
function sortNumeric(a,b) {
|
475 |
return a-b;
|
476 |
};
|
477 |
+
|
478 |
function sortNumericDesc(a,b) {
|
479 |
return b-a;
|
480 |
};
|
481 |
+
|
482 |
function getCachedSortType(parsers,i) {
|
483 |
return parsers[i].type;
|
484 |
};
|
485 |
+
|
486 |
/* public methods */
|
487 |
this.construct = function(settings) {
|
488 |
|
489 |
return this.each(function() {
|
490 |
+
|
491 |
if(!this.tHead || !this.tBodies) return;
|
492 |
+
|
493 |
var $this, $document,$headers, cache, config, shiftDown = 0, sortOrder;
|
494 |
+
|
495 |
this.config = {};
|
496 |
+
|
497 |
config = $.extend(this.config, $.tablesorter.defaults, settings);
|
498 |
+
|
499 |
+
// store common expression for speed
|
500 |
$this = $(this);
|
501 |
+
|
502 |
// build headers
|
503 |
$headers = buildHeaders(this);
|
504 |
+
|
505 |
// try to auto detect column type, and store in tables config
|
506 |
this.config.parsers = buildParserCache(this,$headers);
|
507 |
+
|
508 |
+
|
509 |
// build the cache for the tbody cells
|
510 |
cache = buildCache(this);
|
511 |
+
|
512 |
// get the css class names, could be done else where.
|
513 |
var sortCSS = [config.cssDesc,config.cssAsc];
|
514 |
+
|
515 |
// fixate columns if the users supplies the fixedWidth option
|
516 |
fixColumnWidth(this);
|
517 |
+
|
518 |
// apply event handling to headers
|
519 |
// this is to big, perhaps break it out?
|
520 |
$headers.click(function(e) {
|
521 |
+
|
522 |
$this.trigger("sortStart");
|
523 |
+
|
524 |
var totalRows = ($this[0].tBodies[0] && $this[0].tBodies[0].rows.length) || 0;
|
525 |
+
|
526 |
if(!this.sortDisabled && totalRows > 0) {
|
527 |
+
|
528 |
+
|
529 |
// store exp, for speed
|
530 |
var $cell = $(this);
|
531 |
+
|
532 |
// get current column index
|
533 |
var i = this.column;
|
534 |
+
|
535 |
// get current column sort order
|
536 |
this.order = this.count++ % 2;
|
537 |
+
|
538 |
// user only whants to sort on one column
|
539 |
if(!e[config.sortMultiSortKey]) {
|
540 |
+
|
541 |
// flush the sort list
|
542 |
config.sortList = [];
|
543 |
+
|
544 |
if(config.sortForce != null) {
|
545 |
+
var a = config.sortForce;
|
546 |
for(var j=0; j < a.length; j++) {
|
547 |
if(a[j][0] != i) {
|
548 |
config.sortList.push(a[j]);
|
549 |
}
|
550 |
}
|
551 |
}
|
552 |
+
|
553 |
// add column to sort list
|
554 |
config.sortList.push([i,this.order]);
|
555 |
+
|
556 |
// multi column sorting
|
557 |
} else {
|
558 |
// the user has clicked on an all ready sortet column.
|
559 |
+
if(isValueInArray(i,config.sortList)) {
|
560 |
+
|
561 |
// revers the sorting direction for all tables.
|
562 |
for(var j=0; j < config.sortList.length; j++) {
|
563 |
var s = config.sortList[j], o = config.headerList[s[0]];
|
566 |
o.count++;
|
567 |
s[1] = o.count % 2;
|
568 |
}
|
569 |
+
}
|
570 |
} else {
|
571 |
// add column to sort list array
|
572 |
config.sortList.push([i,this.order]);
|
580 |
// stop normal event by returning false
|
581 |
return false;
|
582 |
}
|
583 |
+
// cancel selection
|
584 |
}).mousedown(function() {
|
585 |
if(config.cancelSelection) {
|
586 |
this.onselectstart = function() {return false};
|
587 |
return false;
|
588 |
}
|
589 |
});
|
590 |
+
|
591 |
// apply easy methods that trigger binded events
|
592 |
$this.bind("update",function() {
|
593 |
+
|
594 |
// rebuild parsers.
|
595 |
this.config.parsers = buildParserCache(this,$headers);
|
596 |
+
|
597 |
// rebuild the cache map
|
598 |
cache = buildCache(this);
|
599 |
+
|
600 |
}).bind("sorton",function(e,list) {
|
601 |
+
|
602 |
$(this).trigger("sortStart");
|
603 |
+
|
604 |
config.sortList = list;
|
605 |
+
|
606 |
// update and store the sortlist
|
607 |
var sortList = config.sortList;
|
608 |
+
|
609 |
// update header count index
|
610 |
updateHeaderSortCount(this,sortList);
|
611 |
+
|
612 |
//set css for headers
|
613 |
setHeadersCss(this,$headers,sortList,sortCSS);
|
614 |
+
|
615 |
+
|
616 |
// sort the table and append it to the dom
|
617 |
appendToTable(this,multisort(this,sortList,cache));
|
618 |
|
619 |
}).bind("appendCache",function() {
|
620 |
+
|
621 |
appendToTable(this,cache);
|
622 |
+
|
623 |
}).bind("applyWidgetId",function(e,id) {
|
624 |
+
|
625 |
getWidgetById(id).format(this);
|
626 |
+
|
627 |
}).bind("applyWidgets",function() {
|
628 |
// apply widgets
|
629 |
applyWidget(this);
|
630 |
});
|
631 |
+
|
632 |
if($.metadata && ($(this).metadata() && $(this).metadata().sortlist)) {
|
633 |
config.sortList = $(this).metadata().sortlist;
|
634 |
}
|
635 |
// if user has supplied a sort list to constructor.
|
636 |
if(config.sortList.length > 0) {
|
637 |
+
$this.trigger("sorton",[config.sortList]);
|
638 |
}
|
639 |
+
|
640 |
// apply widgets
|
641 |
applyWidget(this);
|
642 |
});
|
643 |
};
|
644 |
+
|
645 |
this.addParser = function(parser) {
|
646 |
var l = parsers.length, a = true;
|
647 |
for(var i=0; i < l; i++) {
|
651 |
}
|
652 |
if(a) { parsers.push(parser); };
|
653 |
};
|
654 |
+
|
655 |
this.addWidget = function(widget) {
|
656 |
widgets.push(widget);
|
657 |
};
|
658 |
+
|
659 |
this.formatFloat = function(s) {
|
660 |
var i = parseFloat(s);
|
661 |
return (isNaN(i)) ? 0 : i;
|
664 |
var i = parseInt(s);
|
665 |
return (isNaN(i)) ? 0 : i;
|
666 |
};
|
667 |
+
|
668 |
this.isDigit = function(s,config) {
|
669 |
var DECIMAL = '\\' + config.decimal;
|
670 |
var exp = '/(^[+]?0(' + DECIMAL +'0+)?$)|(^([-+]?[1-9][0-9]*)$)|(^([-+]?((0?|[1-9][0-9]*)' + DECIMAL +'(0*[1-9][0-9]*)))$)|(^[-+]?[1-9]+[0-9]*' + DECIMAL +'0+$)/';
|
671 |
return RegExp(exp).test($.trim(s));
|
672 |
};
|
673 |
+
|
674 |
this.clearTableBody = function(table) {
|
675 |
+
table.tBodies[0].innerHTML = "";
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
676 |
};
|
677 |
}
|
678 |
});
|
679 |
+
|
680 |
// extend plugin scope
|
681 |
$.fn.extend({
|
682 |
tablesorter: $.tablesorter.construct
|
683 |
});
|
684 |
+
|
685 |
var ts = $.tablesorter;
|
686 |
+
|
687 |
// add default parsers
|
688 |
ts.addParser({
|
689 |
id: "text",
|
695 |
},
|
696 |
type: "text"
|
697 |
});
|
698 |
+
|
699 |
ts.addParser({
|
700 |
id: "digit",
|
701 |
is: function(s,table) {
|
707 |
},
|
708 |
type: "numeric"
|
709 |
});
|
710 |
+
|
711 |
ts.addParser({
|
712 |
id: "currency",
|
713 |
is: function(s) {
|
718 |
},
|
719 |
type: "numeric"
|
720 |
});
|
721 |
+
|
722 |
ts.addParser({
|
723 |
id: "ipAddress",
|
724 |
is: function(s) {
|
738 |
},
|
739 |
type: "numeric"
|
740 |
});
|
741 |
+
|
742 |
ts.addParser({
|
743 |
id: "url",
|
744 |
is: function(s) {
|
749 |
},
|
750 |
type: "text"
|
751 |
});
|
752 |
+
|
753 |
ts.addParser({
|
754 |
id: "isoDate",
|
755 |
is: function(s) {
|
760 |
},
|
761 |
type: "numeric"
|
762 |
});
|
763 |
+
|
764 |
ts.addParser({
|
765 |
id: "percent",
|
766 |
+
is: function(s) {
|
767 |
return /\%$/.test($.trim(s));
|
768 |
},
|
769 |
format: function(s) {
|
798 |
//reformat the string in ISO format
|
799 |
s = s.replace(/(\d{1,2})[\/\-](\d{1,2})[\/\-](\d{4})/, "$3/$2/$1");
|
800 |
} else if(c.dateFormat == "dd/mm/yy" || c.dateFormat == "dd-mm-yy") {
|
801 |
+
s = s.replace(/(\d{1,2})[\/\-](\d{1,2})[\/\-](\d{2})/, "$1/$2/$3");
|
802 |
}
|
803 |
return $.tablesorter.formatFloat(new Date(s).getTime());
|
804 |
},
|
815 |
},
|
816 |
type: "numeric"
|
817 |
});
|
818 |
+
|
819 |
+
|
820 |
ts.addParser({
|
821 |
id: "metadata",
|
822 |
is: function(s) {
|
828 |
},
|
829 |
type: "numeric"
|
830 |
});
|
831 |
+
|
832 |
// add default widgets
|
833 |
ts.addWidget({
|
834 |
id: "zebra",
|
841 |
.removeClass(table.config.widgetZebra.css[0]).addClass(table.config.widgetZebra.css[1]);
|
842 |
if(table.config.debug) { $.tablesorter.benchmark("Applying Zebra widget", time); }
|
843 |
}
|
844 |
+
});
|
845 |
+
})(jQuery);
|
admin/js/plupload/Moxie.swf
CHANGED
Binary file
|
admin/js/plupload/Moxie.xap
CHANGED
Binary file
|
admin/js/plupload/i18n/ar.js
CHANGED
@@ -1,2 +1,2 @@
|
|
1 |
// Arabic (ar)
|
2 |
-
plupload.addI18n({"Stop Upload":"أيقاف التحميل","Upload URL might be wrong or doesn't exist.":"عنوان التحميل ربما يكون خاطئ أو غير متوفر","tb":"تيرابايت","Size":"الحجم","Close":"أغلاق","Init error.":"خطأ في تهيئة","Add files to the upload queue and click the start button.":"أضف ملفات إلى القائمة إنتظار التحميل ثم أضغط على زر البداية","Filename":"أسم الملف","Image format either wrong or not supported.":"صيغة الصورة أما خطاء أو غير مدعومه","Status":"الحالة","HTTP Error.":"خطأ في برتوكول نقل الملفات","Start Upload":"أبدا التحميل","
|
1 |
// Arabic (ar)
|
2 |
+
plupload.addI18n({"Stop Upload":"أيقاف التحميل","Upload URL might be wrong or doesn't exist.":"عنوان التحميل ربما يكون خاطئ أو غير متوفر","tb":"تيرابايت","Size":"الحجم","Close":"أغلاق","You must specify either browse_button or drop_element.":"","Init error.":"خطأ في تهيئة","Add files to the upload queue and click the start button.":"أضف ملفات إلى القائمة إنتظار التحميل ثم أضغط على زر البداية","List":"","Filename":"أسم الملف","%s specified, but cannot be found.":"","Image format either wrong or not supported.":"صيغة الصورة أما خطاء أو غير مدعومه","Status":"الحالة","HTTP Error.":"خطأ في برتوكول نقل الملفات","Start Upload":"أبدا التحميل","Error: File too large:":" خطاء : حجم الملف كبير :","kb":"كيلوبايت","Duplicate file error.":"خطاء في تكرار الملف","File size error.":"خطأ في حجم الملف","N/A":"لا شي","gb":"جيجابايت","Error: Invalid file extension:":"خطاء : أمتداد الملف غير صالح :","Select files":"أختر الملفات","%s already present in the queue.":"%s الملف موجود بالفعل في قائمة الانتظار","Resoultion out of boundaries! <b>%s</b> runtime supports images only up to %wx%hpx.":"","File: %s":"ملف: %s","b":"بايت","Uploaded %d/%d files":"تحميل %d/%d ملف","Upload element accepts only %d file(s) at a time. Extra files were stripped.":"العناصر المقبوله لتحميل هي %d ملف في هذا الوقت. الملفات الاضافية أزيلة.","%d files queued":"%d الملفات في قائمة الانتظار","File: %s, size: %d, max file size: %d":"ملف: %s, أقصى حجم للملف: %d, حجم: %d","Thumbnails":"","Drag files here.":"سحب الملف هنا","Runtime ran out of available memory.":"الذاكرة المتوفره أنتهت لمدة التشغيل","File count error.":"خطاء في عد الملفات","File extension error.":"خطأ في أمتداد الملف","mb":"ميجابايت","Add Files":"أضف ملفات"});
|
admin/js/plupload/i18n/az.js
ADDED
@@ -0,0 +1,2 @@
|
|
|
|
|
1 |
+
// Azerbaijani (az)
|
2 |
+
plupload.addI18n({"Stop Upload":"Yükləməni saxla","Upload URL might be wrong or doesn't exist.":"Yükləmə ünvanı səhvdir və ya mövcud deyil","tb":"tb","Size":"Həcm","Close":"Bağla","You must specify either browse_button or drop_element.":"","Init error.":"Init error.","Add files to the upload queue and click the start button.":"Faylları əlavə edin və yüklə düyməsinə klikləyin.","List":"","Filename":"Faylın adı","%s specified, but cannot be found.":"","Image format either wrong or not supported.":"Şəklin formatı uyğun deyil və ya dəstəklənmir.","Status":"Status","HTTP Error.":"HTTP xətası.","Start Upload":"Yüklə","Error: File too large:":"Xəta:Fayl həcmi çox böyükdür.","kb":"kb","Duplicate file error.":"Bu fayl artıq növbədə var.","File size error.":"Fayl həcmi xətası.","N/A":"N/A","gb":"gb","Error: Invalid file extension:":"Xəta: Yanlış fayl uzantısı:","Select files":"Faylları seçin","%s already present in the queue.":"%s artıq növbədə var.","Resoultion out of boundaries! <b>%s</b> runtime supports images only up to %wx%hpx.":"","File: %s":"Fayl: %s","b":"b","Uploaded %d/%d files":"%d/%d fayl yüklənib","Upload element accepts only %d file(s) at a time. Extra files were stripped.":"Upload element accepts only %d file(s) at a time. Extra files were stripped.","%d files queued":"Növbədə %d fayl var","File: %s, size: %d, max file size: %d":"Fayl: %s, həcm: %d, max fayl həcmi: %d","Thumbnails":"","Drag files here.":"Faylları bura çəkin.","Runtime ran out of available memory.":"Runtime ran out of available memory.","File count error.":"Fayl sayı çox böyükdür.","File extension error.":"Fayl uzantısı xətası.","mb":"mb","Add Files":"Fayl əlavə et"});
|
admin/js/plupload/i18n/bg.js
ADDED
@@ -0,0 +1,2 @@
|
|
|
|
|
1 |
+
// Bulgarian (bg)
|
2 |
+
plupload.addI18n({"Stop Upload":"Спрете качването","Upload URL might be wrong or doesn't exist.":"URL за качване може да е грешен или да не съществува.","tb":"tb","Size":"Размер","Close":"Затвори","You must specify either browse_button or drop_element.":"","Init error.":"Грешка: инициализиране.","Add files to the upload queue and click the start button.":"Добавете файлове в опашката за качване, и щракнете бутона старт.","List":"","Filename":"Име на файла","%s specified, but cannot be found.":"","Image format either wrong or not supported.":"Формата на изображението или е объркан, или не се поддържа.","Status":"Статус","HTTP Error.":"Грешка: HTTP .","Start Upload":"Започнете качването","Error: File too large:":"Грешка: Файла е твърде голям:","kb":"kb","Duplicate file error.":"Грешка: файла е вече качен на сървъра.","File size error.":"Грешка: размер на файла.","N/A":"не приложимо","gb":"gb","Error: Invalid file extension:":"Грешка: Невалидно разширение на файл:","Select files":"Изберете файлове","%s already present in the queue.":"%s вече го има в опашката.","Resoultion out of boundaries! <b>%s</b> runtime supports images only up to %wx%hpx.":"","File: %s":"Файл: %s","b":"b","Uploaded %d/%d files":"Качени %d/%d файла","Upload element accepts only %d file(s) at a time. Extra files were stripped.":"Елемента за качване приема само %d файл(а) наведнъж. Допълнителните файлове бяха отстранени.","%d files queued":"%d файла в опашката","File: %s, size: %d, max file size: %d":"Файл: %s, размер: %d, максимален размер: %d","Thumbnails":"","Drag files here.":"Довлечете файловете тук.","Runtime ran out of available memory.":"Недостатъчна свободна памет.","File count error.":"Грешка в броя на файловете.","File extension error.":"Грешка: разширение на файла.","mb":"mb","Add Files":"Добавете файлове"});
|
admin/js/plupload/i18n/bs.js
CHANGED
@@ -1,2 +1,2 @@
|
|
1 |
// Bosnian (bs)
|
2 |
-
plupload.addI18n({"Stop Upload":"Prekini dodavanje","Upload URL might be wrong or doesn't exist.":"URL za dodavanje je neispravan ili ne postoji.","tb":"tb","Size":"Veličina","Close":"Zatvori","Init error.":"Inicijalizacijska greška.","Add files to the upload queue and click the start button.":"Dodajte datoteke u red i kliknite na dugme za pokretanje.","Filename":"Naziv datoteke","Image format either wrong or not supported.":"Format slike je neispravan ili nije podržan.","Status":"Status","HTTP Error.":"HTTP greška.","Start Upload":"Započni dodavanje","
|
1 |
// Bosnian (bs)
|
2 |
+
plupload.addI18n({"Stop Upload":"Prekini dodavanje","Upload URL might be wrong or doesn't exist.":"URL za dodavanje je neispravan ili ne postoji.","tb":"tb","Size":"Veličina","Close":"Zatvori","You must specify either browse_button or drop_element.":"","Init error.":"Inicijalizacijska greška.","Add files to the upload queue and click the start button.":"Dodajte datoteke u red i kliknite na dugme za pokretanje.","List":"","Filename":"Naziv datoteke","%s specified, but cannot be found.":"","Image format either wrong or not supported.":"Format slike je neispravan ili nije podržan.","Status":"Status","HTTP Error.":"HTTP greška.","Start Upload":"Započni dodavanje","Error: File too large:":"Greška! Datoteka je prevelika:","kb":"kb","Duplicate file error.":"Dupla datoteka.","File size error.":"Greška u veličini datoteke.","N/A":"N/A","gb":"gb","Error: Invalid file extension:":"Greška! Neispravan ekstenzija datoteke:","Select files":"Odaberite datoteke","%s already present in the queue.":"%s se već nalazi u redu.","Resoultion out of boundaries! <b>%s</b> runtime supports images only up to %wx%hpx.":"","File: %s":"Datoteka: %s","b":"b","Uploaded %d/%d files":"Dodano %d/%d datoteka","Upload element accepts only %d file(s) at a time. Extra files were stripped.":"Dodavanje trenutno dozvoljava samo %d datoteka istovremeno. Dodatne datoteke su uklonjene.","%d files queued":"%d datoteka čeka","File: %s, size: %d, max file size: %d":"Datoteka: %s, veličina: %d, maksimalna veličina: %d","Thumbnails":"","Drag files here.":"Dovucite datoteke ovdje.","Runtime ran out of available memory.":"Nema više dostupne memorije.","File count error.":"Greška u brojanju datoeka.","File extension error.":"Greška u ekstenziji datoteke.","mb":"mb","Add Files":"Dodaj datoteke"});
|
admin/js/plupload/i18n/ca.js
CHANGED
@@ -1,2 +1,2 @@
|
|
1 |
// Catalan (ca)
|
2 |
-
plupload.addI18n({"Stop Upload":"","Upload URL might be wrong or doesn't exist.":"","tb":"","Size":"","Close":"","Init error.":"","Add files to the upload queue and click the start button.":"","Filename":"","Image format either wrong or not supported.":"","Status":"","HTTP Error.":"","Start Upload":"","
|
1 |
// Catalan (ca)
|
2 |
+
plupload.addI18n({"Stop Upload":"Parar pujada","Upload URL might be wrong or doesn't exist.":"La URL de càrrega no és correcte o bé no existeix.","tb":"Tb","Size":"Tamany","Close":"Tancar","You must specify either browse_button or drop_element.":"Has d'especificar o bé el botó de selecció de fitxers `browse_button` o bé l'àrea per arrosegar els fitxers `drop_element`.","Init error.":"Error d´inicialització.","Add files to the upload queue and click the start button.":"Afegeixi els fitxers a la cua de pujada i cliqui el botó Iniciar","List":"Llistat","Filename":"Nom de fitxer","%s specified, but cannot be found.":"%s especificat, però no es pot trobar.","Image format either wrong or not supported.":"Format d'imatge incorrecte o no suportat.","Status":"Estat","HTTP Error.":"Error HTTP.","Start Upload":"Començar pujada","Error: File too large:":"Error: Fitxer massa gran:","kb":"Kb","Duplicate file error.":"Error per duplicitat de fitxer.","File size error.":"Error en la mida del fitxer.","N/A":"N/D","gb":"Gb","Error: Invalid file extension:":"Error: Extensió de fitxer no vàlida:","Select files":"Seleccionar fitxers","%s already present in the queue.":"%s ja existeix a la cua.","Resoultion out of boundaries! <b>%s</b> runtime supports images only up to %wx%hpx.":"Resolució de la imatge massa gran! El pujador <b>%s</b> suporta mides d'imatge fins a %wx%hpx.","File: %s":"Fitxer: %s","b":"b","Uploaded %d/%d files":"Pujats %d/%d fitxers","Upload element accepts only %d file(s) at a time. Extra files were stripped.":"La càrrega d'elements tan sols accepta %d fitxer(s) alhora. Els fitxers sobrants seran descartats.","%d files queued":"%d fitxers en cua","File: %s, size: %d, max file size: %d":"Fitxer: %s, mida: %d, mida màxima de fitxer: %d","Thumbnails":"Miniatures","Drag files here.":"Arrossegui fitxers aquí","Runtime ran out of available memory.":"L'execució ha arribat al límit de memòria.","File count error.":"Error en el recompte de fitxers","File extension error.":"Error en l´extensió del fitxer.","mb":"Mb","Add Files":"Afegir fitxers"});
|
admin/js/plupload/i18n/cs.js
CHANGED
@@ -1,2 +1,2 @@
|
|
1 |
// Czech (cs)
|
2 |
-
plupload.addI18n({"Stop Upload":"
|
1 |
// Czech (cs)
|
2 |
+
plupload.addI18n({"Stop Upload":"Zastavit nahrávání","Upload URL might be wrong or doesn't exist.":"URL uploadu je možná špatně, nebo neexistuje.","tb":"tb","Size":"Velikost","Close":"Zavřít","You must specify either browse_button or drop_element.":"Musíte specifikovat browse_button či drop_element.","Init error.":"Chyba inicializace.","Add files to the upload queue and click the start button.":"Přidejte soubory do fronty a pak spusťte nahrávání.","List":"Seznam","Filename":"Název souboru","%s specified, but cannot be found.":"%s bylo specifikováno, ale nebylo nalezeno.","Image format either wrong or not supported.":"Špatný, nebo nepodporovaný formát obrázku.","Status":"Stav","HTTP Error.":"Chyba HTTP.","Start Upload":"Spustit nahrávání","Error: File too large:":"Chyba: Soubor je příliš veliký:","kb":"kb","Duplicate file error.":"Chyba - duplikovaný soubor.","File size error.":"Chyba velikosti souboru.","N/A":"N/A","gb":"gb","Error: Invalid file extension:":"Chyba: Neplatná koncovka souboru:","Select files":"Vyberte soubory","%s already present in the queue.":"%s je již zařazen ve frontě.","Resoultion out of boundaries! <b>%s</b> runtime supports images only up to %wx%hpx.":"Rozlišení je mimo rozmezí! <b>%s</b> runtime podporuje obrázky pouze do %wx%hpx.","File: %s":"Soubor: %s","b":"b","Uploaded %d/%d files":"Nahráno %d/%d souborů","Upload element accepts only %d file(s) at a time. Extra files were stripped.":"Upload akceptuje pouze %d soubor(ů) najednou. Další soubory byly odstraněny.","%d files queued":"%d souborů ve frontě","File: %s, size: %d, max file size: %d":"Soubor: %s, velikost: %d, maximální velikost souboru: %d","Thumbnails":"Náhledy","Drag files here.":"Sem přetáhněte soubory.","Runtime ran out of available memory.":"Běh skriptu přesáhl dostupnou paměť.","File count error.":"Chyba v počtu souborů.","File extension error.":"Chyba přípony souboru.","mb":"mb","Add Files":"Přidat soubory"});
|
admin/js/plupload/i18n/cy.js
CHANGED
@@ -1,2 +1,2 @@
|
|
1 |
// Welsh (cy)
|
2 |
-
plupload.addI18n({"Stop Upload":"Atal Lanlwytho","Upload URL might be wrong or doesn't exist.":"URL y lanlwythiad ynb anghywir neu ddim yn bodoli.","tb":"tb","Size":"Maint","Close":"Cau","Init error.":"Gwall cych.","Add files to the upload queue and click the start button.":"Ychwanegwch ffeiliau i'r ciw lanlwytho a chlicio'r botwm dechrau.","Filename":"Enw'r ffeil","Image format either wrong or not supported.":"Fformat delwedd yn anghywir neu heb ei gynnal.","Status":"Statws","HTTP Error.":"Gwall HTTP.","Start Upload":"Dechrau Lanlwytho","
|
1 |
// Welsh (cy)
|
2 |
+
plupload.addI18n({"Stop Upload":"Atal Lanlwytho","Upload URL might be wrong or doesn't exist.":"URL y lanlwythiad ynb anghywir neu ddim yn bodoli.","tb":"tb","Size":"Maint","Close":"Cau","You must specify either browse_button or drop_element.":"","Init error.":"Gwall cych.","Add files to the upload queue and click the start button.":"Ychwanegwch ffeiliau i'r ciw lanlwytho a chlicio'r botwm dechrau.","List":"","Filename":"Enw'r ffeil","%s specified, but cannot be found.":"","Image format either wrong or not supported.":"Fformat delwedd yn anghywir neu heb ei gynnal.","Status":"Statws","HTTP Error.":"Gwall HTTP.","Start Upload":"Dechrau Lanlwytho","Error: File too large:":"Gwall: Ffeil yn rhy fawr:","kb":"kb","Duplicate file error.":"Gwall ffeil ddyblyg.","File size error.":"Gwall maint ffeil.","N/A":"Dd/A","gb":"gb","Error: Invalid file extension:":"Gwall: estyniad ffeil annilys:","Select files":"Dewis ffeiliau","%s already present in the queue.":"%s yn y ciw yn barod.","Resoultion out of boundaries! <b>%s</b> runtime supports images only up to %wx%hpx.":"","File: %s":"Ffeil: %s","b":"b","Uploaded %d/%d files":"Lanlwythwyd %d/%d ffeil","Upload element accepts only %d file(s) at a time. Extra files were stripped.":"Mae'r elfen lanlwytho yn derbyn %d ffeil ar y tro. Caiff ffeiliau ychwanegol eu tynnu.","%d files queued":"%d ffeil mewn ciw","File: %s, size: %d, max file size: %d":"Ffeil: %s, maint: %d, maint mwyaf ffeil: %d","Thumbnails":"","Drag files here.":"Llusgwch ffeiliau yma.","Runtime ran out of available memory.":"Allan o gof.","File count error.":"Gwall cyfri ffeiliau.","File extension error.":"Gwall estyniad ffeil.","mb":"mb","Add Files":"Ychwanegu Ffeiliau"});
|
admin/js/plupload/i18n/da.js
CHANGED
@@ -1,2 +1,2 @@
|
|
1 |
// Danish (da)
|
2 |
-
plupload.addI18n({"Stop Upload":"Stop
|
1 |
// Danish (da)
|
2 |
+
plupload.addI18n({"Stop Upload":"Stop upload","Upload URL might be wrong or doesn't exist.":"Upload URL kan være forkert eller ikke eksisterende.","tb":"tb","Size":"Størrelse","Close":"Luk","You must specify either browse_button or drop_element.":"","Init error.":"Opstarts fejl.","Add files to the upload queue and click the start button.":"Tilføj filer til køen og klik Start upload knappen.","List":"","Filename":"Filnavn","%s specified, but cannot be found.":"","Image format either wrong or not supported.":"Billede format er enten forkert eller ikke understøttet.","Status":"Status","HTTP Error.":"HTTP fejl.","Start Upload":"Start upload","Error: File too large:":"Fejl: Filen er for stor:","kb":"kb","Duplicate file error.":"Filen findes allerede.","File size error.":"Filstørrelse fejl.","N/A":"N/A","gb":"gb","Error: Invalid file extension:":"Fejl: Ugyldigt fil format:","Select files":"Vælg filer","%s already present in the queue.":"%s findes allerede i køen.","Resoultion out of boundaries! <b>%s</b> runtime supports images only up to %wx%hpx.":"","File: %s":"Fil: %s","b":"b","Uploaded %d/%d files":"Uploaded %d/%d filer","Upload element accepts only %d file(s) at a time. Extra files were stripped.":"Upload accepterer kun %d fil(er) af gangen. Ekstra filer blev skippet.","%d files queued":"%d filer i kø","File: %s, size: %d, max file size: %d":"Fil: %s, størrelse: %d, maks. filstørrelse: %d","Thumbnails":"","Drag files here.":"Træk filer her.","Runtime ran out of available memory.":"Runtime mangler tilgængelige hukommelse.","File count error.":"Fil antal fejl.","File extension error.":"Fil format fejl.","mb":"mb","Add Files":"Tilføj filer"});
|
admin/js/plupload/i18n/de.js
CHANGED
@@ -1,2 +1,2 @@
|
|
1 |
// German (de)
|
2 |
-
plupload.addI18n({"Stop Upload":"Hochladen
|
1 |
// German (de)
|
2 |
+
plupload.addI18n({"Stop Upload":"Hochladen abbrechen","Upload URL might be wrong or doesn't exist.":"Upload-URL ist falsch oder existiert nicht.","tb":"TB","Size":"Größe","Close":"Schließen","You must specify either browse_button or drop_element.":"","Init error.":"Initialisierungsfehler","Add files to the upload queue and click the start button.":"Dateien hinzufügen und auf 'Hochladen' klicken.","List":"Liste","Filename":"Dateiname","%s specified, but cannot be found.":"","Image format either wrong or not supported.":"Bildformat falsch oder nicht unterstützt.","Status":"Status","HTTP Error.":"HTTP-Fehler","Start Upload":"Hochladen beginnen","Error: File too large:":"Fehler: Datei zu groß:","kb":"KB","Duplicate file error.":"Datei bereits hochgeladen","File size error.":"Fehler bei Dateigröße","N/A":"Nicht verfügbar","gb":"GB","Error: Invalid file extension:":"Fehler: Ungültige Dateiendung:","Select files":"Dateien auswählen","%s already present in the queue.":"%s ist bereits in der Warteschlange","Resoultion out of boundaries! <b>%s</b> runtime supports images only up to %wx%hpx.":"","File: %s":"Datei: %s","b":"B","Uploaded %d/%d files":"%d/%d Dateien wurden hochgeladen","Upload element accepts only %d file(s) at a time. Extra files were stripped.":"Pro Durchgang können nur %d Datei(en) akzeptiert werden. Überzählige Dateien wurden ignoriert.","%d files queued":"%d Dateien in der Warteschlange","File: %s, size: %d, max file size: %d":"Datei: %s, Größe: %d, maximale Dateigröße: %d","Thumbnails":"Vorschaubilder","Drag files here.":"Dateien auf diese Fläche bewegen.","Runtime ran out of available memory.":"Nicht genügend Speicher verfügbar.","File count error.":"Fehlerhafte Dateianzahl.","File extension error.":"Fehler bei Dateiendung","mb":"MB","Add Files":"Dateien hinzufügen"});
|
admin/js/plupload/i18n/el.js
CHANGED
@@ -1,2 +1,2 @@
|
|
1 |
// Greek (el)
|
2 |
-
plupload.addI18n({"Stop Upload":"
|
1 |
// Greek (el)
|
2 |
+
plupload.addI18n({"Stop Upload":"Ακύρωση Μεταφόρτωσης","Upload URL might be wrong or doesn't exist.":"Το URL μεταφόρτωσης είναι λάθος ή δεν υπάρχει.","tb":"tb","Size":"Μέγεθος","Close":"Κλείσιμο","You must specify either browse_button or drop_element.":"","Init error.":"Σφάλμα αρχικοποίησης.","Add files to the upload queue and click the start button.":"Προσθέστε αρχεία στην ουρά μεταφόρτωσης και πατήστε το κουμπί εκκίνησης.","List":"Λίστα","Filename":"Όνομα Αρχείου","%s specified, but cannot be found.":"","Image format either wrong or not supported.":"Ο τύπος εικόνας είναι λάθος ή δεν υποστηρίζεται.","Status":"Κατάσταση","HTTP Error.":"Σφάλμα HTTP.","Start Upload":"Εκκίνηση Μεταφόρτωσης","Error: File too large:":"Σφάλμα: Πολύ μεγάλο αρχείο:","kb":"kb","Duplicate file error.":"Το αρχείο έχει ξαναπροστεθεί.","File size error.":"Σφάλμα με το μέγεθος του αρχείου.","N/A":"Δεν ισχύει","gb":"gb","Error: Invalid file extension:":"Σφάλμα: Μη έγκυρος τύπος αρχείου:","Select files":"Επιλέξτε Αρχεία","%s already present in the queue.":"Το «%s» βρίσκεται ήδη στην ουρά.","Resoultion out of boundaries! <b>%s</b> runtime supports images only up to %wx%hpx.":"","File: %s":"Αρχείο: %s","b":"b","Uploaded %d/%d files":"Μεταφορτώθηκαν %d/%d αρχεία","Upload element accepts only %d file(s) at a time. Extra files were stripped.":"Μπορείτε να μεταφορτώσετε μεχρι και %d αρχείο/α κάθε φορά. Τα επιπλέον αρχεία αφαιρέθηκαν.","%d files queued":"%d αρχεία στην ουρά","File: %s, size: %d, max file size: %d":"Αρχείο: %s, μέγεθος: %d, μέγιστο μέγεθος αρχείου: %d","Thumbnails":"Μικρογραφίες","Drag files here.":"Σύρετε αρχεία εδώ","Runtime ran out of available memory.":"Δεν υπάρχει αρκετή διαθέσιμη μνήμη.","File count error.":"Σφάλμα με τον αριθμό αρχείων.","File extension error.":"Σφάλμα με τον τύπο αρχείου.","mb":"mb","Add Files":"Προσθέστε Αρχεία"});
|
admin/js/plupload/i18n/en.js
CHANGED
@@ -1,2 +1,2 @@
|
|
1 |
// English (en)
|
2 |
-
plupload.addI18n({"Stop Upload":"Stop Upload","Upload URL might be wrong or doesn't exist.":"Upload URL might be wrong or doesn't exist.","tb":"tb","Size":"Size","Close":"Close","Init error.":"Init error.","Add files to the upload queue and click the start button.":"Add files to the upload queue and click the start button.","Filename":"Filename","Image format either wrong or not supported.":"Image format either wrong or not supported.","Status":"Status","HTTP Error.":"HTTP Error.","Start Upload":"Start Upload","
|
1 |
// English (en)
|
2 |
+
plupload.addI18n({"Stop Upload":"Stop Upload","Upload URL might be wrong or doesn't exist.":"Upload URL might be wrong or doesn't exist.","tb":"tb","Size":"Size","Close":"Close","You must specify either browse_button or drop_element.":"You must specify either browse_button or drop_element.","Init error.":"Init error.","Add files to the upload queue and click the start button.":"Add files to the upload queue and click the start button.","List":"List","Filename":"Filename","%s specified, but cannot be found.":"%s specified, but cannot be found.","Image format either wrong or not supported.":"Image format either wrong or not supported.","Status":"Status","HTTP Error.":"HTTP Error.","Start Upload":"Start Upload","Error: File too large:":"Error: File too large:","kb":"kb","Duplicate file error.":"Duplicate file error.","File size error.":"File size error.","N/A":"N/A","gb":"gb","Error: Invalid file extension:":"Error: Invalid file extension:","Select files":"Select files","%s already present in the queue.":"%s already present in the queue.","Resoultion out of boundaries! <b>%s</b> runtime supports images only up to %wx%hpx.":"Resoultion out of boundaries! <b>%s</b> runtime supports images only up to %wx%hpx.","File: %s":"File: %s","b":"b","Uploaded %d/%d files":"Uploaded %d/%d files","Upload element accepts only %d file(s) at a time. Extra files were stripped.":"Upload element accepts only %d file(s) at a time. Extra files were stripped.","%d files queued":"%d files queued","File: %s, size: %d, max file size: %d":"File: %s, size: %d, max file size: %d","Thumbnails":"Thumbnails","Drag files here.":"Drag files here.","Runtime ran out of available memory.":"Runtime ran out of available memory.","File count error.":"File count error.","File extension error.":"File extension error.","mb":"mb","Add Files":"Add Files"});
|
admin/js/plupload/i18n/es.js
CHANGED
@@ -1,2 +1,2 @@
|
|
1 |
// Spanish (es)
|
2 |
-
plupload.addI18n({"Stop Upload":"Detener Subida.","Upload URL might be wrong or doesn't exist.":"URL de carga inexistente.","tb":"TB","Size":"Tamaño","Close":"Cerrar","Init error.":"Error de inicialización.","Add files to the upload queue and click the start button.":"Agregue archivos a la lista de subida y pulse clic en el botón de Iniciar carga","Filename":"Nombre de archivo","Image format either wrong or not supported.":"Formato de imagen no soportada.","Status":"Estado","HTTP Error.":"Error de HTTP.","Start Upload":"Iniciar carga","
|
1 |
// Spanish (es)
|
2 |
+
plupload.addI18n({"Stop Upload":"Detener Subida.","Upload URL might be wrong or doesn't exist.":"URL de carga inexistente.","tb":"TB","Size":"Tamaño","Close":"Cerrar","You must specify either browse_button or drop_element.":"Debe especificar el browse_button o el drop_element","Init error.":"Error de inicialización.","Add files to the upload queue and click the start button.":"Agregue archivos a la lista de subida y pulse clic en el botón de Iniciar carga","List":"Lista","Filename":"Nombre de archivo","%s specified, but cannot be found.":"%s especificado, pero no se puede encontrar","Image format either wrong or not supported.":"Formato de imagen no soportada.","Status":"Estado","HTTP Error.":"Error de HTTP.","Start Upload":"Iniciar carga","Error: File too large:":"Error: archivo demasiado grande:","kb":"KB","Duplicate file error.":"Error, archivo duplicado","File size error.":"Error de tamaño de archivo.","N/A":"No disponible","gb":"GB","Error: Invalid file extension:":"Error: Extensión de archivo inválida:","Select files":"Elija archivos","%s already present in the queue.":"%s ya se encuentra en la lista.","Resoultion out of boundaries! <b>%s</b> runtime supports images only up to %wx%hpx.":"Resolución fuera de límites! El tiempo de ejecución <b>%s</b> sólo admite imágenes hasta %wx%hpx","File: %s":"Archivo: %s","b":"B","Uploaded %d/%d files":"Subidos %d/%d archivos","Upload element accepts only %d file(s) at a time. Extra files were stripped.":"Se aceptan sólo %d archivo(s) al tiempo. Más, no se tienen en cuenta.","%d files queued":"%d archivos en cola.","File: %s, size: %d, max file size: %d":"Archivo: %s, tamaño: %d, tamaño máximo de archivo: %d","Thumbnails":"Miniaturas","Drag files here.":"Arrastre archivos aquí","Runtime ran out of available memory.":"No hay memoria disponible.","File count error.":"Error en contador de archivos.","File extension error.":"Error de extensión de archivo.","mb":"MB","Add Files":"Agregar archivos"});
|
admin/js/plupload/i18n/et.js
CHANGED
@@ -1,2 +1,2 @@
|
|
1 |
// Estonian (et)
|
2 |
-
plupload.addI18n({"Stop Upload":"Stop Upload","Upload URL might be wrong or doesn't exist.":"Üleslaadimise URL võib olla vale või seda pole.","tb":"","Size":"Suurus","Close":"Sulge","Init error.":"Lähtestamise viga.","Add files to the upload queue and click the start button.":"Lisa failid üleslaadimise järjekorda ja klõpsa alustamise nupule.","Filename":"Failinimi","Image format either wrong or not supported.":"Image format either wrong or not supported.","Status":"Olek","HTTP Error.":"HTTP ühenduse viga.","Start Upload":"Start Upload","
|
1 |
// Estonian (et)
|
2 |
+
plupload.addI18n({"Stop Upload":"Stop Upload","Upload URL might be wrong or doesn't exist.":"Üleslaadimise URL võib olla vale või seda pole.","tb":"","Size":"Suurus","Close":"Sulge","You must specify either browse_button or drop_element.":"","Init error.":"Lähtestamise viga.","Add files to the upload queue and click the start button.":"Lisa failid üleslaadimise järjekorda ja klõpsa alustamise nupule.","List":"","Filename":"Failinimi","%s specified, but cannot be found.":"","Image format either wrong or not supported.":"Image format either wrong or not supported.","Status":"Olek","HTTP Error.":"HTTP ühenduse viga.","Start Upload":"Start Upload","Error: File too large:":"Error: File too large:","kb":"","Duplicate file error.":"","File size error.":"Failisuuruse viga.","N/A":"N/A","gb":"","Error: Invalid file extension:":"Error: Invalid file extension:","Select files":"Vali faile","%s already present in the queue.":"","Resoultion out of boundaries! <b>%s</b> runtime supports images only up to %wx%hpx.":"","File: %s":"Fail: %s","b":"","Uploaded %d/%d files":"Üles laaditud %d/%d","Upload element accepts only %d file(s) at a time. Extra files were stripped.":"Üleslaadimise element saab vastu võtta ainult %d faili ühe korraga. Ülejäänud failid jäetakse laadimata.","%d files queued":"Järjekorras on %d faili","File: %s, size: %d, max file size: %d":"","Thumbnails":"","Drag files here.":"Lohista failid siia.","Runtime ran out of available memory.":"Runtime ran out of available memory.","File count error.":"Failide arvu viga.","File extension error.":"Faililaiendi viga.","mb":"","Add Files":"Add Files"});
|
admin/js/plupload/i18n/fa.js
CHANGED
@@ -1,2 +1,2 @@
|
|
1 |
// Persian (fa)
|
2 |
-
plupload.addI18n({"Stop Upload":"توقف انتقال","Upload URL might be wrong or doesn't exist.":"Upload URL might be wrong or doesn't exist.","tb":"","Size":"سایز","Close":"بستن","Init error.":"خطا در استارت اسکریپت","Add files to the upload queue and click the start button.":"اضافه کنید فایل ها را به صف آپلود و دکمه شروع را کلیک کنید.","Filename":"نام فایل","Image format either wrong or not supported.":"Image format either wrong or not supported.","Status":"وضعیت","HTTP Error.":"HTTP خطای","Start Upload":"شروع انتقال","
|
1 |
// Persian (fa)
|
2 |
+
plupload.addI18n({"Stop Upload":"توقف انتقال","Upload URL might be wrong or doesn't exist.":"Upload URL might be wrong or doesn't exist.","tb":"ترابایت","Size":"سایز","Close":"بستن","You must specify either browse_button or drop_element.":"","Init error.":"خطا در استارت اسکریپت","Add files to the upload queue and click the start button.":"اضافه کنید فایل ها را به صف آپلود و دکمه شروع را کلیک کنید.","List":"","Filename":"نام فایل","%s specified, but cannot be found.":"","Image format either wrong or not supported.":"Image format either wrong or not supported.","Status":"وضعیت","HTTP Error.":"HTTP خطای","Start Upload":"شروع انتقال","Error: File too large:":"Error: File too large:","kb":"کیلوبایت","Duplicate file error.":"خطای فایل تکراری","File size error.":"خطای سایز فایل","N/A":"N/A","gb":"گیگابایت","Error: Invalid file extension:":"Error: Invalid file extension:","Select files":"انتخاب فایل","%s already present in the queue.":"%s در لیست آپلود وجود دارد.","Resoultion out of boundaries! <b>%s</b> runtime supports images only up to %wx%hpx.":"","File: %s":" فایل ها : %s","b":"بایت","Uploaded %d/%d files":"منتقل شد %d/%d از فایلها","Upload element accepts only %d file(s) at a time. Extra files were stripped.":"عنصر بارگذار فقط %d فایل رو در یک زمان می پذیرد. سایر فایل ها مجرد از این موضوع هستند.","%d files queued":"%d فایل در صف","File: %s, size: %d, max file size: %d":"فایل: %s, اندازه: %d, محدودیت اندازه فایل: %d","Thumbnails":"","Drag files here.":"بکشید فایل ها رو به اینجا","Runtime ran out of available memory.":"Runtime ran out of available memory.","File count error.":"خطای تعداد فایل","File extension error.":"خطا پیشوند فایل","mb":"مگابایت","Add Files":"افزودن فایل"});
|
admin/js/plupload/i18n/fi.js
CHANGED
@@ -1,2 +1,2 @@
|
|
1 |
// Finnish (fi)
|
2 |
-
plupload.addI18n({"Stop Upload":"
|
1 |
// Finnish (fi)
|
2 |
+
plupload.addI18n({"Stop Upload":"Pysäytä lähetys","Upload URL might be wrong or doesn't exist.":"Lähetyksen URL-osoite saattaa olla väärä tai sitä ei ole olemassa.","tb":"TB","Size":"Koko","Close":"Sulje","You must specify either browse_button or drop_element.":"","Init error.":"Init virhe.","Add files to the upload queue and click the start button.":"Lisää tiedostoja lähetysjonoon ja klikkaa aloita-nappia.","List":"","Filename":"Tiedostonimi","%s specified, but cannot be found.":"","Image format either wrong or not supported.":"Kuvaformaatti on joko väärä tai ei tuettu.","Status":"Tila","HTTP Error.":"HTTP-virhe.","Start Upload":"Aloita lähetys","Error: File too large:":"Virhe: Liian suuri tiedosto:","kb":"kB","Duplicate file error.":"Tuplatiedostovirhe.","File size error.":"Tiedostokokovirhe.","N/A":"N/A","gb":"GB","Error: Invalid file extension:":"Virhe: Virheellinen tiedostopääte:","Select files":"Valitse tiedostoja","%s already present in the queue.":"%s on jo jonossa.","Resoultion out of boundaries! <b>%s</b> runtime supports images only up to %wx%hpx.":"","File: %s":"Tiedosto: %s","b":"B","Uploaded %d/%d files":"Lähetetty %d/%d tiedostoa","Upload element accepts only %d file(s) at a time. Extra files were stripped.":"Vain %d tiedosto(a) voidaan lähettää kerralla. Ylimääräiset tiedostot ohitettiin.","%d files queued":"%d tiedostoa jonossa","File: %s, size: %d, max file size: %d":"Tiedosto: %s, koko: %d, suurin sallittu tiedostokoko: %d","Thumbnails":"","Drag files here.":"Raahaa tiedostot tähän.","Runtime ran out of available memory.":"Toiminnon käytettävissä oleva muisti loppui kesken.","File count error.":"Tiedostolaskentavirhe.","File extension error.":"Tiedostopäätevirhe.","mb":"MB","Add Files":"Lisää tiedostoja"});
|
admin/js/plupload/i18n/fr.js
CHANGED
@@ -1,2 +1,2 @@
|
|
1 |
// French (fr)
|
2 |
-
plupload.addI18n({"Stop Upload":"Arrêter l'envoi.","Upload URL might be wrong or doesn't exist.":"L'URL d'envoi est soit erronée soit n'existe pas.","tb":"To","Size":"Taille","Close":"Fermer","Init error.":"Erreur d'initialisation.","Add files to the upload queue and click the start button.":"Ajoutez des fichiers à la file d'attente de téléchargement et appuyez sur le bouton 'Démarrer l'envoi'","Filename":"Nom du fichier","Image format either wrong or not supported.":"Le format d'image est soit erroné soit pas géré.","Status":"État","HTTP Error.":"Erreur HTTP.","Start Upload":"Démarrer l'envoi","
|
1 |
// French (fr)
|
2 |
+
plupload.addI18n({"Stop Upload":"Arrêter l'envoi.","Upload URL might be wrong or doesn't exist.":"L'URL d'envoi est soit erronée soit n'existe pas.","tb":"To","Size":"Taille","Close":"Fermer","You must specify either browse_button or drop_element.":"Vous devez spécifier browse_button ou drop_element.","Init error.":"Erreur d'initialisation.","Add files to the upload queue and click the start button.":"Ajoutez des fichiers à la file d'attente de téléchargement et appuyez sur le bouton 'Démarrer l'envoi'","List":"Liste","Filename":"Nom du fichier","%s specified, but cannot be found.":"%s spécifié, mais ne peut pas être trouvé.","Image format either wrong or not supported.":"Le format d'image est soit erroné soit pas géré.","Status":"État","HTTP Error.":"Erreur HTTP.","Start Upload":"Démarrer l'envoi","Error: File too large:":"Erreur: Fichier trop volumineux:","kb":"Ko","Duplicate file error.":"Erreur: Fichier déjà sélectionné.","File size error.":"Erreur de taille de fichier.","N/A":"Non applicable","gb":"Go","Error: Invalid file extension:":"Erreur: Extension de fichier non valide:","Select files":"Sélectionnez les fichiers","%s already present in the queue.":"%s déjà présent dans la file d'attente.","Resoultion out of boundaries! <b>%s</b> runtime supports images only up to %wx%hpx.":"Résolution sur les frontières ! L'exécution de <b>%s</b> supporte seulement les images de %wx%hpx","File: %s":"Fichier: %s","b":"o","Uploaded %d/%d files":"%d fichiers sur %d ont été envoyés","Upload element accepts only %d file(s) at a time. Extra files were stripped.":"Que %d fichier(s) peuvent être envoyé(s) à la fois. Les fichiers supplémentaires ont été ignorés.","%d files queued":"%d fichiers en attente","File: %s, size: %d, max file size: %d":"Fichier: %s, taille: %d, taille max. d'un fichier: %d","Thumbnails":"Miniatures","Drag files here.":"Déposez les fichiers ici.","Runtime ran out of available memory.":"Le traitement a manqué de mémoire disponible.","File count error.":"Erreur: Nombre de fichiers.","File extension error.":"Erreur d'extension de fichier","mb":"Mo","Add Files":"Ajouter des fichiers"});
|
admin/js/plupload/i18n/he.js
CHANGED
@@ -1,2 +1,2 @@
|
|
1 |
// Hebrew (he)
|
2 |
-
plupload.addI18n({"Stop Upload":"בטל העלאה","Upload URL might be wrong or doesn't exist.":"כתובת URL שגויה או לא קיימת.","tb":"tb","Size":"גודל","Close":"סגור","Init error.":"שגיאת איתחול","Add files to the upload queue and click the start button.":"הוסף קבצים לרשימה ולחץ על כפתור שליחה להתחלת פעולות העלאה","Filename":"שם קובץ","Image format either wrong or not supported.":"תמונה פגומה או סוג תמונה לא נתמך","Status":"אחוז","HTTP Error.":"שגיאת פרוטוקול","Start Upload":"שליחה","
|
1 |
// Hebrew (he)
|
2 |
+
plupload.addI18n({"Stop Upload":"בטל העלאה","Upload URL might be wrong or doesn't exist.":"כתובת URL שגויה או לא קיימת.","tb":"tb","Size":"גודל","Close":"סגור","You must specify either browse_button or drop_element.":"יש לציין או browse_button או drop_element.","Init error.":"שגיאת איתחול","Add files to the upload queue and click the start button.":"הוסף קבצים לרשימה ולחץ על כפתור שליחה להתחלת פעולות העלאה","List":"רשימה","Filename":"שם קובץ","%s specified, but cannot be found.":"%s צויין, אך לא נמצא.","Image format either wrong or not supported.":"תמונה פגומה או סוג תמונה לא נתמך","Status":"אחוז","HTTP Error.":"שגיאת פרוטוקול","Start Upload":"שליחה","Error: File too large:":"שגיאה: קובץ חורג מהגודל המותר:","kb":"KB","Duplicate file error.":"קובץ כפול","File size error.":"גודל קובץ חורג מהמותר","N/A":"שגיאה","gb":"GB","Error: Invalid file extension:":"שגיאה: סוג קובץ לא נתמך:","Select files":"בחר קבצים","%s already present in the queue.":"%sקובץ נמצא כבר ברשימת הקבצים.","Resoultion out of boundaries! <b>%s</b> runtime supports images only up to %wx%hpx.":"הרזולוציה גבוהה מדי! <b>%s</b> הפלטפורמה תומכת בתמונות עד גודל px.","File: %s":"קובץ: %s","b":"B","Uploaded %d/%d files":"מעלה: %d/%d","Upload element accepts only %d file(s) at a time. Extra files were stripped.":"אלמנטי ההעלאה מקבלים רק %d קובץ(ים) בפעם אחת. קבצים נוספים הוסרו.","%d files queued":"%d קבצים נותרו","File: %s, size: %d, max file size: %d":"קובץ: %s, גודל: %d, גודל מקסימלי: %d","Thumbnails":"תמונות ממוזערות","Drag files here.":"גרור קבצים לכאן","Runtime ran out of available memory.":"שגיאת מחסור בזיכרון","File count error.":"שגיאת מספר קבצים","File extension error.":"קובץ זה לא נתמך","mb":"MB","Add Files":"הוסף קבצים"});
|
admin/js/plupload/i18n/hr.js
CHANGED
@@ -1,2 +1,2 @@
|
|
1 |
// Croatian (hr)
|
2 |
-
plupload.addI18n({"Stop Upload":"Zaustavi upload.","Upload URL might be wrong or doesn't exist.":"Upload URL might be wrong or doesn't exist.","tb":"tb","Size":"Veličina","Close":"Zatvori","Init error.":"Greška inicijalizacije.","Add files to the upload queue and click the start button.":"Dodajte datoteke u listu i kliknite Upload.","Filename":"Ime datoteke","Image format either wrong or not supported.":"Image format either wrong or not supported.","Status":"Status","HTTP Error.":"HTTP greška.","Start Upload":"Pokreni upload.","
|
1 |
// Croatian (hr)
|
2 |
+
plupload.addI18n({"Stop Upload":"Zaustavi upload.","Upload URL might be wrong or doesn't exist.":"Upload URL might be wrong or doesn't exist.","tb":"tb","Size":"Veličina","Close":"Zatvori","You must specify either browse_button or drop_element.":"","Init error.":"Greška inicijalizacije.","Add files to the upload queue and click the start button.":"Dodajte datoteke u listu i kliknite Upload.","List":"","Filename":"Ime datoteke","%s specified, but cannot be found.":"","Image format either wrong or not supported.":"Image format either wrong or not supported.","Status":"Status","HTTP Error.":"HTTP greška.","Start Upload":"Pokreni upload.","Error: File too large:":"Pogreška: Datoteka je prevelika:","kb":"kb","Duplicate file error.":"Pogreška dvostruke datoteke.","File size error.":"Greška veličine datoteke.","N/A":"N/A","gb":"gb","Error: Invalid file extension:":"Pogreška: Nevažeći nastavak datoteke:","Select files":"Odaberite datoteke:","%s already present in the queue.":"%s je već prisutan u listi čekanja.","Resoultion out of boundaries! <b>%s</b> runtime supports images only up to %wx%hpx.":"","File: %s":"Datoteka: %s","b":"b","Uploaded %d/%d files":"Uploadano %d/%d datoteka","Upload element accepts only %d file(s) at a time. Extra files were stripped.":"Upload element accepts only %d file(s) at a time. Extra files were stripped.","%d files queued":"%d datoteka na čekanju.","File: %s, size: %d, max file size: %d":"Datoteka: %s, veličina: %d, maksimalna veličina: %d","Thumbnails":"","Drag files here.":"Dovucite datoteke ovdje","Runtime ran out of available memory.":"Runtime aplikaciji je ponestalo memorije.","File count error.":"Pogreška u broju datoteka.","File extension error.":"Pogreška u nastavku datoteke.","mb":"mb","Add Files":"Dodaj datoteke"});
|
admin/js/plupload/i18n/hu.js
CHANGED
@@ -1,2 +1,2 @@
|
|
1 |
// Hungarian (hu)
|
2 |
-
plupload.addI18n({"Stop Upload":"Feltöltés leállítása","Upload URL might be wrong or doesn't exist.":"A feltöltő URL hibás vagy nem létezik.","tb":"","Size":"Méret","Close":"Bezárás","Init error.":"Init hiba.","Add files to the upload queue and click the start button.":"A fájlok feltöltési sorhoz való hozzáadása után az Indítás gombra kell kattintani.","Filename":"Fájlnév","Image format either wrong or not supported.":"Rossz vagy nem támogatott képformátum.","Status":"Állapot","HTTP Error.":"HTTP-hiba.","Start Upload":"Feltöltés indítása","
|
1 |
// Hungarian (hu)
|
2 |
+
plupload.addI18n({"Stop Upload":"Feltöltés leállítása","Upload URL might be wrong or doesn't exist.":"A feltöltő URL hibás vagy nem létezik.","tb":"TB","Size":"Méret","Close":"Bezárás","You must specify either browse_button or drop_element.":"","Init error.":"Init hiba.","Add files to the upload queue and click the start button.":"A fájlok feltöltési sorhoz való hozzáadása után az Indítás gombra kell kattintani.","List":"","Filename":"Fájlnév","%s specified, but cannot be found.":"","Image format either wrong or not supported.":"Rossz vagy nem támogatott képformátum.","Status":"Állapot","HTTP Error.":"HTTP-hiba.","Start Upload":"Feltöltés indítása","Error: File too large:":"Hiba: a fájl túl nagy:","kb":"kB","Duplicate file error.":"Duplikáltfájl-hiba.","File size error.":"Hibás fájlméret.","N/A":"Nem elérhető","gb":"GB","Error: Invalid file extension:":"Hiba: érvénytelen fájlkiterjesztés:","Select files":"Fájlok kiválasztása","%s already present in the queue.":"%s már szerepel a listában.","Resoultion out of boundaries! <b>%s</b> runtime supports images only up to %wx%hpx.":"","File: %s":"Fájl: %s","b":"b","Uploaded %d/%d files":"Feltöltött fájlok: %d/%d","Upload element accepts only %d file(s) at a time. Extra files were stripped.":"A feltöltés egyszerre csak %d fájlt fogad el, a többi fájl nem lesz feltöltve.","%d files queued":"%d fájl sorbaállítva","File: %s, size: %d, max file size: %d":"Fájl: %s, méret: %d, legnagyobb fájlméret: %d","Thumbnails":"","Drag files here.":"Ide lehet húzni a fájlokat.","Runtime ran out of available memory.":"Futásidőben elfogyott a rendelkezésre álló memória.","File count error.":"A fájlok számával kapcsolatos hiba.","File extension error.":"Hibás fájlkiterjesztés.","mb":"MB","Add Files":"Fájlok hozzáadása"});
|
admin/js/plupload/i18n/hy.js
CHANGED
@@ -1,2 +1,2 @@
|
|
1 |
// Armenian (hy)
|
2 |
-
plupload.addI18n({"Stop Upload":"Կանգնեցնել","Upload URL might be wrong or doesn't exist.":"Ավեցաված URL-ը սխալ է կամ գոյություն չունի։","tb":"տբ","Size":"Չափ","Close":"Փակել","Init error.":"Ստեղծման սխալ","Add files to the upload queue and click the start button.":"Ավելացրեք ֆայլեր ցուցակում և սեղմեք \"Վերբեռնել\"։","Filename":"Ֆայլի անուն","Image format either wrong or not supported.":"Նկարի ֆորմատը սխալ է կամ չի ընդունվում։","Status":"","HTTP Error.":"HTTP սխալ","Start Upload":"Վերբեռնել","
|
1 |
// Armenian (hy)
|
2 |
+
plupload.addI18n({"Stop Upload":"Կանգնեցնել","Upload URL might be wrong or doesn't exist.":"Ավեցաված URL-ը սխալ է կամ գոյություն չունի։","tb":"տբ","Size":"Չափ","Close":"Փակել","You must specify either browse_button or drop_element.":"","Init error.":"Ստեղծման սխալ","Add files to the upload queue and click the start button.":"Ավելացրեք ֆայլեր ցուցակում և սեղմեք \"Վերբեռնել\"։","List":"","Filename":"Ֆայլի անուն","%s specified, but cannot be found.":"","Image format either wrong or not supported.":"Նկարի ֆորմատը սխալ է կամ չի ընդունվում։","Status":"Կարգավիճակ","HTTP Error.":"HTTP սխալ","Start Upload":"Վերբեռնել","Error: File too large:":"Սխալ։ Ֆայլի չափը մեծ է։","kb":"կբ","Duplicate file error.":"Ֆայլի կրկնման սխալ","File size error.":"Ֆայլի չափի սխալ","N/A":"N/A","gb":"գբ","Error: Invalid file extension:":"Սխալ։ Ֆայլի ընդլայնումը սխալ է։","Select files":"Ընտրեք ֆայլերը","%s already present in the queue.":"%s ֆայլը արդեն ավելացված է ցուցակում.","Resoultion out of boundaries! <b>%s</b> runtime supports images only up to %wx%hpx.":"","File: %s":"Ֆայլ: %s","b":"բ","Uploaded %d/%d files":"Վերբեռնվել են %d/%d ֆայլերը","Upload element accepts only %d file(s) at a time. Extra files were stripped.":"Վերբեռնիչը միանգամից ըդունում է միայն %d ֆայլ(եր). Ավելորդ ֆայլերը հեռացվել են.","%d files queued":"ցուցակում կա %d ֆայլ","File: %s, size: %d, max file size: %d":"Ֆայլ: %s, չափ: %d, ֆայլի մաքսիմում չափ: %d","Thumbnails":"","Drag files here.":"Տեղափոխեք ֆայլերը այստեղ","Runtime ran out of available memory.":"Օպերատիվ հիշողության անբավարարուտյուն.","File count error.":"Ֆայլերի քանակի սխալ","File extension error.":"Ֆայլի ընդլայնման սխալ","mb":"մբ","Add Files":"Ավելացնել ֆայլեր"});
|
admin/js/plupload/i18n/id.js
CHANGED
@@ -1,2 +1,2 @@
|
|
1 |
// Indonesian (id)
|
2 |
-
plupload.addI18n({"Stop Upload":"Hentikan Upload","Upload URL might be wrong or doesn't exist.":"Alamat URL untuk upload tidak benar atau tidak ada","tb":"tb","Size":"Ukuran","Close":"Tutup","Init error.":"Kesalahan pada Init","Add files to the upload queue and click the start button.":"Tambahkan file kedalam antrian upload dan klik tombol Mulai","Filename":"Nama File","Image format either wrong or not supported.":"Kesalahan pada jenis gambar atau jenis file tidak didukung","Status":"Status","HTTP Error.":"HTTP Bermasalah","Start Upload":"Mulai Upload","
|
1 |
// Indonesian (id)
|
2 |
+
plupload.addI18n({"Stop Upload":"Hentikan Upload","Upload URL might be wrong or doesn't exist.":"Alamat URL untuk upload tidak benar atau tidak ada","tb":"tb","Size":"Ukuran","Close":"Tutup","You must specify either browse_button or drop_element.":"","Init error.":"Kesalahan pada Init","Add files to the upload queue and click the start button.":"Tambahkan file kedalam antrian upload dan klik tombol Mulai","List":"","Filename":"Nama File","%s specified, but cannot be found.":"","Image format either wrong or not supported.":"Kesalahan pada jenis gambar atau jenis file tidak didukung","Status":"Status","HTTP Error.":"HTTP Bermasalah","Start Upload":"Mulai Upload","Error: File too large:":"Kesalahan: File terlalu besar","kb":"kb","Duplicate file error.":"Terjadi duplikasi file","File size error.":"Kesalahan pada ukuran file","N/A":"N/A","gb":"gb","Error: Invalid file extension:":"Kesalahan: Ekstensi file tidak dikenal","Select files":"Pilih file","%s already present in the queue.":"%s sudah ada dalam daftar antrian","Resoultion out of boundaries! <b>%s</b> runtime supports images only up to %wx%hpx.":"","File: %s":"File: %s","b":"b","Uploaded %d/%d files":"File terupload %d/%d","Upload element accepts only %d file(s) at a time. Extra files were stripped.":"Tempat untuk upload hanya menerima %d file(s) dalam setiap upload. File lainnya tidak akan disertakan","%d files queued":"%d file dalam antrian","File: %s, size: %d, max file size: %d":"File: %s, ukuran: %d, maksimum ukuran file: %d","Thumbnails":"","Drag files here.":"Tarik file kesini","Runtime ran out of available memory.":"Tidak cukup memori","File count error.":"Kesalahan pada jumlah file","File extension error.":"Kesalahan pada ekstensi file","mb":"mb","Add Files":"Tambah File"});
|
admin/js/plupload/i18n/it.js
CHANGED
@@ -1,2 +1,2 @@
|
|
1 |
// Italian (it)
|
2 |
-
plupload.addI18n({"Stop Upload":"Ferma Upload","Upload URL might be wrong or doesn't exist.":"URL di Upload errata o non esistente","tb":"tb","Size":"Dimensione","Close":"Chiudi","Init error.":"Errore inizializzazione.","Add files to the upload queue and click the start button.":"Aggiungi i file alla coda di caricamento e clicca il pulsante di avvio.","Filename":"Nome file","Image format either wrong or not supported.":"Formato immagine errato o non supportato.","Status":"Stato","HTTP Error.":"Errore HTTP.","Start Upload":"Inizia Upload","
|
1 |
// Italian (it)
|
2 |
+
plupload.addI18n({"Stop Upload":"Ferma Upload","Upload URL might be wrong or doesn't exist.":"URL di Upload errata o non esistente","tb":"tb","Size":"Dimensione","Close":"Chiudi","You must specify either browse_button or drop_element.":"Devi indicare almeno uno tra browse_button o drop_element.","Init error.":"Errore inizializzazione.","Add files to the upload queue and click the start button.":"Aggiungi i file alla coda di caricamento e clicca il pulsante di avvio.","List":"Lista","Filename":"Nome file","%s specified, but cannot be found.":"%s specificato, ma non è stato possibile trovarlo.","Image format either wrong or not supported.":"Formato immagine errato o non supportato.","Status":"Stato","HTTP Error.":"Errore HTTP.","Start Upload":"Inizia Upload","Error: File too large:":"Errore: File troppo grande:","kb":"kb","Duplicate file error.":"Errore file duplicato.","File size error.":"Errore dimensione file.","N/A":"N/D","gb":"gb","Error: Invalid file extension:":"Errore: Estensione file non valida:","Select files":"Seleziona i files","%s already present in the queue.":"%s già presente nella coda.","Resoultion out of boundaries! <b>%s</b> runtime supports images only up to %wx%hpx.":"Risoluzione oltre i limiti! <b>%s</b> runtime supporta immagini fino a %wx%hpx.","File: %s":"File: %s","b":"byte","Uploaded %d/%d files":"Caricati %d/%d file","Upload element accepts only %d file(s) at a time. Extra files were stripped.":"Upload element accepts only %d file(s) at a time. Extra files were stripped.","%d files queued":"%d file in coda","File: %s, size: %d, max file size: %d":"File: %s, dimensione: %d, dimensione max file: %d","Thumbnails":"Anteprime","Drag files here.":"Trascina i files qui.","Runtime ran out of available memory.":"Runtime ha esaurito la memoria disponibile.","File count error.":"File count error.","File extension error.":"Errore estensione file.","mb":"mb","Add Files":"Aggiungi file"});
|
admin/js/plupload/i18n/ja.js
CHANGED
@@ -1,2 +1,2 @@
|
|
1 |
// Japanese (ja)
|
2 |
-
plupload.addI18n({"Stop Upload":"アップロード停止","Upload URL might be wrong or doesn't exist.":"アップロード先の URL が存在しません","tb":"","Size":"サイズ","Close":"閉じる","Init error.":"イニシャライズエラー","Add files to the upload queue and click the start button.":"ファイルをアップロードキューに追加してスタートボタンをクリックしてください","Filename":"ファイル名","
|
1 |
// Japanese (ja)
|
2 |
+
plupload.addI18n({"Stop Upload":"アップロード停止","Upload URL might be wrong or doesn't exist.":"アップロード先の URL が存在しません","tb":"TB","Size":"サイズ","Close":"閉じる","You must specify either browse_button or drop_element.":"ブラウザのボタンで または ファイルをドロップするか いずれかの方法で指定する必要があります。","Init error.":"イニシャライズエラー","Add files to the upload queue and click the start button.":"ファイルをアップロードキューに追加してスタートボタンをクリックしてください","List":"リスト","Filename":"ファイル名","%s specified, but cannot be found.":"指定された %s は見つかりません。","Image format either wrong or not supported.":"画像形式が間違っているかサポートされていません","Status":"ステータス","HTTP Error.":"HTTP エラー","Start Upload":"アップロード開始","Error: File too large:":"エラー: ファイルが大きすぎます:","kb":"KB","Duplicate file error.":"重複ファイルエラー","File size error.":"ファイルサイズエラー","N/A":"N/A","gb":"GB","Error: Invalid file extension:":"エラー: ファイルの拡張子が無効です:","Select files":"ファイル選択","%s already present in the queue.":"%s 既にキューに存在しています","Resoultion out of boundaries! <b>%s</b> runtime supports images only up to %wx%hpx.":"解像度がしきい値を超えています! ランタイム <b>%s</b> は縦 %h px 横 %w px までをサポートします","File: %s":"ファイル: %s","b":"B","Uploaded %d/%d files":"アップロード中 %d/%d ファイル","Upload element accepts only %d file(s) at a time. Extra files were stripped.":"アップロード可能なファイル数は %d です 余分なファイルは削除されました","%d files queued":"%d ファイルが追加されました","File: %s, size: %d, max file size: %d":"ファイル: %s, サイズ: %d, 最大ファイルサイズ: %d","Thumbnails":"サムネイル","Drag files here.":"ここにファイルをドラッグ","Runtime ran out of available memory.":"ランタイムが使用するメモリが不足しました","File count error.":"ファイル数エラー","File extension error.":"ファイル拡張子エラー","mb":"MB","Add Files":"ファイルを追加"});
|
admin/js/plupload/i18n/ka.js
CHANGED
@@ -1,2 +1,2 @@
|
|
1 |
// Georgian (ka)
|
2 |
-
plupload.addI18n({"Stop Upload":"ატვირთვის შეჩერება","Upload URL might be wrong or doesn't exist.":"ატვირთვის მისამართი არასწორია ან არ არსებობს.","tb":"ტბ","Size":"ზომა","Close":"დავხუროთ","Init error.":"ინიციალიზაციის შეცდომა.","Add files to the upload queue and click the start button.":"დაამატეთ ფაილები და დააჭირეთ ღილაკს - ატვირთვა.","Filename":"ფაილის სახელი","Image format either wrong or not supported.":"ფაილის ფორმატი არ არის მხარდაჭერილი ან არასწორია.","Status":"სტატუსი","HTTP Error.":"HTTP შეცდომა.","Start Upload":"ატვირთვა","
|
1 |
// Georgian (ka)
|
2 |
+
plupload.addI18n({"Stop Upload":"ატვირთვის შეჩერება","Upload URL might be wrong or doesn't exist.":"ატვირთვის მისამართი არასწორია ან არ არსებობს.","tb":"ტბ","Size":"ზომა","Close":"დავხუროთ","You must specify either browse_button or drop_element.":"თქვენ უნდა მიუთითოთ browse_button ან drop_element.","Init error.":"ინიციალიზაციის შეცდომა.","Add files to the upload queue and click the start button.":"დაამატეთ ფაილები და დააჭირეთ ღილაკს - ატვირთვა.","List":"","Filename":"ფაილის სახელი","%s specified, but cannot be found.":"%s მითითებულია, მაგრამ ვერ მოიძებნა.","Image format either wrong or not supported.":"ფაილის ფორმატი არ არის მხარდაჭერილი ან არასწორია.","Status":"სტატუსი","HTTP Error.":"HTTP შეცდომა.","Start Upload":"ატვირთვა","Error: File too large:":"შეცდომა: ფაილი ზედმეტად დიდია.","kb":"კბ","Duplicate file error.":"ესეთი ფაილი უკვე დამატებულია.","File size error.":"ფაილის ზომა დაშვებულზე დიდია.","N/A":"N/A","gb":"გბ","Error: Invalid file extension:":"შეცდომა: ფაილს აქვს არასწორი გაფართოება.","Select files":"ფაილების მონიშვნა","%s already present in the queue.":"%s უკვე დამატებულია.","Resoultion out of boundaries! <b>%s</b> runtime supports images only up to %wx%hpx.":"სურათის გარჩევადობა აღემატება <b>%s</b> გარემოს მიერ მხარდაჭერილ მქსიმუმებს - %wx%hpx.","File: %s":"ფაილი: %s","b":"ბ","Uploaded %d/%d files":"ატვირთულია %d/%d ფაილი","Upload element accepts only %d file(s) at a time. Extra files were stripped.":"ერთდროულად დაშვებულია მხოლოდ %d ფაილის დამატება.","%d files queued":"რიგშია %d ფაილი","File: %s, size: %d, max file size: %d":"ფაილი: %s, ზომა: %d, მაქსიმალური დაშვებული ზომა: %d","Thumbnails":"","Drag files here.":"ჩააგდეთ ფაილები აქ.","Runtime ran out of available memory.":"ხელმისაწვდომი მეხსიერება გადაივსო.","File count error.":"აღმოჩენილია ზედმეტი ფაილები.","File extension error.":"ფაილის ფორმატი დაშვებული არ არის.","mb":"მბ","Add Files":"დაამატეთ ფაილები"});
|
admin/js/plupload/i18n/kk.js
CHANGED
@@ -1,2 +1,2 @@
|
|
1 |
// Kazakh (kk)
|
2 |
-
plupload.addI18n({"Stop Upload":"Жүктеуді тоқтату","Upload URL might be wrong or doesn't exist.":"Жүктеуді қабылдаушы URL қате не мүлдем көрсетілмеген.","tb":"тб","Size":"Өлшемі","Close":"Жабу","Init error.":"Инициализация қатесі.","Add files to the upload queue and click the start button.":"Жүктеу кезегіне файлдар қосып, Бастау кнопкасын басыңыз.","Filename":"Файл аты","Image format either wrong or not supported.":"Сурет форматы қате немесе оның қолдауы жоқ.","Status":"Күйі","HTTP Error.":"HTTP қатесі.","Start Upload":"Жүктеуді бастау","
|
1 |
// Kazakh (kk)
|
2 |
+
plupload.addI18n({"Stop Upload":"Жүктеуді тоқтату","Upload URL might be wrong or doesn't exist.":"Жүктеуді қабылдаушы URL қате не мүлдем көрсетілмеген.","tb":"тб","Size":"Өлшемі","Close":"Жабу","You must specify either browse_button or drop_element.":"","Init error.":"Инициализация қатесі.","Add files to the upload queue and click the start button.":"Жүктеу кезегіне файлдар қосып, Бастау кнопкасын басыңыз.","List":"","Filename":"Файл аты","%s specified, but cannot be found.":"","Image format either wrong or not supported.":"Сурет форматы қате немесе оның қолдауы жоқ.","Status":"Күйі","HTTP Error.":"HTTP қатесі.","Start Upload":"Жүктеуді бастау","Error: File too large:":"Қате: Файл мөлшері тым үлкен:","kb":"кб","Duplicate file error.":"Файл қайталамасының қатесі.","File size error.":"Файл өлшемінің қатесі.","N/A":"Қ/Ж","gb":"гб","Error: Invalid file extension:":"Қате: Файл кеңейтілуі қате:","Select files":"Файлдар таңдаңыз","%s already present in the queue.":"%s файлы кезекте бұрыннан бар.","Resoultion out of boundaries! <b>%s</b> runtime supports images only up to %wx%hpx.":"","File: %s":"Файл: %s","b":"б","Uploaded %d/%d files":"Жүктелген: %d/%d файл","Upload element accepts only %d file(s) at a time. Extra files were stripped.":"Жүктеу элементі бір кезде %d файл ғана жүктей алады. Артық файлдар жүктелмейді.","%d files queued":"%d файл кезекке қойылды","File: %s, size: %d, max file size: %d":"Файл: %s, өлшемі: %d, макс. файл өлшемі: %d","Thumbnails":"","Drag files here.":"Файлдарды мына жерге тастаңыз.","Runtime ran out of available memory.":"Орындау кезінде жады жетпей қалды.","File count error.":"Файл санының қатесі.","File extension error.":"Файл кеңейтілуінің қатесі.","mb":"мб","Add Files":"Файл қосу"});
|
admin/js/plupload/i18n/km.js
ADDED
@@ -0,0 +1,2 @@
|
|
|
|
|
1 |
+
// Khmer (km)
|
2 |
+
plupload.addI18n({"Stop Upload":"បញ្ឈប់ការផ្ទុកឡើង","Upload URL might be wrong or doesn't exist.":"URL ផ្ទុកឡើងអាចខុស ឬក៏គ្មាន។","tb":"tb","Size":"ទំហំ","Close":"បិទ","You must specify either browse_button or drop_element.":"","Init error.":"កំហុស Init។","Add files to the upload queue and click the start button.":"បន្ថែមឯកសារទៅក្នុងជួរលំដាប់ផ្ទុកឡើង ហើយចុចប៊ូតុងចាប់ផ្ដើម។","List":"","Filename":"ឈ្មោះឯកសារ","%s specified, but cannot be found.":"","Image format either wrong or not supported.":"ទ្រង់ទ្រាយរូបភាពអាចខុស ឬក៏មិនស្គាល់តែម្ដង។","Status":"ស្ថានភាព","HTTP Error.":"កំហុស HTTP ។","Start Upload":"ចាប់ផ្ដើមផ្ទុកឡើង","Error: File too large:":"កំហុស៖ ឯកសារធំពេក៖","kb":"kb","Duplicate file error.":"កំហុសឯកសារស្ទួនគ្នា។","File size error.":"កំហុសទំហំឯកសារ។","N/A":"គ្មាន","gb":"gb","Error: Invalid file extension:":"កំហុស៖ កន្ទុយឯកសារមិនត្រឹមត្រូវ៖","Select files":"ជ្រើសឯកសារ","%s already present in the queue.":"មាន %s នៅក្នុងជួរលំដាប់ហើយ។","Resoultion out of boundaries! <b>%s</b> runtime supports images only up to %wx%hpx.":"","File: %s":"ឯកសារ៖ %s","b":"b","Uploaded %d/%d files":"បានផ្ទុកឡើងឯកសារ %d/%d","Upload element accepts only %d file(s) at a time. Extra files were stripped.":"ការផ្ទុកឡើងទទួលឯកសារបានតែ %d ប៉ុណ្ណោះក្នុងពេលតែមួយ។ ឯកសារផ្សេងទៀតនឹងត្រូវដកចេញ។","%d files queued":"បានដាក់ឯកសារ %d បន្តគ្នា","File: %s, size: %d, max file size: %d":"ឯកសារ៖ %s, size: %d, ទំហំឯកសារអតិបរមា៖ %d","Thumbnails":"","Drag files here.":"អូសឯកសារមកទីនេះ។","Runtime ran out of available memory.":"ពេលដំណើរការអស់អង្គចងចាំទំនេរហើយ។","File count error.":"កំហុសការរាប់ឯកសារ។","File extension error.":"កំហុសកន្ទុយឯកសារ។","mb":"mb","Add Files":"បន្ថែមឯកសារ"});
|
admin/js/plupload/i18n/ko.js
CHANGED
@@ -1,2 +1,2 @@
|
|
1 |
// Korean (ko)
|
2 |
-
plupload.addI18n({"Stop Upload":"업로드 중지","Upload URL might be wrong or doesn't exist.":"업로드할 URL이 존재하지
|
1 |
// Korean (ko)
|
2 |
+
plupload.addI18n({"Stop Upload":"업로드 중지","Upload URL might be wrong or doesn't exist.":"업로드할 URL이 존재하지 않습니다.","tb":"tb","Size":"크기","Close":"닫기","You must specify either browse_button or drop_element.":"browse_button 이나 drop_element 둘 중 하나를 지정해 주세요.","Init error.":"초기화 오류.","Add files to the upload queue and click the start button.":"파일을 업로드 큐에 추가한 후 시작 버튼을 클릭하십시오.","List":"목록","Filename":"파일명","%s specified, but cannot be found.":"%s 가 지정됐지만, 찾을 수 없습니다.","Image format either wrong or not supported.":"지원되지 않는 이미지 형식입니다.","Status":"상태","HTTP Error.":"HTTP 오류.","Start Upload":"업로드 시작","Error: File too large:":"오류: 파일 크기가 너무 큽니다.","kb":"kb","Duplicate file error.":"파일 중복 오류.","File size error.":"파일 크기 오류.","N/A":"N/A","gb":"gb","Error: Invalid file extension:":"오류: 허용되지 않은 확장자입니다.","Select files":"파일 선택","%s already present in the queue.":"%s 파일이 이미 대기열에 존재합니다.","Resoultion out of boundaries! <b>%s</b> runtime supports images only up to %wx%hpx.":"해상도 지원 범위를 초과했습니다! <b>%s</b> 런타임은 %wx%hpx 이상의 이미지를 지원합니다.","File: %s":"파일: %s","b":"b","Uploaded %d/%d files":"%d / %d 파일 업로드 완료","Upload element accepts only %d file(s) at a time. Extra files were stripped.":"업로드 가능한 파일의 수는 %d 입니다. 불필요한 파일은 삭제되었습니다.","%d files queued":"%d 파일이 추가됨","File: %s, size: %d, max file size: %d":"파일: %s, 크기: %d, 최대 파일 크기: %d","Thumbnails":"미리보기","Drag files here.":"이곳에 파일을 드래그 하세요.","Runtime ran out of available memory.":"런타임 메모리가 부족합니다.","File count error.":"파일 갯수 오류.","File extension error.":"파일 확장자 오류.","mb":"mb","Add Files":"파일 추가"});
|
admin/js/plupload/i18n/ku_IQ.js
ADDED
@@ -0,0 +1,2 @@
|
|
|
|
|
1 |
+
// Kurdish (Iraq) (ku_IQ)
|
2 |
+
plupload.addI18n({"Stop Upload":"وەستانی بارکردن","Upload URL might be wrong or doesn't exist.":".بەستەری بارکراو نادروستە یان بەردەست نییە","tb":"تێرابایت","Size":"قەبارە","Close":"داخستن","You must specify either browse_button or drop_element.":"","Init error.":".هەڵەی ئامادەکردن","Add files to the upload queue and click the start button.":".زیادکردنی پەڕگەکان بۆ ڕیزی بارکردن و کرتەکردن لە دوگمەی دەستپێکردن","List":"","Filename":"ناوی پەڕگە","%s specified, but cannot be found.":"","Image format either wrong or not supported.":".شێوازی وێنە هەڵەیە یان پاڵپشتی ناکرێت","Status":"ڕەوش","HTTP Error.":".HTTP هەڵەی","Start Upload":"دەستپێکردنی بارکردن","Error: File too large:":":هەڵە: پەڕگەکە زۆر گەورەیە","kb":"کیلۆبایت","Duplicate file error.":".هەڵەی پەڕگەی دوبارە","File size error.":".هەڵەی قەبارەی پەڕگە","N/A":"بەردەست نییە","gb":"گێگابایت","Error: Invalid file extension:":":هەڵە: پاشگری پەڕگەی نادروست","Select files":"دیاریکردنی پەڕگەکان","%s already present in the queue.":".ئامادەیی هەیە لە ڕیز %s","Resoultion out of boundaries! <b>%s</b> runtime supports images only up to %wx%hpx.":"","File: %s":"%s :پەڕگە","b":"بایت","Uploaded %d/%d files":"پەڕگە بارکران %d/%d","Upload element accepts only %d file(s) at a time. Extra files were stripped.":"بەشی بارکردن تەنها %d پەڕگە(کان) وەردەگرێت لەیەک کاتدا. پەڕگە زیادەکان .جیادەکرێنەوە","%d files queued":"پەڕگە ڕیزکران %d","File: %s, size: %d, max file size: %d":"پەڕگە: %s، قەبارە: %d، گەورەترین قەبارەی پەڕگە: %d","Thumbnails":"","Drag files here.":".پەڕگەکان ڕاکێشە بۆ ئێرە","Runtime ran out of available memory.":"هەڵەی دەرچوون لە بیرگەی بەردەست.","File count error.":".هەڵەی ژماردنی پەڕگە","File extension error.":".هەڵەی پاشگری پەڕگە","mb":"مێگابایت","Add Files":"زیادکردنی پەڕگەکان"});
|
admin/js/plupload/i18n/lt.js
CHANGED
@@ -1,2 +1,2 @@
|
|
1 |
// Lithuanian (lt)
|
2 |
-
plupload.addI18n({"Stop Upload":"Stabdyti įkėlimą","Upload URL might be wrong or doesn't exist.":"Klaidinga arba neegzistuojanti įkėlimo nuoroda.","tb":"tb","Size":"Dydis","Close":"Uždaryti","Init error.":"Įkrovimo klaida.","Add files to the upload queue and click the start button.":"Pridėkite bylas į įkėlimo eilę ir paspauskite starto mygtuką.","Filename":"Bylos pavadinimas","Image format either wrong or not supported.":"Paveiksliuko formatas klaidingas arba nebepalaikomas.","Status":"Statusas","HTTP Error.":"HTTP klaida.","Start Upload":"Pradėti įkėlimą","
|
1 |
// Lithuanian (lt)
|
2 |
+
plupload.addI18n({"Stop Upload":"Stabdyti įkėlimą","Upload URL might be wrong or doesn't exist.":"Klaidinga arba neegzistuojanti įkėlimo nuoroda.","tb":"tb","Size":"Dydis","Close":"Uždaryti","You must specify either browse_button or drop_element.":"","Init error.":"Įkrovimo klaida.","Add files to the upload queue and click the start button.":"Pridėkite bylas į įkėlimo eilę ir paspauskite starto mygtuką.","List":"","Filename":"Bylos pavadinimas","%s specified, but cannot be found.":"","Image format either wrong or not supported.":"Paveiksliuko formatas klaidingas arba nebepalaikomas.","Status":"Statusas","HTTP Error.":"HTTP klaida.","Start Upload":"Pradėti įkėlimą","Error: File too large:":"Klaida: Byla per didelė:","kb":"kb","Duplicate file error.":"Pasikartojanti byla.","File size error.":"Netinkamas bylos dydis.","N/A":"N/A","gb":"gb","Error: Invalid file extension:":"Klaida: Netinkamas bylos plėtinys:","Select files":"Žymėti bylas","%s already present in the queue.":"%s jau yra eilėje.","Resoultion out of boundaries! <b>%s</b> runtime supports images only up to %wx%hpx.":"","File: %s":"Byla: %s","b":"b","Uploaded %d/%d files":"Įkelta bylų: %d/%d","Upload element accepts only %d file(s) at a time. Extra files were stripped.":"Vienu metu galima įkelti tik %d bylas(ų). Papildomos bylos buvo pašalintos.","%d files queued":"%d bylų eilėje","File: %s, size: %d, max file size: %d":"Byla: %s, dydis: %d, galimas dydis: %d","Thumbnails":"","Drag files here.":"Padėti bylas čia.","Runtime ran out of available memory.":"Išeikvota darbinė atmintis.","File count error.":"Netinkamas bylų kiekis.","File extension error.":"Netinkamas pletinys.","mb":"mb","Add Files":"Pridėti bylas"});
|
admin/js/plupload/i18n/lv.js
CHANGED
@@ -1,2 +1,2 @@
|
|
1 |
// Latvian (lv)
|
2 |
-
plupload.addI18n({"Stop Upload":"
|
1 |
// Latvian (lv)
|
2 |
+
plupload.addI18n({"Stop Upload":"Apturēt augšupielādi","Upload URL might be wrong or doesn't exist.":"Augšupielādes saite neeksistē vai ir nepareiza.","tb":"terabaiti","Size":"Izmērs","Close":"Aizvērt","You must specify either browse_button or drop_element.":"Jums ir jānorāda vainu browse_button vai drop_element.","Init error.":"Inicializācijas kļūda.","Add files to the upload queue and click the start button.":"Pievienojiet failus rindai un klikšķiniet uz pogas \"Sākt augšupielādi\".","List":"Saraksts","Filename":"Faila nosaukums","%s specified, but cannot be found.":"%s norādīts, bet nevar tikt atrasts.","Image format either wrong or not supported.":"Attēla formāts ir nepareizs vai arī netiek atbalstīts.","Status":"Statuss","HTTP Error.":"HTTP kļūda.","Start Upload":"Sākt augšupielādi","Error: File too large:":"Kļūda: Fails pārāk liels:","kb":"kilobaiti","Duplicate file error.":"Atkārtota faila kļūda","File size error.":"Faila izmēra kļūda.","N/A":"N/A","gb":"gigabaiti","Error: Invalid file extension:":"Kļūda: Nepareizs faila paplašinājums:","Select files":"Izvēlieties failus","%s already present in the queue.":"%s jau ir atrodams rindā.","Resoultion out of boundaries! <b>%s</b> runtime supports images only up to %wx%hpx.":"Izšķirtspēja ārpus robežām! <b>%s</b> atbalsta attēlus tikai līdz %wx%hpx","File: %s":"Fails: %s","b":"baiti","Uploaded %d/%d files":"Augšupielādēti %d/%d faili","Upload element accepts only %d file(s) at a time. Extra files were stripped.":"Iespējams ielādēt tikai %d failus vienā reizē. Atlikušie faili netika pievienoti","%d files queued":"%d faili pievienoti rindai","File: %s, size: %d, max file size: %d":"Fails: %s, izmērs: %d, max faila izmērs: %d","Thumbnails":"Ikonas","Drag files here.":"Ievelciet failus šeit","Runtime ran out of available memory.":"Pietrūkst izmantojamās atmiņas.","File count error.":"Failu skaita kļūda","File extension error.":"Faila paplašinājuma kļūda.","mb":"megabaiti","Add Files":"Pievienot failus"});
|
admin/js/plupload/i18n/ms.js
ADDED
@@ -0,0 +1,2 @@
|
|
|
|
|
1 |
+
// Malay (ms)
|
2 |
+
plupload.addI18n({"Stop Upload":"Berhenti Muat naik","Upload URL might be wrong or doesn't exist.":"URL muat naik mungkin salah atau tidak wujud.","tb":"tb","Size":"saiz","Close":"Tutup","You must specify either browse_button or drop_element.":"","Init error.":"Ralat perlaksanaan.","Add files to the upload queue and click the start button.":"Tambah fail ke dalam giliran muat naik dan klik butang Muat Naik.","List":"","Filename":"Nama fail","%s specified, but cannot be found.":"","Image format either wrong or not supported.":"Format imej sama ada salah atau tidak disokong.","Status":"Status","HTTP Error.":"Ralat HTTP.","Start Upload":"Muat Naik","Error: File too large:":"Ralat: Fail terlalu bersar:","kb":"kb","Duplicate file error.":"Ralat menggandakan fail.","File size error.":"Ralat saiz fail.","N/A":"N/A","gb":"gb","Error: Invalid file extension:":"Ralat: Sambungan fail tidak sah:","Select files":"Pilih fail","%s already present in the queue.":"%s telah ada dalam barisan.","Resoultion out of boundaries! <b>%s</b> runtime supports images only up to %wx%hpx.":"","File: %s":"Fail: %s","b":"b","Uploaded %d/%d files":"%d/%d telah dimuat naik","Upload element accepts only %d file(s) at a time. Extra files were stripped.":"Element muat naik hanya menerima %d fail(-fail) pada satu masa. Fail tambahan telah digugurkan.","%d files queued":"%d fail dalam barisan","File: %s, size: %d, max file size: %d":"Fail: %s, saiz: %d, saiz maks fail: %d","Thumbnails":"","Drag files here.":"Seret fail ke sini.","Runtime ran out of available memory.":"Ruang ingatan masa larian tidak mencukupi.","File count error.":"Ralat bilangan fail.","File extension error.":"Ralat sambungan fail.","mb":"mb","Add Files":"Tambah Fail"});
|
admin/js/plupload/i18n/nl.js
CHANGED
@@ -1,2 +1,2 @@
|
|
1 |
// Dutch (nl)
|
2 |
-
plupload.addI18n({"Stop Upload":"Stop Upload","Upload URL might be wrong or doesn't exist.":"Upload URL
|
1 |
// Dutch (nl)
|
2 |
+
plupload.addI18n({"Stop Upload":"Stop Upload","Upload URL might be wrong or doesn't exist.":"Upload URL is verkeerd of bestaat niet.","tb":"tb","Size":"Grootte","Close":"Sluiten","You must specify either browse_button or drop_element.":"","Init error.":"Initialisatie error.","Add files to the upload queue and click the start button.":"Voeg bestanden toe aan de wachtrij en druk op 'Start'.","List":"","Filename":"Bestandsnaam","%s specified, but cannot be found.":"","Image format either wrong or not supported.":"bestandsextensie is verkeerd of niet ondersteund.","Status":"Status","HTTP Error.":"HTTP Error.","Start Upload":"Start Upload","Error: File too large:":"Error: Bestand te groot:","kb":"kb","Duplicate file error.":"Bestand bestaat al.","File size error.":"Bestandsgrootte error.","N/A":"Niet beschikbaar","gb":"gb","Error: Invalid file extension:":"Error: Ongeldige bestandsextensie:","Select files":"Selecteer bestand(en):","%s already present in the queue.":"%s is al aan de wachtrij toegevoegd.","Resoultion out of boundaries! <b>%s</b> runtime supports images only up to %wx%hpx.":"","File: %s":"Bestand: %s","b":"b","Uploaded %d/%d files":"%d/%d bestanden ge-upload","Upload element accepts only %d file(s) at a time. Extra files were stripped.":"Upload accepteert alleen %d bestand(en) tegelijk. Extra bestanden zijn verwijderd.","%d files queued":"%d bestand(en) in de wachtrij","File: %s, size: %d, max file size: %d":"Bestand: %s, grootte: %d, maximale bestandsgrootte: %d","Thumbnails":"","Drag files here.":"Sleep bestanden hierheen.","Runtime ran out of available memory.":"Het maximum bruikbare geheugen is overschreden.","File count error.":"Teveel bestand(en) error.","File extension error.":"Ongeldig bestandsextensie.","mb":"mb","Add Files":"Bestand(en) toevoegen"});
|
admin/js/plupload/i18n/pl.js
CHANGED
@@ -1,2 +1,2 @@
|
|
1 |
// Polish (pl)
|
2 |
-
plupload.addI18n({"Stop Upload":"Przerwij transfer.","Upload URL might be wrong or doesn't exist.":"
|
1 |
// Polish (pl)
|
2 |
+
plupload.addI18n({"Stop Upload":"Przerwij transfer.","Upload URL might be wrong or doesn't exist.":"Adres URL może być nieprawidłowy lub może nie istnieć","tb":"tb","Size":"Rozmiar","Close":"Zamknij","You must specify either browse_button or drop_element.":"Musisz określić browse_button albo drop_element.","Init error.":"Błąd inicjalizacji.","Add files to the upload queue and click the start button.":"Dodaj pliki i kliknij 'Rozpocznij transfer'.","List":"Lista","Filename":"Nazwa pliku","%s specified, but cannot be found.":"%s określony ale nie można znaleźć.","Image format either wrong or not supported.":"Format zdjęcia jest zły lub nieobsługiwany","Status":"Status","HTTP Error.":"Błąd HTTP.","Start Upload":"Wyślij","Error: File too large:":"Błąd: Plik za duży:","kb":"kb","Duplicate file error.":"Błąd: duplikacja pliku.","File size error.":"Plik jest zbyt duży.","N/A":"Nie dostępne","gb":"gb","Error: Invalid file extension:":"Błąd: Nieprawidłowe rozszerzenie pliku:","Select files":"Wybierz pliki:","%s already present in the queue.":"%s już występuje w kolejce.","Resoultion out of boundaries! <b>%s</b> runtime supports images only up to %wx%hpx.":"Za duża rozdzielczość! <b>%s</b> maksymalna rozdzielczość to: %wx%hpx.","File: %s":"Plik: %s","b":"b","Uploaded %d/%d files":"Wysłano %d/%d plików","Upload element accepts only %d file(s) at a time. Extra files were stripped.":"Można jednocześnie dodać %d plików. Dodatkowe pliki zostały usunięte.","%d files queued":"%d plików w kolejce.","File: %s, size: %d, max file size: %d":"Plik: %s, rozmiar: %d, maksymalny rozmiar pliku: %d","Thumbnails":"Miniatury","Drag files here.":"Przeciągnij tu pliki","Runtime ran out of available memory.":"Wyczerpano pamięć RAM.","File count error.":"Błąd liczenia pliku.","File extension error.":"Nie obsługiwany format pliku.","mb":"mb","Add Files":"Dodaj pliki"});
|
admin/js/plupload/i18n/pt.js
ADDED
@@ -0,0 +1,2 @@
|
|
|
|
|
1 |
+
// Portuguese (pt)
|
2 |
+
plupload.addI18n({"Stop Upload":"Parar envio","Upload URL might be wrong or doesn't exist.":"O URL para carregar os ficheiros pode estar errado ou não existir.","tb":"tb","Size":"Tamanho","Close":"Fechar","You must specify either browse_button or drop_element.":"Deve especificar ou o botão de navegação browse_button ou o elemento de recolha drop_element.","Init error.":"Erro ao iniciar.","Add files to the upload queue and click the start button.":"Adicione ficheiros à fila e clique no botão iniciar.","List":"Lista","Filename":"Nome do ficheiro","%s specified, but cannot be found.":"%s definido mas não foi encontrado.","Image format either wrong or not supported.":"Formato da imagem errado ou não é suportado.","Status":"Estado","HTTP Error.":"Erro HTTP.","Start Upload":"Começar envio","Error: File too large:":"Erro: Ficheiro demasiado grande:","kb":"kb","Duplicate file error.":"Erro: ficheiro duplicado.","File size error.":"Tamanho do ficheiro errado.","N/A":"N/D","gb":"gb","Error: Invalid file extension:":"Erro: Extensão de ficheiro inválida:","Select files":"Seleccione ficheiros","%s already present in the queue.":"%s já se encontra em fila.","Resoultion out of boundaries! <b>%s</b> runtime supports images only up to %wx%hpx.":"Resolução excede os limites! <b>%s</b> suporta imagens até %wx%hpx.","File: %s":"Ficheiro: %s","b":"b","Uploaded %d/%d files":"Carregados %d/%d ficheiros","Upload element accepts only %d file(s) at a time. Extra files were stripped.":"Só é possível enviar %d ficheiro(s) de cada vez. Os restantes ficheiros foram excluídos.","%d files queued":"%d ficheiros em fila","File: %s, size: %d, max file size: %d":"Ficheiro: %s, tamanho: %d, tamanho máximo do ficheiro: %d","Thumbnails":"Miniaturas","Drag files here.":"Largar ficheiros aqui.","Runtime ran out of available memory.":"A execução esgotou a memória disponível.","File count error.":"Erro: contagem de ficheiros.","File extension error.":"Error de extensão do ficheiro.","mb":"mb","Add Files":"Adicionar ficheiros"});
|
admin/js/plupload/i18n/pt_BR.js
CHANGED
@@ -1,2 +1,2 @@
|
|
1 |
// Portuguese (Brazil) (pt_BR)
|
2 |
-
plupload.addI18n({"Stop Upload":"Parar o envio","Upload URL might be wrong or doesn't exist.":"URL de envio
|
1 |
// Portuguese (Brazil) (pt_BR)
|
2 |
+
plupload.addI18n({"Stop Upload":"Parar o envio","Upload URL might be wrong or doesn't exist.":"URL de envio incorreta ou inexistente","tb":"TB","Size":"Tamanho","Close":"Fechar","You must specify either browse_button or drop_element.":"Você deve especificar o botão para escolher(browse_button) os arquivos ou o elemento para arrastar(drop_element).","Init error.":"Erro ao iniciar.","Add files to the upload queue and click the start button.":"Adicione os arquivos à fila e clique no botão \"Iniciar o envio\".","List":"Listagem","Filename":"Nome do arquivo","%s specified, but cannot be found.":"Método de envio <b>%s</b> especificado, mas não pôde ser encontrado.","Image format either wrong or not supported.":"Imagem em formato desconhecido ou não permitido.","Status":"Status","HTTP Error.":"Erro HTTP.","Start Upload":"Iniciar o envio","Error: File too large:":"Erro: Arquivo muito grande:","kb":"KB","Duplicate file error.":"Erro: Arquivo duplicado.","File size error.":"Tamanho de arquivo não permitido.","N/A":"N/D","gb":"GB","Error: Invalid file extension:":"Erro: Extensão de arquivo inválida:","Select files":"Selecione os arquivos","%s already present in the queue.":"%s já presentes na fila.","Resoultion out of boundaries! <b>%s</b> runtime supports images only up to %wx%hpx.":"Resolução fora de tamanho. O método de envio <b>%s</b> suporta imagens com no máximo %wx%hpx.","File: %s":"Arquivo: %s","b":"Bytes","Uploaded %d/%d files":"%d\\/%d arquivo(s) enviados(s)","Upload element accepts only %d file(s) at a time. Extra files were stripped.":"Só são aceitos %d arquivos por vez. O que passou disso foi descartado.","%d files queued":"%d arquivo(s)","File: %s, size: %d, max file size: %d":"Arquivo: %s, Tamanho: %d , Tamanho Máximo do Arquivo: %d","Thumbnails":"Miniaturas","Drag files here.":"Arraste os arquivos pra cá","Runtime ran out of available memory.":"Método de envio ficou sem mem\\u00f3ria.","File count error.":"Erro na contagem dos arquivos","File extension error.":"Tipo de arquivo não permitido.","mb":"MB","Add Files":"Adicionar arquivo(s)"});
|
admin/js/plupload/i18n/ro.js
CHANGED
@@ -1,2 +1,2 @@
|
|
1 |
// Romanian (ro)
|
2 |
-
plupload.addI18n({"Stop Upload":"Oprește încărcarea","Upload URL might be wrong or doesn't exist.":"Upload URL might be wrong or doesn't exist.","tb":"tb","Size":"Mărime","Close":"Închide","Init error.":"Eroare inițializare.","Add files to the upload queue and click the start button.":"Adaugă fișiere în lista apoi apasă butonul \"Începe încărcarea\".","Filename":"Nume fișier","Image format either wrong or not supported.":"Formatul de imagine ori este greșit ori nu este suportat.","Status":"Stare","HTTP Error.":"Eroare HTTP","Start Upload":"Începe încărcarea","
|
1 |
// Romanian (ro)
|
2 |
+
plupload.addI18n({"Stop Upload":"Oprește încărcarea","Upload URL might be wrong or doesn't exist.":"Upload URL might be wrong or doesn't exist.","tb":"tb","Size":"Mărime","Close":"Închide","You must specify either browse_button or drop_element.":"","Init error.":"Eroare inițializare.","Add files to the upload queue and click the start button.":"Adaugă fișiere în lista apoi apasă butonul \"Începe încărcarea\".","List":"","Filename":"Nume fișier","%s specified, but cannot be found.":"","Image format either wrong or not supported.":"Formatul de imagine ori este greșit ori nu este suportat.","Status":"Stare","HTTP Error.":"Eroare HTTP","Start Upload":"Începe încărcarea","Error: File too large:":"Eroare: Fișierul este prea mare:","kb":"kb","Duplicate file error.":"Eroare duplicat fișier.","File size error.":"Eroare dimensiune fișier.","N/A":"N/A","gb":"gb","Error: Invalid file extension:":"Eroare: Extensia fișierului este invalidă:","Select files":"Selectează fișierele","%s already present in the queue.":"%s există deja în lista de așteptare.","Resoultion out of boundaries! <b>%s</b> runtime supports images only up to %wx%hpx.":"","File: %s":"Fișier: %s","b":"b","Uploaded %d/%d files":"Fișiere încărcate %d/%d","Upload element accepts only %d file(s) at a time. Extra files were stripped.":"Upload element accepts only %d file(s) at a time. Extra files were stripped.","%d files queued":"%d fișiere listate","File: %s, size: %d, max file size: %d":"Fișier: %s, mărime: %d, mărime maximă: %d","Thumbnails":"","Drag files here.":"Trage aici fișierele.","Runtime ran out of available memory.":"Runtime ran out of available memory.","File count error.":"Eroare numărare fișiere.","File extension error.":"Eroare extensie fișier.","mb":"mb","Add Files":"Adaugă fișiere"});
|
admin/js/plupload/i18n/ru.js
CHANGED
@@ -1,2 +1,2 @@
|
|
1 |
// Russian (ru)
|
2 |
-
plupload.addI18n({"Stop Upload":"Остановить Загрузку","Upload URL might be wrong or doesn't exist.":"Адрес заргузки неправильный или он не существует.","tb":"тб","Size":"Размер","Close":"Закрыть","Init error.":"Ошибка инициализации.","Add files to the upload queue and click the start button.":"Добавьте файлы в очередь и нажмите кнопку \"Загрузить файлы\".","Filename":"Имя файла","Image format either wrong or not supported.":"Формат картинки неправильный или он не поддерживается.","Status":"Статус","HTTP Error.":"Ошибка HTTP.","Start Upload":"Начать загрузку","
|
1 |
// Russian (ru)
|
2 |
+
plupload.addI18n({"Stop Upload":"Остановить Загрузку","Upload URL might be wrong or doesn't exist.":"Адрес заргузки неправильный или он не существует.","tb":"тб","Size":"Размер","Close":"Закрыть","You must specify either browse_button or drop_element.":"Вы должны указать browse_button или drop_element.","Init error.":"Ошибка инициализации.","Add files to the upload queue and click the start button.":"Добавьте файлы в очередь и нажмите кнопку \"Загрузить файлы\".","List":"Список","Filename":"Имя файла","%s specified, but cannot be found.":"%s существует, но не может быть найден.","Image format either wrong or not supported.":"Формат картинки неправильный или он не поддерживается.","Status":"Статус","HTTP Error.":"Ошибка HTTP.","Start Upload":"Начать загрузку","Error: File too large:":"Ошибка: Файл слишком большой:","kb":"кб","Duplicate file error.":"Такой файл уже присутствует в очереди.","File size error.":"Неправильный размер файла.","N/A":"N/A","gb":"гб","Error: Invalid file extension:":"Ошибка: У файла неправильное расширение:","Select files":"Выберите файлы","%s already present in the queue.":"%s уже присутствует в очереди.","Resoultion out of boundaries! <b>%s</b> runtime supports images only up to %wx%hpx.":"Слишком большое разрешение! <b>%s</b> поддерживаются изображения с размером не более %wx%hpx","File: %s":"Файл: %s","b":"б","Uploaded %d/%d files":"Загружено %d/%d файлов","Upload element accepts only %d file(s) at a time. Extra files were stripped.":"Загрузочный элемент за раз принимает только %d файл(ов). Лишние файлы были отброшены.","%d files queued":"В очереди %d файл(ов)","File: %s, size: %d, max file size: %d":"Файл: %s, размер: %d, макс. размер файла: %d","Thumbnails":"Миниатюра","Drag files here.":"Перетащите файлы сюда.","Runtime ran out of available memory.":"Рабочая среда превысила лимит достуной памяти.","File count error.":"Слишком много файлов.","File extension error.":"Неправильное расширение файла.","mb":"мб","Add Files":"Добавьте файлы"});
|
admin/js/plupload/i18n/sk.js
CHANGED
@@ -1,2 +1,2 @@
|
|
1 |
// Slovak (sk)
|
2 |
-
plupload.addI18n({"Stop Upload":"Zastaviť nahrávanie","Upload URL might be wrong or doesn't exist.":"
|
1 |
// Slovak (sk)
|
2 |
+
plupload.addI18n({"Stop Upload":"Zastaviť nahrávanie","Upload URL might be wrong or doesn't exist.":"URL pre nahratie nie je správna alebo neexistuje.","tb":"tb","Size":"Veľkosť","Close":"Zatvoriť","You must specify either browse_button or drop_element.":"","Init error.":"Chyba inicializácie.","Add files to the upload queue and click the start button.":"Pridajte súbory do zoznamu a potom spustite nahrávanie.","List":"","Filename":"Názov súboru","%s specified, but cannot be found.":"","Image format either wrong or not supported.":"Formát obrázku je nesprávny alebo nie je podporovaný.","Status":"Stav","HTTP Error.":"HTTP Chyba.","Start Upload":"Spustiť nahrávanie","Error: File too large:":"Chyba: Súbor je príliš veľký:","kb":"kb","Duplicate file error.":"Duplicitný súbor.","File size error.":"Súbor je príliš veľký.","N/A":"N/A","gb":"gb","Error: Invalid file extension:":"Error: Nesprávny typ súboru:","Select files":"Vyberte súbory","%s already present in the queue.":"%s sa už nachádza v zozname.","Resoultion out of boundaries! <b>%s</b> runtime supports images only up to %wx%hpx.":"","File: %s":"Súbor: %s","b":"b","Uploaded %d/%d files":"Nahraných %d/%d súborov","Upload element accepts only %d file(s) at a time. Extra files were stripped.":"Upload element accepts only %d file(s) at a time. Extra files were stripped.","%d files queued":"%d súborov pridaných do zoznamu","File: %s, size: %d, max file size: %d":"Súbor: %s, veľkosť: %d, max. veľkosť súboru: %d","Thumbnails":"","Drag files here.":"Sem pretiahnite súbory.","Runtime ran out of available memory.":"Runtime ran out of available memory.","File count error.":"Nesprávny počet súborov.","File extension error.":"Chybný typ súboru.","mb":"mb","Add Files":"Pridať súbory"});
|
admin/js/plupload/i18n/sl.js
ADDED
@@ -0,0 +1,2 @@
|
|
|
|
|
1 |
+
// Slovenian (sl)
|
2 |
+
plupload.addI18n({"Stop Upload":"Ustavi prenos","Upload URL might be wrong or doesn't exist.":"URL za nalaganje je napačen ali ne obstaja.","tb":"tb","Size":"Velikost","Close":"Zapri","You must specify either browse_button or drop_element.":"","Init error.":"Napaka pri inicializaciji.","Add files to the upload queue and click the start button.":"Dodaj datoteke na seznam in klikni na gumb začni","List":"Seznam","Filename":"Ime datoteke","%s specified, but cannot be found.":"","Image format either wrong or not supported.":"Format slike je napačen ali ni podrpt.","Status":"Status","HTTP Error.":"Neznana HTTP napaka.","Start Upload":"Začni prenos","Error: File too large:":"Napaka: datoteka je prevelika:","kb":"kb","Duplicate file error.":"Datoteka je že na seznamu.","File size error.":"Datoteka je prevelika.","N/A":"Ni na voljo","gb":"gb","Error: Invalid file extension:":"Napaka: napačen tip datoteke:","Select files":"Izberi datoteke","%s already present in the queue.":"%s je že na seznamu.","Resoultion out of boundaries! <b>%s</b> runtime supports images only up to %wx%hpx.":"","File: %s":"Datoteka: %s","b":"b","Uploaded %d/%d files":"Naloženo %d/%d datotek","Upload element accepts only %d file(s) at a time. Extra files were stripped.":"Nalagalnik sprejme samo %d datotek na enkrat. Višek datotek je odstranjen iz seznama.","%d files queued":"%d datotek na seznamu","File: %s, size: %d, max file size: %d":"Datoteka: %s, velikost: %d, največja dovoljena velikost: %d","Thumbnails":"Sličice","Drag files here.":"Potegni datoteke sem.","Runtime ran out of available memory.":"Zmanjkalo je pomnilnika.","File count error.":"Napačno število datotek.","File extension error.":"Napačen tip datoteke.","mb":"mb","Add Files":"Dodaj datoteke"});
|
admin/js/plupload/i18n/sq.js
ADDED
@@ -0,0 +1,2 @@
|
|
|
|
|
1 |
+
// Albanian (sq)
|
2 |
+
plupload.addI18n({"Stop Upload":"Ndalimi i ngarkimit","Upload URL might be wrong or doesn't exist.":"Ngarkimi i URL-s është i gabuar ose nuk ekziston.","tb":"TB","Size":"Madhësia","Close":"Mbyll","You must specify either browse_button or drop_element.":"","Init error.":"Init gabim.","Add files to the upload queue and click the start button.":"Mbas ngarkimit të dosjeve sipas rradhës duhet të klikoni butonin Start.","List":"","Filename":"Emri i dosjes","%s specified, but cannot be found.":"","Image format either wrong or not supported.":"Formati i fotove është i keq ose nuk është i pranueshëm.","Status":"Statusi","HTTP Error.":"HTTP Gabim.","Start Upload":"Nisja e ngarkimit","Error: File too large:":"Gabim: dosja është shumë e madhe:","kb":"KB","Duplicate file error.":"Gabim i dublikimit të dosjes.","File size error.":"Gabim i madhësisë së dosjes.","N/A":"Nuk është në dispozicion","gb":"GB","Error: Invalid file extension:":"Gabim: përhapja e llojit të dosjes është e pavlefshme:","Select files":"Zhgjidhni dosjet","%s already present in the queue.":"%s tashmë ekziston në list.","Resoultion out of boundaries! <b>%s</b> runtime supports images only up to %wx%hpx.":"","File: %s":"Dosje: %s","b":"B","Uploaded %d/%d files":"Dosjet e ngarkuara: %d/%d","Upload element accepts only %d file(s) at a time. Extra files were stripped.":"Ngarkimi pranon njëherësh vetëm %d dosje, dosjet e tjera nuk do të jenë të ngarkuara.","%d files queued":"Dosja %d e vendosur në rradhë","File: %s, size: %d, max file size: %d":"Dosje: %s, madhësia: %d, madhësia maximale e dosjes: %d","Thumbnails":"","Drag files here.":"Këtu mund të tërhiqni dosjet","Runtime ran out of available memory.":"Memoria që ishte në dispozicion ka mbaruar.","File count error.":"Gabim në lidhje me numrin e dosjeve.","File extension error.":"Gabim i zgjerimit të dosjes.","mb":"MB","Add Files":"Shtoni dosjet"});
|
admin/js/plupload/i18n/sr.js
CHANGED
@@ -1,2 +1,2 @@
|
|
1 |
// Serbian (sr)
|
2 |
-
plupload.addI18n({"Stop Upload":"Stop Upload","Upload URL might be wrong or doesn't exist.":"Upload URL might be wrong or doesn't exist.","tb":"","Size":"Veličina","Close":"Close","Init error.":"Init error.","Add files to the upload queue and click the start button.":"Dodajte fajlove u listu i kliknite na dugme Start.","Filename":"Naziv fajla","Image format either wrong or not supported.":"Image format either wrong or not supported.","Status":"Status","HTTP Error.":"HTTP Error.","Start Upload":"Počni upload","
|
1 |
// Serbian (sr)
|
2 |
+
plupload.addI18n({"Stop Upload":"Stop Upload","Upload URL might be wrong or doesn't exist.":"Upload URL might be wrong or doesn't exist.","tb":"","Size":"Veličina","Close":"Close","You must specify either browse_button or drop_element.":"","Init error.":"Init error.","Add files to the upload queue and click the start button.":"Dodajte fajlove u listu i kliknite na dugme Start.","List":"","Filename":"Naziv fajla","%s specified, but cannot be found.":"","Image format either wrong or not supported.":"Image format either wrong or not supported.","Status":"Status","HTTP Error.":"HTTP Error.","Start Upload":"Počni upload","Error: File too large:":"Error: File too large:","kb":"","Duplicate file error.":"","File size error.":"File size error.","N/A":"N/A","gb":"","Error: Invalid file extension:":"Error: Invalid file extension:","Select files":"Izaberite fajlove","%s already present in the queue.":"","Resoultion out of boundaries! <b>%s</b> runtime supports images only up to %wx%hpx.":"","File: %s":"File: %s","b":"","Uploaded %d/%d files":"Snimljeno %d/%d fajlova","Upload element accepts only %d file(s) at a time. Extra files were stripped.":"Upload element accepts only %d file(s) at a time. Extra files were stripped.","%d files queued":"%d files queued","File: %s, size: %d, max file size: %d":"","Thumbnails":"","Drag files here.":"Prevucite fajlove ovde.","Runtime ran out of available memory.":"Runtime ran out of available memory.","File count error.":"File count error.","File extension error.":"File extension error.","mb":"","Add Files":"Dodaj fajlove"});
|
admin/js/plupload/i18n/sv.js
CHANGED
@@ -1,2 +1,2 @@
|
|
1 |
// Swedish (sv)
|
2 |
-
plupload.addI18n({"Stop Upload":"
|
1 |
// Swedish (sv)
|
2 |
+
plupload.addI18n({"Stop Upload":"Avbryt","Upload URL might be wrong or doesn't exist.":"URL:en va fel eller existerar inte.","tb":"tb","Size":"Storlek","Close":"Stäng","You must specify either browse_button or drop_element.":"Du behöver specificera browse_button eller drop_element.","Init error.":"Problem vid initialisering.","Add files to the upload queue and click the start button.":"Lägg till filer till kön och tryck på start.","List":"Lista","Filename":"Filnamn","%s specified, but cannot be found.":"%s specificerad, men hittades inte.","Image format either wrong or not supported.":"Bildformatet är fel eller så finns inte stöd för det.","Status":"Status","HTTP Error.":"HTTP problem.","Start Upload":"Starta","Error: File too large:":"Fel: Filen är för stor:","kb":"kb","Duplicate file error.":"Problem med dubbla filer.","File size error.":"Problem med filstorlek.","N/A":"N/A","gb":"gb","Error: Invalid file extension:":"Fel: Ej godkänd filändelse.","Select files":"Välj filer","%s already present in the queue.":"%s är redan tillagd.","Resoultion out of boundaries! <b>%s</b> runtime supports images only up to %wx%hpx.":"Upplösning utanför gränserna! <b>%s</b> bara bilder upp till %wx%hpx stöds.","File: %s":"Fil: %s","b":"b","Uploaded %d/%d files":"Laddade upp %d/%d filer","Upload element accepts only %d file(s) at a time. Extra files were stripped.":"Det går bara lägga till %d filer åt gången, allt utöver detta togs bort.","%d files queued":"%d filer i kö","File: %s, size: %d, max file size: %d":"Fil: %s, storlek: %d, max storlek: %d","Thumbnails":"Miniatyrer","Drag files here.":"Dra filer hit","Runtime ran out of available memory.":"Slut på minne.","File count error.":"Räknefel.","File extension error.":"Problem med filändelse.","mb":"mb","Add Files":"Lägg till"});
|
admin/js/plupload/i18n/th_TH.js
CHANGED
@@ -1,2 +1,2 @@
|
|
1 |
// Thai (Thailand) (th_TH)
|
2 |
-
plupload.addI18n({"Stop Upload":"หยุดอัพโหลด","Upload URL might be wrong or doesn't exist.":"URL ของการอัพโหลดอาจจะผิดหรือไม่มีอยู่","tb":"เทราไบต์","Size":"ขนาด","Close":"ปิด","Init error.":"Init เกิดข้อผิดพลาด","Add files to the upload queue and click the start button.":"เพิ่มไฟล์ไปยังคิวอัพโหลดและคลิกที่ปุ่มเริ่ม","Filename":"ชื่อไฟล์","Image format either wrong or not supported.":"รูปแบบรูปภาพทั้งสองผิดหรือไม่รองรับ","Status":"สถานะ","HTTP Error.":"HTTP เกิดข้อผิดพลาด","Start Upload":"เริ่มอัพโหลด","
|
1 |
// Thai (Thailand) (th_TH)
|
2 |
+
plupload.addI18n({"Stop Upload":"หยุดอัพโหลด","Upload URL might be wrong or doesn't exist.":"URL ของการอัพโหลดอาจจะผิดหรือไม่มีอยู่","tb":"เทราไบต์","Size":"ขนาด","Close":"ปิด","You must specify either browse_button or drop_element.":"","Init error.":"Init เกิดข้อผิดพลาด","Add files to the upload queue and click the start button.":"เพิ่มไฟล์ไปยังคิวอัพโหลดและคลิกที่ปุ่มเริ่ม","List":"","Filename":"ชื่อไฟล์","%s specified, but cannot be found.":"","Image format either wrong or not supported.":"รูปแบบรูปภาพทั้งสองผิดหรือไม่รองรับ","Status":"สถานะ","HTTP Error.":"HTTP เกิดข้อผิดพลาด","Start Upload":"เริ่มอัพโหลด","Error: File too large:":"ข้อผิดพลาด: ไฟล์ใหญ่เกินไป:","kb":"กิโลไบต์","Duplicate file error.":"ไฟล์ที่ซ้ำกันเกิดข้อผิดพลาด","File size error.":"ขนาดไฟล์เกิดข้อผิดพลาด","N/A":"N/A","gb":"กิกะไบต์","Error: Invalid file extension:":"ข้อผิดพลาด: นามสกุลไฟล์ไม่ถูกต้อง:","Select files":"เลือกไฟล์","%s already present in the queue.":"%s อยู่ในคิวแล้ว","Resoultion out of boundaries! <b>%s</b> runtime supports images only up to %wx%hpx.":"","File: %s":"ไฟล์: %s","b":"ไบต์","Uploaded %d/%d files":"อัพโหลดแล้ว %d/%d ไฟล์","Upload element accepts only %d file(s) at a time. Extra files were stripped.":"การอัพโหลดจะยอมรับเฉพาะ %d ไฟล์(s) ในช่วงเวลาเดียวกัน เมื่อไฟล์พิเศษถูกปลดออก","%d files queued":"%d ไฟล์ที่อยู่ในคิว","File: %s, size: %d, max file size: %d":"ไฟล์: %s, ขนาด: %d, ขนาดไฟล์สูงสุด: %d","Thumbnails":"","Drag files here.":"ลากไฟล์มาที่นี่","Runtime ran out of available memory.":"รันไทม์วิ่งออกมาจากหน่วยความจำ","File count error.":"การนับไฟล์เกิดข้อผิดพลาด","File extension error.":"นามสกุลไฟล์เกิดข้อผิดพลาด","mb":"เมกะไบต์","Add Files":"เพิ่มไฟล์"});
|
admin/js/plupload/i18n/tr.js
CHANGED
@@ -1,2 +1,2 @@
|
|
1 |
// Turkish (tr)
|
2 |
-
plupload.addI18n({"Stop Upload":"Yüklemeyi durdur","Upload URL might be wrong or doesn't exist.":"URL yok ya da hatalı olabilir.","tb":"tb","Size":"Boyut","Close":"Kapat","Init error.":"Başlangıç hatası.","Add files to the upload queue and click the start button.":"Dosyaları kuyruğa ekleyin ve başlatma butonuna tıklayın.","Filename":"Dosya adı","Image format either wrong or not supported.":"Resim formatı yanlış ya da desteklenmiyor.","Status":"Durum","HTTP Error.":"HTTP hatası.","Start Upload":"Yüklemeyi başlat","
|
1 |
// Turkish (tr)
|
2 |
+
plupload.addI18n({"Stop Upload":"Yüklemeyi durdur","Upload URL might be wrong or doesn't exist.":"URL yok ya da hatalı olabilir.","tb":"tb","Size":"Boyut","Close":"Kapat","You must specify either browse_button or drop_element.":"browse_button veya drop_element değişkenlerini belirlemelisiniz.","Init error.":"Başlangıç hatası.","Add files to the upload queue and click the start button.":"Dosyaları kuyruğa ekleyin ve başlatma butonuna tıklayın.","List":"Liste","Filename":"Dosya adı","%s specified, but cannot be found.":"%s tanımlandı fakat bulunamadı.","Image format either wrong or not supported.":"Resim formatı yanlış ya da desteklenmiyor.","Status":"Durum","HTTP Error.":"HTTP hatası.","Start Upload":"Yüklemeyi başlat","Error: File too large:":"Hata: Dosya çok büyük:","kb":"kb","Duplicate file error.":"Yinelenen dosya hatası.","File size error.":"Dosya boyutu hatası.","N/A":"-","gb":"gb","Error: Invalid file extension:":"Hata: Geçersiz dosya uzantısı:","Select files":"Dosyaları seç","%s already present in the queue.":"%s kuyrukta zaten mevcut.","Resoultion out of boundaries! <b>%s</b> runtime supports images only up to %wx%hpx.":"Çözünürlük sınırların dışındadır! <b>%s</b> modu en fazla %wx%hpx desteklemektedir.","File: %s":"Dosya: %s","b":"bayt","Uploaded %d/%d files":"%d/%d dosya yüklendi","Upload element accepts only %d file(s) at a time. Extra files were stripped.":"Yükleme elemanı aynı anda %d dosya kabul eder. Ekstra dosyalar işleme konulmaz.","%d files queued":"Kuyrukta %d dosya var.","File: %s, size: %d, max file size: %d":"Dosya: %s, boyut: %d, maksimum dosya boyutu: %d","Thumbnails":"Önizlemeler","Drag files here.":"Dosyaları buraya bırakın.","Runtime ran out of available memory.":"İşlem için yeterli bellek yok.","File count error.":"Dosya sayım hatası.","File extension error.":"Dosya uzantısı hatası.","mb":"mb","Add Files":"Dosya ekle"});
|
admin/js/plupload/i18n/uk_UA.js
CHANGED
@@ -1,2 +1,2 @@
|
|
1 |
// Ukrainian (Ukraine) (uk_UA)
|
2 |
-
plupload.addI18n({"Stop Upload":"Зупинити завантаження","Upload URL might be wrong or doesn't exist.":"Адреса завантаження неправильна або не існує.","tb":"","Size":"Розмір","Close":"Закрити","Init error.":"Помилка ініціалізації.","Add files to the upload queue and click the start button.":"Додайте файли в чергу та натисніть кнопку \"Завантажити файли\".","Filename":"Назва файлу","Image format either wrong or not supported.":"Формат картинки не правильний або не підтримується.","Status":"Статус","HTTP Error.":"Помилка HTTP.","Start Upload":"Почати завантаження","
|
1 |
// Ukrainian (Ukraine) (uk_UA)
|
2 |
+
plupload.addI18n({"Stop Upload":"Зупинити завантаження","Upload URL might be wrong or doesn't exist.":"Адреса завантаження неправильна або не існує.","tb":"тб","Size":"Розмір","Close":"Закрити","You must specify either browse_button or drop_element.":"Ви маєте вказати або browse_button, або drop_element.","Init error.":"Помилка ініціалізації.","Add files to the upload queue and click the start button.":"Додайте файли в чергу та натисніть кнопку \"Завантажити файли\".","List":"Список","Filename":"Назва файлу","%s specified, but cannot be found.":"%s вказано, але не може бути знайдено.","Image format either wrong or not supported.":"Формат картинки не правильний або не підтримується.","Status":"Статус","HTTP Error.":"Помилка HTTP.","Start Upload":"Почати завантаження","Error: File too large:":"Помилка: Файл занадто великий:","kb":"кб","Duplicate file error.":"Такий файл вже присутній в черзі.","File size error.":"Неправильний розмір файлу.","N/A":"Н/Д","gb":"гб","Error: Invalid file extension:":"Помилка: У файлу неправильне розширення:","Select files":"Оберіть файли","%s already present in the queue.":"%s вже присутній у черзі.","Resoultion out of boundaries! <b>%s</b> runtime supports images only up to %wx%hpx.":"Роздільна здатність поза межами! Робоче середовище <b>%s</b> підтримує зображення лише до %wx%hpx.","File: %s":"Файл: %s","b":"б","Uploaded %d/%d files":"Завантажено %d/%d файлів","Upload element accepts only %d file(s) at a time. Extra files were stripped.":"Завантажувальний елемент приймає лише %d файл(ів) одночасно. Зайві файли було відкинуто.","%d files queued":"В черзі %d файл(ів)","File: %s, size: %d, max file size: %d":"Файл: %s, розмір: %d, макс. розмір файлу: %d","Thumbnails":"Мініатюри","Drag files here.":"Перетягніть файли сюди.","Runtime ran out of available memory.":"Робоче середовище перевищило ліміт доступної пам'яті.","File count error.":"Занадто багато файлів.","File extension error.":"Неправильне розширення файлу.","mb":"мб","Add Files":"Додати файли"});
|
admin/js/plupload/i18n/vi.js
ADDED
@@ -0,0 +1,2 @@
|
|
|
|
|
1 |
+
// Vietnamese (vi)
|
2 |
+
plupload.addI18n({"Stop Upload":"Dừng","Upload URL might be wrong or doesn't exist.":"Đường dẫn URL tải lên không đúng hoặc không tồn tại.","tb":"TB","Size":"Dung lượng","Close":"Đóng","You must specify either browse_button or drop_element.":"","Init error.":"Lỗi khởi tạo","Add files to the upload queue and click the start button.":"Thêm tập tin để tải lên và bấm vào nút bắt đầu","List":"Danh sách","Filename":"Tên tập tin","%s specified, but cannot be found.":"%s đã chỉ định nhưng không thể tìm thấy.","Image format either wrong or not supported.":"Định dạng hình ảnh không đúng hoặc không được hỗ trợ.","Status":"Trạng thái","HTTP Error.":"Lỗi HTTP","Start Upload":"Bắt đầu","Error: File too large:":"Lỗi: Dung lượng tập tin quá lớn:","kb":"KB","Duplicate file error.":"Tập tin đã tồn tại","File size error.":"Lỗi dung lượng tập tin","N/A":"Chưa có thông tin","gb":"GB","Error: Invalid file extension:":"Lỗi: Định dạng tập tin không xác định:","Select files":"Chọn tập tin","%s already present in the queue.":"%s đã có trong danh sách chờ tải lên","Resoultion out of boundaries! <b>%s</b> runtime supports images only up to %wx%hpx.":"Độ phân giải quá lớn! <b>%s</b> chỉ hỗ trợ kích thước tối đa %wx%hpx.","File: %s":"Tập tin: %s","b":"B","Uploaded %d/%d files":"Đã tải lên %d/%d tập tin","Upload element accepts only %d file(s) at a time. Extra files were stripped.":"Chỉ có thể tải lên (%d) tập tin cùng một lúc. Những tập tin còn lại đã bị huỷ bỏ.","%d files queued":"%d tập tin trong danh sách chờ","File: %s, size: %d, max file size: %d":"Tập tin: %s, dung lượng %d, dung lượng tối đa: %d","Thumbnails":"Ảnh thu nhỏ","Drag files here.":"Thả tập tin vào đây","Runtime ran out of available memory.":"Thời gian chạy vượt quá giới hạn bộ nhớ cho phép.","File count error.":"Lỗi đếm tập tin","File extension error.":"Lỗi định dạng tập tin","mb":"MB","Add Files":"Thêm tập tin"});
|
admin/js/plupload/i18n/zh_CN.js
CHANGED
@@ -1,2 +1,2 @@
|
|
1 |
// Chinese (China) (zh_CN)
|
2 |
-
plupload.addI18n({"Stop Upload":"停止上传","Upload URL might be wrong or doesn't exist.":"上传的URL可能是错误的或不存在。","tb":"tb","Size":"大小","Close":"关闭","Init error.":"初始化错误。","Add files to the upload queue and click the start button.":"将文件添加到上传队列,然后点击”开始上传“按钮。","Filename":"文件名","Image format either wrong or not supported.":"图片格式错误或者不支持。","Status":"状态","HTTP Error.":"HTTP 错误。","Start Upload":"开始上传","
|
1 |
// Chinese (China) (zh_CN)
|
2 |
+
plupload.addI18n({"Stop Upload":"停止上传","Upload URL might be wrong or doesn't exist.":"上传的URL可能是错误的或不存在。","tb":"tb","Size":"大小","Close":"关闭","You must specify either browse_button or drop_element.":"您必须指定 browse_button 或者 drop_element。","Init error.":"初始化错误。","Add files to the upload queue and click the start button.":"将文件添加到上传队列,然后点击”开始上传“按钮。","List":"列表","Filename":"文件名","%s specified, but cannot be found.":"%s 已指定,但是没有找到。","Image format either wrong or not supported.":"图片格式错误或者不支持。","Status":"状态","HTTP Error.":"HTTP 错误。","Start Upload":"开始上传","Error: File too large:":"错误: 文件太大:","kb":"kb","Duplicate file error.":"重复文件错误。","File size error.":"文件大小错误。","N/A":"N/A","gb":"gb","Error: Invalid file extension:":"错误:无效的文件扩展名:","Select files":"选择文件","%s already present in the queue.":"%s 已经在当前队列里。","Resoultion out of boundaries! <b>%s</b> runtime supports images only up to %wx%hpx.":"超限。<b>%s</b> 支持最大 %wx%hpx 的图片。","File: %s":"文件: %s","b":"b","Uploaded %d/%d files":"已上传 %d/%d 个文件","Upload element accepts only %d file(s) at a time. Extra files were stripped.":"每次只接受同时上传 %d 个文件,多余的文件将会被删除。","%d files queued":"%d 个文件加入到队列","File: %s, size: %d, max file size: %d":"文件: %s, 大小: %d, 最大文件大小: %d","Thumbnails":"缩略图","Drag files here.":"把文件拖到这里。","Runtime ran out of available memory.":"运行时已消耗所有可用内存。","File count error.":"文件数量错误。","File extension error.":"文件扩展名错误。","mb":"mb","Add Files":"增加文件"});
|
admin/js/plupload/i18n/zh_TW.js
CHANGED
@@ -1,2 +1,2 @@
|
|
1 |
// Chinese (Taiwan) (zh_TW)
|
2 |
-
plupload.addI18n({"Stop Upload":"停止上傳","Upload URL might be wrong or doesn't exist.":"檔案URL可能有誤或者不存在。","tb":"tb","Size":"大小","Close":"關閉","Init error.":"初始化錯誤。","Add files to the upload queue and click the start button.":"將檔案加入上傳序列,然後點選”開始上傳“按鈕。","Filename":"檔案名稱","Image format either wrong or not supported.":"圖片格式錯誤或者不支援。","Status":"狀態","HTTP Error.":"HTTP 錯誤。","Start Upload":"開始上傳","
|
1 |
// Chinese (Taiwan) (zh_TW)
|
2 |
+
plupload.addI18n({"Stop Upload":"停止上傳","Upload URL might be wrong or doesn't exist.":"檔案URL可能有誤或者不存在。","tb":"tb","Size":"大小","Close":"關閉","You must specify either browse_button or drop_element.":"您必須指定 browse_button 或 drop_element。","Init error.":"初始化錯誤。","Add files to the upload queue and click the start button.":"將檔案加入上傳序列,然後點選”開始上傳“按鈕。","List":"清單","Filename":"檔案名稱","%s specified, but cannot be found.":"找不到已選擇的 %s。","Image format either wrong or not supported.":"圖片格式錯誤或者不支援。","Status":"狀態","HTTP Error.":"HTTP 錯誤。","Start Upload":"開始上傳","Error: File too large:":"錯誤: 檔案大小太大:","kb":"kb","Duplicate file error.":"錯誤:檔案重複。","File size error.":"錯誤:檔案大小超過限制。","N/A":"N/A","gb":"gb","Error: Invalid file extension:":"錯誤:不接受的檔案格式:","Select files":"選擇檔案","%s already present in the queue.":"%s 已經存在目前的檔案序列。","Resoultion out of boundaries! <b>%s</b> runtime supports images only up to %wx%hpx.":"圖片解析度超出範圍! <b>%s</b> 最高只支援到 %wx%hpx。","File: %s":"檔案: %s","b":"b","Uploaded %d/%d files":"已上傳 %d/%d 個文件","Upload element accepts only %d file(s) at a time. Extra files were stripped.":"每次只能上傳 %d 個檔案,超過限制數量的檔案將被忽略。","%d files queued":"%d 個檔案加入到序列","File: %s, size: %d, max file size: %d":"檔案: %s, 大小: %d, 檔案大小上限: %d","Thumbnails":"縮圖","Drag files here.":"把檔案拖曳到這裡。","Runtime ran out of available memory.":"執行時耗盡了所有可用的記憶體。","File count error.":"檔案數量錯誤。","File extension error.":"檔案副檔名錯誤。","mb":"mb","Add Files":"增加檔案"});
|
admin/js/plupload/jquery.plupload.queue/css/jquery.plupload.queue.css
ADDED
@@ -0,0 +1,185 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
/*
|
2 |
+
Plupload
|
3 |
+
------------------------------------------------------------------- */
|
4 |
+
|
5 |
+
.plupload_wrapper * {
|
6 |
+
box-sizing: content-box;
|
7 |
+
}
|
8 |
+
|
9 |
+
.plupload_button {
|
10 |
+
display: -moz-inline-box; /* FF < 3*/
|
11 |
+
display: inline-block;
|
12 |
+
font: normal 12px sans-serif;
|
13 |
+
text-decoration: none;
|
14 |
+
color: #42454a;
|
15 |
+
border: 1px solid #bababa;
|
16 |
+
padding: 2px 8px 3px 20px;
|
17 |
+
margin-right: 4px;
|
18 |
+
background: #f3f3f3 url('../img/buttons.png') no-repeat 0 center;
|
19 |
+
outline: 0;
|
20 |
+
|
21 |
+
/* Optional rounded corners for browsers that support it */
|
22 |
+
-moz-border-radius: 3px;
|
23 |
+
-khtml-border-radius: 3px;
|
24 |
+
-webkit-border-radius: 3px;
|
25 |
+
border-radius: 3px;
|
26 |
+
}
|
27 |
+
|
28 |
+
.plupload_button:hover {
|
29 |
+
color: #000;
|
30 |
+
text-decoration: none;
|
31 |
+
}
|
32 |
+
|
33 |
+
.plupload_disabled, a.plupload_disabled:hover {
|
34 |
+
color: #737373;
|
35 |
+
border-color: #c5c5c5;
|
36 |
+
background: #ededed url('../img/buttons-disabled.png') no-repeat 0 center;
|
37 |
+
cursor: default;
|
38 |
+
}
|
39 |
+
|
40 |
+
.plupload_add {
|
41 |
+
background-position: -181px center;
|
42 |
+
}
|
43 |
+
|
44 |
+
.plupload_wrapper {
|
45 |
+
font: normal 11px Verdana,sans-serif;
|
46 |
+
width: 100%;
|
47 |
+
}
|
48 |
+
|
49 |
+
.plupload_container {
|
50 |
+
padding: 8px;
|
51 |
+
background: url('../img/transp50.png');
|
52 |
+
/*-moz-border-radius: 5px;*/
|
53 |
+
}
|
54 |
+
|
55 |
+
.plupload_container input {
|
56 |
+
border: 1px solid #DDD;
|
57 |
+
font: normal 11px Verdana,sans-serif;
|
58 |
+
width: 98%;
|
59 |
+
}
|
60 |
+
|
61 |
+
.plupload_header {background: #2A2C2E url('../img/backgrounds.gif') repeat-x;}
|
62 |
+
.plupload_header_content {
|
63 |
+
background: url('../img/backgrounds.gif') no-repeat 0 -317px;
|
64 |
+
min-height: 56px;
|
65 |
+
padding-left: 60px;
|
66 |
+
color: #FFF;
|
67 |
+
}
|
68 |
+
.plupload_header_title {
|
69 |
+
font: normal 18px sans-serif;
|
70 |
+
padding: 6px 0 3px;
|
71 |
+
}
|
72 |
+
.plupload_header_text {
|
73 |
+
font: normal 12px sans-serif;
|
74 |
+
}
|
75 |
+
|
76 |
+
.plupload_filelist {
|
77 |
+
margin: 0;
|
78 |
+
padding: 0;
|
79 |
+
list-style: none;
|
80 |
+
}
|
81 |
+
|
82 |
+
.plupload_scroll .plupload_filelist {
|
83 |
+
height: 185px;
|
84 |
+
background: #F5F5F5;
|
85 |
+
overflow-y: scroll;
|
86 |
+
}
|
87 |
+
|
88 |
+
.plupload_filelist li {
|
89 |
+
padding: 10px 8px;
|
90 |
+
background: #F5F5F5 url('../img/backgrounds.gif') repeat-x 0 -156px;
|
91 |
+
border-bottom: 1px solid #DDD;
|
92 |
+
}
|
93 |
+
|
94 |
+
.plupload_filelist_header, .plupload_filelist_footer {
|
95 |
+
background: #DFDFDF;
|
96 |
+
padding: 8px 8px;
|
97 |
+
color: #42454A;
|
98 |
+
}
|
99 |
+
.plupload_filelist_header {
|
100 |
+
border-top: 1px solid #EEE;
|
101 |
+
border-bottom: 1px solid #CDCDCD;
|
102 |
+
}
|
103 |
+
|
104 |
+
.plupload_filelist_footer {border-top: 1px solid #FFF; height: 22px; line-height: 20px; vertical-align: middle;}
|
105 |
+
.plupload_file_name {float: left; overflow: hidden}
|
106 |
+
.plupload_file_status {color: #777;}
|
107 |
+
.plupload_file_status span {color: #42454A;}
|
108 |
+
.plupload_file_size, .plupload_file_status, .plupload_progress {
|
109 |
+
float: right;
|
110 |
+
width: 80px;
|
111 |
+
}
|
112 |
+
.plupload_file_size, .plupload_file_status, .plupload_file_action {text-align: right;}
|
113 |
+
|
114 |
+
.plupload_filelist .plupload_file_name {
|
115 |
+
width: 205px;
|
116 |
+
white-space: nowrap;
|
117 |
+
text-overflow: ellipsis;
|
118 |
+
}
|
119 |
+
|
120 |
+
.plupload_file_action {
|
121 |
+
float: right;
|
122 |
+
width: 16px;
|
123 |
+
height: 16px;
|
124 |
+
margin-left: 15px;
|
125 |
+
}
|
126 |
+
|
127 |
+
.plupload_file_action * {
|
128 |
+
display: none;
|
129 |
+
width: 16px;
|
130 |
+
height: 16px;
|
131 |
+
}
|
132 |
+
|
133 |
+
li.plupload_uploading {background: #ECF3DC url('../img/backgrounds.gif') repeat-x 0 -238px;}
|
134 |
+
li.plupload_done {color:#AAA}
|
135 |
+
|
136 |
+
li.plupload_delete a {
|
137 |
+
background: url('../img/delete.gif');
|
138 |
+
}
|
139 |
+
|
140 |
+
li.plupload_failed a {
|
141 |
+
background: url('../img/error.gif');
|
142 |
+
cursor: default;
|
143 |
+
}
|
144 |
+
|
145 |
+
li.plupload_done a {
|
146 |
+
background: url('../img/done.gif');
|
147 |
+
cursor: default;
|
148 |
+
}
|
149 |
+
|
150 |
+
.plupload_progress, .plupload_upload_status {
|
151 |
+
display: none;
|
152 |
+
}
|
153 |
+
|
154 |
+
.plupload_progress_container {
|
155 |
+
margin-top: 3px;
|
156 |
+
border: 1px solid #CCC;
|
157 |
+
background: #FFF;
|
158 |
+
padding: 1px;
|
159 |
+
}
|
160 |
+
.plupload_progress_bar {
|
161 |
+
width: 0px;
|
162 |
+
height: 7px;
|
163 |
+
background: #CDEB8B;
|
164 |
+
}
|
165 |
+
|
166 |
+
.plupload_scroll .plupload_filelist_header .plupload_file_action, .plupload_scroll .plupload_filelist_footer .plupload_file_action {
|
167 |
+
margin-right: 17px;
|
168 |
+
}
|
169 |
+
|
170 |
+
/* Floats */
|
171 |
+
|
172 |
+
.plupload_clear,.plupload_clearer {clear: both;}
|
173 |
+
.plupload_clearer, .plupload_progress_bar {
|
174 |
+
display: block;
|
175 |
+
font-size: 0;
|
176 |
+
line-height: 0;
|
177 |
+
}
|
178 |
+
|
179 |
+
li.plupload_droptext {
|
180 |
+
background: transparent;
|
181 |
+
text-align: center;
|
182 |
+
vertical-align: middle;
|
183 |
+
border: 0;
|
184 |
+
line-height: 165px;
|
185 |
+
}
|
admin/js/plupload/jquery.plupload.queue/img/backgrounds.gif
ADDED
Binary file
|
admin/js/plupload/jquery.plupload.queue/img/buttons-disabled.png
ADDED
Binary file
|
admin/js/plupload/jquery.plupload.queue/img/buttons.png
ADDED
Binary file
|
admin/js/plupload/jquery.plupload.queue/img/delete.gif
ADDED
Binary file
|
admin/js/plupload/jquery.plupload.queue/img/done.gif
ADDED
Binary file
|
admin/js/plupload/jquery.plupload.queue/img/error.gif
ADDED
Binary file
|
admin/js/plupload/jquery.plupload.queue/img/throbber.gif
ADDED
Binary file
|
admin/js/plupload/jquery.plupload.queue/img/transp50.png
ADDED
Binary file
|
admin/js/plupload/jquery.plupload.queue/jquery.plupload.queue.js
ADDED
@@ -0,0 +1,433 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
/**
|
2 |
+
* jquery.plupload.queue.js
|
3 |
+
*
|
4 |
+
* Copyright 2009, Moxiecode Systems AB
|
5 |
+
* Released under GPL License.
|
6 |
+
*
|
7 |
+
* License: http://www.plupload.com/license
|
8 |
+
* Contributing: http://www.plupload.com/contributing
|
9 |
+
*/
|
10 |
+
|
11 |
+
/* global jQuery:true, alert:true */
|
12 |
+
|
13 |
+
/**
|
14 |
+
jQuery based implementation of the Plupload API - multi-runtime file uploading API.
|
15 |
+
|
16 |
+
To use the widget you must include _jQuery_. It is not meant to be extended in any way and is provided to be
|
17 |
+
used as it is.
|
18 |
+
|
19 |
+
@example
|
20 |
+
<!-- Instantiating: -->
|
21 |
+
<div id="uploader">
|
22 |
+
<p>Your browser doesn't have Flash, Silverlight or HTML5 support.</p>
|
23 |
+
</div>
|
24 |
+
|
25 |
+
<script>
|
26 |
+
$('#uploader').pluploadQueue({
|
27 |
+
url : '../upload.php',
|
28 |
+
filters : [
|
29 |
+
{title : "Image files", extensions : "jpg,gif,png"}
|
30 |
+
],
|
31 |
+
rename: true,
|
32 |
+
flash_swf_url : '../../js/Moxie.swf',
|
33 |
+
silverlight_xap_url : '../../js/Moxie.xap',
|
34 |
+
});
|
35 |
+
</script>
|
36 |
+
|
37 |
+
@example
|
38 |
+
// Retrieving a reference to plupload.Uploader object
|
39 |
+
var uploader = $('#uploader').pluploadQueue();
|
40 |
+
|
41 |
+
uploader.bind('FilesAdded', function() {
|
42 |
+
|
43 |
+
// Autostart
|
44 |
+
setTimeout(uploader.start, 1); // "detach" from the main thread
|
45 |
+
});
|
46 |
+
|
47 |
+
@class pluploadQueue
|
48 |
+
@constructor
|
49 |
+
@param {Object} settings For detailed information about each option check documentation.
|
50 |
+
@param {String} settings.url URL of the server-side upload handler.
|
51 |
+
@param {Number|String} [settings.chunk_size=0] Chunk size in bytes to slice the file into. Shorcuts with b, kb, mb, gb, tb suffixes also supported. `e.g. 204800 or "204800b" or "200kb"`. By default - disabled.
|
52 |
+
@param {String} [settings.file_data_name="file"] Name for the file field in Multipart formated message.
|
53 |
+
@param {Array} [settings.filters=[]] Set of file type filters, each one defined by hash of title and extensions. `e.g. {title : "Image files", extensions : "jpg,jpeg,gif,png"}`. Dispatches `plupload.FILE_EXTENSION_ERROR`
|
54 |
+
@param {String} [settings.flash_swf_url] URL of the Flash swf.
|
55 |
+
@param {Object} [settings.headers] Custom headers to send with the upload. Hash of name/value pairs.
|
56 |
+
@param {Number|String} [settings.max_file_size] Maximum file size that the user can pick, in bytes. Optionally supports b, kb, mb, gb, tb suffixes. `e.g. "10mb" or "1gb"`. By default - not set. Dispatches `plupload.FILE_SIZE_ERROR`.
|
57 |
+
@param {Number} [settings.max_retries=0] How many times to retry the chunk or file, before triggering Error event.
|
58 |
+
@param {Boolean} [settings.multipart=true] Whether to send file and additional parameters as Multipart formated message.
|
59 |
+
@param {Object} [settings.multipart_params] Hash of key/value pairs to send with every file upload.
|
60 |
+
@param {Boolean} [settings.multi_selection=true] Enable ability to select multiple files at once in file dialog.
|
61 |
+
@param {Boolean} [settings.prevent_duplicates=false] Do not let duplicates into the queue. Dispatches `plupload.FILE_DUPLICATE_ERROR`.
|
62 |
+
@param {String|Object} [settings.required_features] Either comma-separated list or hash of required features that chosen runtime should absolutely possess.
|
63 |
+
@param {Object} [settings.resize] Enable resizng of images on client-side. Applies to `image/jpeg` and `image/png` only. `e.g. {width : 200, height : 200, quality : 90, crop: true}`
|
64 |
+
@param {Number} [settings.resize.width] If image is bigger, it will be resized.
|
65 |
+
@param {Number} [settings.resize.height] If image is bigger, it will be resized.
|
66 |
+
@param {Number} [settings.resize.quality=90] Compression quality for jpegs (1-100).
|
67 |
+
@param {Boolean} [settings.resize.crop=false] Whether to crop images to exact dimensions. By default they will be resized proportionally.
|
68 |
+
@param {String} [settings.runtimes="html5,flash,silverlight,html4"] Comma separated list of runtimes, that Plupload will try in turn, moving to the next if previous fails.
|
69 |
+
@param {String} [settings.silverlight_xap_url] URL of the Silverlight xap.
|
70 |
+
@param {Boolean} [settings.unique_names=false] If true will generate unique filenames for uploaded files.
|
71 |
+
|
72 |
+
@param {Boolean} [settings.dragdrop=true] Enable ability to add file to the queue by drag'n'dropping them from the desktop.
|
73 |
+
@param {Boolean} [settings.rename=false] Enable ability to rename files in the queue.
|
74 |
+
@param {Boolean} [settings.multiple_queues=true] Re-activate the widget after each upload procedure.
|
75 |
+
*/
|
76 |
+
;(function($, plupload) {
|
77 |
+
var uploaders = {};
|
78 |
+
|
79 |
+
function _(str) {
|
80 |
+
return plupload.translate(str) || str;
|
81 |
+
}
|
82 |
+
|
83 |
+
function renderUI(id, target) {
|
84 |
+
// Remove all existing non plupload items
|
85 |
+
target.contents().each(function(i, node) {
|
86 |
+
node = $(node);
|
87 |
+
|
88 |
+
if (!node.is('.plupload')) {
|
89 |
+
node.remove();
|
90 |
+
}
|
91 |
+
});
|
92 |
+
|
93 |
+
target.prepend(
|
94 |
+
'<div class="plupload_wrapper plupload_scroll">' +
|
95 |
+
'<div id="' + id + '_container" class="plupload_container">' +
|
96 |
+
'<div class="plupload">' +
|
97 |
+
'<div class="plupload_header">' +
|
98 |
+
'<div class="plupload_header_content">' +
|
99 |
+
'<div class="plupload_header_title">' + _('Select files') + '</div>' +
|
100 |
+
'<div class="plupload_header_text">' + _('Add files to the upload queue and click the start button.') + '</div>' +
|
101 |
+
'</div>' +
|
102 |
+
'</div>' +
|
103 |
+
|
104 |
+
'<div class="plupload_content">' +
|
105 |
+
'<div class="plupload_filelist_header">' +
|
106 |
+
'<div class="plupload_file_name">' + _('Filename') + '</div>' +
|
107 |
+
'<div class="plupload_file_action"> </div>' +
|
108 |
+
'<div class="plupload_file_status"><span>' + _('Status') + '</span></div>' +
|
109 |
+
'<div class="plupload_file_size">' + _('Size') + '</div>' +
|
110 |
+
'<div class="plupload_clearer"> </div>' +
|
111 |
+
'</div>' +
|
112 |
+
|
113 |
+
'<ul id="' + id + '_filelist" class="plupload_filelist"></ul>' +
|
114 |
+
|
115 |
+
'<div class="plupload_filelist_footer">' +
|
116 |
+
'<div class="plupload_file_name">' +
|
117 |
+
'<div class="plupload_buttons">' +
|
118 |
+
'<a href="#" class="plupload_button plupload_add" id="' + id + '_browse">' + _('Add Files') + '</a>' +
|
119 |
+
'<a href="#" class="plupload_button plupload_start">' + _('Start Upload') + '</a>' +
|
120 |
+
'</div>' +
|
121 |
+
'<span class="plupload_upload_status"></span>' +
|
122 |
+
'</div>' +
|
123 |
+
'<div class="plupload_file_action"></div>' +
|
124 |
+
'<div class="plupload_file_status"><span class="plupload_total_status">0%</span></div>' +
|
125 |
+
'<div class="plupload_file_size"><span class="plupload_total_file_size">0 b</span></div>' +
|
126 |
+
'<div class="plupload_progress">' +
|
127 |
+
'<div class="plupload_progress_container">' +
|
128 |
+
'<div class="plupload_progress_bar"></div>' +
|
129 |
+
'</div>' +
|
130 |
+
'</div>' +
|
131 |
+
'<div class="plupload_clearer"> </div>' +
|
132 |
+
'</div>' +
|
133 |
+
'</div>' +
|
134 |
+
'</div>' +
|
135 |
+
'</div>' +
|
136 |
+
'<input type="hidden" id="' + id + '_count" name="' + id + '_count" value="0" />' +
|
137 |
+
'</div>'
|
138 |
+
);
|
139 |
+
}
|
140 |
+
|
141 |
+
$.fn.pluploadQueue = function(settings) {
|
142 |
+
if (settings) {
|
143 |
+
this.each(function() {
|
144 |
+
var uploader, target, id, contents_bak;
|
145 |
+
|
146 |
+
target = $(this);
|
147 |
+
id = target.attr('id');
|
148 |
+
|
149 |
+
if (!id) {
|
150 |
+
id = plupload.guid();
|
151 |
+
target.attr('id', id);
|
152 |
+
}
|
153 |
+
|
154 |
+
contents_bak = target.html();
|
155 |
+
renderUI(id, target);
|
156 |
+
|
157 |
+
settings = $.extend({
|
158 |
+
dragdrop : true,
|
159 |
+
browse_button : id + '_browse',
|
160 |
+
container : id
|
161 |
+
}, settings);
|
162 |
+
|
163 |
+
// Enable drag/drop (see PostInit handler as well)
|
164 |
+
if (settings.dragdrop) {
|
165 |
+
settings.drop_element = id + '_filelist';
|
166 |
+
}
|
167 |
+
|
168 |
+
uploader = new plupload.Uploader(settings);
|
169 |
+
|
170 |
+
uploaders[id] = uploader;
|
171 |
+
|
172 |
+
function handleStatus(file) {
|
173 |
+
var actionClass;
|
174 |
+
|
175 |
+
if (file.status == plupload.DONE) {
|
176 |
+
actionClass = 'plupload_done';
|
177 |
+
}
|
178 |
+
|
179 |
+
if (file.status == plupload.FAILED) {
|
180 |
+
actionClass = 'plupload_failed';
|
181 |
+
}
|
182 |
+
|
183 |
+
if (file.status == plupload.QUEUED) {
|
184 |
+
actionClass = 'plupload_delete';
|
185 |
+
}
|
186 |
+
|
187 |
+
if (file.status == plupload.UPLOADING) {
|
188 |
+
actionClass = 'plupload_uploading';
|
189 |
+
}
|
190 |
+
|
191 |
+
var icon = $('#' + file.id).attr('class', actionClass).find('a').css('display', 'block');
|
192 |
+
if (file.hint) {
|
193 |
+
icon.attr('title', file.hint);
|
194 |
+
}
|
195 |
+
}
|
196 |
+
|
197 |
+
function updateTotalProgress() {
|
198 |
+
$('span.plupload_total_status', target).html(uploader.total.percent + '%');
|
199 |
+
$('div.plupload_progress_bar', target).css('width', uploader.total.percent + '%');
|
200 |
+
$('span.plupload_upload_status', target).html(
|
201 |
+
plupload.sprintf(_('Uploaded %d/%d files'), uploader.total.uploaded, uploader.files.length)
|
202 |
+
);
|
203 |
+
}
|
204 |
+
|
205 |
+
function updateList() {
|
206 |
+
var fileList = $('ul.plupload_filelist', target).html(''), inputCount = 0, inputHTML;
|
207 |
+
|
208 |
+
$.each(uploader.files, function(i, file) {
|
209 |
+
inputHTML = '';
|
210 |
+
|
211 |
+
if (file.status == plupload.DONE) {
|
212 |
+
if (file.target_name) {
|
213 |
+
inputHTML += '<input type="hidden" name="' + id + '_' + inputCount + '_tmpname" value="' + plupload.xmlEncode(file.target_name) + '" />';
|
214 |
+
}
|
215 |
+
|
216 |
+
inputHTML += '<input type="hidden" name="' + id + '_' + inputCount + '_name" value="' + plupload.xmlEncode(file.name) + '" />';
|
217 |
+
inputHTML += '<input type="hidden" name="' + id + '_' + inputCount + '_status" value="' + (file.status == plupload.DONE ? 'done' : 'failed') + '" />';
|
218 |
+
|
219 |
+
inputCount++;
|
220 |
+
|
221 |
+
$('#' + id + '_count').val(inputCount);
|
222 |
+
}
|
223 |
+
|
224 |
+
fileList.append(
|
225 |
+
'<li id="' + file.id + '">' +
|
226 |
+
'<div class="plupload_file_name"><span>' + file.name + '</span></div>' +
|
227 |
+
'<div class="plupload_file_action"><a href="#"></a></div>' +
|
228 |
+
'<div class="plupload_file_status">' + file.percent + '%</div>' +
|
229 |
+
'<div class="plupload_file_size">' + plupload.formatSize(file.size) + '</div>' +
|
230 |
+
'<div class="plupload_clearer"> </div>' +
|
231 |
+
inputHTML +
|
232 |
+
'</li>'
|
233 |
+
);
|
234 |
+
|
235 |
+
handleStatus(file);
|
236 |
+
|
237 |
+
$('#' + file.id + '.plupload_delete a').click(function(e) {
|
238 |
+
$('#' + file.id).remove();
|
239 |
+
uploader.removeFile(file);
|
240 |
+
|
241 |
+
e.preventDefault();
|
242 |
+
});
|
243 |
+
});
|
244 |
+
|
245 |
+
$('span.plupload_total_file_size', target).html(plupload.formatSize(uploader.total.size));
|
246 |
+
|
247 |
+
if (uploader.total.queued === 0) {
|
248 |
+
$('span.plupload_add_text', target).html(_('Add Files'));
|
249 |
+
} else {
|
250 |
+
$('span.plupload_add_text', target).html(plupload.sprintf(_('%d files queued'), uploader.total.queued));
|
251 |
+
}
|
252 |
+
|
253 |
+
$('a.plupload_start', target).toggleClass('plupload_disabled', uploader.files.length == (uploader.total.uploaded + uploader.total.failed));
|
254 |
+
|
255 |
+
// Scroll to end of file list
|
256 |
+
fileList[0].scrollTop = fileList[0].scrollHeight;
|
257 |
+
|
258 |
+
updateTotalProgress();
|
259 |
+
|
260 |
+
// Re-add drag message if there is no files
|
261 |
+
if (!uploader.files.length && uploader.features.dragdrop && uploader.settings.dragdrop) {
|
262 |
+
$('#' + id + '_filelist').append('<li class="plupload_droptext">' + _("Drag files here.") + '</li>');
|
263 |
+
}
|
264 |
+
}
|
265 |
+
|
266 |
+
function destroy() {
|
267 |
+
delete uploaders[id];
|
268 |
+
uploader.destroy();
|
269 |
+
target.html(contents_bak);
|
270 |
+
uploader = target = contents_bak = null;
|
271 |
+
}
|
272 |
+
|
273 |
+
uploader.bind("UploadFile", function(up, file) {
|
274 |
+
$('#' + file.id).addClass('plupload_current_file');
|
275 |
+
});
|
276 |
+
|
277 |
+
uploader.bind('Init', function(up, res) {
|
278 |
+
// Enable rename support
|
279 |
+
if (!settings.unique_names && settings.rename) {
|
280 |
+
target.on('click', '#' + id + '_filelist div.plupload_file_name span', function(e) {
|
281 |
+
var targetSpan = $(e.target), file, parts, name, ext = "";
|
282 |
+
var fileContainer = targetSpan.closest('li');
|
283 |
+
|
284 |
+
if (!fileContainer.hasClass('plupload_delete')) {
|
285 |
+
return;
|
286 |
+
}
|
287 |
+
|
288 |
+
// Get file name and split out name and extension
|
289 |
+
file = up.getFile(targetSpan.parents('li')[0].id);
|
290 |
+
name = file.name;
|
291 |
+
parts = /^(.+)(\.[^.]+)$/.exec(name);
|
292 |
+
if (parts) {
|
293 |
+
name = parts[1];
|
294 |
+
ext = parts[2];
|
295 |
+
}
|
296 |
+
|
297 |
+
// Display input element
|
298 |
+
targetSpan.hide().after('<input type="text" />');
|
299 |
+
targetSpan.next().val(name).focus().blur(function() {
|
300 |
+
targetSpan.show().next().remove();
|
301 |
+
}).keydown(function(e) {
|
302 |
+
var targetInput = $(this);
|
303 |
+
|
304 |
+
if (e.keyCode == 13) {
|
305 |
+
e.preventDefault();
|
306 |
+
|
307 |
+
// Rename file and glue extension back on
|
308 |
+
file.name = targetInput.val() + ext;
|
309 |
+
targetSpan.html(file.name);
|
310 |
+
targetInput.blur();
|
311 |
+
}
|
312 |
+
});
|
313 |
+
});
|
314 |
+
}
|
315 |
+
|
316 |
+
$('#' + id + '_container').attr('title', 'Using runtime: ' + res.runtime);
|
317 |
+
|
318 |
+
$('a.plupload_start', target).click(function(e) {
|
319 |
+
if (!$(this).hasClass('plupload_disabled')) {
|
320 |
+
uploader.start();
|
321 |
+
}
|
322 |
+
|
323 |
+
e.preventDefault();
|
324 |
+
});
|
325 |
+
|
326 |
+
$('a.plupload_stop', target).click(function(e) {
|
327 |
+
e.preventDefault();
|
328 |
+
uploader.stop();
|
329 |
+
});
|
330 |
+
|
331 |
+
$('a.plupload_start', target).addClass('plupload_disabled');
|
332 |
+
});
|
333 |
+
|
334 |
+
uploader.bind("Error", function(up, err) {
|
335 |
+
var file = err.file, message;
|
336 |
+
|
337 |
+
if (file) {
|
338 |
+
message = err.message;
|
339 |
+
|
340 |
+
if (err.details) {
|
341 |
+
message += " (" + err.details + ")";
|
342 |
+
}
|
343 |
+
|
344 |
+
if (err.code == plupload.FILE_SIZE_ERROR) {
|
345 |
+
alert(_("Error: File too large:") + " " + file.name);
|
346 |
+
}
|
347 |
+
|
348 |
+
if (err.code == plupload.FILE_EXTENSION_ERROR) {
|
349 |
+
alert(_("Error: Invalid file extension:") + " " + file.name);
|
350 |
+
}
|
351 |
+
|
352 |
+
file.hint = message;
|
353 |
+
$('#' + file.id).attr('class', 'plupload_failed').find('a').css('display', 'block').attr('title', message);
|
354 |
+
}
|
355 |
+
|
356 |
+
if (err.code === plupload.INIT_ERROR) {
|
357 |
+
setTimeout(function() {
|
358 |
+
destroy();
|
359 |
+
}, 1);
|
360 |
+
}
|
361 |
+
});
|
362 |
+
|
363 |
+
uploader.bind("PostInit", function(up) {
|
364 |
+
// features are populated only after input components are fully instantiated
|
365 |
+
if (up.settings.dragdrop && up.features.dragdrop) {
|
366 |
+
$('#' + id + '_filelist').append('<li class="plupload_droptext">' + _("Drag files here.") + '</li>');
|
367 |
+
}
|
368 |
+
});
|
369 |
+
|
370 |
+
uploader.init();
|
371 |
+
|
372 |
+
uploader.bind('StateChanged', function() {
|
373 |
+
if (uploader.state === plupload.STARTED) {
|
374 |
+
$('li.plupload_delete a,div.plupload_buttons', target).hide();
|
375 |
+
uploader.disableBrowse(true);
|
376 |
+
|
377 |
+
$('span.plupload_upload_status,div.plupload_progress,a.plupload_stop', target).css('display', 'block');
|
378 |
+
$('span.plupload_upload_status', target).html('Uploaded ' + uploader.total.uploaded + '/' + uploader.files.length + ' files');
|
379 |
+
|
380 |
+
if (settings.multiple_queues) {
|
381 |
+
$('span.plupload_total_status,span.plupload_total_file_size', target).show();
|
382 |
+
}
|
383 |
+
} else {
|
384 |
+
updateList();
|
385 |
+
$('a.plupload_stop,div.plupload_progress', target).hide();
|
386 |
+
$('a.plupload_delete', target).css('display', 'block');
|
387 |
+
|
388 |
+
if (settings.multiple_queues && uploader.total.uploaded + uploader.total.failed == uploader.files.length) {
|
389 |
+
$(".plupload_buttons,.plupload_upload_status", target).css("display", "inline");
|
390 |
+
uploader.disableBrowse(false);
|
391 |
+
|
392 |
+
$(".plupload_start", target).addClass("plupload_disabled");
|
393 |
+
$('span.plupload_total_status,span.plupload_total_file_size', target).hide();
|
394 |
+
}
|
395 |
+
}
|
396 |
+
});
|
397 |
+
|
398 |
+
uploader.bind('FilesAdded', updateList);
|
399 |
+
|
400 |
+
uploader.bind('FilesRemoved', function() {
|
401 |
+
// since the whole file list is redrawn for every change in the queue
|
402 |
+
// we need to scroll back to the file removal point to avoid annoying
|
403 |
+
// scrolling to the bottom bug (see #926)
|
404 |
+
var scrollTop = $('#' + id + '_filelist').scrollTop();
|
405 |
+
updateList();
|
406 |
+
$('#' + id + '_filelist').scrollTop(scrollTop);
|
407 |
+
});
|
408 |
+
|
409 |
+
uploader.bind('FileUploaded', function(up, file) {
|
410 |
+
handleStatus(file);
|
411 |
+
});
|
412 |
+
|
413 |
+
uploader.bind("UploadProgress", function(up, file) {
|
414 |
+
// Set file specific progress
|
415 |
+
$('#' + file.id + ' div.plupload_file_status', target).html(file.percent + '%');
|
416 |
+
|
417 |
+
handleStatus(file);
|
418 |
+
updateTotalProgress();
|
419 |
+
});
|
420 |
+
|
421 |
+
// Call setup function
|
422 |
+
if (settings.setup) {
|
423 |
+
settings.setup(uploader);
|
424 |
+
}
|
425 |
+
});
|
426 |
+
|
427 |
+
return this;
|
428 |
+
} else {
|
429 |
+
// Get uploader instance for specified element
|
430 |
+
return uploaders[$(this[0]).attr('id')];
|
431 |
+
}
|
432 |
+
};
|
433 |
+
})(jQuery, plupload);
|
admin/js/plupload/jquery.plupload.queue/jquery.plupload.queue.min.js
ADDED
@@ -0,0 +1 @@
|
|
|
1 |
+
!function(e,t){function i(e){return t.translate(e)||e}function s(t,s){s.contents().each(function(t,i){i=e(i),i.is(".plupload")||i.remove()}),s.prepend('<div class="plupload_wrapper plupload_scroll"><div id="'+t+'_container" class="plupload_container">'+'<div class="plupload">'+'<div class="plupload_header">'+'<div class="plupload_header_content">'+'<div class="plupload_header_title">'+i("Select files")+"</div>"+'<div class="plupload_header_text">'+i("Add files to the upload queue and click the start button.")+"</div>"+"</div>"+"</div>"+'<div class="plupload_content">'+'<div class="plupload_filelist_header">'+'<div class="plupload_file_name">'+i("Filename")+"</div>"+'<div class="plupload_file_action"> </div>'+'<div class="plupload_file_status"><span>'+i("Status")+"</span></div>"+'<div class="plupload_file_size">'+i("Size")+"</div>"+'<div class="plupload_clearer"> </div>'+"</div>"+'<ul id="'+t+'_filelist" class="plupload_filelist"></ul>'+'<div class="plupload_filelist_footer">'+'<div class="plupload_file_name">'+'<div class="plupload_buttons">'+'<a href="#" class="plupload_button plupload_add" id="'+t+'_browse">'+i("Add Files")+"</a>"+'<a href="#" class="plupload_button plupload_start">'+i("Start Upload")+"</a>"+"</div>"+'<span class="plupload_upload_status"></span>'+"</div>"+'<div class="plupload_file_action"></div>'+'<div class="plupload_file_status"><span class="plupload_total_status">0%</span></div>'+'<div class="plupload_file_size"><span class="plupload_total_file_size">0 b</span></div>'+'<div class="plupload_progress">'+'<div class="plupload_progress_container">'+'<div class="plupload_progress_bar"></div>'+"</div>"+"</div>"+'<div class="plupload_clearer"> </div>'+"</div>"+"</div>"+"</div>"+"</div>"+'<input type="hidden" id="'+t+'_count" name="'+t+'_count" value="0" />'+"</div>")}var l={};e.fn.pluploadQueue=function(a){return a?(this.each(function(){function n(i){var s;i.status==t.DONE&&(s="plupload_done"),i.status==t.FAILED&&(s="plupload_failed"),i.status==t.QUEUED&&(s="plupload_delete"),i.status==t.UPLOADING&&(s="plupload_uploading");var l=e("#"+i.id).attr("class",s).find("a").css("display","block");i.hint&&l.attr("title",i.hint)}function o(){e("span.plupload_total_status",p).html(u.total.percent+"%"),e("div.plupload_progress_bar",p).css("width",u.total.percent+"%"),e("span.plupload_upload_status",p).html(t.sprintf(i("Uploaded %d/%d files"),u.total.uploaded,u.files.length))}function r(){var s,l=e("ul.plupload_filelist",p).html(""),a=0;e.each(u.files,function(i,o){s="",o.status==t.DONE&&(o.target_name&&(s+='<input type="hidden" name="'+c+"_"+a+'_tmpname" value="'+t.xmlEncode(o.target_name)+'" />'),s+='<input type="hidden" name="'+c+"_"+a+'_name" value="'+t.xmlEncode(o.name)+'" />',s+='<input type="hidden" name="'+c+"_"+a+'_status" value="'+(o.status==t.DONE?"done":"failed")+'" />',a++,e("#"+c+"_count").val(a)),l.append('<li id="'+o.id+'">'+'<div class="plupload_file_name"><span>'+o.name+"</span></div>"+'<div class="plupload_file_action"><a href="#"></a></div>'+'<div class="plupload_file_status">'+o.percent+"%</div>"+'<div class="plupload_file_size">'+t.formatSize(o.size)+"</div>"+'<div class="plupload_clearer"> </div>'+s+"</li>"),n(o),e("#"+o.id+".plupload_delete a").click(function(t){e("#"+o.id).remove(),u.removeFile(o),t.preventDefault()})}),e("span.plupload_total_file_size",p).html(t.formatSize(u.total.size)),0===u.total.queued?e("span.plupload_add_text",p).html(i("Add Files")):e("span.plupload_add_text",p).html(t.sprintf(i("%d files queued"),u.total.queued)),e("a.plupload_start",p).toggleClass("plupload_disabled",u.files.length==u.total.uploaded+u.total.failed),l[0].scrollTop=l[0].scrollHeight,o(),!u.files.length&&u.features.dragdrop&&u.settings.dragdrop&&e("#"+c+"_filelist").append('<li class="plupload_droptext">'+i("Drag files here.")+"</li>")}function d(){delete l[c],u.destroy(),p.html(_),u=p=_=null}var u,p,c,_;p=e(this),c=p.attr("id"),c||(c=t.guid(),p.attr("id",c)),_=p.html(),s(c,p),a=e.extend({dragdrop:!0,browse_button:c+"_browse",container:c},a),a.dragdrop&&(a.drop_element=c+"_filelist"),u=new t.Uploader(a),l[c]=u,u.bind("UploadFile",function(t,i){e("#"+i.id).addClass("plupload_current_file")}),u.bind("Init",function(t,i){!a.unique_names&&a.rename&&p.on("click","#"+c+"_filelist div.plupload_file_name span",function(i){var s,l,a,n=e(i.target),o="",r=n.closest("li");r.hasClass("plupload_delete")&&(s=t.getFile(n.parents("li")[0].id),a=s.name,l=/^(.+)(\.[^.]+)$/.exec(a),l&&(a=l[1],o=l[2]),n.hide().after('<input type="text" />'),n.next().val(a).focus().blur(function(){n.show().next().remove()}).keydown(function(t){var i=e(this);13==t.keyCode&&(t.preventDefault(),s.name=i.val()+o,n.html(s.name),i.blur())}))}),e("#"+c+"_container").attr("title","Using runtime: "+i.runtime),e("a.plupload_start",p).click(function(t){e(this).hasClass("plupload_disabled")||u.start(),t.preventDefault()}),e("a.plupload_stop",p).click(function(e){e.preventDefault(),u.stop()}),e("a.plupload_start",p).addClass("plupload_disabled")}),u.bind("Error",function(s,l){var a,n=l.file;n&&(a=l.message,l.details&&(a+=" ("+l.details+")"),l.code==t.FILE_SIZE_ERROR&&alert(i("Error: File too large:")+" "+n.name),l.code==t.FILE_EXTENSION_ERROR&&alert(i("Error: Invalid file extension:")+" "+n.name),n.hint=a,e("#"+n.id).attr("class","plupload_failed").find("a").css("display","block").attr("title",a)),l.code===t.INIT_ERROR&&setTimeout(function(){d()},1)}),u.bind("PostInit",function(t){t.settings.dragdrop&&t.features.dragdrop&&e("#"+c+"_filelist").append('<li class="plupload_droptext">'+i("Drag files here.")+"</li>")}),u.init(),u.bind("StateChanged",function(){u.state===t.STARTED?(e("li.plupload_delete a,div.plupload_buttons",p).hide(),u.disableBrowse(!0),e("span.plupload_upload_status,div.plupload_progress,a.plupload_stop",p).css("display","block"),e("span.plupload_upload_status",p).html("Uploaded "+u.total.uploaded+"/"+u.files.length+" files"),a.multiple_queues&&e("span.plupload_total_status,span.plupload_total_file_size",p).show()):(r(),e("a.plupload_stop,div.plupload_progress",p).hide(),e("a.plupload_delete",p).css("display","block"),a.multiple_queues&&u.total.uploaded+u.total.failed==u.files.length&&(e(".plupload_buttons,.plupload_upload_status",p).css("display","inline"),u.disableBrowse(!1),e(".plupload_start",p).addClass("plupload_disabled"),e("span.plupload_total_status,span.plupload_total_file_size",p).hide()))}),u.bind("FilesAdded",r),u.bind("FilesRemoved",function(){var t=e("#"+c+"_filelist").scrollTop();r(),e("#"+c+"_filelist").scrollTop(t)}),u.bind("FileUploaded",function(e,t){n(t)}),u.bind("UploadProgress",function(t,i){e("#"+i.id+" div.plupload_file_status",p).html(i.percent+"%"),n(i),o()}),a.setup&&a.setup(u)}),this):l[e(this[0]).attr("id")]}}(jQuery,plupload);
|
admin/js/plupload/jquery.ui.plupload/css/jquery.ui.plupload.css
CHANGED
@@ -2,6 +2,10 @@
|
|
2 |
Plupload
|
3 |
------------------------------------------------------------------- */
|
4 |
|
|
|
|
|
|
|
|
|
5 |
.plupload_button {
|
6 |
cursor: pointer;
|
7 |
outline: none;
|
@@ -11,6 +15,7 @@
|
|
11 |
font: normal 11px Verdana,sans-serif;
|
12 |
width: 100%;
|
13 |
min-width: 520px;
|
|
|
14 |
}
|
15 |
|
16 |
.plupload_container {
|
@@ -23,10 +28,10 @@
|
|
23 |
.plupload_file {border-width: 0 0 1px 0}
|
24 |
.plupload_container .plupload_header {border-width: 0 0 1px 0; position: relative;}
|
25 |
|
26 |
-
.plupload_delete .ui-icon,
|
27 |
.plupload_done .ui-icon,
|
28 |
.plupload_failed .ui-icon {
|
29 |
-
cursor:pointer;
|
30 |
}
|
31 |
|
32 |
.plupload_header_content {
|
@@ -50,6 +55,7 @@
|
|
50 |
|
51 |
.plupload_header_title {
|
52 |
font: normal 18px sans-serif;
|
|
|
53 |
padding: 6px 0 3px;
|
54 |
}
|
55 |
|
@@ -71,7 +77,7 @@
|
|
71 |
|
72 |
.plupload_content {
|
73 |
position: absolute;
|
74 |
-
top:
|
75 |
bottom: 44px;
|
76 |
left: 0;
|
77 |
right: 0;
|
@@ -103,18 +109,22 @@
|
|
103 |
display: block;
|
104 |
position: relative;
|
105 |
overflow: hidden;
|
106 |
-
|
107 |
}
|
108 |
|
109 |
.plupload_file_thumb {
|
110 |
-
position:
|
111 |
-
|
112 |
-
|
|
|
|
|
|
|
113 |
background: #eee url(../img/loading.gif) center no-repeat;
|
114 |
}
|
115 |
|
116 |
-
.
|
117 |
-
|
|
|
118 |
}
|
119 |
|
120 |
.plupload_file_name {
|
@@ -134,7 +144,7 @@
|
|
134 |
right: 0;
|
135 |
}
|
136 |
|
137 |
-
.plupload_buttons {
|
138 |
position: relative;
|
139 |
}
|
140 |
|
@@ -144,9 +154,13 @@
|
|
144 |
border-right: none;
|
145 |
border-top: none;
|
146 |
height: 29px;
|
|
|
|
|
|
|
|
|
147 |
}
|
148 |
|
149 |
-
.plupload_view_list div.plupload_file_size,
|
150 |
.plupload_view_list div.plupload_file_status,
|
151 |
.plupload_view_list div.plupload_file_action {
|
152 |
padding: 8px 6px;
|
@@ -173,16 +187,16 @@
|
|
173 |
margin-left: -2px;
|
174 |
}
|
175 |
|
176 |
-
.plupload_view_list .plupload_file_size,
|
177 |
.plupload_view_list .plupload_file_status,
|
178 |
-
.plupload_filelist_footer .plupload_file_size,
|
179 |
.plupload_filelist_footer .plupload_file_status {
|
180 |
-
text-align: right;
|
181 |
width: 52px;
|
182 |
}
|
183 |
|
184 |
-
.plupload_view_list .plupload_file_thumb
|
185 |
-
|
186 |
top: -999px;
|
187 |
}
|
188 |
|
@@ -201,8 +215,7 @@
|
|
201 |
}
|
202 |
|
203 |
.plupload_view_thumbs .plupload_file {
|
204 |
-
|
205 |
-
padding: 72px 6px 6px;
|
206 |
margin: 10px;
|
207 |
border: 1px solid #fff;
|
208 |
float: left;
|
@@ -210,8 +223,6 @@
|
|
210 |
|
211 |
.plupload_view_thumbs .plupload_file_thumb,
|
212 |
.plupload_view_thumbs .plupload_file_dummy {
|
213 |
-
width: 100px;
|
214 |
-
height: 60px;
|
215 |
text-align: center;
|
216 |
overflow: hidden;
|
217 |
}
|
@@ -221,8 +232,12 @@
|
|
221 |
font-weight: bold;
|
222 |
text-transform: lowercase;
|
223 |
overflow: hidden;
|
224 |
-
line-height: 60px;
|
225 |
border: none;
|
|
|
|
|
|
|
|
|
|
|
226 |
}
|
227 |
|
228 |
.plupload_view_thumbs div.plupload_file_action {
|
@@ -247,13 +262,11 @@
|
|
247 |
}
|
248 |
|
249 |
.plupload_view_thumbs div.plupload_file_status {
|
250 |
-
position:
|
251 |
-
top: 67px;
|
252 |
-
left: 6px;
|
253 |
-
width: 100px;
|
254 |
height: 3px;
|
255 |
overflow: hidden;
|
256 |
text-indent: -999px;
|
|
|
257 |
}
|
258 |
|
259 |
.plupload_view_thumbs div.plupload_file_progress {
|
@@ -263,7 +276,7 @@
|
|
263 |
|
264 |
.plupload .ui-sortable-helper,
|
265 |
.plupload .ui-sortable .plupload_file {
|
266 |
-
cursor:move;
|
267 |
}
|
268 |
|
269 |
.plupload_file_action {width: 16px;}
|
@@ -297,7 +310,7 @@
|
|
297 |
.plupload_clearer {height: 0;}
|
298 |
|
299 |
/* Misc */
|
300 |
-
.plupload_hidden {display: none;}
|
301 |
|
302 |
.plupload_droptext {
|
303 |
position: absolute;
|
@@ -317,12 +330,16 @@
|
|
317 |
display: block;
|
318 |
}
|
319 |
|
|
|
|
|
|
|
|
|
320 |
.plupload_buttons, .plupload_upload_status {float: left}
|
321 |
|
322 |
.plupload_message {
|
323 |
position: absolute;
|
324 |
top: -1px;
|
325 |
-
left: -1px;
|
326 |
height: 100%;
|
327 |
width: 100%;
|
328 |
}
|
@@ -333,28 +350,28 @@
|
|
333 |
}
|
334 |
|
335 |
.plupload_message strong {
|
336 |
-
font-weight: bold;
|
337 |
}
|
338 |
|
339 |
-
plupload_message i {
|
340 |
-
font-style: italic;
|
341 |
}
|
342 |
|
343 |
.plupload_message p span.ui-icon {
|
344 |
float: left;
|
345 |
-
margin-right: 0.3em;
|
346 |
}
|
347 |
|
348 |
.plupload_header_content .ui-state-error,
|
349 |
.plupload_header_content .ui-state-highlight {
|
350 |
-
border:none;
|
351 |
}
|
352 |
|
353 |
.plupload_message_close {
|
354 |
position:absolute;
|
355 |
top:5px;
|
356 |
right:5px;
|
357 |
-
cursor:pointer;
|
358 |
}
|
359 |
|
360 |
.plupload .ui-sortable-placeholder {
|
2 |
Plupload
|
3 |
------------------------------------------------------------------- */
|
4 |
|
5 |
+
.plupload_wrapper * {
|
6 |
+
box-sizing: content-box;
|
7 |
+
}
|
8 |
+
|
9 |
.plupload_button {
|
10 |
cursor: pointer;
|
11 |
outline: none;
|
15 |
font: normal 11px Verdana,sans-serif;
|
16 |
width: 100%;
|
17 |
min-width: 520px;
|
18 |
+
line-height: 12px;
|
19 |
}
|
20 |
|
21 |
.plupload_container {
|
28 |
.plupload_file {border-width: 0 0 1px 0}
|
29 |
.plupload_container .plupload_header {border-width: 0 0 1px 0; position: relative;}
|
30 |
|
31 |
+
.plupload_delete .ui-icon,
|
32 |
.plupload_done .ui-icon,
|
33 |
.plupload_failed .ui-icon {
|
34 |
+
cursor:pointer;
|
35 |
}
|
36 |
|
37 |
.plupload_header_content {
|
55 |
|
56 |
.plupload_header_title {
|
57 |
font: normal 18px sans-serif;
|
58 |
+
line-height: 19px;
|
59 |
padding: 6px 0 3px;
|
60 |
}
|
61 |
|
77 |
|
78 |
.plupload_content {
|
79 |
position: absolute;
|
80 |
+
top: 86px;
|
81 |
bottom: 44px;
|
82 |
left: 0;
|
83 |
right: 0;
|
109 |
display: block;
|
110 |
position: relative;
|
111 |
overflow: hidden;
|
112 |
+
line-height: 12px;
|
113 |
}
|
114 |
|
115 |
.plupload_file_thumb {
|
116 |
+
position: relative;
|
117 |
+
background-image: none;
|
118 |
+
background-color: #eee;
|
119 |
+
}
|
120 |
+
|
121 |
+
.plupload_thumb_loading {
|
122 |
background: #eee url(../img/loading.gif) center no-repeat;
|
123 |
}
|
124 |
|
125 |
+
.plupload_thumb_loading .plupload_file_dummy,
|
126 |
+
.plupload_thumb_embedded .plupload_file_dummy {
|
127 |
+
display: none;
|
128 |
}
|
129 |
|
130 |
.plupload_file_name {
|
144 |
right: 0;
|
145 |
}
|
146 |
|
147 |
+
.plupload_buttons {
|
148 |
position: relative;
|
149 |
}
|
150 |
|
154 |
border-right: none;
|
155 |
border-top: none;
|
156 |
height: 29px;
|
157 |
+
width: 100% !important;
|
158 |
+
/* fix IE6 vertical white-space bug */
|
159 |
+
_float: left;
|
160 |
+
_clear: left;
|
161 |
}
|
162 |
|
163 |
+
.plupload_view_list div.plupload_file_size,
|
164 |
.plupload_view_list div.plupload_file_status,
|
165 |
.plupload_view_list div.plupload_file_action {
|
166 |
padding: 8px 6px;
|
187 |
margin-left: -2px;
|
188 |
}
|
189 |
|
190 |
+
.plupload_view_list .plupload_file_size,
|
191 |
.plupload_view_list .plupload_file_status,
|
192 |
+
.plupload_filelist_footer .plupload_file_size,
|
193 |
.plupload_filelist_footer .plupload_file_status {
|
194 |
+
text-align: right;
|
195 |
width: 52px;
|
196 |
}
|
197 |
|
198 |
+
.plupload_view_list .plupload_file_thumb {
|
199 |
+
position: absolute;
|
200 |
top: -999px;
|
201 |
}
|
202 |
|
215 |
}
|
216 |
|
217 |
.plupload_view_thumbs .plupload_file {
|
218 |
+
padding: 6px;
|
|
|
219 |
margin: 10px;
|
220 |
border: 1px solid #fff;
|
221 |
float: left;
|
223 |
|
224 |
.plupload_view_thumbs .plupload_file_thumb,
|
225 |
.plupload_view_thumbs .plupload_file_dummy {
|
|
|
|
|
226 |
text-align: center;
|
227 |
overflow: hidden;
|
228 |
}
|
232 |
font-weight: bold;
|
233 |
text-transform: lowercase;
|
234 |
overflow: hidden;
|
|
|
235 |
border: none;
|
236 |
+
position: absolute;
|
237 |
+
top: 0;
|
238 |
+
left: 0;
|
239 |
+
width: 100%;
|
240 |
+
height: 100%;
|
241 |
}
|
242 |
|
243 |
.plupload_view_thumbs div.plupload_file_action {
|
262 |
}
|
263 |
|
264 |
.plupload_view_thumbs div.plupload_file_status {
|
265 |
+
position: relative;
|
|
|
|
|
|
|
266 |
height: 3px;
|
267 |
overflow: hidden;
|
268 |
text-indent: -999px;
|
269 |
+
margin-bottom: 3px;
|
270 |
}
|
271 |
|
272 |
.plupload_view_thumbs div.plupload_file_progress {
|
276 |
|
277 |
.plupload .ui-sortable-helper,
|
278 |
.plupload .ui-sortable .plupload_file {
|
279 |
+
cursor:move;
|
280 |
}
|
281 |
|
282 |
.plupload_file_action {width: 16px;}
|
310 |
.plupload_clearer {height: 0;}
|
311 |
|
312 |
/* Misc */
|
313 |
+
.plupload_hidden {display: none !important;}
|
314 |
|
315 |
.plupload_droptext {
|
316 |
position: absolute;
|
330 |
display: block;
|
331 |
}
|
332 |
|
333 |
+
.plupload_files_queued .plupload_droptext {
|
334 |
+
display: none;
|
335 |
+
}
|
336 |
+
|
337 |
.plupload_buttons, .plupload_upload_status {float: left}
|
338 |
|
339 |
.plupload_message {
|
340 |
position: absolute;
|
341 |
top: -1px;
|
342 |
+
left: -1px;
|
343 |
height: 100%;
|
344 |
width: 100%;
|
345 |
}
|
350 |
}
|
351 |
|
352 |
.plupload_message strong {
|
353 |
+
font-weight: bold;
|
354 |
}
|
355 |
|
356 |
+
.plupload_message i {
|
357 |
+
font-style: italic;
|
358 |
}
|
359 |
|
360 |
.plupload_message p span.ui-icon {
|
361 |
float: left;
|
362 |
+
margin-right: 0.3em;
|
363 |
}
|
364 |
|
365 |
.plupload_header_content .ui-state-error,
|
366 |
.plupload_header_content .ui-state-highlight {
|
367 |
+
border:none;
|
368 |
}
|
369 |
|
370 |
.plupload_message_close {
|
371 |
position:absolute;
|
372 |
top:5px;
|
373 |
right:5px;
|
374 |
+
cursor:pointer;
|
375 |
}
|
376 |
|
377 |
.plupload .ui-sortable-placeholder {
|
admin/js/plupload/jquery.ui.plupload/img/plupload.png
CHANGED
Binary file
|
admin/js/plupload/jquery.ui.plupload/jquery.ui.plupload.js
CHANGED
@@ -12,7 +12,7 @@
|
|
12 |
* jquery.ui.widget.js
|
13 |
* jquery.ui.button.js
|
14 |
* jquery.ui.progressbar.js
|
15 |
-
*
|
16 |
* Optionally:
|
17 |
* jquery.ui.sortable.js
|
18 |
*/
|
@@ -22,11 +22,11 @@
|
|
22 |
/**
|
23 |
jQuery UI based implementation of the Plupload API - multi-runtime file uploading API.
|
24 |
|
25 |
-
To use the widget you must include _jQuery_ and _jQuery UI_ bundle (including `ui.core`, `ui.widget`, `ui.button`,
|
26 |
`ui.progressbar` and `ui.sortable`).
|
27 |
|
28 |
-
In general the widget is designed the way that you do not usually need to do anything to it after you instantiate it.
|
29 |
-
But! You still can intervenue, to some extent, in case you need to. Although, due to the fact that widget is based on
|
30 |
_jQuery UI_ widget factory, there are some specifics. See examples below for more details.
|
31 |
|
32 |
@example
|
@@ -58,7 +58,7 @@ _jQuery UI_ widget factory, there are some specifics. See examples below for mor
|
|
58 |
@example
|
59 |
// Subscribing to the events...
|
60 |
// ... on initialization:
|
61 |
-
$('#uploader').plupload({
|
62 |
...
|
63 |
viewchanged: function(event, args) {
|
64 |
// stuff ...
|
@@ -75,7 +75,11 @@ _jQuery UI_ widget factory, there are some specifics. See examples below for mor
|
|
75 |
@param {String} settings.url URL of the server-side upload handler.
|
76 |
@param {Number|String} [settings.chunk_size=0] Chunk size in bytes to slice the file into. Shorcuts with b, kb, mb, gb, tb suffixes also supported. `e.g. 204800 or "204800b" or "200kb"`. By default - disabled.
|
77 |
@param {String} [settings.file_data_name="file"] Name for the file field in Multipart formated message.
|
78 |
-
@param {
|
|
|
|
|
|
|
|
|
79 |
@param {String} [settings.flash_swf_url] URL of the Flash swf.
|
80 |
@param {Object} [settings.headers] Custom headers to send with the upload. Hash of name/value pairs.
|
81 |
@param {Number|String} [settings.max_file_size] Maximum file size that the user can pick, in bytes. Optionally supports b, kb, mb, gb, tb suffixes. `e.g. "10mb" or "1gb"`. By default - not set. Dispatches `plupload.FILE_SIZE_ERROR`.
|
@@ -98,19 +102,18 @@ _jQuery UI_ widget factory, there are some specifics. See examples below for mor
|
|
98 |
@param {Boolean} [settings.dragdrop=true] Enable ability to add file to the queue by drag'n'dropping them from the desktop.
|
99 |
@param {Boolean} [settings.rename=false] Enable ability to rename files in the queue.
|
100 |
@param {Boolean} [settings.sortable=false] Enable ability to sort files in the queue, changing their uploading priority.
|
101 |
-
@param {Object} [settings.buttons] Control the visibility of functional buttons.
|
102 |
@param {Boolean} [settings.buttons.browse=true] Display browse button.
|
103 |
@param {Boolean} [settings.buttons.start=true] Display start button.
|
104 |
-
@param {Boolean} [settings.buttons.stop=true] Display stop button.
|
105 |
@param {Object} [settings.views] Control various views of the file queue.
|
106 |
@param {Boolean} [settings.views.list=true] Enable list view.
|
107 |
@param {Boolean} [settings.views.thumbs=false] Enable thumbs view.
|
108 |
@param {String} [settings.views.default='list'] Default view.
|
109 |
@param {Boolean} [settings.views.remember=true] Whether to remember the current view (requires jQuery Cookie plugin).
|
110 |
@param {Boolean} [settings.multiple_queues=true] Re-activate the widget after each upload procedure.
|
111 |
-
@param {Number} [settings.max_file_count=0] Limit the number of files user is able to upload in one go, autosets _multiple_queues_ to _false_ (default is 0 - no limit).
|
112 |
*/
|
113 |
-
(function(window, document, plupload, o, $) {
|
114 |
|
115 |
/**
|
116 |
Dispatched when the widget is initialized and ready.
|
@@ -138,14 +141,14 @@ Dispatched when file dialog is closed.
|
|
138 |
/**
|
139 |
Dispatched when upload is started.
|
140 |
|
141 |
-
@event
|
142 |
@param {plupload.Uploader} uploader Uploader instance sending the event.
|
143 |
*/
|
144 |
|
145 |
/**
|
146 |
Dispatched when upload is stopped.
|
147 |
|
148 |
-
@event
|
149 |
@param {plupload.Uploader} uploader Uploader instance sending the event.
|
150 |
*/
|
151 |
|
@@ -195,13 +198,13 @@ Dispatched when error of some kind is detected.
|
|
195 |
@param {Enum} status Status constant matching the plupload states QUEUED, UPLOADING, FAILED, DONE.
|
196 |
*/
|
197 |
|
198 |
-
var uploaders = {};
|
199 |
-
|
200 |
function _(str) {
|
201 |
return plupload.translate(str) || str;
|
202 |
}
|
203 |
|
204 |
-
function renderUI(obj) {
|
205 |
obj.id = obj.attr('id');
|
206 |
|
207 |
obj.html(
|
@@ -210,8 +213,8 @@ function renderUI(obj) {
|
|
210 |
'<div class="ui-state-default ui-widget-header plupload_header">' +
|
211 |
'<div class="plupload_header_content">' +
|
212 |
'<div class="plupload_logo"> </div>' +
|
213 |
-
'<div class="plupload_header_title">' + _(
|
214 |
-
'<div class="plupload_header_text">' + _(
|
215 |
'<div class="plupload_view_switch">' +
|
216 |
'<input type="radio" id="'+obj.id+'_view_list" name="view_mode_'+obj.id+'" checked="checked" /><label class="plupload_button" for="'+obj.id+'_view_list" data-view="list">' + _('List') + '</label>' +
|
217 |
'<input type="radio" id="'+obj.id+'_view_thumbs" name="view_mode_'+obj.id+'" /><label class="plupload_button" for="'+obj.id+'_view_thumbs" data-view="thumbs">' + _('Thumbnails') + '</label>' +
|
@@ -233,14 +236,14 @@ function renderUI(obj) {
|
|
233 |
'<ul class="plupload_filelist_content"> </ul>' +
|
234 |
'<div class="plupload_clearer"> </div>' +
|
235 |
'</div>' +
|
236 |
-
|
237 |
'<table class="plupload_filelist plupload_filelist_footer ui-widget-header">' +
|
238 |
'<tr>' +
|
239 |
'<td class="plupload_cell plupload_file_name">' +
|
240 |
'<div class="plupload_buttons"><!-- Visible -->' +
|
241 |
-
'<a class="plupload_button plupload_add">' + _(
|
242 |
-
'<a class="plupload_button plupload_start">' + _(
|
243 |
-
'<a class="plupload_button plupload_stop plupload_hidden">'+_(
|
244 |
'</div>' +
|
245 |
|
246 |
'<div class="plupload_started plupload_hidden"><!-- Hidden -->' +
|
@@ -269,35 +272,41 @@ function renderUI(obj) {
|
|
269 |
$.widget("ui.plupload", {
|
270 |
|
271 |
widgetEventPrefix: '',
|
272 |
-
|
273 |
contents_bak: '',
|
274 |
-
|
275 |
options: {
|
276 |
browse_button_hover: 'ui-state-hover',
|
277 |
browse_button_active: 'ui-state-active',
|
278 |
-
|
|
|
|
|
279 |
// widget specific
|
280 |
-
dragdrop : true,
|
281 |
-
multiple_queues: true, // re-use widget by default
|
282 |
buttons: {
|
283 |
browse: true,
|
284 |
start: true,
|
285 |
-
stop: true
|
286 |
},
|
|
|
287 |
views: {
|
288 |
list: true,
|
289 |
thumbs: false,
|
290 |
active: 'list',
|
291 |
remember: true // requires: https://github.com/carhartl/jquery-cookie, otherwise disabled even if set to true
|
292 |
},
|
|
|
|
|
|
|
|
|
|
|
|
|
293 |
autostart: false,
|
294 |
sortable: false,
|
295 |
-
rename: false
|
296 |
-
max_file_count: 0 // unlimited
|
297 |
},
|
298 |
-
|
299 |
FILE_COUNT_ERROR: -9001,
|
300 |
-
|
301 |
_create: function() {
|
302 |
var id = this.element.attr('id');
|
303 |
if (!id) {
|
@@ -305,30 +314,30 @@ $.widget("ui.plupload", {
|
|
305 |
this.element.attr('id', id);
|
306 |
}
|
307 |
this.id = id;
|
308 |
-
|
309 |
// backup the elements initial state
|
310 |
this.contents_bak = this.element.html();
|
311 |
renderUI(this.element);
|
312 |
-
|
313 |
// container, just in case
|
314 |
-
this.container = $('.plupload_container', this.element).attr('id', id + '_container');
|
315 |
|
316 |
this.content = $('.plupload_content', this.element);
|
317 |
-
|
318 |
if ($.fn.resizable) {
|
319 |
-
this.container.resizable({
|
320 |
handles: 's',
|
321 |
minHeight: 300
|
322 |
});
|
323 |
}
|
324 |
-
|
325 |
// list of files, may become sortable
|
326 |
this.filelist = $('.plupload_filelist_content', this.container)
|
327 |
.attr({
|
328 |
id: id + '_filelist',
|
329 |
unselectable: 'on'
|
330 |
});
|
331 |
-
|
332 |
|
333 |
// buttons
|
334 |
this.browse_button = $('.plupload_add', this.container).attr('id', id + '_browse');
|
@@ -336,22 +345,22 @@ $.widget("ui.plupload", {
|
|
336 |
this.stop_button = $('.plupload_stop', this.container).attr('id', id + '_stop');
|
337 |
this.thumbs_switcher = $('#' + id + '_view_thumbs');
|
338 |
this.list_switcher = $('#' + id + '_view_list');
|
339 |
-
|
340 |
if ($.ui.button) {
|
341 |
this.browse_button.button({
|
342 |
icons: { primary: 'ui-icon-circle-plus' },
|
343 |
disabled: true
|
344 |
});
|
345 |
-
|
346 |
this.start_button.button({
|
347 |
icons: { primary: 'ui-icon-circle-arrow-e' },
|
348 |
disabled: true
|
349 |
});
|
350 |
-
|
351 |
this.stop_button.button({
|
352 |
icons: { primary: 'ui-icon-circle-close' }
|
353 |
});
|
354 |
-
|
355 |
this.list_switcher.button({
|
356 |
text: false,
|
357 |
icons: { secondary: "ui-icon-grip-dotted-horizontal" }
|
@@ -362,21 +371,21 @@ $.widget("ui.plupload", {
|
|
362 |
icons: { secondary: "ui-icon-image" }
|
363 |
});
|
364 |
}
|
365 |
-
|
366 |
// progressbar
|
367 |
-
this.progressbar = $('.plupload_progress_container', this.container);
|
368 |
-
|
369 |
if ($.ui.progressbar) {
|
370 |
this.progressbar.progressbar();
|
371 |
}
|
372 |
-
|
373 |
// counter
|
374 |
this.counter = $('.plupload_count', this.element)
|
375 |
.attr({
|
376 |
id: id + '_count',
|
377 |
name: id + '_count'
|
378 |
});
|
379 |
-
|
380 |
// initialize uploader instance
|
381 |
this._initUploader();
|
382 |
},
|
@@ -385,7 +394,7 @@ $.widget("ui.plupload", {
|
|
385 |
var self = this
|
386 |
, id = this.id
|
387 |
, uploader
|
388 |
-
, options = {
|
389 |
container: id + '_buttons',
|
390 |
browse_button: id + '_browse'
|
391 |
}
|
@@ -398,48 +407,85 @@ $.widget("ui.plupload", {
|
|
398 |
options.drop_element = this.id + '_dropbox';
|
399 |
}
|
400 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
401 |
uploader = this.uploader = uploaders[id] = new plupload.Uploader($.extend(this.options, options));
|
402 |
|
|
|
|
|
|
|
403 |
if (self.options.views.thumbs) {
|
404 |
uploader.settings.required_features.display_media = true;
|
405 |
}
|
406 |
|
|
|
|
|
|
|
|
|
|
|
|
|
407 |
|
408 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
409 |
var message, details = "";
|
410 |
|
411 |
message = '<strong>' + err.message + '</strong>';
|
412 |
-
|
413 |
switch (err.code) {
|
414 |
case plupload.FILE_EXTENSION_ERROR:
|
415 |
-
details =
|
416 |
break;
|
417 |
-
|
418 |
case plupload.FILE_SIZE_ERROR:
|
419 |
-
details =
|
420 |
break;
|
421 |
|
422 |
case plupload.FILE_DUPLICATE_ERROR:
|
423 |
-
details =
|
424 |
break;
|
425 |
-
|
426 |
case self.FILE_COUNT_ERROR:
|
427 |
-
details =
|
428 |
break;
|
429 |
-
|
430 |
case plupload.IMAGE_FORMAT_ERROR :
|
431 |
details = _("Image format either wrong or not supported.");
|
432 |
-
break;
|
433 |
-
|
434 |
case plupload.IMAGE_MEMORY_ERROR :
|
435 |
details = _("Runtime ran out of available memory.");
|
436 |
break;
|
437 |
-
|
438 |
/* // This needs a review
|
439 |
case plupload.IMAGE_DIMENSIONS_ERROR :
|
440 |
-
details =
|
441 |
break; */
|
442 |
-
|
443 |
case plupload.HTTP_ERROR:
|
444 |
details = _("Upload URL might be wrong or doesn't exist.");
|
445 |
break;
|
@@ -459,8 +505,8 @@ $.widget("ui.plupload", {
|
|
459 |
}
|
460 |
});
|
461 |
|
462 |
-
|
463 |
-
uploader.bind('PostInit', function(up) {
|
464 |
// all buttons are optional, so they can be disabled and hidden
|
465 |
if (!self.options.buttons.browse) {
|
466 |
self.browse_button.button('disable').hide();
|
@@ -468,17 +514,17 @@ $.widget("ui.plupload", {
|
|
468 |
} else {
|
469 |
self.browse_button.button('enable');
|
470 |
}
|
471 |
-
|
472 |
if (!self.options.buttons.start) {
|
473 |
self.start_button.button('disable').hide();
|
474 |
-
}
|
475 |
-
|
476 |
if (!self.options.buttons.stop) {
|
477 |
self.stop_button.button('disable').hide();
|
478 |
}
|
479 |
-
|
480 |
if (!self.options.unique_names && self.options.rename) {
|
481 |
-
self._enableRenaming();
|
482 |
}
|
483 |
|
484 |
if (self.options.dragdrop && up.features.dragdrop) {
|
@@ -486,7 +532,7 @@ $.widget("ui.plupload", {
|
|
486 |
}
|
487 |
|
488 |
self._enableViewSwitcher();
|
489 |
-
|
490 |
self.start_button.click(function(e) {
|
491 |
if (!$(this).button('option', 'disabled')) {
|
492 |
self.start();
|
@@ -501,45 +547,24 @@ $.widget("ui.plupload", {
|
|
501 |
|
502 |
self._trigger('ready', null, { up: up });
|
503 |
});
|
504 |
-
|
505 |
-
|
506 |
-
// check if file count doesn't exceed the limit
|
507 |
-
if (self.options.max_file_count) {
|
508 |
-
self.options.multiple_queues = false; // one go only
|
509 |
|
510 |
-
|
511 |
-
var selectedCount = selectedFiles.length
|
512 |
-
, extraCount = up.files.length + selectedCount - self.options.max_file_count
|
513 |
-
;
|
514 |
-
|
515 |
-
if (extraCount > 0) {
|
516 |
-
selectedFiles.splice(selectedCount - extraCount, extraCount);
|
517 |
-
|
518 |
-
up.trigger('Error', {
|
519 |
-
code : self.FILE_COUNT_ERROR,
|
520 |
-
message : _('File count error.')
|
521 |
-
});
|
522 |
-
}
|
523 |
-
});
|
524 |
-
}
|
525 |
-
|
526 |
-
// uploader internal events must run first
|
527 |
uploader.init();
|
528 |
|
529 |
uploader.bind('FileFiltered', function(up, file) {
|
530 |
self._addFiles(file);
|
531 |
});
|
532 |
-
|
533 |
uploader.bind('FilesAdded', function(up, files) {
|
534 |
self._trigger('selected', null, { up: up, files: files } );
|
535 |
|
536 |
// re-enable sortable
|
537 |
if (self.options.sortable && $.ui.sortable) {
|
538 |
-
self._enableSortingList();
|
539 |
}
|
540 |
|
541 |
self._trigger('updatelist', null, { filelist: self.filelist });
|
542 |
-
|
543 |
if (self.options.autostart) {
|
544 |
// set a little delay to make sure that QueueChanged triggered by the core has time to complete
|
545 |
setTimeout(function() {
|
@@ -547,43 +572,71 @@ $.widget("ui.plupload", {
|
|
547 |
}, 10);
|
548 |
}
|
549 |
});
|
550 |
-
|
551 |
uploader.bind('FilesRemoved', function(up, files) {
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
552 |
self._trigger('removed', null, { up: up, files: files } );
|
553 |
});
|
554 |
-
|
555 |
-
uploader.bind('QueueChanged
|
|
|
|
|
|
|
|
|
556 |
self._handleState();
|
|
|
|
|
|
|
|
|
|
|
557 |
});
|
558 |
-
|
559 |
uploader.bind('UploadFile', function(up, file) {
|
560 |
self._handleFileStatus(file);
|
561 |
});
|
562 |
-
|
563 |
-
uploader.bind('FileUploaded', function(up, file) {
|
564 |
self._handleFileStatus(file);
|
565 |
-
self._trigger('uploaded', null, { up: up, file: file } );
|
566 |
});
|
567 |
-
|
568 |
uploader.bind('UploadProgress', function(up, file) {
|
569 |
self._handleFileStatus(file);
|
570 |
self._updateTotalProgress();
|
571 |
self._trigger('progress', null, { up: up, file: file } );
|
572 |
});
|
573 |
-
|
574 |
uploader.bind('UploadComplete', function(up, files) {
|
575 |
-
self._addFormFields();
|
576 |
self._trigger('complete', null, { up: up, files: files } );
|
577 |
});
|
578 |
},
|
579 |
|
580 |
-
|
581 |
_setOption: function(key, value) {
|
582 |
var self = this;
|
583 |
|
584 |
-
if (key == 'buttons' && typeof(value) == 'object') {
|
585 |
value = $.extend(self.options.buttons, value);
|
586 |
-
|
587 |
if (!value.browse) {
|
588 |
self.browse_button.button('disable').hide();
|
589 |
self.uploader.disableBrowse(true);
|
@@ -591,24 +644,24 @@ $.widget("ui.plupload", {
|
|
591 |
self.browse_button.button('enable').show();
|
592 |
self.uploader.disableBrowse(false);
|
593 |
}
|
594 |
-
|
595 |
if (!value.start) {
|
596 |
self.start_button.button('disable').hide();
|
597 |
} else {
|
598 |
self.start_button.button('enable').show();
|
599 |
}
|
600 |
-
|
601 |
if (!value.stop) {
|
602 |
self.stop_button.button('disable').hide();
|
603 |
} else {
|
604 |
-
self.start_button.button('enable').show();
|
605 |
}
|
606 |
}
|
607 |
-
|
608 |
-
self.uploader.
|
609 |
},
|
610 |
|
611 |
-
|
612 |
/**
|
613 |
Start upload. Triggers `start` event.
|
614 |
|
@@ -616,10 +669,9 @@ $.widget("ui.plupload", {
|
|
616 |
*/
|
617 |
start: function() {
|
618 |
this.uploader.start();
|
619 |
-
this._trigger('start', null, { up: this.uploader });
|
620 |
},
|
621 |
|
622 |
-
|
623 |
/**
|
624 |
Stop upload. Triggers `stop` event.
|
625 |
|
@@ -627,7 +679,6 @@ $.widget("ui.plupload", {
|
|
627 |
*/
|
628 |
stop: function() {
|
629 |
this.uploader.stop();
|
630 |
-
this._trigger('stop', null, { up: this.uploader });
|
631 |
},
|
632 |
|
633 |
|
@@ -652,9 +703,9 @@ $.widget("ui.plupload", {
|
|
652 |
this.uploader.disableBrowse(true);
|
653 |
},
|
654 |
|
655 |
-
|
656 |
/**
|
657 |
-
Retrieve file by
|
658 |
|
659 |
@method getFile
|
660 |
@param {String} id Unique id of the file
|
@@ -662,18 +713,18 @@ $.widget("ui.plupload", {
|
|
662 |
*/
|
663 |
getFile: function(id) {
|
664 |
var file;
|
665 |
-
|
666 |
if (typeof id === 'number') {
|
667 |
-
file = this.uploader.files[id];
|
668 |
} else {
|
669 |
-
file = this.uploader.getFile(id);
|
670 |
}
|
671 |
return file;
|
672 |
},
|
673 |
|
674 |
/**
|
675 |
Return array of files currently in the queue.
|
676 |
-
|
677 |
@method getFiles
|
678 |
@return {Array} Array of files in the queue represented by plupload.File objects
|
679 |
*/
|
@@ -681,21 +732,21 @@ $.widget("ui.plupload", {
|
|
681 |
return this.uploader.files;
|
682 |
},
|
683 |
|
684 |
-
|
685 |
/**
|
686 |
Remove the file from the queue.
|
687 |
|
688 |
@method removeFile
|
689 |
-
@param {plupload.File|String} file File to remove, might be specified directly or by
|
690 |
*/
|
691 |
removeFile: function(file) {
|
692 |
if (plupload.typeOf(file) === 'string') {
|
693 |
file = this.getFile(file);
|
694 |
}
|
695 |
-
this.
|
696 |
},
|
697 |
|
698 |
-
|
699 |
/**
|
700 |
Clear the file queue.
|
701 |
|
@@ -739,12 +790,12 @@ $.widget("ui.plupload", {
|
|
739 |
*/
|
740 |
notify: function(type, message) {
|
741 |
var popup = $(
|
742 |
-
'<div class="plupload_message">' +
|
743 |
'<span class="plupload_message_close ui-icon ui-icon-circle-close" title="'+_('Close')+'"></span>' +
|
744 |
'<p><span class="ui-icon"></span>' + message + '</p>' +
|
745 |
'</div>'
|
746 |
);
|
747 |
-
|
748 |
popup
|
749 |
.addClass('ui-state-' + (type === 'error' ? 'error' : 'highlight'))
|
750 |
.find('p .ui-icon')
|
@@ -752,44 +803,42 @@ $.widget("ui.plupload", {
|
|
752 |
.end()
|
753 |
.find('.plupload_message_close')
|
754 |
.click(function() {
|
755 |
-
popup.remove();
|
756 |
})
|
757 |
.end();
|
758 |
-
|
759 |
$('.plupload_header', this.container).append(popup);
|
760 |
},
|
761 |
|
762 |
-
|
763 |
/**
|
764 |
Destroy the widget, the uploader, free associated resources and bring back original html.
|
765 |
|
766 |
@method destroy
|
767 |
*/
|
768 |
destroy: function() {
|
769 |
-
this._removeFiles([].slice.call(this.uploader.files));
|
770 |
-
|
771 |
// destroy uploader instance
|
772 |
this.uploader.destroy();
|
773 |
|
774 |
// unbind all button events
|
775 |
$('.plupload_button', this.element).unbind();
|
776 |
-
|
777 |
// destroy buttons
|
778 |
if ($.ui.button) {
|
779 |
$('.plupload_add, .plupload_start, .plupload_stop', this.container)
|
780 |
.button('destroy');
|
781 |
}
|
782 |
-
|
783 |
// destroy progressbar
|
784 |
if ($.ui.progressbar) {
|
785 |
-
this.progressbar.progressbar('destroy');
|
786 |
}
|
787 |
-
|
788 |
// destroy sortable behavior
|
789 |
if ($.ui.sortable && this.options.sortable) {
|
790 |
$('tbody', this.filelist).sortable('destroy');
|
791 |
}
|
792 |
-
|
793 |
// restore the elements initial state
|
794 |
this.element
|
795 |
.empty()
|
@@ -798,42 +847,50 @@ $.widget("ui.plupload", {
|
|
798 |
|
799 |
$.Widget.prototype.destroy.apply(this);
|
800 |
},
|
801 |
-
|
802 |
-
|
803 |
_handleState: function() {
|
804 |
-
var up = this.uploader
|
805 |
-
|
806 |
-
|
807 |
-
|
808 |
-
|
|
|
809 |
$([])
|
810 |
.add(this.stop_button)
|
811 |
.add('.plupload_started')
|
812 |
.removeClass('plupload_hidden');
|
813 |
-
|
814 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
815 |
$('.plupload_header_content', this.element).addClass('plupload_header_content_bw');
|
816 |
-
}
|
|
|
817 |
$([])
|
818 |
.add(this.stop_button)
|
819 |
.add('.plupload_started')
|
820 |
.addClass('plupload_hidden');
|
821 |
-
|
822 |
-
if (
|
823 |
-
|
824 |
} else {
|
825 |
-
|
826 |
-
|
827 |
-
.add(this.start_button)
|
828 |
-
.button('disable');
|
829 |
|
830 |
-
|
|
|
831 |
}
|
832 |
|
833 |
-
if
|
834 |
-
|
835 |
-
|
836 |
-
|
837 |
}
|
838 |
|
839 |
this._updateTotalProgress();
|
@@ -842,54 +899,57 @@ $.widget("ui.plupload", {
|
|
842 |
if (up.total.queued === 0) {
|
843 |
$('.ui-button-text', this.browse_button).html(_('Add Files'));
|
844 |
} else {
|
845 |
-
$('.ui-button-text', this.browse_button).html(
|
846 |
}
|
847 |
|
|
|
|
|
|
|
848 |
up.refresh();
|
849 |
},
|
850 |
-
|
851 |
-
|
852 |
_handleFileStatus: function(file) {
|
853 |
-
var
|
854 |
-
|
855 |
// since this method might be called asynchronously, file row might not yet be rendered
|
856 |
-
if (!$
|
857 |
-
return;
|
858 |
}
|
859 |
|
860 |
switch (file.status) {
|
861 |
-
case plupload.DONE:
|
862 |
actionClass = 'plupload_done';
|
863 |
-
iconClass = 'ui-icon ui-icon-circle-check';
|
864 |
break;
|
865 |
-
|
866 |
case plupload.FAILED:
|
867 |
actionClass = 'ui-state-error plupload_failed';
|
868 |
-
iconClass = 'ui-icon ui-icon-alert';
|
869 |
break;
|
870 |
|
871 |
case plupload.QUEUED:
|
872 |
actionClass = 'plupload_delete';
|
873 |
-
iconClass = 'ui-icon ui-icon-circle-minus';
|
874 |
break;
|
875 |
|
876 |
case plupload.UPLOADING:
|
877 |
actionClass = 'ui-state-highlight plupload_uploading';
|
878 |
-
iconClass = 'ui-icon ui-icon-circle-arrow-w';
|
879 |
-
|
880 |
// scroll uploading file into the view if its bottom boundary is out of it
|
881 |
var scroller = $('.plupload_scroll', this.container)
|
882 |
, scrollTop = scroller.scrollTop()
|
883 |
, scrollerHeight = scroller.height()
|
884 |
-
, rowOffset = $
|
885 |
;
|
886 |
-
|
887 |
if (scrollerHeight < rowOffset) {
|
888 |
scroller.scrollTop(scrollTop + rowOffset - scrollerHeight);
|
889 |
-
}
|
890 |
|
891 |
// Set file specific progress
|
892 |
-
$
|
893 |
.find('.plupload_file_percent')
|
894 |
.html(file.percent + '%')
|
895 |
.end()
|
@@ -897,33 +957,26 @@ $.widget("ui.plupload", {
|
|
897 |
.css('width', file.percent + '%')
|
898 |
.end()
|
899 |
.find('.plupload_file_size')
|
900 |
-
.html(plupload.formatSize(file.size));
|
901 |
break;
|
902 |
}
|
903 |
actionClass += ' ui-state-default plupload_file';
|
904 |
|
905 |
-
$
|
906 |
.attr('class', actionClass)
|
907 |
-
.find('.
|
908 |
-
.attr('class', iconClass)
|
909 |
-
.end()
|
910 |
-
.filter('.plupload_delete, .plupload_done, .plupload_failed')
|
911 |
-
.find('.ui-icon')
|
912 |
-
.click(function(e) {
|
913 |
-
self._removeFiles(file);
|
914 |
-
e.preventDefault();
|
915 |
-
});
|
916 |
},
|
917 |
-
|
918 |
-
|
919 |
_updateTotalProgress: function() {
|
920 |
var up = this.uploader;
|
921 |
|
922 |
// Scroll to end of file list
|
923 |
this.filelist[0].scrollTop = this.filelist[0].scrollHeight;
|
924 |
-
|
925 |
this.progressbar.progressbar('value', up.total.percent);
|
926 |
-
|
927 |
this.element
|
928 |
.find('.plupload_total_status')
|
929 |
.html(up.total.percent + '%')
|
@@ -932,7 +985,7 @@ $.widget("ui.plupload", {
|
|
932 |
.html(plupload.formatSize(up.total.size))
|
933 |
.end()
|
934 |
.find('.plupload_upload_status')
|
935 |
-
.html(
|
936 |
},
|
937 |
|
938 |
|
@@ -952,7 +1005,7 @@ $.widget("ui.plupload", {
|
|
952 |
|
953 |
function onLast(el, eventName, cb) {
|
954 |
var timer;
|
955 |
-
|
956 |
el.on(eventName, function() {
|
957 |
clearTimeout(timer);
|
958 |
timer = setTimeout(function() {
|
@@ -981,15 +1034,15 @@ $.widget("ui.plupload", {
|
|
981 |
// calculate index of virst visible thumb
|
982 |
var startIdx = Math.floor(self.content.scrollTop() / th) * cols;
|
983 |
// get potentially visible thumbs that are not yet visible
|
984 |
-
thumbs = $('.plupload_file', self.filelist)
|
985 |
.slice(startIdx, startIdx + num)
|
986 |
-
.filter('
|
987 |
.get();
|
988 |
}
|
989 |
-
|
990 |
|
991 |
function init() {
|
992 |
-
function mpl() {
|
993 |
if (self.view_mode !== 'thumbs') {
|
994 |
return;
|
995 |
}
|
@@ -1012,25 +1065,37 @@ $.widget("ui.plupload", {
|
|
1012 |
|
1013 |
|
1014 |
function preloadThumb(file, cb) {
|
1015 |
-
var img = new o.Image();
|
|
|
1016 |
|
1017 |
img.onload = function() {
|
1018 |
-
var thumb = $('#' + file.id + ' .plupload_file_thumb', self.filelist)
|
1019 |
-
this.embed(thumb[0], {
|
1020 |
-
width:
|
1021 |
-
height:
|
1022 |
crop: true,
|
1023 |
-
|
1024 |
-
|
|
|
|
|
1025 |
});
|
1026 |
};
|
1027 |
|
1028 |
-
img.bind("embedded error", function() {
|
1029 |
-
$('#' + file.id, self.filelist)
|
|
|
|
|
|
|
|
|
1030 |
this.destroy();
|
1031 |
setTimeout(cb, 1); // detach, otherwise ui might hang (in SilverLight for example)
|
1032 |
});
|
1033 |
|
|
|
|
|
|
|
|
|
|
|
1034 |
img.load(file.getSource());
|
1035 |
}
|
1036 |
|
@@ -1038,7 +1103,7 @@ $.widget("ui.plupload", {
|
|
1038 |
function lazyLoad() {
|
1039 |
if (self.view_mode !== 'thumbs' || loading) {
|
1040 |
return;
|
1041 |
-
}
|
1042 |
|
1043 |
pickThumbsToLoad();
|
1044 |
if (!thumbs.length) {
|
@@ -1047,7 +1112,7 @@ $.widget("ui.plupload", {
|
|
1047 |
|
1048 |
loading = true;
|
1049 |
|
1050 |
-
preloadThumb(self.getFile($(thumbs.shift()).attr('id')), function() {
|
1051 |
loading = false;
|
1052 |
lazyLoad();
|
1053 |
});
|
@@ -1062,19 +1127,23 @@ $.widget("ui.plupload", {
|
|
1062 |
|
1063 |
|
1064 |
_addFiles: function(files) {
|
1065 |
-
var self = this, file_html;
|
1066 |
|
1067 |
-
file_html = '<li class="plupload_file ui-state-default" id="
|
1068 |
-
'<div class="plupload_file_thumb">' +
|
1069 |
-
'<div class="plupload_file_dummy ui-widget-content"><span class="ui-state-disabled"
|
1070 |
'</div>' +
|
1071 |
-
'<div class="plupload_file_name" title="%name%"><span class="plupload_file_namespan">%name%</span></div>' +
|
1072 |
-
'<div class="plupload_file_action"><div class="ui-icon"> </div></div>' +
|
1073 |
-
'<div class="plupload_file_size">%size% </div>' +
|
1074 |
'<div class="plupload_file_status">' +
|
1075 |
-
'<div class="plupload_file_progress ui-widget-header" style="width: 0%"> </div>' +
|
1076 |
-
'<span class="plupload_file_percent"
|
|
|
|
|
|
|
|
|
|
|
|
|
1077 |
'</div>' +
|
|
|
1078 |
'<div class="plupload_file_fields"> </div>' +
|
1079 |
'</li>';
|
1080 |
|
@@ -1083,51 +1152,27 @@ $.widget("ui.plupload", {
|
|
1083 |
}
|
1084 |
|
1085 |
$.each(files, function(i, file) {
|
1086 |
-
var ext = o.Mime.getFileExtension(file.name) || 'none';
|
1087 |
-
|
1088 |
-
self.filelist.append(file_html.replace(/%(\w+)%/g, function($0, $1) {
|
1089 |
-
if ('size' === $1) {
|
1090 |
-
return plupload.formatSize(file.size);
|
1091 |
-
} else if ('ext' === $1) {
|
1092 |
-
return ext;
|
1093 |
-
} else {
|
1094 |
-
return file[$1] || '';
|
1095 |
-
}
|
1096 |
-
}));
|
1097 |
-
|
1098 |
-
self._handleFileStatus(file);
|
1099 |
-
});
|
1100 |
-
},
|
1101 |
|
|
|
|
|
|
|
|
|
|
|
1102 |
|
1103 |
-
|
1104 |
-
|
1105 |
|
1106 |
-
|
1107 |
-
|
1108 |
-
}
|
1109 |
|
1110 |
-
|
1111 |
-
|
1112 |
-
|
1113 |
-
}
|
1114 |
-
|
1115 |
-
$.each(files, function(i, file) {
|
1116 |
-
$('#' + file.id).toggle("highlight", function() {
|
1117 |
-
this.remove();
|
1118 |
});
|
1119 |
-
up.removeFile(file);
|
1120 |
});
|
1121 |
|
1122 |
-
|
1123 |
-
if (up.files.length) {
|
1124 |
-
// re-initialize sortable
|
1125 |
-
if (this.options.sortable && $.ui.sortable) {
|
1126 |
-
this._enableSortingList();
|
1127 |
-
}
|
1128 |
-
}
|
1129 |
-
|
1130 |
-
this._trigger('updatelist', null, { filelist: this.filelist });
|
1131 |
},
|
1132 |
|
1133 |
|
@@ -1153,20 +1198,20 @@ $.widget("ui.plupload", {
|
|
1153 |
|
1154 |
this.counter.val(this.uploader.files.length);
|
1155 |
},
|
1156 |
-
|
1157 |
|
1158 |
_viewChanged: function(view) {
|
1159 |
// update or write a new cookie
|
1160 |
if (this.options.views.remember && $.cookie) {
|
1161 |
$.cookie('plupload_ui_view', view, { expires: 7, path: '/' });
|
1162 |
-
}
|
1163 |
-
|
1164 |
// ugly fix for IE6 - make content area stretchable
|
1165 |
-
if (
|
1166 |
-
this.content.attr('style', 'height:expression(document.getElementById("' + this.id + '_container' + '").clientHeight - ' + (view === 'list' ?
|
1167 |
}
|
1168 |
|
1169 |
-
this.container.removeClass('plupload_view_list plupload_view_thumbs').addClass('plupload_view_' + view);
|
1170 |
this.view_mode = view;
|
1171 |
this._trigger('viewchanged', null, { view: view });
|
1172 |
},
|
@@ -1228,20 +1273,26 @@ $.widget("ui.plupload", {
|
|
1228 |
this._displayThumbs();
|
1229 |
}
|
1230 |
},
|
1231 |
-
|
1232 |
-
|
1233 |
_enableRenaming: function() {
|
1234 |
var self = this;
|
1235 |
|
1236 |
this.filelist.dblclick(function(e) {
|
1237 |
-
var
|
|
|
|
|
|
|
|
|
|
|
1238 |
|
1239 |
-
|
|
|
1240 |
return;
|
1241 |
}
|
1242 |
-
|
1243 |
// Get file name and split out name and extension
|
1244 |
-
file = self.uploader.getFile(
|
1245 |
name = file.name;
|
1246 |
parts = /^(.+)(\.[^.]+)$/.exec(name);
|
1247 |
if (parts) {
|
@@ -1269,39 +1320,39 @@ $.widget("ui.plupload", {
|
|
1269 |
})[0].focus();
|
1270 |
});
|
1271 |
},
|
1272 |
-
|
1273 |
-
|
1274 |
_enableSortingList: function() {
|
1275 |
var self = this;
|
1276 |
-
|
1277 |
if ($('.plupload_file', this.filelist).length < 2) {
|
1278 |
-
return;
|
1279 |
}
|
1280 |
|
1281 |
// destroy sortable if enabled
|
1282 |
-
$('tbody', this.filelist).sortable('destroy');
|
1283 |
-
|
1284 |
-
// enable
|
1285 |
this.filelist.sortable({
|
1286 |
items: '.plupload_delete',
|
1287 |
-
|
1288 |
cancel: 'object, .plupload_clearer',
|
1289 |
|
1290 |
stop: function() {
|
1291 |
var files = [];
|
1292 |
-
|
1293 |
$.each($(this).sortable('toArray'), function(i, id) {
|
1294 |
files[files.length] = self.uploader.getFile(id);
|
1295 |
-
});
|
1296 |
-
|
1297 |
files.unshift(files.length);
|
1298 |
files.unshift(0);
|
1299 |
-
|
1300 |
-
// re-populate files array
|
1301 |
-
Array.prototype.splice.apply(self.uploader.files, files);
|
1302 |
}
|
1303 |
-
});
|
1304 |
}
|
1305 |
});
|
1306 |
|
1307 |
-
} (window, document, plupload,
|
12 |
* jquery.ui.widget.js
|
13 |
* jquery.ui.button.js
|
14 |
* jquery.ui.progressbar.js
|
15 |
+
*
|
16 |
* Optionally:
|
17 |
* jquery.ui.sortable.js
|
18 |
*/
|
22 |
/**
|
23 |
jQuery UI based implementation of the Plupload API - multi-runtime file uploading API.
|
24 |
|
25 |
+
To use the widget you must include _jQuery_ and _jQuery UI_ bundle (including `ui.core`, `ui.widget`, `ui.button`,
|
26 |
`ui.progressbar` and `ui.sortable`).
|
27 |
|
28 |
+
In general the widget is designed the way that you do not usually need to do anything to it after you instantiate it.
|
29 |
+
But! You still can intervenue, to some extent, in case you need to. Although, due to the fact that widget is based on
|
30 |
_jQuery UI_ widget factory, there are some specifics. See examples below for more details.
|
31 |
|
32 |
@example
|
58 |
@example
|
59 |
// Subscribing to the events...
|
60 |
// ... on initialization:
|
61 |
+
$('#uploader').plupload({
|
62 |
...
|
63 |
viewchanged: function(event, args) {
|
64 |
// stuff ...
|
75 |
@param {String} settings.url URL of the server-side upload handler.
|
76 |
@param {Number|String} [settings.chunk_size=0] Chunk size in bytes to slice the file into. Shorcuts with b, kb, mb, gb, tb suffixes also supported. `e.g. 204800 or "204800b" or "200kb"`. By default - disabled.
|
77 |
@param {String} [settings.file_data_name="file"] Name for the file field in Multipart formated message.
|
78 |
+
@param {Object} [settings.filters={}] Set of file type filters.
|
79 |
+
@param {Array} [settings.filters.mime_types=[]] List of file types to accept, each one defined by title and list of extensions. `e.g. {title : "Image files", extensions : "jpg,jpeg,gif,png"}`. Dispatches `plupload.FILE_EXTENSION_ERROR`
|
80 |
+
@param {String|Number} [settings.filters.max_file_size=0] Maximum file size that the user can pick, in bytes. Optionally supports b, kb, mb, gb, tb suffixes. `e.g. "10mb" or "1gb"`. By default - not set. Dispatches `plupload.FILE_SIZE_ERROR`.
|
81 |
+
@param {Boolean} [settings.filters.prevent_duplicates=false] Do not let duplicates into the queue. Dispatches `plupload.FILE_DUPLICATE_ERROR`.
|
82 |
+
@param {Number} [settings.filters.max_file_count=0] Limit the number of files that can reside in the queue at the same time (default is 0 - no limit).
|
83 |
@param {String} [settings.flash_swf_url] URL of the Flash swf.
|
84 |
@param {Object} [settings.headers] Custom headers to send with the upload. Hash of name/value pairs.
|
85 |
@param {Number|String} [settings.max_file_size] Maximum file size that the user can pick, in bytes. Optionally supports b, kb, mb, gb, tb suffixes. `e.g. "10mb" or "1gb"`. By default - not set. Dispatches `plupload.FILE_SIZE_ERROR`.
|
102 |
@param {Boolean} [settings.dragdrop=true] Enable ability to add file to the queue by drag'n'dropping them from the desktop.
|
103 |
@param {Boolean} [settings.rename=false] Enable ability to rename files in the queue.
|
104 |
@param {Boolean} [settings.sortable=false] Enable ability to sort files in the queue, changing their uploading priority.
|
105 |
+
@param {Object} [settings.buttons] Control the visibility of functional buttons.
|
106 |
@param {Boolean} [settings.buttons.browse=true] Display browse button.
|
107 |
@param {Boolean} [settings.buttons.start=true] Display start button.
|
108 |
+
@param {Boolean} [settings.buttons.stop=true] Display stop button.
|
109 |
@param {Object} [settings.views] Control various views of the file queue.
|
110 |
@param {Boolean} [settings.views.list=true] Enable list view.
|
111 |
@param {Boolean} [settings.views.thumbs=false] Enable thumbs view.
|
112 |
@param {String} [settings.views.default='list'] Default view.
|
113 |
@param {Boolean} [settings.views.remember=true] Whether to remember the current view (requires jQuery Cookie plugin).
|
114 |
@param {Boolean} [settings.multiple_queues=true] Re-activate the widget after each upload procedure.
|
|
|
115 |
*/
|
116 |
+
;(function(window, document, plupload, o, $) {
|
117 |
|
118 |
/**
|
119 |
Dispatched when the widget is initialized and ready.
|
141 |
/**
|
142 |
Dispatched when upload is started.
|
143 |
|
144 |
+
@event started
|
145 |
@param {plupload.Uploader} uploader Uploader instance sending the event.
|
146 |
*/
|
147 |
|
148 |
/**
|
149 |
Dispatched when upload is stopped.
|
150 |
|
151 |
+
@event stopped
|
152 |
@param {plupload.Uploader} uploader Uploader instance sending the event.
|
153 |
*/
|
154 |
|
198 |
@param {Enum} status Status constant matching the plupload states QUEUED, UPLOADING, FAILED, DONE.
|
199 |
*/
|
200 |
|
201 |
+
var uploaders = {};
|
202 |
+
|
203 |
function _(str) {
|
204 |
return plupload.translate(str) || str;
|
205 |
}
|
206 |
|
207 |
+
function renderUI(obj) {
|
208 |
obj.id = obj.attr('id');
|
209 |
|
210 |
obj.html(
|
213 |
'<div class="ui-state-default ui-widget-header plupload_header">' +
|
214 |
'<div class="plupload_header_content">' +
|
215 |
'<div class="plupload_logo"> </div>' +
|
216 |
+
'<div class="plupload_header_title">' + _("Select files") + '</div>' +
|
217 |
+
'<div class="plupload_header_text">' + _("Add files to the upload queue and click the start button.") + '</div>' +
|
218 |
'<div class="plupload_view_switch">' +
|
219 |
'<input type="radio" id="'+obj.id+'_view_list" name="view_mode_'+obj.id+'" checked="checked" /><label class="plupload_button" for="'+obj.id+'_view_list" data-view="list">' + _('List') + '</label>' +
|
220 |
'<input type="radio" id="'+obj.id+'_view_thumbs" name="view_mode_'+obj.id+'" /><label class="plupload_button" for="'+obj.id+'_view_thumbs" data-view="thumbs">' + _('Thumbnails') + '</label>' +
|
236 |
'<ul class="plupload_filelist_content"> </ul>' +
|
237 |
'<div class="plupload_clearer"> </div>' +
|
238 |
'</div>' +
|
239 |
+
|
240 |
'<table class="plupload_filelist plupload_filelist_footer ui-widget-header">' +
|
241 |
'<tr>' +
|
242 |
'<td class="plupload_cell plupload_file_name">' +
|
243 |
'<div class="plupload_buttons"><!-- Visible -->' +
|
244 |
+
'<a class="plupload_button plupload_add">' + _("Add Files") + '</a> ' +
|
245 |
+
'<a class="plupload_button plupload_start">' + _("Start Upload") + '</a> ' +
|
246 |
+
'<a class="plupload_button plupload_stop plupload_hidden">'+_("Stop Upload") + '</a> ' +
|
247 |
'</div>' +
|
248 |
|
249 |
'<div class="plupload_started plupload_hidden"><!-- Hidden -->' +
|
272 |
$.widget("ui.plupload", {
|
273 |
|
274 |
widgetEventPrefix: '',
|
275 |
+
|
276 |
contents_bak: '',
|
277 |
+
|
278 |
options: {
|
279 |
browse_button_hover: 'ui-state-hover',
|
280 |
browse_button_active: 'ui-state-active',
|
281 |
+
|
282 |
+
filters: {},
|
283 |
+
|
284 |
// widget specific
|
|
|
|
|
285 |
buttons: {
|
286 |
browse: true,
|
287 |
start: true,
|
288 |
+
stop: true
|
289 |
},
|
290 |
+
|
291 |
views: {
|
292 |
list: true,
|
293 |
thumbs: false,
|
294 |
active: 'list',
|
295 |
remember: true // requires: https://github.com/carhartl/jquery-cookie, otherwise disabled even if set to true
|
296 |
},
|
297 |
+
|
298 |
+
thumb_width: 100,
|
299 |
+
thumb_height: 60,
|
300 |
+
|
301 |
+
multiple_queues: true, // re-use widget by default
|
302 |
+
dragdrop : true,
|
303 |
autostart: false,
|
304 |
sortable: false,
|
305 |
+
rename: false
|
|
|
306 |
},
|
307 |
+
|
308 |
FILE_COUNT_ERROR: -9001,
|
309 |
+
|
310 |
_create: function() {
|
311 |
var id = this.element.attr('id');
|
312 |
if (!id) {
|
314 |
this.element.attr('id', id);
|
315 |
}
|
316 |
this.id = id;
|
317 |
+
|
318 |
// backup the elements initial state
|
319 |
this.contents_bak = this.element.html();
|
320 |
renderUI(this.element);
|
321 |
+
|
322 |
// container, just in case
|
323 |
+
this.container = $('.plupload_container', this.element).attr('id', id + '_container');
|
324 |
|
325 |
this.content = $('.plupload_content', this.element);
|
326 |
+
|
327 |
if ($.fn.resizable) {
|
328 |
+
this.container.resizable({
|
329 |
handles: 's',
|
330 |
minHeight: 300
|
331 |
});
|
332 |
}
|
333 |
+
|
334 |
// list of files, may become sortable
|
335 |
this.filelist = $('.plupload_filelist_content', this.container)
|
336 |
.attr({
|
337 |
id: id + '_filelist',
|
338 |
unselectable: 'on'
|
339 |
});
|
340 |
+
|
341 |
|
342 |
// buttons
|
343 |
this.browse_button = $('.plupload_add', this.container).attr('id', id + '_browse');
|
345 |
this.stop_button = $('.plupload_stop', this.container).attr('id', id + '_stop');
|
346 |
this.thumbs_switcher = $('#' + id + '_view_thumbs');
|
347 |
this.list_switcher = $('#' + id + '_view_list');
|
348 |
+
|
349 |
if ($.ui.button) {
|
350 |
this.browse_button.button({
|
351 |
icons: { primary: 'ui-icon-circle-plus' },
|
352 |
disabled: true
|
353 |
});
|
354 |
+
|
355 |
this.start_button.button({
|
356 |
icons: { primary: 'ui-icon-circle-arrow-e' },
|
357 |
disabled: true
|
358 |
});
|
359 |
+
|
360 |
this.stop_button.button({
|
361 |
icons: { primary: 'ui-icon-circle-close' }
|
362 |
});
|
363 |
+
|
364 |
this.list_switcher.button({
|
365 |
text: false,
|
366 |
icons: { secondary: "ui-icon-grip-dotted-horizontal" }
|
371 |
icons: { secondary: "ui-icon-image" }
|
372 |
});
|
373 |
}
|
374 |
+
|
375 |
// progressbar
|
376 |
+
this.progressbar = $('.plupload_progress_container', this.container);
|
377 |
+
|
378 |
if ($.ui.progressbar) {
|
379 |
this.progressbar.progressbar();
|
380 |
}
|
381 |
+
|
382 |
// counter
|
383 |
this.counter = $('.plupload_count', this.element)
|
384 |
.attr({
|
385 |
id: id + '_count',
|
386 |
name: id + '_count'
|
387 |
});
|
388 |
+
|
389 |
// initialize uploader instance
|
390 |
this._initUploader();
|
391 |
},
|
394 |
var self = this
|
395 |
, id = this.id
|
396 |
, uploader
|
397 |
+
, options = {
|
398 |
container: id + '_buttons',
|
399 |
browse_button: id + '_browse'
|
400 |
}
|
407 |
options.drop_element = this.id + '_dropbox';
|
408 |
}
|
409 |
|
410 |
+
this.filelist.on('click', function(e) {
|
411 |
+
var me = $(e.target), fileContainer;
|
412 |
+
if (me.hasClass('plupload_action_icon')) {
|
413 |
+
fileContainer = me.closest('.plupload_file');
|
414 |
+
if (fileContainer.hasClass('plupload_delete')) {
|
415 |
+
self.removeFile(fileContainer.attr('id'));
|
416 |
+
e.preventDefault();
|
417 |
+
}
|
418 |
+
}
|
419 |
+
});
|
420 |
+
|
421 |
uploader = this.uploader = uploaders[id] = new plupload.Uploader($.extend(this.options, options));
|
422 |
|
423 |
+
// retrieve full normalized set of options
|
424 |
+
this.options = uploader.getOption();
|
425 |
+
|
426 |
if (self.options.views.thumbs) {
|
427 |
uploader.settings.required_features.display_media = true;
|
428 |
}
|
429 |
|
430 |
+
// for backward compatibility
|
431 |
+
if (self.options.max_file_count) {
|
432 |
+
plupload.extend(uploader.getOption('filters'), {
|
433 |
+
max_file_count: self.options.max_file_count
|
434 |
+
});
|
435 |
+
}
|
436 |
|
437 |
+
plupload.addFileFilter('max_file_count', function(maxCount, file, cb) {
|
438 |
+
if (maxCount <= this.files.length - (this.total.uploaded + this.total.failed)) {
|
439 |
+
self.browse_button.button('disable');
|
440 |
+
this.disableBrowse();
|
441 |
+
|
442 |
+
this.trigger('Error', {
|
443 |
+
code : self.FILE_COUNT_ERROR,
|
444 |
+
message : _("File count error."),
|
445 |
+
file : file
|
446 |
+
});
|
447 |
+
cb(false);
|
448 |
+
} else {
|
449 |
+
cb(true);
|
450 |
+
}
|
451 |
+
});
|
452 |
+
|
453 |
+
|
454 |
+
uploader.bind('Error', function(up, err) {
|
455 |
var message, details = "";
|
456 |
|
457 |
message = '<strong>' + err.message + '</strong>';
|
458 |
+
|
459 |
switch (err.code) {
|
460 |
case plupload.FILE_EXTENSION_ERROR:
|
461 |
+
details = plupload.sprintf(_("File: %s"), err.file.name);
|
462 |
break;
|
463 |
+
|
464 |
case plupload.FILE_SIZE_ERROR:
|
465 |
+
details = plupload.sprintf(_("File: %s, size: %d, max file size: %d"), err.file.name, plupload.formatSize(err.file.size), plupload.formatSize(plupload.parseSize(up.getOption('filters').max_file_size)));
|
466 |
break;
|
467 |
|
468 |
case plupload.FILE_DUPLICATE_ERROR:
|
469 |
+
details = plupload.sprintf(_("%s already present in the queue."), err.file.name);
|
470 |
break;
|
471 |
+
|
472 |
case self.FILE_COUNT_ERROR:
|
473 |
+
details = plupload.sprintf(_("Upload element accepts only %d file(s) at a time. Extra files were stripped."), up.getOption('filters').max_file_count || 0);
|
474 |
break;
|
475 |
+
|
476 |
case plupload.IMAGE_FORMAT_ERROR :
|
477 |
details = _("Image format either wrong or not supported.");
|
478 |
+
break;
|
479 |
+
|
480 |
case plupload.IMAGE_MEMORY_ERROR :
|
481 |
details = _("Runtime ran out of available memory.");
|
482 |
break;
|
483 |
+
|
484 |
/* // This needs a review
|
485 |
case plupload.IMAGE_DIMENSIONS_ERROR :
|
486 |
+
details = plupload.sprintf(_('Resoultion out of boundaries! <b>%s</b> runtime supports images only up to %wx%hpx.'), up.runtime, up.features.maxWidth, up.features.maxHeight);
|
487 |
break; */
|
488 |
+
|
489 |
case plupload.HTTP_ERROR:
|
490 |
details = _("Upload URL might be wrong or doesn't exist.");
|
491 |
break;
|
505 |
}
|
506 |
});
|
507 |
|
508 |
+
|
509 |
+
uploader.bind('PostInit', function(up) {
|
510 |
// all buttons are optional, so they can be disabled and hidden
|
511 |
if (!self.options.buttons.browse) {
|
512 |
self.browse_button.button('disable').hide();
|
514 |
} else {
|
515 |
self.browse_button.button('enable');
|
516 |
}
|
517 |
+
|
518 |
if (!self.options.buttons.start) {
|
519 |
self.start_button.button('disable').hide();
|
520 |
+
}
|
521 |
+
|
522 |
if (!self.options.buttons.stop) {
|
523 |
self.stop_button.button('disable').hide();
|
524 |
}
|
525 |
+
|
526 |
if (!self.options.unique_names && self.options.rename) {
|
527 |
+
self._enableRenaming();
|
528 |
}
|
529 |
|
530 |
if (self.options.dragdrop && up.features.dragdrop) {
|
532 |
}
|
533 |
|
534 |
self._enableViewSwitcher();
|
535 |
+
|
536 |
self.start_button.click(function(e) {
|
537 |
if (!$(this).button('option', 'disabled')) {
|
538 |
self.start();
|
547 |
|
548 |
self._trigger('ready', null, { up: up });
|
549 |
});
|
|
|
|
|
|
|
|
|
|
|
550 |
|
551 |
+
// uploader internal events must run first
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
552 |
uploader.init();
|
553 |
|
554 |
uploader.bind('FileFiltered', function(up, file) {
|
555 |
self._addFiles(file);
|
556 |
});
|
557 |
+
|
558 |
uploader.bind('FilesAdded', function(up, files) {
|
559 |
self._trigger('selected', null, { up: up, files: files } );
|
560 |
|
561 |
// re-enable sortable
|
562 |
if (self.options.sortable && $.ui.sortable) {
|
563 |
+
self._enableSortingList();
|
564 |
}
|
565 |
|
566 |
self._trigger('updatelist', null, { filelist: self.filelist });
|
567 |
+
|
568 |
if (self.options.autostart) {
|
569 |
// set a little delay to make sure that QueueChanged triggered by the core has time to complete
|
570 |
setTimeout(function() {
|
572 |
}, 10);
|
573 |
}
|
574 |
});
|
575 |
+
|
576 |
uploader.bind('FilesRemoved', function(up, files) {
|
577 |
+
// destroy sortable if enabled
|
578 |
+
if ($.ui.sortable && self.options.sortable) {
|
579 |
+
$('tbody', self.filelist).sortable('destroy');
|
580 |
+
}
|
581 |
+
|
582 |
+
$.each(files, function(i, file) {
|
583 |
+
$('#' + file.id).toggle("highlight", function() {
|
584 |
+
$(this).remove();
|
585 |
+
});
|
586 |
+
});
|
587 |
+
|
588 |
+
if (up.files.length) {
|
589 |
+
// re-initialize sortable
|
590 |
+
if (self.options.sortable && $.ui.sortable) {
|
591 |
+
self._enableSortingList();
|
592 |
+
}
|
593 |
+
}
|
594 |
+
|
595 |
+
self._trigger('updatelist', null, { filelist: self.filelist });
|
596 |
self._trigger('removed', null, { up: up, files: files } );
|
597 |
});
|
598 |
+
|
599 |
+
uploader.bind('QueueChanged', function() {
|
600 |
+
self._handleState();
|
601 |
+
});
|
602 |
+
|
603 |
+
uploader.bind('StateChanged', function(up) {
|
604 |
self._handleState();
|
605 |
+
if (plupload.STARTED === up.state) {
|
606 |
+
self._trigger('started', null, { up: this.uploader });
|
607 |
+
} else if (plupload.STOPPED === up.state) {
|
608 |
+
self._trigger('stopped', null, { up: this.uploader });
|
609 |
+
}
|
610 |
});
|
611 |
+
|
612 |
uploader.bind('UploadFile', function(up, file) {
|
613 |
self._handleFileStatus(file);
|
614 |
});
|
615 |
+
|
616 |
+
uploader.bind('FileUploaded', function(up, file, result) {
|
617 |
self._handleFileStatus(file);
|
618 |
+
self._trigger('uploaded', null, { up: up, file: file, result: result } );
|
619 |
});
|
620 |
+
|
621 |
uploader.bind('UploadProgress', function(up, file) {
|
622 |
self._handleFileStatus(file);
|
623 |
self._updateTotalProgress();
|
624 |
self._trigger('progress', null, { up: up, file: file } );
|
625 |
});
|
626 |
+
|
627 |
uploader.bind('UploadComplete', function(up, files) {
|
628 |
+
self._addFormFields();
|
629 |
self._trigger('complete', null, { up: up, files: files } );
|
630 |
});
|
631 |
},
|
632 |
|
633 |
+
|
634 |
_setOption: function(key, value) {
|
635 |
var self = this;
|
636 |
|
637 |
+
if (key == 'buttons' && typeof(value) == 'object') {
|
638 |
value = $.extend(self.options.buttons, value);
|
639 |
+
|
640 |
if (!value.browse) {
|
641 |
self.browse_button.button('disable').hide();
|
642 |
self.uploader.disableBrowse(true);
|
644 |
self.browse_button.button('enable').show();
|
645 |
self.uploader.disableBrowse(false);
|
646 |
}
|
647 |
+
|
648 |
if (!value.start) {
|
649 |
self.start_button.button('disable').hide();
|
650 |
} else {
|
651 |
self.start_button.button('enable').show();
|
652 |
}
|
653 |
+
|
654 |
if (!value.stop) {
|
655 |
self.stop_button.button('disable').hide();
|
656 |
} else {
|
657 |
+
self.start_button.button('enable').show();
|
658 |
}
|
659 |
}
|
660 |
+
|
661 |
+
self.uploader.setOption(key, value);
|
662 |
},
|
663 |
|
664 |
+
|
665 |
/**
|
666 |
Start upload. Triggers `start` event.
|
667 |
|
669 |
*/
|
670 |
start: function() {
|
671 |
this.uploader.start();
|
|
|
672 |
},
|
673 |
|
674 |
+
|
675 |
/**
|
676 |
Stop upload. Triggers `stop` event.
|
677 |
|
679 |
*/
|
680 |
stop: function() {
|
681 |
this.uploader.stop();
|
|
|
682 |
},
|
683 |
|
684 |
|
703 |
this.uploader.disableBrowse(true);
|
704 |
},
|
705 |
|
706 |
+
|
707 |
/**
|
708 |
+
Retrieve file by its unique id.
|
709 |
|
710 |
@method getFile
|
711 |
@param {String} id Unique id of the file
|
713 |
*/
|
714 |
getFile: function(id) {
|
715 |
var file;
|
716 |
+
|
717 |
if (typeof id === 'number') {
|
718 |
+
file = this.uploader.files[id];
|
719 |
} else {
|
720 |
+
file = this.uploader.getFile(id);
|
721 |
}
|
722 |
return file;
|
723 |
},
|
724 |
|
725 |
/**
|
726 |
Return array of files currently in the queue.
|
727 |
+
|
728 |
@method getFiles
|
729 |
@return {Array} Array of files in the queue represented by plupload.File objects
|
730 |
*/
|
732 |
return this.uploader.files;
|
733 |
},
|
734 |
|
735 |
+
|
736 |
/**
|
737 |
Remove the file from the queue.
|
738 |
|
739 |
@method removeFile
|
740 |
+
@param {plupload.File|String} file File to remove, might be specified directly or by its unique id
|
741 |
*/
|
742 |
removeFile: function(file) {
|
743 |
if (plupload.typeOf(file) === 'string') {
|
744 |
file = this.getFile(file);
|
745 |
}
|
746 |
+
this.uploader.removeFile(file);
|
747 |
},
|
748 |
|
749 |
+
|
750 |
/**
|
751 |
Clear the file queue.
|
752 |
|
790 |
*/
|
791 |
notify: function(type, message) {
|
792 |
var popup = $(
|
793 |
+
'<div class="plupload_message">' +
|
794 |
'<span class="plupload_message_close ui-icon ui-icon-circle-close" title="'+_('Close')+'"></span>' +
|
795 |
'<p><span class="ui-icon"></span>' + message + '</p>' +
|
796 |
'</div>'
|
797 |
);
|
798 |
+
|
799 |
popup
|
800 |
.addClass('ui-state-' + (type === 'error' ? 'error' : 'highlight'))
|
801 |
.find('p .ui-icon')
|
803 |
.end()
|
804 |
.find('.plupload_message_close')
|
805 |
.click(function() {
|
806 |
+
popup.remove();
|
807 |
})
|
808 |
.end();
|
809 |
+
|
810 |
$('.plupload_header', this.container).append(popup);
|
811 |
},
|
812 |
|
813 |
+
|
814 |
/**
|
815 |
Destroy the widget, the uploader, free associated resources and bring back original html.
|
816 |
|
817 |
@method destroy
|
818 |
*/
|
819 |
destroy: function() {
|
|
|
|
|
820 |
// destroy uploader instance
|
821 |
this.uploader.destroy();
|
822 |
|
823 |
// unbind all button events
|
824 |
$('.plupload_button', this.element).unbind();
|
825 |
+
|
826 |
// destroy buttons
|
827 |
if ($.ui.button) {
|
828 |
$('.plupload_add, .plupload_start, .plupload_stop', this.container)
|
829 |
.button('destroy');
|
830 |
}
|
831 |
+
|
832 |
// destroy progressbar
|
833 |
if ($.ui.progressbar) {
|
834 |
+
this.progressbar.progressbar('destroy');
|
835 |
}
|
836 |
+
|
837 |
// destroy sortable behavior
|
838 |
if ($.ui.sortable && this.options.sortable) {
|
839 |
$('tbody', this.filelist).sortable('destroy');
|
840 |
}
|
841 |
+
|
842 |
// restore the elements initial state
|
843 |
this.element
|
844 |
.empty()
|
847 |
|
848 |
$.Widget.prototype.destroy.apply(this);
|
849 |
},
|
850 |
+
|
851 |
+
|
852 |
_handleState: function() {
|
853 |
+
var up = this.uploader
|
854 |
+
, filesPending = up.files.length - (up.total.uploaded + up.total.failed)
|
855 |
+
, maxCount = up.getOption('filters').max_file_count || 0
|
856 |
+
;
|
857 |
+
|
858 |
+
if (plupload.STARTED === up.state) {
|
859 |
$([])
|
860 |
.add(this.stop_button)
|
861 |
.add('.plupload_started')
|
862 |
.removeClass('plupload_hidden');
|
863 |
+
|
864 |
+
this.start_button.button('disable');
|
865 |
+
|
866 |
+
if (!this.options.multiple_queues) {
|
867 |
+
this.browse_button.button('disable');
|
868 |
+
up.disableBrowse();
|
869 |
+
}
|
870 |
+
|
871 |
+
$('.plupload_upload_status', this.element).html(plupload.sprintf(_('Uploaded %d/%d files'), up.total.uploaded, up.files.length));
|
872 |
$('.plupload_header_content', this.element).addClass('plupload_header_content_bw');
|
873 |
+
}
|
874 |
+
else if (plupload.STOPPED === up.state) {
|
875 |
$([])
|
876 |
.add(this.stop_button)
|
877 |
.add('.plupload_started')
|
878 |
.addClass('plupload_hidden');
|
879 |
+
|
880 |
+
if (filesPending) {
|
881 |
+
this.start_button.button('enable');
|
882 |
} else {
|
883 |
+
this.start_button.button('disable');
|
884 |
+
}
|
|
|
|
|
885 |
|
886 |
+
if (this.options.multiple_queues) {
|
887 |
+
$('.plupload_header_content', this.element).removeClass('plupload_header_content_bw');
|
888 |
}
|
889 |
|
890 |
+
// if max_file_count defined, only that many files can be queued at once
|
891 |
+
if (this.options.multiple_queues && maxCount && maxCount > filesPending) {
|
892 |
+
this.browse_button.button('enable');
|
893 |
+
up.disableBrowse(false);
|
894 |
}
|
895 |
|
896 |
this._updateTotalProgress();
|
899 |
if (up.total.queued === 0) {
|
900 |
$('.ui-button-text', this.browse_button).html(_('Add Files'));
|
901 |
} else {
|
902 |
+
$('.ui-button-text', this.browse_button).html(plupload.sprintf(_('%d files queued'), up.total.queued));
|
903 |
}
|
904 |
|
905 |
+
// have a helper class on a container expressing whether it has files queued or not
|
906 |
+
this.container.toggleClass('plupload_files_queued', up.files.length);
|
907 |
+
|
908 |
up.refresh();
|
909 |
},
|
910 |
+
|
911 |
+
|
912 |
_handleFileStatus: function(file) {
|
913 |
+
var $file = $('#' + file.id), actionClass, iconClass;
|
914 |
+
|
915 |
// since this method might be called asynchronously, file row might not yet be rendered
|
916 |
+
if (!$file.length) {
|
917 |
+
return;
|
918 |
}
|
919 |
|
920 |
switch (file.status) {
|
921 |
+
case plupload.DONE:
|
922 |
actionClass = 'plupload_done';
|
923 |
+
iconClass = 'plupload_action_icon ui-icon ui-icon-circle-check';
|
924 |
break;
|
925 |
+
|
926 |
case plupload.FAILED:
|
927 |
actionClass = 'ui-state-error plupload_failed';
|
928 |
+
iconClass = 'plupload_action_icon ui-icon ui-icon-alert';
|
929 |
break;
|
930 |
|
931 |
case plupload.QUEUED:
|
932 |
actionClass = 'plupload_delete';
|
933 |
+
iconClass = 'plupload_action_icon ui-icon ui-icon-circle-minus';
|
934 |
break;
|
935 |
|
936 |
case plupload.UPLOADING:
|
937 |
actionClass = 'ui-state-highlight plupload_uploading';
|
938 |
+
iconClass = 'plupload_action_icon ui-icon ui-icon-circle-arrow-w';
|
939 |
+
|
940 |
// scroll uploading file into the view if its bottom boundary is out of it
|
941 |
var scroller = $('.plupload_scroll', this.container)
|
942 |
, scrollTop = scroller.scrollTop()
|
943 |
, scrollerHeight = scroller.height()
|
944 |
+
, rowOffset = $file.position().top + $file.height()
|
945 |
;
|
946 |
+
|
947 |
if (scrollerHeight < rowOffset) {
|
948 |
scroller.scrollTop(scrollTop + rowOffset - scrollerHeight);
|
949 |
+
}
|
950 |
|
951 |
// Set file specific progress
|
952 |
+
$file
|
953 |
.find('.plupload_file_percent')
|
954 |
.html(file.percent + '%')
|
955 |
.end()
|
957 |
.css('width', file.percent + '%')
|
958 |
.end()
|
959 |
.find('.plupload_file_size')
|
960 |
+
.html(plupload.formatSize(file.size));
|
961 |
break;
|
962 |
}
|
963 |
actionClass += ' ui-state-default plupload_file';
|
964 |
|
965 |
+
$file
|
966 |
.attr('class', actionClass)
|
967 |
+
.find('.plupload_action_icon')
|
968 |
+
.attr('class', iconClass);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
969 |
},
|
970 |
+
|
971 |
+
|
972 |
_updateTotalProgress: function() {
|
973 |
var up = this.uploader;
|
974 |
|
975 |
// Scroll to end of file list
|
976 |
this.filelist[0].scrollTop = this.filelist[0].scrollHeight;
|
977 |
+
|
978 |
this.progressbar.progressbar('value', up.total.percent);
|
979 |
+
|
980 |
this.element
|
981 |
.find('.plupload_total_status')
|
982 |
.html(up.total.percent + '%')
|
985 |
.html(plupload.formatSize(up.total.size))
|
986 |
.end()
|
987 |
.find('.plupload_upload_status')
|
988 |
+
.html(plupload.sprintf(_('Uploaded %d/%d files'), up.total.uploaded, up.files.length));
|
989 |
},
|
990 |
|
991 |
|
1005 |
|
1006 |
function onLast(el, eventName, cb) {
|
1007 |
var timer;
|
1008 |
+
|
1009 |
el.on(eventName, function() {
|
1010 |
clearTimeout(timer);
|
1011 |
timer = setTimeout(function() {
|
1034 |
// calculate index of virst visible thumb
|
1035 |
var startIdx = Math.floor(self.content.scrollTop() / th) * cols;
|
1036 |
// get potentially visible thumbs that are not yet visible
|
1037 |
+
thumbs = $('.plupload_file .plupload_file_thumb', self.filelist)
|
1038 |
.slice(startIdx, startIdx + num)
|
1039 |
+
.filter('.plupload_thumb_toload')
|
1040 |
.get();
|
1041 |
}
|
1042 |
+
|
1043 |
|
1044 |
function init() {
|
1045 |
+
function mpl() { // measure, pick, load
|
1046 |
if (self.view_mode !== 'thumbs') {
|
1047 |
return;
|
1048 |
}
|
1065 |
|
1066 |
|
1067 |
function preloadThumb(file, cb) {
|
1068 |
+
var img = new o.image.Image();
|
1069 |
+
var resolveUrl = o.core.utils.Url.resolveUrl;
|
1070 |
|
1071 |
img.onload = function() {
|
1072 |
+
var thumb = $('#' + file.id + ' .plupload_file_thumb', self.filelist);
|
1073 |
+
this.embed(thumb[0], {
|
1074 |
+
width: self.options.thumb_width,
|
1075 |
+
height: self.options.thumb_height,
|
1076 |
crop: true,
|
1077 |
+
fit: true,
|
1078 |
+
preserveHeaders: false,
|
1079 |
+
swf_url: resolveUrl(self.options.flash_swf_url),
|
1080 |
+
xap_url: resolveUrl(self.options.silverlight_xap_url)
|
1081 |
});
|
1082 |
};
|
1083 |
|
1084 |
+
img.bind("embedded error", function(e) {
|
1085 |
+
$('#' + file.id, self.filelist)
|
1086 |
+
.find('.plupload_file_thumb')
|
1087 |
+
.removeClass('plupload_thumb_loading')
|
1088 |
+
.addClass('plupload_thumb_' + e.type)
|
1089 |
+
;
|
1090 |
this.destroy();
|
1091 |
setTimeout(cb, 1); // detach, otherwise ui might hang (in SilverLight for example)
|
1092 |
});
|
1093 |
|
1094 |
+
$('#' + file.id, self.filelist)
|
1095 |
+
.find('.plupload_file_thumb')
|
1096 |
+
.removeClass('plupload_thumb_toload')
|
1097 |
+
.addClass('plupload_thumb_loading')
|
1098 |
+
;
|
1099 |
img.load(file.getSource());
|
1100 |
}
|
1101 |
|
1103 |
function lazyLoad() {
|
1104 |
if (self.view_mode !== 'thumbs' || loading) {
|
1105 |
return;
|
1106 |
+
}
|
1107 |
|
1108 |
pickThumbsToLoad();
|
1109 |
if (!thumbs.length) {
|
1112 |
|
1113 |
loading = true;
|
1114 |
|
1115 |
+
preloadThumb(self.getFile($(thumbs.shift()).closest('.plupload_file').attr('id')), function() {
|
1116 |
loading = false;
|
1117 |
lazyLoad();
|
1118 |
});
|
1127 |
|
1128 |
|
1129 |
_addFiles: function(files) {
|
1130 |
+
var self = this, file_html, html = '';
|
1131 |
|
1132 |
+
file_html = '<li class="plupload_file ui-state-default plupload_delete" id="{id}" style="width:{thumb_width}px;">' +
|
1133 |
+
'<div class="plupload_file_thumb plupload_thumb_toload" style="width: {thumb_width}px; height: {thumb_height}px;">' +
|
1134 |
+
'<div class="plupload_file_dummy ui-widget-content" style="line-height: {thumb_height}px;"><span class="ui-state-disabled">{ext} </span></div>' +
|
1135 |
'</div>' +
|
|
|
|
|
|
|
1136 |
'<div class="plupload_file_status">' +
|
1137 |
+
'<div class="plupload_file_progress ui-widget-header" style="width: 0%"> </div>' +
|
1138 |
+
'<span class="plupload_file_percent">{percent} </span>' +
|
1139 |
+
'</div>' +
|
1140 |
+
'<div class="plupload_file_name" title="{name}">' +
|
1141 |
+
'<span class="plupload_file_name_wrapper">{name} </span>' +
|
1142 |
+
'</div>' +
|
1143 |
+
'<div class="plupload_file_action">' +
|
1144 |
+
'<div class="plupload_action_icon ui-icon ui-icon-circle-minus"> </div>' +
|
1145 |
'</div>' +
|
1146 |
+
'<div class="plupload_file_size">{size} </div>' +
|
1147 |
'<div class="plupload_file_fields"> </div>' +
|
1148 |
'</li>';
|
1149 |
|
1152 |
}
|
1153 |
|
1154 |
$.each(files, function(i, file) {
|
1155 |
+
var ext = o.core.utils.Mime.getFileExtension(file.name) || 'none';
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1156 |
|
1157 |
+
html += file_html.replace(/\{(\w+)\}/g, function($0, $1) {
|
1158 |
+
switch ($1) {
|
1159 |
+
case 'thumb_width':
|
1160 |
+
case 'thumb_height':
|
1161 |
+
return self.options[$1];
|
1162 |
|
1163 |
+
case 'size':
|
1164 |
+
return plupload.formatSize(file.size);
|
1165 |
|
1166 |
+
case 'ext':
|
1167 |
+
return ext;
|
|
|
1168 |
|
1169 |
+
default:
|
1170 |
+
return file[$1] || '';
|
1171 |
+
}
|
|
|
|
|
|
|
|
|
|
|
1172 |
});
|
|
|
1173 |
});
|
1174 |
|
1175 |
+
self.filelist.append(html);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1176 |
},
|
1177 |
|
1178 |
|
1198 |
|
1199 |
this.counter.val(this.uploader.files.length);
|
1200 |
},
|
1201 |
+
|
1202 |
|
1203 |
_viewChanged: function(view) {
|
1204 |
// update or write a new cookie
|
1205 |
if (this.options.views.remember && $.cookie) {
|
1206 |
$.cookie('plupload_ui_view', view, { expires: 7, path: '/' });
|
1207 |
+
}
|
1208 |
+
|
1209 |
// ugly fix for IE6 - make content area stretchable
|
1210 |
+
if (plupload.ua.browser === 'IE' && plupload.ua.version < 7) {
|
1211 |
+
this.content.attr('style', 'height:expression(document.getElementById("' + this.id + '_container' + '").clientHeight - ' + (view === 'list' ? 132 : 102) + ')');
|
1212 |
}
|
1213 |
|
1214 |
+
this.container.removeClass('plupload_view_list plupload_view_thumbs').addClass('plupload_view_' + view);
|
1215 |
this.view_mode = view;
|
1216 |
this._trigger('viewchanged', null, { view: view });
|
1217 |
},
|
1273 |
this._displayThumbs();
|
1274 |
}
|
1275 |
},
|
1276 |
+
|
1277 |
+
|
1278 |
_enableRenaming: function() {
|
1279 |
var self = this;
|
1280 |
|
1281 |
this.filelist.dblclick(function(e) {
|
1282 |
+
var nameInput, fileContainer, file, parts, name, ext = "";
|
1283 |
+
var nameSpan = $(e.target);
|
1284 |
+
|
1285 |
+
if (!nameSpan.hasClass('plupload_file_name_wrapper')) {
|
1286 |
+
return;
|
1287 |
+
}
|
1288 |
|
1289 |
+
fileContainer = nameSpan.closest('.plupload_file');
|
1290 |
+
if (!fileContainer.hasClass('plupload_delete')) {
|
1291 |
return;
|
1292 |
}
|
1293 |
+
|
1294 |
// Get file name and split out name and extension
|
1295 |
+
file = self.uploader.getFile(fileContainer[0].id);
|
1296 |
name = file.name;
|
1297 |
parts = /^(.+)(\.[^.]+)$/.exec(name);
|
1298 |
if (parts) {
|
1320 |
})[0].focus();
|
1321 |
});
|
1322 |
},
|
1323 |
+
|
1324 |
+
|
1325 |
_enableSortingList: function() {
|
1326 |
var self = this;
|
1327 |
+
|
1328 |
if ($('.plupload_file', this.filelist).length < 2) {
|
1329 |
+
return;
|
1330 |
}
|
1331 |
|
1332 |
// destroy sortable if enabled
|
1333 |
+
$('tbody', this.filelist).sortable('destroy');
|
1334 |
+
|
1335 |
+
// enable
|
1336 |
this.filelist.sortable({
|
1337 |
items: '.plupload_delete',
|
1338 |
+
|
1339 |
cancel: 'object, .plupload_clearer',
|
1340 |
|
1341 |
stop: function() {
|
1342 |
var files = [];
|
1343 |
+
|
1344 |
$.each($(this).sortable('toArray'), function(i, id) {
|
1345 |
files[files.length] = self.uploader.getFile(id);
|
1346 |
+
});
|
1347 |
+
|
1348 |
files.unshift(files.length);
|
1349 |
files.unshift(0);
|
1350 |
+
|
1351 |
+
// re-populate files array
|
1352 |
+
Array.prototype.splice.apply(self.uploader.files, files);
|
1353 |
}
|
1354 |
+
});
|
1355 |
}
|
1356 |
});
|
1357 |
|
1358 |
+
} (window, document, plupload, moxie, jQuery));
|
admin/js/plupload/jquery.ui.plupload/jquery.ui.plupload.min.js
CHANGED
@@ -1 +1 @@
|
|
1 |
-
;(function(e,t,n,r,i){function o(e){return n.translate(e)||e}function u(e){e.id=e.attr("id"),e.html('<div class="plupload_wrapper"><div class="ui-widget-content plupload_container"><div class="ui-state-default ui-widget-header plupload_header"><div class="plupload_header_content"><div class="plupload_logo"> </div><div class="plupload_header_title">'+o("Select files")+"</div>"+'<div class="plupload_header_text">'+o("Add files to the upload queue and click the start button.")+"</div>"+'<div class="plupload_view_switch">'+'<input type="radio" id="'+e.id+'_view_list" name="view_mode_'+e.id+'" checked="checked" /><label class="plupload_button" for="'+e.id+'_view_list" data-view="list">'+o("List")+"</label>"+'<input type="radio" id="'+e.id+'_view_thumbs" name="view_mode_'+e.id+'" /><label class="plupload_button" for="'+e.id+'_view_thumbs" data-view="thumbs">'+o("Thumbnails")+"</label>"+"</div>"+"</div>"+"</div>"+'<table class="plupload_filelist plupload_filelist_header ui-widget-header">'+"<tr>"+'<td class="plupload_cell plupload_file_name">'+o("Filename")+"</td>"+'<td class="plupload_cell plupload_file_status">'+o("Status")+"</td>"+'<td class="plupload_cell plupload_file_size">'+o("Size")+"</td>"+'<td class="plupload_cell plupload_file_action"> </td>'+"</tr>"+"</table>"+'<div class="plupload_content">'+'<div class="plupload_droptext">'+o("Drag files here.")+"</div>"+'<ul class="plupload_filelist_content"> </ul>'+'<div class="plupload_clearer"> </div>'+"</div>"+'<table class="plupload_filelist plupload_filelist_footer ui-widget-header">'+"<tr>"+'<td class="plupload_cell plupload_file_name">'+'<div class="plupload_buttons"><!-- Visible -->'+'<a class="plupload_button plupload_add">'+o("Add Files")+"</a> "+'<a class="plupload_button plupload_start">'+o("Start Upload")+"</a> "+'<a class="plupload_button plupload_stop plupload_hidden">'+o("Stop Upload")+"</a> "+"</div>"+'<div class="plupload_started plupload_hidden"><!-- Hidden -->'+'<div class="plupload_progress plupload_right">'+'<div class="plupload_progress_container"></div>'+"</div>"+'<div class="plupload_cell plupload_upload_status"></div>'+'<div class="plupload_clearer"> </div>'+"</div>"+"</td>"+'<td class="plupload_file_status"><span class="plupload_total_status">0%</span></td>'+'<td class="plupload_file_size"><span class="plupload_total_file_size">0 kb</span></td>'+'<td class="plupload_file_action"></td>'+"</tr>"+"</table>"+"</div>"+'<input class="plupload_count" value="0" type="hidden">'+"</div>")}var s={};i.widget("ui.plupload",{widgetEventPrefix:"",contents_bak:"",options:{browse_button_hover:"ui-state-hover",browse_button_active:"ui-state-active",dragdrop:!0,multiple_queues:!0,buttons:{browse:!0,start:!0,stop:!0},views:{list:!0,thumbs:!1,active:"list",remember:!0},autostart:!1,sortable:!1,rename:!1,max_file_count:0},FILE_COUNT_ERROR:-9001,_create:function(){var e=this.element.attr("id");e||(e=n.guid(),this.element.attr("id",e)),this.id=e,this.contents_bak=this.element.html(),u(this.element),this.container=i(".plupload_container",this.element).attr("id",e+"_container"),this.content=i(".plupload_content",this.element),i.fn.resizable&&this.container.resizable({handles:"s",minHeight:300}),this.filelist=i(".plupload_filelist_content",this.container).attr({id:e+"_filelist",unselectable:"on"}),this.browse_button=i(".plupload_add",this.container).attr("id",e+"_browse"),this.start_button=i(".plupload_start",this.container).attr("id",e+"_start"),this.stop_button=i(".plupload_stop",this.container).attr("id",e+"_stop"),this.thumbs_switcher=i("#"+e+"_view_thumbs"),this.list_switcher=i("#"+e+"_view_list"),i.ui.button&&(this.browse_button.button({icons:{primary:"ui-icon-circle-plus"},disabled:!0}),this.start_button.button({icons:{primary:"ui-icon-circle-arrow-e"},disabled:!0}),this.stop_button.button({icons:{primary:"ui-icon-circle-close"}}),this.list_switcher.button({text:!1,icons:{secondary:"ui-icon-grip-dotted-horizontal"}}),this.thumbs_switcher.button({text:!1,icons:{secondary:"ui-icon-image"}})),this.progressbar=i(".plupload_progress_container",this.container),i.ui.progressbar&&this.progressbar.progressbar(),this.counter=i(".plupload_count",this.element).attr({id:e+"_count",name:e+"_count"}),this._initUploader()},_initUploader:function(){var e=this,t=this.id,u,a={container:t+"_buttons",browse_button:t+"_browse"};i(".plupload_buttons",this.element).attr("id",t+"_buttons"),e.options.dragdrop&&(this.filelist.parent().attr("id",this.id+"_dropbox"),a.drop_element=this.id+"_dropbox"),u=this.uploader=s[t]=new n.Uploader(i.extend(this.options,a)),e.options.views.thumbs&&(u.settings.required_features.display_media=!0),u.bind("Error",function(t,i){var s,u="";s="<strong>"+i.message+"</strong>";switch(i.code){case n.FILE_EXTENSION_ERROR:u=r.sprintf(o("File: %s"),i.file.name);break;case n.FILE_SIZE_ERROR:u=r.sprintf(o("File: %s, size: %d, max file size: %d"),i.file.name,i.file.size,n.parseSize(e.options.max_file_size));break;case n.FILE_DUPLICATE_ERROR:u=r.sprintf(o("%s already present in the queue."),i.file.name);break;case e.FILE_COUNT_ERROR:u=r.sprintf(o("Upload element accepts only %d file(s) at a time. Extra files were stripped."),e.options.max_file_count);break;case n.IMAGE_FORMAT_ERROR:u=o("Image format either wrong or not supported.");break;case n.IMAGE_MEMORY_ERROR:u=o("Runtime ran out of available memory.");break;case n.HTTP_ERROR:u=o("Upload URL might be wrong or doesn't exist.")}s+=" <br /><i>"+u+"</i>",e._trigger("error",null,{up:t,error:i}),i.code===n.INIT_ERROR?setTimeout(function(){e.destroy()},1):e.notify("error",s)}),u.bind("PostInit",function(t){e.options.buttons.browse?e.browse_button.button("enable"):(e.browse_button.button("disable").hide(),t.disableBrowse(!0)),e.options.buttons.start||e.start_button.button("disable").hide(),e.options.buttons.stop||e.stop_button.button("disable").hide(),!e.options.unique_names&&e.options.rename&&e._enableRenaming(),e.options.dragdrop&&t.features.dragdrop&&e.filelist.parent().addClass("plupload_dropbox"),e._enableViewSwitcher(),e.start_button.click(function(t){i(this).button("option","disabled")||e.start(),t.preventDefault()}),e.stop_button.click(function(t){e.stop(),t.preventDefault()}),e._trigger("ready",null,{up:t})}),e.options.max_file_count&&(e.options.multiple_queues=!1,u.bind("FilesAdded",function(t,n){var r=n.length,i=t.files.length+r-e.options.max_file_count;i>0&&(n.splice(r-i,i),t.trigger("Error",{code:e.FILE_COUNT_ERROR,message:o("File count error.")}))})),u.init(),u.bind("FileFiltered",function(t,n){e._addFiles(n)}),u.bind("FilesAdded",function(t,n){e._trigger("selected",null,{up:t,files:n}),e.options.sortable&&i.ui.sortable&&e._enableSortingList(),e._trigger("updatelist",null,{filelist:e.filelist}),e.options.autostart&&setTimeout(function(){e.start()},10)}),u.bind("FilesRemoved",function(t,n){e._trigger("removed",null,{up:t,files:n})}),u.bind("QueueChanged StateChanged",function(){e._handleState()}),u.bind("UploadFile",function(t,n){e._handleFileStatus(n)}),u.bind("FileUploaded",function(t,n){e._handleFileStatus(n),e._trigger("uploaded",null,{up:t,file:n})}),u.bind("UploadProgress",function(t,n){e._handleFileStatus(n),e._updateTotalProgress(),e._trigger("progress",null,{up:t,file:n})}),u.bind("UploadComplete",function(t,n){e._addFormFields(),e._trigger("complete",null,{up:t,files:n})})},_setOption:function(e,t){var n=this;e=="buttons"&&typeof t=="object"&&(t=i.extend(n.options.buttons,t),t.browse?(n.browse_button.button("enable").show(),n.uploader.disableBrowse(!1)):(n.browse_button.button("disable").hide(),n.uploader.disableBrowse(!0)),t.start?n.start_button.button("enable").show():n.start_button.button("disable").hide(),t.stop?n.start_button.button("enable").show():n.stop_button.button("disable").hide()),n.uploader.settings[e]=t},start:function(){this.uploader.start(),this._trigger("start",null,{up:this.uploader})},stop:function(){this.uploader.stop(),this._trigger("stop",null,{up:this.uploader})},enable:function(){this.browse_button.button("enable"),this.uploader.disableBrowse(!1)},disable:function(){this.browse_button.button("disable"),this.uploader.disableBrowse(!0)},getFile:function(e){var t;return typeof e=="number"?t=this.uploader.files[e]:t=this.uploader.getFile(e),t},getFiles:function(){return this.uploader.files},removeFile:function(e){n.typeOf(e)==="string"&&(e=this.getFile(e)),this._removeFiles(e)},clearQueue:function(){this.uploader.splice()},getUploader:function(){return this.uploader},refresh:function(){this.uploader.refresh()},notify:function(e,t){var n=i('<div class="plupload_message"><span class="plupload_message_close ui-icon ui-icon-circle-close" title="'+o("Close")+'"></span>'+'<p><span class="ui-icon"></span>'+t+"</p>"+"</div>");n.addClass("ui-state-"+(e==="error"?"error":"highlight")).find("p .ui-icon").addClass("ui-icon-"+(e==="error"?"alert":"info")).end().find(".plupload_message_close").click(function(){n.remove()}).end(),i(".plupload_header",this.container).append(n)},destroy:function(){this._removeFiles([].slice.call(this.uploader.files)),this.uploader.destroy(),i(".plupload_button",this.element).unbind(),i.ui.button&&i(".plupload_add, .plupload_start, .plupload_stop",this.container).button("destroy"),i.ui.progressbar&&this.progressbar.progressbar("destroy"),i.ui.sortable&&this.options.sortable&&i("tbody",this.filelist).sortable("destroy"),this.element.empty().html(this.contents_bak),this.contents_bak="",i.Widget.prototype.destroy.apply(this)},_handleState:function(){var e=this.uploader;e.state===n.STARTED?(i(this.start_button).button("disable"),i([]).add(this.stop_button).add(".plupload_started").removeClass("plupload_hidden"),i(".plupload_upload_status",this.element).html(r.sprintf(o("Uploaded %d/%d files"),e.total.uploaded,e.files.length)),i(".plupload_header_content",this.element).addClass("plupload_header_content_bw")):e.state===n.STOPPED&&(i([]).add(this.stop_button).add(".plupload_started").addClass("plupload_hidden"),this.options.multiple_queues?i(".plupload_header_content",this.element).removeClass("plupload_header_content_bw"):(i([]).add(this.browse_button).add(this.start_button).button("disable"),e.disableBrowse()),e.files.length===e.total.uploaded+e.total.failed?this.start_button.button("disable"):this.start_button.button("enable"),this._updateTotalProgress()),e.total.queued===0?i(".ui-button-text",this.browse_button).html(o("Add Files")):i(".ui-button-text",this.browse_button).html(r.sprintf(o("%d files queued"),e.total.queued)),e.refresh()},_handleFileStatus:function(e){var t=this,r,s;if(!i("#"+e.id).length)return;switch(e.status){case n.DONE:r="plupload_done",s="ui-icon ui-icon-circle-check";break;case n.FAILED:r="ui-state-error plupload_failed",s="ui-icon ui-icon-alert";break;case n.QUEUED:r="plupload_delete",s="ui-icon ui-icon-circle-minus";break;case n.UPLOADING:r="ui-state-highlight plupload_uploading",s="ui-icon ui-icon-circle-arrow-w";var o=i(".plupload_scroll",this.container),u=o.scrollTop(),a=o.height(),f=i("#"+e.id).position().top+i("#"+e.id).height();a<f&&o.scrollTop(u+f-a),i("#"+e.id).find(".plupload_file_percent").html(e.percent+"%").end().find(".plupload_file_progress").css("width",e.percent+"%").end().find(".plupload_file_size").html(n.formatSize(e.size))}r+=" ui-state-default plupload_file",i("#"+e.id).attr("class",r).find(".ui-icon").attr("class",s).end().filter(".plupload_delete, .plupload_done, .plupload_failed").find(".ui-icon").click(function(n){t._removeFiles(e),n.preventDefault()})},_updateTotalProgress:function(){var e=this.uploader;this.filelist[0].scrollTop=this.filelist[0].scrollHeight,this.progressbar.progressbar("value",e.total.percent),this.element.find(".plupload_total_status").html(e.total.percent+"%").end().find(".plupload_total_file_size").html(n.formatSize(e.total.size)).end().find(".plupload_upload_status").html(r.sprintf(o("Uploaded %d/%d files"),e.total.uploaded,e.files.length))},_displayThumbs:function(){function f(e,t,n){var r;e.on(t,function(){clearTimeout(r),r=setTimeout(function(){clearTimeout(r),n()},300)})}function l(){if(!t||!n){var r=i(".plupload_file:eq(0)",e.filelist);t=r.outerWidth(!0),n=r.outerHeight(!0)}var u=e.content.width(),a=e.content.height();s=Math.floor(u/t),o=s*(Math.ceil(a/n)+1)}function c(){var t=Math.floor(e.content.scrollTop()/n)*s;u=i(".plupload_file",e.filelist).slice(t,t+o).filter(":not(.plupload_file_thumb_loaded)").get()}function h(){function t(){if(e.view_mode!=="thumbs")return;l(),c(),d()}i.fn.resizable&&f(e.container,"resize",t),f(e.window,"resize",t),f(e.content,"scroll",t),e.element.on("viewchanged selected",t),t()}function p(t,n){var s=new r.Image;s.onload=function(){var n=i("#"+t.id+" .plupload_file_thumb",e.filelist).html("");this.embed(n[0],{width:100,height:60,crop:!0,swf_url:r.resolveUrl(e.options.flash_swf_url),xap_url:r.resolveUrl(e.options.silverlight_xap_url)})},s.bind("embedded error",function(){i("#"+t.id,e.filelist).addClass("plupload_file_thumb_loaded"),this.destroy(),setTimeout(n,1)}),s.load(t.getSource())}function d(){if(e.view_mode!=="thumbs"||a)return;c();if(!u.length)return;a=!0,p(e.getFile(i(u.shift()).attr("id")),function(){a=!1,d()})}var e=this,t,n,s,o=0,u=[],a=!1;if(!this.options.views.thumbs)return;this.element.on("selected",function v(){e.element.off("selected",v),h()})},_addFiles:function(e){var t=this,s;s='<li class="plupload_file ui-state-default" id="%id%"><div class="plupload_file_thumb"><div class="plupload_file_dummy ui-widget-content"><span class="ui-state-disabled">%ext%</span></div></div><div class="plupload_file_name" title="%name%"><span class="plupload_file_namespan">%name%</span></div><div class="plupload_file_action"><div class="ui-icon"> </div></div><div class="plupload_file_size">%size% </div><div class="plupload_file_status"><div class="plupload_file_progress ui-widget-header" style="width: 0%"> </div><span class="plupload_file_percent">%percent% </span></div><div class="plupload_file_fields"> </div></li>',n.typeOf(e)!=="array"&&(e=[e]),i.each(e,function(e,i){var o=r.Mime.getFileExtension(i.name)||"none";t.filelist.append(s.replace(/%(\w+)%/g,function(e,t){return"size"===t?n.formatSize(i.size):"ext"===t?o:i[t]||""})),t._handleFileStatus(i)})},_removeFiles:function(e){var t=this,r=this.uploader;n.typeOf(e)!=="array"&&(e=[e]),i.ui.sortable&&this.options.sortable&&i("tbody",t.filelist).sortable("destroy"),i.each(e,function(e,t){i("#"+t.id).toggle("highlight",function(){this.remove()}),r.removeFile(t)}),r.files.length&&this.options.sortable&&i.ui.sortable&&this._enableSortingList(),this._trigger("updatelist",null,{filelist:this.filelist})},_addFormFields:function(){var e=this;i(".plupload_file_fields",this.filelist).html(""),n.each(this.uploader.files,function(t,r){var s="",o=e.id+"_"+r;t.target_name&&(s+='<input type="hidden" name="'+o+'_tmpname" value="'+n.xmlEncode(t.target_name)+'" />'),s+='<input type="hidden" name="'+o+'_name" value="'+n.xmlEncode(t.name)+'" />',s+='<input type="hidden" name="'+o+'_status" value="'+(t.status===n.DONE?"done":"failed")+'" />',i("#"+t.id).find(".plupload_file_fields").html(s)}),this.counter.val(this.uploader.files.length)},_viewChanged:function(e){this.options.views.remember&&i.cookie&&i.cookie("plupload_ui_view",e,{expires:7,path:"/"}),r.Env.browser==="IE"&&r.Env.version<7&&this.content.attr("style",'height:expression(document.getElementById("'+this.id+"_container"+'").clientHeight - '+(e==="list"?133:103)+");"),this.container.removeClass("plupload_view_list plupload_view_thumbs").addClass("plupload_view_"+e),this.view_mode=e,this._trigger("viewchanged",null,{view:e})},_enableViewSwitcher:function(){var e=this,t,r=i(".plupload_view_switch",this.container),s,o;n.each(["list","thumbs"],function(t){e.options.views[t]||r.find('[for="'+e.id+"_view_"+t+'"], #'+e.id+"_view_"+t).remove()}),s=r.find(".plupload_button"),s.length===1?(r.hide(),t=s.eq(0).data("view"),this._viewChanged(t)):i.ui.button&&s.length>1?(this.options.views.remember&&i.cookie&&(t=i.cookie("plupload_ui_view")),~n.inArray(t,["list","thumbs"])||(t=this.options.views.active),r.show().buttonset().find(".ui-button").click(function(n){t=i(this).data("view"),e._viewChanged(t),n.preventDefault()}),o=r.find('[for="'+e.id+"_view_"+t+'"]'),o.length&&o.trigger("click")):(r.show(),this._viewChanged(this.options.views.active)),this.options.views.thumbs&&this._displayThumbs()},_enableRenaming:function(){var e=this;this.filelist.dblclick(function(t){var n=i(t.target),r,s,o,u,a="";if(!n.hasClass("plupload_file_namespan"))return;s=e.uploader.getFile(n.closest(".plupload_file")[0].id),u=s.name,o=/^(.+)(\.[^.]+)$/.exec(u),o&&(u=o[1],a=o[2]),r=i('<input class="plupload_file_rename" type="text" />').width(n.width()).insertAfter(n.hide()),r.val(u).blur(function(){n.show().parent().scrollLeft(0).end().next().remove()}).keydown(function(e){var t=i(this);i.inArray(e.keyCode,[13,27])!==-1&&(e.preventDefault(),e.keyCode===13&&(s.name=t.val()+a,n.html(s.name)),t.blur())})[0].focus()})},_enableSortingList:function(){var e=this;if(i(".plupload_file",this.filelist).length<2)return;i("tbody",this.filelist).sortable("destroy"),this.filelist.sortable({items:".plupload_delete",cancel:"object, .plupload_clearer",stop:function(){var t=[];i.each(i(this).sortable("toArray"),function(n,r){t[t.length]=e.uploader.getFile(r)}),t.unshift(t.length),t.unshift(0),Array.prototype.splice.apply(e.uploader.files,t)}})}})})(window,document,plupload,mOxie,jQuery);
|
1 |
+
!function(e,t,i,s,n){function l(e){return i.translate(e)||e}function o(e){e.id=e.attr("id"),e.html('<div class="plupload_wrapper"><div class="ui-widget-content plupload_container"><div class="ui-state-default ui-widget-header plupload_header"><div class="plupload_header_content"><div class="plupload_logo"> </div><div class="plupload_header_title">'+l("Select files")+"</div>"+'<div class="plupload_header_text">'+l("Add files to the upload queue and click the start button.")+"</div>"+'<div class="plupload_view_switch">'+'<input type="radio" id="'+e.id+'_view_list" name="view_mode_'+e.id+'" checked="checked" /><label class="plupload_button" for="'+e.id+'_view_list" data-view="list">'+l("List")+"</label>"+'<input type="radio" id="'+e.id+'_view_thumbs" name="view_mode_'+e.id+'" /><label class="plupload_button" for="'+e.id+'_view_thumbs" data-view="thumbs">'+l("Thumbnails")+"</label>"+"</div>"+"</div>"+"</div>"+'<table class="plupload_filelist plupload_filelist_header ui-widget-header">'+"<tr>"+'<td class="plupload_cell plupload_file_name">'+l("Filename")+"</td>"+'<td class="plupload_cell plupload_file_status">'+l("Status")+"</td>"+'<td class="plupload_cell plupload_file_size">'+l("Size")+"</td>"+'<td class="plupload_cell plupload_file_action"> </td>'+"</tr>"+"</table>"+'<div class="plupload_content">'+'<div class="plupload_droptext">'+l("Drag files here.")+"</div>"+'<ul class="plupload_filelist_content"> </ul>'+'<div class="plupload_clearer"> </div>'+"</div>"+'<table class="plupload_filelist plupload_filelist_footer ui-widget-header">'+"<tr>"+'<td class="plupload_cell plupload_file_name">'+'<div class="plupload_buttons"><!-- Visible -->'+'<a class="plupload_button plupload_add">'+l("Add Files")+"</a> "+'<a class="plupload_button plupload_start">'+l("Start Upload")+"</a> "+'<a class="plupload_button plupload_stop plupload_hidden">'+l("Stop Upload")+"</a> "+"</div>"+'<div class="plupload_started plupload_hidden"><!-- Hidden -->'+'<div class="plupload_progress plupload_right">'+'<div class="plupload_progress_container"></div>'+"</div>"+'<div class="plupload_cell plupload_upload_status"></div>'+'<div class="plupload_clearer"> </div>'+"</div>"+"</td>"+'<td class="plupload_file_status"><span class="plupload_total_status">0%</span></td>'+'<td class="plupload_file_size"><span class="plupload_total_file_size">0 kb</span></td>'+'<td class="plupload_file_action"></td>'+"</tr>"+"</table>"+"</div>"+'<input class="plupload_count" value="0" type="hidden">'+"</div>")}var a={};n.widget("ui.plupload",{widgetEventPrefix:"",contents_bak:"",options:{browse_button_hover:"ui-state-hover",browse_button_active:"ui-state-active",filters:{},buttons:{browse:!0,start:!0,stop:!0},views:{list:!0,thumbs:!1,active:"list",remember:!0},thumb_width:100,thumb_height:60,multiple_queues:!0,dragdrop:!0,autostart:!1,sortable:!1,rename:!1},FILE_COUNT_ERROR:-9001,_create:function(){var e=this.element.attr("id");e||(e=i.guid(),this.element.attr("id",e)),this.id=e,this.contents_bak=this.element.html(),o(this.element),this.container=n(".plupload_container",this.element).attr("id",e+"_container"),this.content=n(".plupload_content",this.element),n.fn.resizable&&this.container.resizable({handles:"s",minHeight:300}),this.filelist=n(".plupload_filelist_content",this.container).attr({id:e+"_filelist",unselectable:"on"}),this.browse_button=n(".plupload_add",this.container).attr("id",e+"_browse"),this.start_button=n(".plupload_start",this.container).attr("id",e+"_start"),this.stop_button=n(".plupload_stop",this.container).attr("id",e+"_stop"),this.thumbs_switcher=n("#"+e+"_view_thumbs"),this.list_switcher=n("#"+e+"_view_list"),n.ui.button&&(this.browse_button.button({icons:{primary:"ui-icon-circle-plus"},disabled:!0}),this.start_button.button({icons:{primary:"ui-icon-circle-arrow-e"},disabled:!0}),this.stop_button.button({icons:{primary:"ui-icon-circle-close"}}),this.list_switcher.button({text:!1,icons:{secondary:"ui-icon-grip-dotted-horizontal"}}),this.thumbs_switcher.button({text:!1,icons:{secondary:"ui-icon-image"}})),this.progressbar=n(".plupload_progress_container",this.container),n.ui.progressbar&&this.progressbar.progressbar(),this.counter=n(".plupload_count",this.element).attr({id:e+"_count",name:e+"_count"}),this._initUploader()},_initUploader:function(){var e,t=this,s=this.id,o={container:s+"_buttons",browse_button:s+"_browse"};n(".plupload_buttons",this.element).attr("id",s+"_buttons"),t.options.dragdrop&&(this.filelist.parent().attr("id",this.id+"_dropbox"),o.drop_element=this.id+"_dropbox"),this.filelist.on("click",function(e){var i,s=n(e.target);s.hasClass("plupload_action_icon")&&(i=s.closest(".plupload_file"),i.hasClass("plupload_delete")&&(t.removeFile(i.attr("id")),e.preventDefault()))}),e=this.uploader=a[s]=new i.Uploader(n.extend(this.options,o)),this.options=e.getOption(),t.options.views.thumbs&&(e.settings.required_features.display_media=!0),t.options.max_file_count&&i.extend(e.getOption("filters"),{max_file_count:t.options.max_file_count}),i.addFileFilter("max_file_count",function(e,i,s){e<=this.files.length-(this.total.uploaded+this.total.failed)?(t.browse_button.button("disable"),this.disableBrowse(),this.trigger("Error",{code:t.FILE_COUNT_ERROR,message:l("File count error."),file:i}),s(!1)):s(!0)}),e.bind("Error",function(e,s){var n,o="";switch(n="<strong>"+s.message+"</strong>",s.code){case i.FILE_EXTENSION_ERROR:o=i.sprintf(l("File: %s"),s.file.name);break;case i.FILE_SIZE_ERROR:o=i.sprintf(l("File: %s, size: %d, max file size: %d"),s.file.name,i.formatSize(s.file.size),i.formatSize(i.parseSize(e.getOption("filters").max_file_size)));break;case i.FILE_DUPLICATE_ERROR:o=i.sprintf(l("%s already present in the queue."),s.file.name);break;case t.FILE_COUNT_ERROR:o=i.sprintf(l("Upload element accepts only %d file(s) at a time. Extra files were stripped."),e.getOption("filters").max_file_count||0);break;case i.IMAGE_FORMAT_ERROR:o=l("Image format either wrong or not supported.");break;case i.IMAGE_MEMORY_ERROR:o=l("Runtime ran out of available memory.");break;case i.HTTP_ERROR:o=l("Upload URL might be wrong or doesn't exist.")}n+=" <br /><i>"+o+"</i>",t._trigger("error",null,{up:e,error:s}),s.code===i.INIT_ERROR?setTimeout(function(){t.destroy()},1):t.notify("error",n)}),e.bind("PostInit",function(e){t.options.buttons.browse?t.browse_button.button("enable"):(t.browse_button.button("disable").hide(),e.disableBrowse(!0)),t.options.buttons.start||t.start_button.button("disable").hide(),t.options.buttons.stop||t.stop_button.button("disable").hide(),!t.options.unique_names&&t.options.rename&&t._enableRenaming(),t.options.dragdrop&&e.features.dragdrop&&t.filelist.parent().addClass("plupload_dropbox"),t._enableViewSwitcher(),t.start_button.click(function(e){n(this).button("option","disabled")||t.start(),e.preventDefault()}),t.stop_button.click(function(e){t.stop(),e.preventDefault()}),t._trigger("ready",null,{up:e})}),e.init(),e.bind("FileFiltered",function(e,i){t._addFiles(i)}),e.bind("FilesAdded",function(e,i){t._trigger("selected",null,{up:e,files:i}),t.options.sortable&&n.ui.sortable&&t._enableSortingList(),t._trigger("updatelist",null,{filelist:t.filelist}),t.options.autostart&&setTimeout(function(){t.start()},10)}),e.bind("FilesRemoved",function(e,i){n.ui.sortable&&t.options.sortable&&n("tbody",t.filelist).sortable("destroy"),n.each(i,function(e,t){n("#"+t.id).toggle("highlight",function(){n(this).remove()})}),e.files.length&&t.options.sortable&&n.ui.sortable&&t._enableSortingList(),t._trigger("updatelist",null,{filelist:t.filelist}),t._trigger("removed",null,{up:e,files:i})}),e.bind("QueueChanged",function(){t._handleState()}),e.bind("StateChanged",function(e){t._handleState(),i.STARTED===e.state?t._trigger("started",null,{up:this.uploader}):i.STOPPED===e.state&&t._trigger("stopped",null,{up:this.uploader})}),e.bind("UploadFile",function(e,i){t._handleFileStatus(i)}),e.bind("FileUploaded",function(e,i,s){t._handleFileStatus(i),t._trigger("uploaded",null,{up:e,file:i,result:s})}),e.bind("UploadProgress",function(e,i){t._handleFileStatus(i),t._updateTotalProgress(),t._trigger("progress",null,{up:e,file:i})}),e.bind("UploadComplete",function(e,i){t._addFormFields(),t._trigger("complete",null,{up:e,files:i})})},_setOption:function(e,t){var i=this;"buttons"==e&&"object"==typeof t&&(t=n.extend(i.options.buttons,t),t.browse?(i.browse_button.button("enable").show(),i.uploader.disableBrowse(!1)):(i.browse_button.button("disable").hide(),i.uploader.disableBrowse(!0)),t.start?i.start_button.button("enable").show():i.start_button.button("disable").hide(),t.stop?i.start_button.button("enable").show():i.stop_button.button("disable").hide()),i.uploader.setOption(e,t)},start:function(){this.uploader.start()},stop:function(){this.uploader.stop()},enable:function(){this.browse_button.button("enable"),this.uploader.disableBrowse(!1)},disable:function(){this.browse_button.button("disable"),this.uploader.disableBrowse(!0)},getFile:function(e){var t;return t="number"==typeof e?this.uploader.files[e]:this.uploader.getFile(e)},getFiles:function(){return this.uploader.files},removeFile:function(e){"string"===i.typeOf(e)&&(e=this.getFile(e)),this.uploader.removeFile(e)},clearQueue:function(){this.uploader.splice()},getUploader:function(){return this.uploader},refresh:function(){this.uploader.refresh()},notify:function(e,t){var i=n('<div class="plupload_message"><span class="plupload_message_close ui-icon ui-icon-circle-close" title="'+l("Close")+'"></span>'+'<p><span class="ui-icon"></span>'+t+"</p>"+"</div>");i.addClass("ui-state-"+("error"===e?"error":"highlight")).find("p .ui-icon").addClass("ui-icon-"+("error"===e?"alert":"info")).end().find(".plupload_message_close").click(function(){i.remove()}).end(),n(".plupload_header",this.container).append(i)},destroy:function(){this.uploader.destroy(),n(".plupload_button",this.element).unbind(),n.ui.button&&n(".plupload_add, .plupload_start, .plupload_stop",this.container).button("destroy"),n.ui.progressbar&&this.progressbar.progressbar("destroy"),n.ui.sortable&&this.options.sortable&&n("tbody",this.filelist).sortable("destroy"),this.element.empty().html(this.contents_bak),this.contents_bak="",n.Widget.prototype.destroy.apply(this)},_handleState:function(){var e=this.uploader,t=e.files.length-(e.total.uploaded+e.total.failed),s=e.getOption("filters").max_file_count||0;i.STARTED===e.state?(n([]).add(this.stop_button).add(".plupload_started").removeClass("plupload_hidden"),this.start_button.button("disable"),this.options.multiple_queues||(this.browse_button.button("disable"),e.disableBrowse()),n(".plupload_upload_status",this.element).html(i.sprintf(l("Uploaded %d/%d files"),e.total.uploaded,e.files.length)),n(".plupload_header_content",this.element).addClass("plupload_header_content_bw")):i.STOPPED===e.state&&(n([]).add(this.stop_button).add(".plupload_started").addClass("plupload_hidden"),t?this.start_button.button("enable"):this.start_button.button("disable"),this.options.multiple_queues&&n(".plupload_header_content",this.element).removeClass("plupload_header_content_bw"),this.options.multiple_queues&&s&&s>t&&(this.browse_button.button("enable"),e.disableBrowse(!1)),this._updateTotalProgress()),0===e.total.queued?n(".ui-button-text",this.browse_button).html(l("Add Files")):n(".ui-button-text",this.browse_button).html(i.sprintf(l("%d files queued"),e.total.queued)),this.container.toggleClass("plupload_files_queued",e.files.length),e.refresh()},_handleFileStatus:function(e){var t,s,l=n("#"+e.id);if(l.length){switch(e.status){case i.DONE:t="plupload_done",s="plupload_action_icon ui-icon ui-icon-circle-check";break;case i.FAILED:t="ui-state-error plupload_failed",s="plupload_action_icon ui-icon ui-icon-alert";break;case i.QUEUED:t="plupload_delete",s="plupload_action_icon ui-icon ui-icon-circle-minus";break;case i.UPLOADING:t="ui-state-highlight plupload_uploading",s="plupload_action_icon ui-icon ui-icon-circle-arrow-w";var o=n(".plupload_scroll",this.container),a=o.scrollTop(),r=o.height(),d=l.position().top+l.height();d>r&&o.scrollTop(a+d-r),l.find(".plupload_file_percent").html(e.percent+"%").end().find(".plupload_file_progress").css("width",e.percent+"%").end().find(".plupload_file_size").html(i.formatSize(e.size))}t+=" ui-state-default plupload_file",l.attr("class",t).find(".plupload_action_icon").attr("class",s)}},_updateTotalProgress:function(){var e=this.uploader;this.filelist[0].scrollTop=this.filelist[0].scrollHeight,this.progressbar.progressbar("value",e.total.percent),this.element.find(".plupload_total_status").html(e.total.percent+"%").end().find(".plupload_total_file_size").html(i.formatSize(e.total.size)).end().find(".plupload_upload_status").html(i.sprintf(l("Uploaded %d/%d files"),e.total.uploaded,e.files.length))},_displayThumbs:function(){function e(e,t,i){var s;e.on(t,function(){clearTimeout(s),s=setTimeout(function(){clearTimeout(s),i()},300)})}function t(){if(!r||!d){var e=n(".plupload_file:eq(0)",p.filelist);r=e.outerWidth(!0),d=e.outerHeight(!0)}var t=p.content.width(),i=p.content.height();u=Math.floor(t/r),c=u*(Math.ceil(i/d)+1)}function i(){var e=Math.floor(p.content.scrollTop()/d)*u;_=n(".plupload_file .plupload_file_thumb",p.filelist).slice(e,e+c).filter(".plupload_thumb_toload").get()}function l(){function s(){"thumbs"===p.view_mode&&(t(),i(),a())}n.fn.resizable&&e(p.container,"resize",s),e(p.window,"resize",s),e(p.content,"scroll",s),p.element.on("viewchanged selected",s),s()}function o(e,t){var i=new s.image.Image,l=s.core.utils.Url.resolveUrl;i.onload=function(){var t=n("#"+e.id+" .plupload_file_thumb",p.filelist);this.embed(t[0],{width:p.options.thumb_width,height:p.options.thumb_height,crop:!0,fit:!0,preserveHeaders:!1,swf_url:l(p.options.flash_swf_url),xap_url:l(p.options.silverlight_xap_url)})},i.bind("embedded error",function(i){n("#"+e.id,p.filelist).find(".plupload_file_thumb").removeClass("plupload_thumb_loading").addClass("plupload_thumb_"+i.type),this.destroy(),setTimeout(t,1)}),n("#"+e.id,p.filelist).find(".plupload_file_thumb").removeClass("plupload_thumb_toload").addClass("plupload_thumb_loading"),i.load(e.getSource())}function a(){"thumbs"!==p.view_mode||h||(i(),_.length&&(h=!0,o(p.getFile(n(_.shift()).closest(".plupload_file").attr("id")),function(){h=!1,a()})))}var r,d,u,p=this,c=0,_=[],h=!1;this.options.views.thumbs&&this.element.on("selected",function f(){p.element.off("selected",f),l()})},_addFiles:function(e){var t,l=this,o="";t='<li class="plupload_file ui-state-default plupload_delete" id="{id}" style="width:{thumb_width}px;"><div class="plupload_file_thumb plupload_thumb_toload" style="width: {thumb_width}px; height: {thumb_height}px;"><div class="plupload_file_dummy ui-widget-content" style="line-height: {thumb_height}px;"><span class="ui-state-disabled">{ext} </span></div></div><div class="plupload_file_status"><div class="plupload_file_progress ui-widget-header" style="width: 0%"> </div><span class="plupload_file_percent">{percent} </span></div><div class="plupload_file_name" title="{name}"><span class="plupload_file_name_wrapper">{name} </span></div><div class="plupload_file_action"><div class="plupload_action_icon ui-icon ui-icon-circle-minus"> </div></div><div class="plupload_file_size">{size} </div><div class="plupload_file_fields"> </div></li>',"array"!==i.typeOf(e)&&(e=[e]),n.each(e,function(e,n){var a=s.core.utils.Mime.getFileExtension(n.name)||"none";o+=t.replace(/\{(\w+)\}/g,function(e,t){switch(t){case"thumb_width":case"thumb_height":return l.options[t];case"size":return i.formatSize(n.size);case"ext":return a;default:return n[t]||""}})}),l.filelist.append(o)},_addFormFields:function(){var e=this;n(".plupload_file_fields",this.filelist).html(""),i.each(this.uploader.files,function(t,s){var l="",o=e.id+"_"+s;t.target_name&&(l+='<input type="hidden" name="'+o+'_tmpname" value="'+i.xmlEncode(t.target_name)+'" />'),l+='<input type="hidden" name="'+o+'_name" value="'+i.xmlEncode(t.name)+'" />',l+='<input type="hidden" name="'+o+'_status" value="'+(t.status===i.DONE?"done":"failed")+'" />',n("#"+t.id).find(".plupload_file_fields").html(l)}),this.counter.val(this.uploader.files.length)},_viewChanged:function(e){this.options.views.remember&&n.cookie&&n.cookie("plupload_ui_view",e,{expires:7,path:"/"}),"IE"===i.ua.browser&&i.ua.version<7&&this.content.attr("style",'height:expression(document.getElementById("'+this.id+"_container"+'").clientHeight - '+("list"===e?132:102)+")"),this.container.removeClass("plupload_view_list plupload_view_thumbs").addClass("plupload_view_"+e),this.view_mode=e,this._trigger("viewchanged",null,{view:e})},_enableViewSwitcher:function(){var e,t,s,l=this,o=n(".plupload_view_switch",this.container);i.each(["list","thumbs"],function(e){l.options.views[e]||o.find('[for="'+l.id+"_view_"+e+'"], #'+l.id+"_view_"+e).remove()}),t=o.find(".plupload_button"),1===t.length?(o.hide(),e=t.eq(0).data("view"),this._viewChanged(e)):n.ui.button&&t.length>1?(this.options.views.remember&&n.cookie&&(e=n.cookie("plupload_ui_view")),~i.inArray(e,["list","thumbs"])||(e=this.options.views.active),o.show().buttonset().find(".ui-button").click(function(t){e=n(this).data("view"),l._viewChanged(e),t.preventDefault()}),s=o.find('[for="'+l.id+"_view_"+e+'"]'),s.length&&s.trigger("click")):(o.show(),this._viewChanged(this.options.views.active)),this.options.views.thumbs&&this._displayThumbs()},_enableRenaming:function(){var e=this;this.filelist.dblclick(function(t){var i,s,l,o,a,r="",d=n(t.target);d.hasClass("plupload_file_name_wrapper")&&(s=d.closest(".plupload_file"),s.hasClass("plupload_delete")&&(l=e.uploader.getFile(s[0].id),a=l.name,o=/^(.+)(\.[^.]+)$/.exec(a),o&&(a=o[1],r=o[2]),i=n('<input class="plupload_file_rename" type="text" />').width(d.width()).insertAfter(d.hide()),i.val(a).blur(function(){d.show().parent().scrollLeft(0).end().next().remove()}).keydown(function(e){var t=n(this);-1!==n.inArray(e.keyCode,[13,27])&&(e.preventDefault(),13===e.keyCode&&(l.name=t.val()+r,d.html(l.name)),t.blur())})[0].focus()))})},_enableSortingList:function(){var e=this;n(".plupload_file",this.filelist).length<2||(n("tbody",this.filelist).sortable("destroy"),this.filelist.sortable({items:".plupload_delete",cancel:"object, .plupload_clearer",stop:function(){var t=[];n.each(n(this).sortable("toArray"),function(i,s){t[t.length]=e.uploader.getFile(s)}),t.unshift(t.length),t.unshift(0),Array.prototype.splice.apply(e.uploader.files,t)}}))}})}(window,document,plupload,moxie,jQuery);
|
admin/js/plupload/moxie.js
ADDED
@@ -0,0 +1,11714 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
;var MXI_DEBUG = true;
|
2 |
+
/**
|
3 |
+
* mOxie - multi-runtime File API & XMLHttpRequest L2 Polyfill
|
4 |
+
* v1.5.7
|
5 |
+
*
|
6 |
+
* Copyright 2013, Moxiecode Systems AB
|
7 |
+
* Released under GPL License.
|
8 |
+
*
|
9 |
+
* License: http://www.plupload.com/license
|
10 |
+
* Contributing: http://www.plupload.com/contributing
|
11 |
+
*
|
12 |
+
* Date: 2017-11-03
|
13 |
+
*/
|
14 |
+
;(function (global, factory) {
|
15 |
+
var extract = function() {
|
16 |
+
var ctx = {};
|
17 |
+
factory.apply(ctx, arguments);
|
18 |
+
return ctx.moxie;
|
19 |
+
};
|
20 |
+
|
21 |
+
if (typeof define === "function" && define.amd) {
|
22 |
+
define("moxie", [], extract);
|
23 |
+
} else if (typeof module === "object" && module.exports) {
|
24 |
+
module.exports = extract();
|
25 |
+
} else {
|
26 |
+
global.moxie = extract();
|
27 |
+
}
|
28 |
+
}(this || window, function() {
|
29 |
+
/**
|
30 |
+
* Compiled inline version. (Library mode)
|
31 |
+
*/
|
32 |
+
|
33 |
+
/*jshint smarttabs:true, undef:true, latedef:true, curly:true, bitwise:true, camelcase:true */
|
34 |
+
/*globals $code */
|
35 |
+
|
36 |
+
(function(exports, undefined) {
|
37 |
+
"use strict";
|
38 |
+
|
39 |
+
var modules = {};
|
40 |
+
|
41 |
+
function require(ids, callback) {
|
42 |
+
var module, defs = [];
|
43 |
+
|
44 |
+
for (var i = 0; i < ids.length; ++i) {
|
45 |
+
module = modules[ids[i]] || resolve(ids[i]);
|
46 |
+
if (!module) {
|
47 |
+
throw 'module definition dependecy not found: ' + ids[i];
|
48 |
+
}
|
49 |
+
|
50 |
+
defs.push(module);
|
51 |
+
}
|
52 |
+
|
53 |
+
callback.apply(null, defs);
|
54 |
+
}
|
55 |
+
|
56 |
+
function define(id, dependencies, definition) {
|
57 |
+
if (typeof id !== 'string') {
|
58 |
+
throw 'invalid module definition, module id must be defined and be a string';
|
59 |
+
}
|
60 |
+
|
61 |
+
if (dependencies === undefined) {
|
62 |
+
throw 'invalid module definition, dependencies must be specified';
|
63 |
+
}
|
64 |
+
|
65 |
+
if (definition === undefined) {
|
66 |
+
throw 'invalid module definition, definition function must be specified';
|
67 |
+
}
|
68 |
+
|
69 |
+
require(dependencies, function() {
|
70 |
+
modules[id] = definition.apply(null, arguments);
|
71 |
+
});
|
72 |
+
}
|
73 |
+
|
74 |
+
function defined(id) {
|
75 |
+
return !!modules[id];
|
76 |
+
}
|
77 |
+
|
78 |
+
function resolve(id) {
|
79 |
+
var target = exports;
|
80 |
+
var fragments = id.split(/[.\/]/);
|
81 |
+
|
82 |
+
for (var fi = 0; fi < fragments.length; ++fi) {
|
83 |
+
if (!target[fragments[fi]]) {
|
84 |
+
return;
|
85 |
+
}
|
86 |
+
|
87 |
+
target = target[fragments[fi]];
|
88 |
+
}
|
89 |
+
|
90 |
+
return target;
|
91 |
+
}
|
92 |
+
|
93 |
+
function expose(ids) {
|
94 |
+
for (var i = 0; i < ids.length; i++) {
|
95 |
+
var target = exports;
|
96 |
+
var id = ids[i];
|
97 |
+
var fragments = id.split(/[.\/]/);
|
98 |
+
|
99 |
+
for (var fi = 0; fi < fragments.length - 1; ++fi) {
|
100 |
+
if (target[fragments[fi]] === undefined) {
|
101 |
+
target[fragments[fi]] = {};
|
102 |
+
}
|
103 |
+
|
104 |
+
target = target[fragments[fi]];
|
105 |
+
}
|
106 |
+
|
107 |
+
target[fragments[fragments.length - 1]] = modules[id];
|
108 |
+
}
|
109 |
+
}
|
110 |
+
|
111 |
+
// Included from: src/javascript/core/utils/Basic.js
|
112 |
+
|
113 |
+
/**
|
114 |
+
* Basic.js
|
115 |
+
*
|
116 |
+
* Copyright 2013, Moxiecode Systems AB
|
117 |
+
* Released under GPL License.
|
118 |
+
*
|
119 |
+
* License: http://www.plupload.com/license
|
120 |
+
* Contributing: http://www.plupload.com/contributing
|
121 |
+
*/
|
122 |
+
|
123 |
+
/**
|
124 |
+
@class moxie/core/utils/Basic
|
125 |
+
@public
|
126 |
+
@static
|
127 |
+
*/
|
128 |
+
|
129 |
+
define('moxie/core/utils/Basic', [], function() {
|
130 |
+
/**
|
131 |
+
Gets the true type of the built-in object (better version of typeof).
|
132 |
+
@author Angus Croll (http://javascriptweblog.wordpress.com/)
|
133 |
+
|
134 |
+
@method typeOf
|
135 |
+
@static
|
136 |
+
@param {Object} o Object to check.
|
137 |
+
@return {String} Object [[Class]]
|
138 |
+
*/
|
139 |
+
function typeOf(o) {
|
140 |
+
var undef;
|
141 |
+
|
142 |
+
if (o === undef) {
|
143 |
+
return 'undefined';
|
144 |
+
} else if (o === null) {
|
145 |
+
return 'null';
|
146 |
+
} else if (o.nodeType) {
|
147 |
+
return 'node';
|
148 |
+
}
|
149 |
+
|
150 |
+
// the snippet below is awesome, however it fails to detect null, undefined and arguments types in IE lte 8
|
151 |
+
return ({}).toString.call(o).match(/\s([a-z|A-Z]+)/)[1].toLowerCase();
|
152 |
+
}
|
153 |
+
|
154 |
+
/**
|
155 |
+
Extends the specified object with another object(s).
|
156 |
+
|
157 |
+
@method extend
|
158 |
+
@static
|
159 |
+
@param {Object} target Object to extend.
|
160 |
+
@param {Object} [obj]* Multiple objects to extend with.
|
161 |
+
@return {Object} Same as target, the extended object.
|
162 |
+
*/
|
163 |
+
function extend() {
|
164 |
+
return merge(false, false, arguments);
|
165 |
+
}
|
166 |
+
|
167 |
+
|
168 |
+
/**
|
169 |
+
Extends the specified object with another object(s), but only if the property exists in the target.
|
170 |
+
|
171 |
+
@method extendIf
|
172 |
+
@static
|
173 |
+
@param {Object} target Object to extend.
|
174 |
+
@param {Object} [obj]* Multiple objects to extend with.
|
175 |
+
@return {Object} Same as target, the extended object.
|
176 |
+
*/
|
177 |
+
function extendIf() {
|
178 |
+
return merge(true, false, arguments);
|
179 |
+
}
|
180 |
+
|
181 |
+
|
182 |
+
function extendImmutable() {
|
183 |
+
return merge(false, true, arguments);
|
184 |
+
}
|
185 |
+
|
186 |
+
|
187 |
+
function extendImmutableIf() {
|
188 |
+
return merge(true, true, arguments);
|
189 |
+
}
|
190 |
+
|
191 |
+
|
192 |
+
function clone(value) {
|
193 |
+
switch (typeOf(value)) {
|
194 |
+
case 'array':
|
195 |
+
return merge(false, true, [[], value]);
|
196 |
+
|
197 |
+
case 'object':
|
198 |
+
return merge(false, true, [{}, value]);
|
199 |
+
|
200 |
+
default:
|
201 |
+
return value;
|
202 |
+
}
|
203 |
+
}
|
204 |
+
|
205 |
+
|
206 |
+
function shallowCopy(obj) {
|
207 |
+
switch (typeOf(obj)) {
|
208 |
+
case 'array':
|
209 |
+
return Array.prototype.slice.call(obj);
|
210 |
+
|
211 |
+
case 'object':
|
212 |
+
return extend({}, obj);
|
213 |
+
}
|
214 |
+
return obj;
|
215 |
+
}
|
216 |
+
|
217 |
+
|
218 |
+
function merge(strict, immutable, args) {
|
219 |
+
var undef;
|
220 |
+
var target = args[0];
|
221 |
+
|
222 |
+
each(args, function(arg, i) {
|
223 |
+
if (i > 0) {
|
224 |
+
each(arg, function(value, key) {
|
225 |
+
var isComplex = inArray(typeOf(value), ['array', 'object']) !== -1;
|
226 |
+
|
227 |
+
if (value === undef || strict && target[key] === undef) {
|
228 |
+
return true;
|
229 |
+
}
|
230 |
+
|
231 |
+
if (isComplex && immutable) {
|
232 |
+
value = shallowCopy(value);
|
233 |
+
}
|
234 |
+
|
235 |
+
if (typeOf(target[key]) === typeOf(value) && isComplex) {
|
236 |
+
merge(strict, immutable, [target[key], value]);
|
237 |
+
} else {
|
238 |
+
target[key] = value;
|
239 |
+
}
|
240 |
+
});
|
241 |
+
}
|
242 |
+
});
|
243 |
+
|
244 |
+
return target;
|
245 |
+
}
|
246 |
+
|
247 |
+
|
248 |
+
/**
|
249 |
+
A way to inherit one `class` from another in a consisstent way (more or less)
|
250 |
+
|
251 |
+
@method inherit
|
252 |
+
@static
|
253 |
+
@since >1.4.1
|
254 |
+
@param {Function} child
|
255 |
+
@param {Function} parent
|
256 |
+
@return {Function} Prepared constructor
|
257 |
+
*/
|
258 |
+
function inherit(child, parent) {
|
259 |
+
// copy over all parent properties
|
260 |
+
for (var key in parent) {
|
261 |
+
if ({}.hasOwnProperty.call(parent, key)) {
|
262 |
+
child[key] = parent[key];
|
263 |
+
}
|
264 |
+
}
|
265 |
+
|
266 |
+
// give child `class` a place to define its own methods
|
267 |
+
function ctor() {
|
268 |
+
this.constructor = child;
|
269 |
+
|
270 |
+
if (MXI_DEBUG) {
|
271 |
+
var getCtorName = function(fn) {
|
272 |
+
var m = fn.toString().match(/^function\s([^\(\s]+)/);
|
273 |
+
return m ? m[1] : false;
|
274 |
+
};
|
275 |
+
|
276 |
+
this.ctorName = getCtorName(child);
|
277 |
+
}
|
278 |
+
}
|
279 |
+
ctor.prototype = parent.prototype;
|
280 |
+
child.prototype = new ctor();
|
281 |
+
|
282 |
+
// keep a way to reference parent methods
|
283 |
+
child.parent = parent.prototype;
|
284 |
+
return child;
|
285 |
+
}
|
286 |
+
|
287 |
+
|
288 |
+
/**
|
289 |
+
Executes the callback function for each item in array/object. If you return false in the
|
290 |
+
callback it will break the loop.
|
291 |
+
|
292 |
+
@method each
|
293 |
+
@static
|
294 |
+
@param {Object} obj Object to iterate.
|
295 |
+
@param {function} callback Callback function to execute for each item.
|
296 |
+
*/
|
297 |
+
function each(obj, callback) {
|
298 |
+
var length, key, i, undef;
|
299 |
+
|
300 |
+
if (obj) {
|
301 |
+
try {
|
302 |
+
length = obj.length;
|
303 |
+
} catch(ex) {
|
304 |
+
length = undef;
|
305 |
+
}
|
306 |
+
|
307 |
+
if (length === undef || typeof(length) !== 'number') {
|
308 |
+
// Loop object items
|
309 |
+
for (key in obj) {
|
310 |
+
if (obj.hasOwnProperty(key)) {
|
311 |
+
if (callback(obj[key], key) === false) {
|
312 |
+
return;
|
313 |
+
}
|
314 |
+
}
|
315 |
+
}
|
316 |
+
} else {
|
317 |
+
// Loop array items
|
318 |
+
for (i = 0; i < length; i++) {
|
319 |
+
if (callback(obj[i], i) === false) {
|
320 |
+
return;
|
321 |
+
}
|
322 |
+
}
|
323 |
+
}
|
324 |
+
}
|
325 |
+
}
|
326 |
+
|
327 |
+
/**
|
328 |
+
Checks if object is empty.
|
329 |
+
|
330 |
+
@method isEmptyObj
|
331 |
+
@static
|
332 |
+
@param {Object} o Object to check.
|
333 |
+
@return {Boolean}
|
334 |
+
*/
|
335 |
+
function isEmptyObj(obj) {
|
336 |
+
var prop;
|
337 |
+
|
338 |
+
if (!obj || typeOf(obj) !== 'object') {
|
339 |
+
return true;
|
340 |
+
}
|
341 |
+
|
342 |
+
for (prop in obj) {
|
343 |
+
return false;
|
344 |
+
}
|
345 |
+
|
346 |
+
return true;
|
347 |
+
}
|
348 |
+
|
349 |
+
/**
|
350 |
+
Recieve an array of functions (usually async) to call in sequence, each function
|
351 |
+
receives a callback as first argument that it should call, when it completes. Finally,
|
352 |
+
after everything is complete, main callback is called. Passing truthy value to the
|
353 |
+
callback as a first argument will interrupt the sequence and invoke main callback
|
354 |
+
immediately.
|
355 |
+
|
356 |
+
@method inSeries
|
357 |
+
@static
|
358 |
+
@param {Array} queue Array of functions to call in sequence
|
359 |
+
@param {Function} cb Main callback that is called in the end, or in case of error
|
360 |
+
*/
|
361 |
+
function inSeries(queue, cb) {
|
362 |
+
var i = 0, length = queue.length;
|
363 |
+
|
364 |
+
if (typeOf(cb) !== 'function') {
|
365 |
+
cb = function() {};
|
366 |
+
}
|
367 |
+
|
368 |
+
if (!queue || !queue.length) {
|
369 |
+
cb();
|
370 |
+
}
|
371 |
+
|
372 |
+
function callNext(i) {
|
373 |
+
if (typeOf(queue[i]) === 'function') {
|
374 |
+
queue[i](function(error) {
|
375 |
+
/*jshint expr:true */
|
376 |
+
++i < length && !error ? callNext(i) : cb(error);
|
377 |
+
});
|
378 |
+
}
|
379 |
+
}
|
380 |
+
callNext(i);
|
381 |
+
}
|
382 |
+
|
383 |
+
|
384 |
+
/**
|
385 |
+
Recieve an array of functions (usually async) to call in parallel, each function
|
386 |
+
receives a callback as first argument that it should call, when it completes. After
|
387 |
+
everything is complete, main callback is called. Passing truthy value to the
|
388 |
+
callback as a first argument will interrupt the process and invoke main callback
|
389 |
+
immediately.
|
390 |
+
|
391 |
+
@method inParallel
|
392 |
+
@static
|
393 |
+
@param {Array} queue Array of functions to call in sequence
|
394 |
+
@param {Function} cb Main callback that is called in the end, or in case of erro
|
395 |
+
*/
|
396 |
+
function inParallel(queue, cb) {
|
397 |
+
var count = 0, num = queue.length, cbArgs = new Array(num);
|
398 |
+
|
399 |
+
each(queue, function(fn, i) {
|
400 |
+
fn(function(error) {
|
401 |
+
if (error) {
|
402 |
+
return cb(error);
|
403 |
+
}
|
404 |
+
|
405 |
+
var args = [].slice.call(arguments);
|
406 |
+
args.shift(); // strip error - undefined or not
|
407 |
+
|
408 |
+
cbArgs[i] = args;
|
409 |
+
count++;
|
410 |
+
|
411 |
+
if (count === num) {
|
412 |
+
cbArgs.unshift(null);
|
413 |
+
cb.apply(this, cbArgs);
|
414 |
+
}
|
415 |
+
});
|
416 |
+
});
|
417 |
+
}
|
418 |
+
|
419 |
+
|
420 |
+
/**
|
421 |
+
Find an element in array and return it's index if present, otherwise return -1.
|
422 |
+
|
423 |
+
@method inArray
|
424 |
+
@static
|
425 |
+
@param {Mixed} needle Element to find
|
426 |
+
@param {Array} array
|
427 |
+
@return {Int} Index of the element, or -1 if not found
|
428 |
+
*/
|
429 |
+
function inArray(needle, array) {
|
430 |
+
if (array) {
|
431 |
+
if (Array.prototype.indexOf) {
|
432 |
+
return Array.prototype.indexOf.call(array, needle);
|
433 |
+
}
|
434 |
+
|
435 |
+
for (var i = 0, length = array.length; i < length; i++) {
|
436 |
+
if (array[i] === needle) {
|
437 |
+
return i;
|
438 |
+
}
|
439 |
+
}
|
440 |
+
}
|
441 |
+
return -1;
|
442 |
+
}
|
443 |
+
|
444 |
+
|
445 |
+
/**
|
446 |
+
Returns elements of first array if they are not present in second. And false - otherwise.
|
447 |
+
|
448 |
+
@private
|
449 |
+
@method arrayDiff
|
450 |
+
@param {Array} needles
|
451 |
+
@param {Array} array
|
452 |
+
@return {Array|Boolean}
|
453 |
+
*/
|
454 |
+
function arrayDiff(needles, array) {
|
455 |
+
var diff = [];
|
456 |
+
|
457 |
+
if (typeOf(needles) !== 'array') {
|
458 |
+
needles = [needles];
|
459 |
+
}
|
460 |
+
|
461 |
+
if (typeOf(array) !== 'array') {
|
462 |
+
array = [array];
|
463 |
+
}
|
464 |
+
|
465 |
+
for (var i in needles) {
|
466 |
+
if (inArray(needles[i], array) === -1) {
|
467 |
+
diff.push(needles[i]);
|
468 |
+
}
|
469 |
+
}
|
470 |
+
return diff.length ? diff : false;
|
471 |
+
}
|
472 |
+
|
473 |
+
|
474 |
+
/**
|
475 |
+
Find intersection of two arrays.
|
476 |
+
|
477 |
+
@private
|
478 |
+
@method arrayIntersect
|
479 |
+
@param {Array} array1
|
480 |
+
@param {Array} array2
|
481 |
+
@return {Array} Intersection of two arrays or null if there is none
|
482 |
+
*/
|
483 |
+
function arrayIntersect(array1, array2) {
|
484 |
+
var result = [];
|
485 |
+
each(array1, function(item) {
|
486 |
+
if (inArray(item, array2) !== -1) {
|
487 |
+
result.push(item);
|
488 |
+
}
|
489 |
+
});
|
490 |
+
return result.length ? result : null;
|
491 |
+
}
|
492 |
+
|
493 |
+
|
494 |
+
/**
|
495 |
+
Forces anything into an array.
|
496 |
+
|
497 |
+
@method toArray
|
498 |
+
@static
|
499 |
+
@param {Object} obj Object with length field.
|
500 |
+
@return {Array} Array object containing all items.
|
501 |
+
*/
|
502 |
+
function toArray(obj) {
|
503 |
+
var i, arr = [];
|
504 |
+
|
505 |
+
for (i = 0; i < obj.length; i++) {
|
506 |
+
arr[i] = obj[i];
|
507 |
+
}
|
508 |
+
|
509 |
+
return arr;
|
510 |
+
}
|
511 |
+
|
512 |
+
|
513 |
+
/**
|
514 |
+
Generates an unique ID. The only way a user would be able to get the same ID is if the two persons
|
515 |
+
at the same exact millisecond manage to get the same 5 random numbers between 0-65535; it also uses
|
516 |
+
a counter so each ID is guaranteed to be unique for the given page. It is more probable for the earth
|
517 |
+
to be hit with an asteroid.
|
518 |
+
|
519 |
+
@method guid
|
520 |
+
@static
|
521 |
+
@param {String} prefix to prepend (by default 'o' will be prepended).
|
522 |
+
@method guid
|
523 |
+
@return {String} Virtually unique id.
|
524 |
+
*/
|
525 |
+
var guid = (function() {
|
526 |
+
var counter = 0;
|
527 |
+
|
528 |
+
return function(prefix) {
|
529 |
+
var guid = new Date().getTime().toString(32), i;
|
530 |
+
|
531 |
+
for (i = 0; i < 5; i++) {
|
532 |
+
guid += Math.floor(Math.random() * 65535).toString(32);
|
533 |
+
}
|
534 |
+
|
535 |
+
return (prefix || 'o_') + guid + (counter++).toString(32);
|
536 |
+
};
|
537 |
+
}());
|
538 |
+
|
539 |
+
|
540 |
+
/**
|
541 |
+
Trims white spaces around the string
|
542 |
+
|
543 |
+
@method trim
|
544 |
+
@static
|
545 |
+
@param {String} str
|
546 |
+
@return {String}
|
547 |
+
*/
|
548 |
+
function trim(str) {
|
549 |
+
if (!str) {
|
550 |
+
return str;
|
551 |
+
}
|
552 |
+
return String.prototype.trim ? String.prototype.trim.call(str) : str.toString().replace(/^\s*/, '').replace(/\s*$/, '');
|
553 |
+
}
|
554 |
+
|
555 |
+
|
556 |
+
/**
|
557 |
+
Parses the specified size string into a byte value. For example 10kb becomes 10240.
|
558 |
+
|
559 |
+
@method parseSizeStr
|
560 |
+
@static
|
561 |
+
@param {String/Number} size String to parse or number to just pass through.
|
562 |
+
@return {Number} Size in bytes.
|
563 |
+
*/
|
564 |
+
function parseSizeStr(size) {
|
565 |
+
if (typeof(size) !== 'string') {
|
566 |
+
return size;
|
567 |
+
}
|
568 |
+
|
569 |
+
var muls = {
|
570 |
+
t: 1099511627776,
|
571 |
+
g: 1073741824,
|
572 |
+
m: 1048576,
|
573 |
+
k: 1024
|
574 |
+
},
|
575 |
+
mul;
|
576 |
+
|
577 |
+
size = /^([0-9\.]+)([tmgk]?)$/.exec(size.toLowerCase().replace(/[^0-9\.tmkg]/g, ''));
|
578 |
+
mul = size[2];
|
579 |
+
size = +size[1];
|
580 |
+
|
581 |
+
if (muls.hasOwnProperty(mul)) {
|
582 |
+
size *= muls[mul];
|
583 |
+
}
|
584 |
+
return Math.floor(size);
|
585 |
+
}
|
586 |
+
|
587 |
+
|
588 |
+
/**
|
589 |
+
* Pseudo sprintf implementation - simple way to replace tokens with specified values.
|
590 |
+
*
|
591 |
+
* @param {String} str String with tokens
|
592 |
+
* @return {String} String with replaced tokens
|
593 |
+
*/
|
594 |
+
function sprintf(str) {
|
595 |
+
var args = [].slice.call(arguments, 1);
|
596 |
+
|
597 |
+
return str.replace(/%([a-z])/g, function($0, $1) {
|
598 |
+
var value = args.shift();
|
599 |
+
|
600 |
+
switch ($1) {
|
601 |
+
case 's':
|
602 |
+
return value + '';
|
603 |
+
|
604 |
+
case 'd':
|
605 |
+
return parseInt(value, 10);
|
606 |
+
|
607 |
+
case 'f':
|
608 |
+
return parseFloat(value);
|
609 |
+
|
610 |
+
case 'c':
|
611 |
+
return '';
|
612 |
+
|
613 |
+
default:
|
614 |
+
return value;
|
615 |
+
}
|
616 |
+
});
|
617 |
+
}
|
618 |
+
|
619 |
+
|
620 |
+
|
621 |
+
function delay(cb, timeout) {
|
622 |
+
var self = this;
|
623 |
+
setTimeout(function() {
|
624 |
+
cb.call(self);
|
625 |
+
}, timeout || 1);
|
626 |
+
}
|
627 |
+
|
628 |
+
|
629 |
+
return {
|
630 |
+
guid: guid,
|
631 |
+
typeOf: typeOf,
|
632 |
+
extend: extend,
|
633 |
+
extendIf: extendIf,
|
634 |
+
extendImmutable: extendImmutable,
|
635 |
+
extendImmutableIf: extendImmutableIf,
|
636 |
+
clone: clone,
|
637 |
+
inherit: inherit,
|
638 |
+
each: each,
|
639 |
+
isEmptyObj: isEmptyObj,
|
640 |
+
inSeries: inSeries,
|
641 |
+
inParallel: inParallel,
|
642 |
+
inArray: inArray,
|
643 |
+
arrayDiff: arrayDiff,
|
644 |
+
arrayIntersect: arrayIntersect,
|
645 |
+
toArray: toArray,
|
646 |
+
trim: trim,
|
647 |
+
sprintf: sprintf,
|
648 |
+
parseSizeStr: parseSizeStr,
|
649 |
+
delay: delay
|
650 |
+
};
|
651 |
+
});
|
652 |
+
|
653 |
+
// Included from: src/javascript/core/utils/Encode.js
|
654 |
+
|
655 |
+
/**
|
656 |
+
* Encode.js
|
657 |
+
*
|
658 |
+
* Copyright 2013, Moxiecode Systems AB
|
659 |
+
* Released under GPL License.
|
660 |
+
*
|
661 |
+
* License: http://www.plupload.com/license
|
662 |
+
* Contributing: http://www.plupload.com/contributing
|
663 |
+
*/
|
664 |
+
|
665 |
+
/**
|
666 |
+
@class moxie/core/utils/Encode
|
667 |
+
@public
|
668 |
+
@static
|
669 |
+
*/
|
670 |
+
|
671 |
+
define('moxie/core/utils/Encode', [], function() {
|
672 |
+
|
673 |
+
/**
|
674 |
+
Encode string with UTF-8
|
675 |
+
|
676 |
+
@method utf8_encode
|
677 |
+
@static
|
678 |
+
@param {String} str String to encode
|
679 |
+
@return {String} UTF-8 encoded string
|
680 |
+
*/
|
681 |
+
var utf8_encode = function(str) {
|
682 |
+
return unescape(encodeURIComponent(str));
|
683 |
+
};
|
684 |
+
|
685 |
+
/**
|
686 |
+
Decode UTF-8 encoded string
|
687 |
+
|
688 |
+
@method utf8_decode
|
689 |
+
@static
|
690 |
+
@param {String} str String to decode
|
691 |
+
@return {String} Decoded string
|
692 |
+
*/
|
693 |
+
var utf8_decode = function(str_data) {
|
694 |
+
return decodeURIComponent(escape(str_data));
|
695 |
+
};
|
696 |
+
|
697 |
+
/**
|
698 |
+
Decode Base64 encoded string (uses browser's default method if available),
|
699 |
+
from: https://raw.github.com/kvz/phpjs/master/functions/url/base64_decode.js
|
700 |
+
|
701 |
+
@method atob
|
702 |
+
@static
|
703 |
+
@param {String} data String to decode
|
704 |
+
@return {String} Decoded string
|
705 |
+
*/
|
706 |
+
var atob = function(data, utf8) {
|
707 |
+
if (typeof(window.atob) === 'function') {
|
708 |
+
return utf8 ? utf8_decode(window.atob(data)) : window.atob(data);
|
709 |
+
}
|
710 |
+
|
711 |
+
// http://kevin.vanzonneveld.net
|
712 |
+
// + original by: Tyler Akins (http://rumkin.com)
|
713 |
+
// + improved by: Thunder.m
|
714 |
+
// + input by: Aman Gupta
|
715 |
+
// + improved by: Kevin van Zonneveld (http://kevin.vanzonneveld.net)
|
716 |
+
// + bugfixed by: Onno Marsman
|
717 |
+
// + bugfixed by: Pellentesque Malesuada
|
718 |
+
// + improved by: Kevin van Zonneveld (http://kevin.vanzonneveld.net)
|
719 |
+
// + input by: Brett Zamir (http://brett-zamir.me)
|
720 |
+
// + bugfixed by: Kevin van Zonneveld (http://kevin.vanzonneveld.net)
|
721 |
+
// * example 1: base64_decode('S2V2aW4gdmFuIFpvbm5ldmVsZA==');
|
722 |
+
// * returns 1: 'Kevin van Zonneveld'
|
723 |
+
// mozilla has this native
|
724 |
+
// - but breaks in 2.0.0.12!
|
725 |
+
//if (typeof this.window.atob == 'function') {
|
726 |
+
// return atob(data);
|
727 |
+
//}
|
728 |
+
var b64 = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=";
|
729 |
+
var o1, o2, o3, h1, h2, h3, h4, bits, i = 0,
|
730 |
+
ac = 0,
|
731 |
+
dec = "",
|
732 |
+
tmp_arr = [];
|
733 |
+
|
734 |
+
if (!data) {
|
735 |
+
return data;
|
736 |
+
}
|
737 |
+
|
738 |
+
data += '';
|
739 |
+
|
740 |
+
do { // unpack four hexets into three octets using index points in b64
|
741 |
+
h1 = b64.indexOf(data.charAt(i++));
|
742 |
+
h2 = b64.indexOf(data.charAt(i++));
|
743 |
+
h3 = b64.indexOf(data.charAt(i++));
|
744 |
+
h4 = b64.indexOf(data.charAt(i++));
|
745 |
+
|
746 |
+
bits = h1 << 18 | h2 << 12 | h3 << 6 | h4;
|
747 |
+
|
748 |
+
o1 = bits >> 16 & 0xff;
|
749 |
+
o2 = bits >> 8 & 0xff;
|
750 |
+
o3 = bits & 0xff;
|
751 |
+
|
752 |
+
if (h3 == 64) {
|
753 |
+
tmp_arr[ac++] = String.fromCharCode(o1);
|
754 |
+
} else if (h4 == 64) {
|
755 |
+
tmp_arr[ac++] = String.fromCharCode(o1, o2);
|
756 |
+
} else {
|
757 |
+
tmp_arr[ac++] = String.fromCharCode(o1, o2, o3);
|
758 |
+
}
|
759 |
+
} while (i < data.length);
|
760 |
+
|
761 |
+
dec = tmp_arr.join('');
|
762 |
+
|
763 |
+
return utf8 ? utf8_decode(dec) : dec;
|
764 |
+
};
|
765 |
+
|
766 |
+
/**
|
767 |
+
Base64 encode string (uses browser's default method if available),
|
768 |
+
from: https://raw.github.com/kvz/phpjs/master/functions/url/base64_encode.js
|
769 |
+
|
770 |
+
@method btoa
|
771 |
+
@static
|
772 |
+
@param {String} data String to encode
|
773 |
+
@return {String} Base64 encoded string
|
774 |
+
*/
|
775 |
+
var btoa = function(data, utf8) {
|
776 |
+
if (utf8) {
|
777 |
+
data = utf8_encode(data);
|
778 |
+
}
|
779 |
+
|
780 |
+
if (typeof(window.btoa) === 'function') {
|
781 |
+
return window.btoa(data);
|
782 |
+
}
|
783 |
+
|
784 |
+
// http://kevin.vanzonneveld.net
|
785 |
+
// + original by: Tyler Akins (http://rumkin.com)
|
786 |
+
// + improved by: Bayron Guevara
|
787 |
+
// + improved by: Thunder.m
|
788 |
+
// + improved by: Kevin van Zonneveld (http://kevin.vanzonneveld.net)
|
789 |
+
// + bugfixed by: Pellentesque Malesuada
|
790 |
+
// + improved by: Kevin van Zonneveld (http://kevin.vanzonneveld.net)
|
791 |
+
// + improved by: Rafał Kukawski (http://kukawski.pl)
|
792 |
+
// * example 1: base64_encode('Kevin van Zonneveld');
|
793 |
+
// * returns 1: 'S2V2aW4gdmFuIFpvbm5ldmVsZA=='
|
794 |
+
// mozilla has this native
|
795 |
+
// - but breaks in 2.0.0.12!
|
796 |
+
var b64 = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=";
|
797 |
+
var o1, o2, o3, h1, h2, h3, h4, bits, i = 0,
|
798 |
+
ac = 0,
|
799 |
+
enc = "",
|
800 |
+
tmp_arr = [];
|
801 |
+
|
802 |
+
if (!data) {
|
803 |
+
return data;
|
804 |
+
}
|
805 |
+
|
806 |
+
do { // pack three octets into four hexets
|
807 |
+
o1 = data.charCodeAt(i++);
|
808 |
+
o2 = data.charCodeAt(i++);
|
809 |
+
o3 = data.charCodeAt(i++);
|
810 |
+
|
811 |
+
bits = o1 << 16 | o2 << 8 | o3;
|
812 |
+
|
813 |
+
h1 = bits >> 18 & 0x3f;
|
814 |
+
h2 = bits >> 12 & 0x3f;
|
815 |
+
h3 = bits >> 6 & 0x3f;
|
816 |
+
h4 = bits & 0x3f;
|
817 |
+
|
818 |
+
// use hexets to index into b64, and append result to encoded string
|
819 |
+
tmp_arr[ac++] = b64.charAt(h1) + b64.charAt(h2) + b64.charAt(h3) + b64.charAt(h4);
|
820 |
+
} while (i < data.length);
|
821 |
+
|
822 |
+
enc = tmp_arr.join('');
|
823 |
+
|
824 |
+
var r = data.length % 3;
|
825 |
+
|
826 |
+
return (r ? enc.slice(0, r - 3) : enc) + '==='.slice(r || 3);
|
827 |
+
};
|
828 |
+
|
829 |
+
|
830 |
+
return {
|
831 |
+
utf8_encode: utf8_encode,
|
832 |
+
utf8_decode: utf8_decode,
|
833 |
+
atob: atob,
|
834 |
+
btoa: btoa
|
835 |
+
};
|
836 |
+
});
|
837 |
+
|
838 |
+
// Included from: src/javascript/core/utils/Env.js
|
839 |
+
|
840 |
+
/**
|
841 |
+
* Env.js
|
842 |
+
*
|
843 |
+
* Copyright 2013, Moxiecode Systems AB
|
844 |
+
* Released under GPL License.
|
845 |
+
*
|
846 |
+
* License: http://www.plupload.com/license
|
847 |
+
* Contributing: http://www.plupload.com/contributing
|
848 |
+
*/
|
849 |
+
|
850 |
+
/**
|
851 |
+
@class moxie/core/utils/Env
|
852 |
+
@public
|
853 |
+
@static
|
854 |
+
*/
|
855 |
+
|
856 |
+
define("moxie/core/utils/Env", [
|
857 |
+
"moxie/core/utils/Basic"
|
858 |
+
], function(Basic) {
|
859 |
+
|
860 |
+
/**
|
861 |
+
* UAParser.js v0.7.7
|
862 |
+
* Lightweight JavaScript-based User-Agent string parser
|
863 |
+
* https://github.com/faisalman/ua-parser-js
|
864 |
+
*
|
865 |
+
* Copyright © 2012-2015 Faisal Salman <fyzlman@gmail.com>
|
866 |
+
* Dual licensed under GPLv2 & MIT
|
867 |
+
*/
|
868 |
+
var UAParser = (function (undefined) {
|
869 |
+
|
870 |
+
//////////////
|
871 |
+
// Constants
|
872 |
+
/////////////
|
873 |
+
|
874 |
+
|
875 |
+
var EMPTY = '',
|
876 |
+
UNKNOWN = '?',
|
877 |
+
FUNC_TYPE = 'function',
|
878 |
+
UNDEF_TYPE = 'undefined',
|
879 |
+
OBJ_TYPE = 'object',
|
880 |
+
MAJOR = 'major',
|
881 |
+
MODEL = 'model',
|
882 |
+
NAME = 'name',
|
883 |
+
TYPE = 'type',
|
884 |
+
VENDOR = 'vendor',
|
885 |
+
VERSION = 'version',
|
886 |
+
ARCHITECTURE= 'architecture',
|
887 |
+
CONSOLE = 'console',
|
888 |
+
MOBILE = 'mobile',
|
889 |
+
TABLET = 'tablet';
|
890 |
+
|
891 |
+
|
892 |
+
///////////
|
893 |
+
// Helper
|
894 |
+
//////////
|
895 |
+
|
896 |
+
|
897 |
+
var util = {
|
898 |
+
has : function (str1, str2) {
|
899 |
+
return str2.toLowerCase().indexOf(str1.toLowerCase()) !== -1;
|
900 |
+
},
|
901 |
+
lowerize : function (str) {
|
902 |
+
return str.toLowerCase();
|
903 |
+
}
|
904 |
+
};
|
905 |
+
|
906 |
+
|
907 |
+
///////////////
|
908 |
+
// Map helper
|
909 |
+
//////////////
|
910 |
+
|
911 |
+
|
912 |
+
var mapper = {
|
913 |
+
|
914 |
+
rgx : function () {
|
915 |
+
|
916 |
+
// loop through all regexes maps
|
917 |
+
for (var result, i = 0, j, k, p, q, matches, match, args = arguments; i < args.length; i += 2) {
|
918 |
+
|
919 |
+
var regex = args[i], // even sequence (0,2,4,..)
|
920 |
+
props = args[i + 1]; // odd sequence (1,3,5,..)
|
921 |
+
|
922 |
+
// construct object barebones
|
923 |
+
if (typeof(result) === UNDEF_TYPE) {
|
924 |
+
result = {};
|
925 |
+
for (p in props) {
|
926 |
+
q = props[p];
|
927 |
+
if (typeof(q) === OBJ_TYPE) {
|
928 |
+
result[q[0]] = undefined;
|
929 |
+
} else {
|
930 |
+
result[q] = undefined;
|
931 |
+
}
|
932 |
+
}
|
933 |
+
}
|
934 |
+
|
935 |
+
// try matching uastring with regexes
|
936 |
+
for (j = k = 0; j < regex.length; j++) {
|
937 |
+
matches = regex[j].exec(this.getUA());
|
938 |
+
if (!!matches) {
|
939 |
+
for (p = 0; p < props.length; p++) {
|
940 |
+
match = matches[++k];
|
941 |
+
q = props[p];
|
942 |
+
// check if given property is actually array
|
943 |
+
if (typeof(q) === OBJ_TYPE && q.length > 0) {
|
944 |
+
if (q.length == 2) {
|
945 |
+
if (typeof(q[1]) == FUNC_TYPE) {
|
946 |
+
// assign modified match
|
947 |
+
result[q[0]] = q[1].call(this, match);
|
948 |
+
} else {
|
949 |
+
// assign given value, ignore regex match
|
950 |
+
result[q[0]] = q[1];
|
951 |
+
}
|
952 |
+
} else if (q.length == 3) {
|
953 |
+
// check whether function or regex
|
954 |
+
if (typeof(q[1]) === FUNC_TYPE && !(q[1].exec && q[1].test)) {
|
955 |
+
// call function (usually string mapper)
|
956 |
+
result[q[0]] = match ? q[1].call(this, match, q[2]) : undefined;
|
957 |
+
} else {
|
958 |
+
// sanitize match using given regex
|
959 |
+
result[q[0]] = match ? match.replace(q[1], q[2]) : undefined;
|
960 |
+
}
|
961 |
+
} else if (q.length == 4) {
|
962 |
+
result[q[0]] = match ? q[3].call(this, match.replace(q[1], q[2])) : undefined;
|
963 |
+
}
|
964 |
+
} else {
|
965 |
+
result[q] = match ? match : undefined;
|
966 |
+
}
|
967 |
+
}
|
968 |
+
break;
|
969 |
+
}
|
970 |
+
}
|
971 |
+
|
972 |
+
if(!!matches) break; // break the loop immediately if match found
|
973 |
+
}
|
974 |
+
return result;
|
975 |
+
},
|
976 |
+
|
977 |
+
str : function (str, map) {
|
978 |
+
|
979 |
+
for (var i in map) {
|
980 |
+
// check if array
|
981 |
+
if (typeof(map[i]) === OBJ_TYPE && map[i].length > 0) {
|
982 |
+
for (var j = 0; j < map[i].length; j++) {
|
983 |
+
if (util.has(map[i][j], str)) {
|
984 |
+
return (i === UNKNOWN) ? undefined : i;
|
985 |
+
}
|
986 |
+
}
|
987 |
+
} else if (util.has(map[i], str)) {
|
988 |
+
return (i === UNKNOWN) ? undefined : i;
|
989 |
+
}
|
990 |
+
}
|
991 |
+
return str;
|
992 |
+
}
|
993 |
+
};
|
994 |
+
|
995 |
+
|
996 |
+
///////////////
|
997 |
+
// String map
|
998 |
+
//////////////
|
999 |
+
|
1000 |
+
|
1001 |
+
var maps = {
|
1002 |
+
|
1003 |
+
browser : {
|
1004 |
+
oldsafari : {
|
1005 |
+
major : {
|
1006 |
+
'1' : ['/8', '/1', '/3'],
|
1007 |
+
'2' : '/4',
|
1008 |
+
'?' : '/'
|
1009 |
+
},
|
1010 |
+
version : {
|
1011 |
+
'1.0' : '/8',
|
1012 |
+
'1.2' : '/1',
|
1013 |
+
'1.3' : '/3',
|
1014 |
+
'2.0' : '/412',
|
1015 |
+
'2.0.2' : '/416',
|
1016 |
+
'2.0.3' : '/417',
|
1017 |
+
'2.0.4' : '/419',
|
1018 |
+
'?' : '/'
|
1019 |
+
}
|
1020 |
+
}
|
1021 |
+
},
|
1022 |
+
|
1023 |
+
device : {
|
1024 |
+
sprint : {
|
1025 |
+
model : {
|
1026 |
+
'Evo Shift 4G' : '7373KT'
|
1027 |
+
},
|
1028 |
+
vendor : {
|
1029 |
+
'HTC' : 'APA',
|
1030 |
+
'Sprint' : 'Sprint'
|
1031 |
+
}
|
1032 |
+
}
|
1033 |
+
},
|
1034 |
+
|
1035 |
+
os : {
|
1036 |
+
windows : {
|
1037 |
+
version : {
|
1038 |
+
'ME' : '4.90',
|
1039 |
+
'NT 3.11' : 'NT3.51',
|
1040 |
+
'NT 4.0' : 'NT4.0',
|
1041 |
+
'2000' : 'NT 5.0',
|
1042 |
+
'XP' : ['NT 5.1', 'NT 5.2'],
|
1043 |
+
'Vista' : 'NT 6.0',
|
1044 |
+
'7' : 'NT 6.1',
|
1045 |
+
'8' : 'NT 6.2',
|
1046 |
+
'8.1' : 'NT 6.3',
|
1047 |
+
'RT' : 'ARM'
|
1048 |
+
}
|
1049 |
+
}
|
1050 |
+
}
|
1051 |
+
};
|
1052 |
+
|
1053 |
+
|
1054 |
+
//////////////
|
1055 |
+
// Regex map
|
1056 |
+
/////////////
|
1057 |
+
|
1058 |
+
|
1059 |
+
var regexes = {
|
1060 |
+
|
1061 |
+
browser : [[
|
1062 |
+
|
1063 |
+
// Presto based
|
1064 |
+
/(opera\smini)\/([\w\.-]+)/i, // Opera Mini
|
1065 |
+
/(opera\s[mobiletab]+).+version\/([\w\.-]+)/i, // Opera Mobi/Tablet
|
1066 |
+
/(opera).+version\/([\w\.]+)/i, // Opera > 9.80
|
1067 |
+
/(opera)[\/\s]+([\w\.]+)/i // Opera < 9.80
|
1068 |
+
|
1069 |
+
], [NAME, VERSION], [
|
1070 |
+
|
1071 |
+
/\s(opr)\/([\w\.]+)/i // Opera Webkit
|
1072 |
+
], [[NAME, 'Opera'], VERSION], [
|
1073 |
+
|
1074 |
+
// Mixed
|
1075 |
+
/(kindle)\/([\w\.]+)/i, // Kindle
|
1076 |
+
/(lunascape|maxthon|netfront|jasmine|blazer)[\/\s]?([\w\.]+)*/i,
|
1077 |
+
// Lunascape/Maxthon/Netfront/Jasmine/Blazer
|
1078 |
+
|
1079 |
+
// Trident based
|
1080 |
+
/(avant\s|iemobile|slim|baidu)(?:browser)?[\/\s]?([\w\.]*)/i,
|
1081 |
+
// Avant/IEMobile/SlimBrowser/Baidu
|
1082 |
+
/(?:ms|\()(ie)\s([\w\.]+)/i, // Internet Explorer
|
1083 |
+
|
1084 |
+
// Webkit/KHTML based
|
1085 |
+
/(rekonq)\/([\w\.]+)*/i, // Rekonq
|
1086 |
+
/(chromium|flock|rockmelt|midori|epiphany|silk|skyfire|ovibrowser|bolt|iron|vivaldi)\/([\w\.-]+)/i
|
1087 |
+
// Chromium/Flock/RockMelt/Midori/Epiphany/Silk/Skyfire/Bolt/Iron
|
1088 |
+
], [NAME, VERSION], [
|
1089 |
+
|
1090 |
+
/(trident).+rv[:\s]([\w\.]+).+like\sgecko/i // IE11
|
1091 |
+
], [[NAME, 'IE'], VERSION], [
|
1092 |
+
|
1093 |
+
/(edge)\/((\d+)?[\w\.]+)/i // Microsoft Edge
|
1094 |
+
], [NAME, VERSION], [
|
1095 |
+
|
1096 |
+
/(yabrowser)\/([\w\.]+)/i // Yandex
|
1097 |
+
], [[NAME, 'Yandex'], VERSION], [
|
1098 |
+
|
1099 |
+
/(comodo_dragon)\/([\w\.]+)/i // Comodo Dragon
|
1100 |
+
], [[NAME, /_/g, ' '], VERSION], [
|
1101 |
+
|
1102 |
+
/(chrome|omniweb|arora|[tizenoka]{5}\s?browser)\/v?([\w\.]+)/i,
|
1103 |
+
// Chrome/OmniWeb/Arora/Tizen/Nokia
|
1104 |
+
/(uc\s?browser|qqbrowser)[\/\s]?([\w\.]+)/i
|
1105 |
+
// UCBrowser/QQBrowser
|
1106 |
+
], [NAME, VERSION], [
|
1107 |
+
|
1108 |
+
/(dolfin)\/([\w\.]+)/i // Dolphin
|
1109 |
+
], [[NAME, 'Dolphin'], VERSION], [
|
1110 |
+
|
1111 |
+
/((?:android.+)crmo|crios)\/([\w\.]+)/i // Chrome for Android/iOS
|
1112 |
+
], [[NAME, 'Chrome'], VERSION], [
|
1113 |
+
|
1114 |
+
/XiaoMi\/MiuiBrowser\/([\w\.]+)/i // MIUI Browser
|
1115 |
+
], [VERSION, [NAME, 'MIUI Browser']], [
|
1116 |
+
|
1117 |
+
/android.+version\/([\w\.]+)\s+(?:mobile\s?safari|safari)/i // Android Browser
|
1118 |
+
], [VERSION, [NAME, 'Android Browser']], [
|
1119 |
+
|
1120 |
+
/FBAV\/([\w\.]+);/i // Facebook App for iOS
|
1121 |
+
], [VERSION, [NAME, 'Facebook']], [
|
1122 |
+
|
1123 |
+
/version\/([\w\.]+).+?mobile\/\w+\s(safari)/i // Mobile Safari
|
1124 |
+
], [VERSION, [NAME, 'Mobile Safari']], [
|
1125 |
+
|
1126 |
+
/version\/([\w\.]+).+?(mobile\s?safari|safari)/i // Safari & Safari Mobile
|
1127 |
+
], [VERSION, NAME], [
|
1128 |
+
|
1129 |
+
/webkit.+?(mobile\s?safari|safari)(\/[\w\.]+)/i // Safari < 3.0
|
1130 |
+
], [NAME, [VERSION, mapper.str, maps.browser.oldsafari.version]], [
|
1131 |
+
|
1132 |
+
/(konqueror)\/([\w\.]+)/i, // Konqueror
|
1133 |
+
/(webkit|khtml)\/([\w\.]+)/i
|
1134 |
+
], [NAME, VERSION], [
|
1135 |
+
|
1136 |
+
// Gecko based
|
1137 |
+
/(navigator|netscape)\/([\w\.-]+)/i // Netscape
|
1138 |
+
], [[NAME, 'Netscape'], VERSION], [
|
1139 |
+
/(swiftfox)/i, // Swiftfox
|
1140 |
+
/(icedragon|iceweasel|camino|chimera|fennec|maemo\sbrowser|minimo|conkeror)[\/\s]?([\w\.\+]+)/i,
|
1141 |
+
// IceDragon/Iceweasel/Camino/Chimera/Fennec/Maemo/Minimo/Conkeror
|
1142 |
+
/(firefox|seamonkey|k-meleon|icecat|iceape|firebird|phoenix)\/([\w\.-]+)/i,
|
1143 |
+
// Firefox/SeaMonkey/K-Meleon/IceCat/IceApe/Firebird/Phoenix
|
1144 |
+
/(mozilla)\/([\w\.]+).+rv\:.+gecko\/\d+/i, // Mozilla
|
1145 |
+
|
1146 |
+
// Other
|
1147 |
+
/(polaris|lynx|dillo|icab|doris|amaya|w3m|netsurf)[\/\s]?([\w\.]+)/i,
|
1148 |
+
// Polaris/Lynx/Dillo/iCab/Doris/Amaya/w3m/NetSurf
|
1149 |
+
/(links)\s\(([\w\.]+)/i, // Links
|
1150 |
+
/(gobrowser)\/?([\w\.]+)*/i, // GoBrowser
|
1151 |
+
/(ice\s?browser)\/v?([\w\._]+)/i, // ICE Browser
|
1152 |
+
/(mosaic)[\/\s]([\w\.]+)/i // Mosaic
|
1153 |
+
], [NAME, VERSION]
|
1154 |
+
],
|
1155 |
+
|
1156 |
+
engine : [[
|
1157 |
+
|
1158 |
+
/windows.+\sedge\/([\w\.]+)/i // EdgeHTML
|
1159 |
+
], [VERSION, [NAME, 'EdgeHTML']], [
|
1160 |
+
|
1161 |
+
/(presto)\/([\w\.]+)/i, // Presto
|
1162 |
+
/(webkit|trident|netfront|netsurf|amaya|lynx|w3m)\/([\w\.]+)/i, // WebKit/Trident/NetFront/NetSurf/Amaya/Lynx/w3m
|
1163 |
+
/(khtml|tasman|links)[\/\s]\(?([\w\.]+)/i, // KHTML/Tasman/Links
|
1164 |
+
/(icab)[\/\s]([23]\.[\d\.]+)/i // iCab
|
1165 |
+
], [NAME, VERSION], [
|
1166 |
+
|
1167 |
+
/rv\:([\w\.]+).*(gecko)/i // Gecko
|
1168 |
+
], [VERSION, NAME]
|
1169 |
+
],
|
1170 |
+
|
1171 |
+
os : [[
|
1172 |
+
|
1173 |
+
// Windows based
|
1174 |
+
/microsoft\s(windows)\s(vista|xp)/i // Windows (iTunes)
|
1175 |
+
], [NAME, VERSION], [
|
1176 |
+
/(windows)\snt\s6\.2;\s(arm)/i, // Windows RT
|
1177 |
+
/(windows\sphone(?:\sos)*|windows\smobile|windows)[\s\/]?([ntce\d\.\s]+\w)/i
|
1178 |
+
], [NAME, [VERSION, mapper.str, maps.os.windows.version]], [
|
1179 |
+
/(win(?=3|9|n)|win\s9x\s)([nt\d\.]+)/i
|
1180 |
+
], [[NAME, 'Windows'], [VERSION, mapper.str, maps.os.windows.version]], [
|
1181 |
+
|
1182 |
+
// Mobile/Embedded OS
|
1183 |
+
/\((bb)(10);/i // BlackBerry 10
|
1184 |
+
], [[NAME, 'BlackBerry'], VERSION], [
|
1185 |
+
/(blackberry)\w*\/?([\w\.]+)*/i, // Blackberry
|
1186 |
+
/(tizen)[\/\s]([\w\.]+)/i, // Tizen
|
1187 |
+
/(android|webos|palm\os|qnx|bada|rim\stablet\sos|meego|contiki)[\/\s-]?([\w\.]+)*/i,
|
1188 |
+
// Android/WebOS/Palm/QNX/Bada/RIM/MeeGo/Contiki
|
1189 |
+
/linux;.+(sailfish);/i // Sailfish OS
|
1190 |
+
], [NAME, VERSION], [
|
1191 |
+
/(symbian\s?os|symbos|s60(?=;))[\/\s-]?([\w\.]+)*/i // Symbian
|
1192 |
+
], [[NAME, 'Symbian'], VERSION], [
|
1193 |
+
/\((series40);/i // Series 40
|
1194 |
+
], [NAME], [
|
1195 |
+
/mozilla.+\(mobile;.+gecko.+firefox/i // Firefox OS
|
1196 |
+
], [[NAME, 'Firefox OS'], VERSION], [
|
1197 |
+
|
1198 |
+
// Console
|
1199 |
+
/(nintendo|playstation)\s([wids3portablevu]+)/i, // Nintendo/Playstation
|
1200 |
+
|
1201 |
+
// GNU/Linux based
|
1202 |
+
/(mint)[\/\s\(]?(\w+)*/i, // Mint
|
1203 |
+
/(mageia|vectorlinux)[;\s]/i, // Mageia/VectorLinux
|
1204 |
+
/(joli|[kxln]?ubuntu|debian|[open]*suse|gentoo|arch|slackware|fedora|mandriva|centos|pclinuxos|redhat|zenwalk|linpus)[\/\s-]?([\w\.-]+)*/i,
|
1205 |
+
// Joli/Ubuntu/Debian/SUSE/Gentoo/Arch/Slackware
|
1206 |
+
// Fedora/Mandriva/CentOS/PCLinuxOS/RedHat/Zenwalk/Linpus
|
1207 |
+
/(hurd|linux)\s?([\w\.]+)*/i, // Hurd/Linux
|
1208 |
+
/(gnu)\s?([\w\.]+)*/i // GNU
|
1209 |
+
], [NAME, VERSION], [
|
1210 |
+
|
1211 |
+
/(cros)\s[\w]+\s([\w\.]+\w)/i // Chromium OS
|
1212 |
+
], [[NAME, 'Chromium OS'], VERSION],[
|
1213 |
+
|
1214 |
+
// Solaris
|
1215 |
+
/(sunos)\s?([\w\.]+\d)*/i // Solaris
|
1216 |
+
], [[NAME, 'Solaris'], VERSION], [
|
1217 |
+
|
1218 |
+
// BSD based
|
1219 |
+
/\s([frentopc-]{0,4}bsd|dragonfly)\s?([\w\.]+)*/i // FreeBSD/NetBSD/OpenBSD/PC-BSD/DragonFly
|
1220 |
+
], [NAME, VERSION],[
|
1221 |
+
|
1222 |
+
/(ip[honead]+)(?:.*os\s*([\w]+)*\slike\smac|;\sopera)/i // iOS
|
1223 |
+
], [[NAME, 'iOS'], [VERSION, /_/g, '.']], [
|
1224 |
+
|
1225 |
+
/(mac\sos\sx)\s?([\w\s\.]+\w)*/i,
|
1226 |
+
/(macintosh|mac(?=_powerpc)\s)/i // Mac OS
|
1227 |
+
], [[NAME, 'Mac OS'], [VERSION, /_/g, '.']], [
|
1228 |
+
|
1229 |
+
// Other
|
1230 |
+
/((?:open)?solaris)[\/\s-]?([\w\.]+)*/i, // Solaris
|
1231 |
+
/(haiku)\s(\w+)/i, // Haiku
|
1232 |
+
/(aix)\s((\d)(?=\.|\)|\s)[\w\.]*)*/i, // AIX
|
1233 |
+
/(plan\s9|minix|beos|os\/2|amigaos|morphos|risc\sos|openvms)/i,
|
1234 |
+
// Plan9/Minix/BeOS/OS2/AmigaOS/MorphOS/RISCOS/OpenVMS
|
1235 |
+
/(unix)\s?([\w\.]+)*/i // UNIX
|
1236 |
+
], [NAME, VERSION]
|
1237 |
+
]
|
1238 |
+
};
|
1239 |
+
|
1240 |
+
|
1241 |
+
/////////////////
|
1242 |
+
// Constructor
|
1243 |
+
////////////////
|
1244 |
+
|
1245 |
+
|
1246 |
+
var UAParser = function (uastring) {
|
1247 |
+
|
1248 |
+
var ua = uastring || ((window && window.navigator && window.navigator.userAgent) ? window.navigator.userAgent : EMPTY);
|
1249 |
+
|
1250 |
+
this.getBrowser = function () {
|
1251 |
+
return mapper.rgx.apply(this, regexes.browser);
|
1252 |
+
};
|
1253 |
+
this.getEngine = function () {
|
1254 |
+
return mapper.rgx.apply(this, regexes.engine);
|
1255 |
+
};
|
1256 |
+
this.getOS = function () {
|
1257 |
+
return mapper.rgx.apply(this, regexes.os);
|
1258 |
+
};
|
1259 |
+
this.getResult = function() {
|
1260 |
+
return {
|
1261 |
+
ua : this.getUA(),
|
1262 |
+
browser : this.getBrowser(),
|
1263 |
+
engine : this.getEngine(),
|
1264 |
+
os : this.getOS()
|
1265 |
+
};
|
1266 |
+
};
|
1267 |
+
this.getUA = function () {
|
1268 |
+
return ua;
|
1269 |
+
};
|
1270 |
+
this.setUA = function (uastring) {
|
1271 |
+
ua = uastring;
|
1272 |
+
return this;
|
1273 |
+
};
|
1274 |
+
this.setUA(ua);
|
1275 |
+
};
|
1276 |
+
|
1277 |
+
return UAParser;
|
1278 |
+
})();
|
1279 |
+
|
1280 |
+
|
1281 |
+
function version_compare(v1, v2, operator) {
|
1282 |
+
// From: http://phpjs.org/functions
|
1283 |
+
// + original by: Philippe Jausions (http://pear.php.net/user/jausions)
|
1284 |
+
// + original by: Aidan Lister (http://aidanlister.com/)
|
1285 |
+
// + reimplemented by: Kankrelune (http://www.webfaktory.info/)
|
1286 |
+
// + improved by: Brett Zamir (http://brett-zamir.me)
|
1287 |
+
// + improved by: Scott Baker
|
1288 |
+
// + improved by: Theriault
|
1289 |
+
// * example 1: version_compare('8.2.5rc', '8.2.5a');
|
1290 |
+
// * returns 1: 1
|
1291 |
+
// * example 2: version_compare('8.2.50', '8.2.52', '<');
|
1292 |
+
// * returns 2: true
|
1293 |
+
// * example 3: version_compare('5.3.0-dev', '5.3.0');
|
1294 |
+
// * returns 3: -1
|
1295 |
+
// * example 4: version_compare('4.1.0.52','4.01.0.51');
|
1296 |
+
// * returns 4: 1
|
1297 |
+
|
1298 |
+
// Important: compare must be initialized at 0.
|
1299 |
+
var i = 0,
|
1300 |
+
x = 0,
|
1301 |
+
compare = 0,
|
1302 |
+
// vm maps textual PHP versions to negatives so they're less than 0.
|
1303 |
+
// PHP currently defines these as CASE-SENSITIVE. It is important to
|
1304 |
+
// leave these as negatives so that they can come before numerical versions
|
1305 |
+
// and as if no letters were there to begin with.
|
1306 |
+
// (1alpha is < 1 and < 1.1 but > 1dev1)
|
1307 |
+
// If a non-numerical value can't be mapped to this table, it receives
|
1308 |
+
// -7 as its value.
|
1309 |
+
vm = {
|
1310 |
+
'dev': -6,
|
1311 |
+
'alpha': -5,
|
1312 |
+
'a': -5,
|
1313 |
+
'beta': -4,
|
1314 |
+
'b': -4,
|
1315 |
+
'RC': -3,
|
1316 |
+
'rc': -3,
|
1317 |
+
'#': -2,
|
1318 |
+
'p': 1,
|
1319 |
+
'pl': 1
|
1320 |
+
},
|
1321 |
+
// This function will be called to prepare each version argument.
|
1322 |
+
// It replaces every _, -, and + with a dot.
|
1323 |
+
// It surrounds any nonsequence of numbers/dots with dots.
|
1324 |
+
// It replaces sequences of dots with a single dot.
|
1325 |
+
// version_compare('4..0', '4.0') == 0
|
1326 |
+
// Important: A string of 0 length needs to be converted into a value
|
1327 |
+
// even less than an unexisting value in vm (-7), hence [-8].
|
1328 |
+
// It's also important to not strip spaces because of this.
|
1329 |
+
// version_compare('', ' ') == 1
|
1330 |
+
prepVersion = function (v) {
|
1331 |
+
v = ('' + v).replace(/[_\-+]/g, '.');
|
1332 |
+
v = v.replace(/([^.\d]+)/g, '.$1.').replace(/\.{2,}/g, '.');
|
1333 |
+
return (!v.length ? [-8] : v.split('.'));
|
1334 |
+
},
|
1335 |
+
// This converts a version component to a number.
|
1336 |
+
// Empty component becomes 0.
|
1337 |
+
// Non-numerical component becomes a negative number.
|
1338 |
+
// Numerical component becomes itself as an integer.
|
1339 |
+
numVersion = function (v) {
|
1340 |
+
return !v ? 0 : (isNaN(v) ? vm[v] || -7 : parseInt(v, 10));
|
1341 |
+
};
|
1342 |
+
|
1343 |
+
v1 = prepVersion(v1);
|
1344 |
+
v2 = prepVersion(v2);
|
1345 |
+
x = Math.max(v1.length, v2.length);
|
1346 |
+
for (i = 0; i < x; i++) {
|
1347 |
+
if (v1[i] == v2[i]) {
|
1348 |
+
continue;
|
1349 |
+
}
|
1350 |
+
v1[i] = numVersion(v1[i]);
|
1351 |
+
v2[i] = numVersion(v2[i]);
|
1352 |
+
if (v1[i] < v2[i]) {
|
1353 |
+
compare = -1;
|
1354 |
+
break;
|
1355 |
+
} else if (v1[i] > v2[i]) {
|
1356 |
+
compare = 1;
|
1357 |
+
break;
|
1358 |
+
}
|
1359 |
+
}
|
1360 |
+
if (!operator) {
|
1361 |
+
return compare;
|
1362 |
+
}
|
1363 |
+
|
1364 |
+
// Important: operator is CASE-SENSITIVE.
|
1365 |
+
// "No operator" seems to be treated as "<."
|
1366 |
+
// Any other values seem to make the function return null.
|
1367 |
+
switch (operator) {
|
1368 |
+
case '>':
|
1369 |
+
case 'gt':
|
1370 |
+
return (compare > 0);
|
1371 |
+
case '>=':
|
1372 |
+
case 'ge':
|
1373 |
+
return (compare >= 0);
|
1374 |
+
case '<=':
|
1375 |
+
case 'le':
|
1376 |
+
return (compare <= 0);
|
1377 |
+
case '==':
|
1378 |
+
case '=':
|
1379 |
+
case 'eq':
|
1380 |
+
return (compare === 0);
|
1381 |
+
case '<>':
|
1382 |
+
case '!=':
|
1383 |
+
case 'ne':
|
1384 |
+
return (compare !== 0);
|
1385 |
+
case '':
|
1386 |
+
case '<':
|
1387 |
+
case 'lt':
|
1388 |
+
return (compare < 0);
|
1389 |
+
default:
|
1390 |
+
return null;
|
1391 |
+
}
|
1392 |
+
}
|
1393 |
+
|
1394 |
+
|
1395 |
+
var can = (function() {
|
1396 |
+
var caps = {
|
1397 |
+
access_global_ns: function () {
|
1398 |
+
return !!window.moxie;
|
1399 |
+
},
|
1400 |
+
|
1401 |
+
define_property: (function() {
|
1402 |
+
/* // currently too much extra code required, not exactly worth it
|
1403 |
+
try { // as of IE8, getters/setters are supported only on DOM elements
|
1404 |
+
var obj = {};
|
1405 |
+
if (Object.defineProperty) {
|
1406 |
+
Object.defineProperty(obj, 'prop', {
|
1407 |
+
enumerable: true,
|
1408 |
+
configurable: true
|
1409 |
+
});
|
1410 |
+
return true;
|
1411 |
+
}
|
1412 |
+
} catch(ex) {}
|
1413 |
+
|
1414 |
+
if (Object.prototype.__defineGetter__ && Object.prototype.__defineSetter__) {
|
1415 |
+
return true;
|
1416 |
+
}*/
|
1417 |
+
return false;
|
1418 |
+
}()),
|
1419 |
+
|
1420 |
+
create_canvas: function() {
|
1421 |
+
// On the S60 and BB Storm, getContext exists, but always returns undefined
|
1422 |
+
// so we actually have to call getContext() to verify
|
1423 |
+
// github.com/Modernizr/Modernizr/issues/issue/97/
|
1424 |
+
var el = document.createElement('canvas');
|
1425 |
+
var isSupported = !!(el.getContext && el.getContext('2d'));
|
1426 |
+
caps.create_canvas = isSupported;
|
1427 |
+
return isSupported;
|
1428 |
+
},
|
1429 |
+
|
1430 |
+
return_response_type: function(responseType) {
|
1431 |
+
try {
|
1432 |
+
if (Basic.inArray(responseType, ['', 'text', 'document']) !== -1) {
|
1433 |
+
return true;
|
1434 |
+
} else if (window.XMLHttpRequest) {
|
1435 |
+
var xhr = new XMLHttpRequest();
|
1436 |
+
xhr.open('get', '/'); // otherwise Gecko throws an exception
|
1437 |
+
if ('responseType' in xhr) {
|
1438 |
+
xhr.responseType = responseType;
|
1439 |
+
// as of 23.0.1271.64, Chrome switched from throwing exception to merely logging it to the console (why? o why?)
|
1440 |
+
if (xhr.responseType !== responseType) {
|
1441 |
+
return false;
|
1442 |
+
}
|
1443 |
+
return true;
|
1444 |
+
}
|
1445 |
+
}
|
1446 |
+
} catch (ex) {}
|
1447 |
+
return false;
|
1448 |
+
},
|
1449 |
+
|
1450 |
+
use_blob_uri: function() {
|
1451 |
+
var URL = window.URL;
|
1452 |
+
caps.use_blob_uri = (URL &&
|
1453 |
+
'createObjectURL' in URL &&
|
1454 |
+
'revokeObjectURL' in URL &&
|
1455 |
+
(Env.browser !== 'IE' || Env.verComp(Env.version, '11.0.46', '>=')) // IE supports createObjectURL, but not fully, for example it fails to use it as a src for the image
|
1456 |
+
);
|
1457 |
+
return caps.use_blob_uri;
|
1458 |
+
},
|
1459 |
+
|
1460 |
+
// ideas for this heavily come from Modernizr (http://modernizr.com/)
|
1461 |
+
use_data_uri: (function() {
|
1462 |
+
var du = new Image();
|
1463 |
+
|
1464 |
+
du.onload = function() {
|
1465 |
+
caps.use_data_uri = (du.width === 1 && du.height === 1);
|
1466 |
+
};
|
1467 |
+
|
1468 |
+
setTimeout(function() {
|
1469 |
+
du.src = "data:image/gif;base64,R0lGODlhAQABAIAAAP8AAAAAACH5BAAAAAAALAAAAAABAAEAAAICRAEAOw==";
|
1470 |
+
}, 1);
|
1471 |
+
return false;
|
1472 |
+
}()),
|
1473 |
+
|
1474 |
+
use_data_uri_over32kb: function() { // IE8
|
1475 |
+
return caps.use_data_uri && (Env.browser !== 'IE' || Env.version >= 9);
|
1476 |
+
},
|
1477 |
+
|
1478 |
+
use_data_uri_of: function(bytes) {
|
1479 |
+
return (caps.use_data_uri && bytes < 33000 || caps.use_data_uri_over32kb());
|
1480 |
+
},
|
1481 |
+
|
1482 |
+
use_fileinput: function() {
|
1483 |
+
if (navigator.userAgent.match(/(Android (1.0|1.1|1.5|1.6|2.0|2.1))|(Windows Phone (OS 7|8.0))|(XBLWP)|(ZuneWP)|(w(eb)?OSBrowser)|(webOS)|(Kindle\/(1.0|2.0|2.5|3.0))/)) {
|
1484 |
+
return false;
|
1485 |
+
}
|
1486 |
+
|
1487 |
+
var el = document.createElement('input');
|
1488 |
+
el.setAttribute('type', 'file');
|
1489 |
+
return caps.use_fileinput = !el.disabled;
|
1490 |
+
},
|
1491 |
+
|
1492 |
+
use_webgl: function() {
|
1493 |
+
var canvas = document.createElement('canvas');
|
1494 |
+
var gl = null, isSupported;
|
1495 |
+
try {
|
1496 |
+
gl = canvas.getContext("webgl") || canvas.getContext("experimental-webgl");
|
1497 |
+
}
|
1498 |
+
catch(e) {}
|
1499 |
+
|
1500 |
+
if (!gl) { // it seems that sometimes it doesn't throw exception, but still fails to get context
|
1501 |
+
gl = null;
|
1502 |
+
}
|
1503 |
+
|
1504 |
+
isSupported = !!gl;
|
1505 |
+
caps.use_webgl = isSupported; // save result of our check
|
1506 |
+
canvas = undefined;
|
1507 |
+
return isSupported;
|
1508 |
+
}
|
1509 |
+
};
|
1510 |
+
|
1511 |
+
return function(cap) {
|
1512 |
+
var args = [].slice.call(arguments);
|
1513 |
+
args.shift(); // shift of cap
|
1514 |
+
return Basic.typeOf(caps[cap]) === 'function' ? caps[cap].apply(this, args) : !!caps[cap];
|
1515 |
+
};
|
1516 |
+
}());
|
1517 |
+
|
1518 |
+
|
1519 |
+
var uaResult = new UAParser().getResult();
|
1520 |
+
|
1521 |
+
|
1522 |
+
var Env = {
|
1523 |
+
can: can,
|
1524 |
+
|
1525 |
+
uaParser: UAParser,
|
1526 |
+
|
1527 |
+
browser: uaResult.browser.name,
|
1528 |
+
version: uaResult.browser.version,
|
1529 |
+
os: uaResult.os.name, // everybody intuitively types it in a lowercase for some reason
|
1530 |
+
osVersion: uaResult.os.version,
|
1531 |
+
|
1532 |
+
verComp: version_compare,
|
1533 |
+
|
1534 |
+
swf_url: "../flash/Moxie.swf",
|
1535 |
+
xap_url: "../silverlight/Moxie.xap",
|
1536 |
+
global_event_dispatcher: "moxie.core.EventTarget.instance.dispatchEvent"
|
1537 |
+
};
|
1538 |
+
|
1539 |
+
// for backward compatibility
|
1540 |
+
// @deprecated Use `Env.os` instead
|
1541 |
+
Env.OS = Env.os;
|
1542 |
+
|
1543 |
+
if (MXI_DEBUG) {
|
1544 |
+
Env.debug = {
|
1545 |
+
runtime: true,
|
1546 |
+
events: false
|
1547 |
+
};
|
1548 |
+
|
1549 |
+
Env.log = function() {
|
1550 |
+
|
1551 |
+
function logObj(data) {
|
1552 |
+
// TODO: this should recursively print out the object in a pretty way
|
1553 |
+
console.appendChild(document.createTextNode(data + "\n"));
|
1554 |
+
}
|
1555 |
+
|
1556 |
+
// if debugger present, IE8 might have window.console.log method, but not be able to apply on it (why...)
|
1557 |
+
if (window && window.console && window.console.log && window.console.log.apply) {
|
1558 |
+
window.console.log.apply(window.console, arguments);
|
1559 |
+
} else if (document) {
|
1560 |
+
var console = document.getElementById('moxie-console');
|
1561 |
+
if (!console) {
|
1562 |
+
console = document.createElement('pre');
|
1563 |
+
console.id = 'moxie-console';
|
1564 |
+
//console.style.display = 'none';
|
1565 |
+
document.body.appendChild(console);
|
1566 |
+
}
|
1567 |
+
|
1568 |
+
var data = arguments[0];
|
1569 |
+
if (Basic.typeOf(data) === 'string') {
|
1570 |
+
data = Basic.sprintf.apply(this, arguments);
|
1571 |
+
} else if (Basic.inArray(Basic.typeOf(data), ['object', 'array']) !== -1) {
|
1572 |
+
logObj(data);
|
1573 |
+
return;
|
1574 |
+
}
|
1575 |
+
|
1576 |
+
console.appendChild(document.createTextNode(data + "\n"));
|
1577 |
+
}
|
1578 |
+
};
|
1579 |
+
}
|
1580 |
+
|
1581 |
+
return Env;
|
1582 |
+
});
|
1583 |
+
|
1584 |
+
// Included from: src/javascript/core/Exceptions.js
|
1585 |
+
|
1586 |
+
/**
|
1587 |
+
* Exceptions.js
|
1588 |
+
*
|
1589 |
+
* Copyright 2013, Moxiecode Systems AB
|
1590 |
+
* Released under GPL License.
|
1591 |
+
*
|
1592 |
+
* License: http://www.plupload.com/license
|
1593 |
+
* Contributing: http://www.plupload.com/contributing
|
1594 |
+
*/
|
1595 |
+
|
1596 |
+
define('moxie/core/Exceptions', [
|
1597 |
+
'moxie/core/utils/Basic'
|
1598 |
+
], function(Basic) {
|
1599 |
+
|
1600 |
+
function _findKey(obj, value) {
|
1601 |
+
var key;
|
1602 |
+
for (key in obj) {
|
1603 |
+
if (obj[key] === value) {
|
1604 |
+
return key;
|
1605 |
+
}
|
1606 |
+
}
|
1607 |
+
return null;
|
1608 |
+
}
|
1609 |
+
|
1610 |
+
/**
|
1611 |
+
@class moxie/core/Exception
|
1612 |
+
*/
|
1613 |
+
return {
|
1614 |
+
RuntimeError: (function() {
|
1615 |
+
var namecodes = {
|
1616 |
+
NOT_INIT_ERR: 1,
|
1617 |
+
EXCEPTION_ERR: 3,
|
1618 |
+
NOT_SUPPORTED_ERR: 9,
|
1619 |
+
JS_ERR: 4
|
1620 |
+
};
|
1621 |
+
|
1622 |
+
function RuntimeError(code, message) {
|
1623 |
+
this.code = code;
|
1624 |
+
this.name = _findKey(namecodes, code);
|
1625 |
+
this.message = this.name + (message || ": RuntimeError " + this.code);
|
1626 |
+
}
|
1627 |
+
|
1628 |
+
Basic.extend(RuntimeError, namecodes);
|
1629 |
+
RuntimeError.prototype = Error.prototype;
|
1630 |
+
return RuntimeError;
|
1631 |
+
}()),
|
1632 |
+
|
1633 |
+
OperationNotAllowedException: (function() {
|
1634 |
+
|
1635 |
+
function OperationNotAllowedException(code) {
|
1636 |
+
this.code = code;
|
1637 |
+
this.name = 'OperationNotAllowedException';
|
1638 |
+
}
|
1639 |
+
|
1640 |
+
Basic.extend(OperationNotAllowedException, {
|
1641 |
+
NOT_ALLOWED_ERR: 1
|
1642 |
+
});
|
1643 |
+
|
1644 |
+
OperationNotAllowedException.prototype = Error.prototype;
|
1645 |
+
|
1646 |
+
return OperationNotAllowedException;
|
1647 |
+
}()),
|
1648 |
+
|
1649 |
+
ImageError: (function() {
|
1650 |
+
var namecodes = {
|
1651 |
+
WRONG_FORMAT: 1,
|
1652 |
+
MAX_RESOLUTION_ERR: 2,
|
1653 |
+
INVALID_META_ERR: 3
|
1654 |
+
};
|
1655 |
+
|
1656 |
+
function ImageError(code) {
|
1657 |
+
this.code = code;
|
1658 |
+
this.name = _findKey(namecodes, code);
|
1659 |
+
this.message = this.name + ": ImageError " + this.code;
|
1660 |
+
}
|
1661 |
+
|
1662 |
+
Basic.extend(ImageError, namecodes);
|
1663 |
+
ImageError.prototype = Error.prototype;
|
1664 |
+
|
1665 |
+
return ImageError;
|
1666 |
+
}()),
|
1667 |
+
|
1668 |
+
FileException: (function() {
|
1669 |
+
var namecodes = {
|
1670 |
+
NOT_FOUND_ERR: 1,
|
1671 |
+
SECURITY_ERR: 2,
|
1672 |
+
ABORT_ERR: 3,
|
1673 |
+
NOT_READABLE_ERR: 4,
|
1674 |
+
ENCODING_ERR: 5,
|
1675 |
+
NO_MODIFICATION_ALLOWED_ERR: 6,
|
1676 |
+
INVALID_STATE_ERR: 7,
|
1677 |
+
SYNTAX_ERR: 8
|
1678 |
+
};
|
1679 |
+
|
1680 |
+
function FileException(code) {
|
1681 |
+
this.code = code;
|
1682 |
+
this.name = _findKey(namecodes, code);
|
1683 |
+
this.message = this.name + ": FileException " + this.code;
|
1684 |
+
}
|
1685 |
+
|
1686 |
+
Basic.extend(FileException, namecodes);
|
1687 |
+
FileException.prototype = Error.prototype;
|
1688 |
+
return FileException;
|
1689 |
+
}()),
|
1690 |
+
|
1691 |
+
DOMException: (function() {
|
1692 |
+
var namecodes = {
|
1693 |
+
INDEX_SIZE_ERR: 1,
|
1694 |
+
DOMSTRING_SIZE_ERR: 2,
|
1695 |
+
HIERARCHY_REQUEST_ERR: 3,
|
1696 |
+
WRONG_DOCUMENT_ERR: 4,
|
1697 |
+
INVALID_CHARACTER_ERR: 5,
|
1698 |
+
NO_DATA_ALLOWED_ERR: 6,
|
1699 |
+
NO_MODIFICATION_ALLOWED_ERR: 7,
|
1700 |
+
NOT_FOUND_ERR: 8,
|
1701 |
+
NOT_SUPPORTED_ERR: 9,
|
1702 |
+
INUSE_ATTRIBUTE_ERR: 10,
|
1703 |
+
INVALID_STATE_ERR: 11,
|
1704 |
+
SYNTAX_ERR: 12,
|
1705 |
+
INVALID_MODIFICATION_ERR: 13,
|
1706 |
+
NAMESPACE_ERR: 14,
|
1707 |
+
INVALID_ACCESS_ERR: 15,
|
1708 |
+
VALIDATION_ERR: 16,
|
1709 |
+
TYPE_MISMATCH_ERR: 17,
|
1710 |
+
SECURITY_ERR: 18,
|
1711 |
+
NETWORK_ERR: 19,
|
1712 |
+
ABORT_ERR: 20,
|
1713 |
+
URL_MISMATCH_ERR: 21,
|
1714 |
+
QUOTA_EXCEEDED_ERR: 22,
|
1715 |
+
TIMEOUT_ERR: 23,
|
1716 |
+
INVALID_NODE_TYPE_ERR: 24,
|
1717 |
+
DATA_CLONE_ERR: 25
|
1718 |
+
};
|
1719 |
+
|
1720 |
+
function DOMException(code) {
|
1721 |
+
this.code = code;
|
1722 |
+
this.name = _findKey(namecodes, code);
|
1723 |
+
this.message = this.name + ": DOMException " + this.code;
|
1724 |
+
}
|
1725 |
+
|
1726 |
+
Basic.extend(DOMException, namecodes);
|
1727 |
+
DOMException.prototype = Error.prototype;
|
1728 |
+
return DOMException;
|
1729 |
+
}()),
|
1730 |
+
|
1731 |
+
EventException: (function() {
|
1732 |
+
function EventException(code) {
|
1733 |
+
this.code = code;
|
1734 |
+
this.name = 'EventException';
|
1735 |
+
}
|
1736 |
+
|
1737 |
+
Basic.extend(EventException, {
|
1738 |
+
UNSPECIFIED_EVENT_TYPE_ERR: 0
|
1739 |
+
});
|
1740 |
+
|
1741 |
+
EventException.prototype = Error.prototype;
|
1742 |
+
|
1743 |
+
return EventException;
|
1744 |
+
}())
|
1745 |
+
};
|
1746 |
+
});
|
1747 |
+
|
1748 |
+
// Included from: src/javascript/core/utils/Dom.js
|
1749 |
+
|
1750 |
+
/**
|
1751 |
+
* Dom.js
|
1752 |
+
*
|
1753 |
+
* Copyright 2013, Moxiecode Systems AB
|
1754 |
+
* Released under GPL License.
|
1755 |
+
*
|
1756 |
+
* License: http://www.plupload.com/license
|
1757 |
+
* Contributing: http://www.plupload.com/contributing
|
1758 |
+
*/
|
1759 |
+
|
1760 |
+
/**
|
1761 |
+
@class moxie/core/utils/Dom
|
1762 |
+
@public
|
1763 |
+
@static
|
1764 |
+
*/
|
1765 |
+
|
1766 |
+
define('moxie/core/utils/Dom', ['moxie/core/utils/Env'], function(Env) {
|
1767 |
+
|
1768 |
+
/**
|
1769 |
+
Get DOM Element by it's id.
|
1770 |
+
|
1771 |
+
@method get
|
1772 |
+
@param {String} id Identifier of the DOM Element
|
1773 |
+
@return {DOMElement}
|
1774 |
+
*/
|
1775 |
+
var get = function(id) {
|
1776 |
+
if (typeof id !== 'string') {
|
1777 |
+
return id;
|
1778 |
+
}
|
1779 |
+
return document.getElementById(id);
|
1780 |
+
};
|
1781 |
+
|
1782 |
+
/**
|
1783 |
+
Checks if specified DOM element has specified class.
|
1784 |
+
|
1785 |
+
@method hasClass
|
1786 |
+
@static
|
1787 |
+
@param {Object} obj DOM element like object to add handler to.
|
1788 |
+
@param {String} name Class name
|
1789 |
+
*/
|
1790 |
+
var hasClass = function(obj, name) {
|
1791 |
+
if (!obj.className) {
|
1792 |
+
return false;
|
1793 |
+
}
|
1794 |
+
|
1795 |
+
var regExp = new RegExp("(^|\\s+)"+name+"(\\s+|$)");
|
1796 |
+
return regExp.test(obj.className);
|
1797 |
+
};
|
1798 |
+
|
1799 |
+
/**
|
1800 |
+
Adds specified className to specified DOM element.
|
1801 |
+
|
1802 |
+
@method addClass
|
1803 |
+
@static
|
1804 |
+
@param {Object} obj DOM element like object to add handler to.
|
1805 |
+
@param {String} name Class name
|
1806 |
+
*/
|
1807 |
+
var addClass = function(obj, name) {
|
1808 |
+
if (!hasClass(obj, name)) {
|
1809 |
+
obj.className = !obj.className ? name : obj.className.replace(/\s+$/, '') + ' ' + name;
|
1810 |
+
}
|
1811 |
+
};
|
1812 |
+
|
1813 |
+
/**
|
1814 |
+
Removes specified className from specified DOM element.
|
1815 |
+
|
1816 |
+
@method removeClass
|
1817 |
+
@static
|
1818 |
+
@param {Object} obj DOM element like object to add handler to.
|
1819 |
+
@param {String} name Class name
|
1820 |
+
*/
|
1821 |
+
var removeClass = function(obj, name) {
|
1822 |
+
if (obj.className) {
|
1823 |
+
var regExp = new RegExp("(^|\\s+)"+name+"(\\s+|$)");
|
1824 |
+
obj.className = obj.className.replace(regExp, function($0, $1, $2) {
|
1825 |
+
return $1 === ' ' && $2 === ' ' ? ' ' : '';
|
1826 |
+
});
|
1827 |
+
}
|
1828 |
+
};
|
1829 |
+
|
1830 |
+
/**
|
1831 |
+
Returns a given computed style of a DOM element.
|
1832 |
+
|
1833 |
+
@method getStyle
|
1834 |
+
@static
|
1835 |
+
@param {Object} obj DOM element like object.
|
1836 |
+
@param {String} name Style you want to get from the DOM element
|
1837 |
+
*/
|
1838 |
+
var getStyle = function(obj, name) {
|
1839 |
+
if (obj.currentStyle) {
|
1840 |
+
return obj.currentStyle[name];
|
1841 |
+
} else if (window.getComputedStyle) {
|
1842 |
+
return window.getComputedStyle(obj, null)[name];
|
1843 |
+
}
|
1844 |
+
};
|
1845 |
+
|
1846 |
+
|
1847 |
+
/**
|
1848 |
+
Returns the absolute x, y position of an Element. The position will be returned in a object with x, y fields.
|
1849 |
+
|
1850 |
+
@method getPos
|
1851 |
+
@static
|
1852 |
+
@param {Element} node HTML element or element id to get x, y position from.
|
1853 |
+
@param {Element} root Optional root element to stop calculations at.
|
1854 |
+
@return {object} Absolute position of the specified element object with x, y fields.
|
1855 |
+
*/
|
1856 |
+
var getPos = function(node, root) {
|
1857 |
+
var x = 0, y = 0, parent, doc = document, nodeRect, rootRect;
|
1858 |
+
|
1859 |
+
node = node;
|
1860 |
+
root = root || doc.body;
|
1861 |
+
|
1862 |
+
// Returns the x, y cordinate for an element on IE 6 and IE 7
|
1863 |
+
function getIEPos(node) {
|
1864 |
+
var bodyElm, rect, x = 0, y = 0;
|
1865 |
+
|
1866 |
+
if (node) {
|
1867 |
+
rect = node.getBoundingClientRect();
|
1868 |
+
bodyElm = doc.compatMode === "CSS1Compat" ? doc.documentElement : doc.body;
|
1869 |
+
x = rect.left + bodyElm.scrollLeft;
|
1870 |
+
y = rect.top + bodyElm.scrollTop;
|
1871 |
+
}
|
1872 |
+
|
1873 |
+
return {
|
1874 |
+
x : x,
|
1875 |
+
y : y
|
1876 |
+
};
|
1877 |
+
}
|
1878 |
+
|
1879 |
+
// Use getBoundingClientRect on IE 6 and IE 7 but not on IE 8 in standards mode
|
1880 |
+
if (node && node.getBoundingClientRect && Env.browser === 'IE' && (!doc.documentMode || doc.documentMode < 8)) {
|
1881 |
+
nodeRect = getIEPos(node);
|
1882 |
+
rootRect = getIEPos(root);
|
1883 |
+
|
1884 |
+
return {
|
1885 |
+
x : nodeRect.x - rootRect.x,
|
1886 |
+
y : nodeRect.y - rootRect.y
|
1887 |
+
};
|
1888 |
+
}
|
1889 |
+
|
1890 |
+
parent = node;
|
1891 |
+
while (parent && parent != root && parent.nodeType) {
|
1892 |
+
x += parent.offsetLeft || 0;
|
1893 |
+
y += parent.offsetTop || 0;
|
1894 |
+
parent = parent.offsetParent;
|
1895 |
+
}
|
1896 |
+
|
1897 |
+
parent = node.parentNode;
|
1898 |
+
while (parent && parent != root && parent.nodeType) {
|
1899 |
+
x -= parent.scrollLeft || 0;
|
1900 |
+
y -= parent.scrollTop || 0;
|
1901 |
+
parent = parent.parentNode;
|
1902 |
+
}
|
1903 |
+
|
1904 |
+
return {
|
1905 |
+
x : x,
|
1906 |
+
y : y
|
1907 |
+
};
|
1908 |
+
};
|
1909 |
+
|
1910 |
+
/**
|
1911 |
+
Returns the size of the specified node in pixels.
|
1912 |
+
|
1913 |
+
@method getSize
|
1914 |
+
@static
|
1915 |
+
@param {Node} node Node to get the size of.
|
1916 |
+
@return {Object} Object with a w and h property.
|
1917 |
+
*/
|
1918 |
+
var getSize = function(node) {
|
1919 |
+
return {
|
1920 |
+
w : node.offsetWidth || node.clientWidth,
|
1921 |
+
h : node.offsetHeight || node.clientHeight
|
1922 |
+
};
|
1923 |
+
};
|
1924 |
+
|
1925 |
+
return {
|
1926 |
+
get: get,
|
1927 |
+
hasClass: hasClass,
|
1928 |
+
addClass: addClass,
|
1929 |
+
removeClass: removeClass,
|
1930 |
+
getStyle: getStyle,
|
1931 |
+
getPos: getPos,
|
1932 |
+
getSize: getSize
|
1933 |
+
};
|
1934 |
+
});
|
1935 |
+
|
1936 |
+
// Included from: src/javascript/core/EventTarget.js
|
1937 |
+
|
1938 |
+
/**
|
1939 |
+
* EventTarget.js
|
1940 |
+
*
|
1941 |
+
* Copyright 2013, Moxiecode Systems AB
|
1942 |
+
* Released under GPL License.
|
1943 |
+
*
|
1944 |
+
* License: http://www.plupload.com/license
|
1945 |
+
* Contributing: http://www.plupload.com/contributing
|
1946 |
+
*/
|
1947 |
+
|
1948 |
+
define('moxie/core/EventTarget', [
|
1949 |
+
'moxie/core/utils/Env',
|
1950 |
+
'moxie/core/Exceptions',
|
1951 |
+
'moxie/core/utils/Basic'
|
1952 |
+
], function(Env, x, Basic) {
|
1953 |
+
|
1954 |
+
// hash of event listeners by object uid
|
1955 |
+
var eventpool = {};
|
1956 |
+
|
1957 |
+
/**
|
1958 |
+
Parent object for all event dispatching components and objects
|
1959 |
+
|
1960 |
+
@class moxie/core/EventTarget
|
1961 |
+
@constructor EventTarget
|
1962 |
+
*/
|
1963 |
+
function EventTarget() {
|
1964 |
+
/**
|
1965 |
+
Unique id of the event dispatcher, usually overriden by children
|
1966 |
+
|
1967 |
+
@property uid
|
1968 |
+
@type String
|
1969 |
+
*/
|
1970 |
+
this.uid = Basic.guid();
|
1971 |
+
}
|
1972 |
+
|
1973 |
+
|
1974 |
+
Basic.extend(EventTarget.prototype, {
|
1975 |
+
|
1976 |
+
/**
|
1977 |
+
Can be called from within a child in order to acquire uniqie id in automated manner
|
1978 |
+
|
1979 |
+
@method init
|
1980 |
+
*/
|
1981 |
+
init: function() {
|
1982 |
+
if (!this.uid) {
|
1983 |
+
this.uid = Basic.guid('uid_');
|
1984 |
+
}
|
1985 |
+
},
|
1986 |
+
|
1987 |
+
/**
|
1988 |
+
Register a handler to a specific event dispatched by the object
|
1989 |
+
|
1990 |
+
@method addEventListener
|
1991 |
+
@param {String} type Type or basically a name of the event to subscribe to
|
1992 |
+
@param {Function} fn Callback function that will be called when event happens
|
1993 |
+
@param {Number} [priority=0] Priority of the event handler - handlers with higher priorities will be called first
|
1994 |
+
@param {Object} [scope=this] A scope to invoke event handler in
|
1995 |
+
*/
|
1996 |
+
addEventListener: function(type, fn, priority, scope) {
|
1997 |
+
var self = this, list;
|
1998 |
+
|
1999 |
+
// without uid no event handlers can be added, so make sure we got one
|
2000 |
+
if (!this.hasOwnProperty('uid')) {
|
2001 |
+
this.uid = Basic.guid('uid_');
|
2002 |
+
}
|
2003 |
+
|
2004 |
+
type = Basic.trim(type);
|
2005 |
+
|
2006 |
+
if (/\s/.test(type)) {
|
2007 |
+
// multiple event types were passed for one handler
|
2008 |
+
Basic.each(type.split(/\s+/), function(type) {
|
2009 |
+
self.addEventListener(type, fn, priority, scope);
|
2010 |
+
});
|
2011 |
+
return;
|
2012 |
+
}
|
2013 |
+
|
2014 |
+
type = type.toLowerCase();
|
2015 |
+
priority = parseInt(priority, 10) || 0;
|
2016 |
+
|
2017 |
+
list = eventpool[this.uid] && eventpool[this.uid][type] || [];
|
2018 |
+
list.push({fn : fn, priority : priority, scope : scope || this});
|
2019 |
+
|
2020 |
+
if (!eventpool[this.uid]) {
|
2021 |
+
eventpool[this.uid] = {};
|
2022 |
+
}
|
2023 |
+
eventpool[this.uid][type] = list;
|
2024 |
+
},
|
2025 |
+
|
2026 |
+
/**
|
2027 |
+
Check if any handlers were registered to the specified event
|
2028 |
+
|
2029 |
+
@method hasEventListener
|
2030 |
+
@param {String} [type] Type or basically a name of the event to check
|
2031 |
+
@return {Mixed} Returns a handler if it was found and false, if - not
|
2032 |
+
*/
|
2033 |
+
hasEventListener: function(type) {
|
2034 |
+
var list;
|
2035 |
+
if (type) {
|
2036 |
+
type = type.toLowerCase();
|
2037 |
+
list = eventpool[this.uid] && eventpool[this.uid][type];
|
2038 |
+
} else {
|
2039 |
+
list = eventpool[this.uid];
|
2040 |
+
}
|
2041 |
+
return list ? list : false;
|
2042 |
+
},
|
2043 |
+
|
2044 |
+
/**
|
2045 |
+
Unregister the handler from the event, or if former was not specified - unregister all handlers
|
2046 |
+
|
2047 |
+
@method removeEventListener
|
2048 |
+
@param {String} type Type or basically a name of the event
|
2049 |
+
@param {Function} [fn] Handler to unregister
|
2050 |
+
*/
|
2051 |
+
removeEventListener: function(type, fn) {
|
2052 |
+
var self = this, list, i;
|
2053 |
+
|
2054 |
+
type = type.toLowerCase();
|
2055 |
+
|
2056 |
+
if (/\s/.test(type)) {
|
2057 |
+
// multiple event types were passed for one handler
|
2058 |
+
Basic.each(type.split(/\s+/), function(type) {
|
2059 |
+
self.removeEventListener(type, fn);
|
2060 |
+
});
|
2061 |
+
return;
|
2062 |
+
}
|
2063 |
+
|
2064 |
+
list = eventpool[this.uid] && eventpool[this.uid][type];
|
2065 |
+
|
2066 |
+
if (list) {
|
2067 |
+
if (fn) {
|
2068 |
+
for (i = list.length - 1; i >= 0; i--) {
|
2069 |
+
if (list[i].fn === fn) {
|
2070 |
+
list.splice(i, 1);
|
2071 |
+
break;
|
2072 |
+
}
|
2073 |
+
}
|
2074 |
+
} else {
|
2075 |
+
list = [];
|
2076 |
+
}
|
2077 |
+
|
2078 |
+
// delete event list if it has become empty
|
2079 |
+
if (!list.length) {
|
2080 |
+
delete eventpool[this.uid][type];
|
2081 |
+
|
2082 |
+
// and object specific entry in a hash if it has no more listeners attached
|
2083 |
+
if (Basic.isEmptyObj(eventpool[this.uid])) {
|
2084 |
+
delete eventpool[this.uid];
|
2085 |
+
}
|
2086 |
+
}
|
2087 |
+
}
|
2088 |
+
},
|
2089 |
+
|
2090 |
+
/**
|
2091 |
+
Remove all event handlers from the object
|
2092 |
+
|
2093 |
+
@method removeAllEventListeners
|
2094 |
+
*/
|
2095 |
+
removeAllEventListeners: function() {
|
2096 |
+
if (eventpool[this.uid]) {
|
2097 |
+
delete eventpool[this.uid];
|
2098 |
+
}
|
2099 |
+
},
|
2100 |
+
|
2101 |
+
/**
|
2102 |
+
Dispatch the event
|
2103 |
+
|
2104 |
+
@method dispatchEvent
|
2105 |
+
@param {String/Object} Type of event or event object to dispatch
|
2106 |
+
@param {Mixed} [...] Variable number of arguments to be passed to a handlers
|
2107 |
+
@return {Boolean} true by default and false if any handler returned false
|
2108 |
+
*/
|
2109 |
+
dispatchEvent: function(type) {
|
2110 |
+
var uid, list, args, tmpEvt, evt = {}, result = true, undef;
|
2111 |
+
|
2112 |
+
if (Basic.typeOf(type) !== 'string') {
|
2113 |
+
// we can't use original object directly (because of Silverlight)
|
2114 |
+
tmpEvt = type;
|
2115 |
+
|
2116 |
+
if (Basic.typeOf(tmpEvt.type) === 'string') {
|
2117 |
+
type = tmpEvt.type;
|
2118 |
+
|
2119 |
+
if (tmpEvt.total !== undef && tmpEvt.loaded !== undef) { // progress event
|
2120 |
+
evt.total = tmpEvt.total;
|
2121 |
+
evt.loaded = tmpEvt.loaded;
|
2122 |
+
}
|
2123 |
+
evt.async = tmpEvt.async || false;
|
2124 |
+
} else {
|
2125 |
+
throw new x.EventException(x.EventException.UNSPECIFIED_EVENT_TYPE_ERR);
|
2126 |
+
}
|
2127 |
+
}
|
2128 |
+
|
2129 |
+
// check if event is meant to be dispatched on an object having specific uid
|
2130 |
+
if (type.indexOf('::') !== -1) {
|
2131 |
+
(function(arr) {
|
2132 |
+
uid = arr[0];
|
2133 |
+
type = arr[1];
|
2134 |
+
}(type.split('::')));
|
2135 |
+
} else {
|
2136 |
+
uid = this.uid;
|
2137 |
+
}
|
2138 |
+
|
2139 |
+
type = type.toLowerCase();
|
2140 |
+
|
2141 |
+
list = eventpool[uid] && eventpool[uid][type];
|
2142 |
+
|
2143 |
+
if (list) {
|
2144 |
+
// sort event list by prority
|
2145 |
+
list.sort(function(a, b) { return b.priority - a.priority; });
|
2146 |
+
|
2147 |
+
args = [].slice.call(arguments);
|
2148 |
+
|
2149 |
+
// first argument will be pseudo-event object
|
2150 |
+
args.shift();
|
2151 |
+
evt.type = type;
|
2152 |
+
args.unshift(evt);
|
2153 |
+
|
2154 |
+
if (MXI_DEBUG && Env.debug.events) {
|
2155 |
+
Env.log("%cEvent '%s' fired on %s", 'color: #999;', evt.type, (this.ctorName ? this.ctorName + '::' : '') + uid);
|
2156 |
+
}
|
2157 |
+
|
2158 |
+
// Dispatch event to all listeners
|
2159 |
+
var queue = [];
|
2160 |
+
Basic.each(list, function(handler) {
|
2161 |
+
// explicitly set the target, otherwise events fired from shims do not get it
|
2162 |
+
args[0].target = handler.scope;
|
2163 |
+
// if event is marked as async, detach the handler
|
2164 |
+
if (evt.async) {
|
2165 |
+
queue.push(function(cb) {
|
2166 |
+
setTimeout(function() {
|
2167 |
+
cb(handler.fn.apply(handler.scope, args) === false);
|
2168 |
+
}, 1);
|
2169 |
+
});
|
2170 |
+
} else {
|
2171 |
+
queue.push(function(cb) {
|
2172 |
+
cb(handler.fn.apply(handler.scope, args) === false); // if handler returns false stop propagation
|
2173 |
+
});
|
2174 |
+
}
|
2175 |
+
});
|
2176 |
+
if (queue.length) {
|
2177 |
+
Basic.inSeries(queue, function(err) {
|
2178 |
+
result = !err;
|
2179 |
+
});
|
2180 |
+
}
|
2181 |
+
}
|
2182 |
+
return result;
|
2183 |
+
},
|
2184 |
+
|
2185 |
+
/**
|
2186 |
+
Register a handler to the event type that will run only once
|
2187 |
+
|
2188 |
+
@method bindOnce
|
2189 |
+
@since >1.4.1
|
2190 |
+
@param {String} type Type or basically a name of the event to subscribe to
|
2191 |
+
@param {Function} fn Callback function that will be called when event happens
|
2192 |
+
@param {Number} [priority=0] Priority of the event handler - handlers with higher priorities will be called first
|
2193 |
+
@param {Object} [scope=this] A scope to invoke event handler in
|
2194 |
+
*/
|
2195 |
+
bindOnce: function(type, fn, priority, scope) {
|
2196 |
+
var self = this;
|
2197 |
+
self.bind.call(this, type, function cb() {
|
2198 |
+
self.unbind(type, cb);
|
2199 |
+
return fn.apply(this, arguments);
|
2200 |
+
}, priority, scope);
|
2201 |
+
},
|
2202 |
+
|
2203 |
+
/**
|
2204 |
+
Alias for addEventListener
|
2205 |
+
|
2206 |
+
@method bind
|
2207 |
+
@protected
|
2208 |
+
*/
|
2209 |
+
bind: function() {
|
2210 |
+
this.addEventListener.apply(this, arguments);
|
2211 |
+
},
|
2212 |
+
|
2213 |
+
/**
|
2214 |
+
Alias for removeEventListener
|
2215 |
+
|
2216 |
+
@method unbind
|
2217 |
+
@protected
|
2218 |
+
*/
|
2219 |
+
unbind: function() {
|
2220 |
+
this.removeEventListener.apply(this, arguments);
|
2221 |
+
},
|
2222 |
+
|
2223 |
+
/**
|
2224 |
+
Alias for removeAllEventListeners
|
2225 |
+
|
2226 |
+
@method unbindAll
|
2227 |
+
@protected
|
2228 |
+
*/
|
2229 |
+
unbindAll: function() {
|
2230 |
+
this.removeAllEventListeners.apply(this, arguments);
|
2231 |
+
},
|
2232 |
+
|
2233 |
+
/**
|
2234 |
+
Alias for dispatchEvent
|
2235 |
+
|
2236 |
+
@method trigger
|
2237 |
+
@protected
|
2238 |
+
*/
|
2239 |
+
trigger: function() {
|
2240 |
+
return this.dispatchEvent.apply(this, arguments);
|
2241 |
+
},
|
2242 |
+
|
2243 |
+
|
2244 |
+
/**
|
2245 |
+
Handle properties of on[event] type.
|
2246 |
+
|
2247 |
+
@method handleEventProps
|
2248 |
+
@private
|
2249 |
+
*/
|
2250 |
+
handleEventProps: function(dispatches) {
|
2251 |
+
var self = this;
|
2252 |
+
|
2253 |
+
this.bind(dispatches.join(' '), function(e) {
|
2254 |
+
var prop = 'on' + e.type.toLowerCase();
|
2255 |
+
if (Basic.typeOf(this[prop]) === 'function') {
|
2256 |
+
this[prop].apply(this, arguments);
|
2257 |
+
}
|
2258 |
+
});
|
2259 |
+
|
2260 |
+
// object must have defined event properties, even if it doesn't make use of them
|
2261 |
+
Basic.each(dispatches, function(prop) {
|
2262 |
+
prop = 'on' + prop.toLowerCase(prop);
|
2263 |
+
if (Basic.typeOf(self[prop]) === 'undefined') {
|
2264 |
+
self[prop] = null;
|
2265 |
+
}
|
2266 |
+
});
|
2267 |
+
}
|
2268 |
+
|
2269 |
+
});
|
2270 |
+
|
2271 |
+
|
2272 |
+
EventTarget.instance = new EventTarget();
|
2273 |
+
|
2274 |
+
return EventTarget;
|
2275 |
+
});
|
2276 |
+
|
2277 |
+
// Included from: src/javascript/runtime/Runtime.js
|
2278 |
+
|
2279 |
+
/**
|
2280 |
+
* Runtime.js
|
2281 |
+
*
|
2282 |
+
* Copyright 2013, Moxiecode Systems AB
|
2283 |
+
* Released under GPL License.
|
2284 |
+
*
|
2285 |
+
* License: http://www.plupload.com/license
|
2286 |
+
* Contributing: http://www.plupload.com/contributing
|
2287 |
+
*/
|
2288 |
+
|
2289 |
+
define('moxie/runtime/Runtime', [
|
2290 |
+
"moxie/core/utils/Env",
|
2291 |
+
"moxie/core/utils/Basic",
|
2292 |
+
"moxie/core/utils/Dom",
|
2293 |
+
"moxie/core/EventTarget"
|
2294 |
+
], function(Env, Basic, Dom, EventTarget) {
|
2295 |
+
var runtimeConstructors = {}, runtimes = {};
|
2296 |
+
|
2297 |
+
/**
|
2298 |
+
Common set of methods and properties for every runtime instance
|
2299 |
+
|
2300 |
+
@class moxie/runtime/Runtime
|
2301 |
+
|
2302 |
+
@param {Object} options
|
2303 |
+
@param {String} type Sanitized name of the runtime
|
2304 |
+
@param {Object} [caps] Set of capabilities that differentiate specified runtime
|
2305 |
+
@param {Object} [modeCaps] Set of capabilities that do require specific operational mode
|
2306 |
+
@param {String} [preferredMode='browser'] Preferred operational mode to choose if no required capabilities were requested
|
2307 |
+
*/
|
2308 |
+
function Runtime(options, type, caps, modeCaps, preferredMode) {
|
2309 |
+
/**
|
2310 |
+
Dispatched when runtime is initialized and ready.
|
2311 |
+
Results in RuntimeInit on a connected component.
|
2312 |
+
|
2313 |
+
@event Init
|
2314 |
+
*/
|
2315 |
+
|
2316 |
+
/**
|
2317 |
+
Dispatched when runtime fails to initialize.
|
2318 |
+
Results in RuntimeError on a connected component.
|
2319 |
+
|
2320 |
+
@event Error
|
2321 |
+
*/
|
2322 |
+
|
2323 |
+
var self = this
|
2324 |
+
, _shim
|
2325 |
+
, _uid = Basic.guid(type + '_')
|
2326 |
+
, defaultMode = preferredMode || 'browser'
|
2327 |
+
;
|
2328 |
+
|
2329 |
+
options = options || {};
|
2330 |
+
|
2331 |
+
// register runtime in private hash
|
2332 |
+
runtimes[_uid] = this;
|
2333 |
+
|
2334 |
+
/**
|
2335 |
+
Default set of capabilities, which can be redifined later by specific runtime
|
2336 |
+
|
2337 |
+
@private
|
2338 |
+
@property caps
|
2339 |
+
@type Object
|
2340 |
+
*/
|
2341 |
+
caps = Basic.extend({
|
2342 |
+
// Runtime can:
|
2343 |
+
// provide access to raw binary data of the file
|
2344 |
+
access_binary: false,
|
2345 |
+
// provide access to raw binary data of the image (image extension is optional)
|
2346 |
+
access_image_binary: false,
|
2347 |
+
// display binary data as thumbs for example
|
2348 |
+
display_media: false,
|
2349 |
+
// make cross-domain requests
|
2350 |
+
do_cors: false,
|
2351 |
+
// accept files dragged and dropped from the desktop
|
2352 |
+
drag_and_drop: false,
|
2353 |
+
// filter files in selection dialog by their extensions
|
2354 |
+
filter_by_extension: true,
|
2355 |
+
// resize image (and manipulate it raw data of any file in general)
|
2356 |
+
resize_image: false,
|
2357 |
+
// periodically report how many bytes of total in the file were uploaded (loaded)
|
2358 |
+
report_upload_progress: false,
|
2359 |
+
// provide access to the headers of http response
|
2360 |
+
return_response_headers: false,
|
2361 |
+
// support response of specific type, which should be passed as an argument
|
2362 |
+
// e.g. runtime.can('return_response_type', 'blob')
|
2363 |
+
return_response_type: false,
|
2364 |
+
// return http status code of the response
|
2365 |
+
return_status_code: true,
|
2366 |
+
// send custom http header with the request
|
2367 |
+
send_custom_headers: false,
|
2368 |
+
// pick up the files from a dialog
|
2369 |
+
select_file: false,
|
2370 |
+
// select whole folder in file browse dialog
|
2371 |
+
select_folder: false,
|
2372 |
+
// select multiple files at once in file browse dialog
|
2373 |
+
select_multiple: true,
|
2374 |
+
// send raw binary data, that is generated after image resizing or manipulation of other kind
|
2375 |
+
send_binary_string: false,
|
2376 |
+
// send cookies with http request and therefore retain session
|
2377 |
+
send_browser_cookies: true,
|
2378 |
+
// send data formatted as multipart/form-data
|
2379 |
+
send_multipart: true,
|
2380 |
+
// slice the file or blob to smaller parts
|
2381 |
+
slice_blob: false,
|
2382 |
+
// upload file without preloading it to memory, stream it out directly from disk
|
2383 |
+
stream_upload: false,
|
2384 |
+
// programmatically trigger file browse dialog
|
2385 |
+
summon_file_dialog: false,
|
2386 |
+
// upload file of specific size, size should be passed as argument
|
2387 |
+
// e.g. runtime.can('upload_filesize', '500mb')
|
2388 |
+
upload_filesize: true,
|
2389 |
+
// initiate http request with specific http method, method should be passed as argument
|
2390 |
+
// e.g. runtime.can('use_http_method', 'put')
|
2391 |
+
use_http_method: true
|
2392 |
+
}, caps);
|
2393 |
+
|
2394 |
+
|
2395 |
+
// default to the mode that is compatible with preferred caps
|
2396 |
+
if (options.preferred_caps) {
|
2397 |
+
defaultMode = Runtime.getMode(modeCaps, options.preferred_caps, defaultMode);
|
2398 |
+
}
|
2399 |
+
|
2400 |
+
if (MXI_DEBUG && Env.debug.runtime) {
|
2401 |
+
Env.log("\tdefault mode: %s", defaultMode);
|
2402 |
+
}
|
2403 |
+
|
2404 |
+
// small extension factory here (is meant to be extended with actual extensions constructors)
|
2405 |
+
_shim = (function() {
|
2406 |
+
var objpool = {};
|
2407 |
+
return {
|
2408 |
+
exec: function(uid, comp, fn, args) {
|
2409 |
+
if (_shim[comp]) {
|
2410 |
+
if (!objpool[uid]) {
|
2411 |
+
objpool[uid] = {
|
2412 |
+
context: this,
|
2413 |
+
instance: new _shim[comp]()
|
2414 |
+
};
|
2415 |
+
}
|
2416 |
+
if (objpool[uid].instance[fn]) {
|
2417 |
+
return objpool[uid].instance[fn].apply(this, args);
|
2418 |
+
}
|
2419 |
+
}
|
2420 |
+
},
|
2421 |
+
|
2422 |
+
removeInstance: function(uid) {
|
2423 |
+
delete objpool[uid];
|
2424 |
+
},
|
2425 |
+
|
2426 |
+
removeAllInstances: function() {
|
2427 |
+
var self = this;
|
2428 |
+
Basic.each(objpool, function(obj, uid) {
|
2429 |
+
if (Basic.typeOf(obj.instance.destroy) === 'function') {
|
2430 |
+
obj.instance.destroy.call(obj.context);
|
2431 |
+
}
|
2432 |
+
self.removeInstance(uid);
|
2433 |
+
});
|
2434 |
+
}
|
2435 |
+
};
|
2436 |
+
}());
|
2437 |
+
|
2438 |
+
|
2439 |
+
// public methods
|
2440 |
+
Basic.extend(this, {
|
2441 |
+
/**
|
2442 |
+
Specifies whether runtime instance was initialized or not
|
2443 |
+
|
2444 |
+
@property initialized
|
2445 |
+
@type {Boolean}
|
2446 |
+
@default false
|
2447 |
+
*/
|
2448 |
+
initialized: false, // shims require this flag to stop initialization retries
|
2449 |
+
|
2450 |
+
/**
|
2451 |
+
Unique ID of the runtime
|
2452 |
+
|
2453 |
+
@property uid
|
2454 |
+
@type {String}
|
2455 |
+
*/
|
2456 |
+
uid: _uid,
|
2457 |
+
|
2458 |
+
/**
|
2459 |
+
Runtime type (e.g. flash, html5, etc)
|
2460 |
+
|
2461 |
+
@property type
|
2462 |
+
@type {String}
|
2463 |
+
*/
|
2464 |
+
type: type,
|
2465 |
+
|
2466 |
+
/**
|
2467 |
+
Runtime (not native one) may operate in browser or client mode.
|
2468 |
+
|
2469 |
+
@property mode
|
2470 |
+
@private
|
2471 |
+
@type {String|Boolean} current mode or false, if none possible
|
2472 |
+
*/
|
2473 |
+
mode: Runtime.getMode(modeCaps, (options.required_caps), defaultMode),
|
2474 |
+
|
2475 |
+
/**
|
2476 |
+
id of the DOM container for the runtime (if available)
|
2477 |
+
|
2478 |
+
@property shimid
|
2479 |
+
@type {String}
|
2480 |
+
*/
|
2481 |
+
shimid: _uid + '_container',
|
2482 |
+
|
2483 |
+
/**
|
2484 |
+
Number of connected clients. If equal to zero, runtime can be destroyed
|
2485 |
+
|
2486 |
+
@property clients
|
2487 |
+
@type {Number}
|
2488 |
+
*/
|
2489 |
+
clients: 0,
|
2490 |
+
|
2491 |
+
/**
|
2492 |
+
Runtime initialization options
|
2493 |
+
|
2494 |
+
@property options
|
2495 |
+
@type {Object}
|
2496 |
+
*/
|
2497 |
+
options: options,
|
2498 |
+
|
2499 |
+
/**
|
2500 |
+
Checks if the runtime has specific capability
|
2501 |
+
|
2502 |
+
@method can
|
2503 |
+
@param {String} cap Name of capability to check
|
2504 |
+
@param {Mixed} [value] If passed, capability should somehow correlate to the value
|
2505 |
+
@param {Object} [refCaps] Set of capabilities to check the specified cap against (defaults to internal set)
|
2506 |
+
@return {Boolean} true if runtime has such capability and false, if - not
|
2507 |
+
*/
|
2508 |
+
can: function(cap, value) {
|
2509 |
+
var refCaps = arguments[2] || caps;
|
2510 |
+
|
2511 |
+
// if cap var is a comma-separated list of caps, convert it to object (key/value)
|
2512 |
+
if (Basic.typeOf(cap) === 'string' && Basic.typeOf(value) === 'undefined') {
|
2513 |
+
cap = Runtime.parseCaps(cap);
|
2514 |
+
}
|
2515 |
+
|
2516 |
+
if (Basic.typeOf(cap) === 'object') {
|
2517 |
+
for (var key in cap) {
|
2518 |
+
if (!this.can(key, cap[key], refCaps)) {
|
2519 |
+
return false;
|
2520 |
+
}
|
2521 |
+
}
|
2522 |
+
return true;
|
2523 |
+
}
|
2524 |
+
|
2525 |
+
// check the individual cap
|
2526 |
+
if (Basic.typeOf(refCaps[cap]) === 'function') {
|
2527 |
+
return refCaps[cap].call(this, value);
|
2528 |
+
} else {
|
2529 |
+
return (value === refCaps[cap]);
|
2530 |
+
}
|
2531 |
+
},
|
2532 |
+
|
2533 |
+
/**
|
2534 |
+
Returns container for the runtime as DOM element
|
2535 |
+
|
2536 |
+
@method getShimContainer
|
2537 |
+
@return {DOMElement}
|
2538 |
+
*/
|
2539 |
+
getShimContainer: function() {
|
2540 |
+
var container, shimContainer = Dom.get(this.shimid);
|
2541 |
+
|
2542 |
+
// if no container for shim, create one
|
2543 |
+
if (!shimContainer) {
|
2544 |
+
container = Dom.get(this.options.container) || document.body;
|
2545 |
+
|
2546 |
+
// create shim container and insert it at an absolute position into the outer container
|
2547 |
+
shimContainer = document.createElement('div');
|
2548 |
+
shimContainer.id = this.shimid;
|
2549 |
+
shimContainer.className = 'moxie-shim moxie-shim-' + this.type;
|
2550 |
+
|
2551 |
+
Basic.extend(shimContainer.style, {
|
2552 |
+
position: 'absolute',
|
2553 |
+
top: '0px',
|
2554 |
+
left: '0px',
|
2555 |
+
width: '1px',
|
2556 |
+
height: '1px',
|
2557 |
+
overflow: 'hidden'
|
2558 |
+
});
|
2559 |
+
|
2560 |
+
container.appendChild(shimContainer);
|
2561 |
+
container = null;
|
2562 |
+
}
|
2563 |
+
|
2564 |
+
return shimContainer;
|
2565 |
+
},
|
2566 |
+
|
2567 |
+
/**
|
2568 |
+
Returns runtime as DOM element (if appropriate)
|
2569 |
+
|
2570 |
+
@method getShim
|
2571 |
+
@return {DOMElement}
|
2572 |
+
*/
|
2573 |
+
getShim: function() {
|
2574 |
+
return _shim;
|
2575 |
+
},
|
2576 |
+
|
2577 |
+
/**
|
2578 |
+
Invokes a method within the runtime itself (might differ across the runtimes)
|
2579 |
+
|
2580 |
+
@method shimExec
|
2581 |
+
@param {Mixed} []
|
2582 |
+
@protected
|
2583 |
+
@return {Mixed} Depends on the action and component
|
2584 |
+
*/
|
2585 |
+
shimExec: function(component, action) {
|
2586 |
+
var args = [].slice.call(arguments, 2);
|
2587 |
+
return self.getShim().exec.call(this, this.uid, component, action, args);
|
2588 |
+
},
|
2589 |
+
|
2590 |
+
/**
|
2591 |
+
Operaional interface that is used by components to invoke specific actions on the runtime
|
2592 |
+
(is invoked in the scope of component)
|
2593 |
+
|
2594 |
+
@method exec
|
2595 |
+
@param {Mixed} []*
|
2596 |
+
@protected
|
2597 |
+
@return {Mixed} Depends on the action and component
|
2598 |
+
*/
|
2599 |
+
exec: function(component, action) { // this is called in the context of component, not runtime
|
2600 |
+
var args = [].slice.call(arguments, 2);
|
2601 |
+
|
2602 |
+
if (self[component] && self[component][action]) {
|
2603 |
+
return self[component][action].apply(this, args);
|
2604 |
+
}
|
2605 |
+
return self.shimExec.apply(this, arguments);
|
2606 |
+
},
|
2607 |
+
|
2608 |
+
/**
|
2609 |
+
Destroys the runtime (removes all events and deletes DOM structures)
|
2610 |
+
|
2611 |
+
@method destroy
|
2612 |
+
*/
|
2613 |
+
destroy: function() {
|
2614 |
+
if (!self) {
|
2615 |
+
return; // obviously already destroyed
|
2616 |
+
}
|
2617 |
+
|
2618 |
+
var shimContainer = Dom.get(this.shimid);
|
2619 |
+
if (shimContainer) {
|
2620 |
+
shimContainer.parentNode.removeChild(shimContainer);
|
2621 |
+
}
|
2622 |
+
|
2623 |
+
if (_shim) {
|
2624 |
+
_shim.removeAllInstances();
|
2625 |
+
}
|
2626 |
+
|
2627 |
+
this.unbindAll();
|
2628 |
+
delete runtimes[this.uid];
|
2629 |
+
this.uid = null; // mark this runtime as destroyed
|
2630 |
+
_uid = self = _shim = shimContainer = null;
|
2631 |
+
}
|
2632 |
+
});
|
2633 |
+
|
2634 |
+
// once we got the mode, test against all caps
|
2635 |
+
if (this.mode && options.required_caps && !this.can(options.required_caps)) {
|
2636 |
+
this.mode = false;
|
2637 |
+
}
|
2638 |
+
}
|
2639 |
+
|
2640 |
+
|
2641 |
+
/**
|
2642 |
+
Default order to try different runtime types
|
2643 |
+
|
2644 |
+
@property order
|
2645 |
+
@type String
|
2646 |
+
@static
|
2647 |
+
*/
|
2648 |
+
Runtime.order = 'html5,flash,silverlight,html4';
|
2649 |
+
|
2650 |
+
|
2651 |
+
/**
|
2652 |
+
Retrieves runtime from private hash by it's uid
|
2653 |
+
|
2654 |
+
@method getRuntime
|
2655 |
+
@private
|
2656 |
+
@static
|
2657 |
+
@param {String} uid Unique identifier of the runtime
|
2658 |
+
@return {Runtime|Boolean} Returns runtime, if it exists and false, if - not
|
2659 |
+
*/
|
2660 |
+
Runtime.getRuntime = function(uid) {
|
2661 |
+
return runtimes[uid] ? runtimes[uid] : false;
|
2662 |
+
};
|
2663 |
+
|
2664 |
+
|
2665 |
+
/**
|
2666 |
+
Register constructor for the Runtime of new (or perhaps modified) type
|
2667 |
+
|
2668 |
+
@method addConstructor
|
2669 |
+
@static
|
2670 |
+
@param {String} type Runtime type (e.g. flash, html5, etc)
|
2671 |
+
@param {Function} construct Constructor for the Runtime type
|
2672 |
+
*/
|
2673 |
+
Runtime.addConstructor = function(type, constructor) {
|
2674 |
+
constructor.prototype = EventTarget.instance;
|
2675 |
+
runtimeConstructors[type] = constructor;
|
2676 |
+
};
|
2677 |
+
|
2678 |
+
|
2679 |
+
/**
|
2680 |
+
Get the constructor for the specified type.
|
2681 |
+
|
2682 |
+
method getConstructor
|
2683 |
+
@static
|
2684 |
+
@param {String} type Runtime type (e.g. flash, html5, etc)
|
2685 |
+
@return {Function} Constructor for the Runtime type
|
2686 |
+
*/
|
2687 |
+
Runtime.getConstructor = function(type) {
|
2688 |
+
return runtimeConstructors[type] || null;
|
2689 |
+
};
|
2690 |
+
|
2691 |
+
|
2692 |
+
/**
|
2693 |
+
Get info about the runtime (uid, type, capabilities)
|
2694 |
+
|
2695 |
+
@method getInfo
|
2696 |
+
@static
|
2697 |
+
@param {String} uid Unique identifier of the runtime
|
2698 |
+
@return {Mixed} Info object or null if runtime doesn't exist
|
2699 |
+
*/
|
2700 |
+
Runtime.getInfo = function(uid) {
|
2701 |
+
var runtime = Runtime.getRuntime(uid);
|
2702 |
+
|
2703 |
+
if (runtime) {
|
2704 |
+
return {
|
2705 |
+
uid: runtime.uid,
|
2706 |
+
type: runtime.type,
|
2707 |
+
mode: runtime.mode,
|
2708 |
+
can: function() {
|
2709 |
+
return runtime.can.apply(runtime, arguments);
|
2710 |
+
}
|
2711 |
+
};
|
2712 |
+
}
|
2713 |
+
return null;
|
2714 |
+
};
|
2715 |
+
|
2716 |
+
|
2717 |
+
/**
|
2718 |
+
Convert caps represented by a comma-separated string to the object representation.
|
2719 |
+
|
2720 |
+
@method parseCaps
|
2721 |
+
@static
|
2722 |
+
@param {String} capStr Comma-separated list of capabilities
|
2723 |
+
@return {Object}
|
2724 |
+
*/
|
2725 |
+
Runtime.parseCaps = function(capStr) {
|
2726 |
+
var capObj = {};
|
2727 |
+
|
2728 |
+
if (Basic.typeOf(capStr) !== 'string') {
|
2729 |
+
return capStr || {};
|
2730 |
+
}
|
2731 |
+
|
2732 |
+
Basic.each(capStr.split(','), function(key) {
|
2733 |
+
capObj[key] = true; // we assume it to be - true
|
2734 |
+
});
|
2735 |
+
|
2736 |
+
return capObj;
|
2737 |
+
};
|
2738 |
+
|
2739 |
+
/**
|
2740 |
+
Test the specified runtime for specific capabilities.
|
2741 |
+
|
2742 |
+
@method can
|
2743 |
+
@static
|
2744 |
+
@param {String} type Runtime type (e.g. flash, html5, etc)
|
2745 |
+
@param {String|Object} caps Set of capabilities to check
|
2746 |
+
@return {Boolean} Result of the test
|
2747 |
+
*/
|
2748 |
+
Runtime.can = function(type, caps) {
|
2749 |
+
var runtime
|
2750 |
+
, constructor = Runtime.getConstructor(type)
|
2751 |
+
, mode
|
2752 |
+
;
|
2753 |
+
if (constructor) {
|
2754 |
+
runtime = new constructor({
|
2755 |
+
required_caps: caps
|
2756 |
+
});
|
2757 |
+
mode = runtime.mode;
|
2758 |
+
runtime.destroy();
|
2759 |
+
return !!mode;
|
2760 |
+
}
|
2761 |
+
return false;
|
2762 |
+
};
|
2763 |
+
|
2764 |
+
|
2765 |
+
/**
|
2766 |
+
Figure out a runtime that supports specified capabilities.
|
2767 |
+
|
2768 |
+
@method thatCan
|
2769 |
+
@static
|
2770 |
+
@param {String|Object} caps Set of capabilities to check
|
2771 |
+
@param {String} [runtimeOrder] Comma-separated list of runtimes to check against
|
2772 |
+
@return {String} Usable runtime identifier or null
|
2773 |
+
*/
|
2774 |
+
Runtime.thatCan = function(caps, runtimeOrder) {
|
2775 |
+
var types = (runtimeOrder || Runtime.order).split(/\s*,\s*/);
|
2776 |
+
for (var i in types) {
|
2777 |
+
if (Runtime.can(types[i], caps)) {
|
2778 |
+
return types[i];
|
2779 |
+
}
|
2780 |
+
}
|
2781 |
+
return null;
|
2782 |
+
};
|
2783 |
+
|
2784 |
+
|
2785 |
+
/**
|
2786 |
+
Figure out an operational mode for the specified set of capabilities.
|
2787 |
+
|
2788 |
+
@method getMode
|
2789 |
+
@static
|
2790 |
+
@param {Object} modeCaps Set of capabilities that depend on particular runtime mode
|
2791 |
+
@param {Object} [requiredCaps] Supplied set of capabilities to find operational mode for
|
2792 |
+
@param {String|Boolean} [defaultMode='browser'] Default mode to use
|
2793 |
+
@return {String|Boolean} Compatible operational mode
|
2794 |
+
*/
|
2795 |
+
Runtime.getMode = function(modeCaps, requiredCaps, defaultMode) {
|
2796 |
+
var mode = null;
|
2797 |
+
|
2798 |
+
if (Basic.typeOf(defaultMode) === 'undefined') { // only if not specified
|
2799 |
+
defaultMode = 'browser';
|
2800 |
+
}
|
2801 |
+
|
2802 |
+
if (requiredCaps && !Basic.isEmptyObj(modeCaps)) {
|
2803 |
+
// loop over required caps and check if they do require the same mode
|
2804 |
+
Basic.each(requiredCaps, function(value, cap) {
|
2805 |
+
if (modeCaps.hasOwnProperty(cap)) {
|
2806 |
+
var capMode = modeCaps[cap](value);
|
2807 |
+
|
2808 |
+
// make sure we always have an array
|
2809 |
+
if (typeof(capMode) === 'string') {
|
2810 |
+
capMode = [capMode];
|
2811 |
+
}
|
2812 |
+
|
2813 |
+
if (!mode) {
|
2814 |
+
mode = capMode;
|
2815 |
+
} else if (!(mode = Basic.arrayIntersect(mode, capMode))) {
|
2816 |
+
// if cap requires conflicting mode - runtime cannot fulfill required caps
|
2817 |
+
|
2818 |
+
if (MXI_DEBUG && Env.debug.runtime) {
|
2819 |
+
Env.log("\t\t%s: %s (conflicting mode requested: %s)", cap, value, capMode);
|
2820 |
+
}
|
2821 |
+
|
2822 |
+
return (mode = false);
|
2823 |
+
}
|
2824 |
+
}
|
2825 |
+
|
2826 |
+
if (MXI_DEBUG && Env.debug.runtime) {
|
2827 |
+
Env.log("\t\t%s: %s (compatible modes: %s)", cap, value, mode);
|
2828 |
+
}
|
2829 |
+
});
|
2830 |
+
|
2831 |
+
if (mode) {
|
2832 |
+
return Basic.inArray(defaultMode, mode) !== -1 ? defaultMode : mode[0];
|
2833 |
+
} else if (mode === false) {
|
2834 |
+
return false;
|
2835 |
+
}
|
2836 |
+
}
|
2837 |
+
return defaultMode;
|
2838 |
+
};
|
2839 |
+
|
2840 |
+
|
2841 |
+
/**
|
2842 |
+
* Third party shims (Flash and Silverlight) require global event target against which they
|
2843 |
+
* will fire their events. However when moxie is not loaded to global namespace, default
|
2844 |
+
* event target is not accessible and we have to create artificial ones.
|
2845 |
+
*
|
2846 |
+
* @method getGlobalEventTarget
|
2847 |
+
* @static
|
2848 |
+
* @return {String} Name of the global event target
|
2849 |
+
*/
|
2850 |
+
Runtime.getGlobalEventTarget = function() {
|
2851 |
+
if (/^moxie\./.test(Env.global_event_dispatcher) && !Env.can('access_global_ns')) {
|
2852 |
+
var uniqueCallbackName = Basic.guid('moxie_event_target_');
|
2853 |
+
|
2854 |
+
window[uniqueCallbackName] = function(e, data) {
|
2855 |
+
EventTarget.instance.dispatchEvent(e, data);
|
2856 |
+
};
|
2857 |
+
|
2858 |
+
Env.global_event_dispatcher = uniqueCallbackName;
|
2859 |
+
}
|
2860 |
+
|
2861 |
+
return Env.global_event_dispatcher;
|
2862 |
+
};
|
2863 |
+
|
2864 |
+
|
2865 |
+
/**
|
2866 |
+
Capability check that always returns true
|
2867 |
+
|
2868 |
+
@private
|
2869 |
+
@static
|
2870 |
+
@return {True}
|
2871 |
+
*/
|
2872 |
+
Runtime.capTrue = function() {
|
2873 |
+
return true;
|
2874 |
+
};
|
2875 |
+
|
2876 |
+
/**
|
2877 |
+
Capability check that always returns false
|
2878 |
+
|
2879 |
+
@private
|
2880 |
+
@static
|
2881 |
+
@return {False}
|
2882 |
+
*/
|
2883 |
+
Runtime.capFalse = function() {
|
2884 |
+
return false;
|
2885 |
+
};
|
2886 |
+
|
2887 |
+
/**
|
2888 |
+
Evaluate the expression to boolean value and create a function that always returns it.
|
2889 |
+
|
2890 |
+
@private
|
2891 |
+
@static
|
2892 |
+
@param {Mixed} expr Expression to evaluate
|
2893 |
+
@return {Function} Function returning the result of evaluation
|
2894 |
+
*/
|
2895 |
+
Runtime.capTest = function(expr) {
|
2896 |
+
return function() {
|
2897 |
+
return !!expr;
|
2898 |
+
};
|
2899 |
+
};
|
2900 |
+
|
2901 |
+
return Runtime;
|
2902 |
+
});
|
2903 |
+
|
2904 |
+
// Included from: src/javascript/runtime/RuntimeClient.js
|
2905 |
+
|
2906 |
+
/**
|
2907 |
+
* RuntimeClient.js
|
2908 |
+
*
|
2909 |
+
* Copyright 2013, Moxiecode Systems AB
|
2910 |
+
* Released under GPL License.
|
2911 |
+
*
|
2912 |
+
* License: http://www.plupload.com/license
|
2913 |
+
* Contributing: http://www.plupload.com/contributing
|
2914 |
+
*/
|
2915 |
+
|
2916 |
+
define('moxie/runtime/RuntimeClient', [
|
2917 |
+
'moxie/core/utils/Env',
|
2918 |
+
'moxie/core/Exceptions',
|
2919 |
+
'moxie/core/utils/Basic',
|
2920 |
+
'moxie/runtime/Runtime'
|
2921 |
+
], function(Env, x, Basic, Runtime) {
|
2922 |
+
/**
|
2923 |
+
Set of methods and properties, required by a component to acquire ability to connect to a runtime
|
2924 |
+
|
2925 |
+
@class moxie/runtime/RuntimeClient
|
2926 |
+
*/
|
2927 |
+
return function RuntimeClient() {
|
2928 |
+
var runtime;
|
2929 |
+
|
2930 |
+
Basic.extend(this, {
|
2931 |
+
/**
|
2932 |
+
Connects to the runtime specified by the options. Will either connect to existing runtime or create a new one.
|
2933 |
+
Increments number of clients connected to the specified runtime.
|
2934 |
+
|
2935 |
+
@private
|
2936 |
+
@method connectRuntime
|
2937 |
+
@param {Mixed} options Can be a runtme uid or a set of key-value pairs defining requirements and pre-requisites
|
2938 |
+
*/
|
2939 |
+
connectRuntime: function(options) {
|
2940 |
+
var comp = this, ruid;
|
2941 |
+
|
2942 |
+
function initialize(items) {
|
2943 |
+
var type, constructor;
|
2944 |
+
|
2945 |
+
// if we ran out of runtimes
|
2946 |
+
if (!items.length) {
|
2947 |
+
comp.trigger('RuntimeError', new x.RuntimeError(x.RuntimeError.NOT_INIT_ERR));
|
2948 |
+
runtime = null;
|
2949 |
+
return;
|
2950 |
+
}
|
2951 |
+
|
2952 |
+
type = items.shift().toLowerCase();
|
2953 |
+
constructor = Runtime.getConstructor(type);
|
2954 |
+
if (!constructor) {
|
2955 |
+
if (MXI_DEBUG && Env.debug.runtime) {
|
2956 |
+
Env.log("Constructor for '%s' runtime is not available.", type);
|
2957 |
+
}
|
2958 |
+
initialize(items);
|
2959 |
+
return;
|
2960 |
+
}
|
2961 |
+
|
2962 |
+
if (MXI_DEBUG && Env.debug.runtime) {
|
2963 |
+
Env.log("Trying runtime: %s", type);
|
2964 |
+
Env.log(options);
|
2965 |
+
}
|
2966 |
+
|
2967 |
+
// try initializing the runtime
|
2968 |
+
runtime = new constructor(options);
|
2969 |
+
|
2970 |
+
runtime.bind('Init', function() {
|
2971 |
+
// mark runtime as initialized
|
2972 |
+
runtime.initialized = true;
|
2973 |
+
|
2974 |
+
if (MXI_DEBUG && Env.debug.runtime) {
|
2975 |
+
Env.log("Runtime '%s' initialized", runtime.type);
|
2976 |
+
}
|
2977 |
+
|
2978 |
+
// jailbreak ...
|
2979 |
+
setTimeout(function() {
|
2980 |
+
runtime.clients++;
|
2981 |
+
comp.ruid = runtime.uid;
|
2982 |
+
// this will be triggered on component
|
2983 |
+
comp.trigger('RuntimeInit', runtime);
|
2984 |
+
}, 1);
|
2985 |
+
});
|
2986 |
+
|
2987 |
+
runtime.bind('Error', function() {
|
2988 |
+
if (MXI_DEBUG && Env.debug.runtime) {
|
2989 |
+
Env.log("Runtime '%s' failed to initialize", runtime.type);
|
2990 |
+
}
|
2991 |
+
|
2992 |
+
runtime.destroy(); // runtime cannot destroy itself from inside at a right moment, thus we do it here
|
2993 |
+
initialize(items);
|
2994 |
+
});
|
2995 |
+
|
2996 |
+
runtime.bind('Exception', function(e, err) {
|
2997 |
+
var message = err.name + "(#" + err.code + ")" + (err.message ? ", from: " + err.message : '');
|
2998 |
+
|
2999 |
+
if (MXI_DEBUG && Env.debug.runtime) {
|
3000 |
+
Env.log("Runtime '%s' has thrown an exception: %s", this.type, message);
|
3001 |
+
}
|
3002 |
+
comp.trigger('RuntimeError', new x.RuntimeError(x.RuntimeError.EXCEPTION_ERR, message));
|
3003 |
+
});
|
3004 |
+
|
3005 |
+
if (MXI_DEBUG && Env.debug.runtime) {
|
3006 |
+
Env.log("\tselected mode: %s", runtime.mode);
|
3007 |
+
}
|
3008 |
+
|
3009 |
+
// check if runtime managed to pick-up operational mode
|
3010 |
+
if (!runtime.mode) {
|
3011 |
+
runtime.trigger('Error');
|
3012 |
+
return;
|
3013 |
+
}
|
3014 |
+
|
3015 |
+
runtime.init();
|
3016 |
+
}
|
3017 |
+
|
3018 |
+
// check if a particular runtime was requested
|
3019 |
+
if (Basic.typeOf(options) === 'string') {
|
3020 |
+
ruid = options;
|
3021 |
+
} else if (Basic.typeOf(options.ruid) === 'string') {
|
3022 |
+
ruid = options.ruid;
|
3023 |
+
}
|
3024 |
+
|
3025 |
+
if (ruid) {
|
3026 |
+
runtime = Runtime.getRuntime(ruid);
|
3027 |
+
if (runtime) {
|
3028 |
+
comp.ruid = ruid;
|
3029 |
+
runtime.clients++;
|
3030 |
+
return runtime;
|
3031 |
+
} else {
|
3032 |
+
// there should be a runtime and there's none - weird case
|
3033 |
+
throw new x.RuntimeError(x.RuntimeError.NOT_INIT_ERR);
|
3034 |
+
}
|
3035 |
+
}
|
3036 |
+
|
3037 |
+
// initialize a fresh one, that fits runtime list and required features best
|
3038 |
+
initialize((options.runtime_order || Runtime.order).split(/\s*,\s*/));
|
3039 |
+
},
|
3040 |
+
|
3041 |
+
|
3042 |
+
/**
|
3043 |
+
Disconnects from the runtime. Decrements number of clients connected to the specified runtime.
|
3044 |
+
|
3045 |
+
@private
|
3046 |
+
@method disconnectRuntime
|
3047 |
+
*/
|
3048 |
+
disconnectRuntime: function() {
|
3049 |
+
if (runtime && --runtime.clients <= 0) {
|
3050 |
+
runtime.destroy();
|
3051 |
+
}
|
3052 |
+
|
3053 |
+
// once the component is disconnected, it shouldn't have access to the runtime
|
3054 |
+
runtime = null;
|
3055 |
+
},
|
3056 |
+
|
3057 |
+
|
3058 |
+
/**
|
3059 |
+
Returns the runtime to which the client is currently connected.
|
3060 |
+
|
3061 |
+
@method getRuntime
|
3062 |
+
@return {Runtime} Runtime or null if client is not connected
|
3063 |
+
*/
|
3064 |
+
getRuntime: function() {
|
3065 |
+
if (runtime && runtime.uid) {
|
3066 |
+
return runtime;
|
3067 |
+
}
|
3068 |
+
return runtime = null; // make sure we do not leave zombies rambling around
|
3069 |
+
},
|
3070 |
+
|
3071 |
+
|
3072 |
+
/**
|
3073 |
+
Handy shortcut to safely invoke runtime extension methods.
|
3074 |
+
|
3075 |
+
@private
|
3076 |
+
@method exec
|
3077 |
+
@return {Mixed} Whatever runtime extension method returns
|
3078 |
+
*/
|
3079 |
+
exec: function() {
|
3080 |
+
return runtime ? runtime.exec.apply(this, arguments) : null;
|
3081 |
+
},
|
3082 |
+
|
3083 |
+
|
3084 |
+
/**
|
3085 |
+
Test runtime client for specific capability
|
3086 |
+
|
3087 |
+
@method can
|
3088 |
+
@param {String} cap
|
3089 |
+
@return {Bool}
|
3090 |
+
*/
|
3091 |
+
can: function(cap) {
|
3092 |
+
return runtime ? runtime.can(cap) : false;
|
3093 |
+
}
|
3094 |
+
|
3095 |
+
});
|
3096 |
+
};
|
3097 |
+
|
3098 |
+
|
3099 |
+
});
|
3100 |
+
|
3101 |
+
// Included from: src/javascript/file/Blob.js
|
3102 |
+
|
3103 |
+
/**
|
3104 |
+
* Blob.js
|
3105 |
+
*
|
3106 |
+
* Copyright 2013, Moxiecode Systems AB
|
3107 |
+
* Released under GPL License.
|
3108 |
+
*
|
3109 |
+
* License: http://www.plupload.com/license
|
3110 |
+
* Contributing: http://www.plupload.com/contributing
|
3111 |
+
*/
|
3112 |
+
|
3113 |
+
define('moxie/file/Blob', [
|
3114 |
+
'moxie/core/utils/Basic',
|
3115 |
+
'moxie/core/utils/Encode',
|
3116 |
+
'moxie/runtime/RuntimeClient'
|
3117 |
+
], function(Basic, Encode, RuntimeClient) {
|
3118 |
+
|
3119 |
+
var blobpool = {};
|
3120 |
+
|
3121 |
+
/**
|
3122 |
+
@class moxie/file/Blob
|
3123 |
+
@constructor
|
3124 |
+
@param {String} ruid Unique id of the runtime, to which this blob belongs to
|
3125 |
+
@param {Object} blob Object "Native" blob object, as it is represented in the runtime
|
3126 |
+
*/
|
3127 |
+
function Blob(ruid, blob) {
|
3128 |
+
|
3129 |
+
function _sliceDetached(start, end, type) {
|
3130 |
+
var blob, data = blobpool[this.uid];
|
3131 |
+
|
3132 |
+
if (Basic.typeOf(data) !== 'string' || !data.length) {
|
3133 |
+
return null; // or throw exception
|
3134 |
+
}
|
3135 |
+
|
3136 |
+
blob = new Blob(null, {
|
3137 |
+
type: type,
|
3138 |
+
size: end - start
|
3139 |
+
});
|
3140 |
+
blob.detach(data.substr(start, blob.size));
|
3141 |
+
|
3142 |
+
return blob;
|
3143 |
+
}
|
3144 |
+
|
3145 |
+
RuntimeClient.call(this);
|
3146 |
+
|
3147 |
+
if (ruid) {
|
3148 |
+
this.connectRuntime(ruid);
|
3149 |
+
}
|
3150 |
+
|
3151 |
+
if (!blob) {
|
3152 |
+
blob = {};
|
3153 |
+
} else if (Basic.typeOf(blob) === 'string') { // dataUrl or binary string
|
3154 |
+
blob = { data: blob };
|
3155 |
+
}
|
3156 |
+
|
3157 |
+
Basic.extend(this, {
|
3158 |
+
|
3159 |
+
/**
|
3160 |
+
Unique id of the component
|
3161 |
+
|
3162 |
+
@property uid
|
3163 |
+
@type {String}
|
3164 |
+
*/
|
3165 |
+
uid: blob.uid || Basic.guid('uid_'),
|
3166 |
+
|
3167 |
+
/**
|
3168 |
+
Unique id of the connected runtime, if falsy, then runtime will have to be initialized
|
3169 |
+
before this Blob can be used, modified or sent
|
3170 |
+
|
3171 |
+
@property ruid
|
3172 |
+
@type {String}
|
3173 |
+
*/
|
3174 |
+
ruid: ruid,
|
3175 |
+
|
3176 |
+
/**
|
3177 |
+
Size of blob
|
3178 |
+
|
3179 |
+
@property size
|
3180 |
+
@type {Number}
|
3181 |
+
@default 0
|
3182 |
+
*/
|
3183 |
+
size: blob.size || 0,
|
3184 |
+
|
3185 |
+
/**
|
3186 |
+
Mime type of blob
|
3187 |
+
|
3188 |
+
@property type
|
3189 |
+
@type {String}
|
3190 |
+
@default ''
|
3191 |
+
*/
|
3192 |
+
type: blob.type || '',
|
3193 |
+
|
3194 |
+
/**
|
3195 |
+
@method slice
|
3196 |
+
@param {Number} [start=0]
|
3197 |
+
*/
|
3198 |
+
slice: function(start, end, type) {
|
3199 |
+
if (this.isDetached()) {
|
3200 |
+
return _sliceDetached.apply(this, arguments);
|
3201 |
+
}
|
3202 |
+
return this.getRuntime().exec.call(this, 'Blob', 'slice', this.getSource(), start, end, type);
|
3203 |
+
},
|
3204 |
+
|
3205 |
+
/**
|
3206 |
+
Returns "native" blob object (as it is represented in connected runtime) or null if not found
|
3207 |
+
|
3208 |
+
@method getSource
|
3209 |
+
@return {Blob} Returns "native" blob object or null if not found
|
3210 |
+
*/
|
3211 |
+
getSource: function() {
|
3212 |
+
if (!blobpool[this.uid]) {
|
3213 |
+
return null;
|
3214 |
+
}
|
3215 |
+
return blobpool[this.uid];
|
3216 |
+
},
|
3217 |
+
|
3218 |
+
/**
|
3219 |
+
Detaches blob from any runtime that it depends on and initialize with standalone value
|
3220 |
+
|
3221 |
+
@method detach
|
3222 |
+
@protected
|
3223 |
+
@param {DOMString} [data=''] Standalone value
|
3224 |
+
*/
|
3225 |
+
detach: function(data) {
|
3226 |
+
if (this.ruid) {
|
3227 |
+
this.getRuntime().exec.call(this, 'Blob', 'destroy');
|
3228 |
+
this.disconnectRuntime();
|
3229 |
+
this.ruid = null;
|
3230 |
+
}
|
3231 |
+
|
3232 |
+
data = data || '';
|
3233 |
+
|
3234 |
+
// if dataUrl, convert to binary string
|
3235 |
+
if (data.substr(0, 5) == 'data:') {
|
3236 |
+
var base64Offset = data.indexOf(';base64,');
|
3237 |
+
this.type = data.substring(5, base64Offset);
|
3238 |
+
data = Encode.atob(data.substring(base64Offset + 8));
|
3239 |
+
}
|
3240 |
+
|
3241 |
+
this.size = data.length;
|
3242 |
+
|
3243 |
+
blobpool[this.uid] = data;
|
3244 |
+
},
|
3245 |
+
|
3246 |
+
/**
|
3247 |
+
Checks if blob is standalone (detached of any runtime)
|
3248 |
+
|
3249 |
+
@method isDetached
|
3250 |
+
@protected
|
3251 |
+
@return {Boolean}
|
3252 |
+
*/
|
3253 |
+
isDetached: function() {
|
3254 |
+
return !this.ruid && Basic.typeOf(blobpool[this.uid]) === 'string';
|
3255 |
+
},
|
3256 |
+
|
3257 |
+
/**
|
3258 |
+
Destroy Blob and free any resources it was using
|
3259 |
+
|
3260 |
+
@method destroy
|
3261 |
+
*/
|
3262 |
+
destroy: function() {
|
3263 |
+
this.detach();
|
3264 |
+
delete blobpool[this.uid];
|
3265 |
+
}
|
3266 |
+
});
|
3267 |
+
|
3268 |
+
|
3269 |
+
if (blob.data) {
|
3270 |
+
this.detach(blob.data); // auto-detach if payload has been passed
|
3271 |
+
} else {
|
3272 |
+
blobpool[this.uid] = blob;
|
3273 |
+
}
|
3274 |
+
}
|
3275 |
+
|
3276 |
+
return Blob;
|
3277 |
+
});
|
3278 |
+
|
3279 |
+
// Included from: src/javascript/core/I18n.js
|
3280 |
+
|
3281 |
+
/**
|
3282 |
+
* I18n.js
|
3283 |
+
*
|
3284 |
+
* Copyright 2013, Moxiecode Systems AB
|
3285 |
+
* Released under GPL License.
|
3286 |
+
*
|
3287 |
+
* License: http://www.plupload.com/license
|
3288 |
+
* Contributing: http://www.plupload.com/contributing
|
3289 |
+
*/
|
3290 |
+
|
3291 |
+
define("moxie/core/I18n", [
|
3292 |
+
"moxie/core/utils/Basic"
|
3293 |
+
], function(Basic) {
|
3294 |
+
var i18n = {};
|
3295 |
+
|
3296 |
+
/**
|
3297 |
+
@class moxie/core/I18n
|
3298 |
+
*/
|
3299 |
+
return {
|
3300 |
+
/**
|
3301 |
+
* Extends the language pack object with new items.
|
3302 |
+
*
|
3303 |
+
* @param {Object} pack Language pack items to add.
|
3304 |
+
* @return {Object} Extended language pack object.
|
3305 |
+
*/
|
3306 |
+
addI18n: function(pack) {
|
3307 |
+
return Basic.extend(i18n, pack);
|
3308 |
+
},
|
3309 |
+
|
3310 |
+
/**
|
3311 |
+
* Translates the specified string by checking for the english string in the language pack lookup.
|
3312 |
+
*
|
3313 |
+
* @param {String} str String to look for.
|
3314 |
+
* @return {String} Translated string or the input string if it wasn't found.
|
3315 |
+
*/
|
3316 |
+
translate: function(str) {
|
3317 |
+
return i18n[str] || str;
|
3318 |
+
},
|
3319 |
+
|
3320 |
+
/**
|
3321 |
+
* Shortcut for translate function
|
3322 |
+
*
|
3323 |
+
* @param {String} str String to look for.
|
3324 |
+
* @return {String} Translated string or the input string if it wasn't found.
|
3325 |
+
*/
|
3326 |
+
_: function(str) {
|
3327 |
+
return this.translate(str);
|
3328 |
+
},
|
3329 |
+
|
3330 |
+
/**
|
3331 |
+
* Pseudo sprintf implementation - simple way to replace tokens with specified values.
|
3332 |
+
*
|
3333 |
+
* @param {String} str String with tokens
|
3334 |
+
* @return {String} String with replaced tokens
|
3335 |
+
*/
|
3336 |
+
sprintf: function(str) {
|
3337 |
+
var args = [].slice.call(arguments, 1);
|
3338 |
+
|
3339 |
+
return str.replace(/%[a-z]/g, function() {
|
3340 |
+
var value = args.shift();
|
3341 |
+
return Basic.typeOf(value) !== 'undefined' ? value : '';
|
3342 |
+
});
|
3343 |
+
}
|
3344 |
+
};
|
3345 |
+
});
|
3346 |
+
|
3347 |
+
// Included from: src/javascript/core/utils/Mime.js
|
3348 |
+
|
3349 |
+
/**
|
3350 |
+
* Mime.js
|
3351 |
+
*
|
3352 |
+
* Copyright 2013, Moxiecode Systems AB
|
3353 |
+
* Released under GPL License.
|
3354 |
+
*
|
3355 |
+
* License: http://www.plupload.com/license
|
3356 |
+
* Contributing: http://www.plupload.com/contributing
|
3357 |
+
*/
|
3358 |
+
|
3359 |
+
/**
|
3360 |
+
@class moxie/core/utils/Mime
|
3361 |
+
@public
|
3362 |
+
@static
|
3363 |
+
*/
|
3364 |
+
|
3365 |
+
define("moxie/core/utils/Mime", [
|
3366 |
+
"moxie/core/utils/Basic",
|
3367 |
+
"moxie/core/I18n"
|
3368 |
+
], function(Basic, I18n) {
|
3369 |
+
|
3370 |
+
var mimeData = "" +
|
3371 |
+
"application/msword,doc dot," +
|
3372 |
+
"application/pdf,pdf," +
|
3373 |
+
"application/pgp-signature,pgp," +
|
3374 |
+
"application/postscript,ps ai eps," +
|
3375 |
+
"application/rtf,rtf," +
|
3376 |
+
"application/vnd.ms-excel,xls xlb xlt xla," +
|
3377 |
+
"application/vnd.ms-powerpoint,ppt pps pot ppa," +
|
3378 |
+
"application/zip,zip," +
|
3379 |
+
"application/x-shockwave-flash,swf swfl," +
|
3380 |
+
"application/vnd.openxmlformats-officedocument.wordprocessingml.document,docx," +
|
3381 |
+
"application/vnd.openxmlformats-officedocument.wordprocessingml.template,dotx," +
|
3382 |
+
"application/vnd.openxmlformats-officedocument.spreadsheetml.sheet,xlsx," +
|
3383 |
+
"application/vnd.openxmlformats-officedocument.presentationml.presentation,pptx," +
|
3384 |
+
"application/vnd.openxmlformats-officedocument.presentationml.template,potx," +
|
3385 |
+
"application/vnd.openxmlformats-officedocument.presentationml.slideshow,ppsx," +
|
3386 |
+
"application/x-javascript,js," +
|
3387 |
+
"application/json,json," +
|
3388 |
+
"audio/mpeg,mp3 mpga mpega mp2," +
|
3389 |
+
"audio/x-wav,wav," +
|
3390 |
+
"audio/x-m4a,m4a," +
|
3391 |
+
"audio/ogg,oga ogg," +
|
3392 |
+
"audio/aiff,aiff aif," +
|
3393 |
+
"audio/flac,flac," +
|
3394 |
+
"audio/aac,aac," +
|
3395 |
+
"audio/ac3,ac3," +
|
3396 |
+
"audio/x-ms-wma,wma," +
|
3397 |
+
"image/bmp,bmp," +
|
3398 |
+
"image/gif,gif," +
|
3399 |
+
"image/jpeg,jpg jpeg jpe," +
|
3400 |
+
"image/photoshop,psd," +
|
3401 |
+
"image/png,png," +
|
3402 |
+
"image/svg+xml,svg svgz," +
|
3403 |
+
"image/tiff,tiff tif," +
|
3404 |
+
"text/plain,asc txt text diff log," +
|
3405 |
+
"text/html,htm html xhtml," +
|
3406 |
+
"text/css,css," +
|
3407 |
+
"text/csv,csv," +
|
3408 |
+
"text/rtf,rtf," +
|
3409 |
+
"video/mpeg,mpeg mpg mpe m2v," +
|
3410 |
+
"video/quicktime,qt mov," +
|
3411 |
+
"video/mp4,mp4," +
|
3412 |
+
"video/x-m4v,m4v," +
|
3413 |
+
"video/x-flv,flv," +
|
3414 |
+
"video/x-ms-wmv,wmv," +
|
3415 |
+
"video/avi,avi," +
|
3416 |
+
"video/webm,webm," +
|
3417 |
+
"video/3gpp,3gpp 3gp," +
|
3418 |
+
"video/3gpp2,3g2," +
|
3419 |
+
"video/vnd.rn-realvideo,rv," +
|
3420 |
+
"video/ogg,ogv," +
|
3421 |
+
"video/x-matroska,mkv," +
|
3422 |
+
"application/vnd.oasis.opendocument.formula-template,otf," +
|
3423 |
+
"application/octet-stream,exe";
|
3424 |
+
|
3425 |
+
|
3426 |
+
/**
|
3427 |
+
* Map of mimes to extensions
|
3428 |
+
*
|
3429 |
+
* @property mimes
|
3430 |
+
* @type {Object}
|
3431 |
+
*/
|
3432 |
+
var mimes = {};
|
3433 |
+
|
3434 |
+
/**
|
3435 |
+
* Map of extensions to mimes
|
3436 |
+
*
|
3437 |
+
* @property extensions
|
3438 |
+
* @type {Object}
|
3439 |
+
*/
|
3440 |
+
var extensions = {};
|
3441 |
+
|
3442 |
+
|
3443 |
+
/**
|
3444 |
+
* Parses mimeData string into a mimes and extensions lookup maps. String should have the
|
3445 |
+
* following format:
|
3446 |
+
*
|
3447 |
+
* application/msword,doc dot,application/pdf,pdf, ...
|
3448 |
+
*
|
3449 |
+
* so mime-type followed by comma and followed by space-separated list of associated extensions,
|
3450 |
+
* then comma again and then another mime-type, etc.
|
3451 |
+
*
|
3452 |
+
* If invoked externally will replace override internal lookup maps with user-provided data.
|
3453 |
+
*
|
3454 |
+
* @method addMimeType
|
3455 |
+
* @param {String} mimeData
|
3456 |
+
*/
|
3457 |
+
var addMimeType = function (mimeData) {
|
3458 |
+
var items = mimeData.split(/,/), i, ii, ext;
|
3459 |
+
|
3460 |
+
for (i = 0; i < items.length; i += 2) {
|
3461 |
+
ext = items[i + 1].split(/ /);
|
3462 |
+
|
3463 |
+
// extension to mime lookup
|
3464 |
+
for (ii = 0; ii < ext.length; ii++) {
|
3465 |
+
mimes[ext[ii]] = items[i];
|
3466 |
+
}
|
3467 |
+
// mime to extension lookup
|
3468 |
+
extensions[items[i]] = ext;
|
3469 |
+
}
|
3470 |
+
};
|
3471 |
+
|
3472 |
+
|
3473 |
+
var extList2mimes = function (filters, addMissingExtensions) {
|
3474 |
+
var ext, i, ii, type, mimes = [];
|
3475 |
+
|
3476 |
+
// convert extensions to mime types list
|
3477 |
+
for (i = 0; i < filters.length; i++) {
|
3478 |
+
ext = filters[i].extensions.toLowerCase().split(/\s*,\s*/);
|
3479 |
+
|
3480 |
+
for (ii = 0; ii < ext.length; ii++) {
|
3481 |
+
|
3482 |
+
// if there's an asterisk in the list, then accept attribute is not required
|
3483 |
+
if (ext[ii] === '*') {
|
3484 |
+
return [];
|
3485 |
+
}
|
3486 |
+
|
3487 |
+
type = mimes[ext[ii]];
|
3488 |
+
|
3489 |
+
// future browsers should filter by extension, finally
|
3490 |
+
if (addMissingExtensions && /^\w+$/.test(ext[ii])) {
|
3491 |
+
mimes.push('.' + ext[ii]);
|
3492 |
+
} else if (type && Basic.inArray(type, mimes) === -1) {
|
3493 |
+
mimes.push(type);
|
3494 |
+
} else if (!type) {
|
3495 |
+
// if we have no type in our map, then accept all
|
3496 |
+
return [];
|
3497 |
+
}
|
3498 |
+
}
|
3499 |
+
}
|
3500 |
+
return mimes;
|
3501 |
+
};
|
3502 |
+
|
3503 |
+
|
3504 |
+
var mimes2exts = function(mimes) {
|
3505 |
+
var exts = [];
|
3506 |
+
|
3507 |
+
Basic.each(mimes, function(mime) {
|
3508 |
+
mime = mime.toLowerCase();
|
3509 |
+
|
3510 |
+
if (mime === '*') {
|
3511 |
+
exts = [];
|
3512 |
+
return false;
|
3513 |
+
}
|
3514 |
+
|
3515 |
+
// check if this thing looks like mime type
|
3516 |
+
var m = mime.match(/^(\w+)\/(\*|\w+)$/);
|
3517 |
+
if (m) {
|
3518 |
+
if (m[2] === '*') {
|
3519 |
+
// wildcard mime type detected
|
3520 |
+
Basic.each(extensions, function(arr, mime) {
|
3521 |
+
if ((new RegExp('^' + m[1] + '/')).test(mime)) {
|
3522 |
+
[].push.apply(exts, extensions[mime]);
|
3523 |
+
}
|
3524 |
+
});
|
3525 |
+
} else if (extensions[mime]) {
|
3526 |
+
[].push.apply(exts, extensions[mime]);
|
3527 |
+
}
|
3528 |
+
}
|
3529 |
+
});
|
3530 |
+
return exts;
|
3531 |
+
};
|
3532 |
+
|
3533 |
+
|
3534 |
+
var mimes2extList = function(mimes) {
|
3535 |
+
var accept = [], exts = [];
|
3536 |
+
|
3537 |
+
if (Basic.typeOf(mimes) === 'string') {
|
3538 |
+
mimes = Basic.trim(mimes).split(/\s*,\s*/);
|
3539 |
+
}
|
3540 |
+
|
3541 |
+
exts = mimes2exts(mimes);
|
3542 |
+
|
3543 |
+
accept.push({
|
3544 |
+
title: I18n.translate('Files'),
|
3545 |
+
extensions: exts.length ? exts.join(',') : '*'
|
3546 |
+
});
|
3547 |
+
|
3548 |
+
return accept;
|
3549 |
+
};
|
3550 |
+
|
3551 |
+
/**
|
3552 |
+
* Extract extension from the given filename
|
3553 |
+
*
|
3554 |
+
* @method getFileExtension
|
3555 |
+
* @param {String} fileName
|
3556 |
+
* @return {String} File extension
|
3557 |
+
*/
|
3558 |
+
var getFileExtension = function(fileName) {
|
3559 |
+
var matches = fileName && fileName.match(/\.([^.]+)$/);
|
3560 |
+
if (matches) {
|
3561 |
+
return matches[1].toLowerCase();
|
3562 |
+
}
|
3563 |
+
return '';
|
3564 |
+
};
|
3565 |
+
|
3566 |
+
|
3567 |
+
/**
|
3568 |
+
* Get file mime-type from it's filename - will try to match the extension
|
3569 |
+
* against internal mime-type lookup map
|
3570 |
+
*
|
3571 |
+
* @method getFileMime
|
3572 |
+
* @param {String} fileName
|
3573 |
+
* @return File mime-type if found or an empty string if not
|
3574 |
+
*/
|
3575 |
+
var getFileMime = function(fileName) {
|
3576 |
+
return mimes[getFileExtension(fileName)] || '';
|
3577 |
+
};
|
3578 |
+
|
3579 |
+
|
3580 |
+
addMimeType(mimeData);
|
3581 |
+
|
3582 |
+
return {
|
3583 |
+
mimes: mimes,
|
3584 |
+
extensions: extensions,
|
3585 |
+
addMimeType: addMimeType,
|
3586 |
+
extList2mimes: extList2mimes,
|
3587 |
+
mimes2exts: mimes2exts,
|
3588 |
+
mimes2extList: mimes2extList,
|
3589 |
+
getFileExtension: getFileExtension,
|
3590 |
+
getFileMime: getFileMime
|
3591 |
+
}
|
3592 |
+
});
|
3593 |
+
|
3594 |
+
// Included from: src/javascript/file/FileInput.js
|
3595 |
+
|
3596 |
+
/**
|
3597 |
+
* FileInput.js
|
3598 |
+
*
|
3599 |
+
* Copyright 2013, Moxiecode Systems AB
|
3600 |
+
* Released under GPL License.
|
3601 |
+
*
|
3602 |
+
* License: http://www.plupload.com/license
|
3603 |
+
* Contributing: http://www.plupload.com/contributing
|
3604 |
+
*/
|
3605 |
+
|
3606 |
+
define('moxie/file/FileInput', [
|
3607 |
+
'moxie/core/utils/Basic',
|
3608 |
+
'moxie/core/utils/Env',
|
3609 |
+
'moxie/core/utils/Mime',
|
3610 |
+
'moxie/core/utils/Dom',
|
3611 |
+
'moxie/core/Exceptions',
|
3612 |
+
'moxie/core/EventTarget',
|
3613 |
+
'moxie/core/I18n',
|
3614 |
+
'moxie/runtime/Runtime',
|
3615 |
+
'moxie/runtime/RuntimeClient'
|
3616 |
+
], function(Basic, Env, Mime, Dom, x, EventTarget, I18n, Runtime, RuntimeClient) {
|
3617 |
+
/**
|
3618 |
+
Provides a convenient way to create cross-browser file-picker. Generates file selection dialog on click,
|
3619 |
+
converts selected files to _File_ objects, to be used in conjunction with _Image_, preloaded in memory
|
3620 |
+
with _FileReader_ or uploaded to a server through _XMLHttpRequest_.
|
3621 |
+
|
3622 |
+
@class moxie/file/FileInput
|
3623 |
+
@constructor
|
3624 |
+
@extends EventTarget
|
3625 |
+
@uses RuntimeClient
|
3626 |
+
@param {Object|String|DOMElement} options If options is string or node, argument is considered as _browse\_button_.
|
3627 |
+
@param {String|DOMElement} options.browse_button DOM Element to turn into file picker.
|
3628 |
+
@param {Array} [options.accept] Array of mime types to accept. By default accepts all.
|
3629 |
+
@param {Boolean} [options.multiple=false] Enable selection of multiple files.
|
3630 |
+
@param {Boolean} [options.directory=false] Turn file input into the folder input (cannot be both at the same time).
|
3631 |
+
@param {String|DOMElement} [options.container] DOM Element to use as a container for file-picker. Defaults to parentNode
|
3632 |
+
for _browse\_button_.
|
3633 |
+
@param {Object|String} [options.required_caps] Set of required capabilities, that chosen runtime must support.
|
3634 |
+
|
3635 |
+
@example
|
3636 |
+
<div id="container">
|
3637 |
+
<a id="file-picker" href="javascript:;">Browse...</a>
|
3638 |
+
</div>
|
3639 |
+
|
3640 |
+
<script>
|
3641 |
+
var fileInput = new moxie.file.FileInput({
|
3642 |
+
browse_button: 'file-picker', // or document.getElementById('file-picker')
|
3643 |
+
container: 'container',
|
3644 |
+
accept: [
|
3645 |
+
{title: "Image files", extensions: "jpg,gif,png"} // accept only images
|
3646 |
+
],
|
3647 |
+
multiple: true // allow multiple file selection
|
3648 |
+
});
|
3649 |
+
|
3650 |
+
fileInput.onchange = function(e) {
|
3651 |
+
// do something to files array
|
3652 |
+
console.info(e.target.files); // or this.files or fileInput.files
|
3653 |
+
};
|
3654 |
+
|
3655 |
+
fileInput.init(); // initialize
|
3656 |
+
</script>
|
3657 |
+
*/
|
3658 |
+
var dispatches = [
|
3659 |
+
/**
|
3660 |
+
Dispatched when runtime is connected and file-picker is ready to be used.
|
3661 |
+
|
3662 |
+
@event ready
|
3663 |
+
@param {Object} event
|
3664 |
+
*/
|
3665 |
+
'ready',
|
3666 |
+
|
3667 |
+
/**
|
3668 |
+
Dispatched right after [ready](#event_ready) event, and whenever [refresh()](#method_refresh) is invoked.
|
3669 |
+
Check [corresponding documentation entry](#method_refresh) for more info.
|
3670 |
+
|
3671 |
+
@event refresh
|
3672 |
+
@param {Object} event
|
3673 |
+
*/
|
3674 |
+
|
3675 |
+
/**
|
3676 |
+
Dispatched when selection of files in the dialog is complete.
|
3677 |
+
|
3678 |
+
@event change
|
3679 |
+
@param {Object} event
|
3680 |
+
*/
|
3681 |
+
'change',
|
3682 |
+
|
3683 |
+
'cancel', // TODO: might be useful
|
3684 |
+
|
3685 |
+
/**
|
3686 |
+
Dispatched when mouse cursor enters file-picker area. Can be used to style element
|
3687 |
+
accordingly.
|
3688 |
+
|
3689 |
+
@event mouseenter
|
3690 |
+
@param {Object} event
|
3691 |
+
*/
|
3692 |
+
'mouseenter',
|
3693 |
+
|
3694 |
+
/**
|
3695 |
+
Dispatched when mouse cursor leaves file-picker area. Can be used to style element
|
3696 |
+
accordingly.
|
3697 |
+
|
3698 |
+
@event mouseleave
|
3699 |
+
@param {Object} event
|
3700 |
+
*/
|
3701 |
+
'mouseleave',
|
3702 |
+
|
3703 |
+
/**
|
3704 |
+
Dispatched when functional mouse button is pressed on top of file-picker area.
|
3705 |
+
|
3706 |
+
@event mousedown
|
3707 |
+
@param {Object} event
|
3708 |
+
*/
|
3709 |
+
'mousedown',
|
3710 |
+
|
3711 |
+
/**
|
3712 |
+
Dispatched when functional mouse button is released on top of file-picker area.
|
3713 |
+
|
3714 |
+
@event mouseup
|
3715 |
+
@param {Object} event
|
3716 |
+
*/
|
3717 |
+
'mouseup'
|
3718 |
+
];
|
3719 |
+
|
3720 |
+
function FileInput(options) {
|
3721 |
+
if (MXI_DEBUG) {
|
3722 |
+
Env.log("Instantiating FileInput...");
|
3723 |
+
}
|
3724 |
+
|
3725 |
+
var container, browseButton, defaults;
|
3726 |
+
|
3727 |
+
// if flat argument passed it should be browse_button id
|
3728 |
+
if (Basic.inArray(Basic.typeOf(options), ['string', 'node']) !== -1) {
|
3729 |
+
options = { browse_button : options };
|
3730 |
+
}
|
3731 |
+
|
3732 |
+
// this will help us to find proper default container
|
3733 |
+
browseButton = Dom.get(options.browse_button);
|
3734 |
+
if (!browseButton) {
|
3735 |
+
// browse button is required
|
3736 |
+
throw new x.DOMException(x.DOMException.NOT_FOUND_ERR);
|
3737 |
+
}
|
3738 |
+
|
3739 |
+
// figure out the options
|
3740 |
+
defaults = {
|
3741 |
+
accept: [{
|
3742 |
+
title: I18n.translate('All Files'),
|
3743 |
+
extensions: '*'
|
3744 |
+
}],
|
3745 |
+
multiple: false,
|
3746 |
+
required_caps: false,
|
3747 |
+
container: browseButton.parentNode || document.body
|
3748 |
+
};
|
3749 |
+
|
3750 |
+
options = Basic.extend({}, defaults, options);
|
3751 |
+
|
3752 |
+
// convert to object representation
|
3753 |
+
if (typeof(options.required_caps) === 'string') {
|
3754 |
+
options.required_caps = Runtime.parseCaps(options.required_caps);
|
3755 |
+
}
|
3756 |
+
|
3757 |
+
// normalize accept option (could be list of mime types or array of title/extensions pairs)
|
3758 |
+
if (typeof(options.accept) === 'string') {
|
3759 |
+
options.accept = Mime.mimes2extList(options.accept);
|
3760 |
+
}
|
3761 |
+
|
3762 |
+
container = Dom.get(options.container);
|
3763 |
+
// make sure we have container
|
3764 |
+
if (!container) {
|
3765 |
+
container = document.body;
|
3766 |
+
}
|
3767 |
+
|
3768 |
+
// make container relative, if it's not
|
3769 |
+
if (Dom.getStyle(container, 'position') === 'static') {
|
3770 |
+
container.style.position = 'relative';
|
3771 |
+
}
|
3772 |
+
|
3773 |
+
container = browseButton = null; // IE
|
3774 |
+
|
3775 |
+
RuntimeClient.call(this);
|
3776 |
+
|
3777 |
+
Basic.extend(this, {
|
3778 |
+
/**
|
3779 |
+
Unique id of the component
|
3780 |
+
|
3781 |
+
@property uid
|
3782 |
+
@protected
|
3783 |
+
@readOnly
|
3784 |
+
@type {String}
|
3785 |
+
@default UID
|
3786 |
+
*/
|
3787 |
+
uid: Basic.guid('uid_'),
|
3788 |
+
|
3789 |
+
/**
|
3790 |
+
Unique id of the connected runtime, if any.
|
3791 |
+
|
3792 |
+
@property ruid
|
3793 |
+
@protected
|
3794 |
+
@type {String}
|
3795 |
+
*/
|
3796 |
+
ruid: null,
|
3797 |
+
|
3798 |
+
/**
|
3799 |
+
Unique id of the runtime container. Useful to get hold of it for various manipulations.
|
3800 |
+
|
3801 |
+
@property shimid
|
3802 |
+
@protected
|
3803 |
+
@type {String}
|
3804 |
+
*/
|
3805 |
+
shimid: null,
|
3806 |
+
|
3807 |
+
/**
|
3808 |
+
Array of selected moxie.file.File objects
|
3809 |
+
|
3810 |
+
@property files
|
3811 |
+
@type {Array}
|
3812 |
+
@default null
|
3813 |
+
*/
|
3814 |
+
files: null,
|
3815 |
+
|
3816 |
+
/**
|
3817 |
+
Initializes the file-picker, connects it to runtime and dispatches event ready when done.
|
3818 |
+
|
3819 |
+
@method init
|
3820 |
+
*/
|
3821 |
+
init: function() {
|
3822 |
+
var self = this;
|
3823 |
+
|
3824 |
+
self.bind('RuntimeInit', function(e, runtime) {
|
3825 |
+
self.ruid = runtime.uid;
|
3826 |
+
self.shimid = runtime.shimid;
|
3827 |
+
|
3828 |
+
self.bind("Ready", function() {
|
3829 |
+
self.trigger("Refresh");
|
3830 |
+
}, 999);
|
3831 |
+
|
3832 |
+
// re-position and resize shim container
|
3833 |
+
self.bind('Refresh', function() {
|
3834 |
+
var pos, size, browseButton, shimContainer, zIndex;
|
3835 |
+
|
3836 |
+
browseButton = Dom.get(options.browse_button);
|
3837 |
+
shimContainer = Dom.get(runtime.shimid); // do not use runtime.getShimContainer(), since it will create container if it doesn't exist
|
3838 |
+
|
3839 |
+
if (browseButton) {
|
3840 |
+
pos = Dom.getPos(browseButton, Dom.get(options.container));
|
3841 |
+
size = Dom.getSize(browseButton);
|
3842 |
+
zIndex = parseInt(Dom.getStyle(browseButton, 'z-index'), 10) || 0;
|
3843 |
+
|
3844 |
+
if (shimContainer) {
|
3845 |
+
Basic.extend(shimContainer.style, {
|
3846 |
+
top: pos.y + 'px',
|
3847 |
+
left: pos.x + 'px',
|
3848 |
+
width: size.w + 'px',
|
3849 |
+
height: size.h + 'px',
|
3850 |
+
zIndex: zIndex + 1
|
3851 |
+
});
|
3852 |
+
}
|
3853 |
+
}
|
3854 |
+
shimContainer = browseButton = null;
|
3855 |
+
});
|
3856 |
+
|
3857 |
+
runtime.exec.call(self, 'FileInput', 'init', options);
|
3858 |
+
});
|
3859 |
+
|
3860 |
+
// runtime needs: options.required_features, options.runtime_order and options.container
|
3861 |
+
self.connectRuntime(Basic.extend({}, options, {
|
3862 |
+
required_caps: {
|
3863 |
+
select_file: true
|
3864 |
+
}
|
3865 |
+
}));
|
3866 |
+
},
|
3867 |
+
|
3868 |
+
|
3869 |
+
/**
|
3870 |
+
* Get current option value by its name
|
3871 |
+
*
|
3872 |
+
* @method getOption
|
3873 |
+
* @param name
|
3874 |
+
* @return {Mixed}
|
3875 |
+
*/
|
3876 |
+
getOption: function(name) {
|
3877 |
+
return options[name];
|
3878 |
+
},
|
3879 |
+
|
3880 |
+
|
3881 |
+
/**
|
3882 |
+
* Sets a new value for the option specified by name
|
3883 |
+
*
|
3884 |
+
* @method setOption
|
3885 |
+
* @param name
|
3886 |
+
* @param value
|
3887 |
+
*/
|
3888 |
+
setOption: function(name, value) {
|
3889 |
+
if (!options.hasOwnProperty(name)) {
|
3890 |
+
return;
|
3891 |
+
}
|
3892 |
+
|
3893 |
+
var oldValue = options[name];
|
3894 |
+
|
3895 |
+
switch (name) {
|
3896 |
+
case 'accept':
|
3897 |
+
if (typeof(value) === 'string') {
|
3898 |
+
value = Mime.mimes2extList(value);
|
3899 |
+
}
|
3900 |
+
break;
|
3901 |
+
|
3902 |
+
case 'container':
|
3903 |
+
case 'required_caps':
|
3904 |
+
throw new x.FileException(x.FileException.NO_MODIFICATION_ALLOWED_ERR);
|
3905 |
+
}
|
3906 |
+
|
3907 |
+
options[name] = value;
|
3908 |
+
this.exec('FileInput', 'setOption', name, value);
|
3909 |
+
|
3910 |
+
this.trigger('OptionChanged', name, value, oldValue);
|
3911 |
+
},
|
3912 |
+
|
3913 |
+
/**
|
3914 |
+
Disables file-picker element, so that it doesn't react to mouse clicks.
|
3915 |
+
|
3916 |
+
@method disable
|
3917 |
+
@param {Boolean} [state=true] Disable component if - true, enable if - false
|
3918 |
+
*/
|
3919 |
+
disable: function(state) {
|
3920 |
+
var runtime = this.getRuntime();
|
3921 |
+
if (runtime) {
|
3922 |
+
this.exec('FileInput', 'disable', Basic.typeOf(state) === 'undefined' ? true : state);
|
3923 |
+
}
|
3924 |
+
},
|
3925 |
+
|
3926 |
+
|
3927 |
+
/**
|
3928 |
+
Reposition and resize dialog trigger to match the position and size of browse_button element.
|
3929 |
+
|
3930 |
+
@method refresh
|
3931 |
+
*/
|
3932 |
+
refresh: function() {
|
3933 |
+
this.trigger("Refresh");
|
3934 |
+
},
|
3935 |
+
|
3936 |
+
|
3937 |
+
/**
|
3938 |
+
Destroy component.
|
3939 |
+
|
3940 |
+
@method destroy
|
3941 |
+
*/
|
3942 |
+
destroy: function() {
|
3943 |
+
var runtime = this.getRuntime();
|
3944 |
+
if (runtime) {
|
3945 |
+
runtime.exec.call(this, 'FileInput', 'destroy');
|
3946 |
+
this.disconnectRuntime();
|
3947 |
+
}
|
3948 |
+
|
3949 |
+
if (Basic.typeOf(this.files) === 'array') {
|
3950 |
+
// no sense in leaving associated files behind
|
3951 |
+
Basic.each(this.files, function(file) {
|
3952 |
+
file.destroy();
|
3953 |
+
});
|
3954 |
+
}
|
3955 |
+
this.files = null;
|
3956 |
+
|
3957 |
+
this.unbindAll();
|
3958 |
+
}
|
3959 |
+
});
|
3960 |
+
|
3961 |
+
this.handleEventProps(dispatches);
|
3962 |
+
}
|
3963 |
+
|
3964 |
+
FileInput.prototype = EventTarget.instance;
|
3965 |
+
|
3966 |
+
return FileInput;
|
3967 |
+
});
|
3968 |
+
|
3969 |
+
// Included from: src/javascript/file/File.js
|
3970 |
+
|
3971 |
+
/**
|
3972 |
+
* File.js
|
3973 |
+
*
|
3974 |
+
* Copyright 2013, Moxiecode Systems AB
|
3975 |
+
* Released under GPL License.
|
3976 |
+
*
|
3977 |
+
* License: http://www.plupload.com/license
|
3978 |
+
* Contributing: http://www.plupload.com/contributing
|
3979 |
+
*/
|
3980 |
+
|
3981 |
+
define('moxie/file/File', [
|
3982 |
+
'moxie/core/utils/Basic',
|
3983 |
+
'moxie/core/utils/Mime',
|
3984 |
+
'moxie/file/Blob'
|
3985 |
+
], function(Basic, Mime, Blob) {
|
3986 |
+
/**
|
3987 |
+
@class moxie/file/File
|
3988 |
+
@extends Blob
|
3989 |
+
@constructor
|
3990 |
+
@param {String} ruid Unique id of the runtime, to which this blob belongs to
|
3991 |
+
@param {Object} file Object "Native" file object, as it is represented in the runtime
|
3992 |
+
*/
|
3993 |
+
function File(ruid, file) {
|
3994 |
+
if (!file) { // avoid extra errors in case we overlooked something
|
3995 |
+
file = {};
|
3996 |
+
}
|
3997 |
+
|
3998 |
+
Blob.apply(this, arguments);
|
3999 |
+
|
4000 |
+
if (!this.type) {
|
4001 |
+
this.type = Mime.getFileMime(file.name);
|
4002 |
+
}
|
4003 |
+
|
4004 |
+
// sanitize file name or generate new one
|
4005 |
+
var name;
|
4006 |
+
if (file.name) {
|
4007 |
+
name = file.name.replace(/\\/g, '/');
|
4008 |
+
name = name.substr(name.lastIndexOf('/') + 1);
|
4009 |
+
} else if (this.type) {
|
4010 |
+
var prefix = this.type.split('/')[0];
|
4011 |
+
name = Basic.guid((prefix !== '' ? prefix : 'file') + '_');
|
4012 |
+
|
4013 |
+
if (Mime.extensions[this.type]) {
|
4014 |
+
name += '.' + Mime.extensions[this.type][0]; // append proper extension if possible
|
4015 |
+
}
|
4016 |
+
}
|
4017 |
+
|
4018 |
+
|
4019 |
+
Basic.extend(this, {
|
4020 |
+
/**
|
4021 |
+
File name
|
4022 |
+
|
4023 |
+
@property name
|
4024 |
+
@type {String}
|
4025 |
+
@default UID
|
4026 |
+
*/
|
4027 |
+
name: name || Basic.guid('file_'),
|
4028 |
+
|
4029 |
+
/**
|
4030 |
+
Relative path to the file inside a directory
|
4031 |
+
|
4032 |
+
@property relativePath
|
4033 |
+
@type {String}
|
4034 |
+
@default ''
|
4035 |
+
*/
|
4036 |
+
relativePath: '',
|
4037 |
+
|
4038 |
+
/**
|
4039 |
+
Date of last modification
|
4040 |
+
|
4041 |
+
@property lastModifiedDate
|
4042 |
+
@type {String}
|
4043 |
+
@default now
|
4044 |
+
*/
|
4045 |
+
lastModifiedDate: file.lastModifiedDate || (new Date()).toLocaleString() // Thu Aug 23 2012 19:40:00 GMT+0400 (GET)
|
4046 |
+
});
|
4047 |
+
}
|
4048 |
+
|
4049 |
+
File.prototype = Blob.prototype;
|
4050 |
+
|
4051 |
+
return File;
|
4052 |
+
});
|
4053 |
+
|
4054 |
+
// Included from: src/javascript/file/FileDrop.js
|
4055 |
+
|
4056 |
+
/**
|
4057 |
+
* FileDrop.js
|
4058 |
+
*
|
4059 |
+
* Copyright 2013, Moxiecode Systems AB
|
4060 |
+
* Released under GPL License.
|
4061 |
+
*
|
4062 |
+
* License: http://www.plupload.com/license
|
4063 |
+
* Contributing: http://www.plupload.com/contributing
|
4064 |
+
*/
|
4065 |
+
|
4066 |
+
define('moxie/file/FileDrop', [
|
4067 |
+
'moxie/core/I18n',
|
4068 |
+
'moxie/core/utils/Dom',
|
4069 |
+
'moxie/core/Exceptions',
|
4070 |
+
'moxie/core/utils/Basic',
|
4071 |
+
'moxie/core/utils/Env',
|
4072 |
+
'moxie/file/File',
|
4073 |
+
'moxie/runtime/RuntimeClient',
|
4074 |
+
'moxie/core/EventTarget',
|
4075 |
+
'moxie/core/utils/Mime'
|
4076 |
+
], function(I18n, Dom, x, Basic, Env, File, RuntimeClient, EventTarget, Mime) {
|
4077 |
+
/**
|
4078 |
+
Turn arbitrary DOM element to a drop zone accepting files. Converts selected files to _File_ objects, to be used
|
4079 |
+
in conjunction with _Image_, preloaded in memory with _FileReader_ or uploaded to a server through
|
4080 |
+
_XMLHttpRequest_.
|
4081 |
+
|
4082 |
+
@example
|
4083 |
+
<div id="drop_zone">
|
4084 |
+
Drop files here
|
4085 |
+
</div>
|
4086 |
+
<br />
|
4087 |
+
<div id="filelist"></div>
|
4088 |
+
|
4089 |
+
<script type="text/javascript">
|
4090 |
+
var fileDrop = new moxie.file.FileDrop('drop_zone'), fileList = moxie.utils.Dom.get('filelist');
|
4091 |
+
|
4092 |
+
fileDrop.ondrop = function() {
|
4093 |
+
moxie.utils.Basic.each(this.files, function(file) {
|
4094 |
+
fileList.innerHTML += '<div>' + file.name + '</div>';
|
4095 |
+
});
|
4096 |
+
};
|
4097 |
+
|
4098 |
+
fileDrop.init();
|
4099 |
+
</script>
|
4100 |
+
|
4101 |
+
@class moxie/file/FileDrop
|
4102 |
+
@constructor
|
4103 |
+
@extends EventTarget
|
4104 |
+
@uses RuntimeClient
|
4105 |
+
@param {Object|String} options If options has typeof string, argument is considered as options.drop_zone
|
4106 |
+
@param {String|DOMElement} options.drop_zone DOM Element to turn into a drop zone
|
4107 |
+
@param {Array} [options.accept] Array of mime types to accept. By default accepts all
|
4108 |
+
@param {Object|String} [options.required_caps] Set of required capabilities, that chosen runtime must support
|
4109 |
+
*/
|
4110 |
+
var dispatches = [
|
4111 |
+
/**
|
4112 |
+
Dispatched when runtime is connected and drop zone is ready to accept files.
|
4113 |
+
|
4114 |
+
@event ready
|
4115 |
+
@param {Object} event
|
4116 |
+
*/
|
4117 |
+
'ready',
|
4118 |
+
|
4119 |
+
/**
|
4120 |
+
Dispatched when dragging cursor enters the drop zone.
|
4121 |
+
|
4122 |
+
@event dragenter
|
4123 |
+
@param {Object} event
|
4124 |
+
*/
|
4125 |
+
'dragenter',
|
4126 |
+
|
4127 |
+
/**
|
4128 |
+
Dispatched when dragging cursor leaves the drop zone.
|
4129 |
+
|
4130 |
+
@event dragleave
|
4131 |
+
@param {Object} event
|
4132 |
+
*/
|
4133 |
+
'dragleave',
|
4134 |
+
|
4135 |
+
/**
|
4136 |
+
Dispatched when file is dropped onto the drop zone.
|
4137 |
+
|
4138 |
+
@event drop
|
4139 |
+
@param {Object} event
|
4140 |
+
*/
|
4141 |
+
'drop',
|
4142 |
+
|
4143 |
+
/**
|
4144 |
+
Dispatched if error occurs.
|
4145 |
+
|
4146 |
+
@event error
|
4147 |
+
@param {Object} event
|
4148 |
+
*/
|
4149 |
+
'error'
|
4150 |
+
];
|
4151 |
+
|
4152 |
+
function FileDrop(options) {
|
4153 |
+
if (MXI_DEBUG) {
|
4154 |
+
Env.log("Instantiating FileDrop...");
|
4155 |
+
}
|
4156 |
+
|
4157 |
+
var self = this, defaults;
|
4158 |
+
|
4159 |
+
// if flat argument passed it should be drop_zone id
|
4160 |
+
if (typeof(options) === 'string') {
|
4161 |
+
options = { drop_zone : options };
|
4162 |
+
}
|
4163 |
+
|
4164 |
+
// figure out the options
|
4165 |
+
defaults = {
|
4166 |
+
accept: [{
|
4167 |
+
title: I18n.translate('All Files'),
|
4168 |
+
extensions: '*'
|
4169 |
+
}],
|
4170 |
+
required_caps: {
|
4171 |
+
drag_and_drop: true
|
4172 |
+
}
|
4173 |
+
};
|
4174 |
+
|
4175 |
+
options = typeof(options) === 'object' ? Basic.extend({}, defaults, options) : defaults;
|
4176 |
+
|
4177 |
+
// this will help us to find proper default container
|
4178 |
+
options.container = Dom.get(options.drop_zone) || document.body;
|
4179 |
+
|
4180 |
+
// make container relative, if it is not
|
4181 |
+
if (Dom.getStyle(options.container, 'position') === 'static') {
|
4182 |
+
options.container.style.position = 'relative';
|
4183 |
+
}
|
4184 |
+
|
4185 |
+
// normalize accept option (could be list of mime types or array of title/extensions pairs)
|
4186 |
+
if (typeof(options.accept) === 'string') {
|
4187 |
+
options.accept = Mime.mimes2extList(options.accept);
|
4188 |
+
}
|
4189 |
+
|
4190 |
+
RuntimeClient.call(self);
|
4191 |
+
|
4192 |
+
Basic.extend(self, {
|
4193 |
+
uid: Basic.guid('uid_'),
|
4194 |
+
|
4195 |
+
ruid: null,
|
4196 |
+
|
4197 |
+
files: null,
|
4198 |
+
|
4199 |
+
init: function() {
|
4200 |
+
self.bind('RuntimeInit', function(e, runtime) {
|
4201 |
+
self.ruid = runtime.uid;
|
4202 |
+
runtime.exec.call(self, 'FileDrop', 'init', options);
|
4203 |
+
self.dispatchEvent('ready');
|
4204 |
+
});
|
4205 |
+
|
4206 |
+
// runtime needs: options.required_features, options.runtime_order and options.container
|
4207 |
+
self.connectRuntime(options); // throws RuntimeError
|
4208 |
+
},
|
4209 |
+
|
4210 |
+
destroy: function() {
|
4211 |
+
var runtime = this.getRuntime();
|
4212 |
+
if (runtime) {
|
4213 |
+
runtime.exec.call(this, 'FileDrop', 'destroy');
|
4214 |
+
this.disconnectRuntime();
|
4215 |
+
}
|
4216 |
+
this.files = null;
|
4217 |
+
|
4218 |
+
this.unbindAll();
|
4219 |
+
}
|
4220 |
+
});
|
4221 |
+
|
4222 |
+
this.handleEventProps(dispatches);
|
4223 |
+
}
|
4224 |
+
|
4225 |
+
FileDrop.prototype = EventTarget.instance;
|
4226 |
+
|
4227 |
+
return FileDrop;
|
4228 |
+
});
|
4229 |
+
|
4230 |
+
// Included from: src/javascript/file/FileReader.js
|
4231 |
+
|
4232 |
+
/**
|
4233 |
+
* FileReader.js
|
4234 |
+
*
|
4235 |
+
* Copyright 2013, Moxiecode Systems AB
|
4236 |
+
* Released under GPL License.
|
4237 |
+
*
|
4238 |
+
* License: http://www.plupload.com/license
|
4239 |
+
* Contributing: http://www.plupload.com/contributing
|
4240 |
+
*/
|
4241 |
+
|
4242 |
+
define('moxie/file/FileReader', [
|
4243 |
+
'moxie/core/utils/Basic',
|
4244 |
+
'moxie/core/utils/Encode',
|
4245 |
+
'moxie/core/Exceptions',
|
4246 |
+
'moxie/core/EventTarget',
|
4247 |
+
'moxie/file/Blob',
|
4248 |
+
'moxie/runtime/RuntimeClient'
|
4249 |
+
], function(Basic, Encode, x, EventTarget, Blob, RuntimeClient) {
|
4250 |
+
/**
|
4251 |
+
Utility for preloading o.Blob/o.File objects in memory. By design closely follows [W3C FileReader](http://www.w3.org/TR/FileAPI/#dfn-filereader)
|
4252 |
+
interface. Where possible uses native FileReader, where - not falls back to shims.
|
4253 |
+
|
4254 |
+
@class moxie/file/FileReader
|
4255 |
+
@constructor FileReader
|
4256 |
+
@extends EventTarget
|
4257 |
+
@uses RuntimeClient
|
4258 |
+
*/
|
4259 |
+
var dispatches = [
|
4260 |
+
|
4261 |
+
/**
|
4262 |
+
Dispatched when the read starts.
|
4263 |
+
|
4264 |
+
@event loadstart
|
4265 |
+
@param {Object} event
|
4266 |
+
*/
|
4267 |
+
'loadstart',
|
4268 |
+
|
4269 |
+
/**
|
4270 |
+
Dispatched while reading (and decoding) blob, and reporting partial Blob data (progess.loaded/progress.total).
|
4271 |
+
|
4272 |
+
@event progress
|
4273 |
+
@param {Object} event
|
4274 |
+
*/
|
4275 |
+
'progress',
|
4276 |
+
|
4277 |
+
/**
|
4278 |
+
Dispatched when the read has successfully completed.
|
4279 |
+
|
4280 |
+
@event load
|
4281 |
+
@param {Object} event
|
4282 |
+
*/
|
4283 |
+
'load',
|
4284 |
+
|
4285 |
+
/**
|
4286 |
+
Dispatched when the read has been aborted. For instance, by invoking the abort() method.
|
4287 |
+
|
4288 |
+
@event abort
|
4289 |
+
@param {Object} event
|
4290 |
+
*/
|
4291 |
+
'abort',
|
4292 |
+
|
4293 |
+
/**
|
4294 |
+
Dispatched when the read has failed.
|
4295 |
+
|
4296 |
+
@event error
|
4297 |
+
@param {Object} event
|
4298 |
+
*/
|
4299 |
+
'error',
|
4300 |
+
|
4301 |
+
/**
|
4302 |
+
Dispatched when the request has completed (either in success or failure).
|
4303 |
+
|
4304 |
+
@event loadend
|
4305 |
+
@param {Object} event
|
4306 |
+
*/
|
4307 |
+
'loadend'
|
4308 |
+
];
|
4309 |
+
|
4310 |
+
function FileReader() {
|
4311 |
+
|
4312 |
+
RuntimeClient.call(this);
|
4313 |
+
|
4314 |
+
Basic.extend(this, {
|
4315 |
+
/**
|
4316 |
+
UID of the component instance.
|
4317 |
+
|
4318 |
+
@property uid
|
4319 |
+
@type {String}
|
4320 |
+
*/
|
4321 |
+
uid: Basic.guid('uid_'),
|
4322 |
+
|
4323 |
+
/**
|
4324 |
+
Contains current state of FileReader object. Can take values of FileReader.EMPTY, FileReader.LOADING
|
4325 |
+
and FileReader.DONE.
|
4326 |
+
|
4327 |
+
@property readyState
|
4328 |
+
@type {Number}
|
4329 |
+
@default FileReader.EMPTY
|
4330 |
+
*/
|
4331 |
+
readyState: FileReader.EMPTY,
|
4332 |
+
|
4333 |
+
/**
|
4334 |
+
Result of the successful read operation.
|
4335 |
+
|
4336 |
+
@property result
|
4337 |
+
@type {String}
|
4338 |
+
*/
|
4339 |
+
result: null,
|
4340 |
+
|
4341 |
+
/**
|
4342 |
+
Stores the error of failed asynchronous read operation.
|
4343 |
+
|
4344 |
+
@property error
|
4345 |
+
@type {DOMError}
|
4346 |
+
*/
|
4347 |
+
error: null,
|
4348 |
+
|
4349 |
+
/**
|
4350 |
+
Initiates reading of File/Blob object contents to binary string.
|
4351 |
+
|
4352 |
+
@method readAsBinaryString
|
4353 |
+
@param {Blob|File} blob Object to preload
|
4354 |
+
*/
|
4355 |
+
readAsBinaryString: function(blob) {
|
4356 |
+
_read.call(this, 'readAsBinaryString', blob);
|
4357 |
+
},
|
4358 |
+
|
4359 |
+
/**
|
4360 |
+
Initiates reading of File/Blob object contents to dataURL string.
|
4361 |
+
|
4362 |
+
@method readAsDataURL
|
4363 |
+
@param {Blob|File} blob Object to preload
|
4364 |
+
*/
|
4365 |
+
readAsDataURL: function(blob) {
|
4366 |
+
_read.call(this, 'readAsDataURL', blob);
|
4367 |
+
},
|
4368 |
+
|
4369 |
+
/**
|
4370 |
+
Initiates reading of File/Blob object contents to string.
|
4371 |
+
|
4372 |
+
@method readAsText
|
4373 |
+
@param {Blob|File} blob Object to preload
|
4374 |
+
*/
|
4375 |
+
readAsText: function(blob) {
|
4376 |
+
_read.call(this, 'readAsText', blob);
|
4377 |
+
},
|
4378 |
+
|
4379 |
+
/**
|
4380 |
+
Aborts preloading process.
|
4381 |
+
|
4382 |
+
@method abort
|
4383 |
+
*/
|
4384 |
+
abort: function() {
|
4385 |
+
this.result = null;
|
4386 |
+
|
4387 |
+
if (Basic.inArray(this.readyState, [FileReader.EMPTY, FileReader.DONE]) !== -1) {
|
4388 |
+
return;
|
4389 |
+
} else if (this.readyState === FileReader.LOADING) {
|
4390 |
+
this.readyState = FileReader.DONE;
|
4391 |
+
}
|
4392 |
+
|
4393 |
+
this.exec('FileReader', 'abort');
|
4394 |
+
|
4395 |
+
this.trigger('abort');
|
4396 |
+
this.trigger('loadend');
|
4397 |
+
},
|
4398 |
+
|
4399 |
+
/**
|
4400 |
+
Destroy component and release resources.
|
4401 |
+
|
4402 |
+
@method destroy
|
4403 |
+
*/
|
4404 |
+
destroy: function() {
|
4405 |
+
this.abort();
|
4406 |
+
this.exec('FileReader', 'destroy');
|
4407 |
+
this.disconnectRuntime();
|
4408 |
+
this.unbindAll();
|
4409 |
+
}
|
4410 |
+
});
|
4411 |
+
|
4412 |
+
// uid must already be assigned
|
4413 |
+
this.handleEventProps(dispatches);
|
4414 |
+
|
4415 |
+
this.bind('Error', function(e, err) {
|
4416 |
+
this.readyState = FileReader.DONE;
|
4417 |
+
this.error = err;
|
4418 |
+
}, 999);
|
4419 |
+
|
4420 |
+
this.bind('Load', function(e) {
|
4421 |
+
this.readyState = FileReader.DONE;
|
4422 |
+
}, 999);
|
4423 |
+
|
4424 |
+
|
4425 |
+
function _read(op, blob) {
|
4426 |
+
var self = this;
|
4427 |
+
|
4428 |
+
this.trigger('loadstart');
|
4429 |
+
|
4430 |
+
if (this.readyState === FileReader.LOADING) {
|
4431 |
+
this.trigger('error', new x.DOMException(x.DOMException.INVALID_STATE_ERR));
|
4432 |
+
this.trigger('loadend');
|
4433 |
+
return;
|
4434 |
+
}
|
4435 |
+
|
4436 |
+
// if source is not o.Blob/o.File
|
4437 |
+
if (!(blob instanceof Blob)) {
|
4438 |
+
this.trigger('error', new x.DOMException(x.DOMException.NOT_FOUND_ERR));
|
4439 |
+
this.trigger('loadend');
|
4440 |
+
return;
|
4441 |
+
}
|
4442 |
+
|
4443 |
+
this.result = null;
|
4444 |
+
this.readyState = FileReader.LOADING;
|
4445 |
+
|
4446 |
+
if (blob.isDetached()) {
|
4447 |
+
var src = blob.getSource();
|
4448 |
+
switch (op) {
|
4449 |
+
case 'readAsText':
|
4450 |
+
case 'readAsBinaryString':
|
4451 |
+
this.result = src;
|
4452 |
+
break;
|
4453 |
+
case 'readAsDataURL':
|
4454 |
+
this.result = 'data:' + blob.type + ';base64,' + Encode.btoa(src);
|
4455 |
+
break;
|
4456 |
+
}
|
4457 |
+
this.readyState = FileReader.DONE;
|
4458 |
+
this.trigger('load');
|
4459 |
+
this.trigger('loadend');
|
4460 |
+
} else {
|
4461 |
+
this.connectRuntime(blob.ruid);
|
4462 |
+
this.exec('FileReader', 'read', op, blob);
|
4463 |
+
}
|
4464 |
+
}
|
4465 |
+
}
|
4466 |
+
|
4467 |
+
/**
|
4468 |
+
Initial FileReader state
|
4469 |
+
|
4470 |
+
@property EMPTY
|
4471 |
+
@type {Number}
|
4472 |
+
@final
|
4473 |
+
@static
|
4474 |
+
@default 0
|
4475 |
+
*/
|
4476 |
+
FileReader.EMPTY = 0;
|
4477 |
+
|
4478 |
+
/**
|
4479 |
+
FileReader switches to this state when it is preloading the source
|
4480 |
+
|
4481 |
+
@property LOADING
|
4482 |
+
@type {Number}
|
4483 |
+
@final
|
4484 |
+
@static
|
4485 |
+
@default 1
|
4486 |
+
*/
|
4487 |
+
FileReader.LOADING = 1;
|
4488 |
+
|
4489 |
+
/**
|
4490 |
+
Preloading is complete, this is a final state
|
4491 |
+
|
4492 |
+
@property DONE
|
4493 |
+
@type {Number}
|
4494 |
+
@final
|
4495 |
+
@static
|
4496 |
+
@default 2
|
4497 |
+
*/
|
4498 |
+
FileReader.DONE = 2;
|
4499 |
+
|
4500 |
+
FileReader.prototype = EventTarget.instance;
|
4501 |
+
|
4502 |
+
return FileReader;
|
4503 |
+
});
|
4504 |
+
|
4505 |
+
// Included from: src/javascript/core/utils/Url.js
|
4506 |
+
|
4507 |
+
/**
|
4508 |
+
* Url.js
|
4509 |
+
*
|
4510 |
+
* Copyright 2013, Moxiecode Systems AB
|
4511 |
+
* Released under GPL License.
|
4512 |
+
*
|
4513 |
+
* License: http://www.plupload.com/license
|
4514 |
+
* Contributing: http://www.plupload.com/contributing
|
4515 |
+
*/
|
4516 |
+
|
4517 |
+
/**
|
4518 |
+
@class moxie/core/utils/Url
|
4519 |
+
@public
|
4520 |
+
@static
|
4521 |
+
*/
|
4522 |
+
|
4523 |
+
define('moxie/core/utils/Url', [
|
4524 |
+
'moxie/core/utils/Basic'
|
4525 |
+
], function(Basic) {
|
4526 |
+
/**
|
4527 |
+
Parse url into separate components and fill in absent parts with parts from current url,
|
4528 |
+
based on https://raw.github.com/kvz/phpjs/master/functions/url/parse_url.js
|
4529 |
+
|
4530 |
+
@method parseUrl
|
4531 |
+
@static
|
4532 |
+
@param {String} url Url to parse (defaults to empty string if undefined)
|
4533 |
+
@return {Object} Hash containing extracted uri components
|
4534 |
+
*/
|
4535 |
+
var parseUrl = function(url, currentUrl) {
|
4536 |
+
var key = ['source', 'scheme', 'authority', 'userInfo', 'user', 'pass', 'host', 'port', 'relative', 'path', 'directory', 'file', 'query', 'fragment']
|
4537 |
+
, i = key.length
|
4538 |
+
, ports = {
|
4539 |
+
http: 80,
|
4540 |
+
https: 443
|
4541 |
+
}
|
4542 |
+
, uri = {}
|
4543 |
+
, regex = /^(?:([^:\/?#]+):)?(?:\/\/()(?:(?:()(?:([^:@\/]*):?([^:@\/]*))?@)?(\[[\da-fA-F:]+\]|[^:\/?#]*)(?::(\d*))?))?()(?:(()(?:(?:[^?#\/]*\/)*)()(?:[^?#]*))(?:\\?([^#]*))?(?:#(.*))?)/
|
4544 |
+
, m = regex.exec(url || '')
|
4545 |
+
, isRelative
|
4546 |
+
, isSchemeLess = /^\/\/\w/.test(url)
|
4547 |
+
;
|
4548 |
+
|
4549 |
+
switch (Basic.typeOf(currentUrl)) {
|
4550 |
+
case 'undefined':
|
4551 |
+
currentUrl = parseUrl(document.location.href, false);
|
4552 |
+
break;
|
4553 |
+
|
4554 |
+
case 'string':
|
4555 |
+
currentUrl = parseUrl(currentUrl, false);
|
4556 |
+
break;
|
4557 |
+
}
|
4558 |
+
|
4559 |
+
while (i--) {
|
4560 |
+
if (m[i]) {
|
4561 |
+
uri[key[i]] = m[i];
|
4562 |
+
}
|
4563 |
+
}
|
4564 |
+
|
4565 |
+
isRelative = !isSchemeLess && !uri.scheme;
|
4566 |
+
|
4567 |
+
if (isSchemeLess || isRelative) {
|
4568 |
+
uri.scheme = currentUrl.scheme;
|
4569 |
+
}
|
4570 |
+
|
4571 |
+
// when url is relative, we set the origin and the path ourselves
|
4572 |
+
if (isRelative) {
|
4573 |
+
uri.host = currentUrl.host;
|
4574 |
+
uri.port = currentUrl.port;
|
4575 |
+
|
4576 |
+
var path = '';
|
4577 |
+
// for urls without trailing slash we need to figure out the path
|
4578 |
+
if (/^[^\/]/.test(uri.path)) {
|
4579 |
+
path = currentUrl.path;
|
4580 |
+
// if path ends with a filename, strip it
|
4581 |
+
if (/\/[^\/]*\.[^\/]*$/.test(path)) {
|
4582 |
+
path = path.replace(/\/[^\/]+$/, '/');
|
4583 |
+
} else {
|
4584 |
+
// avoid double slash at the end (see #127)
|
4585 |
+
path = path.replace(/\/?$/, '/');
|
4586 |
+
}
|
4587 |
+
}
|
4588 |
+
uri.path = path + (uri.path || ''); // site may reside at domain.com or domain.com/subdir
|
4589 |
+
}
|
4590 |
+
|
4591 |
+
if (!uri.port) {
|
4592 |
+
uri.port = ports[uri.scheme] || 80;
|
4593 |
+
}
|
4594 |
+
|
4595 |
+
uri.port = parseInt(uri.port, 10);
|
4596 |
+
|
4597 |
+
if (!uri.path) {
|
4598 |
+
uri.path = "/";
|
4599 |
+
}
|
4600 |
+
|
4601 |
+
delete uri.source;
|
4602 |
+
|
4603 |
+
return uri;
|
4604 |
+
};
|
4605 |
+
|
4606 |
+
/**
|
4607 |
+
Resolve url - among other things will turn relative url to absolute
|
4608 |
+
|
4609 |
+
@method resolveUrl
|
4610 |
+
@static
|
4611 |
+
@param {String|Object} url Either absolute or relative, or a result of parseUrl call
|
4612 |
+
@return {String} Resolved, absolute url
|
4613 |
+
*/
|
4614 |
+
var resolveUrl = function(url) {
|
4615 |
+
var ports = { // we ignore default ports
|
4616 |
+
http: 80,
|
4617 |
+
https: 443
|
4618 |
+
}
|
4619 |
+
, urlp = typeof(url) === 'object' ? url : parseUrl(url);
|
4620 |
+
;
|
4621 |
+
|
4622 |
+
return urlp.scheme + '://' + urlp.host + (urlp.port !== ports[urlp.scheme] ? ':' + urlp.port : '') + urlp.path + (urlp.query ? urlp.query : '');
|
4623 |
+
};
|
4624 |
+
|
4625 |
+
/**
|
4626 |
+
Check if specified url has the same origin as the current document
|
4627 |
+
|
4628 |
+
@method hasSameOrigin
|
4629 |
+
@static
|
4630 |
+
@param {String|Object} url
|
4631 |
+
@return {Boolean}
|
4632 |
+
*/
|
4633 |
+
var hasSameOrigin = function(url) {
|
4634 |
+
function origin(url) {
|
4635 |
+
return [url.scheme, url.host, url.port].join('/');
|
4636 |
+
}
|
4637 |
+
|
4638 |
+
if (typeof url === 'string') {
|
4639 |
+
url = parseUrl(url);
|
4640 |
+
}
|
4641 |
+
|
4642 |
+
return origin(parseUrl()) === origin(url);
|
4643 |
+
};
|
4644 |
+
|
4645 |
+
return {
|
4646 |
+
parseUrl: parseUrl,
|
4647 |
+
resolveUrl: resolveUrl,
|
4648 |
+
hasSameOrigin: hasSameOrigin
|
4649 |
+
};
|
4650 |
+
});
|
4651 |
+
|
4652 |
+
// Included from: src/javascript/runtime/RuntimeTarget.js
|
4653 |
+
|
4654 |
+
/**
|
4655 |
+
* RuntimeTarget.js
|
4656 |
+
*
|
4657 |
+
* Copyright 2013, Moxiecode Systems AB
|
4658 |
+
* Released under GPL License.
|
4659 |
+
*
|
4660 |
+
* License: http://www.plupload.com/license
|
4661 |
+
* Contributing: http://www.plupload.com/contributing
|
4662 |
+
*/
|
4663 |
+
|
4664 |
+
define('moxie/runtime/RuntimeTarget', [
|
4665 |
+
'moxie/core/utils/Basic',
|
4666 |
+
'moxie/runtime/RuntimeClient',
|
4667 |
+
"moxie/core/EventTarget"
|
4668 |
+
], function(Basic, RuntimeClient, EventTarget) {
|
4669 |
+
/**
|
4670 |
+
Instance of this class can be used as a target for the events dispatched by shims,
|
4671 |
+
when allowing them onto components is for either reason inappropriate
|
4672 |
+
|
4673 |
+
@class moxie/runtime/RuntimeTarget
|
4674 |
+
@constructor
|
4675 |
+
@protected
|
4676 |
+
@extends EventTarget
|
4677 |
+
*/
|
4678 |
+
function RuntimeTarget() {
|
4679 |
+
this.uid = Basic.guid('uid_');
|
4680 |
+
|
4681 |
+
RuntimeClient.call(this);
|
4682 |
+
|
4683 |
+
this.destroy = function() {
|
4684 |
+
this.disconnectRuntime();
|
4685 |
+
this.unbindAll();
|
4686 |
+
};
|
4687 |
+
}
|
4688 |
+
|
4689 |
+
RuntimeTarget.prototype = EventTarget.instance;
|
4690 |
+
|
4691 |
+
return RuntimeTarget;
|
4692 |
+
});
|
4693 |
+
|
4694 |
+
// Included from: src/javascript/file/FileReaderSync.js
|
4695 |
+
|
4696 |
+
/**
|
4697 |
+
* FileReaderSync.js
|
4698 |
+
*
|
4699 |
+
* Copyright 2013, Moxiecode Systems AB
|
4700 |
+
* Released under GPL License.
|
4701 |
+
*
|
4702 |
+
* License: http://www.plupload.com/license
|
4703 |
+
* Contributing: http://www.plupload.com/contributing
|
4704 |
+
*/
|
4705 |
+
|
4706 |
+
define('moxie/file/FileReaderSync', [
|
4707 |
+
'moxie/core/utils/Basic',
|
4708 |
+
'moxie/runtime/RuntimeClient',
|
4709 |
+
'moxie/core/utils/Encode'
|
4710 |
+
], function(Basic, RuntimeClient, Encode) {
|
4711 |
+
/**
|
4712 |
+
Synchronous FileReader implementation. Something like this is available in WebWorkers environment, here
|
4713 |
+
it can be used to read only preloaded blobs/files and only below certain size (not yet sure what that'd be,
|
4714 |
+
but probably < 1mb). Not meant to be used directly by user.
|
4715 |
+
|
4716 |
+
@class moxie/file/FileReaderSync
|
4717 |
+
@private
|
4718 |
+
@constructor
|
4719 |
+
*/
|
4720 |
+
return function() {
|
4721 |
+
RuntimeClient.call(this);
|
4722 |
+
|
4723 |
+
Basic.extend(this, {
|
4724 |
+
uid: Basic.guid('uid_'),
|
4725 |
+
|
4726 |
+
readAsBinaryString: function(blob) {
|
4727 |
+
return _read.call(this, 'readAsBinaryString', blob);
|
4728 |
+
},
|
4729 |
+
|
4730 |
+
readAsDataURL: function(blob) {
|
4731 |
+
return _read.call(this, 'readAsDataURL', blob);
|
4732 |
+
},
|
4733 |
+
|
4734 |
+
/*readAsArrayBuffer: function(blob) {
|
4735 |
+
return _read.call(this, 'readAsArrayBuffer', blob);
|
4736 |
+
},*/
|
4737 |
+
|
4738 |
+
readAsText: function(blob) {
|
4739 |
+
return _read.call(this, 'readAsText', blob);
|
4740 |
+
}
|
4741 |
+
});
|
4742 |
+
|
4743 |
+
function _read(op, blob) {
|
4744 |
+
if (blob.isDetached()) {
|
4745 |
+
var src = blob.getSource();
|
4746 |
+
switch (op) {
|
4747 |
+
case 'readAsBinaryString':
|
4748 |
+
return src;
|
4749 |
+
case 'readAsDataURL':
|
4750 |
+
return 'data:' + blob.type + ';base64,' + Encode.btoa(src);
|
4751 |
+
case 'readAsText':
|
4752 |
+
var txt = '';
|
4753 |
+
for (var i = 0, length = src.length; i < length; i++) {
|
4754 |
+
txt += String.fromCharCode(src[i]);
|
4755 |
+
}
|
4756 |
+
return txt;
|
4757 |
+
}
|
4758 |
+
} else {
|
4759 |
+
var result = this.connectRuntime(blob.ruid).exec.call(this, 'FileReaderSync', 'read', op, blob);
|
4760 |
+
this.disconnectRuntime();
|
4761 |
+
return result;
|
4762 |
+
}
|
4763 |
+
}
|
4764 |
+
};
|
4765 |
+
});
|
4766 |
+
|
4767 |
+
// Included from: src/javascript/xhr/FormData.js
|
4768 |
+
|
4769 |
+
/**
|
4770 |
+
* FormData.js
|
4771 |
+
*
|
4772 |
+
* Copyright 2013, Moxiecode Systems AB
|
4773 |
+
* Released under GPL License.
|
4774 |
+
*
|
4775 |
+
* License: http://www.plupload.com/license
|
4776 |
+
* Contributing: http://www.plupload.com/contributing
|
4777 |
+
*/
|
4778 |
+
|
4779 |
+
define("moxie/xhr/FormData", [
|
4780 |
+
"moxie/core/Exceptions",
|
4781 |
+
"moxie/core/utils/Basic",
|
4782 |
+
"moxie/file/Blob"
|
4783 |
+
], function(x, Basic, Blob) {
|
4784 |
+
/**
|
4785 |
+
FormData
|
4786 |
+
|
4787 |
+
@class moxie/xhr/FormData
|
4788 |
+
@constructor
|
4789 |
+
*/
|
4790 |
+
function FormData() {
|
4791 |
+
var _blob, _fields = [];
|
4792 |
+
|
4793 |
+
Basic.extend(this, {
|
4794 |
+
/**
|
4795 |
+
Append another key-value pair to the FormData object
|
4796 |
+
|
4797 |
+
@method append
|
4798 |
+
@param {String} name Name for the new field
|
4799 |
+
@param {String|Blob|Array|Object} value Value for the field
|
4800 |
+
*/
|
4801 |
+
append: function(name, value) {
|
4802 |
+
var self = this, valueType = Basic.typeOf(value);
|
4803 |
+
|
4804 |
+
// according to specs value might be either Blob or String
|
4805 |
+
if (value instanceof Blob) {
|
4806 |
+
_blob = {
|
4807 |
+
name: name,
|
4808 |
+
value: value // unfortunately we can only send single Blob in one FormData
|
4809 |
+
};
|
4810 |
+
} else if ('array' === valueType) {
|
4811 |
+
name += '[]';
|
4812 |
+
|
4813 |
+
Basic.each(value, function(value) {
|
4814 |
+
self.append(name, value);
|
4815 |
+
});
|
4816 |
+
} else if ('object' === valueType) {
|
4817 |
+
Basic.each(value, function(value, key) {
|
4818 |
+
self.append(name + '[' + key + ']', value);
|
4819 |
+
});
|
4820 |
+
} else if ('null' === valueType || 'undefined' === valueType || 'number' === valueType && isNaN(value)) {
|
4821 |
+
self.append(name, "false");
|
4822 |
+
} else {
|
4823 |
+
_fields.push({
|
4824 |
+
name: name,
|
4825 |
+
value: value.toString()
|
4826 |
+
});
|
4827 |
+
}
|
4828 |
+
},
|
4829 |
+
|
4830 |
+
/**
|
4831 |
+
Checks if FormData contains Blob.
|
4832 |
+
|
4833 |
+
@method hasBlob
|
4834 |
+
@return {Boolean}
|
4835 |
+
*/
|
4836 |
+
hasBlob: function() {
|
4837 |
+
return !!this.getBlob();
|
4838 |
+
},
|
4839 |
+
|
4840 |
+
/**
|
4841 |
+
Retrieves blob.
|
4842 |
+
|
4843 |
+
@method getBlob
|
4844 |
+
@return {Object} Either Blob if found or null
|
4845 |
+
*/
|
4846 |
+
getBlob: function() {
|
4847 |
+
return _blob && _blob.value || null;
|
4848 |
+
},
|
4849 |
+
|
4850 |
+
/**
|
4851 |
+
Retrieves blob field name.
|
4852 |
+
|
4853 |
+
@method getBlobName
|
4854 |
+
@return {String} Either Blob field name or null
|
4855 |
+
*/
|
4856 |
+
getBlobName: function() {
|
4857 |
+
return _blob && _blob.name || null;
|
4858 |
+
},
|
4859 |
+
|
4860 |
+
/**
|
4861 |
+
Loop over the fields in FormData and invoke the callback for each of them.
|
4862 |
+
|
4863 |
+
@method each
|
4864 |
+
@param {Function} cb Callback to call for each field
|
4865 |
+
*/
|
4866 |
+
each: function(cb) {
|
4867 |
+
Basic.each(_fields, function(field) {
|
4868 |
+
cb(field.value, field.name);
|
4869 |
+
});
|
4870 |
+
|
4871 |
+
if (_blob) {
|
4872 |
+
cb(_blob.value, _blob.name);
|
4873 |
+
}
|
4874 |
+
},
|
4875 |
+
|
4876 |
+
destroy: function() {
|
4877 |
+
_blob = null;
|
4878 |
+
_fields = [];
|
4879 |
+
}
|
4880 |
+
});
|
4881 |
+
}
|
4882 |
+
|
4883 |
+
return FormData;
|
4884 |
+
});
|
4885 |
+
|
4886 |
+
// Included from: src/javascript/xhr/XMLHttpRequest.js
|
4887 |
+
|
4888 |
+
/**
|
4889 |
+
* XMLHttpRequest.js
|
4890 |
+
*
|
4891 |
+
* Copyright 2013, Moxiecode Systems AB
|
4892 |
+
* Released under GPL License.
|
4893 |
+
*
|
4894 |
+
* License: http://www.plupload.com/license
|
4895 |
+
* Contributing: http://www.plupload.com/contributing
|
4896 |
+
*/
|
4897 |
+
|
4898 |
+
define("moxie/xhr/XMLHttpRequest", [
|
4899 |
+
"moxie/core/utils/Basic",
|
4900 |
+
"moxie/core/Exceptions",
|
4901 |
+
"moxie/core/EventTarget",
|
4902 |
+
"moxie/core/utils/Encode",
|
4903 |
+
"moxie/core/utils/Url",
|
4904 |
+
"moxie/runtime/Runtime",
|
4905 |
+
"moxie/runtime/RuntimeTarget",
|
4906 |
+
"moxie/file/Blob",
|
4907 |
+
"moxie/file/FileReaderSync",
|
4908 |
+
"moxie/xhr/FormData",
|
4909 |
+
"moxie/core/utils/Env",
|
4910 |
+
"moxie/core/utils/Mime"
|
4911 |
+
], function(Basic, x, EventTarget, Encode, Url, Runtime, RuntimeTarget, Blob, FileReaderSync, FormData, Env, Mime) {
|
4912 |
+
|
4913 |
+
var httpCode = {
|
4914 |
+
100: 'Continue',
|
4915 |
+
101: 'Switching Protocols',
|
4916 |
+
102: 'Processing',
|
4917 |
+
|
4918 |
+
200: 'OK',
|
4919 |
+
201: 'Created',
|
4920 |
+
202: 'Accepted',
|
4921 |
+
203: 'Non-Authoritative Information',
|
4922 |
+
204: 'No Content',
|
4923 |
+
205: 'Reset Content',
|
4924 |
+
206: 'Partial Content',
|
4925 |
+
207: 'Multi-Status',
|
4926 |
+
226: 'IM Used',
|
4927 |
+
|
4928 |
+
300: 'Multiple Choices',
|
4929 |
+
301: 'Moved Permanently',
|
4930 |
+
302: 'Found',
|
4931 |
+
303: 'See Other',
|
4932 |
+
304: 'Not Modified',
|
4933 |
+
305: 'Use Proxy',
|
4934 |
+
306: 'Reserved',
|
4935 |
+
307: 'Temporary Redirect',
|
4936 |
+
|
4937 |
+
400: 'Bad Request',
|
4938 |
+
401: 'Unauthorized',
|
4939 |
+
402: 'Payment Required',
|
4940 |
+
403: 'Forbidden',
|
4941 |
+
404: 'Not Found',
|
4942 |
+
405: 'Method Not Allowed',
|
4943 |
+
406: 'Not Acceptable',
|
4944 |
+
407: 'Proxy Authentication Required',
|
4945 |
+
408: 'Request Timeout',
|
4946 |
+
409: 'Conflict',
|
4947 |
+
410: 'Gone',
|
4948 |
+
411: 'Length Required',
|
4949 |
+
412: 'Precondition Failed',
|
4950 |
+
413: 'Request Entity Too Large',
|
4951 |
+
414: 'Request-URI Too Long',
|
4952 |
+
415: 'Unsupported Media Type',
|
4953 |
+
416: 'Requested Range Not Satisfiable',
|
4954 |
+
417: 'Expectation Failed',
|
4955 |
+
422: 'Unprocessable Entity',
|
4956 |
+
423: 'Locked',
|
4957 |
+
424: 'Failed Dependency',
|
4958 |
+
426: 'Upgrade Required',
|
4959 |
+
|
4960 |
+
500: 'Internal Server Error',
|
4961 |
+
501: 'Not Implemented',
|
4962 |
+
502: 'Bad Gateway',
|
4963 |
+
503: 'Service Unavailable',
|
4964 |
+
504: 'Gateway Timeout',
|
4965 |
+
505: 'HTTP Version Not Supported',
|
4966 |
+
506: 'Variant Also Negotiates',
|
4967 |
+
507: 'Insufficient Storage',
|
4968 |
+
510: 'Not Extended'
|
4969 |
+
};
|
4970 |
+
|
4971 |
+
function XMLHttpRequestUpload() {
|
4972 |
+
this.uid = Basic.guid('uid_');
|
4973 |
+
}
|
4974 |
+
|
4975 |
+
XMLHttpRequestUpload.prototype = EventTarget.instance;
|
4976 |
+
|
4977 |
+
/**
|
4978 |
+
Implementation of XMLHttpRequest
|
4979 |
+
|
4980 |
+
@class moxie/xhr/XMLHttpRequest
|
4981 |
+
@constructor
|
4982 |
+
@uses RuntimeClient
|
4983 |
+
@extends EventTarget
|
4984 |
+
*/
|
4985 |
+
var dispatches = [
|
4986 |
+
'loadstart',
|
4987 |
+
|
4988 |
+
'progress',
|
4989 |
+
|
4990 |
+
'abort',
|
4991 |
+
|
4992 |
+
'error',
|
4993 |
+
|
4994 |
+
'load',
|
4995 |
+
|
4996 |
+
'timeout',
|
4997 |
+
|
4998 |
+
'loadend'
|
4999 |
+
|
5000 |
+
// readystatechange (for historical reasons)
|
5001 |
+
];
|
5002 |
+
|
5003 |
+
var NATIVE = 1, RUNTIME = 2;
|
5004 |
+
|
5005 |
+
function XMLHttpRequest() {
|
5006 |
+
var self = this,
|
5007 |
+
// this (together with _p() @see below) is here to gracefully upgrade to setter/getter syntax where possible
|
5008 |
+
props = {
|
5009 |
+
/**
|
5010 |
+
The amount of milliseconds a request can take before being terminated. Initially zero. Zero means there is no timeout.
|
5011 |
+
|
5012 |
+
@property timeout
|
5013 |
+
@type Number
|
5014 |
+
@default 0
|
5015 |
+
*/
|
5016 |
+
timeout: 0,
|
5017 |
+
|
5018 |
+
/**
|
5019 |
+
Current state, can take following values:
|
5020 |
+
UNSENT (numeric value 0)
|
5021 |
+
The object has been constructed.
|
5022 |
+
|
5023 |
+
OPENED (numeric value 1)
|
5024 |
+
The open() method has been successfully invoked. During this state request headers can be set using setRequestHeader() and the request can be made using the send() method.
|
5025 |
+
|
5026 |
+
HEADERS_RECEIVED (numeric value 2)
|
5027 |
+
All redirects (if any) have been followed and all HTTP headers of the final response have been received. Several response members of the object are now available.
|
5028 |
+
|
5029 |
+
LOADING (numeric value 3)
|
5030 |
+
The response entity body is being received.
|
5031 |
+
|
5032 |
+
DONE (numeric value 4)
|
5033 |
+
|
5034 |
+
@property readyState
|
5035 |
+
@type Number
|
5036 |
+
@default 0 (UNSENT)
|
5037 |
+
*/
|
5038 |
+
readyState: XMLHttpRequest.UNSENT,
|
5039 |
+
|
5040 |
+
/**
|
5041 |
+
True when user credentials are to be included in a cross-origin request. False when they are to be excluded
|
5042 |
+
in a cross-origin request and when cookies are to be ignored in its response. Initially false.
|
5043 |
+
|
5044 |
+
@property withCredentials
|
5045 |
+
@type Boolean
|
5046 |
+
@default false
|
5047 |
+
*/
|
5048 |
+
withCredentials: false,
|
5049 |
+
|
5050 |
+
/**
|
5051 |
+
Returns the HTTP status code.
|
5052 |
+
|
5053 |
+
@property status
|
5054 |
+
@type Number
|
5055 |
+
@default 0
|
5056 |
+
*/
|
5057 |
+
status: 0,
|
5058 |
+
|
5059 |
+
/**
|
5060 |
+
Returns the HTTP status text.
|
5061 |
+
|
5062 |
+
@property statusText
|
5063 |
+
@type String
|
5064 |
+
*/
|
5065 |
+
statusText: "",
|
5066 |
+
|
5067 |
+
/**
|
5068 |
+
Returns the response type. Can be set to change the response type. Values are:
|
5069 |
+
the empty string (default), "arraybuffer", "blob", "document", "json", and "text".
|
5070 |
+
|
5071 |
+
@property responseType
|
5072 |
+
@type String
|
5073 |
+
*/
|
5074 |
+
responseType: "",
|
5075 |
+
|
5076 |
+
/**
|
5077 |
+
Returns the document response entity body.
|
5078 |
+
|
5079 |
+
Throws an "InvalidStateError" exception if responseType is not the empty string or "document".
|
5080 |
+
|
5081 |
+
@property responseXML
|
5082 |
+
@type Document
|
5083 |
+
*/
|
5084 |
+
responseXML: null,
|
5085 |
+
|
5086 |
+
/**
|
5087 |
+
Returns the text response entity body.
|
5088 |
+
|
5089 |
+
Throws an "InvalidStateError" exception if responseType is not the empty string or "text".
|
5090 |
+
|
5091 |
+
@property responseText
|
5092 |
+
@type String
|
5093 |
+
*/
|
5094 |
+
responseText: null,
|
5095 |
+
|
5096 |
+
/**
|
5097 |
+
Returns the response entity body (http://www.w3.org/TR/XMLHttpRequest/#response-entity-body).
|
5098 |
+
Can become: ArrayBuffer, Blob, Document, JSON, Text
|
5099 |
+
|
5100 |
+
@property response
|
5101 |
+
@type Mixed
|
5102 |
+
*/
|
5103 |
+
response: null
|
5104 |
+
},
|
5105 |
+
|
5106 |
+
_async = true,
|
5107 |
+
_url,
|
5108 |
+
_method,
|
5109 |
+
_headers = {},
|
5110 |
+
_user,
|
5111 |
+
_password,
|
5112 |
+
_encoding = null,
|
5113 |
+
_mimeType = null,
|
5114 |
+
|
5115 |
+
// flags
|
5116 |
+
_sync_flag = false,
|
5117 |
+
_send_flag = false,
|
5118 |
+
_upload_events_flag = false,
|
5119 |
+
_upload_complete_flag = false,
|
5120 |
+
_error_flag = false,
|
5121 |
+
_same_origin_flag = false,
|
5122 |
+
|
5123 |
+
// times
|
5124 |
+
_start_time,
|
5125 |
+
_timeoutset_time,
|
5126 |
+
|
5127 |
+
_finalMime = null,
|
5128 |
+
_finalCharset = null,
|
5129 |
+
|
5130 |
+
_options = {},
|
5131 |
+
_xhr,
|
5132 |
+
_responseHeaders = '',
|
5133 |
+
_responseHeadersBag
|
5134 |
+
;
|
5135 |
+
|
5136 |
+
|
5137 |
+
Basic.extend(this, props, {
|
5138 |
+
/**
|
5139 |
+
Unique id of the component
|
5140 |
+
|
5141 |
+
@property uid
|
5142 |
+
@type String
|
5143 |
+
*/
|
5144 |
+
uid: Basic.guid('uid_'),
|
5145 |
+
|
5146 |
+
/**
|
5147 |
+
Target for Upload events
|
5148 |
+
|
5149 |
+
@property upload
|
5150 |
+
@type XMLHttpRequestUpload
|
5151 |
+
*/
|
5152 |
+
upload: new XMLHttpRequestUpload(),
|
5153 |
+
|
5154 |
+
|
5155 |
+
/**
|
5156 |
+
Sets the request method, request URL, synchronous flag, request username, and request password.
|
5157 |
+
|
5158 |
+
Throws a "SyntaxError" exception if one of the following is true:
|
5159 |
+
|
5160 |
+
method is not a valid HTTP method.
|
5161 |
+
url cannot be resolved.
|
5162 |
+
url contains the "user:password" format in the userinfo production.
|
5163 |
+
Throws a "SecurityError" exception if method is a case-insensitive match for CONNECT, TRACE or TRACK.
|
5164 |
+
|
5165 |
+
Throws an "InvalidAccessError" exception if one of the following is true:
|
5166 |
+
|
5167 |
+
Either user or password is passed as argument and the origin of url does not match the XMLHttpRequest origin.
|
5168 |
+
There is an associated XMLHttpRequest document and either the timeout attribute is not zero,
|
5169 |
+
the withCredentials attribute is true, or the responseType attribute is not the empty string.
|
5170 |
+
|
5171 |
+
|
5172 |
+
@method open
|
5173 |
+
@param {String} method HTTP method to use on request
|
5174 |
+
@param {String} url URL to request
|
5175 |
+
@param {Boolean} [async=true] If false request will be done in synchronous manner. Asynchronous by default.
|
5176 |
+
@param {String} [user] Username to use in HTTP authentication process on server-side
|
5177 |
+
@param {String} [password] Password to use in HTTP authentication process on server-side
|
5178 |
+
*/
|
5179 |
+
open: function(method, url, async, user, password) {
|
5180 |
+
var urlp;
|
5181 |
+
|
5182 |
+
// first two arguments are required
|
5183 |
+
if (!method || !url) {
|
5184 |
+
throw new x.DOMException(x.DOMException.SYNTAX_ERR);
|
5185 |
+
}
|
5186 |
+
|
5187 |
+
// 2 - check if any code point in method is higher than U+00FF or after deflating method it does not match the method
|
5188 |
+
if (/[\u0100-\uffff]/.test(method) || Encode.utf8_encode(method) !== method) {
|
5189 |
+
throw new x.DOMException(x.DOMException.SYNTAX_ERR);
|
5190 |
+
}
|
5191 |
+
|
5192 |
+
// 3
|
5193 |
+
if (!!~Basic.inArray(method.toUpperCase(), ['CONNECT', 'DELETE', 'GET', 'HEAD', 'OPTIONS', 'POST', 'PUT', 'TRACE', 'TRACK'])) {
|
5194 |
+
_method = method.toUpperCase();
|
5195 |
+
}
|
5196 |
+
|
5197 |
+
|
5198 |
+
// 4 - allowing these methods poses a security risk
|
5199 |
+
if (!!~Basic.inArray(_method, ['CONNECT', 'TRACE', 'TRACK'])) {
|
5200 |
+
throw new x.DOMException(x.DOMException.SECURITY_ERR);
|
5201 |
+
}
|
5202 |
+
|
5203 |
+
// 5
|
5204 |
+
url = Encode.utf8_encode(url);
|
5205 |
+
|
5206 |
+
// 6 - Resolve url relative to the XMLHttpRequest base URL. If the algorithm returns an error, throw a "SyntaxError".
|
5207 |
+
urlp = Url.parseUrl(url);
|
5208 |
+
|
5209 |
+
_same_origin_flag = Url.hasSameOrigin(urlp);
|
5210 |
+
|
5211 |
+
// 7 - manually build up absolute url
|
5212 |
+
_url = Url.resolveUrl(url);
|
5213 |
+
|
5214 |
+
// 9-10, 12-13
|
5215 |
+
if ((user || password) && !_same_origin_flag) {
|
5216 |
+
throw new x.DOMException(x.DOMException.INVALID_ACCESS_ERR);
|
5217 |
+
}
|
5218 |
+
|
5219 |
+
_user = user || urlp.user;
|
5220 |
+
_password = password || urlp.pass;
|
5221 |
+
|
5222 |
+
// 11
|
5223 |
+
_async = async || true;
|
5224 |
+
|
5225 |
+
if (_async === false && (_p('timeout') || _p('withCredentials') || _p('responseType') !== "")) {
|
5226 |
+
throw new x.DOMException(x.DOMException.INVALID_ACCESS_ERR);
|
5227 |
+
}
|
5228 |
+
|
5229 |
+
// 14 - terminate abort()
|
5230 |
+
|
5231 |
+
// 15 - terminate send()
|
5232 |
+
|
5233 |
+
// 18
|
5234 |
+
_sync_flag = !_async;
|
5235 |
+
_send_flag = false;
|
5236 |
+
_headers = {};
|
5237 |
+
_reset.call(this);
|
5238 |
+
|
5239 |
+
// 19
|
5240 |
+
_p('readyState', XMLHttpRequest.OPENED);
|
5241 |
+
|
5242 |
+
// 20
|
5243 |
+
this.dispatchEvent('readystatechange');
|
5244 |
+
},
|
5245 |
+
|
5246 |
+
/**
|
5247 |
+
Appends an header to the list of author request headers, or if header is already
|
5248 |
+
in the list of author request headers, combines its value with value.
|
5249 |
+
|
5250 |
+
Throws an "InvalidStateError" exception if the state is not OPENED or if the send() flag is set.
|
5251 |
+
Throws a "SyntaxError" exception if header is not a valid HTTP header field name or if value
|
5252 |
+
is not a valid HTTP header field value.
|
5253 |
+
|
5254 |
+
@method setRequestHeader
|
5255 |
+
@param {String} header
|
5256 |
+
@param {String|Number} value
|
5257 |
+
*/
|
5258 |
+
setRequestHeader: function(header, value) {
|
5259 |
+
var uaHeaders = [ // these headers are controlled by the user agent
|
5260 |
+
"accept-charset",
|
5261 |
+
"accept-encoding",
|
5262 |
+
"access-control-request-headers",
|
5263 |
+
"access-control-request-method",
|
5264 |
+
"connection",
|
5265 |
+
"content-length",
|
5266 |
+
"cookie",
|
5267 |
+
"cookie2",
|
5268 |
+
"content-transfer-encoding",
|
5269 |
+
"date",
|
5270 |
+
"expect",
|
5271 |
+
"host",
|
5272 |
+
"keep-alive",
|
5273 |
+
"origin",
|
5274 |
+
"referer",
|
5275 |
+
"te",
|
5276 |
+
"trailer",
|
5277 |
+
"transfer-encoding",
|
5278 |
+
"upgrade",
|
5279 |
+
"user-agent",
|
5280 |
+
"via"
|
5281 |
+
];
|
5282 |
+
|
5283 |
+
// 1-2
|
5284 |
+
if (_p('readyState') !== XMLHttpRequest.OPENED || _send_flag) {
|
5285 |
+
throw new x.DOMException(x.DOMException.INVALID_STATE_ERR);
|
5286 |
+
}
|
5287 |
+
|
5288 |
+
// 3
|
5289 |
+
if (/[\u0100-\uffff]/.test(header) || Encode.utf8_encode(header) !== header) {
|
5290 |
+
throw new x.DOMException(x.DOMException.SYNTAX_ERR);
|
5291 |
+
}
|
5292 |
+
|
5293 |
+
// 4
|
5294 |
+
/* this step is seemingly bypassed in browsers, probably to allow various unicode characters in header values
|
5295 |
+
if (/[\u0100-\uffff]/.test(value) || Encode.utf8_encode(value) !== value) {
|
5296 |
+
throw new x.DOMException(x.DOMException.SYNTAX_ERR);
|
5297 |
+
}*/
|
5298 |
+
|
5299 |
+
header = Basic.trim(header).toLowerCase();
|
5300 |
+
|
5301 |
+
// setting of proxy-* and sec-* headers is prohibited by spec
|
5302 |
+
if (!!~Basic.inArray(header, uaHeaders) || /^(proxy\-|sec\-)/.test(header)) {
|
5303 |
+
return false;
|
5304 |
+
}
|
5305 |
+
|
5306 |
+
// camelize
|
5307 |
+
// browsers lowercase header names (at least for custom ones)
|
5308 |
+
// header = header.replace(/\b\w/g, function($1) { return $1.toUpperCase(); });
|
5309 |
+
|
5310 |
+
if (!_headers[header]) {
|
5311 |
+
_headers[header] = value;
|
5312 |
+
} else {
|
5313 |
+
// http://tools.ietf.org/html/rfc2616#section-4.2 (last paragraph)
|
5314 |
+
_headers[header] += ', ' + value;
|
5315 |
+
}
|
5316 |
+
return true;
|
5317 |
+
},
|
5318 |
+
|
5319 |
+
/**
|
5320 |
+
* Test if the specified header is already set on this request.
|
5321 |
+
* Returns a header value or boolean false if it's not yet set.
|
5322 |
+
*
|
5323 |
+
* @method hasRequestHeader
|
5324 |
+
* @param {String} header Name of the header to test
|
5325 |
+
* @return {Boolean|String}
|
5326 |
+
*/
|
5327 |
+
hasRequestHeader: function(header) {
|
5328 |
+
return header && _headers[header.toLowerCase()] || false;
|
5329 |
+
},
|
5330 |
+
|
5331 |
+
/**
|
5332 |
+
Returns all headers from the response, with the exception of those whose field name is Set-Cookie or Set-Cookie2.
|
5333 |
+
|
5334 |
+
@method getAllResponseHeaders
|
5335 |
+
@return {String} reponse headers or empty string
|
5336 |
+
*/
|
5337 |
+
getAllResponseHeaders: function() {
|
5338 |
+
return _responseHeaders || '';
|
5339 |
+
},
|
5340 |
+
|
5341 |
+
/**
|
5342 |
+
Returns the header field value from the response of which the field name matches header,
|
5343 |
+
unless the field name is Set-Cookie or Set-Cookie2.
|
5344 |
+
|
5345 |
+
@method getResponseHeader
|
5346 |
+
@param {String} header
|
5347 |
+
@return {String} value(s) for the specified header or null
|
5348 |
+
*/
|
5349 |
+
getResponseHeader: function(header) {
|
5350 |
+
header = header.toLowerCase();
|
5351 |
+
|
5352 |
+
if (_error_flag || !!~Basic.inArray(header, ['set-cookie', 'set-cookie2'])) {
|
5353 |
+
return null;
|
5354 |
+
}
|
5355 |
+
|
5356 |
+
if (_responseHeaders && _responseHeaders !== '') {
|
5357 |
+
// if we didn't parse response headers until now, do it and keep for later
|
5358 |
+
if (!_responseHeadersBag) {
|
5359 |
+
_responseHeadersBag = {};
|
5360 |
+
Basic.each(_responseHeaders.split(/\r\n/), function(line) {
|
5361 |
+
var pair = line.split(/:\s+/);
|
5362 |
+
if (pair.length === 2) { // last line might be empty, omit
|
5363 |
+
pair[0] = Basic.trim(pair[0]); // just in case
|
5364 |
+
_responseHeadersBag[pair[0].toLowerCase()] = { // simply to retain header name in original form
|
5365 |
+
header: pair[0],
|
5366 |
+
value: Basic.trim(pair[1])
|
5367 |
+
};
|
5368 |
+
}
|
5369 |
+
});
|
5370 |
+
}
|
5371 |
+
if (_responseHeadersBag.hasOwnProperty(header)) {
|
5372 |
+
return _responseHeadersBag[header].header + ': ' + _responseHeadersBag[header].value;
|
5373 |
+
}
|
5374 |
+
}
|
5375 |
+
return null;
|
5376 |
+
},
|
5377 |
+
|
5378 |
+
/**
|
5379 |
+
Sets the Content-Type header for the response to mime.
|
5380 |
+
Throws an "InvalidStateError" exception if the state is LOADING or DONE.
|
5381 |
+
Throws a "SyntaxError" exception if mime is not a valid media type.
|
5382 |
+
|
5383 |
+
@method overrideMimeType
|
5384 |
+
@param String mime Mime type to set
|
5385 |
+
*/
|
5386 |
+
overrideMimeType: function(mime) {
|
5387 |
+
var matches, charset;
|
5388 |
+
|
5389 |
+
// 1
|
5390 |
+
if (!!~Basic.inArray(_p('readyState'), [XMLHttpRequest.LOADING, XMLHttpRequest.DONE])) {
|
5391 |
+
throw new x.DOMException(x.DOMException.INVALID_STATE_ERR);
|
5392 |
+
}
|
5393 |
+
|
5394 |
+
// 2
|
5395 |
+
mime = Basic.trim(mime.toLowerCase());
|
5396 |
+
|
5397 |
+
if (/;/.test(mime) && (matches = mime.match(/^([^;]+)(?:;\scharset\=)?(.*)$/))) {
|
5398 |
+
mime = matches[1];
|
5399 |
+
if (matches[2]) {
|
5400 |
+
charset = matches[2];
|
5401 |
+
}
|
5402 |
+
}
|
5403 |
+
|
5404 |
+
if (!Mime.mimes[mime]) {
|
5405 |
+
throw new x.DOMException(x.DOMException.SYNTAX_ERR);
|
5406 |
+
}
|
5407 |
+
|
5408 |
+
// 3-4
|
5409 |
+
_finalMime = mime;
|
5410 |
+
_finalCharset = charset;
|
5411 |
+
},
|
5412 |
+
|
5413 |
+
/**
|
5414 |
+
Initiates the request. The optional argument provides the request entity body.
|
5415 |
+
The argument is ignored if request method is GET or HEAD.
|
5416 |
+
|
5417 |
+
Throws an "InvalidStateError" exception if the state is not OPENED or if the send() flag is set.
|
5418 |
+
|
5419 |
+
@method send
|
5420 |
+
@param {Blob|Document|String|FormData} [data] Request entity body
|
5421 |
+
@param {Object} [options] Set of requirements and pre-requisities for runtime initialization
|
5422 |
+
*/
|
5423 |
+
send: function(data, options) {
|
5424 |
+
if (Basic.typeOf(options) === 'string') {
|
5425 |
+
_options = { ruid: options };
|
5426 |
+
} else if (!options) {
|
5427 |
+
_options = {};
|
5428 |
+
} else {
|
5429 |
+
_options = options;
|
5430 |
+
}
|
5431 |
+
|
5432 |
+
// 1-2
|
5433 |
+
if (this.readyState !== XMLHttpRequest.OPENED || _send_flag) {
|
5434 |
+
throw new x.DOMException(x.DOMException.INVALID_STATE_ERR);
|
5435 |
+
}
|
5436 |
+
|
5437 |
+
// 3
|
5438 |
+
// sending Blob
|
5439 |
+
if (data instanceof Blob) {
|
5440 |
+
_options.ruid = data.ruid;
|
5441 |
+
_mimeType = data.type || 'application/octet-stream';
|
5442 |
+
}
|
5443 |
+
|
5444 |
+
// FormData
|
5445 |
+
else if (data instanceof FormData) {
|
5446 |
+
if (data.hasBlob()) {
|
5447 |
+
var blob = data.getBlob();
|
5448 |
+
_options.ruid = blob.ruid;
|
5449 |
+
_mimeType = blob.type || 'application/octet-stream';
|
5450 |
+
}
|
5451 |
+
}
|
5452 |
+
|
5453 |
+
// DOMString
|
5454 |
+
else if (typeof data === 'string') {
|
5455 |
+
_encoding = 'UTF-8';
|
5456 |
+
_mimeType = 'text/plain;charset=UTF-8';
|
5457 |
+
|
5458 |
+
// data should be converted to Unicode and encoded as UTF-8
|
5459 |
+
data = Encode.utf8_encode(data);
|
5460 |
+
}
|
5461 |
+
|
5462 |
+
// if withCredentials not set, but requested, set it automatically
|
5463 |
+
if (!this.withCredentials) {
|
5464 |
+
this.withCredentials = (_options.required_caps && _options.required_caps.send_browser_cookies) && !_same_origin_flag;
|
5465 |
+
}
|
5466 |
+
|
5467 |
+
// 4 - storage mutex
|
5468 |
+
// 5
|
5469 |
+
_upload_events_flag = (!_sync_flag && this.upload.hasEventListener()); // DSAP
|
5470 |
+
// 6
|
5471 |
+
_error_flag = false;
|
5472 |
+
// 7
|
5473 |
+
_upload_complete_flag = !data;
|
5474 |
+
// 8 - Asynchronous steps
|
5475 |
+
if (!_sync_flag) {
|
5476 |
+
// 8.1
|
5477 |
+
_send_flag = true;
|
5478 |
+
// 8.2
|
5479 |
+
// this.dispatchEvent('loadstart'); // will be dispatched either by native or runtime xhr
|
5480 |
+
// 8.3
|
5481 |
+
//if (!_upload_complete_flag) {
|
5482 |
+
// this.upload.dispatchEvent('loadstart'); // will be dispatched either by native or runtime xhr
|
5483 |
+
//}
|
5484 |
+
}
|
5485 |
+
// 8.5 - Return the send() method call, but continue running the steps in this algorithm.
|
5486 |
+
_doXHR.call(this, data);
|
5487 |
+
},
|
5488 |
+
|
5489 |
+
/**
|
5490 |
+
Cancels any network activity.
|
5491 |
+
|
5492 |
+
@method abort
|
5493 |
+
*/
|
5494 |
+
abort: function() {
|
5495 |
+
_error_flag = true;
|
5496 |
+
_sync_flag = false;
|
5497 |
+
|
5498 |
+
if (!~Basic.inArray(_p('readyState'), [XMLHttpRequest.UNSENT, XMLHttpRequest.OPENED, XMLHttpRequest.DONE])) {
|
5499 |
+
_p('readyState', XMLHttpRequest.DONE);
|
5500 |
+
_send_flag = false;
|
5501 |
+
|
5502 |
+
if (_xhr) {
|
5503 |
+
_xhr.getRuntime().exec.call(_xhr, 'XMLHttpRequest', 'abort', _upload_complete_flag);
|
5504 |
+
} else {
|
5505 |
+
throw new x.DOMException(x.DOMException.INVALID_STATE_ERR);
|
5506 |
+
}
|
5507 |
+
|
5508 |
+
_upload_complete_flag = true;
|
5509 |
+
} else {
|
5510 |
+
_p('readyState', XMLHttpRequest.UNSENT);
|
5511 |
+
}
|
5512 |
+
},
|
5513 |
+
|
5514 |
+
destroy: function() {
|
5515 |
+
if (_xhr) {
|
5516 |
+
if (Basic.typeOf(_xhr.destroy) === 'function') {
|
5517 |
+
_xhr.destroy();
|
5518 |
+
}
|
5519 |
+
_xhr = null;
|
5520 |
+
}
|
5521 |
+
|
5522 |
+
this.unbindAll();
|
5523 |
+
|
5524 |
+
if (this.upload) {
|
5525 |
+
this.upload.unbindAll();
|
5526 |
+
this.upload = null;
|
5527 |
+
}
|
5528 |
+
}
|
5529 |
+
});
|
5530 |
+
|
5531 |
+
this.handleEventProps(dispatches.concat(['readystatechange'])); // for historical reasons
|
5532 |
+
this.upload.handleEventProps(dispatches);
|
5533 |
+
|
5534 |
+
/* this is nice, but maybe too lengthy
|
5535 |
+
|
5536 |
+
// if supported by JS version, set getters/setters for specific properties
|
5537 |
+
o.defineProperty(this, 'readyState', {
|
5538 |
+
configurable: false,
|
5539 |
+
|
5540 |
+
get: function() {
|
5541 |
+
return _p('readyState');
|
5542 |
+
}
|
5543 |
+
});
|
5544 |
+
|
5545 |
+
o.defineProperty(this, 'timeout', {
|
5546 |
+
configurable: false,
|
5547 |
+
|
5548 |
+
get: function() {
|
5549 |
+
return _p('timeout');
|
5550 |
+
},
|
5551 |
+
|
5552 |
+
set: function(value) {
|
5553 |
+
|
5554 |
+
if (_sync_flag) {
|
5555 |
+
throw new x.DOMException(x.DOMException.INVALID_ACCESS_ERR);
|
5556 |
+
}
|
5557 |
+
|
5558 |
+
// timeout still should be measured relative to the start time of request
|
5559 |
+
_timeoutset_time = (new Date).getTime();
|
5560 |
+
|
5561 |
+
_p('timeout', value);
|
5562 |
+
}
|
5563 |
+
});
|
5564 |
+
|
5565 |
+
// the withCredentials attribute has no effect when fetching same-origin resources
|
5566 |
+
o.defineProperty(this, 'withCredentials', {
|
5567 |
+
configurable: false,
|
5568 |
+
|
5569 |
+
get: function() {
|
5570 |
+
return _p('withCredentials');
|
5571 |
+
},
|
5572 |
+
|
5573 |
+
set: function(value) {
|
5574 |
+
// 1-2
|
5575 |
+
if (!~o.inArray(_p('readyState'), [XMLHttpRequest.UNSENT, XMLHttpRequest.OPENED]) || _send_flag) {
|
5576 |
+
throw new x.DOMException(x.DOMException.INVALID_STATE_ERR);
|
5577 |
+
}
|
5578 |
+
|
5579 |
+
// 3-4
|
5580 |
+
if (_anonymous_flag || _sync_flag) {
|
5581 |
+
throw new x.DOMException(x.DOMException.INVALID_ACCESS_ERR);
|
5582 |
+
}
|
5583 |
+
|
5584 |
+
// 5
|
5585 |
+
_p('withCredentials', value);
|
5586 |
+
}
|
5587 |
+
});
|
5588 |
+
|
5589 |
+
o.defineProperty(this, 'status', {
|
5590 |
+
configurable: false,
|
5591 |
+
|
5592 |
+
get: function() {
|
5593 |
+
return _p('status');
|
5594 |
+
}
|
5595 |
+
});
|
5596 |
+
|
5597 |
+
o.defineProperty(this, 'statusText', {
|
5598 |
+
configurable: false,
|
5599 |
+
|
5600 |
+
get: function() {
|
5601 |
+
return _p('statusText');
|
5602 |
+
}
|
5603 |
+
});
|
5604 |
+
|
5605 |
+
o.defineProperty(this, 'responseType', {
|
5606 |
+
configurable: false,
|
5607 |
+
|
5608 |
+
get: function() {
|
5609 |
+
return _p('responseType');
|
5610 |
+
},
|
5611 |
+
|
5612 |
+
set: function(value) {
|
5613 |
+
// 1
|
5614 |
+
if (!!~o.inArray(_p('readyState'), [XMLHttpRequest.LOADING, XMLHttpRequest.DONE])) {
|
5615 |
+
throw new x.DOMException(x.DOMException.INVALID_STATE_ERR);
|
5616 |
+
}
|
5617 |
+
|
5618 |
+
// 2
|
5619 |
+
if (_sync_flag) {
|
5620 |
+
throw new x.DOMException(x.DOMException.INVALID_ACCESS_ERR);
|
5621 |
+
}
|
5622 |
+
|
5623 |
+
// 3
|
5624 |
+
_p('responseType', value.toLowerCase());
|
5625 |
+
}
|
5626 |
+
});
|
5627 |
+
|
5628 |
+
o.defineProperty(this, 'responseText', {
|
5629 |
+
configurable: false,
|
5630 |
+
|
5631 |
+
get: function() {
|
5632 |
+
// 1
|
5633 |
+
if (!~o.inArray(_p('responseType'), ['', 'text'])) {
|
5634 |
+
throw new x.DOMException(x.DOMException.INVALID_STATE_ERR);
|
5635 |
+
}
|
5636 |
+
|
5637 |
+
// 2-3
|
5638 |
+
if (_p('readyState') !== XMLHttpRequest.DONE && _p('readyState') !== XMLHttpRequest.LOADING || _error_flag) {
|
5639 |
+
throw new x.DOMException(x.DOMException.INVALID_STATE_ERR);
|
5640 |
+
}
|
5641 |
+
|
5642 |
+
return _p('responseText');
|
5643 |
+
}
|
5644 |
+
});
|
5645 |
+
|
5646 |
+
o.defineProperty(this, 'responseXML', {
|
5647 |
+
configurable: false,
|
5648 |
+
|
5649 |
+
get: function() {
|
5650 |
+
// 1
|
5651 |
+
if (!~o.inArray(_p('responseType'), ['', 'document'])) {
|
5652 |
+
throw new x.DOMException(x.DOMException.INVALID_STATE_ERR);
|
5653 |
+
}
|
5654 |
+
|
5655 |
+
// 2-3
|
5656 |
+
if (_p('readyState') !== XMLHttpRequest.DONE || _error_flag) {
|
5657 |
+
throw new x.DOMException(x.DOMException.INVALID_STATE_ERR);
|
5658 |
+
}
|
5659 |
+
|
5660 |
+
return _p('responseXML');
|
5661 |
+
}
|
5662 |
+
});
|
5663 |
+
|
5664 |
+
o.defineProperty(this, 'response', {
|
5665 |
+
configurable: false,
|
5666 |
+
|
5667 |
+
get: function() {
|
5668 |
+
if (!!~o.inArray(_p('responseType'), ['', 'text'])) {
|
5669 |
+
if (_p('readyState') !== XMLHttpRequest.DONE && _p('readyState') !== XMLHttpRequest.LOADING || _error_flag) {
|
5670 |
+
return '';
|
5671 |
+
}
|
5672 |
+
}
|
5673 |
+
|
5674 |
+
if (_p('readyState') !== XMLHttpRequest.DONE || _error_flag) {
|
5675 |
+
return null;
|
5676 |
+
}
|
5677 |
+
|
5678 |
+
return _p('response');
|
5679 |
+
}
|
5680 |
+
});
|
5681 |
+
|
5682 |
+
*/
|
5683 |
+
|
5684 |
+
function _p(prop, value) {
|
5685 |
+
if (!props.hasOwnProperty(prop)) {
|
5686 |
+
return;
|
5687 |
+
}
|
5688 |
+
if (arguments.length === 1) { // get
|
5689 |
+
return Env.can('define_property') ? props[prop] : self[prop];
|
5690 |
+
} else { // set
|
5691 |
+
if (Env.can('define_property')) {
|
5692 |
+
props[prop] = value;
|
5693 |
+
} else {
|
5694 |
+
self[prop] = value;
|
5695 |
+
}
|
5696 |
+
}
|
5697 |
+
}
|
5698 |
+
|
5699 |
+
/*
|
5700 |
+
function _toASCII(str, AllowUnassigned, UseSTD3ASCIIRules) {
|
5701 |
+
// TODO: http://tools.ietf.org/html/rfc3490#section-4.1
|
5702 |
+
return str.toLowerCase();
|
5703 |
+
}
|
5704 |
+
*/
|
5705 |
+
|
5706 |
+
|
5707 |
+
function _doXHR(data) {
|
5708 |
+
var self = this;
|
5709 |
+
|
5710 |
+
_start_time = new Date().getTime();
|
5711 |
+
|
5712 |
+
_xhr = new RuntimeTarget();
|
5713 |
+
|
5714 |
+
function loadEnd() {
|
5715 |
+
if (_xhr) { // it could have been destroyed by now
|
5716 |
+
_xhr.destroy();
|
5717 |
+
_xhr = null;
|
5718 |
+
}
|
5719 |
+
self.dispatchEvent('loadend');
|
5720 |
+
self = null;
|
5721 |
+
}
|
5722 |
+
|
5723 |
+
function exec(runtime) {
|
5724 |
+
_xhr.bind('LoadStart', function(e) {
|
5725 |
+
_p('readyState', XMLHttpRequest.LOADING);
|
5726 |
+
self.dispatchEvent('readystatechange');
|
5727 |
+
|
5728 |
+
self.dispatchEvent(e);
|
5729 |
+
|
5730 |
+
if (_upload_events_flag) {
|
5731 |
+
self.upload.dispatchEvent(e);
|
5732 |
+
}
|
5733 |
+
});
|
5734 |
+
|
5735 |
+
_xhr.bind('Progress', function(e) {
|
5736 |
+
if (_p('readyState') !== XMLHttpRequest.LOADING) {
|
5737 |
+
_p('readyState', XMLHttpRequest.LOADING); // LoadStart unreliable (in Flash for example)
|
5738 |
+
self.dispatchEvent('readystatechange');
|
5739 |
+
}
|
5740 |
+
self.dispatchEvent(e);
|
5741 |
+
});
|
5742 |
+
|
5743 |
+
_xhr.bind('UploadProgress', function(e) {
|
5744 |
+
if (_upload_events_flag) {
|
5745 |
+
self.upload.dispatchEvent({
|
5746 |
+
type: 'progress',
|
5747 |
+
lengthComputable: false,
|
5748 |
+
total: e.total,
|
5749 |
+
loaded: e.loaded
|
5750 |
+
});
|
5751 |
+
}
|
5752 |
+
});
|
5753 |
+
|
5754 |
+
_xhr.bind('Load', function(e) {
|
5755 |
+
_p('readyState', XMLHttpRequest.DONE);
|
5756 |
+
_p('status', Number(runtime.exec.call(_xhr, 'XMLHttpRequest', 'getStatus') || 0));
|
5757 |
+
_p('statusText', httpCode[_p('status')] || "");
|
5758 |
+
|
5759 |
+
_p('response', runtime.exec.call(_xhr, 'XMLHttpRequest', 'getResponse', _p('responseType')));
|
5760 |
+
|
5761 |
+
if (!!~Basic.inArray(_p('responseType'), ['text', ''])) {
|
5762 |
+
_p('responseText', _p('response'));
|
5763 |
+
} else if (_p('responseType') === 'document') {
|
5764 |
+
_p('responseXML', _p('response'));
|
5765 |
+
}
|
5766 |
+
|
5767 |
+
_responseHeaders = runtime.exec.call(_xhr, 'XMLHttpRequest', 'getAllResponseHeaders');
|
5768 |
+
|
5769 |
+
self.dispatchEvent('readystatechange');
|
5770 |
+
|
5771 |
+
if (_p('status') > 0) { // status 0 usually means that server is unreachable
|
5772 |
+
if (_upload_events_flag) {
|
5773 |
+
self.upload.dispatchEvent(e);
|
5774 |
+
}
|
5775 |
+
self.dispatchEvent(e);
|
5776 |
+
} else {
|
5777 |
+
_error_flag = true;
|
5778 |
+
self.dispatchEvent('error');
|
5779 |
+
}
|
5780 |
+
loadEnd();
|
5781 |
+
});
|
5782 |
+
|
5783 |
+
_xhr.bind('Abort', function(e) {
|
5784 |
+
self.dispatchEvent(e);
|
5785 |
+
loadEnd();
|
5786 |
+
});
|
5787 |
+
|
5788 |
+
_xhr.bind('Error', function(e) {
|
5789 |
+
_error_flag = true;
|
5790 |
+
_p('readyState', XMLHttpRequest.DONE);
|
5791 |
+
self.dispatchEvent('readystatechange');
|
5792 |
+
_upload_complete_flag = true;
|
5793 |
+
self.dispatchEvent(e);
|
5794 |
+
loadEnd();
|
5795 |
+
});
|
5796 |
+
|
5797 |
+
runtime.exec.call(_xhr, 'XMLHttpRequest', 'send', {
|
5798 |
+
url: _url,
|
5799 |
+
method: _method,
|
5800 |
+
async: _async,
|
5801 |
+
user: _user,
|
5802 |
+
password: _password,
|
5803 |
+
headers: _headers,
|
5804 |
+
mimeType: _mimeType,
|
5805 |
+
encoding: _encoding,
|
5806 |
+
responseType: self.responseType,
|
5807 |
+
withCredentials: self.withCredentials,
|
5808 |
+
options: _options
|
5809 |
+
}, data);
|
5810 |
+
}
|
5811 |
+
|
5812 |
+
// clarify our requirements
|
5813 |
+
if (typeof(_options.required_caps) === 'string') {
|
5814 |
+
_options.required_caps = Runtime.parseCaps(_options.required_caps);
|
5815 |
+
}
|
5816 |
+
|
5817 |
+
_options.required_caps = Basic.extend({}, _options.required_caps, {
|
5818 |
+
return_response_type: self.responseType
|
5819 |
+
});
|
5820 |
+
|
5821 |
+
if (data instanceof FormData) {
|
5822 |
+
_options.required_caps.send_multipart = true;
|
5823 |
+
}
|
5824 |
+
|
5825 |
+
if (!Basic.isEmptyObj(_headers)) {
|
5826 |
+
_options.required_caps.send_custom_headers = true;
|
5827 |
+
}
|
5828 |
+
|
5829 |
+
if (!_same_origin_flag) {
|
5830 |
+
_options.required_caps.do_cors = true;
|
5831 |
+
}
|
5832 |
+
|
5833 |
+
|
5834 |
+
if (_options.ruid) { // we do not need to wait if we can connect directly
|
5835 |
+
exec(_xhr.connectRuntime(_options));
|
5836 |
+
} else {
|
5837 |
+
_xhr.bind('RuntimeInit', function(e, runtime) {
|
5838 |
+
exec(runtime);
|
5839 |
+
});
|
5840 |
+
_xhr.bind('RuntimeError', function(e, err) {
|
5841 |
+
self.dispatchEvent('RuntimeError', err);
|
5842 |
+
});
|
5843 |
+
_xhr.connectRuntime(_options);
|
5844 |
+
}
|
5845 |
+
}
|
5846 |
+
|
5847 |
+
|
5848 |
+
function _reset() {
|
5849 |
+
_p('responseText', "");
|
5850 |
+
_p('responseXML', null);
|
5851 |
+
_p('response', null);
|
5852 |
+
_p('status', 0);
|
5853 |
+
_p('statusText', "");
|
5854 |
+
_start_time = _timeoutset_time = null;
|
5855 |
+
}
|
5856 |
+
}
|
5857 |
+
|
5858 |
+
XMLHttpRequest.UNSENT = 0;
|
5859 |
+
XMLHttpRequest.OPENED = 1;
|
5860 |
+
XMLHttpRequest.HEADERS_RECEIVED = 2;
|
5861 |
+
XMLHttpRequest.LOADING = 3;
|
5862 |
+
XMLHttpRequest.DONE = 4;
|
5863 |
+
|
5864 |
+
XMLHttpRequest.prototype = EventTarget.instance;
|
5865 |
+
|
5866 |
+
return XMLHttpRequest;
|
5867 |
+
});
|
5868 |
+
|
5869 |
+
// Included from: src/javascript/runtime/Transporter.js
|
5870 |
+
|
5871 |
+
/**
|
5872 |
+
* Transporter.js
|
5873 |
+
*
|
5874 |
+
* Copyright 2013, Moxiecode Systems AB
|
5875 |
+
* Released under GPL License.
|
5876 |
+
*
|
5877 |
+
* License: http://www.plupload.com/license
|
5878 |
+
* Contributing: http://www.plupload.com/contributing
|
5879 |
+
*/
|
5880 |
+
|
5881 |
+
define("moxie/runtime/Transporter", [
|
5882 |
+
"moxie/core/utils/Basic",
|
5883 |
+
"moxie/core/utils/Encode",
|
5884 |
+
"moxie/runtime/RuntimeClient",
|
5885 |
+
"moxie/core/EventTarget"
|
5886 |
+
], function(Basic, Encode, RuntimeClient, EventTarget) {
|
5887 |
+
|
5888 |
+
/**
|
5889 |
+
@class moxie/runtime/Transporter
|
5890 |
+
@private
|
5891 |
+
@constructor
|
5892 |
+
*/
|
5893 |
+
function Transporter() {
|
5894 |
+
var mod, _runtime, _data, _size, _pos, _chunk_size;
|
5895 |
+
|
5896 |
+
RuntimeClient.call(this);
|
5897 |
+
|
5898 |
+
Basic.extend(this, {
|
5899 |
+
uid: Basic.guid('uid_'),
|
5900 |
+
|
5901 |
+
state: Transporter.IDLE,
|
5902 |
+
|
5903 |
+
result: null,
|
5904 |
+
|
5905 |
+
transport: function(data, type, options) {
|
5906 |
+
var self = this;
|
5907 |
+
|
5908 |
+
options = Basic.extend({
|
5909 |
+
chunk_size: 204798
|
5910 |
+
}, options);
|
5911 |
+
|
5912 |
+
// should divide by three, base64 requires this
|
5913 |
+
if ((mod = options.chunk_size % 3)) {
|
5914 |
+
options.chunk_size += 3 - mod;
|
5915 |
+
}
|
5916 |
+
|
5917 |
+
_chunk_size = options.chunk_size;
|
5918 |
+
|
5919 |
+
_reset.call(this);
|
5920 |
+
_data = data;
|
5921 |
+
_size = data.length;
|
5922 |
+
|
5923 |
+
if (Basic.typeOf(options) === 'string' || options.ruid) {
|
5924 |
+
_run.call(self, type, this.connectRuntime(options));
|
5925 |
+
} else {
|
5926 |
+
// we require this to run only once
|
5927 |
+
var cb = function(e, runtime) {
|
5928 |
+
self.unbind("RuntimeInit", cb);
|
5929 |
+
_run.call(self, type, runtime);
|
5930 |
+
};
|
5931 |
+
this.bind("RuntimeInit", cb);
|
5932 |
+
this.connectRuntime(options);
|
5933 |
+
}
|
5934 |
+
},
|
5935 |
+
|
5936 |
+
abort: function() {
|
5937 |
+
var self = this;
|
5938 |
+
|
5939 |
+
self.state = Transporter.IDLE;
|
5940 |
+
if (_runtime) {
|
5941 |
+
_runtime.exec.call(self, 'Transporter', 'clear');
|
5942 |
+
self.trigger("TransportingAborted");
|
5943 |
+
}
|
5944 |
+
|
5945 |
+
_reset.call(self);
|
5946 |
+
},
|
5947 |
+
|
5948 |
+
|
5949 |
+
destroy: function() {
|
5950 |
+
this.unbindAll();
|
5951 |
+
_runtime = null;
|
5952 |
+
this.disconnectRuntime();
|
5953 |
+
_reset.call(this);
|
5954 |
+
}
|
5955 |
+
});
|
5956 |
+
|
5957 |
+
function _reset() {
|
5958 |
+
_size = _pos = 0;
|
5959 |
+
_data = this.result = null;
|
5960 |
+
}
|
5961 |
+
|
5962 |
+
function _run(type, runtime) {
|
5963 |
+
var self = this;
|
5964 |
+
|
5965 |
+
_runtime = runtime;
|
5966 |
+
|
5967 |
+
//self.unbind("RuntimeInit");
|
5968 |
+
|
5969 |
+
self.bind("TransportingProgress", function(e) {
|
5970 |
+
_pos = e.loaded;
|
5971 |
+
|
5972 |
+
if (_pos < _size && Basic.inArray(self.state, [Transporter.IDLE, Transporter.DONE]) === -1) {
|
5973 |
+
_transport.call(self);
|
5974 |
+
}
|
5975 |
+
}, 999);
|
5976 |
+
|
5977 |
+
self.bind("TransportingComplete", function() {
|
5978 |
+
_pos = _size;
|
5979 |
+
self.state = Transporter.DONE;
|
5980 |
+
_data = null; // clean a bit
|
5981 |
+
self.result = _runtime.exec.call(self, 'Transporter', 'getAsBlob', type || '');
|
5982 |
+
}, 999);
|
5983 |
+
|
5984 |
+
self.state = Transporter.BUSY;
|
5985 |
+
self.trigger("TransportingStarted");
|
5986 |
+
_transport.call(self);
|
5987 |
+
}
|
5988 |
+
|
5989 |
+
function _transport() {
|
5990 |
+
var self = this,
|
5991 |
+
chunk,
|
5992 |
+
bytesLeft = _size - _pos;
|
5993 |
+
|
5994 |
+
if (_chunk_size > bytesLeft) {
|
5995 |
+
_chunk_size = bytesLeft;
|
5996 |
+
}
|
5997 |
+
|
5998 |
+
chunk = Encode.btoa(_data.substr(_pos, _chunk_size));
|
5999 |
+
_runtime.exec.call(self, 'Transporter', 'receive', chunk, _size);
|
6000 |
+
}
|
6001 |
+
}
|
6002 |
+
|
6003 |
+
Transporter.IDLE = 0;
|
6004 |
+
Transporter.BUSY = 1;
|
6005 |
+
Transporter.DONE = 2;
|
6006 |
+
|
6007 |
+
Transporter.prototype = EventTarget.instance;
|
6008 |
+
|
6009 |
+
return Transporter;
|
6010 |
+
});
|
6011 |
+
|
6012 |
+
// Included from: src/javascript/image/Image.js
|
6013 |
+
|
6014 |
+
/**
|
6015 |
+
* Image.js
|
6016 |
+
*
|
6017 |
+
* Copyright 2013, Moxiecode Systems AB
|
6018 |
+
* Released under GPL License.
|
6019 |
+
*
|
6020 |
+
* License: http://www.plupload.com/license
|
6021 |
+
* Contributing: http://www.plupload.com/contributing
|
6022 |
+
*/
|
6023 |
+
|
6024 |
+
define("moxie/image/Image", [
|
6025 |
+
"moxie/core/utils/Basic",
|
6026 |
+
"moxie/core/utils/Dom",
|
6027 |
+
"moxie/core/Exceptions",
|
6028 |
+
"moxie/file/FileReaderSync",
|
6029 |
+
"moxie/xhr/XMLHttpRequest",
|
6030 |
+
"moxie/runtime/Runtime",
|
6031 |
+
"moxie/runtime/RuntimeClient",
|
6032 |
+
"moxie/runtime/Transporter",
|
6033 |
+
"moxie/core/utils/Env",
|
6034 |
+
"moxie/core/EventTarget",
|
6035 |
+
"moxie/file/Blob",
|
6036 |
+
"moxie/file/File",
|
6037 |
+
"moxie/core/utils/Encode"
|
6038 |
+
], function(Basic, Dom, x, FileReaderSync, XMLHttpRequest, Runtime, RuntimeClient, Transporter, Env, EventTarget, Blob, File, Encode) {
|
6039 |
+
/**
|
6040 |
+
Image preloading and manipulation utility. Additionally it provides access to image meta info (Exif, GPS) and raw binary data.
|
6041 |
+
|
6042 |
+
@class moxie/image/Image
|
6043 |
+
@constructor
|
6044 |
+
@extends EventTarget
|
6045 |
+
*/
|
6046 |
+
var dispatches = [
|
6047 |
+
'progress',
|
6048 |
+
|
6049 |
+
/**
|
6050 |
+
Dispatched when loading is complete.
|
6051 |
+
|
6052 |
+
@event load
|
6053 |
+
@param {Object} event
|
6054 |
+
*/
|
6055 |
+
'load',
|
6056 |
+
|
6057 |
+
'error',
|
6058 |
+
|
6059 |
+
/**
|
6060 |
+
Dispatched when resize operation is complete.
|
6061 |
+
|
6062 |
+
@event resize
|
6063 |
+
@param {Object} event
|
6064 |
+
*/
|
6065 |
+
'resize',
|
6066 |
+
|
6067 |
+
/**
|
6068 |
+
Dispatched when visual representation of the image is successfully embedded
|
6069 |
+
into the corresponsing container.
|
6070 |
+
|
6071 |
+
@event embedded
|
6072 |
+
@param {Object} event
|
6073 |
+
*/
|
6074 |
+
'embedded'
|
6075 |
+
];
|
6076 |
+
|
6077 |
+
function Image() {
|
6078 |
+
|
6079 |
+
RuntimeClient.call(this);
|
6080 |
+
|
6081 |
+
Basic.extend(this, {
|
6082 |
+
/**
|
6083 |
+
Unique id of the component
|
6084 |
+
|
6085 |
+
@property uid
|
6086 |
+
@type {String}
|
6087 |
+
*/
|
6088 |
+
uid: Basic.guid('uid_'),
|
6089 |
+
|
6090 |
+
/**
|
6091 |
+
Unique id of the connected runtime, if any.
|
6092 |
+
|
6093 |
+
@property ruid
|
6094 |
+
@type {String}
|
6095 |
+
*/
|
6096 |
+
ruid: null,
|
6097 |
+
|
6098 |
+
/**
|
6099 |
+
Name of the file, that was used to create an image, if available. If not equals to empty string.
|
6100 |
+
|
6101 |
+
@property name
|
6102 |
+
@type {String}
|
6103 |
+
@default ""
|
6104 |
+
*/
|
6105 |
+
name: "",
|
6106 |
+
|
6107 |
+
/**
|
6108 |
+
Size of the image in bytes. Actual value is set only after image is preloaded.
|
6109 |
+
|
6110 |
+
@property size
|
6111 |
+
@type {Number}
|
6112 |
+
@default 0
|
6113 |
+
*/
|
6114 |
+
size: 0,
|
6115 |
+
|
6116 |
+
/**
|
6117 |
+
Width of the image. Actual value is set only after image is preloaded.
|
6118 |
+
|
6119 |
+
@property width
|
6120 |
+
@type {Number}
|
6121 |
+
@default 0
|
6122 |
+
*/
|
6123 |
+
width: 0,
|
6124 |
+
|
6125 |
+
/**
|
6126 |
+
Height of the image. Actual value is set only after image is preloaded.
|
6127 |
+
|
6128 |
+
@property height
|
6129 |
+
@type {Number}
|
6130 |
+
@default 0
|
6131 |
+
*/
|
6132 |
+
height: 0,
|
6133 |
+
|
6134 |
+
/**
|
6135 |
+
Mime type of the image. Currently only image/jpeg and image/png are supported. Actual value is set only after image is preloaded.
|
6136 |
+
|
6137 |
+
@property type
|
6138 |
+
@type {String}
|
6139 |
+
@default ""
|
6140 |
+
*/
|
6141 |
+
type: "",
|
6142 |
+
|
6143 |
+
/**
|
6144 |
+
Holds meta info (Exif, GPS). Is populated only for image/jpeg. Actual value is set only after image is preloaded.
|
6145 |
+
|
6146 |
+
@property meta
|
6147 |
+
@type {Object}
|
6148 |
+
@default {}
|
6149 |
+
*/
|
6150 |
+
meta: {},
|
6151 |
+
|
6152 |
+
/**
|
6153 |
+
Alias for load method, that takes another moxie.image.Image object as a source (see load).
|
6154 |
+
|
6155 |
+
@method clone
|
6156 |
+
@param {Image} src Source for the image
|
6157 |
+
@param {Boolean} [exact=false] Whether to activate in-depth clone mode
|
6158 |
+
*/
|
6159 |
+
clone: function() {
|
6160 |
+
this.load.apply(this, arguments);
|
6161 |
+
},
|
6162 |
+
|
6163 |
+
/**
|
6164 |
+
Loads image from various sources. Currently the source for new image can be: moxie.image.Image,
|
6165 |
+
moxie.file.Blob/moxie.file.File, native Blob/File, dataUrl or URL. Depending on the type of the
|
6166 |
+
source, arguments - differ. When source is URL, Image will be downloaded from remote destination
|
6167 |
+
and loaded in memory.
|
6168 |
+
|
6169 |
+
@example
|
6170 |
+
var img = new moxie.image.Image();
|
6171 |
+
img.onload = function() {
|
6172 |
+
var blob = img.getAsBlob();
|
6173 |
+
|
6174 |
+
var formData = new moxie.xhr.FormData();
|
6175 |
+
formData.append('file', blob);
|
6176 |
+
|
6177 |
+
var xhr = new moxie.xhr.XMLHttpRequest();
|
6178 |
+
xhr.onload = function() {
|
6179 |
+
// upload complete
|
6180 |
+
};
|
6181 |
+
xhr.open('post', 'upload.php');
|
6182 |
+
xhr.send(formData);
|
6183 |
+
};
|
6184 |
+
img.load("http://www.moxiecode.com/images/mox-logo.jpg"); // notice file extension (.jpg)
|
6185 |
+
|
6186 |
+
|
6187 |
+
@method load
|
6188 |
+
@param {Image|Blob|File|String} src Source for the image
|
6189 |
+
@param {Boolean|Object} [mixed]
|
6190 |
+
*/
|
6191 |
+
load: function() {
|
6192 |
+
_load.apply(this, arguments);
|
6193 |
+
},
|
6194 |
+
|
6195 |
+
|
6196 |
+
/**
|
6197 |
+
Resizes the image to fit the specified width/height. If crop is specified, image will also be
|
6198 |
+
cropped to the exact dimensions.
|
6199 |
+
|
6200 |
+
@method resize
|
6201 |
+
@since 3.0
|
6202 |
+
@param {Object} options
|
6203 |
+
@param {Number} options.width Resulting width
|
6204 |
+
@param {Number} [options.height=width] Resulting height (optional, if not supplied will default to width)
|
6205 |
+
@param {String} [options.type='image/jpeg'] MIME type of the resulting image
|
6206 |
+
@param {Number} [options.quality=90] In the case of JPEG, controls the quality of resulting image
|
6207 |
+
@param {Boolean} [options.crop='cc'] If not falsy, image will be cropped, by default from center
|
6208 |
+
@param {Boolean} [options.fit=true] Whether to upscale the image to fit the exact dimensions
|
6209 |
+
@param {Boolean} [options.preserveHeaders=true] Whether to preserve meta headers (on JPEGs after resize)
|
6210 |
+
@param {String} [options.resample='default'] Resampling algorithm to use during resize
|
6211 |
+
@param {Boolean} [options.multipass=true] Whether to scale the image in steps (results in better quality)
|
6212 |
+
*/
|
6213 |
+
resize: function(options) {
|
6214 |
+
var self = this;
|
6215 |
+
var orientation;
|
6216 |
+
var scale;
|
6217 |
+
|
6218 |
+
var srcRect = {
|
6219 |
+
x: 0,
|
6220 |
+
y: 0,
|
6221 |
+
width: self.width,
|
6222 |
+
height: self.height
|
6223 |
+
};
|
6224 |
+
|
6225 |
+
var opts = Basic.extendIf({
|
6226 |
+
width: self.width,
|
6227 |
+
height: self.height,
|
6228 |
+
type: self.type || 'image/jpeg',
|
6229 |
+
quality: 90,
|
6230 |
+
crop: false,
|
6231 |
+
fit: true,
|
6232 |
+
preserveHeaders: true,
|
6233 |
+
resample: 'default',
|
6234 |
+
multipass: true
|
6235 |
+
}, options);
|
6236 |
+
|
6237 |
+
try {
|
6238 |
+
if (!self.size) { // only preloaded image objects can be used as source
|
6239 |
+
throw new x.DOMException(x.DOMException.INVALID_STATE_ERR);
|
6240 |
+
}
|
6241 |
+
|
6242 |
+
// no way to reliably intercept the crash due to high resolution, so we simply avoid it
|
6243 |
+
if (self.width > Image.MAX_RESIZE_WIDTH || self.height > Image.MAX_RESIZE_HEIGHT) {
|
6244 |
+
throw new x.ImageError(x.ImageError.MAX_RESOLUTION_ERR);
|
6245 |
+
}
|
6246 |
+
|
6247 |
+
// take into account orientation tag
|
6248 |
+
orientation = (self.meta && self.meta.tiff && self.meta.tiff.Orientation) || 1;
|
6249 |
+
|
6250 |
+
if (Basic.inArray(orientation, [5,6,7,8]) !== -1) { // values that require 90 degree rotation
|
6251 |
+
var tmp = opts.width;
|
6252 |
+
opts.width = opts.height;
|
6253 |
+
opts.height = tmp;
|
6254 |
+
}
|
6255 |
+
|
6256 |
+
if (opts.crop) {
|
6257 |
+
scale = Math.max(opts.width/self.width, opts.height/self.height);
|
6258 |
+
|
6259 |
+
if (options.fit) {
|
6260 |
+
// first scale it up or down to fit the original image
|
6261 |
+
srcRect.width = Math.min(Math.ceil(opts.width/scale), self.width);
|
6262 |
+
srcRect.height = Math.min(Math.ceil(opts.height/scale), self.height);
|
6263 |
+
|
6264 |
+
// recalculate the scale for adapted dimensions
|
6265 |
+
scale = opts.width/srcRect.width;
|
6266 |
+
} else {
|
6267 |
+
srcRect.width = Math.min(opts.width, self.width);
|
6268 |
+
srcRect.height = Math.min(opts.height, self.height);
|
6269 |
+
|
6270 |
+
// now we do not need to scale it any further
|
6271 |
+
scale = 1;
|
6272 |
+
}
|
6273 |
+
|
6274 |
+
if (typeof(opts.crop) === 'boolean') {
|
6275 |
+
opts.crop = 'cc';
|
6276 |
+
}
|
6277 |
+
|
6278 |
+
switch (opts.crop.toLowerCase().replace(/_/, '-')) {
|
6279 |
+
case 'rb':
|
6280 |
+
case 'right-bottom':
|
6281 |
+
srcRect.x = self.width - srcRect.width;
|
6282 |
+
srcRect.y = self.height - srcRect.height;
|
6283 |
+
break;
|
6284 |
+
|
6285 |
+
case 'cb':
|
6286 |
+
case 'center-bottom':
|
6287 |
+
srcRect.x = Math.floor((self.width - srcRect.width) / 2);
|
6288 |
+
srcRect.y = self.height - srcRect.height;
|
6289 |
+
break;
|
6290 |
+
|
6291 |
+
case 'lb':
|
6292 |
+
case 'left-bottom':
|
6293 |
+
srcRect.x = 0;
|
6294 |
+
srcRect.y = self.height - srcRect.height;
|
6295 |
+
break;
|
6296 |
+
|
6297 |
+
case 'lt':
|
6298 |
+
case 'left-top':
|
6299 |
+
srcRect.x = 0;
|
6300 |
+
srcRect.y = 0;
|
6301 |
+
break;
|
6302 |
+
|
6303 |
+
case 'ct':
|
6304 |
+
case 'center-top':
|
6305 |
+
srcRect.x = Math.floor((self.width - srcRect.width) / 2);
|
6306 |
+
srcRect.y = 0;
|
6307 |
+
break;
|
6308 |
+
|
6309 |
+
case 'rt':
|
6310 |
+
case 'right-top':
|
6311 |
+
srcRect.x = self.width - srcRect.width;
|
6312 |
+
srcRect.y = 0;
|
6313 |
+
break;
|
6314 |
+
|
6315 |
+
case 'rc':
|
6316 |
+
case 'right-center':
|
6317 |
+
case 'right-middle':
|
6318 |
+
srcRect.x = self.width - srcRect.width;
|
6319 |
+
srcRect.y = Math.floor((self.height - srcRect.height) / 2);
|
6320 |
+
break;
|
6321 |
+
|
6322 |
+
|
6323 |
+
case 'lc':
|
6324 |
+
case 'left-center':
|
6325 |
+
case 'left-middle':
|
6326 |
+
srcRect.x = 0;
|
6327 |
+
srcRect.y = Math.floor((self.height - srcRect.height) / 2);
|
6328 |
+
break;
|
6329 |
+
|
6330 |
+
case 'cc':
|
6331 |
+
case 'center-center':
|
6332 |
+
case 'center-middle':
|
6333 |
+
default:
|
6334 |
+
srcRect.x = Math.floor((self.width - srcRect.width) / 2);
|
6335 |
+
srcRect.y = Math.floor((self.height - srcRect.height) / 2);
|
6336 |
+
}
|
6337 |
+
|
6338 |
+
// original image might be smaller than requested crop, so - avoid negative values
|
6339 |
+
srcRect.x = Math.max(srcRect.x, 0);
|
6340 |
+
srcRect.y = Math.max(srcRect.y, 0);
|
6341 |
+
} else {
|
6342 |
+
scale = Math.min(opts.width/self.width, opts.height/self.height);
|
6343 |
+
|
6344 |
+
// do not upscale if we were asked to not fit it
|
6345 |
+
if (scale > 1 && !opts.fit) {
|
6346 |
+
scale = 1;
|
6347 |
+
}
|
6348 |
+
}
|
6349 |
+
|
6350 |
+
this.exec('Image', 'resize', srcRect, scale, opts);
|
6351 |
+
} catch(ex) {
|
6352 |
+
// for now simply trigger error event
|
6353 |
+
self.trigger('error', ex.code);
|
6354 |
+
}
|
6355 |
+
},
|
6356 |
+
|
6357 |
+
/**
|
6358 |
+
Downsizes the image to fit the specified width/height. If crop is supplied, image will be cropped to exact dimensions.
|
6359 |
+
|
6360 |
+
@method downsize
|
6361 |
+
@deprecated use resize()
|
6362 |
+
*/
|
6363 |
+
downsize: function(options) {
|
6364 |
+
var defaults = {
|
6365 |
+
width: this.width,
|
6366 |
+
height: this.height,
|
6367 |
+
type: this.type || 'image/jpeg',
|
6368 |
+
quality: 90,
|
6369 |
+
crop: false,
|
6370 |
+
fit: false,
|
6371 |
+
preserveHeaders: true,
|
6372 |
+
resample: 'default'
|
6373 |
+
}, opts;
|
6374 |
+
|
6375 |
+
if (typeof(options) === 'object') {
|
6376 |
+
opts = Basic.extend(defaults, options);
|
6377 |
+
} else {
|
6378 |
+
// for backward compatibility
|
6379 |
+
opts = Basic.extend(defaults, {
|
6380 |
+
width: arguments[0],
|
6381 |
+
height: arguments[1],
|
6382 |
+
crop: arguments[2],
|
6383 |
+
preserveHeaders: arguments[3]
|
6384 |
+
});
|
6385 |
+
}
|
6386 |
+
|
6387 |
+
this.resize(opts);
|
6388 |
+
},
|
6389 |
+
|
6390 |
+
/**
|
6391 |
+
Alias for downsize(width, height, true). (see downsize)
|
6392 |
+
|
6393 |
+
@method crop
|
6394 |
+
@param {Number} width Resulting width
|
6395 |
+
@param {Number} [height=width] Resulting height (optional, if not supplied will default to width)
|
6396 |
+
@param {Boolean} [preserveHeaders=true] Whether to preserve meta headers (on JPEGs after resize)
|
6397 |
+
*/
|
6398 |
+
crop: function(width, height, preserveHeaders) {
|
6399 |
+
this.downsize(width, height, true, preserveHeaders);
|
6400 |
+
},
|
6401 |
+
|
6402 |
+
getAsCanvas: function() {
|
6403 |
+
if (!Env.can('create_canvas')) {
|
6404 |
+
throw new x.RuntimeError(x.RuntimeError.NOT_SUPPORTED_ERR);
|
6405 |
+
}
|
6406 |
+
return this.exec('Image', 'getAsCanvas');
|
6407 |
+
},
|
6408 |
+
|
6409 |
+
/**
|
6410 |
+
Retrieves image in it's current state as moxie.file.Blob object. Cannot be run on empty or image in progress (throws
|
6411 |
+
DOMException.INVALID_STATE_ERR).
|
6412 |
+
|
6413 |
+
@method getAsBlob
|
6414 |
+
@param {String} [type="image/jpeg"] Mime type of resulting blob. Can either be image/jpeg or image/png
|
6415 |
+
@param {Number} [quality=90] Applicable only together with mime type image/jpeg
|
6416 |
+
@return {Blob} Image as Blob
|
6417 |
+
*/
|
6418 |
+
getAsBlob: function(type, quality) {
|
6419 |
+
if (!this.size) {
|
6420 |
+
throw new x.DOMException(x.DOMException.INVALID_STATE_ERR);
|
6421 |
+
}
|
6422 |
+
return this.exec('Image', 'getAsBlob', type || 'image/jpeg', quality || 90);
|
6423 |
+
},
|
6424 |
+
|
6425 |
+
/**
|
6426 |
+
Retrieves image in it's current state as dataURL string. Cannot be run on empty or image in progress (throws
|
6427 |
+
DOMException.INVALID_STATE_ERR).
|
6428 |
+
|
6429 |
+
@method getAsDataURL
|
6430 |
+
@param {String} [type="image/jpeg"] Mime type of resulting blob. Can either be image/jpeg or image/png
|
6431 |
+
@param {Number} [quality=90] Applicable only together with mime type image/jpeg
|
6432 |
+
@return {String} Image as dataURL string
|
6433 |
+
*/
|
6434 |
+
getAsDataURL: function(type, quality) {
|
6435 |
+
if (!this.size) {
|
6436 |
+
throw new x.DOMException(x.DOMException.INVALID_STATE_ERR);
|
6437 |
+
}
|
6438 |
+
return this.exec('Image', 'getAsDataURL', type || 'image/jpeg', quality || 90);
|
6439 |
+
},
|
6440 |
+
|
6441 |
+
/**
|
6442 |
+
Retrieves image in it's current state as binary string. Cannot be run on empty or image in progress (throws
|
6443 |
+
DOMException.INVALID_STATE_ERR).
|
6444 |
+
|
6445 |
+
@method getAsBinaryString
|
6446 |
+
@param {String} [type="image/jpeg"] Mime type of resulting blob. Can either be image/jpeg or image/png
|
6447 |
+
@param {Number} [quality=90] Applicable only together with mime type image/jpeg
|
6448 |
+
@return {String} Image as binary string
|
6449 |
+
*/
|
6450 |
+
getAsBinaryString: function(type, quality) {
|
6451 |
+
var dataUrl = this.getAsDataURL(type, quality);
|
6452 |
+
return Encode.atob(dataUrl.substring(dataUrl.indexOf('base64,') + 7));
|
6453 |
+
},
|
6454 |
+
|
6455 |
+
/**
|
6456 |
+
Embeds a visual representation of the image into the specified node. Depending on the runtime,
|
6457 |
+
it might be a canvas, an img node or a thrid party shim object (Flash or SilverLight - very rare,
|
6458 |
+
can be used in legacy browsers that do not have canvas or proper dataURI support).
|
6459 |
+
|
6460 |
+
@method embed
|
6461 |
+
@param {DOMElement} el DOM element to insert the image object into
|
6462 |
+
@param {Object} [options]
|
6463 |
+
@param {Number} [options.width] The width of an embed (defaults to the image width)
|
6464 |
+
@param {Number} [options.height] The height of an embed (defaults to the image height)
|
6465 |
+
@param {String} [options.type="image/jpeg"] Mime type
|
6466 |
+
@param {Number} [options.quality=90] Quality of an embed, if mime type is image/jpeg
|
6467 |
+
@param {Boolean} [options.crop=false] Whether to crop an embed to the specified dimensions
|
6468 |
+
@param {Boolean} [options.fit=true] By default thumbs will be up- or downscaled as necessary to fit the dimensions
|
6469 |
+
*/
|
6470 |
+
embed: function(el, options) {
|
6471 |
+
var self = this
|
6472 |
+
, runtime // this has to be outside of all the closures to contain proper runtime
|
6473 |
+
;
|
6474 |
+
|
6475 |
+
var opts = Basic.extend({
|
6476 |
+
width: this.width,
|
6477 |
+
height: this.height,
|
6478 |
+
type: this.type || 'image/jpeg',
|
6479 |
+
quality: 90,
|
6480 |
+
fit: true,
|
6481 |
+
resample: 'nearest'
|
6482 |
+
}, options);
|
6483 |
+
|
6484 |
+
|
6485 |
+
function render(type, quality) {
|
6486 |
+
var img = this;
|
6487 |
+
|
6488 |
+
// if possible, embed a canvas element directly
|
6489 |
+
if (Env.can('create_canvas')) {
|
6490 |
+
var canvas = img.getAsCanvas();
|
6491 |
+
if (canvas) {
|
6492 |
+
el.appendChild(canvas);
|
6493 |
+
canvas = null;
|
6494 |
+
img.destroy();
|
6495 |
+
self.trigger('embedded');
|
6496 |
+
return;
|
6497 |
+
}
|
6498 |
+
}
|
6499 |
+
|
6500 |
+
var dataUrl = img.getAsDataURL(type, quality);
|
6501 |
+
if (!dataUrl) {
|
6502 |
+
throw new x.ImageError(x.ImageError.WRONG_FORMAT);
|
6503 |
+
}
|
6504 |
+
|
6505 |
+
if (Env.can('use_data_uri_of', dataUrl.length)) {
|
6506 |
+
el.innerHTML = '<img src="' + dataUrl + '" width="' + img.width + '" height="' + img.height + '" alt="" />';
|
6507 |
+
img.destroy();
|
6508 |
+
self.trigger('embedded');
|
6509 |
+
} else {
|
6510 |
+
var tr = new Transporter();
|
6511 |
+
|
6512 |
+
tr.bind("TransportingComplete", function() {
|
6513 |
+
runtime = self.connectRuntime(this.result.ruid);
|
6514 |
+
|
6515 |
+
self.bind("Embedded", function() {
|
6516 |
+
// position and size properly
|
6517 |
+
Basic.extend(runtime.getShimContainer().style, {
|
6518 |
+
//position: 'relative',
|
6519 |
+
top: '0px',
|
6520 |
+
left: '0px',
|
6521 |
+
width: img.width + 'px',
|
6522 |
+
height: img.height + 'px'
|
6523 |
+
});
|
6524 |
+
|
6525 |
+
// some shims (Flash/SilverLight) reinitialize, if parent element is hidden, reordered or it's
|
6526 |
+
// position type changes (in Gecko), but since we basically need this only in IEs 6/7 and
|
6527 |
+
// sometimes 8 and they do not have this problem, we can comment this for now
|
6528 |
+
/*tr.bind("RuntimeInit", function(e, runtime) {
|
6529 |
+
tr.destroy();
|
6530 |
+
runtime.destroy();
|
6531 |
+
onResize.call(self); // re-feed our image data
|
6532 |
+
});*/
|
6533 |
+
|
6534 |
+
runtime = null; // release
|
6535 |
+
}, 999);
|
6536 |
+
|
6537 |
+
runtime.exec.call(self, "ImageView", "display", this.result.uid, width, height);
|
6538 |
+
img.destroy();
|
6539 |
+
});
|
6540 |
+
|
6541 |
+
tr.transport(Encode.atob(dataUrl.substring(dataUrl.indexOf('base64,') + 7)), type, {
|
6542 |
+
required_caps: {
|
6543 |
+
display_media: true
|
6544 |
+
},
|
6545 |
+
runtime_order: 'flash,silverlight',
|
6546 |
+
container: el
|
6547 |
+
});
|
6548 |
+
}
|
6549 |
+
}
|
6550 |
+
|
6551 |
+
try {
|
6552 |
+
if (!(el = Dom.get(el))) {
|
6553 |
+
throw new x.DOMException(x.DOMException.INVALID_NODE_TYPE_ERR);
|
6554 |
+
}
|
6555 |
+
|
6556 |
+
if (!this.size) { // only preloaded image objects can be used as source
|
6557 |
+
throw new x.DOMException(x.DOMException.INVALID_STATE_ERR);
|
6558 |
+
}
|
6559 |
+
|
6560 |
+
// high-resolution images cannot be consistently handled across the runtimes
|
6561 |
+
if (this.width > Image.MAX_RESIZE_WIDTH || this.height > Image.MAX_RESIZE_HEIGHT) {
|
6562 |
+
//throw new x.ImageError(x.ImageError.MAX_RESOLUTION_ERR);
|
6563 |
+
}
|
6564 |
+
|
6565 |
+
var imgCopy = new Image();
|
6566 |
+
|
6567 |
+
imgCopy.bind("Resize", function() {
|
6568 |
+
render.call(this, opts.type, opts.quality);
|
6569 |
+
});
|
6570 |
+
|
6571 |
+
imgCopy.bind("Load", function() {
|
6572 |
+
this.downsize(opts);
|
6573 |
+
});
|
6574 |
+
|
6575 |
+
// if embedded thumb data is available and dimensions are big enough, use it
|
6576 |
+
if (this.meta.thumb && this.meta.thumb.width >= opts.width && this.meta.thumb.height >= opts.height) {
|
6577 |
+
imgCopy.load(this.meta.thumb.data);
|
6578 |
+
} else {
|
6579 |
+
imgCopy.clone(this, false);
|
6580 |
+
}
|
6581 |
+
|
6582 |
+
return imgCopy;
|
6583 |
+
} catch(ex) {
|
6584 |
+
// for now simply trigger error event
|
6585 |
+
this.trigger('error', ex.code);
|
6586 |
+
}
|
6587 |
+
},
|
6588 |
+
|
6589 |
+
/**
|
6590 |
+
Properly destroys the image and frees resources in use. If any. Recommended way to dispose
|
6591 |
+
moxie.image.Image object.
|
6592 |
+
|
6593 |
+
@method destroy
|
6594 |
+
*/
|
6595 |
+
destroy: function() {
|
6596 |
+
if (this.ruid) {
|
6597 |
+
this.getRuntime().exec.call(this, 'Image', 'destroy');
|
6598 |
+
this.disconnectRuntime();
|
6599 |
+
}
|
6600 |
+
if (this.meta && this.meta.thumb) {
|
6601 |
+
// thumb is blob, make sure we destroy it first
|
6602 |
+
this.meta.thumb.data.destroy();
|
6603 |
+
}
|
6604 |
+
this.unbindAll();
|
6605 |
+
}
|
6606 |
+
});
|
6607 |
+
|
6608 |
+
|
6609 |
+
// this is here, because in order to bind properly, we need uid, which is created above
|
6610 |
+
this.handleEventProps(dispatches);
|
6611 |
+
|
6612 |
+
this.bind('Load Resize', function() {
|
6613 |
+
return _updateInfo.call(this); // if operation fails (e.g. image is neither PNG nor JPEG) cancel all pending events
|
6614 |
+
}, 999);
|
6615 |
+
|
6616 |
+
|
6617 |
+
function _updateInfo(info) {
|
6618 |
+
try {
|
6619 |
+
if (!info) {
|
6620 |
+
info = this.exec('Image', 'getInfo');
|
6621 |
+
}
|
6622 |
+
|
6623 |
+
this.size = info.size;
|
6624 |
+
this.width = info.width;
|
6625 |
+
this.height = info.height;
|
6626 |
+
this.type = info.type;
|
6627 |
+
this.meta = info.meta;
|
6628 |
+
|
6629 |
+
// update file name, only if empty
|
6630 |
+
if (this.name === '') {
|
6631 |
+
this.name = info.name;
|
6632 |
+
}
|
6633 |
+
|
6634 |
+
return true;
|
6635 |
+
} catch(ex) {
|
6636 |
+
this.trigger('error', ex.code);
|
6637 |
+
return false;
|
6638 |
+
}
|
6639 |
+
}
|
6640 |
+
|
6641 |
+
|
6642 |
+
function _load(src) {
|
6643 |
+
var srcType = Basic.typeOf(src);
|
6644 |
+
|
6645 |
+
try {
|
6646 |
+
// if source is Image
|
6647 |
+
if (src instanceof Image) {
|
6648 |
+
if (!src.size) { // only preloaded image objects can be used as source
|
6649 |
+
throw new x.DOMException(x.DOMException.INVALID_STATE_ERR);
|
6650 |
+
}
|
6651 |
+
_loadFromImage.apply(this, arguments);
|
6652 |
+
}
|
6653 |
+
// if source is o.Blob/o.File
|
6654 |
+
else if (src instanceof Blob) {
|
6655 |
+
if (!~Basic.inArray(src.type, ['image/jpeg', 'image/png'])) {
|
6656 |
+
throw new x.ImageError(x.ImageError.WRONG_FORMAT);
|
6657 |
+
}
|
6658 |
+
_loadFromBlob.apply(this, arguments);
|
6659 |
+
}
|
6660 |
+
// if native blob/file
|
6661 |
+
else if (Basic.inArray(srcType, ['blob', 'file']) !== -1) {
|
6662 |
+
_load.call(this, new File(null, src), arguments[1]);
|
6663 |
+
}
|
6664 |
+
// if String
|
6665 |
+
else if (srcType === 'string') {
|
6666 |
+
// if dataUrl String
|
6667 |
+
if (src.substr(0, 5) === 'data:') {
|
6668 |
+
_load.call(this, new Blob(null, { data: src }), arguments[1]);
|
6669 |
+
}
|
6670 |
+
// else assume Url, either relative or absolute
|
6671 |
+
else {
|
6672 |
+
_loadFromUrl.apply(this, arguments);
|
6673 |
+
}
|
6674 |
+
}
|
6675 |
+
// if source seems to be an img node
|
6676 |
+
else if (srcType === 'node' && src.nodeName.toLowerCase() === 'img') {
|
6677 |
+
_load.call(this, src.src, arguments[1]);
|
6678 |
+
}
|
6679 |
+
else {
|
6680 |
+
throw new x.DOMException(x.DOMException.TYPE_MISMATCH_ERR);
|
6681 |
+
}
|
6682 |
+
} catch(ex) {
|
6683 |
+
// for now simply trigger error event
|
6684 |
+
this.trigger('error', ex.code);
|
6685 |
+
}
|
6686 |
+
}
|
6687 |
+
|
6688 |
+
|
6689 |
+
function _loadFromImage(img, exact) {
|
6690 |
+
var runtime = this.connectRuntime(img.ruid);
|
6691 |
+
this.ruid = runtime.uid;
|
6692 |
+
runtime.exec.call(this, 'Image', 'loadFromImage', img, (Basic.typeOf(exact) === 'undefined' ? true : exact));
|
6693 |
+
}
|
6694 |
+
|
6695 |
+
|
6696 |
+
function _loadFromBlob(blob, options) {
|
6697 |
+
var self = this;
|
6698 |
+
|
6699 |
+
self.name = blob.name || '';
|
6700 |
+
|
6701 |
+
function exec(runtime) {
|
6702 |
+
self.ruid = runtime.uid;
|
6703 |
+
runtime.exec.call(self, 'Image', 'loadFromBlob', blob);
|
6704 |
+
}
|
6705 |
+
|
6706 |
+
if (blob.isDetached()) {
|
6707 |
+
this.bind('RuntimeInit', function(e, runtime) {
|
6708 |
+
exec(runtime);
|
6709 |
+
});
|
6710 |
+
|
6711 |
+
// convert to object representation
|
6712 |
+
if (options && typeof(options.required_caps) === 'string') {
|
6713 |
+
options.required_caps = Runtime.parseCaps(options.required_caps);
|
6714 |
+
}
|
6715 |
+
|
6716 |
+
this.connectRuntime(Basic.extend({
|
6717 |
+
required_caps: {
|
6718 |
+
access_image_binary: true,
|
6719 |
+
resize_image: true
|
6720 |
+
}
|
6721 |
+
}, options));
|
6722 |
+
} else {
|
6723 |
+
exec(this.connectRuntime(blob.ruid));
|
6724 |
+
}
|
6725 |
+
}
|
6726 |
+
|
6727 |
+
|
6728 |
+
function _loadFromUrl(url, options) {
|
6729 |
+
var self = this, xhr;
|
6730 |
+
|
6731 |
+
xhr = new XMLHttpRequest();
|
6732 |
+
|
6733 |
+
xhr.open('get', url);
|
6734 |
+
xhr.responseType = 'blob';
|
6735 |
+
|
6736 |
+
xhr.onprogress = function(e) {
|
6737 |
+
self.trigger(e);
|
6738 |
+
};
|
6739 |
+
|
6740 |
+
xhr.onload = function() {
|
6741 |
+
_loadFromBlob.call(self, xhr.response, true);
|
6742 |
+
};
|
6743 |
+
|
6744 |
+
xhr.onerror = function(e) {
|
6745 |
+
self.trigger(e);
|
6746 |
+
};
|
6747 |
+
|
6748 |
+
xhr.onloadend = function() {
|
6749 |
+
xhr.destroy();
|
6750 |
+
};
|
6751 |
+
|
6752 |
+
xhr.bind('RuntimeError', function(e, err) {
|
6753 |
+
self.trigger('RuntimeError', err);
|
6754 |
+
});
|
6755 |
+
|
6756 |
+
xhr.send(null, options);
|
6757 |
+
}
|
6758 |
+
}
|
6759 |
+
|
6760 |
+
// virtual world will crash on you if image has a resolution higher than this:
|
6761 |
+
Image.MAX_RESIZE_WIDTH = 8192;
|
6762 |
+
Image.MAX_RESIZE_HEIGHT = 8192;
|
6763 |
+
|
6764 |
+
Image.prototype = EventTarget.instance;
|
6765 |
+
|
6766 |
+
return Image;
|
6767 |
+
});
|
6768 |
+
|
6769 |
+
// Included from: src/javascript/runtime/html5/Runtime.js
|
6770 |
+
|
6771 |
+
/**
|
6772 |
+
* Runtime.js
|
6773 |
+
*
|
6774 |
+
* Copyright 2013, Moxiecode Systems AB
|
6775 |
+
* Released under GPL License.
|
6776 |
+
*
|
6777 |
+
* License: http://www.plupload.com/license
|
6778 |
+
* Contributing: http://www.plupload.com/contributing
|
6779 |
+
*/
|
6780 |
+
|
6781 |
+
/*global File:true */
|
6782 |
+
|
6783 |
+
/**
|
6784 |
+
Defines constructor for HTML5 runtime.
|
6785 |
+
|
6786 |
+
@class moxie/runtime/html5/Runtime
|
6787 |
+
@private
|
6788 |
+
*/
|
6789 |
+
define("moxie/runtime/html5/Runtime", [
|
6790 |
+
"moxie/core/utils/Basic",
|
6791 |
+
"moxie/core/Exceptions",
|
6792 |
+
"moxie/runtime/Runtime",
|
6793 |
+
"moxie/core/utils/Env"
|
6794 |
+
], function(Basic, x, Runtime, Env) {
|
6795 |
+
|
6796 |
+
var type = "html5", extensions = {};
|
6797 |
+
|
6798 |
+
function Html5Runtime(options) {
|
6799 |
+
var I = this
|
6800 |
+
, Test = Runtime.capTest
|
6801 |
+
, True = Runtime.capTrue
|
6802 |
+
;
|
6803 |
+
|
6804 |
+
var caps = Basic.extend({
|
6805 |
+
access_binary: Test(window.FileReader || window.File && window.File.getAsDataURL),
|
6806 |
+
access_image_binary: function() {
|
6807 |
+
return I.can('access_binary') && !!extensions.Image;
|
6808 |
+
},
|
6809 |
+
display_media: Test(
|
6810 |
+
(Env.can('create_canvas') || Env.can('use_data_uri_over32kb')) &&
|
6811 |
+
defined('moxie/image/Image')
|
6812 |
+
),
|
6813 |
+
do_cors: Test(window.XMLHttpRequest && 'withCredentials' in new XMLHttpRequest()),
|
6814 |
+
drag_and_drop: Test(function() {
|
6815 |
+
// this comes directly from Modernizr: http://www.modernizr.com/
|
6816 |
+
var div = document.createElement('div');
|
6817 |
+
// IE has support for drag and drop since version 5, but doesn't support dropping files from desktop
|
6818 |
+
return (('draggable' in div) || ('ondragstart' in div && 'ondrop' in div)) &&
|
6819 |
+
(Env.browser !== 'IE' || Env.verComp(Env.version, 9, '>'));
|
6820 |
+
}()),
|
6821 |
+
filter_by_extension: Test(function() { // if you know how to feature-detect this, please suggest
|
6822 |
+
return !(
|
6823 |
+
(Env.browser === 'Chrome' && Env.verComp(Env.version, 28, '<')) ||
|
6824 |
+
(Env.browser === 'IE' && Env.verComp(Env.version, 10, '<')) ||
|
6825 |
+
(Env.browser === 'Safari' && Env.verComp(Env.version, 7, '<')) ||
|
6826 |
+
(Env.browser === 'Firefox' && Env.verComp(Env.version, 37, '<'))
|
6827 |
+
);
|
6828 |
+
}()),
|
6829 |
+
return_response_headers: True,
|
6830 |
+
return_response_type: function(responseType) {
|
6831 |
+
if (responseType === 'json' && !!window.JSON) { // we can fake this one even if it's not supported
|
6832 |
+
return true;
|
6833 |
+
}
|
6834 |
+
return Env.can('return_response_type', responseType);
|
6835 |
+
},
|
6836 |
+
return_status_code: True,
|
6837 |
+
report_upload_progress: Test(window.XMLHttpRequest && new XMLHttpRequest().upload),
|
6838 |
+
resize_image: function() {
|
6839 |
+
return I.can('access_binary') && Env.can('create_canvas');
|
6840 |
+
},
|
6841 |
+
select_file: function() {
|
6842 |
+
return Env.can('use_fileinput') && window.File;
|
6843 |
+
},
|
6844 |
+
select_folder: function() {
|
6845 |
+
return I.can('select_file') && (
|
6846 |
+
Env.browser === 'Chrome' && Env.verComp(Env.version, 21, '>=') ||
|
6847 |
+
Env.browser === 'Firefox' && Env.verComp(Env.version, 42, '>=') // https://developer.mozilla.org/en-US/Firefox/Releases/42
|
6848 |
+
);
|
6849 |
+
},
|
6850 |
+
select_multiple: function() {
|
6851 |
+
// it is buggy on Safari Windows and iOS
|
6852 |
+
return I.can('select_file') &&
|
6853 |
+
!(Env.browser === 'Safari' && Env.os === 'Windows') &&
|
6854 |
+
!(Env.os === 'iOS' && Env.verComp(Env.osVersion, "7.0.0", '>') && Env.verComp(Env.osVersion, "8.0.0", '<'));
|
6855 |
+
},
|
6856 |
+
send_binary_string: Test(window.XMLHttpRequest && (new XMLHttpRequest().sendAsBinary || (window.Uint8Array && window.ArrayBuffer))),
|
6857 |
+
send_custom_headers: Test(window.XMLHttpRequest),
|
6858 |
+
send_multipart: function() {
|
6859 |
+
return !!(window.XMLHttpRequest && new XMLHttpRequest().upload && window.FormData) || I.can('send_binary_string');
|
6860 |
+
},
|
6861 |
+
slice_blob: Test(window.File && (File.prototype.mozSlice || File.prototype.webkitSlice || File.prototype.slice)),
|
6862 |
+
stream_upload: function(){
|
6863 |
+
return I.can('slice_blob') && I.can('send_multipart');
|
6864 |
+
},
|
6865 |
+
summon_file_dialog: function() { // yeah... some dirty sniffing here...
|
6866 |
+
return I.can('select_file') && !(
|
6867 |
+
(Env.browser === 'Firefox' && Env.verComp(Env.version, 4, '<')) ||
|
6868 |
+
(Env.browser === 'Opera' && Env.verComp(Env.version, 12, '<')) ||
|
6869 |
+
(Env.browser === 'IE' && Env.verComp(Env.version, 10, '<'))
|
6870 |
+
);
|
6871 |
+
},
|
6872 |
+
upload_filesize: True,
|
6873 |
+
use_http_method: True
|
6874 |
+
},
|
6875 |
+
arguments[2]
|
6876 |
+
);
|
6877 |
+
|
6878 |
+
Runtime.call(this, options, (arguments[1] || type), caps);
|
6879 |
+
|
6880 |
+
|
6881 |
+
Basic.extend(this, {
|
6882 |
+
|
6883 |
+
init : function() {
|
6884 |
+
this.trigger("Init");
|
6885 |
+
},
|
6886 |
+
|
6887 |
+
destroy: (function(destroy) { // extend default destroy method
|
6888 |
+
return function() {
|
6889 |
+
destroy.call(I);
|
6890 |
+
destroy = I = null;
|
6891 |
+
};
|
6892 |
+
}(this.destroy))
|
6893 |
+
});
|
6894 |
+
|
6895 |
+
Basic.extend(this.getShim(), extensions);
|
6896 |
+
}
|
6897 |
+
|
6898 |
+
Runtime.addConstructor(type, Html5Runtime);
|
6899 |
+
|
6900 |
+
return extensions;
|
6901 |
+
});
|
6902 |
+
|
6903 |
+
// Included from: src/javascript/runtime/html5/file/Blob.js
|
6904 |
+
|
6905 |
+
/**
|
6906 |
+
* Blob.js
|
6907 |
+
*
|
6908 |
+
* Copyright 2013, Moxiecode Systems AB
|
6909 |
+
* Released under GPL License.
|
6910 |
+
*
|
6911 |
+
* License: http://www.plupload.com/license
|
6912 |
+
* Contributing: http://www.plupload.com/contributing
|
6913 |
+
*/
|
6914 |
+
|
6915 |
+
/**
|
6916 |
+
@class moxie/runtime/html5/file/Blob
|
6917 |
+
@private
|
6918 |
+
*/
|
6919 |
+
define("moxie/runtime/html5/file/Blob", [
|
6920 |
+
"moxie/runtime/html5/Runtime",
|
6921 |
+
"moxie/file/Blob"
|
6922 |
+
], function(extensions, Blob) {
|
6923 |
+
|
6924 |
+
function HTML5Blob() {
|
6925 |
+
function w3cBlobSlice(blob, start, end) {
|
6926 |
+
var blobSlice;
|
6927 |
+
|
6928 |
+
if (window.File.prototype.slice) {
|
6929 |
+
try {
|
6930 |
+
blob.slice(); // depricated version will throw WRONG_ARGUMENTS_ERR exception
|
6931 |
+
return blob.slice(start, end);
|
6932 |
+
} catch (e) {
|
6933 |
+
// depricated slice method
|
6934 |
+
return blob.slice(start, end - start);
|
6935 |
+
}
|
6936 |
+
// slice method got prefixed: https://bugzilla.mozilla.org/show_bug.cgi?id=649672
|
6937 |
+
} else if ((blobSlice = window.File.prototype.webkitSlice || window.File.prototype.mozSlice)) {
|
6938 |
+
return blobSlice.call(blob, start, end);
|
6939 |
+
} else {
|
6940 |
+
return null; // or throw some exception
|
6941 |
+
}
|
6942 |
+
}
|
6943 |
+
|
6944 |
+
this.slice = function() {
|
6945 |
+
return new Blob(this.getRuntime().uid, w3cBlobSlice.apply(this, arguments));
|
6946 |
+
};
|
6947 |
+
|
6948 |
+
this.destroy = function() {
|
6949 |
+
this.getRuntime().getShim().removeInstance(this.uid);
|
6950 |
+
};
|
6951 |
+
}
|
6952 |
+
|
6953 |
+
return (extensions.Blob = HTML5Blob);
|
6954 |
+
});
|
6955 |
+
|
6956 |
+
// Included from: src/javascript/core/utils/Events.js
|
6957 |
+
|
6958 |
+
/**
|
6959 |
+
* Events.js
|
6960 |
+
*
|
6961 |
+
* Copyright 2013, Moxiecode Systems AB
|
6962 |
+
* Released under GPL License.
|
6963 |
+
*
|
6964 |
+
* License: http://www.plupload.com/license
|
6965 |
+
* Contributing: http://www.plupload.com/contributing
|
6966 |
+
*/
|
6967 |
+
|
6968 |
+
/**
|
6969 |
+
@class moxie/core/utils/Events
|
6970 |
+
@public
|
6971 |
+
@static
|
6972 |
+
*/
|
6973 |
+
|
6974 |
+
define('moxie/core/utils/Events', [
|
6975 |
+
'moxie/core/utils/Basic'
|
6976 |
+
], function(Basic) {
|
6977 |
+
var eventhash = {}, uid = 'moxie_' + Basic.guid();
|
6978 |
+
|
6979 |
+
// IE W3C like event funcs
|
6980 |
+
function preventDefault() {
|
6981 |
+
this.returnValue = false;
|
6982 |
+
}
|
6983 |
+
|
6984 |
+
function stopPropagation() {
|
6985 |
+
this.cancelBubble = true;
|
6986 |
+
}
|
6987 |
+
|
6988 |
+
/**
|
6989 |
+
Adds an event handler to the specified object and store reference to the handler
|
6990 |
+
in objects internal Plupload registry (@see removeEvent).
|
6991 |
+
|
6992 |
+
@method addEvent
|
6993 |
+
@static
|
6994 |
+
@param {Object} obj DOM element like object to add handler to.
|
6995 |
+
@param {String} name Name to add event listener to.
|
6996 |
+
@param {Function} callback Function to call when event occurs.
|
6997 |
+
@param {String} [key] that might be used to add specifity to the event record.
|
6998 |
+
*/
|
6999 |
+
var addEvent = function(obj, name, callback, key) {
|
7000 |
+
var func, events;
|
7001 |
+
|
7002 |
+
name = name.toLowerCase();
|
7003 |
+
|
7004 |
+
// Add event listener
|
7005 |
+
if (obj.addEventListener) {
|
7006 |
+
func = callback;
|
7007 |
+
|
7008 |
+
obj.addEventListener(name, func, false);
|
7009 |
+
} else if (obj.attachEvent) {
|
7010 |
+
func = function() {
|
7011 |
+
var evt = window.event;
|
7012 |
+
|
7013 |
+
if (!evt.target) {
|
7014 |
+
evt.target = evt.srcElement;
|
7015 |
+
}
|
7016 |
+
|
7017 |
+
evt.preventDefault = preventDefault;
|
7018 |
+
evt.stopPropagation = stopPropagation;
|
7019 |
+
|
7020 |
+
callback(evt);
|
7021 |
+
};
|
7022 |
+
|
7023 |
+
obj.attachEvent('on' + name, func);
|
7024 |
+
}
|
7025 |
+
|
7026 |
+
// Log event handler to objects internal mOxie registry
|
7027 |
+
if (!obj[uid]) {
|
7028 |
+
obj[uid] = Basic.guid();
|
7029 |
+
}
|
7030 |
+
|
7031 |
+
if (!eventhash.hasOwnProperty(obj[uid])) {
|
7032 |
+
eventhash[obj[uid]] = {};
|
7033 |
+
}
|
7034 |
+
|
7035 |
+
events = eventhash[obj[uid]];
|
7036 |
+
|
7037 |
+
if (!events.hasOwnProperty(name)) {
|
7038 |
+
events[name] = [];
|
7039 |
+
}
|
7040 |
+
|
7041 |
+
events[name].push({
|
7042 |
+
func: func,
|
7043 |
+
orig: callback, // store original callback for IE
|
7044 |
+
key: key
|
7045 |
+
});
|
7046 |
+
};
|
7047 |
+
|
7048 |
+
|
7049 |
+
/**
|
7050 |
+
Remove event handler from the specified object. If third argument (callback)
|
7051 |
+
is not specified remove all events with the specified name.
|
7052 |
+
|
7053 |
+
@method removeEvent
|
7054 |
+
@static
|
7055 |
+
@param {Object} obj DOM element to remove event listener(s) from.
|
7056 |
+
@param {String} name Name of event listener to remove.
|
7057 |
+
@param {Function|String} [callback] might be a callback or unique key to match.
|
7058 |
+
*/
|
7059 |
+
var removeEvent = function(obj, name, callback) {
|
7060 |
+
var type, undef;
|
7061 |
+
|
7062 |
+
name = name.toLowerCase();
|
7063 |
+
|
7064 |
+
if (obj[uid] && eventhash[obj[uid]] && eventhash[obj[uid]][name]) {
|
7065 |
+
type = eventhash[obj[uid]][name];
|
7066 |
+
} else {
|
7067 |
+
return;
|
7068 |
+
}
|
7069 |
+
|
7070 |
+
for (var i = type.length - 1; i >= 0; i--) {
|
7071 |
+
// undefined or not, key should match
|
7072 |
+
if (type[i].orig === callback || type[i].key === callback) {
|
7073 |
+
if (obj.removeEventListener) {
|
7074 |
+
obj.removeEventListener(name, type[i].func, false);
|
7075 |
+
} else if (obj.detachEvent) {
|
7076 |
+
obj.detachEvent('on'+name, type[i].func);
|
7077 |
+
}
|
7078 |
+
|
7079 |
+
type[i].orig = null;
|
7080 |
+
type[i].func = null;
|
7081 |
+
type.splice(i, 1);
|
7082 |
+
|
7083 |
+
// If callback was passed we are done here, otherwise proceed
|
7084 |
+
if (callback !== undef) {
|
7085 |
+
break;
|
7086 |
+
}
|
7087 |
+
}
|
7088 |
+
}
|
7089 |
+
|
7090 |
+
// If event array got empty, remove it
|
7091 |
+
if (!type.length) {
|
7092 |
+
delete eventhash[obj[uid]][name];
|
7093 |
+
}
|
7094 |
+
|
7095 |
+
// If mOxie registry has become empty, remove it
|
7096 |
+
if (Basic.isEmptyObj(eventhash[obj[uid]])) {
|
7097 |
+
delete eventhash[obj[uid]];
|
7098 |
+
|
7099 |
+
// IE doesn't let you remove DOM object property with - delete
|
7100 |
+
try {
|
7101 |
+
delete obj[uid];
|
7102 |
+
} catch(e) {
|
7103 |
+
obj[uid] = undef;
|
7104 |
+
}
|
7105 |
+
}
|
7106 |
+
};
|
7107 |
+
|
7108 |
+
|
7109 |
+
/**
|
7110 |
+
Remove all kind of events from the specified object
|
7111 |
+
|
7112 |
+
@method removeAllEvents
|
7113 |
+
@static
|
7114 |
+
@param {Object} obj DOM element to remove event listeners from.
|
7115 |
+
@param {String} [key] unique key to match, when removing events.
|
7116 |
+
*/
|
7117 |
+
var removeAllEvents = function(obj, key) {
|
7118 |
+
if (!obj || !obj[uid]) {
|
7119 |
+
return;
|
7120 |
+
}
|
7121 |
+
|
7122 |
+
Basic.each(eventhash[obj[uid]], function(events, name) {
|
7123 |
+
removeEvent(obj, name, key);
|
7124 |
+
});
|
7125 |
+
};
|
7126 |
+
|
7127 |
+
return {
|
7128 |
+
addEvent: addEvent,
|
7129 |
+
removeEvent: removeEvent,
|
7130 |
+
removeAllEvents: removeAllEvents
|
7131 |
+
};
|
7132 |
+
});
|
7133 |
+
|
7134 |
+
// Included from: src/javascript/runtime/html5/file/FileInput.js
|
7135 |
+
|
7136 |
+
/**
|
7137 |
+
* FileInput.js
|
7138 |
+
*
|
7139 |
+
* Copyright 2013, Moxiecode Systems AB
|
7140 |
+
* Released under GPL License.
|
7141 |
+
*
|
7142 |
+
* License: http://www.plupload.com/license
|
7143 |
+
* Contributing: http://www.plupload.com/contributing
|
7144 |
+
*/
|
7145 |
+
|
7146 |
+
/**
|
7147 |
+
@class moxie/runtime/html5/file/FileInput
|
7148 |
+
@private
|
7149 |
+
*/
|
7150 |
+
define("moxie/runtime/html5/file/FileInput", [
|
7151 |
+
"moxie/runtime/html5/Runtime",
|
7152 |
+
"moxie/file/File",
|
7153 |
+
"moxie/core/utils/Basic",
|
7154 |
+
"moxie/core/utils/Dom",
|
7155 |
+
"moxie/core/utils/Events",
|
7156 |
+
"moxie/core/utils/Mime",
|
7157 |
+
"moxie/core/utils/Env"
|
7158 |
+
], function(extensions, File, Basic, Dom, Events, Mime, Env) {
|
7159 |
+
|
7160 |
+
function FileInput() {
|
7161 |
+
var _options, _browseBtnZIndex; // save original z-index
|
7162 |
+
|
7163 |
+
Basic.extend(this, {
|
7164 |
+
init: function(options) {
|
7165 |
+
var comp = this, I = comp.getRuntime(), input, shimContainer, mimes, browseButton, zIndex, top;
|
7166 |
+
|
7167 |
+
_options = options;
|
7168 |
+
|
7169 |
+
// figure out accept string
|
7170 |
+
mimes = Mime.extList2mimes(_options.accept, I.can('filter_by_extension'));
|
7171 |
+
|
7172 |
+
shimContainer = I.getShimContainer();
|
7173 |
+
|
7174 |
+
shimContainer.innerHTML = '<input id="' + I.uid +'" type="file" style="font-size:999px;opacity:0;"' +
|
7175 |
+
(_options.multiple && I.can('select_multiple') ? 'multiple' : '') +
|
7176 |
+
(_options.directory && I.can('select_folder') ? 'webkitdirectory directory' : '') + // Chrome 11+
|
7177 |
+
(mimes ? ' accept="' + mimes.join(',') + '"' : '') + ' />';
|
7178 |
+
|
7179 |
+
input = Dom.get(I.uid);
|
7180 |
+
|
7181 |
+
// prepare file input to be placed underneath the browse_button element
|
7182 |
+
Basic.extend(input.style, {
|
7183 |
+
position: 'absolute',
|
7184 |
+
top: 0,
|
7185 |
+
left: 0,
|
7186 |
+
width: '100%',
|
7187 |
+
height: '100%'
|
7188 |
+
});
|
7189 |
+
|
7190 |
+
|
7191 |
+
browseButton = Dom.get(_options.browse_button);
|
7192 |
+
_browseBtnZIndex = Dom.getStyle(browseButton, 'z-index') || 'auto';
|
7193 |
+
|
7194 |
+
// Route click event to the input[type=file] element for browsers that support such behavior
|
7195 |
+
if (I.can('summon_file_dialog')) {
|
7196 |
+
if (Dom.getStyle(browseButton, 'position') === 'static') {
|
7197 |
+
browseButton.style.position = 'relative';
|
7198 |
+
}
|
7199 |
+
|
7200 |
+
Events.addEvent(browseButton, 'click', function(e) {
|
7201 |
+
var input = Dom.get(I.uid);
|
7202 |
+
if (input && !input.disabled) { // for some reason FF (up to 8.0.1 so far) lets to click disabled input[type=file]
|
7203 |
+
input.click();
|
7204 |
+
}
|
7205 |
+
e.preventDefault();
|
7206 |
+
}, comp.uid);
|
7207 |
+
|
7208 |
+
comp.bind('Refresh', function() {
|
7209 |
+
zIndex = parseInt(_browseBtnZIndex, 10) || 1;
|
7210 |
+
|
7211 |
+
Dom.get(_options.browse_button).style.zIndex = zIndex;
|
7212 |
+
this.getRuntime().getShimContainer().style.zIndex = zIndex - 1;
|
7213 |
+
});
|
7214 |
+
}
|
7215 |
+
|
7216 |
+
/* Since we have to place input[type=file] on top of the browse_button for some browsers,
|
7217 |
+
browse_button loses interactivity, so we restore it here */
|
7218 |
+
top = I.can('summon_file_dialog') ? browseButton : shimContainer;
|
7219 |
+
|
7220 |
+
Events.addEvent(top, 'mouseover', function() {
|
7221 |
+
comp.trigger('mouseenter');
|
7222 |
+
}, comp.uid);
|
7223 |
+
|
7224 |
+
Events.addEvent(top, 'mouseout', function() {
|
7225 |
+
comp.trigger('mouseleave');
|
7226 |
+
}, comp.uid);
|
7227 |
+
|
7228 |
+
Events.addEvent(top, 'mousedown', function() {
|
7229 |
+
comp.trigger('mousedown');
|
7230 |
+
}, comp.uid);
|
7231 |
+
|
7232 |
+
Events.addEvent(Dom.get(_options.container), 'mouseup', function() {
|
7233 |
+
comp.trigger('mouseup');
|
7234 |
+
}, comp.uid);
|
7235 |
+
|
7236 |
+
// it shouldn't be possible to tab into the hidden element
|
7237 |
+
(I.can('summon_file_dialog') ? input : browseButton).setAttribute('tabindex', -1);
|
7238 |
+
|
7239 |
+
input.onchange = function onChange() { // there should be only one handler for this
|
7240 |
+
comp.files = [];
|
7241 |
+
|
7242 |
+
Basic.each(this.files, function(file) {
|
7243 |
+
var relativePath = '';
|
7244 |
+
|
7245 |
+
if (_options.directory) {
|
7246 |
+
// folders are represented by dots, filter them out (Chrome 11+)
|
7247 |
+
if (file.name == ".") {
|
7248 |
+
// if it looks like a folder...
|
7249 |
+
return true;
|
7250 |
+
}
|
7251 |
+
}
|
7252 |
+
|
7253 |
+
if (file.webkitRelativePath) {
|
7254 |
+
relativePath = '/' + file.webkitRelativePath.replace(/^\//, '');
|
7255 |
+
}
|
7256 |
+
|
7257 |
+
file = new File(I.uid, file);
|
7258 |
+
file.relativePath = relativePath;
|
7259 |
+
|
7260 |
+
comp.files.push(file);
|
7261 |
+
});
|
7262 |
+
|
7263 |
+
// clearing the value enables the user to select the same file again if they want to
|
7264 |
+
if (Env.browser !== 'IE' && Env.browser !== 'IEMobile') {
|
7265 |
+
this.value = '';
|
7266 |
+
} else {
|
7267 |
+
// in IE input[type="file"] is read-only so the only way to reset it is to re-insert it
|
7268 |
+
var clone = this.cloneNode(true);
|
7269 |
+
this.parentNode.replaceChild(clone, this);
|
7270 |
+
clone.onchange = onChange;
|
7271 |
+
}
|
7272 |
+
|
7273 |
+
if (comp.files.length) {
|
7274 |
+
comp.trigger('change');
|
7275 |
+
}
|
7276 |
+
};
|
7277 |
+
|
7278 |
+
// ready event is perfectly asynchronous
|
7279 |
+
comp.trigger({
|
7280 |
+
type: 'ready',
|
7281 |
+
async: true
|
7282 |
+
});
|
7283 |
+
|
7284 |
+
shimContainer = null;
|
7285 |
+
},
|
7286 |
+
|
7287 |
+
|
7288 |
+
setOption: function(name, value) {
|
7289 |
+
var I = this.getRuntime();
|
7290 |
+
var input = Dom.get(I.uid);
|
7291 |
+
|
7292 |
+
switch (name) {
|
7293 |
+
case 'accept':
|
7294 |
+
if (value) {
|
7295 |
+
var mimes = value.mimes || Mime.extList2mimes(value, I.can('filter_by_extension'));
|
7296 |
+
input.setAttribute('accept', mimes.join(','));
|
7297 |
+
} else {
|
7298 |
+
input.removeAttribute('accept');
|
7299 |
+
}
|
7300 |
+
break;
|
7301 |
+
|
7302 |
+
case 'directory':
|
7303 |
+
if (value && I.can('select_folder')) {
|
7304 |
+
input.setAttribute('directory', '');
|
7305 |
+
input.setAttribute('webkitdirectory', '');
|
7306 |
+
} else {
|
7307 |
+
input.removeAttribute('directory');
|
7308 |
+
input.removeAttribute('webkitdirectory');
|
7309 |
+
}
|
7310 |
+
break;
|
7311 |
+
|
7312 |
+
case 'multiple':
|
7313 |
+
if (value && I.can('select_multiple')) {
|
7314 |
+
input.setAttribute('multiple', '');
|
7315 |
+
} else {
|
7316 |
+
input.removeAttribute('multiple');
|
7317 |
+
}
|
7318 |
+
|
7319 |
+
}
|
7320 |
+
},
|
7321 |
+
|
7322 |
+
|
7323 |
+
disable: function(state) {
|
7324 |
+
var I = this.getRuntime(), input;
|
7325 |
+
|
7326 |
+
if ((input = Dom.get(I.uid))) {
|
7327 |
+
input.disabled = !!state;
|
7328 |
+
}
|
7329 |
+
},
|
7330 |
+
|
7331 |
+
destroy: function() {
|
7332 |
+
var I = this.getRuntime()
|
7333 |
+
, shim = I.getShim()
|
7334 |
+
, shimContainer = I.getShimContainer()
|
7335 |
+
, container = _options && Dom.get(_options.container)
|
7336 |
+
, browseButton = _options && Dom.get(_options.browse_button)
|
7337 |
+
;
|
7338 |
+
|
7339 |
+
if (container) {
|
7340 |
+
Events.removeAllEvents(container, this.uid);
|
7341 |
+
}
|
7342 |
+
|
7343 |
+
if (browseButton) {
|
7344 |
+
Events.removeAllEvents(browseButton, this.uid);
|
7345 |
+
browseButton.style.zIndex = _browseBtnZIndex; // reset to original value
|
7346 |
+
}
|
7347 |
+
|
7348 |
+
if (shimContainer) {
|
7349 |
+
Events.removeAllEvents(shimContainer, this.uid);
|
7350 |
+
shimContainer.innerHTML = '';
|
7351 |
+
}
|
7352 |
+
|
7353 |
+
shim.removeInstance(this.uid);
|
7354 |
+
|
7355 |
+
_options = shimContainer = container = browseButton = shim = null;
|
7356 |
+
}
|
7357 |
+
});
|
7358 |
+
}
|
7359 |
+
|
7360 |
+
return (extensions.FileInput = FileInput);
|
7361 |
+
});
|
7362 |
+
|
7363 |
+
// Included from: src/javascript/runtime/html5/file/FileDrop.js
|
7364 |
+
|
7365 |
+
/**
|
7366 |
+
* FileDrop.js
|
7367 |
+
*
|
7368 |
+
* Copyright 2013, Moxiecode Systems AB
|
7369 |
+
* Released under GPL License.
|
7370 |
+
*
|
7371 |
+
* License: http://www.plupload.com/license
|
7372 |
+
* Contributing: http://www.plupload.com/contributing
|
7373 |
+
*/
|
7374 |
+
|
7375 |
+
/**
|
7376 |
+
@class moxie/runtime/html5/file/FileDrop
|
7377 |
+
@private
|
7378 |
+
*/
|
7379 |
+
define("moxie/runtime/html5/file/FileDrop", [
|
7380 |
+
"moxie/runtime/html5/Runtime",
|
7381 |
+
'moxie/file/File',
|
7382 |
+
"moxie/core/utils/Basic",
|
7383 |
+
"moxie/core/utils/Dom",
|
7384 |
+
"moxie/core/utils/Events",
|
7385 |
+
"moxie/core/utils/Mime"
|
7386 |
+
], function(extensions, File, Basic, Dom, Events, Mime) {
|
7387 |
+
|
7388 |
+
function FileDrop() {
|
7389 |
+
var _files = [], _allowedExts = [], _options, _ruid;
|
7390 |
+
|
7391 |
+
Basic.extend(this, {
|
7392 |
+
init: function(options) {
|
7393 |
+
var comp = this, dropZone;
|
7394 |
+
|
7395 |
+
_options = options;
|
7396 |
+
_ruid = comp.ruid; // every dropped-in file should have a reference to the runtime
|
7397 |
+
_allowedExts = _extractExts(_options.accept);
|
7398 |
+
dropZone = _options.container;
|
7399 |
+
|
7400 |
+
Events.addEvent(dropZone, 'dragover', function(e) {
|
7401 |
+
if (!_hasFiles(e)) {
|
7402 |
+
return;
|
7403 |
+
}
|
7404 |
+
e.preventDefault();
|
7405 |
+
e.dataTransfer.dropEffect = 'copy';
|
7406 |
+
}, comp.uid);
|
7407 |
+
|
7408 |
+
Events.addEvent(dropZone, 'drop', function(e) {
|
7409 |
+
if (!_hasFiles(e)) {
|
7410 |
+
return;
|
7411 |
+
}
|
7412 |
+
e.preventDefault();
|
7413 |
+
|
7414 |
+
_files = [];
|
7415 |
+
|
7416 |
+
// Chrome 21+ accepts folders via Drag'n'Drop
|
7417 |
+
if (e.dataTransfer.items && e.dataTransfer.items[0].webkitGetAsEntry) {
|
7418 |
+
_readItems(e.dataTransfer.items, function() {
|
7419 |
+
comp.files = _files;
|
7420 |
+
comp.trigger("drop");
|
7421 |
+
});
|
7422 |
+
} else {
|
7423 |
+
Basic.each(e.dataTransfer.files, function(file) {
|
7424 |
+
_addFile(file);
|
7425 |
+
});
|
7426 |
+
comp.files = _files;
|
7427 |
+
comp.trigger("drop");
|
7428 |
+
}
|
7429 |
+
}, comp.uid);
|
7430 |
+
|
7431 |
+
Events.addEvent(dropZone, 'dragenter', function(e) {
|
7432 |
+
comp.trigger("dragenter");
|
7433 |
+
}, comp.uid);
|
7434 |
+
|
7435 |
+
Events.addEvent(dropZone, 'dragleave', function(e) {
|
7436 |
+
comp.trigger("dragleave");
|
7437 |
+
}, comp.uid);
|
7438 |
+
},
|
7439 |
+
|
7440 |
+
destroy: function() {
|
7441 |
+
Events.removeAllEvents(_options && Dom.get(_options.container), this.uid);
|
7442 |
+
_ruid = _files = _allowedExts = _options = null;
|
7443 |
+
this.getRuntime().getShim().removeInstance(this.uid);
|
7444 |
+
}
|
7445 |
+
});
|
7446 |
+
|
7447 |
+
|
7448 |
+
function _hasFiles(e) {
|
7449 |
+
if (!e.dataTransfer || !e.dataTransfer.types) { // e.dataTransfer.files is not available in Gecko during dragover
|
7450 |
+
return false;
|
7451 |
+
}
|
7452 |
+
|
7453 |
+
var types = Basic.toArray(e.dataTransfer.types || []);
|
7454 |
+
|
7455 |
+
return Basic.inArray("Files", types) !== -1 ||
|
7456 |
+
Basic.inArray("public.file-url", types) !== -1 || // Safari < 5
|
7457 |
+
Basic.inArray("application/x-moz-file", types) !== -1 // Gecko < 1.9.2 (< Firefox 3.6)
|
7458 |
+
;
|
7459 |
+
}
|
7460 |
+
|
7461 |
+
|
7462 |
+
function _addFile(file, relativePath) {
|
7463 |
+
if (_isAcceptable(file)) {
|
7464 |
+
var fileObj = new File(_ruid, file);
|
7465 |
+
fileObj.relativePath = relativePath || '';
|
7466 |
+
_files.push(fileObj);
|
7467 |
+
}
|
7468 |
+
}
|
7469 |
+
|
7470 |
+
|
7471 |
+
function _extractExts(accept) {
|
7472 |
+
var exts = [];
|
7473 |
+
for (var i = 0; i < accept.length; i++) {
|
7474 |
+
[].push.apply(exts, accept[i].extensions.split(/\s*,\s*/));
|
7475 |
+
}
|
7476 |
+
return Basic.inArray('*', exts) === -1 ? exts : [];
|
7477 |
+
}
|
7478 |
+
|
7479 |
+
|
7480 |
+
function _isAcceptable(file) {
|
7481 |
+
if (!_allowedExts.length) {
|
7482 |
+
return true;
|
7483 |
+
}
|
7484 |
+
var ext = Mime.getFileExtension(file.name);
|
7485 |
+
return !ext || Basic.inArray(ext, _allowedExts) !== -1;
|
7486 |
+
}
|
7487 |
+
|
7488 |
+
|
7489 |
+
function _readItems(items, cb) {
|
7490 |
+
var entries = [];
|
7491 |
+
Basic.each(items, function(item) {
|
7492 |
+
var entry = item.webkitGetAsEntry();
|
7493 |
+
// Address #998 (https://code.google.com/p/chromium/issues/detail?id=332579)
|
7494 |
+
if (entry) {
|
7495 |
+
// file() fails on OSX when the filename contains a special character (e.g. umlaut): see #61
|
7496 |
+
if (entry.isFile) {
|
7497 |
+
_addFile(item.getAsFile(), entry.fullPath);
|
7498 |
+
} else {
|
7499 |
+
entries.push(entry);
|
7500 |
+
}
|
7501 |
+
}
|
7502 |
+
});
|
7503 |
+
|
7504 |
+
if (entries.length) {
|
7505 |
+
_readEntries(entries, cb);
|
7506 |
+
} else {
|
7507 |
+
cb();
|
7508 |
+
}
|
7509 |
+
}
|
7510 |
+
|
7511 |
+
|
7512 |
+
function _readEntries(entries, cb) {
|
7513 |
+
var queue = [];
|
7514 |
+
Basic.each(entries, function(entry) {
|
7515 |
+
queue.push(function(cbcb) {
|
7516 |
+
_readEntry(entry, cbcb);
|
7517 |
+
});
|
7518 |
+
});
|
7519 |
+
Basic.inSeries(queue, function() {
|
7520 |
+
cb();
|
7521 |
+
});
|
7522 |
+
}
|
7523 |
+
|
7524 |
+
|
7525 |
+
function _readEntry(entry, cb) {
|
7526 |
+
if (entry.isFile) {
|
7527 |
+
entry.file(function(file) {
|
7528 |
+
_addFile(file, entry.fullPath);
|
7529 |
+
cb();
|
7530 |
+
}, function() {
|
7531 |
+
// fire an error event maybe
|
7532 |
+
cb();
|
7533 |
+
});
|
7534 |
+
} else if (entry.isDirectory) {
|
7535 |
+
_readDirEntry(entry, cb);
|
7536 |
+
} else {
|
7537 |
+
cb(); // not file, not directory? what then?..
|
7538 |
+
}
|
7539 |
+
}
|
7540 |
+
|
7541 |
+
|
7542 |
+
function _readDirEntry(dirEntry, cb) {
|
7543 |
+
var entries = [], dirReader = dirEntry.createReader();
|
7544 |
+
|
7545 |
+
// keep quering recursively till no more entries
|
7546 |
+
function getEntries(cbcb) {
|
7547 |
+
dirReader.readEntries(function(moreEntries) {
|
7548 |
+
if (moreEntries.length) {
|
7549 |
+
[].push.apply(entries, moreEntries);
|
7550 |
+
getEntries(cbcb);
|
7551 |
+
} else {
|
7552 |
+
cbcb();
|
7553 |
+
}
|
7554 |
+
}, cbcb);
|
7555 |
+
}
|
7556 |
+
|
7557 |
+
// ...and you thought FileReader was crazy...
|
7558 |
+
getEntries(function() {
|
7559 |
+
_readEntries(entries, cb);
|
7560 |
+
});
|
7561 |
+
}
|
7562 |
+
}
|
7563 |
+
|
7564 |
+
return (extensions.FileDrop = FileDrop);
|
7565 |
+
});
|
7566 |
+
|
7567 |
+
// Included from: src/javascript/runtime/html5/file/FileReader.js
|
7568 |
+
|
7569 |
+
/**
|
7570 |
+
* FileReader.js
|
7571 |
+
*
|
7572 |
+
* Copyright 2013, Moxiecode Systems AB
|
7573 |
+
* Released under GPL License.
|
7574 |
+
*
|
7575 |
+
* License: http://www.plupload.com/license
|
7576 |
+
* Contributing: http://www.plupload.com/contributing
|
7577 |
+
*/
|
7578 |
+
|
7579 |
+
/**
|
7580 |
+
@class moxie/runtime/html5/file/FileReader
|
7581 |
+
@private
|
7582 |
+
*/
|
7583 |
+
define("moxie/runtime/html5/file/FileReader", [
|
7584 |
+
"moxie/runtime/html5/Runtime",
|
7585 |
+
"moxie/core/utils/Encode",
|
7586 |
+
"moxie/core/utils/Basic"
|
7587 |
+
], function(extensions, Encode, Basic) {
|
7588 |
+
|
7589 |
+
function FileReader() {
|
7590 |
+
var _fr, _convertToBinary = false;
|
7591 |
+
|
7592 |
+
Basic.extend(this, {
|
7593 |
+
|
7594 |
+
read: function(op, blob) {
|
7595 |
+
var comp = this;
|
7596 |
+
|
7597 |
+
comp.result = '';
|
7598 |
+
|
7599 |
+
_fr = new window.FileReader();
|
7600 |
+
|
7601 |
+
_fr.addEventListener('progress', function(e) {
|
7602 |
+
comp.trigger(e);
|
7603 |
+
});
|
7604 |
+
|
7605 |
+
_fr.addEventListener('load', function(e) {
|
7606 |
+
comp.result = _convertToBinary ? _toBinary(_fr.result) : _fr.result;
|
7607 |
+
comp.trigger(e);
|
7608 |
+
});
|
7609 |
+
|
7610 |
+
_fr.addEventListener('error', function(e) {
|
7611 |
+
comp.trigger(e, _fr.error);
|
7612 |
+
});
|
7613 |
+
|
7614 |
+
_fr.addEventListener('loadend', function(e) {
|
7615 |
+
_fr = null;
|
7616 |
+
comp.trigger(e);
|
7617 |
+
});
|
7618 |
+
|
7619 |
+
if (Basic.typeOf(_fr[op]) === 'function') {
|
7620 |
+
_convertToBinary = false;
|
7621 |
+
_fr[op](blob.getSource());
|
7622 |
+
} else if (op === 'readAsBinaryString') { // readAsBinaryString is depricated in general and never existed in IE10+
|
7623 |
+
_convertToBinary = true;
|
7624 |
+
_fr.readAsDataURL(blob.getSource());
|
7625 |
+
}
|
7626 |
+
},
|
7627 |
+
|
7628 |
+
abort: function() {
|
7629 |
+
if (_fr) {
|
7630 |
+
_fr.abort();
|
7631 |
+
}
|
7632 |
+
},
|
7633 |
+
|
7634 |
+
destroy: function() {
|
7635 |
+
_fr = null;
|
7636 |
+
this.getRuntime().getShim().removeInstance(this.uid);
|
7637 |
+
}
|
7638 |
+
});
|
7639 |
+
|
7640 |
+
function _toBinary(str) {
|
7641 |
+
return Encode.atob(str.substring(str.indexOf('base64,') + 7));
|
7642 |
+
}
|
7643 |
+
}
|
7644 |
+
|
7645 |
+
return (extensions.FileReader = FileReader);
|
7646 |
+
});
|
7647 |
+
|
7648 |
+
// Included from: src/javascript/runtime/html5/xhr/XMLHttpRequest.js
|
7649 |
+
|
7650 |
+
/**
|
7651 |
+
* XMLHttpRequest.js
|
7652 |
+
*
|
7653 |
+
* Copyright 2013, Moxiecode Systems AB
|
7654 |
+
* Released under GPL License.
|
7655 |
+
*
|
7656 |
+
* License: http://www.plupload.com/license
|
7657 |
+
* Contributing: http://www.plupload.com/contributing
|
7658 |
+
*/
|
7659 |
+
|
7660 |
+
/*global ActiveXObject:true */
|
7661 |
+
|
7662 |
+
/**
|
7663 |
+
@class moxie/runtime/html5/xhr/XMLHttpRequest
|
7664 |
+
@private
|
7665 |
+
*/
|
7666 |
+
define("moxie/runtime/html5/xhr/XMLHttpRequest", [
|
7667 |
+
"moxie/runtime/html5/Runtime",
|
7668 |
+
"moxie/core/utils/Basic",
|
7669 |
+
"moxie/core/utils/Mime",
|
7670 |
+
"moxie/core/utils/Url",
|
7671 |
+
"moxie/file/File",
|
7672 |
+
"moxie/file/Blob",
|
7673 |
+
"moxie/xhr/FormData",
|
7674 |
+
"moxie/core/Exceptions",
|
7675 |
+
"moxie/core/utils/Env"
|
7676 |
+
], function(extensions, Basic, Mime, Url, File, Blob, FormData, x, Env) {
|
7677 |
+
|
7678 |
+
function XMLHttpRequest() {
|
7679 |
+
var self = this
|
7680 |
+
, _xhr
|
7681 |
+
, _filename
|
7682 |
+
;
|
7683 |
+
|
7684 |
+
Basic.extend(this, {
|
7685 |
+
send: function(meta, data) {
|
7686 |
+
var target = this
|
7687 |
+
, isGecko2_5_6 = (Env.browser === 'Mozilla' && Env.verComp(Env.version, 4, '>=') && Env.verComp(Env.version, 7, '<'))
|
7688 |
+
, isAndroidBrowser = Env.browser === 'Android Browser'
|
7689 |
+
, mustSendAsBinary = false
|
7690 |
+
;
|
7691 |
+
|
7692 |
+
// extract file name
|
7693 |
+
_filename = meta.url.replace(/^.+?\/([\w\-\.]+)$/, '$1').toLowerCase();
|
7694 |
+
|
7695 |
+
_xhr = _getNativeXHR();
|
7696 |
+
_xhr.open(meta.method, meta.url, meta.async, meta.user, meta.password);
|
7697 |
+
|
7698 |
+
|
7699 |
+
// prepare data to be sent
|
7700 |
+
if (data instanceof Blob) {
|
7701 |
+
if (data.isDetached()) {
|
7702 |
+
mustSendAsBinary = true;
|
7703 |
+
}
|
7704 |
+
data = data.getSource();
|
7705 |
+
} else if (data instanceof FormData) {
|
7706 |
+
|
7707 |
+
if (data.hasBlob()) {
|
7708 |
+
if (data.getBlob().isDetached()) {
|
7709 |
+
data = _prepareMultipart.call(target, data); // _xhr must be instantiated and be in OPENED state
|
7710 |
+
mustSendAsBinary = true;
|
7711 |
+
} else if ((isGecko2_5_6 || isAndroidBrowser) && Basic.typeOf(data.getBlob().getSource()) === 'blob' && window.FileReader) {
|
7712 |
+
// Gecko 2/5/6 can't send blob in FormData: https://bugzilla.mozilla.org/show_bug.cgi?id=649150
|
7713 |
+
// Android browsers (default one and Dolphin) seem to have the same issue, see: #613
|
7714 |
+
_preloadAndSend.call(target, meta, data);
|
7715 |
+
return; // _preloadAndSend will reinvoke send() with transmutated FormData =%D
|
7716 |
+
}
|
7717 |
+
}
|
7718 |
+
|
7719 |
+
// transfer fields to real FormData
|
7720 |
+
if (data instanceof FormData) { // if still a FormData, e.g. not mangled by _prepareMultipart()
|
7721 |
+
var fd = new window.FormData();
|
7722 |
+
data.each(function(value, name) {
|
7723 |
+
if (value instanceof Blob) {
|
7724 |
+
fd.append(name, value.getSource());
|
7725 |
+
} else {
|
7726 |
+
fd.append(name, value);
|
7727 |
+
}
|
7728 |
+
});
|
7729 |
+
data = fd;
|
7730 |
+
}
|
7731 |
+
}
|
7732 |
+
|
7733 |
+
|
7734 |
+
// if XHR L2
|
7735 |
+
if (_xhr.upload) {
|
7736 |
+
if (meta.withCredentials) {
|
7737 |
+
_xhr.withCredentials = true;
|
7738 |
+
}
|
7739 |
+
|
7740 |
+
_xhr.addEventListener('load', function(e) {
|
7741 |
+
target.trigger(e);
|
7742 |
+
});
|
7743 |
+
|
7744 |
+
_xhr.addEventListener('error', function(e) {
|
7745 |
+
target.trigger(e);
|
7746 |
+
});
|
7747 |
+
|
7748 |
+
// additionally listen to progress events
|
7749 |
+
_xhr.addEventListener('progress', function(e) {
|
7750 |
+
target.trigger(e);
|
7751 |
+
});
|
7752 |
+
|
7753 |
+
_xhr.upload.addEventListener('progress', function(e) {
|
7754 |
+
target.trigger({
|
7755 |
+
type: 'UploadProgress',
|
7756 |
+
loaded: e.loaded,
|
7757 |
+
total: e.total
|
7758 |
+
});
|
7759 |
+
});
|
7760 |
+
// ... otherwise simulate XHR L2
|
7761 |
+
} else {
|
7762 |
+
_xhr.onreadystatechange = function onReadyStateChange() {
|
7763 |
+
|
7764 |
+
// fake Level 2 events
|
7765 |
+
switch (_xhr.readyState) {
|
7766 |
+
|
7767 |
+
case 1: // XMLHttpRequest.OPENED
|
7768 |
+
// readystatechanged is fired twice for OPENED state (in IE and Mozilla) - neu
|
7769 |
+
break;
|
7770 |
+
|
7771 |
+
// looks like HEADERS_RECEIVED (state 2) is not reported in Opera (or it's old versions) - neu
|
7772 |
+
case 2: // XMLHttpRequest.HEADERS_RECEIVED
|
7773 |
+
break;
|
7774 |
+
|
7775 |
+
case 3: // XMLHttpRequest.LOADING
|
7776 |
+
// try to fire progress event for not XHR L2
|
7777 |
+
var total, loaded;
|
7778 |
+
|
7779 |
+
try {
|
7780 |
+
if (Url.hasSameOrigin(meta.url)) { // Content-Length not accessible for cross-domain on some browsers
|
7781 |
+
total = _xhr.getResponseHeader('Content-Length') || 0; // old Safari throws an exception here
|
7782 |
+
}
|
7783 |
+
|
7784 |
+
if (_xhr.responseText) { // responseText was introduced in IE7
|
7785 |
+
loaded = _xhr.responseText.length;
|
7786 |
+
}
|
7787 |
+
} catch(ex) {
|
7788 |
+
total = loaded = 0;
|
7789 |
+
}
|
7790 |
+
|
7791 |
+
target.trigger({
|
7792 |
+
type: 'progress',
|
7793 |
+
lengthComputable: !!total,
|
7794 |
+
total: parseInt(total, 10),
|
7795 |
+
loaded: loaded
|
7796 |
+
});
|
7797 |
+
break;
|
7798 |
+
|
7799 |
+
case 4: // XMLHttpRequest.DONE
|
7800 |
+
// release readystatechange handler (mostly for IE)
|
7801 |
+
_xhr.onreadystatechange = function() {};
|
7802 |
+
|
7803 |
+
// usually status 0 is returned when server is unreachable, but FF also fails to status 0 for 408 timeout
|
7804 |
+
try {
|
7805 |
+
if (_xhr.status >= 200 && _xhr.status < 400) {
|
7806 |
+
target.trigger('load');
|
7807 |
+
break;
|
7808 |
+
}
|
7809 |
+
} catch(ex) {}
|
7810 |
+
|
7811 |
+
target.trigger('error');
|
7812 |
+
break;
|
7813 |
+
}
|
7814 |
+
};
|
7815 |
+
}
|
7816 |
+
|
7817 |
+
|
7818 |
+
// set request headers
|
7819 |
+
if (!Basic.isEmptyObj(meta.headers)) {
|
7820 |
+
Basic.each(meta.headers, function(value, header) {
|
7821 |
+
_xhr.setRequestHeader(header, value);
|
7822 |
+
});
|
7823 |
+
}
|
7824 |
+
|
7825 |
+
// request response type
|
7826 |
+
if ("" !== meta.responseType && 'responseType' in _xhr) {
|
7827 |
+
if ('json' === meta.responseType && !Env.can('return_response_type', 'json')) { // we can fake this one
|
7828 |
+
_xhr.responseType = 'text';
|
7829 |
+
} else {
|
7830 |
+
_xhr.responseType = meta.responseType;
|
7831 |
+
}
|
7832 |
+
}
|
7833 |
+
|
7834 |
+
// send ...
|
7835 |
+
if (!mustSendAsBinary) {
|
7836 |
+
_xhr.send(data);
|
7837 |
+
} else {
|
7838 |
+
if (_xhr.sendAsBinary) { // Gecko
|
7839 |
+
_xhr.sendAsBinary(data);
|
7840 |
+
} else { // other browsers having support for typed arrays
|
7841 |
+
(function() {
|
7842 |
+
// mimic Gecko's sendAsBinary
|
7843 |
+
var ui8a = new Uint8Array(data.length);
|
7844 |
+
for (var i = 0; i < data.length; i++) {
|
7845 |
+
ui8a[i] = (data.charCodeAt(i) & 0xff);
|
7846 |
+
}
|
7847 |
+
_xhr.send(ui8a.buffer);
|
7848 |
+
}());
|
7849 |
+
}
|
7850 |
+
}
|
7851 |
+
|
7852 |
+
target.trigger('loadstart');
|
7853 |
+
},
|
7854 |
+
|
7855 |
+
getStatus: function() {
|
7856 |
+
// according to W3C spec it should return 0 for readyState < 3, but instead it throws an exception
|
7857 |
+
try {
|
7858 |
+
if (_xhr) {
|
7859 |
+
return _xhr.status;
|
7860 |
+
}
|
7861 |
+
} catch(ex) {}
|
7862 |
+
return 0;
|
7863 |
+
},
|
7864 |
+
|
7865 |
+
getResponse: function(responseType) {
|
7866 |
+
var I = this.getRuntime();
|
7867 |
+
|
7868 |
+
try {
|
7869 |
+
switch (responseType) {
|
7870 |
+
case 'blob':
|
7871 |
+
var file = new File(I.uid, _xhr.response);
|
7872 |
+
|
7873 |
+
// try to extract file name from content-disposition if possible (might be - not, if CORS for example)
|
7874 |
+
var disposition = _xhr.getResponseHeader('Content-Disposition');
|
7875 |
+
if (disposition) {
|
7876 |
+
// extract filename from response header if available
|
7877 |
+
var match = disposition.match(/filename=([\'\"'])([^\1]+)\1/);
|
7878 |
+
if (match) {
|
7879 |
+
_filename = match[2];
|
7880 |
+
}
|
7881 |
+
}
|
7882 |
+
file.name = _filename;
|
7883 |
+
|
7884 |
+
// pre-webkit Opera doesn't set type property on the blob response
|
7885 |
+
if (!file.type) {
|
7886 |
+
file.type = Mime.getFileMime(_filename);
|
7887 |
+
}
|
7888 |
+
return file;
|
7889 |
+
|
7890 |
+
case 'json':
|
7891 |
+
if (!Env.can('return_response_type', 'json')) {
|
7892 |
+
return _xhr.status === 200 && !!window.JSON ? JSON.parse(_xhr.responseText) : null;
|
7893 |
+
}
|
7894 |
+
return _xhr.response;
|
7895 |
+
|
7896 |
+
case 'document':
|
7897 |
+
return _getDocument(_xhr);
|
7898 |
+
|
7899 |
+
default:
|
7900 |
+
return _xhr.responseText !== '' ? _xhr.responseText : null; // against the specs, but for consistency across the runtimes
|
7901 |
+
}
|
7902 |
+
} catch(ex) {
|
7903 |
+
return null;
|
7904 |
+
}
|
7905 |
+
},
|
7906 |
+
|
7907 |
+
getAllResponseHeaders: function() {
|
7908 |
+
try {
|
7909 |
+
return _xhr.getAllResponseHeaders();
|
7910 |
+
} catch(ex) {}
|
7911 |
+
return '';
|
7912 |
+
},
|
7913 |
+
|
7914 |
+
abort: function() {
|
7915 |
+
if (_xhr) {
|
7916 |
+
_xhr.abort();
|
7917 |
+
}
|
7918 |
+
},
|
7919 |
+
|
7920 |
+
destroy: function() {
|
7921 |
+
self = _filename = null;
|
7922 |
+
this.getRuntime().getShim().removeInstance(this.uid);
|
7923 |
+
}
|
7924 |
+
});
|
7925 |
+
|
7926 |
+
|
7927 |
+
// here we go... ugly fix for ugly bug
|
7928 |
+
function _preloadAndSend(meta, data) {
|
7929 |
+
var target = this, blob, fr;
|
7930 |
+
|
7931 |
+
// get original blob
|
7932 |
+
blob = data.getBlob().getSource();
|
7933 |
+
|
7934 |
+
// preload blob in memory to be sent as binary string
|
7935 |
+
fr = new window.FileReader();
|
7936 |
+
fr.onload = function() {
|
7937 |
+
// overwrite original blob
|
7938 |
+
data.append(data.getBlobName(), new Blob(null, {
|
7939 |
+
type: blob.type,
|
7940 |
+
data: fr.result
|
7941 |
+
}));
|
7942 |
+
// invoke send operation again
|
7943 |
+
self.send.call(target, meta, data);
|
7944 |
+
};
|
7945 |
+
fr.readAsBinaryString(blob);
|
7946 |
+
}
|
7947 |
+
|
7948 |
+
|
7949 |
+
function _getNativeXHR() {
|
7950 |
+
if (window.XMLHttpRequest && !(Env.browser === 'IE' && Env.verComp(Env.version, 8, '<'))) { // IE7 has native XHR but it's buggy
|
7951 |
+
return new window.XMLHttpRequest();
|
7952 |
+
} else {
|
7953 |
+
return (function() {
|
7954 |
+
var progIDs = ['Msxml2.XMLHTTP.6.0', 'Microsoft.XMLHTTP']; // if 6.0 available, use it, otherwise failback to default 3.0
|
7955 |
+
for (var i = 0; i < progIDs.length; i++) {
|
7956 |
+
try {
|
7957 |
+
return new ActiveXObject(progIDs[i]);
|
7958 |
+
} catch (ex) {}
|
7959 |
+
}
|
7960 |
+
})();
|
7961 |
+
}
|
7962 |
+
}
|
7963 |
+
|
7964 |
+
// @credits Sergey Ilinsky (http://www.ilinsky.com/)
|
7965 |
+
function _getDocument(xhr) {
|
7966 |
+
var rXML = xhr.responseXML;
|
7967 |
+
var rText = xhr.responseText;
|
7968 |
+
|
7969 |
+
// Try parsing responseText (@see: http://www.ilinsky.com/articles/XMLHttpRequest/#bugs-ie-responseXML-content-type)
|
7970 |
+
if (Env.browser === 'IE' && rText && rXML && !rXML.documentElement && /[^\/]+\/[^\+]+\+xml/.test(xhr.getResponseHeader("Content-Type"))) {
|
7971 |
+
rXML = new window.ActiveXObject("Microsoft.XMLDOM");
|
7972 |
+
rXML.async = false;
|
7973 |
+
rXML.validateOnParse = false;
|
7974 |
+
rXML.loadXML(rText);
|
7975 |
+
}
|
7976 |
+
|
7977 |
+
// Check if there is no error in document
|
7978 |
+
if (rXML) {
|
7979 |
+
if ((Env.browser === 'IE' && rXML.parseError !== 0) || !rXML.documentElement || rXML.documentElement.tagName === "parsererror") {
|
7980 |
+
return null;
|
7981 |
+
}
|
7982 |
+
}
|
7983 |
+
return rXML;
|
7984 |
+
}
|
7985 |
+
|
7986 |
+
|
7987 |
+
function _prepareMultipart(fd) {
|
7988 |
+
var boundary = '----moxieboundary' + new Date().getTime()
|
7989 |
+
, dashdash = '--'
|
7990 |
+
, crlf = '\r\n'
|
7991 |
+
, multipart = ''
|
7992 |
+
, I = this.getRuntime()
|
7993 |
+
;
|
7994 |
+
|
7995 |
+
if (!I.can('send_binary_string')) {
|
7996 |
+
throw new x.RuntimeError(x.RuntimeError.NOT_SUPPORTED_ERR);
|
7997 |
+
}
|
7998 |
+
|
7999 |
+
_xhr.setRequestHeader('Content-Type', 'multipart/form-data; boundary=' + boundary);
|
8000 |
+
|
8001 |
+
// append multipart parameters
|
8002 |
+
fd.each(function(value, name) {
|
8003 |
+
// Firefox 3.6 failed to convert multibyte characters to UTF-8 in sendAsBinary(),
|
8004 |
+
// so we try it here ourselves with: unescape(encodeURIComponent(value))
|
8005 |
+
if (value instanceof Blob) {
|
8006 |
+
// Build RFC2388 blob
|
8007 |
+
multipart += dashdash + boundary + crlf +
|
8008 |
+
'Content-Disposition: form-data; name="' + name + '"; filename="' + unescape(encodeURIComponent(value.name || 'blob')) + '"' + crlf +
|
8009 |
+
'Content-Type: ' + (value.type || 'application/octet-stream') + crlf + crlf +
|
8010 |
+
value.getSource() + crlf;
|
8011 |
+
} else {
|
8012 |
+
multipart += dashdash + boundary + crlf +
|
8013 |
+
'Content-Disposition: form-data; name="' + name + '"' + crlf + crlf +
|
8014 |
+
unescape(encodeURIComponent(value)) + crlf;
|
8015 |
+
}
|
8016 |
+
});
|
8017 |
+
|
8018 |
+
multipart += dashdash + boundary + dashdash + crlf;
|
8019 |
+
|
8020 |
+
return multipart;
|
8021 |
+
}
|
8022 |
+
}
|
8023 |
+
|
8024 |
+
return (extensions.XMLHttpRequest = XMLHttpRequest);
|
8025 |
+
});
|
8026 |
+
|
8027 |
+
// Included from: src/javascript/runtime/html5/utils/BinaryReader.js
|
8028 |
+
|
8029 |
+
/**
|
8030 |
+
* BinaryReader.js
|
8031 |
+
*
|
8032 |
+
* Copyright 2013, Moxiecode Systems AB
|
8033 |
+
* Released under GPL License.
|
8034 |
+
*
|
8035 |
+
* License: http://www.plupload.com/license
|
8036 |
+
* Contributing: http://www.plupload.com/contributing
|
8037 |
+
*/
|
8038 |
+
|
8039 |
+
/**
|
8040 |
+
@class moxie/runtime/html5/utils/BinaryReader
|
8041 |
+
@private
|
8042 |
+
*/
|
8043 |
+
define("moxie/runtime/html5/utils/BinaryReader", [
|
8044 |
+
"moxie/core/utils/Basic"
|
8045 |
+
], function(Basic) {
|
8046 |
+
|
8047 |
+
|
8048 |
+
function BinaryReader(data) {
|
8049 |
+
if (data instanceof ArrayBuffer) {
|
8050 |
+
ArrayBufferReader.apply(this, arguments);
|
8051 |
+
} else {
|
8052 |
+
UTF16StringReader.apply(this, arguments);
|
8053 |
+
}
|
8054 |
+
}
|
8055 |
+
|
8056 |
+
Basic.extend(BinaryReader.prototype, {
|
8057 |
+
|
8058 |
+
littleEndian: false,
|
8059 |
+
|
8060 |
+
|
8061 |
+
read: function(idx, size) {
|
8062 |
+
var sum, mv, i;
|
8063 |
+
|
8064 |
+
if (idx + size > this.length()) {
|
8065 |
+
throw new Error("You are trying to read outside the source boundaries.");
|
8066 |
+
}
|
8067 |
+
|
8068 |
+
mv = this.littleEndian
|
8069 |
+
? 0
|
8070 |
+
: -8 * (size - 1)
|
8071 |
+
;
|
8072 |
+
|
8073 |
+
for (i = 0, sum = 0; i < size; i++) {
|
8074 |
+
sum |= (this.readByteAt(idx + i) << Math.abs(mv + i*8));
|
8075 |
+
}
|
8076 |
+
return sum;
|
8077 |
+
},
|
8078 |
+
|
8079 |
+
|
8080 |
+
write: function(idx, num, size) {
|
8081 |
+
var mv, i, str = '';
|
8082 |
+
|
8083 |
+
if (idx > this.length()) {
|
8084 |
+
throw new Error("You are trying to write outside the source boundaries.");
|
8085 |
+
}
|
8086 |
+
|
8087 |
+
mv = this.littleEndian
|
8088 |
+
? 0
|
8089 |
+
: -8 * (size - 1)
|
8090 |
+
;
|
8091 |
+
|
8092 |
+
for (i = 0; i < size; i++) {
|
8093 |
+
this.writeByteAt(idx + i, (num >> Math.abs(mv + i*8)) & 255);
|
8094 |
+
}
|
8095 |
+
},
|
8096 |
+
|
8097 |
+
|
8098 |
+
BYTE: function(idx) {
|
8099 |
+
return this.read(idx, 1);
|
8100 |
+
},
|
8101 |
+
|
8102 |
+
|
8103 |
+
SHORT: function(idx) {
|
8104 |
+
return this.read(idx, 2);
|
8105 |
+
},
|
8106 |
+
|
8107 |
+
|
8108 |
+
LONG: function(idx) {
|
8109 |
+
return this.read(idx, 4);
|
8110 |
+
},
|
8111 |
+
|
8112 |
+
|
8113 |
+
SLONG: function(idx) { // 2's complement notation
|
8114 |
+
var num = this.read(idx, 4);
|
8115 |
+
return (num > 2147483647 ? num - 4294967296 : num);
|
8116 |
+
},
|
8117 |
+
|
8118 |
+
|
8119 |
+
CHAR: function(idx) {
|
8120 |
+
return String.fromCharCode(this.read(idx, 1));
|
8121 |
+
},
|
8122 |
+
|
8123 |
+
|
8124 |
+
STRING: function(idx, count) {
|
8125 |
+
return this.asArray('CHAR', idx, count).join('');
|
8126 |
+
},
|
8127 |
+
|
8128 |
+
|
8129 |
+
asArray: function(type, idx, count) {
|
8130 |
+
var values = [];
|
8131 |
+
|
8132 |
+
for (var i = 0; i < count; i++) {
|
8133 |
+
values[i] = this[type](idx + i);
|
8134 |
+
}
|
8135 |
+
return values;
|
8136 |
+
}
|
8137 |
+
});
|
8138 |
+
|
8139 |
+
|
8140 |
+
function ArrayBufferReader(data) {
|
8141 |
+
var _dv = new DataView(data);
|
8142 |
+
|
8143 |
+
Basic.extend(this, {
|
8144 |
+
|
8145 |
+
readByteAt: function(idx) {
|
8146 |
+
return _dv.getUint8(idx);
|
8147 |
+
},
|
8148 |
+
|
8149 |
+
|
8150 |
+
writeByteAt: function(idx, value) {
|
8151 |
+
_dv.setUint8(idx, value);
|
8152 |
+
},
|
8153 |
+
|
8154 |
+
|
8155 |
+
SEGMENT: function(idx, size, value) {
|
8156 |
+
switch (arguments.length) {
|
8157 |
+
case 2:
|
8158 |
+
return data.slice(idx, idx + size);
|
8159 |
+
|
8160 |
+
case 1:
|
8161 |
+
return data.slice(idx);
|
8162 |
+
|
8163 |
+
case 3:
|
8164 |
+
if (value === null) {
|
8165 |
+
value = new ArrayBuffer();
|
8166 |
+
}
|
8167 |
+
|
8168 |
+
if (value instanceof ArrayBuffer) {
|
8169 |
+
var arr = new Uint8Array(this.length() - size + value.byteLength);
|
8170 |
+
if (idx > 0) {
|
8171 |
+
arr.set(new Uint8Array(data.slice(0, idx)), 0);
|
8172 |
+
}
|
8173 |
+
arr.set(new Uint8Array(value), idx);
|
8174 |
+
arr.set(new Uint8Array(data.slice(idx + size)), idx + value.byteLength);
|
8175 |
+
|
8176 |
+
this.clear();
|
8177 |
+
data = arr.buffer;
|
8178 |
+
_dv = new DataView(data);
|
8179 |
+
break;
|
8180 |
+
}
|
8181 |
+
|
8182 |
+
default: return data;
|
8183 |
+
}
|
8184 |
+
},
|
8185 |
+
|
8186 |
+
|
8187 |
+
length: function() {
|
8188 |
+
return data ? data.byteLength : 0;
|
8189 |
+
},
|
8190 |
+
|
8191 |
+
|
8192 |
+
clear: function() {
|
8193 |
+
_dv = data = null;
|
8194 |
+
}
|
8195 |
+
});
|
8196 |
+
}
|
8197 |
+
|
8198 |
+
|
8199 |
+
function UTF16StringReader(data) {
|
8200 |
+
Basic.extend(this, {
|
8201 |
+
|
8202 |
+
readByteAt: function(idx) {
|
8203 |
+
return data.charCodeAt(idx);
|
8204 |
+
},
|
8205 |
+
|
8206 |
+
|
8207 |
+
writeByteAt: function(idx, value) {
|
8208 |
+
putstr(String.fromCharCode(value), idx, 1);
|
8209 |
+
},
|
8210 |
+
|
8211 |
+
|
8212 |
+
SEGMENT: function(idx, length, segment) {
|
8213 |
+
switch (arguments.length) {
|
8214 |
+
case 1:
|
8215 |
+
return data.substr(idx);
|
8216 |
+
case 2:
|
8217 |
+
return data.substr(idx, length);
|
8218 |
+
case 3:
|
8219 |
+
putstr(segment !== null ? segment : '', idx, length);
|
8220 |
+
break;
|
8221 |
+
default: return data;
|
8222 |
+
}
|
8223 |
+
},
|
8224 |
+
|
8225 |
+
|
8226 |
+
length: function() {
|
8227 |
+
return data ? data.length : 0;
|
8228 |
+
},
|
8229 |
+
|
8230 |
+
clear: function() {
|
8231 |
+
data = null;
|
8232 |
+
}
|
8233 |
+
});
|
8234 |
+
|
8235 |
+
|
8236 |
+
function putstr(segment, idx, length) {
|
8237 |
+
length = arguments.length === 3 ? length : data.length - idx - 1;
|
8238 |
+
data = data.substr(0, idx) + segment + data.substr(length + idx);
|
8239 |
+
}
|
8240 |
+
}
|
8241 |
+
|
8242 |
+
|
8243 |
+
return BinaryReader;
|
8244 |
+
});
|
8245 |
+
|
8246 |
+
// Included from: src/javascript/runtime/html5/image/JPEGHeaders.js
|
8247 |
+
|
8248 |
+
/**
|
8249 |
+
* JPEGHeaders.js
|
8250 |
+
*
|
8251 |
+
* Copyright 2013, Moxiecode Systems AB
|
8252 |
+
* Released under GPL License.
|
8253 |
+
*
|
8254 |
+
* License: http://www.plupload.com/license
|
8255 |
+
* Contributing: http://www.plupload.com/contributing
|
8256 |
+
*/
|
8257 |
+
|
8258 |
+
/**
|
8259 |
+
@class moxie/runtime/html5/image/JPEGHeaders
|
8260 |
+
@private
|
8261 |
+
*/
|
8262 |
+
define("moxie/runtime/html5/image/JPEGHeaders", [
|
8263 |
+
"moxie/runtime/html5/utils/BinaryReader",
|
8264 |
+
"moxie/core/Exceptions"
|
8265 |
+
], function(BinaryReader, x) {
|
8266 |
+
|
8267 |
+
return function JPEGHeaders(data) {
|
8268 |
+
var headers = [], _br, idx, marker, length = 0;
|
8269 |
+
|
8270 |
+
_br = new BinaryReader(data);
|
8271 |
+
|
8272 |
+
// Check if data is jpeg
|
8273 |
+
if (_br.SHORT(0) !== 0xFFD8) {
|
8274 |
+
_br.clear();
|
8275 |
+
throw new x.ImageError(x.ImageError.WRONG_FORMAT);
|
8276 |
+
}
|
8277 |
+
|
8278 |
+
idx = 2;
|
8279 |
+
|
8280 |
+
while (idx <= _br.length()) {
|
8281 |
+
marker = _br.SHORT(idx);
|
8282 |
+
|
8283 |
+
// omit RST (restart) markers
|
8284 |
+
if (marker >= 0xFFD0 && marker <= 0xFFD7) {
|
8285 |
+
idx += 2;
|
8286 |
+
continue;
|
8287 |
+
}
|
8288 |
+
|
8289 |
+
// no headers allowed after SOS marker
|
8290 |
+
if (marker === 0xFFDA || marker === 0xFFD9) {
|
8291 |
+
break;
|
8292 |
+
}
|
8293 |
+
|
8294 |
+
length = _br.SHORT(idx + 2) + 2;
|
8295 |
+
|
8296 |
+
// APPn marker detected
|
8297 |
+
if (marker >= 0xFFE1 && marker <= 0xFFEF) {
|
8298 |
+
headers.push({
|
8299 |
+
hex: marker,
|
8300 |
+
name: 'APP' + (marker & 0x000F),
|
8301 |
+
start: idx,
|
8302 |
+
length: length,
|
8303 |
+
segment: _br.SEGMENT(idx, length)
|
8304 |
+
});
|
8305 |
+
}
|
8306 |
+
|
8307 |
+
idx += length;
|
8308 |
+
}
|
8309 |
+
|
8310 |
+
_br.clear();
|
8311 |
+
|
8312 |
+
return {
|
8313 |
+
headers: headers,
|
8314 |
+
|
8315 |
+
restore: function(data) {
|
8316 |
+
var max, i, br;
|
8317 |
+
|
8318 |
+
br = new BinaryReader(data);
|
8319 |
+
|
8320 |
+
idx = br.SHORT(2) == 0xFFE0 ? 4 + br.SHORT(4) : 2;
|
8321 |
+
|
8322 |
+
for (i = 0, max = headers.length; i < max; i++) {
|
8323 |
+
br.SEGMENT(idx, 0, headers[i].segment);
|
8324 |
+
idx += headers[i].length;
|
8325 |
+
}
|
8326 |
+
|
8327 |
+
data = br.SEGMENT();
|
8328 |
+
br.clear();
|
8329 |
+
return data;
|
8330 |
+
},
|
8331 |
+
|
8332 |
+
strip: function(data) {
|
8333 |
+
var br, headers, jpegHeaders, i;
|
8334 |
+
|
8335 |
+
jpegHeaders = new JPEGHeaders(data);
|
8336 |
+
headers = jpegHeaders.headers;
|
8337 |
+
jpegHeaders.purge();
|
8338 |
+
|
8339 |
+
br = new BinaryReader(data);
|
8340 |
+
|
8341 |
+
i = headers.length;
|
8342 |
+
while (i--) {
|
8343 |
+
br.SEGMENT(headers[i].start, headers[i].length, '');
|
8344 |
+
}
|
8345 |
+
|
8346 |
+
data = br.SEGMENT();
|
8347 |
+
br.clear();
|
8348 |
+
return data;
|
8349 |
+
},
|
8350 |
+
|
8351 |
+
get: function(name) {
|
8352 |
+
var array = [];
|
8353 |
+
|
8354 |
+
for (var i = 0, max = headers.length; i < max; i++) {
|
8355 |
+
if (headers[i].name === name.toUpperCase()) {
|
8356 |
+
array.push(headers[i].segment);
|
8357 |
+
}
|
8358 |
+
}
|
8359 |
+
return array;
|
8360 |
+
},
|
8361 |
+
|
8362 |
+
set: function(name, segment) {
|
8363 |
+
var array = [], i, ii, max;
|
8364 |
+
|
8365 |
+
if (typeof(segment) === 'string') {
|
8366 |
+
array.push(segment);
|
8367 |
+
} else {
|
8368 |
+
array = segment;
|
8369 |
+
}
|
8370 |
+
|
8371 |
+
for (i = ii = 0, max = headers.length; i < max; i++) {
|
8372 |
+
if (headers[i].name === name.toUpperCase()) {
|
8373 |
+
headers[i].segment = array[ii];
|
8374 |
+
headers[i].length = array[ii].length;
|
8375 |
+
ii++;
|
8376 |
+
}
|
8377 |
+
if (ii >= array.length) {
|
8378 |
+
break;
|
8379 |
+
}
|
8380 |
+
}
|
8381 |
+
},
|
8382 |
+
|
8383 |
+
purge: function() {
|
8384 |
+
this.headers = headers = [];
|
8385 |
+
}
|
8386 |
+
};
|
8387 |
+
};
|
8388 |
+
});
|
8389 |
+
|
8390 |
+
// Included from: src/javascript/runtime/html5/image/ExifParser.js
|
8391 |
+
|
8392 |
+
/**
|
8393 |
+
* ExifParser.js
|
8394 |
+
*
|
8395 |
+
* Copyright 2013, Moxiecode Systems AB
|
8396 |
+
* Released under GPL License.
|
8397 |
+
*
|
8398 |
+
* License: http://www.plupload.com/license
|
8399 |
+
* Contributing: http://www.plupload.com/contributing
|
8400 |
+
*/
|
8401 |
+
|
8402 |
+
/**
|
8403 |
+
@class moxie/runtime/html5/image/ExifParser
|
8404 |
+
@private
|
8405 |
+
*/
|
8406 |
+
define("moxie/runtime/html5/image/ExifParser", [
|
8407 |
+
"moxie/core/utils/Basic",
|
8408 |
+
"moxie/runtime/html5/utils/BinaryReader",
|
8409 |
+
"moxie/core/Exceptions"
|
8410 |
+
], function(Basic, BinaryReader, x) {
|
8411 |
+
|
8412 |
+
function ExifParser(data) {
|
8413 |
+
var __super__, tags, tagDescs, offsets, idx, Tiff;
|
8414 |
+
|
8415 |
+
BinaryReader.call(this, data);
|
8416 |
+
|
8417 |
+
tags = {
|
8418 |
+
tiff: {
|
8419 |
+
/*
|
8420 |
+
The image orientation viewed in terms of rows and columns.
|
8421 |
+
|
8422 |
+
1 = The 0th row is at the visual top of the image, and the 0th column is the visual left-hand side.
|
8423 |
+
2 = The 0th row is at the visual top of the image, and the 0th column is the visual right-hand side.
|
8424 |
+
3 = The 0th row is at the visual bottom of the image, and the 0th column is the visual right-hand side.
|
8425 |
+
4 = The 0th row is at the visual bottom of the image, and the 0th column is the visual left-hand side.
|
8426 |
+
5 = The 0th row is the visual left-hand side of the image, and the 0th column is the visual top.
|
8427 |
+
6 = The 0th row is the visual right-hand side of the image, and the 0th column is the visual top.
|
8428 |
+
7 = The 0th row is the visual right-hand side of the image, and the 0th column is the visual bottom.
|
8429 |
+
8 = The 0th row is the visual left-hand side of the image, and the 0th column is the visual bottom.
|
8430 |
+
*/
|
8431 |
+
0x0112: 'Orientation',
|
8432 |
+
0x010E: 'ImageDescription',
|
8433 |
+
0x010F: 'Make',
|
8434 |
+
0x0110: 'Model',
|
8435 |
+
0x0131: 'Software',
|
8436 |
+
0x8769: 'ExifIFDPointer',
|
8437 |
+
0x8825: 'GPSInfoIFDPointer'
|
8438 |
+
},
|
8439 |
+
exif: {
|
8440 |
+
0x9000: 'ExifVersion',
|
8441 |
+
0xA001: 'ColorSpace',
|
8442 |
+
0xA002: 'PixelXDimension',
|
8443 |
+
0xA003: 'PixelYDimension',
|
8444 |
+
0x9003: 'DateTimeOriginal',
|
8445 |
+
0x829A: 'ExposureTime',
|
8446 |
+
0x829D: 'FNumber',
|
8447 |
+
0x8827: 'ISOSpeedRatings',
|
8448 |
+
0x9201: 'ShutterSpeedValue',
|
8449 |
+
0x9202: 'ApertureValue' ,
|
8450 |
+
0x9207: 'MeteringMode',
|
8451 |
+
0x9208: 'LightSource',
|
8452 |
+
0x9209: 'Flash',
|
8453 |
+
0x920A: 'FocalLength',
|
8454 |
+
0xA402: 'ExposureMode',
|
8455 |
+
0xA403: 'WhiteBalance',
|
8456 |
+
0xA406: 'SceneCaptureType',
|
8457 |
+
0xA404: 'DigitalZoomRatio',
|
8458 |
+
0xA408: 'Contrast',
|
8459 |
+
0xA409: 'Saturation',
|
8460 |
+
0xA40A: 'Sharpness'
|
8461 |
+
},
|
8462 |
+
gps: {
|
8463 |
+
0x0000: 'GPSVersionID',
|
8464 |
+
0x0001: 'GPSLatitudeRef',
|
8465 |
+
0x0002: 'GPSLatitude',
|
8466 |
+
0x0003: 'GPSLongitudeRef',
|
8467 |
+
0x0004: 'GPSLongitude'
|
8468 |
+
},
|
8469 |
+
|
8470 |
+
thumb: {
|
8471 |
+
0x0201: 'JPEGInterchangeFormat',
|
8472 |
+
0x0202: 'JPEGInterchangeFormatLength'
|
8473 |
+
}
|
8474 |
+
};
|
8475 |
+
|
8476 |
+
tagDescs = {
|
8477 |
+
'ColorSpace': {
|
8478 |
+
1: 'sRGB',
|
8479 |
+
0: 'Uncalibrated'
|
8480 |
+
},
|
8481 |
+
|
8482 |
+
'MeteringMode': {
|
8483 |
+
0: 'Unknown',
|
8484 |
+
1: 'Average',
|
8485 |
+
2: 'CenterWeightedAverage',
|
8486 |
+
3: 'Spot',
|
8487 |
+
4: 'MultiSpot',
|
8488 |
+
5: 'Pattern',
|
8489 |
+
6: 'Partial',
|
8490 |
+
255: 'Other'
|
8491 |
+
},
|
8492 |
+
|
8493 |
+
'LightSource': {
|
8494 |
+
1: 'Daylight',
|
8495 |
+
2: 'Fliorescent',
|
8496 |
+
3: 'Tungsten',
|
8497 |
+
4: 'Flash',
|
8498 |
+
9: 'Fine weather',
|
8499 |
+
10: 'Cloudy weather',
|
8500 |
+
11: 'Shade',
|
8501 |
+
12: 'Daylight fluorescent (D 5700 - 7100K)',
|
8502 |
+
13: 'Day white fluorescent (N 4600 -5400K)',
|
8503 |
+
14: 'Cool white fluorescent (W 3900 - 4500K)',
|
8504 |
+
15: 'White fluorescent (WW 3200 - 3700K)',
|
8505 |
+
17: 'Standard light A',
|
8506 |
+
18: 'Standard light B',
|
8507 |
+
19: 'Standard light C',
|
8508 |
+
20: 'D55',
|
8509 |
+
21: 'D65',
|
8510 |
+
22: 'D75',
|
8511 |
+
23: 'D50',
|
8512 |
+
24: 'ISO studio tungsten',
|
8513 |
+
255: 'Other'
|
8514 |
+
},
|
8515 |
+
|
8516 |
+
'Flash': {
|
8517 |
+
0x0000: 'Flash did not fire',
|
8518 |
+
0x0001: 'Flash fired',
|
8519 |
+
0x0005: 'Strobe return light not detected',
|
8520 |
+
0x0007: 'Strobe return light detected',
|
8521 |
+
0x0009: 'Flash fired, compulsory flash mode',
|
8522 |
+
0x000D: 'Flash fired, compulsory flash mode, return light not detected',
|
8523 |
+
0x000F: 'Flash fired, compulsory flash mode, return light detected',
|
8524 |
+
0x0010: 'Flash did not fire, compulsory flash mode',
|
8525 |
+
0x0018: 'Flash did not fire, auto mode',
|
8526 |
+
0x0019: 'Flash fired, auto mode',
|
8527 |
+
0x001D: 'Flash fired, auto mode, return light not detected',
|
8528 |
+
0x001F: 'Flash fired, auto mode, return light detected',
|
8529 |
+
0x0020: 'No flash function',
|
8530 |
+
0x0041: 'Flash fired, red-eye reduction mode',
|
8531 |
+
0x0045: 'Flash fired, red-eye reduction mode, return light not detected',
|
8532 |
+
0x0047: 'Flash fired, red-eye reduction mode, return light detected',
|
8533 |
+
0x0049: 'Flash fired, compulsory flash mode, red-eye reduction mode',
|
8534 |
+
0x004D: 'Flash fired, compulsory flash mode, red-eye reduction mode, return light not detected',
|
8535 |
+
0x004F: 'Flash fired, compulsory flash mode, red-eye reduction mode, return light detected',
|
8536 |
+
0x0059: 'Flash fired, auto mode, red-eye reduction mode',
|
8537 |
+
0x005D: 'Flash fired, auto mode, return light not detected, red-eye reduction mode',
|
8538 |
+
0x005F: 'Flash fired, auto mode, return light detected, red-eye reduction mode'
|
8539 |
+
},
|
8540 |
+
|
8541 |
+
'ExposureMode': {
|
8542 |
+
0: 'Auto exposure',
|
8543 |
+
1: 'Manual exposure',
|
8544 |
+
2: 'Auto bracket'
|
8545 |
+
},
|
8546 |
+
|
8547 |
+
'WhiteBalance': {
|
8548 |
+
0: 'Auto white balance',
|
8549 |
+
1: 'Manual white balance'
|
8550 |
+
},
|
8551 |
+
|
8552 |
+
'SceneCaptureType': {
|
8553 |
+
0: 'Standard',
|
8554 |
+
1: 'Landscape',
|
8555 |
+
2: 'Portrait',
|
8556 |
+
3: 'Night scene'
|
8557 |
+
},
|
8558 |
+
|
8559 |
+
'Contrast': {
|
8560 |
+
0: 'Normal',
|
8561 |
+
1: 'Soft',
|
8562 |
+
2: 'Hard'
|
8563 |
+
},
|
8564 |
+
|
8565 |
+
'Saturation': {
|
8566 |
+
0: 'Normal',
|
8567 |
+
1: 'Low saturation',
|
8568 |
+
2: 'High saturation'
|
8569 |
+
},
|
8570 |
+
|
8571 |
+
'Sharpness': {
|
8572 |
+
0: 'Normal',
|
8573 |
+
1: 'Soft',
|
8574 |
+
2: 'Hard'
|
8575 |
+
},
|
8576 |
+
|
8577 |
+
// GPS related
|
8578 |
+
'GPSLatitudeRef': {
|
8579 |
+
N: 'North latitude',
|
8580 |
+
S: 'South latitude'
|
8581 |
+
},
|
8582 |
+
|
8583 |
+
'GPSLongitudeRef': {
|
8584 |
+
E: 'East longitude',
|
8585 |
+
W: 'West longitude'
|
8586 |
+
}
|
8587 |
+
};
|
8588 |
+
|
8589 |
+
offsets = {
|
8590 |
+
tiffHeader: 10
|
8591 |
+
};
|
8592 |
+
|
8593 |
+
idx = offsets.tiffHeader;
|
8594 |
+
|
8595 |
+
__super__ = {
|
8596 |
+
clear: this.clear
|
8597 |
+
};
|
8598 |
+
|
8599 |
+
// Public functions
|
8600 |
+
Basic.extend(this, {
|
8601 |
+
|
8602 |
+
read: function() {
|
8603 |
+
try {
|
8604 |
+
return ExifParser.prototype.read.apply(this, arguments);
|
8605 |
+
} catch (ex) {
|
8606 |
+
throw new x.ImageError(x.ImageError.INVALID_META_ERR);
|
8607 |
+
}
|
8608 |
+
},
|
8609 |
+
|
8610 |
+
|
8611 |
+
write: function() {
|
8612 |
+
try {
|
8613 |
+
return ExifParser.prototype.write.apply(this, arguments);
|
8614 |
+
} catch (ex) {
|
8615 |
+
throw new x.ImageError(x.ImageError.INVALID_META_ERR);
|
8616 |
+
}
|
8617 |
+
},
|
8618 |
+
|
8619 |
+
|
8620 |
+
UNDEFINED: function() {
|
8621 |
+
return this.BYTE.apply(this, arguments);
|
8622 |
+
},
|
8623 |
+
|
8624 |
+
|
8625 |
+
RATIONAL: function(idx) {
|
8626 |
+
return this.LONG(idx) / this.LONG(idx + 4)
|
8627 |
+
},
|
8628 |
+
|
8629 |
+
|
8630 |
+
SRATIONAL: function(idx) {
|
8631 |
+
return this.SLONG(idx) / this.SLONG(idx + 4)
|
8632 |
+
},
|
8633 |
+
|
8634 |
+
ASCII: function(idx) {
|
8635 |
+
return this.CHAR(idx);
|
8636 |
+
},
|
8637 |
+
|
8638 |
+
TIFF: function() {
|
8639 |
+
return Tiff || null;
|
8640 |
+
},
|
8641 |
+
|
8642 |
+
|
8643 |
+
EXIF: function() {
|
8644 |
+
var Exif = null;
|
8645 |
+
|
8646 |
+
if (offsets.exifIFD) {
|
8647 |
+
try {
|
8648 |
+
Exif = extractTags.call(this, offsets.exifIFD, tags.exif);
|
8649 |
+
} catch(ex) {
|
8650 |
+
return null;
|
8651 |
+
}
|
8652 |
+
|
8653 |
+
// Fix formatting of some tags
|
8654 |
+
if (Exif.ExifVersion && Basic.typeOf(Exif.ExifVersion) === 'array') {
|
8655 |
+
for (var i = 0, exifVersion = ''; i < Exif.ExifVersion.length; i++) {
|
8656 |
+
exifVersion += String.fromCharCode(Exif.ExifVersion[i]);
|
8657 |
+
}
|
8658 |
+
Exif.ExifVersion = exifVersion;
|
8659 |
+
}
|
8660 |
+
}
|
8661 |
+
|
8662 |
+
return Exif;
|
8663 |
+
},
|
8664 |
+
|
8665 |
+
|
8666 |
+
GPS: function() {
|
8667 |
+
var GPS = null;
|
8668 |
+
|
8669 |
+
if (offsets.gpsIFD) {
|
8670 |
+
try {
|
8671 |
+
GPS = extractTags.call(this, offsets.gpsIFD, tags.gps);
|
8672 |
+
} catch (ex) {
|
8673 |
+
return null;
|
8674 |
+
}
|
8675 |
+
|
8676 |
+
// iOS devices (and probably some others) do not put in GPSVersionID tag (why?..)
|
8677 |
+
if (GPS.GPSVersionID && Basic.typeOf(GPS.GPSVersionID) === 'array') {
|
8678 |
+
GPS.GPSVersionID = GPS.GPSVersionID.join('.');
|
8679 |
+
}
|
8680 |
+
}
|
8681 |
+
|
8682 |
+
return GPS;
|
8683 |
+
},
|
8684 |
+
|
8685 |
+
|
8686 |
+
thumb: function() {
|
8687 |
+
if (offsets.IFD1) {
|
8688 |
+
try {
|
8689 |
+
var IFD1Tags = extractTags.call(this, offsets.IFD1, tags.thumb);
|
8690 |
+
|
8691 |
+
if ('JPEGInterchangeFormat' in IFD1Tags) {
|
8692 |
+
return this.SEGMENT(offsets.tiffHeader + IFD1Tags.JPEGInterchangeFormat, IFD1Tags.JPEGInterchangeFormatLength);
|
8693 |
+
}
|
8694 |
+
} catch (ex) {}
|
8695 |
+
}
|
8696 |
+
return null;
|
8697 |
+
},
|
8698 |
+
|
8699 |
+
|
8700 |
+
setExif: function(tag, value) {
|
8701 |
+
// Right now only setting of width/height is possible
|
8702 |
+
if (tag !== 'PixelXDimension' && tag !== 'PixelYDimension') { return false; }
|
8703 |
+
|
8704 |
+
return setTag.call(this, 'exif', tag, value);
|
8705 |
+
},
|
8706 |
+
|
8707 |
+
|
8708 |
+
clear: function() {
|
8709 |
+
__super__.clear();
|
8710 |
+
data = tags = tagDescs = Tiff = offsets = __super__ = null;
|
8711 |
+
}
|
8712 |
+
});
|
8713 |
+
|
8714 |
+
|
8715 |
+
// Check if that's APP1 and that it has EXIF
|
8716 |
+
if (this.SHORT(0) !== 0xFFE1 || this.STRING(4, 5).toUpperCase() !== "EXIF\0") {
|
8717 |
+
throw new x.ImageError(x.ImageError.INVALID_META_ERR);
|
8718 |
+
}
|
8719 |
+
|
8720 |
+
// Set read order of multi-byte data
|
8721 |
+
this.littleEndian = (this.SHORT(idx) == 0x4949);
|
8722 |
+
|
8723 |
+
// Check if always present bytes are indeed present
|
8724 |
+
if (this.SHORT(idx+=2) !== 0x002A) {
|
8725 |
+
throw new x.ImageError(x.ImageError.INVALID_META_ERR);
|
8726 |
+
}
|
8727 |
+
|
8728 |
+
offsets.IFD0 = offsets.tiffHeader + this.LONG(idx += 2);
|
8729 |
+
Tiff = extractTags.call(this, offsets.IFD0, tags.tiff);
|
8730 |
+
|
8731 |
+
if ('ExifIFDPointer' in Tiff) {
|
8732 |
+
offsets.exifIFD = offsets.tiffHeader + Tiff.ExifIFDPointer;
|
8733 |
+
delete Tiff.ExifIFDPointer;
|
8734 |
+
}
|
8735 |
+
|
8736 |
+
if ('GPSInfoIFDPointer' in Tiff) {
|
8737 |
+
offsets.gpsIFD = offsets.tiffHeader + Tiff.GPSInfoIFDPointer;
|
8738 |
+
delete Tiff.GPSInfoIFDPointer;
|
8739 |
+
}
|
8740 |
+
|
8741 |
+
if (Basic.isEmptyObj(Tiff)) {
|
8742 |
+
Tiff = null;
|
8743 |
+
}
|
8744 |
+
|
8745 |
+
// check if we have a thumb as well
|
8746 |
+
var IFD1Offset = this.LONG(offsets.IFD0 + this.SHORT(offsets.IFD0) * 12 + 2);
|
8747 |
+
if (IFD1Offset) {
|
8748 |
+
offsets.IFD1 = offsets.tiffHeader + IFD1Offset;
|
8749 |
+
}
|
8750 |
+
|
8751 |
+
|
8752 |
+
function extractTags(IFD_offset, tags2extract) {
|
8753 |
+
var data = this;
|
8754 |
+
var length, i, tag, type, count, size, offset, value, values = [], hash = {};
|
8755 |
+
|
8756 |
+
var types = {
|
8757 |
+
1 : 'BYTE',
|
8758 |
+
7 : 'UNDEFINED',
|
8759 |
+
2 : 'ASCII',
|
8760 |
+
3 : 'SHORT',
|
8761 |
+
4 : 'LONG',
|
8762 |
+
5 : 'RATIONAL',
|
8763 |
+
9 : 'SLONG',
|
8764 |
+
10: 'SRATIONAL'
|
8765 |
+
};
|
8766 |
+
|
8767 |
+
var sizes = {
|
8768 |
+
'BYTE' : 1,
|
8769 |
+
'UNDEFINED' : 1,
|
8770 |
+
'ASCII' : 1,
|
8771 |
+
'SHORT' : 2,
|
8772 |
+
'LONG' : 4,
|
8773 |
+
'RATIONAL' : 8,
|
8774 |
+
'SLONG' : 4,
|
8775 |
+
'SRATIONAL' : 8
|
8776 |
+
};
|
8777 |
+
|
8778 |
+
length = data.SHORT(IFD_offset);
|
8779 |
+
|
8780 |
+
// The size of APP1 including all these elements shall not exceed the 64 Kbytes specified in the JPEG standard.
|
8781 |
+
|
8782 |
+
for (i = 0; i < length; i++) {
|
8783 |
+
values = [];
|
8784 |
+
|
8785 |
+
// Set binary reader pointer to beginning of the next tag
|
8786 |
+
offset = IFD_offset + 2 + i*12;
|
8787 |
+
|
8788 |
+
tag = tags2extract[data.SHORT(offset)];
|
8789 |
+
|
8790 |
+
if (tag === undefined) {
|
8791 |
+
continue; // Not the tag we requested
|
8792 |
+
}
|
8793 |
+
|
8794 |
+
type = types[data.SHORT(offset+=2)];
|
8795 |
+
count = data.LONG(offset+=2);
|
8796 |
+
size = sizes[type];
|
8797 |
+
|
8798 |
+
if (!size) {
|
8799 |
+
throw new x.ImageError(x.ImageError.INVALID_META_ERR);
|
8800 |
+
}
|
8801 |
+
|
8802 |
+
offset += 4;
|
8803 |
+
|
8804 |
+
// tag can only fit 4 bytes of data, if data is larger we should look outside
|
8805 |
+
if (size * count > 4) {
|
8806 |
+
// instead of data tag contains an offset of the data
|
8807 |
+
offset = data.LONG(offset) + offsets.tiffHeader;
|
8808 |
+
}
|
8809 |
+
|
8810 |
+
// in case we left the boundaries of data throw an early exception
|
8811 |
+
if (offset + size * count >= this.length()) {
|
8812 |
+
throw new x.ImageError(x.ImageError.INVALID_META_ERR);
|
8813 |
+
}
|
8814 |
+
|
8815 |
+
// special care for the string
|
8816 |
+
if (type === 'ASCII') {
|
8817 |
+
hash[tag] = Basic.trim(data.STRING(offset, count).replace(/\0$/, '')); // strip trailing NULL
|
8818 |
+
continue;
|
8819 |
+
} else {
|
8820 |
+
values = data.asArray(type, offset, count);
|
8821 |
+
value = (count == 1 ? values[0] : values);
|
8822 |
+
|
8823 |
+
if (tagDescs.hasOwnProperty(tag) && typeof value != 'object') {
|
8824 |
+
hash[tag] = tagDescs[tag][value];
|
8825 |
+
} else {
|
8826 |
+
hash[tag] = value;
|
8827 |
+
}
|
8828 |
+
}
|
8829 |
+
}
|
8830 |
+
|
8831 |
+
return hash;
|
8832 |
+
}
|
8833 |
+
|
8834 |
+
// At the moment only setting of simple (LONG) values, that do not require offset recalculation, is supported
|
8835 |
+
function setTag(ifd, tag, value) {
|
8836 |
+
var offset, length, tagOffset, valueOffset = 0;
|
8837 |
+
|
8838 |
+
// If tag name passed translate into hex key
|
8839 |
+
if (typeof(tag) === 'string') {
|
8840 |
+
var tmpTags = tags[ifd.toLowerCase()];
|
8841 |
+
for (var hex in tmpTags) {
|
8842 |
+
if (tmpTags[hex] === tag) {
|
8843 |
+
tag = hex;
|
8844 |
+
break;
|
8845 |
+
}
|
8846 |
+
}
|
8847 |
+
}
|
8848 |
+
offset = offsets[ifd.toLowerCase() + 'IFD'];
|
8849 |
+
length = this.SHORT(offset);
|
8850 |
+
|
8851 |
+
for (var i = 0; i < length; i++) {
|
8852 |
+
tagOffset = offset + 12 * i + 2;
|
8853 |
+
|
8854 |
+
if (this.SHORT(tagOffset) == tag) {
|
8855 |
+
valueOffset = tagOffset + 8;
|
8856 |
+
break;
|
8857 |
+
}
|
8858 |
+
}
|
8859 |
+
|
8860 |
+
if (!valueOffset) {
|
8861 |
+
return false;
|
8862 |
+
}
|
8863 |
+
|
8864 |
+
try {
|
8865 |
+
this.write(valueOffset, value, 4);
|
8866 |
+
} catch(ex) {
|
8867 |
+
return false;
|
8868 |
+
}
|
8869 |
+
|
8870 |
+
return true;
|
8871 |
+
}
|
8872 |
+
}
|
8873 |
+
|
8874 |
+
ExifParser.prototype = BinaryReader.prototype;
|
8875 |
+
|
8876 |
+
return ExifParser;
|
8877 |
+
});
|
8878 |
+
|
8879 |
+
// Included from: src/javascript/runtime/html5/image/JPEG.js
|
8880 |
+
|
8881 |
+
/**
|
8882 |
+
* JPEG.js
|
8883 |
+
*
|
8884 |
+
* Copyright 2013, Moxiecode Systems AB
|
8885 |
+
* Released under GPL License.
|
8886 |
+
*
|
8887 |
+
* License: http://www.plupload.com/license
|
8888 |
+
* Contributing: http://www.plupload.com/contributing
|
8889 |
+
*/
|
8890 |
+
|
8891 |
+
/**
|
8892 |
+
@class moxie/runtime/html5/image/JPEG
|
8893 |
+
@private
|
8894 |
+
*/
|
8895 |
+
define("moxie/runtime/html5/image/JPEG", [
|
8896 |
+
"moxie/core/utils/Basic",
|
8897 |
+
"moxie/core/Exceptions",
|
8898 |
+
"moxie/runtime/html5/image/JPEGHeaders",
|
8899 |
+
"moxie/runtime/html5/utils/BinaryReader",
|
8900 |
+
"moxie/runtime/html5/image/ExifParser"
|
8901 |
+
], function(Basic, x, JPEGHeaders, BinaryReader, ExifParser) {
|
8902 |
+
|
8903 |
+
function JPEG(data) {
|
8904 |
+
var _br, _hm, _ep, _info;
|
8905 |
+
|
8906 |
+
_br = new BinaryReader(data);
|
8907 |
+
|
8908 |
+
// check if it is jpeg
|
8909 |
+
if (_br.SHORT(0) !== 0xFFD8) {
|
8910 |
+
throw new x.ImageError(x.ImageError.WRONG_FORMAT);
|
8911 |
+
}
|
8912 |
+
|
8913 |
+
// backup headers
|
8914 |
+
_hm = new JPEGHeaders(data);
|
8915 |
+
|
8916 |
+
// extract exif info
|
8917 |
+
try {
|
8918 |
+
_ep = new ExifParser(_hm.get('app1')[0]);
|
8919 |
+
} catch(ex) {}
|
8920 |
+
|
8921 |
+
// get dimensions
|
8922 |
+
_info = _getDimensions.call(this);
|
8923 |
+
|
8924 |
+
Basic.extend(this, {
|
8925 |
+
type: 'image/jpeg',
|
8926 |
+
|
8927 |
+
size: _br.length(),
|
8928 |
+
|
8929 |
+
width: _info && _info.width || 0,
|
8930 |
+
|
8931 |
+
height: _info && _info.height || 0,
|
8932 |
+
|
8933 |
+
setExif: function(tag, value) {
|
8934 |
+
if (!_ep) {
|
8935 |
+
return false; // or throw an exception
|
8936 |
+
}
|
8937 |
+
|
8938 |
+
if (Basic.typeOf(tag) === 'object') {
|
8939 |
+
Basic.each(tag, function(value, tag) {
|
8940 |
+
_ep.setExif(tag, value);
|
8941 |
+
});
|
8942 |
+
} else {
|
8943 |
+
_ep.setExif(tag, value);
|
8944 |
+
}
|
8945 |
+
|
8946 |
+
// update internal headers
|
8947 |
+
_hm.set('app1', _ep.SEGMENT());
|
8948 |
+
},
|
8949 |
+
|
8950 |
+
writeHeaders: function() {
|
8951 |
+
if (!arguments.length) {
|
8952 |
+
// if no arguments passed, update headers internally
|
8953 |
+
return _hm.restore(data);
|
8954 |
+
}
|
8955 |
+
return _hm.restore(arguments[0]);
|
8956 |
+
},
|
8957 |
+
|
8958 |
+
stripHeaders: function(data) {
|
8959 |
+
return _hm.strip(data);
|
8960 |
+
},
|
8961 |
+
|
8962 |
+
purge: function() {
|
8963 |
+
_purge.call(this);
|
8964 |
+
}
|
8965 |
+
});
|
8966 |
+
|
8967 |
+
if (_ep) {
|
8968 |
+
this.meta = {
|
8969 |
+
tiff: _ep.TIFF(),
|
8970 |
+
exif: _ep.EXIF(),
|
8971 |
+
gps: _ep.GPS(),
|
8972 |
+
thumb: _getThumb()
|
8973 |
+
};
|
8974 |
+
}
|
8975 |
+
|
8976 |
+
|
8977 |
+
function _getDimensions(br) {
|
8978 |
+
var idx = 0
|
8979 |
+
, marker
|
8980 |
+
, length
|
8981 |
+
;
|
8982 |
+
|
8983 |
+
if (!br) {
|
8984 |
+
br = _br;
|
8985 |
+
}
|
8986 |
+
|
8987 |
+
// examine all through the end, since some images might have very large APP segments
|
8988 |
+
while (idx <= br.length()) {
|
8989 |
+
marker = br.SHORT(idx += 2);
|
8990 |
+
|
8991 |
+
if (marker >= 0xFFC0 && marker <= 0xFFC3) { // SOFn
|
8992 |
+
idx += 5; // marker (2 bytes) + length (2 bytes) + Sample precision (1 byte)
|
8993 |
+
return {
|
8994 |
+
height: br.SHORT(idx),
|
8995 |
+
width: br.SHORT(idx += 2)
|
8996 |
+
};
|
8997 |
+
}
|
8998 |
+
length = br.SHORT(idx += 2);
|
8999 |
+
idx += length - 2;
|
9000 |
+
}
|
9001 |
+
return null;
|
9002 |
+
}
|
9003 |
+
|
9004 |
+
|
9005 |
+
function _getThumb() {
|
9006 |
+
var data = _ep.thumb()
|
9007 |
+
, br
|
9008 |
+
, info
|
9009 |
+
;
|
9010 |
+
|
9011 |
+
if (data) {
|
9012 |
+
br = new BinaryReader(data);
|
9013 |
+
info = _getDimensions(br);
|
9014 |
+
br.clear();
|
9015 |
+
|
9016 |
+
if (info) {
|
9017 |
+
info.data = data;
|
9018 |
+
return info;
|
9019 |
+
}
|
9020 |
+
}
|
9021 |
+
return null;
|
9022 |
+
}
|
9023 |
+
|
9024 |
+
|
9025 |
+
function _purge() {
|
9026 |
+
if (!_ep || !_hm || !_br) {
|
9027 |
+
return; // ignore any repeating purge requests
|
9028 |
+
}
|
9029 |
+
_ep.clear();
|
9030 |
+
_hm.purge();
|
9031 |
+
_br.clear();
|
9032 |
+
_info = _hm = _ep = _br = null;
|
9033 |
+
}
|
9034 |
+
}
|
9035 |
+
|
9036 |
+
return JPEG;
|
9037 |
+
});
|
9038 |
+
|
9039 |
+
// Included from: src/javascript/runtime/html5/image/PNG.js
|
9040 |
+
|
9041 |
+
/**
|
9042 |
+
* PNG.js
|
9043 |
+
*
|
9044 |
+
* Copyright 2013, Moxiecode Systems AB
|
9045 |
+
* Released under GPL License.
|
9046 |
+
*
|
9047 |
+
* License: http://www.plupload.com/license
|
9048 |
+
* Contributing: http://www.plupload.com/contributing
|
9049 |
+
*/
|
9050 |
+
|
9051 |
+
/**
|
9052 |
+
@class moxie/runtime/html5/image/PNG
|
9053 |
+
@private
|
9054 |
+
*/
|
9055 |
+
define("moxie/runtime/html5/image/PNG", [
|
9056 |
+
"moxie/core/Exceptions",
|
9057 |
+
"moxie/core/utils/Basic",
|
9058 |
+
"moxie/runtime/html5/utils/BinaryReader"
|
9059 |
+
], function(x, Basic, BinaryReader) {
|
9060 |
+
|
9061 |
+
function PNG(data) {
|
9062 |
+
var _br, _hm, _ep, _info;
|
9063 |
+
|
9064 |
+
_br = new BinaryReader(data);
|
9065 |
+
|
9066 |
+
// check if it's png
|
9067 |
+
(function() {
|
9068 |
+
var idx = 0, i = 0
|
9069 |
+
, signature = [0x8950, 0x4E47, 0x0D0A, 0x1A0A]
|
9070 |
+
;
|
9071 |
+
|
9072 |
+
for (i = 0; i < signature.length; i++, idx += 2) {
|
9073 |
+
if (signature[i] != _br.SHORT(idx)) {
|
9074 |
+
throw new x.ImageError(x.ImageError.WRONG_FORMAT);
|
9075 |
+
}
|
9076 |
+
}
|
9077 |
+
}());
|
9078 |
+
|
9079 |
+
function _getDimensions() {
|
9080 |
+
var chunk, idx;
|
9081 |
+
|
9082 |
+
chunk = _getChunkAt.call(this, 8);
|
9083 |
+
|
9084 |
+
if (chunk.type == 'IHDR') {
|
9085 |
+
idx = chunk.start;
|
9086 |
+
return {
|
9087 |
+
width: _br.LONG(idx),
|
9088 |
+
height: _br.LONG(idx += 4)
|
9089 |
+
};
|
9090 |
+
}
|
9091 |
+
return null;
|
9092 |
+
}
|
9093 |
+
|
9094 |
+
function _purge() {
|
9095 |
+
if (!_br) {
|
9096 |
+
return; // ignore any repeating purge requests
|
9097 |
+
}
|
9098 |
+
_br.clear();
|
9099 |
+
data = _info = _hm = _ep = _br = null;
|
9100 |
+
}
|
9101 |
+
|
9102 |
+
_info = _getDimensions.call(this);
|
9103 |
+
|
9104 |
+
Basic.extend(this, {
|
9105 |
+
type: 'image/png',
|
9106 |
+
|
9107 |
+
size: _br.length(),
|
9108 |
+
|
9109 |
+
width: _info.width,
|
9110 |
+
|
9111 |
+
height: _info.height,
|
9112 |
+
|
9113 |
+
purge: function() {
|
9114 |
+
_purge.call(this);
|
9115 |
+
}
|
9116 |
+
});
|
9117 |
+
|
9118 |
+
// for PNG we can safely trigger purge automatically, as we do not keep any data for later
|
9119 |
+
_purge.call(this);
|
9120 |
+
|
9121 |
+
function _getChunkAt(idx) {
|
9122 |
+
var length, type, start, CRC;
|
9123 |
+
|
9124 |
+
length = _br.LONG(idx);
|
9125 |
+
type = _br.STRING(idx += 4, 4);
|
9126 |
+
start = idx += 4;
|
9127 |
+
CRC = _br.LONG(idx + length);
|
9128 |
+
|
9129 |
+
return {
|
9130 |
+
length: length,
|
9131 |
+
type: type,
|
9132 |
+
start: start,
|
9133 |
+
CRC: CRC
|
9134 |
+
};
|
9135 |
+
}
|
9136 |
+
}
|
9137 |
+
|
9138 |
+
return PNG;
|
9139 |
+
});
|
9140 |
+
|
9141 |
+
// Included from: src/javascript/runtime/html5/image/ImageInfo.js
|
9142 |
+
|
9143 |
+
/**
|
9144 |
+
* ImageInfo.js
|
9145 |
+
*
|
9146 |
+
* Copyright 2013, Moxiecode Systems AB
|
9147 |
+
* Released under GPL License.
|
9148 |
+
*
|
9149 |
+
* License: http://www.plupload.com/license
|
9150 |
+
* Contributing: http://www.plupload.com/contributing
|
9151 |
+
*/
|
9152 |
+
|
9153 |
+
/**
|
9154 |
+
Optional image investigation tool for HTML5 runtime. Provides the following features:
|
9155 |
+
- ability to distinguish image type (JPEG or PNG) by signature
|
9156 |
+
- ability to extract image width/height directly from it's internals, without preloading in memory (fast)
|
9157 |
+
- ability to extract APP headers from JPEGs (Exif, GPS, etc)
|
9158 |
+
- ability to replace width/height tags in extracted JPEG headers
|
9159 |
+
- ability to restore APP headers, that were for example stripped during image manipulation
|
9160 |
+
|
9161 |
+
@class moxie/runtime/html5/image/ImageInfo
|
9162 |
+
@private
|
9163 |
+
@param {String} data Image source as binary string
|
9164 |
+
*/
|
9165 |
+
define("moxie/runtime/html5/image/ImageInfo", [
|
9166 |
+
"moxie/core/utils/Basic",
|
9167 |
+
"moxie/core/Exceptions",
|
9168 |
+
"moxie/runtime/html5/image/JPEG",
|
9169 |
+
"moxie/runtime/html5/image/PNG"
|
9170 |
+
], function(Basic, x, JPEG, PNG) {
|
9171 |
+
|
9172 |
+
return function(data) {
|
9173 |
+
var _cs = [JPEG, PNG], _img;
|
9174 |
+
|
9175 |
+
// figure out the format, throw: ImageError.WRONG_FORMAT if not supported
|
9176 |
+
_img = (function() {
|
9177 |
+
for (var i = 0; i < _cs.length; i++) {
|
9178 |
+
try {
|
9179 |
+
return new _cs[i](data);
|
9180 |
+
} catch (ex) {
|
9181 |
+
// console.info(ex);
|
9182 |
+
}
|
9183 |
+
}
|
9184 |
+
throw new x.ImageError(x.ImageError.WRONG_FORMAT);
|
9185 |
+
}());
|
9186 |
+
|
9187 |
+
Basic.extend(this, {
|
9188 |
+
/**
|
9189 |
+
Image Mime Type extracted from it's depths
|
9190 |
+
|
9191 |
+
@property type
|
9192 |
+
@type {String}
|
9193 |
+
@default ''
|
9194 |
+
*/
|
9195 |
+
type: '',
|
9196 |
+
|
9197 |
+
/**
|
9198 |
+
Image size in bytes
|
9199 |
+
|
9200 |
+
@property size
|
9201 |
+
@type {Number}
|
9202 |
+
@default 0
|
9203 |
+
*/
|
9204 |
+
size: 0,
|
9205 |
+
|
9206 |
+
/**
|
9207 |
+
Image width extracted from image source
|
9208 |
+
|
9209 |
+
@property width
|
9210 |
+
@type {Number}
|
9211 |
+
@default 0
|
9212 |
+
*/
|
9213 |
+
width: 0,
|
9214 |
+
|
9215 |
+
/**
|
9216 |
+
Image height extracted from image source
|
9217 |
+
|
9218 |
+
@property height
|
9219 |
+
@type {Number}
|
9220 |
+
@default 0
|
9221 |
+
*/
|
9222 |
+
height: 0,
|
9223 |
+
|
9224 |
+
/**
|
9225 |
+
Sets Exif tag. Currently applicable only for width and height tags. Obviously works only with JPEGs.
|
9226 |
+
|
9227 |
+
@method setExif
|
9228 |
+
@param {String} tag Tag to set
|
9229 |
+
@param {Mixed} value Value to assign to the tag
|
9230 |
+
*/
|
9231 |
+
setExif: function() {},
|
9232 |
+
|
9233 |
+
/**
|
9234 |
+
Restores headers to the source.
|
9235 |
+
|
9236 |
+
@method writeHeaders
|
9237 |
+
@param {String} data Image source as binary string
|
9238 |
+
@return {String} Updated binary string
|
9239 |
+
*/
|
9240 |
+
writeHeaders: function(data) {
|
9241 |
+
return data;
|
9242 |
+
},
|
9243 |
+
|
9244 |
+
/**
|
9245 |
+
Strip all headers from the source.
|
9246 |
+
|
9247 |
+
@method stripHeaders
|
9248 |
+
@param {String} data Image source as binary string
|
9249 |
+
@return {String} Updated binary string
|
9250 |
+
*/
|
9251 |
+
stripHeaders: function(data) {
|
9252 |
+
return data;
|
9253 |
+
},
|
9254 |
+
|
9255 |
+
/**
|
9256 |
+
Dispose resources.
|
9257 |
+
|
9258 |
+
@method purge
|
9259 |
+
*/
|
9260 |
+
purge: function() {
|
9261 |
+
data = null;
|
9262 |
+
}
|
9263 |
+
});
|
9264 |
+
|
9265 |
+
Basic.extend(this, _img);
|
9266 |
+
|
9267 |
+
this.purge = function() {
|
9268 |
+
_img.purge();
|
9269 |
+
_img = null;
|
9270 |
+
};
|
9271 |
+
};
|
9272 |
+
});
|
9273 |
+
|
9274 |
+
// Included from: src/javascript/runtime/html5/image/ResizerCanvas.js
|
9275 |
+
|
9276 |
+
/**
|
9277 |
+
* ResizerCanvas.js
|
9278 |
+
*
|
9279 |
+
* Copyright 2013, Moxiecode Systems AB
|
9280 |
+
* Released under GPL License.
|
9281 |
+
*
|
9282 |
+
* License: http://www.plupload.com/license
|
9283 |
+
* Contributing: http://www.plupload.com/contributing
|
9284 |
+
*/
|
9285 |
+
|
9286 |
+
/**
|
9287 |
+
* Resizes image/canvas using canvas
|
9288 |
+
*/
|
9289 |
+
define("moxie/runtime/html5/image/ResizerCanvas", [], function() {
|
9290 |
+
|
9291 |
+
function scale(image, ratio, resample) {
|
9292 |
+
var sD = image.width > image.height ? 'width' : 'height'; // take the largest side
|
9293 |
+
var dD = Math.round(image[sD] * ratio);
|
9294 |
+
var scaleCapped = false;
|
9295 |
+
|
9296 |
+
if (resample !== 'nearest' && (ratio < 0.5 || ratio > 2)) {
|
9297 |
+
ratio = ratio < 0.5 ? 0.5 : 2;
|
9298 |
+
scaleCapped = true;
|
9299 |
+
}
|
9300 |
+
|
9301 |
+
var tCanvas = _scale(image, ratio);
|
9302 |
+
|
9303 |
+
if (scaleCapped) {
|
9304 |
+
return scale(tCanvas, dD / tCanvas[sD], resample);
|
9305 |
+
} else {
|
9306 |
+
return tCanvas;
|
9307 |
+
}
|
9308 |
+
}
|
9309 |
+
|
9310 |
+
|
9311 |
+
function _scale(image, ratio) {
|
9312 |
+
var sW = image.width;
|
9313 |
+
var sH = image.height;
|
9314 |
+
var dW = Math.round(sW * ratio);
|
9315 |
+
var dH = Math.round(sH * ratio);
|
9316 |
+
|
9317 |
+
var canvas = document.createElement('canvas');
|
9318 |
+
canvas.width = dW;
|
9319 |
+
canvas.height = dH;
|
9320 |
+
canvas.getContext("2d").drawImage(image, 0, 0, sW, sH, 0, 0, dW, dH);
|
9321 |
+
|
9322 |
+
image = null; // just in case
|
9323 |
+
return canvas;
|
9324 |
+
}
|
9325 |
+
|
9326 |
+
return {
|
9327 |
+
scale: scale
|
9328 |
+
};
|
9329 |
+
|
9330 |
+
});
|
9331 |
+
|
9332 |
+
// Included from: src/javascript/runtime/html5/image/Image.js
|
9333 |
+
|
9334 |
+
/**
|
9335 |
+
* Image.js
|
9336 |
+
*
|
9337 |
+
* Copyright 2013, Moxiecode Systems AB
|
9338 |
+
* Released under GPL License.
|
9339 |
+
*
|
9340 |
+
* License: http://www.plupload.com/license
|
9341 |
+
* Contributing: http://www.plupload.com/contributing
|
9342 |
+
*/
|
9343 |
+
|
9344 |
+
/**
|
9345 |
+
@class moxie/runtime/html5/image/Image
|
9346 |
+
@private
|
9347 |
+
*/
|
9348 |
+
define("moxie/runtime/html5/image/Image", [
|
9349 |
+
"moxie/runtime/html5/Runtime",
|
9350 |
+
"moxie/core/utils/Basic",
|
9351 |
+
"moxie/core/Exceptions",
|
9352 |
+
"moxie/core/utils/Encode",
|
9353 |
+
"moxie/file/Blob",
|
9354 |
+
"moxie/file/File",
|
9355 |
+
"moxie/runtime/html5/image/ImageInfo",
|
9356 |
+
"moxie/runtime/html5/image/ResizerCanvas",
|
9357 |
+
"moxie/core/utils/Mime",
|
9358 |
+
"moxie/core/utils/Env"
|
9359 |
+
], function(extensions, Basic, x, Encode, Blob, File, ImageInfo, ResizerCanvas, Mime, Env) {
|
9360 |
+
|
9361 |
+
function HTML5Image() {
|
9362 |
+
var me = this
|
9363 |
+
, _img, _imgInfo, _canvas, _binStr, _blob
|
9364 |
+
, _modified = false // is set true whenever image is modified
|
9365 |
+
, _preserveHeaders = true
|
9366 |
+
;
|
9367 |
+
|
9368 |
+
Basic.extend(this, {
|
9369 |
+
loadFromBlob: function(blob) {
|
9370 |
+
var I = this.getRuntime()
|
9371 |
+
, asBinary = arguments.length > 1 ? arguments[1] : true
|
9372 |
+
;
|
9373 |
+
|
9374 |
+
if (!I.can('access_binary')) {
|
9375 |
+
throw new x.RuntimeError(x.RuntimeError.NOT_SUPPORTED_ERR);
|
9376 |
+
}
|
9377 |
+
|
9378 |
+
_blob = blob;
|
9379 |
+
|
9380 |
+
if (blob.isDetached()) {
|
9381 |
+
_binStr = blob.getSource();
|
9382 |
+
_preload.call(this, _binStr);
|
9383 |
+
return;
|
9384 |
+
} else {
|
9385 |
+
_readAsDataUrl.call(this, blob.getSource(), function(dataUrl) {
|
9386 |
+
if (asBinary) {
|
9387 |
+
_binStr = _toBinary(dataUrl);
|
9388 |
+
}
|
9389 |
+
_preload.call(this, dataUrl);
|
9390 |
+
});
|
9391 |
+
}
|
9392 |
+
},
|
9393 |
+
|
9394 |
+
loadFromImage: function(img, exact) {
|
9395 |
+
this.meta = img.meta;
|
9396 |
+
|
9397 |
+
_blob = new File(null, {
|
9398 |
+
name: img.name,
|
9399 |
+
size: img.size,
|
9400 |
+
type: img.type
|
9401 |
+
});
|
9402 |
+
|
9403 |
+
_preload.call(this, exact ? (_binStr = img.getAsBinaryString()) : img.getAsDataURL());
|
9404 |
+
},
|
9405 |
+
|
9406 |
+
getInfo: function() {
|
9407 |
+
var I = this.getRuntime(), info;
|
9408 |
+
|
9409 |
+
if (!_imgInfo && _binStr && I.can('access_image_binary')) {
|
9410 |
+
_imgInfo = new ImageInfo(_binStr);
|
9411 |
+
}
|
9412 |
+
|
9413 |
+
// this stuff below is definitely having fun with itself
|
9414 |
+
info = {
|
9415 |
+
width: _getImg().width || 0,
|
9416 |
+
height: _getImg().height || 0,
|
9417 |
+
type: _blob.type || Mime.getFileMime(_blob.name),
|
9418 |
+
size: _binStr && _binStr.length || _blob.size || 0,
|
9419 |
+
name: _blob.name || '',
|
9420 |
+
meta: null
|
9421 |
+
};
|
9422 |
+
|
9423 |
+
if (_preserveHeaders) {
|
9424 |
+
info.meta = _imgInfo && _imgInfo.meta || this.meta || {};
|
9425 |
+
|
9426 |
+
// if data was taken from ImageInfo it will be a binary string, so we convert it to blob
|
9427 |
+
if (info.meta && info.meta.thumb && !(info.meta.thumb.data instanceof Blob)) {
|
9428 |
+
info.meta.thumb.data = new Blob(null, {
|
9429 |
+
type: 'image/jpeg',
|
9430 |
+
data: info.meta.thumb.data
|
9431 |
+
});
|
9432 |
+
}
|
9433 |
+
}
|
9434 |
+
|
9435 |
+
return info;
|
9436 |
+
},
|
9437 |
+
|
9438 |
+
|
9439 |
+
resize: function(rect, ratio, options) {
|
9440 |
+
var canvas = document.createElement('canvas');
|
9441 |
+
canvas.width = rect.width;
|
9442 |
+
canvas.height = rect.height;
|
9443 |
+
|
9444 |
+
canvas.getContext("2d").drawImage(_getImg(), rect.x, rect.y, rect.width, rect.height, 0, 0, canvas.width, canvas.height);
|
9445 |
+
|
9446 |
+
_canvas = ResizerCanvas.scale(canvas, ratio);
|
9447 |
+
|
9448 |
+
_preserveHeaders = options.preserveHeaders;
|
9449 |
+
|
9450 |
+
// rotate if required, according to orientation tag
|
9451 |
+
if (!_preserveHeaders) {
|
9452 |
+
var orientation = (this.meta && this.meta.tiff && this.meta.tiff.Orientation) || 1;
|
9453 |
+
_canvas = _rotateToOrientaion(_canvas, orientation);
|
9454 |
+
}
|
9455 |
+
|
9456 |
+
this.width = _canvas.width;
|
9457 |
+
this.height = _canvas.height;
|
9458 |
+
|
9459 |
+
_modified = true;
|
9460 |
+
|
9461 |
+
this.trigger('Resize');
|
9462 |
+
},
|
9463 |
+
|
9464 |
+
getAsCanvas: function() {
|
9465 |
+
if (!_canvas) {
|
9466 |
+
_canvas = _getCanvas();
|
9467 |
+
}
|
9468 |
+
_canvas.id = this.uid + '_canvas';
|
9469 |
+
return _canvas;
|
9470 |
+
},
|
9471 |
+
|
9472 |
+
getAsBlob: function(type, quality) {
|
9473 |
+
if (type !== this.type) {
|
9474 |
+
_modified = true; // reconsider the state
|
9475 |
+
return new File(null, {
|
9476 |
+
name: _blob.name || '',
|
9477 |
+
type: type,
|
9478 |
+
data: me.getAsDataURL(type, quality)
|
9479 |
+
});
|
9480 |
+
}
|
9481 |
+
return new File(null, {
|
9482 |
+
name: _blob.name || '',
|
9483 |
+
type: type,
|
9484 |
+
data: me.getAsBinaryString(type, quality)
|
9485 |
+
});
|
9486 |
+
},
|
9487 |
+
|
9488 |
+
getAsDataURL: function(type) {
|
9489 |
+
var quality = arguments[1] || 90;
|
9490 |
+
|
9491 |
+
// if image has not been modified, return the source right away
|
9492 |
+
if (!_modified) {
|
9493 |
+
return _img.src;
|
9494 |
+
}
|
9495 |
+
|
9496 |
+
// make sure we have a canvas to work with
|
9497 |
+
_getCanvas();
|
9498 |
+
|
9499 |
+
if ('image/jpeg' !== type) {
|
9500 |
+
return _canvas.toDataURL('image/png');
|
9501 |
+
} else {
|
9502 |
+
try {
|
9503 |
+
// older Geckos used to result in an exception on quality argument
|
9504 |
+
return _canvas.toDataURL('image/jpeg', quality/100);
|
9505 |
+
} catch (ex) {
|
9506 |
+
return _canvas.toDataURL('image/jpeg');
|
9507 |
+
}
|
9508 |
+
}
|
9509 |
+
},
|
9510 |
+
|
9511 |
+
getAsBinaryString: function(type, quality) {
|
9512 |
+
// if image has not been modified, return the source right away
|
9513 |
+
if (!_modified) {
|
9514 |
+
// if image was not loaded from binary string
|
9515 |
+
if (!_binStr) {
|
9516 |
+
_binStr = _toBinary(me.getAsDataURL(type, quality));
|
9517 |
+
}
|
9518 |
+
return _binStr;
|
9519 |
+
}
|
9520 |
+
|
9521 |
+
if ('image/jpeg' !== type) {
|
9522 |
+
_binStr = _toBinary(me.getAsDataURL(type, quality));
|
9523 |
+
} else {
|
9524 |
+
var dataUrl;
|
9525 |
+
|
9526 |
+
// if jpeg
|
9527 |
+
if (!quality) {
|
9528 |
+
quality = 90;
|
9529 |
+
}
|
9530 |
+
|
9531 |
+
// make sure we have a canvas to work with
|
9532 |
+
_getCanvas();
|
9533 |
+
|
9534 |
+
try {
|
9535 |
+
// older Geckos used to result in an exception on quality argument
|
9536 |
+
dataUrl = _canvas.toDataURL('image/jpeg', quality/100);
|
9537 |
+
} catch (ex) {
|
9538 |
+
dataUrl = _canvas.toDataURL('image/jpeg');
|
9539 |
+
}
|
9540 |
+
|
9541 |
+
_binStr = _toBinary(dataUrl);
|
9542 |
+
|
9543 |
+
if (_imgInfo) {
|
9544 |
+
_binStr = _imgInfo.stripHeaders(_binStr);
|
9545 |
+
|
9546 |
+
if (_preserveHeaders) {
|
9547 |
+
// update dimensions info in exif
|
9548 |
+
if (_imgInfo.meta && _imgInfo.meta.exif) {
|
9549 |
+
_imgInfo.setExif({
|
9550 |
+
PixelXDimension: this.width,
|
9551 |
+
PixelYDimension: this.height
|
9552 |
+
});
|
9553 |
+
}
|
9554 |
+
|
9555 |
+
// re-inject the headers
|
9556 |
+
_binStr = _imgInfo.writeHeaders(_binStr);
|
9557 |
+
}
|
9558 |
+
|
9559 |
+
// will be re-created from fresh on next getInfo call
|
9560 |
+
_imgInfo.purge();
|
9561 |
+
_imgInfo = null;
|
9562 |
+
}
|
9563 |
+
}
|
9564 |
+
|
9565 |
+
_modified = false;
|
9566 |
+
|
9567 |
+
return _binStr;
|
9568 |
+
},
|
9569 |
+
|
9570 |
+
destroy: function() {
|
9571 |
+
me = null;
|
9572 |
+
_purge.call(this);
|
9573 |
+
this.getRuntime().getShim().removeInstance(this.uid);
|
9574 |
+
}
|
9575 |
+
});
|
9576 |
+
|
9577 |
+
|
9578 |
+
function _getImg() {
|
9579 |
+
if (!_canvas && !_img) {
|
9580 |
+
throw new x.ImageError(x.DOMException.INVALID_STATE_ERR);
|
9581 |
+
}
|
9582 |
+
return _canvas || _img;
|
9583 |
+
}
|
9584 |
+
|
9585 |
+
|
9586 |
+
function _getCanvas() {
|
9587 |
+
var canvas = _getImg();
|
9588 |
+
if (canvas.nodeName.toLowerCase() == 'canvas') {
|
9589 |
+
return canvas;
|
9590 |
+
}
|
9591 |
+
_canvas = document.createElement('canvas');
|
9592 |
+
_canvas.width = canvas.width;
|
9593 |
+
_canvas.height = canvas.height;
|
9594 |
+
_canvas.getContext("2d").drawImage(canvas, 0, 0);
|
9595 |
+
return _canvas;
|
9596 |
+
}
|
9597 |
+
|
9598 |
+
|
9599 |
+
function _toBinary(str) {
|
9600 |
+
return Encode.atob(str.substring(str.indexOf('base64,') + 7));
|
9601 |
+
}
|
9602 |
+
|
9603 |
+
|
9604 |
+
function _toDataUrl(str, type) {
|
9605 |
+
return 'data:' + (type || '') + ';base64,' + Encode.btoa(str);
|
9606 |
+
}
|
9607 |
+
|
9608 |
+
|
9609 |
+
function _preload(str) {
|
9610 |
+
var comp = this;
|
9611 |
+
|
9612 |
+
_img = new Image();
|
9613 |
+
_img.onerror = function() {
|
9614 |
+
_purge.call(this);
|
9615 |
+
comp.trigger('error', x.ImageError.WRONG_FORMAT);
|
9616 |
+
};
|
9617 |
+
_img.onload = function() {
|
9618 |
+
comp.trigger('load');
|
9619 |
+
};
|
9620 |
+
|
9621 |
+
_img.src = str.substr(0, 5) == 'data:' ? str : _toDataUrl(str, _blob.type);
|
9622 |
+
}
|
9623 |
+
|
9624 |
+
|
9625 |
+
function _readAsDataUrl(file, callback) {
|
9626 |
+
var comp = this, fr;
|
9627 |
+
|
9628 |
+
// use FileReader if it's available
|
9629 |
+
if (window.FileReader) {
|
9630 |
+
fr = new FileReader();
|
9631 |
+
fr.onload = function() {
|
9632 |
+
callback.call(comp, this.result);
|
9633 |
+
};
|
9634 |
+
fr.onerror = function() {
|
9635 |
+
comp.trigger('error', x.ImageError.WRONG_FORMAT);
|
9636 |
+
};
|
9637 |
+
fr.readAsDataURL(file);
|
9638 |
+
} else {
|
9639 |
+
return callback.call(this, file.getAsDataURL());
|
9640 |
+
}
|
9641 |
+
}
|
9642 |
+
|
9643 |
+
/**
|
9644 |
+
* Transform canvas coordination according to specified frame size and orientation
|
9645 |
+
* Orientation value is from EXIF tag
|
9646 |
+
* @author Shinichi Tomita <shinichi.tomita@gmail.com>
|
9647 |
+
*/
|
9648 |
+
function _rotateToOrientaion(img, orientation) {
|
9649 |
+
var RADIANS = Math.PI/180;
|
9650 |
+
var canvas = document.createElement('canvas');
|
9651 |
+
var ctx = canvas.getContext('2d');
|
9652 |
+
var width = img.width;
|
9653 |
+
var height = img.height;
|
9654 |
+
|
9655 |
+
if (Basic.inArray(orientation, [5,6,7,8]) > -1) {
|
9656 |
+
canvas.width = height;
|
9657 |
+
canvas.height = width;
|
9658 |
+
} else {
|
9659 |
+
canvas.width = width;
|
9660 |
+
canvas.height = height;
|
9661 |
+
}
|
9662 |
+
|
9663 |
+
/**
|
9664 |
+
1 = The 0th row is at the visual top of the image, and the 0th column is the visual left-hand side.
|
9665 |
+
2 = The 0th row is at the visual top of the image, and the 0th column is the visual right-hand side.
|
9666 |
+
3 = The 0th row is at the visual bottom of the image, and the 0th column is the visual right-hand side.
|
9667 |
+
4 = The 0th row is at the visual bottom of the image, and the 0th column is the visual left-hand side.
|
9668 |
+
5 = The 0th row is the visual left-hand side of the image, and the 0th column is the visual top.
|
9669 |
+
6 = The 0th row is the visual right-hand side of the image, and the 0th column is the visual top.
|
9670 |
+
7 = The 0th row is the visual right-hand side of the image, and the 0th column is the visual bottom.
|
9671 |
+
8 = The 0th row is the visual left-hand side of the image, and the 0th column is the visual bottom.
|
9672 |
+
*/
|
9673 |
+
switch (orientation) {
|
9674 |
+
case 2:
|
9675 |
+
// horizontal flip
|
9676 |
+
ctx.translate(width, 0);
|
9677 |
+
ctx.scale(-1, 1);
|
9678 |
+
break;
|
9679 |
+
case 3:
|
9680 |
+
// 180 rotate left
|
9681 |
+
ctx.translate(width, height);
|
9682 |
+
ctx.rotate(180 * RADIANS);
|
9683 |
+
break;
|
9684 |
+
case 4:
|
9685 |
+
// vertical flip
|
9686 |
+
ctx.translate(0, height);
|
9687 |
+
ctx.scale(1, -1);
|
9688 |
+
break;
|
9689 |
+
case 5:
|
9690 |
+
// vertical flip + 90 rotate right
|
9691 |
+
ctx.rotate(90 * RADIANS);
|
9692 |
+
ctx.scale(1, -1);
|
9693 |
+
break;
|
9694 |
+
case 6:
|
9695 |
+
// 90 rotate right
|
9696 |
+
ctx.rotate(90 * RADIANS);
|
9697 |
+
ctx.translate(0, -height);
|
9698 |
+
break;
|
9699 |
+
case 7:
|
9700 |
+
// horizontal flip + 90 rotate right
|
9701 |
+
ctx.rotate(90 * RADIANS);
|
9702 |
+
ctx.translate(width, -height);
|
9703 |
+
ctx.scale(-1, 1);
|
9704 |
+
break;
|
9705 |
+
case 8:
|
9706 |
+
// 90 rotate left
|
9707 |
+
ctx.rotate(-90 * RADIANS);
|
9708 |
+
ctx.translate(-width, 0);
|
9709 |
+
break;
|
9710 |
+
}
|
9711 |
+
|
9712 |
+
ctx.drawImage(img, 0, 0, width, height);
|
9713 |
+
return canvas;
|
9714 |
+
}
|
9715 |
+
|
9716 |
+
|
9717 |
+
function _purge() {
|
9718 |
+
if (_imgInfo) {
|
9719 |
+
_imgInfo.purge();
|
9720 |
+
_imgInfo = null;
|
9721 |
+
}
|
9722 |
+
|
9723 |
+
_binStr = _img = _canvas = _blob = null;
|
9724 |
+
_modified = false;
|
9725 |
+
}
|
9726 |
+
}
|
9727 |
+
|
9728 |
+
return (extensions.Image = HTML5Image);
|
9729 |
+
});
|
9730 |
+
|
9731 |
+
// Included from: src/javascript/runtime/flash/Runtime.js
|
9732 |
+
|
9733 |
+
/**
|
9734 |
+
* Runtime.js
|
9735 |
+
*
|
9736 |
+
* Copyright 2013, Moxiecode Systems AB
|
9737 |
+
* Released under GPL License.
|
9738 |
+
*
|
9739 |
+
* License: http://www.plupload.com/license
|
9740 |
+
* Contributing: http://www.plupload.com/contributing
|
9741 |
+
*/
|
9742 |
+
|
9743 |
+
/*global ActiveXObject:true */
|
9744 |
+
|
9745 |
+
/**
|
9746 |
+
Defines constructor for Flash runtime.
|
9747 |
+
|
9748 |
+
@class moxie/runtime/flash/Runtime
|
9749 |
+
@private
|
9750 |
+
*/
|
9751 |
+
define("moxie/runtime/flash/Runtime", [
|
9752 |
+
"moxie/core/utils/Basic",
|
9753 |
+
"moxie/core/utils/Env",
|
9754 |
+
"moxie/core/utils/Dom",
|
9755 |
+
"moxie/core/Exceptions",
|
9756 |
+
"moxie/runtime/Runtime"
|
9757 |
+
], function(Basic, Env, Dom, x, Runtime) {
|
9758 |
+
|
9759 |
+
var type = 'flash', extensions = {};
|
9760 |
+
|
9761 |
+
/**
|
9762 |
+
Get the version of the Flash Player
|
9763 |
+
|
9764 |
+
@method getShimVersion
|
9765 |
+
@private
|
9766 |
+
@return {Number} Flash Player version
|
9767 |
+
*/
|
9768 |
+
function getShimVersion() {
|
9769 |
+
var version;
|
9770 |
+
|
9771 |
+
try {
|
9772 |
+
version = navigator.plugins['Shockwave Flash'];
|
9773 |
+
version = version.description;
|
9774 |
+
} catch (e1) {
|
9775 |
+
try {
|
9776 |
+
version = new ActiveXObject('ShockwaveFlash.ShockwaveFlash').GetVariable('$version');
|
9777 |
+
} catch (e2) {
|
9778 |
+
version = '0.0';
|
9779 |
+
}
|
9780 |
+
}
|
9781 |
+
version = version.match(/\d+/g);
|
9782 |
+
return parseFloat(version[0] + '.' + version[1]);
|
9783 |
+
}
|
9784 |
+
|
9785 |
+
|
9786 |
+
/**
|
9787 |
+
Cross-browser SWF removal
|
9788 |
+
- Especially needed to safely and completely remove a SWF in Internet Explorer
|
9789 |
+
|
9790 |
+
Originated from SWFObject v2.2 <http://code.google.com/p/swfobject/>
|
9791 |
+
*/
|
9792 |
+
function removeSWF(id) {
|
9793 |
+
var obj = Dom.get(id);
|
9794 |
+
if (obj && obj.nodeName == "OBJECT") {
|
9795 |
+
if (Env.browser === 'IE') {
|
9796 |
+
obj.style.display = "none";
|
9797 |
+
(function onInit(){
|
9798 |
+
// http://msdn.microsoft.com/en-us/library/ie/ms534360(v=vs.85).aspx
|
9799 |
+
if (obj.readyState == 4) {
|
9800 |
+
removeObjectInIE(id);
|
9801 |
+
}
|
9802 |
+
else {
|
9803 |
+
setTimeout(onInit, 10);
|
9804 |
+
}
|
9805 |
+
})();
|
9806 |
+
}
|
9807 |
+
else {
|
9808 |
+
obj.parentNode.removeChild(obj);
|
9809 |
+
}
|
9810 |
+
}
|
9811 |
+
}
|
9812 |
+
|
9813 |
+
|
9814 |
+
function removeObjectInIE(id) {
|
9815 |
+
var obj = Dom.get(id);
|
9816 |
+
if (obj) {
|
9817 |
+
for (var i in obj) {
|
9818 |
+
if (typeof obj[i] == "function") {
|
9819 |
+
obj[i] = null;
|
9820 |
+
}
|
9821 |
+
}
|
9822 |
+
obj.parentNode.removeChild(obj);
|
9823 |
+
}
|
9824 |
+
}
|
9825 |
+
|
9826 |
+
/**
|
9827 |
+
Constructor for the Flash Runtime
|
9828 |
+
*/
|
9829 |
+
function FlashRuntime(options) {
|
9830 |
+
var I = this, initTimer;
|
9831 |
+
|
9832 |
+
options = Basic.extend({ swf_url: Env.swf_url }, options);
|
9833 |
+
|
9834 |
+
Runtime.call(this, options, type, {
|
9835 |
+
access_binary: function(value) {
|
9836 |
+
return value && I.mode === 'browser';
|
9837 |
+
},
|
9838 |
+
access_image_binary: function(value) {
|
9839 |
+
return value && I.mode === 'browser';
|
9840 |
+
},
|
9841 |
+
display_media: Runtime.capTest(defined('moxie/image/Image')),
|
9842 |
+
do_cors: Runtime.capTrue,
|
9843 |
+
drag_and_drop: false,
|
9844 |
+
report_upload_progress: function() {
|
9845 |
+
return I.mode === 'client';
|
9846 |
+
},
|
9847 |
+
resize_image: Runtime.capTrue,
|
9848 |
+
return_response_headers: false,
|
9849 |
+
return_response_type: function(responseType) {
|
9850 |
+
if (responseType === 'json' && !!window.JSON) {
|
9851 |
+
return true;
|
9852 |
+
}
|
9853 |
+
return !Basic.arrayDiff(responseType, ['', 'text', 'document']) || I.mode === 'browser';
|
9854 |
+
},
|
9855 |
+
return_status_code: function(code) {
|
9856 |
+
return I.mode === 'browser' || !Basic.arrayDiff(code, [200, 404]);
|
9857 |
+
},
|
9858 |
+
select_file: Runtime.capTrue,
|
9859 |
+
select_multiple: Runtime.capTrue,
|
9860 |
+
send_binary_string: function(value) {
|
9861 |
+
return value && I.mode === 'browser';
|
9862 |
+
},
|
9863 |
+
send_browser_cookies: function(value) {
|
9864 |
+
return value && I.mode === 'browser';
|
9865 |
+
},
|
9866 |
+
send_custom_headers: function(value) {
|
9867 |
+
return value && I.mode === 'browser';
|
9868 |
+
},
|
9869 |
+
send_multipart: Runtime.capTrue,
|
9870 |
+
slice_blob: function(value) {
|
9871 |
+
return value && I.mode === 'browser';
|
9872 |
+
},
|
9873 |
+
stream_upload: function(value) {
|
9874 |
+
return value && I.mode === 'browser';
|
9875 |
+
},
|
9876 |
+
summon_file_dialog: false,
|
9877 |
+
upload_filesize: function(size) {
|
9878 |
+
return Basic.parseSizeStr(size) <= 2097152 || I.mode === 'client';
|
9879 |
+
},
|
9880 |
+
use_http_method: function(methods) {
|
9881 |
+
return !Basic.arrayDiff(methods, ['GET', 'POST']);
|
9882 |
+
}
|
9883 |
+
}, {
|
9884 |
+
// capabilities that require specific mode
|
9885 |
+
access_binary: function(value) {
|
9886 |
+
return value ? 'browser' : 'client';
|
9887 |
+
},
|
9888 |
+
access_image_binary: function(value) {
|
9889 |
+
return value ? 'browser' : 'client';
|
9890 |
+
},
|
9891 |
+
report_upload_progress: function(value) {
|
9892 |
+
return value ? 'browser' : 'client';
|
9893 |
+
},
|
9894 |
+
return_response_type: function(responseType) {
|
9895 |
+
return Basic.arrayDiff(responseType, ['', 'text', 'json', 'document']) ? 'browser' : ['client', 'browser'];
|
9896 |
+
},
|
9897 |
+
return_status_code: function(code) {
|
9898 |
+
return Basic.arrayDiff(code, [200, 404]) ? 'browser' : ['client', 'browser'];
|
9899 |
+
},
|
9900 |
+
send_binary_string: function(value) {
|
9901 |
+
return value ? 'browser' : 'client';
|
9902 |
+
},
|
9903 |
+
send_browser_cookies: function(value) {
|
9904 |
+
return value ? 'browser' : 'client';
|
9905 |
+
},
|
9906 |
+
send_custom_headers: function(value) {
|
9907 |
+
return value ? 'browser' : 'client';
|
9908 |
+
},
|
9909 |
+
slice_blob: function(value) {
|
9910 |
+
return value ? 'browser' : 'client';
|
9911 |
+
},
|
9912 |
+
stream_upload: function(value) {
|
9913 |
+
return value ? 'client' : 'browser';
|
9914 |
+
},
|
9915 |
+
upload_filesize: function(size) {
|
9916 |
+
return Basic.parseSizeStr(size) >= 2097152 ? 'client' : 'browser';
|
9917 |
+
}
|
9918 |
+
}, 'client');
|
9919 |
+
|
9920 |
+
|
9921 |
+
// minimal requirement for Flash Player version
|
9922 |
+
if (getShimVersion() < 11.3) {
|
9923 |
+
if (MXI_DEBUG && Env.debug.runtime) {
|
9924 |
+
Env.log("\tFlash didn't meet minimal version requirement (11.3).");
|
9925 |
+
}
|
9926 |
+
|
9927 |
+
this.mode = false; // with falsy mode, runtime won't operable, no matter what the mode was before
|
9928 |
+
}
|
9929 |
+
|
9930 |
+
|
9931 |
+
Basic.extend(this, {
|
9932 |
+
|
9933 |
+
getShim: function() {
|
9934 |
+
return Dom.get(this.uid);
|
9935 |
+
},
|
9936 |
+
|
9937 |
+
shimExec: function(component, action) {
|
9938 |
+
var args = [].slice.call(arguments, 2);
|
9939 |
+
return I.getShim().exec(this.uid, component, action, args);
|
9940 |
+
},
|
9941 |
+
|
9942 |
+
init: function() {
|
9943 |
+
var html, el, container;
|
9944 |
+
|
9945 |
+
container = this.getShimContainer();
|
9946 |
+
|
9947 |
+
// if not the minimal height, shims are not initialized in older browsers (e.g FF3.6, IE6,7,8, Safari 4.0,5.0, etc)
|
9948 |
+
Basic.extend(container.style, {
|
9949 |
+
position: 'absolute',
|
9950 |
+
top: '-8px',
|
9951 |
+
left: '-8px',
|
9952 |
+
width: '9px',
|
9953 |
+
height: '9px',
|
9954 |
+
overflow: 'hidden'
|
9955 |
+
});
|
9956 |
+
|
9957 |
+
// insert flash object
|
9958 |
+
html = '<object id="' + this.uid + '" type="application/x-shockwave-flash" data="' + options.swf_url + '" ';
|
9959 |
+
|
9960 |
+
if (Env.browser === 'IE') {
|
9961 |
+
html += 'classid="clsid:d27cdb6e-ae6d-11cf-96b8-444553540000" ';
|
9962 |
+
}
|
9963 |
+
|
9964 |
+
html += 'width="100%" height="100%" style="outline:0">' +
|
9965 |
+
'<param name="movie" value="' + options.swf_url + '" />' +
|
9966 |
+
'<param name="flashvars" value="uid=' + escape(this.uid) + '&target=' + Runtime.getGlobalEventTarget() + '" />' +
|
9967 |
+
'<param name="wmode" value="transparent" />' +
|
9968 |
+
'<param name="allowscriptaccess" value="always" />' +
|
9969 |
+
'</object>';
|
9970 |
+
|
9971 |
+
if (Env.browser === 'IE') {
|
9972 |
+
el = document.createElement('div');
|
9973 |
+
container.appendChild(el);
|
9974 |
+
el.outerHTML = html;
|
9975 |
+
el = container = null; // just in case
|
9976 |
+
} else {
|
9977 |
+
container.innerHTML = html;
|
9978 |
+
}
|
9979 |
+
|
9980 |
+
// Init is dispatched by the shim
|
9981 |
+
initTimer = setTimeout(function() {
|
9982 |
+
if (I && !I.initialized) { // runtime might be already destroyed by this moment
|
9983 |
+
I.trigger("Error", new x.RuntimeError(x.RuntimeError.NOT_INIT_ERR));
|
9984 |
+
|
9985 |
+
if (MXI_DEBUG && Env.debug.runtime) {
|
9986 |
+
Env.log("\tFlash failed to initialize within a specified period of time (typically 5s).");
|
9987 |
+
}
|
9988 |
+
}
|
9989 |
+
}, 5000);
|
9990 |
+
},
|
9991 |
+
|
9992 |
+
destroy: (function(destroy) { // extend default destroy method
|
9993 |
+
return function() {
|
9994 |
+
removeSWF(I.uid); // SWF removal requires special care in IE
|
9995 |
+
|
9996 |
+
destroy.call(I);
|
9997 |
+
clearTimeout(initTimer); // initialization check might be still onwait
|
9998 |
+
options = initTimer = destroy = I = null;
|
9999 |
+
};
|
10000 |
+
}(this.destroy))
|
10001 |
+
|
10002 |
+
}, extensions);
|
10003 |
+
}
|
10004 |
+
|
10005 |
+
Runtime.addConstructor(type, FlashRuntime);
|
10006 |
+
|
10007 |
+
return extensions;
|
10008 |
+
});
|
10009 |
+
|
10010 |
+
// Included from: src/javascript/runtime/flash/file/Blob.js
|
10011 |
+
|
10012 |
+
/**
|
10013 |
+
* Blob.js
|
10014 |
+
*
|
10015 |
+
* Copyright 2013, Moxiecode Systems AB
|
10016 |
+
* Released under GPL License.
|
10017 |
+
*
|
10018 |
+
* License: http://www.plupload.com/license
|
10019 |
+
* Contributing: http://www.plupload.com/contributing
|
10020 |
+
*/
|
10021 |
+
|
10022 |
+
/**
|
10023 |
+
@class moxie/runtime/flash/file/Blob
|
10024 |
+
@private
|
10025 |
+
*/
|
10026 |
+
define("moxie/runtime/flash/file/Blob", [
|
10027 |
+
"moxie/runtime/flash/Runtime",
|
10028 |
+
"moxie/file/Blob"
|
10029 |
+
], function(extensions, Blob) {
|
10030 |
+
|
10031 |
+
var FlashBlob = {
|
10032 |
+
slice: function(blob, start, end, type) {
|
10033 |
+
var self = this.getRuntime();
|
10034 |
+
|
10035 |
+
if (start < 0) {
|
10036 |
+
start = Math.max(blob.size + start, 0);
|
10037 |
+
} else if (start > 0) {
|
10038 |
+
start = Math.min(start, blob.size);
|
10039 |
+
}
|
10040 |
+
|
10041 |
+
if (end < 0) {
|
10042 |
+
end = Math.max(blob.size + end, 0);
|
10043 |
+
} else if (end > 0) {
|
10044 |
+
end = Math.min(end, blob.size);
|
10045 |
+
}
|
10046 |
+
|
10047 |
+
blob = self.shimExec.call(this, 'Blob', 'slice', start, end, type || '');
|
10048 |
+
|
10049 |
+
if (blob) {
|
10050 |
+
blob = new Blob(self.uid, blob);
|
10051 |
+
}
|
10052 |
+
return blob;
|
10053 |
+
}
|
10054 |
+
};
|
10055 |
+
|
10056 |
+
return (extensions.Blob = FlashBlob);
|
10057 |
+
});
|
10058 |
+
|
10059 |
+
// Included from: src/javascript/runtime/flash/file/FileInput.js
|
10060 |
+
|
10061 |
+
/**
|
10062 |
+
* FileInput.js
|
10063 |
+
*
|
10064 |
+
* Copyright 2013, Moxiecode Systems AB
|
10065 |
+
* Released under GPL License.
|
10066 |
+
*
|
10067 |
+
* License: http://www.plupload.com/license
|
10068 |
+
* Contributing: http://www.plupload.com/contributing
|
10069 |
+
*/
|
10070 |
+
|
10071 |
+
/**
|
10072 |
+
@class moxie/runtime/flash/file/FileInput
|
10073 |
+
@private
|
10074 |
+
*/
|
10075 |
+
define("moxie/runtime/flash/file/FileInput", [
|
10076 |
+
"moxie/runtime/flash/Runtime",
|
10077 |
+
"moxie/file/File",
|
10078 |
+
"moxie/core/utils/Dom",
|
10079 |
+
"moxie/core/utils/Basic"
|
10080 |
+
], function(extensions, File, Dom, Basic) {
|
10081 |
+
|
10082 |
+
var FileInput = {
|
10083 |
+
init: function(options) {
|
10084 |
+
var comp = this, I = this.getRuntime();
|
10085 |
+
var browseButton = Dom.get(options.browse_button);
|
10086 |
+
|
10087 |
+
if (browseButton) {
|
10088 |
+
browseButton.setAttribute('tabindex', -1);
|
10089 |
+
browseButton = null;
|
10090 |
+
}
|
10091 |
+
|
10092 |
+
this.bind("Change", function() {
|
10093 |
+
var files = I.shimExec.call(comp, 'FileInput', 'getFiles');
|
10094 |
+
comp.files = [];
|
10095 |
+
Basic.each(files, function(file) {
|
10096 |
+
comp.files.push(new File(I.uid, file));
|
10097 |
+
});
|
10098 |
+
}, 999);
|
10099 |
+
|
10100 |
+
this.getRuntime().shimExec.call(this, 'FileInput', 'init', {
|
10101 |
+
accept: options.accept,
|
10102 |
+
multiple: options.multiple
|
10103 |
+
});
|
10104 |
+
|
10105 |
+
this.trigger('ready');
|
10106 |
+
}
|
10107 |
+
};
|
10108 |
+
|
10109 |
+
return (extensions.FileInput = FileInput);
|
10110 |
+
});
|
10111 |
+
|
10112 |
+
// Included from: src/javascript/runtime/flash/file/FileReader.js
|
10113 |
+
|
10114 |
+
/**
|
10115 |
+
* FileReader.js
|
10116 |
+
*
|
10117 |
+
* Copyright 2013, Moxiecode Systems AB
|
10118 |
+
* Released under GPL License.
|
10119 |
+
*
|
10120 |
+
* License: http://www.plupload.com/license
|
10121 |
+
* Contributing: http://www.plupload.com/contributing
|
10122 |
+
*/
|
10123 |
+
|
10124 |
+
/**
|
10125 |
+
@class moxie/runtime/flash/file/FileReader
|
10126 |
+
@private
|
10127 |
+
*/
|
10128 |
+
define("moxie/runtime/flash/file/FileReader", [
|
10129 |
+
"moxie/runtime/flash/Runtime",
|
10130 |
+
"moxie/core/utils/Encode"
|
10131 |
+
], function(extensions, Encode) {
|
10132 |
+
|
10133 |
+
function _formatData(data, op) {
|
10134 |
+
switch (op) {
|
10135 |
+
case 'readAsText':
|
10136 |
+
return Encode.atob(data, 'utf8');
|
10137 |
+
case 'readAsBinaryString':
|
10138 |
+
return Encode.atob(data);
|
10139 |
+
case 'readAsDataURL':
|
10140 |
+
return data;
|
10141 |
+
}
|
10142 |
+
return null;
|
10143 |
+
}
|
10144 |
+
|
10145 |
+
var FileReader = {
|
10146 |
+
read: function(op, blob) {
|
10147 |
+
var comp = this;
|
10148 |
+
|
10149 |
+
comp.result = '';
|
10150 |
+
|
10151 |
+
// special prefix for DataURL read mode
|
10152 |
+
if (op === 'readAsDataURL') {
|
10153 |
+
comp.result = 'data:' + (blob.type || '') + ';base64,';
|
10154 |
+
}
|
10155 |
+
|
10156 |
+
comp.bind('Progress', function(e, data) {
|
10157 |
+
if (data) {
|
10158 |
+
comp.result += _formatData(data, op);
|
10159 |
+
}
|
10160 |
+
}, 999);
|
10161 |
+
|
10162 |
+
return comp.getRuntime().shimExec.call(this, 'FileReader', 'readAsBase64', blob.uid);
|
10163 |
+
}
|
10164 |
+
};
|
10165 |
+
|
10166 |
+
return (extensions.FileReader = FileReader);
|
10167 |
+
});
|
10168 |
+
|
10169 |
+
// Included from: src/javascript/runtime/flash/file/FileReaderSync.js
|
10170 |
+
|
10171 |
+
/**
|
10172 |
+
* FileReaderSync.js
|
10173 |
+
*
|
10174 |
+
* Copyright 2013, Moxiecode Systems AB
|
10175 |
+
* Released under GPL License.
|
10176 |
+
*
|
10177 |
+
* License: http://www.plupload.com/license
|
10178 |
+
* Contributing: http://www.plupload.com/contributing
|
10179 |
+
*/
|
10180 |
+
|
10181 |
+
/**
|
10182 |
+
@class moxie/runtime/flash/file/FileReaderSync
|
10183 |
+
@private
|
10184 |
+
*/
|
10185 |
+
define("moxie/runtime/flash/file/FileReaderSync", [
|
10186 |
+
"moxie/runtime/flash/Runtime",
|
10187 |
+
"moxie/core/utils/Encode"
|
10188 |
+
], function(extensions, Encode) {
|
10189 |
+
|
10190 |
+
function _formatData(data, op) {
|
10191 |
+
switch (op) {
|
10192 |
+
case 'readAsText':
|
10193 |
+
return Encode.atob(data, 'utf8');
|
10194 |
+
case 'readAsBinaryString':
|
10195 |
+
return Encode.atob(data);
|
10196 |
+
case 'readAsDataURL':
|
10197 |
+
return data;
|
10198 |
+
}
|
10199 |
+
return null;
|
10200 |
+
}
|
10201 |
+
|
10202 |
+
var FileReaderSync = {
|
10203 |
+
read: function(op, blob) {
|
10204 |
+
var result, self = this.getRuntime();
|
10205 |
+
|
10206 |
+
result = self.shimExec.call(this, 'FileReaderSync', 'readAsBase64', blob.uid);
|
10207 |
+
if (!result) {
|
10208 |
+
return null; // or throw ex
|
10209 |
+
}
|
10210 |
+
|
10211 |
+
// special prefix for DataURL read mode
|
10212 |
+
if (op === 'readAsDataURL') {
|
10213 |
+
result = 'data:' + (blob.type || '') + ';base64,' + result;
|
10214 |
+
}
|
10215 |
+
|
10216 |
+
return _formatData(result, op, blob.type);
|
10217 |
+
}
|
10218 |
+
};
|
10219 |
+
|
10220 |
+
return (extensions.FileReaderSync = FileReaderSync);
|
10221 |
+
});
|
10222 |
+
|
10223 |
+
// Included from: src/javascript/runtime/flash/runtime/Transporter.js
|
10224 |
+
|
10225 |
+
/**
|
10226 |
+
* Transporter.js
|
10227 |
+
*
|
10228 |
+
* Copyright 2013, Moxiecode Systems AB
|
10229 |
+
* Released under GPL License.
|
10230 |
+
*
|
10231 |
+
* License: http://www.plupload.com/license
|
10232 |
+
* Contributing: http://www.plupload.com/contributing
|
10233 |
+
*/
|
10234 |
+
|
10235 |
+
/**
|
10236 |
+
@class moxie/runtime/flash/runtime/Transporter
|
10237 |
+
@private
|
10238 |
+
*/
|
10239 |
+
define("moxie/runtime/flash/runtime/Transporter", [
|
10240 |
+
"moxie/runtime/flash/Runtime",
|
10241 |
+
"moxie/file/Blob"
|
10242 |
+
], function(extensions, Blob) {
|
10243 |
+
|
10244 |
+
var Transporter = {
|
10245 |
+
getAsBlob: function(type) {
|
10246 |
+
var self = this.getRuntime()
|
10247 |
+
, blob = self.shimExec.call(this, 'Transporter', 'getAsBlob', type)
|
10248 |
+
;
|
10249 |
+
if (blob) {
|
10250 |
+
return new Blob(self.uid, blob);
|
10251 |
+
}
|
10252 |
+
return null;
|
10253 |
+
}
|
10254 |
+
};
|
10255 |
+
|
10256 |
+
return (extensions.Transporter = Transporter);
|
10257 |
+
});
|
10258 |
+
|
10259 |
+
// Included from: src/javascript/runtime/flash/xhr/XMLHttpRequest.js
|
10260 |
+
|
10261 |
+
/**
|
10262 |
+
* XMLHttpRequest.js
|
10263 |
+
*
|
10264 |
+
* Copyright 2013, Moxiecode Systems AB
|
10265 |
+
* Released under GPL License.
|
10266 |
+
*
|
10267 |
+
* License: http://www.plupload.com/license
|
10268 |
+
* Contributing: http://www.plupload.com/contributing
|
10269 |
+
*/
|
10270 |
+
|
10271 |
+
/**
|
10272 |
+
@class moxie/runtime/flash/xhr/XMLHttpRequest
|
10273 |
+
@private
|
10274 |
+
*/
|
10275 |
+
define("moxie/runtime/flash/xhr/XMLHttpRequest", [
|
10276 |
+
"moxie/runtime/flash/Runtime",
|
10277 |
+
"moxie/core/utils/Basic",
|
10278 |
+
"moxie/file/Blob",
|
10279 |
+
"moxie/file/File",
|
10280 |
+
"moxie/file/FileReaderSync",
|
10281 |
+
"moxie/runtime/flash/file/FileReaderSync",
|
10282 |
+
"moxie/xhr/FormData",
|
10283 |
+
"moxie/runtime/Transporter",
|
10284 |
+
"moxie/runtime/flash/runtime/Transporter"
|
10285 |
+
], function(extensions, Basic, Blob, File, FileReaderSync, FileReaderSyncFlash, FormData, Transporter, TransporterFlash) {
|
10286 |
+
|
10287 |
+
var XMLHttpRequest = {
|
10288 |
+
|
10289 |
+
send: function(meta, data) {
|
10290 |
+
var target = this, self = target.getRuntime();
|
10291 |
+
|
10292 |
+
function send() {
|
10293 |
+
meta.transport = self.mode;
|
10294 |
+
self.shimExec.call(target, 'XMLHttpRequest', 'send', meta, data);
|
10295 |
+
}
|
10296 |
+
|
10297 |
+
|
10298 |
+
function appendBlob(name, blob) {
|
10299 |
+
self.shimExec.call(target, 'XMLHttpRequest', 'appendBlob', name, blob.uid);
|
10300 |
+
data = null;
|
10301 |
+
send();
|
10302 |
+
}
|
10303 |
+
|
10304 |
+
|
10305 |
+
function attachBlob(blob, cb) {
|
10306 |
+
var tr = new Transporter();
|
10307 |
+
|
10308 |
+
tr.bind("TransportingComplete", function() {
|
10309 |
+
cb(this.result);
|
10310 |
+
});
|
10311 |
+
|
10312 |
+
tr.transport(blob.getSource(), blob.type, {
|
10313 |
+
ruid: self.uid
|
10314 |
+
});
|
10315 |
+
}
|
10316 |
+
|
10317 |
+
// copy over the headers if any
|
10318 |
+
if (!Basic.isEmptyObj(meta.headers)) {
|
10319 |
+
Basic.each(meta.headers, function(value, header) {
|
10320 |
+
self.shimExec.call(target, 'XMLHttpRequest', 'setRequestHeader', header, value.toString()); // Silverlight doesn't accept integers into the arguments of type object
|
10321 |
+
});
|
10322 |
+
}
|
10323 |
+
|
10324 |
+
// transfer over multipart params and blob itself
|
10325 |
+
if (data instanceof FormData) {
|
10326 |
+
var blobField;
|
10327 |
+
data.each(function(value, name) {
|
10328 |
+
if (value instanceof Blob) {
|
10329 |
+
blobField = name;
|
10330 |
+
} else {
|
10331 |
+
self.shimExec.call(target, 'XMLHttpRequest', 'append', name, value);
|
10332 |
+
}
|
10333 |
+
});
|
10334 |
+
|
10335 |
+
if (!data.hasBlob()) {
|
10336 |
+
data = null;
|
10337 |
+
send();
|
10338 |
+
} else {
|
10339 |
+
var blob = data.getBlob();
|
10340 |
+
if (blob.isDetached()) {
|
10341 |
+
attachBlob(blob, function(attachedBlob) {
|
10342 |
+
blob.destroy();
|
10343 |
+
appendBlob(blobField, attachedBlob);
|
10344 |
+
});
|
10345 |
+
} else {
|
10346 |
+
appendBlob(blobField, blob);
|
10347 |
+
}
|
10348 |
+
}
|
10349 |
+
} else if (data instanceof Blob) {
|
10350 |
+
if (data.isDetached()) {
|
10351 |
+
attachBlob(data, function(attachedBlob) {
|
10352 |
+
data.destroy();
|
10353 |
+
data = attachedBlob.uid;
|
10354 |
+
send();
|
10355 |
+
});
|
10356 |
+
} else {
|
10357 |
+
data = data.uid;
|
10358 |
+
send();
|
10359 |
+
}
|
10360 |
+
} else {
|
10361 |
+
send();
|
10362 |
+
}
|
10363 |
+
},
|
10364 |
+
|
10365 |
+
getResponse: function(responseType) {
|
10366 |
+
var frs, blob, self = this.getRuntime();
|
10367 |
+
|
10368 |
+
blob = self.shimExec.call(this, 'XMLHttpRequest', 'getResponseAsBlob');
|
10369 |
+
|
10370 |
+
if (blob) {
|
10371 |
+
blob = new File(self.uid, blob);
|
10372 |
+
|
10373 |
+
if ('blob' === responseType) {
|
10374 |
+
return blob;
|
10375 |
+
}
|
10376 |
+
|
10377 |
+
try {
|
10378 |
+
frs = new FileReaderSync();
|
10379 |
+
|
10380 |
+
if (!!~Basic.inArray(responseType, ["", "text"])) {
|
10381 |
+
return frs.readAsText(blob);
|
10382 |
+
} else if ('json' === responseType && !!window.JSON) {
|
10383 |
+
return JSON.parse(frs.readAsText(blob));
|
10384 |
+
}
|
10385 |
+
} finally {
|
10386 |
+
blob.destroy();
|
10387 |
+
}
|
10388 |
+
}
|
10389 |
+
return null;
|
10390 |
+
},
|
10391 |
+
|
10392 |
+
abort: function(upload_complete_flag) {
|
10393 |
+
var self = this.getRuntime();
|
10394 |
+
|
10395 |
+
self.shimExec.call(this, 'XMLHttpRequest', 'abort');
|
10396 |
+
|
10397 |
+
this.dispatchEvent('readystatechange');
|
10398 |
+
// this.dispatchEvent('progress');
|
10399 |
+
this.dispatchEvent('abort');
|
10400 |
+
|
10401 |
+
//if (!upload_complete_flag) {
|
10402 |
+
// this.dispatchEvent('uploadprogress');
|
10403 |
+
//}
|
10404 |
+
}
|
10405 |
+
};
|
10406 |
+
|
10407 |
+
return (extensions.XMLHttpRequest = XMLHttpRequest);
|
10408 |
+
});
|
10409 |
+
|
10410 |
+
// Included from: src/javascript/runtime/flash/image/Image.js
|
10411 |
+
|
10412 |
+
/**
|
10413 |
+
* Image.js
|
10414 |
+
*
|
10415 |
+
* Copyright 2013, Moxiecode Systems AB
|
10416 |
+
* Released under GPL License.
|
10417 |
+
*
|
10418 |
+
* License: http://www.plupload.com/license
|
10419 |
+
* Contributing: http://www.plupload.com/contributing
|
10420 |
+
*/
|
10421 |
+
|
10422 |
+
/**
|
10423 |
+
@class moxie/runtime/flash/image/Image
|
10424 |
+
@private
|
10425 |
+
*/
|
10426 |
+
define("moxie/runtime/flash/image/Image", [
|
10427 |
+
"moxie/runtime/flash/Runtime",
|
10428 |
+
"moxie/core/utils/Basic",
|
10429 |
+
"moxie/runtime/Transporter",
|
10430 |
+
"moxie/file/Blob",
|
10431 |
+
"moxie/file/FileReaderSync"
|
10432 |
+
], function(extensions, Basic, Transporter, Blob, FileReaderSync) {
|
10433 |
+
|
10434 |
+
var Image = {
|
10435 |
+
loadFromBlob: function(blob) {
|
10436 |
+
var comp = this, self = comp.getRuntime();
|
10437 |
+
|
10438 |
+
function exec(srcBlob) {
|
10439 |
+
self.shimExec.call(comp, 'Image', 'loadFromBlob', srcBlob.uid);
|
10440 |
+
comp = self = null;
|
10441 |
+
}
|
10442 |
+
|
10443 |
+
if (blob.isDetached()) { // binary string
|
10444 |
+
var tr = new Transporter();
|
10445 |
+
tr.bind("TransportingComplete", function() {
|
10446 |
+
exec(tr.result.getSource());
|
10447 |
+
});
|
10448 |
+
tr.transport(blob.getSource(), blob.type, { ruid: self.uid });
|
10449 |
+
} else {
|
10450 |
+
exec(blob.getSource());
|
10451 |
+
}
|
10452 |
+
},
|
10453 |
+
|
10454 |
+
loadFromImage: function(img) {
|
10455 |
+
var self = this.getRuntime();
|
10456 |
+
return self.shimExec.call(this, 'Image', 'loadFromImage', img.uid);
|
10457 |
+
},
|
10458 |
+
|
10459 |
+
getInfo: function() {
|
10460 |
+
var self = this.getRuntime()
|
10461 |
+
, info = self.shimExec.call(this, 'Image', 'getInfo')
|
10462 |
+
;
|
10463 |
+
|
10464 |
+
if (info.meta && info.meta.thumb && info.meta.thumb.data && !(self.meta.thumb.data instanceof Blob)) {
|
10465 |
+
info.meta.thumb.data = new Blob(self.uid, info.meta.thumb.data);
|
10466 |
+
}
|
10467 |
+
return info;
|
10468 |
+
},
|
10469 |
+
|
10470 |
+
getAsBlob: function(type, quality) {
|
10471 |
+
var self = this.getRuntime()
|
10472 |
+
, blob = self.shimExec.call(this, 'Image', 'getAsBlob', type, quality)
|
10473 |
+
;
|
10474 |
+
if (blob) {
|
10475 |
+
return new Blob(self.uid, blob);
|
10476 |
+
}
|
10477 |
+
return null;
|
10478 |
+
},
|
10479 |
+
|
10480 |
+
getAsDataURL: function() {
|
10481 |
+
var self = this.getRuntime()
|
10482 |
+
, blob = self.Image.getAsBlob.apply(this, arguments)
|
10483 |
+
, frs
|
10484 |
+
;
|
10485 |
+
if (!blob) {
|
10486 |
+
return null;
|
10487 |
+
}
|
10488 |
+
frs = new FileReaderSync();
|
10489 |
+
return frs.readAsDataURL(blob);
|
10490 |
+
}
|
10491 |
+
};
|
10492 |
+
|
10493 |
+
return (extensions.Image = Image);
|
10494 |
+
});
|
10495 |
+
|
10496 |
+
// Included from: src/javascript/runtime/silverlight/Runtime.js
|
10497 |
+
|
10498 |
+
/**
|
10499 |
+
* RunTime.js
|
10500 |
+
*
|
10501 |
+
* Copyright 2013, Moxiecode Systems AB
|
10502 |
+
* Released under GPL License.
|
10503 |
+
*
|
10504 |
+
* License: http://www.plupload.com/license
|
10505 |
+
* Contributing: http://www.plupload.com/contributing
|
10506 |
+
*/
|
10507 |
+
|
10508 |
+
/*global ActiveXObject:true */
|
10509 |
+
|
10510 |
+
/**
|
10511 |
+
Defines constructor for Silverlight runtime.
|
10512 |
+
|
10513 |
+
@class moxie/runtime/silverlight/Runtime
|
10514 |
+
@private
|
10515 |
+
*/
|
10516 |
+
define("moxie/runtime/silverlight/Runtime", [
|
10517 |
+
"moxie/core/utils/Basic",
|
10518 |
+
"moxie/core/utils/Env",
|
10519 |
+
"moxie/core/utils/Dom",
|
10520 |
+
"moxie/core/Exceptions",
|
10521 |
+
"moxie/runtime/Runtime"
|
10522 |
+
], function(Basic, Env, Dom, x, Runtime) {
|
10523 |
+
|
10524 |
+
var type = "silverlight", extensions = {};
|
10525 |
+
|
10526 |
+
function isInstalled(version) {
|
10527 |
+
var isVersionSupported = false, control = null, actualVer,
|
10528 |
+
actualVerArray, reqVerArray, requiredVersionPart, actualVersionPart, index = 0;
|
10529 |
+
|
10530 |
+
try {
|
10531 |
+
try {
|
10532 |
+
control = new ActiveXObject('AgControl.AgControl');
|
10533 |
+
|
10534 |
+
if (control.IsVersionSupported(version)) {
|
10535 |
+
isVersionSupported = true;
|
10536 |
+
}
|
10537 |
+
|
10538 |
+
control = null;
|
10539 |
+
} catch (e) {
|
10540 |
+
var plugin = navigator.plugins["Silverlight Plug-In"];
|
10541 |
+
|
10542 |
+
if (plugin) {
|
10543 |
+
actualVer = plugin.description;
|
10544 |
+
|
10545 |
+
if (actualVer === "1.0.30226.2") {
|
10546 |
+
actualVer = "2.0.30226.2";
|
10547 |
+
}
|
10548 |
+
|
10549 |
+
actualVerArray = actualVer.split(".");
|
10550 |
+
|
10551 |
+
while (actualVerArray.length > 3) {
|
10552 |
+
actualVerArray.pop();
|
10553 |
+
}
|
10554 |
+
|
10555 |
+
while ( actualVerArray.length < 4) {
|
10556 |
+
actualVerArray.push(0);
|
10557 |
+
}
|
10558 |
+
|
10559 |
+
reqVerArray = version.split(".");
|
10560 |
+
|
10561 |
+
while (reqVerArray.length > 4) {
|
10562 |
+
reqVerArray.pop();
|
10563 |
+
}
|
10564 |
+
|
10565 |
+
do {
|
10566 |
+
requiredVersionPart = parseInt(reqVerArray[index], 10);
|
10567 |
+
actualVersionPart = parseInt(actualVerArray[index], 10);
|
10568 |
+
index++;
|
10569 |
+
} while (index < reqVerArray.length && requiredVersionPart === actualVersionPart);
|
10570 |
+
|
10571 |
+
if (requiredVersionPart <= actualVersionPart && !isNaN(requiredVersionPart)) {
|
10572 |
+
isVersionSupported = true;
|
10573 |
+
}
|
10574 |
+
}
|
10575 |
+
}
|
10576 |
+
} catch (e2) {
|
10577 |
+
isVersionSupported = false;
|
10578 |
+
}
|
10579 |
+
|
10580 |
+
return isVersionSupported;
|
10581 |
+
}
|
10582 |
+
|
10583 |
+
/**
|
10584 |
+
Constructor for the Silverlight Runtime
|
10585 |
+
*/
|
10586 |
+
function SilverlightRuntime(options) {
|
10587 |
+
var I = this, initTimer;
|
10588 |
+
|
10589 |
+
options = Basic.extend({ xap_url: Env.xap_url }, options);
|
10590 |
+
|
10591 |
+
Runtime.call(this, options, type, {
|
10592 |
+
access_binary: Runtime.capTrue,
|
10593 |
+
access_image_binary: Runtime.capTrue,
|
10594 |
+
display_media: Runtime.capTest(defined('moxie/image/Image')),
|
10595 |
+
do_cors: Runtime.capTrue,
|
10596 |
+
drag_and_drop: false,
|
10597 |
+
report_upload_progress: Runtime.capTrue,
|
10598 |
+
resize_image: Runtime.capTrue,
|
10599 |
+
return_response_headers: function(value) {
|
10600 |
+
return value && I.mode === 'client';
|
10601 |
+
},
|
10602 |
+
return_response_type: function(responseType) {
|
10603 |
+
if (responseType !== 'json') {
|
10604 |
+
return true;
|
10605 |
+
} else {
|
10606 |
+
return !!window.JSON;
|
10607 |
+
}
|
10608 |
+
},
|
10609 |
+
return_status_code: function(code) {
|
10610 |
+
return I.mode === 'client' || !Basic.arrayDiff(code, [200, 404]);
|
10611 |
+
},
|
10612 |
+
select_file: Runtime.capTrue,
|
10613 |
+
select_multiple: Runtime.capTrue,
|
10614 |
+
send_binary_string: Runtime.capTrue,
|
10615 |
+
send_browser_cookies: function(value) {
|
10616 |
+
return value && I.mode === 'browser';
|
10617 |
+
},
|
10618 |
+
send_custom_headers: function(value) {
|
10619 |
+
return value && I.mode === 'client';
|
10620 |
+
},
|
10621 |
+
send_multipart: Runtime.capTrue,
|
10622 |
+
slice_blob: Runtime.capTrue,
|
10623 |
+
stream_upload: true,
|
10624 |
+
summon_file_dialog: false,
|
10625 |
+
upload_filesize: Runtime.capTrue,
|
10626 |
+
use_http_method: function(methods) {
|
10627 |
+
return I.mode === 'client' || !Basic.arrayDiff(methods, ['GET', 'POST']);
|
10628 |
+
}
|
10629 |
+
}, {
|
10630 |
+
// capabilities that require specific mode
|
10631 |
+
return_response_headers: function(value) {
|
10632 |
+
return value ? 'client' : 'browser';
|
10633 |
+
},
|
10634 |
+
return_status_code: function(code) {
|
10635 |
+
return Basic.arrayDiff(code, [200, 404]) ? 'client' : ['client', 'browser'];
|
10636 |
+
},
|
10637 |
+
send_browser_cookies: function(value) {
|
10638 |
+
return value ? 'browser' : 'client';
|
10639 |
+
},
|
10640 |
+
send_custom_headers: function(value) {
|
10641 |
+
return value ? 'client' : 'browser';
|
10642 |
+
},
|
10643 |
+
use_http_method: function(methods) {
|
10644 |
+
return Basic.arrayDiff(methods, ['GET', 'POST']) ? 'client' : ['client', 'browser'];
|
10645 |
+
}
|
10646 |
+
});
|
10647 |
+
|
10648 |
+
|
10649 |
+
// minimal requirement
|
10650 |
+
if (!isInstalled('2.0.31005.0') || Env.browser === 'Opera') {
|
10651 |
+
if (MXI_DEBUG && Env.debug.runtime) {
|
10652 |
+
Env.log("\tSilverlight is not installed or minimal version (2.0.31005.0) requirement not met (not likely).");
|
10653 |
+
}
|
10654 |
+
|
10655 |
+
this.mode = false;
|
10656 |
+
}
|
10657 |
+
|
10658 |
+
|
10659 |
+
Basic.extend(this, {
|
10660 |
+
getShim: function() {
|
10661 |
+
return Dom.get(this.uid).content.Moxie;
|
10662 |
+
},
|
10663 |
+
|
10664 |
+
shimExec: function(component, action) {
|
10665 |
+
var args = [].slice.call(arguments, 2);
|
10666 |
+
return I.getShim().exec(this.uid, component, action, args);
|
10667 |
+
},
|
10668 |
+
|
10669 |
+
init : function() {
|
10670 |
+
var container;
|
10671 |
+
|
10672 |
+
container = this.getShimContainer();
|
10673 |
+
|
10674 |
+
container.innerHTML = '<object id="' + this.uid + '" data="data:application/x-silverlight," type="application/x-silverlight-2" width="100%" height="100%" style="outline:none;">' +
|
10675 |
+
'<param name="source" value="' + options.xap_url + '"/>' +
|
10676 |
+
'<param name="background" value="Transparent"/>' +
|
10677 |
+
'<param name="windowless" value="true"/>' +
|
10678 |
+
'<param name="enablehtmlaccess" value="true"/>' +
|
10679 |
+
'<param name="initParams" value="uid=' + this.uid + ',target=' + Runtime.getGlobalEventTarget() + '"/>' +
|
10680 |
+
'</object>';
|
10681 |
+
|
10682 |
+
// Init is dispatched by the shim
|
10683 |
+
initTimer = setTimeout(function() {
|
10684 |
+
if (I && !I.initialized) { // runtime might be already destroyed by this moment
|
10685 |
+
I.trigger("Error", new x.RuntimeError(x.RuntimeError.NOT_INIT_ERR));
|
10686 |
+
|
10687 |
+
if (MXI_DEBUG && Env.debug.runtime) {
|
10688 |
+
Env.log("\Silverlight failed to initialize within a specified period of time (5-10s).");
|
10689 |
+
}
|
10690 |
+
}
|
10691 |
+
}, Env.OS !== 'Windows'? 10000 : 5000); // give it more time to initialize in non Windows OS (like Mac)
|
10692 |
+
},
|
10693 |
+
|
10694 |
+
destroy: (function(destroy) { // extend default destroy method
|
10695 |
+
return function() {
|
10696 |
+
destroy.call(I);
|
10697 |
+
clearTimeout(initTimer); // initialization check might be still onwait
|
10698 |
+
options = initTimer = destroy = I = null;
|
10699 |
+
};
|
10700 |
+
}(this.destroy))
|
10701 |
+
|
10702 |
+
}, extensions);
|
10703 |
+
}
|
10704 |
+
|
10705 |
+
Runtime.addConstructor(type, SilverlightRuntime);
|
10706 |
+
|
10707 |
+
return extensions;
|
10708 |
+
});
|
10709 |
+
|
10710 |
+
// Included from: src/javascript/runtime/silverlight/file/Blob.js
|
10711 |
+
|
10712 |
+
/**
|
10713 |
+
* Blob.js
|
10714 |
+
*
|
10715 |
+
* Copyright 2013, Moxiecode Systems AB
|
10716 |
+
* Released under GPL License.
|
10717 |
+
*
|
10718 |
+
* License: http://www.plupload.com/license
|
10719 |
+
* Contributing: http://www.plupload.com/contributing
|
10720 |
+
*/
|
10721 |
+
|
10722 |
+
/**
|
10723 |
+
@class moxie/runtime/silverlight/file/Blob
|
10724 |
+
@private
|
10725 |
+
*/
|
10726 |
+
define("moxie/runtime/silverlight/file/Blob", [
|
10727 |
+
"moxie/runtime/silverlight/Runtime",
|
10728 |
+
"moxie/core/utils/Basic",
|
10729 |
+
"moxie/runtime/flash/file/Blob"
|
10730 |
+
], function(extensions, Basic, Blob) {
|
10731 |
+
return (extensions.Blob = Basic.extend({}, Blob));
|
10732 |
+
});
|
10733 |
+
|
10734 |
+
// Included from: src/javascript/runtime/silverlight/file/FileInput.js
|
10735 |
+
|
10736 |
+
/**
|
10737 |
+
* FileInput.js
|
10738 |
+
*
|
10739 |
+
* Copyright 2013, Moxiecode Systems AB
|
10740 |
+
* Released under GPL License.
|
10741 |
+
*
|
10742 |
+
* License: http://www.plupload.com/license
|
10743 |
+
* Contributing: http://www.plupload.com/contributing
|
10744 |
+
*/
|
10745 |
+
|
10746 |
+
/**
|
10747 |
+
@class moxie/runtime/silverlight/file/FileInput
|
10748 |
+
@private
|
10749 |
+
*/
|
10750 |
+
define("moxie/runtime/silverlight/file/FileInput", [
|
10751 |
+
"moxie/runtime/silverlight/Runtime",
|
10752 |
+
"moxie/file/File",
|
10753 |
+
"moxie/core/utils/Dom",
|
10754 |
+
"moxie/core/utils/Basic"
|
10755 |
+
], function(extensions, File, Dom, Basic) {
|
10756 |
+
|
10757 |
+
function toFilters(accept) {
|
10758 |
+
var filter = '';
|
10759 |
+
for (var i = 0; i < accept.length; i++) {
|
10760 |
+
filter += (filter !== '' ? '|' : '') + accept[i].title + " | *." + accept[i].extensions.replace(/,/g, ';*.');
|
10761 |
+
}
|
10762 |
+
return filter;
|
10763 |
+
}
|
10764 |
+
|
10765 |
+
|
10766 |
+
var FileInput = {
|
10767 |
+
init: function(options) {
|
10768 |
+
var comp = this, I = this.getRuntime();
|
10769 |
+
var browseButton = Dom.get(options.browse_button);
|
10770 |
+
|
10771 |
+
if (browseButton) {
|
10772 |
+
browseButton.setAttribute('tabindex', -1);
|
10773 |
+
browseButton = null;
|
10774 |
+
}
|
10775 |
+
|
10776 |
+
this.bind("Change", function() {
|
10777 |
+
var files = I.shimExec.call(comp, 'FileInput', 'getFiles');
|
10778 |
+
comp.files = [];
|
10779 |
+
Basic.each(files, function(file) {
|
10780 |
+
comp.files.push(new File(I.uid, file));
|
10781 |
+
});
|
10782 |
+
}, 999);
|
10783 |
+
|
10784 |
+
I.shimExec.call(this, 'FileInput', 'init', toFilters(options.accept), options.multiple);
|
10785 |
+
this.trigger('ready');
|
10786 |
+
},
|
10787 |
+
|
10788 |
+
setOption: function(name, value) {
|
10789 |
+
if (name == 'accept') {
|
10790 |
+
value = toFilters(value);
|
10791 |
+
}
|
10792 |
+
this.getRuntime().shimExec.call(this, 'FileInput', 'setOption', name, value);
|
10793 |
+
}
|
10794 |
+
};
|
10795 |
+
|
10796 |
+
return (extensions.FileInput = FileInput);
|
10797 |
+
});
|
10798 |
+
|
10799 |
+
// Included from: src/javascript/runtime/silverlight/file/FileDrop.js
|
10800 |
+
|
10801 |
+
/**
|
10802 |
+
* FileDrop.js
|
10803 |
+
*
|
10804 |
+
* Copyright 2013, Moxiecode Systems AB
|
10805 |
+
* Released under GPL License.
|
10806 |
+
*
|
10807 |
+
* License: http://www.plupload.com/license
|
10808 |
+
* Contributing: http://www.plupload.com/contributing
|
10809 |
+
*/
|
10810 |
+
|
10811 |
+
/**
|
10812 |
+
@class moxie/runtime/silverlight/file/FileDrop
|
10813 |
+
@private
|
10814 |
+
*/
|
10815 |
+
define("moxie/runtime/silverlight/file/FileDrop", [
|
10816 |
+
"moxie/runtime/silverlight/Runtime",
|
10817 |
+
"moxie/core/utils/Dom",
|
10818 |
+
"moxie/core/utils/Events"
|
10819 |
+
], function(extensions, Dom, Events) {
|
10820 |
+
|
10821 |
+
// not exactly useful, since works only in safari (...crickets...)
|
10822 |
+
var FileDrop = {
|
10823 |
+
init: function() {
|
10824 |
+
var comp = this, self = comp.getRuntime(), dropZone;
|
10825 |
+
|
10826 |
+
dropZone = self.getShimContainer();
|
10827 |
+
|
10828 |
+
Events.addEvent(dropZone, 'dragover', function(e) {
|
10829 |
+
e.preventDefault();
|
10830 |
+
e.stopPropagation();
|
10831 |
+
e.dataTransfer.dropEffect = 'copy';
|
10832 |
+
}, comp.uid);
|
10833 |
+
|
10834 |
+
Events.addEvent(dropZone, 'dragenter', function(e) {
|
10835 |
+
e.preventDefault();
|
10836 |
+
var flag = Dom.get(self.uid).dragEnter(e);
|
10837 |
+
// If handled, then stop propagation of event in DOM
|
10838 |
+
if (flag) {
|
10839 |
+
e.stopPropagation();
|
10840 |
+
}
|
10841 |
+
}, comp.uid);
|
10842 |
+
|
10843 |
+
Events.addEvent(dropZone, 'drop', function(e) {
|
10844 |
+
e.preventDefault();
|
10845 |
+
var flag = Dom.get(self.uid).dragDrop(e);
|
10846 |
+
// If handled, then stop propagation of event in DOM
|
10847 |
+
if (flag) {
|
10848 |
+
e.stopPropagation();
|
10849 |
+
}
|
10850 |
+
}, comp.uid);
|
10851 |
+
|
10852 |
+
return self.shimExec.call(this, 'FileDrop', 'init');
|
10853 |
+
}
|
10854 |
+
};
|
10855 |
+
|
10856 |
+
return (extensions.FileDrop = FileDrop);
|
10857 |
+
});
|
10858 |
+
|
10859 |
+
// Included from: src/javascript/runtime/silverlight/file/FileReader.js
|
10860 |
+
|
10861 |
+
/**
|
10862 |
+
* FileReader.js
|
10863 |
+
*
|
10864 |
+
* Copyright 2013, Moxiecode Systems AB
|
10865 |
+
* Released under GPL License.
|
10866 |
+
*
|
10867 |
+
* License: http://www.plupload.com/license
|
10868 |
+
* Contributing: http://www.plupload.com/contributing
|
10869 |
+
*/
|
10870 |
+
|
10871 |
+
/**
|
10872 |
+
@class moxie/runtime/silverlight/file/FileReader
|
10873 |
+
@private
|
10874 |
+
*/
|
10875 |
+
define("moxie/runtime/silverlight/file/FileReader", [
|
10876 |
+
"moxie/runtime/silverlight/Runtime",
|
10877 |
+
"moxie/core/utils/Basic",
|
10878 |
+
"moxie/runtime/flash/file/FileReader"
|
10879 |
+
], function(extensions, Basic, FileReader) {
|
10880 |
+
return (extensions.FileReader = Basic.extend({}, FileReader));
|
10881 |
+
});
|
10882 |
+
|
10883 |
+
// Included from: src/javascript/runtime/silverlight/file/FileReaderSync.js
|
10884 |
+
|
10885 |
+
/**
|
10886 |
+
* FileReaderSync.js
|
10887 |
+
*
|
10888 |
+
* Copyright 2013, Moxiecode Systems AB
|
10889 |
+
* Released under GPL License.
|
10890 |
+
*
|
10891 |
+
* License: http://www.plupload.com/license
|
10892 |
+
* Contributing: http://www.plupload.com/contributing
|
10893 |
+
*/
|
10894 |
+
|
10895 |
+
/**
|
10896 |
+
@class moxie/runtime/silverlight/file/FileReaderSync
|
10897 |
+
@private
|
10898 |
+
*/
|
10899 |
+
define("moxie/runtime/silverlight/file/FileReaderSync", [
|
10900 |
+
"moxie/runtime/silverlight/Runtime",
|
10901 |
+
"moxie/core/utils/Basic",
|
10902 |
+
"moxie/runtime/flash/file/FileReaderSync"
|
10903 |
+
], function(extensions, Basic, FileReaderSync) {
|
10904 |
+
return (extensions.FileReaderSync = Basic.extend({}, FileReaderSync));
|
10905 |
+
});
|
10906 |
+
|
10907 |
+
// Included from: src/javascript/runtime/silverlight/runtime/Transporter.js
|
10908 |
+
|
10909 |
+
/**
|
10910 |
+
* Transporter.js
|
10911 |
+
*
|
10912 |
+
* Copyright 2013, Moxiecode Systems AB
|
10913 |
+
* Released under GPL License.
|
10914 |
+
*
|
10915 |
+
* License: http://www.plupload.com/license
|
10916 |
+
* Contributing: http://www.plupload.com/contributing
|
10917 |
+
*/
|
10918 |
+
|
10919 |
+
/**
|
10920 |
+
@class moxie/runtime/silverlight/runtime/Transporter
|
10921 |
+
@private
|
10922 |
+
*/
|
10923 |
+
define("moxie/runtime/silverlight/runtime/Transporter", [
|
10924 |
+
"moxie/runtime/silverlight/Runtime",
|
10925 |
+
"moxie/core/utils/Basic",
|
10926 |
+
"moxie/runtime/flash/runtime/Transporter"
|
10927 |
+
], function(extensions, Basic, Transporter) {
|
10928 |
+
return (extensions.Transporter = Basic.extend({}, Transporter));
|
10929 |
+
});
|
10930 |
+
|
10931 |
+
// Included from: src/javascript/runtime/silverlight/xhr/XMLHttpRequest.js
|
10932 |
+
|
10933 |
+
/**
|
10934 |
+
* XMLHttpRequest.js
|
10935 |
+
*
|
10936 |
+
* Copyright 2013, Moxiecode Systems AB
|
10937 |
+
* Released under GPL License.
|
10938 |
+
*
|
10939 |
+
* License: http://www.plupload.com/license
|
10940 |
+
* Contributing: http://www.plupload.com/contributing
|
10941 |
+
*/
|
10942 |
+
|
10943 |
+
/**
|
10944 |
+
@class moxie/runtime/silverlight/xhr/XMLHttpRequest
|
10945 |
+
@private
|
10946 |
+
*/
|
10947 |
+
define("moxie/runtime/silverlight/xhr/XMLHttpRequest", [
|
10948 |
+
"moxie/runtime/silverlight/Runtime",
|
10949 |
+
"moxie/core/utils/Basic",
|
10950 |
+
"moxie/runtime/flash/xhr/XMLHttpRequest",
|
10951 |
+
"moxie/runtime/silverlight/file/FileReaderSync",
|
10952 |
+
"moxie/runtime/silverlight/runtime/Transporter"
|
10953 |
+
], function(extensions, Basic, XMLHttpRequest, FileReaderSyncSilverlight, TransporterSilverlight) {
|
10954 |
+
return (extensions.XMLHttpRequest = Basic.extend({}, XMLHttpRequest));
|
10955 |
+
});
|
10956 |
+
|
10957 |
+
// Included from: src/javascript/runtime/silverlight/image/Image.js
|
10958 |
+
|
10959 |
+
/**
|
10960 |
+
* Image.js
|
10961 |
+
*
|
10962 |
+
* Copyright 2013, Moxiecode Systems AB
|
10963 |
+
* Released under GPL License.
|
10964 |
+
*
|
10965 |
+
* License: http://www.plupload.com/license
|
10966 |
+
* Contributing: http://www.plupload.com/contributing
|
10967 |
+
*/
|
10968 |
+
|
10969 |
+
/**
|
10970 |
+
@class moxie/runtime/silverlight/image/Image
|
10971 |
+
@private
|
10972 |
+
*/
|
10973 |
+
define("moxie/runtime/silverlight/image/Image", [
|
10974 |
+
"moxie/runtime/silverlight/Runtime",
|
10975 |
+
"moxie/core/utils/Basic",
|
10976 |
+
"moxie/file/Blob",
|
10977 |
+
"moxie/runtime/flash/image/Image"
|
10978 |
+
], function(extensions, Basic, Blob, Image) {
|
10979 |
+
return (extensions.Image = Basic.extend({}, Image, {
|
10980 |
+
|
10981 |
+
getInfo: function() {
|
10982 |
+
var self = this.getRuntime()
|
10983 |
+
, grps = ['tiff', 'exif', 'gps', 'thumb']
|
10984 |
+
, info = { meta: {} }
|
10985 |
+
, rawInfo = self.shimExec.call(this, 'Image', 'getInfo')
|
10986 |
+
;
|
10987 |
+
|
10988 |
+
if (rawInfo.meta) {
|
10989 |
+
Basic.each(grps, function(grp) {
|
10990 |
+
var meta = rawInfo.meta[grp]
|
10991 |
+
, tag
|
10992 |
+
, i
|
10993 |
+
, length
|
10994 |
+
, value
|
10995 |
+
;
|
10996 |
+
if (meta && meta.keys) {
|
10997 |
+
info.meta[grp] = {};
|
10998 |
+
for (i = 0, length = meta.keys.length; i < length; i++) {
|
10999 |
+
tag = meta.keys[i];
|
11000 |
+
value = meta[tag];
|
11001 |
+
if (value) {
|
11002 |
+
// convert numbers
|
11003 |
+
if (/^(\d|[1-9]\d+)$/.test(value)) { // integer (make sure doesn't start with zero)
|
11004 |
+
value = parseInt(value, 10);
|
11005 |
+
} else if (/^\d*\.\d+$/.test(value)) { // double
|
11006 |
+
value = parseFloat(value);
|
11007 |
+
}
|
11008 |
+
info.meta[grp][tag] = value;
|
11009 |
+
}
|
11010 |
+
}
|
11011 |
+
}
|
11012 |
+
});
|
11013 |
+
|
11014 |
+
// save thumb data as blob
|
11015 |
+
if (info.meta && info.meta.thumb && info.meta.thumb.data && !(self.meta.thumb.data instanceof Blob)) {
|
11016 |
+
info.meta.thumb.data = new Blob(self.uid, info.meta.thumb.data);
|
11017 |
+
}
|
11018 |
+
}
|
11019 |
+
|
11020 |
+
info.width = parseInt(rawInfo.width, 10);
|
11021 |
+
info.height = parseInt(rawInfo.height, 10);
|
11022 |
+
info.size = parseInt(rawInfo.size, 10);
|
11023 |
+
info.type = rawInfo.type;
|
11024 |
+
info.name = rawInfo.name;
|
11025 |
+
|
11026 |
+
return info;
|
11027 |
+
},
|
11028 |
+
|
11029 |
+
resize: function(rect, ratio, opts) {
|
11030 |
+
this.getRuntime().shimExec.call(this, 'Image', 'resize', rect.x, rect.y, rect.width, rect.height, ratio, opts.preserveHeaders, opts.resample);
|
11031 |
+
}
|
11032 |
+
}));
|
11033 |
+
});
|
11034 |
+
|
11035 |
+
// Included from: src/javascript/runtime/html4/Runtime.js
|
11036 |
+
|
11037 |
+
/**
|
11038 |
+
* Runtime.js
|
11039 |
+
*
|
11040 |
+
* Copyright 2013, Moxiecode Systems AB
|
11041 |
+
* Released under GPL License.
|
11042 |
+
*
|
11043 |
+
* License: http://www.plupload.com/license
|
11044 |
+
* Contributing: http://www.plupload.com/contributing
|
11045 |
+
*/
|
11046 |
+
|
11047 |
+
/*global File:true */
|
11048 |
+
|
11049 |
+
/**
|
11050 |
+
Defines constructor for HTML4 runtime.
|
11051 |
+
|
11052 |
+
@class moxie/runtime/html4/Runtime
|
11053 |
+
@private
|
11054 |
+
*/
|
11055 |
+
define("moxie/runtime/html4/Runtime", [
|
11056 |
+
"moxie/core/utils/Basic",
|
11057 |
+
"moxie/core/Exceptions",
|
11058 |
+
"moxie/runtime/Runtime",
|
11059 |
+
"moxie/core/utils/Env"
|
11060 |
+
], function(Basic, x, Runtime, Env) {
|
11061 |
+
|
11062 |
+
var type = 'html4', extensions = {};
|
11063 |
+
|
11064 |
+
function Html4Runtime(options) {
|
11065 |
+
var I = this
|
11066 |
+
, Test = Runtime.capTest
|
11067 |
+
, True = Runtime.capTrue
|
11068 |
+
;
|
11069 |
+
|
11070 |
+
Runtime.call(this, options, type, {
|
11071 |
+
access_binary: Test(window.FileReader || window.File && File.getAsDataURL),
|
11072 |
+
access_image_binary: false,
|
11073 |
+
display_media: Test(
|
11074 |
+
(Env.can('create_canvas') || Env.can('use_data_uri_over32kb')) &&
|
11075 |
+
defined('moxie/image/Image')
|
11076 |
+
),
|
11077 |
+
do_cors: false,
|
11078 |
+
drag_and_drop: false,
|
11079 |
+
filter_by_extension: Test(function() { // if you know how to feature-detect this, please suggest
|
11080 |
+
return !(
|
11081 |
+
(Env.browser === 'Chrome' && Env.verComp(Env.version, 28, '<')) ||
|
11082 |
+
(Env.browser === 'IE' && Env.verComp(Env.version, 10, '<')) ||
|
11083 |
+
(Env.browser === 'Safari' && Env.verComp(Env.version, 7, '<')) ||
|
11084 |
+
(Env.browser === 'Firefox' && Env.verComp(Env.version, 37, '<'))
|
11085 |
+
);
|
11086 |
+
}()),
|
11087 |
+
resize_image: function() {
|
11088 |
+
return extensions.Image && I.can('access_binary') && Env.can('create_canvas');
|
11089 |
+
},
|
11090 |
+
report_upload_progress: false,
|
11091 |
+
return_response_headers: false,
|
11092 |
+
return_response_type: function(responseType) {
|
11093 |
+
if (responseType === 'json' && !!window.JSON) {
|
11094 |
+
return true;
|
11095 |
+
}
|
11096 |
+
return !!~Basic.inArray(responseType, ['text', 'document', '']);
|
11097 |
+
},
|
11098 |
+
return_status_code: function(code) {
|
11099 |
+
return !Basic.arrayDiff(code, [200, 404]);
|
11100 |
+
},
|
11101 |
+
select_file: function() {
|
11102 |
+
return Env.can('use_fileinput');
|
11103 |
+
},
|
11104 |
+
select_multiple: false,
|
11105 |
+
send_binary_string: false,
|
11106 |
+
send_custom_headers: false,
|
11107 |
+
send_multipart: true,
|
11108 |
+
slice_blob: false,
|
11109 |
+
stream_upload: function() {
|
11110 |
+
return I.can('select_file');
|
11111 |
+
},
|
11112 |
+
summon_file_dialog: function() { // yeah... some dirty sniffing here...
|
11113 |
+
return I.can('select_file') && !(
|
11114 |
+
(Env.browser === 'Firefox' && Env.verComp(Env.version, 4, '<')) ||
|
11115 |
+
(Env.browser === 'Opera' && Env.verComp(Env.version, 12, '<')) ||
|
11116 |
+
(Env.browser === 'IE' && Env.verComp(Env.version, 10, '<'))
|
11117 |
+
);
|
11118 |
+
},
|
11119 |
+
upload_filesize: True,
|
11120 |
+
use_http_method: function(methods) {
|
11121 |
+
return !Basic.arrayDiff(methods, ['GET', 'POST']);
|
11122 |
+
}
|
11123 |
+
});
|
11124 |
+
|
11125 |
+
|
11126 |
+
Basic.extend(this, {
|
11127 |
+
init : function() {
|
11128 |
+
this.trigger("Init");
|
11129 |
+
},
|
11130 |
+
|
11131 |
+
destroy: (function(destroy) { // extend default destroy method
|
11132 |
+
return function() {
|
11133 |
+
destroy.call(I);
|
11134 |
+
destroy = I = null;
|
11135 |
+
};
|
11136 |
+
}(this.destroy))
|
11137 |
+
});
|
11138 |
+
|
11139 |
+
Basic.extend(this.getShim(), extensions);
|
11140 |
+
}
|
11141 |
+
|
11142 |
+
Runtime.addConstructor(type, Html4Runtime);
|
11143 |
+
|
11144 |
+
return extensions;
|
11145 |
+
});
|
11146 |
+
|
11147 |
+
// Included from: src/javascript/runtime/html4/file/FileInput.js
|
11148 |
+
|
11149 |
+
/**
|
11150 |
+
* FileInput.js
|
11151 |
+
*
|
11152 |
+
* Copyright 2013, Moxiecode Systems AB
|
11153 |
+
* Released under GPL License.
|
11154 |
+
*
|
11155 |
+
* License: http://www.plupload.com/license
|
11156 |
+
* Contributing: http://www.plupload.com/contributing
|
11157 |
+
*/
|
11158 |
+
|
11159 |
+
/**
|
11160 |
+
@class moxie/runtime/html4/file/FileInput
|
11161 |
+
@private
|
11162 |
+
*/
|
11163 |
+
define("moxie/runtime/html4/file/FileInput", [
|
11164 |
+
"moxie/runtime/html4/Runtime",
|
11165 |
+
"moxie/file/File",
|
11166 |
+
"moxie/core/utils/Basic",
|
11167 |
+
"moxie/core/utils/Dom",
|
11168 |
+
"moxie/core/utils/Events",
|
11169 |
+
"moxie/core/utils/Mime",
|
11170 |
+
"moxie/core/utils/Env"
|
11171 |
+
], function(extensions, File, Basic, Dom, Events, Mime, Env) {
|
11172 |
+
|
11173 |
+
function FileInput() {
|
11174 |
+
var _uid, _mimes = [], _options, _browseBtnZIndex; // save original z-index;
|
11175 |
+
|
11176 |
+
function addInput() {
|
11177 |
+
var comp = this, I = comp.getRuntime(), shimContainer, browseButton, currForm, form, input, uid;
|
11178 |
+
|
11179 |
+
uid = Basic.guid('uid_');
|
11180 |
+
|
11181 |
+
shimContainer = I.getShimContainer(); // we get new ref every time to avoid memory leaks in IE
|
11182 |
+
|
11183 |
+
if (_uid) { // move previous form out of the view
|
11184 |
+
currForm = Dom.get(_uid + '_form');
|
11185 |
+
if (currForm) {
|
11186 |
+
Basic.extend(currForm.style, { top: '100%' });
|
11187 |
+
// it shouldn't be possible to tab into the hidden element
|
11188 |
+
currForm.firstChild.setAttribute('tabindex', -1);
|
11189 |
+
}
|
11190 |
+
}
|
11191 |
+
|
11192 |
+
// build form in DOM, since innerHTML version not able to submit file for some reason
|
11193 |
+
form = document.createElement('form');
|
11194 |
+
form.setAttribute('id', uid + '_form');
|
11195 |
+
form.setAttribute('method', 'post');
|
11196 |
+
form.setAttribute('enctype', 'multipart/form-data');
|
11197 |
+
form.setAttribute('encoding', 'multipart/form-data');
|
11198 |
+
|
11199 |
+
Basic.extend(form.style, {
|
11200 |
+
overflow: 'hidden',
|
11201 |
+
position: 'absolute',
|
11202 |
+
top: 0,
|
11203 |
+
left: 0,
|
11204 |
+
width: '100%',
|
11205 |
+
height: '100%'
|
11206 |
+
});
|
11207 |
+
|
11208 |
+
input = document.createElement('input');
|
11209 |
+
input.setAttribute('id', uid);
|
11210 |
+
input.setAttribute('type', 'file');
|
11211 |
+
input.setAttribute('accept', _mimes.join(','));
|
11212 |
+
|
11213 |
+
if (I.can('summon_file_dialog')) {
|
11214 |
+
input.setAttribute('tabindex', -1);
|
11215 |
+
}
|
11216 |
+
|
11217 |
+
Basic.extend(input.style, {
|
11218 |
+
fontSize: '999px',
|
11219 |
+
opacity: 0
|
11220 |
+
});
|
11221 |
+
|
11222 |
+
form.appendChild(input);
|
11223 |
+
shimContainer.appendChild(form);
|
11224 |
+
|
11225 |
+
// prepare file input to be placed underneath the browse_button element
|
11226 |
+
Basic.extend(input.style, {
|
11227 |
+
position: 'absolute',
|
11228 |
+
top: 0,
|
11229 |
+
left: 0,
|
11230 |
+
width: '100%',
|
11231 |
+
height: '100%'
|
11232 |
+
});
|
11233 |
+
|
11234 |
+
if (Env.browser === 'IE' && Env.verComp(Env.version, 10, '<')) {
|
11235 |
+
Basic.extend(input.style, {
|
11236 |
+
filter : "progid:DXImageTransform.Microsoft.Alpha(opacity=0)"
|
11237 |
+
});
|
11238 |
+
}
|
11239 |
+
|
11240 |
+
input.onchange = function() { // there should be only one handler for this
|
11241 |
+
var file;
|
11242 |
+
|
11243 |
+
if (!this.value) {
|
11244 |
+
return;
|
11245 |
+
}
|
11246 |
+
|
11247 |
+
if (this.files) { // check if browser is fresh enough
|
11248 |
+
file = this.files[0];
|
11249 |
+
} else {
|
11250 |
+
file = {
|
11251 |
+
name: this.value
|
11252 |
+
};
|
11253 |
+
}
|
11254 |
+
|
11255 |
+
file = new File(I.uid, file);
|
11256 |
+
|
11257 |
+
// clear event handler
|
11258 |
+
this.onchange = function() {};
|
11259 |
+
addInput.call(comp);
|
11260 |
+
|
11261 |
+
comp.files = [file];
|
11262 |
+
|
11263 |
+
// substitute all ids with file uids (consider file.uid read-only - we cannot do it the other way around)
|
11264 |
+
input.setAttribute('id', file.uid);
|
11265 |
+
form.setAttribute('id', file.uid + '_form');
|
11266 |
+
|
11267 |
+
comp.trigger('change');
|
11268 |
+
|
11269 |
+
input = form = null;
|
11270 |
+
};
|
11271 |
+
|
11272 |
+
|
11273 |
+
// route click event to the input
|
11274 |
+
if (I.can('summon_file_dialog')) {
|
11275 |
+
browseButton = Dom.get(_options.browse_button);
|
11276 |
+
Events.removeEvent(browseButton, 'click', comp.uid);
|
11277 |
+
Events.addEvent(browseButton, 'click', function(e) {
|
11278 |
+
if (input && !input.disabled) { // for some reason FF (up to 8.0.1 so far) lets to click disabled input[type=file]
|
11279 |
+
input.click();
|
11280 |
+
}
|
11281 |
+
e.preventDefault();
|
11282 |
+
}, comp.uid);
|
11283 |
+
}
|
11284 |
+
|
11285 |
+
_uid = uid;
|
11286 |
+
|
11287 |
+
shimContainer = currForm = browseButton = null;
|
11288 |
+
}
|
11289 |
+
|
11290 |
+
Basic.extend(this, {
|
11291 |
+
init: function(options) {
|
11292 |
+
var comp = this, I = comp.getRuntime(), shimContainer;
|
11293 |
+
|
11294 |
+
// figure out accept string
|
11295 |
+
_options = options;
|
11296 |
+
_mimes = Mime.extList2mimes(options.accept, I.can('filter_by_extension'));
|
11297 |
+
|
11298 |
+
shimContainer = I.getShimContainer();
|
11299 |
+
|
11300 |
+
(function() {
|
11301 |
+
var browseButton, zIndex, top;
|
11302 |
+
|
11303 |
+
browseButton = Dom.get(options.browse_button);
|
11304 |
+
_browseBtnZIndex = Dom.getStyle(browseButton, 'z-index') || 'auto';
|
11305 |
+
|
11306 |
+
// Route click event to the input[type=file] element for browsers that support such behavior
|
11307 |
+
if (I.can('summon_file_dialog')) {
|
11308 |
+
if (Dom.getStyle(browseButton, 'position') === 'static') {
|
11309 |
+
browseButton.style.position = 'relative';
|
11310 |
+
}
|
11311 |
+
|
11312 |
+
comp.bind('Refresh', function() {
|
11313 |
+
zIndex = parseInt(_browseBtnZIndex, 10) || 1;
|
11314 |
+
|
11315 |
+
Dom.get(_options.browse_button).style.zIndex = zIndex;
|
11316 |
+
this.getRuntime().getShimContainer().style.zIndex = zIndex - 1;
|
11317 |
+
});
|
11318 |
+
} else {
|
11319 |
+
// it shouldn't be possible to tab into the hidden element
|
11320 |
+
browseButton.setAttribute('tabindex', -1);
|
11321 |
+
}
|
11322 |
+
|
11323 |
+
/* Since we have to place input[type=file] on top of the browse_button for some browsers,
|
11324 |
+
browse_button loses interactivity, so we restore it here */
|
11325 |
+
top = I.can('summon_file_dialog') ? browseButton : shimContainer;
|
11326 |
+
|
11327 |
+
Events.addEvent(top, 'mouseover', function() {
|
11328 |
+
comp.trigger('mouseenter');
|
11329 |
+
}, comp.uid);
|
11330 |
+
|
11331 |
+
Events.addEvent(top, 'mouseout', function() {
|
11332 |
+
comp.trigger('mouseleave');
|
11333 |
+
}, comp.uid);
|
11334 |
+
|
11335 |
+
Events.addEvent(top, 'mousedown', function() {
|
11336 |
+
comp.trigger('mousedown');
|
11337 |
+
}, comp.uid);
|
11338 |
+
|
11339 |
+
Events.addEvent(Dom.get(options.container), 'mouseup', function() {
|
11340 |
+
comp.trigger('mouseup');
|
11341 |
+
}, comp.uid);
|
11342 |
+
|
11343 |
+
browseButton = null;
|
11344 |
+
}());
|
11345 |
+
|
11346 |
+
addInput.call(this);
|
11347 |
+
|
11348 |
+
shimContainer = null;
|
11349 |
+
|
11350 |
+
// trigger ready event asynchronously
|
11351 |
+
comp.trigger({
|
11352 |
+
type: 'ready',
|
11353 |
+
async: true
|
11354 |
+
});
|
11355 |
+
},
|
11356 |
+
|
11357 |
+
setOption: function(name, value) {
|
11358 |
+
var I = this.getRuntime();
|
11359 |
+
var input;
|
11360 |
+
|
11361 |
+
if (name == 'accept') {
|
11362 |
+
_mimes = value.mimes || Mime.extList2mimes(value, I.can('filter_by_extension'));
|
11363 |
+
}
|
11364 |
+
|
11365 |
+
// update current input
|
11366 |
+
input = Dom.get(_uid)
|
11367 |
+
if (input) {
|
11368 |
+
input.setAttribute('accept', _mimes.join(','));
|
11369 |
+
}
|
11370 |
+
},
|
11371 |
+
|
11372 |
+
|
11373 |
+
disable: function(state) {
|
11374 |
+
var input;
|
11375 |
+
|
11376 |
+
if ((input = Dom.get(_uid))) {
|
11377 |
+
input.disabled = !!state;
|
11378 |
+
}
|
11379 |
+
},
|
11380 |
+
|
11381 |
+
destroy: function() {
|
11382 |
+
var I = this.getRuntime()
|
11383 |
+
, shim = I.getShim()
|
11384 |
+
, shimContainer = I.getShimContainer()
|
11385 |
+
, container = _options && Dom.get(_options.container)
|
11386 |
+
, browseButton = _options && Dom.get(_options.browse_button)
|
11387 |
+
;
|
11388 |
+
|
11389 |
+
if (container) {
|
11390 |
+
Events.removeAllEvents(container, this.uid);
|
11391 |
+
}
|
11392 |
+
|
11393 |
+
if (browseButton) {
|
11394 |
+
Events.removeAllEvents(browseButton, this.uid);
|
11395 |
+
browseButton.style.zIndex = _browseBtnZIndex; // reset to original value
|
11396 |
+
}
|
11397 |
+
|
11398 |
+
if (shimContainer) {
|
11399 |
+
Events.removeAllEvents(shimContainer, this.uid);
|
11400 |
+
shimContainer.innerHTML = '';
|
11401 |
+
}
|
11402 |
+
|
11403 |
+
shim.removeInstance(this.uid);
|
11404 |
+
|
11405 |
+
_uid = _mimes = _options = shimContainer = container = browseButton = shim = null;
|
11406 |
+
}
|
11407 |
+
});
|
11408 |
+
}
|
11409 |
+
|
11410 |
+
return (extensions.FileInput = FileInput);
|
11411 |
+
});
|
11412 |
+
|
11413 |
+
// Included from: src/javascript/runtime/html4/file/FileReader.js
|
11414 |
+
|
11415 |
+
/**
|
11416 |
+
* FileReader.js
|
11417 |
+
*
|
11418 |
+
* Copyright 2013, Moxiecode Systems AB
|
11419 |
+
* Released under GPL License.
|
11420 |
+
*
|
11421 |
+
* License: http://www.plupload.com/license
|
11422 |
+
* Contributing: http://www.plupload.com/contributing
|
11423 |
+
*/
|
11424 |
+
|
11425 |
+
/**
|
11426 |
+
@class moxie/runtime/html4/file/FileReader
|
11427 |
+
@private
|
11428 |
+
*/
|
11429 |
+
define("moxie/runtime/html4/file/FileReader", [
|
11430 |
+
"moxie/runtime/html4/Runtime",
|
11431 |
+
"moxie/runtime/html5/file/FileReader"
|
11432 |
+
], function(extensions, FileReader) {
|
11433 |
+
return (extensions.FileReader = FileReader);
|
11434 |
+
});
|
11435 |
+
|
11436 |
+
// Included from: src/javascript/runtime/html4/xhr/XMLHttpRequest.js
|
11437 |
+
|
11438 |
+
/**
|
11439 |
+
* XMLHttpRequest.js
|
11440 |
+
*
|
11441 |
+
* Copyright 2013, Moxiecode Systems AB
|
11442 |
+
* Released under GPL License.
|
11443 |
+
*
|
11444 |
+
* License: http://www.plupload.com/license
|
11445 |
+
* Contributing: http://www.plupload.com/contributing
|
11446 |
+
*/
|
11447 |
+
|
11448 |
+
/**
|
11449 |
+
@class moxie/runtime/html4/xhr/XMLHttpRequest
|
11450 |
+
@private
|
11451 |
+
*/
|
11452 |
+
define("moxie/runtime/html4/xhr/XMLHttpRequest", [
|
11453 |
+
"moxie/runtime/html4/Runtime",
|
11454 |
+
"moxie/core/utils/Basic",
|
11455 |
+
"moxie/core/utils/Dom",
|
11456 |
+
"moxie/core/utils/Url",
|
11457 |
+
"moxie/core/Exceptions",
|
11458 |
+
"moxie/core/utils/Events",
|
11459 |
+
"moxie/file/Blob",
|
11460 |
+
"moxie/xhr/FormData"
|
11461 |
+
], function(extensions, Basic, Dom, Url, x, Events, Blob, FormData) {
|
11462 |
+
|
11463 |
+
function XMLHttpRequest() {
|
11464 |
+
var _status, _response, _iframe;
|
11465 |
+
|
11466 |
+
function cleanup(cb) {
|
11467 |
+
var target = this, uid, form, inputs, i, hasFile = false;
|
11468 |
+
|
11469 |
+
if (!_iframe) {
|
11470 |
+
return;
|
11471 |
+
}
|
11472 |
+
|
11473 |
+
uid = _iframe.id.replace(/_iframe$/, '');
|
11474 |
+
|
11475 |
+
form = Dom.get(uid + '_form');
|
11476 |
+
if (form) {
|
11477 |
+
inputs = form.getElementsByTagName('input');
|
11478 |
+
i = inputs.length;
|
11479 |
+
|
11480 |
+
while (i--) {
|
11481 |
+
switch (inputs[i].getAttribute('type')) {
|
11482 |
+
case 'hidden':
|
11483 |
+
inputs[i].parentNode.removeChild(inputs[i]);
|
11484 |
+
break;
|
11485 |
+
case 'file':
|
11486 |
+
hasFile = true; // flag the case for later
|
11487 |
+
break;
|
11488 |
+
}
|
11489 |
+
}
|
11490 |
+
inputs = [];
|
11491 |
+
|
11492 |
+
if (!hasFile) { // we need to keep the form for sake of possible retries
|
11493 |
+
form.parentNode.removeChild(form);
|
11494 |
+
}
|
11495 |
+
form = null;
|
11496 |
+
}
|
11497 |
+
|
11498 |
+
// without timeout, request is marked as canceled (in console)
|
11499 |
+
setTimeout(function() {
|
11500 |
+
Events.removeEvent(_iframe, 'load', target.uid);
|
11501 |
+
if (_iframe.parentNode) { // #382
|
11502 |
+
_iframe.parentNode.removeChild(_iframe);
|
11503 |
+
}
|
11504 |
+
|
11505 |
+
// check if shim container has any other children, if - not, remove it as well
|
11506 |
+
var shimContainer = target.getRuntime().getShimContainer();
|
11507 |
+
if (!shimContainer.children.length) {
|
11508 |
+
shimContainer.parentNode.removeChild(shimContainer);
|
11509 |
+
}
|
11510 |
+
|
11511 |
+
shimContainer = _iframe = null;
|
11512 |
+
cb();
|
11513 |
+
}, 1);
|
11514 |
+
}
|
11515 |
+
|
11516 |
+
Basic.extend(this, {
|
11517 |
+
send: function(meta, data) {
|
11518 |
+
var target = this, I = target.getRuntime(), uid, form, input, blob;
|
11519 |
+
|
11520 |
+
_status = _response = null;
|
11521 |
+
|
11522 |
+
function createIframe() {
|
11523 |
+
var container = I.getShimContainer() || document.body
|
11524 |
+
, temp = document.createElement('div')
|
11525 |
+
;
|
11526 |
+
|
11527 |
+
// IE 6 won't be able to set the name using setAttribute or iframe.name
|
11528 |
+
temp.innerHTML = '<iframe id="' + uid + '_iframe" name="' + uid + '_iframe" src="javascript:""" style="display:none"></iframe>';
|
11529 |
+
_iframe = temp.firstChild;
|
11530 |
+
container.appendChild(_iframe);
|
11531 |
+
|
11532 |
+
/* _iframe.onreadystatechange = function() {
|
11533 |
+
console.info(_iframe.readyState);
|
11534 |
+
};*/
|
11535 |
+
|
11536 |
+
Events.addEvent(_iframe, 'load', function() { // _iframe.onload doesn't work in IE lte 8
|
11537 |
+
var el;
|
11538 |
+
|
11539 |
+
try {
|
11540 |
+
el = _iframe.contentWindow.document || _iframe.contentDocument || window.frames[_iframe.id].document;
|
11541 |
+
|
11542 |
+
// try to detect some standard error pages
|
11543 |
+
if (/^4(0[0-9]|1[0-7]|2[2346])\s/.test(el.title)) { // test if title starts with 4xx HTTP error
|
11544 |
+
_status = el.title.replace(/^(\d+).*$/, '$1');
|
11545 |
+
} else {
|
11546 |
+
_status = 200;
|
11547 |
+
// get result
|
11548 |
+
_response = Basic.trim(el.body.innerHTML);
|
11549 |
+
|
11550 |
+
// we need to fire these at least once
|
11551 |
+
target.trigger({
|
11552 |
+
type: 'progress',
|
11553 |
+
loaded: _response.length,
|
11554 |
+
total: _response.length
|
11555 |
+
});
|
11556 |
+
|
11557 |
+
if (blob) { // if we were uploading a file
|
11558 |
+
target.trigger({
|
11559 |
+
type: 'uploadprogress',
|
11560 |
+
loaded: blob.size || 1025,
|
11561 |
+
total: blob.size || 1025
|
11562 |
+
});
|
11563 |
+
}
|
11564 |
+
}
|
11565 |
+
} catch (ex) {
|
11566 |
+
if (Url.hasSameOrigin(meta.url)) {
|
11567 |
+
// if response is sent with error code, iframe in IE gets redirected to res://ieframe.dll/http_x.htm
|
11568 |
+
// which obviously results to cross domain error (wtf?)
|
11569 |
+
_status = 404;
|
11570 |
+
} else {
|
11571 |
+
cleanup.call(target, function() {
|
11572 |
+
target.trigger('error');
|
11573 |
+
});
|
11574 |
+
return;
|
11575 |
+
}
|
11576 |
+
}
|
11577 |
+
|
11578 |
+
cleanup.call(target, function() {
|
11579 |
+
target.trigger('load');
|
11580 |
+
});
|
11581 |
+
}, target.uid);
|
11582 |
+
} // end createIframe
|
11583 |
+
|
11584 |
+
// prepare data to be sent and convert if required
|
11585 |
+
if (data instanceof FormData && data.hasBlob()) {
|
11586 |
+
blob = data.getBlob();
|
11587 |
+
uid = blob.uid;
|
11588 |
+
input = Dom.get(uid);
|
11589 |
+
form = Dom.get(uid + '_form');
|
11590 |
+
if (!form) {
|
11591 |
+
throw new x.DOMException(x.DOMException.NOT_FOUND_ERR);
|
11592 |
+
}
|
11593 |
+
} else {
|
11594 |
+
uid = Basic.guid('uid_');
|
11595 |
+
|
11596 |
+
form = document.createElement('form');
|
11597 |
+
form.setAttribute('id', uid + '_form');
|
11598 |
+
form.setAttribute('method', meta.method);
|
11599 |
+
form.setAttribute('enctype', 'multipart/form-data');
|
11600 |
+
form.setAttribute('encoding', 'multipart/form-data');
|
11601 |
+
|
11602 |
+
I.getShimContainer().appendChild(form);
|
11603 |
+
}
|
11604 |
+
|
11605 |
+
// set upload target
|
11606 |
+
form.setAttribute('target', uid + '_iframe');
|
11607 |
+
|
11608 |
+
if (data instanceof FormData) {
|
11609 |
+
data.each(function(value, name) {
|
11610 |
+
if (value instanceof Blob) {
|
11611 |
+
if (input) {
|
11612 |
+
input.setAttribute('name', name);
|
11613 |
+
}
|
11614 |
+
} else {
|
11615 |
+
var hidden = document.createElement('input');
|
11616 |
+
|
11617 |
+
Basic.extend(hidden, {
|
11618 |
+
type : 'hidden',
|
11619 |
+
name : name,
|
11620 |
+
value : value
|
11621 |
+
});
|
11622 |
+
|
11623 |
+
// make sure that input[type="file"], if it's there, comes last
|
11624 |
+
if (input) {
|
11625 |
+
form.insertBefore(hidden, input);
|
11626 |
+
} else {
|
11627 |
+
form.appendChild(hidden);
|
11628 |
+
}
|
11629 |
+
}
|
11630 |
+
});
|
11631 |
+
}
|
11632 |
+
|
11633 |
+
// set destination url
|
11634 |
+
form.setAttribute("action", meta.url);
|
11635 |
+
|
11636 |
+
createIframe();
|
11637 |
+
form.submit();
|
11638 |
+
target.trigger('loadstart');
|
11639 |
+
},
|
11640 |
+
|
11641 |
+
getStatus: function() {
|
11642 |
+
return _status;
|
11643 |
+
},
|
11644 |
+
|
11645 |
+
getResponse: function(responseType) {
|
11646 |
+
if ('json' === responseType) {
|
11647 |
+
// strip off <pre>..</pre> tags that might be enclosing the response
|
11648 |
+
if (Basic.typeOf(_response) === 'string' && !!window.JSON) {
|
11649 |
+
try {
|
11650 |
+
return JSON.parse(_response.replace(/^\s*<pre[^>]*>/, '').replace(/<\/pre>\s*$/, ''));
|
11651 |
+
} catch (ex) {
|
11652 |
+
return null;
|
11653 |
+
}
|
11654 |
+
}
|
11655 |
+
} else if ('document' === responseType) {
|
11656 |
+
|
11657 |
+
}
|
11658 |
+
return _response;
|
11659 |
+
},
|
11660 |
+
|
11661 |
+
abort: function() {
|
11662 |
+
var target = this;
|
11663 |
+
|
11664 |
+
if (_iframe && _iframe.contentWindow) {
|
11665 |
+
if (_iframe.contentWindow.stop) { // FireFox/Safari/Chrome
|
11666 |
+
_iframe.contentWindow.stop();
|
11667 |
+
} else if (_iframe.contentWindow.document.execCommand) { // IE
|
11668 |
+
_iframe.contentWindow.document.execCommand('Stop');
|
11669 |
+
} else {
|
11670 |
+
_iframe.src = "about:blank";
|
11671 |
+
}
|
11672 |
+
}
|
11673 |
+
|
11674 |
+
cleanup.call(this, function() {
|
11675 |
+
// target.dispatchEvent('readystatechange');
|
11676 |
+
target.dispatchEvent('abort');
|
11677 |
+
});
|
11678 |
+
},
|
11679 |
+
|
11680 |
+
destroy: function() {
|
11681 |
+
this.getRuntime().getShim().removeInstance(this.uid);
|
11682 |
+
}
|
11683 |
+
});
|
11684 |
+
}
|
11685 |
+
|
11686 |
+
return (extensions.XMLHttpRequest = XMLHttpRequest);
|
11687 |
+
});
|
11688 |
+
|
11689 |
+
// Included from: src/javascript/runtime/html4/image/Image.js
|
11690 |
+
|
11691 |
+
/**
|
11692 |
+
* Image.js
|
11693 |
+
*
|
11694 |
+
* Copyright 2013, Moxiecode Systems AB
|
11695 |
+
* Released under GPL License.
|
11696 |
+
*
|
11697 |
+
* License: http://www.plupload.com/license
|
11698 |
+
* Contributing: http://www.plupload.com/contributing
|
11699 |
+
*/
|
11700 |
+
|
11701 |
+
/**
|
11702 |
+
@class moxie/runtime/html4/image/Image
|
11703 |
+
@private
|
11704 |
+
*/
|
11705 |
+
define("moxie/runtime/html4/image/Image", [
|
11706 |
+
"moxie/runtime/html4/Runtime",
|
11707 |
+
"moxie/runtime/html5/image/Image"
|
11708 |
+
], function(extensions, Image) {
|
11709 |
+
return (extensions.Image = Image);
|
11710 |
+
});
|
11711 |
+
|
11712 |
+
expose(["moxie/core/utils/Basic","moxie/core/utils/Encode","moxie/core/utils/Env","moxie/core/Exceptions","moxie/core/utils/Dom","moxie/core/EventTarget","moxie/runtime/Runtime","moxie/runtime/RuntimeClient","moxie/file/Blob","moxie/core/I18n","moxie/core/utils/Mime","moxie/file/FileInput","moxie/file/File","moxie/file/FileDrop","moxie/file/FileReader","moxie/core/utils/Url","moxie/runtime/RuntimeTarget","moxie/xhr/FormData","moxie/xhr/XMLHttpRequest","moxie/image/Image","moxie/core/utils/Events","moxie/runtime/html5/image/ResizerCanvas"]);
|
11713 |
+
})(this);
|
11714 |
+
}));
|
admin/js/plupload/moxie.min.js
CHANGED
@@ -1,6 +1,6 @@
|
|
1 |
/**
|
2 |
* mOxie - multi-runtime File API & XMLHttpRequest L2 Polyfill
|
3 |
-
* v1.
|
4 |
*
|
5 |
* Copyright 2013, Moxiecode Systems AB
|
6 |
* Released under GPL License.
|
@@ -8,8 +8,9 @@
|
|
8 |
* License: http://www.plupload.com/license
|
9 |
* Contributing: http://www.plupload.com/contributing
|
10 |
*
|
11 |
-
* Date:
|
12 |
*/
|
13 |
-
!function(e,t){"use strict";function n(e,t){for(var n,i=[],r=0;r<e.length;++r){if(n=s[e[r]]||o(e[r]),!n)throw"module definition dependecy not found: "+e[r];i.push(n)}t.apply(null,i)}function i(e,i,r){if("string"!=typeof e)throw"invalid module definition, module id must be defined and be a string";if(i===t)throw"invalid module definition, dependencies must be specified";if(r===t)throw"invalid module definition, definition function must be specified";n(i,function(){s[e]=r.apply(null,arguments)})}function r(e){return!!s[e]}function o(t){for(var n=e,i=t.split(/[.\/]/),r=0;r<i.length;++r){if(!n[i[r]])return;n=n[i[r]]}return n}function a(n){for(var i=0;i<n.length;i++){for(var r=e,o=n[i],a=o.split(/[.\/]/),u=0;u<a.length-1;++u)r[a[u]]===t&&(r[a[u]]={}),r=r[a[u]];r[a[a.length-1]]=s[o]}}var s={},u="moxie/core/utils/Basic",c="moxie/core/I18n",l="moxie/core/utils/Mime",d="moxie/core/utils/Env",f="moxie/core/utils/Dom",p="moxie/core/Exceptions",h="moxie/core/EventTarget",m="moxie/core/utils/Encode",g="moxie/runtime/Runtime",v="moxie/runtime/RuntimeClient",y="moxie/file/Blob",w="moxie/file/File",E="moxie/file/FileInput",_="moxie/file/FileDrop",x="moxie/runtime/RuntimeTarget",R="moxie/file/FileReader",b="moxie/core/utils/Url",T="moxie/file/FileReaderSync",S="moxie/xhr/FormData",A="moxie/xhr/XMLHttpRequest",O="moxie/runtime/Transporter",I="moxie/image/Image",D="moxie/runtime/html5/Runtime",N="moxie/runtime/html5/file/Blob",L="moxie/core/utils/Events",M="moxie/runtime/html5/file/FileInput",C="moxie/runtime/html5/file/FileDrop",F="moxie/runtime/html5/file/FileReader",H="moxie/runtime/html5/xhr/XMLHttpRequest",P="moxie/runtime/html5/utils/BinaryReader",k="moxie/runtime/html5/image/JPEGHeaders",U="moxie/runtime/html5/image/ExifParser",B="moxie/runtime/html5/image/JPEG",z="moxie/runtime/html5/image/PNG",G="moxie/runtime/html5/image/ImageInfo",q="moxie/runtime/html5/image/MegaPixel",X="moxie/runtime/html5/image/Image",j="moxie/runtime/flash/Runtime",V="moxie/runtime/flash/file/Blob",W="moxie/runtime/flash/file/FileInput",Y="moxie/runtime/flash/file/FileReader",$="moxie/runtime/flash/file/FileReaderSync",J="moxie/runtime/flash/xhr/XMLHttpRequest",Z="moxie/runtime/flash/runtime/Transporter",K="moxie/runtime/flash/image/Image",Q="moxie/runtime/silverlight/Runtime",et="moxie/runtime/silverlight/file/Blob",tt="moxie/runtime/silverlight/file/FileInput",nt="moxie/runtime/silverlight/file/FileDrop",it="moxie/runtime/silverlight/file/FileReader",rt="moxie/runtime/silverlight/file/FileReaderSync",ot="moxie/runtime/silverlight/xhr/XMLHttpRequest",at="moxie/runtime/silverlight/runtime/Transporter",st="moxie/runtime/silverlight/image/Image",ut="moxie/runtime/html4/Runtime",ct="moxie/runtime/html4/file/FileInput",lt="moxie/runtime/html4/file/FileReader",dt="moxie/runtime/html4/xhr/XMLHttpRequest",ft="moxie/runtime/html4/image/Image";i(u,[],function(){var e=function(e){var t;return e===t?"undefined":null===e?"null":e.nodeType?"node":{}.toString.call(e).match(/\s([a-z|A-Z]+)/)[1].toLowerCase()},t=function(i){var r;return n(arguments,function(o,s){s>0&&n(o,function(n,o){n!==r&&(e(i[o])===e(n)&&~a(e(n),["array","object"])?t(i[o],n):i[o]=n)})}),i},n=function(e,t){var n,i,r,o;if(e){try{n=e.length}catch(a){n=o}if(n===o){for(i in e)if(e.hasOwnProperty(i)&&t(e[i],i)===!1)return}else for(r=0;n>r;r++)if(t(e[r],r)===!1)return}},i=function(t){var n;if(!t||"object"!==e(t))return!0;for(n in t)return!1;return!0},r=function(t,n){function i(r){"function"===e(t[r])&&t[r](function(e){++r<o&&!e?i(r):n(e)})}var r=0,o=t.length;"function"!==e(n)&&(n=function(){}),t&&t.length||n(),i(r)},o=function(e,t){var i=0,r=e.length,o=new Array(r);n(e,function(e,n){e(function(e){if(e)return t(e);var a=[].slice.call(arguments);a.shift(),o[n]=a,i++,i===r&&(o.unshift(null),t.apply(this,o))})})},a=function(e,t){if(t){if(Array.prototype.indexOf)return Array.prototype.indexOf.call(t,e);for(var n=0,i=t.length;i>n;n++)if(t[n]===e)return n}return-1},s=function(t,n){var i=[];"array"!==e(t)&&(t=[t]),"array"!==e(n)&&(n=[n]);for(var r in t)-1===a(t[r],n)&&i.push(t[r]);return i.length?i:!1},u=function(e,t){var i=[];return n(e,function(e){-1!==a(e,t)&&i.push(e)}),i.length?i:null},c=function(e){var t,n=[];for(t=0;t<e.length;t++)n[t]=e[t];return n},l=function(){var e=0;return function(t){var n=(new Date).getTime().toString(32),i;for(i=0;5>i;i++)n+=Math.floor(65535*Math.random()).toString(32);return(t||"o_")+n+(e++).toString(32)}}(),d=function(e){return e?String.prototype.trim?String.prototype.trim.call(e):e.toString().replace(/^\s*/,"").replace(/\s*$/,""):e},f=function(e){if("string"!=typeof e)return e;var t={t:1099511627776,g:1073741824,m:1048576,k:1024},n;return e=/^([0-9]+)([mgk]?)$/.exec(e.toLowerCase().replace(/[^0-9mkg]/g,"")),n=e[2],e=+e[1],t.hasOwnProperty(n)&&(e*=t[n]),e};return{guid:l,typeOf:e,extend:t,each:n,isEmptyObj:i,inSeries:r,inParallel:o,inArray:a,arrayDiff:s,arrayIntersect:u,toArray:c,trim:d,parseSizeStr:f}}),i(c,[u],function(e){var t={};return{addI18n:function(n){return e.extend(t,n)},translate:function(e){return t[e]||e},_:function(e){return this.translate(e)},sprintf:function(t){var n=[].slice.call(arguments,1);return t.replace(/%[a-z]/g,function(){var t=n.shift();return"undefined"!==e.typeOf(t)?t:""})}}}),i(l,[u,c],function(e,t){var n="application/msword,doc dot,application/pdf,pdf,application/pgp-signature,pgp,application/postscript,ps ai eps,application/rtf,rtf,application/vnd.ms-excel,xls xlb,application/vnd.ms-powerpoint,ppt pps pot,application/zip,zip,application/x-shockwave-flash,swf swfl,application/vnd.openxmlformats-officedocument.wordprocessingml.document,docx,application/vnd.openxmlformats-officedocument.wordprocessingml.template,dotx,application/vnd.openxmlformats-officedocument.spreadsheetml.sheet,xlsx,application/vnd.openxmlformats-officedocument.presentationml.presentation,pptx,application/vnd.openxmlformats-officedocument.presentationml.template,potx,application/vnd.openxmlformats-officedocument.presentationml.slideshow,ppsx,application/x-javascript,js,application/json,json,audio/mpeg,mp3 mpga mpega mp2,audio/x-wav,wav,audio/x-m4a,m4a,audio/ogg,oga ogg,audio/aiff,aiff aif,audio/flac,flac,audio/aac,aac,audio/ac3,ac3,audio/x-ms-wma,wma,image/bmp,bmp,image/gif,gif,image/jpeg,jpg jpeg jpe,image/photoshop,psd,image/png,png,image/svg+xml,svg svgz,image/tiff,tiff tif,text/plain,asc txt text diff log,text/html,htm html xhtml,text/css,css,text/csv,csv,text/rtf,rtf,video/mpeg,mpeg mpg mpe m2v,video/quicktime,qt mov,video/mp4,mp4,video/x-m4v,m4v,video/x-flv,flv,video/x-ms-wmv,wmv,video/avi,avi,video/webm,webm,video/3gpp,3gpp 3gp,video/3gpp2,3g2,video/vnd.rn-realvideo,rv,video/ogg,ogv,video/x-matroska,mkv,application/vnd.oasis.opendocument.formula-template,otf,application/octet-stream,exe",i={mimes:{},extensions:{},addMimeType:function(e){var t=e.split(/,/),n,i,r;for(n=0;n<t.length;n+=2){for(r=t[n+1].split(/ /),i=0;i<r.length;i++)this.mimes[r[i]]=t[n];this.extensions[t[n]]=r}},extList2mimes:function(t,n){var i=this,r,o,a,s,u=[];for(o=0;o<t.length;o++)for(r=t[o].extensions.split(/\s*,\s*/),a=0;a<r.length;a++){if("*"===r[a])return[];if(s=i.mimes[r[a]])-1===e.inArray(s,u)&&u.push(s);else{if(!n||!/^\w+$/.test(r[a]))return[];u.push("."+r[a])}}return u},mimes2exts:function(t){var n=this,i=[];return e.each(t,function(t){if("*"===t)return i=[],!1;var r=t.match(/^(\w+)\/(\*|\w+)$/);r&&("*"===r[2]?e.each(n.extensions,function(e,t){new RegExp("^"+r[1]+"/").test(t)&&[].push.apply(i,n.extensions[t])}):n.extensions[t]&&[].push.apply(i,n.extensions[t]))}),i},mimes2extList:function(n){var i=[],r=[];return"string"===e.typeOf(n)&&(n=e.trim(n).split(/\s*,\s*/)),r=this.mimes2exts(n),i.push({title:t.translate("Files"),extensions:r.length?r.join(","):"*"}),i.mimes=n,i},getFileExtension:function(e){var t=e&&e.match(/\.([^.]+)$/);return t?t[1].toLowerCase():""},getFileMime:function(e){return this.mimes[this.getFileExtension(e)]||""}};return i.addMimeType(n),i}),i(d,[u],function(e){function t(e,t,n){var i=0,r=0,o=0,a={dev:-6,alpha:-5,a:-5,beta:-4,b:-4,RC:-3,rc:-3,"#":-2,p:1,pl:1},s=function(e){return e=(""+e).replace(/[_\-+]/g,"."),e=e.replace(/([^.\d]+)/g,".$1.").replace(/\.{2,}/g,"."),e.length?e.split("."):[-8]},u=function(e){return e?isNaN(e)?a[e]||-7:parseInt(e,10):0};for(e=s(e),t=s(t),r=Math.max(e.length,t.length),i=0;r>i;i++)if(e[i]!=t[i]){if(e[i]=u(e[i]),t[i]=u(t[i]),e[i]<t[i]){o=-1;break}if(e[i]>t[i]){o=1;break}}if(!n)return o;switch(n){case">":case"gt":return o>0;case">=":case"ge":return o>=0;case"<=":case"le":return 0>=o;case"==":case"=":case"eq":return 0===o;case"<>":case"!=":case"ne":return 0!==o;case"":case"<":case"lt":return 0>o;default:return null}}var n=function(e){var t="",n="?",i="function",r="undefined",o="object",a="major",s="model",u="name",c="type",l="vendor",d="version",f="architecture",p="console",h="mobile",m="tablet",g={has:function(e,t){return-1!==t.toLowerCase().indexOf(e.toLowerCase())},lowerize:function(e){return e.toLowerCase()}},v={rgx:function(){for(var t,n=0,a,s,u,c,l,d,f=arguments;n<f.length;n+=2){var p=f[n],h=f[n+1];if(typeof t===r){t={};for(u in h)c=h[u],typeof c===o?t[c[0]]=e:t[c]=e}for(a=s=0;a<p.length;a++)if(l=p[a].exec(this.getUA())){for(u=0;u<h.length;u++)d=l[++s],c=h[u],typeof c===o&&c.length>0?2==c.length?t[c[0]]=typeof c[1]==i?c[1].call(this,d):c[1]:3==c.length?t[c[0]]=typeof c[1]!==i||c[1].exec&&c[1].test?d?d.replace(c[1],c[2]):e:d?c[1].call(this,d,c[2]):e:4==c.length&&(t[c[0]]=d?c[3].call(this,d.replace(c[1],c[2])):e):t[c]=d?d:e;break}if(l)break}return t},str:function(t,i){for(var r in i)if(typeof i[r]===o&&i[r].length>0){for(var a=0;a<i[r].length;a++)if(g.has(i[r][a],t))return r===n?e:r}else if(g.has(i[r],t))return r===n?e:r;return t}},y={browser:{oldsafari:{major:{1:["/8","/1","/3"],2:"/4","?":"/"},version:{"1.0":"/8",1.2:"/1",1.3:"/3","2.0":"/412","2.0.2":"/416","2.0.3":"/417","2.0.4":"/419","?":"/"}}},device:{sprint:{model:{"Evo Shift 4G":"7373KT"},vendor:{HTC:"APA",Sprint:"Sprint"}}},os:{windows:{version:{ME:"4.90","NT 3.11":"NT3.51","NT 4.0":"NT4.0",2000:"NT 5.0",XP:["NT 5.1","NT 5.2"],Vista:"NT 6.0",7:"NT 6.1",8:"NT 6.2",8.1:"NT 6.3",RT:"ARM"}}}},w={browser:[[/(opera\smini)\/((\d+)?[\w\.-]+)/i,/(opera\s[mobiletab]+).+version\/((\d+)?[\w\.-]+)/i,/(opera).+version\/((\d+)?[\w\.]+)/i,/(opera)[\/\s]+((\d+)?[\w\.]+)/i],[u,d,a],[/\s(opr)\/((\d+)?[\w\.]+)/i],[[u,"Opera"],d,a],[/(kindle)\/((\d+)?[\w\.]+)/i,/(lunascape|maxthon|netfront|jasmine|blazer)[\/\s]?((\d+)?[\w\.]+)*/i,/(avant\s|iemobile|slim|baidu)(?:browser)?[\/\s]?((\d+)?[\w\.]*)/i,/(?:ms|\()(ie)\s((\d+)?[\w\.]+)/i,/(rekonq)((?:\/)[\w\.]+)*/i,/(chromium|flock|rockmelt|midori|epiphany|silk|skyfire|ovibrowser|bolt|iron)\/((\d+)?[\w\.-]+)/i],[u,d,a],[/(trident).+rv[:\s]((\d+)?[\w\.]+).+like\sgecko/i],[[u,"IE"],d,a],[/(yabrowser)\/((\d+)?[\w\.]+)/i],[[u,"Yandex"],d,a],[/(comodo_dragon)\/((\d+)?[\w\.]+)/i],[[u,/_/g," "],d,a],[/(chrome|omniweb|arora|[tizenoka]{5}\s?browser)\/v?((\d+)?[\w\.]+)/i],[u,d,a],[/(dolfin)\/((\d+)?[\w\.]+)/i],[[u,"Dolphin"],d,a],[/((?:android.+)crmo|crios)\/((\d+)?[\w\.]+)/i],[[u,"Chrome"],d,a],[/((?:android.+))version\/((\d+)?[\w\.]+)\smobile\ssafari/i],[[u,"Android Browser"],d,a],[/version\/((\d+)?[\w\.]+).+?mobile\/\w+\s(safari)/i],[d,a,[u,"Mobile Safari"]],[/version\/((\d+)?[\w\.]+).+?(mobile\s?safari|safari)/i],[d,a,u],[/webkit.+?(mobile\s?safari|safari)((\/[\w\.]+))/i],[u,[a,v.str,y.browser.oldsafari.major],[d,v.str,y.browser.oldsafari.version]],[/(konqueror)\/((\d+)?[\w\.]+)/i,/(webkit|khtml)\/((\d+)?[\w\.]+)/i],[u,d,a],[/(navigator|netscape)\/((\d+)?[\w\.-]+)/i],[[u,"Netscape"],d,a],[/(swiftfox)/i,/(icedragon|iceweasel|camino|chimera|fennec|maemo\sbrowser|minimo|conkeror)[\/\s]?((\d+)?[\w\.\+]+)/i,/(firefox|seamonkey|k-meleon|icecat|iceape|firebird|phoenix)\/((\d+)?[\w\.-]+)/i,/(mozilla)\/((\d+)?[\w\.]+).+rv\:.+gecko\/\d+/i,/(uc\s?browser|polaris|lynx|dillo|icab|doris|amaya|w3m|netsurf|qqbrowser)[\/\s]?((\d+)?[\w\.]+)/i,/(links)\s\(((\d+)?[\w\.]+)/i,/(gobrowser)\/?((\d+)?[\w\.]+)*/i,/(ice\s?browser)\/v?((\d+)?[\w\._]+)/i,/(mosaic)[\/\s]((\d+)?[\w\.]+)/i],[u,d,a]],engine:[[/(presto)\/([\w\.]+)/i,/(webkit|trident|netfront|netsurf|amaya|lynx|w3m)\/([\w\.]+)/i,/(khtml|tasman|links)[\/\s]\(?([\w\.]+)/i,/(icab)[\/\s]([23]\.[\d\.]+)/i],[u,d],[/rv\:([\w\.]+).*(gecko)/i],[d,u]],os:[[/(windows)\snt\s6\.2;\s(arm)/i,/(windows\sphone(?:\sos)*|windows\smobile|windows)[\s\/]?([ntce\d\.\s]+\w)/i],[u,[d,v.str,y.os.windows.version]],[/(win(?=3|9|n)|win\s9x\s)([nt\d\.]+)/i],[[u,"Windows"],[d,v.str,y.os.windows.version]],[/\((bb)(10);/i],[[u,"BlackBerry"],d],[/(blackberry)\w*\/?([\w\.]+)*/i,/(tizen)\/([\w\.]+)/i,/(android|webos|palm\os|qnx|bada|rim\stablet\sos|meego)[\/\s-]?([\w\.]+)*/i],[u,d],[/(symbian\s?os|symbos|s60(?=;))[\/\s-]?([\w\.]+)*/i],[[u,"Symbian"],d],[/mozilla.+\(mobile;.+gecko.+firefox/i],[[u,"Firefox OS"],d],[/(nintendo|playstation)\s([wids3portablevu]+)/i,/(mint)[\/\s\(]?(\w+)*/i,/(joli|[kxln]?ubuntu|debian|[open]*suse|gentoo|arch|slackware|fedora|mandriva|centos|pclinuxos|redhat|zenwalk)[\/\s-]?([\w\.-]+)*/i,/(hurd|linux)\s?([\w\.]+)*/i,/(gnu)\s?([\w\.]+)*/i],[u,d],[/(cros)\s[\w]+\s([\w\.]+\w)/i],[[u,"Chromium OS"],d],[/(sunos)\s?([\w\.]+\d)*/i],[[u,"Solaris"],d],[/\s([frentopc-]{0,4}bsd|dragonfly)\s?([\w\.]+)*/i],[u,d],[/(ip[honead]+)(?:.*os\s*([\w]+)*\slike\smac|;\sopera)/i],[[u,"iOS"],[d,/_/g,"."]],[/(mac\sos\sx)\s?([\w\s\.]+\w)*/i],[u,[d,/_/g,"."]],[/(haiku)\s(\w+)/i,/(aix)\s((\d)(?=\.|\)|\s)[\w\.]*)*/i,/(macintosh|mac(?=_powerpc)|plan\s9|minix|beos|os\/2|amigaos|morphos|risc\sos)/i,/(unix)\s?([\w\.]+)*/i],[u,d]]},E=function(e){var n=e||(window&&window.navigator&&window.navigator.userAgent?window.navigator.userAgent:t);this.getBrowser=function(){return v.rgx.apply(this,w.browser)},this.getEngine=function(){return v.rgx.apply(this,w.engine)},this.getOS=function(){return v.rgx.apply(this,w.os)},this.getResult=function(){return{ua:this.getUA(),browser:this.getBrowser(),engine:this.getEngine(),os:this.getOS()}},this.getUA=function(){return n},this.setUA=function(e){return n=e,this},this.setUA(n)};return(new E).getResult()}(),i=function(){var t={define_property:function(){return!1}(),create_canvas:function(){var e=document.createElement("canvas");return!(!e.getContext||!e.getContext("2d"))}(),return_response_type:function(t){try{if(-1!==e.inArray(t,["","text","document"]))return!0;if(window.XMLHttpRequest){var n=new XMLHttpRequest;if(n.open("get","/"),"responseType"in n)return n.responseType=t,n.responseType!==t?!1:!0}}catch(i){}return!1},use_data_uri:function(){var e=new Image;return e.onload=function(){t.use_data_uri=1===e.width&&1===e.height},setTimeout(function(){e.src="data:image/gif;base64,R0lGODlhAQABAIAAAP8AAAAAACH5BAAAAAAALAAAAAABAAEAAAICRAEAOw=="},1),!1}(),use_data_uri_over32kb:function(){return t.use_data_uri&&("IE"!==r.browser||r.version>=9)},use_data_uri_of:function(e){return t.use_data_uri&&33e3>e||t.use_data_uri_over32kb()},use_fileinput:function(){var e=document.createElement("input");return e.setAttribute("type","file"),!e.disabled}};return function(n){var i=[].slice.call(arguments);return i.shift(),"function"===e.typeOf(t[n])?t[n].apply(this,i):!!t[n]}}(),r={can:i,browser:n.browser.name,version:parseFloat(n.browser.major),os:n.os.name,osVersion:n.os.version,verComp:t,swf_url:"../flash/Moxie.swf",xap_url:"../silverlight/Moxie.xap",global_event_dispatcher:"moxie.core.EventTarget.instance.dispatchEvent"};return r.OS=r.os,r}),i(f,[d],function(e){var t=function(e){return"string"!=typeof e?e:document.getElementById(e)},n=function(e,t){if(!e.className)return!1;var n=new RegExp("(^|\\s+)"+t+"(\\s+|$)");return n.test(e.className)},i=function(e,t){n(e,t)||(e.className=e.className?e.className.replace(/\s+$/,"")+" "+t:t)},r=function(e,t){if(e.className){var n=new RegExp("(^|\\s+)"+t+"(\\s+|$)");e.className=e.className.replace(n,function(e,t,n){return" "===t&&" "===n?" ":""})}},o=function(e,t){return e.currentStyle?e.currentStyle[t]:window.getComputedStyle?window.getComputedStyle(e,null)[t]:void 0},a=function(t,n){function i(e){var t,n,i=0,r=0;return e&&(n=e.getBoundingClientRect(),t="CSS1Compat"===s.compatMode?s.documentElement:s.body,i=n.left+t.scrollLeft,r=n.top+t.scrollTop),{x:i,y:r}}var r=0,o=0,a,s=document,u,c;if(t=t,n=n||s.body,t&&t.getBoundingClientRect&&"IE"===e.browser&&(!s.documentMode||s.documentMode<8))return u=i(t),c=i(n),{x:u.x-c.x,y:u.y-c.y};for(a=t;a&&a!=n&&a.nodeType;)r+=a.offsetLeft||0,o+=a.offsetTop||0,a=a.offsetParent;for(a=t.parentNode;a&&a!=n&&a.nodeType;)r-=a.scrollLeft||0,o-=a.scrollTop||0,a=a.parentNode;return{x:r,y:o}},s=function(e){return{w:e.offsetWidth||e.clientWidth,h:e.offsetHeight||e.clientHeight}};return{get:t,hasClass:n,addClass:i,removeClass:r,getStyle:o,getPos:a,getSize:s}}),i(p,[u],function(e){function t(e,t){var n;for(n in e)if(e[n]===t)return n;return null}return{RuntimeError:function(){function n(e){this.code=e,this.name=t(i,e),this.message=this.name+": RuntimeError "+this.code}var i={NOT_INIT_ERR:1,NOT_SUPPORTED_ERR:9,JS_ERR:4};return e.extend(n,i),n.prototype=Error.prototype,n}(),OperationNotAllowedException:function(){function t(e){this.code=e,this.name="OperationNotAllowedException"}return e.extend(t,{NOT_ALLOWED_ERR:1}),t.prototype=Error.prototype,t}(),ImageError:function(){function n(e){this.code=e,this.name=t(i,e),this.message=this.name+": ImageError "+this.code}var i={WRONG_FORMAT:1,MAX_RESOLUTION_ERR:2};return e.extend(n,i),n.prototype=Error.prototype,n}(),FileException:function(){function n(e){this.code=e,this.name=t(i,e),this.message=this.name+": FileException "+this.code}var i={NOT_FOUND_ERR:1,SECURITY_ERR:2,ABORT_ERR:3,NOT_READABLE_ERR:4,ENCODING_ERR:5,NO_MODIFICATION_ALLOWED_ERR:6,INVALID_STATE_ERR:7,SYNTAX_ERR:8};return e.extend(n,i),n.prototype=Error.prototype,n}(),DOMException:function(){function n(e){this.code=e,this.name=t(i,e),this.message=this.name+": DOMException "+this.code}var i={INDEX_SIZE_ERR:1,DOMSTRING_SIZE_ERR:2,HIERARCHY_REQUEST_ERR:3,WRONG_DOCUMENT_ERR:4,INVALID_CHARACTER_ERR:5,NO_DATA_ALLOWED_ERR:6,NO_MODIFICATION_ALLOWED_ERR:7,NOT_FOUND_ERR:8,NOT_SUPPORTED_ERR:9,INUSE_ATTRIBUTE_ERR:10,INVALID_STATE_ERR:11,SYNTAX_ERR:12,INVALID_MODIFICATION_ERR:13,NAMESPACE_ERR:14,INVALID_ACCESS_ERR:15,VALIDATION_ERR:16,TYPE_MISMATCH_ERR:17,SECURITY_ERR:18,NETWORK_ERR:19,ABORT_ERR:20,URL_MISMATCH_ERR:21,QUOTA_EXCEEDED_ERR:22,TIMEOUT_ERR:23,INVALID_NODE_TYPE_ERR:24,DATA_CLONE_ERR:25};return e.extend(n,i),n.prototype=Error.prototype,n}(),EventException:function(){function t(e){this.code=e,this.name="EventException"}return e.extend(t,{UNSPECIFIED_EVENT_TYPE_ERR:0}),t.prototype=Error.prototype,t}()}}),i(h,[p,u],function(e,t){function n(){var n={};t.extend(this,{uid:null,init:function(){this.uid||(this.uid=t.guid("uid_"))},addEventListener:function(e,i,r,o){var a=this,s;return e=t.trim(e),/\s/.test(e)?(t.each(e.split(/\s+/),function(e){a.addEventListener(e,i,r,o)}),void 0):(e=e.toLowerCase(),r=parseInt(r,10)||0,s=n[this.uid]&&n[this.uid][e]||[],s.push({fn:i,priority:r,scope:o||this}),n[this.uid]||(n[this.uid]={}),n[this.uid][e]=s,void 0)},hasEventListener:function(e){return e?!(!n[this.uid]||!n[this.uid][e]):!!n[this.uid]},removeEventListener:function(e,i){e=e.toLowerCase();var r=n[this.uid]&&n[this.uid][e],o;if(r){if(i){for(o=r.length-1;o>=0;o--)if(r[o].fn===i){r.splice(o,1);break}}else r=[];r.length||(delete n[this.uid][e],t.isEmptyObj(n[this.uid])&&delete n[this.uid])}},removeAllEventListeners:function(){n[this.uid]&&delete n[this.uid]},dispatchEvent:function(i){var r,o,a,s,u={},c=!0,l;if("string"!==t.typeOf(i)){if(s=i,"string"!==t.typeOf(s.type))throw new e.EventException(e.EventException.UNSPECIFIED_EVENT_TYPE_ERR);i=s.type,s.total!==l&&s.loaded!==l&&(u.total=s.total,u.loaded=s.loaded),u.async=s.async||!1}if(-1!==i.indexOf("::")?function(e){r=e[0],i=e[1]}(i.split("::")):r=this.uid,i=i.toLowerCase(),o=n[r]&&n[r][i]){o.sort(function(e,t){return t.priority-e.priority}),a=[].slice.call(arguments),a.shift(),u.type=i,a.unshift(u);var d=[];t.each(o,function(e){a[0].target=e.scope,u.async?d.push(function(t){setTimeout(function(){t(e.fn.apply(e.scope,a)===!1)},1)}):d.push(function(t){t(e.fn.apply(e.scope,a)===!1)})}),d.length&&t.inSeries(d,function(e){c=!e})}return c},bind:function(){this.addEventListener.apply(this,arguments)},unbind:function(){this.removeEventListener.apply(this,arguments)},unbindAll:function(){this.removeAllEventListeners.apply(this,arguments)},trigger:function(){return this.dispatchEvent.apply(this,arguments)},convertEventPropsToHandlers:function(e){var n;"array"!==t.typeOf(e)&&(e=[e]);for(var i=0;i<e.length;i++)n="on"+e[i],"function"===t.typeOf(this[n])?this.addEventListener(e[i],this[n]):"undefined"===t.typeOf(this[n])&&(this[n]=null)}})}return n.instance=new n,n}),i(m,[],function(){var e=function(e){return unescape(encodeURIComponent(e))},t=function(e){return decodeURIComponent(escape(e))},n=function(e,n){if("function"==typeof window.atob)return n?t(window.atob(e)):window.atob(e);var i="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=",r,o,a,s,u,c,l,d,f=0,p=0,h="",m=[];if(!e)return e;e+="";do s=i.indexOf(e.charAt(f++)),u=i.indexOf(e.charAt(f++)),c=i.indexOf(e.charAt(f++)),l=i.indexOf(e.charAt(f++)),d=s<<18|u<<12|c<<6|l,r=255&d>>16,o=255&d>>8,a=255&d,m[p++]=64==c?String.fromCharCode(r):64==l?String.fromCharCode(r,o):String.fromCharCode(r,o,a);while(f<e.length);return h=m.join(""),n?t(h):h},i=function(t,n){if(n&&e(t),"function"==typeof window.btoa)return window.btoa(t);var i="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=",r,o,a,s,u,c,l,d,f=0,p=0,h="",m=[];if(!t)return t;do r=t.charCodeAt(f++),o=t.charCodeAt(f++),a=t.charCodeAt(f++),d=r<<16|o<<8|a,s=63&d>>18,u=63&d>>12,c=63&d>>6,l=63&d,m[p++]=i.charAt(s)+i.charAt(u)+i.charAt(c)+i.charAt(l);while(f<t.length);h=m.join("");var g=t.length%3;return(g?h.slice(0,g-3):h)+"===".slice(g||3)};return{utf8_encode:e,utf8_decode:t,atob:n,btoa:i}}),i(g,[u,f,h],function(e,t,n){function i(n,r,a,s,u){var c=this,l,d=e.guid(r+"_"),f=u||"browser";n=n||{},o[d]=this,a=e.extend({access_binary:!1,access_image_binary:!1,display_media:!1,do_cors:!1,drag_and_drop:!1,filter_by_extension:!0,resize_image:!1,report_upload_progress:!1,return_response_headers:!1,return_response_type:!1,return_status_code:!0,send_custom_headers:!1,select_file:!1,select_folder:!1,select_multiple:!0,send_binary_string:!1,send_browser_cookies:!0,send_multipart:!0,slice_blob:!1,stream_upload:!1,summon_file_dialog:!1,upload_filesize:!0,use_http_method:!0},a),n.preferred_caps&&(f=i.getMode(s,n.preferred_caps,f)),l=function(){var t={};return{exec:function(e,n,i,r){return l[n]&&(t[e]||(t[e]={context:this,instance:new l[n]}),t[e].instance[i])?t[e].instance[i].apply(this,r):void 0},removeInstance:function(e){delete t[e]},removeAllInstances:function(){var n=this;e.each(t,function(t,i){"function"===e.typeOf(t.instance.destroy)&&t.instance.destroy.call(t.context),n.removeInstance(i)})}}}(),e.extend(this,{initialized:!1,uid:d,type:r,mode:i.getMode(s,n.required_caps,f),shimid:d+"_container",clients:0,options:n,can:function(t,n){var r=arguments[2]||a;if("string"===e.typeOf(t)&&"undefined"===e.typeOf(n)&&(t=i.parseCaps(t)),"object"===e.typeOf(t)){for(var o in t)if(!this.can(o,t[o],r))return!1;return!0}return"function"===e.typeOf(r[t])?r[t].call(this,n):n===r[t]},getShimContainer:function(){var n,i=t.get(this.shimid);return i||(n=this.options.container?t.get(this.options.container):document.body,i=document.createElement("div"),i.id=this.shimid,i.className="moxie-shim moxie-shim-"+this.type,e.extend(i.style,{position:"absolute",top:"0px",left:"0px",width:"1px",height:"1px",overflow:"hidden"}),n.appendChild(i),n=null),i},getShim:function(){return l},shimExec:function(e,t){var n=[].slice.call(arguments,2);return c.getShim().exec.call(this,this.uid,e,t,n)},exec:function(e,t){var n=[].slice.call(arguments,2);return c[e]&&c[e][t]?c[e][t].apply(this,n):c.shimExec.apply(this,arguments)},destroy:function(){if(c){var e=t.get(this.shimid);e&&e.parentNode.removeChild(e),l&&l.removeAllInstances(),this.unbindAll(),delete o[this.uid],this.uid=null,d=c=l=e=null}}}),this.mode&&n.required_caps&&!this.can(n.required_caps)&&(this.mode=!1)}var r={},o={};return i.order="html5,flash,silverlight,html4",i.getRuntime=function(e){return o[e]?o[e]:!1},i.addConstructor=function(e,t){t.prototype=n.instance,r[e]=t},i.getConstructor=function(e){return r[e]||null},i.getInfo=function(e){var t=i.getRuntime(e);return t?{uid:t.uid,type:t.type,mode:t.mode,can:function(){return t.can.apply(t,arguments)}}:null},i.parseCaps=function(t){var n={};return"string"!==e.typeOf(t)?t||{}:(e.each(t.split(","),function(e){n[e]=!0}),n)},i.can=function(e,t){var n,r=i.getConstructor(e),o;return r?(n=new r({required_caps:t}),o=n.mode,n.destroy(),!!o):!1},i.thatCan=function(e,t){var n=(t||i.order).split(/\s*,\s*/);for(var r in n)if(i.can(n[r],e))return n[r];return null},i.getMode=function(t,n,i){var r=null;if("undefined"===e.typeOf(i)&&(i="browser"),n&&!e.isEmptyObj(t)){if(e.each(n,function(n,i){if(t.hasOwnProperty(i)){var o=t[i](n);if("string"==typeof o&&(o=[o]),r){if(!(r=e.arrayIntersect(r,o)))return r=!1}else r=o}}),r)return-1!==e.inArray(i,r)?i:r[0];if(r===!1)return!1}return i},i.capTrue=function(){return!0},i.capFalse=function(){return!1},i.capTest=function(e){return function(){return!!e}},i}),i(v,[p,u,g],function(e,t,n){return function i(){var i;t.extend(this,{connectRuntime:function(r){function o(t){var s,u;return t.length?(s=t.shift(),(u=n.getConstructor(s))?(i=new u(r),i.bind("Init",function(){i.initialized=!0,setTimeout(function(){i.clients++,a.trigger("RuntimeInit",i)},1)}),i.bind("Error",function(){i.destroy(),o(t)}),i.mode?(i.init(),void 0):(i.trigger("Error"),void 0)):(o(t),void 0)):(a.trigger("RuntimeError",new e.RuntimeError(e.RuntimeError.NOT_INIT_ERR)),i=null,void 0)}var a=this,s;if("string"===t.typeOf(r)?s=r:"string"===t.typeOf(r.ruid)&&(s=r.ruid),s){if(i=n.getRuntime(s))return i.clients++,i;throw new e.RuntimeError(e.RuntimeError.NOT_INIT_ERR)}o((r.runtime_order||n.order).split(/\s*,\s*/))},getRuntime:function(){return i&&i.uid?i:(i=null,null)},disconnectRuntime:function(){i&&--i.clients<=0&&(i.destroy(),i=null)}})}}),i(y,[u,m,v],function(e,t,n){function i(o,a){function s(t,n,o){var a,s=r[this.uid];return"string"===e.typeOf(s)&&s.length?(a=new i(null,{type:o,size:n-t}),a.detach(s.substr(t,a.size)),a):null}n.call(this),o&&this.connectRuntime(o),a?"string"===e.typeOf(a)&&(a={data:a}):a={},e.extend(this,{uid:a.uid||e.guid("uid_"),ruid:o,size:a.size||0,type:a.type||"",slice:function(e,t,n){return this.isDetached()?s.apply(this,arguments):this.getRuntime().exec.call(this,"Blob","slice",this.getSource(),e,t,n)},getSource:function(){return r[this.uid]?r[this.uid]:null},detach:function(e){this.ruid&&(this.getRuntime().exec.call(this,"Blob","destroy",r[this.uid]),this.disconnectRuntime(),this.ruid=null),e=e||"";var n=e.match(/^data:([^;]*);base64,/);n&&(this.type=n[1],e=t.atob(e.substring(e.indexOf("base64,")+7))),this.size=e.length,r[this.uid]=e},isDetached:function(){return!this.ruid&&"string"===e.typeOf(r[this.uid])},destroy:function(){this.detach(),delete r[this.uid]}}),a.data?this.detach(a.data):r[this.uid]=a}var r={};return i}),i(w,[u,l,y],function(e,t,n){function i(i,r){var o,a;if(r||(r={}),a=r.type&&""!==r.type?r.type:t.getFileMime(r.name),r.name)o=r.name.replace(/\\/g,"/"),o=o.substr(o.lastIndexOf("/")+1);else{var s=a.split("/")[0];o=e.guid((""!==s?s:"file")+"_"),t.extensions[a]&&(o+="."+t.extensions[a][0])}n.apply(this,arguments),e.extend(this,{type:a||"",name:o||e.guid("file_"),lastModifiedDate:r.lastModifiedDate||(new Date).toLocaleString()})}return i.prototype=n.prototype,i}),i(E,[u,l,f,p,h,c,w,g,v],function(e,t,n,i,r,o,a,s,u){function c(r){var c=this,d,f,p;if(-1!==e.inArray(e.typeOf(r),["string","node"])&&(r={browse_button:r}),f=n.get(r.browse_button),!f)throw new i.DOMException(i.DOMException.NOT_FOUND_ERR);p={accept:[{title:o.translate("All Files"),extensions:"*"}],name:"file",multiple:!1,required_caps:!1,container:f.parentNode||document.body},r=e.extend({},p,r),"string"==typeof r.required_caps&&(r.required_caps=s.parseCaps(r.required_caps)),"string"==typeof r.accept&&(r.accept=t.mimes2extList(r.accept)),d=n.get(r.container),d||(d=document.body),"static"===n.getStyle(d,"position")&&(d.style.position="relative"),d=f=null,u.call(c),e.extend(c,{uid:e.guid("uid_"),ruid:null,shimid:null,files:null,init:function(){c.convertEventPropsToHandlers(l),c.bind("RuntimeInit",function(t,i){c.ruid=i.uid,c.shimid=i.shimid,c.bind("Ready",function(){c.trigger("Refresh")},999),c.bind("Change",function(){var t=i.exec.call(c,"FileInput","getFiles");c.files=[],e.each(t,function(e){return 0===e.size?!0:(c.files.push(new a(c.ruid,e)),void 0)})},999),c.bind("Refresh",function(){var t,o,a,s;a=n.get(r.browse_button),s=n.get(i.shimid),a&&(t=n.getPos(a,n.get(r.container)),o=n.getSize(a),s&&e.extend(s.style,{top:t.y+"px",left:t.x+"px",width:o.w+"px",height:o.h+"px"})),s=a=null}),i.exec.call(c,"FileInput","init",r)}),c.connectRuntime(e.extend({},r,{required_caps:{select_file:!0}}))},disable:function(t){var n=this.getRuntime();n&&n.exec.call(this,"FileInput","disable","undefined"===e.typeOf(t)?!0:t)},refresh:function(){c.trigger("Refresh")},destroy:function(){var t=this.getRuntime();t&&(t.exec.call(this,"FileInput","destroy"),this.disconnectRuntime()),"array"===e.typeOf(this.files)&&e.each(this.files,function(e){e.destroy()}),this.files=null}})}var l=["ready","change","cancel","mouseenter","mouseleave","mousedown","mouseup"];return c.prototype=r.instance,c}),i(_,[c,f,p,u,w,v,h,l],function(e,t,n,i,r,o,a,s){function u(n){var a=this,u;"string"==typeof n&&(n={drop_zone:n}),u={accept:[{title:e.translate("All Files"),extensions:"*"}],required_caps:{drag_and_drop:!0}},n="object"==typeof n?i.extend({},u,n):u,n.container=t.get(n.drop_zone)||document.body,"static"===t.getStyle(n.container,"position")&&(n.container.style.position="relative"),"string"==typeof n.accept&&(n.accept=s.mimes2extList(n.accept)),o.call(a),i.extend(a,{uid:i.guid("uid_"),ruid:null,files:null,init:function(){a.convertEventPropsToHandlers(c),a.bind("RuntimeInit",function(e,t){a.ruid=t.uid,a.bind("Drop",function(){var e=t.exec.call(a,"FileDrop","getFiles");a.files=[],i.each(e,function(e){a.files.push(new r(a.ruid,e))})},999),t.exec.call(a,"FileDrop","init",n),a.dispatchEvent("ready")}),a.connectRuntime(n)},destroy:function(){var e=this.getRuntime();e&&(e.exec.call(this,"FileDrop","destroy"),this.disconnectRuntime()),this.files=null}})}var c=["ready","dragenter","dragleave","drop","error"];return u.prototype=a.instance,u}),i(x,[u,v,h],function(e,t,n){function i(){this.uid=e.guid("uid_"),t.call(this),this.destroy=function(){this.disconnectRuntime(),this.unbindAll()}}return i.prototype=n.instance,i}),i(R,[u,m,p,h,y,w,x],function(e,t,n,i,r,o,a){function s(){function i(e,i){function l(e){o.readyState=s.DONE,o.error=e,o.trigger("error"),d()}function d(){c.destroy(),c=null,o.trigger("loadend")}function f(t){c.bind("Error",function(e,t){l(t)}),c.bind("Progress",function(e){o.result=t.exec.call(c,"FileReader","getResult"),o.trigger(e)}),c.bind("Load",function(e){o.readyState=s.DONE,o.result=t.exec.call(c,"FileReader","getResult"),o.trigger(e),d()}),t.exec.call(c,"FileReader","read",e,i)}if(c=new a,this.convertEventPropsToHandlers(u),this.readyState===s.LOADING)return l(new n.DOMException(n.DOMException.INVALID_STATE_ERR));if(this.readyState=s.LOADING,this.trigger("loadstart"),i instanceof r)if(i.isDetached()){var p=i.getSource();switch(e){case"readAsText":case"readAsBinaryString":this.result=p;break;case"readAsDataURL":this.result="data:"+i.type+";base64,"+t.btoa(p)}this.readyState=s.DONE,this.trigger("load"),d()}else f(c.connectRuntime(i.ruid));else l(new n.DOMException(n.DOMException.NOT_FOUND_ERR))}var o=this,c;e.extend(this,{uid:e.guid("uid_"),readyState:s.EMPTY,result:null,error:null,readAsBinaryString:function(e){i.call(this,"readAsBinaryString",e)},readAsDataURL:function(e){i.call(this,"readAsDataURL",e)},readAsText:function(e){i.call(this,"readAsText",e)
|
14 |
-
},abort:function(){this.result=null,-1===e.inArray(this.readyState,[s.EMPTY,s.DONE])&&(this.readyState===s.LOADING&&(this.readyState=s.DONE),c&&c.getRuntime().exec.call(this,"FileReader","abort"),this.trigger("abort"),this.trigger("loadend"))},destroy:function(){this.abort(),c&&(c.getRuntime().exec.call(this,"FileReader","destroy"),c.disconnectRuntime()),o=c=null}})}var u=["loadstart","progress","load","abort","error","loadend"];return s.EMPTY=0,s.LOADING=1,s.DONE=2,s.prototype=i.instance,s}),i(b,[],function(){var e=function(t,n){for(var i=["source","scheme","authority","userInfo","user","pass","host","port","relative","path","directory","file","query","fragment"],r=i.length,o={http:80,https:443},a={},s=/^(?:([^:\/?#]+):)?(?:\/\/()(?:(?:()(?:([^:@]*):?([^:@]*))?@)?([^:\/?#]*)(?::(\d*))?))?()(?:(()(?:(?:[^?#\/]*\/)*)()(?:[^?#]*))(?:\\?([^#]*))?(?:#(.*))?)/,u=s.exec(t||"");r--;)u[r]&&(a[i[r]]=u[r]);if(!a.scheme){n&&"string"!=typeof n||(n=e(n||document.location.href)),a.scheme=n.scheme,a.host=n.host,a.port=n.port;var c="";/^[^\/]/.test(a.path)&&(c=n.path,/(\/|\/[^\.]+)$/.test(c)?c+="/":c=c.replace(/\/[^\/]+$/,"/")),a.path=c+(a.path||"")}return a.port||(a.port=o[a.scheme]||80),a.port=parseInt(a.port,10),a.path||(a.path="/"),delete a.source,a},t=function(t){var n={http:80,https:443},i=e(t);return i.scheme+"://"+i.host+(i.port!==n[i.scheme]?":"+i.port:"")+i.path+(i.query?i.query:"")},n=function(t){function n(e){return[e.scheme,e.host,e.port].join("/")}return"string"==typeof t&&(t=e(t)),n(e())===n(t)};return{parseUrl:e,resolveUrl:t,hasSameOrigin:n}}),i(T,[u,v,m],function(e,t,n){return function(){function i(e,t){if(!t.isDetached()){var i=this.connectRuntime(t.ruid).exec.call(this,"FileReaderSync","read",e,t);return this.disconnectRuntime(),i}var r=t.getSource();switch(e){case"readAsBinaryString":return r;case"readAsDataURL":return"data:"+t.type+";base64,"+n.btoa(r);case"readAsText":for(var o="",a=0,s=r.length;s>a;a++)o+=String.fromCharCode(r[a]);return o}}t.call(this),e.extend(this,{uid:e.guid("uid_"),readAsBinaryString:function(e){return i.call(this,"readAsBinaryString",e)},readAsDataURL:function(e){return i.call(this,"readAsDataURL",e)},readAsText:function(e){return i.call(this,"readAsText",e)}})}}),i(S,[p,u,y],function(e,t,n){function i(){var e,i=[];t.extend(this,{append:function(r,o){var a=this,s=t.typeOf(o);o instanceof n?e={name:r,value:o}:"array"===s?(r+="[]",t.each(o,function(e){a.append(r,e)})):"object"===s?t.each(o,function(e,t){a.append(r+"["+t+"]",e)}):"null"===s||"undefined"===s||"number"===s&&isNaN(o)?a.append(r,"false"):i.push({name:r,value:o.toString()})},hasBlob:function(){return!!this.getBlob()},getBlob:function(){return e&&e.value||null},getBlobName:function(){return e&&e.name||null},each:function(n){t.each(i,function(e){n(e.value,e.name)}),e&&n(e.value,e.name)},destroy:function(){e=null,i=[]}})}return i}),i(A,[u,p,h,m,b,g,x,y,T,S,d,l],function(e,t,n,i,r,o,a,s,u,c,l,d){function f(){this.uid=e.guid("uid_")}function p(){function n(e,t){return y.hasOwnProperty(e)?1===arguments.length?l.can("define_property")?y[e]:v[e]:(l.can("define_property")?y[e]=t:v[e]=t,void 0):void 0}function u(t){function i(){k.destroy(),k=null,s.dispatchEvent("loadend"),s=null}function r(r){k.bind("LoadStart",function(e){n("readyState",p.LOADING),s.dispatchEvent("readystatechange"),s.dispatchEvent(e),I&&s.upload.dispatchEvent(e)}),k.bind("Progress",function(e){n("readyState")!==p.LOADING&&(n("readyState",p.LOADING),s.dispatchEvent("readystatechange")),s.dispatchEvent(e)}),k.bind("UploadProgress",function(e){I&&s.upload.dispatchEvent({type:"progress",lengthComputable:!1,total:e.total,loaded:e.loaded})}),k.bind("Load",function(t){n("readyState",p.DONE),n("status",Number(r.exec.call(k,"XMLHttpRequest","getStatus")||0)),n("statusText",h[n("status")]||""),n("response",r.exec.call(k,"XMLHttpRequest","getResponse",n("responseType"))),~e.inArray(n("responseType"),["text",""])?n("responseText",n("response")):"document"===n("responseType")&&n("responseXML",n("response")),U=r.exec.call(k,"XMLHttpRequest","getAllResponseHeaders"),s.dispatchEvent("readystatechange"),n("status")>0?(I&&s.upload.dispatchEvent(t),s.dispatchEvent(t)):(N=!0,s.dispatchEvent("error")),i()}),k.bind("Abort",function(e){s.dispatchEvent(e),i()}),k.bind("Error",function(e){N=!0,n("readyState",p.DONE),s.dispatchEvent("readystatechange"),D=!0,s.dispatchEvent(e),i()}),r.exec.call(k,"XMLHttpRequest","send",{url:E,method:_,async:w,user:R,password:b,headers:x,mimeType:S,encoding:T,responseType:s.responseType,withCredentials:s.withCredentials,options:P},t)}var s=this;M=(new Date).getTime(),k=new a,"string"==typeof P.required_caps&&(P.required_caps=o.parseCaps(P.required_caps)),P.required_caps=e.extend({},P.required_caps,{return_response_type:s.responseType}),t instanceof c&&(P.required_caps.send_multipart=!0),L||(P.required_caps.do_cors=!0),P.ruid?r(k.connectRuntime(P)):(k.bind("RuntimeInit",function(e,t){r(t)}),k.bind("RuntimeError",function(e,t){s.dispatchEvent("RuntimeError",t)}),k.connectRuntime(P))}function g(){n("responseText",""),n("responseXML",null),n("response",null),n("status",0),n("statusText",""),M=C=null}var v=this,y={timeout:0,readyState:p.UNSENT,withCredentials:!1,status:0,statusText:"",responseType:"",responseXML:null,responseText:null,response:null},w=!0,E,_,x={},R,b,T=null,S=null,A=!1,O=!1,I=!1,D=!1,N=!1,L=!1,M,C,F=null,H=null,P={},k,U="",B;e.extend(this,y,{uid:e.guid("uid_"),upload:new f,open:function(o,a,s,u,c){var l;if(!o||!a)throw new t.DOMException(t.DOMException.SYNTAX_ERR);if(/[\u0100-\uffff]/.test(o)||i.utf8_encode(o)!==o)throw new t.DOMException(t.DOMException.SYNTAX_ERR);if(~e.inArray(o.toUpperCase(),["CONNECT","DELETE","GET","HEAD","OPTIONS","POST","PUT","TRACE","TRACK"])&&(_=o.toUpperCase()),~e.inArray(_,["CONNECT","TRACE","TRACK"]))throw new t.DOMException(t.DOMException.SECURITY_ERR);if(a=i.utf8_encode(a),l=r.parseUrl(a),L=r.hasSameOrigin(l),E=r.resolveUrl(a),(u||c)&&!L)throw new t.DOMException(t.DOMException.INVALID_ACCESS_ERR);if(R=u||l.user,b=c||l.pass,w=s||!0,w===!1&&(n("timeout")||n("withCredentials")||""!==n("responseType")))throw new t.DOMException(t.DOMException.INVALID_ACCESS_ERR);A=!w,O=!1,x={},g.call(this),n("readyState",p.OPENED),this.convertEventPropsToHandlers(["readystatechange"]),this.dispatchEvent("readystatechange")},setRequestHeader:function(r,o){var a=["accept-charset","accept-encoding","access-control-request-headers","access-control-request-method","connection","content-length","cookie","cookie2","content-transfer-encoding","date","expect","host","keep-alive","origin","referer","te","trailer","transfer-encoding","upgrade","user-agent","via"];if(n("readyState")!==p.OPENED||O)throw new t.DOMException(t.DOMException.INVALID_STATE_ERR);if(/[\u0100-\uffff]/.test(r)||i.utf8_encode(r)!==r)throw new t.DOMException(t.DOMException.SYNTAX_ERR);return r=e.trim(r).toLowerCase(),~e.inArray(r,a)||/^(proxy\-|sec\-)/.test(r)?!1:(x[r]?x[r]+=", "+o:x[r]=o,!0)},getAllResponseHeaders:function(){return U||""},getResponseHeader:function(t){return t=t.toLowerCase(),N||~e.inArray(t,["set-cookie","set-cookie2"])?null:U&&""!==U&&(B||(B={},e.each(U.split(/\r\n/),function(t){var n=t.split(/:\s+/);2===n.length&&(n[0]=e.trim(n[0]),B[n[0].toLowerCase()]={header:n[0],value:e.trim(n[1])})})),B.hasOwnProperty(t))?B[t].header+": "+B[t].value:null},overrideMimeType:function(i){var r,o;if(~e.inArray(n("readyState"),[p.LOADING,p.DONE]))throw new t.DOMException(t.DOMException.INVALID_STATE_ERR);if(i=e.trim(i.toLowerCase()),/;/.test(i)&&(r=i.match(/^([^;]+)(?:;\scharset\=)?(.*)$/))&&(i=r[1],r[2]&&(o=r[2])),!d.mimes[i])throw new t.DOMException(t.DOMException.SYNTAX_ERR);F=i,H=o},send:function(n,r){if(P="string"===e.typeOf(r)?{ruid:r}:r?r:{},this.convertEventPropsToHandlers(m),this.upload.convertEventPropsToHandlers(m),this.readyState!==p.OPENED||O)throw new t.DOMException(t.DOMException.INVALID_STATE_ERR);if(n instanceof s)P.ruid=n.ruid,S=n.type||"application/octet-stream";else if(n instanceof c){if(n.hasBlob()){var o=n.getBlob();P.ruid=o.ruid,S=o.type||"application/octet-stream"}}else"string"==typeof n&&(T="UTF-8",S="text/plain;charset=UTF-8",n=i.utf8_encode(n));this.withCredentials||(this.withCredentials=P.required_caps&&P.required_caps.send_browser_cookies&&!L),I=!A&&this.upload.hasEventListener(),N=!1,D=!n,A||(O=!0),u.call(this,n)},abort:function(){if(N=!0,A=!1,~e.inArray(n("readyState"),[p.UNSENT,p.OPENED,p.DONE]))n("readyState",p.UNSENT);else{if(n("readyState",p.DONE),O=!1,!k)throw new t.DOMException(t.DOMException.INVALID_STATE_ERR);k.getRuntime().exec.call(k,"XMLHttpRequest","abort",D),D=!0}},destroy:function(){k&&("function"===e.typeOf(k.destroy)&&k.destroy(),k=null),this.unbindAll(),this.upload&&(this.upload.unbindAll(),this.upload=null)}})}var h={100:"Continue",101:"Switching Protocols",102:"Processing",200:"OK",201:"Created",202:"Accepted",203:"Non-Authoritative Information",204:"No Content",205:"Reset Content",206:"Partial Content",207:"Multi-Status",226:"IM Used",300:"Multiple Choices",301:"Moved Permanently",302:"Found",303:"See Other",304:"Not Modified",305:"Use Proxy",306:"Reserved",307:"Temporary Redirect",400:"Bad Request",401:"Unauthorized",402:"Payment Required",403:"Forbidden",404:"Not Found",405:"Method Not Allowed",406:"Not Acceptable",407:"Proxy Authentication Required",408:"Request Timeout",409:"Conflict",410:"Gone",411:"Length Required",412:"Precondition Failed",413:"Request Entity Too Large",414:"Request-URI Too Long",415:"Unsupported Media Type",416:"Requested Range Not Satisfiable",417:"Expectation Failed",422:"Unprocessable Entity",423:"Locked",424:"Failed Dependency",426:"Upgrade Required",500:"Internal Server Error",501:"Not Implemented",502:"Bad Gateway",503:"Service Unavailable",504:"Gateway Timeout",505:"HTTP Version Not Supported",506:"Variant Also Negotiates",507:"Insufficient Storage",510:"Not Extended"};f.prototype=n.instance;var m=["loadstart","progress","abort","error","load","timeout","loadend"],g=1,v=2;return p.UNSENT=0,p.OPENED=1,p.HEADERS_RECEIVED=2,p.LOADING=3,p.DONE=4,p.prototype=n.instance,p}),i(O,[u,m,v,h],function(e,t,n,i){function r(){function i(){l=d=0,c=this.result=null}function o(t,n){var i=this;u=n,i.bind("TransportingProgress",function(t){d=t.loaded,l>d&&-1===e.inArray(i.state,[r.IDLE,r.DONE])&&a.call(i)},999),i.bind("TransportingComplete",function(){d=l,i.state=r.DONE,c=null,i.result=u.exec.call(i,"Transporter","getAsBlob",t||"")},999),i.state=r.BUSY,i.trigger("TransportingStarted"),a.call(i)}function a(){var e=this,n,i=l-d;f>i&&(f=i),n=t.btoa(c.substr(d,f)),u.exec.call(e,"Transporter","receive",n,l)}var s,u,c,l,d,f;n.call(this),e.extend(this,{uid:e.guid("uid_"),state:r.IDLE,result:null,transport:function(t,n,r){var a=this;if(r=e.extend({chunk_size:204798},r),(s=r.chunk_size%3)&&(r.chunk_size+=3-s),f=r.chunk_size,i.call(this),c=t,l=t.length,"string"===e.typeOf(r)||r.ruid)o.call(a,n,this.connectRuntime(r));else{var u=function(e,t){a.unbind("RuntimeInit",u),o.call(a,n,t)};this.bind("RuntimeInit",u),this.connectRuntime(r)}},abort:function(){var e=this;e.state=r.IDLE,u&&(u.exec.call(e,"Transporter","clear"),e.trigger("TransportingAborted")),i.call(e)},destroy:function(){this.unbindAll(),u=null,this.disconnectRuntime(),i.call(this)}})}return r.IDLE=0,r.BUSY=1,r.DONE=2,r.prototype=i.instance,r}),i(I,[u,f,p,T,A,g,v,O,d,h,y,w,m],function(e,t,n,i,r,o,a,s,u,c,l,d,f){function p(){function i(e){e||(e=this.getRuntime().exec.call(this,"Image","getInfo")),this.size=e.size,this.width=e.width,this.height=e.height,this.type=e.type,this.meta=e.meta,""===this.name&&(this.name=e.name)}function c(t){var i=e.typeOf(t);try{if(t instanceof p){if(!t.size)throw new n.DOMException(n.DOMException.INVALID_STATE_ERR);m.apply(this,arguments)}else if(t instanceof l){if(!~e.inArray(t.type,["image/jpeg","image/png"]))throw new n.ImageError(n.ImageError.WRONG_FORMAT);g.apply(this,arguments)}else if(-1!==e.inArray(i,["blob","file"]))c.call(this,new d(null,t),arguments[1]);else if("string"===i)/^data:[^;]*;base64,/.test(t)?c.call(this,new l(null,{data:t}),arguments[1]):v.apply(this,arguments);else{if("node"!==i||"img"!==t.nodeName.toLowerCase())throw new n.DOMException(n.DOMException.TYPE_MISMATCH_ERR);c.call(this,t.src,arguments[1])}}catch(r){this.trigger("error",r)}}function m(t,n){var i=this.connectRuntime(t.ruid);this.ruid=i.uid,i.exec.call(this,"Image","loadFromImage",t,"undefined"===e.typeOf(n)?!0:n)}function g(t,n){function i(e){r.ruid=e.uid,e.exec.call(r,"Image","loadFromBlob",t)}var r=this;r.name=t.name||"",t.isDetached()?(this.bind("RuntimeInit",function(e,t){i(t)}),n&&"string"==typeof n.required_caps&&(n.required_caps=o.parseCaps(n.required_caps)),this.connectRuntime(e.extend({required_caps:{access_image_binary:!0,resize_image:!0}},n))):i(this.connectRuntime(t.ruid))}function v(e,t){var n=this,i;i=new r,i.open("get",e),i.responseType="blob",i.onprogress=function(e){n.trigger(e)},i.onload=function(){g.call(n,i.response,!0)},i.onerror=function(e){n.trigger(e)},i.onloadend=function(){i.destroy()},i.bind("RuntimeError",function(e,t){n.trigger("RuntimeError",t)}),i.send(null,t)}a.call(this),e.extend(this,{uid:e.guid("uid_"),ruid:null,name:"",size:0,width:0,height:0,type:"",meta:{},clone:function(){this.load.apply(this,arguments)},load:function(){this.bind("Load Resize",function(){i.call(this)},999),this.convertEventPropsToHandlers(h),c.apply(this,arguments)},downsize:function(t,i,r,o){try{if(!this.size)throw new n.DOMException(n.DOMException.INVALID_STATE_ERR);if(this.width>p.MAX_RESIZE_WIDTH||this.height>p.MAX_RESIZE_HEIGHT)throw new n.ImageError(n.ImageError.MAX_RESOLUTION_ERR);(!t&&!i||"undefined"===e.typeOf(r))&&(r=!1),t=t||this.width,i=i||this.height,o="undefined"===e.typeOf(o)?!0:!!o,this.getRuntime().exec.call(this,"Image","downsize",t,i,r,o)}catch(a){this.trigger("error",a)}},crop:function(e,t,n){this.downsize(e,t,!0,n)},getAsCanvas:function(){if(!u.can("create_canvas"))throw new n.RuntimeError(n.RuntimeError.NOT_SUPPORTED_ERR);var e=this.connectRuntime(this.ruid);return e.exec.call(this,"Image","getAsCanvas")},getAsBlob:function(e,t){if(!this.size)throw new n.DOMException(n.DOMException.INVALID_STATE_ERR);return e||(e="image/jpeg"),"image/jpeg"!==e||t||(t=90),this.getRuntime().exec.call(this,"Image","getAsBlob",e,t)},getAsDataURL:function(e,t){if(!this.size)throw new n.DOMException(n.DOMException.INVALID_STATE_ERR);return this.getRuntime().exec.call(this,"Image","getAsDataURL",e,t)},getAsBinaryString:function(e,t){var n=this.getAsDataURL(e,t);return f.atob(n.substring(n.indexOf("base64,")+7))},embed:function(i){function r(){if(u.can("create_canvas")){var t=a.getAsCanvas();if(t)return i.appendChild(t),t=null,a.destroy(),o.trigger("embedded"),void 0}var r=a.getAsDataURL(c,l);if(!r)throw new n.ImageError(n.ImageError.WRONG_FORMAT);if(u.can("use_data_uri_of",r.length))i.innerHTML='<img src="'+r+'" width="'+a.width+'" height="'+a.height+'" />',a.destroy(),o.trigger("embedded");else{var d=new s;d.bind("TransportingComplete",function(){v=o.connectRuntime(this.result.ruid),o.bind("Embedded",function(){e.extend(v.getShimContainer().style,{top:"0px",left:"0px",width:a.width+"px",height:a.height+"px"}),v=null},999),v.exec.call(o,"ImageView","display",this.result.uid,m,g),a.destroy()}),d.transport(f.atob(r.substring(r.indexOf("base64,")+7)),c,e.extend({},h,{required_caps:{display_media:!0},runtime_order:"flash,silverlight",container:i}))}}var o=this,a,c,l,d,h=arguments[1]||{},m=this.width,g=this.height,v;try{if(!(i=t.get(i)))throw new n.DOMException(n.DOMException.INVALID_NODE_TYPE_ERR);if(!this.size)throw new n.DOMException(n.DOMException.INVALID_STATE_ERR);if(this.width>p.MAX_RESIZE_WIDTH||this.height>p.MAX_RESIZE_HEIGHT)throw new n.ImageError(n.ImageError.MAX_RESOLUTION_ERR);if(c=h.type||this.type||"image/jpeg",l=h.quality||90,d="undefined"!==e.typeOf(h.crop)?h.crop:!1,h.width)m=h.width,g=h.height||m;else{var y=t.getSize(i);y.w&&y.h&&(m=y.w,g=y.h)}return a=new p,a.bind("Resize",function(){r.call(o)}),a.bind("Load",function(){a.downsize(m,g,d,!1)}),a.clone(this,!1),a}catch(w){this.trigger("error",w)}},destroy:function(){this.ruid&&(this.getRuntime().exec.call(this,"Image","destroy"),this.disconnectRuntime()),this.unbindAll()}})}var h=["progress","load","error","resize","embedded"];return p.MAX_RESIZE_WIDTH=6500,p.MAX_RESIZE_HEIGHT=6500,p.prototype=c.instance,p}),i(D,[u,p,g,d],function(e,t,n,i){function r(t){var r=this,s=n.capTest,u=n.capTrue,c=e.extend({access_binary:s(window.FileReader||window.File&&window.File.getAsDataURL),access_image_binary:function(){return r.can("access_binary")&&!!a.Image},display_media:s(i.can("create_canvas")||i.can("use_data_uri_over32kb")),do_cors:s(window.XMLHttpRequest&&"withCredentials"in new XMLHttpRequest),drag_and_drop:s(function(){var e=document.createElement("div");return("draggable"in e||"ondragstart"in e&&"ondrop"in e)&&("IE"!==i.browser||i.version>9)}()),filter_by_extension:s(function(){return"Chrome"===i.browser&&i.version>=28||"IE"===i.browser&&i.version>=10}()),return_response_headers:u,return_response_type:function(e){return"json"===e&&window.JSON?!0:i.can("return_response_type",e)},return_status_code:u,report_upload_progress:s(window.XMLHttpRequest&&(new XMLHttpRequest).upload),resize_image:function(){return r.can("access_binary")&&i.can("create_canvas")},select_file:function(){return i.can("use_fileinput")&&window.File},select_folder:function(){return r.can("select_file")&&"Chrome"===i.browser&&i.version>=21},select_multiple:function(){return!(!r.can("select_file")||"Safari"===i.browser&&"Windows"===i.os||"iOS"===i.os&&i.verComp(i.osVersion,"7.0.4","<"))},send_binary_string:s(window.XMLHttpRequest&&((new XMLHttpRequest).sendAsBinary||window.Uint8Array&&window.ArrayBuffer)),send_custom_headers:s(window.XMLHttpRequest),send_multipart:function(){return!!(window.XMLHttpRequest&&(new XMLHttpRequest).upload&&window.FormData)||r.can("send_binary_string")},slice_blob:s(window.File&&(File.prototype.mozSlice||File.prototype.webkitSlice||File.prototype.slice)),stream_upload:function(){return r.can("slice_blob")&&r.can("send_multipart")},summon_file_dialog:s(function(){return"Firefox"===i.browser&&i.version>=4||"Opera"===i.browser&&i.version>=12||"IE"===i.browser&&i.version>=10||!!~e.inArray(i.browser,["Chrome","Safari"])}()),upload_filesize:u},arguments[2]);n.call(this,t,arguments[1]||o,c),e.extend(this,{init:function(){this.trigger("Init")},destroy:function(e){return function(){e.call(r),e=r=null}}(this.destroy)}),e.extend(this.getShim(),a)}var o="html5",a={};return n.addConstructor(o,r),a}),i(N,[D,y],function(e,t){function n(){function e(e,t,n){var i;if(!window.File.prototype.slice)return(i=window.File.prototype.webkitSlice||window.File.prototype.mozSlice)?i.call(e,t,n):null;try{return e.slice(),e.slice(t,n)}catch(r){return e.slice(t,n-t)}}this.slice=function(){return new t(this.getRuntime().uid,e.apply(this,arguments))}}return e.Blob=n}),i(L,[u],function(e){function t(){this.returnValue=!1}function n(){this.cancelBubble=!0}var i={},r="moxie_"+e.guid(),o=function(o,a,s,u){var c,l;a=a.toLowerCase(),o.addEventListener?(c=s,o.addEventListener(a,c,!1)):o.attachEvent&&(c=function(){var e=window.event;e.target||(e.target=e.srcElement),e.preventDefault=t,e.stopPropagation=n,s(e)},o.attachEvent("on"+a,c)),o[r]||(o[r]=e.guid()),i.hasOwnProperty(o[r])||(i[o[r]]={}),l=i[o[r]],l.hasOwnProperty(a)||(l[a]=[]),l[a].push({func:c,orig:s,key:u})},a=function(t,n,o){var a,s;if(n=n.toLowerCase(),t[r]&&i[t[r]]&&i[t[r]][n]){a=i[t[r]][n];for(var u=a.length-1;u>=0&&(a[u].orig!==o&&a[u].key!==o||(t.removeEventListener?t.removeEventListener(n,a[u].func,!1):t.detachEvent&&t.detachEvent("on"+n,a[u].func),a[u].orig=null,a[u].func=null,a.splice(u,1),o===s));u--);if(a.length||delete i[t[r]][n],e.isEmptyObj(i[t[r]])){delete i[t[r]];try{delete t[r]}catch(c){t[r]=s}}}},s=function(t,n){t&&t[r]&&e.each(i[t[r]],function(e,i){a(t,i,n)})};return{addEvent:o,removeEvent:a,removeAllEvents:s}}),i(M,[D,u,f,L,l,d],function(e,t,n,i,r,o){function a(){var e=[],a;t.extend(this,{init:function(s){var u=this,c=u.getRuntime(),l,d,f,p,h,m;a=s,e=[],f=a.accept.mimes||r.extList2mimes(a.accept,c.can("filter_by_extension")),d=c.getShimContainer(),d.innerHTML='<input id="'+c.uid+'" type="file" style="font-size:999px;opacity:0;"'+(a.multiple&&c.can("select_multiple")?"multiple":"")+(a.directory&&c.can("select_folder")?"webkitdirectory directory":"")+(f?' accept="'+f.join(",")+'"':"")+" />",l=n.get(c.uid),t.extend(l.style,{position:"absolute",top:0,left:0,width:"100%",height:"100%"}),p=n.get(a.browse_button),c.can("summon_file_dialog")&&("static"===n.getStyle(p,"position")&&(p.style.position="relative"),h=parseInt(n.getStyle(p,"z-index"),10)||1,p.style.zIndex=h,d.style.zIndex=h-1,i.addEvent(p,"click",function(e){var t=n.get(c.uid);t&&!t.disabled&&t.click(),e.preventDefault()},u.uid)),m=c.can("summon_file_dialog")?p:d,i.addEvent(m,"mouseover",function(){u.trigger("mouseenter")},u.uid),i.addEvent(m,"mouseout",function(){u.trigger("mouseleave")},u.uid),i.addEvent(m,"mousedown",function(){u.trigger("mousedown")},u.uid),i.addEvent(n.get(a.container),"mouseup",function(){u.trigger("mouseup")},u.uid),l.onchange=function g(){if(e=[],a.directory?t.each(this.files,function(t){"."!==t.name&&e.push(t)}):e=[].slice.call(this.files),"IE"!==o.browser)this.value="";else{var n=this.cloneNode(!0);this.parentNode.replaceChild(n,this),n.onchange=g}u.trigger("change")},u.trigger({type:"ready",async:!0}),d=null},getFiles:function(){return e},disable:function(e){var t=this.getRuntime(),i;(i=n.get(t.uid))&&(i.disabled=!!e)},destroy:function(){var t=this.getRuntime(),r=t.getShim(),o=t.getShimContainer();i.removeAllEvents(o,this.uid),i.removeAllEvents(a&&n.get(a.container),this.uid),i.removeAllEvents(a&&n.get(a.browse_button),this.uid),o&&(o.innerHTML=""),r.removeInstance(this.uid),e=a=o=r=null}})}return e.FileInput=a}),i(C,[D,u,f,L,l],function(e,t,n,i,r){function o(){function e(e){for(var n=[],i=0;i<e.length;i++)[].push.apply(n,e[i].extensions.split(/\s*,\s*/));return-1===t.inArray("*",n)?n:[]}function o(e){var n=r.getFileExtension(e.name);return!n||!d.length||-1!==t.inArray(n,d)}function a(e,n){var i=[];t.each(e,function(e){var t=e.webkitGetAsEntry();if(t)if(t.isFile){var n=e.getAsFile();o(n)&&l.push(n)}else i.push(t)}),i.length?s(i,n):n()}function s(e,n){var i=[];t.each(e,function(e){i.push(function(t){u(e,t)})}),t.inSeries(i,function(){n()})}function u(e,t){e.isFile?e.file(function(e){o(e)&&l.push(e),t()},function(){t()}):e.isDirectory?c(e,t):t()}function c(e,t){function n(e){r.readEntries(function(t){t.length?([].push.apply(i,t),n(e)):e()},e)}var i=[],r=e.createReader();n(function(){s(i,t)})}var l=[],d=[],f;t.extend(this,{init:function(n){var r=this,s;f=n,d=e(f.accept),s=f.container,i.addEvent(s,"dragover",function(e){e.preventDefault(),e.stopPropagation(),e.dataTransfer.dropEffect="copy"},r.uid),i.addEvent(s,"drop",function(e){e.preventDefault(),e.stopPropagation(),l=[],e.dataTransfer.items&&e.dataTransfer.items[0].webkitGetAsEntry?a(e.dataTransfer.items,function(){r.trigger("drop")}):(t.each(e.dataTransfer.files,function(e){o(e)&&l.push(e)}),r.trigger("drop"))},r.uid),i.addEvent(s,"dragenter",function(e){e.preventDefault(),e.stopPropagation(),r.trigger("dragenter")},r.uid),i.addEvent(s,"dragleave",function(e){e.preventDefault(),e.stopPropagation(),r.trigger("dragleave")},r.uid)},getFiles:function(){return l},destroy:function(){i.removeAllEvents(f&&n.get(f.container),this.uid),l=d=f=null}})}return e.FileDrop=o}),i(F,[D,m,u],function(e,t,n){function i(){function e(e){return t.atob(e.substring(e.indexOf("base64,")+7))}var i,r=!1;n.extend(this,{read:function(e,t){var o=this;i=new window.FileReader,i.addEventListener("progress",function(e){o.trigger(e)}),i.addEventListener("load",function(e){o.trigger(e)}),i.addEventListener("error",function(e){o.trigger(e,i.error)}),i.addEventListener("loadend",function(){i=null}),"function"===n.typeOf(i[e])?(r=!1,i[e](t.getSource())):"readAsBinaryString"===e&&(r=!0,i.readAsDataURL(t.getSource()))},getResult:function(){return i&&i.result?r?e(i.result):i.result:null},abort:function(){i&&i.abort()},destroy:function(){i=null}})}return e.FileReader=i}),i(H,[D,u,l,b,w,y,S,p,d],function(e,t,n,i,r,o,a,s,u){function c(){function e(e,t){var n=this,i,r;i=t.getBlob().getSource(),r=new window.FileReader,r.onload=function(){t.append(t.getBlobName(),new o(null,{type:i.type,data:r.result})),f.send.call(n,e,t)},r.readAsBinaryString(i)}function c(){return!window.XMLHttpRequest||"IE"===u.browser&&u.version<8?function(){for(var e=["Msxml2.XMLHTTP.6.0","Microsoft.XMLHTTP"],t=0;t<e.length;t++)try{return new ActiveXObject(e[t])}catch(n){}}():new window.XMLHttpRequest}function l(e){var t=e.responseXML,n=e.responseText;return"IE"===u.browser&&n&&t&&!t.documentElement&&/[^\/]+\/[^\+]+\+xml/.test(e.getResponseHeader("Content-Type"))&&(t=new window.ActiveXObject("Microsoft.XMLDOM"),t.async=!1,t.validateOnParse=!1,t.loadXML(n)),t&&("IE"===u.browser&&0!==t.parseError||!t.documentElement||"parsererror"===t.documentElement.tagName)?null:t}function d(e){var t="----moxieboundary"+(new Date).getTime(),n="--",i="\r\n",r="",a=this.getRuntime();if(!a.can("send_binary_string"))throw new s.RuntimeError(s.RuntimeError.NOT_SUPPORTED_ERR);return p.setRequestHeader("Content-Type","multipart/form-data; boundary="+t),e.each(function(e,a){r+=e instanceof o?n+t+i+'Content-Disposition: form-data; name="'+a+'"; filename="'+unescape(encodeURIComponent(e.name||"blob"))+'"'+i+"Content-Type: "+(e.type||"application/octet-stream")+i+i+e.getSource()+i:n+t+i+'Content-Disposition: form-data; name="'+a+'"'+i+i+unescape(encodeURIComponent(e))+i}),r+=n+t+n+i}var f=this,p,h;t.extend(this,{send:function(n,r){var s=this,l="Mozilla"===u.browser&&u.version>=4&&u.version<7,f="Android Browser"===u.browser,m=!1;if(h=n.url.replace(/^.+?\/([\w\-\.]+)$/,"$1").toLowerCase(),p=c(),p.open(n.method,n.url,n.async,n.user,n.password),r instanceof o)r.isDetached()&&(m=!0),r=r.getSource();else if(r instanceof a){if(r.hasBlob())if(r.getBlob().isDetached())r=d.call(s,r),m=!0;else if((l||f)&&"blob"===t.typeOf(r.getBlob().getSource())&&window.FileReader)return e.call(s,n,r),void 0;if(r instanceof a){var g=new window.FormData;r.each(function(e,t){e instanceof o?g.append(t,e.getSource()):g.append(t,e)}),r=g}}p.upload?(n.withCredentials&&(p.withCredentials=!0),p.addEventListener("load",function(e){s.trigger(e)}),p.addEventListener("error",function(e){s.trigger(e)}),p.addEventListener("progress",function(e){s.trigger(e)}),p.upload.addEventListener("progress",function(e){s.trigger({type:"UploadProgress",loaded:e.loaded,total:e.total})})):p.onreadystatechange=function v(){switch(p.readyState){case 1:break;case 2:break;case 3:var e,t;try{i.hasSameOrigin(n.url)&&(e=p.getResponseHeader("Content-Length")||0),p.responseText&&(t=p.responseText.length)}catch(r){e=t=0}s.trigger({type:"progress",lengthComputable:!!e,total:parseInt(e,10),loaded:t});break;case 4:p.onreadystatechange=function(){},0===p.status?s.trigger("error"):s.trigger("load")}},t.isEmptyObj(n.headers)||t.each(n.headers,function(e,t){p.setRequestHeader(t,e)}),""!==n.responseType&&"responseType"in p&&(p.responseType="json"!==n.responseType||u.can("return_response_type","json")?n.responseType:"text"),m?p.sendAsBinary?p.sendAsBinary(r):function(){for(var e=new Uint8Array(r.length),t=0;t<r.length;t++)e[t]=255&r.charCodeAt(t);p.send(e.buffer)}():p.send(r),s.trigger("loadstart")},getStatus:function(){try{if(p)return p.status}catch(e){}return 0},getResponse:function(e){var t=this.getRuntime();try{switch(e){case"blob":var i=new r(t.uid,p.response),o=p.getResponseHeader("Content-Disposition");if(o){var a=o.match(/filename=([\'\"'])([^\1]+)\1/);a&&(h=a[2])}return i.name=h,i.type||(i.type=n.getFileMime(h)),i;case"json":return u.can("return_response_type","json")?p.response:200===p.status&&window.JSON?JSON.parse(p.responseText):null;case"document":return l(p);default:return""!==p.responseText?p.responseText:null}}catch(s){return null}},getAllResponseHeaders:function(){try{return p.getAllResponseHeaders()}catch(e){}return""},abort:function(){p&&p.abort()},destroy:function(){f=h=null}})}return e.XMLHttpRequest=c}),i(P,[],function(){return function(){function e(e,t){var n=r?0:-8*(t-1),i=0,a;for(a=0;t>a;a++)i|=o.charCodeAt(e+a)<<Math.abs(n+8*a);return i}function n(e,t,n){n=3===arguments.length?n:o.length-t-1,o=o.substr(0,t)+e+o.substr(n+t)}function i(e,t,i){var o="",a=r?0:-8*(i-1),s;for(s=0;i>s;s++)o+=String.fromCharCode(255&t>>Math.abs(a+8*s));n(o,e,i)}var r=!1,o;return{II:function(e){return e===t?r:(r=e,void 0)},init:function(e){r=!1,o=e},SEGMENT:function(e,t,i){switch(arguments.length){case 1:return o.substr(e,o.length-e-1);case 2:return o.substr(e,t);case 3:n(i,e,t);break;default:return o}},BYTE:function(t){return e(t,1)},SHORT:function(t){return e(t,2)},LONG:function(n,r){return r===t?e(n,4):(i(n,r,4),void 0)},SLONG:function(t){var n=e(t,4);return n>2147483647?n-4294967296:n},STRING:function(t,n){var i="";for(n+=t;n>t;t++)i+=String.fromCharCode(e(t,1));return i}}}}),i(k,[P],function(e){return function t(n){var i=[],r,o,a,s=0;if(r=new e,r.init(n),65496===r.SHORT(0)){for(o=2;o<=n.length;)if(a=r.SHORT(o),a>=65488&&65495>=a)o+=2;else{if(65498===a||65497===a)break;s=r.SHORT(o+2)+2,a>=65505&&65519>=a&&i.push({hex:a,name:"APP"+(15&a),start:o,length:s,segment:r.SEGMENT(o,s)}),o+=s}return r.init(null),{headers:i,restore:function(e){var t,n;for(r.init(e),o=65504==r.SHORT(2)?4+r.SHORT(4):2,n=0,t=i.length;t>n;n++)r.SEGMENT(o,0,i[n].segment),o+=i[n].length;return e=r.SEGMENT(),r.init(null),e},strip:function(e){var n,i,o;for(i=new t(e),n=i.headers,i.purge(),r.init(e),o=n.length;o--;)r.SEGMENT(n[o].start,n[o].length,"");return e=r.SEGMENT(),r.init(null),e},get:function(e){for(var t=[],n=0,r=i.length;r>n;n++)i[n].name===e.toUpperCase()&&t.push(i[n].segment);return t},set:function(e,t){var n=[],r,o,a;for("string"==typeof t?n.push(t):n=t,r=o=0,a=i.length;a>r&&(i[r].name===e.toUpperCase()&&(i[r].segment=n[o],i[r].length=n[o].length,o++),!(o>=n.length));r++);},purge:function(){i=[],r.init(null),r=null}}}}}),i(U,[u,P],function(e,n){return function i(){function i(e,n){var i=a.SHORT(e),r,o,s,u,d,f,p,h,m=[],g={};for(r=0;i>r;r++)if(p=f=e+12*r+2,s=n[a.SHORT(p)],s!==t){switch(u=a.SHORT(p+=2),d=a.LONG(p+=2),p+=4,m=[],u){case 1:case 7:for(d>4&&(p=a.LONG(p)+c.tiffHeader),o=0;d>o;o++)m[o]=a.BYTE(p+o);break;case 2:d>4&&(p=a.LONG(p)+c.tiffHeader),g[s]=a.STRING(p,d-1);continue;case 3:for(d>2&&(p=a.LONG(p)+c.tiffHeader),o=0;d>o;o++)m[o]=a.SHORT(p+2*o);break;case 4:for(d>1&&(p=a.LONG(p)+c.tiffHeader),o=0;d>o;o++)m[o]=a.LONG(p+4*o);break;case 5:for(p=a.LONG(p)+c.tiffHeader,o=0;d>o;o++)m[o]=a.LONG(p+4*o)/a.LONG(p+4*o+4);break;case 9:for(p=a.LONG(p)+c.tiffHeader,o=0;d>o;o++)m[o]=a.SLONG(p+4*o);break;case 10:for(p=a.LONG(p)+c.tiffHeader,o=0;d>o;o++)m[o]=a.SLONG(p+4*o)/a.SLONG(p+4*o+4);break;default:continue}h=1==d?m[0]:m,g[s]=l.hasOwnProperty(s)&&"object"!=typeof h?l[s][h]:h}return g}function r(){var e=c.tiffHeader;return a.II(18761==a.SHORT(e)),42!==a.SHORT(e+=2)?!1:(c.IFD0=c.tiffHeader+a.LONG(e+=2),u=i(c.IFD0,s.tiff),"ExifIFDPointer"in u&&(c.exifIFD=c.tiffHeader+u.ExifIFDPointer,delete u.ExifIFDPointer),"GPSInfoIFDPointer"in u&&(c.gpsIFD=c.tiffHeader+u.GPSInfoIFDPointer,delete u.GPSInfoIFDPointer),!0)}function o(e,t,n){var i,r,o,u=0;if("string"==typeof t){var l=s[e.toLowerCase()];for(var d in l)if(l[d]===t){t=d;break}}i=c[e.toLowerCase()+"IFD"],r=a.SHORT(i);for(var f=0;r>f;f++)if(o=i+12*f+2,a.SHORT(o)==t){u=o+8;break}return u?(a.LONG(u,n),!0):!1}var a,s,u,c={},l;return a=new n,s={tiff:{274:"Orientation",270:"ImageDescription",271:"Make",272:"Model",305:"Software",34665:"ExifIFDPointer",34853:"GPSInfoIFDPointer"},exif:{36864:"ExifVersion",40961:"ColorSpace",40962:"PixelXDimension",40963:"PixelYDimension",36867:"DateTimeOriginal",33434:"ExposureTime",33437:"FNumber",34855:"ISOSpeedRatings",37377:"ShutterSpeedValue",37378:"ApertureValue",37383:"MeteringMode",37384:"LightSource",37385:"Flash",37386:"FocalLength",41986:"ExposureMode",41987:"WhiteBalance",41990:"SceneCaptureType",41988:"DigitalZoomRatio",41992:"Contrast",41993:"Saturation",41994:"Sharpness"},gps:{0:"GPSVersionID",1:"GPSLatitudeRef",2:"GPSLatitude",3:"GPSLongitudeRef",4:"GPSLongitude"}},l={ColorSpace:{1:"sRGB",0:"Uncalibrated"},MeteringMode:{0:"Unknown",1:"Average",2:"CenterWeightedAverage",3:"Spot",4:"MultiSpot",5:"Pattern",6:"Partial",255:"Other"},LightSource:{1:"Daylight",2:"Fliorescent",3:"Tungsten",4:"Flash",9:"Fine weather",10:"Cloudy weather",11:"Shade",12:"Daylight fluorescent (D 5700 - 7100K)",13:"Day white fluorescent (N 4600 -5400K)",14:"Cool white fluorescent (W 3900 - 4500K)",15:"White fluorescent (WW 3200 - 3700K)",17:"Standard light A",18:"Standard light B",19:"Standard light C",20:"D55",21:"D65",22:"D75",23:"D50",24:"ISO studio tungsten",255:"Other"},Flash:{0:"Flash did not fire.",1:"Flash fired.",5:"Strobe return light not detected.",7:"Strobe return light detected.",9:"Flash fired, compulsory flash mode",13:"Flash fired, compulsory flash mode, return light not detected",15:"Flash fired, compulsory flash mode, return light detected",16:"Flash did not fire, compulsory flash mode",24:"Flash did not fire, auto mode",25:"Flash fired, auto mode",29:"Flash fired, auto mode, return light not detected",31:"Flash fired, auto mode, return light detected",32:"No flash function",65:"Flash fired, red-eye reduction mode",69:"Flash fired, red-eye reduction mode, return light not detected",71:"Flash fired, red-eye reduction mode, return light detected",73:"Flash fired, compulsory flash mode, red-eye reduction mode",77:"Flash fired, compulsory flash mode, red-eye reduction mode, return light not detected",79:"Flash fired, compulsory flash mode, red-eye reduction mode, return light detected",89:"Flash fired, auto mode, red-eye reduction mode",93:"Flash fired, auto mode, return light not detected, red-eye reduction mode",95:"Flash fired, auto mode, return light detected, red-eye reduction mode"},ExposureMode:{0:"Auto exposure",1:"Manual exposure",2:"Auto bracket"},WhiteBalance:{0:"Auto white balance",1:"Manual white balance"},SceneCaptureType:{0:"Standard",1:"Landscape",2:"Portrait",3:"Night scene"},Contrast:{0:"Normal",1:"Soft",2:"Hard"},Saturation:{0:"Normal",1:"Low saturation",2:"High saturation"},Sharpness:{0:"Normal",1:"Soft",2:"Hard"},GPSLatitudeRef:{N:"North latitude",S:"South latitude"},GPSLongitudeRef:{E:"East longitude",W:"West longitude"}},{init:function(e){return c={tiffHeader:10},e!==t&&e.length?(a.init(e),65505===a.SHORT(0)&&"EXIF\0"===a.STRING(4,5).toUpperCase()?r():!1):!1
|
15 |
-
},TIFF:function(){return u},EXIF:function(){var t;if(t=i(c.exifIFD,s.exif),t.ExifVersion&&"array"===e.typeOf(t.ExifVersion)){for(var n=0,r="";n<t.ExifVersion.length;n++)r+=String.fromCharCode(t.ExifVersion[n]);t.ExifVersion=r}return t},GPS:function(){var t;return t=i(c.gpsIFD,s.gps),t.GPSVersionID&&"array"===e.typeOf(t.GPSVersionID)&&(t.GPSVersionID=t.GPSVersionID.join(".")),t},setExif:function(e,t){return"PixelXDimension"!==e&&"PixelYDimension"!==e?!1:o("exif",e,t)},getBinary:function(){return a.SEGMENT()},purge:function(){a.init(null),a=u=null,c={}}}}}),i(B,[u,p,k,P,U],function(e,t,n,i,r){function o(o){function a(){for(var e=0,t,n;e<=u.length;){if(t=c.SHORT(e+=2),t>=65472&&65475>=t)return e+=5,{height:c.SHORT(e),width:c.SHORT(e+=2)};n=c.SHORT(e+=2),e+=n-2}return null}function s(){d&&l&&c&&(d.purge(),l.purge(),c.init(null),u=f=l=d=c=null)}var u,c,l,d,f,p;if(u=o,c=new i,c.init(u),65496!==c.SHORT(0))throw new t.ImageError(t.ImageError.WRONG_FORMAT);l=new n(o),d=new r,p=!!d.init(l.get("app1")[0]),f=a.call(this),e.extend(this,{type:"image/jpeg",size:u.length,width:f&&f.width||0,height:f&&f.height||0,setExif:function(t,n){return p?("object"===e.typeOf(t)?e.each(t,function(e,t){d.setExif(t,e)}):d.setExif(t,n),l.set("app1",d.getBinary()),void 0):!1},writeHeaders:function(){return arguments.length?l.restore(arguments[0]):u=l.restore(u)},stripHeaders:function(e){return l.strip(e)},purge:function(){s.call(this)}}),p&&(this.meta={tiff:d.TIFF(),exif:d.EXIF(),gps:d.GPS()})}return o}),i(z,[p,u,P],function(e,t,n){function i(i){function r(){var e,t;return e=a.call(this,8),"IHDR"==e.type?(t=e.start,{width:u.LONG(t),height:u.LONG(t+=4)}):null}function o(){u&&(u.init(null),s=d=c=l=u=null)}function a(e){var t,n,i,r;return t=u.LONG(e),n=u.STRING(e+=4,4),i=e+=4,r=u.LONG(e+t),{length:t,type:n,start:i,CRC:r}}var s,u,c,l,d;s=i,u=new n,u.init(s),function(){var t=0,n=0,i=[35152,20039,3338,6666];for(n=0;n<i.length;n++,t+=2)if(i[n]!=u.SHORT(t))throw new e.ImageError(e.ImageError.WRONG_FORMAT)}(),d=r.call(this),t.extend(this,{type:"image/png",size:s.length,width:d.width,height:d.height,purge:function(){o.call(this)}}),o.call(this)}return i}),i(G,[u,p,B,z],function(e,t,n,i){return function(r){var o=[n,i],a;a=function(){for(var e=0;e<o.length;e++)try{return new o[e](r)}catch(n){}throw new t.ImageError(t.ImageError.WRONG_FORMAT)}(),e.extend(this,{type:"",size:0,width:0,height:0,setExif:function(){},writeHeaders:function(e){return e},stripHeaders:function(e){return e},purge:function(){}}),e.extend(this,a),this.purge=function(){a.purge(),a=null}}}),i(q,[],function(){function e(e,i,r){var o=e.naturalWidth,a=e.naturalHeight,s=r.width,u=r.height,c=r.x||0,l=r.y||0,d=i.getContext("2d");t(e)&&(o/=2,a/=2);var f=1024,p=document.createElement("canvas");p.width=p.height=f;for(var h=p.getContext("2d"),m=n(e,o,a),g=0;a>g;){for(var v=g+f>a?a-g:f,y=0;o>y;){var w=y+f>o?o-y:f;h.clearRect(0,0,f,f),h.drawImage(e,-y,-g);var E=y*s/o+c<<0,_=Math.ceil(w*s/o),x=g*u/a/m+l<<0,R=Math.ceil(v*u/a/m);d.drawImage(p,0,0,w,v,E,x,_,R),y+=f}g+=f}p=h=null}function t(e){var t=e.naturalWidth,n=e.naturalHeight;if(t*n>1048576){var i=document.createElement("canvas");i.width=i.height=1;var r=i.getContext("2d");return r.drawImage(e,-t+1,0),0===r.getImageData(0,0,1,1).data[3]}return!1}function n(e,t,n){var i=document.createElement("canvas");i.width=1,i.height=n;var r=i.getContext("2d");r.drawImage(e,0,0);for(var o=r.getImageData(0,0,1,n).data,a=0,s=n,u=n;u>a;){var c=o[4*(u-1)+3];0===c?s=u:a=u,u=s+a>>1}i=null;var l=u/n;return 0===l?1:l}return{isSubsampled:t,renderTo:e}}),i(X,[D,u,p,m,w,G,q,l,d],function(e,t,n,i,r,o,a,s,u){function c(){function e(){if(!E&&!y)throw new n.ImageError(n.DOMException.INVALID_STATE_ERR);return E||y}function c(e){return i.atob(e.substring(e.indexOf("base64,")+7))}function l(e,t){return"data:"+(t||"")+";base64,"+i.btoa(e)}function d(e){var t=this;y=new Image,y.onerror=function(){g.call(this),t.trigger("error",new n.ImageError(n.ImageError.WRONG_FORMAT))},y.onload=function(){t.trigger("load")},y.src=/^data:[^;]*;base64,/.test(e)?e:l(e,x.type)}function f(e,t){var i=this,r;return window.FileReader?(r=new FileReader,r.onload=function(){t(this.result)},r.onerror=function(){i.trigger("error",new n.FileException(n.FileException.NOT_READABLE_ERR))},r.readAsDataURL(e),void 0):t(e.getAsDataURL())}function p(n,i,r,o){var a=this,s,u,c=0,l=0,d,f,p,g;if(b=o,g=this.meta&&this.meta.tiff&&this.meta.tiff.Orientation||1,-1!==t.inArray(g,[5,6,7,8])){var v=n;n=i,i=v}return d=e(),u=r?Math.max:Math.min,s=u(n/d.width,i/d.height),s>1&&(!r||o)?(this.trigger("Resize"),void 0):(E||(E=document.createElement("canvas")),f=Math.round(d.width*s),p=Math.round(d.height*s),r?(E.width=n,E.height=i,f>n&&(c=Math.round((f-n)/2)),p>i&&(l=Math.round((p-i)/2))):(E.width=f,E.height=p),b||m(E.width,E.height,g),h.call(this,d,E,-c,-l,f,p),this.width=E.width,this.height=E.height,R=!0,a.trigger("Resize"),void 0)}function h(e,t,n,i,r,o){if("iOS"===u.OS)a.renderTo(e,t,{width:r,height:o,x:n,y:i});else{var s=t.getContext("2d");s.drawImage(e,n,i,r,o)}}function m(e,t,n){switch(n){case 5:case 6:case 7:case 8:E.width=t,E.height=e;break;default:E.width=e,E.height=t}var i=E.getContext("2d");switch(n){case 2:i.translate(e,0),i.scale(-1,1);break;case 3:i.translate(e,t),i.rotate(Math.PI);break;case 4:i.translate(0,t),i.scale(1,-1);break;case 5:i.rotate(.5*Math.PI),i.scale(1,-1);break;case 6:i.rotate(.5*Math.PI),i.translate(0,-t);break;case 7:i.rotate(.5*Math.PI),i.translate(e,-t),i.scale(-1,1);break;case 8:i.rotate(-.5*Math.PI),i.translate(-e,0)}}function g(){w&&(w.purge(),w=null),_=y=E=x=null,R=!1}var v=this,y,w,E,_,x,R=!1,b=!0;t.extend(this,{loadFromBlob:function(e){var t=this,i=t.getRuntime(),r=arguments.length>1?arguments[1]:!0;if(!i.can("access_binary"))throw new n.RuntimeError(n.RuntimeError.NOT_SUPPORTED_ERR);return x=e,e.isDetached()?(_=e.getSource(),d.call(this,_),void 0):(f.call(this,e.getSource(),function(e){r&&(_=c(e)),d.call(t,e)}),void 0)},loadFromImage:function(e,t){this.meta=e.meta,x=new r(null,{name:e.name,size:e.size,type:e.type}),d.call(this,t?_=e.getAsBinaryString():e.getAsDataURL())},getInfo:function(){var t=this.getRuntime(),n;return!w&&_&&t.can("access_image_binary")&&(w=new o(_)),n={width:e().width||0,height:e().height||0,type:x.type||s.getFileMime(x.name),size:_&&_.length||x.size||0,name:x.name||"",meta:w&&w.meta||this.meta||{}}},downsize:function(){p.apply(this,arguments)},getAsCanvas:function(){return E&&(E.id=this.uid+"_canvas"),E},getAsBlob:function(e,t){return e!==this.type&&p.call(this,this.width,this.height,!1),new r(null,{name:x.name||"",type:e,data:v.getAsBinaryString.call(this,e,t)})},getAsDataURL:function(e){var t=arguments[1]||90;if(!R)return y.src;if("image/jpeg"!==e)return E.toDataURL("image/png");try{return E.toDataURL("image/jpeg",t/100)}catch(n){return E.toDataURL("image/jpeg")}},getAsBinaryString:function(e,t){if(!R)return _||(_=c(v.getAsDataURL(e,t))),_;if("image/jpeg"!==e)_=c(v.getAsDataURL(e,t));else{var n;t||(t=90);try{n=E.toDataURL("image/jpeg",t/100)}catch(i){n=E.toDataURL("image/jpeg")}_=c(n),w&&(_=w.stripHeaders(_),b&&(w.meta&&w.meta.exif&&w.setExif({PixelXDimension:this.width,PixelYDimension:this.height}),_=w.writeHeaders(_)),w.purge(),w=null)}return R=!1,_},destroy:function(){v=null,g.call(this),this.getRuntime().getShim().removeInstance(this.uid)}})}return e.Image=c}),i(j,[u,d,f,p,g],function(e,t,n,i,r){function o(){var e;try{e=navigator.plugins["Shockwave Flash"],e=e.description}catch(t){try{e=new ActiveXObject("ShockwaveFlash.ShockwaveFlash").GetVariable("$version")}catch(n){e="0.0"}}return e=e.match(/\d+/g),parseFloat(e[0]+"."+e[1])}function a(a){var c=this,l;a=e.extend({swf_url:t.swf_url},a),r.call(this,a,s,{access_binary:function(e){return e&&"browser"===c.mode},access_image_binary:function(e){return e&&"browser"===c.mode},display_media:r.capTrue,do_cors:r.capTrue,drag_and_drop:!1,report_upload_progress:function(){return"client"===c.mode},resize_image:r.capTrue,return_response_headers:!1,return_response_type:function(t){return"json"===t&&window.JSON?!0:!e.arrayDiff(t,["","text","document"])||"browser"===c.mode},return_status_code:function(t){return"browser"===c.mode||!e.arrayDiff(t,[200,404])},select_file:r.capTrue,select_multiple:r.capTrue,send_binary_string:function(e){return e&&"browser"===c.mode},send_browser_cookies:function(e){return e&&"browser"===c.mode},send_custom_headers:function(e){return e&&"browser"===c.mode},send_multipart:r.capTrue,slice_blob:r.capTrue,stream_upload:function(e){return e&&"browser"===c.mode},summon_file_dialog:!1,upload_filesize:function(t){return e.parseSizeStr(t)<=2097152||"client"===c.mode},use_http_method:function(t){return!e.arrayDiff(t,["GET","POST"])}},{access_binary:function(e){return e?"browser":"client"},access_image_binary:function(e){return e?"browser":"client"},report_upload_progress:function(e){return e?"browser":"client"},return_response_type:function(t){return e.arrayDiff(t,["","text","json","document"])?"browser":["client","browser"]},return_status_code:function(t){return e.arrayDiff(t,[200,404])?"browser":["client","browser"]},send_binary_string:function(e){return e?"browser":"client"},send_browser_cookies:function(e){return e?"browser":"client"},send_custom_headers:function(e){return e?"browser":"client"},stream_upload:function(e){return e?"client":"browser"},upload_filesize:function(t){return e.parseSizeStr(t)>=2097152?"client":"browser"}},"client"),o()<10&&(this.mode=!1),e.extend(this,{getShim:function(){return n.get(this.uid)},shimExec:function(e,t){var n=[].slice.call(arguments,2);return c.getShim().exec(this.uid,e,t,n)},init:function(){var n,r,o;o=this.getShimContainer(),e.extend(o.style,{position:"absolute",top:"-8px",left:"-8px",width:"9px",height:"9px",overflow:"hidden"}),n='<object id="'+this.uid+'" type="application/x-shockwave-flash" data="'+a.swf_url+'" ',"IE"===t.browser&&(n+='classid="clsid:d27cdb6e-ae6d-11cf-96b8-444553540000" '),n+='width="100%" height="100%" style="outline:0"><param name="movie" value="'+a.swf_url+'" />'+'<param name="flashvars" value="uid='+escape(this.uid)+"&target="+t.global_event_dispatcher+'" />'+'<param name="wmode" value="transparent" />'+'<param name="allowscriptaccess" value="always" />'+"</object>","IE"===t.browser?(r=document.createElement("div"),o.appendChild(r),r.outerHTML=n,r=o=null):o.innerHTML=n,l=setTimeout(function(){c&&!c.initialized&&c.trigger("Error",new i.RuntimeError(i.RuntimeError.NOT_INIT_ERR))},5e3)},destroy:function(e){return function(){e.call(c),clearTimeout(l),a=l=e=c=null}}(this.destroy)},u)}var s="flash",u={};return r.addConstructor(s,a),u}),i(V,[j,y],function(e,t){var n={slice:function(e,n,i,r){var o=this.getRuntime();return 0>n?n=Math.max(e.size+n,0):n>0&&(n=Math.min(n,e.size)),0>i?i=Math.max(e.size+i,0):i>0&&(i=Math.min(i,e.size)),e=o.shimExec.call(this,"Blob","slice",n,i,r||""),e&&(e=new t(o.uid,e)),e}};return e.Blob=n}),i(W,[j],function(e){var t={init:function(e){this.getRuntime().shimExec.call(this,"FileInput","init",{name:e.name,accept:e.accept,multiple:e.multiple}),this.trigger("ready")}};return e.FileInput=t}),i(Y,[j,m],function(e,t){function n(e,n){switch(n){case"readAsText":return t.atob(e,"utf8");case"readAsBinaryString":return t.atob(e);case"readAsDataURL":return e}return null}var i="",r={read:function(e,t){var r=this,o=r.getRuntime();return"readAsDataURL"===e&&(i="data:"+(t.type||"")+";base64,"),r.bind("Progress",function(t,r){r&&(i+=n(r,e))}),o.shimExec.call(this,"FileReader","readAsBase64",t.uid)},getResult:function(){return i},destroy:function(){i=null}};return e.FileReader=r}),i($,[j,m],function(e,t){function n(e,n){switch(n){case"readAsText":return t.atob(e,"utf8");case"readAsBinaryString":return t.atob(e);case"readAsDataURL":return e}return null}var i={read:function(e,t){var i,r=this.getRuntime();return(i=r.shimExec.call(this,"FileReaderSync","readAsBase64",t.uid))?("readAsDataURL"===e&&(i="data:"+(t.type||"")+";base64,"+i),n(i,e,t.type)):null}};return e.FileReaderSync=i}),i(J,[j,u,y,w,T,S,O],function(e,t,n,i,r,o,a){var s={send:function(e,i){function r(){e.transport=l.mode,l.shimExec.call(c,"XMLHttpRequest","send",e,i)}function s(e,t){l.shimExec.call(c,"XMLHttpRequest","appendBlob",e,t.uid),i=null,r()}function u(e,t){var n=new a;n.bind("TransportingComplete",function(){t(this.result)}),n.transport(e.getSource(),e.type,{ruid:l.uid})}var c=this,l=c.getRuntime();if(t.isEmptyObj(e.headers)||t.each(e.headers,function(e,t){l.shimExec.call(c,"XMLHttpRequest","setRequestHeader",t,e.toString())}),i instanceof o){var d;if(i.each(function(e,t){e instanceof n?d=t:l.shimExec.call(c,"XMLHttpRequest","append",t,e)}),i.hasBlob()){var f=i.getBlob();f.isDetached()?u(f,function(e){f.destroy(),s(d,e)}):s(d,f)}else i=null,r()}else i instanceof n?i.isDetached()?u(i,function(e){i.destroy(),i=e.uid,r()}):(i=i.uid,r()):r()},getResponse:function(e){var n,o,a=this.getRuntime();if(o=a.shimExec.call(this,"XMLHttpRequest","getResponseAsBlob")){if(o=new i(a.uid,o),"blob"===e)return o;try{if(n=new r,~t.inArray(e,["","text"]))return n.readAsText(o);if("json"===e&&window.JSON)return JSON.parse(n.readAsText(o))}finally{o.destroy()}}return null},abort:function(e){var t=this.getRuntime();t.shimExec.call(this,"XMLHttpRequest","abort"),this.dispatchEvent("readystatechange"),this.dispatchEvent("abort")}};return e.XMLHttpRequest=s}),i(Z,[j,y],function(e,t){var n={getAsBlob:function(e){var n=this.getRuntime(),i=n.shimExec.call(this,"Transporter","getAsBlob",e);return i?new t(n.uid,i):null}};return e.Transporter=n}),i(K,[j,u,O,y,T],function(e,t,n,i,r){var o={loadFromBlob:function(e){function t(e){r.shimExec.call(i,"Image","loadFromBlob",e.uid),i=r=null}var i=this,r=i.getRuntime();if(e.isDetached()){var o=new n;o.bind("TransportingComplete",function(){t(o.result.getSource())}),o.transport(e.getSource(),e.type,{ruid:r.uid})}else t(e.getSource())},loadFromImage:function(e){var t=this.getRuntime();return t.shimExec.call(this,"Image","loadFromImage",e.uid)},getAsBlob:function(e,t){var n=this.getRuntime(),r=n.shimExec.call(this,"Image","getAsBlob",e,t);return r?new i(n.uid,r):null},getAsDataURL:function(){var e=this.getRuntime(),t=e.Image.getAsBlob.apply(this,arguments),n;return t?(n=new r,n.readAsDataURL(t)):null}};return e.Image=o}),i(Q,[u,d,f,p,g],function(e,t,n,i,r){function o(e){var t=!1,n=null,i,r,o,a,s,u=0;try{try{n=new ActiveXObject("AgControl.AgControl"),n.IsVersionSupported(e)&&(t=!0),n=null}catch(c){var l=navigator.plugins["Silverlight Plug-In"];if(l){for(i=l.description,"1.0.30226.2"===i&&(i="2.0.30226.2"),r=i.split(".");r.length>3;)r.pop();for(;r.length<4;)r.push(0);for(o=e.split(".");o.length>4;)o.pop();do a=parseInt(o[u],10),s=parseInt(r[u],10),u++;while(u<o.length&&a===s);s>=a&&!isNaN(a)&&(t=!0)}}}catch(d){t=!1}return t}function a(a){var c=this,l;a=e.extend({xap_url:t.xap_url},a),r.call(this,a,s,{access_binary:r.capTrue,access_image_binary:r.capTrue,display_media:r.capTrue,do_cors:r.capTrue,drag_and_drop:!1,report_upload_progress:r.capTrue,resize_image:r.capTrue,return_response_headers:function(e){return e&&"client"===c.mode},return_response_type:function(e){return"json"!==e?!0:!!window.JSON},return_status_code:function(t){return"client"===c.mode||!e.arrayDiff(t,[200,404])},select_file:r.capTrue,select_multiple:r.capTrue,send_binary_string:r.capTrue,send_browser_cookies:function(e){return e&&"browser"===c.mode},send_custom_headers:function(e){return e&&"client"===c.mode},send_multipart:r.capTrue,slice_blob:r.capTrue,stream_upload:!0,summon_file_dialog:!1,upload_filesize:r.capTrue,use_http_method:function(t){return"client"===c.mode||!e.arrayDiff(t,["GET","POST"])}},{return_response_headers:function(e){return e?"client":"browser"},return_status_code:function(t){return e.arrayDiff(t,[200,404])?"client":["client","browser"]},send_browser_cookies:function(e){return e?"browser":"client"},send_custom_headers:function(e){return e?"client":"browser"},use_http_method:function(t){return e.arrayDiff(t,["GET","POST"])?"client":["client","browser"]}}),o("2.0.31005.0")&&"Opera"!==t.browser||(this.mode=!1),e.extend(this,{getShim:function(){return n.get(this.uid).content.Moxie},shimExec:function(e,t){var n=[].slice.call(arguments,2);return c.getShim().exec(this.uid,e,t,n)},init:function(){var e;e=this.getShimContainer(),e.innerHTML='<object id="'+this.uid+'" data="data:application/x-silverlight," type="application/x-silverlight-2" width="100%" height="100%" style="outline:none;">'+'<param name="source" value="'+a.xap_url+'"/>'+'<param name="background" value="Transparent"/>'+'<param name="windowless" value="true"/>'+'<param name="enablehtmlaccess" value="true"/>'+'<param name="initParams" value="uid='+this.uid+",target="+t.global_event_dispatcher+'"/>'+"</object>",l=setTimeout(function(){c&&!c.initialized&&c.trigger("Error",new i.RuntimeError(i.RuntimeError.NOT_INIT_ERR))},"Windows"!==t.OS?1e4:5e3)},destroy:function(e){return function(){e.call(c),clearTimeout(l),a=l=e=c=null}}(this.destroy)},u)}var s="silverlight",u={};return r.addConstructor(s,a),u}),i(et,[Q,u,V],function(e,t,n){return e.Blob=t.extend({},n)}),i(tt,[Q],function(e){var t={init:function(e){function t(e){for(var t="",n=0;n<e.length;n++)t+=(""!==t?"|":"")+e[n].title+" | *."+e[n].extensions.replace(/,/g,";*.");return t}this.getRuntime().shimExec.call(this,"FileInput","init",t(e.accept),e.name,e.multiple),this.trigger("ready")}};return e.FileInput=t}),i(nt,[Q,f,L],function(e,t,n){var i={init:function(){var e=this,i=e.getRuntime(),r;return r=i.getShimContainer(),n.addEvent(r,"dragover",function(e){e.preventDefault(),e.stopPropagation(),e.dataTransfer.dropEffect="copy"},e.uid),n.addEvent(r,"dragenter",function(e){e.preventDefault();var n=t.get(i.uid).dragEnter(e);n&&e.stopPropagation()},e.uid),n.addEvent(r,"drop",function(e){e.preventDefault();var n=t.get(i.uid).dragDrop(e);n&&e.stopPropagation()},e.uid),i.shimExec.call(this,"FileDrop","init")}};return e.FileDrop=i}),i(it,[Q,u,Y],function(e,t,n){return e.FileReader=t.extend({},n)}),i(rt,[Q,u,$],function(e,t,n){return e.FileReaderSync=t.extend({},n)}),i(ot,[Q,u,J],function(e,t,n){return e.XMLHttpRequest=t.extend({},n)}),i(at,[Q,u,Z],function(e,t,n){return e.Transporter=t.extend({},n)}),i(st,[Q,u,K],function(e,t,n){return e.Image=t.extend({},n,{getInfo:function(){var e=this.getRuntime(),n=["tiff","exif","gps"],i={meta:{}},r=e.shimExec.call(this,"Image","getInfo");return r.meta&&t.each(n,function(e){var t=r.meta[e],n,o,a,s;if(t&&t.keys)for(i.meta[e]={},o=0,a=t.keys.length;a>o;o++)n=t.keys[o],s=t[n],s&&(/^(\d|[1-9]\d+)$/.test(s)?s=parseInt(s,10):/^\d*\.\d+$/.test(s)&&(s=parseFloat(s)),i.meta[e][n]=s)}),i.width=parseInt(r.width,10),i.height=parseInt(r.height,10),i.size=parseInt(r.size,10),i.type=r.type,i.name=r.name,i}})}),i(ut,[u,p,g,d],function(e,t,n,i){function r(t){var r=this,s=n.capTest,u=n.capTrue;n.call(this,t,o,{access_binary:s(window.FileReader||window.File&&File.getAsDataURL),access_image_binary:!1,display_media:s(a.Image&&(i.can("create_canvas")||i.can("use_data_uri_over32kb"))),do_cors:!1,drag_and_drop:!1,filter_by_extension:s(function(){return"Chrome"===i.browser&&i.version>=28||"IE"===i.browser&&i.version>=10}()),resize_image:function(){return a.Image&&r.can("access_binary")&&i.can("create_canvas")},report_upload_progress:!1,return_response_headers:!1,return_response_type:function(t){return"json"===t&&window.JSON?!0:!!~e.inArray(t,["text","document",""])},return_status_code:function(t){return!e.arrayDiff(t,[200,404])},select_file:function(){return i.can("use_fileinput")},select_multiple:!1,send_binary_string:!1,send_custom_headers:!1,send_multipart:!0,slice_blob:!1,stream_upload:function(){return r.can("select_file")},summon_file_dialog:s(function(){return"Firefox"===i.browser&&i.version>=4||"Opera"===i.browser&&i.version>=12||!!~e.inArray(i.browser,["Chrome","Safari"])}()),upload_filesize:u,use_http_method:function(t){return!e.arrayDiff(t,["GET","POST"])}}),e.extend(this,{init:function(){this.trigger("Init")},destroy:function(e){return function(){e.call(r),e=r=null}}(this.destroy)}),e.extend(this.getShim(),a)}var o="html4",a={};return n.addConstructor(o,r),a}),i(ct,[ut,u,f,L,l,d],function(e,t,n,i,r,o){function a(){function e(){var r=this,l=r.getRuntime(),d,f,p,h,m,g;g=t.guid("uid_"),d=l.getShimContainer(),a&&(p=n.get(a+"_form"),p&&t.extend(p.style,{top:"100%"})),h=document.createElement("form"),h.setAttribute("id",g+"_form"),h.setAttribute("method","post"),h.setAttribute("enctype","multipart/form-data"),h.setAttribute("encoding","multipart/form-data"),t.extend(h.style,{overflow:"hidden",position:"absolute",top:0,left:0,width:"100%",height:"100%"}),m=document.createElement("input"),m.setAttribute("id",g),m.setAttribute("type","file"),m.setAttribute("name",c.name||"Filedata"),m.setAttribute("accept",u.join(",")),t.extend(m.style,{fontSize:"999px",opacity:0}),h.appendChild(m),d.appendChild(h),t.extend(m.style,{position:"absolute",top:0,left:0,width:"100%",height:"100%"}),"IE"===o.browser&&o.version<10&&t.extend(m.style,{filter:"progid:DXImageTransform.Microsoft.Alpha(opacity=0)"}),m.onchange=function(){var t;this.value&&(t=this.files?this.files[0]:{name:this.value},s=[t],this.onchange=function(){},e.call(r),r.bind("change",function i(){var e=n.get(g),t=n.get(g+"_form"),o;r.unbind("change",i),r.files.length&&e&&t&&(o=r.files[0],e.setAttribute("id",o.uid),t.setAttribute("id",o.uid+"_form"),t.setAttribute("target",o.uid+"_iframe")),e=t=null},998),m=h=null,r.trigger("change"))},l.can("summon_file_dialog")&&(f=n.get(c.browse_button),i.removeEvent(f,"click",r.uid),i.addEvent(f,"click",function(e){m&&!m.disabled&&m.click(),e.preventDefault()},r.uid)),a=g,d=p=f=null}var a,s=[],u=[],c;t.extend(this,{init:function(t){var o=this,a=o.getRuntime(),s;c=t,u=t.accept.mimes||r.extList2mimes(t.accept,a.can("filter_by_extension")),s=a.getShimContainer(),function(){var e,r,u;e=n.get(t.browse_button),a.can("summon_file_dialog")&&("static"===n.getStyle(e,"position")&&(e.style.position="relative"),r=parseInt(n.getStyle(e,"z-index"),10)||1,e.style.zIndex=r,s.style.zIndex=r-1),u=a.can("summon_file_dialog")?e:s,i.addEvent(u,"mouseover",function(){o.trigger("mouseenter")},o.uid),i.addEvent(u,"mouseout",function(){o.trigger("mouseleave")},o.uid),i.addEvent(u,"mousedown",function(){o.trigger("mousedown")},o.uid),i.addEvent(n.get(t.container),"mouseup",function(){o.trigger("mouseup")},o.uid),e=null}(),e.call(this),s=null,o.trigger({type:"ready",async:!0})},getFiles:function(){return s},disable:function(e){var t;(t=n.get(a))&&(t.disabled=!!e)},destroy:function(){var e=this.getRuntime(),t=e.getShim(),r=e.getShimContainer();i.removeAllEvents(r,this.uid),i.removeAllEvents(c&&n.get(c.container),this.uid),i.removeAllEvents(c&&n.get(c.browse_button),this.uid),r&&(r.innerHTML=""),t.removeInstance(this.uid),a=s=u=c=r=t=null}})}return e.FileInput=a}),i(lt,[ut,F],function(e,t){return e.FileReader=t}),i(dt,[ut,u,f,b,p,L,y,S],function(e,t,n,i,r,o,a,s){function u(){function e(e){var t=this,i,r,a,s,u=!1;if(l){if(i=l.id.replace(/_iframe$/,""),r=n.get(i+"_form")){for(a=r.getElementsByTagName("input"),s=a.length;s--;)switch(a[s].getAttribute("type")){case"hidden":a[s].parentNode.removeChild(a[s]);break;case"file":u=!0}a=[],u||r.parentNode.removeChild(r),r=null}setTimeout(function(){o.removeEvent(l,"load",t.uid),l.parentNode&&l.parentNode.removeChild(l);var n=t.getRuntime().getShimContainer();n.children.length||n.parentNode.removeChild(n),n=l=null,e()},1)}}var u,c,l;t.extend(this,{send:function(d,f){function p(){var n=m.getShimContainer()||document.body,r=document.createElement("div");r.innerHTML='<iframe id="'+g+'_iframe" name="'+g+'_iframe" src="javascript:""" style="display:none"></iframe>',l=r.firstChild,n.appendChild(l),o.addEvent(l,"load",function(){var n;try{n=l.contentWindow.document||l.contentDocument||window.frames[l.id].document,/^4(0[0-9]|1[0-7]|2[2346])\s/.test(n.title)?u=n.title.replace(/^(\d+).*$/,"$1"):(u=200,c=t.trim(n.body.innerHTML),h.trigger({type:"progress",loaded:c.length,total:c.length}),w&&h.trigger({type:"uploadprogress",loaded:w.size||1025,total:w.size||1025}))}catch(r){if(!i.hasSameOrigin(d.url))return e.call(h,function(){h.trigger("error")}),void 0;u=404}e.call(h,function(){h.trigger("load")})},h.uid)}var h=this,m=h.getRuntime(),g,v,y,w;if(u=c=null,f instanceof s&&f.hasBlob()){if(w=f.getBlob(),g=w.uid,y=n.get(g),v=n.get(g+"_form"),!v)throw new r.DOMException(r.DOMException.NOT_FOUND_ERR)}else g=t.guid("uid_"),v=document.createElement("form"),v.setAttribute("id",g+"_form"),v.setAttribute("method",d.method),v.setAttribute("enctype","multipart/form-data"),v.setAttribute("encoding","multipart/form-data"),v.setAttribute("target",g+"_iframe"),m.getShimContainer().appendChild(v);f instanceof s&&f.each(function(e,n){if(e instanceof a)y&&y.setAttribute("name",n);else{var i=document.createElement("input");t.extend(i,{type:"hidden",name:n,value:e}),y?v.insertBefore(i,y):v.appendChild(i)}}),v.setAttribute("action",d.url),p(),v.submit(),h.trigger("loadstart")},getStatus:function(){return u},getResponse:function(e){if("json"===e&&"string"===t.typeOf(c)&&window.JSON)try{return JSON.parse(c.replace(/^\s*<pre[^>]*>/,"").replace(/<\/pre>\s*$/,""))}catch(n){return null}return c},abort:function(){var t=this;l&&l.contentWindow&&(l.contentWindow.stop?l.contentWindow.stop():l.contentWindow.document.execCommand?l.contentWindow.document.execCommand("Stop"):l.src="about:blank"),e.call(this,function(){t.dispatchEvent("abort")})}})}return e.XMLHttpRequest=u}),i(ft,[ut,X],function(e,t){return e.Image=t}),a([u,c,l,d,f,p,h,m,g,v,y,w,E,_,x,R,b,T,S,A,O,I,L])}(this);;(function(){"use strict";var e={},t=moxie.core.utils.Basic.inArray;return function n(r){var i,s;for(i in r)s=typeof r[i],s==="object"&&!~t(i,["Exceptions","Env","Mime"])?n(r[i]):s==="function"&&(e[i]=r[i])}(window.moxie),e.Env=window.moxie.core.utils.Env,e.Mime=window.moxie.core.utils.Mime,e.Exceptions=window.moxie.core.Exceptions,window.mOxie=e,window.o||(window.o=e),e})();
|
1 |
/**
|
2 |
* mOxie - multi-runtime File API & XMLHttpRequest L2 Polyfill
|
3 |
+
* v1.5.7
|
4 |
*
|
5 |
* Copyright 2013, Moxiecode Systems AB
|
6 |
* Released under GPL License.
|
8 |
* License: http://www.plupload.com/license
|
9 |
* Contributing: http://www.plupload.com/contributing
|
10 |
*
|
11 |
+
* Date: 2017-11-03
|
12 |
*/
|
13 |
+
!function(e,t){var i=function(){var e={};return t.apply(e,arguments),e.moxie};"function"==typeof define&&define.amd?define("moxie",[],i):"object"==typeof module&&module.exports?module.exports=i():e.moxie=i()}(this||window,function(){!function(e,t){"use strict";function i(e,t){for(var i,n=[],r=0;r<e.length;++r){if(i=s[e[r]]||o(e[r]),!i)throw"module definition dependecy not found: "+e[r];n.push(i)}t.apply(null,n)}function n(e,n,r){if("string"!=typeof e)throw"invalid module definition, module id must be defined and be a string";if(n===t)throw"invalid module definition, dependencies must be specified";if(r===t)throw"invalid module definition, definition function must be specified";i(n,function(){s[e]=r.apply(null,arguments)})}function r(e){return!!s[e]}function o(t){for(var i=e,n=t.split(/[.\/]/),r=0;r<n.length;++r){if(!i[n[r]])return;i=i[n[r]]}return i}function a(i){for(var n=0;n<i.length;n++){for(var r=e,o=i[n],a=o.split(/[.\/]/),u=0;u<a.length-1;++u)r[a[u]]===t&&(r[a[u]]={}),r=r[a[u]];r[a[a.length-1]]=s[o]}}var s={};n("moxie/core/utils/Basic",[],function(){function e(e){var t;return e===t?"undefined":null===e?"null":e.nodeType?"node":{}.toString.call(e).match(/\s([a-z|A-Z]+)/)[1].toLowerCase()}function t(){return s(!1,!1,arguments)}function i(){return s(!0,!1,arguments)}function n(){return s(!1,!0,arguments)}function r(){return s(!0,!0,arguments)}function o(t){switch(e(t)){case"array":return s(!1,!0,[[],t]);case"object":return s(!1,!0,[{},t]);default:return t}}function a(i){switch(e(i)){case"array":return Array.prototype.slice.call(i);case"object":return t({},i)}return i}function s(t,i,n){var r,o=n[0];return c(n,function(n,u){u>0&&c(n,function(n,u){var c=-1!==h(e(n),["array","object"]);return n===r||t&&o[u]===r?!0:(c&&i&&(n=a(n)),e(o[u])===e(n)&&c?s(t,i,[o[u],n]):o[u]=n,void 0)})}),o}function u(e,t){function i(){this.constructor=e}for(var n in t)({}).hasOwnProperty.call(t,n)&&(e[n]=t[n]);return i.prototype=t.prototype,e.prototype=new i,e.parent=t.prototype,e}function c(e,t){var i,n,r,o;if(e){try{i=e.length}catch(a){i=o}if(i===o||"number"!=typeof i){for(n in e)if(e.hasOwnProperty(n)&&t(e[n],n)===!1)return}else for(r=0;i>r;r++)if(t(e[r],r)===!1)return}}function l(t){var i;if(!t||"object"!==e(t))return!0;for(i in t)return!1;return!0}function d(t,i){function n(r){"function"===e(t[r])&&t[r](function(e){++r<o&&!e?n(r):i(e)})}var r=0,o=t.length;"function"!==e(i)&&(i=function(){}),t&&t.length||i(),n(r)}function m(e,t){var i=0,n=e.length,r=new Array(n);c(e,function(e,o){e(function(e){if(e)return t(e);var a=[].slice.call(arguments);a.shift(),r[o]=a,i++,i===n&&(r.unshift(null),t.apply(this,r))})})}function h(e,t){if(t){if(Array.prototype.indexOf)return Array.prototype.indexOf.call(t,e);for(var i=0,n=t.length;n>i;i++)if(t[i]===e)return i}return-1}function f(t,i){var n=[];"array"!==e(t)&&(t=[t]),"array"!==e(i)&&(i=[i]);for(var r in t)-1===h(t[r],i)&&n.push(t[r]);return n.length?n:!1}function p(e,t){var i=[];return c(e,function(e){-1!==h(e,t)&&i.push(e)}),i.length?i:null}function g(e){var t,i=[];for(t=0;t<e.length;t++)i[t]=e[t];return i}function x(e){return e?String.prototype.trim?String.prototype.trim.call(e):e.toString().replace(/^\s*/,"").replace(/\s*$/,""):e}function v(e){if("string"!=typeof e)return e;var t,i={t:1099511627776,g:1073741824,m:1048576,k:1024};return e=/^([0-9\.]+)([tmgk]?)$/.exec(e.toLowerCase().replace(/[^0-9\.tmkg]/g,"")),t=e[2],e=+e[1],i.hasOwnProperty(t)&&(e*=i[t]),Math.floor(e)}function w(e){var t=[].slice.call(arguments,1);return e.replace(/%([a-z])/g,function(e,i){var n=t.shift();switch(i){case"s":return n+"";case"d":return parseInt(n,10);case"f":return parseFloat(n);case"c":return"";default:return n}})}function y(e,t){var i=this;setTimeout(function(){e.call(i)},t||1)}var E=function(){var e=0;return function(t){var i,n=(new Date).getTime().toString(32);for(i=0;5>i;i++)n+=Math.floor(65535*Math.random()).toString(32);return(t||"o_")+n+(e++).toString(32)}}();return{guid:E,typeOf:e,extend:t,extendIf:i,extendImmutable:n,extendImmutableIf:r,clone:o,inherit:u,each:c,isEmptyObj:l,inSeries:d,inParallel:m,inArray:h,arrayDiff:f,arrayIntersect:p,toArray:g,trim:x,sprintf:w,parseSizeStr:v,delay:y}}),n("moxie/core/utils/Encode",[],function(){var e=function(e){return unescape(encodeURIComponent(e))},t=function(e){return decodeURIComponent(escape(e))},i=function(e,i){if("function"==typeof window.atob)return i?t(window.atob(e)):window.atob(e);var n,r,o,a,s,u,c,l,d="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=",m=0,h=0,f="",p=[];if(!e)return e;e+="";do a=d.indexOf(e.charAt(m++)),s=d.indexOf(e.charAt(m++)),u=d.indexOf(e.charAt(m++)),c=d.indexOf(e.charAt(m++)),l=a<<18|s<<12|u<<6|c,n=255&l>>16,r=255&l>>8,o=255&l,p[h++]=64==u?String.fromCharCode(n):64==c?String.fromCharCode(n,r):String.fromCharCode(n,r,o);while(m<e.length);return f=p.join(""),i?t(f):f},n=function(t,i){if(i&&(t=e(t)),"function"==typeof window.btoa)return window.btoa(t);var n,r,o,a,s,u,c,l,d="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=",m=0,h=0,f="",p=[];if(!t)return t;do n=t.charCodeAt(m++),r=t.charCodeAt(m++),o=t.charCodeAt(m++),l=n<<16|r<<8|o,a=63&l>>18,s=63&l>>12,u=63&l>>6,c=63&l,p[h++]=d.charAt(a)+d.charAt(s)+d.charAt(u)+d.charAt(c);while(m<t.length);f=p.join("");var g=t.length%3;return(g?f.slice(0,g-3):f)+"===".slice(g||3)};return{utf8_encode:e,utf8_decode:t,atob:i,btoa:n}}),n("moxie/core/utils/Env",["moxie/core/utils/Basic"],function(e){function i(e,t,i){var n=0,r=0,o=0,a={dev:-6,alpha:-5,a:-5,beta:-4,b:-4,RC:-3,rc:-3,"#":-2,p:1,pl:1},s=function(e){return e=(""+e).replace(/[_\-+]/g,"."),e=e.replace(/([^.\d]+)/g,".$1.").replace(/\.{2,}/g,"."),e.length?e.split("."):[-8]},u=function(e){return e?isNaN(e)?a[e]||-7:parseInt(e,10):0};for(e=s(e),t=s(t),r=Math.max(e.length,t.length),n=0;r>n;n++)if(e[n]!=t[n]){if(e[n]=u(e[n]),t[n]=u(t[n]),e[n]<t[n]){o=-1;break}if(e[n]>t[n]){o=1;break}}if(!i)return o;switch(i){case">":case"gt":return o>0;case">=":case"ge":return o>=0;case"<=":case"le":return 0>=o;case"==":case"=":case"eq":return 0===o;case"<>":case"!=":case"ne":return 0!==o;case"":case"<":case"lt":return 0>o;default:return null}}var n=function(e){var t="",i="?",n="function",r="undefined",o="object",a="name",s="version",u={has:function(e,t){return-1!==t.toLowerCase().indexOf(e.toLowerCase())},lowerize:function(e){return e.toLowerCase()}},c={rgx:function(){for(var t,i,a,s,u,c,l,d=0,m=arguments;d<m.length;d+=2){var h=m[d],f=m[d+1];if(typeof t===r){t={};for(s in f)u=f[s],typeof u===o?t[u[0]]=e:t[u]=e}for(i=a=0;i<h.length;i++)if(c=h[i].exec(this.getUA())){for(s=0;s<f.length;s++)l=c[++a],u=f[s],typeof u===o&&u.length>0?2==u.length?t[u[0]]=typeof u[1]==n?u[1].call(this,l):u[1]:3==u.length?t[u[0]]=typeof u[1]!==n||u[1].exec&&u[1].test?l?l.replace(u[1],u[2]):e:l?u[1].call(this,l,u[2]):e:4==u.length&&(t[u[0]]=l?u[3].call(this,l.replace(u[1],u[2])):e):t[u]=l?l:e;break}if(c)break}return t},str:function(t,n){for(var r in n)if(typeof n[r]===o&&n[r].length>0){for(var a=0;a<n[r].length;a++)if(u.has(n[r][a],t))return r===i?e:r}else if(u.has(n[r],t))return r===i?e:r;return t}},l={browser:{oldsafari:{major:{1:["/8","/1","/3"],2:"/4","?":"/"},version:{"1.0":"/8",1.2:"/1",1.3:"/3","2.0":"/412","2.0.2":"/416","2.0.3":"/417","2.0.4":"/419","?":"/"}}},device:{sprint:{model:{"Evo Shift 4G":"7373KT"},vendor:{HTC:"APA",Sprint:"Sprint"}}},os:{windows:{version:{ME:"4.90","NT 3.11":"NT3.51","NT 4.0":"NT4.0",2000:"NT 5.0",XP:["NT 5.1","NT 5.2"],Vista:"NT 6.0",7:"NT 6.1",8:"NT 6.2",8.1:"NT 6.3",RT:"ARM"}}}},d={browser:[[/(opera\smini)\/([\w\.-]+)/i,/(opera\s[mobiletab]+).+version\/([\w\.-]+)/i,/(opera).+version\/([\w\.]+)/i,/(opera)[\/\s]+([\w\.]+)/i],[a,s],[/\s(opr)\/([\w\.]+)/i],[[a,"Opera"],s],[/(kindle)\/([\w\.]+)/i,/(lunascape|maxthon|netfront|jasmine|blazer)[\/\s]?([\w\.]+)*/i,/(avant\s|iemobile|slim|baidu)(?:browser)?[\/\s]?([\w\.]*)/i,/(?:ms|\()(ie)\s([\w\.]+)/i,/(rekonq)\/([\w\.]+)*/i,/(chromium|flock|rockmelt|midori|epiphany|silk|skyfire|ovibrowser|bolt|iron|vivaldi)\/([\w\.-]+)/i],[a,s],[/(trident).+rv[:\s]([\w\.]+).+like\sgecko/i],[[a,"IE"],s],[/(edge)\/((\d+)?[\w\.]+)/i],[a,s],[/(yabrowser)\/([\w\.]+)/i],[[a,"Yandex"],s],[/(comodo_dragon)\/([\w\.]+)/i],[[a,/_/g," "],s],[/(chrome|omniweb|arora|[tizenoka]{5}\s?browser)\/v?([\w\.]+)/i,/(uc\s?browser|qqbrowser)[\/\s]?([\w\.]+)/i],[a,s],[/(dolfin)\/([\w\.]+)/i],[[a,"Dolphin"],s],[/((?:android.+)crmo|crios)\/([\w\.]+)/i],[[a,"Chrome"],s],[/XiaoMi\/MiuiBrowser\/([\w\.]+)/i],[s,[a,"MIUI Browser"]],[/android.+version\/([\w\.]+)\s+(?:mobile\s?safari|safari)/i],[s,[a,"Android Browser"]],[/FBAV\/([\w\.]+);/i],[s,[a,"Facebook"]],[/version\/([\w\.]+).+?mobile\/\w+\s(safari)/i],[s,[a,"Mobile Safari"]],[/version\/([\w\.]+).+?(mobile\s?safari|safari)/i],[s,a],[/webkit.+?(mobile\s?safari|safari)(\/[\w\.]+)/i],[a,[s,c.str,l.browser.oldsafari.version]],[/(konqueror)\/([\w\.]+)/i,/(webkit|khtml)\/([\w\.]+)/i],[a,s],[/(navigator|netscape)\/([\w\.-]+)/i],[[a,"Netscape"],s],[/(swiftfox)/i,/(icedragon|iceweasel|camino|chimera|fennec|maemo\sbrowser|minimo|conkeror)[\/\s]?([\w\.\+]+)/i,/(firefox|seamonkey|k-meleon|icecat|iceape|firebird|phoenix)\/([\w\.-]+)/i,/(mozilla)\/([\w\.]+).+rv\:.+gecko\/\d+/i,/(polaris|lynx|dillo|icab|doris|amaya|w3m|netsurf)[\/\s]?([\w\.]+)/i,/(links)\s\(([\w\.]+)/i,/(gobrowser)\/?([\w\.]+)*/i,/(ice\s?browser)\/v?([\w\._]+)/i,/(mosaic)[\/\s]([\w\.]+)/i],[a,s]],engine:[[/windows.+\sedge\/([\w\.]+)/i],[s,[a,"EdgeHTML"]],[/(presto)\/([\w\.]+)/i,/(webkit|trident|netfront|netsurf|amaya|lynx|w3m)\/([\w\.]+)/i,/(khtml|tasman|links)[\/\s]\(?([\w\.]+)/i,/(icab)[\/\s]([23]\.[\d\.]+)/i],[a,s],[/rv\:([\w\.]+).*(gecko)/i],[s,a]],os:[[/microsoft\s(windows)\s(vista|xp)/i],[a,s],[/(windows)\snt\s6\.2;\s(arm)/i,/(windows\sphone(?:\sos)*|windows\smobile|windows)[\s\/]?([ntce\d\.\s]+\w)/i],[a,[s,c.str,l.os.windows.version]],[/(win(?=3|9|n)|win\s9x\s)([nt\d\.]+)/i],[[a,"Windows"],[s,c.str,l.os.windows.version]],[/\((bb)(10);/i],[[a,"BlackBerry"],s],[/(blackberry)\w*\/?([\w\.]+)*/i,/(tizen)[\/\s]([\w\.]+)/i,/(android|webos|palm\os|qnx|bada|rim\stablet\sos|meego|contiki)[\/\s-]?([\w\.]+)*/i,/linux;.+(sailfish);/i],[a,s],[/(symbian\s?os|symbos|s60(?=;))[\/\s-]?([\w\.]+)*/i],[[a,"Symbian"],s],[/\((series40);/i],[a],[/mozilla.+\(mobile;.+gecko.+firefox/i],[[a,"Firefox OS"],s],[/(nintendo|playstation)\s([wids3portablevu]+)/i,/(mint)[\/\s\(]?(\w+)*/i,/(mageia|vectorlinux)[;\s]/i,/(joli|[kxln]?ubuntu|debian|[open]*suse|gentoo|arch|slackware|fedora|mandriva|centos|pclinuxos|redhat|zenwalk|linpus)[\/\s-]?([\w\.-]+)*/i,/(hurd|linux)\s?([\w\.]+)*/i,/(gnu)\s?([\w\.]+)*/i],[a,s],[/(cros)\s[\w]+\s([\w\.]+\w)/i],[[a,"Chromium OS"],s],[/(sunos)\s?([\w\.]+\d)*/i],[[a,"Solaris"],s],[/\s([frentopc-]{0,4}bsd|dragonfly)\s?([\w\.]+)*/i],[a,s],[/(ip[honead]+)(?:.*os\s*([\w]+)*\slike\smac|;\sopera)/i],[[a,"iOS"],[s,/_/g,"."]],[/(mac\sos\sx)\s?([\w\s\.]+\w)*/i,/(macintosh|mac(?=_powerpc)\s)/i],[[a,"Mac OS"],[s,/_/g,"."]],[/((?:open)?solaris)[\/\s-]?([\w\.]+)*/i,/(haiku)\s(\w+)/i,/(aix)\s((\d)(?=\.|\)|\s)[\w\.]*)*/i,/(plan\s9|minix|beos|os\/2|amigaos|morphos|risc\sos|openvms)/i,/(unix)\s?([\w\.]+)*/i],[a,s]]},m=function(e){var i=e||(window&&window.navigator&&window.navigator.userAgent?window.navigator.userAgent:t);this.getBrowser=function(){return c.rgx.apply(this,d.browser)},this.getEngine=function(){return c.rgx.apply(this,d.engine)},this.getOS=function(){return c.rgx.apply(this,d.os)},this.getResult=function(){return{ua:this.getUA(),browser:this.getBrowser(),engine:this.getEngine(),os:this.getOS()}},this.getUA=function(){return i},this.setUA=function(e){return i=e,this},this.setUA(i)};return m}(),r=function(){var i={access_global_ns:function(){return!!window.moxie},define_property:function(){return!1}(),create_canvas:function(){var e=document.createElement("canvas"),t=!(!e.getContext||!e.getContext("2d"));return i.create_canvas=t,t},return_response_type:function(t){try{if(-1!==e.inArray(t,["","text","document"]))return!0;if(window.XMLHttpRequest){var i=new XMLHttpRequest;if(i.open("get","/"),"responseType"in i)return i.responseType=t,i.responseType!==t?!1:!0}}catch(n){}return!1},use_blob_uri:function(){var e=window.URL;return i.use_blob_uri=e&&"createObjectURL"in e&&"revokeObjectURL"in e&&("IE"!==a.browser||a.verComp(a.version,"11.0.46",">=")),i.use_blob_uri},use_data_uri:function(){var e=new Image;return e.onload=function(){i.use_data_uri=1===e.width&&1===e.height},setTimeout(function(){e.src="data:image/gif;base64,R0lGODlhAQABAIAAAP8AAAAAACH5BAAAAAAALAAAAAABAAEAAAICRAEAOw=="},1),!1}(),use_data_uri_over32kb:function(){return i.use_data_uri&&("IE"!==a.browser||a.version>=9)},use_data_uri_of:function(e){return i.use_data_uri&&33e3>e||i.use_data_uri_over32kb()},use_fileinput:function(){if(navigator.userAgent.match(/(Android (1.0|1.1|1.5|1.6|2.0|2.1))|(Windows Phone (OS 7|8.0))|(XBLWP)|(ZuneWP)|(w(eb)?OSBrowser)|(webOS)|(Kindle\/(1.0|2.0|2.5|3.0))/))return!1;var e=document.createElement("input");return e.setAttribute("type","file"),i.use_fileinput=!e.disabled},use_webgl:function(){var e,n=document.createElement("canvas"),r=null;try{r=n.getContext("webgl")||n.getContext("experimental-webgl")}catch(o){}return r||(r=null),e=!!r,i.use_webgl=e,n=t,e}};return function(t){var n=[].slice.call(arguments);return n.shift(),"function"===e.typeOf(i[t])?i[t].apply(this,n):!!i[t]}}(),o=(new n).getResult(),a={can:r,uaParser:n,browser:o.browser.name,version:o.browser.version,os:o.os.name,osVersion:o.os.version,verComp:i,swf_url:"../flash/Moxie.swf",xap_url:"../silverlight/Moxie.xap",global_event_dispatcher:"moxie.core.EventTarget.instance.dispatchEvent"};return a.OS=a.os,a}),n("moxie/core/Exceptions",["moxie/core/utils/Basic"],function(e){function t(e,t){var i;for(i in e)if(e[i]===t)return i;return null}return{RuntimeError:function(){function i(e,i){this.code=e,this.name=t(n,e),this.message=this.name+(i||": RuntimeError "+this.code)}var n={NOT_INIT_ERR:1,EXCEPTION_ERR:3,NOT_SUPPORTED_ERR:9,JS_ERR:4};return e.extend(i,n),i.prototype=Error.prototype,i}(),OperationNotAllowedException:function(){function t(e){this.code=e,this.name="OperationNotAllowedException"}return e.extend(t,{NOT_ALLOWED_ERR:1}),t.prototype=Error.prototype,t}(),ImageError:function(){function i(e){this.code=e,this.name=t(n,e),this.message=this.name+": ImageError "+this.code}var n={WRONG_FORMAT:1,MAX_RESOLUTION_ERR:2,INVALID_META_ERR:3};return e.extend(i,n),i.prototype=Error.prototype,i}(),FileException:function(){function i(e){this.code=e,this.name=t(n,e),this.message=this.name+": FileException "+this.code}var n={NOT_FOUND_ERR:1,SECURITY_ERR:2,ABORT_ERR:3,NOT_READABLE_ERR:4,ENCODING_ERR:5,NO_MODIFICATION_ALLOWED_ERR:6,INVALID_STATE_ERR:7,SYNTAX_ERR:8};return e.extend(i,n),i.prototype=Error.prototype,i}(),DOMException:function(){function i(e){this.code=e,this.name=t(n,e),this.message=this.name+": DOMException "+this.code}var n={INDEX_SIZE_ERR:1,DOMSTRING_SIZE_ERR:2,HIERARCHY_REQUEST_ERR:3,WRONG_DOCUMENT_ERR:4,INVALID_CHARACTER_ERR:5,NO_DATA_ALLOWED_ERR:6,NO_MODIFICATION_ALLOWED_ERR:7,NOT_FOUND_ERR:8,NOT_SUPPORTED_ERR:9,INUSE_ATTRIBUTE_ERR:10,INVALID_STATE_ERR:11,SYNTAX_ERR:12,INVALID_MODIFICATION_ERR:13,NAMESPACE_ERR:14,INVALID_ACCESS_ERR:15,VALIDATION_ERR:16,TYPE_MISMATCH_ERR:17,SECURITY_ERR:18,NETWORK_ERR:19,ABORT_ERR:20,URL_MISMATCH_ERR:21,QUOTA_EXCEEDED_ERR:22,TIMEOUT_ERR:23,INVALID_NODE_TYPE_ERR:24,DATA_CLONE_ERR:25};return e.extend(i,n),i.prototype=Error.prototype,i}(),EventException:function(){function t(e){this.code=e,this.name="EventException"}return e.extend(t,{UNSPECIFIED_EVENT_TYPE_ERR:0}),t.prototype=Error.prototype,t}()}}),n("moxie/core/utils/Dom",["moxie/core/utils/Env"],function(e){var t=function(e){return"string"!=typeof e?e:document.getElementById(e)},i=function(e,t){if(!e.className)return!1;var i=new RegExp("(^|\\s+)"+t+"(\\s+|$)");return i.test(e.className)},n=function(e,t){i(e,t)||(e.className=e.className?e.className.replace(/\s+$/,"")+" "+t:t)},r=function(e,t){if(e.className){var i=new RegExp("(^|\\s+)"+t+"(\\s+|$)");e.className=e.className.replace(i,function(e,t,i){return" "===t&&" "===i?" ":""})}},o=function(e,t){return e.currentStyle?e.currentStyle[t]:window.getComputedStyle?window.getComputedStyle(e,null)[t]:void 0},a=function(t,i){function n(e){var t,i,n=0,r=0;return e&&(i=e.getBoundingClientRect(),t="CSS1Compat"===c.compatMode?c.documentElement:c.body,n=i.left+t.scrollLeft,r=i.top+t.scrollTop),{x:n,y:r}}var r,o,a,s=0,u=0,c=document;if(t=t,i=i||c.body,t&&t.getBoundingClientRect&&"IE"===e.browser&&(!c.documentMode||c.documentMode<8))return o=n(t),a=n(i),{x:o.x-a.x,y:o.y-a.y};for(r=t;r&&r!=i&&r.nodeType;)s+=r.offsetLeft||0,u+=r.offsetTop||0,r=r.offsetParent;for(r=t.parentNode;r&&r!=i&&r.nodeType;)s-=r.scrollLeft||0,u-=r.scrollTop||0,r=r.parentNode;return{x:s,y:u}},s=function(e){return{w:e.offsetWidth||e.clientWidth,h:e.offsetHeight||e.clientHeight}};return{get:t,hasClass:i,addClass:n,removeClass:r,getStyle:o,getPos:a,getSize:s}}),n("moxie/core/EventTarget",["moxie/core/utils/Env","moxie/core/Exceptions","moxie/core/utils/Basic"],function(e,t,i){function n(){this.uid=i.guid()}var r={};return i.extend(n.prototype,{init:function(){this.uid||(this.uid=i.guid("uid_"))},addEventListener:function(e,t,n,o){var a,s=this;return this.hasOwnProperty("uid")||(this.uid=i.guid("uid_")),e=i.trim(e),/\s/.test(e)?(i.each(e.split(/\s+/),function(e){s.addEventListener(e,t,n,o)}),void 0):(e=e.toLowerCase(),n=parseInt(n,10)||0,a=r[this.uid]&&r[this.uid][e]||[],a.push({fn:t,priority:n,scope:o||this}),r[this.uid]||(r[this.uid]={}),r[this.uid][e]=a,void 0)},hasEventListener:function(e){var t;return e?(e=e.toLowerCase(),t=r[this.uid]&&r[this.uid][e]):t=r[this.uid],t?t:!1},removeEventListener:function(e,t){var n,o,a=this;if(e=e.toLowerCase(),/\s/.test(e))return i.each(e.split(/\s+/),function(e){a.removeEventListener(e,t)}),void 0;if(n=r[this.uid]&&r[this.uid][e]){if(t){for(o=n.length-1;o>=0;o--)if(n[o].fn===t){n.splice(o,1);break}}else n=[];n.length||(delete r[this.uid][e],i.isEmptyObj(r[this.uid])&&delete r[this.uid])}},removeAllEventListeners:function(){r[this.uid]&&delete r[this.uid]},dispatchEvent:function(e){var n,o,a,s,u,c={},l=!0;if("string"!==i.typeOf(e)){if(s=e,"string"!==i.typeOf(s.type))throw new t.EventException(t.EventException.UNSPECIFIED_EVENT_TYPE_ERR);e=s.type,s.total!==u&&s.loaded!==u&&(c.total=s.total,c.loaded=s.loaded),c.async=s.async||!1}if(-1!==e.indexOf("::")?function(t){n=t[0],e=t[1]}(e.split("::")):n=this.uid,e=e.toLowerCase(),o=r[n]&&r[n][e]){o.sort(function(e,t){return t.priority-e.priority}),a=[].slice.call(arguments),a.shift(),c.type=e,a.unshift(c);var d=[];i.each(o,function(e){a[0].target=e.scope,c.async?d.push(function(t){setTimeout(function(){t(e.fn.apply(e.scope,a)===!1)},1)}):d.push(function(t){t(e.fn.apply(e.scope,a)===!1)})}),d.length&&i.inSeries(d,function(e){l=!e})}return l},bindOnce:function(e,t,i,n){var r=this;r.bind.call(this,e,function o(){return r.unbind(e,o),t.apply(this,arguments)},i,n)},bind:function(){this.addEventListener.apply(this,arguments)},unbind:function(){this.removeEventListener.apply(this,arguments)},unbindAll:function(){this.removeAllEventListeners.apply(this,arguments)},trigger:function(){return this.dispatchEvent.apply(this,arguments)},handleEventProps:function(e){var t=this;this.bind(e.join(" "),function(e){var t="on"+e.type.toLowerCase();"function"===i.typeOf(this[t])&&this[t].apply(this,arguments)}),i.each(e,function(e){e="on"+e.toLowerCase(e),"undefined"===i.typeOf(t[e])&&(t[e]=null)})}}),n.instance=new n,n}),n("moxie/runtime/Runtime",["moxie/core/utils/Env","moxie/core/utils/Basic","moxie/core/utils/Dom","moxie/core/EventTarget"],function(e,t,i,n){function r(e,n,o,s,u){var c,l=this,d=t.guid(n+"_"),m=u||"browser";e=e||{},a[d]=this,o=t.extend({access_binary:!1,access_image_binary:!1,display_media:!1,do_cors:!1,drag_and_drop:!1,filter_by_extension:!0,resize_image:!1,report_upload_progress:!1,return_response_headers:!1,return_response_type:!1,return_status_code:!0,send_custom_headers:!1,select_file:!1,select_folder:!1,select_multiple:!0,send_binary_string:!1,send_browser_cookies:!0,send_multipart:!0,slice_blob:!1,stream_upload:!1,summon_file_dialog:!1,upload_filesize:!0,use_http_method:!0},o),e.preferred_caps&&(m=r.getMode(s,e.preferred_caps,m)),c=function(){var e={};return{exec:function(t,i,n,r){return c[i]&&(e[t]||(e[t]={context:this,instance:new c[i]}),e[t].instance[n])?e[t].instance[n].apply(this,r):void 0},removeInstance:function(t){delete e[t]},removeAllInstances:function(){var i=this;t.each(e,function(e,n){"function"===t.typeOf(e.instance.destroy)&&e.instance.destroy.call(e.context),i.removeInstance(n)})}}}(),t.extend(this,{initialized:!1,uid:d,type:n,mode:r.getMode(s,e.required_caps,m),shimid:d+"_container",clients:0,options:e,can:function(e,i){var n=arguments[2]||o;if("string"===t.typeOf(e)&&"undefined"===t.typeOf(i)&&(e=r.parseCaps(e)),"object"===t.typeOf(e)){for(var a in e)if(!this.can(a,e[a],n))return!1;return!0}return"function"===t.typeOf(n[e])?n[e].call(this,i):i===n[e]},getShimContainer:function(){var e,n=i.get(this.shimid);return n||(e=i.get(this.options.container)||document.body,n=document.createElement("div"),n.id=this.shimid,n.className="moxie-shim moxie-shim-"+this.type,t.extend(n.style,{position:"absolute",top:"0px",left:"0px",width:"1px",height:"1px",overflow:"hidden"}),e.appendChild(n),e=null),n},getShim:function(){return c},shimExec:function(e,t){var i=[].slice.call(arguments,2);return l.getShim().exec.call(this,this.uid,e,t,i)},exec:function(e,t){var i=[].slice.call(arguments,2);return l[e]&&l[e][t]?l[e][t].apply(this,i):l.shimExec.apply(this,arguments)},destroy:function(){if(l){var e=i.get(this.shimid);e&&e.parentNode.removeChild(e),c&&c.removeAllInstances(),this.unbindAll(),delete a[this.uid],this.uid=null,d=l=c=e=null}}}),this.mode&&e.required_caps&&!this.can(e.required_caps)&&(this.mode=!1)}var o={},a={};return r.order="html5,flash,silverlight,html4",r.getRuntime=function(e){return a[e]?a[e]:!1},r.addConstructor=function(e,t){t.prototype=n.instance,o[e]=t},r.getConstructor=function(e){return o[e]||null},r.getInfo=function(e){var t=r.getRuntime(e);return t?{uid:t.uid,type:t.type,mode:t.mode,can:function(){return t.can.apply(t,arguments)}}:null},r.parseCaps=function(e){var i={};return"string"!==t.typeOf(e)?e||{}:(t.each(e.split(","),function(e){i[e]=!0}),i)},r.can=function(e,t){var i,n,o=r.getConstructor(e);return o?(i=new o({required_caps:t}),n=i.mode,i.destroy(),!!n):!1},r.thatCan=function(e,t){var i=(t||r.order).split(/\s*,\s*/);for(var n in i)if(r.can(i[n],e))return i[n];return null},r.getMode=function(e,i,n){var r=null;if("undefined"===t.typeOf(n)&&(n="browser"),i&&!t.isEmptyObj(e)){if(t.each(i,function(i,n){if(e.hasOwnProperty(n)){var o=e[n](i);if("string"==typeof o&&(o=[o]),r){if(!(r=t.arrayIntersect(r,o)))return r=!1}else r=o}}),r)return-1!==t.inArray(n,r)?n:r[0];if(r===!1)return!1}return n},r.getGlobalEventTarget=function(){if(/^moxie\./.test(e.global_event_dispatcher)&&!e.can("access_global_ns")){var i=t.guid("moxie_event_target_");window[i]=function(e,t){n.instance.dispatchEvent(e,t)},e.global_event_dispatcher=i}return e.global_event_dispatcher},r.capTrue=function(){return!0},r.capFalse=function(){return!1},r.capTest=function(e){return function(){return!!e}},r}),n("moxie/runtime/RuntimeClient",["moxie/core/utils/Env","moxie/core/Exceptions","moxie/core/utils/Basic","moxie/runtime/Runtime"],function(e,t,i,n){return function(){var e;i.extend(this,{connectRuntime:function(r){function o(i){var a,u;return i.length?(a=i.shift().toLowerCase(),(u=n.getConstructor(a))?(e=new u(r),e.bind("Init",function(){e.initialized=!0,setTimeout(function(){e.clients++,s.ruid=e.uid,s.trigger("RuntimeInit",e)},1)}),e.bind("Error",function(){e.destroy(),o(i)}),e.bind("Exception",function(e,i){var n=i.name+"(#"+i.code+")"+(i.message?", from: "+i.message:"");s.trigger("RuntimeError",new t.RuntimeError(t.RuntimeError.EXCEPTION_ERR,n))}),e.mode?(e.init(),void 0):(e.trigger("Error"),void 0)):(o(i),void 0)):(s.trigger("RuntimeError",new t.RuntimeError(t.RuntimeError.NOT_INIT_ERR)),e=null,void 0)}var a,s=this;if("string"===i.typeOf(r)?a=r:"string"===i.typeOf(r.ruid)&&(a=r.ruid),a){if(e=n.getRuntime(a))return s.ruid=a,e.clients++,e;throw new t.RuntimeError(t.RuntimeError.NOT_INIT_ERR)}o((r.runtime_order||n.order).split(/\s*,\s*/))},disconnectRuntime:function(){e&&--e.clients<=0&&e.destroy(),e=null},getRuntime:function(){return e&&e.uid?e:e=null},exec:function(){return e?e.exec.apply(this,arguments):null},can:function(t){return e?e.can(t):!1}})}}),n("moxie/file/Blob",["moxie/core/utils/Basic","moxie/core/utils/Encode","moxie/runtime/RuntimeClient"],function(e,t,i){function n(o,a){function s(t,i,o){var a,s=r[this.uid];return"string"===e.typeOf(s)&&s.length?(a=new n(null,{type:o,size:i-t}),a.detach(s.substr(t,a.size)),a):null}i.call(this),o&&this.connectRuntime(o),a?"string"===e.typeOf(a)&&(a={data:a}):a={},e.extend(this,{uid:a.uid||e.guid("uid_"),ruid:o,size:a.size||0,type:a.type||"",slice:function(e,t,i){return this.isDetached()?s.apply(this,arguments):this.getRuntime().exec.call(this,"Blob","slice",this.getSource(),e,t,i)},getSource:function(){return r[this.uid]?r[this.uid]:null},detach:function(e){if(this.ruid&&(this.getRuntime().exec.call(this,"Blob","destroy"),this.disconnectRuntime(),this.ruid=null),e=e||"","data:"==e.substr(0,5)){var i=e.indexOf(";base64,");this.type=e.substring(5,i),e=t.atob(e.substring(i+8))}this.size=e.length,r[this.uid]=e},isDetached:function(){return!this.ruid&&"string"===e.typeOf(r[this.uid])},destroy:function(){this.detach(),delete r[this.uid]}}),a.data?this.detach(a.data):r[this.uid]=a}var r={};return n}),n("moxie/core/I18n",["moxie/core/utils/Basic"],function(e){var t={};return{addI18n:function(i){return e.extend(t,i)},translate:function(e){return t[e]||e},_:function(e){return this.translate(e)},sprintf:function(t){var i=[].slice.call(arguments,1);return t.replace(/%[a-z]/g,function(){var t=i.shift();return"undefined"!==e.typeOf(t)?t:""})}}}),n("moxie/core/utils/Mime",["moxie/core/utils/Basic","moxie/core/I18n"],function(e,t){var i="application/msword,doc dot,application/pdf,pdf,application/pgp-signature,pgp,application/postscript,ps ai eps,application/rtf,rtf,application/vnd.ms-excel,xls xlb xlt xla,application/vnd.ms-powerpoint,ppt pps pot ppa,application/zip,zip,application/x-shockwave-flash,swf swfl,application/vnd.openxmlformats-officedocument.wordprocessingml.document,docx,application/vnd.openxmlformats-officedocument.wordprocessingml.template,dotx,application/vnd.openxmlformats-officedocument.spreadsheetml.sheet,xlsx,application/vnd.openxmlformats-officedocument.presentationml.presentation,pptx,application/vnd.openxmlformats-officedocument.presentationml.template,potx,application/vnd.openxmlformats-officedocument.presentationml.slideshow,ppsx,application/x-javascript,js,application/json,json,audio/mpeg,mp3 mpga mpega mp2,audio/x-wav,wav,audio/x-m4a,m4a,audio/ogg,oga ogg,audio/aiff,aiff aif,audio/flac,flac,audio/aac,aac,audio/ac3,ac3,audio/x-ms-wma,wma,image/bmp,bmp,image/gif,gif,image/jpeg,jpg jpeg jpe,image/photoshop,psd,image/png,png,image/svg+xml,svg svgz,image/tiff,tiff tif,text/plain,asc txt text diff log,text/html,htm html xhtml,text/css,css,text/csv,csv,text/rtf,rtf,video/mpeg,mpeg mpg mpe m2v,video/quicktime,qt mov,video/mp4,mp4,video/x-m4v,m4v,video/x-flv,flv,video/x-ms-wmv,wmv,video/avi,avi,video/webm,webm,video/3gpp,3gpp 3gp,video/3gpp2,3g2,video/vnd.rn-realvideo,rv,video/ogg,ogv,video/x-matroska,mkv,application/vnd.oasis.opendocument.formula-template,otf,application/octet-stream,exe",n={},r={},o=function(e){var t,i,o,a=e.split(/,/);for(t=0;t<a.length;t+=2){for(o=a[t+1].split(/ /),i=0;i<o.length;i++)n[o[i]]=a[t];r[a[t]]=o}},a=function(t,i){var n,r,o,a,s=[];for(r=0;r<t.length;r++)for(n=t[r].extensions.toLowerCase().split(/\s*,\s*/),o=0;o<n.length;o++){if("*"===n[o])return[];if(a=s[n[o]],i&&/^\w+$/.test(n[o]))s.push("."+n[o]);else if(a&&-1===e.inArray(a,s))s.push(a);else if(!a)return[]}return s},s=function(t){var i=[];return e.each(t,function(t){if(t=t.toLowerCase(),"*"===t)return i=[],!1;var n=t.match(/^(\w+)\/(\*|\w+)$/);n&&("*"===n[2]?e.each(r,function(e,t){new RegExp("^"+n[1]+"/").test(t)&&[].push.apply(i,r[t])}):r[t]&&[].push.apply(i,r[t]))}),i},u=function(i){var n=[],r=[];return"string"===e.typeOf(i)&&(i=e.trim(i).split(/\s*,\s*/)),r=s(i),n.push({title:t.translate("Files"),extensions:r.length?r.join(","):"*"}),n},c=function(e){var t=e&&e.match(/\.([^.]+)$/);return t?t[1].toLowerCase():""},l=function(e){return n[c(e)]||""};return o(i),{mimes:n,extensions:r,addMimeType:o,extList2mimes:a,mimes2exts:s,mimes2extList:u,getFileExtension:c,getFileMime:l}}),n("moxie/file/FileInput",["moxie/core/utils/Basic","moxie/core/utils/Env","moxie/core/utils/Mime","moxie/core/utils/Dom","moxie/core/Exceptions","moxie/core/EventTarget","moxie/core/I18n","moxie/runtime/Runtime","moxie/runtime/RuntimeClient"],function(e,t,i,n,r,o,a,s,u){function c(t){var o,c,d;if(-1!==e.inArray(e.typeOf(t),["string","node"])&&(t={browse_button:t}),c=n.get(t.browse_button),!c)throw new r.DOMException(r.DOMException.NOT_FOUND_ERR);d={accept:[{title:a.translate("All Files"),extensions:"*"}],multiple:!1,required_caps:!1,container:c.parentNode||document.body},t=e.extend({},d,t),"string"==typeof t.required_caps&&(t.required_caps=s.parseCaps(t.required_caps)),"string"==typeof t.accept&&(t.accept=i.mimes2extList(t.accept)),o=n.get(t.container),o||(o=document.body),"static"===n.getStyle(o,"position")&&(o.style.position="relative"),o=c=null,u.call(this),e.extend(this,{uid:e.guid("uid_"),ruid:null,shimid:null,files:null,init:function(){var i=this;i.bind("RuntimeInit",function(r,o){i.ruid=o.uid,i.shimid=o.shimid,i.bind("Ready",function(){i.trigger("Refresh")},999),i.bind("Refresh",function(){var i,r,a,s,u;a=n.get(t.browse_button),s=n.get(o.shimid),a&&(i=n.getPos(a,n.get(t.container)),r=n.getSize(a),u=parseInt(n.getStyle(a,"z-index"),10)||0,s&&e.extend(s.style,{top:i.y+"px",left:i.x+"px",width:r.w+"px",height:r.h+"px",zIndex:u+1})),s=a=null}),o.exec.call(i,"FileInput","init",t)}),i.connectRuntime(e.extend({},t,{required_caps:{select_file:!0}}))},getOption:function(e){return t[e]},setOption:function(e,n){if(t.hasOwnProperty(e)){var o=t[e];switch(e){case"accept":"string"==typeof n&&(n=i.mimes2extList(n));break;case"container":case"required_caps":throw new r.FileException(r.FileException.NO_MODIFICATION_ALLOWED_ERR)}t[e]=n,this.exec("FileInput","setOption",e,n),this.trigger("OptionChanged",e,n,o)}},disable:function(t){var i=this.getRuntime();i&&this.exec("FileInput","disable","undefined"===e.typeOf(t)?!0:t)},refresh:function(){this.trigger("Refresh")},destroy:function(){var t=this.getRuntime();t&&(t.exec.call(this,"FileInput","destroy"),this.disconnectRuntime()),"array"===e.typeOf(this.files)&&e.each(this.files,function(e){e.destroy()}),this.files=null,this.unbindAll()}}),this.handleEventProps(l)}var l=["ready","change","cancel","mouseenter","mouseleave","mousedown","mouseup"];return c.prototype=o.instance,c}),n("moxie/file/File",["moxie/core/utils/Basic","moxie/core/utils/Mime","moxie/file/Blob"],function(e,t,i){function n(n,r){r||(r={}),i.apply(this,arguments),this.type||(this.type=t.getFileMime(r.name));var o;if(r.name)o=r.name.replace(/\\/g,"/"),o=o.substr(o.lastIndexOf("/")+1);else if(this.type){var a=this.type.split("/")[0];o=e.guid((""!==a?a:"file")+"_"),t.extensions[this.type]&&(o+="."+t.extensions[this.type][0])}e.extend(this,{name:o||e.guid("file_"),relativePath:"",lastModifiedDate:r.lastModifiedDate||(new Date).toLocaleString()})}return n.prototype=i.prototype,n}),n("moxie/file/FileDrop",["moxie/core/I18n","moxie/core/utils/Dom","moxie/core/Exceptions","moxie/core/utils/Basic","moxie/core/utils/Env","moxie/file/File","moxie/runtime/RuntimeClient","moxie/core/EventTarget","moxie/core/utils/Mime"],function(e,t,i,n,r,o,a,s,u){function c(i){var r,o=this;"string"==typeof i&&(i={drop_zone:i}),r={accept:[{title:e.translate("All Files"),extensions:"*"}],required_caps:{drag_and_drop:!0}},i="object"==typeof i?n.extend({},r,i):r,i.container=t.get(i.drop_zone)||document.body,"static"===t.getStyle(i.container,"position")&&(i.container.style.position="relative"),"string"==typeof i.accept&&(i.accept=u.mimes2extList(i.accept)),a.call(o),n.extend(o,{uid:n.guid("uid_"),ruid:null,files:null,init:function(){o.bind("RuntimeInit",function(e,t){o.ruid=t.uid,t.exec.call(o,"FileDrop","init",i),o.dispatchEvent("ready")
|
14 |
+
}),o.connectRuntime(i)},destroy:function(){var e=this.getRuntime();e&&(e.exec.call(this,"FileDrop","destroy"),this.disconnectRuntime()),this.files=null,this.unbindAll()}}),this.handleEventProps(l)}var l=["ready","dragenter","dragleave","drop","error"];return c.prototype=s.instance,c}),n("moxie/file/FileReader",["moxie/core/utils/Basic","moxie/core/utils/Encode","moxie/core/Exceptions","moxie/core/EventTarget","moxie/file/Blob","moxie/runtime/RuntimeClient"],function(e,t,i,n,r,o){function a(){function n(e,n){if(this.trigger("loadstart"),this.readyState===a.LOADING)return this.trigger("error",new i.DOMException(i.DOMException.INVALID_STATE_ERR)),this.trigger("loadend"),void 0;if(!(n instanceof r))return this.trigger("error",new i.DOMException(i.DOMException.NOT_FOUND_ERR)),this.trigger("loadend"),void 0;if(this.result=null,this.readyState=a.LOADING,n.isDetached()){var o=n.getSource();switch(e){case"readAsText":case"readAsBinaryString":this.result=o;break;case"readAsDataURL":this.result="data:"+n.type+";base64,"+t.btoa(o)}this.readyState=a.DONE,this.trigger("load"),this.trigger("loadend")}else this.connectRuntime(n.ruid),this.exec("FileReader","read",e,n)}o.call(this),e.extend(this,{uid:e.guid("uid_"),readyState:a.EMPTY,result:null,error:null,readAsBinaryString:function(e){n.call(this,"readAsBinaryString",e)},readAsDataURL:function(e){n.call(this,"readAsDataURL",e)},readAsText:function(e){n.call(this,"readAsText",e)},abort:function(){this.result=null,-1===e.inArray(this.readyState,[a.EMPTY,a.DONE])&&(this.readyState===a.LOADING&&(this.readyState=a.DONE),this.exec("FileReader","abort"),this.trigger("abort"),this.trigger("loadend"))},destroy:function(){this.abort(),this.exec("FileReader","destroy"),this.disconnectRuntime(),this.unbindAll()}}),this.handleEventProps(s),this.bind("Error",function(e,t){this.readyState=a.DONE,this.error=t},999),this.bind("Load",function(){this.readyState=a.DONE},999)}var s=["loadstart","progress","load","abort","error","loadend"];return a.EMPTY=0,a.LOADING=1,a.DONE=2,a.prototype=n.instance,a}),n("moxie/core/utils/Url",["moxie/core/utils/Basic"],function(e){var t=function(i,n){var r,o=["source","scheme","authority","userInfo","user","pass","host","port","relative","path","directory","file","query","fragment"],a=o.length,s={http:80,https:443},u={},c=/^(?:([^:\/?#]+):)?(?:\/\/()(?:(?:()(?:([^:@\/]*):?([^:@\/]*))?@)?(\[[\da-fA-F:]+\]|[^:\/?#]*)(?::(\d*))?))?()(?:(()(?:(?:[^?#\/]*\/)*)()(?:[^?#]*))(?:\\?([^#]*))?(?:#(.*))?)/,l=c.exec(i||""),d=/^\/\/\w/.test(i);switch(e.typeOf(n)){case"undefined":n=t(document.location.href,!1);break;case"string":n=t(n,!1)}for(;a--;)l[a]&&(u[o[a]]=l[a]);if(r=!d&&!u.scheme,(d||r)&&(u.scheme=n.scheme),r){u.host=n.host,u.port=n.port;var m="";/^[^\/]/.test(u.path)&&(m=n.path,m=/\/[^\/]*\.[^\/]*$/.test(m)?m.replace(/\/[^\/]+$/,"/"):m.replace(/\/?$/,"/")),u.path=m+(u.path||"")}return u.port||(u.port=s[u.scheme]||80),u.port=parseInt(u.port,10),u.path||(u.path="/"),delete u.source,u},i=function(e){var i={http:80,https:443},n="object"==typeof e?e:t(e);return n.scheme+"://"+n.host+(n.port!==i[n.scheme]?":"+n.port:"")+n.path+(n.query?n.query:"")},n=function(e){function i(e){return[e.scheme,e.host,e.port].join("/")}return"string"==typeof e&&(e=t(e)),i(t())===i(e)};return{parseUrl:t,resolveUrl:i,hasSameOrigin:n}}),n("moxie/runtime/RuntimeTarget",["moxie/core/utils/Basic","moxie/runtime/RuntimeClient","moxie/core/EventTarget"],function(e,t,i){function n(){this.uid=e.guid("uid_"),t.call(this),this.destroy=function(){this.disconnectRuntime(),this.unbindAll()}}return n.prototype=i.instance,n}),n("moxie/file/FileReaderSync",["moxie/core/utils/Basic","moxie/runtime/RuntimeClient","moxie/core/utils/Encode"],function(e,t,i){return function(){function n(e,t){if(!t.isDetached()){var n=this.connectRuntime(t.ruid).exec.call(this,"FileReaderSync","read",e,t);return this.disconnectRuntime(),n}var r=t.getSource();switch(e){case"readAsBinaryString":return r;case"readAsDataURL":return"data:"+t.type+";base64,"+i.btoa(r);case"readAsText":for(var o="",a=0,s=r.length;s>a;a++)o+=String.fromCharCode(r[a]);return o}}t.call(this),e.extend(this,{uid:e.guid("uid_"),readAsBinaryString:function(e){return n.call(this,"readAsBinaryString",e)},readAsDataURL:function(e){return n.call(this,"readAsDataURL",e)},readAsText:function(e){return n.call(this,"readAsText",e)}})}}),n("moxie/xhr/FormData",["moxie/core/Exceptions","moxie/core/utils/Basic","moxie/file/Blob"],function(e,t,i){function n(){var e,n=[];t.extend(this,{append:function(r,o){var a=this,s=t.typeOf(o);o instanceof i?e={name:r,value:o}:"array"===s?(r+="[]",t.each(o,function(e){a.append(r,e)})):"object"===s?t.each(o,function(e,t){a.append(r+"["+t+"]",e)}):"null"===s||"undefined"===s||"number"===s&&isNaN(o)?a.append(r,"false"):n.push({name:r,value:o.toString()})},hasBlob:function(){return!!this.getBlob()},getBlob:function(){return e&&e.value||null},getBlobName:function(){return e&&e.name||null},each:function(i){t.each(n,function(e){i(e.value,e.name)}),e&&i(e.value,e.name)},destroy:function(){e=null,n=[]}})}return n}),n("moxie/xhr/XMLHttpRequest",["moxie/core/utils/Basic","moxie/core/Exceptions","moxie/core/EventTarget","moxie/core/utils/Encode","moxie/core/utils/Url","moxie/runtime/Runtime","moxie/runtime/RuntimeTarget","moxie/file/Blob","moxie/file/FileReaderSync","moxie/xhr/FormData","moxie/core/utils/Env","moxie/core/utils/Mime"],function(e,t,i,n,r,o,a,s,u,c,l,d){function m(){this.uid=e.guid("uid_")}function h(){function i(e,t){return I.hasOwnProperty(e)?1===arguments.length?l.can("define_property")?I[e]:A[e]:(l.can("define_property")?I[e]=t:A[e]=t,void 0):void 0}function u(t){function n(){_&&(_.destroy(),_=null),s.dispatchEvent("loadend"),s=null}function r(r){_.bind("LoadStart",function(e){i("readyState",h.LOADING),s.dispatchEvent("readystatechange"),s.dispatchEvent(e),L&&s.upload.dispatchEvent(e)}),_.bind("Progress",function(e){i("readyState")!==h.LOADING&&(i("readyState",h.LOADING),s.dispatchEvent("readystatechange")),s.dispatchEvent(e)}),_.bind("UploadProgress",function(e){L&&s.upload.dispatchEvent({type:"progress",lengthComputable:!1,total:e.total,loaded:e.loaded})}),_.bind("Load",function(t){i("readyState",h.DONE),i("status",Number(r.exec.call(_,"XMLHttpRequest","getStatus")||0)),i("statusText",f[i("status")]||""),i("response",r.exec.call(_,"XMLHttpRequest","getResponse",i("responseType"))),~e.inArray(i("responseType"),["text",""])?i("responseText",i("response")):"document"===i("responseType")&&i("responseXML",i("response")),U=r.exec.call(_,"XMLHttpRequest","getAllResponseHeaders"),s.dispatchEvent("readystatechange"),i("status")>0?(L&&s.upload.dispatchEvent(t),s.dispatchEvent(t)):(F=!0,s.dispatchEvent("error")),n()}),_.bind("Abort",function(e){s.dispatchEvent(e),n()}),_.bind("Error",function(e){F=!0,i("readyState",h.DONE),s.dispatchEvent("readystatechange"),M=!0,s.dispatchEvent(e),n()}),r.exec.call(_,"XMLHttpRequest","send",{url:x,method:v,async:T,user:w,password:y,headers:S,mimeType:D,encoding:O,responseType:s.responseType,withCredentials:s.withCredentials,options:k},t)}var s=this;E=(new Date).getTime(),_=new a,"string"==typeof k.required_caps&&(k.required_caps=o.parseCaps(k.required_caps)),k.required_caps=e.extend({},k.required_caps,{return_response_type:s.responseType}),t instanceof c&&(k.required_caps.send_multipart=!0),e.isEmptyObj(S)||(k.required_caps.send_custom_headers=!0),B||(k.required_caps.do_cors=!0),k.ruid?r(_.connectRuntime(k)):(_.bind("RuntimeInit",function(e,t){r(t)}),_.bind("RuntimeError",function(e,t){s.dispatchEvent("RuntimeError",t)}),_.connectRuntime(k))}function g(){i("responseText",""),i("responseXML",null),i("response",null),i("status",0),i("statusText",""),E=b=null}var x,v,w,y,E,b,_,R,A=this,I={timeout:0,readyState:h.UNSENT,withCredentials:!1,status:0,statusText:"",responseType:"",responseXML:null,responseText:null,response:null},T=!0,S={},O=null,D=null,N=!1,C=!1,L=!1,M=!1,F=!1,B=!1,P=null,H=null,k={},U="";e.extend(this,I,{uid:e.guid("uid_"),upload:new m,open:function(o,a,s,u,c){var l;if(!o||!a)throw new t.DOMException(t.DOMException.SYNTAX_ERR);if(/[\u0100-\uffff]/.test(o)||n.utf8_encode(o)!==o)throw new t.DOMException(t.DOMException.SYNTAX_ERR);if(~e.inArray(o.toUpperCase(),["CONNECT","DELETE","GET","HEAD","OPTIONS","POST","PUT","TRACE","TRACK"])&&(v=o.toUpperCase()),~e.inArray(v,["CONNECT","TRACE","TRACK"]))throw new t.DOMException(t.DOMException.SECURITY_ERR);if(a=n.utf8_encode(a),l=r.parseUrl(a),B=r.hasSameOrigin(l),x=r.resolveUrl(a),(u||c)&&!B)throw new t.DOMException(t.DOMException.INVALID_ACCESS_ERR);if(w=u||l.user,y=c||l.pass,T=s||!0,T===!1&&(i("timeout")||i("withCredentials")||""!==i("responseType")))throw new t.DOMException(t.DOMException.INVALID_ACCESS_ERR);N=!T,C=!1,S={},g.call(this),i("readyState",h.OPENED),this.dispatchEvent("readystatechange")},setRequestHeader:function(r,o){var a=["accept-charset","accept-encoding","access-control-request-headers","access-control-request-method","connection","content-length","cookie","cookie2","content-transfer-encoding","date","expect","host","keep-alive","origin","referer","te","trailer","transfer-encoding","upgrade","user-agent","via"];if(i("readyState")!==h.OPENED||C)throw new t.DOMException(t.DOMException.INVALID_STATE_ERR);if(/[\u0100-\uffff]/.test(r)||n.utf8_encode(r)!==r)throw new t.DOMException(t.DOMException.SYNTAX_ERR);return r=e.trim(r).toLowerCase(),~e.inArray(r,a)||/^(proxy\-|sec\-)/.test(r)?!1:(S[r]?S[r]+=", "+o:S[r]=o,!0)},hasRequestHeader:function(e){return e&&S[e.toLowerCase()]||!1},getAllResponseHeaders:function(){return U||""},getResponseHeader:function(t){return t=t.toLowerCase(),F||~e.inArray(t,["set-cookie","set-cookie2"])?null:U&&""!==U&&(R||(R={},e.each(U.split(/\r\n/),function(t){var i=t.split(/:\s+/);2===i.length&&(i[0]=e.trim(i[0]),R[i[0].toLowerCase()]={header:i[0],value:e.trim(i[1])})})),R.hasOwnProperty(t))?R[t].header+": "+R[t].value:null},overrideMimeType:function(n){var r,o;if(~e.inArray(i("readyState"),[h.LOADING,h.DONE]))throw new t.DOMException(t.DOMException.INVALID_STATE_ERR);if(n=e.trim(n.toLowerCase()),/;/.test(n)&&(r=n.match(/^([^;]+)(?:;\scharset\=)?(.*)$/))&&(n=r[1],r[2]&&(o=r[2])),!d.mimes[n])throw new t.DOMException(t.DOMException.SYNTAX_ERR);P=n,H=o},send:function(i,r){if(k="string"===e.typeOf(r)?{ruid:r}:r?r:{},this.readyState!==h.OPENED||C)throw new t.DOMException(t.DOMException.INVALID_STATE_ERR);if(i instanceof s)k.ruid=i.ruid,D=i.type||"application/octet-stream";else if(i instanceof c){if(i.hasBlob()){var o=i.getBlob();k.ruid=o.ruid,D=o.type||"application/octet-stream"}}else"string"==typeof i&&(O="UTF-8",D="text/plain;charset=UTF-8",i=n.utf8_encode(i));this.withCredentials||(this.withCredentials=k.required_caps&&k.required_caps.send_browser_cookies&&!B),L=!N&&this.upload.hasEventListener(),F=!1,M=!i,N||(C=!0),u.call(this,i)},abort:function(){if(F=!0,N=!1,~e.inArray(i("readyState"),[h.UNSENT,h.OPENED,h.DONE]))i("readyState",h.UNSENT);else{if(i("readyState",h.DONE),C=!1,!_)throw new t.DOMException(t.DOMException.INVALID_STATE_ERR);_.getRuntime().exec.call(_,"XMLHttpRequest","abort",M),M=!0}},destroy:function(){_&&("function"===e.typeOf(_.destroy)&&_.destroy(),_=null),this.unbindAll(),this.upload&&(this.upload.unbindAll(),this.upload=null)}}),this.handleEventProps(p.concat(["readystatechange"])),this.upload.handleEventProps(p)}var f={100:"Continue",101:"Switching Protocols",102:"Processing",200:"OK",201:"Created",202:"Accepted",203:"Non-Authoritative Information",204:"No Content",205:"Reset Content",206:"Partial Content",207:"Multi-Status",226:"IM Used",300:"Multiple Choices",301:"Moved Permanently",302:"Found",303:"See Other",304:"Not Modified",305:"Use Proxy",306:"Reserved",307:"Temporary Redirect",400:"Bad Request",401:"Unauthorized",402:"Payment Required",403:"Forbidden",404:"Not Found",405:"Method Not Allowed",406:"Not Acceptable",407:"Proxy Authentication Required",408:"Request Timeout",409:"Conflict",410:"Gone",411:"Length Required",412:"Precondition Failed",413:"Request Entity Too Large",414:"Request-URI Too Long",415:"Unsupported Media Type",416:"Requested Range Not Satisfiable",417:"Expectation Failed",422:"Unprocessable Entity",423:"Locked",424:"Failed Dependency",426:"Upgrade Required",500:"Internal Server Error",501:"Not Implemented",502:"Bad Gateway",503:"Service Unavailable",504:"Gateway Timeout",505:"HTTP Version Not Supported",506:"Variant Also Negotiates",507:"Insufficient Storage",510:"Not Extended"};m.prototype=i.instance;var p=["loadstart","progress","abort","error","load","timeout","loadend"];return h.UNSENT=0,h.OPENED=1,h.HEADERS_RECEIVED=2,h.LOADING=3,h.DONE=4,h.prototype=i.instance,h}),n("moxie/runtime/Transporter",["moxie/core/utils/Basic","moxie/core/utils/Encode","moxie/runtime/RuntimeClient","moxie/core/EventTarget"],function(e,t,i,n){function r(){function n(){l=d=0,c=this.result=null}function o(t,i){var n=this;u=i,n.bind("TransportingProgress",function(t){d=t.loaded,l>d&&-1===e.inArray(n.state,[r.IDLE,r.DONE])&&a.call(n)},999),n.bind("TransportingComplete",function(){d=l,n.state=r.DONE,c=null,n.result=u.exec.call(n,"Transporter","getAsBlob",t||"")},999),n.state=r.BUSY,n.trigger("TransportingStarted"),a.call(n)}function a(){var e,i=this,n=l-d;m>n&&(m=n),e=t.btoa(c.substr(d,m)),u.exec.call(i,"Transporter","receive",e,l)}var s,u,c,l,d,m;i.call(this),e.extend(this,{uid:e.guid("uid_"),state:r.IDLE,result:null,transport:function(t,i,r){var a=this;if(r=e.extend({chunk_size:204798},r),(s=r.chunk_size%3)&&(r.chunk_size+=3-s),m=r.chunk_size,n.call(this),c=t,l=t.length,"string"===e.typeOf(r)||r.ruid)o.call(a,i,this.connectRuntime(r));else{var u=function(e,t){a.unbind("RuntimeInit",u),o.call(a,i,t)};this.bind("RuntimeInit",u),this.connectRuntime(r)}},abort:function(){var e=this;e.state=r.IDLE,u&&(u.exec.call(e,"Transporter","clear"),e.trigger("TransportingAborted")),n.call(e)},destroy:function(){this.unbindAll(),u=null,this.disconnectRuntime(),n.call(this)}})}return r.IDLE=0,r.BUSY=1,r.DONE=2,r.prototype=n.instance,r}),n("moxie/image/Image",["moxie/core/utils/Basic","moxie/core/utils/Dom","moxie/core/Exceptions","moxie/file/FileReaderSync","moxie/xhr/XMLHttpRequest","moxie/runtime/Runtime","moxie/runtime/RuntimeClient","moxie/runtime/Transporter","moxie/core/utils/Env","moxie/core/EventTarget","moxie/file/Blob","moxie/file/File","moxie/core/utils/Encode"],function(e,t,i,n,r,o,a,s,u,c,l,d,m){function h(){function n(e){try{return e||(e=this.exec("Image","getInfo")),this.size=e.size,this.width=e.width,this.height=e.height,this.type=e.type,this.meta=e.meta,""===this.name&&(this.name=e.name),!0}catch(t){return this.trigger("error",t.code),!1}}function c(t){var n=e.typeOf(t);try{if(t instanceof h){if(!t.size)throw new i.DOMException(i.DOMException.INVALID_STATE_ERR);p.apply(this,arguments)}else if(t instanceof l){if(!~e.inArray(t.type,["image/jpeg","image/png"]))throw new i.ImageError(i.ImageError.WRONG_FORMAT);g.apply(this,arguments)}else if(-1!==e.inArray(n,["blob","file"]))c.call(this,new d(null,t),arguments[1]);else if("string"===n)"data:"===t.substr(0,5)?c.call(this,new l(null,{data:t}),arguments[1]):x.apply(this,arguments);else{if("node"!==n||"img"!==t.nodeName.toLowerCase())throw new i.DOMException(i.DOMException.TYPE_MISMATCH_ERR);c.call(this,t.src,arguments[1])}}catch(r){this.trigger("error",r.code)}}function p(t,i){var n=this.connectRuntime(t.ruid);this.ruid=n.uid,n.exec.call(this,"Image","loadFromImage",t,"undefined"===e.typeOf(i)?!0:i)}function g(t,i){function n(e){r.ruid=e.uid,e.exec.call(r,"Image","loadFromBlob",t)}var r=this;r.name=t.name||"",t.isDetached()?(this.bind("RuntimeInit",function(e,t){n(t)}),i&&"string"==typeof i.required_caps&&(i.required_caps=o.parseCaps(i.required_caps)),this.connectRuntime(e.extend({required_caps:{access_image_binary:!0,resize_image:!0}},i))):n(this.connectRuntime(t.ruid))}function x(e,t){var i,n=this;i=new r,i.open("get",e),i.responseType="blob",i.onprogress=function(e){n.trigger(e)},i.onload=function(){g.call(n,i.response,!0)},i.onerror=function(e){n.trigger(e)},i.onloadend=function(){i.destroy()},i.bind("RuntimeError",function(e,t){n.trigger("RuntimeError",t)}),i.send(null,t)}a.call(this),e.extend(this,{uid:e.guid("uid_"),ruid:null,name:"",size:0,width:0,height:0,type:"",meta:{},clone:function(){this.load.apply(this,arguments)},load:function(){c.apply(this,arguments)},resize:function(t){var n,r,o=this,a={x:0,y:0,width:o.width,height:o.height},s=e.extendIf({width:o.width,height:o.height,type:o.type||"image/jpeg",quality:90,crop:!1,fit:!0,preserveHeaders:!0,resample:"default",multipass:!0},t);try{if(!o.size)throw new i.DOMException(i.DOMException.INVALID_STATE_ERR);if(o.width>h.MAX_RESIZE_WIDTH||o.height>h.MAX_RESIZE_HEIGHT)throw new i.ImageError(i.ImageError.MAX_RESOLUTION_ERR);if(n=o.meta&&o.meta.tiff&&o.meta.tiff.Orientation||1,-1!==e.inArray(n,[5,6,7,8])){var u=s.width;s.width=s.height,s.height=u}if(s.crop){switch(r=Math.max(s.width/o.width,s.height/o.height),t.fit?(a.width=Math.min(Math.ceil(s.width/r),o.width),a.height=Math.min(Math.ceil(s.height/r),o.height),r=s.width/a.width):(a.width=Math.min(s.width,o.width),a.height=Math.min(s.height,o.height),r=1),"boolean"==typeof s.crop&&(s.crop="cc"),s.crop.toLowerCase().replace(/_/,"-")){case"rb":case"right-bottom":a.x=o.width-a.width,a.y=o.height-a.height;break;case"cb":case"center-bottom":a.x=Math.floor((o.width-a.width)/2),a.y=o.height-a.height;break;case"lb":case"left-bottom":a.x=0,a.y=o.height-a.height;break;case"lt":case"left-top":a.x=0,a.y=0;break;case"ct":case"center-top":a.x=Math.floor((o.width-a.width)/2),a.y=0;break;case"rt":case"right-top":a.x=o.width-a.width,a.y=0;break;case"rc":case"right-center":case"right-middle":a.x=o.width-a.width,a.y=Math.floor((o.height-a.height)/2);break;case"lc":case"left-center":case"left-middle":a.x=0,a.y=Math.floor((o.height-a.height)/2);break;case"cc":case"center-center":case"center-middle":default:a.x=Math.floor((o.width-a.width)/2),a.y=Math.floor((o.height-a.height)/2)}a.x=Math.max(a.x,0),a.y=Math.max(a.y,0)}else r=Math.min(s.width/o.width,s.height/o.height),r>1&&!s.fit&&(r=1);this.exec("Image","resize",a,r,s)}catch(c){o.trigger("error",c.code)}},downsize:function(t){var i,n={width:this.width,height:this.height,type:this.type||"image/jpeg",quality:90,crop:!1,fit:!1,preserveHeaders:!0,resample:"default"};i="object"==typeof t?e.extend(n,t):e.extend(n,{width:arguments[0],height:arguments[1],crop:arguments[2],preserveHeaders:arguments[3]}),this.resize(i)},crop:function(e,t,i){this.downsize(e,t,!0,i)},getAsCanvas:function(){if(!u.can("create_canvas"))throw new i.RuntimeError(i.RuntimeError.NOT_SUPPORTED_ERR);return this.exec("Image","getAsCanvas")},getAsBlob:function(e,t){if(!this.size)throw new i.DOMException(i.DOMException.INVALID_STATE_ERR);return this.exec("Image","getAsBlob",e||"image/jpeg",t||90)},getAsDataURL:function(e,t){if(!this.size)throw new i.DOMException(i.DOMException.INVALID_STATE_ERR);return this.exec("Image","getAsDataURL",e||"image/jpeg",t||90)},getAsBinaryString:function(e,t){var i=this.getAsDataURL(e,t);return m.atob(i.substring(i.indexOf("base64,")+7))},embed:function(n,r){function o(t,r){var o=this;if(u.can("create_canvas")){var l=o.getAsCanvas();if(l)return n.appendChild(l),l=null,o.destroy(),c.trigger("embedded"),void 0}var d=o.getAsDataURL(t,r);if(!d)throw new i.ImageError(i.ImageError.WRONG_FORMAT);if(u.can("use_data_uri_of",d.length))n.innerHTML='<img src="'+d+'" width="'+o.width+'" height="'+o.height+'" alt="" />',o.destroy(),c.trigger("embedded");else{var h=new s;h.bind("TransportingComplete",function(){a=c.connectRuntime(this.result.ruid),c.bind("Embedded",function(){e.extend(a.getShimContainer().style,{top:"0px",left:"0px",width:o.width+"px",height:o.height+"px"}),a=null},999),a.exec.call(c,"ImageView","display",this.result.uid,width,height),o.destroy()}),h.transport(m.atob(d.substring(d.indexOf("base64,")+7)),t,{required_caps:{display_media:!0},runtime_order:"flash,silverlight",container:n})}}var a,c=this,l=e.extend({width:this.width,height:this.height,type:this.type||"image/jpeg",quality:90,fit:!0,resample:"nearest"},r);try{if(!(n=t.get(n)))throw new i.DOMException(i.DOMException.INVALID_NODE_TYPE_ERR);if(!this.size)throw new i.DOMException(i.DOMException.INVALID_STATE_ERR);this.width>h.MAX_RESIZE_WIDTH||this.height>h.MAX_RESIZE_HEIGHT;var d=new h;return d.bind("Resize",function(){o.call(this,l.type,l.quality)}),d.bind("Load",function(){this.downsize(l)}),this.meta.thumb&&this.meta.thumb.width>=l.width&&this.meta.thumb.height>=l.height?d.load(this.meta.thumb.data):d.clone(this,!1),d}catch(f){this.trigger("error",f.code)}},destroy:function(){this.ruid&&(this.getRuntime().exec.call(this,"Image","destroy"),this.disconnectRuntime()),this.meta&&this.meta.thumb&&this.meta.thumb.data.destroy(),this.unbindAll()}}),this.handleEventProps(f),this.bind("Load Resize",function(){return n.call(this)},999)}var f=["progress","load","error","resize","embedded"];return h.MAX_RESIZE_WIDTH=8192,h.MAX_RESIZE_HEIGHT=8192,h.prototype=c.instance,h}),n("moxie/runtime/html5/Runtime",["moxie/core/utils/Basic","moxie/core/Exceptions","moxie/runtime/Runtime","moxie/core/utils/Env"],function(e,t,i,n){function o(t){var o=this,u=i.capTest,c=i.capTrue,l=e.extend({access_binary:u(window.FileReader||window.File&&window.File.getAsDataURL),access_image_binary:function(){return o.can("access_binary")&&!!s.Image},display_media:u((n.can("create_canvas")||n.can("use_data_uri_over32kb"))&&r("moxie/image/Image")),do_cors:u(window.XMLHttpRequest&&"withCredentials"in new XMLHttpRequest),drag_and_drop:u(function(){var e=document.createElement("div");return("draggable"in e||"ondragstart"in e&&"ondrop"in e)&&("IE"!==n.browser||n.verComp(n.version,9,">"))}()),filter_by_extension:u(function(){return!("Chrome"===n.browser&&n.verComp(n.version,28,"<")||"IE"===n.browser&&n.verComp(n.version,10,"<")||"Safari"===n.browser&&n.verComp(n.version,7,"<")||"Firefox"===n.browser&&n.verComp(n.version,37,"<"))}()),return_response_headers:c,return_response_type:function(e){return"json"===e&&window.JSON?!0:n.can("return_response_type",e)},return_status_code:c,report_upload_progress:u(window.XMLHttpRequest&&(new XMLHttpRequest).upload),resize_image:function(){return o.can("access_binary")&&n.can("create_canvas")},select_file:function(){return n.can("use_fileinput")&&window.File},select_folder:function(){return o.can("select_file")&&("Chrome"===n.browser&&n.verComp(n.version,21,">=")||"Firefox"===n.browser&&n.verComp(n.version,42,">="))},select_multiple:function(){return!(!o.can("select_file")||"Safari"===n.browser&&"Windows"===n.os||"iOS"===n.os&&n.verComp(n.osVersion,"7.0.0",">")&&n.verComp(n.osVersion,"8.0.0","<"))},send_binary_string:u(window.XMLHttpRequest&&((new XMLHttpRequest).sendAsBinary||window.Uint8Array&&window.ArrayBuffer)),send_custom_headers:u(window.XMLHttpRequest),send_multipart:function(){return!!(window.XMLHttpRequest&&(new XMLHttpRequest).upload&&window.FormData)||o.can("send_binary_string")},slice_blob:u(window.File&&(File.prototype.mozSlice||File.prototype.webkitSlice||File.prototype.slice)),stream_upload:function(){return o.can("slice_blob")&&o.can("send_multipart")},summon_file_dialog:function(){return o.can("select_file")&&!("Firefox"===n.browser&&n.verComp(n.version,4,"<")||"Opera"===n.browser&&n.verComp(n.version,12,"<")||"IE"===n.browser&&n.verComp(n.version,10,"<"))},upload_filesize:c,use_http_method:c},arguments[2]);i.call(this,t,arguments[1]||a,l),e.extend(this,{init:function(){this.trigger("Init")},destroy:function(e){return function(){e.call(o),e=o=null}}(this.destroy)}),e.extend(this.getShim(),s)}var a="html5",s={};return i.addConstructor(a,o),s}),n("moxie/runtime/html5/file/Blob",["moxie/runtime/html5/Runtime","moxie/file/Blob"],function(e,t){function i(){function e(e,t,i){var n;if(!window.File.prototype.slice)return(n=window.File.prototype.webkitSlice||window.File.prototype.mozSlice)?n.call(e,t,i):null;try{return e.slice(),e.slice(t,i)}catch(r){return e.slice(t,i-t)}}this.slice=function(){return new t(this.getRuntime().uid,e.apply(this,arguments))},this.destroy=function(){this.getRuntime().getShim().removeInstance(this.uid)}}return e.Blob=i}),n("moxie/core/utils/Events",["moxie/core/utils/Basic"],function(e){function t(){this.returnValue=!1}function i(){this.cancelBubble=!0}var n={},r="moxie_"+e.guid(),o=function(o,a,s,u){var c,l;a=a.toLowerCase(),o.addEventListener?(c=s,o.addEventListener(a,c,!1)):o.attachEvent&&(c=function(){var e=window.event;e.target||(e.target=e.srcElement),e.preventDefault=t,e.stopPropagation=i,s(e)},o.attachEvent("on"+a,c)),o[r]||(o[r]=e.guid()),n.hasOwnProperty(o[r])||(n[o[r]]={}),l=n[o[r]],l.hasOwnProperty(a)||(l[a]=[]),l[a].push({func:c,orig:s,key:u})},a=function(t,i,o){var a,s;if(i=i.toLowerCase(),t[r]&&n[t[r]]&&n[t[r]][i]){a=n[t[r]][i];for(var u=a.length-1;u>=0&&(a[u].orig!==o&&a[u].key!==o||(t.removeEventListener?t.removeEventListener(i,a[u].func,!1):t.detachEvent&&t.detachEvent("on"+i,a[u].func),a[u].orig=null,a[u].func=null,a.splice(u,1),o===s));u--);if(a.length||delete n[t[r]][i],e.isEmptyObj(n[t[r]])){delete n[t[r]];try{delete t[r]}catch(c){t[r]=s}}}},s=function(t,i){t&&t[r]&&e.each(n[t[r]],function(e,n){a(t,n,i)})};return{addEvent:o,removeEvent:a,removeAllEvents:s}}),n("moxie/runtime/html5/file/FileInput",["moxie/runtime/html5/Runtime","moxie/file/File","moxie/core/utils/Basic","moxie/core/utils/Dom","moxie/core/utils/Events","moxie/core/utils/Mime","moxie/core/utils/Env"],function(e,t,i,n,r,o,a){function s(){var e,s;i.extend(this,{init:function(u){var c,l,d,m,h,f,p=this,g=p.getRuntime();e=u,d=o.extList2mimes(e.accept,g.can("filter_by_extension")),l=g.getShimContainer(),l.innerHTML='<input id="'+g.uid+'" type="file" style="font-size:999px;opacity:0;"'+(e.multiple&&g.can("select_multiple")?"multiple":"")+(e.directory&&g.can("select_folder")?"webkitdirectory directory":"")+(d?' accept="'+d.join(",")+'"':"")+" />",c=n.get(g.uid),i.extend(c.style,{position:"absolute",top:0,left:0,width:"100%",height:"100%"}),m=n.get(e.browse_button),s=n.getStyle(m,"z-index")||"auto",g.can("summon_file_dialog")&&("static"===n.getStyle(m,"position")&&(m.style.position="relative"),r.addEvent(m,"click",function(e){var t=n.get(g.uid);t&&!t.disabled&&t.click(),e.preventDefault()},p.uid),p.bind("Refresh",function(){h=parseInt(s,10)||1,n.get(e.browse_button).style.zIndex=h,this.getRuntime().getShimContainer().style.zIndex=h-1})),f=g.can("summon_file_dialog")?m:l,r.addEvent(f,"mouseover",function(){p.trigger("mouseenter")},p.uid),r.addEvent(f,"mouseout",function(){p.trigger("mouseleave")},p.uid),r.addEvent(f,"mousedown",function(){p.trigger("mousedown")},p.uid),r.addEvent(n.get(e.container),"mouseup",function(){p.trigger("mouseup")},p.uid),(g.can("summon_file_dialog")?c:m).setAttribute("tabindex",-1),c.onchange=function x(){if(p.files=[],i.each(this.files,function(i){var n="";return e.directory&&"."==i.name?!0:(i.webkitRelativePath&&(n="/"+i.webkitRelativePath.replace(/^\//,"")),i=new t(g.uid,i),i.relativePath=n,p.files.push(i),void 0)}),"IE"!==a.browser&&"IEMobile"!==a.browser)this.value="";else{var n=this.cloneNode(!0);this.parentNode.replaceChild(n,this),n.onchange=x}p.files.length&&p.trigger("change")},p.trigger({type:"ready",async:!0}),l=null},setOption:function(e,t){var i=this.getRuntime(),r=n.get(i.uid);switch(e){case"accept":if(t){var a=t.mimes||o.extList2mimes(t,i.can("filter_by_extension"));r.setAttribute("accept",a.join(","))}else r.removeAttribute("accept");break;case"directory":t&&i.can("select_folder")?(r.setAttribute("directory",""),r.setAttribute("webkitdirectory","")):(r.removeAttribute("directory"),r.removeAttribute("webkitdirectory"));break;case"multiple":t&&i.can("select_multiple")?r.setAttribute("multiple",""):r.removeAttribute("multiple")}},disable:function(e){var t,i=this.getRuntime();(t=n.get(i.uid))&&(t.disabled=!!e)},destroy:function(){var t=this.getRuntime(),i=t.getShim(),o=t.getShimContainer(),a=e&&n.get(e.container),u=e&&n.get(e.browse_button);a&&r.removeAllEvents(a,this.uid),u&&(r.removeAllEvents(u,this.uid),u.style.zIndex=s),o&&(r.removeAllEvents(o,this.uid),o.innerHTML=""),i.removeInstance(this.uid),e=o=a=u=i=null}})}return e.FileInput=s}),n("moxie/runtime/html5/file/FileDrop",["moxie/runtime/html5/Runtime","moxie/file/File","moxie/core/utils/Basic","moxie/core/utils/Dom","moxie/core/utils/Events","moxie/core/utils/Mime"],function(e,t,i,n,r,o){function a(){function e(e){if(!e.dataTransfer||!e.dataTransfer.types)return!1;var t=i.toArray(e.dataTransfer.types||[]);return-1!==i.inArray("Files",t)||-1!==i.inArray("public.file-url",t)||-1!==i.inArray("application/x-moz-file",t)}function a(e,i){if(u(e)){var n=new t(f,e);n.relativePath=i||"",p.push(n)}}function s(e){for(var t=[],n=0;n<e.length;n++)[].push.apply(t,e[n].extensions.split(/\s*,\s*/));return-1===i.inArray("*",t)?t:[]}function u(e){if(!g.length)return!0;var t=o.getFileExtension(e.name);return!t||-1!==i.inArray(t,g)}function c(e,t){var n=[];i.each(e,function(e){var t=e.webkitGetAsEntry();t&&(t.isFile?a(e.getAsFile(),t.fullPath):n.push(t))}),n.length?l(n,t):t()}function l(e,t){var n=[];i.each(e,function(e){n.push(function(t){d(e,t)})}),i.inSeries(n,function(){t()})}function d(e,t){e.isFile?e.file(function(i){a(i,e.fullPath),t()},function(){t()}):e.isDirectory?m(e,t):t()}function m(e,t){function i(e){r.readEntries(function(t){t.length?([].push.apply(n,t),i(e)):e()},e)}var n=[],r=e.createReader();i(function(){l(n,t)})}var h,f,p=[],g=[];i.extend(this,{init:function(t){var n,o=this;h=t,f=o.ruid,g=s(h.accept),n=h.container,r.addEvent(n,"dragover",function(t){e(t)&&(t.preventDefault(),t.dataTransfer.dropEffect="copy")},o.uid),r.addEvent(n,"drop",function(t){e(t)&&(t.preventDefault(),p=[],t.dataTransfer.items&&t.dataTransfer.items[0].webkitGetAsEntry?c(t.dataTransfer.items,function(){o.files=p,o.trigger("drop")}):(i.each(t.dataTransfer.files,function(e){a(e)}),o.files=p,o.trigger("drop")))},o.uid),r.addEvent(n,"dragenter",function(){o.trigger("dragenter")},o.uid),r.addEvent(n,"dragleave",function(){o.trigger("dragleave")},o.uid)},destroy:function(){r.removeAllEvents(h&&n.get(h.container),this.uid),f=p=g=h=null,this.getRuntime().getShim().removeInstance(this.uid)}})}return e.FileDrop=a}),n("moxie/runtime/html5/file/FileReader",["moxie/runtime/html5/Runtime","moxie/core/utils/Encode","moxie/core/utils/Basic"],function(e,t,i){function n(){function e(e){return t.atob(e.substring(e.indexOf("base64,")+7))}var n,r=!1;i.extend(this,{read:function(t,o){var a=this;a.result="",n=new window.FileReader,n.addEventListener("progress",function(e){a.trigger(e)}),n.addEventListener("load",function(t){a.result=r?e(n.result):n.result,a.trigger(t)}),n.addEventListener("error",function(e){a.trigger(e,n.error)}),n.addEventListener("loadend",function(e){n=null,a.trigger(e)}),"function"===i.typeOf(n[t])?(r=!1,n[t](o.getSource())):"readAsBinaryString"===t&&(r=!0,n.readAsDataURL(o.getSource()))},abort:function(){n&&n.abort()},destroy:function(){n=null,this.getRuntime().getShim().removeInstance(this.uid)}})}return e.FileReader=n}),n("moxie/runtime/html5/xhr/XMLHttpRequest",["moxie/runtime/html5/Runtime","moxie/core/utils/Basic","moxie/core/utils/Mime","moxie/core/utils/Url","moxie/file/File","moxie/file/Blob","moxie/xhr/FormData","moxie/core/Exceptions","moxie/core/utils/Env"],function(e,t,i,n,r,o,a,s,u){function c(){function e(e,t){var i,n,r=this;i=t.getBlob().getSource(),n=new window.FileReader,n.onload=function(){t.append(t.getBlobName(),new o(null,{type:i.type,data:n.result})),f.send.call(r,e,t)},n.readAsBinaryString(i)}function c(){return!window.XMLHttpRequest||"IE"===u.browser&&u.verComp(u.version,8,"<")?function(){for(var e=["Msxml2.XMLHTTP.6.0","Microsoft.XMLHTTP"],t=0;t<e.length;t++)try{return new ActiveXObject(e[t])}catch(i){}}():new window.XMLHttpRequest}function l(e){var t=e.responseXML,i=e.responseText;return"IE"===u.browser&&i&&t&&!t.documentElement&&/[^\/]+\/[^\+]+\+xml/.test(e.getResponseHeader("Content-Type"))&&(t=new window.ActiveXObject("Microsoft.XMLDOM"),t.async=!1,t.validateOnParse=!1,t.loadXML(i)),t&&("IE"===u.browser&&0!==t.parseError||!t.documentElement||"parsererror"===t.documentElement.tagName)?null:t
|
15 |
+
}function d(e){var t="----moxieboundary"+(new Date).getTime(),i="--",n="\r\n",r="",a=this.getRuntime();if(!a.can("send_binary_string"))throw new s.RuntimeError(s.RuntimeError.NOT_SUPPORTED_ERR);return m.setRequestHeader("Content-Type","multipart/form-data; boundary="+t),e.each(function(e,a){r+=e instanceof o?i+t+n+'Content-Disposition: form-data; name="'+a+'"; filename="'+unescape(encodeURIComponent(e.name||"blob"))+'"'+n+"Content-Type: "+(e.type||"application/octet-stream")+n+n+e.getSource()+n:i+t+n+'Content-Disposition: form-data; name="'+a+'"'+n+n+unescape(encodeURIComponent(e))+n}),r+=i+t+i+n}var m,h,f=this;t.extend(this,{send:function(i,r){var s=this,l="Mozilla"===u.browser&&u.verComp(u.version,4,">=")&&u.verComp(u.version,7,"<"),f="Android Browser"===u.browser,p=!1;if(h=i.url.replace(/^.+?\/([\w\-\.]+)$/,"$1").toLowerCase(),m=c(),m.open(i.method,i.url,i.async,i.user,i.password),r instanceof o)r.isDetached()&&(p=!0),r=r.getSource();else if(r instanceof a){if(r.hasBlob())if(r.getBlob().isDetached())r=d.call(s,r),p=!0;else if((l||f)&&"blob"===t.typeOf(r.getBlob().getSource())&&window.FileReader)return e.call(s,i,r),void 0;if(r instanceof a){var g=new window.FormData;r.each(function(e,t){e instanceof o?g.append(t,e.getSource()):g.append(t,e)}),r=g}}m.upload?(i.withCredentials&&(m.withCredentials=!0),m.addEventListener("load",function(e){s.trigger(e)}),m.addEventListener("error",function(e){s.trigger(e)}),m.addEventListener("progress",function(e){s.trigger(e)}),m.upload.addEventListener("progress",function(e){s.trigger({type:"UploadProgress",loaded:e.loaded,total:e.total})})):m.onreadystatechange=function(){switch(m.readyState){case 1:break;case 2:break;case 3:var e,t;try{n.hasSameOrigin(i.url)&&(e=m.getResponseHeader("Content-Length")||0),m.responseText&&(t=m.responseText.length)}catch(r){e=t=0}s.trigger({type:"progress",lengthComputable:!!e,total:parseInt(e,10),loaded:t});break;case 4:m.onreadystatechange=function(){};try{if(m.status>=200&&m.status<400){s.trigger("load");break}}catch(r){}s.trigger("error")}},t.isEmptyObj(i.headers)||t.each(i.headers,function(e,t){m.setRequestHeader(t,e)}),""!==i.responseType&&"responseType"in m&&(m.responseType="json"!==i.responseType||u.can("return_response_type","json")?i.responseType:"text"),p?m.sendAsBinary?m.sendAsBinary(r):function(){for(var e=new Uint8Array(r.length),t=0;t<r.length;t++)e[t]=255&r.charCodeAt(t);m.send(e.buffer)}():m.send(r),s.trigger("loadstart")},getStatus:function(){try{if(m)return m.status}catch(e){}return 0},getResponse:function(e){var t=this.getRuntime();try{switch(e){case"blob":var n=new r(t.uid,m.response),o=m.getResponseHeader("Content-Disposition");if(o){var a=o.match(/filename=([\'\"'])([^\1]+)\1/);a&&(h=a[2])}return n.name=h,n.type||(n.type=i.getFileMime(h)),n;case"json":return u.can("return_response_type","json")?m.response:200===m.status&&window.JSON?JSON.parse(m.responseText):null;case"document":return l(m);default:return""!==m.responseText?m.responseText:null}}catch(s){return null}},getAllResponseHeaders:function(){try{return m.getAllResponseHeaders()}catch(e){}return""},abort:function(){m&&m.abort()},destroy:function(){f=h=null,this.getRuntime().getShim().removeInstance(this.uid)}})}return e.XMLHttpRequest=c}),n("moxie/runtime/html5/utils/BinaryReader",["moxie/core/utils/Basic"],function(e){function t(e){e instanceof ArrayBuffer?i.apply(this,arguments):n.apply(this,arguments)}function i(t){var i=new DataView(t);e.extend(this,{readByteAt:function(e){return i.getUint8(e)},writeByteAt:function(e,t){i.setUint8(e,t)},SEGMENT:function(e,n,r){switch(arguments.length){case 2:return t.slice(e,e+n);case 1:return t.slice(e);case 3:if(null===r&&(r=new ArrayBuffer),r instanceof ArrayBuffer){var o=new Uint8Array(this.length()-n+r.byteLength);e>0&&o.set(new Uint8Array(t.slice(0,e)),0),o.set(new Uint8Array(r),e),o.set(new Uint8Array(t.slice(e+n)),e+r.byteLength),this.clear(),t=o.buffer,i=new DataView(t);break}default:return t}},length:function(){return t?t.byteLength:0},clear:function(){i=t=null}})}function n(t){function i(e,i,n){n=3===arguments.length?n:t.length-i-1,t=t.substr(0,i)+e+t.substr(n+i)}e.extend(this,{readByteAt:function(e){return t.charCodeAt(e)},writeByteAt:function(e,t){i(String.fromCharCode(t),e,1)},SEGMENT:function(e,n,r){switch(arguments.length){case 1:return t.substr(e);case 2:return t.substr(e,n);case 3:i(null!==r?r:"",e,n);break;default:return t}},length:function(){return t?t.length:0},clear:function(){t=null}})}return e.extend(t.prototype,{littleEndian:!1,read:function(e,t){var i,n,r;if(e+t>this.length())throw new Error("You are trying to read outside the source boundaries.");for(n=this.littleEndian?0:-8*(t-1),r=0,i=0;t>r;r++)i|=this.readByteAt(e+r)<<Math.abs(n+8*r);return i},write:function(e,t,i){var n,r;if(e>this.length())throw new Error("You are trying to write outside the source boundaries.");for(n=this.littleEndian?0:-8*(i-1),r=0;i>r;r++)this.writeByteAt(e+r,255&t>>Math.abs(n+8*r))},BYTE:function(e){return this.read(e,1)},SHORT:function(e){return this.read(e,2)},LONG:function(e){return this.read(e,4)},SLONG:function(e){var t=this.read(e,4);return t>2147483647?t-4294967296:t},CHAR:function(e){return String.fromCharCode(this.read(e,1))},STRING:function(e,t){return this.asArray("CHAR",e,t).join("")},asArray:function(e,t,i){for(var n=[],r=0;i>r;r++)n[r]=this[e](t+r);return n}}),t}),n("moxie/runtime/html5/image/JPEGHeaders",["moxie/runtime/html5/utils/BinaryReader","moxie/core/Exceptions"],function(e,t){return function i(n){var r,o,a,s=[],u=0;if(r=new e(n),65496!==r.SHORT(0))throw r.clear(),new t.ImageError(t.ImageError.WRONG_FORMAT);for(o=2;o<=r.length();)if(a=r.SHORT(o),a>=65488&&65495>=a)o+=2;else{if(65498===a||65497===a)break;u=r.SHORT(o+2)+2,a>=65505&&65519>=a&&s.push({hex:a,name:"APP"+(15&a),start:o,length:u,segment:r.SEGMENT(o,u)}),o+=u}return r.clear(),{headers:s,restore:function(t){var i,n,r;for(r=new e(t),o=65504==r.SHORT(2)?4+r.SHORT(4):2,n=0,i=s.length;i>n;n++)r.SEGMENT(o,0,s[n].segment),o+=s[n].l
|