Exemple #1
0
/**
 * Function buildMain
 *
 *
 * @return string
 */
function buildMain()
{
    $selectOptions = buildSelOpts();
    $content = <<<endForm
          Deleting AIML categories from the database is <strong>permanent</strong>!
          This action <strong>CANNOT</strong> be undone!<br />
          <div id="clearForm">
          <form name="clearForm" action="index.php?page=clear" method="POST" onsubmit="return verify()">
          <table class="formTable">
            <tr>
              <td>
                <input type="radio" name="action" value="void" id="actionClearFile" checked="checked">
                <label for="actionClearFile" style="width: 210px; text-align: left">Clear categories from this AIML file: </label><br />
              </td>
              <td>
                <input type="radio" name="action" id="actionClearAll" value="clear">
                <label for="actionClearAll" style="width: 250px">Clear <strong>ALL</strong> AIML categories (Purge database)</label>
              </td>
            </tr>
            <tr>
              <td colspan="2">
                <select name="clearFile" id="clearFile" size="1" style="margin: 14px;" onclick="document.getElementById('actionClearFile').checked = true" onchange="document.getElementById('actionClearFile').checked = true">
                  <option value="null" selected="selected">Choose a file</option>
{$selectOptions}
                </select>
              </td>
            </tr>
            <tr>
              <td colspan="2">
                <input type="submit" name="" value="Submit">
              </td>
            </tr>
          </table>
          </form>
          </div>
[showHelp]
          <script type="text/javascript">
            function verify()
{


              var fn = document.getElementById('clearFile').value;
              var clearAll = document.getElementById('actionClearAll').checked;
              if (fn == 'null' && clearAll === false) return false;
              if (clearAll) fn = 'repository for all files';
              return confirm('This will delete all categories from the AIML file ' + fn + '! This cannot be undone! Are you sure you want to do this?');
            }
          </script>
endForm;
    return $content;
}
Exemple #2
0
/**
 * Function buildMain
 *
 *
 * @return string
 */
function buildMain()
{
    global $msg, $template;
    $selectOptions = buildSelOpts();
    if ($selectOptions === false) {
        return "<div class=\"bold red center\">{$msg}</div><br>\n";
    }
    $content = $template->getSection('ClearAIML');
    $content = str_replace('[selectOptions]', $selectOptions, $content);
    $content = str_replace('[blank]', '', $content);
    return $content;
}