| 1 | <html> |
|---|
| 2 | |
|---|
| 3 | <head> |
|---|
| 4 | <title>Insert/Modify Link</title> |
|---|
| 5 | <script type="text/javascript" src="../../popups/popup.js"></script> |
|---|
| 6 | <link rel="stylesheet" type="text/css" href="../../popups/popup.css" /> |
|---|
| 7 | |
|---|
| 8 | <script type="text/javascript"> |
|---|
| 9 | window.resizeTo(400, 200); |
|---|
| 10 | |
|---|
| 11 | Xinha = window.opener.Xinha; |
|---|
| 12 | |
|---|
| 13 | function i18n(str) { |
|---|
| 14 | return (Xinha._lc(str, 'Xinha')); |
|---|
| 15 | } |
|---|
| 16 | |
|---|
| 17 | function onTargetChanged() { |
|---|
| 18 | var f = document.getElementById("f_other_target"); |
|---|
| 19 | if (this.value == "_other") { |
|---|
| 20 | f.style.visibility = "visible"; |
|---|
| 21 | f.select(); |
|---|
| 22 | f.focus(); |
|---|
| 23 | } else f.style.visibility = "hidden"; |
|---|
| 24 | } |
|---|
| 25 | |
|---|
| 26 | function Init() { |
|---|
| 27 | __dlg_translate('Xinha'); |
|---|
| 28 | __dlg_init(); |
|---|
| 29 | |
|---|
| 30 | |
|---|
| 31 | document.getElementById("f_target").selectedIndex = 1; |
|---|
| 32 | document.getElementById("f_target").selectedIndex = 0; |
|---|
| 33 | |
|---|
| 34 | var param = window.dialogArguments; |
|---|
| 35 | var target_select = document.getElementById("f_target"); |
|---|
| 36 | var use_target = true; |
|---|
| 37 | if (param) { |
|---|
| 38 | if ( typeof param["f_usetarget"] != "undefined" ) { |
|---|
| 39 | use_target = param["f_usetarget"]; |
|---|
| 40 | } |
|---|
| 41 | if ( typeof param["f_href"] != "undefined" ) { |
|---|
| 42 | document.getElementById("f_href").value = param["f_href"]; |
|---|
| 43 | document.getElementById("f_title").value = param["f_title"]; |
|---|
| 44 | comboSelectValue(target_select, param["f_target"]); |
|---|
| 45 | if (target_select.value != param.f_target) { |
|---|
| 46 | var opt = document.createElement("option"); |
|---|
| 47 | opt.value = param.f_target; |
|---|
| 48 | opt.innerHTML = opt.value; |
|---|
| 49 | target_select.appendChild(opt); |
|---|
| 50 | opt.selected = true; |
|---|
| 51 | } |
|---|
| 52 | } |
|---|
| 53 | } |
|---|
| 54 | if (! use_target) { |
|---|
| 55 | document.getElementById("f_target_label").style.visibility = "hidden"; |
|---|
| 56 | document.getElementById("f_target").style.visibility = "hidden"; |
|---|
| 57 | document.getElementById("f_other_target").style.visibility = "hidden"; |
|---|
| 58 | } |
|---|
| 59 | var opt = document.createElement("option"); |
|---|
| 60 | opt.value = "_other"; |
|---|
| 61 | opt.innerHTML = i18n("Other"); |
|---|
| 62 | target_select.appendChild(opt); |
|---|
| 63 | target_select.onchange = onTargetChanged; |
|---|
| 64 | document.getElementById("f_href").focus(); |
|---|
| 65 | document.getElementById("f_href").select(); |
|---|
| 66 | } |
|---|
| 67 | |
|---|
| 68 | function onOK() { |
|---|
| 69 | var required = { |
|---|
| 70 | |
|---|
| 71 | |
|---|
| 72 | |
|---|
| 73 | }; |
|---|
| 74 | for (var i in required) { |
|---|
| 75 | var el = document.getElementById(i); |
|---|
| 76 | if (!el.value) { |
|---|
| 77 | alert(required[i]); |
|---|
| 78 | el.focus(); |
|---|
| 79 | return false; |
|---|
| 80 | } |
|---|
| 81 | } |
|---|
| 82 | |
|---|
| 83 | var fields = ["f_href", "f_title", "f_target" ]; |
|---|
| 84 | var param = new Object(); |
|---|
| 85 | for (var i in fields) { |
|---|
| 86 | var id = fields[i]; |
|---|
| 87 | var el = document.getElementById(id); |
|---|
| 88 | param[id] = el.value; |
|---|
| 89 | } |
|---|
| 90 | if (param.f_target == "_other") |
|---|
| 91 | param.f_target = document.getElementById("f_other_target").value; |
|---|
| 92 | __dlg_close(param); |
|---|
| 93 | return false; |
|---|
| 94 | } |
|---|
| 95 | |
|---|
| 96 | function onCancel() { |
|---|
| 97 | __dlg_close(null); |
|---|
| 98 | return false; |
|---|
| 99 | } |
|---|
| 100 | |
|---|
| 101 | </script> |
|---|
| 102 | |
|---|
| 103 | </head> |
|---|
| 104 | |
|---|
| 105 | <body class="dialog" onload="Init()"> |
|---|
| 106 | <div class="title">Insert/Modify Link</div> |
|---|
| 107 | <form> |
|---|
| 108 | <table border="0" style="width: 100%;"> |
|---|
| 109 | <tr> |
|---|
| 110 | <td class="label">URL:</td> |
|---|
| 111 | <td><input type="text" id="f_href" style="width: 100%" /></td> |
|---|
| 112 | </tr> |
|---|
| 113 | <tr> |
|---|
| 114 | <td class="label">Title (tooltip):</td> |
|---|
| 115 | <td><input type="text" id="f_title" style="width: 100%" /></td> |
|---|
| 116 | </tr> |
|---|
| 117 | <tr> |
|---|
| 118 | <td class="label"><span id="f_target_label">Target:</span></td> |
|---|
| 119 | <td><select id="f_target"> |
|---|
| 120 | <option value="">None (use implicit)</option> |
|---|
| 121 | <option value="_blank">New window (_blank)</option> |
|---|
| 122 | <option value="_self">Same frame (_self)</option> |
|---|
| 123 | <option value="_top">Top frame (_top)</option> |
|---|
| 124 | </select> |
|---|
| 125 | <input type="text" name="f_other_target" id="f_other_target" size="10" style="visibility: hidden" /> |
|---|
| 126 | </td> |
|---|
| 127 | </tr> |
|---|
| 128 | </table> |
|---|
| 129 | |
|---|
| 130 | <div id="buttons"> |
|---|
| 131 | <button type="submit" name="ok" onclick="return onOK();">OK</button> |
|---|
| 132 | <button type="button" name="cancel" onclick="return onCancel();">Cancel</button> |
|---|
| 133 | </div> |
|---|
| 134 | </form> |
|---|
| 135 | </body> |
|---|
| 136 | </html> |
|---|