<img name="llock" src="media/style/<?php echo $manager_theme ? "$manager_theme/":""; ?>images/tree/folder.gif" width="18" height="18" onclick="enableLinkSelection(!allowLinkSelection);" style="cursor:pointer;" />
var allowLinkSelection = false;
function enableLinkSelection(b){
parent.tree.ca = "link"; // set the value for the Tree frame to decide what to do when clicked
var closed = "media/style/<?php echo $manager_theme ? "$manager_theme/":""; ?>images/tree/folder.gif";
var opened = "media/style/<?php echo $manager_theme ? "$manager_theme/":""; ?>images/tree/folderopen.gif";
if(b) {
document.images["llock"].src = opened;
allowLinkSelection = true;
}
else {
document.images["llock"].src = closed;
allowLinkSelection = false;
}
}
function setLink(lId) { // gets called from the Tree frame when a document is clicked
if (!allowLinkSelection) {
window.location.href="index.php?a=3&id="+lId; // open document for view as normal
return;
}
else {
documentDirty=true;
document.mutate.ta.value=lId; // put the document ID in the field named ta of the form named mutate
}
}
if(ca=="link") {
try {
parent.main.setLink(id);
} catch(oException) {
alert('<?php echo $_lang['unable_set_link']; ?>');
}
}
case "url": // handles url input fields
$urls= array(''=>'--', 'http://'=>'http://', 'https://'=>'https://', 'ftp://'=>'ftp://', 'mailto:'=>'mailto:');
$field_html = '<script type="text/javascript">
function setTVLink(lId) { // gets called from the Tree frame when a document is clicked
if (!allowLinkSelection) {
window.location.href="index.php?a=3&id="+lId; // open document for view as normal
return;
}
else {
documentDirty=true;
document.mutate.tv'.$field_name.'.value=lId; // put the document ID in the field named ta of the form named mutate
}
}
</script>';
$field_html .='<table border="0" cellspacing="0" cellpadding="0"><tr><td><select id="tv'.$field_name.'_prefix" name="tv'.$field_name.'_prefix" onchange="documentDirty=true; setVariableModified(\''.$field_name.'\');">';
foreach($urls as $k => $v){
if(strpos($field_value,$v)===false) $field_html.='<option value="'.$v.'">'.$k.'</option>';
else{
$field_value = str_replace($v,"",$field_value);
$field_html.='<option value="$v" selected="selected">'.$k.'</option>';
}
}
$field_html .='</select></td><td>';
$field_html .= '<input type="text" id="tv'.$field_name.'" name="tv'.$field_name.'" value="'.htmlspecialchars($field_value).'" width="100" '.$field_style.' onchange="documentDirty=true;setVariableModified(\''.$field_name.'\');" /> <img name="llock" src="media/style/'. ($manager_theme ? "$manager_theme/" : "") .'images/tree/folder.gif" width="18" height="18" onclick="enableLinkSelection(!allowLinkSelection);" style="cursor:pointer;" /> </td></tr></table>';
break;
if(ca=="link") {
parent.main.setTVLink(id);
try {
parent.main.setLink(id);
} catch(oException) {
alert('<?php echo $_lang['unable_set_link']; ?>');
}
}
$tmplvar = $_POST["tv".$row['name']];
if($_POST["tv".$row['name'].'_prefix']!='--') {
$tmplvar = str_replace(array("ftp://","http://"),"",$tmplvar);
$tmplvar = $_POST["tv".$row['name'].'_prefix'].$tmplvar;
}
elseif (is_numeric($_POST["tv".$row['name']]))
{
$tmplvar = (string)$_POST["tv".$row['name']];
}