root/afridex/plugins/fresh-page/RCCWP_CustomFieldPage.php @ 22

Revision 21, 7.1 kB (checked in by admin, 18 years ago)
Line 
1<?php
2class RCCWP_CustomFieldPage
3{
4        function Edit()
5        {
6                $custom_field = RCCWP_CustomField::Get((int)$_GET['edit-custom-field']);
7                ?>
8               
9                <div class="wrap">
10<?php
11
12?>
13                <h2>Edit Custom Field</h2>
14               
15                <form action="" method="post" id="edit-custom-field-form">
16                <input type="hidden" name="custom-field-id" value="<?=$custom_field->id?>"
17                <fieldset class="options">
18               
19                <table class="optiontable">
20                <tbody>
21                <tr valign="top">
22                        <th scope="row">Name:</th>
23                        <td><input name="custom-field-name" id="custom-field-name" size="40" type="text" value="<?=$custom_field->name?>" /></td>
24                </tr>
25                <tr valign="top">
26                        <th scope="row">Label:</th>
27                        <td><input name="custom-field-description" id="custom-field-description" size="40" type="text" value="<?=$custom_field->description?>" /></td>
28                </tr>
29<!--            <tr valign="top">
30                        <th scope="row">Description:</th>
31                        <td><textarea name="custom-field-description" id="custom-field-description" rows="2" cols="38"><?=$custom_field->description?></textarea></td>
32                </tr>
33-->
34                <tr valign="top">
35                        <th scope="row">Order:</th>
36                        <td>
37                                <input name="custom-field-order" id="custom-field-order" size="2" type="text" value="<?=$custom_field->display_order?>" /></td>
38                        </td>
39                </tr>
40               
41                <?php if (in_array($custom_field->type, array('Textbox', 'Listbox'))) : ?>
42                <tr valign="top">
43                        <th scope="row">Size:</th>
44                        <td><input type="text" name="custom-field-size" id="custom-field-size" size="2" value="<?=$custom_field->properties['size']?>" /></td>
45                </tr>   
46                <?php endif; ?>
47
48                <?php if (in_array($custom_field->type, array('Multiline Textbox'))) : ?>
49                <tr valign="top">
50                        <th scope="row">Height:</th>
51                        <td><input type="text" name="custom-field-height" id="custom-field-height" size="2" value="<?=$custom_field->properties['height']?>" /></td>
52                </tr>   
53                <tr valign="top">
54                        <th scope="row">Width:</th>
55                        <td><input type="text" name="custom-field-width" id="custom-field-width" size="2" value="<?=$custom_field->properties['width']?>" /></td>
56                </tr>   
57                <?php endif; ?>
58
59
60<!-- START -->
61                <?php if (in_array($custom_field->type, array('Image'))) : ?>
62        <!--
63                <?php 
64                        $size = explode("&",$custom_field->properties['params']);
65                                $h = substr($size[1], 2);
66                                $w = substr($size[2], 2);
67                        $cssVlaue = $custom_field->CSS;
68                ?>
69                <tr valign="top">
70                        <th scope="row"><span id="lblHeight" style="display:inline;">Height:</span></th>
71                        <td><span id="txtHeight" style="display:inline;"><input type="text" name="custom-field-photo-height" id="custom-field-photo-height" size="3" value="<?=$h; ?>" /></span></td>
72                </tr>   
73                <tr valign="top">
74                        <th scope="row"><span id="lblWidth" style="display:inline;">Width:</span></th>
75                        <td><span id="txtWidth" style="display:inline;"><input type="text" name="custom-field-photo-width" id="custom-field-photo-width" size="3" value="<?=$w; ?>" /></span></td>
76                </tr>
77                -->
78                <?php endif; ?>
79
80<!-- END -->
81
82                <?php
83                if ($custom_field->has_options == "true") :
84                        $options = implode("\n", (array)$custom_field->options)
85                ?>
86                <tr valign="top">
87                        <th scope="row">Options:</th>
88                        <td>
89                                <textarea name="custom-field-options" id="custom-field-options" rows="2" cols="38"><?=$options?></textarea><br />
90                                <em>Separate each option with a newline.</em>
91                        </td>
92                </tr>
93                <tr valign="top">
94                        <th scope="row">Default Value:</th>
95                        <td>
96                                <?php
97                                $default_value = implode("\n", (array)$custom_field->default_value);
98                                if ($custom_field->allow_multiple_values == "true") :
99                                ?>
100                                <textarea name="custom-field-default-value" id="custom-field-default-value" rows="2" cols="38"><?=$default_value?></textarea><br />
101                                <em>Separate each value with a newline.</em>
102                                <?php
103                                else:
104                                ?>
105                                <input type="text" name="custom-field-default-value" id="custom-field-default-value" size="25" value="<?=$default_value?>" />
106                                <?php
107                                endif;
108                                ?>
109                        </td>
110                </tr>
111                <?php
112                endif;
113                ?>
114               
115                <tr valign="top">
116                        <th scope="row">Type:</th>
117                        <td>
118
119                                <!-- START :: Javascript for Image/Photo' Css Class -->
120                                <script type="text/javascript" language="javascript">
121                                        function fun(name)
122                                        {
123                                                if(name == "Image")
124                                                {
125                                                        document.getElementById('divCSS').style.display = 'inline';
126                                                        document.getElementById('divLbl').style.display = 'inline';
127                                                        document.getElementById('lblHeight').style.display = 'inline';
128                                                        document.getElementById('txtHeight').style.display = 'inline';
129                                                        document.getElementById('lblWidth').style.display = 'inline';
130                                                        document.getElementById('txtWidth').style.display = 'inline';
131                                                }
132                                                else
133                                                {
134                                                        document.getElementById('divCSS').style.display = 'none';
135                                                        document.getElementById('divLbl').style.display = 'none';
136                                                        document.getElementById('lblHeight').style.display = 'none';
137                                                        document.getElementById('txtHeight').style.display = 'none';
138                                                        document.getElementById('lblWidth').style.display = 'none';
139                                                        document.getElementById('txtWidth').style.display = 'none';
140                                                }
141                                        }
142                                </script>
143                                <!-- END :: Javascript for Image/Photo' Css Class -->
144
145                                <?php
146                                $field_types = RCCWP_CustomField::GetCustomFieldTypes();
147                                foreach ($field_types as $field) :
148                                        $checked = 
149                                                $field->name == $custom_field->type ?
150                                                'checked="checked"' : '';
151                                ?>
152                                        <label><input name="custom-field-type" value="<?=$field->id?>" type="radio" <?=$checked?> onclick='fun("<?=$field->name?>");'/>
153                                        <?=$field->name?></label><br />
154                                <?php
155                                endforeach;
156                                ?>
157                        </td>
158                </tr>
159                <!-- START :: For Image/Photo' Css -->
160                <?php
161                        $isDisplay = $custom_field->type == "Image" ? 'display:inline;' : 'display:none;';
162                ?>
163                <?php 
164                        $size = explode("&",$custom_field->properties['params']);
165                                $h = substr($size[1], 2);
166                                $w = substr($size[2], 2);
167                        $cssVlaue = $custom_field->CSS;
168                ?>
169                <tr valign="top">
170                        <th scope="row"><span id="lblHeight" style="<?php echo $isDisplay;?>">Max Height:</span></th>
171                        <td><span id="txtHeight" style="<?php echo $isDisplay;?>"><input type="text" name="custom-field-photo-height" id="custom-field-photo-height" size="3" value="<?=$h; ?>" /></span></td>
172                </tr>   
173                <tr valign="top">
174                        <th scope="row"><span id="lblWidth" style="<?php echo $isDisplay;?>">Max Width:</span></th>
175                        <td><span id="txtWidth" style="<?php echo $isDisplay;?>"><input type="text" name="custom-field-photo-width" id="custom-field-photo-width" size="3" value="<?=$w; ?>" /></span></td>
176                </tr>
177                <tr valign="top">
178                        <th scope="row"><div id="divLbl" style="<?php echo $isDisplay;?>">Css Class:</div></th>
179                        <td>
180                                <div id="divCSS" style="<?php echo $isDisplay;?>">
181                                <input name="custom-field-css" id="custom-field-css" size="40" type="text" value=<?=$cssVlaue?> />
182                                </div>
183                        </td>
184                </tr>
185
186                <!-- END :: For Image/Photo' Css -->           
187                </tbody>
188                </table>
189               
190                </fieldset>
191                <p class="submit" ><input name="cancel-edit-custom-field" type="submit" id="cancel-edit-custom-field" value="Cancel" /> <input name="submit-edit-custom-field" type="submit" id="submit-edit-custom-field" value="Update" /></p>
192               
193                </form>
194               
195                </div>
196               
197                <?php
198        }
199}
200?>
Note: See TracBrowser for help on using the browser.