| 1 |
<?php |
| 2 |
/** |
| 3 |
* Post advanced form for inclusion in the administration panels. |
| 4 |
* |
| 5 |
* @package WordPress |
| 6 |
* @subpackage Administration |
| 7 |
*/ |
| 8 |
// don't load directly |
| 9 |
if ( !defined('ABSPATH') ) |
| 10 |
die('-1'); |
| 11 |
|
| 12 |
global $usces; |
| 13 |
|
| 14 |
//echo $GLOBALS['hook_suffix']; |
| 15 |
//wp_enqueue_script('post'); |
| 16 |
// |
| 17 |
//if ( post_type_supports($post_type, 'editor') ) { |
| 18 |
// if ( user_can_richedit() ) |
| 19 |
// wp_enqueue_script('editor'); |
| 20 |
// wp_enqueue_script('word-count'); |
| 21 |
//} |
| 22 |
// |
| 23 |
//if ( post_type_supports($post_type, 'editor') || post_type_supports($post_type, 'thumbnail') ) { |
| 24 |
// add_thickbox(); |
| 25 |
// wp_enqueue_script('media-upload'); |
| 26 |
//} |
| 27 |
|
| 28 |
/** |
| 29 |
* Post ID global |
| 30 |
* @name $post_ID |
| 31 |
* @var int |
| 32 |
*/ |
| 33 |
$post_ID = isset($post_ID) ? (int) $post_ID : 0; |
| 34 |
$temp_ID = isset($temp_ID) ? (int) $temp_ID : 0; |
| 35 |
$user_ID = isset($user_ID) ? (int) $user_ID : 0; |
| 36 |
$action = isset($action) ? $action : ''; |
| 37 |
|
| 38 |
$messages = array(); |
| 39 |
$messages['post'] = array( |
| 40 |
0 => '', // Unused. Messages start at index 1. |
| 41 |
1 => sprintf( __('Post updated. <a href="%s">View post</a>'), esc_url( get_permalink($post_ID) ) ), |
| 42 |
2 => __('Custom field updated.'), |
| 43 |
3 => __('Custom field deleted.'), |
| 44 |
4 => __('Post updated.'), |
| 45 |
/* translators: %s: date and time of the revision */ |
| 46 |
5 => isset($_GET['revision']) ? sprintf( __('Post restored to revision from %s'), wp_post_revision_title( (int) $_GET['revision'], false ) ) : false, |
| 47 |
6 => sprintf( __('Post published. <a href="%s">View post</a>'), esc_url( get_permalink($post_ID) ) ), |
| 48 |
7 => __('Post saved.'), |
| 49 |
8 => sprintf( __('Post submitted. <a target="_blank" href="%s">Preview post</a>'), esc_url( add_query_arg( 'preview', 'true', get_permalink($post_ID) ) ) ), |
| 50 |
9 => sprintf( __('Post scheduled for: <strong>%1$s</strong>. <a target="_blank" href="%2$s">Preview post</a>'), |
| 51 |
// translators: Publish box date format, see http://php.net/date |
| 52 |
(isset($post->post_date) ? date_i18n( __( 'M j, Y @ G:i' ), strtotime( $post->post_date ) ) : ''), esc_url( get_permalink($post_ID) ) ), |
| 53 |
10 => sprintf( __('Post draft updated. <a target="_blank" href="%s">Preview post</a>'), esc_url( add_query_arg( 'preview', 'true', get_permalink($post_ID) ) ) ), |
| 54 |
); |
| 55 |
//$messages['page'] = array( |
| 56 |
// 0 => '', // Unused. Messages start at index 1. |
| 57 |
// 1 => sprintf( __('Page updated. <a href="%s">View page</a>'), esc_url( get_permalink($post_ID) ) ), |
| 58 |
// 2 => __('Custom field updated.'), |
| 59 |
// 3 => __('Custom field deleted.'), |
| 60 |
// 4 => __('Page updated.'), |
| 61 |
// 5 => isset($_GET['revision']) ? sprintf( __('Page restored to revision from %s'), wp_post_revision_title( (int) $_GET['revision'], false ) ) : false, |
| 62 |
// 6 => sprintf( __('Page published. <a href="%s">View page</a>'), esc_url( get_permalink($post_ID) ) ), |
| 63 |
// 7 => __('Page saved.'), |
| 64 |
// 8 => sprintf( __('Page submitted. <a target="_blank" href="%s">Preview page</a>'), esc_url( add_query_arg( 'preview', 'true', get_permalink($post_ID) ) ) ), |
| 65 |
// 9 => sprintf( __('Page scheduled for: <strong>%1$s</strong>. <a target="_blank" href="%2$s">Preview page</a>'), date_i18n( __( 'M j, Y @ G:i' ), strtotime( $post->post_date ) ), esc_url( get_permalink($post_ID) ) ), |
| 66 |
// 10 => sprintf( __('Page draft updated. <a target="_blank" href="%s">Preview page</a>'), esc_url( add_query_arg( 'preview', 'true', get_permalink($post_ID) ) ) ), |
| 67 |
//); |
| 68 |
// |
| 69 |
$messages = apply_filters( 'post_updated_messages', $messages ); |
| 70 |
|
| 71 |
$message = false; |
| 72 |
if ( isset($_GET['message']) ) { |
| 73 |
$_GET['message'] = absint( $_GET['message'] ); |
| 74 |
if ( isset($messages[$post_type][$_GET['message']]) ) |
| 75 |
$message = $messages[$post_type][$_GET['message']]; |
| 76 |
elseif ( !isset($messages[$post_type]) && isset($messages['post'][$_GET['message']]) ) |
| 77 |
$message = $messages['post'][$_GET['message']]; |
| 78 |
} |
| 79 |
|
| 80 |
$notice = false; |
| 81 |
$form_extra = ''; |
| 82 |
if ( isset($post->post_status) && 'auto-draft' == $post->post_status ) { |
| 83 |
if ( 'edit' == $action ) |
| 84 |
$post->post_title = ''; |
| 85 |
$autosave = false; |
| 86 |
$form_extra .= "<input type='hidden' id='auto_draft' name='auto_draft' value='1' />"; |
| 87 |
} else { |
| 88 |
$autosave = wp_get_post_autosave( $post_ID ); |
| 89 |
} |
| 90 |
|
| 91 |
$form_action = 'editpost'; |
| 92 |
$nonce_action = 'update-' . $post_type . '_' . $post_ID; |
| 93 |
$form_extra .= "<input type='hidden' id='post_ID' name='post_ID' value='" . esc_attr($post->ID) . "' />"; |
| 94 |
|
| 95 |
// Detect if there exists an autosave newer than the post and if that autosave is different than the post |
| 96 |
if ( $autosave && mysql2date( 'U', $autosave->post_modified_gmt, false ) > mysql2date( 'U', $post->post_modified_gmt, false ) ) { |
| 97 |
foreach ( _wp_post_revision_fields() as $autosave_field => $_autosave_field ) { |
| 98 |
if ( normalize_whitespace( $autosave->$autosave_field ) != normalize_whitespace( $post->$autosave_field ) ) { |
| 99 |
$notice = sprintf( __( 'There is an autosave of this post that is more recent than the version below. <a href="%s">View the autosave</a>' ), get_edit_post_link( $autosave->ID ) ); |
| 100 |
break; |
| 101 |
} |
| 102 |
} |
| 103 |
unset($autosave_field, $_autosave_field); |
| 104 |
} |
| 105 |
|
| 106 |
$post_type_object = get_post_type_object($post_type); |
| 107 |
|
| 108 |
// All meta boxes should be defined and added before the first do_meta_boxes() call (or potentially during the do_meta_boxes action). |
| 109 |
|
| 110 |
|
| 111 |
|
| 112 |
/****************************************************************************/ |
| 113 |
function post_item_pict_box($post) { |
| 114 |
global $usces, $current_screen; |
| 115 |
$item_picts = array(); |
| 116 |
$item_sumnails = array(); |
| 117 |
$post_id = isset($post->ID) ? $post->ID : 0; |
| 118 |
$item_code = get_post_meta($post_id, '_itemCode', true); |
| 119 |
|
| 120 |
if( !empty($item_code) ){ |
| 121 |
$pictid = (int)$usces->get_mainpictid($item_code); |
| 122 |
$item_picts[] = wp_get_attachment_image( $pictid, array(260, 200), true ); |
| 123 |
$item_sumnails[] = wp_get_attachment_image( $pictid, array(50, 50), true ); |
| 124 |
$item_pictids = $usces->get_pictids($item_code); |
| 125 |
for($i=0; $i<count($item_pictids); $i++){ |
| 126 |
$item_picts[] = wp_get_attachment_image( $item_pictids[$i], array(260, 200), true ); |
| 127 |
$item_sumnails[] = wp_get_attachment_image( $item_pictids[$i], array(50, 50), true ); |
| 128 |
} |
| 129 |
} |
| 130 |
?> |
| 131 |
|
| 132 |
<div class="item-main-pict"> |
| 133 |
<div id="item-select-pict"> |
| 134 |
<?php |
| 135 |
if($item_sumnails) { |
| 136 |
echo $item_picts[0]; |
| 137 |
} else { |
| 138 |
?> |
| 139 |
<!--<img src="#" width="260" height="200" alt="" />--> |
| 140 |
|
| 141 |
<?php |
| 142 |
} |
| 143 |
?> |
| 144 |
</div> |
| 145 |
<div class="clearfix"> |
| 146 |
<?php for($i=0; $i<count($item_sumnails); $i++){ ?> |
| 147 |
<div class="subpict"><a onclick='uscesItem.cahngepict("<?php echo str_replace('"', '\"', $item_picts[$i]); ?>");'><?php echo $item_sumnails[$i]; ?></a></div> |
| 148 |
<?php } ?> |
| 149 |
</div> |
| 150 |
</div> |
| 151 |
<?php |
| 152 |
} |
| 153 |
add_meta_box('item-main-pict', __('Item image', 'usces'), 'post_item_pict_box', $post_type, 'side', 'high'); |
| 154 |
|
| 155 |
|
| 156 |
do_action('add_meta_boxes', $post_type, $post); |
| 157 |
do_action('add_meta_boxes_' . $post_type, $post); |
| 158 |
|
| 159 |
do_action('do_meta_boxes', $post_type, 'normal', $post); |
| 160 |
do_action('do_meta_boxes', $post_type, 'advanced', $post); |
| 161 |
do_action('do_meta_boxes', $post_type, 'side', $post); |
| 162 |
|
| 163 |
//if ( 'post' == $post_type ) { |
| 164 |
// add_contextual_help($current_screen, |
| 165 |
// '<p>' . __('The title field and the big Post Editing Area are fixed in place, but you can reposition all the other boxes that allow you to add metadata to your post using drag and drop, and can minimize or expand them by clicking the title bar of the box. You can also hide any of the boxes by using the Screen Options tab, where you can also choose a 1- or 2-column layout for this screen.') . '</p>' . |
| 166 |
// '<p>' . __('<strong>Title</strong> - Enter a title for your post. After you enter a title, you’ll see the permalink below, which you can edit.') . '</p>' . |
| 167 |
// '<p>' . __('<strong>Post editor</strong> - Enter the text for your post. There are two modes of editing: Visual and HTML. Choose the mode by clicking on the appropriate tab. Visual mode gives you a WYSIWYG editor. Click the last icon in the row to get a second row of controls. The HTML mode allows you to enter raw HTML along with your post text. You can insert media files by clicking the icons above the post editor and following the directions.') . '</p>' . |
| 168 |
// '<p>' . __('<strong>Publish</strong> - You can set the terms of publishing your post in the Publish box. For Status, Visibility, and Publish (immediately), click on the Edit link to reveal more options. Visibility includes options for password-protecting a post or making it stay at the top of your blog indefinitely (sticky). Publish (immediately) allows you to set a future or past date and time, so you can schedule a post to be published in the future or backdate a post.') . '</p>' . |
| 169 |
// '<p>' . __('<strong>Featured Image</strong> - This allows you to associate an image with your post without inserting it. This is usually useful only if your theme makes use of the featured image as a post thumbnail on the home page, a custom header, etc.') . '</p>' . |
| 170 |
// '<p>' . __("<strong>Send Trackbacks</strong> - Trackbacks are a way to notify legacy blog systems that you've linked to them. Enter the URL(s) you want to send trackbacks. If you link to other WordPress sites they’ll be notified automatically using pingbacks, and this field is unnecessary.") . '</p>' . |
| 171 |
// '<p>' . __('<strong>Discussion</strong> - You can turn comments and pings on or off, and if there are comments on the post, you can see them here and moderate them.') . '</p>' . |
| 172 |
// '<p>' . sprintf(__('You can also create posts with the <a href="%s">Press This bookmarklet</a>.'), 'options-writing.php') . '</p>' . |
| 173 |
// '<p><strong>' . __('For more information:') . '</strong></p>' . |
| 174 |
// '<p>' . __('<a href="http://codex.wordpress.org/Writing_Posts">Writing Posts Documentation</a>') . '</p>' . |
| 175 |
// '<p>' . __('<a href="http://wordpress.org/support/">Support Forums</a>') . '</p>' |
| 176 |
// ); |
| 177 |
//} elseif ( 'page' == $post_type ) { |
| 178 |
// add_contextual_help($current_screen, '<p>' . __('Pages are similar to Posts in that they have a title, body text, and associated metadata, but they are different in that they are not part of the chronological blog stream, kind of like permanent posts. Pages are not categorized or tagged, but can have a hierarchy. You can nest Pages under other Pages by making one the "Parent" of the other, creating a group of Pages.') . '</p>' . |
| 179 |
// '<p>' . __('Creating a Page is very similar to creating a Post, and the screens can be customized in the same way using drag and drop, the Screen Options tab, and expanding/collapsing boxes as you choose. The Page editor mostly works the same Post editor, but there are some Page-specific features in the Page Attributes box:') . '</p>' . |
| 180 |
// '<p>' . __('<strong>Parent</strong> - You can arrange your pages in hierarchies. For example, you could have an “About” page that has “Life Story” and “My Dog” pages under it. There are no limits to how many levels you can nest pages.') . '</p>' . |
| 181 |
// '<p>' . __('<strong>Template</strong> - Some themes have custom templates you can use for certain pages that might have additional features or custom layouts. If so, you’ll see them in this dropdown menu.') . '</p>' . |
| 182 |
// '<p>' . __('<strong>Order</strong> - Pages are usually ordered alphabetically, but you can put a number above to change the order pages appear in.') . '</p>' . |
| 183 |
// '<p><strong>' . __('For more information:') . '</strong></p>' . |
| 184 |
// '<p>' . __('<a href="http://codex.wordpress.org/Pages_Add_New_SubPanel">Page Creation Documentation</a>') . '</p>' . |
| 185 |
// '<p>' . __('<a href="http://wordpress.org/support/">Support Forums</a>') . '</p>' |
| 186 |
// ); |
| 187 |
//} |
| 188 |
|
| 189 |
/* 30 ***************************************/ |
| 190 |
//require_once('./admin-header.php'); |
| 191 |
|
| 192 |
$status = $this->action_status; |
| 193 |
$message = $this->action_message; |
| 194 |
$this->action_status = 'none'; |
| 195 |
$this->action_message = ''; |
| 196 |
global $screen_layout_columns; |
| 197 |
|
| 198 |
?> |
| 199 |
<script type="text/javascript"> |
| 200 |
|
| 201 |
jQuery(function($){ |
| 202 |
<?php if($status == 'success'){ ?> |
| 203 |
$("#anibox").animate({ backgroundColor: "#ECFFFF" }, 2000); |
| 204 |
<?php }else if($status == 'caution'){ ?> |
| 205 |
$("#anibox").animate({ backgroundColor: "#FFF5CE" }, 2000); |
| 206 |
<?php }else if($status == 'error'){ ?> |
| 207 |
$("#anibox").animate({ backgroundColor: "#FFE6E6" }, 2000); |
| 208 |
<?php } ?> |
| 209 |
}); |
| 210 |
</script> |
| 211 |
|
| 212 |
<div class="wrap"> |
| 213 |
<div class="usces_admin"> |
| 214 |
<?php //screen_icon(); ?> |
| 215 |
<h2><!--<img src="<?php echo get_option('siteurl'); ?>/wp-content/plugins/usc-e-shop/images/easymoblog1.png" /> --><?php echo esc_html( $title ); ?></h2> |
| 216 |
<div id="aniboxStatus" class="<?php echo $status; ?>"> |
| 217 |
<div id="anibox" class="clearfix"> |
| 218 |
<img src="<?php echo USCES_PLUGIN_URL; ?>/images/list_message_<?php echo $status; ?>.gif" /> |
| 219 |
<div class="mes" id="info_massage"><?php echo $message; ?></div> |
| 220 |
</div> |
| 221 |
</div> |
| 222 |
<form name="post" action="" method="post" id="post"> |
| 223 |
<?php |
| 224 |
|
| 225 |
//if ( 0 == $post_ID) |
| 226 |
// wp_nonce_field('add-post'); |
| 227 |
//else |
| 228 |
// wp_nonce_field('update-post_' . $post_ID); |
| 229 |
$itemCode = get_post_meta($post_ID, '_itemCode', true); |
| 230 |
$itemName = get_post_meta($post_ID, '_itemName', true); |
| 231 |
$itemRestriction = get_post_meta($post_ID, '_itemRestriction', true); |
| 232 |
$itemPointrate = get_post_meta($post_ID, '_itemPointrate', true); |
| 233 |
$itemGpNum1 = get_post_meta($post_ID, '_itemGpNum1', true); |
| 234 |
$itemGpNum2 = get_post_meta($post_ID, '_itemGpNum2', true); |
| 235 |
$itemGpNum3 = get_post_meta($post_ID, '_itemGpNum3', true); |
| 236 |
$itemGpDis1 = get_post_meta($post_ID, '_itemGpDis1', true); |
| 237 |
$itemGpDis2 = get_post_meta($post_ID, '_itemGpDis2', true); |
| 238 |
$itemGpDis3 = get_post_meta($post_ID, '_itemGpDis3', true); |
| 239 |
|
| 240 |
$itemShipping = get_post_meta($post_ID, '_itemShipping', true); |
| 241 |
$itemDeliveryMethod = get_post_meta($post_ID, '_itemDeliveryMethod', true); |
| 242 |
$itemShippingCharge = get_post_meta($post_ID, '_itemShippingCharge', true); |
| 243 |
$itemIndividualSCharge = get_post_meta($post_ID, '_itemIndividualSCharge', true); |
| 244 |
/*************************************** 30 */ |
| 245 |
?> |
| 246 |
|
| 247 |
<?php wp_nonce_field($nonce_action); ?> |
| 248 |
<input type="hidden" name="usces_nonce" id="usces_nonce" value="<?php echo wp_create_nonce( 'usc-e-shop' ); ?>" /> |
| 249 |
<input type="hidden" id="user-id" name="user_ID" value="<?php echo (int) $user_ID ?>" /> |
| 250 |
<input type="hidden" id="hiddenaction" name="action" value="<?php echo esc_attr($form_action) ?>" /> |
| 251 |
<input type="hidden" id="originalaction" name="originalaction" value="<?php echo esc_attr($form_action) ?>" /> |
| 252 |
<input type="hidden" id="post_author" name="post_author" value="<?php echo esc_attr( $post->post_author ); ?>" /> |
| 253 |
<input type="hidden" id="post_type" name="post_type" value="<?php echo esc_attr($post_type) ?>" /> |
| 254 |
<input type="hidden" id="original_post_status" name="original_post_status" value="<?php echo esc_attr($post->post_status) ?>" /> |
| 255 |
<input type="hidden" id="referredby" name="referredby" value="<?php echo esc_url(stripslashes(wp_get_referer())); ?>" /> |
| 256 |
|
| 257 |
<input type="hidden" name="post_mime_type" value="item" /> |
| 258 |
<input type="hidden" name="page" value="usces_itemedit" /> |
| 259 |
<input name="usces_referer" type="hidden" id="usces_referer" value="<?php if(isset($_REQUEST['usces_referer'])) echo $_REQUEST['usces_referer']; ?>" /> |
| 260 |
|
| 261 |
<?php |
| 262 |
if ( isset($post->post_status) && 'draft' != $post->post_status ) |
| 263 |
wp_original_referer_field(true, 'previous'); |
| 264 |
|
| 265 |
echo $form_extra; |
| 266 |
|
| 267 |
wp_nonce_field( 'autosave', 'autosavenonce', false ); |
| 268 |
wp_nonce_field( 'meta-box-order', 'meta-box-order-nonce', false ); |
| 269 |
wp_nonce_field( 'closedpostboxes', 'closedpostboxesnonce', false ); |
| 270 |
?> |
| 271 |
|
| 272 |
<div id="refbutton"><a href="<?php echo USCES_ADMIN_URL . '?page=usces_itemedit&action=duplicate&post='.$post->ID.'&usces_referer='.(isset($_REQUEST['usces_referer']) ? urlencode($_REQUEST['usces_referer']) : ''); ?>">[<?php _e('make a copy', 'usces'); ?>]</a> <a href="<?php if(isset($_REQUEST['usces_referer'])) echo $_REQUEST['usces_referer']; ?>">[<?php _e('back to item list', 'usces'); ?>]</a></div> |
| 273 |
<!--<div id="poststuff" class="metabox-holder has-right-sidebar">--> |
| 274 |
<div id="poststuff"> |
| 275 |
<div id="post-body" class="metabox-holder columns-<?php echo 1 == get_current_screen()->get_columns() ? '1' : '2'; ?>"> |
| 276 |
<div id="post-body-content"> |
| 277 |
|
| 278 |
|
| 279 |
|
| 280 |
|
| 281 |
<!--<div id="postitemcustomstuff">--> |
| 282 |
<div id="meta_box_product_first_box" class="postbox " > |
| 283 |
<div class="inside"> |
| 284 |
<table class="iteminfo_table"> |
| 285 |
<tr> |
| 286 |
<th><?php _e('item code', 'usces'); ?></th> |
| 287 |
<td><input type="text" name="itemCode" id="itemCode" class="itemCode" value="<?php echo esc_attr($itemCode); ?>" /> |
| 288 |
<input type="hidden" name="itemCode_nonce" id="itemCode_nonce" value="<?php echo wp_create_nonce( 'itemCode_nonce' ); ?>" /></td> |
| 289 |
</tr> |
| 290 |
<tr> |
| 291 |
<th><?php _e('item name', 'usces'); ?></th> |
| 292 |
<td><input type="text" name="itemName" id="itemName" class="itemName" value="<?php echo esc_attr($itemName); ?>" /> |
| 293 |
<input type="hidden" name="itemName_nonce" id="itemName_nonce" value="<?php echo wp_create_nonce( 'itemName_nonce' ); ?>" /></td> |
| 294 |
</tr> |
| 295 |
<tr> |
| 296 |
<th><?php _e('Limited amount for purchase', 'usces'); ?></th> |
| 297 |
<td><?php printf(__('limit by%s%s%s', 'usces'), '<input type="text" name="itemRestriction" id="itemRestriction" class="itemRestriction" value="', esc_attr($itemRestriction), '" />'); ?> |
| 298 |
<input type="hidden" name="itemRestriction_nonce" id="itemRestriction_nonce" value="<?php echo wp_create_nonce( 'itemRestriction_nonce' ); ?>" /></td> |
| 299 |
</tr> |
| 300 |
<tr> |
| 301 |
<th><?php _e('Percentage of points', 'usces'); ?></th> |
| 302 |
<td><input type="text" name="itemPointrate" id="itemPointrate" class="itemPointrate" value="<?php echo esc_attr($itemPointrate); ?>" />%<em>(<?php _e('Integer', 'usces'); ?>)</em> |
| 303 |
<input type="hidden" name="itemPointrate_nonce" id="itemPointrate_nonce" value="<?php echo wp_create_nonce( 'itemPointrate_nonce' ); ?>" /></td> |
| 304 |
</tr> |
| 305 |
<tr> |
| 306 |
<?php |
| 307 |
$gp_row = '<th rowspan="3">' . __('Business package discount', 'usces') . '</th> |
| 308 |
<td>1.' . sprintf(__('in more than%s%s%s%s%s %s%s%s,', 'usces'), '<input type="text" name="', 'itemGpNum1', '" id="', 'itemGpNum1', '" class="itemPointrate"', 'value="', esc_attr($itemGpNum1), '" />') . '<input type="text" name="itemGpDis1" id="itemGpDis1" class="itemPointrate" value="' . esc_attr($itemGpDis1) . '" />' . __('%discount','usces') . '(' . __('Unit price','usces') . ')</td> |
| 309 |
</tr> |
| 310 |
<tr> |
| 311 |
<td>2.' . sprintf(__('in more than%s%s%s%s%s %s%s%s,', 'usces'), '<input type="text" name="', 'itemGpNum2', '" id="', 'itemGpNum2', '" class="itemPointrate"', 'value="', esc_attr($itemGpNum2), '" />') . '<input type="text" name="itemGpDis2" id="itemGpDis2" class="itemPointrate" value="' . esc_attr($itemGpDis2) . '" />' . __('%discount','usces') . '(' . __('Unit price','usces') . ')</td> |
| 312 |
</tr> |
| 313 |
<tr> |
| 314 |
<td>3.' . sprintf(__('in more than%s%s%s%s%s %s%s%s,', 'usces'), '<input type="text" name="', 'itemGpNum3', '" id="', 'itemGpNum3', '" class="itemPointrate"', 'value="', esc_attr($itemGpNum3), '" />') . '<input type="text" name="itemGpDis3" id="itemGpDis3" class="itemPointrate" value="' . esc_attr($itemGpDis3) . '" />' . __('%discount','usces') . '(' . __('Unit price','usces') . ')</td> |
| 315 |
</tr>'; |
| 316 |
?> |
| 317 |
<?php echo apply_filters('usces_item_master_gp_row', $gp_row, $post_ID); ?> |
| 318 |
<?php apply_filters('usces_item_master_first_section', NULL, $post_ID); ?> |
| 319 |
</table> |
| 320 |
</div> |
| 321 |
</div> |
| 322 |
<?php do_action('usces_after_item_master_first_section', $post_ID); ?> |
| 323 |
<!--<div id="postitemcustomstuff">--> |
| 324 |
<div id="meta_box_product_second_box" class="postbox " > |
| 325 |
<div class="inside"> |
| 326 |
<table class="iteminfo_table"> |
| 327 |
<?php |
| 328 |
$second_section = '<tr class="shipped"> |
| 329 |
<th>' . __('estimated shipping date', 'usces') . '</th> |
| 330 |
<td><select name="itemShipping" id="itemShipping" class="itemShipping">'; |
| 331 |
foreach( (array)$this->shipping_rule as $key => $label){ |
| 332 |
$selected = $key == $itemShipping ? ' selected="selected"' : ''; |
| 333 |
$second_section .= '<option value="' . esc_attr($key) . '"' . $selected . '>' . esc_html($label) . '</option>'; |
| 334 |
} |
| 335 |
$second_section .= '</select> |
| 336 |
<input type="hidden" name="itemShipping_nonce" id="itemShipping_nonce" value="' . wp_create_nonce( 'itemShipping_nonce' ) . '" /></td> |
| 337 |
</tr> |
| 338 |
<tr class="shipped"> |
| 339 |
<th>' . __('shipping option','usces') . '</th> |
| 340 |
<td>'; |
| 341 |
$delivery_methods = $this->options['delivery_method']; |
| 342 |
if( count($delivery_methods) === 0 ){ |
| 343 |
$second_section .= __('* Please register an item, after you finished delivery setting!','usces'); |
| 344 |
}else{ |
| 345 |
foreach( $delivery_methods as $deli){ |
| 346 |
$second_section .= '<label for="itemDeliveryMethod[' . $deli['id'] . ']"><input name="itemDeliveryMethod[' . $deli['id'] . ']" id="itemDeliveryMethod[' . $deli['id'] . ']" type="checkbox" value="' . esc_attr($deli['id']) . '"'; |
| 347 |
if(in_array($deli['id'], (array)$itemDeliveryMethod)) { |
| 348 |
$second_section .= ' checked="checked"'; |
| 349 |
} |
| 350 |
$second_section .= ' />' . esc_html($deli['name']) . '</label>'; |
| 351 |
} |
| 352 |
} |
| 353 |
$second_section .= '</td> |
| 354 |
</tr> |
| 355 |
<tr class="shipped"> |
| 356 |
<th>' . __('Shipping', 'usces') . '</th> |
| 357 |
<td><select name="itemShippingCharge" id="itemShippingCharge" class="itemShippingCharge">'; |
| 358 |
foreach( $this->options['shipping_charge'] as $cahrge){ |
| 359 |
$selected = $cahrge['id'] == $itemShippingCharge ? ' selected="selected"' : ''; |
| 360 |
$second_section .= '<option value="' . $cahrge['id'] . '"' . $selected . '>' . esc_html($cahrge['name']) . '</option>'; |
| 361 |
} |
| 362 |
$second_section .= '</select> |
| 363 |
<input type="hidden" name="itemShippingCharge_nonce" id="itemShippingCharge_nonce" value="' . wp_create_nonce( 'itemShippingCharge_nonce' ) . '" /></td> |
| 364 |
</tr> |
| 365 |
<tr class="shipped"> |
| 366 |
<th>' . __('Postage individual charging', 'usces') . '</th> |
| 367 |
<td><input name="itemIndividualSCharge" id="itemIndividualSCharge" type="checkbox" value="1"'; |
| 368 |
if($itemIndividualSCharge){ |
| 369 |
$second_section .= ' checked="checked"'; |
| 370 |
} |
| 371 |
$second_section .= ' /></td> |
| 372 |
</tr>'; |
| 373 |
$second_section = apply_filters('usces_item_master_second_section', $second_section, $post_ID); |
| 374 |
echo $second_section; |
| 375 |
?> |
| 376 |
</table> |
| 377 |
</div> |
| 378 |
</div> |
| 379 |
<?php do_action('usces_after_item_master_second_section', $post_ID); ?> |
| 380 |
|
| 381 |
<div id="itemsku" class="postbox"> |
| 382 |
<h3 class="hndle"><span>SKU <?php _e('Price', 'usces'); ?></span></h3> |
| 383 |
<div class="inside"> |
| 384 |
<div id="postskucustomstuff" class="skustuff"> |
| 385 |
<?php |
| 386 |
//$metadata = has_item_sku_meta($post->ID); |
| 387 |
//list_item_sku_meta($metadata); |
| 388 |
//item_sku_meta_form(); |
| 389 |
$skus = $usces->get_skus($post->ID); |
| 390 |
list_item_sku_meta($skus); |
| 391 |
item_sku_meta_form(); |
| 392 |
|
| 393 |
?> |
| 394 |
</div> |
| 395 |
</div> |
| 396 |
</div> |
| 397 |
<?php do_action('usces_after_item_master_sku_section', $post_ID); ?> |
| 398 |
<div id="itemoption" class="postbox"> |
| 399 |
<h3 class="hndle"><span><?php _e('options for items', 'usces'); ?></span></h3> |
| 400 |
<div class="inside"> |
| 401 |
<div id="postoptcustomstuff"><div id="optajax-response"></div> |
| 402 |
<?php |
| 403 |
//$metadata = has_item_option_meta($post->ID); |
| 404 |
//list_item_option_meta($metadata); |
| 405 |
//item_option_meta_form(); |
| 406 |
$opts = usces_get_opts($post->ID); |
| 407 |
list_item_option_meta($opts); |
| 408 |
item_option_meta_form(); |
| 409 |
?> |
| 410 |
</div> |
| 411 |
</div> |
| 412 |
</div> |
| 413 |
<?php do_action('usces_after_item_master_option_section', $post_ID); ?> |
| 414 |
|
| 415 |
<div class="postbox"> |
| 416 |
<?php if ( post_type_supports($post_type, 'title') ) { ?> |
| 417 |
<div class="inside"> |
| 418 |
<div class="itempagetitle"><?php _e("The product details page title", "usces"); ?></div> |
| 419 |
<div id="titlediv"> |
| 420 |
<div id="titlewrap"> |
| 421 |
<label class="hide-if-no-js" style="visibility:hidden" id="title-prompt-text" for="title"><?php _e('Enter title here') ?></label> |
| 422 |
<input type="text" name="post_title" size="30" tabindex="1" value="<?php echo esc_attr( htmlspecialchars( $post->post_title ) ); ?>" id="title" autocomplete="off" /> |
| 423 |
</div> |
| 424 |
<?php |
| 425 |
$sample_permalink_html = get_sample_permalink_html($post->ID); |
| 426 |
$shortlink = wp_get_shortlink($post->ID, 'post'); |
| 427 |
if ( !empty($shortlink) ) |
| 428 |
$sample_permalink_html .= '<input id="shortlink" type="hidden" value="' . esc_attr($shortlink) . '" /><a href="#" class="button" onclick="prompt('URL:', jQuery(\'#shortlink\').val()); return false;">' . __('Get Shortlink') . '</a>'; |
| 429 |
|
| 430 |
if ( !( 'pending' == $post->post_status && !current_user_can( $post_type_object->cap->publish_posts ) ) ) { ?> |
| 431 |
<div id="edit-slug-box"> |
| 432 |
<?php |
| 433 |
if ( ! empty($post->ID) && ! empty($sample_permalink_html) && 'auto-draft' != $post->post_status ) |
| 434 |
echo $sample_permalink_html; |
| 435 |
?> |
| 436 |
</div> |
| 437 |
<?php |
| 438 |
} |
| 439 |
?> |
| 440 |
</div> |
| 441 |
<?php |
| 442 |
wp_nonce_field( 'samplepermalink', 'samplepermalinknonce', false ); |
| 443 |
?> |
| 444 |
<?php } ?> |
| 445 |
<?php if ( post_type_supports($post_type, 'editor') ) { ?> |
| 446 |
<div class="itempagetitle"><?php _e("Full product details", "usces"); ?></div> |
| 447 |
<div id="<?php echo user_can_richedit() ? 'postdivrich' : 'postdiv'; ?>" class="postarea"> |
| 448 |
|
| 449 |
<style type="text/css"> |
| 450 |
<!-- |
| 451 |
.wp_themeSkin table td { |
| 452 |
background-color: white; |
| 453 |
} |
| 454 |
--> |
| 455 |
</style> |
| 456 |
<?php |
| 457 |
if ( version_compare($wp_version, '3.3-beta', '>') ){ |
| 458 |
wp_editor($post->post_content, 'content', array('dfw' => true, 'tabindex' => 1) ); |
| 459 |
}else{ |
| 460 |
the_editor($post->post_content); |
| 461 |
} |
| 462 |
?> |
| 463 |
|
| 464 |
<table id="post-status-info" cellspacing="0"><tbody><tr> |
| 465 |
<td id="wp-word-count"></td> |
| 466 |
<td class="autosave-info"> |
| 467 |
<span id="autosave"> </span> |
| 468 |
<?php |
| 469 |
if ( 'auto-draft' != $post->post_status ) { |
| 470 |
echo '<span id="last-edit">'; |
| 471 |
if ( $last_id = get_post_meta($post_ID, '_edit_last', true) ) { |
| 472 |
$last_user = get_userdata($last_id); |
| 473 |
printf(__('Last edited by %1$s on %2$s at %3$s'), esc_html( $last_user->display_name ), mysql2date(get_option('date_format'), $post->post_modified), mysql2date(get_option('time_format'), $post->post_modified)); |
| 474 |
} else { |
| 475 |
if( isset($post->post_modified) ) |
| 476 |
printf(__('Last edited on %1$s at %2$s'), mysql2date(get_option('date_format'), $post->post_modified), mysql2date(get_option('time_format'), $post->post_modified)); |
| 477 |
} |
| 478 |
echo '</span>'; |
| 479 |
} ?> |
| 480 |
</td> |
| 481 |
</tr></tbody></table> |
| 482 |
|
| 483 |
</div> |
| 484 |
|
| 485 |
<?php |
| 486 |
} |
| 487 |
?> |
| 488 |
</div> |
| 489 |
</div> |
| 490 |
|
| 491 |
<?php |
| 492 |
//do_meta_boxes($post_type, 'normal', $post); |
| 493 |
// |
| 494 |
//( 'page' == $post_type ) ? do_action('edit_page_form') : do_action('edit_form_advanced'); |
| 495 |
// |
| 496 |
//do_meta_boxes($post_type, 'advanced', $post); |
| 497 |
// |
| 498 |
//do_action('dbx_post_sidebar'); ?> |
| 499 |
|
| 500 |
</div> |
| 501 |
|
| 502 |
|
| 503 |
|
| 504 |
|
| 505 |
|
| 506 |
|
| 507 |
|
| 508 |
|
| 509 |
|
| 510 |
|
| 511 |
<div id="postbox-container-1" class="postbox-container"> |
| 512 |
<div id="side-info-column" class="inner-sidebar"> |
| 513 |
<div id="item-main-pict"></div> |
| 514 |
</div> |
| 515 |
|
| 516 |
<?php |
| 517 |
|
| 518 |
if ( 'page' == $post_type ) |
| 519 |
do_action('submitpage_box'); |
| 520 |
else |
| 521 |
do_action('submitpost_box'); |
| 522 |
|
| 523 |
do_meta_boxes($post_type, 'side', $post); |
| 524 |
|
| 525 |
?> |
| 526 |
</div> |
| 527 |
<div id="postbox-container-2" class="postbox-container"> |
| 528 |
<?php |
| 529 |
|
| 530 |
do_meta_boxes(null, 'normal', $post); |
| 531 |
|
| 532 |
if ( 'page' == $post_type ) |
| 533 |
do_action('edit_page_form'); |
| 534 |
else |
| 535 |
do_action('edit_form_advanced'); |
| 536 |
|
| 537 |
do_meta_boxes(null, 'advanced', $post); |
| 538 |
|
| 539 |
?> |
| 540 |
</div> |
| 541 |
<?php |
| 542 |
|
| 543 |
do_action('dbx_post_sidebar'); |
| 544 |
|
| 545 |
?> |
| 546 |
|
| 547 |
</div> |
| 548 |
|
| 549 |
<br class="clear" /> |
| 550 |
</div><!-- /poststuff --> |
| 551 |
</form> |
| 552 |
</div> |
| 553 |
|
| 554 |
<?php wp_comment_reply(); ?> |
| 555 |
|
| 556 |
<?php if ((isset($post->post_title) && '' == $post->post_title) || (isset($_GET['message']) && 2 > $_GET['message'])) : ?> |
| 557 |
<script type="text/javascript"> |
| 558 |
try{document.post.itemCode.focus();}catch(e){} |
| 559 |
try{ |
| 560 |
var dfo = document.post; |
| 561 |
if(dfo.itemRestriction.value == '') dfo.itemRestriction.value = uscesL10n.purchase_limit; |
| 562 |
if(dfo.itemPointrate.value == '') dfo.itemPointrate.value = uscesL10n.point_rate; |
| 563 |
if(dfo.itemShipping.selectedIndex == '0') dfo.itemShipping.selectedIndex = uscesL10n.shipping_rule; |
| 564 |
}catch(e){} |
| 565 |
|
| 566 |
jQuery(document).ready(function($){ |
| 567 |
$("#in-category-"+<?php echo USCES_ITEM_CAT_PARENT_ID; ?>).attr({checked: "checked"}); |
| 568 |
|
| 569 |
// $('#itemCode').blur( |
| 570 |
// function() { |
| 571 |
// if ( $("#itemCode").val().length == 0 ) return; |
| 572 |
// uscesItem.newdraft($('#itemCode').val()); |
| 573 |
// }); |
| 574 |
}); |
| 575 |
</script> |
| 576 |
<?php endif; ?> |
| 577 |
|