summaryrefslogtreecommitdiff
path: root/modules/watermark/views/watermark_add_form.html.php
blob: b5c5069736bd8ade1a27a572163a69a84081d256 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
<? defined("SYSPATH") or die("No direct script access."); ?>
<? if (empty($_FILES)): ?>
<script>
$("document").ready(function() {
  ajaxify_form();
});

function ajaxify_form() {
  $("#gUploadWatermarkForm").ajaxForm({
    complete:function(xhr, statusText) {
      $("#gUploadWatermarkForm").replaceWith(xhr.responseText);
      if (xhr.status == 200) {
        $("#gUploadWatermarkForm").clearForm();
      }
      ajaxify_form();
    }
  });
}
</script>
<? endif ?>
<form action="<?= url::site("watermark/load")?>" method="post" id="gUploadWatermarkForm"
      enctype="multipart/form-data">
  <fieldset>
    <legend><?= _("Upload Watermark")?></legend>
    <ul>
      <li <? if (isset($errors["file"])): ?>class ="gError"<? endif ?>>
        <label for="file"><?= _("File")?></label>
        <input type="file" id="file" name="file" class="upload" 
          value="<?= $fields["file"]  ?>">
        <? if (isset($errors["file"]["type"])): ?>
        <p><?= _("Invalid File Type") ?></p>
        <? elseif (isset($errors["file"]["size"])): ?>
        <p><?= _("File too large") ?></p>
        <? elseif (isset($errors["file"]["valid"])): ?>
        <p><?= _("Upload failed") ?></p>
        <? endif ?>
        <? if (isset($success)): ?>
        <p><?= $success ?></p>
        <? endif ?>
      </li>
      <li>
        <button type="submit" class="submit"><?= _("Upload") ?></button>
      </li>
    </ul>
  </fieldset>
</form>