forked from hunk/Magic-Fields
-
Notifications
You must be signed in to change notification settings - Fork 0
/
RCCWP_ManagementPage.php
151 lines (123 loc) · 5.18 KB
/
RCCWP_ManagementPage.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
<?php
include_once('RCCWP_Application.php');
class RCCWP_ManagementPage
{
function AssignCustomWritePanel()
{
global $mf_domain;
$postId = (int)$_GET['assign-custom-write-panel'];
$customWritePanels = RCCWP_CustomWritePanel::GetCustomWritePanels();
$customWritePanelOptions = RCCWP_Options::Get();
$message = 'The Post that you\'re about to edit is not associated with any Custom Write Panel.';
?>
<div id="message" class="updated"><p><?php _e($message); ?></p></div>
<div class="wrap">
<h2><?php _e('Assign Custom Write Panel'); ?></h2>
<form action="" method="post" id="assign-custom-write-panel-form">
<table class="optiontable">
<tbody>
<tr valign="top">
<th scope="row"><?php _e('Custom Write Panel', $mf_domain); ?>:</th>
<td>
<select name="custom-write-panel-id" id="custom-write-panel-id">
<option value=""><?php _e('(None)', $mf_domain); ?></option>
<?php
$defaultCustomWritePanel = $customWritePanelOptions['default-custom-write-panel'];
foreach ($customWritePanels as $panel) :
$selected = $panel->id == $defaultCustomWritePanel ? 'selected="selected"' : '';
?>
<option value="<?php echo $panel->id?>" <?php echo $selected?>><?php echo $panel->name?></option>
<?php
endforeach;
?>
</select>
</td>
</tr>
</tbody>
</table>
<input type="hidden" name="post-id" value="<?php echo $postId?>" />
<p class="submit" >
<input name="edit-with-no-custom-write-panel" type="submit" value="<?php _e("Don't Assign Custom Write Panel", $mf_domain); ?>" />
<input name="edit-with-custom-write-panel" type="submit" value="<?php _e('Edit with Custom Write Panel', $mf_domain); ?>" />
</p>
</form>
</div>
<?php
}
function GetCustomFieldEditUrl($customWriteModuleId, $customGroupId, $customFieldId)
{
$url = '?page=' . 'Magic_FieldsManageModules' . '&edit-custom-field=' . $customFieldId . '&custom-group-id=' . $customGroupId . '&custom-write-module-id='. $customWriteModuleId ;
return $url;
}
function GetCustomFieldDeleteUrl($customGroupId, $customFieldId)
{
$url = '?page=' . 'Magic_FieldsManageModules' . '&delete-custom-field=' . $customFieldId . '&custom-group-id=' . $customGroupId;
return $url;
}
function GetModuleDuplicateEditUrl($customWriteModuleId, $duplicateId)
{
$url = '?page=' . 'Magic_FieldsManageModules' . '&edit-module-duplicate=' . $duplicateId . '&module-duplicate-id=' . $duplicateId . '&custom-write-module-id='. $customWriteModuleId ;
return $url;
}
function GetModuleDuplicateDeleteUrl($customWriteModuleId, $duplicateId)
{
$url = '?page=' . 'Magic_FieldsManageModules' . '&delete-module-duplicate=' . $duplicateId . '&module-duplicate-id=' . $duplicateId . '&custom-write-module-id='. $customWriteModuleId ;
return $url;
}
function GetCustomWritePanelEditUrl($customWritePanelId)
{
$url = '?page=' . urlencode(MF_PLUGIN_DIR . DIRECTORY_SEPARATOR . 'RCCWP_Menu.php') . '&view-custom-write-panel=' . $customWritePanelId . '&custom-write-panel-id=' . $customWritePanelId;
return $url;
}
function GetCustomWritePanelDeleteUrl($customWritePanelId)
{
$url = '?page=' . urlencode(MF_PLUGIN_DIR . DIRECTORY_SEPARATOR . 'RCCWP_Menu.php') . '&delete-custom-write-panel=' . $customWritePanelId . '&custom-write-panel-id=' . $customWritePanelId;
return $url;
}
function GetCustomWriteModuleEditUrl($moduleId)
{
$url = '?page=' . 'Magic_FieldsManageModules' . '&view-custom-write-module=' . $moduleId . '&custom-write-module-id=' . $moduleId;
return $url;
}
function GetCustomWriteModuleDeleteUrl($moduleId)
{
$url = '?page=' . 'Magic_FieldsManageModules' . '&delete-custom-write-module=' . $moduleId . '&custom-write-module-id=' . $moduleId;
return $url;
}
function GetCustomGroupEditUrl($groupId, $moduleId)
{
$url = '?page=' . urlencode(MF_PLUGIN_DIR . DIRECTORY_SEPARATOR . 'RCCWP_Menu.php') . '&mf_action=view-custom-group&custom-group-id=' . $groupId. '&custom-write-module-id=' . $moduleId;
return $url;
}
function GetCustomGroupDeleteUrl($groupId)
{
$url = '?page=' . 'Magic_FieldsManageModules' . '&delete-custom-group=' . $groupId . '&custom-group-id=' . $groupId;
return $url;
}
function GetCustomPanelModuleDeleteUrl($customWritePanelId, $panelModuleId)
{
$url = '?page=' . urlencode(MF_PLUGIN_DIR . DIRECTORY_SEPARATOR . 'RCCWP_Menu.php') . '&delete-custom-panel-module=' . $panelModuleId . '&custom-write-panel-id=' . $customWritePanelId;
return $url;
}
/**
* Generates a url containing the write panel id and the action
*
* @return unknown
*/
public static function GetCustomWritePanelGenericUrl($mfAction, $customWritePanelId = null)
{
if (empty($customWritePanelId) && isset($_REQUEST['custom-write-panel-id']) && filter_var($_REQUEST['custom-write-panel-id'], FILTER_VALIDATE_INT)){
$customWritePanelId = filter_var($_REQUEST['custom-write-panel-id'], FILTER_VALIDATE_INT);
}
if (!empty($customWritePanelId)){
$url = RCCWP_ManagementPage::GetPanelPage() . "&custom-write-panel-id=$customWritePanelId&mf_action=$mfAction";
}
else{
$url = RCCWP_ManagementPage::GetPanelPage() . "&mf_action=$mfAction";
}
return $url;
}
public static function GetPanelPage(){
return '?page=MagicFieldsMenu';
}
}