|
@@ -35,9 +35,80 @@ require_once(APPROOT.'/application/startup.inc.php');
|
|
function DisplayPreferences($oP)
|
|
function DisplayPreferences($oP)
|
|
{
|
|
{
|
|
$oAppContext = new ApplicationContext();
|
|
$oAppContext = new ApplicationContext();
|
|
-
|
|
|
|
|
|
+ $sURL = utils::GetAbsoluteUrlAppRoot().'pages/UI.php?'.$oAppContext->GetForLink();
|
|
|
|
+
|
|
$oP->add('<div class="page_header"><h1><img style="vertical-align:middle" src="../images/preferences.png"/> '.Dict::S('UI:Preferences')."</h1></div>\n");
|
|
$oP->add('<div class="page_header"><h1><img style="vertical-align:middle" src="../images/preferences.png"/> '.Dict::S('UI:Preferences')."</h1></div>\n");
|
|
$oP->add('<div id="user_prefs" style="max-width:800px; min-width:400px;">');
|
|
$oP->add('<div id="user_prefs" style="max-width:800px; min-width:400px;">');
|
|
|
|
+
|
|
|
|
+ //////////////////////////////////////////////////////////////////////////
|
|
|
|
+ //
|
|
|
|
+ // User Language selection
|
|
|
|
+ //
|
|
|
|
+ //////////////////////////////////////////////////////////////////////////
|
|
|
|
+
|
|
|
|
+ $oP->add('<fieldset><legend>'.Dict::S('UI:FavoriteLanguage').'</legend>');
|
|
|
|
+ $oP->add('<form method="post">');
|
|
|
|
+ $aLanguages = Dict::GetLanguages();
|
|
|
|
+ $aSortedlang = array();
|
|
|
|
+ foreach($aLanguages as $sCode => $aLang)
|
|
|
|
+ {
|
|
|
|
+ $aSortedlang[$aLang['description']] = $sCode;
|
|
|
|
+ }
|
|
|
|
+ ksort($aSortedlang);
|
|
|
|
+ $oP->add('<p>'.Dict::S('UI:Favorites:SelectYourLanguage').' <select name="language">');
|
|
|
|
+ foreach($aSortedlang as $sCode)
|
|
|
|
+ {
|
|
|
|
+ $sSelected = ($sCode == Dict::GetUserLanguage()) ? 'selected' : '';
|
|
|
|
+ $oP->add('<option value="'.$sCode.'" '.$sSelected.'/>'.$aLanguages[$sCode]['description'].' ('.$aLanguages[$sCode]['localized_description'].')</option>');
|
|
|
|
+ }
|
|
|
|
+ $oP->add('</select></p>');
|
|
|
|
+ $oP->add('<input type="hidden" name="operation" value="apply_language"/>');
|
|
|
|
+ $oP->add($oAppContext->GetForForm());
|
|
|
|
+ $oP->add('<p><input type="button" onClick="window.location.href=\''.$sURL.'\'" value="'.Dict::S('UI:Button:Cancel').'"/>');
|
|
|
|
+ $oP->add(' ');
|
|
|
|
+ $oP->add('<input type="submit" value="'.Dict::S('UI:Button:Apply').'"/></p>');
|
|
|
|
+ $oP->add('</form>');
|
|
|
|
+ $oP->add('</fieldset>');
|
|
|
|
+
|
|
|
|
+ //////////////////////////////////////////////////////////////////////////
|
|
|
|
+ //
|
|
|
|
+ // Other (miscellaneous) settings
|
|
|
|
+ //
|
|
|
|
+ //////////////////////////////////////////////////////////////////////////
|
|
|
|
+
|
|
|
|
+ $oP->add('<fieldset><legend>'.Dict::S('UI:FavoriteOtherSettings').'</legend>');
|
|
|
|
+ $oP->add('<form method="post" onsubmit="return ValidateOtherSettings()">');
|
|
|
|
+ $iDefaultPageSize = appUserPreferences::GetPref('default_page_size', MetaModel::GetConfig()->GetMinDisplayLimit());
|
|
|
|
+ $oP->add('<p>'.Dict::Format('UI:Favorites:Default_X_ItemsPerPage', '<input id="default_page_size" name="default_page_size" type="text" size="3" value="'.$iDefaultPageSize.'"/><span id="v_default_page_size"></span>').'</p>');
|
|
|
|
+ $oP->add('<input type="hidden" name="operation" value="apply_others"/>');
|
|
|
|
+ $oP->add($oAppContext->GetForForm());
|
|
|
|
+ $oP->add('<p><input type="button" onClick="window.location.href=\''.$sURL.'\'" value="'.Dict::S('UI:Button:Cancel').'"/>');
|
|
|
|
+ $oP->add(' ');
|
|
|
|
+ $oP->add('<input id="other_submit" type="submit" value="'.Dict::S('UI:Button:Apply').'"/></p>');
|
|
|
|
+ $oP->add('</form>');
|
|
|
|
+ $oP->add('</fieldset>');
|
|
|
|
+
|
|
|
|
+ $oP->add_script(
|
|
|
|
+<<<EOF
|
|
|
|
+function ValidateOtherSettings()
|
|
|
|
+{
|
|
|
|
+ var sPageLength = $('#default_page_size').val();
|
|
|
|
+ var iPageLength = parseInt(sPageLength , 10);
|
|
|
|
+ if (/^[0-9]+$/.test(sPageLength) && (iPageLength > 0))
|
|
|
|
+ {
|
|
|
|
+ $('#v_default_page_size').html('');
|
|
|
|
+ $('#other_submit').removeAttr('disabled');
|
|
|
|
+ return true;
|
|
|
|
+ }
|
|
|
|
+ else
|
|
|
|
+ {
|
|
|
|
+ $('#v_default_page_size').html('<img src="../images/validation_error.png"/>');
|
|
|
|
+ $('#other_submit').attr('disabled', 'disabled');
|
|
|
|
+ return false;
|
|
|
|
+ }
|
|
|
|
+}
|
|
|
|
+EOF
|
|
|
|
+ );
|
|
|
|
|
|
//////////////////////////////////////////////////////////////////////////
|
|
//////////////////////////////////////////////////////////////////////////
|
|
//
|
|
//
|
|
@@ -55,7 +126,6 @@ function DisplayPreferences($oP)
|
|
$oBlock->Display($oP, 1, array('menu' => false, 'selection_mode' => true, 'selection_type' => 'multiple', 'cssCount'=> '.selectedCount', 'table_id' => 'user_prefs'));
|
|
$oBlock->Display($oP, 1, array('menu' => false, 'selection_mode' => true, 'selection_type' => 'multiple', 'cssCount'=> '.selectedCount', 'table_id' => 'user_prefs'));
|
|
$oP->add($oAppContext->GetForForm());
|
|
$oP->add($oAppContext->GetForForm());
|
|
$oP->add('<input type="hidden" name="operation" value="apply"/>');
|
|
$oP->add('<input type="hidden" name="operation" value="apply"/>');
|
|
- $sURL = utils::GetAbsoluteUrlAppRoot().'pages/UI.php?'.$oAppContext->GetForLink();
|
|
|
|
$oP->add('<p><input type="button" onClick="window.location.href=\''.$sURL.'\'" value="'.Dict::S('UI:Button:Cancel').'"/>');
|
|
$oP->add('<p><input type="button" onClick="window.location.href=\''.$sURL.'\'" value="'.Dict::S('UI:Button:Cancel').'"/>');
|
|
$oP->add(' ');
|
|
$oP->add(' ');
|
|
$oP->add('<input type="submit" value="'.Dict::S('UI:Button:Apply').'"/></p>');
|
|
$oP->add('<input type="submit" value="'.Dict::S('UI:Button:Apply').'"/></p>');
|
|
@@ -117,76 +187,6 @@ EOF
|
|
);
|
|
);
|
|
}
|
|
}
|
|
|
|
|
|
- //////////////////////////////////////////////////////////////////////////
|
|
|
|
- //
|
|
|
|
- // User Language selection
|
|
|
|
- //
|
|
|
|
- //////////////////////////////////////////////////////////////////////////
|
|
|
|
-
|
|
|
|
- $oP->add('<fieldset><legend>'.Dict::S('UI:FavoriteLanguage').'</legend>');
|
|
|
|
- $oP->add('<form method="post">');
|
|
|
|
- $aLanguages = Dict::GetLanguages();
|
|
|
|
- $aSortedlang = array();
|
|
|
|
- foreach($aLanguages as $sCode => $aLang)
|
|
|
|
- {
|
|
|
|
- $aSortedlang[$aLang['description']] = $sCode;
|
|
|
|
- }
|
|
|
|
- ksort($aSortedlang);
|
|
|
|
- $oP->add('<p>'.Dict::S('UI:Favorites:SelectYourLanguage').' <select name="language">');
|
|
|
|
- foreach($aSortedlang as $sCode)
|
|
|
|
- {
|
|
|
|
- $sSelected = ($sCode == Dict::GetUserLanguage()) ? 'selected' : '';
|
|
|
|
- $oP->add('<option value="'.$sCode.'" '.$sSelected.'/>'.$aLanguages[$sCode]['description'].' ('.$aLanguages[$sCode]['localized_description'].')</option>');
|
|
|
|
- }
|
|
|
|
- $oP->add('</select></p>');
|
|
|
|
- $oP->add('<input type="hidden" name="operation" value="apply_language"/>');
|
|
|
|
- $oP->add($oAppContext->GetForForm());
|
|
|
|
- $oP->add('<p><input type="button" onClick="window.location.href=\''.$sURL.'\'" value="'.Dict::S('UI:Button:Cancel').'"/>');
|
|
|
|
- $oP->add(' ');
|
|
|
|
- $oP->add('<input type="submit" value="'.Dict::S('UI:Button:Apply').'"/></p>');
|
|
|
|
- $oP->add('</form>');
|
|
|
|
- $oP->add('</fieldset>');
|
|
|
|
-
|
|
|
|
- //////////////////////////////////////////////////////////////////////////
|
|
|
|
- //
|
|
|
|
- // Other (miscellaneous) settings
|
|
|
|
- //
|
|
|
|
- //////////////////////////////////////////////////////////////////////////
|
|
|
|
-
|
|
|
|
- $oP->add('<fieldset><legend>'.Dict::S('UI:FavoriteOtherSettings').'</legend>');
|
|
|
|
- $oP->add('<form method="post" onsubmit="return ValidateOtherSettings()">');
|
|
|
|
- $iDefaultPageSize = appUserPreferences::GetPref('default_page_size', MetaModel::GetConfig()->GetMinDisplayLimit());
|
|
|
|
- $oP->add('<p>'.Dict::Format('UI:Favorites:Default_X_ItemsPerPage', '<input id="default_page_size" name="default_page_size" type="text" size="3" value="'.$iDefaultPageSize.'"/><span id="v_default_page_size"></span>').'</p>');
|
|
|
|
- $oP->add('<input type="hidden" name="operation" value="apply_others"/>');
|
|
|
|
- $oP->add($oAppContext->GetForForm());
|
|
|
|
- $oP->add('<p><input type="button" onClick="window.location.href=\''.$sURL.'\'" value="'.Dict::S('UI:Button:Cancel').'"/>');
|
|
|
|
- $oP->add(' ');
|
|
|
|
- $oP->add('<input id="other_submit" type="submit" value="'.Dict::S('UI:Button:Apply').'"/></p>');
|
|
|
|
- $oP->add('</form>');
|
|
|
|
- $oP->add('</fieldset>');
|
|
|
|
-
|
|
|
|
- $oP->add_script(
|
|
|
|
-<<<EOF
|
|
|
|
-function ValidateOtherSettings()
|
|
|
|
-{
|
|
|
|
- var sPageLength = $('#default_page_size').val();
|
|
|
|
- var iPageLength = parseInt(sPageLength , 10);
|
|
|
|
- if (/^[0-9]+$/.test(sPageLength) && (iPageLength > 0))
|
|
|
|
- {
|
|
|
|
- $('#v_default_page_size').html('');
|
|
|
|
- $('#other_submit').removeAttr('disabled');
|
|
|
|
- return true;
|
|
|
|
- }
|
|
|
|
- else
|
|
|
|
- {
|
|
|
|
- $('#v_default_page_size').html('<img src="../images/validation_error.png"/>');
|
|
|
|
- $('#other_submit').attr('disabled', 'disabled');
|
|
|
|
- return false;
|
|
|
|
- }
|
|
|
|
-}
|
|
|
|
-EOF
|
|
|
|
- );
|
|
|
|
-
|
|
|
|
$oP->add('</div>');
|
|
$oP->add('</div>');
|
|
$oP->add_ready_script("$('#fav_page_length').bind('keyup change', function(){ ValidateOtherSettings(); })");
|
|
$oP->add_ready_script("$('#fav_page_length').bind('keyup change', function(){ ValidateOtherSettings(); })");
|
|
}
|
|
}
|