- New Welcome popup message, displayed once per session at maximum.

SVN:trunk[797]
This commit is contained in:
Denis Flaven
2010-09-08 08:23:52 +00:00
parent 32b337b9a8
commit c91b99c6a3
4 changed files with 91 additions and 1 deletions

View File

@@ -0,0 +1,46 @@
<div style="width:100%;background: url(../images/welcome.jpg) top left no-repeat;">
<style>
.dashboard {
vertical-align:top;
width:50%;
border:0px solid #000;
background-color:#F9F9F1;
padding:10px;
text-align:left;
font-size:10pt;
}
.dashboard2 {
vertical-align:top;
width:50%;
border:0px solid #000;
-moz-border-radius:10px;
padding:5px;
text-align:left;
}
td.dashboard li {
margin-top: 5px;
display: list-item;
}
td div.display_block {
padding:0;
}
tr td.dashboard2, tr td.dashboard2 ul {
font-size:10pt;
}
</style>
<p></p>
<p></p>
<p style="text-align:left; font-size:32px;padding-left:400px;padding-top:40px;margin-bottom:30px;margin-top:0;color:#FFFFFF;"><itopstring>UI:WelcomeMenu:Title</itopstring></p>
<p></p>
<table border="0" style="padding:10px;border-spacing: 10px;width:100%">
<tr>
<td class="dashboard2">
<itopstring>UI:WelcomeMenu:LeftBlock</itopstring>
</td>
<td class="dashboard2">
<itopstring>UI:WelcomeMenu:RightBlock</itopstring>
</td>
</tr>
</table>
</div>

View File

@@ -827,6 +827,7 @@ When associated with a trigger, each action is given an "order" number, specifyi
'UI:Help' => 'Help',
'UI:PasswordConfirm' => '(Confirm)',
'UI:BeforeAdding_Class_ObjectsSaveThisObject' => 'Before adding more %1$s objects, save this object.',
'UI:DisplayThisMessageAtStartup' => 'Display this message at startup',
));

View File

@@ -838,6 +838,7 @@ Lors de l\'association à un déclencheur, on attribue à chaque action un numé
'UI:Help' => 'Aide',
'UI:PasswordConfirm' => '(Confirmer)',
'UI:BeforeAdding_Class_ObjectsSaveThisObject' => 'Enregistrez l\'objet courant avant de créer de nouveaux éléments de type %1$s.',
'UI:DisplayThisMessageAtStartup' => 'Afficher ce message au démarrage',
));
?>

View File

@@ -445,6 +445,47 @@ function UpdateObject(&$oObj)
}
}
}
/**
* Displays a popup welcome message, once per session at maximum
* until the user unchecks the "Display welcome at startup"
* @param WebPage $oP The current web page for the display
* @return void
*/
function DisplayWelcomePopup(WebPage $oP)
{
if (!isset($_SESSION['welcome']))
{
// Check, only once per session, if the popup should be displayed...
// If the user did not already ask for hiding it forever
$bPopup = appUserPreferences::GetPref('welcome_popup', true);
if ($bPopup)
{
$sTemplate = @file_get_contents('../application/templates/welcome_popup.html');
if ($sTemplate !== false)
{
$oTemplate = new DisplayTemplate($sTemplate);
$oP->add("<div id=\"welcome_popup\">");
$oTemplate->Render($oP, array());
$oP->add("<p style=\"float:left\"><input type=\"checkbox\" checked id=\"display_welcome_popup\"/><label for=\"display_welcome_popup\">&nbsp;".Dict::S('UI:DisplayThisMessageAtStartup')."</label></p>\n");
$oP->add("<p style=\"float:right\"><input type=\"button\" value=\"".Dict::S('UI:Button:Ok')."\" onClick=\"$('#welcome_popup').dialog('close');\"/>\n");
$oP->add("</div>\n");
$sTitle = addslashes(Dict::S('UI:WelcomeMenu:Title'));
$oP->add_ready_script(
<<<EOF
$('#welcome_popup').dialog( { width:'80%', title: '$sTitle', autoOpen: true, modal:true,
close: function() {
var bDisplay = $('#display_welcome_popup:checked').length;
SetUserPreference('welcome_popup', bDisplay, true);
}
});
EOF
);
$_SESSION['welcome'] = 'ok';
}
}
}
}
/***********************************************************************************
*
* Main user interface page, starts here
@@ -1456,7 +1497,8 @@ EOF
ExecutionKPI::ReportStats();
MetaModel::ShowQueryTrace();
$oP->output();
DisplayWelcomePopup($oP);
$oP->output();
}
catch(CoreException $e)
{