Merge branch 'support/3.2' into develop

This commit is contained in:
Benjamin Dalsass
2024-11-13 13:32:53 +01:00
8 changed files with 92 additions and 15 deletions

View File

@@ -71,7 +71,7 @@ define('DEFAULT_MAX_DISPLAY_LIMIT', 30);
define('DEFAULT_STANDARD_RELOAD_INTERVAL', 5 * 60);
define('DEFAULT_FAST_RELOAD_INTERVAL', 1 * 60);
define('DEFAULT_SECURE_CONNECTION_REQUIRED', false);
define('DEFAULT_ALLOWED_LOGIN_TYPES', 'form|external|basic');
define('DEFAULT_ALLOWED_LOGIN_TYPES', 'form|external|basic|token');
define('DEFAULT_EXT_AUTH_VARIABLE', '$_SERVER[\'REMOTE_USER\']');
define('DEFAULT_ENCRYPTION_KEY', '@iT0pEncr1pti0n!'); // We'll use a random generated key later (if possible)
define('DEFAULT_ENCRYPTION_LIB', 'Mcrypt'); // We'll define the best encryption available later

View File

@@ -5,16 +5,16 @@
/* Semantic palettes */
/* - Primary color of the brand */
$common-color-primary-100: $common-color-blue-100 !default;
$common-color-primary-200: $common-color-blue-200 !default;
$common-color-primary-300: $common-color-blue-300 !default;
$common-color-primary-400: $common-color-blue-400 !default;
$common-color-primary-500: $common-color-blue-500 !default;
$common-color-primary-600: $common-color-blue-600 !default;
$common-color-primary-700: $common-color-blue-700 !default;
$common-color-primary-800: $common-color-blue-800 !default;
$common-color-primary-900: $common-color-blue-900 !default;
$common-color-primary-950: $common-color-blue-950 !default;
$common-color-primary-100: $common-color-orange-100 !default;
$common-color-primary-200: $common-color-orange-200 !default;
$common-color-primary-300: $common-color-orange-300 !default;
$common-color-primary-400: $common-color-orange-400 !default;
$common-color-primary-500: $common-color-orange-500 !default;
$common-color-primary-600: $common-color-orange-600 !default;
$common-color-primary-700: $common-color-orange-700 !default;
$common-color-primary-800: $common-color-orange-800 !default;
$common-color-primary-900: $common-color-orange-900 !default;
$common-color-primary-950: $common-color-orange-950 !default;
/* - Secondary color of the brand */
$common-color-secondary-100: $common-color-grey-100 !default;

File diff suppressed because one or more lines are too long

View File

@@ -821,6 +821,23 @@ table .group-actions .item-action-wrapper .panel-body > p:last-child{
font-size: 1em;
}
/* tree list filter data */
.list-group-item .tree-item-wrapper .tree-item-filter-data{
padding-top: 8px;
color: $gray;
font-size: .9em;
}
/* tree list filter data span items */
.list-group-item .tree-item-wrapper .tree-item-filter-data span:not(:last-child):after{
content: '';
margin: 0 5px;
}
/* tree list filter data label span items */
.list-group-item .tree-item-wrapper .tree-item-filter-data .tree-item-filter-data-label{
font-weight: bold;
}
/****************************************************************/
/* - Mosaic mode */
/* */

View File

