-
Notifications
You must be signed in to change notification settings - Fork 3
/
Copy pathnsmclient.cpp
471 lines (406 loc) · 15.3 KB
/
nsmclient.cpp
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
// -----------------------------------------------------------------------------
// nsmclient.cpp
// -----------------------------------------------------------------------------
// $Revision: 1.31 $
// $Author: philippe $
// $Date: 2005/05/23 14:41:38 $
// -----------------------------------------------------------------------------
// -----------------------------------------------------------------------------
// -----------------------------------------------------------------------------
// Copyright Nautilus, 2004
// http://www.nautilus-info.com
// -----------------------------------------------------------------------------
// Ce logiciel est un programme informatique servant à gérer et traiter les
// informations de santé d'une personne.
//
// Ce logiciel est régi par la licence CeCILL soumise au droit français et
// respectant les principes de diffusion des logiciels libres. Vous pouvez
// utiliser, modifier et/ou redistribuer ce programme sous les conditions de la
// licence CeCILL telle que diffusée par le CEA, le CNRS et l'INRIA sur le site
// "http://www.cecill.info".
//
// En contrepartie de l'accessibilité au code source et des droits de copie, de
// modification et de redistribution accordés par cette licence, il n'est offert
// aux utilisateurs qu'une garantie limitée. Pour les mêmes raisons, seule une
// responsabilité restreinte pèse sur l'auteur du programme, le titulaire des
// droits patrimoniaux et les concédants successifs.
//
// A cet égard l'attention de l'utilisateur est attirée sur les risques
// associés au chargement, à l'utilisation, à la modification et/ou au
// développement et à la reproduction du logiciel par l'utilisateur étant donné
// sa spécificité de logiciel libre, qui peut le rendre complexe à manipuler et
// qui le réserve donc à des développeurs et des professionnels avertis
// possédant des connaissances informatiques approfondies. Les utilisateurs sont
// donc invités à charger et tester l'adéquation du logiciel à leurs besoins
// dans des conditions permettant d'assurer la sécurité de leurs systèmes et ou
// de leurs données et, plus généralement, à l'utiliser et l'exploiter dans les
// mêmes conditions de sécurité.
//
// Le fait que vous puissiez accéder à cet en-tête signifie que vous avez pris
// connaissance de la licence CeCILL, et que vous en avez accepté les termes.
// -----------------------------------------------------------------------------
// This software is a computer program whose purpose is to manage and process
// a person's health data.
//
// This software is governed by the CeCILL license under French law and abiding
// by the rules of distribution of free software. You can use, modify and/ or
// redistribute the software under the terms of the CeCILL license as circulated
// by CEA, CNRS and INRIA at the following URL "http://www.cecill.info".
//
// As a counterpart to the access to the source code and rights to copy, modify
// and redistribute granted by the license, users are provided only with a
// limited warranty and the software's author, the holder of the economic
// rights, and the successive licensors have only limited liability.
//
// In this respect, the user's attention is drawn to the risks associated with
// loading, using, modifying and/or developing or reproducing the software by
// the user in light of its specific status of free software, that may mean that
// it is complicated to manipulate, and that also therefore means that it is
// reserved for developers and experienced professionals having in-depth
// computer knowledge. Users are therefore encouraged to load and test the
// software's suitability as regards their requirements in conditions enabling
// the security of their systems and/or data to be ensured and, more generally,
// to use and operate it in the same conditions as regards security.
//
// The fact that you are presently reading this means that you have had
// knowledge of the CeCILL license and that you accept its terms.
// -----------------------------------------------------------------------------
// #include <owl\owlpch.h>
#define WINVER 0x0500
#include <vcl.h>
#pragma hdrstop
USEUNIT("nautilus\nscompub.cpp");
USEUNIT("nautilus\ns_html.cpp");
USEUNIT("nautilus\nsbrowse.cpp");
USEUNIT("nautilus\nsGrabObjects.cpp");
USEUNIT("nautilus\nsbrowseSvce.cpp");
USEUNIT("nautilus\Nsdocref.cpp");
USEUNIT("nautilus\nsmodhtm.cpp");
USEUNIT("nautilus\NstriHis.cpp");
USEUNIT("nautilus\nshistdo.cpp");
USEUNIT("nautilus\Nsttx.cpp");
USEUNIT("nautilus\Nschoisi.cpp");
USEUNIT("nautilus\nspatdlg.cpp");
USEUNIT("nautilus\NsHistor.cpp");
USEUNIT("nautilus\nsvueref.cpp");
USEUNIT("nautilus\Nsdocaga.cpp");
USEUNIT("nautilus\Nsdocview.cpp");
USEUNIT("nautilus\Nscrdoc2.cpp");
USEUNIT("nautilus\Nscrvue.cpp");
USEUNIT("nautilus\nscsdoc.cpp");
USEUNIT("nautilus\nscsvue.cpp");
USEUNIT("nautilus\nsldvdoc.cpp");
USEUNIT("nautilus\nsldvvue.cpp");
USEUNIT("nautilus\Nsrechdl.cpp");
USEUNIT("nautilus\Nsrechd2.cpp");
USEUNIT("nautilus\nsperary.cpp");
USEUNIT("nautilus\Nsepicap.cpp");
USEUNIT("nautilus\nsSOAPview.cpp");
USEUNIT("nautilus\nscaptview.cpp");
USEUNIT("nautilus\nsvisual.cpp");
USEUNIT("nautilus\Nssuper.cpp");
USEUNIT("nsutil\nscache.cpp");
USEUNIT("nautilus\wordbasic.cpp");
USEUNIT("EnumProc.cpp");
USEUNIT("nautilus\nsepisodview.cpp");
USEUNIT("nautilus\nscqdoc.cpp");
USEUNIT("nautilus\nscqvue.cpp");
USEUNIT("nautilus\naumain.cpp");
USEUNIT("nautilus\nsmdiframe.cpp");
USEUNIT("nautilus\nsdrugview.cpp");
USEUNIT("nautilus\nsgoalview.cpp");
USEUNIT("nautilus\nsprocessview.cpp");
USEUNIT("nautilus\nsprocess.cpp");
USEUNIT("nautilus\nsbackup.cpp");
USEUNIT("nautilus\nsupdate.cpp");
USEUNIT("curl\nscurl.cpp");
USEUNIT("nautilus\nsrcview.cpp");
USEUNIT("nautilus\nsaddfunctions.cpp");
USEUNIT("nautilus\WebBrowserPrint.cpp");
USEUNIT("partage\nsstrcore.cpp");
USEUNIT("partage\nsstrex.cpp");
USEUNIT("partage\nswinstr.cpp");
USEUNIT("export\html2word.cpp");
USEUNIT("nautilus\nsAcroRead.cpp");
USEUNIT("nautilus\nsMailSvce.cpp");
USEUNIT("nautilus\nsTeamDocView.cpp");
USEUNIT("nautilus\nsFollowUpView.cpp");
USEUNIT("nautilus\nsVenueDocView.cpp");
USEUNIT("nautilus\NsInterface.cpp");
USEUNIT("nautilus\nsCoopChartDV.cpp");
USEUNIT("nautilus\decisionTreeDV.cpp");
USEUNIT("nautilus\wordObjects.cpp");
USEUNIT("nautilus\nsdrughistoview.cpp");
USEUNIT("nautilus\nsAlertSvce.cpp");
USEUNIT("nautilus\nsAlertSvceActiveX.cpp");
USEFORM("nautilus\ActiveX.cpp", WebProxy);
USEFORM("nautilus\Compos.cpp", WebCompos);
USEFORM("nautilus\Import.cpp", WebImport);
USEFORM("nautilus\ImpImg.cpp", ImportImg);
USEFORM("nautilus\ImportPdf.cpp", PdfImport);
USEFORM("nautilus\log_form.cpp", WebLog);
USEFORM("nautilus\Lettre.cpp", LettreType);
USEFORM("nautilus\EMail.cpp", MailBox);
USEFORM("nautilus\Nssmtp.cpp", ControlSMTP);
USEFORM("nautilus\AutoWord.cpp", AutoWordForm);
USEFORM("export\AutoWordExp.cpp", AutoWordFormEx);
USEFORM("nautilus\WebService.cpp", WebServiceForm);
USEFORM("include\nautilus\ExamHisto.cpp", ExamHistoForm);
USEFORM("nautilus\NsIndySmtp.cpp", SMTP);
USEFORM("nautilus\AcroReader.cpp", AcroReader);
USERC("nautilus\nautilus.rc");
USERC("nautilus\nauti_icons.rc");
USERC("nautilus\nstypdoc.rc");
USERC("nautilus\nshisto.rc");
USERC("nautilus\Ns_start.rc");
USERC("nautilus\nsresour.rc");
USERC("nautilus\nsresourBtn.rc");
USERC("nautilus\ns_cr.rc");
USERC("nautilus\printer.rc");
USERC("nautilus\inputdia.rc");
USERC("nautilus\nsepisod.rc");
USERC("nautilus\NsSOAP.rc");
USERC("nautilus\NsMailBox.rc");
USERC("nautilus\nsldvvue.rc");
USERC("nautilus\fonctions.rc");
USERC("docking\stripes_icons.rc");
USELIB("nsmutil.lib");
USELIB("nsm_sgbd.lib");
USELIB("nsmsavoir.lib");
USELIB("nsmbb.lib");
USELIB("nsmdecode.lib");
USELIB("nsmdn.lib");
USELIB("nsmepisod.lib");
USELIB("nsmoutil.lib");
USELIB("nsmcompta.lib");
USELIB("nsm_apicr.lib");
USELIB("nsmldv.lib");
USELIB("nsm_ob1.lib");
USELIB("memmgr.lib");
USELIB("cp32mti.lib");
USELIB("bidsvi.lib");
USELIB("owlwvi.lib");
USELIB("ocfwvi.lib");
USELIB("jvm.lib");
USELIB("psapi.lib");
USELIB("kernel32.lib");
USEUNIT("nautilus\nsTankSvce.cpp");
//---------------------------------------------------------------------------
#include "nautilus\nssuper.h"
#include "ns_ob1\nautilus-bbk.h"
#include "nautilus\nsupdate.h"
#include "nautilus\nsepicap.h"
#include "nautilus\nsbackup.h"
#include "nsoutil\nsupdatedlg.h"
#include "nsoutil\nsrechcr.h"
#include "nsoutil\nsEpiOut.h"
#include "partage\nsdivfile.h"
#include <checks.h>
DIAG_DEFINE_GROUP(OwlApp, 1, 2) ;
int OwlMain(int argc, char* argv[])
{
NSSuper* pNSSuperviseur = new NSSuper() ;
NSContexte* pContexte = new NSContexte(pNSSuperviseur) ;
// pNSSuperviseur->initInstanceCounters() ; // now done in NSSuper constructor
// pContexte->setSuperviseur(pNSSuperviseur) ; // now done in NSSuper constructor
TMyApp myApp(pContexte) ;
// myApp._pFormsApplication = Application ;
// Adapt base directory to exe directory
//
string sInitialBaseDirectory = pContexte->getBaseDirectory() ;
string sCommand = string("") ;
if (argc > 0)
{
sCommand = string(argv[0]) ;
if (string("") != sCommand)
{
size_t iLastSlashPos = sCommand.find_last_of(FILESLASH) ;
if (NPOS != iLastSlashPos)
{
string sExeDir = string(sCommand, 0, iLastSlashPos) ;
if (sInitialBaseDirectory != sExeDir)
{
pContexte->setBaseDirectory(sExeDir) ;
pContexte->reallocateBaseDirectory() ;
// Need to reload localisation string
//
pNSSuperviseur->loadLocalisationString("") ;
}
}
}
}
// Remise à zéro du fichier de trace - reseting trace file
//
string sTraceFileName ;
if (pNSSuperviseur->getInstance() > 1)
sTraceFileName = string("traceNau") + pNSSuperviseur->getInstanceString() + string(".inf") ;
else
sTraceFileName = string("traceNau.inf") ;
if (NsFileExists(sTraceFileName))
DeleteFile(sTraceFileName.c_str()) ;
if (NsFileExists("errorPilot.log"))
DeleteFile("errorPilot.log") ;
// Reseting blackboard trace file
//
string sBbkTraceFileName = string("traceBBK.inf") ;
if (NsFileExists(sBbkTraceFileName))
DeleteFile(sBbkTraceFileName.c_str()) ;
string ps = string("Starting, version ") + pNSSuperviseur->sNumVersion ;
pNSSuperviseur->trace(&ps, 1, NSSuper::trWarning) ;
ps = string("Command: ") + sCommand ;
pNSSuperviseur->trace(&ps, 1, NSSuper::trWarning) ;
ps = string("Initial base directory: ") + sInitialBaseDirectory ;
pNSSuperviseur->trace(&ps, 1, NSSuper::trWarning) ;
string sBaseDirectory = pContexte->getBaseDirectory() ;
ps = string("Current base directory: ") + sBaseDirectory ;
pNSSuperviseur->trace(&ps, 1, NSSuper::trWarning) ;
pNSSuperviseur->parseExecArgs(argc, argv) ;
// Better not use a local object because it would be destroyed after
// supervisor and would spoil objects counter
//
ps = string("Checking for update.") ;
pNSSuperviseur->trace(&ps, 1, NSSuper::trWarning) ;
NSUpdate* pUpdater = new NSUpdate(pContexte) ;
if (pUpdater->init() && pUpdater->mustCheckForUpdateAvailability() &&
pUpdater->isUpdateAvailable())
{
TSplashWindow* pSplash = 0 ;
if (myApp.getSplashWindow())
pSplash = myApp.getSplashWindow() ;
/*
string MsgHdr = pContexte->getSuperviseur()->getText("updateManagement", "updateManagement") ;
string MsgTxt = pContexte->getSuperviseur()->getText("updateManagement", "aMoreRecentVersionExistsDoYouWantToInstallIt") ;
int retVal = ::MessageBox(hWnd, MsgTxt.c_str(), MsgHdr.c_str(), MB_YESNO) ;
*/
try
{
pUpdater->setWaitingForUpdate(true) ;
// NsUpdateYesNoDialog* pUpdate = new NsUpdateYesNoDialog((TWindow*)pSplash, pContexte, &updater) ;
// int retVal = pUpdate->Execute() ;
//
if (false == pUpdater->mustForceUpdate())
{
NsUpdateYesNoWindow* pUpdate = new NsUpdateYesNoWindow((TWindow*)pSplash, pContexte, pUpdater) ;
pUpdate->Create() ;
while (pUpdater->getWaitingForUpdate())
myApp.PumpWaitingMessages() ;
}
else
pUpdater->setWantUpdate(true) ;
if (pUpdater->getWantUpdate())
{
// string splashMsg = pContexte->getSuperviseur()->getText("updateManagement", "downloadingUpdate") ;
// myApp.sendMessageToSplash(splashMsg) ;
NsDownloadWindow* pDownload = new NsDownloadWindow((TWindow*)pSplash, pContexte, pUpdater) ;
pDownload->Create() ;
if (pUpdater->startUpdate(sBaseDirectory))
{
delete pUpdater ;
delete pContexte ;
delete pNSSuperviseur ;
return -1 ;
}
pDownload->Destroy() ;
}
}
catch(TWindow::TXWindow& e)
{
string sErr = string("Exception Main : ") + e.why() ;
erreur(sErr.c_str(), standardError, 0) ;
}
catch(...)
{
erreur("Exception Main.", standardError, 0) ;
}
}
delete pUpdater ;
myApp.createSplash() ;
if (false == pNSSuperviseur->InitialiseDatabase(pContexte))
return -1 ;
pNSSuperviseur->InitialiseJava() ;
if (false == pNSSuperviseur->isJavaOk())
{
ps = string("Java initialization failed, exit") ;
pNSSuperviseur->trace(&ps, 1, NSSuper::trError) ;
return -1 ;
}
ps = string("Java initialization succeeded, creating trSteps") ;
pNSSuperviseur->trace(&ps, 1, NSSuper::trSteps) ;
pNSSuperviseur->creePilot() ;
//#ifndef __OB1__
ps = string("Igniting the Blackboard") ;
pNSSuperviseur->trace(&ps, 1, NSSuper::trSteps) ;
runBlackboard(pContexte) ;
ps = string("Blackboard started, running application") ;
pNSSuperviseur->trace(&ps, 1, NSSuper::trSteps) ;
//#endif
// TMyApp myApp(pContexte) ;
int iRun = myApp.Run() ;
ps = string("Application stopped, closing main objects") ;
pNSSuperviseur->trace(&ps, 1, NSSuper::trSteps) ;
// If user object still exists, it's time to delete it
// Détruit l'utilisateur s'il existe encore.
//
NSUtilisateurChoisi* pUser = pContexte->getUtilisateur() ;
if (pUser)
{
#ifndef __EPIPUMP__
# ifndef __EPIBRAIN__
NSEpisodus* pEpisodus = pContexte->getEpisodus() ;
if (pEpisodus && pEpisodus->bAutoSave)
{
// NSPrometheFile PrometCfg(pContexte) ;
// PrometCfg.EcrireFichier(pUser->getID()) ;
pEpisodus->saveParams(pUser->getID()) ;
}
# endif // !__EPIBRAIN__
#endif // !__EPIPUMP__
string sMsg = string("Deleting the user") ;
pContexte->getSuperviseur()->trace(&sMsg, 1, NSSuper::trSteps) ;
delete pUser ;
pContexte->setUtilisateur((NSUtilisateurChoisi*) 0) ;
}
myApp.PumpWaitingMessages() ;
#ifndef __EPIPUMP__
# ifndef __EPIBRAIN__
# ifdef __OB1__
closeBlackboard(pContexte) ;
# endif
# endif // !__EPIBRAIN__
#endif // !__EPIPUMP__
// Delete context
//
pContexte->reallocateBaseDirectory() ;
delete pContexte ;
// Close supervisor related tables
//
pNSSuperviseur->DeleteLocalDatabaseObjects() ;
pNSSuperviseur->CheckZeroObjectCount(string("NSFiche"), NSFiche::getNbInstance()) ;
// Close IDAPI engine and database.
//
pNSSuperviseur->FermeDatabase() ;
// Backup
//
nsbackup(pNSSuperviseur) ;
ps = string("Closing supervisor") ;
pNSSuperviseur->trace(&ps, 1, NSSuper::trSteps) ;
delete pNSSuperviseur ;
return iRun ;
/*
try
{
Registrar = new TOcRegistrar(AppReg, TOleDocViewFactory<TMyApp>(), OWL::TApplication::GetCmdLine(), ::DocTemplateStaticHead) ;
if (Registrar->IsOptionSet(amAnyRegOption))
return 0 ;
// If this is an exe server normal run, run the app now. Otherwise, wait
// until our factory gets a call (don't call us, we'll call you)
return Registrar->Run() ;
}
catch (xmsg& x)
{
::MessageBox(0, x.why().c_str(), "Exception", MB_OK);
}
return -1;
*/
}
#define WinMain