/* Module 'newsHTML' - by iri : http://www.irizone.net */ /* version 1.0 - juillet 2004 - copyleft iri */ typeof head = S;; typeof foot = S;; typeof body = S;; typeof file = S;; typeof news = [S r1];; typeof edit = [CLIENT r1];; typeof dmifile = S;; defcom CeditOk = editOk S S;; defcom Cnews = news S;; fun cbStart (from, user, action, param, others, tag) = _DMScreateClientDMI this UtoC user linebuild head::foot::body::nil; _DMSeventTag this user "entering" nil nil nil; 0;; fun IniDMI(fic)= set dmifile = fic; let strextr _getpack _checkpack fic -> l in ( set head = getInfo l "title"; set foot = getInfo l "link"; set body = getInfo l "body"; set file = getInfo l "file"; ); set news = lineextr _getpack _checkpack file; _DMSdefineActions this ["start" @cbStart]:: nil; 0;; fun _datey(s)= let strfind ":" s 0 -> r in let strfind ":" s r -> rr in substr s rr strlen s;; fun _datem(s)= let strfind ":" s 0 -> r in let strfind ":" s r -> rr in substr s r+1 rr-r;; fun _dated(s)= let strfind ":" s 0 -> r in substr s 1 r;; fun search_2(list, date, l)= if list == nil then list else let list -> [elt suite] in if !strcmp "[" substr elt 0 1 then let atoi _dated date -> day in let atoi _datem date -> month in let atoi _datey date -> year in let atoi _dated elt -> dayS in let atoi _datem elt -> monthS in let atoi _datey elt -> yearS in if (day < dayS) && (month < month) && (year < yearS) then search_2 suite date tl suite else list else search_2 suite date suite;; fun search_1(list, date)= if list == nil then search_2 news date news else let list -> [elt suite] in if !strcmp elt date then tl suite else search_1 suite date;; fun __news(date)= let if date == nil then news else search_1 news date -> l in _DMSsend this DMSsender Cnews [linebuild l];; fun getNews(list, s)= if list == nil then s else let list -> [elt suite] in (set s = strcat strcat s elt "\n"; getNews suite s);; fun __openAdmin()= if (sizelist edit) > 0 then _DMSevent this DMSsender "adminRefused" nil nil else (set edit = DMSsender::edit; _DMSevent this DMSsender "adminOpened" nil nil; _DMSsend this DMSsender CeditOk [file getNews news nil]); 0;; fun chgnews(list, s)= if list == nil then nil else let lineextr s -> [Phead[Pfoot[Pbgcolor[Ptext[Plink[Pvlink[Palink[Pfile _]]]]]]]]in let list -> [elt suite] in if !strcmp hd elt "title" then ("title"::Phead::nil)::chgnews suite s else if !strcmp hd elt "link" then ("link"::Pfoot::nil)::chgnews suite s else if !strcmp hd elt "body" then ("body"::(linebuild Pbgcolor::Ptext::Plink::Pvlink::Palink::nil)::nil)::chgnews suite s else if !strcmp hd elt "file" then ("file"::Pfile::nil)::chgnews suite s else elt::chgnews suite s;; fun __addC(string, msg)= if !findList edit DMSsender then nil else let unzip string -> s in let unzip msg -> m in (_storepack strbuild chgnews strextr _getpack _checkpack dmifile s dmifile; if m != nil then _storepack m file else 0; _DMSevent this DMSsender "adminChangedC" nil nil; _DMSevent this nil "log" strcatn "newsHTML changed by "::(_DMSgetLogin DMSsender)::nil nil; set edit = nil); 0;;