root/afridex/plugins/fresh-page/RCCWP_ManagementPage.php @ 21

Revision 21, 5.2 kB (checked in by admin, 18 years ago)
RevLine 
[21]1<?php
2include_once('RCCWP_Application.php');
3
4class RCCWP_ManagementPage
5{
6        function AssignCustomWritePanel()
7        {
8                $postId = (int)$_GET['assign-custom-write-panel'];
9                $customWritePanels = RCCWP_Application::GetCustomWritePanels();
10                $customWritePanelOptions = RCCWP_Options::Get();
11                $message = 'The Post that you\'re about to edit is not associated with any Custom Write Panel.';
12                ?>
13               
14                <div id="message" class="updated"><p><?php _e($message); ?></p></div>
15               
16                <div class="wrap">
17                <h2><?php _e('Assign Custom Write Panel'); ?></h2>
18               
19                <form action="" method="post" id="assign-custom-write-panel-form">
20               
21                <table class="optiontable">
22                <tbody>
23                <tr valign="top">
24                        <th scope="row">Custom Write Panel:</th>
25                        <td>
26                                <select name="custom-write-panel-id" id="custom-write-panel-id">
27                                        <option value="">(None)</option>
28                                <?php
29                                $defaultCustomWritePanel = $customWritePanelOptions['default-custom-write-panel'];
30                                foreach ($customWritePanels as $panel) :
31                                        $selected = $panel->id == $defaultCustomWritePanel ? 'selected="selected"' : '';
32                                ?>
33                                        <option value="<?=$panel->id?>" <?=$selected?>><?=$panel->name?></option>
34                                <?php
35                                endforeach;
36                                ?>
37                                </select>
38                        </td>
39                </tr>
40                </tbody>
41                </table>
42               
43                <input type="hidden" name="post-id" value="<?=$postId?>" />
44                <p class="submit" >
45                        <input name="edit-with-no-custom-write-panel" type="submit" value="Don't Assign Custom Write Panel" />
46                        <input name="edit-with-custom-write-panel" type="submit" value="Edit with Custom Write Panel" />
47                </p>
48               
49                </form>
50               
51                </div>
52               
53                <?php
54        }
55       
56        function GetCustomFieldEditUrl($customWritePanelId, $customFieldId)
57        {
58                $url = '?page=' . RC_CWP_PLUGIN_DIR . DIRECTORY_SEPARATOR . 'RCCWP_Menu.php&edit-custom-field=' . $customFieldId . '&custom-write-panel-id=' . $customWritePanelId;
59                return $url;
60        }
61       
62        function GetCustomFieldDeleteUrl($customWritePanelId, $customFieldId)
63        {
64                $url = '?page=' . RC_CWP_PLUGIN_DIR . DIRECTORY_SEPARATOR . 'RCCWP_Menu.php&delete-custom-field=' . $customFieldId . '&custom-write-panel-id=' . $customWritePanelId;
65                return $url;
66        }
67       
68        function GetCustomWritePanelEditUrl($customWritePanelId)
69        {
70                $url = '?page=' . urlencode( RC_CWP_PLUGIN_DIR . DIRECTORY_SEPARATOR . 'RCCWP_Menu.php') .'&view-custom-write-panel=' . $customWritePanelId . '&custom-write-panel-id=' . $customWritePanelId;
71                return $url;
72        }
73       
74        function GetCustomWritePanelDeleteUrl($customWritePanelId)
75        {
76                $url = '?page=' . RC_CWP_PLUGIN_DIR . DIRECTORY_SEPARATOR . 'RCCWP_Menu.php&delete-custom-write-panel=' . $customWritePanelId . '&custom-write-panel-id=' . $customWritePanelId;
77                return $url;
78        }
79       
80        function View()
81        {
82                $customWritePanels = RCCWP_Application::GetCustomWritePanels();
83                ?>
84
85                <div class="wrap">
86                <h2><?php _e('Custom Write Panel'); ?></h2>
87                <table cellpadding="3" cellspacing="3" width="100%" class="widefat">
88                <thead>
89                <tr>
90                        <th scope="col" width="7%"><?php _e('Order'); ?></th>
91                        <th scope="col" width="50%"><?php _e('Name'); ?></th>
92<!--                    <th scope="col"><?php _e('Description'); ?></th> -->
93                        <th colspan="3" style="text-align:center"><?php _e('Action'); ?></th>
94                </tr>
95                </thead>
96                <tbody>
97                <?php
98                foreach ($customWritePanels as $panel) :
99                        $class = $class == '' ? 'alternate' : '';
100                ?>
101                <tr class="<?=$class?>">
102                        <td align="right"><?=$panel->display_order ?></td>
103                        <td><?=$panel->name ?></td>
104<!--                    <td><?=$panel->description ?></td></td> -->
105
106                        <td width="15%" align="center">
107                        <?php $buttonBGColor = $buttonBGColor == '#F1F1F1' ? '#fff' : '#F1F1F1';  ?>
108                        <form action="" method="post" id="view-write-panel-form">
109                                <input type="hidden" name="custom-write-panel-id" value="<?=$panel->id?>" />
110                                 <input name="create-custom-field" type="submit" id="create-custom-field" value="Create Custom Field" style="cursor:pointer; border:0px; background:<?php echo $buttonBGColor?>; color:#00019B;" onmouseover="this.style.background='#DFDFDF';" onmouseout="this.style.background='<?php echo $buttonBGColor?>'"/>
111                        </form>
112                        </td>
113
114<!--
115                        <td width="20%">
116                        <form action="" method="post" id="view-write-panel-form" name="view-write-panel-form">
117                                <input type="text" name="custom-write-panel-id" value="<?=$panel->id?>" />
118                                <a href="javascript:void(0);" onclick="document.form.view-write-panel-form.submit();" class="edit"><?php _e('Create Custom Field'); ?></a>
119                        </form>
120                        </td>
121-->
122                        <td><a href="<?php echo RCCWP_ManagementPage::GetCustomWritePanelEditUrl($panel->id); ?>" class="edit"><?php _e('View') ?></a></td>
123                        <td><a href="<?php echo RCCWP_ManagementPage::GetCustomWritePanelDeleteUrl($panel->id); ?>" class="delete"><?php _e('Delete'); ?></a></td>
124               
125                </tr>
126                <?php
127                endforeach;
128                ?>
129                </tbody>
130                </table>
131
132                </div>
133
134                <div class="wrap">
135                <form action="" method="post" id="main-management-form">
136                <p class="submit">
137                        <!--
138                        <input name="custom-write-panel-options" type="submit" id="custom-write-panel-options" value="<?php _e('Go to Options'); ?>" />
139                        -->
140                        <input name="create-custom-write-panel" type="submit" id="create-custom-write-panel" value="<?php _e('Create Custom Write Panel'); ?>" />
141                </p>
142                </form>
143                </div>
144
145                <?php 
146        }
147}
148?>
Note: See TracBrowser for help on using the browser.