Skip to content

Commit

Permalink
fix(form): broken add target form
Browse files Browse the repository at this point in the history
Signed-off-by: Thierry Bugier <tbugier@teclib.com>
  • Loading branch information
btry committed Aug 22, 2019
1 parent e53d055 commit c591a48
Show file tree
Hide file tree
Showing 2 changed files with 38 additions and 35 deletions.
38 changes: 38 additions & 0 deletions ajax/target.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
<?php
/**
* ---------------------------------------------------------------------
* Formcreator is a plugin which allows creation of custom forms of
* easy access.
* ---------------------------------------------------------------------
* LICENSE
*
* This file is part of Formcreator.
*
* Formcreator is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* Formcreator is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with Formcreator. If not, see <http://www.gnu.org/licenses/>.
* ---------------------------------------------------------------------
* @author Thierry Bugier
* @author Jérémy Moreau
* @copyright Copyright © 2011 - 2019 Teclib'
* @license http://www.gnu.org/licenses/gpl.txt GPLv3+
* @link https://github.com/pluginsGLPI/formcreator/
* @link https://pluginsglpi.github.io/formcreator/
* @link http://plugins.glpi-project.org/#/plugin/formcreator
* ---------------------------------------------------------------------
*/

include ('../../../inc/includes.php');
Session::checkRight('entity', UPDATE);

$target = new PluginFormcreatorForm();
$target->showAddTargetForm();
35 changes: 0 additions & 35 deletions inc/form.class.php
Original file line number Diff line number Diff line change
Expand Up @@ -1864,41 +1864,6 @@ public function showImportForm() {
}
}

/**
* Show form to add a new target
*
* @return void
*/
public function showAdTargetForm() {
echo '<form name="form_target" method="post" action="'.static::getFormURL().'">';
echo '<table class="tab_cadre_fixe">';

echo '<tr><th colspan="4">'.__('Add a destination', 'formcreator').'</th></tr>';

echo '<tr class="line1">';
echo '<td width="15%"><strong>'.__('Name').' <span style="color:red;">*</span></strong></td>';
echo '<td width="40%"><input type="text" name="name" style="width:100%;" value="" /></td>';
echo '<td width="15%"><strong>'._n('Type', 'Types', 1).' <span style="color:red;">*</span></strong></td>';
echo '<td width="30%">';
$typeNames = [];
foreach ($this->getTargetTypes() as $targetType) {
$typeNames[$targetType] = $targetType::getTypeName();
}
Dropdown::showFromArray('itemtype', $typeNames);
echo '</td>';
echo '</tr>';

echo '<tr class="line0">';
echo '<td colspan="4" class="center">';
echo '<input type="hidden" name="plugin_formcreator_forms_id" value="'.(int) $_REQUEST['form_id'].'" />';
echo '<input type="submit" name="add" class="submit_button" value="'.__('Add').'" />';
echo '</td>';
echo '</tr>';

echo '</table>';
Html::closeForm();
}

/**
* Process import of json file(s) sended by the submit of self::showImportForm
* @param array $params GET/POST data that need to contain the filename(s) in _json_file key
Expand Down

0 comments on commit c591a48

Please sign in to comment.