/* Directory Editor - Jan 2000 - Sylvain Huet */ /* 1.0 */ typeof ed = Editor;; typeof server = ObjText ;; typeof author = ObjText ;; typeof email = ObjText ;; typeof password = ObjText ;; typeof picture = ObjText ;; typeof urlscol = ObjText ;; typeof urlhttp = ObjText ;; typeof urlscolC = ObjCheck ;; typeof urlhttpC = ObjCheck ;; typeof lang = ObjText ;; typeof timeout = ObjText ;; typeof msg = ObjText ;; /* max size for bitmaps */ var MAXSIZEBMP=32768;; fun save (filename, n)= ("action"::"update"::nil):: ("server"::(_GETtext server)::nil):: ("author"::(_GETtext author)::nil):: ("email"::(_GETtext email)::nil):: ("password"::(_GETtext password)::nil):: ("picture"::(_GETtext picture)::nil):: ("urlscol"::(if _GETcheck urlscolC then nil else _GETtext urlscol)::nil):: ("urlhttp"::(if _GETcheck urlhttpC then nil else _GETtext urlhttp)::nil):: ("lang"::(_GETtext lang)::nil):: ("timeout"::(_GETtext timeout)::nil):: ("msg"::(_GETtext msg)::nil):: nil;; fun load (l) = _SETtext server getInfo l "server"; _SETtext author getInfo l "author"; _SETtext email getInfo l "email"; _SETtext password getInfo l "password"; _SETtext picture getInfo l "picture"; let getInfo l "urlscol" -> url in (_SETcheck urlscolC if url==nil then 1 else 0; _ENtext urlscol if url==nil then 0 else 1; _SETtext urlscol url); let getInfo l "urlhttp" -> url in (_SETcheck urlhttpC if url==nil then 1 else 0; _ENtext urlhttp if url==nil then 0 else 1; _SETtext urlhttp url); _SETtext lang getInfo l "lang"; _SETtext timeout getInfo l "timeout"; _SETtext msg getInfo l "msg"; 0;; typeof buffer=ObjBitmap;; fun _paint(a,b)= _BLTbitmap ed.EditorEditWin buffer 325 5; 0;; fun clearbitmap()= _FILLbitmap buffer 0; 0;; fun _open(d,b,file)= let _PtoScol file -> name in if name==nil then nil else if (_fileSize file)>=MAXSIZEBMP then /* loc( (_DLGMessageBox _channel ed.EditorEditWin "Warning" ) */ (_DLGMessageBox _channel ed.EditorEditWin (_locEditor "700-DIRREG-warning" nil) /* loc( strcatn "The size of this file is too long.\nIt should be lower than "::(itoa MAXSIZEBMP)::" bytes."::nil 0; ) */ strcatn (_locEditor "710-DIRREG-thesizeoft" nil)::" "::(itoa MAXSIZEBMP)::" "::(_locEditor "711-DIRREG-bytes." nil)::nil 0; nil) else let _LDbitmap _channel file -> bmp0 in let if bmp0==nil then _LDjpeg _channel file else bmp0 -> bmp in if bmp==nil then /* loc( (_DLGMessageBox _channel ed.EditorEditWin "Warning" ) */ (_DLGMessageBox _channel ed.EditorEditWin (_locEditor "700-DIRREG-warning" nil) /* loc( "This file is not a bmp or jpeg file." 0; ) */ (_locEditor "770-DIRREG-thisfileis" nil) 0; nil) else let _GETbitmapSize bmp -> [w h] in (_SCPbitmap buffer 0 0 127 127 bmp 0 0 w-1 h-1 nil; _DSbitmap bmp; _SETtext picture name; 0); _paint nil nil;; fun chgpicture(a,b)= _DLGrflopen (_DLGOpenFile _channel ed.EditorEditWin nil nil "bitmap (*.bmp,*.jpg)\0*.BMP;*.JPG\0\0") @_open nil;; fun nopicture(a,b)= _SETtext picture ""; clearbitmap; _paint nil nil;; fun switchC(c,t,i)=_ENtext t if i then 0 else 1;; fun IniEditor (s)= set ed = startEditor _channel nil 0 0 325+133 360 WN_NORMAL-WN_SIZEBOX EDITOR_NORMAL s "Dms/CommTools/DirReg/dirreg.dmc" "Dms/CommTools/DirReg/help/help.htm" "Dms/CommTools/DirReg/dirreg.bmp" @load @save nil; /* loc( _CRtext _channel ed.EditorEditWin 5 5 100 20 ET_BORDER "Server (address:port)" ; ) */ _CRtext _channel ed.EditorEditWin 5 5 100 20 ET_BORDER (_locEditor "1020-DIRREG-serveradd" nil) ; /* loc( set server = _CReditLine _channel ed.EditorEditWin 110 5 200 20 ET_DOWN|ET_AHSCROLL "dir.scol-technologies.org:3102"; ) */ set server = _CReditLine _channel ed.EditorEditWin 110 5 200 20 ET_DOWN|ET_AHSCROLL (_locEditor "1030-DIRREG-scol.cryo-" nil); /* loc( _CRtext _channel ed.EditorEditWin 5 30 100 20 ET_BORDER "Author" ; ) */ _CRtext _channel ed.EditorEditWin 5 30 100 20 ET_BORDER (_locEditor "1040-DIRREG-author" nil) ; set author = _CReditLine _channel ed.EditorEditWin 110 30 200 20 ET_DOWN ""; /* loc( _CRtext _channel ed.EditorEditWin 5 55 100 20 ET_BORDER|ET_AHSCROLL "eMail" ; ) */ _CRtext _channel ed.EditorEditWin 5 55 100 20 ET_BORDER|ET_AHSCROLL (_locEditor "1060-DIRREG-email" nil) ; set email = _CReditLine _channel ed.EditorEditWin 110 55 200 20 ET_DOWN ""; /* loc( _CRtext _channel ed.EditorEditWin 5 80 100 20 ET_BORDER "Main Language" ; ) */ _CRtext _channel ed.EditorEditWin 5 80 100 20 ET_BORDER (_locEditor "1080-DIRREG-mainlangua" nil) ; set lang = _CReditLine _channel ed.EditorEditWin 110 80 200 20 ET_DOWN ""; /* loc( _CRtext _channel ed.EditorEditWin 5 105 100 20 ET_BORDER "Frequency (minutes)" ; ) */ _CRtext _channel ed.EditorEditWin 5 105 100 20 ET_BORDER (_locEditor "1100-DIRREG-frequency" nil) ; set timeout = _CReditLine _channel ed.EditorEditWin 110 105 200 20 ET_DOWN|ET_NUMBER "10"; /* loc( _CRtext _channel ed.EditorEditWin 5 155 120 20 ET_BORDER "ID number (optional)" ; ) */ _CRtext _channel ed.EditorEditWin 5 155 120 20 ET_BORDER (_locEditor "1120-DIRREG-idnumbero" nil) ; set password = _CReditLine _channel ed.EditorEditWin 130 155 180 20 ET_DOWN|ET_PASSWORD ""; /* loc( set urlscolC=_CRcheck _channel ed.EditorEditWin 5 180 100 20 ET_BORDER "Default ScolUrl" ; ) */ set urlscolC=_CRcheck _channel ed.EditorEditWin 5 180 130 20 ET_BORDER (_locEditor "1150-DIRREG-defaultsco" nil) ; set urlscol = _CReditLine _channel ed.EditorEditWin 140 180 170 20 ET_DOWN ""; _CBcheck _SETcheck urlscolC 1 @switchC urlscol; _ENtext urlscol 0; /* loc( set urlhttpC=_CRcheck _channel ed.EditorEditWin 5 205 100 20 ET_BORDER "Default HttpUrl" ; ) */ set urlhttpC=_CRcheck _channel ed.EditorEditWin 5 205 130 20 ET_BORDER (_locEditor "1200-DIRREG-defaulthtt" nil) ; set urlhttp = _CReditLine _channel ed.EditorEditWin 140 205 170 20 ET_DOWN ""; _CBcheck _SETcheck urlhttpC 1 @switchC urlhttp; _ENtext urlhttp 0; /* loc( _CRtext _channel ed.EditorEditWin 5 230 305 20 ET_BORDER "Message (less than 255 digits)" ; ) */ _CRtext _channel ed.EditorEditWin 5 230 305 20 ET_BORDER (_locEditor "1250-DIRREG-messagele" nil) ; set msg = _CReditText _channel ed.EditorEditWin 5 255 305 100 ET_DOWN ""; /* loc( _CBbutton _CRbutton _channel ed.EditorEditWin 325 138 128 20 0 "Change Picture" @chgpicture nil; ) */ _CBbutton _CRbutton _channel ed.EditorEditWin 325 138 128 20 0 (_locEditor "1280-DIRREG-changepict" nil) @chgpicture nil; set picture = _CRtext _channel ed.EditorEditWin 325 163 128 20 ET_DOWN|ET_AHSCROLL ""; /* loc( _CBbutton _CRbutton _channel ed.EditorEditWin 325 188 128 20 0 "No Picture" @nopicture nil; ) */ _CBbutton _CRbutton _channel ed.EditorEditWin 325 188 128 20 0 (_locEditor "1300-DIRREG-nopicture" nil) @nopicture nil; set buffer=_CRbitmap _channel 128 128; _CBwinPaint ed.EditorEditWin @_paint nil; clearbitmap; _paint nil nil; if s==nil then nil else openDMI ed; _open nil nil _checkpack _GETtext picture; 0;;