Skip to content
Permalink
Browse files

Changing link dialog and adding new select color dialog.

  • Loading branch information...
julmis
julmis committed May 16, 2004
1 parent 2d33fc0 commit 1665e6c80d06fa30c537f4e94dd17287db148565
@@ -18,7 +18,7 @@
optional_variable($file, "");
optional_variable($wdir, "");
optional_variable($action, "");
optional_variable($usecheckboxes, "");
optional_variable($usecheckboxes, true);
if (! $course = get_record("course", "id", $id) ) {
error("That's an invalid course id");
@@ -77,10 +77,14 @@ function set_value(params) {
for(field in params) {
var value = params[field];
switch(field) {
case "url" : upper.document.getElementById('f_href').value = value; break;
case "imodified" : upper.document.getElementById('imodified').value = value; break;
case "isize" : upper.document.getElementById('isize').value = value; break;
case "itype" : upper.document.getElementById('itype').value = value; break;
case "url" :
//upper.document.getElementById('f_href').value = value;
upper.opener.document.getElementById('f_href').value = value;
upper.close();
break;
//case "imodified" : upper.document.getElementById('imodified').value = value; break;
//case "isize" : upper.document.getElementById('isize').value = value; break;
//case "itype" : upper.document.getElementById('itype').value = value; break;
}
}
}
@@ -38,20 +38,20 @@ Dialog._modal = null;
Dialog._arguments = null;

Dialog._geckoOpenModal = function(url, action, init) {

if(url.lastIndexOf("insert_image.php") != -1) {
var x = 730;
var y = 540;
} else if (url.lastIndexOf("link.php") != -1) {
var x = 700;
var y = 460;
} else if (url.lastIndexOf("link_std.php") != -1) {
var x = 400;
var y = 180;
} else if (url.lastIndexOf("dlg_ins_smile.php") != -1) {
var x = 330;
var y = 360;
} else if (url.lastIndexOf("dlg_ins_char.php") != -1) {
var x = 450;
var y = 270;
} else if (url.lastIndexOf("select_color.html") != -1) {
} else if (url.lastIndexOf("select_color.php") != -1) {
var x = 238;
var y = 188;
} else if (url.lastIndexOf("insert_table.php") != -1) {
@@ -67,7 +67,7 @@ Dialog._geckoOpenModal = function(url, action, init) {
var x = 10;
var y = 10;
}

var lx = (screen.width - x) / 2;
var tx = (screen.height - y) / 2;
var dlg = window.open(url, "ha_dialog", "toolbar=no,menubar=no,personalbar=no, width="+ x +",height="+ y +",scrollbars=no,resizable=no, left="+ lx +", top="+ tx +"");
@@ -1428,12 +1428,7 @@ function (str, l1, l2, l3) {
f_title : link.title,
f_target : link.target
};
this._popupDialog("<?php
if(isteacher($id)) {
echo "link.php?id=$id";
} else {
echo "link_std.php?id=$id";
}?>", function(param) {
this._popupDialog("link_std.php?id=<?php echo $id; ?>", function(param) {
if (!param)
return false;
var a = link;
@@ -1676,7 +1671,7 @@ function (str, l1, l2, l3) {
case "hilitecolor":
(HTMLArea.is_ie) && (cmdID = "backcolor");
case "forecolor":
this._popupDialog("select_color.html", function(color) {
this._popupDialog("select_color.php", function(color) {
if (color) { // selection not canceled
editor._doc.execCommand(cmdID, false, "#" + color);
}
@@ -14,85 +14,12 @@
<head>
<title><?php print_string("insertlink","editor");?></title>
<meta http-equiv="Content-Type" content="text/html; <?php print_string("thischarset");?>">
<script type="text/javascript" src="popup.js"></script>
<script language="JavaScript" type="text/javascript">
//I18N = window.opener.HTMLArea.I18N.dialogs;
// function i18n(str) {
// return (I18N[str] || str);
// };
function onTargetChanged() {
/*
// commented out since it does not work!!!
var f = document.getElementById("f_other_target");
if (this.value == "_other") {
f.style.visibility = "visible";
f.select();
f.focus();
} else f.style.visibility = "hidden";
*/};
function Init() {
//__dlg_translate(I18N);
__dlg_init();
var param = window.dialogArguments;
var target_select = document.getElementById("f_target");
if (param) {
document.getElementById("f_href").value = param["f_href"];
document.getElementById("f_title").value = param["f_title"];
//comboSelectValue(target_select, param["f_target"]);
if (target_select.value != param.f_target) {
var opt = document.createElement("option");
opt.value = param.f_target;
opt.innerHTML = opt.value;
target_select.appendChild(opt);
opt.selected = true;
}
} else {
document.getElementById("f_href").value = "http://";
}
var opt = document.createElement("option");
opt.value = "_other";
opt.innerHTML = "<?php print_string("linktargetother","editor");?>";
target_select.appendChild(opt);
target_select.onchange = onTargetChanged;
document.getElementById("f_href").focus();
window.focus();
document.getElementById("f_href").select();
};
function onOK() {
var required = {
"f_href": "You must enter the URL where this link points to"
};
for (var i in required) {
var el = document.getElementById(i);
if (!el.value) {
alert(required[i]);
el.focus();
return false;
}
}
// pass data back to the calling window
var fields = ["f_href", "f_title", "f_target" ];
var param = new Object();
for (var i in fields) {
var id = fields[i];
var el = document.getElementById(id);
param[id] = el.value;
}
if (param.f_target == "_other")
param.f_target = document.getElementById("f_other_target").value;
__dlg_close(param);
return false;
};
function onCancel() {
__dlg_close(null);
window.close();
return false;
};
function checkvalue(elm,formname) {
var el = document.getElementById(elm);
if(!el.value) {
@@ -119,11 +46,7 @@ function submit_form(dothis) {
</script>
<style type="text/css">
html, body {
width: 700;
height: 460;
background-color: rgb(212,208,200);
}
html, body { background-color: rgb(212,208,200); }
.title {
background-color: #ddddff;
padding: 5px;
@@ -135,19 +58,11 @@ function submit_form(dothis) {
}
input,select { font-family: Tahoma, sans-serif; font-size: 11px; }
legend { font-family: Tahoma, sans-serif; font-size: 11px; }
p {
margin-left: 10px;
background-color: transparent;
font-family: Tahoma, sans-serif;
font-size: 11px;
color: black;
}
p { margin-left: 10px;
background-color: transparent; font-family: Tahoma, sans-serif;
font-size: 11px; color: black; }
td { font-family: Tahoma, sans-serif; font-size: 11px; }
button {
width: 70px;
font-family: Tahoma, sans-serif;
font-size: 11px;
}
button { width: 70px; font-family: Tahoma, sans-serif; font-size: 11px; }
#imodified,#itype,#isize {
background-color: rgb(212,208,200);
border: none;
@@ -160,11 +75,11 @@ function submit_form(dothis) {
</style>
</head>

<body onload="Init()">
<body>
<div class="title"><?php print_string("insertlink","editor");?></div>
<table width="660" border="0" cellspacing="0" cellpadding="2">
<table width="450" border="0" cellspacing="0" cellpadding="2">
<tr>
<td width="380" valign="top"><fieldset>
<td width="450" valign="top"><fieldset>
<legend><?php
if(isteacher($id)) {
print_string("filebrowser","editor");
@@ -174,68 +89,18 @@ function submit_form(dothis) {

<div class="space"></div>
<?php print(isteacher($id))?
"<iframe id=\"fbrowser\" name=\"fbrowser\" src=\"../coursefiles.php?id=".$course->id."\" width=\"360\" height=\"260\"></iframe>":
"<iframe id=\"fbrowser\" name=\"fbrowser\" src=\"../coursefiles.php?id=".$course->id."\" width=\"420\" height=\"180\"></iframe>":
""; ?>
<p>
</p>
<div class="space"></div>
</fieldset>&nbsp;</td>
<td width="300" valign="top">
<form name="mainform">
<fieldset>
<legend><?php print_string("properties","editor");?></legend>
<div class="space"></div>
<table width="298" border="0">
<tr>
<td width="35" align="right"><?php print_string("modified");?>:</td>
<td align="left"><input id="imodified" type="text" name="imodified" size="40"></td>
</tr>
<tr>
<td width="35" align="right"><?php print_string("type","editor");?>:</td>
<td align="left"><input id="itype" type="text" name="itype" size="40"></td>
</tr>
<tr>
<td width="35" align="right"><?php print_string("size","editor");?>:</td>
<td align="left"><input id="isize" type="text" name="isize" size="40"></td>
</tr>
</table>
<br>
</fieldset>
<fieldset><legend><?php print_string("linkproperties","editor");?></legend>
<br>
<table width="82%" border="0">
<tr>
<td width="35" align="right"><?php print_string("linkurl","editor");?>:</td>
<td><input id="f_href" type="text" name="f_href" size="40"></td>
</tr>
<tr>
<td width="35" align="right"><?php print_string("linktitle","editor");?>:</td>
<td><input id="f_title" type="text" name="f_title" size="40"></td>
</tr>
<tr>
<td width="35" align="right"><?php print_string("linktarget","editor");?>:</td>
<td><select id="f_target" name="f_target">
<option value=""><?php print_string("linktargetnone","editor");?></option>
<option value="_blank"><?php print_string("linktargetblank","editor");?></option>
<option value="_self"><?php print_string("linktargetself","editor");?></option>
<option value="_top"><?php print_string("linktargettop","editor");?></option>
</select></td>
</tr>
</table>
<div class="space"></div>
<table width="78%" border="0" cellspacing="0" cellpadding="2">
<tr>
<td align="right" valign="middle"><button name="btnOk" onclick="return onOK();"><?php print_string("ok","editor");?></button>&nbsp;
<button name="btnCancel" onclick="return onCancel();"><?php print_string("cancel","editor");?></button></td>
</tr>
</table>
<div class="space"></div>
</fieldset>
</form>
</td>
</tr>
</table>
<table border="0" cellpadding="2" cellspacing="0">
<table width="100%" border="0" cellpadding="0" cellspacing="0">
<tr>
<td>
<table border="0" cellpadding="2" cellspacing="0">
<tr><td><?php print_string("selection","editor");?>: </td>
<td><form name="idelete" id="idelete">
<input name="btnDelete" type="submit" id="btnDelete" value="<?php print_string("delete","editor");?>" onclick="return submit_form('delete');"></form></td>
@@ -249,7 +114,14 @@ function submit_form(dothis) {
<input type="hidden" name="file" value="">
<input type="hidden" name="action" value="rename">
<input name="btnRename" type="submit" id="btnRename" value="<?php print_string("rename","editor");?>"></form></td>
</tr></table>
</tr>
</table>
</td>
<td>
<button type="button" name="close" onclick="return onCancel();"><?php print_string("close","editor");?></button>
</td>
</tr>
</table>
<table border="0" cellpadding="1" cellspacing="1">
<tr>
<td height="22"><?php
@@ -16,13 +16,6 @@
<title><?php print_string("insertlink","editor");?></title>
<script type="text/javascript" src="popup.js"></script>
<script type="text/javascript">
window.resizeTo(400, 200);
//I18N = window.opener.HTMLArea.I18N.dialogs;
//function i18n(str) {
// return (I18N[str] || str);
//};
function onTargetChanged() {
var f = document.getElementById("f_other_target");
@@ -41,7 +34,7 @@ function Init() {
if (param) {
document.getElementById("f_href").value = param["f_href"];
document.getElementById("f_title").value = param["f_title"];
comboSelectValue(target_select, param["f_target"]);
//comboSelectValue(target_select, param["f_target"]);
if (target_select.value != param.f_target) {
var opt = document.createElement("option");
opt.value = param.f_target;
@@ -92,22 +85,37 @@ function onCancel() {
return false;
};
function onBrowse() {
var lx = (screen.width - 470) / 2;
var tx = (screen.height - 400) / 2;
var settings = "toolbar=no,";
settings += " location=no,";
settings += " directories=no,";
settings += " status=no,";
settings += " menubar=no,";
settings += " scrollbars=no,";
settings += " resizable=no,";
settings += " width=470,";
settings += " height=400,";
var newwin = window.open("link.php?id=<?php echo $id; ?>","",""+ settings +" left="+ lx +", top="+ tx +"");
return false;
}
</script>

<style type="text/css">
html, body {
width: 400;
height: 200;
width: 400px;
height: 180px;
background: ButtonFace;
color: ButtonText;
font: 11px Tahoma,Verdana,sans-serif;
margin: 0px;
padding: 0px;
}
body { padding: 5px; }
table {
font: 11px Tahoma,Verdana,sans-serif;
}
table { font: 11px Tahoma,Verdana,sans-serif; }
select, input, button { font: 11px Tahoma,Verdana,sans-serif; }
button { width: 70px; }
table .label { text-align: right; width: 8em; }
@@ -150,6 +158,7 @@ function onCancel() {
</table>

<div id="buttons">
<?php print(isteacher($id))? "<button type=\"button\" name=\"browse\" onclick=\"return onBrowse();\">Browse</button>" : ""; ?>
<button type="button" name="ok" onclick="return onOK();"><?php print_string("ok","editor");?></button>
<button type="button" name="cancel" onclick="return onCancel();"><?php print_string("cancel","editor");?></button>
</div>

0 comments on commit 1665e6c

Please sign in to comment.
You can’t perform that action at this time.