struct Card = [ authorCARD : S, sitenameCARD : S, emailCARD : S, messageCARD : S, ipCARD : S, bitmapCARD : S, lastCARD : I, idnumCARD : I, rankCARD : I ] mkCARD ;; typeof listCard = [ Card r1 ] ;; defcom CaskCount= askCount ;; defcom CaskCard = askCard I ;; defcom CaddBookmark = addbookmark S ;; defcom CaskBitmap = askBitmap S I I ;; defcom Copen=open S;; typeof authorS = S ;; typeof sitenameS = S ;; typeof emailS = S ;; typeof cardwin = ObjWin ;; typeof nameSite = ObjText ;; typeof authorSite = ObjText ;; typeof authorText = ObjText ;; typeof emailSite = ObjText ;; typeof emailText = ObjText ;; typeof ipText = ObjText ;; typeof ipSite = ObjText ;; typeof messSite = ObjText ;; typeof myFont = ObjFont ;; var nbcount = 0 ;; var getcount = 0 ;; var cardListed = 0 ;; typeof bitmap = ObjBitmap ;; var listS = "scol://dir.scol-technologies.org:3102" ;; typeof RegisterButton = ObjButton ;; typeof FavButton = ObjButton ;; typeof listwin = ObjListTab ;; typeof safefond = ObjBitmap ;; typeof fond = ObjBitmap ;; fun genldbitmap(name)= let _LDbitmap _channel _checkpack name -> u in if u != nil then u else _LDjpeg _channel _checkpack name ;; fun findCardByRank(rank,l)=if l == nil then nil else let l -> [ c next ] in if c.rankCARD == rank then c else findCardByRank rank next ;; fun findCardByNum(num,l)=if l == nil then nil else let l -> [ c next ] in if c.rankCARD == num then c else findCardByRank num next ;; fun paintcard(w,a)= _BLTbitmap cardwin fond 0 0 ; if bitmap != nil then _BLTbitmap cardwin bitmap 251 358 else nil ;; fun resizeButtonRegister(x,s)= let x->[wn x y w h] in _SIZEbutton RegisterButton w h x y ; 0 ;; fun resizeButtonFav(x,s)= let x->[wn x y w h] in _SIZEbutton FavButton w h x y ; 0 ;; fun addFavorite(a,b)= let strbuild (sitenameS:: (strcatn "scol://"::listS::"/name+"::sitenameS:: "/author+"::authorS::"/email+"::emailS::nil)::nil)::nil -> booknote in let substr booknote 0 (strlen booknote) -1 -> booknote2 in ( _on _masterchannel CaddBookmark [ booknote2 ] ; 0 ) ;; fun selectSite(bla,bla2,rank)=let nth_list listCard rank -> c in ( _CPbitmap16 fond 0 0 safefond 0 0 406 525 nil ; _DRAWtext fond myFont 177 247 TD_TOP 0xFFFFFF c.sitenameCARD ; _DRAWtext fond myFont 194 278 TD_TOP 0xFFFFFF c.authorCARD ; _DRAWtext fond myFont 121 308 TD_TOP 0xFFFFFF c.emailCARD ; set cardListed = rank ; _DRAWrectangleText fond myFont 30 358 192 470 0xFFFFFF TD_LEFT|TD_TOP c.messageCARD ; set bitmap = genldbitmap c.bitmapCARD ; ) ; _PAINTwindow cardwin ; 0 ;; fun previouscard(a,b)= let findCardByNum cardListed listCard -> c in let if c.rankCARD == 0 then getcount-1 else c.rankCARD - 1 -> id in ( selectSite 0 0 id ; 0 ) ;; fun nextcard(a,b)= let findCardByNum cardListed listCard -> c in let if c.rankCARD == (getcount-1) then 0 else c.rankCARD +1 -> id in ( selectSite 0 0 id ; 0 ) ;; fun gocard(a,b)= let findCardByNum cardListed listCard -> c in if c != nil then ( _on _masterchannel Copen [strcatn "scol://"::c.ipCARD::":"::c.sitenameCARD::nil ]; 0 ) else 0 ;; fun addExtFavorite(a,b)= let findCardByNum cardListed listCard -> c in if c == nil then (_fooS "Card not found in addFavorite"; 0) else let strbuild (c.sitenameCARD:: (strcatn "scol://"::listS::"/name+"::c.sitenameCARD:: "/author+"::c.authorCARD::"/email+"::c.emailCARD::nil)::nil)::nil -> booknote in let substr booknote 0 (strlen booknote) -1 -> booknote2 in ( _on _masterchannel CaddBookmark [ booknote2 ] ; 0 ) ;; fun endcard(w,a)=set cardwin = nil ; _DSfont myFont ; set myFont = nil ; _DSbitmap safefond ; set safefond = nil ; _DSbitmap fond ; set fond = nil ; _DMSdelete this; 0 ;; fun viewFavorite(a,b)= if cardwin == nil then ( if myFont == nil then set myFont = _CRfont _channel 14 0 FF_WEIGHT "Arial" else nil ; if safefond == nil then set safefond = _LDjpeg _channel _checkpack "Dms/commtools/card/screen.jpg" else nil ; if fond == nil then set fond = _CRbitmap _channel 406 525 else nil ; set cardwin = _CRwindow _channel DMSwin 30 30 406 525 WN_MENU|WN_MINBOX "Directory" ; _CBwinPaint cardwin @paintcard 0 ; _CBwinDestroy cardwin @endcard 0 ; _CPbitmap16 fond 0 0 safefond 0 0 406 525 nil ; set listwin = _CRlistTab _channel cardwin 5 40 396 190 LV_DOWN ; _CBlistTabSelect listwin @selectSite 0 ; _ADDlistTabColumn listwin 0 280 0 "Site" ; _ADDlistTabColumn listwin 1 100 0 "State" ; _PAINTwindow cardwin ; let _LDbitmap _channel _checkpack "Dms/Commtools/Card/previous.bmp" -> bmp in _CBbutton _CRbuttonBitmap _channel cardwin bmp 25 497 54 20 0 @previouscard 0 ; let _LDbitmap _channel _checkpack "Dms/Commtools/Card/go.bmp" -> bmp in let _GETbitmapSize bmp -> [x y ] in _CBbutton _CRbuttonBitmap _channel cardwin bmp 257 497 x y 0 @gocard 0 ; let _LDbitmap _channel _checkpack "Dms/Commtools/Card/add.favor.bmp" -> bmp in _CBbutton _CRbuttonBitmap _channel cardwin bmp 108 497 120 20 0 @addExtFavorite 0 ; let _LDbitmap _channel _checkpack "Dms/Commtools/Card/next.bmp" -> bmp in _CBbutton _CRbuttonBitmap _channel cardwin bmp 334 497 50 20 0 @nextcard 0 ; _DMSsend this CaskCount [] ; 0 ) else 0 ;; fun activate(from,action,param,rep)=0;; fun releaseButtonRegister (z)= _DMSdelete this; 0;; fun releaseButtonFav (z)= _DMSdelete this; 0;; fun IniDMI(param)= let strextr param -> [ [ a [ s [e _ ]]] _] in ( set authorS = a ; set sitenameS = s ; set emailS = e ) ; _DMSregisterDMI this @activate nil; let _DMSgetZone this "Register" @releaseButtonRegister @resizeButtonRegister @releaseButtonRegister ->[wn x y w h] in if wn != nil then ( _fooI wn; set RegisterButton = _CBbutton _CRbutton _channel wn x y w h 0 "Add to Favorites" @addFavorite 0 ; 0 ) else ( _fooI wn; 0) ; let _DMSgetZone this "Favorites" @releaseButtonFav @resizeButtonFav @releaseButtonFav -> [ wn x y w h ] in if wn != nil then ( set FavButton = _CBbutton _CRbutton _channel wn x y w h 0 "Favorites" @viewFavorite 0 ; 0 ) else 0 ; 0 ;; fun __sendCount(nb)=set nbcount = nb ; set getcount = 0 ; set listCard = nil ; _RSTlistTab listwin ; if nb > 0 then _DMSsend this CaskCard [ 0 ] else nil ;; fun insertCard(c,list,num)= if list == nil then ( _ADDlistTabItem listwin num getcount c.sitenameCARD ; _SETlistTabItem listwin num 1 if c.ipCARD == nil then "Inactive" else "Active" ; [ c nil ] ) else let list -> [ card next ] in if (strcmp c.sitenameCARD card.sitenameCARD)<0 then ( _ADDlistTabItem listwin num getcount c.sitenameCARD ; _SETlistTabItem listwin num 1 if c.ipCARD == nil then "Inactive" else "Active" ; [ c list ] ) else [ card insertCard c next num+1 ] ;; fun remakeRank(l,num)=if l == nil then 0 else let l -> [ c next ] in ( set c.rankCARD = num ; remakeRank next num+1 ) ;; fun __sendCard(author,sitename,email,message,ip,idnum,bitmap,signature)= let mkCARD [ author sitename email message ip bitmap nil idnum 0 ] -> c in ( set listCard = insertCard c listCard 0 ; remakeRank listCard 0 ) ; set getcount = getcount + 1 ; if getcount != nbcount then _DMSsend this CaskCard [ getcount ] else 0 ; let _getlongname _getpack _checkpack bitmap bitmap "#" -> signature2 in if (bitmap == nil) || (!strcmp signature signature2) then 0 else ( _DMSsend this CaskBitmap [ bitmap idnum 0 ] ; 0 ) ;; fun __endBitmap(name,idnum)= 0 ;; fun __sendbitmap(name,idnum,s,pos)= _appendpack s _getmodifypack name ; _DMSsend this CaskBitmap [ name idnum pos ] ;;