/**
* View groups/fields of a write panel
*
*/
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') {
$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);
?>
");
}
</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', $panel->id);
?>
" ><?php
_e('Edit', $mf_domain);
?>
</a>|
<a href="<?php
echo RCCWP_ManagementPage::GetCustomWritePanelGenericUrl('delete-custom-write-panel', $panel->id);
?>
" onclick="return confirmBeforeDelete();"><?php
_e('Delete', $mf_domain);
?>
</a>|
<a href="<?php
echo RCCWP_ManagementPage::GetCustomWritePanelGenericUrl('export-custom-write-panel', $panel->id);
?>
" ><?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
}
?>
</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"/>
<table cellpadding="3" cellspacing="3" width="100%" class="widefat">
<thead>
<tr>
<th width="60%" scope="col"><?php
_e('Name', $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>
<?php
foreach ($custom_groups as $group) {
if ($customDefaultGroupId != $group->id) {
?>
<tr>
<td><strong><a style="color:#D54E21" href="<?php
echo RCCWP_ManagementPage::GetCustomWritePanelGenericUrl('edit-custom-group') . "&custom-group-id={$group->id}";
?>
"><?php
echo $group->name;
?>
</a></strong> (<a style="font-size:very-small" href="<?php
echo RCCWP_ManagementPage::GetCustomWritePanelGenericUrl('create-custom-field') . "&custom-group-id={$group->id}";
?>
"><?php
_e('create field', $mf_domain);
?>
</a>) </td>
<td><?php
_e('Group', $mf_domain);
?>
</td>
<td><a onclick="return confirmBeforeDelete();" href="<?php
echo RCCWP_ManagementPage::GetCustomWritePanelGenericUrl('delete-custom-group') . "&custom-group-id={$group->id}";
?>
">X <?php
_e('Delete', $mf_domain);
?>
</a></td>
</tr>
<?php
RCCWP_CustomWritePanelPage::DisplayGroupFields($group->id, true);
}
}
RCCWP_CustomWritePanelPage::DisplayGroupFields($customDefaultGroupId);
?>
</tbody>
</table>
</div>
<br />
<?php
}