コード例 #1
0
ファイル: view.php プロジェクト: chandradrupal/resourcespace
            }
            ?>
</p></div><?php 
        }
        ?>
	<?php 
    }
}
// end hook replacecontributedby
# Show field data
$tabname = "";
$tabcount = 0;
$fieldcount = 0;
$extra = "";
for ($n = 0; $n < count($fields); $n++) {
    $displaycondition = check_display_condition($fields, $n);
    if ($displaycondition) {
        if (!hook("renderfield")) {
            display_field_data($fields[$n]);
        }
    }
}
hook("extrafields2");
?>
<div class="clearerleft"></div>
<?php 
echo $extra;
?>
</div>
</div>
<?php 
コード例 #2
0
ファイル: edit.php プロジェクト: claytondaley/resourcespace
function display_field($n, $field, $newtab = false)
{
    global $use, $ref, $original_fields, $multilingual_text_fields, $multiple, $lastrt, $is_template, $language, $lang, $blank_edit_template, $edit_autosave, $errors, $tabs_on_edit, $collapsible_sections, $ctrls_to_save, $embedded_data_user_select, $embedded_data_user_select_fields;
    $name = "field_" . $field["ref"];
    $value = $field["value"];
    $value = trim($value);
    if ($field["omit_when_copying"] && $use != $ref) {
        # Omit when copying - return this field back to the value it was originally, instead of using the current value which has been fetched from the new resource.
        reset($original_fields);
        foreach ($original_fields as $original_field) {
            if ($original_field["ref"] == $field["ref"]) {
                $value = $original_field["value"];
            }
        }
    }
    $displaycondition = true;
    if ($field["display_condition"] != "") {
        #Check if field has a display condition set
        $displaycondition = check_display_condition($n, $field);
    }
    if ($multilingual_text_fields) {
        # Multilingual text fields - find all translations and display the translation for the current language.
        $translations = i18n_get_translations($value);
        if (array_key_exists($language, $translations)) {
            $value = $translations[$language];
        } else {
            $value = "";
        }
    }
    if ($multiple) {
        $value = "";
    }
    # Blank the value for multi-edits.
    if ($field["resource_type"] != $lastrt && $lastrt != -1 && $collapsible_sections) {
        ?>
</div><h2 class="CollapsibleSectionHead" id="resource_type_properties"><?php 
        echo htmlspecialchars(get_resource_type_name($field["resource_type"]));
        ?>
 <?php 
        echo $lang["properties"];
        ?>
</h2><div class="CollapsibleSection" id="ResourceProperties<?php 
        if ($ref == -1) {
            echo "Upload";
        }
        echo $field["resource_type"];
        ?>
Section"><?php 
    }
    $lastrt = $field["resource_type"];
    # Blank form if 'reset form' has been clicked.
    if (getval("resetform", "") != "") {
        $value = "";
    }
    # If config option $blank_edit_template is set, always show a blank form for user edit templates.
    if ($ref < 0 && $blank_edit_template && getval("submitted", "") == "") {
        $value = "";
    }
    ?>
	<?php 
    if ($multiple && !hook("replace_edit_all_checkbox", "", array($field["ref"]))) {
        # Multiple items, a toggle checkbox appears which activates the question
        ?>
<div class="edit_multi_checkbox"><input name="editthis_<?php 
        echo htmlspecialchars($name);
        ?>
" id="editthis_<?php 
        echo $n;
        ?>
" type="checkbox" value="yes" onClick="var q=document.getElementById('question_<?php 
        echo $n;
        ?>
');var m=document.getElementById('modeselect_<?php 
        echo $n;
        ?>
');var f=document.getElementById('findreplace_<?php 
        echo $n;
        ?>
');if (this.checked) {q.style.display='block';m.style.display='block';} else {q.style.display='none';m.style.display='none';f.style.display='none';document.getElementById('modeselectinput_<?php 
        echo $n;
        ?>
').selectedIndex=0;}">&nbsp;<label for="editthis<?php 
        echo $n;
        ?>
"><?php 
        echo htmlspecialchars($field["title"]);
        ?>
</label></div><!-- End of edit_multi_checkbox --><?php 
    }
    ?>

	<?php 
    if ($multiple && !hook("replace_edit_all_mode_select", "", array($field["ref"]))) {
        # When editing multiple, give option to select Replace All Text or Find and Replace
        ?>
		<div class="Question" id="modeselect_<?php 
        echo $n;
        ?>
" style="display:none;padding-bottom:0;margin-bottom:0;">
		<label for="modeselectinput"><?php 
        echo $lang["editmode"];
        ?>
</label>
		<select id="modeselectinput_<?php 
        echo $n;
        ?>
" name="modeselect_<?php 
        echo $field["ref"];
        ?>
" class="stdwidth" onChange="var fr=document.getElementById('findreplace_<?php 
        echo $n;
        ?>
');var q=document.getElementById('question_<?php 
        echo $n;
        ?>
');if (this.value=='FR') {fr.style.display='block';q.style.display='none';} else {fr.style.display='none';q.style.display='block';}<?php 
        hook("edit_all_mode_js");
        ?>
">
		<option value="RT"><?php 
        echo $lang["replacealltext"];
        ?>
</option>
		<?php 
        if (in_array($field["type"], array("0", "1", "5", "8"))) {
            # Find and replace appies to text boxes only.
            ?>
		<option value="FR"><?php 
            echo $lang["findandreplace"];
            ?>
</option>
		<?php 
        }
        ?>
		<?php 
        if ($field["type"] == 0 || $field["type"] == 1 || $field["type"] == 5) {
            # Prepend applies to text boxes only.
            ?>
		<option value="PP"><?php 
            echo $lang["prependtext"];
            ?>
</option>
		<?php 
        }
        if (in_array($field["type"], array("0", "1", "2", "3", "5", "7", "8", "9"))) {
            # Append applies to text boxes, checkboxes ,category tree and dropdowns only.
            ?>
		<option value="AP"><?php 
            echo $lang["appendtext"];
            ?>
</option>
		<?php 
        }
        if ($field["type"] == 0 || $field["type"] == 1 || $field["type"] == 5 || $field["type"] == 2 || $field["type"] == 3) {
            ?>
		<!--- Remove applies to text boxes, checkboxes and dropdowns only. -->
		<option value="RM"><?php 
            echo $lang["removetext"];
            ?>
</option>
		<?php 
        }
        ?>
		<?php 
        hook("edit_all_extra_modes");
        ?>
		</select>
		</div><!-- End of modeselect_<?php 
        echo $n;
        ?>
 -->

		<div class="Question" id="findreplace_<?php 
        echo $n;
        ?>
" style="display:none;border-top:none;">
		<label>&nbsp;</label>
		<?php 
        echo $lang["find"];
        ?>
 <input type="text" name="find_<?php 
        echo $field["ref"];
        ?>
" class="shrtwidth">
		<?php 
        echo $lang["andreplacewith"];
        ?>
 <input type="text" name="replace_<?php 
        echo $field["ref"];
        ?>
" class="shrtwidth">
		</div><!-- End of findreplace_<?php 
        echo $n;
        ?>
 -->
		
		<?php 
        hook("edit_all_after_findreplace", "", array($field, $n));
        ?>
		<?php 
    }
    ?>

	<div class="Question" id="question_<?php 
    echo $n;
    ?>
" <?php 
    if ($multiple || !$displaycondition || $newtab) {
        ?>
style="border-top:none;<?php 
        if ($multiple || !$displaycondition) {
            ?>
			display:none;
			<?php 
        }
    }
    ?>
">
		<?php 
    $labelname = $name;
    // Add _selector to label so it will keep working:
    if ($field['type'] == 9) {
        $labelname .= '_selector';
    }
    // Add -d to label so it will keep working
    if ($field['type'] == 4) {
        $labelname .= '-d';
    }
    ?>
	<label for="<?php 
    echo htmlspecialchars($labelname);
    ?>
" ><?php 
    if (!$multiple) {
        echo htmlspecialchars($field["title"]);
        ?>
 <?php 
        if (!$is_template && $field["required"] == 1) {
            ?>
<sup>*</sup><?php 
        }
    }
    ?>
</label>

	<?php 
    # Autosave display
    if ($edit_autosave || $ctrls_to_save) {
        ?>
	<div class="AutoSaveStatus" id="AutoSaveStatus<?php 
        echo $field["ref"];
        ?>
" style="display:none;"></div>
	<?php 
    }
    ?>


	<?php 
    # Define some Javascript for help actions (applies to all fields)
    $help_js = "onBlur=\"HideHelp(" . $field["ref"] . ");return false;\" onFocus=\"ShowHelp(" . $field["ref"] . ");return false;\"";
    #hook to modify field type in special case. Returning zero (to get a standard text box) doesn't work, so return 1 for type 0, 2 for type 1, etc.
    $modified_field_type = "";
    $modified_field_type = hook("modifyfieldtype");
    if ($modified_field_type) {
        $field["type"] = $modified_field_type - 1;
    }
    hook("addfieldextras");
    # ----------------------------  Show field -----------------------------------
    $type = $field["type"];
    if ($type == "") {
        $type = 0;
    }
    # Default to text type.
    if (!hook("replacefield", "", array($field["type"], $field["ref"], $n))) {
        global $auto_order_checkbox;
        include "edit_fields/" . $type . ".php";
    }
    # ----------------------------------------------------------------------------
    # Display any error messages from previous save
    if (array_key_exists($field["ref"], $errors)) {
        ?>
		<div class="FormError">!! <?php 
        echo $errors[$field["ref"]];
        ?>
 !!</div>
		<?php 
    }
    if (trim($field["help_text"] != "")) {
        # Show inline help for this field.
        # For certain field types that have no obvious focus, the help always appears.
        ?>
		<div class="FormHelp" style="padding:0;<?php 
        if (!in_array($field["type"], array(2, 4, 6, 7, 10))) {
            ?>
 display:none;<?php 
        } else {
            ?>
 clear:left;<?php 
        }
        ?>
" id="help_<?php 
        echo $field["ref"];
        ?>
"><div class="FormHelpInner"><?php 
        echo nl2br(trim(htmlspecialchars(i18n_get_translated($field["help_text"], false))));
        ?>
</div></div>
		<?php 
    }
    # If enabled, include code to produce extra fields to allow multilingual free text to be entered.
    if ($multilingual_text_fields && ($field["type"] == 0 || $field["type"] == 1 || $field["type"] == 5)) {
        display_multilingual_text_field($n, $field, $translations);
    }
    if ($embedded_data_user_select || isset($embedded_data_user_select_fields) && in_array($field["ref"], $embedded_data_user_select_fields)) {
        ?>
		<table id="exif_<?php 
        echo $field["ref"];
        ?>
" class="ExifOptions" cellpadding="3" cellspacing="3" <?php 
        if ($embedded_data_user_select) {
            ?>
 style="display: none;" <?php 
        }
        ?>
>                    
			<tbody>
				<tr>		
					<td>
					<?php 
        echo "&nbsp;&nbsp;" . $lang["embeddedvalue"] . ": ";
        ?>
					</td>
					<td width="10" valign="middle">
						<input type="radio" id="exif_extract_<?php 
        echo $field["ref"];
        ?>
" name="exif_option_<?php 
        echo $field["ref"];
        ?>
" value="yes" checked>
					</td>
					<td align="left" valign="middle">
						<label class="customFieldLabel" for="exif_extract_<?php 
        echo $field["ref"];
        ?>
"><?php 
        echo $lang["embedded_metadata_extract_option"];
        ?>
</label>
					</td>
		
							
					<td width="10" valign="middle">
						<input type="radio" id="no_exif_<?php 
        echo $field["ref"];
        ?>
" name="exif_option_<?php 
        echo $field["ref"];
        ?>
" value="no">
					</td>
					<td align="left" valign="middle">
						<label class="customFieldLabel" for="no_exif_<?php 
        echo $field["ref"];
        ?>
"><?php 
        echo $lang["embedded_metadata_donot_extract_option"];
        ?>
</label>
					</td>
		
							
					<td width="10" valign="middle">
						<input type="radio" id="exif_append_<?php 
        echo $field["ref"];
        ?>
" name="exif_option_<?php 
        echo $field["ref"];
        ?>
" value="append">
					</td>
					<td align="left" valign="middle">
						<label class="customFieldLabel" for="exif_append_<?php 
        echo $field["ref"];
        ?>
"><?php 
        echo $lang["embedded_metadata_append_option"];
        ?>
</label>
					</td>
		
							
					<td width="10" valign="middle">
						<input type="radio" id="exif_prepend_<?php 
        echo $field["ref"];
        ?>
" name="exif_option_<?php 
        echo $field["ref"];
        ?>
" value="prepend">
					</td>
					<td align="left" valign="middle">
						<label class="customFieldLabel" for="exif_prepend_<?php 
        echo $field["ref"];
        ?>
"><?php 
        echo $lang["embedded_metadata_prepend_option"];
        ?>
</label>
					</td>
					
							</tr>
			</tbody>
		</table>		
		<?php 
    }
    ?>
	<div class="clearerleft"> </div>
	</div><!-- end of question_<?php 
    echo $n;
    ?>
 div -->
	<?php 
    hook('afterfielddisplay', '', array($n, $field));
}
コード例 #3
0
ファイル: edit2.php プロジェクト: artsmia/mia_resourcespace
function display_field($n, $field, $newtab=false){
	global $use, $ref, $original_fields, $multilingual_text_fields, $multiple, $lastrt,$is_template, $language, $lang, $blank_edit_template, $edit_autosave, $errors, $tabs_on_edit,$collapsible_sections, $ctrls_to_save, $embedded_data_user_select, $embedded_data_user_select_fields;
	$name="field_" . $field["ref"];
	$value=$field["value"];
	$value=trim($value);

	if ($field["omit_when_copying"] && $use!=$ref){
		# Omit when copying - return this field back to the value it was originally, instead of using the current value which has been fetched from the new resource.
		reset($original_fields);
		foreach ($original_fields as $original_field){
			if ($original_field["ref"]==$field["ref"]) {$value=$original_field["value"];}
		}
	}
	$displaycondition=true;
	if ($field["display_condition"]!=""){
	    #Check if field has a display condition set
	    $displaycondition=check_display_condition($n,$field);
	}
	if ($multilingual_text_fields){
	    # Multilingual text fields - find all translations and display the translation for the current language.
	    $translations=i18n_get_translations($value);
	    if (array_key_exists($language,$translations)) {$value=$translations[$language];} else {$value="";}
	}
	if ($multiple) {$value="";} # Blank the value for multi-edits.
        if ($field["resource_type"]!=$lastrt && $lastrt!=-1 && $collapsible_sections){?>
            </div><h2 class="CollapsibleSectionHead" id="resource_type_properties">
            <?php echo htmlspecialchars(get_resource_type_name($field["resource_type"]))?> <?php echo $lang["properties"]?></h2><div class="CollapsibleSection" id="ResourceProperties<?php if ($ref==-1) echo "Upload"; ?>
            <?php echo $field["resource_type"]; ?>Section"><?php
        }

	$lastrt=$field["resource_type"];
	# Blank form if 'reset form' has been clicked.
	if (getval("resetform","")!="") {$value="";}

	# If config option $blank_edit_template is set, always show a blank form for user edit templates.
	if ($ref<0 && $blank_edit_template && getval("submitted","")=="") {$value="";}
	if ($multiple && !hook("replace_edit_all_checkbox","",array($field["ref"]))) { # Multiple items, a toggle checkbox appears which activates the question
	?><div class="edit_multi_checkbox"><input name="editthis_<?php echo htmlspecialchars($name)?>" id="editthis_<?php echo $n?>" type="checkbox" value="yes" onClick="var q=document.getElementById('question_<?php echo $n?>');var m=document.getElementById('modeselect_<?php echo $n?>');var f=document.getElementById('findreplace_<?php echo $n?>');if (this.checked) {q.style.display='block';m.style.display='block';} else {q.style.display='none';m.style.display='none';f.style.display='none';document.getElementById('modeselectinput_<?php echo $n?>').selectedIndex=0;}">&nbsp;<label for="editthis<?php echo $n?>"><?php echo htmlspecialchars($field["title"])?></label></div><!-- End of edit_multi_checkbox --><?php } ?>

	<div class="Question" id="question_<?php echo $n?>" <?php
	if ($multiple || !$displaycondition || $newtab)
		{?>style="border-top:none;<?php
		if ($multiple || !$displaycondition){?>display:none;<?php }
		}
		?>">
		<?php
			$labelname = $name;
			// Add _selector to label so it will keep working:
			if($field['type'] == 9) {
				$labelname .= '_selector';
			}

			// Add -d to label so it will keep working
			if($field['type'] == 4) {
				$labelname .= '-d';
			}
		?>
	<label for="<?php echo htmlspecialchars($labelname)?>" >
	<?php if (!$multiple) {?><?php echo htmlspecialchars($field["title"])?>
	<?php if (!$is_template && $field["required"]==1) { ?><sup>*</sup><?php } ?><?php } ?>
	</label>

	<?php
	# Define some Javascript for help actions (applies to all fields)
	$help_js="onBlur=\"HideHelp(" . $field["ref"] . ");return false;\" onFocus=\"ShowHelp(" . $field["ref"] . ");return false;\"";

	#hook to modify field type in special case. Returning zero (to get a standard text box) doesn't work, so return 1 for type 0, 2 for type 1, etc.
	$modified_field_type="";
	$modified_field_type=(hook("modifyfieldtype"));
	if ($modified_field_type){$field["type"]=$modified_field_type-1;}

	hook("addfieldextras");
	# ----------------------------  Show field -----------------------------------
	$type=$field["type"];
	if ($type=="") {$type=0;} # Default to text type.
	if (!hook("replacefield","",array($field["type"],$field["ref"],$n)))
		{
		global $auto_order_checkbox;
		include "edit_fields/" . $type . ".php";
		}
	# ----------------------------------------------------------------------------

	# Display any error messages from previous save
	if (array_key_exists($field["ref"],$errors))
		{
		?>
		<div class="FormError">!! <?php echo $errors[$field["ref"]]?> !!</div>
		<?php
		}

	if (trim($field["help_text"]!=""))
		{
		# Show inline help for this field.
		# For certain field types that have no obvious focus, the help always appears.
		?>
                <div class="FormHelp-selector" onmouseenter="ShowHelp(<?php echo $field["ref"] ?>); return false;" onmouseleave="HideHelp(<?php echo $field["ref"]?>)"><em>i</em></div>
		<div class="FormHelp" style="padding:0; display:none;" id="help_<?php echo $field["ref"]?>">
                <div class="FormHelpInner"><?php echo nl2br(trim(htmlspecialchars(i18n_get_translated($field["help_text"],false))))?></div></div>
		<?php
		}

	# If enabled, include code to produce extra fields to allow multilingual free text to be entered.
	if ($multilingual_text_fields && ($field["type"]==0 || $field["type"]==1 || $field["type"]==5))
		{
		display_multilingual_text_field($n, $field, $translations);
		}
		?>
	<div class="clearerleft"> </div>
	</div><!-- end of question_<?php echo $n?> div -->
	<?php
	hook('afterfielddisplay', '', array($n, $field));
	}