Got started on message validation for rich text

merge-requests/2/head
Mike Koch 9 years ago
parent 7bf3f658f8
commit d563f8381b

@ -201,6 +201,7 @@ function print_add_ticket()
echo ' class="isError" ';
} ?> placeholder="<?php echo htmlspecialchars($hesklang['name']); ?>"
data-error="<?php echo htmlspecialchars($hesklang['enter_your_name']); ?>" required>
<div class="help-block with-errors"></div>
</div>
</div>
@ -220,6 +221,7 @@ function print_add_ticket()
echo ' onblur="Javascript:hesk_suggestEmail(0)"';
} ?> placeholder="<?php echo htmlspecialchars($hesklang['email']); ?>"
data-error="<?php echo htmlspecialchars($hesklang['enter_valid_email']); ?>" required>
<div class="help-block with-errors"></div>
</div>
</div>
@ -231,13 +233,16 @@ function print_add_ticket()
class="important">*</span></label>
<div class="col-sm-9">
<input type="email" id="email2" class="form-control" name="email2" size="40" maxlength="1000"
<input type="email" id="email2" class="form-control" name="email2" size="40"
maxlength="1000"
value="<?php if (isset($_SESSION['c_email2'])) {
echo stripslashes(hesk_input($_SESSION['c_email2']));
} ?>" <?php if (in_array('email2', $_SESSION['iserror'])) {
echo ' class="isError" ';
} ?> placeholder="<?php echo htmlspecialchars($hesklang['confemail']); ?>" data-match="#email"
} ?> placeholder="<?php echo htmlspecialchars($hesklang['confemail']); ?>"
data-match="#email"
data-error="<?php echo htmlspecialchars($hesklang['confemaile']); ?>" required>
<div class="help-block with-errors"></div>
</div>
</div>
@ -280,6 +285,7 @@ function print_add_ticket()
echo '<option value="' . $row['id'] . '"' . (($_SESSION['c_category'] == $row['id']) ? ' selected="selected"' : '') . '>' . $row['name'] . '</option>';
} ?>
</select>
<div class="help-block with-errors"></div>
</div>
</div>
@ -319,6 +325,7 @@ function print_add_ticket()
echo 'selected="selected"';
} ?>><?php echo $hesklang['high']; ?></option>
</select>
<div class="help-block with-errors"></div>
</div>
</div>
@ -616,6 +623,7 @@ function print_add_ticket()
echo ' class="isError" ';
} ?> placeholder="<?php echo htmlspecialchars($hesklang['subject']); ?>"
data-error="<?php echo htmlspecialchars($hesklang['enter_subject']); ?>" required>
<div class="help-block with-errors"></div>
</div>
</div>
@ -626,10 +634,12 @@ function print_add_ticket()
id="message" class="form-control htmlEditor" rows="12"
cols="60" <?php if (in_array('message', $_SESSION['iserror'])) {
echo ' class="isError" ';
} ?> data-error="<?php echo htmlspecialchars($hesklang['enter_message']); ?>" required><?php if (isset($_SESSION['c_message'])) {
} ?> data-error="<?php echo htmlspecialchars($hesklang['enter_message']); ?>"
required><?php if (isset($_SESSION['c_message'])) {
echo stripslashes(hesk_input($_SESSION['c_message']));
} ?></textarea>
<div class="help-block with-errors"></div>
<div class="help-block with-errors" id="message-help-block"></div>
<?php if ($modsForHesk_settings['rich_text_for_tickets_for_customers']): ?>
<script type="text/javascript">
/* <![CDATA[ */
@ -992,8 +1002,8 @@ function print_add_ticket()
{
?>
<div class="form-group">
<label for="secimage" class="col-sm-3 control-label"><?php echo $hesklang['verify_i']; ?> <font
class="important">*</font></label>
<label for="secimage" class="col-sm-3 control-label"><?php echo $hesklang['verify_i']; ?> <span
class="important">*</span></label>
<?php
// SPAM prevention verified for this session
if (isset($_SESSION['img_verified'])) {
@ -1101,9 +1111,13 @@ function print_add_ticket()
<input type="hidden" id="longitude" name="longitude" value="E-0">
<input type="hidden" name="token" value="<?php hesk_token_echo(); ?>">
<input type="submit" value="<?php echo $hesklang['sub_ticket']; ?>"
class="btn btn-default">
class="btn btn-default>
</div>
</div>
<script>
$('#screen-resolution-height').prop('value', screen.height);
$('#screen-resolution-width').prop('value', screen.width);
</script>
<?php
} // End IF submit_notice
@ -1117,7 +1131,7 @@ function print_add_ticket()
<input type="hidden" id="screen-resolution-width" name="screen_resolution_width">
<input type="hidden" name="token" value="<?php hesk_token_echo(); ?>">
<input class="btn btn-default" type="submit"
value="<?php echo $hesklang['sub_ticket']; ?>">
value="<?php echo $hesklang['sub_ticket']; ?>" onclick="validateRichText()">
<script>
$('#screen-resolution-height').prop('value', screen.height);
$('#screen-resolution-width').prop('value', screen.width);
@ -1128,6 +1142,16 @@ function print_add_ticket()
<?php
} // End ELSE submit_notice
?>
<script>
function validateRichText() {
var content = tinyMCE.get("message").getContent();
if (content == '') {
$('#message-help-block').text("This can't be empty");
return false;
}
return true;
}
</script>
<!-- Do not delete or modify the code below, it is used to detect simple SPAM bots -->
<input type="hidden" name="hx" value="3"/><input type="hidden" name="hy" value=""/>

Loading…
Cancel
Save