Skip to content
Snippets Groups Projects
Commit 9b0c9fc0 authored by Jared Hancock's avatar Jared Hancock
Browse files

Use PJAX to speed requests in the same panel

parent 6f9c14b2
No related branches found
No related tags found
No related merge requests found
<?php if (!isset($_SERVER['HTTP_X_PJAX'])) { ?>
</div> </div>
<div id="footer"> <div id="footer">
Copyright &copy; 2006-<?php echo date('Y'); ?>&nbsp;<?php echo (string) $ost->company ?: 'osTicket.com'; ?>&nbsp;All Rights Reserved. Copyright &copy; 2006-<?php echo date('Y'); ?>&nbsp;<?php echo (string) $ost->company ?: 'osTicket.com'; ?>&nbsp;All Rights Reserved.
...@@ -20,5 +21,15 @@ if(is_object($thisstaff) && $thisstaff->isStaff()) { ?> ...@@ -20,5 +21,15 @@ if(is_object($thisstaff) && $thisstaff->isStaff()) { ?>
<div class="dialog" style="display:none;width:650px;" id="popup"> <div class="dialog" style="display:none;width:650px;" id="popup">
<div class="body"></div> <div class="body"></div>
</div> </div>
<script type="text/javascript">
if ($.support.pjax) {
$(document).on('click', 'a', function(event) {
if (!$(this).hasClass('no-pjax'))
$.pjax.click(event, {container: $('#content')})
})
}
</script>
</body> </body>
</html> </html>
<?php } # endif X_PJAX ?>
<?php if (!isset($_SERVER['HTTP_X_PJAX'])) { ?>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd"> <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
<html> <html>
<head> <head>
...@@ -13,6 +14,7 @@ ...@@ -13,6 +14,7 @@
<![endif]--> <![endif]-->
<script type="text/javascript" src="<?php echo ROOT_PATH; ?>js/jquery-1.8.3.min.js"></script> <script type="text/javascript" src="<?php echo ROOT_PATH; ?>js/jquery-1.8.3.min.js"></script>
<script type="text/javascript" src="<?php echo ROOT_PATH; ?>js/jquery-ui-1.10.3.custom.min.js"></script> <script type="text/javascript" src="<?php echo ROOT_PATH; ?>js/jquery-ui-1.10.3.custom.min.js"></script>
<script type="text/javascript" src="<?php echo ROOT_PATH; ?>js/jquery.pjax.js"></script>
<script type="text/javascript" src="../js/jquery.multifile.js"></script> <script type="text/javascript" src="../js/jquery.multifile.js"></script>
<script type="text/javascript" src="./js/tips.js"></script> <script type="text/javascript" src="./js/tips.js"></script>
<script type="text/javascript" src="<?php echo ROOT_PATH; ?>js/redactor.min.js"></script> <script type="text/javascript" src="<?php echo ROOT_PATH; ?>js/redactor.min.js"></script>
...@@ -53,27 +55,31 @@ ...@@ -53,27 +55,31 @@
<p id="info">Welcome, <strong><?php echo $thisstaff->getFirstName(); ?></strong> <p id="info">Welcome, <strong><?php echo $thisstaff->getFirstName(); ?></strong>
<?php <?php
if($thisstaff->isAdmin() && !defined('ADMINPAGE')) { ?> if($thisstaff->isAdmin() && !defined('ADMINPAGE')) { ?>
| <a href="admin.php">Admin Panel</a> | <a href="admin.php" class="no-pjax">Admin Panel</a>
<?php }else{ ?> <?php }else{ ?>
| <a href="index.php">Staff Panel</a> | <a href="index.php" class="no-pjax">Staff Panel</a>
<?php } ?> <?php } ?>
| <a href="profile.php">My Preferences</a> | <a href="profile.php">My Preferences</a>
| <a href="logout.php?auth=<?php echo $ost->getLinkToken(); ?>">Log Out</a> | <a href="logout.php?auth=<?php echo $ost->getLinkToken(); ?>" class="no-pjax">Log Out</a>
</p> </p>
</div> </div>
<ul id="nav"> <ul id="nav">
<?php <?php
if(($tabs=$nav->getTabs()) && is_array($tabs)){ if(($tabs=$nav->getTabs()) && is_array($tabs)){
foreach($tabs as $name =>$tab) { foreach($tabs as $name =>$tab) {
echo sprintf('<li class="%s"><a href="%s">%s</a>',$tab['active']?'active':'inactive',$tab['href'],$tab['desc']); echo sprintf('<li class="%s"><a href="%s" class="no-pjax">%s</a>',$tab['active']?'active':'inactive',$tab['href'],$tab['desc']);
if(!$tab['active'] && ($subnav=$nav->getSubMenu($name))){ if(!$tab['active'] && ($subnav=$nav->getSubMenu($name))){
echo "<ul>\n"; echo "<ul>\n";
foreach($subnav as $k => $item) { foreach($subnav as $k => $item) {
if (!($id=$item['id'])) if (!($id=$item['id']))
$id="nav$k"; $id="nav$k";
echo sprintf('<li><a class="%s" href="%s" title="%s" id="%s">%s</a></li>', echo sprintf(
$item['iconclass'], $item['href'], $item['title'], $id, $item['desc']); '<li><a class="%s %s" href="%s" title="%s" id="%s">%s</a></li>',
$item['iconclass'],
$tab['active'] ? '' : 'no-pjax',
$item['href'], $item['title'],
$id, $item['desc']);
} }
echo "\n</ul>\n"; echo "\n</ul>\n";
} }
...@@ -107,7 +113,8 @@ ...@@ -107,7 +113,8 @@
} }
?> ?>
</ul> </ul>
<div id="content"> <div id="content" data-pjax-container>
<?php } # endif X_PJAX ?>
<?php if($errors['err']) { ?> <?php if($errors['err']) { ?>
<div id="msg_error"><?php echo $errors['err']; ?></div> <div id="msg_error"><?php echo $errors['err']; ?></div>
<?php }elseif($msg) { ?> <?php }elseif($msg) { ?>
......
This diff is collapsed.
...@@ -265,7 +265,7 @@ $.autoLock = autoLock; ...@@ -265,7 +265,7 @@ $.autoLock = autoLock;
UI & form events UI & form events
*/ */
jQuery(function($) { var ticket_onload = function($) {
$('#response_options form').hide(); $('#response_options form').hide();
$('#ticket_notes').hide(); $('#ticket_notes').hide();
if(location.hash != "" && $('#response_options '+location.hash).length) { if(location.hash != "" && $('#response_options '+location.hash).length) {
...@@ -407,7 +407,9 @@ jQuery(function($) { ...@@ -407,7 +407,9 @@ jQuery(function($) {
// TODO: Add a hover-button to show just one image // TODO: Add a hover-button to show just one image
}); });
}); });
}); };
$(ticket_onload);
$(document).on('pjax:success', function() { ticket_onload(jQuery); });
showImagesInline = function(urls, thread_id) { showImagesInline = function(urls, thread_id) {
var selector = (thread_id == undefined) var selector = (thread_id == undefined)
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment