Got started on message validation for rich text
This commit is contained in:
parent
7bf3f658f8
commit
d563f8381b
40
index.php
40
index.php
@ -201,6 +201,7 @@ function print_add_ticket()
|
|||||||
echo ' class="isError" ';
|
echo ' class="isError" ';
|
||||||
} ?> placeholder="<?php echo htmlspecialchars($hesklang['name']); ?>"
|
} ?> placeholder="<?php echo htmlspecialchars($hesklang['name']); ?>"
|
||||||
data-error="<?php echo htmlspecialchars($hesklang['enter_your_name']); ?>" required>
|
data-error="<?php echo htmlspecialchars($hesklang['enter_your_name']); ?>" required>
|
||||||
|
|
||||||
<div class="help-block with-errors"></div>
|
<div class="help-block with-errors"></div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
@ -220,6 +221,7 @@ function print_add_ticket()
|
|||||||
echo ' onblur="Javascript:hesk_suggestEmail(0)"';
|
echo ' onblur="Javascript:hesk_suggestEmail(0)"';
|
||||||
} ?> placeholder="<?php echo htmlspecialchars($hesklang['email']); ?>"
|
} ?> placeholder="<?php echo htmlspecialchars($hesklang['email']); ?>"
|
||||||
data-error="<?php echo htmlspecialchars($hesklang['enter_valid_email']); ?>" required>
|
data-error="<?php echo htmlspecialchars($hesklang['enter_valid_email']); ?>" required>
|
||||||
|
|
||||||
<div class="help-block with-errors"></div>
|
<div class="help-block with-errors"></div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
@ -231,13 +233,16 @@ function print_add_ticket()
|
|||||||
class="important">*</span></label>
|
class="important">*</span></label>
|
||||||
|
|
||||||
<div class="col-sm-9">
|
<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'])) {
|
value="<?php if (isset($_SESSION['c_email2'])) {
|
||||||
echo stripslashes(hesk_input($_SESSION['c_email2']));
|
echo stripslashes(hesk_input($_SESSION['c_email2']));
|
||||||
} ?>" <?php if (in_array('email2', $_SESSION['iserror'])) {
|
} ?>" <?php if (in_array('email2', $_SESSION['iserror'])) {
|
||||||
echo ' class="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>
|
data-error="<?php echo htmlspecialchars($hesklang['confemaile']); ?>" required>
|
||||||
|
|
||||||
<div class="help-block with-errors"></div>
|
<div class="help-block with-errors"></div>
|
||||||
</div>
|
</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>';
|
echo '<option value="' . $row['id'] . '"' . (($_SESSION['c_category'] == $row['id']) ? ' selected="selected"' : '') . '>' . $row['name'] . '</option>';
|
||||||
} ?>
|
} ?>
|
||||||
</select>
|
</select>
|
||||||
|
|
||||||
<div class="help-block with-errors"></div>
|
<div class="help-block with-errors"></div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
@ -319,6 +325,7 @@ function print_add_ticket()
|
|||||||
echo 'selected="selected"';
|
echo 'selected="selected"';
|
||||||
} ?>><?php echo $hesklang['high']; ?></option>
|
} ?>><?php echo $hesklang['high']; ?></option>
|
||||||
</select>
|
</select>
|
||||||
|
|
||||||
<div class="help-block with-errors"></div>
|
<div class="help-block with-errors"></div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
@ -616,6 +623,7 @@ function print_add_ticket()
|
|||||||
echo ' class="isError" ';
|
echo ' class="isError" ';
|
||||||
} ?> placeholder="<?php echo htmlspecialchars($hesklang['subject']); ?>"
|
} ?> placeholder="<?php echo htmlspecialchars($hesklang['subject']); ?>"
|
||||||
data-error="<?php echo htmlspecialchars($hesklang['enter_subject']); ?>" required>
|
data-error="<?php echo htmlspecialchars($hesklang['enter_subject']); ?>" required>
|
||||||
|
|
||||||
<div class="help-block with-errors"></div>
|
<div class="help-block with-errors"></div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
@ -626,10 +634,12 @@ function print_add_ticket()
|
|||||||
id="message" class="form-control htmlEditor" rows="12"
|
id="message" class="form-control htmlEditor" rows="12"
|
||||||
cols="60" <?php if (in_array('message', $_SESSION['iserror'])) {
|
cols="60" <?php if (in_array('message', $_SESSION['iserror'])) {
|
||||||
echo ' class="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']));
|
echo stripslashes(hesk_input($_SESSION['c_message']));
|
||||||
} ?></textarea>
|
} ?></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']): ?>
|
<?php if ($modsForHesk_settings['rich_text_for_tickets_for_customers']): ?>
|
||||||
<script type="text/javascript">
|
<script type="text/javascript">
|
||||||
/* <![CDATA[ */
|
/* <![CDATA[ */
|
||||||
@ -992,8 +1002,8 @@ function print_add_ticket()
|
|||||||
{
|
{
|
||||||
?>
|
?>
|
||||||
<div class="form-group">
|
<div class="form-group">
|
||||||
<label for="secimage" class="col-sm-3 control-label"><?php echo $hesklang['verify_i']; ?> <font
|
<label for="secimage" class="col-sm-3 control-label"><?php echo $hesklang['verify_i']; ?> <span
|
||||||
class="important">*</font></label>
|
class="important">*</span></label>
|
||||||
<?php
|
<?php
|
||||||
// SPAM prevention verified for this session
|
// SPAM prevention verified for this session
|
||||||
if (isset($_SESSION['img_verified'])) {
|
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" id="longitude" name="longitude" value="E-0">
|
||||||
<input type="hidden" name="token" value="<?php hesk_token_echo(); ?>">
|
<input type="hidden" name="token" value="<?php hesk_token_echo(); ?>">
|
||||||
<input type="submit" value="<?php echo $hesklang['sub_ticket']; ?>"
|
<input type="submit" value="<?php echo $hesklang['sub_ticket']; ?>"
|
||||||
class="btn btn-default">
|
class="btn btn-default>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
<script>
|
||||||
|
$('#screen-resolution-height').prop('value', screen.height);
|
||||||
|
$('#screen-resolution-width').prop('value', screen.width);
|
||||||
|
</script>
|
||||||
|
|
||||||
<?php
|
<?php
|
||||||
} // End IF submit_notice
|
} // 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" id="screen-resolution-width" name="screen_resolution_width">
|
||||||
<input type="hidden" name="token" value="<?php hesk_token_echo(); ?>">
|
<input type="hidden" name="token" value="<?php hesk_token_echo(); ?>">
|
||||||
<input class="btn btn-default" type="submit"
|
<input class="btn btn-default" type="submit"
|
||||||
value="<?php echo $hesklang['sub_ticket']; ?>">
|
value="<?php echo $hesklang['sub_ticket']; ?>" onclick="validateRichText()">
|
||||||
<script>
|
<script>
|
||||||
$('#screen-resolution-height').prop('value', screen.height);
|
$('#screen-resolution-height').prop('value', screen.height);
|
||||||
$('#screen-resolution-width').prop('value', screen.width);
|
$('#screen-resolution-width').prop('value', screen.width);
|
||||||
@ -1128,6 +1142,16 @@ function print_add_ticket()
|
|||||||
<?php
|
<?php
|
||||||
} // End ELSE submit_notice
|
} // 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 -->
|
<!-- 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=""/>
|
<input type="hidden" name="hx" value="3"/><input type="hidden" name="hy" value=""/>
|
||||||
|
Loading…
x
Reference in New Issue
Block a user