[3526] | 1 | <?php |
---|
| 2 | include("../inc/inc.Settings.php"); |
---|
| 3 | include("../inc/inc.AccessUtils.php"); |
---|
| 4 | include("../inc/inc.ClassAccess.php"); |
---|
| 5 | include("../inc/inc.ClassDocument.php"); |
---|
| 6 | include("../inc/inc.ClassFolder.php"); |
---|
| 7 | include("../inc/inc.ClassGroup.php"); |
---|
| 8 | include("../inc/inc.ClassUser.php"); |
---|
| 9 | include("../inc/inc.ClassKeywords.php"); |
---|
| 10 | include("../inc/inc.DBAccess.php"); |
---|
| 11 | include("../inc/inc.FileUtils.php"); |
---|
| 12 | include("../inc/inc.Language.php"); |
---|
| 13 | include("../inc/inc.OutUtils.php"); |
---|
| 14 | |
---|
| 15 | include("../inc/inc.Authentication.php"); |
---|
| 16 | |
---|
| 17 | |
---|
| 18 | $categories = getAllKeywordCategories($user->getID()); |
---|
| 19 | |
---|
| 20 | printHTMLHead( getMLText("use_default_keywords") ); |
---|
| 21 | ?> |
---|
| 22 | |
---|
| 23 | |
---|
| 24 | <script language="JavaScript"> |
---|
| 25 | var targetObj = opener.document.form1.keywords; |
---|
| 26 | var myTA; |
---|
| 27 | |
---|
| 28 | |
---|
| 29 | function insertKeywords(keywords) { |
---|
| 30 | |
---|
| 31 | if (navigator.appName == "Microsoft Internet Explorer") { |
---|
| 32 | myTA.value += " " + keywords; |
---|
| 33 | } |
---|
| 34 | //assuming Mozilla |
---|
| 35 | else { |
---|
| 36 | selStart = myTA.selectionStart; |
---|
| 37 | |
---|
| 38 | myTA.value = myTA.value.substring(0,myTA.selectionStart) |
---|
| 39 | + keywords |
---|
| 40 | + myTA.value.substring(myTA.selectionStart,myTA.value.length); |
---|
| 41 | |
---|
| 42 | myTA.selectionStart = selStart + keywords.length; |
---|
| 43 | myTA.selectionEnd = selStart + keywords.length; |
---|
| 44 | } |
---|
| 45 | myTA.focus(); |
---|
| 46 | } |
---|
| 47 | |
---|
| 48 | function cancel() { |
---|
| 49 | window.close(); |
---|
| 50 | return true; |
---|
| 51 | } |
---|
| 52 | |
---|
| 53 | function acceptKeywords() { |
---|
| 54 | targetObj.value = myTA.value; |
---|
| 55 | window.close(); |
---|
| 56 | return true; |
---|
| 57 | } |
---|
| 58 | |
---|
| 59 | |
---|
| 60 | |
---|
| 61 | obj = new Array(); |
---|
| 62 | obj[0] = -1; |
---|
| 63 | obj[1] = -1; |
---|
| 64 | function showKeywords(which) { |
---|
| 65 | if (obj[which] != -1) |
---|
| 66 | obj[which].style.display = "none"; |
---|
| 67 | |
---|
| 68 | list = document.getElementById("categories" + which); |
---|
| 69 | |
---|
| 70 | id = list.options[list.selectedIndex].value; |
---|
| 71 | if (id == -1) |
---|
| 72 | return; |
---|
| 73 | |
---|
| 74 | obj[which] = document.getElementById("keywords" + id); |
---|
| 75 | obj[which].style.display = ""; |
---|
| 76 | } |
---|
| 77 | </script> |
---|
| 78 | |
---|
| 79 | <div style="margin-left: 10pt; margin-top: 10pt"> |
---|
| 80 | <?php |
---|
| 81 | printStartBox(getMLText("use_default_keywords")); |
---|
| 82 | ?> |
---|
| 83 | <table> |
---|
| 84 | <tr> |
---|
| 85 | <td class="inputDescription"><?php echo getMLText("global_default_keywords")?>:</td> |
---|
| 86 | <td> |
---|
| 87 | <select onchange="showKeywords(0)" id="categories0"> |
---|
| 88 | <option value="-1"><?php echo getMLText("choose_category")?> |
---|
| 89 | <?php |
---|
| 90 | foreach ($categories as $category) { |
---|
| 91 | $owner = $category->getOwner(); |
---|
| 92 | if ($owner->getID() != $settings->_adminID) |
---|
| 93 | continue; |
---|
| 94 | |
---|
| 95 | print "<option value=\"".$category->getID()."\">" . $category->getName(); |
---|
| 96 | } |
---|
| 97 | ?> |
---|
| 98 | </select> |
---|
| 99 | </td> |
---|
| 100 | </tr> |
---|
| 101 | <?php |
---|
| 102 | foreach ($categories as $category) { |
---|
| 103 | $owner = $category->getOwner(); |
---|
| 104 | if ($owner->getID() != $settings->_adminID) |
---|
| 105 | continue; |
---|
| 106 | ?> |
---|
| 107 | <tr id="keywords<?php echo $category->getID()?>" style="display : none;"> |
---|
| 108 | <td valign="top" class="inputDescription"><?php echo getMLText("default_keywords")?>:</td> |
---|
| 109 | <td class="standardText"> |
---|
| 110 | <?php |
---|
| 111 | $lists = $category->getKeywordLists(); |
---|
| 112 | foreach ($lists as $list) { |
---|
| 113 | print "<li><a href='javascript:insertKeywords(\"$list[keywords]\");'>$list[keywords]</a></li>"; |
---|
| 114 | } |
---|
| 115 | ?> |
---|
| 116 | </td> |
---|
| 117 | </tr> |
---|
| 118 | <?php } ?> |
---|
| 119 | <tr> |
---|
| 120 | <td colspan="2"><hr></td> |
---|
| 121 | </tr> |
---|
| 122 | <tr> |
---|
| 123 | <td class="inputDescription"><?php echo getMLText("personal_default_keywords")?>:</td> |
---|
| 124 | <td> |
---|
| 125 | <select onchange="showKeywords(1)" id="categories1"> |
---|
| 126 | <option value="-1"><?php echo getMLText("choose_category")?> |
---|
| 127 | <?php |
---|
| 128 | foreach ($categories as $category) { |
---|
| 129 | $owner = $category->getOwner(); |
---|
| 130 | if ($owner->getID() == $settings->_adminID) |
---|
| 131 | continue; |
---|
| 132 | |
---|
| 133 | print "<option value=\"".$category->getID()."\">" . $category->getName(); |
---|
| 134 | } |
---|
| 135 | ?> |
---|
| 136 | </select> |
---|
| 137 | </td> |
---|
| 138 | </tr> |
---|
| 139 | <?php |
---|
| 140 | foreach ($categories as $category) { |
---|
| 141 | $owner = $category->getOwner(); |
---|
| 142 | if ($owner->getID() == $settings->_adminID) |
---|
| 143 | continue; |
---|
| 144 | ?> |
---|
| 145 | <tr id="keywords<?php echo $category->getID()?>" style="display : none;"> |
---|
| 146 | <td valign="top" class="inputDescription"><?php echo getMLText("default_keywords")?>:</td> |
---|
| 147 | <td class="standardText"> |
---|
| 148 | <?php |
---|
| 149 | $lists = $category->getKeywordLists(); |
---|
| 150 | foreach ($lists as $list) { |
---|
| 151 | print "<li><a href='javascript:insertKeywords(\"$list[keywords]\");'>$list[keywords]</a></li>"; |
---|
| 152 | } |
---|
| 153 | ?> |
---|
| 154 | </td> |
---|
| 155 | </tr> |
---|
| 156 | <?php } ?> |
---|
| 157 | <tr> |
---|
| 158 | <td colspan="2"><hr></td> |
---|
| 159 | </tr> |
---|
| 160 | <tr> |
---|
| 161 | <td valign="top" class="inputDescription"><?php echo getMLText("keywords")?>:</td> |
---|
| 162 | <td><textarea id="keywordta" rows="5" cols="30"></textarea></td> |
---|
| 163 | </tr> |
---|
| 164 | <tr> |
---|
| 165 | <td colspan="2"> |
---|
| 166 | <br> |
---|
| 167 | <input type="Button" onclick="acceptKeywords();" value="<?php echo getMLText("accept")?>"> |
---|
| 168 | <input type="Button" onclick="cancel();" value="<?php echo getMLText("cancel")?>"> |
---|
| 169 | </td> |
---|
| 170 | </tr> |
---|
| 171 | </table> |
---|
| 172 | |
---|
| 173 | <?php |
---|
| 174 | printEndBox(); |
---|
| 175 | ?> |
---|
| 176 | </div> |
---|
| 177 | |
---|
| 178 | <script language="JavaScript"> |
---|
| 179 | myTA = document.getElementById("keywordta"); |
---|
| 180 | myTA.value = targetObj.value; |
---|
| 181 | myTA.focus(); |
---|
| 182 | </script> |
---|
| 183 | |
---|
| 184 | </body> |
---|
| 185 | </html> |
---|