/******************************************************************************* Plugin Link Editor part Version: 1.0 Author: Sebastien DENEUX Last update: 27/07/2001 *******************************************************************************/ typeof plugin = S;; /* '*.plug' file name */ typeof class = S;; /* plugin name */ typeof ed = PluginEditor;; typeof Password2 = ObjText;; typeof Param2 = ObjText;; typeof Param3 = ObjText;; typeof alias = ObjText;; typeof List = [[S S S S] r1];; typeof LinkCombo = ObjBox;; typeof oldPass = S;; proto save=fun [ [Inst r1] [[S r1]r1] ] [[S r1] [S r1] [[S r1]r1] [[S r1]r1]];; fun getSuppLinks(l) = if l == nil then nil else let l -> [first next] in ("event"::(strcat strcat class ".link." hd first)::nil)::(getSuppLinks next) ;; fun save(l, params) = [ nil /* registerF */ nil /* register */ ("plugin"::plugin::nil)::nil /* supplemental Dat */ ("event"::(strcat class ".askPassword")::nil):: /*("eventC"::(strcat class ".getPhoto")::nil):: ("eventC"::(strcat class ".setPhoto")::nil):: ("eventC"::(strcat class ".activated")::nil):: ("eventC"::(strcat class ".quit")::nil):: ("actionC"::(strcat class ".indicateItem")::nil):: ("actionC"::(strcat class ".endGame")::nil):: ("action"::(strcat class ".update")::nil):: ("zoneC"::"paintBallValues"::nil):: ("zoneC"::"paintBallGuns"::nil):: ("zoneC"::"paintBallMsg"::nil):: ("zoneC"::"paintBallTalk"::nil)::*/ getSuppLinks params ] ;; fun AddToCombo(List) = if List == nil then 0 else let hd List -> [link text _ _] in ( _ADDcombo LinkCombo 10000 text; AddToCombo tl List ) ;; fun ListofLink(ListParams) = if ListParams == nil then 1 else let hd ListParams -> el in ( let nth_list el 3 -> Param in let nth_list el 2 -> text in let nth_list el 1 -> nb in let hd el -> link in set List = [link text Param nb]::List; ListofLink (tl ListParams) ) ;; fun Search2 (List, n) = let List -> [link _ _ _] in !strcmp link n ;; fun Search (List, n) = let List -> [_ text _ _] in !strcmp text n ;; fun CallCombo (combo, paramU, Selnb, string) = let paramU -> [ win l] in let (search_in_list List @Search string) -> result in let result -> [_ _ param nb] in ( if (atoi nb)==1 then ( set Param3 = _CRtext _channel win 5 57 80 20 ET_ALIGN_LEFT param; set Param2 = _CReditLine _channel win 85 55 200 20 ET_ALIGN_LEFT|ET_DOWN let getInfo l "param" -> string in if (nil == string) then "" else string ) else ( _DStext Param2; _DStext Param3; nil ) ) ;; fun closeedit(params) = let _GETcombo LinkCombo ->[_ n] in let (search_in_list List @Search n) -> result in let result -> [link _ _ _] in let _GETtext Password2 -> pass in if !strcmp pass "XXXXXXXXXX" then /*ancien mot de passe*/ strbuild ("gotPassword"::"1"::nil):: ("*password"::oldPass::nil):: ("link"::link::nil):: ("param"::(_GETtext Param2)::nil):: ("alias"::(_GETtext alias)::nil):: nil else if !strcmp pass "" then /*pas de mot de passe*/ strbuild ("link"::link::nil):: ("*password"::nil):: ("gotPassword"::nil):: ("param"::(_GETtext Param2)::nil):: ("alias"::(_GETtext alias)::nil):: nil else /*un nouveau mot de passe*/ strbuild ("link"::link::nil):: ("*password"::(_getlongname pass "" "#")::nil):: ("gotPassword"::"1"::nil):: ("param"::(_GETtext Param2)::nil):: ("alias"::(_GETtext alias)::nil):: nil ;; fun openedit(win, param, params) = let params -> ListParams in ( set List = nil; ListofLink ListParams ); let strextr param -> l in let _GETwindowSizePosition win -> [w h x y] in ( set ed = startPluginEditor _channel win 0 0 w h WN_CHILDINSIDE|WN_NOBORDER class; _CRtext _channel ed.PluginEditorEditWin 5 7 80 20 ET_ALIGN_LEFT "Lien vers : "; _CRtext _channel ed.PluginEditorEditWin 5 82 80 20 ET_ALIGN_LEFT "Alias: "; set alias = _CReditLine _channel ed.PluginEditorEditWin 85 80 200 20 ET_ALIGN_LEFT|ET_DOWN let getInfo l "alias" -> string in if (nil == string) then "" else string; set LinkCombo = _CRcombo _channel ed.PluginEditorEditWin 85 5 200 300 CB_DOWN nil; AddToCombo List; let getInfo l "link" -> myLink in let (search_in_list List @Search2 myLink) -> result in let result -> [link text param nb] in ( _SSELcombo LinkCombo text; if (atoi nb)==1 then ( set Param3 = _CRtext _channel ed.PluginEditorEditWin 5 57 80 20 ET_ALIGN_LEFT param; set Param2 = _CReditLine _channel ed.PluginEditorEditWin 85 55 200 20 ET_ALIGN_LEFT|ET_DOWN let getInfo l "param" -> string in if (nil == string) then "" else string ) else ( _DStext Param2; _DStext Param3; nil ) ); _CRtext _channel ed.PluginEditorEditWin 5 32 80 20 ET_ALIGN_LEFT "Mot de passe : "; set oldPass = getInfo l "*password"; set Password2 = _CReditLine _channel ed.PluginEditorEditWin 85 30 200 20 ET_ALIGN_LEFT|ET_DOWN|ET_PASSWORD if nil == getInfo l "gotPassword" then "" else "XXXXXXXXXX"; _CBcombo LinkCombo @CallCombo [ed.PluginEditorEditWin l]; _CRtext _channel ed.PluginEditorEditWin 5 160 800 20 ET_ALIGN_LEFT "Ce plugin permet de créer des liens vers d'autres modules" ; _CRtext _channel ed.PluginEditorEditWin 5 180 800 20 ET_ALIGN_LEFT "Tout d'abord il faut choisir le lien que l'on veut créer dans 'lien vers :'" ; _CRtext _channel ed.PluginEditorEditWin 5 200 800 20 ET_ALIGN_LEFT "Chaque lien crée peut être protégé par un mot de passe" ; _CRtext _channel ed.PluginEditorEditWin 5 220 800 20 ET_ALIGN_LEFT "Si il y a lieu, il faut donner un paramètre supplémentaire (ex: l'adresse d'un site web)" ; 0 ) ;; /******************************************************************************* Plugin initialisation, the PlugRegister function has to be called at the end file -> S : '*.plug' file name <- I : not used *******************************************************************************/ fun IniPlug(file)= set plugin = file; set class = getInfo strextr _getpack _checkpack file "name"; PlugRegister2 class @save nil @openedit @closeedit ;;