forked from hunk/Magic-Fields
-
Notifications
You must be signed in to change notification settings - Fork 0
/
RCCWP_CustomWritePanelPage.php
571 lines (502 loc) · 22.9 KB
/
RCCWP_CustomWritePanelPage.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
<?php
include_once('RCCWP_CustomWritePanel.php');
class RCCWP_CustomWritePanelPage
{
public static function Content($customWritePanel = null)
{
// add the new expanded column, if it's not there already (Traversal)
RCCWP_Application::AddColumnIfNotExist(MF_TABLE_PANELS, "expanded", $column_attr = "tinyint NOT NULL DEFAULT 1 after type" );
global $mf_domain,$wpdb;
$customWritePanelName = "";
$customWritePanelDescription = "";
$customWritePanelExpanded = 1;
$write_panel_category_ids = array();
$defaultTagChecked = 'checked="checked"';
$customWritePanelAllFieldIds = NULL;
$customThemePage = NULL;
$showPost = true;
$customParentPage = NULL;
$customWritePanelCategoryIds = NULL;
if ($customWritePanel != null)
{
$customWritePanelName = $customWritePanel->name;
$customWritePanelDescription = $customWritePanel->description;
$customWritePanelExpanded = $customWritePanel->expanded;
$customWritePanelDisplayOrder = $customWritePanel->display_order;
$customWritePanelType = $customWritePanel->type;
if ($customWritePanelType == 'page') $showPost = false;
$customWritePanelCategoryIds = RCCWP_CustomWritePanel::GetAssignedCategoryIds($customWritePanel->id);
foreach($customWritePanelCategoryIds as $key => $c ){
if((int)$c != 0){
$tc = get_category($c);
$customWritePanelCategoryIds[$key] = $tc->slug;
}
}
$customWritePanelStandardFieldIds = RCCWP_CustomWritePanel::GetStandardFields($customWritePanel->id);
$customWritePanelAllFieldIds = RCCWP_CustomWritePanel::Get($customWritePanel->id);
if ($customWritePanelType == 'page'){
$customThemePage = RCCWP_CustomWritePanel::GetThemePage($customWritePanel->name);
$customParentPage = RCCWP_CustomWritePanel::GetParentPage($customWritePanel->name);
}
$defaultTagChecked = '';
?>
<input type="hidden" name="custom-write-panel-id" value="<?php echo $customWritePanel->id?>" />
<?php
}
?>
<table class="form-table" width="100%" border="0" cellspacing="0" cellpadding="6">
<tbody>
<tr valign="top">
<th scope="row"><?php _e('Placement', $mf_domain); ?></th>
<td>
<!-- START :: Javascript for Image/Photo' Css Class -->
<script type="text/javascript" language="javascript">
jQuery(document).ready( function() {
<?php if ($showPost){ ?>
showHide("mf_forpost", "mf_forpage");
<?php } else { ?>
showHide("mf_forpage", "mf_forpost");
<?php } ?>
});
function showHide(showClassID, hideClassID)
{
jQuery( function($) {
$("."+showClassID).css("display","");
$("."+hideClassID).css("display","none");
});
}
</script>
<!-- END :: Javascript for Image/Photo' Css Class -->
<input type="radio" name="radPostPage" id="radPostPage" value="post" <?php if(empty($custoWritePanelType) || $customWritePanelType == 'post'){?> checked="checked" <?php } ?> onclick='showHide("mf_forpost", "mf_forpage");' /> <strong><?php _e('Post', $mf_domain); ?> </strong>
<input type="radio" name="radPostPage" id="radPostPage" value="page" <?php if(!empty($customWritePanelType) && $customWritePanelType == 'page'){?> checked="checked" <?php } ?> onclick='showHide("mf_forpage", "mf_forpost");' /> <strong><?php _e('Page', $mf_domain); ?></strong>
</td>
</tr>
<tr valign="top">
<th scope="row" align="right"><?php _e('Name', $mf_domain); ?>:</th>
<td>
<input name="custom-write-panel-name" id="custom-write-panel-name" size="40" type="text" value="<?php echo $customWritePanelName?>" />
</td>
</tr>
<tr valign="top" id="catText" class="mf_forpost">
<th scope="row" align="right"><div id="catLabel" style="display:inline;"><?php _e('Assigned Categories', $mf_domain); ?>:</div></th>
<td>
<?php
$cats = get_categories( "get=all" );
RCCWP_CustomWritePanelPage::PrintNestedCats( $cats, 0, 0, $customWritePanelCategoryIds );
?>
</td>
</tr>
<tr valign="top" id="catText" class="mf_forpage">
<th scope="row" align="right"><div id="catLabel" style="display:inline;"><?php _e('Assigned Theme', $mf_domain); ?>:</div></th>
<td>
<select name="page_template" id="page_template">
<option value='default'><?php _e('Default Template'); ?></option>
<?php $themes_defaults = get_page_templates();
$theme_select=NULL;
foreach($themes_defaults as $v => $k) {
$theme_select=NULL;
if ($customWritePanelType == 'page'){
if($customThemePage == $k){ $theme_select='SELECTED';}
}?>
<option value='<?php echo $k?>' <?php echo $theme_select; ?> ><?php echo $v?></option>
<?php } ?>
<?php ?>
</select>
</td>
</tr>
<tr valign="top" id="catText" class="mf_forpage">
<th scope="row" align="right"><div id="catLabel" style="display:inline;"><?php _e('Page Parent', $mf_domain); ?>:</div></th>
<td>
<?php
wp_dropdown_pages(array('selected' => $customParentPage, 'name' => 'parent_id', 'show_option_none' => __('Main Page (no parent)'), 'sort_column'=> 'menu_order, post_title','option_none_value' => -1)); ?>
</td>
</tr>
<tr>
<th><?php _e('Quantity',$mf_domain);?></th>
<td>
<?php
if(isset($customWritePanel->id) && !empty($customWritePanel->id))
{
if ($customWritePanelAllFieldIds->single == 0)
{
$multiple_checked='checked="checked"';
$single_checked='';
}else{
$single_checked='checked="checked"';
$multiple_checked='';
}
}else{
$multiple_checked='checked="checked"';
$single_checked='';
}
?>
<input type="radio" name="single" id="radPostPage" value="1" <?php echo $single_checked?> /> <strong><?php _e('Single', $mf_domain); ?> </strong>
<input type="radio" name="single" id="radPostPage" value="0" <?php echo $multiple_checked?> /> <strong><?php _e('Multiple', $mf_domain); ?></strong>
</td>
</tr>
<tr valign="top">
<th scope="row" align="right"><?php _e('Standard Fields', $mf_domain); ?>:</th>
<td>
<?php
global $STANDARD_FIELDS, $wp_version;
foreach ($STANDARD_FIELDS as $field) :
if ($field->excludeVersion <= substr($wp_version, 0, 3)) continue;
if ($field->isAdvancedField) continue;
$checked = "";
$classes = "";
if ($customWritePanel != null)
{
if (in_array($field->id, $customWritePanelStandardFieldIds))
{
$checked = "checked=\"checked\"";
}
}
else
{
if ($field->defaultChecked)
{
$checked = "checked=\"checked\"";
}
}
if ($field->forPost && !$field->forPage) $classes = $classes . " mf_forpost";
if ($field->forPage && !$field->forPost) $classes = $classes . " mf_forpage";
?>
<div class="<?php echo $classes?>">
<input type="checkbox" name="custom-write-panel-standard-fields[]" value="<?php echo $field->id?>" <?php echo $checked?> />
<?php echo $field->displayName?>
<br />
</div>
<?php
endforeach;
?>
</td>
</tr>
<tr valign="top">
<th scope="row" align="right"><?php _e('Advanced Fields', $mf_domain); ?>:</th>
<td>
<?php
global $STANDARD_FIELDS, $wp_version;
foreach ($STANDARD_FIELDS as $field) :
if ($field->excludeVersion <= substr($wp_version, 0, 3)) continue;
if (!$field->isAdvancedField) continue;
$checked = "";
$classes = "";
if ($customWritePanel != null)
{
if (in_array($field->id, $customWritePanelStandardFieldIds))
{
$checked = "checked=\"checked\"";
}
}
else
{
if ($field->defaultChecked)
{
$checked = "checked=\"checked\"";
}
}
if ($field->forPost && !$field->forPage) $classes = $classes . " mf_forpost";
if ($field->forPage && !$field->forPost) $classes = $classes . " mf_forpage";
?>
<div class="<?php echo $classes?>">
<input type="checkbox" name="custom-write-panel-standard-fields[]" value="<?php echo $field->id?>" <?php echo $checked?> />
<?php echo $field->displayName?>
<br />
</div>
<?php
endforeach;
?>
</td>
</tr>
<tr valign="top">
<th scope="row" align="right"><?php _e('Order', $mf_domain); ?>:</th>
<?php
if(empty($customWritePanelDisplayOrder)){
$customWritePanelDisplayOrder = "";
}
?>
<td><input name="custom-write-panel-order" id="custom-write-panel-order" size="2" type="text" value="<?php echo $customWritePanelDisplayOrder?>" /></td>
</tr>
<tr>
<th scope="row" align="right"><?php _e('Top Level Fields Expanded', $mf_domain); ?>:</th>
<td><input name="custom-write-panel-expanded" id="custom-write-panel-expanded" type="checkbox" value="1" <?php echo $customWritePanelExpanded == 0 ? '': ' checked="checked" ' ?> /> <?php _e('Display the full expanded group editing interface instead of the summary for fields created at the top level (fields not inside a group)', $mf_domain); ?>
<br /><small><?php _e('Note: the group can still be collapsed by the user, this just determines the default state on load')?></td>
</tr>
</tbody>
</table>
<?php
}
public static function PrintNestedCats( $cats, $parent = 0, $depth = 0, $customWritePanelCategoryIds ) {
foreach ($cats as $cat) :
if( $cat->parent == $parent ) {
$checked = "";
if (@in_array($cat->slug, $customWritePanelCategoryIds))
{
$checked = "checked=\"checked\"";
}
echo str_repeat(' ', $depth * 4);
?> <input type="checkbox" name="custom-write-panel-categories[]" value="<?php echo $cat->slug?>" <?php echo $checked?> /> <?php echo $cat->cat_name ?> <br/>
<?php
RCCWP_CustomWritePanelPage::PrintNestedCats( $cats, $cat->term_id, $depth+1, $customWritePanelCategoryIds );
}
endforeach;
}
public static function Edit()
{
global $mf_domain;
$customWritePanel = RCCWP_CustomWritePanel::Get((int)$_REQUEST['custom-write-panel-id']);
?>
<div class="wrap">
<h2><?php _e('Edit', $mf_domain); ?> <?php echo $customWritePanel->name ?> <?php _e('Write Panel', $mf_domain); ?></h2>
<form action="<?php echo RCCWP_ManagementPage::GetCustomWritePanelGenericUrl('submit-edit-custom-write-panel')?>" method="post" id="submit-edit-custom-write-panel">
<?php wp_nonce_field('submit-edit-custom-write-panel'); ?>
<?php
RCCWP_CustomWritePanelPage::Content($customWritePanel);
?>
<p class="submit" >
<a style="color:black" href="<?php echo RCCWP_ManagementPage::GetCustomWritePanelGenericUrl('cancel-edit-custom-write-panel')?>" class="button"><?php _e('Cancel', $mf_domain); ?></a>
<input type="submit" id="submit-edit-custom-write-panel" value="<?php _e('Update', $mf_domain); ?>" />
</p>
</form>
</div>
<?php
}
function GetAssignedCategoriesString($customWritePanel)
{
$results = RCCWP_CustomWritePanel::GetAssignedCategories($customWritePanel);
$str = '';
foreach ($results as $r)
{
$str .= $r->cat_name . ', ';
}
$str = substr($str, 0, strlen($str) - 2); // deletes last comma and whitespace
return $str;
}
function GetStandardFieldsString($customWritePanel)
{
$results = RCCWP_CustomWritePanel::GetStandardFields($customWritePanel);
foreach ($results as $r)
{
$str .= $r->name . ', ';
}
$str = substr($str, 0, strlen($str) - 2); // deletes last comma and whitespace
return $str;
}
/**
* View groups/fields of a write panel
*
*/
public static function View()
{
global $mf_domain;
$customWritePanelId = (int)$_REQUEST['custom-write-panel-id'];
$customWritePanels = RCCWP_CustomWritePanel::GetCustomWritePanels();
$customWritePanel = RCCWP_CustomWritePanel::Get($customWritePanelId);
$custom_groups = RCCWP_CustomWritePanel::GetCustomGroups($customWritePanelId);
// get default group id
foreach ($custom_groups as $group){
if ($group->name == '__default' && $group->panel_id == $customWritePanelId){ // traversal added extra condition to handle globals
$customDefaultGroupId = $group->id;
break;
}
}
?>
<script type="text/javascript" language="javascript">
function confirmBeforeDelete()
{
return confirm("<?php _e('Are you sure you want to delete this custom Field?', $mf_domain); ?>");
}
function confirmBeforeDeleteGroup()
{
return confirm("<?php _e('Are you sure you want to delete this field group?\n\nNote: All fields that are part of this group will also be deleted!', $mf_domain); ?>");
}
</script>
<div class="wrap">
<form action="<?php echo RCCWP_ManagementPage::GetPanelPage() . "&mf_action=view-custom-write-panel"?>" method="post" id="posts-filter" name="SelectWritePanel">
<h2>
<?php echo $customWritePanel->name?>
<span style="font-size:small">
<a href="<?php echo RCCWP_ManagementPage::GetCustomWritePanelGenericUrl('edit-custom-write-panel', $customWritePanel->id); ?>" ><?php _e('Edit', $mf_domain); ?></a>|
<a href="<?php echo wp_nonce_url(RCCWP_ManagementPage::GetCustomWritePanelGenericUrl('delete-custom-write-panel', $customWritePanel->id),'delete-custom-write-panel'); ?>" onclick="return confirmBeforeDelete();"><?php _e('Delete', $mf_domain); ?></a>|
<a href="<?php echo wp_nonce_url(RCCWP_ManagementPage::GetCustomWritePanelGenericUrl('export-custom-write-panel', $customWritePanel->id),'export-custom-write-panel'); ?>" ><?php _e('Export', $mf_domain); ?></a>
</span>
</h2>
<p id="post-search" style="margin-top:6px">
<strong>
<?php _e('Choose a Write Panel', $mf_domain)?>
<select name="custom-write-panel-id" style="margin-top:-2px" onchange="document.SelectWritePanel.submit()">
<?php
foreach ($customWritePanels as $panel) :
?>
<option <?php echo ($customWritePanelId==$panel->id?' selected ':''); ?> value="<?php echo $panel->id?>"><?php echo $panel->name;?></option>
<?php
endforeach;
?>
</select>
</strong>
<a href="<?php echo RCCWP_ManagementPage::GetCustomWritePanelGenericUrl('create-custom-group')?>" class="button-secondary">+ <?php _e('Create a Group', $mf_domain)?></a>
<a href="<?php echo RCCWP_ManagementPage::GetCustomWritePanelGenericUrl('create-custom-field')."&custom-group-id=$customDefaultGroupId"?>" class="button-secondary">+ <?php _e('Create a Field', $mf_domain)?></a>
</p>
</form>
<br class="clear"/>
<?php if(isset($_GET['save_order']) && $_GET['saved_order'] == "true"):?>
<div id="message" class="updated">
Saved Order.
</div>
<?php endif; ?>
<?php
foreach ($custom_groups as $group) :
?>
<?php if($group->name == "__default"):?>
<h2>Magic Fields</h2>
<?php else:?>
<h2 class="mf-no-default-group"><a href="<?php echo RCCWP_ManagementPage::GetCustomWritePanelGenericUrl('edit-custom-group')."&custom-group-id={$group->id}"?>"><?php echo $group->name?></a></strong>
<span class="mf_add_group_field">(<a href="<?php echo RCCWP_ManagementPage::GetCustomWritePanelGenericUrl('create-custom-field')."&custom-group-id={$group->id}"?>"><?php _e('create field',$mf_domain); ?></a>)</span>
<span class="mf_delete_group_field">(<a onclick="return confirmBeforeDeleteGroup();" href="<?php echo wp_nonce_url(RCCWP_ManagementPage::GetCustomWritePanelGenericUrl('delete-custom-group')."&custom-group-id={$group->id}",'delete-custom-group'); ?>"><?php _e('delete',$mf_domain); ?></a>)</span>
</h2>
<?php endif;?>
<form action="<?php echo RCCWP_ManagementPage::GetCustomWritePanelGenericUrl('save-fields-order')?>" method="post" id="posts-filter" name="ImportWritePanelForm" enctype="multipart/form-data">
<?php wp_nonce_field('save-fields-order'); ?>
<table cellpadding="3" cellspacing="3" width="100%" class="widefat">
<thead>
<tr>
<th width="5%"></th>
<th width="20%" scope="col"><?php _e('Label', $mf_domain)?></th>
<th width="35%" scope="col"><?php _e('Name (Order)', $mf_domain)?></th>
<th width="20%" scope="col"><?php _e('Type', $mf_domain)?></th>
<th width="20%" scope="col"><?php _e('Actions', $mf_domain)?></th>
</tr>
</thead>
<tbody class="sortable">
<?php
RCCWP_CustomWritePanelPage::DisplayGroupFields($group->id);
?>
</tbody>
</table>
<?php endforeach;?>
</div>
<br />
<input type="submit" name="save_submit" value="<?php _e('Save Order',$mf_domain);?>" id="save_order" />
</form>
<?php
}
public static function DisplayGroupFields($customGroupId, $intended = false) {
global $mf_domain;
$custom_fields = RCCWP_CustomGroup::GetCustomFields($customGroupId);
foreach ($custom_fields as $field) :
if( isset( $field->properties['strict-max-length'] ) && $field->properties['strict-max-length'] == 1 ) {
if( $field->type == 'Multiline Textbox' ) {
$maxlength = ' <sup class="help_text strict">[max:'.( $field->properties['width']*$field->properties['height'] ).']</sup>';
}else {
$maxlength = ' <sup class="help_text strict">[max:'.$field->properties['size'].']</sup>';
}
}else {
$maxlength = '';
}
?>
<tr>
<td>
<a id="field_<?php echo $field->id; ?>" class="handler" href="javascript:void(0)"><img src="<?php echo MF_URI; ?>/images/mf_arrows.png"></a>
<input type="hidden" name="mf_order[<?php print $customGroupId;?>][]" value="<?php echo $field->id; ?>" />
</td>
<td><a href="<?php echo RCCWP_ManagementPage::GetCustomWritePanelGenericUrl('edit-custom-field')."&custom-field-id=$field->id"?> " ><?php if ($intended){ ?><img align="top" src="<?php echo MF_URI; ?>images/arrow_right.gif" alt=""/> <?php } ?><?php echo $field->description . $maxlength?></a><?php if( $field->required_field == 1 ) echo ' <span class="required">*</span>'; ?></td>
<td><tt><?php echo $field->name.' <span style="color: #999;">('.$field->display_order.')</span>';?></tt><?php
if( $field->type == 'Textbox' && isset( $field->properties['size'] ) ) { echo ' <sup class="help_text">['.$field->properties['size'].']</sup>'; }
if( $field->type == 'Multiline Textbox' && isset( $field->properties['height'] ) && isset( $field->properties['width'] ) ) { echo ' <sup class="help_text">['.$field->properties['height']. '×'. $field->properties['width'] .']</sup>'; };
?></td>
<td><?php echo $field->type?><?php
if( $field->type == 'Multiline Textbox' && isset( $field->properties['hide-visual-editor'] ) && $field->properties['hide-visual-editor'] == 1 ) { echo ' <sup class="help_text">[simple]</sup>'; }
?></td>
<td><a onclick="return confirmBeforeDelete();" href="<?php echo wp_nonce_url(RCCWP_ManagementPage::GetCustomWritePanelGenericUrl('delete-custom-field')."&custom-field-id=$field->id",'delete-custom-field'); ?>" >× <?php _e('Delete',$mf_domain); ?></a></td>
</tr>
<?php
endforeach;
}
function save_order_fields() {
global $wpdb;
if(!empty($_POST) && is_numeric($_GET['custom-write-panel-id'])){
foreach($_POST['mf_order'] as $group_id => $group) {
foreach($group as $order => $field_id ) {
if(is_numeric($group_id) && is_numeric($field_id) && is_numeric($order)) {
$wpdb->update(MF_TABLE_GROUP_FIELDS,array('display_order' => $order),array('id' => $field_id),array('%d'),array('%d'));
}
}
}
}
wp_safe_redirect(
add_query_arg(
'saved_order',
'true',
wp_get_referer()
)
);
}
function Import()
{
global $mf_domain;
include_once('RCCWP_CustomWritePanel.php');
if(isset($_FILES['import-write-panel-file']) && !empty($_FILES['import-write-panel-file']['tmp_name']) ) {
$filePath = $_FILES['import-write-panel-file']['tmp_name'];
}else{
die(__('Error uploading file!', $mf_domain));
}
if(isset($_REQUEST['overwrite-existing'])) {
$overwrite = true;
}
$writePanelName = basename($_FILES['import-write-panel-file']['name'], ".pnl");
$panelID = RCCWP_CustomWritePanel::Import($filePath, $writePanelName, $overwrite);
unlink($filePath);
echo "<div class='wrap'><h3>".__("The Write Panel was imported successfuly.",$mf_domain)."</h3>";
echo '<p><a href="' . RCCWP_ManagementPage::GetCustomWritePanelGenericUrl('view-custom-write-panel', $panelID).'">'.__('Click here',$mf_domain).' </a> '.__('to edit the write panel.',$mf_domain).'</p>';
echo "</div>";
}
public static function ViewWritePanels()
{
global $mf_domain;
$customWritePanels = RCCWP_CustomWritePanel::GetCustomWritePanels(TRUE);
?>
<div class="wrap">
<form action="<?php echo RCCWP_ManagementPage::GetCustomWritePanelGenericUrl('import-write-panel')?>" method="post" id="posts-filter" name="ImportWritePanelForm" enctype="multipart/form-data">
<h2><?php _e('Custom Write Panel',$mf_domain); ?></h2>
<p id="post-search">
<input id="import-write-panel-file" name="import-write-panel-file" type="file" />
<input id="overwrite-existing" name="overwrite-existing" type="checkbox"/> Overwrite existing panel
<a href="#none" class="button-secondary" style="display:inline" onclick="document.ImportWritePanelForm.submit();"><?php _e('Import a Write Panel',$mf_domain); ?></a>
<a href="<?php echo RCCWP_ManagementPage::GetCustomWritePanelGenericUrl('create-custom-write-panel'); ?>" class="button-secondary" style="display:inline">+ <?php _e('Create a Write Panel',$mf_domain); ?></a>
</p>
</form>
<br class="clear"/>
<table cellpadding="3" cellspacing="3" width="100%" class="widefat">
<thead>
<tr>
<th scope="col" width="40%"><?php _e('Name (Order)',$mf_domain); ?></th>
<th width="10%"><?php _e('Id',$mf_domain); ?></th>
<th width="10%"><?php _e('Type',$mf_domain); ?></th>
<th width="40%" colspan="4" style="text-align:center"><?php _e('Actions',$mf_domain); ?></th>
</tr>
</thead>
<tbody>
<?php
foreach ($customWritePanels as $panel) :
?>
<tr>
<td><?php echo $panel->name;?><?php if ($panel->name != '_Global'): echo ' <span style="color: #999;">('.$panel->display_order.')</span>' ?><?php endif; ?></td>
<td><?php echo $panel->id ?></td>
<td><?php echo ucwords( $panel->type ); if( $panel->single != 1 ) echo ' <sup class="multiple" title="Multiple Posts/Pages">[+]</sup>'; ?></td>
<td><a href="<?php echo RCCWP_ManagementPage::GetCustomWritePanelGenericUrl('view-custom-write-panel', $panel->id)?>" ><?php _e('Edit Fields/Groups',$mf_domain) ?></a></td>
<td><?php if ($panel->name != '_Global'): ?><a href="<?php echo RCCWP_ManagementPage::GetCustomWritePanelGenericUrl('edit-custom-write-panel', $panel->id)?>" ><?php _e('Edit Write Panel',$mf_domain) ?></a> <?php endif; ?></td>
<td><?php if ($panel->name != '_Global'): ?><a href="<?php echo RCCWP_ManagementPage::GetCustomWritePanelGenericUrl('edit-custom-write-panel', $panel->id)?>" >
<a href="<?php echo wp_nonce_url(RCCWP_ManagementPage::GetCustomWritePanelGenericUrl('export-custom-write-panel', $panel->id),'export-custom-write-panel'); ?>" ><?php _e('Export',$mf_domain); ?></a><?php endif; ?></td>
</tr>
<?php
endforeach;
?>
</tbody>
</table>
<br />
</div>
<?php
}
}
?>