* fix tutorial mode not work as expected sometimes.
This commit is contained in:
@@ -39,7 +39,7 @@ js::set('confirmDelete', $lang->user->confirmDelete);
|
||||
}
|
||||
else
|
||||
{
|
||||
common::printLink('user', 'create', "dept={$deptID}", "<i class='icon icon-plus'></i> " . $lang->user->create, '', "class='btn btn-primary'");
|
||||
common::printLink('user', 'create', "dept={$deptID}", "<i class='icon icon-plus'></i> " . $lang->user->create, '', "class='btn btn-primary create-user-btn'");
|
||||
}
|
||||
?>
|
||||
</div>
|
||||
|
||||
@@ -220,6 +220,12 @@
|
||||
|
||||
/* If first show without url, then use the default url */
|
||||
if(!url) url = appsMap[appCode].url;
|
||||
|
||||
var iframe = $iframe.get(0);
|
||||
iframe.onload = iframe.onreadystatechange = function(e)
|
||||
{
|
||||
$app.trigger('loadapp', app);
|
||||
};
|
||||
}
|
||||
|
||||
/* Set tab cookie */
|
||||
@@ -278,7 +284,7 @@
|
||||
updateAppUrl(appCode, null, null, true);
|
||||
}
|
||||
|
||||
app.$app.trigger('show.zentaoapp', app);
|
||||
app.$app.trigger('showapp', app);
|
||||
|
||||
return true;
|
||||
}
|
||||
@@ -318,7 +324,7 @@
|
||||
app.show = false;
|
||||
lastOpenedApp = null;
|
||||
|
||||
app.$app.trigger('hide.zentaoapp', app);
|
||||
app.$app.trigger('hideapp', app);
|
||||
|
||||
/* Active last app */
|
||||
var lastApp = getLastApp(true) || getLastApp();
|
||||
@@ -388,7 +394,7 @@
|
||||
var firstClass = $("#bars li:first").attr('class');
|
||||
if(firstClass == 'divider') $("#bars li.divider:first").remove();
|
||||
|
||||
app.$app.trigger('close.zentaoapp', app);
|
||||
app.$app.trigger('closeapp', app);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -416,7 +422,7 @@
|
||||
iframe.src = url || app.url || iframe.src;
|
||||
}
|
||||
|
||||
if(!notTriggerEvent) app.$app.trigger('reload.zentaoapp', app);
|
||||
if(!notTriggerEvent) app.$app.trigger('reloadapp', app);
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -414,14 +414,20 @@ $(function()
|
||||
|
||||
var checkTutorialState = function()
|
||||
{
|
||||
var iWindow = getAppWindow();
|
||||
iWindow = window.frames['iframePage'];
|
||||
tryCheckTask();
|
||||
var iWindow = getAppWindow();
|
||||
var title = (iWindow.$ ? iWindow.$('head > title').text() : '') + $('head > title').text();
|
||||
var url = createLink('tutorial', 'index', 'referer=' + Base64.encode(iWindow.location.href) + '&task=' + current);
|
||||
try{window.history.replaceState({}, title, url);}catch(e){}
|
||||
};
|
||||
|
||||
var checkTimer = 0;
|
||||
var tryCheckTutorialState = function(delay)
|
||||
{
|
||||
clearTimeout(checkTimer);
|
||||
checkTimer = setTimeout(checkTutorialState, delay || 200);
|
||||
};
|
||||
|
||||
var showTask = function(taskName)
|
||||
{
|
||||
clearTips();
|
||||
@@ -472,7 +478,6 @@ $(function()
|
||||
var progress = Math.round(100*finishCount/totalCount);
|
||||
$progress.toggleClass('finish', isFinishAll).find('.progress-bar').css('width', (100*finishCount/totalCount) + '%');
|
||||
$progress.find('.progress-text').text(progress + '%');
|
||||
if(progress == 100) $.getJSON(createLink('tutorial', 'ajaxFinish'));
|
||||
showTask(current);
|
||||
};
|
||||
|
||||
@@ -482,7 +487,10 @@ $(function()
|
||||
var appsIframe = $('#iframePage').get(0);
|
||||
appsIframe.onload = appsIframe.onreadystatechange = function()
|
||||
{
|
||||
appsWindow.$(appsWindow.document).on('show.zentaoapp close.zentaoapp hide.zentaoapp', checkTutorialState);
|
||||
appsWindow.$(appsWindow.document).on('reloadapp loadapp showapp closeapp hideapp', function()
|
||||
{
|
||||
tryCheckTutorialState(1000);
|
||||
});
|
||||
|
||||
/* Open referer page in app tab */
|
||||
if(tutorialReferer) appsWindow.$.apps.open(tutorialReferer);
|
||||
|
||||
Reference in New Issue
Block a user