/* MODULE "imageweb" - part SERVER author : iri - http://www.irizone.net version 1.0 - june 2004 */ typeof path = S;; /* url */ typeof flag = S;; /* flag du bitmap chez le client */ typeof clis = [CLIENT r1];; /* liste des clients */ typeof dmifile = S;; /* fichier dms */ typeof button = ObjButton;; /* button admin */ typeof url = ObjText;; /* champ admin */ defcom CnewAll = newAll S;; fun bycli(cli, p)= cli == p;; fun broad(cli, p)= _DMSsend this cli p;; fun logout(cli)= _DMSevent this cli "destroyed" nil nil; let search_in_list clis @bycli cli -> c in if c == nil then 0 else (set clis = remove_from_list clis c; 0);; fun cbNewAll(from, user, action, param, others, tag) = if !(_DMSclientAlive UtoC user) then (apply_on_list clis @broad CnewAll [param]; 0) else 0;; fun cbDestroy (from, user, action, param, others, tag) = let UtoC user -> cli in (_DMSdelClientDMI this cli; logout cli); 0;; fun cbStart(from, user, action, param, others, tag) = if (_DMSclientAlive UtoC user) then let UtoC user -> cli in (_DMScreateClientDMI this cli linebuild path::flag::nil; set clis = cli::clis; 0) else 0;; fun chgurl(l, s)= _fooS strcat ">>>>urlimgweb>>>>" s; if l == nil then nil else let l->[a n] in if strcmp hd a "urlimgweb" then a::chgurl n s else ("urlimgweb"::s::nil)::chgurl n s;; fun cbSave(btn, u)= set path = _GETtext url; _storepack strbuild chgurl strextr _getpack _checkpack dmifile path dmifile; _DMSevent this nil "chgAdmin" path nil; apply_on_list clis @broad CnewAll [linebuild path::flag::nil]; 0;; fun cbEndAdmin(win, u)= _DSwindow win;; fun cbAdmin(btn, win)= let _CRwindow _channel win 5 5 250 50 WN_MENU "Admin image web" -> winAdmin in ( _CRtext _channel winAdmin 5 5 40 20 ET_BORDER "url :"; set url = _CReditLine _channel winAdmin 50 5 195 20 ET_DOWN|ET_AHSCROLL path; _SETtextFocus url; set button = _CRbutton _channel winAdmin 5 30 240 20 0 "Save"; _CBbutton button @cbSave 0; _CBwinDestroy winAdmin @cbEndAdmin 0 ); 0;; fun _resize(x, s)= let x -> [win x y w h] in _SIZEbutton button w h x y; 0;; fun IniDMI(file)= let strextr _getpack _checkpack file -> l in let getInfo l "nameAdmin" -> name in ( set path = getInfo l "urlimgweb"; set flag = getInfo l "flagBMP"; let _DMSgetZone this "Button" nil @_resize nil ->[win x y w h] in if win==nil then nil else _CBbutton _CRbutton _channel win x y w h 0 name @cbAdmin win ); set dmifile = file; _DMSregister this @logout nil nil; _DMSdefineActions this ["start" @cbStart]:: ["destroy" @cbDestroy]:: ["newAll" @cbNewAll]:: nil; 0;;