| 184 | | |
|---|
| 185 | | tb_init('a.thickbox, area.thickbox, input.thickbox'); //pass where to apply thickbox |
|---|
| | 205 | |
|---|
| | 206 | |
|---|
| | 207 | // gather images and load some default JS |
|---|
| | 208 | |
|---|
| | 209 | var last = null |
|---|
| | 210 | var img, img_tag, aspect, w, h, skip, i, strtoappend = ""; |
|---|
| | 211 | var my_src = eval( |
|---|
| | 212 | jQuery.ajax({ |
|---|
| | 213 | type: "GET", |
|---|
| | 214 | url: "<?php echo clean_url($_SERVER['PHP_SELF']); ?>", |
|---|
| | 215 | cache : false, |
|---|
| | 216 | async : false, |
|---|
| | 217 | data: "ajax=photo_images&u=<?php echo urlencode($url); ?>", |
|---|
| | 218 | dataType : "script" |
|---|
| | 219 | }).responseText |
|---|
| | 220 | ); |
|---|
| | 221 | |
|---|
| | 222 | for (i = 0; i < my_src.length; i++) { |
|---|
| | 223 | img = new Image(); |
|---|
| | 224 | img.src = my_src[i]; |
|---|
| | 225 | img_attr = 'id="img' + i + '"'; |
|---|
| | 226 | skip = false; |
|---|
| | 227 | if (img.width && img.height) { |
|---|
| | 228 | if (img.width * img.height < 2500) |
|---|
| | 229 | skip = true; |
|---|
| | 230 | aspect = img.width / img.height; |
|---|
| | 231 | scale = (aspect > 1) ? (75 / img.width) : (75 / img.height); |
|---|
| 194 | | |
|---|
| 195 | | jQuery(document).ready(function() { |
|---|
| 196 | | jQuery('#this_photo').focus(); |
|---|
| 197 | | |
|---|
| 198 | | jQuery('.cancel').click(function() { |
|---|
| 199 | | tb_remove(); |
|---|
| 200 | | }); |
|---|
| 201 | | |
|---|
| 202 | | jQuery('.select').click(function() { |
|---|
| 203 | | image_selector(); |
|---|
| 204 | | }); |
|---|
| 205 | | |
|---|
| 206 | | jQuery('#photo_add_url').attr('href', '?ajax=thickbox_url&height=200&width=500'); |
|---|
| 207 | | |
|---|
| 208 | | }); |
|---|
| 209 | | |
|---|
| 210 | | |
|---|
| 211 | | function pick(img, desc) { |
|---|
| 212 | | if (img) { |
|---|
| 213 | | length = jQuery('.photolist input').length; |
|---|
| 214 | | if(length == 0) length = 1; |
|---|
| 215 | | jQuery('.photolist').append('<input name="photo_src[' + length + ']" value="' + img +'" type="hidden"/>'); |
|---|
| 216 | | jQuery('.photolist').append('<input name="photo_description[' + length + ']" value="' + desc +'" type="hidden"/>'); |
|---|
| 217 | | append_editor('<img src="' + img +'" alt="' + desc + '" />'); } |
|---|
| 218 | | tinyMCE.activeEditor.resizeToContent(); |
|---|
| 219 | | return false; |
|---|
| 220 | | } |
|---|
| 221 | | |
|---|
| 222 | | var last = null |
|---|
| 223 | | var my_src, img, img_tag, aspect, w, h, skip, i, strtoappend = ""; |
|---|
| 224 | | var my_src = eval( |
|---|
| 225 | | jQuery.ajax({ |
|---|
| 226 | | type: "GET", |
|---|
| 227 | | url: "<?php echo clean_url($_SERVER['PHP_SELF']); ?>", |
|---|
| 228 | | cache : false, |
|---|
| 229 | | async : false, |
|---|
| 230 | | data: "ajax=photo_images&u=<?php echo urlencode($url); ?>", |
|---|
| 231 | | dataType : "script" |
|---|
| 232 | | }).responseText); |
|---|
| 233 | | |
|---|
| 234 | | for (i = 0; i < my_src.length; i++) { |
|---|
| 235 | | img = new Image(); img.src = my_src[i]; img_attr = 'id="img' + i; skip = false; |
|---|
| 236 | | |
|---|
| 237 | | if (img.width && img.height) { |
|---|
| 238 | | if (img.width * img.height < 2500) |
|---|
| 239 | | skip = true; |
|---|
| 240 | | aspect = img.width / img.height; |
|---|
| 241 | | scale = (aspect > 1) ? (75 / img.width) : (75 / img.height); |
|---|
| 242 | | |
|---|
| 243 | | if (scale < 1) { |
|---|
| 244 | | w = parseInt(img.width * scale); |
|---|
| 245 | | h = parseInt(img.height * scale); |
|---|
| 246 | | } else { |
|---|
| 247 | | w = img.width; |
|---|
| 248 | | h = img.height; |
|---|
| 249 | | } |
|---|
| 250 | | img_attr += ' style="width: ' + w + 'px; height: ' + h + 'px;"'; |
|---|
| 251 | | } |
|---|
| 252 | | |
|---|
| 253 | | if (!skip) strtoappend += '<a href="?ajax=thickbox&i=' + img.src + '&u=<?php echo $url; ?>&height=400&width=500" title="" class="thickbox"><img src="' + img.src + '" ' + img_attr + '/></a>'; |
|---|
| 254 | | |
|---|
| 255 | | } |
|---|
| 256 | | jQuery('#img_container').html(strtoappend); |
|---|
| 257 | | |
|---|
| | 240 | img_attr += ' style="width: ' + w + 'px; height: ' + h + 'px;"'; |
|---|
| | 241 | } |
|---|
| | 242 | if (!skip) strtoappend += '<a href="?ajax=thickbox&i=' + img.src + '&u=<?php echo $url; ?>&height=400&width=500" title="" class="thickbox"><img src="' + img.src + '" ' + img_attr + '/></a>'; |
|---|
| | 243 | } |
|---|
| | 244 | |
|---|
| | 245 | function pick(img, desc) { |
|---|
| | 246 | if (img) { |
|---|
| | 247 | length = jQuery('.photolist input').length; |
|---|
| | 248 | if(length == 0) length = 1; |
|---|
| | 249 | jQuery('.photolist').append('<input name="photo_src[' + length + ']" value="' + img +'" type="hidden"/>'); |
|---|
| | 250 | jQuery('.photolist').append('<input name="photo_description[' + length + ']" value="' + desc +'" type="hidden"/>'); |
|---|
| | 251 | append_editor('<img src="' + img +'" alt="' + desc + '" />'); |
|---|
| | 252 | } |
|---|
| | 253 | tinyMCE.activeEditor.resizeToContent(); |
|---|
| | 254 | return false; |
|---|
| | 255 | } |
|---|
| | 256 | |
|---|
| | 257 | function image_selector() { |
|---|
| | 258 | tb_remove(); |
|---|
| | 259 | desc = jQuery('#this_photo_description').val(); |
|---|
| | 260 | src = jQuery('#this_photo').val(); |
|---|
| | 261 | pick(src, desc); |
|---|
| | 262 | return false; |
|---|
| | 263 | } |
|---|
| | 264 | |
|---|
| | 265 | jQuery(document).ready(function() { |
|---|
| | 266 | jQuery('#img_container').html(strtoappend); |
|---|
| | 267 | jQuery('#photo_add_url').attr('href', '?ajax=thickbox_url&height=200&width=500'); |
|---|
| | 268 | tb_init('a.thickbox, area.thickbox, input.thickbox'); |
|---|
| | 269 | }); |
|---|
| | 270 | |
|---|
| 463 | | <ul id="menu" class="ui-tabs-nav"> |
|---|
| 464 | | <li id="text_button" class="ui-tabs-selected"><a href="#"><?php _e('Text') ?></a></li> |
|---|
| 465 | | <li id="photo_button"><a href="#"><?php _e('Photo') ?></a></li> |
|---|
| 466 | | <li id="quote_button"><a href="#"><?php _e('Quote') ?></a></li> |
|---|
| 467 | | <li id="video_button"><a href="#"><?php _e('Video') ?></a></li> |
|---|
| 468 | | </ul> |
|---|
| 469 | | |
|---|
| 470 | | <form action="press-this.php?action=post" method="post"> |
|---|
| 471 | | |
|---|
| 472 | | <?php wp_nonce_field('press-this') ?> |
|---|
| 473 | | <input type="hidden" name="post_type" id="post_type" value="text"/> |
|---|
| 474 | | <div id="posting"> |
|---|
| 475 | | |
|---|
| 476 | | <h2 id="title"><label for="post_title"><?php _e('Title') ?></label></h2> |
|---|
| 477 | | <div class="titlewrap"> |
|---|
| 478 | | <input name="post_title" id="post_title" class="text" value="<?php echo attribute_escape($title);?>"/> |
|---|
| 479 | | </div> |
|---|
| 480 | | |
|---|
| 481 | | <div id="extra_fields" style="display: none"></div> |
|---|
| 482 | | <div class="editor_area"> |
|---|
| 483 | | <h2 id="content_type"><label for="content"><?php _e('Post') ?></label></h2> |
|---|
| 484 | | <div class="editor-container"> |
|---|
| 485 | | <textarea name="content" id="content" style="width:100%;" class="mceEditor"><?php if($selection) { ?><a href='<?php echo $url ?>'><?php echo $selection ?></a><?php } else { ?><a href='<?php echo $url ?>'><?php echo $title; ?></a><?php } ?></textarea> |
|---|
| 486 | | </div> |
|---|
| 487 | | </div> |
|---|
| 488 | | |
|---|
| 489 | | </div> |
|---|
| 490 | | <div id="categories"> |
|---|
| 491 | | <div class="submitbox" id="submitpost"> |
|---|
| 492 | | <div id="previewview"></div> |
|---|
| 493 | | <div class="inside"> |
|---|
| 494 | | <h2><?php _e('Categories') ?></h2> |
|---|
| 495 | | <div id="categories-all"> |
|---|
| 496 | | <ul id="categorychecklist" class="list:category categorychecklist form-no-clear"> |
|---|
| 497 | | <?php wp_category_checklist() ?> |
|---|
| 498 | | </ul> |
|---|
| 499 | | </div> |
|---|
| 500 | | <h2><?php _e('Tags') ?></h2> |
|---|
| 501 | | <p id="jaxtag"><label class="hidden" for="newtag"><?php _e('Tags'); ?></label><input type="text" name="tags_input" class="tags-input" id="tags-input" size="40" tabindex="3" value="<?php echo get_tags_to_edit( $post->ID ); ?>" /></p> |
|---|
| 502 | | <div id="tagchecklist"></div> |
|---|
| 503 | | </div> |
|---|
| 504 | | <label for="post_status" id="post_status"><input type="radio" name="post_status" value="publish" checked="checked" id="published" />Published <input type="radio" name="post_status" value="draft" id="unpubplished" /> Unpublished</label> |
|---|
| 505 | | |
|---|
| 506 | | <p class="submit"> |
|---|
| 507 | | <input type="submit" value="<?php _e('Publish') ?>" onclick="document.getElementById('photo_saving').style.display = '';"/> |
|---|
| 508 | | <img src="images/loading-publish.gif" alt="" id="photo_saving" style="display:none;"/> |
|---|
| 509 | | </p> |
|---|
| 510 | | </div> |
|---|
| 511 | | |
|---|
| 512 | | |
|---|
| 513 | | </form> |
|---|
| 514 | | |
|---|
| | 472 | <ul id="menu" class="ui-tabs-nav"> |
|---|
| | 473 | <li id="text_button" class="ui-tabs-selected"><a href="#"><?php _e('Text') ?></a></li> |
|---|
| | 474 | <li id="photo_button"><a href="#"><?php _e('Photo') ?></a></li> |
|---|
| | 475 | <li id="quote_button"><a href="#"><?php _e('Quote') ?></a></li> |
|---|
| | 476 | <li id="video_button"><a href="#"><?php _e('Video') ?></a></li> |
|---|
| | 477 | </ul> |
|---|
| | 478 | |
|---|
| | 479 | <form action="press-this.php?action=post" method="post"> |
|---|
| | 480 | <?php wp_nonce_field('press-this') ?> |
|---|
| | 481 | <input type="hidden" name="post_type" id="post_type" value="text"/> |
|---|
| | 482 | <div id="posting"> |
|---|
| | 483 | <h2 id="title"><label for="post_title"><?php _e('Title') ?></label></h2> |
|---|
| | 484 | <div class="titlewrap"> |
|---|
| | 485 | <input name="post_title" id="post_title" class="text" value="<?php echo attribute_escape($title);?>"/> |
|---|
| | 486 | </div> |
|---|
| | 487 | |
|---|
| | 488 | <div id="extra_fields" style="display: none"></div> |
|---|
| | 489 | |
|---|
| | 490 | <div class="editor_area"> |
|---|
| | 491 | <h2 id="content_type"><label for="content"><?php _e('Post') ?></label></h2> |
|---|
| | 492 | <div class="editor-container"> |
|---|
| | 493 | <textarea name="content" id="content" style="width:100%;" class="mceEditor"><?php if($selection) { ?><a href='<?php echo $url ?>'><?php echo $selection ?></a><?php } else { ?><a href='<?php echo $url ?>'><?php echo $title; ?></a><?php } ?></textarea> |
|---|
| | 494 | </div> |
|---|
| | 495 | </div> |
|---|
| | 496 | </div> |
|---|
| | 497 | |
|---|
| | 498 | <div id="categories"> |
|---|
| | 499 | <div class="submitbox" id="submitpost"> |
|---|
| | 500 | <div id="previewview"></div> |
|---|
| | 501 | <div class="inside"> |
|---|
| | 502 | <h2><?php _e('Categories') ?></h2> |
|---|
| | 503 | <div id="categories-all"> |
|---|
| | 504 | <ul id="categorychecklist" class="list:category categorychecklist form-no-clear"> |
|---|
| | 505 | <?php wp_category_checklist() ?> |
|---|
| | 506 | </ul> |
|---|
| | 507 | </div> |
|---|
| | 508 | <h2><?php _e('Tags') ?></h2> |
|---|
| | 509 | <p id="jaxtag"><label class="hidden" for="newtag"><?php _e('Tags'); ?></label><input type="text" name="tags_input" class="tags-input" id="tags-input" size="40" tabindex="3" value="<?php echo get_tags_to_edit( $post->ID ); ?>" /></p> |
|---|
| | 510 | <div id="tagchecklist"></div> |
|---|
| | 511 | </div> |
|---|
| | 512 | <label for="post_status" id="post_status"><input type="radio" name="post_status" value="publish" checked="checked" id="published" />Published <input type="radio" name="post_status" value="draft" id="unpubplished" /> Unpublished</label> |
|---|
| | 513 | <p class="submit"> |
|---|
| | 514 | <input type="submit" value="<?php _e('Publish') ?>" onclick="document.getElementById('photo_saving').style.display = '';"/> |
|---|
| | 515 | <img src="images/loading-publish.gif" alt="" id="photo_saving" style="display:none;"/> |
|---|
| | 516 | </p> |
|---|
| | 517 | </div> |
|---|
| | 518 | </form> |
|---|