/* ADS - DMS - aout 00 - by Ariane Bitoun */ /* Modified - Juin 2001 - by Emmanuel Tollé */ typeof ed = Editor;; typeof texte = ObjText;; typeof font = ObjFont;; typeof AliasEditTexte = ObjText;; typeof EditorWin = ObjWin;; fun cbLoad(dmiBlock)= let getDef ed "params" -> param in ( _SETtext texte getInfo param "path"; _SETtext AliasEditTexte getInfo param "nomdb" ); 0 ;; fun cbSave (filename, n)= let _GETtext texte -> path in let _GETtext AliasEditTexte -> nomdb in let ("path"::(_GETtext texte)::nil):: ("nomdb"::(_GETtext AliasEditTexte)::nil):: nil -> paramsBloc in setDef ed "params" paramsBloc; ("action"::"start"::"start"::nil):: ("action"::"destroy"::"destroy"::nil):: ("event"::"destroyed"::"destroyed"::nil):: ("eventC"::"in"::"in"::nil):: nil ;; fun connectionDB (aliasDB, loginDB, pwdDB) = let ( if aliasDB == nil then "" else aliasDB ) -> al in let ( if loginDB == nil then "" else loginDB ) -> lo in let ( if pwdDB == nil then "" else pwdDB ) -> pwd in if (SqlCreate _channel al lo pwd) != nil then /*DB success*/ _DLGMessageBox _channel EditorWin (_locEditor"WINDOW_NAME_DBCONNECT" nil) (_locEditor "DBCONNECT_SUCCESS" nil) 0 else /*DB failed*/ _DLGMessageBox _channel EditorWin (_locEditor "WINDOW_NAME_DBCONNECT" nil) (_locEditor "DBCONNECT_FAILURE" nil) 0 ;; fun GetODBCInfos(odbcAlias,info)= hd switchstr strextr _loadressini strcatn "odbc."::odbcAlias::"."::info::nil ;; fun cbConnect (btn, param) = let _GETtext param -> tmpAlias in let GetODBCInfos tmpAlias "login" -> tmpLogin in let GetODBCInfos tmpAlias "password" -> tmpPwd in connectionDB tmpAlias tmpLogin tmpPwd ;; fun _OdbcOk(Otext, param, truc)= let _GETtext Otext -> tmpAlias in let GetODBCInfos tmpAlias "login" -> tmpLogin in let GetODBCInfos tmpAlias "password" -> tmpPwd in connectionDB tmpAlias tmpLogin tmpPwd ;; fun cbPro () = let BigToAsc BigInvn BigFromAsc _getpack _checkpack "dms/db/ads/ads.conf" BigFromAsc "a06578b679c935e7" -> 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 (_DLGMessageBox _channel nil _locEditor "PRO_WARNING" nil _locEditor "PRO_INVALID_MSG" nil 0;0) else if periode==0 then 1 else let ((time>>1)&0x3fffffff)/43200-datedebut -> x in if x<0 then (_DLGMessageBox _channel nil _locEditor "PRO_WARNING" nil _locEditor "PRO_INVALID_MSG" nil 0;0) else if x<=periode then (_DLGMessageBox _channel nil _locEditor "PRO_WARNING" nil _locEditor "PRO_LIMITED_MSG" (itoa (periode-x))::nil 0;1) else (_DLGMessageBox _channel nil _locEditor "PRO_WARNING" nil _locEditor "PRO_ENDLIMITED_MSG" nil 0;0) ;; fun IniEditor (s) = set ed = _StartEditor _channel nil 0 0 315 100 WN_NORMAL EDITOR_NORMAL @cbLoad @cbSave @cbPro; set font = _CRfont _channel 12 nil nil "arial"; set EditorWin = getEditWin ed; _CRtext _channel EditorWin 5 10 90 15 ET_ALIGN_LEFT (_locEditor "KW_PATH" nil); set texte = _CReditLine _channel EditorWin 105 10 205 15 ET_BORDER|ET_AHSCROLL "Lib/Texture"; _CRtext _channel EditorWin 5 30 100 30 ET_ALIGN_LEFT (_locEditor "DB_ALIAS" nil); set AliasEditTexte = _CReditLine _channel EditorWin 105 35 205 15 ET_BORDER|ET_TABFOCUS|ET_AHSCROLL ""; _CBlineOk AliasEditTexte @_OdbcOk []; let _CRbutton _channel EditorWin 120 60 70 15 0 (_locEditor "DB_CONECTION" nil) -> ConnectBtn in _CBbutton ConnectBtn @cbConnect AliasEditTexte; _PAINTwindow EditorWin; if s == nil then nil else openDMI ed; 0 ;;