| 1 |
<?php |
| 2 |
/* |
| 3 |
* Followig class handling file input control and their |
| 4 |
* dependencies. Do not make changes in code |
| 5 |
* Create on: 9 November, 2013 |
| 6 |
*/ |
| 7 |
|
| 8 |
class NM_File extends NM_Inputs_wpcomment{ |
| 9 |
|
| 10 |
/* |
| 11 |
* input control settings |
| 12 |
*/ |
| 13 |
var $title, $desc, $settings; |
| 14 |
|
| 15 |
|
| 16 |
/* |
| 17 |
* this var is pouplated with current plugin meta |
| 18 |
*/ |
| 19 |
var $plugin_meta; |
| 20 |
|
| 21 |
function __construct(){ |
| 22 |
|
| 23 |
$this -> plugin_meta = get_plugin_meta_wpcomment(); |
| 24 |
|
| 25 |
$this -> title = __ ( 'File Input', 'nm-wpcomments' ); |
| 26 |
$this -> desc = __ ( 'regular file input', 'nm-wpcomments' ); |
| 27 |
$this -> settings = self::get_settings(); |
| 28 |
|
| 29 |
$this -> input_scripts = array( 'shipped' => array(''), |
| 30 |
|
| 31 |
'custom' => array( |
| 32 |
array ( |
| 33 |
'script_name' => 'plupload_script', |
| 34 |
'script_source' => '/js/uploader/plupload.full.min.js', |
| 35 |
'localized' => false, |
| 36 |
'type' => 'js', |
| 37 |
'depends' => array('jquery'), |
| 38 |
'in_footer' => '', |
| 39 |
), |
| 40 |
|
| 41 |
) |
| 42 |
); |
| 43 |
|
| 44 |
add_action ( 'wp_enqueue_scripts', array ($this, 'load_input_scripts')); |
| 45 |
|
| 46 |
} |
| 47 |
|
| 48 |
|
| 49 |
|
| 50 |
|
| 51 |
private function get_settings(){ |
| 52 |
|
| 53 |
return array ( |
| 54 |
'title' => array ( |
| 55 |
'type' => 'text', |
| 56 |
'title' => __ ( 'Title', 'nm-wpcomments' ), |
| 57 |
'desc' => __ ( 'It will be shown as field label', 'nm-wpcomments' ) |
| 58 |
), |
| 59 |
'data_name' => array ( |
| 60 |
'type' => 'text', |
| 61 |
'title' => __ ( 'Data name', 'nm-wpcomments' ), |
| 62 |
'desc' => __ ( 'REQUIRED: The identification name of this field, that you can insert into body email configuration. Note:Use only lowercase characters and underscores.', 'nm-wpcomments' ) |
| 63 |
), |
| 64 |
'description' => array ( |
| 65 |
'type' => 'text', |
| 66 |
'title' => __ ( 'Description', 'nm-wpcomments' ), |
| 67 |
'desc' => __ ( 'Small description, it will be diplay near name title.', 'nm-wpcomments' ) |
| 68 |
), |
| 69 |
'error_message' => array ( |
| 70 |
'type' => 'text', |
| 71 |
'title' => __ ( 'Error message', 'nm-wpcomments' ), |
| 72 |
'desc' => __ ( 'Insert the error message for validation.', 'nm-wpcomments' ) |
| 73 |
), |
| 74 |
|
| 75 |
'required' => array ( |
| 76 |
'type' => 'checkbox', |
| 77 |
'title' => __ ( 'Required', 'nm-wpcomments' ), |
| 78 |
'desc' => __ ( 'Select this if it must be required.', 'nm-wpcomments' ) |
| 79 |
), |
| 80 |
|
| 81 |
'class' => array ( |
| 82 |
'type' => 'text', |
| 83 |
'title' => __ ( 'Class', 'nm-wpcomments' ), |
| 84 |
'desc' => __ ( 'Insert an additional class(es) (separateb by comma) for more personalization.', 'nm-wpcomments' ) |
| 85 |
), |
| 86 |
|
| 87 |
'width' => array ( |
| 88 |
'type' => 'text', |
| 89 |
'title' => __ ( 'Width', 'nm-wpcomments' ), |
| 90 |
'desc' => __ ( 'Type field width in % e.g: 50%', 'nm-wpcomments' ) |
| 91 |
), |
| 92 |
|
| 93 |
'dragdrop' => array ( |
| 94 |
'type' => 'checkbox', |
| 95 |
'title' => __ ( 'Drag & Drop', 'nm-wpcomments' ), |
| 96 |
'desc' => __ ( 'Turn drag & drop on/eff.', 'nm-wpcomments' ) |
| 97 |
), |
| 98 |
|
| 99 |
'popup_width' => array ( |
| 100 |
'type' => 'text', |
| 101 |
'title' => __ ( 'Popup width', 'nm-wpcomments' ), |
| 102 |
'desc' => __ ( '(if image) Popup window width in px e.g: 750', 'nm-wpcomments' ) |
| 103 |
), |
| 104 |
|
| 105 |
'popup_height' => array ( |
| 106 |
'type' => 'text', |
| 107 |
'title' => __ ( 'Popup height', 'nm-wpcomments' ), |
| 108 |
'desc' => __ ( '(if image) Popup window height in px e.g: 550', 'nm-wpcomments' ) |
| 109 |
), |
| 110 |
|
| 111 |
'button_label_select' => array ( |
| 112 |
'type' => 'text', |
| 113 |
'title' => __ ( 'Button label (select files)', 'nm-wpcomments' ), |
| 114 |
'desc' => __ ( 'Type button label e.g: Select Photos', 'nm-wpcomments' ) |
| 115 |
), |
| 116 |
|
| 117 |
|
| 118 |
'button_class' => array ( |
| 119 |
'type' => 'text', |
| 120 |
'title' => __ ( 'Button class', 'nm-wpcomments' ), |
| 121 |
'desc' => __ ( 'Type class for both (select, upload) buttons', 'nm-wpcomments' ) |
| 122 |
), |
| 123 |
'files_allowed' => array ( |
| 124 |
'type' => 'text', |
| 125 |
'title' => __ ( 'Files allowed', 'nm-wpcomments' ), |
| 126 |
'desc' => __ ( 'Type number of files allowed per upload by user, e.g: 3', 'nm-wpcomments' ) |
| 127 |
), |
| 128 |
'file_types' => array ( |
| 129 |
'type' => 'text', |
| 130 |
'title' => __ ( 'File types', 'nm-wpcomments' ), |
| 131 |
'desc' => __ ( 'File types allowed seperated by comma, e.g: jpg,pdf,zip', 'nm-wpcomments' ) |
| 132 |
), |
| 133 |
|
| 134 |
'file_size' => array ( |
| 135 |
'type' => 'text', |
| 136 |
'title' => __ ( 'File size', 'nm-wpcomments' ), |
| 137 |
'desc' => __ ( 'Type size with units in kb|mb per file uploaded by user, e.g: 3mb', 'nm-wpcomments' ) |
| 138 |
), |
| 139 |
/*'chunk_size' => array ( |
| 140 |
'type' => 'text', |
| 141 |
'title' => __ ( 'chunk size', 'nm-wpcomments' ), |
| 142 |
'desc' => __ ( 'Enables you to chunk the large file into smaller pieces, e.g: 1mb', 'nm-wpcomments' ) |
| 143 |
), |
| 144 |
|
| 145 |
'photo_editing' => array ( |
| 146 |
'type' => 'checkbox', |
| 147 |
'title' => __ ( 'Enable photo editing', 'nm-wpcomments' ), |
| 148 |
'desc' => __ ( 'Allow users to edit photos by Aviary API, make sure that Aviary API Key is set in previous tab.', 'nm-wpcomments' ) |
| 149 |
), |
| 150 |
|
| 151 |
'editing_tools' => array ( |
| 152 |
'type' => 'checkbox', |
| 153 |
'title' => __ ( 'Editing Options', 'nm-wpcomments' ), |
| 154 |
'desc' => __ ( 'Select editing options', 'nm-wpcomments' ), |
| 155 |
'options' => array ( |
| 156 |
'enhance' => 'Enhancements', |
| 157 |
'effects' => 'Filters', |
| 158 |
'frames' => 'Frames', |
| 159 |
'stickers' => 'Stickers', |
| 160 |
'orientation' => 'Orientation', |
| 161 |
'focus' => 'Focus', |
| 162 |
'resize' => 'Resize', |
| 163 |
'crop' => 'Crop', |
| 164 |
'warmth' => 'Warmth', |
| 165 |
'brightness' => 'Brightness', |
| 166 |
'contrast' => 'Contrast', |
| 167 |
'saturation' => 'Saturation', |
| 168 |
'sharpness' => 'Sharpness', |
| 169 |
'colorsplash' => 'Colorsplash', |
| 170 |
'draw' => 'Draw', |
| 171 |
'text' => 'Text', |
| 172 |
'redeye' => 'Red-Eye', |
| 173 |
'whiten' => 'Whiten teeth', |
| 174 |
'blemish' => 'Remove skin blemishes' |
| 175 |
) |
| 176 |
), */ |
| 177 |
|
| 178 |
'logic' => array ( |
| 179 |
'type' => 'checkbox', |
| 180 |
'title' => __ ( 'Enable conditional logic', 'nm-wpcomments' ), |
| 181 |
'desc' => __ ( 'Tick it to turn conditional logic to work below', 'nm-wpcomments' ) |
| 182 |
), |
| 183 |
'conditions' => array ( |
| 184 |
'type' => 'html-conditions', |
| 185 |
'title' => __ ( 'Conditions', 'nm-wpcomments' ), |
| 186 |
'desc' => __ ( 'Tick it to turn conditional logic to work below', 'nm-wpcomments' ) |
| 187 |
), |
| 188 |
); |
| 189 |
} |
| 190 |
|
| 191 |
|
| 192 |
/* |
| 193 |
* @params: args |
| 194 |
*/ |
| 195 |
function render_input($args, $content=""){ |
| 196 |
|
| 197 |
$_html = '<div class="container_buttons">'; |
| 198 |
$_html .= '<div class="btn_center">'; |
| 199 |
$_html .= '<a id="selectfiles-'.$args['id'].'" href="javascript:;" class="select_button '.$args['button-class'].'">' . $args['button-label-select'] . '</a>'; |
| 200 |
|
| 201 |
//$_html .= '<input type="button" name="upload_file_front" value="Upload file" />'; |
| 202 |
$_html .= '</div>'; |
| 203 |
|
| 204 |
|
| 205 |
|
| 206 |
$_html .= '</div>'; //container_buttons |
| 207 |
|
| 208 |
if( isset( $args['dragdrop']) && $args['dragdrop'] ){ |
| 209 |
|
| 210 |
$_html .= '<div class="droptext">'; |
| 211 |
if($this -> if_browser_is_ie()) |
| 212 |
$_html .= __('Drag file(s) in this box', 'nm-wpcomments'); |
| 213 |
else |
| 214 |
$_html .= __('Drag file(s) or directory in this box', 'nm-wpcomments'); |
| 215 |
$_html .= '</div>'; |
| 216 |
} |
| 217 |
|
| 218 |
$_html .= '<div id="filelist-'.$args['id'].'" class="filelist"></div>'; |
| 219 |
|
| 220 |
|
| 221 |
echo $_html; |
| 222 |
|
| 223 |
$this -> get_input_js($args); |
| 224 |
} |
| 225 |
|
| 226 |
|
| 227 |
/* |
| 228 |
* Aviary editing tools is returned |
| 229 |
*/ |
| 230 |
function get_editing_tools($editing_tools){ |
| 231 |
|
| 232 |
parse_str ( $editing_tools, $tools ); |
| 233 |
if ($tools['editing_tools']) |
| 234 |
return implode(',', $tools['editing_tools']); |
| 235 |
} |
| 236 |
|
| 237 |
|
| 238 |
/* |
| 239 |
* following function is rendering JS needed for input |
| 240 |
*/ |
| 241 |
function get_input_js($args){ |
| 242 |
|
| 243 |
//filemanager_pa($args); |
| 244 |
|
| 245 |
if($this -> if_browser_is_ie()) |
| 246 |
$runtimes = 'flash'; |
| 247 |
else |
| 248 |
$runtimes = 'html5,flash,silverlight,html4,browserplus,gear'; |
| 249 |
|
| 250 |
$chunk_size = '1mb'; |
| 251 |
|
| 252 |
$popup_width = $args['popup-width'] == '' ? 600 : $args['popup-width']; |
| 253 |
$popup_height = $args['popup-height'] == '' ? 450 : $args['popup-height']; |
| 254 |
|
| 255 |
|
| 256 |
|
| 257 |
?> |
| 258 |
|
| 259 |
<script type="text/javascript"> |
| 260 |
<!-- |
| 261 |
|
| 262 |
var file_count_<?php echo $args['id']?> = 1; |
| 263 |
var uploader_<?php echo $args['id']?>; |
| 264 |
jQuery(function($){ |
| 265 |
|
| 266 |
// delete file |
| 267 |
$("#nm-uploader-area-<?php echo $args['id']?>").find('.u_i_c_tools_del > a').live('click', function(){ |
| 268 |
|
| 269 |
// console.log($(this)); |
| 270 |
var del_message = '<?php _e('are you sure to delete this file?', 'nm-wpcomments')?>'; |
| 271 |
var a = confirm(del_message); |
| 272 |
if(a){ |
| 273 |
// it is removing from uploader instance |
| 274 |
var fileid = $(this).attr("data-fileid"); |
| 275 |
uploader_<?php echo $args['id']?>.removeFile(fileid); |
| 276 |
|
| 277 |
var filename = jQuery('input:checkbox[name="<?php echo $args['id']?>['+fileid+']"]').val(); |
| 278 |
|
| 279 |
// it is removing physically if uploaded |
| 280 |
jQuery("#u_i_c_"+fileid).find('img').attr('src', nm_filemanager_vars.plugin_url+'/images/loading.gif'); |
| 281 |
|
| 282 |
console.log('filename <?php echo $args['id']?>['+fileid+']'); |
| 283 |
var data = {action: 'nm_filemanager_delete_file', file_name: filename}; |
| 284 |
|
| 285 |
jQuery.post(nm_filemanager_vars.ajaxurl, data, function(resp){ |
| 286 |
alert(resp); |
| 287 |
jQuery("#u_i_c_"+fileid).hide(500).remove(); |
| 288 |
|
| 289 |
// it is removing for input Holder |
| 290 |
jQuery('input:checkbox[name="<?php echo $args['id']?>['+fileid+']"]').remove(); |
| 291 |
file_count_<?php echo $args['id']?>--; |
| 292 |
|
| 293 |
}); |
| 294 |
} |
| 295 |
}); |
| 296 |
|
| 297 |
|
| 298 |
var $filelist_DIV = $('#filelist-<?php echo $args['id']?>'); |
| 299 |
uploader_<?php echo $args['id']?> = new plupload.Uploader({ |
| 300 |
runtimes : '<?php echo $runtimes?>', |
| 301 |
browse_button : 'selectfiles-<?php echo $args['id']?>', // you can pass in id... |
| 302 |
container : 'nm-uploader-area-<?php echo $args['id']?>', // ... or DOM Element itself |
| 303 |
drop_element : 'nm-uploader-area-<?php echo $args['id']?>', |
| 304 |
url : '<?php echo admin_url ( 'admin-ajax.php' )?>', |
| 305 |
multipart_params : {'action' : 'nm_filemanager_upload_file'}, |
| 306 |
max_file_size : '<?php echo $args['file-size']?>', |
| 307 |
max_file_count : parseInt(<?php echo $args['files-allowed']?>), |
| 308 |
|
| 309 |
chunk_size: '<?php echo $chunk_size?>', |
| 310 |
|
| 311 |
// Flash settings |
| 312 |
flash_swf_url : '<?php echo $this -> plugin_meta['url']?>/js/uploader/Moxie.swf', |
| 313 |
// Silverlight settings |
| 314 |
silverlight_xap_url : '<?php echo $this -> plugin_meta['url']?>/js/uploader/Moxie.xap', |
| 315 |
|
| 316 |
filters : { |
| 317 |
mime_types: [ |
| 318 |
{title : "Filetypes", extensions : "<?php echo $args['file-types']?>"} |
| 319 |
] |
| 320 |
}, |
| 321 |
|
| 322 |
init: { |
| 323 |
PostInit: function() { |
| 324 |
$filelist_DIV.html(''); |
| 325 |
|
| 326 |
$('#uploadfiles-<?php echo $args['id']?>').bind('click', function() { |
| 327 |
uploader_<?php echo $args['id']?>.start(); |
| 328 |
return false; |
| 329 |
}); |
| 330 |
}, |
| 331 |
|
| 332 |
FilesAdded: function(up, files) { |
| 333 |
|
| 334 |
var files_added = up.files.length; |
| 335 |
var max_count_error = false; |
| 336 |
|
| 337 |
|
| 338 |
|
| 339 |
plupload.each(files, function (file) { |
| 340 |
|
| 341 |
if(file_count_<?php echo $args['id']?> > uploader_<?php echo $args['id']?>.settings.max_file_count){ |
| 342 |
|
| 343 |
max_count_error = true; |
| 344 |
}else{ |
| 345 |
// Code to add pending file details, if you want |
| 346 |
add_thumb_box(file, $filelist_DIV, up); |
| 347 |
} |
| 348 |
|
| 349 |
file_count_<?php echo $args['id']?>++; |
| 350 |
}); |
| 351 |
|
| 352 |
|
| 353 |
if(max_count_error) |
| 354 |
alert('Only '+uploader_<?php echo $args['id']?>.settings.max_file_count+' files are allowed'); |
| 355 |
|
| 356 |
setTimeout('uploader_<?php echo $args['id']?>.start()', 100); |
| 357 |
|
| 358 |
}, |
| 359 |
|
| 360 |
FileUploaded: function(up, file, info){ |
| 361 |
|
| 362 |
/* console.log(up); |
| 363 |
console.log(file);*/ |
| 364 |
|
| 365 |
var obj_resp = $.parseJSON(info.response); |
| 366 |
//console.log(obj_resp); |
| 367 |
var file_thumb = ''; |
| 368 |
|
| 369 |
// checking if uploaded file is thumb |
| 370 |
ext = obj_resp.file_name.substring(obj_resp.file_name.lastIndexOf('.') + 1); |
| 371 |
ext = ext.toLowerCase(); |
| 372 |
|
| 373 |
if(ext == 'png' || ext == 'gif' || ext == 'jpg' || ext == 'jpeg'){ |
| 374 |
|
| 375 |
file_thumb = nm_filemanager_vars.file_upload_path_thumb + obj_resp.file_name; |
| 376 |
$filelist_DIV.find('#u_i_c_' + file.id).find('.u_i_c_thumb').html('<img src="'+file_thumb+ '" id="thumb_'+file.id+'" />'); |
| 377 |
|
| 378 |
var file_full = nm_filemanager_vars.file_upload_path + obj_resp.file_name; |
| 379 |
// thumb thickbox only shown if it is image |
| 380 |
$filelist_DIV.find('#u_i_c_' + file.id).find('.u_i_c_thumb').append('<div style="display:none" id="u_i_c_big' + file.id + '"><img src="'+file_full+ '" /></div>'); |
| 381 |
|
| 382 |
// Aviary editing tools |
| 383 |
if('<?php echo $args['photo-editing']; ?>' === 'on'){ |
| 384 |
var editing_tools = '<?php echo $this -> get_editing_tools($args['editing-tools']); ?>'; |
| 385 |
$filelist_DIV.find('#u_i_c_' + file.id).find('.u_i_c_tools_edit').append('<a onclick="return launch_aviary_editor(\'thumb_'+file.id+'\', \''+file_full+'\', \''+obj_resp.file_name+'\', \''+editing_tools+'\')" href="javascript:;" title="Edit"><img width="15" src="'+nm_filemanager_vars.plugin_url+'/images/edit.png" width="16" /></a>'); |
| 386 |
} |
| 387 |
|
| 388 |
// zoom effect |
| 389 |
$filelist_DIV.find('#u_i_c_' + file.id).find('.u_i_c_tools_zoom').append('<a href="#TB_inline?width=<?php echo $popup_width?>&height=<?php echo $popup_height?>&inlineId=u_i_c_big'+file.id+'" class="thickbox" title="'+obj_resp.file_name+'"><img src="'+nm_filemanager_vars.plugin_url+'/images/zoom.png" width="16" /></a>'); |
| 390 |
is_image = true; |
| 391 |
}else{ |
| 392 |
file_thumb = nm_filemanager_vars.plugin_url+'/images/file.png'; |
| 393 |
$filelist_DIV.find('#u_i_c_' + file.id).find('.u_i_c_thumb').html('<img src="'+file_thumb+ '" id="thumb_'+file.id+'" width="16" />'); |
| 394 |
is_image = false; |
| 395 |
} |
| 396 |
|
| 397 |
// adding checkbox input to Hold uploaded file name as array |
| 398 |
$filelist_DIV.append('<input style="display:none" checked="checked" type="checkbox" value="'+obj_resp.file_name+'" name="<?php echo $args['id']?>['+file.id+']" />'); |
| 399 |
}, |
| 400 |
|
| 401 |
UploadProgress: function(up, file) { |
| 402 |
//document.getElementById(file.id).getElementsByTagName('b')[0].innerHTML = '<span>' + file.percent + "%</span>"; |
| 403 |
//console.log($filelist_DIV.find('#' + file.id).find('.progress_bar_runner')); |
| 404 |
$filelist_DIV.find('#u_i_c_' + file.id).find('.progress_bar_number').html(file.percent + '%'); |
| 405 |
$filelist_DIV.find('#u_i_c_' + file.id).find('.progress_bar_runner').css({'display':'block', 'width':file.percent + '%'}); |
| 406 |
}, |
| 407 |
|
| 408 |
Error: function(up, err) { |
| 409 |
//document.getElementById('console').innerHTML += "\nError #" + err.code + ": " + err.message; |
| 410 |
alert("\nError #" + err.code + ": " + err.message); |
| 411 |
} |
| 412 |
} |
| 413 |
|
| 414 |
|
| 415 |
}); |
| 416 |
|
| 417 |
uploader_<?php echo $args['id']?>.init(); |
| 418 |
|
| 419 |
}); // jQuery(function($){}); |
| 420 |
|
| 421 |
function add_thumb_box(file, $filelist_DIV){ |
| 422 |
|
| 423 |
var inner_html = '<div class="u_i_c_tools_bar">'; |
| 424 |
inner_html += '<div class="u_i_c_tools_del"><a href="javascript:;" data-fileid="' + file.id+'" title="Delete"><img src="'+nm_filemanager_vars.plugin_url+'/images/delete.png" width="16" /></a></div>'; |
| 425 |
inner_html += '<div class="u_i_c_tools_edit"></div>'; |
| 426 |
inner_html += '<div class="u_i_c_tools_zoom"></div><div class="u_i_c_box_clearfix"></div>'; |
| 427 |
inner_html += '</div>'; |
| 428 |
inner_html += '<div class="u_i_c_thumb"><div class="progress_bar"><span class="progress_bar_runner"></span><span class="progress_bar_number">(' + plupload.formatSize(file.size) + ')<span></div></div>'; |
| 429 |
inner_html += '<div class="u_i_c_name"><strong>' + file.name + '</strong></div>'; |
| 430 |
|
| 431 |
jQuery( '<div />', { |
| 432 |
'id' : 'u_i_c_'+file.id, |
| 433 |
'class' : 'u_i_c_box', |
| 434 |
'html' : inner_html, |
| 435 |
|
| 436 |
}).appendTo($filelist_DIV); |
| 437 |
|
| 438 |
// clearfix |
| 439 |
// 1- removing last clearfix first |
| 440 |
$filelist_DIV.find('.u_i_c_box_clearfix').remove(); |
| 441 |
|
| 442 |
jQuery( '<div />', { |
| 443 |
'class' : 'u_i_c_box_clearfix', |
| 444 |
}).appendTo($filelist_DIV); |
| 445 |
} |
| 446 |
|
| 447 |
//--></script> |
| 448 |
<?php |
| 449 |
|
| 450 |
/*if ($args ['photo-editing'] == 'on') { |
| 451 |
|
| 452 |
|
| 453 |
echo '<script type="text/javascript" src="http://feather.aviary.com/js/feather.js"></script>'; |
| 454 |
|
| 455 |
echo '<script type="text/javascript">'; |
| 456 |
// it is setting up Aviary API |
| 457 |
echo 'if(\'' . $args ['aviary-api-key'] . '\' != \'\'){'; |
| 458 |
echo 'var featherEditor = new Aviary.Feather({'; |
| 459 |
echo 'apiKey : \'' . $args ['aviary-api-key'] . '\','; |
| 460 |
echo 'apiVersion : 3,'; |
| 461 |
echo 'theme : \'dark\','; // Check out our new 'light' and 'dark' themes! |
| 462 |
echo 'postUrl : nm_filemanager_vars.ajaxurl+\'?action=nm_filemanager_save_edited_photo\','; |
| 463 |
echo 'onSave : function(imageID, newURL) {'; |
| 464 |
echo 'var img = document.getElementById(imageID);'; |
| 465 |
echo 'img.src = newURL;'; |
| 466 |
echo 'featherEditor.close();'; |
| 467 |
echo '},'; |
| 468 |
echo 'onError : function(errorObj) {'; |
| 469 |
echo 'alert(errorObj.message);'; |
| 470 |
echo '}'; |
| 471 |
echo '});'; |
| 472 |
echo '}'; |
| 473 |
|
| 474 |
|
| 475 |
echo 'function launch_aviary_editor(id, src, file_name, editing_tools) {'; |
| 476 |
echo 'editing_tools = (editing_tools == "" && editing_tools == undefined) ? \'all\' : editing_tools;'; |
| 477 |
echo 'featherEditor.launch({'; |
| 478 |
echo 'image: id,'; |
| 479 |
echo 'url: src,'; |
| 480 |
echo 'tools: editing_tools,'; |
| 481 |
echo 'postData : {filename: file_name},'; |
| 482 |
echo '});'; |
| 483 |
echo 'return false;'; |
| 484 |
echo '}'; |
| 485 |
echo '</script>'; |
| 486 |
}*/ |
| 487 |
} |
| 488 |
} |