GetThemePage() public method

Get the properties of a write panel
public GetThemePage ( $customWritePanelName ) : an
return an object containing the properties of the write panel which are id, name, description, display_order, capability_name, type
 function ApplyCustomWritePanelAssignedCategories($content)
 {
     global $CUSTOM_WRITE_PANEL;
     global $post, $title;
     if ($post->post_type == "post") {
         $assignedCategoryIds = RCCWP_CustomWritePanel::GetAssignedCategoryIds($CUSTOM_WRITE_PANEL->id);
         if ($post->ID == 0) {
             foreach ($assignedCategoryIds as $categoryId) {
                 $toReplace = 'id="in-category-' . $categoryId . '"';
                 $replacement = $toReplace . ' checked="checked"';
                 $content = str_replace($toReplace, $replacement, $content);
             }
         }
     }
     if ($post->post_type == "page") {
         $customParentPage = RCCWP_CustomWritePanel::GetParentPage($CUSTOM_WRITE_PANEL->name);
         if ($customParentPage && $post->ID == 0) {
             $toReplace = 'value="' . $customParentPage . '"';
             $replacement = 'value="' . $customParentPage . '"' . ' SELECTED';
             $content = str_replace($toReplace, $replacement, $content);
         }
         $customThemePage = RCCWP_CustomWritePanel::GetThemePage($CUSTOM_WRITE_PANEL->name);
         //set default theme page
         if ($post->ID == 0) {
             $toReplace = "value='" . $customThemePage . "'";
             $replacement = "value='" . $customThemePage . "'" . ' SELECTED';
             $content = str_replace($toReplace, $replacement, $content);
         }
     }
     return $content;
 }
示例#2
0
 function ApplyCustomWritePanelAssignedCategories($content)
 {
     global $CUSTOM_WRITE_PANEL;
     global $post, $title;
     $assignedCategoryIds = RCCWP_CustomWritePanel::GetAssignedCategoryIds($CUSTOM_WRITE_PANEL->id);
     $customThemePage = RCCWP_CustomWritePanel::GetThemePage($CUSTOM_WRITE_PANEL->name);
     //hide all categories
     $all = get_categories("get=all");
     foreach ($all as $al) {
         $toReplace = 'class="selectit"><input value="' . $al->term_id . '" type="checkbox" name="post_category[]" id="in-category-' . $al->term_id . '"/>';
         $replacement = 'class="selectit" style="display:none;"><input value="' . $al->term_id . '" type="checkbox" name="post_category[]" id="in-category-' . $al->term_id . '"/>';
         $content = str_replace($toReplace, $replacement, $content);
     }
     //display ony categories and child
     $dos = $assignedCategoryIds;
     foreach ($assignedCategoryIds as $id) {
         $childs = get_categories("child_of=" . $id . "&hierarchical=0&hide_empty=0");
         foreach ($childs as $child) {
             array_unshift($dos, $child->term_id);
         }
     }
     $dos = array_unique($dos);
     foreach ($dos as $do) {
         $toReplace = 'class="selectit" style="display:none;"><input value="' . $do . '" type="checkbox" name="post_category[]" id="in-category-' . $do . '"';
         $replacement = 'class="selectit"><input value="' . $do . '" type="checkbox" name="post_category[]" id="in-category-' . $do . '"';
         $content = str_replace($toReplace, $replacement, $content);
     }
     if ($_GET['custom-write-panel-id']) {
         foreach ($assignedCategoryIds as $categoryId) {
             $toReplace = 'id="in-category-' . $categoryId . '"';
             $replacement = $toReplace . ' checked="checked"';
             $content = str_replace($toReplace, $replacement, $content);
         }
     }
     //set default theme page
     if ($post->ID == 0) {
         $toReplace = "value='" . $customThemePage . "'";
         $replacement = "value='" . $customThemePage . "'" . ' SELECTED"';
         $content = str_replace($toReplace, $replacement, $content);
     }
     return $content;
 }
