/* module Access - part Client */ /* by iri : http://www.irizone.net */ /* version 1.0 - june 2004 */ typeof liste = [S r1];; typeof nameSite = S;; typeof fileAccess = S;; typeof textAdmin = ObjText;; fun _resize(x,s)= let x -> [win x y w h] in (_SIZEwindow win w h x y; _SIZEtext textAdmin w-2 h-2 1 1); 0;; fun end(win, u)= _DSwindow win;; fun _chgAdmin(obj, u)= set liste = lineextr _GETtext textAdmin; _createpack linebuild liste _getmodifypack fileAccess;; fun refreshAdmin()= _SETtext textAdmin linebuild liste; 0;; /* fun [I S S] [S r1] */ fun loginChanged(i, new, old)= if i > (sizelist liste) then let localtime time -> [_ _ _ d m y _ _] in set liste = (strcatn new::" "::(itoa d)::":"::(itoa m)::":"::(itoa y)::nil)::liste else let strfind old nth_list liste i 0 -> r in if r == 0 then let substr nth_list liste i strlen old 100 -> s in set liste = replace_nth_in_list liste i strcat new s else loginChanged i+1 new old;; /* fun [I S] [S r1] */ fun searchValue(i, login)= if i > (sizelist liste) then let localtime time -> [_ _ _ d m y _ _] in set liste = (strcatn login::" "::(itoa d)::":"::(itoa m)::":"::(itoa y)::nil)::liste else let strfind login nth_list liste i 0 -> r in if r == 0 then let localtime time -> [_ _ _ d m y _ _] in set liste = replace_nth_in_list liste i strcatn login::" "::(itoa d)::":"::(itoa m)::":"::(itoa y)::nil else searchValue i+1 login;; /* fun [User] I */ fun chgValue(u)= let UtoC u -> cli in let _DMSgetLogin cli -> login in searchValue 0 login; _createpack linebuild liste _getmodifypack fileAccess;; fun cbStart(from, user, action, param, others, tag) = if (_DMSclientAlive UtoC user) then (_DMScreateClientDMI this UtoC user nameSite; chgValue user; refreshAdmin; 0) else 0;; fun chgLogin(from, user, action, param, others, tag)= let UtoC user -> cli in loginChanged 0 _DMSgetLogin cli param; refreshAdmin; _createpack linebuild liste _getmodifypack fileAccess;; fun cbAdmin(from, user, action, param, others, tag)= let let _DMSgetZone this "Access" nil @_resize nil -> [wn x y w h] in if wn==nil then _CRwindow _channel DMSwin nil nil 200 300 WN_MENU|WN_MINBOX|WN_MAXBOX "Access" else _CRwindow _channel wn x y w h WN_CHILDINSIDE|WN_NOCAPTION|WN_NOBORDER "Access" -> win in let _GETwindowPositionSize win -> [x y w h] in ( _CBwinDestroy win @end 0; set textAdmin = _CReditText _channel win 1 1 w-2 h-2 ET_HSCROLL|ET_VSCROLL|ET_DOWN linebuild liste; _CBtext textAdmin @_chgAdmin 0; 0 );; fun down(box, u, i)= _closemachine;; fun cbNil()= _DLGrflmessage _DLGMessageBox _channel DMSwin "Error !" "File 'Access' Missing !! The server will be closed !\nFichier 'Access' manquant !! Le serveur va être éteint !" 1 @down 0; 0;; fun IniDMI (file)= let strextr _getpack _checkpack file -> l in let getInfo l "listAccess" -> tmp in let getInfo l "nameSite" -> name in (set fileAccess = tmp; if fileAccess != nil then (set liste = lineextr _getpack _checkpack fileAccess; 0) else (cbNil; 0); set nameSite = name); _DMSdefineActions this ["start" @cbStart]:: ["!chgLogin" @chgLogin]:: ["admin" @cbAdmin]:: nil; 0;;