[ Index ]

PHP Cross Reference of Moodle 1.9.3 [Build 15-Oct-2008]

title

Body

[close]

/lib/editor/htmlarea/popups/ -> searchandreplace.php (source)

   1  <?php // $Id: searchandreplace.php,v 1.4 2007/01/27 23:23:44 skodak Exp $
   2      require("../../../../config.php");
   3  
   4      $id = optional_param('id', SITEID, PARAM_INT);
   5  
   6      require_course_login($id);
   7      @header('Content-Type: text/html; charset=utf-8');
   8  ?>
   9  <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
  10      "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
  11  <html>
  12  <head>
  13  <meta http-equiv="content-type" content="text/html; charset=utf-8" />
  14  <title><?php print_string("searchandreplace","editor");?></title>
  15  <script type="text/javascript" src="popup.js"></script>
  16  <script type="text/javascript">
  17  //<![CDATA[
  18  function _CloseOnEsc(ev) {
  19      ev || (ev = window.event) || (ev = editor._iframe.contentWindow.event);
  20      if (ev.keyCode == 27) {
  21          // update_parent();
  22          window.close();
  23          return;
  24      }
  25  }
  26  
  27  //Initialize
  28  function Init() {
  29  
  30    __dlg_init();
  31  
  32    document.body.onkeypress = _CloseOnEsc;
  33    var param = window.dialogArguments;
  34    document.getElementById("f_search").value = param["f_search"];
  35  
  36    document.getElementById("f_search").focus();
  37    document.getElementById("f_search").select();
  38  
  39  };
  40  
  41  //Actions
  42  function onReplaceAll() {
  43      var searchtxt = document.getElementById("f_search").value;
  44  
  45      //Check a search string
  46      if (searchtxt.length < 1 ) {
  47          alert ("Search string is empty!");
  48          return true;
  49      }
  50  
  51      var replacetxt = document.getElementById("f_replace").value;
  52      var stringcase =  (document.getElementById("f_case").checked) ? "g" : "gi";
  53      var regularx = (document.getElementById("f_regx").checked) ? 1 : 0;
  54      //var closesar = (document.getElementById("f_csar").checked) ? 1 : 0;
  55      var closesar = 1;
  56      var param = [ searchtxt , replacetxt, stringcase, regularx, closesar ];
  57  
  58      //looks that not workin in ie :( need to fix!
  59      if (closesar) {
  60          __dlg_close(param);
  61          window.close();
  62          return false;
  63      } else {
  64          return true;
  65      }
  66  };
  67  
  68  function onCancel() {
  69    __dlg_close(null);
  70    return false;
  71  };
  72  
  73  //]]>
  74  </script>
  75  
  76  <style type="text/css">
  77  html, body {
  78    background: ButtonFace;
  79    color: ButtonText;
  80    font: 11px Tahoma,Verdana,sans-serif;
  81    margin: 0px;
  82    padding: 0px;
  83  }
  84  body { padding: 5px; }
  85  table {
  86    font: 11px Tahoma,Verdana,sans-serif;
  87  }
  88  form p {
  89    margin-top: 5px;
  90    margin-bottom: 5px;
  91  }
  92  .fl { width: 9em; float: left; padding: 2px 5px; text-align: right; }
  93  .fr { width: 7em; float: left; padding: 2px 5px; text-align: right; }
  94  fieldset { padding: 0px 10px 5px 5px; }
  95  select, input, button { font: 11px Tahoma,Verdana,sans-serif; }
  96  button { width: 70px; }
  97  #buttons {
  98        margin-top: 1em; border-top: 1px solid #999;
  99        padding: 2px; text-align: right;
 100  }
 101  
 102  .space { padding: 2px; }
 103  
 104  .title { background: #ddf; color: #000; font-weight: bold; font-size: 120%; padding: 3px 10px; margin-bottom: 10px;
 105  border-bottom: 1px solid black; letter-spacing: 2px;
 106  }
 107  form { padding: 0px; margin: 0px; }
 108  </style>
 109  </head>
 110  <body onload="Init()">
 111  <div class="title"><?php print_string("searchandreplace","editor");?></div>
 112  <form>
 113  <table border="0" style="width: 100%;">
 114    <tr>
 115      <td class="label"><?php print_string("findwhat","editor");?>:</td>
 116      <td align="left"><input type="text" id="f_search" style="width: 280px" /></td>
 117    </tr>
 118    <tr>
 119      <td class="label"><?php print_string("replacewith","editor");?>:</td>
 120      <td align="left"><input type="text" id="f_replace" style="width: 280px" /></td>
 121    </tr>
 122  
 123    </table>
 124    <fieldset>
 125      <legend><span style="font-weight: bold;"><?php print_string("options","editor");?>:</span></legend>
 126  <table border="0" style="width: 100%;">
 127    <tr>
 128      <td style="width: 20px;"><input type="checkbox" id="f_regx" checked="checked" /></td>
 129      <td><label for="f_regx"><?php print_string("regularexpressions","editor");?></label></td>
 130    </tr>
 131    <tr>
 132      <td style="width: 20px;"><input type="checkbox" id="f_case" checked="checked" /></td>
 133      <td><label for="f_case"><?php print_string("matchcase","editor");?></label></td>
 134    </tr>
 135    <!-- <tr>
 136      <td style="width: 20px;"><input type="checkbox" id="f_csar" checked="checked" /></td>
 137      <td><label for="f_csar"><?php print_string("closeafterreplace","editor");?></label></td>
 138    </tr> -->
 139  </table>
 140  </fieldset>
 141  <div id="buttons">
 142    <button type="button" name="ok" onclick="return onReplaceAll();" style="width: 120px;"><?php print_string("replaceall","editor");?></button>
 143    <button type="button" name="cancel" onclick="return onCancel();"><?php print_string("cancel","editor");?></button>
 144  </div>
 145  </form>
 146  </body>
 147  </html>


Generated: Wed Jan 14 11:33:29 2009 Cross-referenced by PHPXref 0.7