PluginProbe
Welcart e-Commerce / 1.3.8
Welcart e-Commerce v1.3.8
2.12.4 2.12.3 2.11.35 2.12.2 2.12.1 2.11.34 2.11.33 2.11.32 2.11.31 2.11.30 1.3.16 1.3.17 1.3.2 1.3.3 1.3.4 1.3.5 1.3.6 1.3.7 1.3.8 1.3.9 1.4.0 1.4.1 1.4.10 1.4.11 1.4.12 All 292 releases
usc-e-shop / includes / edit-form-advanced30.php

edit-form-advanced30.php in Welcart e-Commerce 1.3.8, at includes/edit-form-advanced30.php

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