]> wagnertech.de Git - timetracker.git/commitdiff
Work in progress on role editor.
authorNik Okuntseff <support@anuko.com>
Sun, 25 Feb 2018 16:00:14 +0000 (16:00 +0000)
committerNik Okuntseff <support@anuko.com>
Sun, 25 Feb 2018 16:00:14 +0000 (16:00 +0000)
34 files changed:
WEB-INF/lib/form/Form.class.php
WEB-INF/lib/ttRoleHelper.class.php
WEB-INF/resources/ca.lang.php
WEB-INF/resources/cs.lang.php
WEB-INF/resources/da.lang.php
WEB-INF/resources/de.lang.php
WEB-INF/resources/en.lang.php
WEB-INF/resources/es.lang.php
WEB-INF/resources/et.lang.php
WEB-INF/resources/fa.lang.php
WEB-INF/resources/fi.lang.php
WEB-INF/resources/fr.lang.php
WEB-INF/resources/he.lang.php
WEB-INF/resources/hu.lang.php
WEB-INF/resources/it.lang.php
WEB-INF/resources/ja.lang.php
WEB-INF/resources/ko.lang.php
WEB-INF/resources/nl.lang.php
WEB-INF/resources/no.lang.php
WEB-INF/resources/pl.lang.php
WEB-INF/resources/pt-br.lang.php
WEB-INF/resources/pt.lang.php
WEB-INF/resources/ro.lang.php
WEB-INF/resources/ru.lang.php
WEB-INF/resources/sk.lang.php
WEB-INF/resources/sl.lang.php
WEB-INF/resources/sr.lang.php
WEB-INF/resources/sv.lang.php
WEB-INF/resources/tr.lang.php
WEB-INF/resources/zh-cn.lang.php
WEB-INF/resources/zh-tw.lang.php
WEB-INF/templates/footer.tpl
WEB-INF/templates/role_edit.tpl
role_edit.php

index 5a4baa9befad6bb9ac2f85fff92b8092c41a5998..19dd0111f5cb75b308819daeb0703f6c1c939640 100644 (file)
@@ -110,6 +110,10 @@ class Form {
                            $el = new Combobox($params["name"]);
                            $el->setData(@$params["data"]);
                            $el->setDataDefault(@$params["empty"]);
                            $el = new Combobox($params["name"]);
                            $el->setData(@$params["data"]);
                            $el->setDataDefault(@$params["empty"]);
+                            if (isset($params["multiple"])) {
+                              $el->setMultiple($params["multiple"]);
+                              $el->name .= '[]'; // Add brackets to the end of name to get back an array on POST.
+                            }
                            if (isset($params["datakeys"])) $el->setDataKeys($params["datakeys"]);
                            break;
 
                            if (isset($params["datakeys"])) $el->setDataKeys($params["datakeys"]);
                            break;
 
index 957bcdaf8305025911b9ec78f65ca93a9cc9063a..7e1039435b2ce07de3d51043a622a1aea54994ad 100644 (file)
@@ -69,19 +69,17 @@ class ttRoleHelper {
   }
 
   // update function updates a role in the database.
   }
 
   // update function updates a role in the database.
-  static function update($fields)
-  {
+  static function update($fields) {
     global $user;
     $mdb2 = getConnection();
 
     $id = (int)$fields['id'];
     global $user;
     $mdb2 = getConnection();
 
     $id = (int)$fields['id'];
-    $name = $fields['name'];
-    $description = $fields['description'];
-    $status = (int)$fields['status'];
-    // TODO: add rights later when we have them.
-
-    $sql = "update tt_roles set name = ".$mdb2->quote($name).", description = ".$mdb2->quote($description).
-      ", status = $status where id = $id and team_id = $user->team_id";
+    if (isset($fields['name'])) $name_part = 'name = '.$mdb2->quote($fields['name']);
+    if (isset($fields['description'])) $descr_part = ', description = '.$mdb2->quote($fields['description']);
+    if (isset($fields['status'])) $status_part = ', status = '.(int)$fields['status'];
+    if (isset($fields['rights'])) $rights_part = ', rights = '.$mdb2->quote($fields['rights']);
+    $parts = trim($name_part.$descr_part.$status_part.$rights_part, ',');
+    $sql = "update tt_roles set $parts where id = $id and team_id = $user->team_id";
     $affected = $mdb2->exec($sql);
     return (!is_a($affected, 'PEAR_Error'));
   }
     $affected = $mdb2->exec($sql);
     return (!is_a($affected, 'PEAR_Error'));
   }
