/* FILEUPLOAD - Part Editor by iri - http://www.irizone.net july 2007 under GNU/GPL v3 licence */ typeof upfolder = ObjText;; typeof upextension = ObjList;; typeof upsize = ObjText;; fun cbDelUpextension(obj, u)= let _GETlist upextension -> [n _] in _DELlist upextension n;; fun addUpextension(obj, u)= let u -> [wn txt] in ( _ADDlist upextension 0 _GETtext txt; _DSwindow wn );; fun cbAddUpextension(obj, win)= let _CRwindow _channel win 50 100 250 100 WN_MENU|WN_NOSCOL " Extension " -> wn in let _CRtext _channel wn 5 5 240 40 0 "Saisissez une extension à ajouter.\nPar exemple .jpg" -> _ in let _CReditLine _channel wn 5 50 240 20 ET_DOWN nil -> txt in let _CRbutton _channel wn 5 75 240 20 0 "OK" -> ok in ( _SETtextFocus txt; _CBbutton ok @addUpextension [wn txt] );; fun chgUpfolder(obj, u, rep)= _SETtext upfolder rep;; fun cbChgUpfolder(obj, u)= _DLGrflopenDir _DLGOpenDir _channel nil nil "Sélectionnez le répertoire de stockage des fichiers qui seront uploadés." @chgUpfolder 0;; fun getExtensions(n)= if n < 0 then nil else let _SELlist upextension n -> _ in let _GETlist upextension -> [_ ext] in ext :: getExtensions n-1;; fun cbSave(filename, n)= ("action" :: "start" :: nil) :: ("action" :: "register" :: nil) :: ("action" :: "unregister" :: nil) :: ("action" :: "getfolder" :: nil) :: ("action" :: "setfolder" :: nil) :: ("action" :: "getextension" :: nil) :: ("action" :: "setextension" :: nil) :: ("action" :: "getsize" :: nil) :: ("action" :: "setsize" :: nil) :: ("actionC" :: "upfile" :: nil) :: ("actionC" :: "choiceFile" :: nil) :: ("event" :: "getfolder" :: nil) :: ("event" :: "getextension" :: nil) :: ("event" :: "getsize" :: nil) :: ("event" :: "succeed" :: nil) :: ("event" :: "notvalide" :: nil) :: ("eventC" :: "upfileok" :: nil) :: ("eventC" :: "upfilefailed" :: nil) :: ("upfolder" :: (_GETtext upfolder) :: nil) :: ("upextension" :: (strbuild (getExtensions _GETlistCount upextension) :: nil) :: nil) :: ("upsize" :: (_GETtext upsize) :: nil) :: nil;; fun AddExtensions(l)= if l == nil then 0 else ( _ADDlist upextension 0 hd l; AddExtensions tl l );; fun cbLoad(l)= if l == nil then 0 else if !strcmp hd hd l "upfolder" then ( _SETtext upfolder hd tl hd l; cbLoad tl l ) else if !strcmp hd hd l "upextension" then ( AddExtensions hd strextr linebuild tl hd l; cbLoad tl l ) else if !strcmp hd hd l "upsize" then ( _SETtext upsize hd tl hd l; cbLoad tl l ) else cbLoad tl l;; fun cbRflSizewinEditor (win, p, w, h)= _SIZEtext upfolder w-105 20 5 30; _SIZElist upextension w-105 150 5 80; _SIZEtext upsize w-10 20 5 235;; fun IniEditor(param)= let [440 280] -> [w h] in let startEditor _channel nil 0 0 w h WN_MENU EDITOR_NORMAL nil nil nil nil @cbLoad @cbSave nil -> ed in let getEditWin ed -> win in ( _CRtext _channel win 5 5 w-10 20 ET_BORDER|ET_ALIGN_CENTER "Dossier de stockage :"; set upfolder = _CRtext _channel win 5 30 w-105 20 ET_DOWN|ET_AHSCROLL nil; _CBbutton _CRbutton _channel win w-90 30 85 20 0 "Parcourir" @cbChgUpfolder 0; _CRtext _channel win 5 55 w-10 20 ET_BORDER|ET_ALIGN_CENTER "Extensions acceptées :"; set upextension = _CRlist _channel win 5 80 w-105 145 LB_VSCROLL|LB_DOWN; _CBbutton _CRbutton _channel win w-90 80 85 20 0 "Ajouter" @cbAddUpextension win; _CBbutton _CRbutton _channel win w-90 105 85 20 0 "Supprimer" @cbDelUpextension 0; _CRtext _channel win 5 230 w-10 20 ET_BORDER|ET_ALIGN_CENTER "Taille maximale d'un fichier (ko) :"; set upsize = _CReditLine _channel win 5 255 w-10 20 ET_DOWN|ET_NUMBER nil; _CBwinSize win @cbRflSizewinEditor 0; openDMI ed; 0 );;