From da532cc36a4bcff8d5fd77d136516c430c586a9b Mon Sep 17 00:00:00 2001 From: Jean-Yves Gaulier Date: Tue, 5 Nov 2019 17:59:03 +0100 Subject: [PATCH 1/3] PHRAS-2748_bad-chars-cterms_4.1 fix : remove bad ascii chars (0...31 except tab; cr; lf) from cterms values todo ? : also cleanup bad chars from prod/editing and api/editing ? --- .../SearchEngine/Elastic/StringUtils.php | 22 +++++++++++++++++++ .../Elastic/Thesaurus/CandidateTerms.php | 1 + 2 files changed, 23 insertions(+) diff --git a/lib/Alchemy/Phrasea/SearchEngine/Elastic/StringUtils.php b/lib/Alchemy/Phrasea/SearchEngine/Elastic/StringUtils.php index bb8f3dedfd..0131fa942b 100644 --- a/lib/Alchemy/Phrasea/SearchEngine/Elastic/StringUtils.php +++ b/lib/Alchemy/Phrasea/SearchEngine/Elastic/StringUtils.php @@ -63,4 +63,26 @@ class StringUtils return self::$transliterator->transliterate($string); } + + /** + * replace bad chars (ascii 0...31 except 9,10,13) + * + * @param $s + * @param string $replace + * @return mixed + */ + public static function substituteCtrlCharacters($s, $replace = '_') + { + static $bad_chars = null; + if($bad_chars === null) { + $bad_chars = []; + for($i=0; $i<32; $i++) { + if($i != 9 && $i != 10 && $i != 13) { + $bad_chars[] = chr($i); + } + } + } + + return str_replace($bad_chars, $replace, $s); + } } diff --git a/lib/Alchemy/Phrasea/SearchEngine/Elastic/Thesaurus/CandidateTerms.php b/lib/Alchemy/Phrasea/SearchEngine/Elastic/Thesaurus/CandidateTerms.php index cb5c6d24e8..9ebb6f2a7e 100644 --- a/lib/Alchemy/Phrasea/SearchEngine/Elastic/Thesaurus/CandidateTerms.php +++ b/lib/Alchemy/Phrasea/SearchEngine/Elastic/Thesaurus/CandidateTerms.php @@ -32,6 +32,7 @@ class CandidateTerms public function insert($field, $value) { + $value = StringUtils::substituteCtrlCharacters($value, ''); $this->ensureVisitorSetup(); if (!$this->visitor->hasTerm($field, $value)) { $this->new_candidates[$value] = $field; From 6c590f6859092b5a37e8dc9b5503809beaf43be9 Mon Sep 17 00:00:00 2001 From: Harrys Ravalomanana Date: Wed, 6 Nov 2019 11:59:42 +0400 Subject: [PATCH 2/3] PHRAS-2760 #comment fix help menu in view #time 2h --- resources/www/permaview/styles/main.scss | 45 ++++++++++++++++++++++++ 1 file changed, 45 insertions(+) diff --git a/resources/www/permaview/styles/main.scss b/resources/www/permaview/styles/main.scss index a7ed1a6526..0bf3be49a0 100644 --- a/resources/www/permaview/styles/main.scss +++ b/resources/www/permaview/styles/main.scss @@ -109,3 +109,48 @@ dd { float: left; } } + +/*Help menu*/ +.contextMenu.helpcontextmenu { + display: none; + &.shown { + display: block; + position: absolute; + z-index: 101; + } +} +.help-trigger { + display:inline-block; + cursor:pointer; + padding: 0 4px; + border:none; + margin-left: -12px; + margin-right: 94px; + .fa-caret-down:before { + content: "\25BC"; + font-size: 11px; + } +} +.context-menu-theme-vista { + background-image: none; + background-color: #414141; + border-bottom-left-radius: 2px; + border-bottom-right-radius: 2px; + + .context-menu-item { + transition: 500ms; + &:hover { + background-image: none; + background-color: #75abff; + border: none; + } + .context-menu-item-inner { + padding: 4px 12px; + margin-left: 0; + font-family: Helvetica; + font-size: 12px; + font-weight: 700; + color: #fff; + } + } +} From deb7f70a52add855472c0e777b245e95d0ef005a Mon Sep 17 00:00:00 2001 From: Harrys Ravalomanana Date: Fri, 8 Nov 2019 15:14:21 +0400 Subject: [PATCH 3/3] PHRAS-2792 #comment upgrade phraseanet-production-client@0.34.76-d --- package.json | 2 +- yarn.lock | 8 ++++---- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/package.json b/package.json index cea2ca4d27..68f11cbb90 100644 --- a/package.json +++ b/package.json @@ -65,7 +65,7 @@ "normalize-css": "^2.1.0", "npm": "^6.0.0", "npm-modernizr": "^2.8.3", - "phraseanet-production-client": "0.34.75-d", + "phraseanet-production-client": "0.34.76-d", "requirejs": "^2.3.5", "tinymce": "^4.0.28", "underscore": "^1.8.3", diff --git a/yarn.lock b/yarn.lock index 4bdc1fcaef..580e6ac8fe 100644 --- a/yarn.lock +++ b/yarn.lock @@ -7555,10 +7555,10 @@ phraseanet-common@^0.4.1: js-cookie "^2.1.0" pym.js "^1.3.1" -phraseanet-production-client@0.34.75-d: - version "0.34.75-d" - resolved "https://registry.yarnpkg.com/phraseanet-production-client/-/phraseanet-production-client-0.34.75-d.tgz#713d19541db612d42aa0111820e5368698aeb4ea" - integrity sha512-w/pC65z8UiMOdkCHQ2RIYkSMYzBQ9N3264Xl+F8QKSqwdFxXfu75h2mPj/UROrwJq/LYAc9oWiYfHFWLCmO0qA== +phraseanet-production-client@0.34.76-d: + version "0.34.76-d" + resolved "https://registry.yarnpkg.com/phraseanet-production-client/-/phraseanet-production-client-0.34.76-d.tgz#641e9bc4379725ee06669c7cefe0bc78996342e0" + integrity sha512-/SYoQrhVHfvtchjwmVm0/QkuWBTcmbPpNlepCKvjTMZBBPLepe+eUNHJh/vcnd+tCZkeYWu16kQvvdjs92dn5Q== dependencies: "@mapbox/mapbox-gl-language" "^0.9.2" "@turf/turf" "^5.1.6"