add option to display the custom-notes to the user and actually save the custom-note

Signed-off-by: Michael Kaufmann (d00p) <d00p@froxlor.org>
This commit is contained in:
Michael Kaufmann (d00p)
2015-01-15 22:10:37 +01:00
parent 4c50d35945
commit e578a29058
11 changed files with 84 additions and 7 deletions

View File

@@ -201,6 +201,9 @@ if ($page == 'admins'
$name = validate($_POST['name'], 'name');
$email = $idna_convert->encode(validate($_POST['email'], 'email'));
$custom_notes = validate(str_replace("\r\n", "\n", $_POST['custom_notes']), 'custom_notes', '/^[^\0]*$/');
$custom_notes_show = intval_ressource($_POST['custom_notes_show']);
$loginname = validate($_POST['loginname'], 'loginname');
$password = validate($_POST['admin_password'], 'password');
$password = validatePassword($password);
@@ -391,7 +394,9 @@ if ($page == 'admins'
'tickets_see_all' => $tickets_see_all,
'mysqls' => $mysqls,
'ip' => $ipaddress,
'theme' => $_theme
'theme' => $_theme,
'custom_notes' => $custom_notes,
'custom_notes_show' => $custom_notes_show
);
$ins_stmt = Database::prepare("
@@ -419,7 +424,9 @@ if ($page == 'admins'
`tickets_see_all` = :tickets_see_all,
`mysqls` = :mysqls,
`ip` = :ip,
`theme` = :theme
`theme` = :theme,
`custom_notes` = :custom_notes,
`custom_notes_show` = :custom_notes_show
");
Database::pexecute($ins_stmt, $ins_data);
@@ -490,6 +497,9 @@ if ($page == 'admins'
$name = validate($_POST['name'], 'name');
$email = $idna_convert->encode(validate($_POST['email'], 'email'));
$custom_notes = validate(str_replace("\r\n", "\n", $_POST['custom_notes']), 'custom_notes', '/^[^\0]*$/');
$custom_notes_show = intval_ressource($_POST['custom_notes_show']);
if ($result['adminid'] == $userinfo['userid']) {
$password = '';
@@ -724,6 +734,8 @@ if ($page == 'admins'
'mysqls' => $mysqls,
'ip' => $ipaddress,
'deactivated' => $deactivated,
'custom_notes' => $custom_notes,
'custom_notes_show' => $custom_notes_show,
'adminid' => $id
);
@@ -751,7 +763,9 @@ if ($page == 'admins'
`tickets_see_all` = :tickets_see_all,
`mysqls` = :mysqls,
`ip` = :ip,
`deactivated` = :deactivated
`deactivated` = :deactivated,
`custom_notes` = :custom_notes,
`custom_notes_show` = :custom_notes_show
WHERE `adminid` = :adminid
");
Database::pexecute($upd_stmt, $upd_data);

View File

@@ -419,6 +419,9 @@ if ($page == 'customers'
$def_language = validate($_POST['def_language'], 'default language');
$gender = intval_ressource($_POST['gender']);
$custom_notes = validate(str_replace("\r\n", "\n", $_POST['custom_notes']), 'custom_notes', '/^[^\0]*$/');
$custom_notes_show = intval_ressource($_POST['custom_notes_show']);
$diskspace = intval_ressource($_POST['diskspace']);
if (isset($_POST['diskspace_ul'])) {
$diskspace = - 1;
@@ -671,7 +674,9 @@ if ($page == 'customers'
'imap' => $email_imap,
'pop3' => $email_pop3,
'perlenabled' => $perlenabled,
'theme' => $_theme
'theme' => $_theme,
'custom_notes' => $custom_notes,
'custom_notes_show' => $custom_notes_show
);
$ins_stmt = Database::prepare("
@@ -708,7 +713,9 @@ if ($page == 'customers'
`imap` = :imap,
`pop3` = :pop3,
`perlenabled` = :perlenabled,
`theme` = :theme"
`theme` = :theme,
`custom_notes` = :custom_notes,
`custom_notes_show` = :custom_notes_show"
);
Database::pexecute($ins_stmt, $ins_data);
@@ -1065,6 +1072,9 @@ if ($page == 'customers'
$move_to_admin = isset($_POST['move_to_admin']) ? intval_ressource($_POST['move_to_admin']) : 0;
$custom_notes = validate(str_replace("\r\n", "\n", $_POST['custom_notes']), 'custom_notes', '/^[^\0]*$/');
$custom_notes_show = intval_ressource($_POST['custom_notes_show']);
$diskspace = intval_ressource($_POST['diskspace']);
if (isset($_POST['diskspace_ul'])) {
$diskspace = - 1;
@@ -1400,7 +1410,9 @@ if ($page == 'customers'
'phpenabled' => $phpenabled,
'imap' => $email_imap,
'pop3' => $email_pop3,
'perlenabled' => $perlenabled
'perlenabled' => $perlenabled,
'custom_notes' => $custom_notes,
'custom_notes_show' => $custom_notes_show
);
$upd_stmt = Database::prepare("
UPDATE `" . TABLE_PANEL_CUSTOMERS . "` SET
@@ -1431,7 +1443,9 @@ if ($page == 'customers'
`email_quota` = :email_quota,
`imap` = :imap,
`pop3` = :pop3,
`perlenabled` = :perlenabled
`perlenabled` = :perlenabled,
`custom_notes` = :custom_notes,
`custom_notes_show` = :custom_notes_show
WHERE `customerid` = :customerid"
);
Database::pexecute($upd_stmt, $upd_data);

View File

@@ -132,6 +132,7 @@ CREATE TABLE `panel_admins` (
`reportsent` tinyint(4) unsigned NOT NULL default '0',
`theme` varchar(255) NOT NULL default 'Sparkle',
`custom_notes` text,
`custom_notes_show` tinyint(1) NOT NULL default '0',
PRIMARY KEY (`adminid`),
UNIQUE KEY `loginname` (`loginname`)
) ENGINE=MyISAM CHARSET=utf8 COLLATE=utf8_general_ci;
@@ -192,6 +193,7 @@ CREATE TABLE `panel_customers` (
`perlenabled` tinyint(1) NOT NULL default '0',
`theme` varchar(255) NOT NULL default 'Sparkle',
`custom_notes` text,
`custom_notes_show` tinyint(1) NOT NULL default '0',
PRIMARY KEY (`customerid`),
UNIQUE KEY `loginname` (`loginname`)
) ENGINE=MyISAM CHARSET=utf8 COLLATE=utf8_general_ci;

View File

@@ -69,6 +69,14 @@ return array(
'type' => 'textarea',
'cols' => 60,
'rows' => 12
),
'custom_notes_show' => array(
'label' => $lng['usersettings']['custom_notes']['show'],
'type' => 'checkbox',
'values' => array(
array ('label' => $lng['panel']['yes'], 'value' => '1')
),
'value' => array()
)
)
),

View File

@@ -83,6 +83,14 @@ return array(
'cols' => 60,
'rows' => 12,
'value' => $result['custom_notes']
),
'custom_notes_show' => array(
'label' => $lng['usersettings']['custom_notes']['show'],
'type' => 'checkbox',
'values' => array(
array ('label' => $lng['panel']['yes'], 'value' => '1')
),
'value' => array($result['custom_notes_show'])
)
)
),

View File

@@ -130,6 +130,14 @@ return array(
'type' => 'textarea',
'cols' => 60,
'rows' => 12
),
'custom_notes_show' => array(
'label' => $lng['usersettings']['custom_notes']['show'],
'type' => 'checkbox',
'values' => array(
array ('label' => $lng['panel']['yes'], 'value' => '1')
),
'value' => array()
)
)
),

View File

@@ -139,6 +139,14 @@ return array(
'cols' => 60,
'rows' => 12,
'value' => $result['custom_notes']
),
'custom_notes_show' => array(
'label' => $lng['usersettings']['custom_notes']['show'],
'type' => 'checkbox',
'values' => array(
array ('label' => $lng['panel']['yes'], 'value' => '1')
),
'value' => array($result['custom_notes_show'])
)
)
),

View File

@@ -1835,3 +1835,4 @@ $lng['admin']['note'] = 'Note';
$lng['domains']['import_description'] = 'Detailed information about the structure of the import-file and how to import successfully, please visit <a href="http://redmine.froxlor.org/projects/froxlor/wiki/DomainBulkActionDoc" target="_blank">http://redmine.froxlor.org/projects/froxlor/wiki/DomainBulkActionDoc</a>';
$lng['usersettings']['custom_notes']['title'] = 'Custom notes';
$lng['usersettings']['custom_notes']['description'] = 'Feel free to put any notes you want/need in here. They will show up in the admin/customer overview for the corresponding user.';
$lng['usersettings']['custom_notes']['show'] = 'Show your notes on the dashboard of the user';

View File

@@ -1562,3 +1562,4 @@ $lng['admin']['note'] = 'Hinweis';
$lng['domains']['import_description'] = 'Detaillierte Informationen über den Aufbau der Importdatei und einen erfolgreichen Import gibt es hier: <a href="http://redmine.froxlor.org/projects/froxlor/wiki/DomainBulkActionDoc" target="_blank">http://redmine.froxlor.org/projects/froxlor/wiki/DomainBulkActionDoc</a> (englisch)';
$lng['usersettings']['custom_notes']['title'] = 'Eigene Notizen';
$lng['usersettings']['custom_notes']['description'] = 'Hier können Notizen je nach Lust und Laune eingetragen werden. Diese werden in der Administrator/Kunden-Übersicht bei dem jeweiligen Benutzer angezeigt.';
$lng['usersettings']['custom_notes']['show'] = 'Zeige die Notizen auf dem Dashboard des Benutzers';

View File

@@ -179,6 +179,14 @@ $header
</table>
</if>
<if $userinfo['custom_notes'] != '' && $userinfo['custom_notes_show'] == '1'>
<table class="dboarditem full" id="customnotes">
<tbody>
<tr><td>{$userinfo['custom_notes']}</td></tr>
</tbody>
</table>
</if>
<table class="dboarditem">
<thead>
<tr>

View File

@@ -232,6 +232,11 @@ $header
<td>{$userinfo['email']}</td>
</tr>
</if>
<if $userinfo['custom_notes'] != '' && $userinfo['custom_notes_show'] == '1'>
<tr>
<td colspan="2">{$userinfo['custom_notes']}</td>
</tr>
</if>
</tbody>
</table>
</div>