function Main()
    {
        global $FIELD_TYPES, $mf_domain;
        $customGroupID = $_REQUEST['custom-group-id'];
        ?>
  	
  		<div class="wrap">
	  	
  		<h2><?php 
        _e("Create Custom Field", $mf_domain);
        ?>
</h2>
  		<br class="clear" />
  		<?php 
        if (isset($_GET['err_msg'])) {
            switch ($_GET['err_msg']) {
                case -1:
                    ?>
				<div class="error"><p> <?php 
                    _e('A field with the same name already exists in this write panel. Please choose a different name.', $mf_domain);
                    ?>
</p></div>
				<?php 
            }
        }
        ?>
  			
  		<form action="<?php 
        echo RCCWP_ManagementPage::GetCustomWritePanelGenericUrl('continue-create-custom-field');
        ?>
" method="post" name="create_custom_field_form" id="create-custom-field-form" onsubmit="return checkEmpty();" autocomplete="off">

		<?php 
        if (isset($_GET['custom-group-id']) && !empty($_GET['custom-group-id'])) {
            ?>
  			<input type="hidden" name="custom-group-id" value="<?php 
            echo $_GET['custom-group-id'];
            ?>
">
		<?php 
        }
        ?>
		<?php 
        if (isset($_POST['custom-group-id']) && !empty($_POST['custom-group-id'])) {
            ?>
  			<input type="hidden" name="custom-group-id" value="<?php 
            echo $_POST['custom-group-id'];
            ?>
">
		<?php 
        }
        ?>
		
		
		<table class="form-table" width="100%" border="0" cellspacing="0" cellpadding="6">
		<tbody>
		<tr valign="top">
			<th scope="row"><?php 
        _e("Name", $mf_domain);
        ?>
:</th> 
			<td>  
				<input name="custom-field-name" id="custom-field-name" size="40" type="text" />
				<input type="hidden" id="custom-field-name_hidden" name="custom-field-name_hidden" onchange="copyField();">
				<p>
					<?php 
        _e('Type a unique name for the field, the name must be unique among all fields 
					in this panel. The name of the field is the key by which you can retrieve 
					the field value later.', $mf_domain);
        ?>
					
				</p>
			</td>
		</tr>

		<tr valign="top">
			<th scope="row"><?php 
        _e("Label", $mf_domain);
        ?>
:</th>
			<td>
				<input name="custom-field-description" id="custom-field-description" size="40" type="text" />
				<p>
					<?php 
        _e('Type a label for the field. The label of the field is displayed
					beside the field in Write Panel page.', $mf_domain);
        ?>
				</p>
			</td>
		</tr>
		
		<tr valign="top">
			<th scope="row"><?php 
        _e('Help text', $mf_domain);
        ?>
:</th>
			<td>
				<input name="custom-field-helptext" id="custom-field-helptext" size="40" type="text" /><br/><small><?php 
        _e('If set, this will be displayed in a tooltip next to the field label', $mf_domain);
        ?>
</small></td>
		</tr>
		
		<tr valign="top">
			<th scope="row"><?php 
        _e("Can be duplicated", $mf_domain);
        ?>
:</th>
			<td><input name="custom-field-duplicate" id="custom-field-duplicate" type="checkbox" value="1" <?php 
        echo $custom_field->duplicate == 1 ? "checked" : "";
        ?>
/></td>
		</tr>

		<tr valign="top">
			<th scope="row"><?php 
        _e("Order", $mf_domain);
        ?>
:</th>
			<td><input type="text" name="custom-field-order" id="custom-field-order" size="2" value="0" /></td>
		</tr>
		

		<tr valign="top">
			<th scope="row"><?php 
        _e("Required", $mf_domain);
        ?>
:</th>
			<td>
				<select name="custom-field-required" id="custom-field-required">
					<option value="0" selected="selected"><?php 
        _e('Not Required - can be empty', $mf_domain);
        ?>
</option>
					<option value="1"><?php 
        _e('Required - can not be empty', $mf_domain);
        ?>
</option>
				</select>
			</td>
		</tr>
				
		<tr valign="top">
			<th scope="row"><?php 
        _e("Type", $mf_domain);
        ?>
:</th>
			<td>

				<!-- START :: Javascript for Image/Photo' Css Class and for check -->
				<script type="text/javascript" language="javascript">
					submitForm = false;
					function fun(name)
					{
						if(name == "Image")
						{
							document.getElementById('divLbl').style.display = 'inline';
							document.getElementById('divCSS').style.display = 'inline';
						}
						else
						{
							document.getElementById('divLbl').style.display = 'none';
							document.getElementById('divCSS').style.display = 'none';
						}
					}

					function checkEmpty()
					{
						if (submitForm && (document.getElementById('custom-field-name').value == "" || document.getElementById('custom-field-description').value == "")){
							alert("<?php 
        _e('Please fill in the name and the label of the field', $mf_domain);
        ?>
");	
							return false;
						}
						return true;
						
					}
				</script>
				<!-- END :: Javascript for Image/Photo' Css Class -->

				<?php 
        $field_types = RCCWP_CustomField::GetCustomFieldTypes();
        foreach ($field_types as $field) {
            $checked = $field->name == RCCWP_CustomField::GetDefaultCustomFieldType() ? 'checked="checked"' : '';
            ?>
					<label><input name="custom-field-type" value="<?php 
            echo $field->id;
            ?>
" type="radio" <?php 
            echo $checked;
            ?>
 onclick='fun("<?php 
            echo $field->name;
            ?>
");' /> <!-- Calling Javascript Function -->
					<?php 
            echo $field->name;
            ?>
</label><br />
				<?php 
        }
        ?>
			</td>
		</tr>
		<!-- START :: For Image/Photo' Css -->
		<tr valign="top">
			<th scope="row"><div id="divLbl" style="display:none"><?php 
        _e('Css Class', $mf_domain);
        ?>
:</div></th>
			<td>
				<div id="divCSS" style="display:none">
				<input name="custom-field-css" id="custom-field-css" size="40" type="text" value="magicfields" />
				</div>
			</td>
		</tr>
		<!-- END :: For Image/Photo' Css -->
		</tbody>
		</table>
		
		
	  	<p class="submit" >
  			<a style="color:black" href="<?php 
        echo RCCWP_ManagementPage::GetCustomWritePanelGenericUrl('cancel-create-custom-field') . "&custom-group-id={$customGroupID}";
        ?>
" class="button"><?php 
        _e('Cancel', $mf_domain);
        ?>
</a>
  			<input type="submit" id="continue-create-custom-field" value='<?php 
        _e("Continue", $mf_domain);
        ?>
'  onclick="submitForm=true;"/>
  		</p>
	  	
  		</form>
	  	
  		</div>
	  	
  		<?php 
    }
Ejemplo n.º 2
0
    function create_layout_element()
    {
        global $flutter_domain;
        ?>
          <div class="wrap">
            <h2><?php 
        _e('Create a new layout Setting', $flutter_domain);
        ?>
</h2>
            <br/>
            <form method="post" action="?page=RCCWP_ThemeSettingsPage&flutter_action=create-layout-setting&save=true">
            <table class="form-table" width="100%" border="0" cellspacing="0" cellpadding="6">
                <tbody>
                    <tr valing="top">
                        <th><?php 
        _e('Name', $flutter_domain);
        ?>
</th>
                        <td>
                            <input type="text" name="variable_name"/>
                        </td>
                    </tr>
                    <tr valing="top">
                        <th><?php 
        _e('Description', $flutter_domain);
        ?>
</th>
                        <td>
                            <textarea name="description"></textarea>
                        </td>
                    </tr> 
                    <tr valing="top">
                        <th><?php 
        _e('Type', $flutter_domain);
        ?>
</th>
                        <td>
                             <?php 
        $field_types = RCCWP_CustomField::GetCustomFieldTypes();
        foreach ($field_types as $field) {
            $checked = $field->name == RCCWP_CustomField::GetDefaultCustomFieldType() ? 'checked="checked"' : '';
            ?>
 
                             <label><input name="custom-field-type" value="<?php 
            echo $field->id;
            ?>
" type="radio" <?php 
            echo $checked;
            ?>
 >
                             <?php 
            echo $field->name;
            ?>
</label><br />
                             <?php 
        }
        ?>

                        </td>
                    </tr>
                    <tr>
                        <th></th>
                        <td>
                            <input type="submit" id="continue-create-custom-field" value="<?php 
        _e('Create', $flutter_domain);
        ?>
"  onclick="submitForm=true;"/>
                        </td>
                    </tr> 
               </tbody> 
            </form>        
             <p class="submit" >
             </p>
          </div>
<?php 
    }