/******************************************************************************* Module Template Server par Version: 1.0 Authors: Sebastien DENEUX & Julien Zorko Last update: 28/02/2001 Template Module *******************************************************************************/ /******************************************************************************* * All the global variables are grouped in a structure. * Some message boxes are in comment in the callback functions in order to see exactly when these callbacks are called. *******************************************************************************/ typeof distinct = I;; defcom CfillTextZone = FillTextZone I S;; /* write a text in on the client */ /******************************************************************************* Broad a message to the client part, it allows to use the function _DMSsend with the function apply_on_list. function -> defcom : function called in the client part parameterTuple -> tuple : this tuple gives the defcom parameters <- nothing special *******************************************************************************/ fun Broad (com, comParam) = _DMSsend this com comParam ;; /******************************************************************************* the client part of the module has been deleted cli -> CLIENT : the client <- I : nothing special (always 0) *******************************************************************************/ fun cbDeleteClient (cli) = /* _DLGMessageBox _channel nil "cbDeleteClient" "cbDeleteClient" 0; */ _DMSeventTag this CtoU cli "out" nil nil nil; 0 ;; /******************************************************************************* create a client from -> DMI : not used user -> User : the user that run the action action -> S : not used param -> S : parameters of the action others -> [User r1] : not used tag -> Tag : not used <- I : nothing special *******************************************************************************/ fun cbStart (from, user, action, param, others, tag) = if _DMScreateClientDMI this UtoC user itoa distinct then _DMSeventTag this user "entering" nil nil nil else nil ;; /******************************************************************************* destroy a client from -> DMI : not used user -> User : the user that run the action action -> S : not used param -> S : not used others -> [User r1] : not used tag -> Tag : not used <- I : nothing special *******************************************************************************/ fun cbDestroy (from, user, action, param, others, tag) = let UtoC user -> cli in ( _DMSdelClientDMI this cli; cbDeleteClient cli ) ;; /******************************************************************************* main function, called when the server part of the module is initialized file -> S : not used <- I : nothing special *******************************************************************************/ fun IniDMI2 (file) = let strextr _getpack _checkpack file ->param in set distinct = atoi (getInfo param "distinct"); _DMSregister this nil @cbDeleteClient nil; _DMSdefineActions this (["start" @cbStart ]):: (["destroy" @cbDestroy ]):: nil; 0 ;; fun pro () = let BigToAsc BigInvn BigFromAsc _getpack _checkpack "dms/db/dbrequest/dbrequest.conf" BigFromAsc "e7072fd625cc61ef" -> s in let if (strlen s)!=9 then nil else [htoi substr s 1 4 htoi substr s 5 4] -> [datedebut periode] in if periode==nil then (_adderror strcatn (_loc this "PRO_MODULE" nil)::" "::(_DMSgetName this)::" : "::(_loc this "PRO_INVALID_MSG" nil)::nil;0) else if periode==0 then 1 else let ((time>>1)&0x3fffffff)/43200-datedebut -> x in if x<0 then (_adderror strcatn (_loc this "PRO_MODULE" nil)::" "::(_DMSgetName this)::" : "::(_loc this "PRO_INVALID_MSG" nil)::nil;0) else if x<=periode then (_addwarning strcatn (_loc this "PRO_MODULE" nil)::" "::(_DMSgetName this)::" : "::(_loc this "PRO_LIMITED_MSG" (itoa (periode-x))::nil)::nil;1) else (_adderror strcatn (_loc this "PRO_MODULE" nil)::" "::(_DMSgetName this)::" : "::(_loc this "PRO_ENDLIMITED_MSG" nil)::nil;0) ;; /* Server initialisation */ fun IniDMI (f) = if pro then IniDMI2 f else nil ;;