示例#3
0
 function ApplyCustomWritePanelAssignedCategories($content)
 {
     global $CUSTOM_WRITE_PANEL;
     global $post, $title;
     $assignedCategoryIds = RCCWP_CustomWritePanel::GetAssignedCategoryIds($CUSTOM_WRITE_PANEL->id);
     $customThemePage = RCCWP_CustomWritePanel::GetThemePage($CUSTOM_WRITE_PANEL->name);
     if ($_GET['custom-write-panel-id']) {
         foreach ($assignedCategoryIds as $categoryId) {
             $toReplace = 'id="in-category-' . $categoryId . '"';
             $replacement = $toReplace . ' checked="checked"';
             $content = str_replace($toReplace, $replacement, $content);
         }
     }
     //set default theme page
     if ($post->ID == 0) {
         $toReplace = "value='" . $customThemePage . "'";
         $replacement = "value='" . $customThemePage . "'" . ' SELECTED"';
         $content = str_replace($toReplace, $replacement, $content);
     }
     return $content;
 }
    function Content($customWritePanel = null)
    {
        global $mf_domain, $wpdb;
        $customWritePanelName = "";
        $customWritePanelDescription = "";
        $write_panel_category_ids = array();
        $defaultTagChecked = 'checked="checked"';
        $customWritePanelAllFieldIds = NULL;
        $customThemePage = NULL;
        $showPost = true;
        $customParentPage = NULL;
        if ($customWritePanel != null) {
            $customWritePanelName = $customWritePanel->name;
            $customWritePanelDescription = $customWritePanel->description;
            $customWritePanelDisplayOrder = $customWritePanel->display_order;
            $customWritePanelType = $customWritePanel->type;
            if ($customWritePanelType == 'page') {
                $showPost = false;
            }
            $customWritePanelCategoryIds = RCCWP_CustomWritePanel::GetAssignedCategoryIds($customWritePanel->id);
            $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> &nbsp; &nbsp; &nbsp; 
				<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");
        foreach ($cats as $cat) {
            $checked = "";
            if (isset($customWritePanel->id) && !empty($customWritePanel->id)) {
                if (in_array($cat->cat_ID, $customWritePanelCategoryIds)) {
                    $checked = "checked=\"checked\"";
                }
            }
            ?>
					<input type="checkbox" name="custom-write-panel-categories[]" value="<?php 
            echo $cat->cat_ID;
            ?>
" <?php 
            echo $checked;
            ?>
 /> <?php 
            echo $cat->cat_name;
            ?>
 <br/>
				<?php 
        }
        ?>
				
			</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();
        foreach ($themes_defaults as $v => $k) {
            if ($customWritePanelType == 'page') {
                $theme_select = NULL;
                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> &nbsp; &nbsp; &nbsp; 
				<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 
        }
        ?>
			</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 
        }
        ?>
			</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>
		</tbody>
		</table>
		
		<?php 
    }
 /**
  * Export a write panel to file
  *
  * @param integer $panelID
  * @param string $exportedFilename the full path of the file to which the panel will be exported
  */
 function Export($panelID)
 {
     include_once 'RCCWP_CustomGroup.php';
     include_once 'RCCWP_CustomField.php';
     $exported_data = array();
     $writePanel = RCCWP_CustomWritePanel::Get($panelID);
     $writePanel->standardFieldsIDs = RCCWP_CustomWritePanel::GetStandardFields($panelID);
     $writePanel->assignedCategories = array();
     $writePanel->theme = RCCWP_CustomWritePanel::GetThemePage($writePanel->name);
     $writePanel->parent_page = RCCWP_CustomWritePanel::GetParentPage($writePanel->name);
     $assignedCategories = RCCWP_CustomWritePanel::GetAssignedCategories($panelID);
     foreach ($assignedCategories as $assignedCategory) {
         $writePanel->assignedCategories[] = $assignedCategory->cat_id;
     }
     $moduleGroups = RCCWP_CustomWritePanel::GetCustomGroups($panelID);
     foreach ($moduleGroups as $moduleGroup) {
         $fields = RCCWP_CustomGroup::GetCustomFields($moduleGroup->id);
         foreach ($fields as $field) {
             if ($field->type == "Related Type") {
                 $tmp = RCCWP_CustomWritePanel::Get($field->properties["panel_id"]);
                 $field->properties["panel_name"] = $tmp->name;
                 unset($field->properties["panel_id"]);
             }
         }
         $groupFields[$moduleGroup->name]->fields = $fields;
         $groupFields[$moduleGroup->name]->duplicate = $moduleGroup->duplicate;
         $groupFields[$moduleGroup->name]->at_right = $moduleGroup->at_right;
     }
     $exported_data['panel'] = $writePanel;
     $exported_data['fields'] = $groupFields;
     return serialize($exported_data);
 }
 /**
  * Export a write panel to file
  *
  * @param integer $panelID
  * @param string $exportedFilename the full path of the file to which the panel will be exported
  */
 function Export($panelID, $exportedFilename)
 {
     include_once 'RCCWP_CustomGroup.php';
     include_once 'RCCWP_CustomField.php';
     $exported_data = array();
     $writePanel = RCCWP_CustomWritePanel::Get($panelID);
     $writePanel->standardFieldsIDs = RCCWP_CustomWritePanel::GetStandardFields($panelID);
     $writePanel->assignedCategories = array();
     $writePanel->theme = RCCWP_CustomWritePanel::GetThemePage($writePanel->name);
     $writePanel->parent_page = RCCWP_CustomWritePanel::GetParentPage($writePanel->name);
     $assignedCategories = RCCWP_CustomWritePanel::GetAssignedCategories($panelID);
     foreach ($assignedCategories as $assignedCategory) {
         $writePanel->assignedCategories[] = $assignedCategory->cat_name;
     }
     $moduleGroups = RCCWP_CustomWritePanel::GetCustomGroups($panelID);
     foreach ($moduleGroups as $moduleGroup) {
         $groupFields[$moduleGroup->name]->fields = RCCWP_CustomGroup::GetCustomFields($moduleGroup->id);
         $groupFields[$moduleGroup->name]->duplicate = $moduleGroup->duplicate;
         $groupFields[$moduleGroup->name]->at_right = $moduleGroup->at_right;
     }
     $exported_data['panel'] = $writePanel;
     $exported_data['fields'] = $groupFields;
     $handle = fopen($exportedFilename, "w");
     $result = fwrite($handle, serialize($exported_data));
     @fclose($handle);
 }
示例#7
0
    public static function attributesBoxContentPage($post)
    {
        global $wpdb;
        $single_panel = FALSE;
        $panel_id = get_post_meta($post->ID, "_mf_write_panel_id", TRUE);
        if ($panel_id) {
            $panel = RCCWP_CustomWritePanel::Get($panel_id);
        }
        ?>
    	<p><strong><?php 
        _e('Write Panel');
        ?>
</strong></p>
    	<label class="screen-reader-text" for="parent_id"><?php 
        _e('Write Panel1111');
        ?>
</label>
    	<?php 
        // get a list of the write panels
        $customWritePanels = RCCWP_CustomWritePanel::GetCustomWritePanels();
        $promptEditingPost = RCCWP_Options::Get('prompt-editing-post');
        $templates_by_filename = array();
        $templates = get_page_templates();
        // get the reverse map
        foreach ($templates as $name => $file) {
            $templates_by_filename[$file] = $name;
        }
        ?>
    	
    	<select name="rc-cwp-change-custom-write-panel-id" id="rc-cwp-change-custom-write-panel-id">
          <option value="-1"><?php 
        _e('(None)', $mf_domain);
        ?>
</option>
          
    		<?php 
        $items = array();
        foreach ($customWritePanels as $panel) {
            $selected = $panel->id == $panel_id ? 'selected="selected"' : '';
            $panel_theme = RCCWP_CustomWritePanel::GetThemePage($panel->name);
            $parent_page = RCCWP_CustomWritePanel::GetParentPage($panel->name);
            if ($parent_page != '') {
                $pp = get_page($parent_page);
                if ($pp) {
                    $parent_page_title = $pp->post_title;
                }
            }
            $allow = $panel->type == "page";
            if ($panel->single && $panel->id != $panel_id) {
                // check to see if there are any posts with this panel already. If so, we can't allow it to be used.
                $sql = $wpdb->prepare("SELECT COUNT(*) FROM {$wpdb->postmeta} WHERE {$wpdb->postmeta}.meta_value = %d AND {$wpdb->postmeta}.meta_key = %s", array($panel->id, "_mf_write_panel_id"));
                $count = $wpdb->get_var($sql);
                $allow = $count == 0;
            }
            if ($allow) {
                // cannot change to "single" panels
                ?>
    				<option value="<?php 
                echo $panel->id;
                ?>
" <?php 
                echo $selected;
                ?>
><?php 
                echo $panel->name;
                ?>
</option>
    				<?php 
                $items[$panel->id] = "{ panel_theme: '" . $panel_theme . "', template_name: '" . addslashes($templates_by_filename[$panel_theme]) . "', parent_page: '" . $parent_page . "', parent_page_title: '" . addslashes($parent_page_title) . "' }";
            }
        }
        ?>
    		</select>

        <script type="text/javascript">
        var mf_panel_items = { "-1" : { panel_theme: '', template_name: '', parent_page: '', parent_page_title: '' } };
        
        <?php 
        foreach ($items as $key => $value) {
            ?>
 
        mf_panel_items[<?php 
            echo $key;
            ?>
] = <?php 
            echo $value;
            ?>
; 
        <?php 
        }
        ?>
        
        </script>


    <div id="rc-cwp-set-buttons">
      <p><?php 
        _e('Note: Custom fields and groups associated with the selected write panel will be only be displayed once you have saved this page or post.');
        ?>
</p>
      <p><?php 
        _e('Before saving you may also like to set the <strong>Template</strong> and/or <strong>Parent</strong> in the <strong>Page Attributes</strong> panel to match the defaults for the selected write panel (recommended)');
        ?>
</p>
      <div class="inside">
        <input class="button" type="button" id="rc-cwp-set-page-template" value="<?php 
        _e('Set Page Template');
        ?>
" />
        <input class="button" type="button" id="rc-cwp-set-page-parent" value="<?php 
        _e('Set Page Parent');
        ?>
" />
      </div>
      <div class="mf-panel-info">
      <h5 class="mf-hd-panel-info">Defaults for the selected write panel</h5>
      <p>
        Template: <span id="mf-page-template-display"></span><br />
        Parent: <span id="mf-page-parent-display"></span>
      </p>
    </div>
    
  </div>
    <?php 
    }
    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> &nbsp; &nbsp; &nbsp; 
				<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> &nbsp; &nbsp; &nbsp; 
				<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 
        }
        ?>
			</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 
        }
        ?>
			</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" ';
        ?>
 />&nbsp;<?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 
    }