diff --git a/css/backoffice/pages/_all.scss b/css/backoffice/pages/_all.scss index c1b3efdf7..7d44d47e6 100644 --- a/css/backoffice/pages/_all.scss +++ b/css/backoffice/pages/_all.scss @@ -16,4 +16,5 @@ * You should have received a copy of the GNU Affero General Public License */ -@import "base"; \ No newline at end of file +@import "base"; +@import "preferences"; \ No newline at end of file diff --git a/css/backoffice/pages/_preferences.scss b/css/backoffice/pages/_preferences.scss new file mode 100644 index 000000000..c7c68ff8d --- /dev/null +++ b/css/backoffice/pages/_preferences.scss @@ -0,0 +1,43 @@ +$ibo-preferences--panel--width: 60% !default; +$ibo-preferences--panel--margin-x: auto !default; + +$ibo-preferences--user-preferences--picture-placeholder--image--diameter: 54px !default; +$ibo-preferences--user-preferences--picture-placeholder--image--border-radius: $ibo-border-radius-full !default; +$ibo-preferences--user-preferences--picture-placeholder--image--margin: 12px !default; +$ibo-preferences--user-preferences--picture-placeholder--image--background-color: $ibo-color-grey-300 !default; + +$ibo-preferences--user-preferences--picture-placeholder--image--active--border-color: $ibo-color-blue-800; +$ibo-preferences--user-preferences--picture-placeholder--image--hover--border-color: $ibo-color-blue-600; + +#ibo-main-content >.ibo-panel{ + width: $ibo-preferences--panel--width; + margin-left: $ibo-preferences--panel--margin-x; + margin-right: $ibo-preferences--panel--margin-x; +} + +.ibo-preferences--title{ + text-align: center; +} +.ibo-preferences--user-preferences--picture-placeholder{ + display: flex; + flex-direction: row; + flex-wrap: wrap; +} +.ibo-preferences--user-preferences--picture-placeholder--image{ + height: $ibo-preferences--user-preferences--picture-placeholder--image--diameter; + width: $ibo-preferences--user-preferences--picture-placeholder--image--diameter; + border-radius: $ibo-preferences--user-preferences--picture-placeholder--image--border-radius; + margin: $ibo-preferences--user-preferences--picture-placeholder--image--margin; + border: solid 3px $ibo-preferences--user-preferences--picture-placeholder--image--background-color; + + > img{ + border-radius: $ibo-preferences--user-preferences--picture-placeholder--image--border-radius; + background-color: $ibo-preferences--user-preferences--picture-placeholder--image--background-color; + } +} +.ibo-preferences--user-preferences--picture-placeholder--image.ibo-is-active{ + border-color: $ibo-preferences--user-preferences--picture-placeholder--image--active--border-color; +} +.ibo-preferences--user-preferences--picture-placeholder--image:hover{ + border-color: $ibo-preferences--user-preferences--picture-placeholder--image--hover--border-color; +} \ No newline at end of file diff --git a/dictionaries/ui/pages/en.dictionary.itop.preferences.php b/dictionaries/ui/pages/en.dictionary.itop.preferences.php new file mode 100644 index 000000000..50a38080b --- /dev/null +++ b/dictionaries/ui/pages/en.dictionary.itop.preferences.php @@ -0,0 +1,25 @@ + 'Preferences', + 'UI:Preferences:ChooseAPlaceholder' => 'User placeholder image', + 'UI:Preferences:ChooseAPlaceholder+' => 'Choose a placeholder image that will be displayed if the contact linked to your user doesn\'t have one', +)); \ No newline at end of file diff --git a/pages/preferences.php b/pages/preferences.php index ff0667ca1..ef139f3c9 100644 --- a/pages/preferences.php +++ b/pages/preferences.php @@ -17,6 +17,9 @@ * You should have received a copy of the GNU Affero General Public License */ +use Combodo\iTop\Application\UI\Component\Button\Button\Button; +use Combodo\iTop\Application\UI\Component\Html\Html\Html; +use Combodo\iTop\Application\UI\Component\Panel\Panel\Panel; use Combodo\iTop\Application\UI\Layout\PageContent\PageContentFactory; require_once('../approot.inc.php'); @@ -30,22 +33,22 @@ require_once(APPROOT.'/application/startup.inc.php'); */ function DisplayPreferences($oP) { - $oP->SetContentLayout(PageContentFactory::MakeStandardEmpty()); -// $oP->AddUiBlock(new \Combodo\iTop\Application\UI\Component\Breadcrumbs\Breadcrumbs()); + $oContentLayout = PageContentFactory::MakeStandardEmpty(); $oAppContext = new ApplicationContext(); $sURL = utils::GetAbsoluteUrlAppRoot().'pages/UI.php?'.$oAppContext->GetForLink(); - $oP->add('
'.Dict::S('UI:Preferences')."
');
- $('#other_submit').prop('disabled', true);
+ $('#ibo-misc-settings-submit').prop('disabled', true);
return false;
}
}
EOF
);
-
//////////////////////////////////////////////////////////////////////////
//
// Favorite Organizations
//
//////////////////////////////////////////////////////////////////////////
- $oP->add('');
+ $sFavoriteOrganizationsHtml .= $oBlock->GetDisplay($oP, 1, array('menu' => false, 'selection_mode' => true, 'selection_type' => 'multiple', 'cssCount'=> '.selectedCount', 'table_id' => 'user_prefs'));
+ $sFavoriteOrganizationsHtml .= $oAppContext->GetForForm();
+ $sFavoriteOrganizationsHtml .= '';
+ $oFavoriteOrganizationsCancelButton = new Button('ibo-favorite-organizations-cancel', Dict::S('UI:Button:Cancel'), '', Dict::S('UI:Button:Cancel'), '', '', '', 'regular', 'secondary', 'window.location.href='.$sURL);
+ $oFavoriteOrganizationsSubmitButton = new Button('ibo-favorite-organizations-submit', Dict::S('UI:Button:Apply'), '', Dict::S('UI:Button:Apply'), 'submit', '', '', 'regular', 'green');
+
+ $sFavoriteOrganizationsEndHtml = '';
+ $oFavoriteOrganizationsEndHtmlBlock = new Html($sFavoriteOrganizationsEndHtml) ;
+
$aFavoriteOrgs = appUserPreferences::GetPref('favorite_orgs', null);
if ($aFavoriteOrgs == null)
{
@@ -202,6 +231,14 @@ EOF
EOF
);
}
+
+ $oFavoriteOrganizationsHtmlBlock = new Html($sFavoriteOrganizationsHtml);
+ $oFavoriteOrganizationsBlock->AddSubBlock($oFavoriteOrganizationsHtmlBlock);
+ $oFavoriteOrganizationsBlock->AddSubBlock($oFavoriteOrganizationsCancelButton);
+ $oFavoriteOrganizationsBlock->AddSubBlock($oFavoriteOrganizationsSubmitButton);
+ $oFavoriteOrganizationsBlock->AddSubBlock($oFavoriteOrganizationsEndHtmlBlock);
+
+ $oContentLayout->AddMainBlock($oFavoriteOrganizationsBlock);
//////////////////////////////////////////////////////////////////////////
//
@@ -209,30 +246,25 @@ EOF
//
//////////////////////////////////////////////////////////////////////////
- $oP->add('');
-
+ $sShortcutsHtml .= '';
$sConfirmDelete = addslashes(Dict::S('UI:ShortcutDelete:Confirm'));
$oP->add_ready_script(
@@ -293,8 +325,9 @@ OnSelectionCountChange();
EOF
);
} // if count > 0
-
- $oP->add('');
+ $oShortcutsHtmlBlock = new Html($sShortcutsHtml);
+ $oShortcutsBlock->AddSubBlock($oShortcutsHtmlBlock);
+ $oContentLayout->AddMainBlock($oShortcutsBlock);
//////////////////////////////////////////////////////////////////////////
//
@@ -316,16 +349,17 @@ EOF
$bNewsroomEnabled = (MetaModel::GetConfig()->Get('newsroom_enabled') !== false);
if ($bNewsroomEnabled && ($iCountProviders > 0))
{
- $oP->add('');
- }
+ $oNewsroomResetCacheButton = new Button('ibo-newsroom-reset-cache', Dict::S('UI:Newsroom:ResetCache'), '', Dict::S('UI:Newsroom:ResetCache'), '', '', '', 'regular', 'red', "$('#ibo-navigation-menu--notifications-menu').newsroom_menu('clearCache')");
+ $oNewsroomCancelButton = new Button('ibo-newsroom-cancel', Dict::S('UI:Button:Cancel'), '', Dict::S('UI:Button:Cancel'), '', '', '', 'regular', 'secondary', 'window.location.href='.$sURL);
+ $oNewsroomSubmitButton = new Button('ibo-newsroom-submit', Dict::S('UI:Button:Apply'), '', Dict::S('UI:Button:Apply'), 'submit', '', '', 'regular', 'green');
- //Todo: factorize as UiBlock
- if (true)
- {
- $sUserPicturesFolder = '../images/user-pictures/';
- $sUserDefaultPicture = appUserPreferences::GetPref('user_picture_placeholder', 'default-placeholder.png');
+
+ $sNewsroomEndHtml = '';
+ $oNewsroomEndHtmlBlock = new Html($sNewsroomEndHtml);
- $oP->add(
- <<
-UI:Preferences:ChooseAPlaceholder+
-'.Dict::S('UI:Preferences:ChooseAPlaceholder+').'