index 4fe1148dbf9f43099878b6989159ee1e13cd680f..5da5aa5010747aa6b4b58a58b2ef5c19d050630e 100644 (file)
@@ -119,6 +119,7 @@ $i18n_key_words = array(
 'button.cancel' => 'Cancel·lar',
 'button.submit' => 'Enviar',
 'button.add' => 'Agregar',
 'button.cancel' => 'Cancel·lar',
 'button.submit' => 'Enviar',
 'button.add' => 'Agregar',
+'button.delete' => 'Eliminar',
 'button.generate' => 'Generar',
 // TODO: translate the following.
 // 'button.reset_password' => 'Reset password',
 'button.generate' => 'Generar',
 // TODO: translate the following.
 // 'button.reset_password' => 'Reset password',
index 5a04757b5e5700a301b872dd7c927c4d136b6d11..411dc555cafe6135d3eebb4946ab987010b7ede8 100644 (file)
@@ -122,6 +122,7 @@ $i18n_key_words = array(
 'button.cancel' => 'Zrušit',
 'button.submit' => 'Uložit',
 'button.add' => 'Přidat',
 'button.cancel' => 'Zrušit',
 'button.submit' => 'Uložit',
 'button.add' => 'Přidat',
+'button.delete' => 'Smazat',
 'button.generate' => 'Vytvořit',
 'button.reset_password' => 'Resetovat heslo',
 'button.send' => 'Poslat',
 'button.generate' => 'Vytvořit',
 'button.reset_password' => 'Resetovat heslo',
 'button.send' => 'Poslat',
index b5ec4b2219b11c96e2aae3d50aa35507b49a65c6..6390680e23b8eac2747f31d252104c5acd9c75e1 100644 (file)
@@ -106,6 +106,7 @@ $i18n_key_words = array(
 'button.cancel' => 'Fortryd',
 'button.submit' => 'Gem',
 'button.add' => 'Tilføj',
 'button.cancel' => 'Fortryd',
 'button.submit' => 'Gem',
 'button.add' => 'Tilføj',
+'button.delete' => 'Slet',
 'button.generate' => 'Generer',
 'button.reset_password' => 'Nulstil adgangskode',
 'button.send' => 'Send',
 'button.generate' => 'Generer',
 'button.reset_password' => 'Nulstil adgangskode',
 'button.send' => 'Send',
index 3cd956807af1e1c854266585e9aca1fc334af205..eb2dfdac7168d628ce8e518fd4afec64fb6a40f0 100644 (file)
@@ -106,6 +106,7 @@ $i18n_key_words = array(
 'button.cancel' => 'Abbrechen',
 'button.submit' => 'Abschicken',
 'button.add' => 'Hinzufügen',
 'button.cancel' => 'Abbrechen',
 'button.submit' => 'Abschicken',
 'button.add' => 'Hinzufügen',
+'button.delete' => 'Löschen',
 'button.generate' => 'Erstellen',
 'button.reset_password' => 'Passwort zurücksetzen',
 'button.send' => 'Senden',
 'button.generate' => 'Erstellen',
 'button.reset_password' => 'Passwort zurücksetzen',
 'button.send' => 'Senden',
index 408c0392ff4291fde5239195b4fffc4a24842a3a..b53e4836bf11c4278f679944504eb5e7be911b08 100644 (file)
@@ -105,6 +105,7 @@ $i18n_key_words = array(
 'button.cancel' => 'Cancel',
 'button.submit' => 'Submit',
 'button.add' => 'Add',
 'button.cancel' => 'Cancel',
 'button.submit' => 'Submit',
 'button.add' => 'Add',
+'button.delete' => 'Delete',
 'button.generate' => 'Generate',
 'button.reset_password' => 'Reset password',
 'button.send' => 'Send',
 'button.generate' => 'Generate',
 'button.reset_password' => 'Reset password',
 'button.send' => 'Send',
@@ -396,6 +397,8 @@ $i18n_key_words = array(
 'form.roles.active_roles' => 'Active Roles',
 'form.roles.inactive_roles' => 'Inactive Roles',
 'form.roles.rights' => 'Rights',
 'form.roles.active_roles' => 'Active Roles',
 'form.roles.inactive_roles' => 'Inactive Roles',
 'form.roles.rights' => 'Rights',
+'form.roles.assigned' => 'Assigned',
+'form.roles.not_assigned' => 'Not assigned',
 
 // Clients form. See example at https://timetracker.anuko.com/clients.php
 'form.clients.active_clients' => 'Active Clients',
 
 // Clients form. See example at https://timetracker.anuko.com/clients.php
 'form.clients.active_clients' => 'Active Clients',
index 7e618924dad81630f0627c24536b38f3fc7f80ce..2adf12e5ad5f3c24245e3dd9fc488af9b421ca07 100644 (file)
@@ -118,6 +118,7 @@ $i18n_key_words = array(
 'button.cancel' => 'Cancelar',
 'button.submit' => 'Enviar',
 'button.add' => 'Agregar',
 'button.cancel' => 'Cancelar',
 'button.submit' => 'Enviar',
 'button.add' => 'Agregar',
+'button.delete' => 'Eliminar',
 'button.generate' => 'Generar',
 // TODO: translate the following.
 // 'button.reset_password' => 'Reset password',
 'button.generate' => 'Generar',
 // TODO: translate the following.
 // 'button.reset_password' => 'Reset password',
index b572ae9541212448cab1f772620e82be92e744b2..9663f5f2b7211cfe08c2c1a7218d04a13c6d0997 100644 (file)
@@ -122,6 +122,7 @@ $i18n_key_words = array(
 'button.cancel' => 'Tühista',
 'button.submit' => 'Postita',
 'button.add' => 'Lisa',
 'button.cancel' => 'Tühista',
 'button.submit' => 'Postita',
 'button.add' => 'Lisa',
+'button.delete' => 'Kustuta',
 'button.generate' => 'Loo',
 'button.reset_password' => 'Tühjenda salasõna',
 'button.send' => 'Saada',
 'button.generate' => 'Loo',
 'button.reset_password' => 'Tühjenda salasõna',
 'button.send' => 'Saada',
index 020b403bbb5f270f80f3cec666a803c35af75ea6..d1605891e57bb5fbd9c1e88c9e085f0d117db625 100644 (file)
@@ -115,6 +115,7 @@ $i18n_key_words = array(
 'button.cancel' => 'لغو',
 'button.submit' => 'ثبت',
 'button.add' => 'درج',
 'button.cancel' => 'لغو',
 'button.submit' => 'ثبت',
 'button.add' => 'درج',
+'button.delete' => 'حذف',
 'button.generate' => 'تولید',
 'button.reset_password' => 'بازسازی رمزعبور',
 'button.send' => 'ارسال',
 'button.generate' => 'تولید',
 'button.reset_password' => 'بازسازی رمزعبور',
 'button.send' => 'ارسال',
index c608cb870be4e536ffa5c9e5473a16a18d36494e..639154e4308407c75e9be85179d4180a4b4f7094 100644 (file)
@@ -108,6 +108,7 @@ $i18n_key_words = array(
 'button.cancel' => 'Keskeytä',
 'button.submit' => 'Hyväksy',
 'button.add' => 'Lisää',
 'button.cancel' => 'Keskeytä',
 'button.submit' => 'Hyväksy',
 'button.add' => 'Lisää',
+'button.delete' => 'Poista',
 'button.generate' => 'Luo',
 'button.reset_password' => 'Nollaa salasana',
 'button.send' => 'Lähetä',
 'button.generate' => 'Luo',
 'button.reset_password' => 'Nollaa salasana',
 'button.send' => 'Lähetä',
index 76457f330e28b094b7ff2118c10e3c16fddbfb20..e2babb376bce38feec6ea3ede0ff4dccac124976 100644 (file)
@@ -106,6 +106,7 @@ $i18n_key_words = array(
 'button.cancel' => 'Annuler',
 'button.submit' => 'Soumettre',
 'button.add' => 'Ajouter',
 'button.cancel' => 'Annuler',
 'button.submit' => 'Soumettre',
 'button.add' => 'Ajouter',
+'button.delete' => 'Supprimer',
 'button.generate' => 'Générer',
 'button.reset_password' => 'Réinitialiser',
 'button.send' => 'Envoyer',
 'button.generate' => 'Générer',
 'button.reset_password' => 'Réinitialiser',
 'button.send' => 'Envoyer',
index 9a3a14a9b09b22c02692d80e11b24bf9deb9b598..a27e41eec2505234b8644f81713c74ad85f979af 100644 (file)
@@ -124,6 +124,7 @@ $i18n_key_words = array(
 'button.cancel' => 'ביטול',
 'button.submit' => 'שלח',
 'button.add' => 'הוסף',
 'button.cancel' => 'ביטול',
 'button.submit' => 'שלח',
 'button.add' => 'הוסף',
+'button.delete' => 'מחק',
 'button.generate' => 'הרץ',
 'button.reset_password' => 'איפוס סיסמה',
 'button.send' => 'שלח',
 'button.generate' => 'הרץ',
 'button.reset_password' => 'איפוס סיסמה',
 'button.send' => 'שלח',
index 88db66883cb3baf233c35e11371155a4baf381d7..a15c68125f41d88ad2398693ad0c2811e30601c4 100644 (file)
@@ -119,6 +119,7 @@ $i18n_key_words = array(
 'button.cancel' => 'Vissza',
 'button.submit' => 'Mentés',
 'button.add' => 'Hozzáadás',
 'button.cancel' => 'Vissza',
 'button.submit' => 'Mentés',
 'button.add' => 'Hozzáadás',
+'button.delete' => 'Törlés',
 'button.generate' => 'Generálás',
 // TODO: translate the following.
 // 'button.reset_password' => 'Reset password',
 'button.generate' => 'Generálás',
 // TODO: translate the following.
 // 'button.reset_password' => 'Reset password',
index 37407a9084b1c026d541270bd42ccea9b2f7add5..beed939f628917eb6cb0a3931d0e4a6aa962e698 100644 (file)
@@ -107,6 +107,7 @@ $i18n_key_words = array(
 'button.cancel' => 'Cancella',
 'button.submit' => 'Invia',
 'button.add' => 'Aggiungi',
 'button.cancel' => 'Cancella',
 'button.submit' => 'Invia',
 'button.add' => 'Aggiungi',
+'button.delete' => 'Elimina',
 'button.generate' => 'Genera',
 'button.reset_password' => 'Reset password',
 'button.send' => 'Invia',
 'button.generate' => 'Genera',
 'button.reset_password' => 'Reset password',
 'button.send' => 'Invia',
index 0c857f9d5580778d2008b7b1f41bfd1956c3a5c4..669fe10c0637ca5ecd4993ca1eb150c35e6d831c 100644 (file)
@@ -121,6 +121,7 @@ $i18n_key_words = array(
 'button.cancel' => 'キャンセル',
 'button.submit' => '送信',
 'button.add' => '追加',
 'button.cancel' => 'キャンセル',
 'button.submit' => '送信',
 'button.add' => '追加',
+'button.delete' => '削除',
 'button.generate' => '生成',
 // TODO: translate the following.
 // 'button.reset_password' => 'Reset password',
 'button.generate' => '生成',
 // TODO: translate the following.
 // 'button.reset_password' => 'Reset password',
index 115cfe01a5e0608243a95dc65d0c9fca581c2374..2811722706866611d71431ca3b0a78739208c3c1 100644 (file)
@@ -121,6 +121,7 @@ $i18n_key_words = array(
 'button.cancel' => '취소',
 'button.submit' => '발송',
 'button.add' => '추가',
 'button.cancel' => '취소',
 'button.submit' => '발송',
 'button.add' => '추가',
+'button.delete' => '삭제',
 'button.generate' => '생성',
 // TODO: translate the following.
 // 'button.reset_password' => 'Reset password',
 'button.generate' => '생성',
 // TODO: translate the following.
 // 'button.reset_password' => 'Reset password',
index 9cc82c8f81d8bc941c48eb225b6649fee80af03e..9e6b63d09f08598e16ce025f5f2c0c4389ed2dc0 100644 (file)
@@ -105,6 +105,7 @@ $i18n_key_words = array(
 'button.cancel' => 'Afbreken',
 'button.submit' => 'Bewaren',
 'button.add' => 'Toevoegen',
 'button.cancel' => 'Afbreken',
 'button.submit' => 'Bewaren',
 'button.add' => 'Toevoegen',
+'button.delete' => 'Verwijderen',
 'button.generate' => 'Genereren',
 'button.reset_password' => 'Herstel het wachtwoord',
 'button.send' => 'Verzenden',
 'button.generate' => 'Genereren',
 'button.reset_password' => 'Herstel het wachtwoord',
 'button.send' => 'Verzenden',
index a369452f968d00daefbc1dbf9933685a5e1b82e0..04fe3c468c25ff2089e5e1650e2659771760dfef 100644 (file)
@@ -122,6 +122,7 @@ $i18n_key_words = array(
 // TODO: translate the following.
 // 'button.submit' => 'Submit',
 'button.add' => 'Legg til',
 // TODO: translate the following.
 // 'button.submit' => 'Submit',
 'button.add' => 'Legg til',
+'button.delete' => 'Slett',
 'button.generate' => 'Generer',
 'button.reset_password' => 'Resett passord',
 'button.send' => 'Send',
 'button.generate' => 'Generer',
 'button.reset_password' => 'Resett passord',
 'button.send' => 'Send',
index 27466aa3855eca9e71c49a66b6c46817db0c118e..8889ec2a0feaf546665f196f7f37eee0cba7f2b9 100644 (file)
@@ -110,6 +110,7 @@ $i18n_key_words = array(
 'button.cancel' => 'Anuluj',
 'button.submit' => 'Zatwierdź',
 'button.add' => 'Dodaj',
 'button.cancel' => 'Anuluj',
 'button.submit' => 'Zatwierdź',
 'button.add' => 'Dodaj',
+'button.delete' => 'Usuń',
 'button.generate' => 'Wygeneruj',
 'button.reset_password' => 'Resetuj hasło',
 'button.send' => 'Wyślij',
 'button.generate' => 'Wygeneruj',
 'button.reset_password' => 'Resetuj hasło',
 'button.send' => 'Wyślij',
index f6e7448009584c1bb043671fe3f4f5060b43eab0..8b49b7b781e7fec4460289da32dc04b76cbc1b9d 100644 (file)
@@ -107,6 +107,7 @@ $i18n_key_words = array(
 'button.cancel' => 'Cancelar',
 'button.submit' => 'Enviar',
 'button.add' => 'Adicionar',
 'button.cancel' => 'Cancelar',
 'button.submit' => 'Enviar',
 'button.add' => 'Adicionar',
+'button.delete' => 'Apagar',
 'button.generate' => 'Criar',
 'button.reset_password' => 'Resetar senha',
 'button.send' => 'Enviar',
 'button.generate' => 'Criar',
 'button.reset_password' => 'Resetar senha',
 'button.send' => 'Enviar',
index 2a4f3a1d4ef01eb4968091057117b02ec2f87496..c8bb53c6184510140ab769c8b91348f3373d1f3a 100644 (file)
@@ -117,6 +117,7 @@ $i18n_key_words = array(
 'button.cancel' => 'Cancelar',
 'button.submit' => 'Submeter',
 'button.add' => 'Adicionar',
 'button.cancel' => 'Cancelar',
 'button.submit' => 'Submeter',
 'button.add' => 'Adicionar',
+'button.delete' => 'Apagar',
 // TODO: translate the following.
 // 'button.generate' => 'Generate',
 // 'button.reset_password' => 'Reset password',
 // TODO: translate the following.
 // 'button.generate' => 'Generate',
 // 'button.reset_password' => 'Reset password',
index c9893fa3cd54d20b545d156739a2109e84fe910a..f1ce0376c90e0a961646b16a5786a9ebbfb0bf35 100644 (file)
@@ -125,6 +125,7 @@ $i18n_key_words = array(
 'button.cancel' => 'Renunta',
 'button.submit' => 'Trimite',
 'button.add' => 'Adauga',
 'button.cancel' => 'Renunta',
 'button.submit' => 'Trimite',
 'button.add' => 'Adauga',
+'button.delete' => 'Șterge',
 'button.generate' => 'Genereaza',
 // TODO: translate the following.
 // 'button.reset_password' => 'Reset password',
 'button.generate' => 'Genereaza',
 // TODO: translate the following.
 // 'button.reset_password' => 'Reset password',
index e84243af2f626b23f32270f47bef5ad99bdf9264..a612f95c7da7352519ec0dcb0a0acfed43963e6d 100644 (file)
@@ -104,6 +104,7 @@ $i18n_key_words = array(
 'button.cancel' => 'Отменить',
 'button.submit' => 'Подтвердить',
 'button.add' => 'Добавить',
 'button.cancel' => 'Отменить',
 'button.submit' => 'Подтвердить',
 'button.add' => 'Добавить',
+'button.delete' => 'Удалить',
 'button.generate' => 'Сгенерировать',
 'button.reset_password' => 'Сбросить пароль',
 'button.send' => 'Отправить',
 'button.generate' => 'Сгенерировать',
 'button.reset_password' => 'Сбросить пароль',
 'button.send' => 'Отправить',
index f1a6d4111e5b8dd8361c7ad4438e800b85c6d025..25676d2edc351847c640e26d92530b89204a1dbf 100644 (file)
@@ -114,6 +114,7 @@ $i18n_key_words = array(
 'button.cancel' => 'Zrušiť',
 'button.submit' => 'Odoslať',
 'button.add' => 'Pridať',
 'button.cancel' => 'Zrušiť',
 'button.submit' => 'Odoslať',
 'button.add' => 'Pridať',
+'button.delete' => 'Vymazať',
 'button.generate' => 'Generovať',
 'button.reset_password' => 'Obnoviť heslo',
 'button.send' => 'Odoslať',
 'button.generate' => 'Generovať',
 'button.reset_password' => 'Obnoviť heslo',
 'button.send' => 'Odoslať',
index 689fccacd976e8fafb9068c5adad19ae596a6d77..839bdba814db1c26e1d7e5be3f7063132c1c7543 100644 (file)
@@ -116,6 +116,7 @@ $i18n_key_words = array(
 'button.cancel' => 'Prekliči',
 'button.submit' => 'Potrdi',
 'button.add' => 'Dodaj',
 'button.cancel' => 'Prekliči',
 'button.submit' => 'Potrdi',
 'button.add' => 'Dodaj',
+'button.delete' => 'Izbriši',
 'button.generate' => 'Ustvari',
 // TODO: translate the following.
 // 'button.reset_password' => 'Reset password',
 'button.generate' => 'Ustvari',
 // TODO: translate the following.
 // 'button.reset_password' => 'Reset password',
index bf1e6052a902d9b0b0a2a4aa154bd8fa8a8ac798..3bfa69c05046f1fdf0cb1dcaa48a0b5217e022b3 100644 (file)
@@ -107,6 +107,7 @@ $i18n_key_words = array(
 'button.cancel' => 'Otkaži',
 'button.submit' => 'Pošalji',
 'button.add' => 'Dodaj',
 'button.cancel' => 'Otkaži',
 'button.submit' => 'Pošalji',
 'button.add' => 'Dodaj',
+'button.delete' => 'Obriši',
 'button.generate' => 'Napravi',
 'button.reset_password' => 'Resetuj lozinku',
 'button.send' => 'Pošalji',
 'button.generate' => 'Napravi',
 'button.reset_password' => 'Resetuj lozinku',
 'button.send' => 'Pošalji',
index f75436dcc54324849ce0440e94849c4ca8749e07..ae5e2d3381db622b6443109da1a60d799ac4ae33 100644 (file)
@@ -107,6 +107,7 @@ $i18n_key_words = array(
 'button.cancel' => 'Avbryt',
 'button.submit' => 'Skicka',
 'button.add' => 'Lägg till',
 'button.cancel' => 'Avbryt',
 'button.submit' => 'Skicka',
 'button.add' => 'Lägg till',
+'button.delete' => 'Ta bort',
 'button.generate' => 'Generera',
 'button.reset_password' => 'Återställ lösenord',
 'button.send' => 'Skicka',
 'button.generate' => 'Generera',
 'button.reset_password' => 'Återställ lösenord',
 'button.send' => 'Skicka',
index 54b4d83ce41c2f110b0a99fa9b503834e5e82f25..dc15a2e6447a6478dfda24f6eac4b057cad99416 100644 (file)
@@ -127,6 +127,7 @@ $i18n_key_words = array(
 'button.cancel' => 'Iptal',
 'button.submit' => 'Gönder',
 'button.add' => 'Ekle',
 'button.cancel' => 'Iptal',
 'button.submit' => 'Gönder',
 'button.add' => 'Ekle',
+'button.delete' => 'Sil',
 'button.generate' => 'Yarat',
 // TODO: translate the following.
 // 'button.reset_password' => 'Reset password',
 'button.generate' => 'Yarat',
 // TODO: translate the following.
 // 'button.reset_password' => 'Reset password',
index a1700c9e83e365504fd19ce50a07b4dce71d8ec1..3ab0904af2a3efb6318ea590b3c606652b07491c 100644 (file)
@@ -113,6 +113,7 @@ $i18n_key_words = array(
 'button.cancel' => '取消',
 'button.submit' => '提交',
 'button.add' => '添加',
 'button.cancel' => '取消',
 'button.submit' => '提交',
 'button.add' => '添加',
+'button.delete' => '删除',
 'button.generate' => '创建',
 'button.reset_password' => '重置密码',
 'button.send' => '发送',
 'button.generate' => '创建',
 'button.reset_password' => '重置密码',
 'button.send' => '发送',
index f0675a6cd3099058dd57a04da3898d71d265f093..b9e73baec6a17e37aafcf74ef46c24cfef2ecdc4 100644 (file)
@@ -119,6 +119,7 @@ $i18n_key_words = array(
 'button.cancel' => '取消',
 'button.submit' => '提交',
 'button.add' => '添加',
 'button.cancel' => '取消',
 'button.submit' => '提交',
 'button.add' => '添加',
+'button.delete' => '刪除',
 'button.generate' => '創建',
 'button.reset_password' => '重設密碼',
 'button.send' => '發送',
 'button.generate' => '創建',
 'button.reset_password' => '重設密碼',
 'button.send' => '發送',
index 6c2702eece5f79d3775a414aad863bb7f6b99d4a..e7f9eb4ca5cc7b1054538942f1ff483c4e15640b 100644 (file)
@@ -12,7 +12,7 @@
       <br>
       <table cellspacing="0" cellpadding="4" width="100%" border="0">
         <tr>
       <br>
       <table cellspacing="0" cellpadding="4" width="100%" border="0">
         <tr>
-          <td align="center">&nbsp;Anuko Time Tracker 1.17.32.4027 | Copyright &copy; <a href="https://www.anuko.com/lp/tt_3.htm" target="_blank">Anuko</a> |
+          <td align="center">&nbsp;Anuko Time Tracker 1.17.32.4028 | Copyright &copy; <a href="https://www.anuko.com/lp/tt_3.htm" target="_blank">Anuko</a> |
             <a href="https://www.anuko.com/lp/tt_4.htm" target="_blank">{$i18n.footer.credits}</a> |
             <a href="https://www.anuko.com/lp/tt_5.htm" target="_blank">{$i18n.footer.license}</a> |
             <a href="https://www.anuko.com/lp/tt_7.htm" target="_blank">{$i18n.footer.improve}</a>
             <a href="https://www.anuko.com/lp/tt_4.htm" target="_blank">{$i18n.footer.credits}</a> |
             <a href="https://www.anuko.com/lp/tt_5.htm" target="_blank">{$i18n.footer.license}</a> |
             <a href="https://www.anuko.com/lp/tt_7.htm" target="_blank">{$i18n.footer.improve}</a>
index 7a20d6a85acd733aff90078d1edc68a85425b8fe..6ba4ddce9ca48a6a39566c6c30bfc7e45851ac8c 100644 (file)
           <td></td>
           <td>{$i18n.label.required_fields}</td>
         </tr>
           <td></td>
           <td>{$i18n.label.required_fields}</td>
         </tr>
+        <tr>
+          <td colspan="2" align="center" height="50">{$forms.roleForm.btn_save.control}</td>
+        </tr>
         <tr>
           <td></td>
           <td>&nbsp;</td>
         </tr>
         <tr>
         <tr>
           <td></td>
           <td>&nbsp;</td>
         </tr>
         <tr>
-          <td colspan="2" align="center" height="50">{$forms.roleForm.btn_save.control}</td>
+          <td align = "right">{$i18n.form.roles.assigned}:</td>
+          <td>{$forms.roleForm.assigned_rights.control}</td><td>{$forms.roleForm.btn_delete.control}</td>
+        </tr>
+        <tr>
+          <td align = "right">{$i18n.form.roles.not_assigned}:</td>
+          <td>{$forms.roleForm.available_rights.control}</td><td>{$forms.roleForm.btn_add.control}</td>
         </tr>
       </table>
     </td>
         </tr>
       </table>
     </td>
index 94d47e609024ec15412d239c2199d25ed8eba124..21ed258d1f649f1c3db2992e97702971c6e05d1e 100644 (file)
@@ -37,15 +37,20 @@ if (!ttAccessCheck(right_manage_team)) {
   header('Location: access_denied.php');
   exit();
 }
   header('Location: access_denied.php');
   exit();
 }
-
 $cl_role_id = (int)$request->getParameter('id');
 $cl_role_id = (int)$request->getParameter('id');
+$role = ttRoleHelper::get($cl_role_id);
+if (!$role) {
+  header('Location: access_denied.php');
+  exit();
+}
+$assigned_rights = explode(',', $role['rights']);
+$available_rights = array_diff($user->rights_array, $assigned_rights);
 
 if ($request->isPost()) {
   $cl_name = trim($request->getParameter('name'));
   $cl_description = trim($request->getParameter('description'));
   $cl_status = $request->getParameter('status');
 } else {
 
 if ($request->isPost()) {
   $cl_name = trim($request->getParameter('name'));
   $cl_description = trim($request->getParameter('description'));
   $cl_status = $request->getParameter('status');
 } else {
-  $role = ttRoleHelper::get($cl_role_id);
   $cl_name = $role['name'];
   $cl_description = $role['description'];
   $cl_status = $role['status'];
   $cl_name = $role['name'];
   $cl_description = $role['description'];
   $cl_status = $role['status'];
@@ -55,30 +60,74 @@ $form = new Form('roleForm');
 $form->addInput(array('type'=>'hidden','name'=>'id','value'=>$cl_role_id));
 $form->addInput(array('type'=>'text','maxlength'=>'100','name'=>'name','style'=>'width: 250px;','value'=>$cl_name));
 $form->addInput(array('type'=>'textarea','name'=>'description','style'=>'width: 250px; height: 40px;','value'=>$cl_description));
 $form->addInput(array('type'=>'hidden','name'=>'id','value'=>$cl_role_id));
 $form->addInput(array('type'=>'text','maxlength'=>'100','name'=>'name','style'=>'width: 250px;','value'=>$cl_name));
 $form->addInput(array('type'=>'textarea','name'=>'description','style'=>'width: 250px; height: 40px;','value'=>$cl_description));
+
+// Multiple select controls for assigned and available rights.
+$form->addInput(array('type'=>'combobox','name'=>'assigned_rights','style'=>'width: 250px;','multiple'=>true,'data'=>$assigned_rights));
+$form->addInput(array('type'=>'submit','name'=>'btn_delete','value'=>$i18n->getKey('button.delete')));
+$form->addInput(array('type'=>'combobox','name'=>'available_rights','style'=>'width: 250px;','multiple'=>true,'data'=>$available_rights));
+$form->addInput(array('type'=>'submit','name'=>'btn_add','value'=>$i18n->getKey('button.add')));
+
+
 $form->addInput(array('type'=>'combobox','name'=>'status','value'=>$cl_status,
   'data'=>array(ACTIVE=>$i18n->getKey('dropdown.status_active'),INACTIVE=>$i18n->getKey('dropdown.status_inactive'))));
 $form->addInput(array('type'=>'submit','name'=>'btn_save','value'=>$i18n->getKey('button.save')));
 
 if ($request->isPost()) {
 $form->addInput(array('type'=>'combobox','name'=>'status','value'=>$cl_status,
   'data'=>array(ACTIVE=>$i18n->getKey('dropdown.status_active'),INACTIVE=>$i18n->getKey('dropdown.status_inactive'))));
 $form->addInput(array('type'=>'submit','name'=>'btn_save','value'=>$i18n->getKey('button.save')));
 
 if ($request->isPost()) {
-  // Validate user input.
-  if (!ttValidString($cl_name)) $err->add($i18n->getKey('error.field'), $i18n->getKey('label.thing_name'));
-  if (!ttValidString($cl_description, true)) $err->add($i18n->getKey('error.field'), $i18n->getKey('label.description'));
+    if ($request->getParameter('btn_save')) {
+    // Validate user input.
+    if (!ttValidString($cl_name)) $err->add($i18n->getKey('error.field'), $i18n->getKey('label.thing_name'));
+    if (!ttValidString($cl_description, true)) $err->add($i18n->getKey('error.field'), $i18n->getKey('label.description'));
 
 
-  if ($err->no()) {
-    $existing_role = ttRoleHelper::getRoleByName($cl_name);
-    if (!$existing_role || ($cl_role_id == $existing_role['id'])) {
-      // Update role information.
-      if (ttRoleHelper::update(array(
-        'id' => $cl_role_id,
-        'name' => $cl_name,
-        'description' => $cl_description,
-        'status' => $cl_status))) {
-        header('Location: roles.php');
-        exit();
+    if ($err->no()) {
+      $existing_role = ttRoleHelper::getRoleByName($cl_name);
+      if (!$existing_role || ($cl_role_id == $existing_role['id'])) {
+        // Update role information.
+        if (ttRoleHelper::update(array(
+          'id' => $cl_role_id,
+          'name' => $cl_name,
+          'description' => $cl_description,
+          'status' => $cl_status))) {
+          header('Location: roles.php');
+          exit();
+        } else
+          $err->add($i18n->getKey('error.db'));
       } else
       } else
-        $err->add($i18n->getKey('error.db'));
-    } else
-      $err->add($i18n->getKey('error.object_exists'));
+        $err->add($i18n->getKey('error.object_exists'));
+    }
+  }
+  if ($request->getParameter('btn_delete') && $request->getParameter('assigned_rights')) {
+     $rights = $role['rights'];
+     $to_delete = $request->getParameter('assigned_rights');
+     foreach($to_delete as $index) {
+       $right_to_delete = $assigned_rights[$index];
+       $rights = str_replace($right_to_delete, '', $rights);
+       $rights = str_replace(',,',',', $rights);
+     }
+     $rights = trim($rights, ',');
+     if (ttRoleHelper::update(array('id' => $cl_role_id,'rights'=> $rights))) {
+       header('Location: role_edit.php?id='.$role['id']);
+       exit();
+     } else
+       $err->add($i18n->getKey('error.db'));
+  }
+  if ($request->getParameter('btn_add') && $request->getParameter('available_rights')) {
+     $rights = $role['rights'];
+     $to_add = $request->getParameter('available_rights');
+     foreach($to_add as $index) {
+       $right_to_add = $available_rights[$index];
+       // Just in case remove it.
+       $rights = str_replace($right_to_add, '', $rights);
+       $rights = str_replace(',,',',', $rights);
+       // Add the right only if we have it ourselves.
+       if (in_array($right_to_add, $user->rights_array))
+         $rights .= ','.$right_to_add;
+     }
+     $rights = trim($rights, ',');
+     if (ttRoleHelper::update(array('id' => $cl_role_id,'rights'=> $rights))) {
+       header('Location: role_edit.php?id='.$role['id']);
+       exit();
+     } else
+       $err->add($i18n->getKey('error.db'));
   }
 } // isPost
 
   }
 } // isPost