Skip to content

Commit 9567484

Browse files
committed
Merge branch 'release/2.6.3'
2 parents 59c931c + 3acad96 commit 9567484

File tree

169 files changed

+15724
-9927
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

169 files changed

+15724
-9927
lines changed

CHANGELOG.md

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,28 @@
1+
<a name="2.6.3"></a>
2+
## [2.6.3](https://github.com-btry/pluginsGLPI/formcreator/compare/2.6.2...2.6.3) (2018-04-30)
3+
4+
5+
### Bug Fixes
6+
7+
* **condition:** escape quote in import ([b10134e](https://github.com-btry/pluginsGLPI/formcreator/commit/b10134e))
8+
* **condition:** fix show hide issues ([411b998](https://github.com-btry/pluginsGLPI/formcreator/commit/411b998))
9+
* **docs:** fix bad domain for locales ([47788ff](https://github.com-btry/pluginsGLPI/formcreator/commit/47788ff))
10+
* **field:** some fields output a duplicate HTML div ([c4d1a4c](https://github.com-btry/pluginsGLPI/formcreator/commit/c4d1a4c))
11+
* **file:** fix multiple file fields ([a9798d2](https://github.com-btry/pluginsGLPI/formcreator/commit/a9798d2)), closes [#937](https://github.com-btry/pluginsGLPI/formcreator/issues/937)
12+
* **locales:** invalid domain ([7be6ef1](https://github.com-btry/pluginsGLPI/formcreator/commit/7be6ef1)), closes [#872](https://github.com-btry/pluginsGLPI/formcreator/issues/872)
13+
* **question:** filtering out tag question type broken ([86b5a10](https://github.com-btry/pluginsGLPI/formcreator/commit/86b5a10))
14+
* **section:** fix creation of section with abusive escape ([6057cad](https://github.com-btry/pluginsGLPI/formcreator/commit/6057cad)), closes [#940](https://github.com-btry/pluginsGLPI/formcreator/issues/940) [#940](https://github.com-btry/pluginsGLPI/formcreator/issues/940)
15+
* **section:** single quote escaping issue ([b298505](https://github.com-btry/pluginsGLPI/formcreator/commit/b298505)), closes [#940](https://github.com-btry/pluginsGLPI/formcreator/issues/940)
16+
* **target:** distinguish fields content ([326315c](https://github.com-btry/pluginsGLPI/formcreator/commit/326315c))
17+
* **target ticket:** backquote in ticket ticle ([1296925](https://github.com-btry/pluginsGLPI/formcreator/commit/1296925)), closes [#951](https://github.com-btry/pluginsGLPI/formcreator/issues/951)
18+
* **target ticket:** observer groups from template added in assigned ones ([f09e685](https://github.com-btry/pluginsGLPI/formcreator/commit/f09e685))
19+
* **target ticket:** quote escaping for ticket title ([cd070ea](https://github.com-btry/pluginsGLPI/formcreator/commit/cd070ea))
20+
* **ticket:** use default values to set actors of tickets ([fa3f816](https://github.com-btry/pluginsGLPI/formcreator/commit/fa3f816)), closes [#629](https://github.com-btry/pluginsGLPI/formcreator/issues/629)
21+
* **ui:** compatibility issue with internet explorer 11 ([fb2c711](https://github.com-btry/pluginsGLPI/formcreator/commit/fb2c711)), closes [#936](https://github.com-btry/pluginsGLPI/formcreator/issues/936)
22+
* **ui:** responsive design of service catalog ([0f6e466](https://github.com-btry/pluginsGLPI/formcreator/commit/0f6e466))
23+
24+
25+
126
<a name="2.6.2"></a>
227
## [2.6.2](https://github.com-btry/pluginsGLPI/formcreator/compare/2.6.1...2.6.2) (2018-02-12)
328

RoboFile.php

Lines changed: 131 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,4 @@
11
<?php
2-
use Robo\Task\Docker\Commit;
32

43
/**
54
* This is project's console commands configuration for Robo task runner.
@@ -320,4 +319,135 @@ protected function sourceUpdatePackageJson($version) {
320319
protected function sourceUpdateComposerJson($version) {
321320
$this->updateJsonFile('composer.json', $version);
322321
}
322+
323+
/**
324+
* Update headers in source files
325+
*/
326+
public function codeHeadersUpdate() {
327+
$toUpdate = $this->getTrackedFiles('HEAD');
328+
foreach ($toUpdate as $file) {
329+
$this->replaceSourceHeader($file);
330+
}
331+
}
332+
333+
/**
334+
* Read the header template from a file
335+
* @throws Exception
336+
* @return string
337+
*/
338+
protected function getHeaderTemplate() {
339+
if (empty($this->headerTemplate)) {
340+
$this->headerTemplate = file_get_contents(__DIR__ . '/tools/HEADER');
341+
if (empty($this->headerTemplate)) {
342+
throw new Exception('Header template file not found');
343+
}
344+
}
345+
346+
$copyrightRegex = "#Copyright (\(c\)|©) (\d{4}-)?(\d{4}) #iUm";
347+
$year = date("Y");
348+
$replacement = 'Copyright © ${2}' . $year . ' ';
349+
$this->headerTemplate = preg_replace($copyrightRegex, $replacement, $this->headerTemplate);
350+
351+
return $this->headerTemplate;
352+
}
353+
354+
/**
355+
* Format header template for a file type based on extension
356+
*
357+
* @param string $extension
358+
* @param string $template
359+
* @return string
360+
*/
361+
protected function getFormatedHeaderTemplate($extension, $template) {
362+
switch ($extension) {
363+
case 'php':
364+
case 'css':
365+
$lines = explode("\n", $template);
366+
foreach ($lines as &$line) {
367+
$line = rtrim(" * $line");
368+
}
369+
return implode("\n", $lines);
370+
break;
371+
372+
default:
373+
return $template;
374+
}
375+
}
376+
377+
/**
378+
* Update source code header in a source file
379+
* @param string $filename
380+
*/
381+
protected function replaceSourceHeader($filename) {
382+
$filename = __DIR__ . "/$filename";
383+
384+
// define regex for the file type
385+
$ext = pathinfo($filename, PATHINFO_EXTENSION);
386+
switch ($ext) {
387+
case 'php':
388+
$prefix = "\<\?php\\n/\*(\*)?\\n";
389+
$replacementPrefix = "<?php\n/**\n";
390+
$suffix = "\\n( )?\*/";
391+
$replacementSuffix = "\n */";
392+
break;
393+
394+
case 'css':
395+
$prefix = "/\*(\*)?\\n";
396+
$replacementPrefix = "/**\n";
397+
$suffix = "\\n( )?\*/";
398+
$replacementSuffix = "\n */";
399+
break;
400+
default:
401+
// Unhandled file format
402+
return;
403+
}
404+
405+
// format header template for the file type
406+
$header = trim($this->getHeaderTemplate());
407+
$formatedHeader = $replacementPrefix . $this->getFormatedHeaderTemplate($ext, $header) . $replacementSuffix;
408+
409+
// get the content of the file to update
410+
$source = file_get_contents($filename);
411+
412+
// update authors in formated template
413+
$headerMatch = [];
414+
$originalAuthors = [];
415+
$authors = [];
416+
$authorsRegex = "#^.*(\@author .*)$#Um";
417+
preg_match('#^' . $prefix . '(.*)' . $suffix . '#Us', $source, $headerMatch);
418+
if (isset($headerMatch[0])) {
419+
$originalHeader = $headerMatch[0];
420+
preg_match_all($authorsRegex, $originalHeader, $originalAuthors);
421+
if (!is_array($originalAuthors)) {
422+
$originalAuthors = [$originalAuthors];
423+
}
424+
if (isset($originalAuthors[1])) {
425+
$originalAuthors[1] = array_unique($originalAuthors[1]);
426+
$originalAuthors = $this->getFormatedHeaderTemplate($ext, implode("\n", $originalAuthors[1]));
427+
$countOfAuthors = preg_match_all($authorsRegex, $formatedHeader);
428+
if ($countOfAuthors !== false) {
429+
// Empty all author lines except the last one
430+
$formatedHeader = preg_replace($authorsRegex, '', $formatedHeader, $countOfAuthors - 1);
431+
// remove the lines previously reduced to zero
432+
$lines = explode("\n", $formatedHeader);
433+
$formatedHeader = [];
434+
foreach ($lines as $line) {
435+
if ($line !== '') {
436+
$formatedHeader[] = $line;
437+
};
438+
}
439+
$formatedHeader = implode("\n", $formatedHeader);
440+
$formatedHeader = preg_replace($authorsRegex, $originalAuthors, $formatedHeader, 1);
441+
}
442+
}
443+
}
444+
445+
// replace the header if it exists
446+
$source = preg_replace('#^' . $prefix . '(.*)' . $suffix . '#Us', $formatedHeader, $source, 1);
447+
if (empty($source)) {
448+
throw new Exception("An error occurred while processing $filename");
449+
}
450+
451+
file_put_contents($filename, $source);
452+
}
323453
}

RoboFilePlugin.php

Lines changed: 30 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,36 @@
11
<?php
22
/**
3-
* This is project's console commands configuration for Robo task runner.
3+
* LICENSE
44
*
5-
* @see http://robo.li/
5+
* Copyright © 2011-2018 Teclib'
6+
*
7+
* This file is part of Formcreator Plugin for GLPI.
8+
*
9+
* Formcreator is a plugin that allow creation of custom, easy to access forms
10+
* for users when they want to create one or more GLPI tickets.
11+
*
12+
* Formcreator Plugin for GLPI is free software: you can redistribute it and/or modify
13+
* it under the terms of the GNU General Public License as published by
14+
* the Free Software Foundation; either version 2 of the License, or
15+
* (at your option) any later version.
16+
*
17+
* Formcreator Plugin for GLPI is distributed in the hope that it will be useful,
18+
* but WITHOUT ANY WARRANTY; without even the implied warranty of
19+
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
20+
* GNU General Public License for more details.
21+
*
22+
* You should have received a copy of the GNU General Public License along
23+
* with this program; if not, write to the Free Software Foundation, Inc.,
24+
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
25+
* If not, see http://www.gnu.org/licenses/.
26+
* ------------------------------------------------------------------------------
27+
* @author Thierry Bugier
28+
* @author Jérémy Moreau
29+
* @copyright Copyright © 2018 Teclib
30+
* @license GPLv2 https://www.gnu.org/licenses/gpl2.txt
31+
* @link https://github.com/pluginsGLPI/formcreator/
32+
* @link http://plugins.glpi-project.org/#/plugin/formcreator
33+
* ------------------------------------------------------------------------------
634
*/
735
class RoboFilePlugin extends \Robo\Tasks
836
{

ajax/dropdown_values.php

Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,37 @@
11
<?php
2+
/**
3+
* LICENSE
4+
*
5+
* Copyright © 2011-2018 Teclib'
6+
*
7+
* This file is part of Formcreator Plugin for GLPI.
8+
*
9+
* Formcreator is a plugin that allow creation of custom, easy to access forms
10+
* for users when they want to create one or more GLPI tickets.
11+
*
12+
* Formcreator Plugin for GLPI is free software: you can redistribute it and/or modify
13+
* it under the terms of the GNU General Public License as published by
14+
* the Free Software Foundation; either version 2 of the License, or
15+
* (at your option) any later version.
16+
*
17+
* Formcreator Plugin for GLPI is distributed in the hope that it will be useful,
18+
* but WITHOUT ANY WARRANTY; without even the implied warranty of
19+
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
20+
* GNU General Public License for more details.
21+
*
22+
* You should have received a copy of the GNU General Public License along
23+
* with this program; if not, write to the Free Software Foundation, Inc.,
24+
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
25+
* If not, see http://www.gnu.org/licenses/.
26+
* ------------------------------------------------------------------------------
27+
* @author Thierry Bugier
28+
* @author Jérémy Moreau
29+
* @copyright Copyright © 2018 Teclib
30+
* @license GPLv2 https://www.gnu.org/licenses/gpl2.txt
31+
* @link https://github.com/pluginsGLPI/formcreator/
32+
* @link http://plugins.glpi-project.org/#/plugin/formcreator
33+
* ------------------------------------------------------------------------------
34+
*/
235
include ('../../../inc/includes.php');
336

437
Session::checkRight("entity", UPDATE);

ajax/homepage_forms.php

Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,37 @@
11
<?php
2+
/**
3+
* LICENSE
4+
*
5+
* Copyright © 2011-2018 Teclib'
6+
*
7+
* This file is part of Formcreator Plugin for GLPI.
8+
*
9+
* Formcreator is a plugin that allow creation of custom, easy to access forms
10+
* for users when they want to create one or more GLPI tickets.
11+
*
12+
* Formcreator Plugin for GLPI is free software: you can redistribute it and/or modify
13+
* it under the terms of the GNU General Public License as published by
14+
* the Free Software Foundation; either version 2 of the License, or
15+
* (at your option) any later version.
16+
*
17+
* Formcreator Plugin for GLPI is distributed in the hope that it will be useful,
18+
* but WITHOUT ANY WARRANTY; without even the implied warranty of
19+
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
20+
* GNU General Public License for more details.
21+
*
22+
* You should have received a copy of the GNU General Public License along
23+
* with this program; if not, write to the Free Software Foundation, Inc.,
24+
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
25+
* If not, see http://www.gnu.org/licenses/.
26+
* ------------------------------------------------------------------------------
27+
* @author Thierry Bugier
28+
* @author Jérémy Moreau
29+
* @copyright Copyright © 2018 Teclib
30+
* @license GPLv2 https://www.gnu.org/licenses/gpl2.txt
31+
* @link https://github.com/pluginsGLPI/formcreator/
32+
* @link http://plugins.glpi-project.org/#/plugin/formcreator
33+
* ------------------------------------------------------------------------------
34+
*/
235
include ('../../../inc/includes.php');
336

437
$form = new PluginFormcreatorForm();

ajax/homepage_link.php

Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,37 @@
11
<?php
2+
/**
3+
* LICENSE
4+
*
5+
* Copyright © 2011-2018 Teclib'
6+
*
7+
* This file is part of Formcreator Plugin for GLPI.
8+
*
9+
* Formcreator is a plugin that allow creation of custom, easy to access forms
10+
* for users when they want to create one or more GLPI tickets.
11+
*
12+
* Formcreator Plugin for GLPI is free software: you can redistribute it and/or modify
13+
* it under the terms of the GNU General Public License as published by
14+
* the Free Software Foundation; either version 2 of the License, or
15+
* (at your option) any later version.
16+
*
17+
* Formcreator Plugin for GLPI is distributed in the hope that it will be useful,
18+
* but WITHOUT ANY WARRANTY; without even the implied warranty of
19+
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
20+
* GNU General Public License for more details.
21+
*
22+
* You should have received a copy of the GNU General Public License along
23+
* with this program; if not, write to the Free Software Foundation, Inc.,
24+
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
25+
* If not, see http://www.gnu.org/licenses/.
26+
* ------------------------------------------------------------------------------
27+
* @author Thierry Bugier
28+
* @author Jérémy Moreau
29+
* @copyright Copyright © 2018 Teclib
30+
* @license GPLv2 https://www.gnu.org/licenses/gpl2.txt
31+
* @link https://github.com/pluginsGLPI/formcreator/
32+
* @link http://plugins.glpi-project.org/#/plugin/formcreator
33+
* ------------------------------------------------------------------------------
34+
*/
235
include ('../../../inc/includes.php');
336

437
echo '<li id="menu5">";

ajax/homepage_wizard.php

Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,37 @@
11
<?php
2+
/**
3+
* LICENSE
4+
*
5+
* Copyright © 2011-2018 Teclib'
6+
*
7+
* This file is part of Formcreator Plugin for GLPI.
8+
*
9+
* Formcreator is a plugin that allow creation of custom, easy to access forms
10+
* for users when they want to create one or more GLPI tickets.
11+
*
12+
* Formcreator Plugin for GLPI is free software: you can redistribute it and/or modify
13+
* it under the terms of the GNU General Public License as published by
14+
* the Free Software Foundation; either version 2 of the License, or
15+
* (at your option) any later version.
16+
*
17+
* Formcreator Plugin for GLPI is distributed in the hope that it will be useful,
18+
* but WITHOUT ANY WARRANTY; without even the implied warranty of
19+
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
20+
* GNU General Public License for more details.
21+
*
22+
* You should have received a copy of the GNU General Public License along
23+
* with this program; if not, write to the Free Software Foundation, Inc.,
24+
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
25+
* If not, see http://www.gnu.org/licenses/.
26+
* ------------------------------------------------------------------------------
27+
* @author Thierry Bugier
28+
* @author Jérémy Moreau
29+
* @copyright Copyright © 2018 Teclib
30+
* @license GPLv2 https://www.gnu.org/licenses/gpl2.txt
31+
* @link https://github.com/pluginsGLPI/formcreator/
32+
* @link http://plugins.glpi-project.org/#/plugin/formcreator
33+
* ------------------------------------------------------------------------------
34+
*/
235
include ('../../../inc/includes.php');
336

437
if (!isset($_SESSION['glpiactiveprofile']['id'])) {

ajax/ldap_filter.php

Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,37 @@
11
<?php
2+
/**
3+
* LICENSE
4+
*
5+
* Copyright © 2011-2018 Teclib'
6+
*
7+
* This file is part of Formcreator Plugin for GLPI.
8+
*
9+
* Formcreator is a plugin that allow creation of custom, easy to access forms
10+
* for users when they want to create one or more GLPI tickets.
11+
*
12+
* Formcreator Plugin for GLPI is free software: you can redistribute it and/or modify
13+
* it under the terms of the GNU General Public License as published by
14+
* the Free Software Foundation; either version 2 of the License, or
15+
* (at your option) any later version.
16+
*
17+
* Formcreator Plugin for GLPI is distributed in the hope that it will be useful,
18+
* but WITHOUT ANY WARRANTY; without even the implied warranty of
19+
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
20+
* GNU General Public License for more details.
21+
*
22+
* You should have received a copy of the GNU General Public License along
23+
* with this program; if not, write to the Free Software Foundation, Inc.,
24+
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
25+
* If not, see http://www.gnu.org/licenses/.
26+
* ------------------------------------------------------------------------------
27+
* @author Thierry Bugier
28+
* @author Jérémy Moreau
29+
* @copyright Copyright © 2018 Teclib
30+
* @license GPLv2 https://www.gnu.org/licenses/gpl2.txt
31+
* @link https://github.com/pluginsGLPI/formcreator/
32+
* @link http://plugins.glpi-project.org/#/plugin/formcreator
33+
* ------------------------------------------------------------------------------
34+
*/
235
include ('../../../inc/includes.php');
336

437
Session::checkRight("entity", UPDATE);

0 commit comments

Comments
 (0)