Dynamiczne napisy kafelków w menu głównym
Dynamiczna zmiana podpisów kafelków w menu głównym jest wykonywana w menu OnOpenMenu Trigger odpowiedniego menu głównego. W ten sposób można dostosować ikonę, kolor i tekst płytki.
Ikony/kolory
Ikona i kolor płytek menu głównego są przechowywane w tabeli ACF Anveo Page Element Menu. Aby zmienić te wartości w aplikacji, należy najpierw zidentyfikować odpowiedni wpis w tabeli. Wszystkie pozycje menu, które nie należą do jednej Anveo Page są oznaczone pustym polem Kod Anveo Page.
1 2 3 4 5 6 7 |
local anveoPageElementMenu = Record('ACF Anveo Page Element Menu'); -- [[get Main Menu Entry for My Messages]] anveoPageElementMenu:SETRANGE('Anveo Page Code',''); anveoPageElementMenu:SETRANGE('Action Code',''); anveoPageElementMenu:SETRANGE('Linked Anveo Page','ASLS_NOTIFICATIONS'); anveoPageElementMenu:FINDFIRST(); |
W tym wpisie symbol i kolor tła mogą być dynamicznie zmieniane poprzez zmianę pól Background Color i Icon Description. Kompletny przykład powiadomień może wyglądać w ten sposób:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 |
local anveoPageElementMenu = Record('ACF Anveo Page Element Menu'); local ACFNotification = Record('ACF Notification'); local colorRed = '#bd3939'; local colorGreen = '#00b050'; local colorBlue = '#5b9bd5'; local colorGray = '#7c7c7c'; -- [[get Main Menu Entry for My Messages]] anveoPageElementMenu:SETRANGE('Anveo Page Code',''); anveoPageElementMenu:SETRANGE('Action Code',''); anveoPageElementMenu:SETRANGE('Linked Anveo Page','ASLS_NOTIFICATIONS'); anveoPageElementMenu:FINDFIRST(); --[[check if there are unread Notifications]] ACFNotification:SETRANGE('Status', 5); if ACFNotification:ISEMPTY() then --[[no unread messages]] --[[set the background color to gray and set the symbol to "mail"]] anveoPageElementMenu:SETVALUE('Background Color', colorGray); anveoPageElementMenu:SETVALUE('Icon Description', 'mail'); anveoPageElementMenu:MODIFY(false); else --[[there are unread messages]] --[[set the background color to red and set the symbol to "mail_open"]] anveoPageElementMenu:SETVALUE('Background Color', colorRed); anveoPageElementMenu:SETVALUE('Icon Description', 'mail_open'); anveoPageElementMenu:MODIFY(false); end; |
Tekst
Teksty pozycji menu głównego są zdefiniowane w tabeli ACF Multilanguage. Są one identyfikowane przez table number, pola PK i language. Pole zawiera wyświetlany tekst. Dla tabeli ACF Anveo Page Element Menu (w którym przechowywane są płytki menu głównego) można je znaleźć i zmienić w następujący sposób:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 |
local anveoPageElementMenu = Record('ACF Anveo Page Element Menu'); anveoPageElementMenu:SETRANGE('Anveo Page Code',''); anveoPageElementMenu:SETRANGE('Action Code',''); anveoPageElementMenu:SETRANGE('Linked Anveo Page','ASLS_NOTIFICATIONS'); anveoPageElementMenu:FINDFIRST(); --[[Get Multilanguage Entry for currently selected Language and Main Menu entry]] local multilanguage = Record('ACF Multilanguage'); multilanguage:SETRANGE('PK Table No.', anveoPageElementMenu:GETTABLENO()); multilanguage:SETRANGE('Language', GLOBALLANGUAGECODE()); multilanguage:SETRANGE('PK No. 1', anveoPageElementMenu:GETVALUE('Anveo Page Element Line No.')); multilanguage:SETRANGE('PK No. 2', anveoPageElementMenu:GETVALUE('Entry No.')); multilanguage:FINDFIRST(); multilanguage:SETVALUE('Value','Hello World'); multilanguage:MODIFY(false); |
Przykład zmiany płytki zgłoszeniowej aplikacji Anveo Base Apps
Przykład powiadomień wygląda następująco, łącznie ze zmianą tekstów:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 |
local function changeText(anveoPageElementMenu,text) --[[Get Multilanguage Entry for currently selected Language and Main Menu entry]] local multilanguage = Record('ACF Multilanguage'); multilanguage:SETRANGE('PK Table No.', anveoPageElementMenu:GETTABLENO()); multilanguage:SETRANGE('Language', GLOBALLANGUAGECODE()); multilanguage:SETRANGE('PK No. 1', anveoPageElementMenu:GETVALUE('Anveo Page Element Line No.')); multilanguage:SETRANGE('PK No. 2', anveoPageElementMenu:GETVALUE('Entry No.')); multilanguage:FINDFIRST(); multilanguage:SETVALUE('Value',text); multilanguage:MODIFY(false); end; local anveoPageElementMenu = Record('ACF Anveo Page Element Menu'); local ACFNotification = Record('ACF Notification'); local colorRed = '#bd3939'; local colorGreen = '#00b050'; local colorBlue = '#5b9bd5'; local colorGray = '#7c7c7c'; -- [[get Main Menu Entry for My Messages]] anveoPageElementMenu:SETRANGE('Anveo Page Code',''); anveoPageElementMenu:SETRANGE('Action Code',''); anveoPageElementMenu:SETRANGE('Linked Anveo Page','ASLS_NOTIFICATIONS'); anveoPageElementMenu:FINDFIRST(); --[[check if there are unread Notifications]] local total = ACFNotification:COUNT(); ACFNotification:SETRANGE('Status', 5); local unread = ACFNotification:COUNT(); if ACFNotification:ISEMPTY() then --[[no unread messages]] --[[set the background color to gray and set the symbol to "mail"]] anveoPageElementMenu:SETVALUE('Background Color', colorGray); anveoPageElementMenu:SETVALUE('Icon Description', 'mail'); anveoPageElementMenu:MODIFY(false); --[[change Text accordingly]] changeText(anveoPageElementMenu,GETTEXT('ASLS_NOTIFICATIONS',total)); else --[[there are unread messages]] --[[set the background color to red and set the symbol to "mail_open"]] anveoPageElementMenu:SETVALUE('Background Color', colorRed); anveoPageElementMenu:SETVALUE('Icon Description', 'mail_open'); anveoPageElementMenu:MODIFY(false); --[[change Text accordingly]] changeText(anveoPageElementMenu,GETTEXT('ASLS_NOTIFICATIONS_UNREAD',total,unread)); end; |