@@ -6,6 +6,11 @@
* Project Website: http://wiki.aiwsolutions.net/dOQKO
**/
/**
* Altered to allow filtering tree list with extra data.
* Add an attribute data-tree-additional-search to tree-item-wrapper element with extra data you want the search to include.
*/
jQuery.fn.treeListFilter = function(list, timeout, callback) {
var list = jQuery(list);
var input = this;
@@ -41,6 +46,7 @@ jQuery.fn.treeListFilter = function(list, timeout, callback) {
// Modified the search so it looks for each parts of the search and not the entire sentance
// Modified the text to remove accents (latinise())
var text = liObject.find('.tree-item-wrapper').text();
text+= liObject.find('.tree-item-wrapper').attr('data-tree-additional-search');
var textLC = text.toLowerCase().latinise();
var filterValues = filterValue.split(' ');
var display = true;

View File

@@ -26,11 +26,13 @@ use AttributeImage;
use AttributeSet;
use AttributeTagSet;
use Combodo\iTop\Portal\Brick\BrowseBrick;
use DBObject;
use DBSearch;
use Dict;
use MetaModel;
use Symfony\Component\Routing\Generator\UrlGeneratorInterface;
use UserRights;
use utils;
/**
* Class BrowseBrickHelper
@@ -514,6 +516,7 @@ class BrowseBrickHelper
'name' => $aCurrentRowValues[0]->Get($aLevelsProperties[$aCurrentRowKeys[0]]['name_att']),
'class' => get_class($aCurrentRowValues[0]),
'subitems' => array(),
'filter_data' => $this->GetFilterData($aLevelsProperties[$aCurrentRowKeys[0]], $aCurrentRowKeys[0], $aCurrentRowValues[0]),
'action_rules_token' => $this->PrepareActionRulesForItems($aCurrentRowObjects, $aCurrentRowKeys[0], $aLevelsProperties),
);
@@ -564,4 +567,49 @@ class BrowseBrickHelper
$this->AddToTreeItems($aItems[$sCurrentIndex]['subitems'], $aCurrentRowSliced, $aLevelsProperties, $aCurrentRowObjects);
}
}
/**
* Get data to allow filtering tree with invisible fields.
*
* @param array $aLevelProperties tree level properties
* @param string $sRowKey row key
* @param \DBObject $oRowValue row value
*
* @return string[]
* @throws \ArchivedObjectException
* @throws \CoreException
* @throws \Exception
*/
private function GetFilterData(array $aLevelProperties, string $sRowKey, DBObject $oRowValue) : array
{
// result
$sValues = "";
$sValuesAndCodes = "";
// iterate throw level properties fields...
foreach ($aLevelProperties['fields'] as $aField) {
// retrieve the object class
$sFieldObjectClass = get_class($oRowValue);
// retrieve the field object attribute definition
$oAttDef = MetaModel::GetAttributeDef($sFieldObjectClass, $aField['code']);
// get field value (HTML representation)
$sValue = $oAttDef->GetAsHTML($oRowValue->Get($aField['code']));
// do not print empty fields
if(!utils::IsNullOrEmptyString($sValue)){
// append to result
$sValues .= $sValue;
$sValuesAndCodes .= '<span><span class="tree-item-filter-data-label">' . $aField['label'] . ':</span> ' . $sValue . '</span>';
}
}
return [
'values' => $sValues,
'values_and_codes' => $sValuesAndCodes
];
}
}

View File

@@ -149,6 +149,9 @@
}
}
// hide/show tree items filter data when search input is empty/notEmpty
$('.tree-item-filter-data').toggle($('#brick_search_field').val() !== '');
expandAll();
};
// Load current node childnodes throught AJAX
@@ -197,10 +200,12 @@
var liElem = $('<li></li>').addClass('list-group-item');
var spanElem = $('<span></span>').addClass('tree-item-wrapper').attr('data-item-id', item.id).attr('data-level-alias', item.level_alias);
spanElem.attr('data-tree-additional-search', item['filter_data']['values']);
var nameElem = $('<a></a>').addClass('tree-item').text(item.name);
// Building node
$('ul[data-level-id="'+nodeId+'"]').append(liElem);
spanElem.append(nameElem);
spanElem.append('<div class="tree-item-filter-data">' + item['filter_data']['values_and_codes'] + '</div>');
liElem.append(spanElem);
// Delegating a click on <span> to its child <a> element

View File

@@ -35,9 +35,6 @@ class PreferencesController extends AbstractController
{
$sImageFilename = utils::ReadPostedParam('image_filename', null, utils::ENUM_SANITIZATION_FILTER_RAW_DATA);
// Set preference for the user
appUserPreferences::SetPref('user_picture_placeholder', $sImageFilename);
$sUserPicturesFolder = 'images/user-pictures/';
$sImageAbsPath = utils::RealPath(APPROOT.$sUserPicturesFolder.$sImageFilename, APPROOT.$sUserPicturesFolder);
$sImageAbsUrl = utils::GetAbsoluteUrlAppRoot().$sUserPicturesFolder.$sImageFilename;
@@ -53,6 +50,9 @@ class PreferencesController extends AbstractController
throw new Exception('Error while updating user image, could not open file "'.$sImageAbsPath.'"');
}
// Set preference for the user
appUserPreferences::SetPref('user_picture_placeholder', $sImageFilename);
// Check if user has a contact with an image attribute, so we put the image in it also
$sPersonClass = 'Person';
if (true === MetaModel::HasImageAttributeCode($sPersonClass)) {