diff --git a/CHANGELOG.md b/CHANGELOG.md index 280ed56ba..f59dd081e 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,6 +1,13 @@ GLPI Formcreator ChangeLog =============================== +Version 2.6.0 +------------- +## Bugfixes +* fix CSS preventing access to entity selection in service catalog (simplified interface) +* fix error if plugin Tag not available but used in a form to display +* various JS fixes + Version 2.6.0 Release Candidate 1 --------------------------------- diff --git a/RoboFile.php b/RoboFile.php index 1a54a1e70..682b37acb 100644 --- a/RoboFile.php +++ b/RoboFile.php @@ -78,11 +78,11 @@ public function archiveBuild() { } if (!$this->tagExists($version)) { - //throw new Exception("The tag $version does not exists yet"); + throw new Exception("The tag $version does not exists yet"); } if (!$this->isTagMatchesCurrentCommit($version)) { - //throw new Exception("HEAD is not pointing to the tag of the version to build"); + throw new Exception("HEAD is not pointing to the tag of the version to build"); } $versionTag = $this->getVersionTagFromXML($version); diff --git a/RoboFilePlugin.php b/RoboFilePlugin.php new file mode 100644 index 000000000..602a56d7c --- /dev/null +++ b/RoboFilePlugin.php @@ -0,0 +1,193 @@ +minifyCSS() + ->minifyJS(); + } + + /** + * Minify CSS stylesheets + * + * @return void + */ + public function minifyCSS() { + $css_dir = __DIR__ . '/css'; + if (is_dir($css_dir)) { + foreach (glob("$css_dir/*.css") as $css_file) { + if (!$this->endsWith($css_file, 'min.css')) { + $this->taskMinify($css_file) + ->to(str_replace('.css', '.min.css', $css_file)) + ->type('css') + ->run(); + } + } + } + return $this; + } + + /** + * Minify JavaScript files stylesheets + * + * @return void + */ + public function minifyJS() { + $js_dir = __DIR__ . '/js'; + if (is_dir($js_dir)) { + foreach (glob("$js_dir/*.js") as $js_file) { + if (!$this->endsWith($js_file, 'min.js')) { + $this->taskMinify($js_file) + ->to(str_replace('.js', '.min.js', $js_file)) + ->type('js') + ->run(); + } + } + } + return $this; + } + + /** + * Extract translatable strings + * + * @return void + */ + public function localesExtract() { + $this->_exec('tools/extract_template.sh'); + return $this; + } + + /** + * Push locales to transifex + * + * @return void + */ + public function localesPush() { + $this->_exec('tx push -s'); + return $this; + } + + /** + * Pull locales from transifex. + * + * @param integer $percent Completeness percentage + * + * @return void + */ + public function localesPull($percent = 70) { + $this->_exec('tx pull -a --minimum-perc=' .$percent); + return $this; + } + + /** + * Build MO files + * + * @return void + */ + public function localesMo() { + $this->_exec('./tools/release --compile-mo'); + return $this; + } + + /** + * Extract and send locales + * + * @return void + */ + public function localesSend() { + $this->localesExtract() + ->localesPush(); + return $this; + } + + /** + * Retrieve locales and generate mo files + * + * @param integer $percent Completeness percentage + * + * @return void + */ + public function localesGenerate($percent = 70) { + $this->localesPull($percent) + ->localesMo(); + return $this; + } + + /** + * Checks if a string ends with another string + * + * @param string $haystack Full string + * @param string $needle Ends string + * + * @return boolean + * @see http://stackoverflow.com/a/834355 + */ + private function endsWith($haystack, $needle) { + $length = strlen($needle); + if ($length == 0) { + return true; + } + + return (substr($haystack, -$length) === $needle); + } + + /** + * Code sniffer. + * + * Run the PHP Codesniffer on a file or directory. + * + * @param string $file A file or directory to analyze. + * @param array $options Options: + * @option $autofix Whether to run the automatic fixer or not. + * @option $strict Show warnings as well as errors. + * Default is to show only errors. + * + * @return void + */ + public function codeCs( + $file = null, + $options = [ + 'autofix' => false, + 'strict' => false, + ] + ) { + if ($file === null) { + $file = implode(' ', $this->csfiles); + } + + $csignore = ''; + if (count($this->csignore)) { + $csignore .= '--ignore='; + $csignore .= implode(',', $this->csignore); + } + + $strict = $options['strict'] ? '' : '-n'; + + $result = $this->taskExec("./vendor/bin/phpcs $csignore --standard=vendor/glpi-project/coding-standard/GlpiStandard/ {$strict} {$file}")->run(); + + if (!$result->wasSuccessful()) { + if (!$options['autofix'] && !$options['no-interaction']) { + $options['autofix'] = $this->confirm('Would you like to run phpcbf to fix the reported errors?'); + } + if ($options['autofix']) { + $result = $this->taskExec("./vendor/bin/phpcbf $csignore --standard=vendor/glpi-project/coding-standard/GlpiStandard/ {$file}")->run(); + } + } + + return $result; + } + +} \ No newline at end of file diff --git a/ajax/question.php b/ajax/question.php index e4feba30f..8d91208a4 100644 --- a/ajax/question.php +++ b/ajax/question.php @@ -10,5 +10,4 @@ $question_id = intval($_REQUEST['question_id']); $question->getFromDB($question_id); } -$form_id = (int) $_REQUEST['form_id']; $question->showForm($question_id); diff --git a/css/styles.css b/css/styles.css index 646447a9f..8e56ff6e0 100644 --- a/css/styles.css +++ b/css/styles.css @@ -1186,6 +1186,8 @@ span.fc_list_icon { height: 24px; display: inline-block; vertical-align: middle; + font-size: 1.7em; + color: #FFFFFF; } .plugin_formcreator_entityProfile { @@ -1194,8 +1196,6 @@ span.fc_list_icon { height: 40px; } .plugin_formcreator_entityProfile > li { - float: none !important; - display: inline-block; line-height: normal; top: 20%; } @@ -1210,31 +1210,6 @@ span.fc_list_icon { white-space: nowrap; } -.plugin_formcreator_serviceCatalogIcon span.fc_list_icon { - background: url('../pics/issue.png') left no-repeat; - background-size: contain; -} - -.plugin_formcreator_myRequestsIcon span.fc_list_icon { - background: url('../pics/list.png') left no-repeat; - background-size: contain; -} - -.plugin_formcreator_reservationsIcon span.fc_list_icon { - background: url('../pics/reservation.png') left no-repeat; - background-size: contain; -} - -.plugin_formcreator_feedsIcon span.fc_list_icon { - background: url('../pics/feed.png') left no-repeat; - background-size: contain; -} - -.plugin_formcreator_bookmarksIcon span.fc_list_icon { - background: url('../pics/bookmarks.png') left no-repeat; - background-size: contain; -} - .plugin_formcreator_leftMenu .plugin_formcreator_leftMenuItem_separator { margin-bottom: 0; } @@ -1286,24 +1261,15 @@ span.fc_list_icon { opacity: 1; } -#plugin_formcreator_preferences_icon span { - background: url("../../../pics/preferences.png") no-repeat; +#plugin_formcreator_preferences_icon a, #plugin_formcreator_logoutIcon a { display: inline-block; - width: 18px; - height: 18px; + width: 22px; } #plugin_formcreator_preferences_icon a, #plugin_formcreator_logoutIcon a { color: white; } -#plugin_formcreator_logoutIcon span { - background: url("../../../pics/logout.png") no-repeat; - display: inline-block; - width: 18px; - height: 18px; -} - #c_menu #myname { display: inline-block; color: #FFF; @@ -1431,12 +1397,9 @@ span.fc_list_icon { text-align: left; } - .profile-selector { - float: none !important; - } - - .plugin_formcreator_entityProfile { - width: initial; + #header_top .plugin_formcreator_entityProfile .profile-selector { + max-width: none; + padding: 0 !important; } .toggle_menu #c_menu li label { diff --git a/inc/fields.class.php b/inc/fields.class.php index 7a76caf45..2d76f25da 100644 --- a/inc/fields.class.php +++ b/inc/fields.class.php @@ -110,7 +110,7 @@ public static function showField($field, $data = null, $edit = true) { $fieldClass = 'PluginFormcreator'.ucfirst($field['fieldtype']).'Field'; $plugin = new Plugin(); - if ($fieldClass == 'tagField' &&(!$plugin->isInstalled('tag') || !$plugin->isActivated('tag'))) { + if ($fieldClass == 'PluginFormcreatorTagField' && !$plugin->isActivated('tag')) { return; } diff --git a/inc/form.class.php b/inc/form.class.php index 175068926..13666e231 100644 --- a/inc/form.class.php +++ b/inc/form.class.php @@ -440,8 +440,7 @@ public function showForm($ID, $options=[]) { echo ''; echo ''; - echo ''; + $(document).ready(function() {changeValidators(' . $this->fields["validation_required"] . ');});'; + echo Html::scriptBlock($script); + echo ''; echo ''; @@ -868,7 +868,7 @@ public function displayUserForm(CommonGLPI $item) { } // Print css media - echo Html::css(FORMCREATOR_ROOTDOC."/css/print_form.css", ['media' => 'print']); + echo Html::css("plugins/formcreator/css/print_form.css", ['media' => 'print']); // Display form echo "