Infocenter notizen update

- removed html specialchars in quickinfo
- notizen are retrieved by ajax when click on tablerow
This commit is contained in:
alex
2019-01-09 18:10:55 +01:00
parent 17ba5c15d8
commit 1bdf8bd435
4 changed files with 94 additions and 25 deletions
@@ -84,6 +84,7 @@ class InfoCenter extends Auth_Controller
'saveZgvPruefung' => 'infocenter:rw',
'saveAbsage' => 'infocenter:rw',
'saveFreigabe' => 'infocenter:rw',
'getNotiz' => 'infocenter:r',
'saveNotiz' => 'infocenter:rw',
'updateNotiz' => 'infocenter:rw',
'reloadZgvPruefungen' => 'infocenter:r',
@@ -533,6 +534,20 @@ class InfoCenter extends Auth_Controller
$this->output->set_content_type('application/json')->set_output(json_encode($json));
}
/**
* Gets a Notiz
*/
public function getNotiz()
{
$notiz_id = $this->input->get('notiz_id');
$result = $this->NotizModel->load(
$notiz_id
);
$this->output->set_content_type('application/json')->set_output(json_encode($result));
}
/**
* Saves a new Notiz for a person
* @param $person_id
@@ -557,10 +572,10 @@ class InfoCenter extends Auth_Controller
* Updates a new Notiz for a person
* @param int $notiz_id
* @param int $person_id
* @return bool true if success
*/
public function updateNotiz($notiz_id, $person_id)
public function updateNotiz($notiz_id)
{
$person_id = $this->input->post('person_id');
$titel = $this->input->post('notiztitel');
$text = $this->input->post('notiz');
@@ -9,11 +9,11 @@
<tbody>
<?php foreach ($notizen as $notiz): ?>
<tr data-toggle="tooltip"
title="<?php echo isset($notiz->text) ? strip_tags($notiz->text) : '' ?>" style="cursor: pointer">
title="<?php echo isset($notiz->text) ? html_escape($notiz->text) : '' ?>" style="cursor: pointer">
<td><?php echo date_format(date_create($notiz->insertamum), 'd.m.Y H:i:s') ?></td>
<td><?php echo html_escape($notiz->titel) ?></td>
<td><?php echo $notiz->verfasser_uid ?></td>
<td style="display: none"><?php echo $notiz->notiz_id ?></td>
<td style="display: none" class="hiddennotizid"><?php echo $notiz->notiz_id ?></td>
</tr>
<?php endforeach ?>
</tbody>
+55 -21
View File
@@ -45,10 +45,12 @@ $(document).ready(function ()
$("#notizform").on("submit", function (e)
{
e.preventDefault();
var notizId = $("#notizform :input[name='hiddenNotizId']").val();
var notizid = $("#notizform :input[name='hiddenNotizId']").val();
var formdata = $(this).serializeArray();
var data = {};
data.person_id = personid;
for (var i = 0; i < formdata.length; i++)
{
data[formdata[i].name] = formdata[i].value;
@@ -56,9 +58,9 @@ $(document).ready(function ()
$("#notizmsg").empty();
if (notizId !== '')
if (notizid !== '')
{
InfocenterDetails.updateNotiz(notizId, personid, data);
InfocenterDetails.updateNotiz(notizid, data);
}
else
{
@@ -72,16 +74,9 @@ $(document).ready(function ()
{
$("#notizmsg").empty();
var notizId = $(this).find("td:eq(3)").html();
var notizTitle = $(this).find("td:eq(1)").text();
var notizContent = this.title;
var notizid = $(this).find("td.hiddennotizid").html();
$("#notizform label:first").text(FHC_PhrasesLib.t('infocenter', 'notizAendern')).css("color", "red");
$("#notizform :input[type='reset']").css("display", "inline-block");
$("#notizform :input[name='hiddenNotizId']").val(notizId);
$("#notizform :input[name='notiztitel']").val(notizTitle);
$("#notizform :input[name='notiz']").val(notizContent);
InfocenterDetails.getNotiz(notizid);
}
);
@@ -297,7 +292,40 @@ var InfocenterDetails = {
}
);
},
saveNotiz: function(personid, data)
getNotiz: function(notiz_id)
{
FHC_AjaxClient.ajaxCallGet(
CALLED_PATH + '/getNotiz',
{
"notiz_id": notiz_id
},
{
successCallback: function(data, textStatus, jqXHR) {
if (FHC_AjaxClient.hasData(data))
{
var notiz = data.retval[0];
$("#notizform label:first").text(FHC_PhrasesLib.t('infocenter', 'notizAendern')).css("color", "red");
$("#notizform :input[type='reset']").css("display", "inline-block");
$("#notizform :input[name='hiddenNotizId']").val(notiz_id);
$("#notizform :input[name='notiztitel']").val(notiz.titel);
$("#notizform :input[name='notiz']").val(notiz.text);
}
else
{
InfocenterDetails._notizError('fehlerBeimLesen');
}
},
errorCallback: function()
{
InfocenterDetails._notizError('fehlerBeimLesen');
},
veilTimeout: 0
}
);
},
saveNotiz: function(data)
{
FHC_AjaxClient.ajaxCallPost(
CALLED_PATH + '/saveNotiz/' + encodeURIComponent(personid),
@@ -311,18 +339,21 @@ var InfocenterDetails = {
}
else
{
InfocenterDetails._errorSaveNotiz();
InfocenterDetails._notizError('fehlerBeimSpeichern');
}
},
errorCallback: InfocenterDetails._errorSaveNotiz,
errorCallback: function()
{
InfocenterDetails._notizError('fehlerBeimSpeichern');
},
veilTimeout: 0
}
);
},
updateNotiz: function(notizId, personId, data)
updateNotiz: function(notizid, data)
{
FHC_AjaxClient.ajaxCallPost(
CALLED_PATH + '/updateNotiz/' + encodeURIComponent(notizId) + "/" + encodeURIComponent(personId),
CALLED_PATH + '/updateNotiz/' + encodeURIComponent(notizid),
data,
{
successCallback: function(data, textStatus, jqXHR) {
@@ -334,10 +365,13 @@ var InfocenterDetails = {
}
else
{
InfocenterDetails._errorSaveNotiz();
InfocenterDetails._notizError('fehlerBeimSpeichern');
}
},
errorCallback: InfocenterDetails._errorSaveNotiz,
errorCallback: function()
{
InfocenterDetails._notizError('fehlerBeimSpeichern');
},
veilTimeout: 0
}
);
@@ -815,8 +849,8 @@ var InfocenterDetails = {
$("#notizform label:first").text(FHC_PhrasesLib.t('infocenter', 'notizHinzufuegen')).css("color", "black");
$("#notizform :input[type='reset']").css("display", "none");
},
_errorSaveNotiz: function()
_notizError: function(phrasename)
{
$("#notizmsg").text(FHC_PhrasesLib.t('ui', 'fehlerBeimSpeichern'));
$("#notizmsg").text(FHC_PhrasesLib.t('ui', phrasename));
}
};
+20
View File
@@ -1394,6 +1394,26 @@ $phrases = array(
)
)
),
array(
'app' => 'core',
'category' => 'ui',
'phrase' => 'fehlerBeimLesen',
'insertvon' => 'system',
'phrases' => array(
array(
'sprache' => 'German',
'text' => 'Fehler beim Lesen',
'description' => '',
'insertvon' => 'system'
),
array(
'sprache' => 'English',
'text' => 'Error on Reading',
'description' => '',
'insertvon' => 'system'
)
)
),
array(
'app' => 'core',
'category' => 'ui',