udaybabu
08-23-2012, 01:34 PM
I have tinymce editor in my application and working fine but problem is i have a session alert message for 20 min..if i am in idle for 20min session alert message will come..but i am not in idle and entering text in editor even though i am getting session alert message.
thanks
babu
Could you explain a little more about what your problem is? What do you mean by "session alert message"?
IF i understand your post correctly, you're saying that PHP logs you as "idle" after 20min of inactivity? Keep in mind that, if you spend 20min typing into the TinyMCE editor, then -from PHP's point of view- you have been "idle" for that entire time. PHP works on the server. It has no awareness of what goes on client-side (on the user's computer).
If you need additional help, as I said, you'll need to explain more clearly.
udaybabu
08-23-2012, 02:17 PM
Hi,Adrian
Thank u so much for ur replay..let me explain clearly..
in my application if i went idle for 20 min the application will ask a session alert message if i click "ok" the application will continue else click "cancel" it should be logout..
here my problem is if i typing text in editor in 20 min even though session alert message is coming..
here is the session alert message code in sessionAlert.js file..
var idleTime = 3300000(suppose 20min);
var initialSessionTimeoutMessage = 'You will be logged out due inactivity in the database. If you click "OK" within 5 minutes after this message has appeared on the screen, you will remain logged in, otherwise you will be logged out. If you press "Cancel" you will be logged out. If you're logged out, have any notes saved automatically..';
var sessionTimeoutCountdownId = 'sessionTimeoutCountdown';
var redirectAfter = 300;
var redirectTo = '/logout';
var keepAliveURL = '/';
var expiredMessage = 'Your session has expired. You are being logged out for security reasons.';
var running = false; // var to check if the countdown is running
var timer; // reference to the setInterval timer so it can be stopped
$(document).ready(function() {
// create the warning window and set autoOpen to false
var sessionTimeoutWarningDialog = $("<div id='sessionTimeoutWarning'></div>");
$(sessionTimeoutWarningDialog).html(initialSessionTimeoutMessage);
$(sessionTimeoutWarningDialog).dialog({
title: 'Warning',
autoOpen: false, // set this to false so we can manually open it
closeOnEscape: false,
draggable: false,
width: 460,
minHeight: 50,
modal: true,
beforeclose: function() {
// stop the timer
clearInterval(timer);
// stop countdown
running = false;
// ajax call to keep the server-side session alive
$.ajax({
url: keepAliveURL,
async: false
});
},
buttons: {
Yes: function() {
$(this).dialog('close');
},
No: function() {
window.location = redirectTo;
}
},
resizable: false,
open: function() {
$('body').css('overflow','hidden');
},
close: function() {
$('body').css('overflow','auto');
}
});
// start the idle timer
$.idleTimer(idleTime);
// bind to idleTimer's idle.idleTimer event
$(document).bind("idle.idleTimer", function(){
// if the user is idle and a countdown isn't already runnin click dblclick keypress mousemove scrollg
if($.data(document,'idleTimer') === 'idle' && !running){
var counter = redirectAfter;
running = true;
// intialisze timer
$('#'+sessionTimeoutCountdownId).html(redirectAfter);
// open dialog
$(sessionTimeoutWarningDialog).dialog('open');
// create a timer that runs every second
timer = setInterval(function(){
counter -= 1;
// if the counter is 0, redirect the user
if(counter === 0) {
window.location = redirectTo;
} else {
$('#'+sessionTimeoutCountdownId).html(counter);
};
}, 1000);
};
});
});
and tinyMCE editor code...
function tinyMceEditor(element){
tinyMCE.init({
mode : "exact",
elements : element,
theme : "advanced",
plugins : "spellchecker,pagebreak,style,layer,table,save,advhr,advimage,advlink,emotions,iespell,inlinepopups,insertdatetime,preview,media,searchreplace,print,contextmenu, paste,directionality,fullscreen,noneditable,visualchars,nonbreaking,xhtmlxtras,template,wordcount,advlist,autosave,jbimages",
theme_advanced_buttons1 : "spellchecker,bold,italic,underline,justifyleft,justifycenter,justifyright,justifyfull,formatselect,fontselect,fontsizeselect,bullist,numlist",
theme_advanced_buttons2 : "outdent,indent,blockquote,undo,redo,link,unlink,insertdate,inserttime,preview,forecolor,backcolor,hr,removeformat,visualaid,sub,sup,charmap,media,fullscreen,cod e",
theme_advanced_buttons3 : "",
theme_advanced_buttons4 : "",
theme_advanced_toolbar_location : "top",
theme_advanced_toolbar_align : "left",
theme_advanced_resizing : false,
spellchecker_languages : "+Swedish=sv,English=en",
auto_focus : element,
});
}
i hope u guys undestand my prob..
Thanks
kiran
Please use the forum's BBCode tags to make your posts more readable.
for PHP.....................
<?php script goes here ?> .....
for HTML...................
<!-- html markup goes here -->
for javascript/css/other...
// code goes here .............
what does your ajax call do? you don't provide any data to it (just a url - / ). Does PHP do something with that request? How does your javascript know when to stop/reset the timer?
Is this idleTimer a jQuery extension? something you wrote yourself? Is what you posted your entire code?
Powered by vBulletin® Version 4.2.2 Copyright © 2021 vBulletin Solutions, Inc. All rights reserved.