00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025
00026
00027
00028
00029
00030
00031
00032
00033
00034
00035
00036
00037 struct FtpSetting{
00038
00039 AFTP_telnet (TELNET);
00040 AFTP_trmTimeout (Timer);
00041 AFTP_sDataCmd (S);
00042 AFTP_sIp (S);
00043 AFTP_sHost (S);
00044 AFTP_iport (I);
00045 AFTP_sLogin (S);
00046 AFTP_sPass (S);
00047 AFTP_sDir (S);
00048 AFTP_sAppDir (S);
00049 AFTP_sUrl (S);
00050 AFTP_bWebIn (I);
00051 AFTP_iWidth (I);
00052 AFTP_iHeight (I);
00053 AFTP_lFiles ([S r1]);
00054 AFTP_lDirs ([S r1]);
00055
00056 AFTP_ctrlWindow (EdWindow);
00057 AFTP_ctrlHost (EdControl);
00058 AFTP_ctrlPort (EdControl);
00059 AFTP_ctrlLogin (EdControl);
00060 AFTP_ctrlPass (EdControl);
00061 AFTP_ctrlRoot (EdControl);
00062 AFTP_ctrlDir (EdControl);
00063 AFTP_ctrlWww (EdControl);
00064 AFTP_ctrlInWeb (EdControl);
00065
00066 AFTP_ctrlLog (EdControl);
00067 AFTP_ctrlOk (EdControl);
00068 AFTP_ctrlCancel (EdControl
00069
00070 );
00071 };
00072 typedef struct mkFtpSetting FtpSetting;
00073
00074
00075 var sMkAppletPath="tools/os3dlib/res/web/";
00076 var sMkAppletTmpPath="tmp/mkapplet/";
00077
00078 typeof winMkApplet=EdWindow;
00079
00080 var iTimeOut=60000;
00081 var iTimeOutCmd=10000;
00082
00083 proto sendFtpCommand=fun[FtpSetting S] I;
00084 proto ftpConnect=fun[FtpSetting] I;
00085
00086
00087
00088
00089
00090
00091 mkAppletEnableInterface(ftpstr, mode){
00092 setEdCtrlButtonEnable ftpstr.AFTP_ctrlOk mode;
00093 setEdCtrlTextLineEnable ftpstr.AFTP_ctrlHost mode;
00094 setEdCtrlFloatEnable ftpstr.AFTP_ctrlPort mode;
00095 setEdCtrlTextLineEnable ftpstr.AFTP_ctrlLogin mode;
00096 setEdCtrlTextLineEnable ftpstr.AFTP_ctrlPass mode;
00097 setEdCtrlTextLineEnable ftpstr.AFTP_ctrlRoot mode;
00098 setEdCtrlTextLineEnable ftpstr.AFTP_ctrlDir mode;
00099 setEdCtrlTextLineEnable ftpstr.AFTP_ctrlWww mode;
00100 setEdCtrlCheckEnable ftpstr.AFTP_ctrlInWeb mode;
00101 0;
00102 }
00103
00104
00105 mkAppletAddLog(ftpstr, message){
00106 let getEdCtrlTextValue ftpstr.AFTP_ctrlLog -> cont in
00107 let strextr cont -> lines in
00108 let sizelist lines -> nblines in
00109 let if nblines >= 50 then strbuild tl lines else cont -> cont in
00110 setEdCtrlTextValue ftpstr.AFTP_ctrlLog strcatn cont::message::"\n"::nil;
00111
00112 let _GETlineCount getEdCtrlText ftpstr.AFTP_ctrlLog -> lines in
00113 _SCROLLtext getEdCtrlText ftpstr.AFTP_ctrlLog 0 lines;
00114 0;
00115 }
00116
00117
00118 cbDlgTimeout(dlg, ftpstr, res){
00119 if res == 1 then
00120 ftpConnect ftpstr
00121 else
00122 (
00123 mkAppletAddLog ftpstr "Connection closed.";
00124 mkAppletEnableInterface ftpstr 1;
00125 0;
00126 );
00127 0;
00128 }
00129
00130
00131 cbMkAppletTimeOut(timer, ftpstr){
00132 _deltimer timer;
00133 _TELNETClose ftpstr.AFTP_telnet;
00134 let _DLGMessageBox _channel ftpstr.AFTP_ctrlWindow.EDW_win "Time Out" "Connection failed, retry ?" 1 -> dlgTimeOut in
00135 _DLGrflmessage dlgTimeOut @cbDlgTimeout ftpstr;
00136 0;
00137 }
00138
00139
00140 cbTimeOutCmd(timer, ftpstr){
00141 _deltimer timer;
00142 _TELNETClose ftpstr.AFTP_telnet;
00143 mkAppletAddLog ftpstr ">> Try to connect.";
00144 ftpConnect ftpstr;
00145 0;
00146 }
00147
00148
00149 sendFtpCommand(ftpstr, cmd){
00150 if (strfind "LIST" cmd 0)!=nil || (strfind "NLST" cmd 0)!=nil || (strfind "STOR" cmd 0)!=nil || (strfind "RETR" cmd 0)!=nil then
00151 (
00152 set ftpstr.AFTP_sDataCmd = cmd;
00153 mkAppletAddLog ftpstr ">> PASV";
00154 _TELNETSend "PASV\n" ftpstr.AFTP_telnet;
00155 0;
00156 )
00157 else
00158 (
00159 mkAppletAddLog ftpstr strcat ">> " cmd;
00160 _TELNETSend cmd ftpstr.AFTP_telnet;
00161 0;
00162 );
00163
00164 set ftpstr.AFTP_trmTimeout = _starttimer _channel iTimeOutCmd;
00165 _rfltimer ftpstr.AFTP_trmTimeout @cbTimeOutCmd ftpstr;
00166 0;
00167 }
00168
00169
00170 cbDataTimer(t, data){
00171 _deltimer t;
00172 _TELNETClose data;
00173 0;
00174 }
00175
00176
00177 cbDataWrite(data, ftpstr){
00178 if (strfind "STOR" ftpstr.AFTP_sDataCmd 0)!=nil then
00179 (
00180 let (hd ftpstr.AFTP_lFiles) -> file in
00181 (
00182 mkAppletAddLog ftpstr strcat ">> data upload : " file;
00183 _TELNETSend (_getpack _checkpack (strcat sMkAppletTmpPath file)) data;
00184 set ftpstr.AFTP_lFiles = tl ftpstr.AFTP_lFiles;
00185 );
00186
00187
00188 let _starttimer _channel 500 -> datatimer in
00189 _rfltimer datatimer @cbDataTimer data;
00190 0;
00191 )
00192 else
00193 (
00194 _TELNETClose data;
00195 0;
00196 );
00197 0;
00198 }
00199
00200
00201 cbDataRead(data, ftpstr){
00202 let _TELNETGetBuffer data -> ftpecho in
00203 mkAppletAddLog ftpstr ftpecho;
00204 _TELNETClose data;
00205 0;
00206 }
00207
00208
00209 cbDataConnect(ftpdata, ftpstr){
00210
00211 _TELNETrflRead ftpdata @cbDataRead ftpstr;
00212 _TELNETrflWrite ftpdata @cbDataWrite ftpstr;
00213
00214 _TELNETSend ftpstr.AFTP_sDataCmd ftpstr.AFTP_telnet;
00215 0;
00216 }
00217
00218
00219 cbDataClose(ftpdata, ftpstr){
00220 mkAppletAddLog ftpstr ">> upload successfull.";
00221 0;
00222 }
00223
00224
00225
00226 tryToConnectData(serveur, ftpstr){
00227 let _TELNETConnect _channel serveur -> telnetdata in
00228 (
00229 mkAppletAddLog ftpstr strcat ">> Connecting on : " serveur;
00230 _TELNETrflConnect telnetdata @cbDataConnect ftpstr;
00231 _TELNETrflClose telnetdata @cbDataClose ftpstr;
00232 );
00233 0;
00234 }
00235
00236
00237 getPort(str, portpos, pos){
00238 let strfind "," str pos -> npos in
00239 if npos==nil then
00240 (
00241 let substr str pos ((strfind ")" str 0) - pos) -> port in
00242 let substr str portpos ((pos -1) - portpos) -> coef in
00243 (
00244 _fooS strcat ">>>>>>> coef : " coef;
00245 _fooS strcat ">>>>>>> port : " port;
00246 itoa ((atoi coef)*256+(atoi port));
00247 );
00248 )
00249 else
00250 getPort str pos npos+1
00251 ;
00252 }
00253
00254
00255 cbMkAppletOpenBrowser(dlg, ftpstr, rep){
00256 if rep then
00257 (
00258 let strcatn ftpstr.AFTP_sUrl::"web/index.php"::nil -> url in
00259 _openbrowserhttp url;
00260 )
00261 else nil;
00262
00263 _TELNETClose ftpstr.AFTP_telnet;
00264 dsEdWindow winMkApplet;
00265 set winMkApplet = nil;
00266 0;
00267 }
00268
00269
00270 getFtpResponse(ftpEcho, ftpstr){
00271 let strextr ftpEcho -> echolist in
00272 let if (sizelist echolist) > 1 then
00273 atoi (hd (nth_list echolist ((sizelist echolist)-1)))
00274 else
00275 atoi (hd hd echolist)
00276 -> cmdid in
00277
00278 if cmdid == 330 then
00279 (
00280
00281 sendFtpCommand ftpstr (strcatn "USER "::ftpstr.AFTP_sLogin::"\n"::nil);
00282 )
00283 else
00284 if cmdid == 220 then
00285 (
00286
00287 sendFtpCommand ftpstr (strcatn "USER "::ftpstr.AFTP_sLogin::"\n"::nil);
00288 )
00289 else if cmdid == 331 then
00290 (
00291
00292 sendFtpCommand ftpstr (strcatn "PASS "::ftpstr.AFTP_sPass::"\n"::nil);
00293 )
00294 else if cmdid == 230 then
00295 (
00296
00297 sendFtpCommand ftpstr (strcatn "SYST\n"::nil);
00298 )
00299 else if cmdid == 215 then
00300 (
00301
00302 sendFtpCommand ftpstr "TYPE I\n";
00303 )
00304 else if cmdid == 200 then
00305 (
00306
00307 sendFtpCommand ftpstr (strcatn "CWD "::ftpstr.AFTP_sDir::"\n"::nil);
00308 )
00309
00310
00311
00312
00313
00314
00315
00316 else if cmdid == 250 || cmdid == 226 || cmdid == 257 || cmdid == 550 || cmdid == 521 then
00317 (
00318
00319
00320 if ftpstr.AFTP_lDirs != nil then
00321 (
00322 sendFtpCommand ftpstr strcatn "MKD "::(hd ftpstr.AFTP_lDirs)::"\n"::nil;
00323 set ftpstr.AFTP_lDirs = tl ftpstr.AFTP_lDirs;
00324 0;
00325 )
00326 else if ftpstr.AFTP_lFiles != nil then
00327 (
00328
00329 sendFtpCommand ftpstr strcatn "STOR "::((hd ftpstr.AFTP_lFiles))::"\n"::nil;
00330 0;
00331 )
00332 else
00333 (
00334 sendFtpCommand ftpstr "QUIT\n";
00335 0;
00336 );
00337 0;
00338 )
00339 else if cmdid == 227 then
00340 (
00341
00342 tryToConnectData (strcatn ftpstr.AFTP_sIp::":"::(getPort ftpEcho 0 0)::nil) ftpstr;
00343 )
00344 else if cmdid == 421 then
00345 (
00346
00347 _DLGMessageBox _channel ftpstr.AFTP_ctrlWindow.EDW_win "Time Out" "You have been disconnected from the server" 0;
00348 mkAppletEnableInterface ftpstr 1;
00349 0;
00350 )
00351 else if cmdid == 221 then
00352 (
00353
00354 let strcatn ftpstr.AFTP_sUrl::"web/index.php"::nil -> url in
00355 _DLGrflmessage _DLGMessageBox _channel ftpstr.AFTP_ctrlWindow.EDW_win "Upload finished" (strcat "Upload finished. Do you want to open the web page ? " url) 1 @cbMkAppletOpenBrowser ftpstr;
00356 0;
00357 )
00358 else if cmdid == 530 then
00359 (
00360
00361 mkAppletAddLog ftpstr "Bad login or password.";
00362 _TELNETClose ftpstr.AFTP_telnet;
00363 mkAppletEnableInterface ftpstr 1;
00364 0;
00365 )
00366 else if cmdid == 150 then
00367 (
00368 mkAppletAddLog ftpstr "Transfer in progress ...";
00369 0;
00370 )
00371 else nil;
00372 0;
00373 }
00374
00375
00376 cbTelnetWrite(tel, ftpstr){
00377 mkAppletAddLog ftpstr ">> server ready.";
00378 0;
00379 }
00380
00381
00382 cbTelnetRead(tel, ftpstr){
00383 let _TELNETGetBuffer tel -> ftpecho in
00384 (
00385 _deltimer ftpstr.AFTP_trmTimeout;
00386 mkAppletAddLog ftpstr ftpecho;
00387
00388 getFtpResponse ftpecho ftpstr;
00389 );
00390 0;
00391 }
00392
00393
00394 cbTelnetConnect(tel, ftpstr){
00395 mkAppletAddLog ftpstr ">> Connected.";
00396 _TELNETrflRead tel @cbTelnetRead ftpstr;
00397 _TELNETrflWrite tel @cbTelnetWrite ftpstr;
00398 0;
00399 }
00400
00401
00402 ftpConnect(ftpstr){
00403 let (_gethostbyname ftpstr.AFTP_sHost) -> resolvip in
00404 let (strcatn resolvip::":"::(itoa ftpstr.AFTP_iport)::nil) -> ftpadress in
00405 let _TELNETConnect _channel ftpadress -> telnetftp in
00406 (
00407 set ftpstr.AFTP_telnet = telnetftp;
00408 set ftpstr.AFTP_sIp = resolvip;
00409 mkAppletAddLog ftpstr strcatn ">> Connecting on "::ftpstr.AFTP_sHost::" FTP server."::nil;
00410
00411 set ftpstr.AFTP_trmTimeout = _starttimer _channel iTimeOut;
00412 _rfltimer ftpstr.AFTP_trmTimeout @cbMkAppletTimeOut ftpstr;
00413 _TELNETrflConnect ftpstr.AFTP_telnet @cbTelnetConnect ftpstr;
00414 );
00415 0;
00416 }
00417
00418
00419 addDirToList(l, ftpstr){
00420 if l == nil then nil else
00421 let l -> [elem next] in
00422 (
00423 set ftpstr.AFTP_lDirs = elem::ftpstr.AFTP_lDirs;
00424 addDirToList next ftpstr;
00425 );
00426 0;
00427 }
00428
00429
00430 getInitDirs(initdir, ftpstr){
00431 let 0 -> curpos in
00432 let nil -> newldir in
00433 let (strfind "/" initdir curpos) -> dirpos in
00434 (
00435 while dirpos != nil do
00436 (
00437 let (strfind "/" initdir (dirpos +1)) -> nextpos in
00438 let substr initdir curpos ((dirpos) - curpos) -> newdir in
00439 (
00440 if (isStringInList ftpstr.AFTP_lDirs (strlowercase newdir)) then nil else
00441 set newldir = (strlowercase newdir)::newldir;
00442 );
00443 set dirpos = (strfind "/" initdir dirpos +1);
00444 );
00445 addDirToList newldir ftpstr;
00446 );
00447 0;
00448 }
00449
00450
00451 mkAppletGetDirectories(l){
00452 let sizelist l -> size in
00453 let nil -> ndata in
00454 let 0 -> i in
00455 (
00456 while i < size do
00457 (
00458 let nth_list l i -> elem in
00459 let getPathFile elem "" -> [path _] in
00460 set ndata = path::ndata;
00461
00462 set i = i + 1;
00463 );
00464 ndata;
00465 );
00466 }
00467
00468
00469
00470
00471
00472
00473
00474
00475
00476
00477
00478
00479
00480
00481
00482
00483
00484
00485 mkAppletUploadFiles(ftpstr){
00486 apply_on_list (mkAppletGetDirectories ftpstr.AFTP_lFiles) @getInitDirs ftpstr;
00487
00488 set ftpstr.AFTP_lDirs = sortlist ftpstr.AFTP_lDirs @isSmaller;
00489
00490
00491 ftpConnect ftpstr;
00492 0;
00493 }
00494
00495
00496
00497
00498
00499 mkAppletCpWebfiles(l, path){
00500 if l == nil then nil else
00501 (
00502 let getPathFile (hd l) "" -> [_ filename] in
00503 if !strcmpi "conf.inc.php" filename then nil else
00504 let _getpack (_checkpack (hd l)) -> fileCont in
00505 _storepack fileCont (strcatn path::"web/"::filename::nil);
00506 mkAppletCpWebfiles (tl l) path;
00507 );
00508 0;
00509 }
00510
00511
00512 mkAppletPhpInc(ftpstr, filename){
00513 let if ftpstr.AFTP_sAppDir == nil then sMkAppletTmpPath else strcatn sMkAppletTmpPath::ftpstr.AFTP_sAppDir::"/"::nil -> tmppath in
00514 let _listoffiles sMkAppletPath -> lwebfiles in
00515 (
00516 mkAppletCpWebfiles lwebfiles tmppath;
00517 let strcatn "scol://applet?app="::ftpstr.AFTP_sUrl::filename::nil -> appurl in
00518 let strcatn "scol://applet:"::ftpstr.AFTP_sUrl::filename::nil -> oldappurl in
00519 let getVoyagerVersionS -> svoyver in
00520 _storepack strcatn
00521 "<?php
00522
00523 $SCOL_SITE_URL = \""::appurl::"\";
00524 $SCOL_SITE_URL_OLD = \""::oldappurl::"\";
00525
00526 $WIN_32_PLUGIN_URL = \"http://www.scolring.org/rsc/scol_plugin.exe\";
00527 $MAC_BIN_PLUGIN_URL = \"http://www.scolring.org/rsc/scol_mac.bin\";
00528
00529 //$N6_SCOL_PLUGIN_URL = \"http://www.scolring.org/rsc/npscol.xpi\";
00530 //$IE_SCOL_PLUGIN_URL = \"http://www.scolring.org/rsc/NewATLScol.dll\";
00531
00532 $LINUX_PLUGIN_URL = \"http://www.scolring.org\";
00533 $UNKNOWN_PLUGIN_URL = \"http://www.scolring.org\";
00534
00535 $MINIMUMSCOLVERSION = "::svoyver::";
00536
00537 $WEBINTEGRATED = "::(itoa ftpstr.AFTP_bWebIn)::";
00538 $WIDTH = "::(itoa ftpstr.AFTP_iWidth)::";
00539 $HEIGHT = "::(itoa ftpstr.AFTP_iHeight)::";
00540
00541 ?>"::nil strcatn tmppath::"web/conf.inc.php"::nil;
00542
00543 let sizelist lwebfiles -> size in
00544 let nil -> ndata in
00545 let 0 -> i in
00546 (
00547 while i < size do
00548 (
00549 let nth_list lwebfiles i -> elem in
00550 let getPathFile elem "" -> [_ wname] in
00551 set ndata = (strcatn ftpstr.AFTP_sAppDir::"/web/"::wname::nil)::ndata;
00552
00553 set i = i + 1;
00554 );
00555 (strcat ftpstr.AFTP_sAppDir "/web/conf.inc.php")::ndata;
00556 );
00557 );
00558 }
00559
00560
00561 strright(s, i){
00562 substr s (strlen s)-i i;
00563 }
00564
00565
00566 mkAppletFilter(l, path){
00567 if l==nil then nil else
00568 let if path == nil then sMkAppletTmpPath else strcatn sMkAppletTmpPath::path::"/"::nil -> tmppath in
00569 let l->[x nxt] in
00570 let x->[url [name[size[type[sgn _]]]]] in
00571 if url!=nil && ((!strcmp "http://" substr url 0 7) || (!strcmp "ftp://" substr url 0 6)) then
00572 let _getpack _checkpack name -> content in
00573 let zip content -> zipfile in
00574 (
00575 _storepack zipfile strcatn tmppath::name::".zp"::nil;
00576 ((if !strcmpi strright url 3 ".zp" then url else strcat url ".zp")::name::(itoa strlen zipfile)::"2"::(_getlongname content "" "#")::nil)::(mkAppletFilter nxt path);
00577 )
00578 else
00579 x::(mkAppletFilter nxt path);
00580 }
00581
00582
00583 mkAppletCrypt(ftpstr, name, cont, lfiles){
00584 let if (ftpstr.AFTP_sAppDir == nil) then name else strcatn ftpstr.AFTP_sAppDir::"/"::name::nil -> destfile in
00585 let strbuild mkAppletFilter strextr cont ftpstr.AFTP_sAppDir -> newcontent in
00586 (
00587 _storepack newcontent strcat sMkAppletTmpPath destfile;
00588
00589 let mkAppletPhpInc ftpstr name -> lwebfiles in
00590 let listLowercase (destfile::(lcat lwebfiles lfiles)) -> lupfiles in
00591 set ftpstr.AFTP_lFiles = lupfiles;
00592
00593 mkAppletUploadFiles ftpstr;
00594 );
00595 0;
00596 }
00597
00598
00599 fileExist(l, file){
00600 if l ==nil then 0 else
00601 if (!strcmp (hd l) file) then
00602 1
00603 else fileExist (tl l) file;
00604 }
00605
00606
00607 findExcluFile(lfiles){
00608 let sizelist lfiles -> size in
00609 let nil -> nlist in
00610 let 0 -> i in
00611 (
00612 while i < size do
00613 (
00614 let nth_list lfiles i -> file in
00615 let getFileExt file -> ext in
00616 if (!strcmpi "bak" ext) ||
00617 (!strcmpi "scol" ext) ||
00618 (!strcmpi "max" ext) ||
00619 (!strcmpi "psd" ext) ||
00620 (!strcmpi "exe" ext) ||
00621 (!strcmpi "php" ext) ||
00622 (!strcmpi "db" ext) ||
00623 (fileExist nlist file)
00624 then nil else
00625 set nlist = file::nlist;
00626
00627 set i = i + 1;
00628 );
00629 nlist;
00630 );
00631 }
00632
00633
00634
00635 getMkAppletXmlResources(xmlpath){
00636 let XMLload xmlpath -> xmlscenestr in
00637 let XMLgetMarksByValue xmlscenestr "resource" -> lresourcemarks in
00638 let XMLgetMarksByValueAndParamValue xmlscenestr "param" "name" "path" -> lparams in
00639 let XMLgetMarksByValue xmlscenestr "plugin" -> lpluginsmarks in
00640 let nil -> lout in
00641 (
00642 let sizelist lresourcemarks -> size in
00643 let 0 -> i in
00644 while i < size do
00645 (
00646 let nth_list lresourcemarks i -> resourcemark in
00647 let XMLgetParam resourcemark "type" -> type in
00648 let XMLgetParam resourcemark "path" -> path in
00649 set lout = path::lout;
00650
00651 set i = i + 1;
00652 );
00653
00654 let sizelist lpluginsmarks -> size in
00655 let 0 -> i in
00656 while i < size do
00657 (
00658 let nth_list lpluginsmarks i -> pluginmark in
00659 let strcat "tools/os3dplugins/" XMLgetParam pluginmark "source" -> source in
00660 let getPathFile source "" -> [plugdir _] in
00661 let XMLload source -> xmlpluginstr in
00662 let XMLgetMarkByValue xmlpluginstr "resource" -> resourcemark in
00663 let XMLgetMarksByValueFromMark resourcemark "file" -> lfilemarks in
00664 let XMLgetMarkByValue xmlpluginstr "client" -> clientmark in
00665 let XMLgetMarksByValueFromMark clientmark "script" -> lscripmarks in
00666 (
00667 set lout = source::lout;
00668
00669 let sizelist lfilemarks -> size in
00670 let 0 -> i2 in
00671 while i2 < size do
00672 (
00673 let nth_list lfilemarks i2 -> filemark in
00674 let getRelativePath (getDirectoryWithoutLastSlash plugdir) (XMLgetParam filemark "path") -> file in
00675 set lout = file::lout;
00676 set i2 = i2 + 1;
00677 );
00678
00679 let sizelist lscripmarks -> size in
00680 let 0 -> i2 in
00681 while i2 < size do
00682 (
00683 let nth_list lscripmarks i2 -> scriptmark in
00684 let getRelativePath (getDirectoryWithoutLastSlash plugdir) (XMLgetParam scriptmark "path") -> file in
00685 set lout = file::lout;
00686 set i2 = i2 + 1;
00687 );
00688 );
00689
00690 set i = i + 1;
00691 );
00692
00693 let sizelist lparams -> size in
00694 let 0 -> i in
00695 while i < size do
00696 (
00697 let nth_list lparams i -> parammark in
00698 let XMLgetData parammark -> path in
00699 if (!strcmp "" strtrim path) || path == nil then nil else
00700 set lout = path::lout;
00701
00702 set i = i + 1;
00703 );
00704
00705 xmlpath::lout;
00706 );
00707 }
00708
00709
00710 mkAppletAddFile(url, l, ls){
00711 if l ==nil then ls else
00712 let l -> [elem next] in
00713 (
00714 let (strcatn url::elem::"\ "::elem::"\n"::ls::nil) -> newstring in
00715 mkAppletAddFile url next newstring;
00716 );
00717 }
00718
00719
00720 mkAppletUpdateZpFilesName(l, path){
00721 let if path == nil then "" else strcatn path::"/"::nil -> tmppath in
00722 let sizelist l -> size in
00723 let nil -> ndata in
00724 let 0 -> i in
00725 (
00726 while i < size do
00727 (
00728 let nth_list l i -> elem in
00729 set ndata = (strcatn tmppath::elem::".zp"::nil)::ndata;
00730
00731 set i = i + 1;
00732 );
00733 ndata;
00734 );
00735 }
00736
00737
00738 mkAppletGetFilesMd5(lfiles){
00739 let sizelist lfiles -> size in
00740 let nil -> ndata in
00741 let 0 -> i in
00742 (
00743 while i < size do
00744 (
00745 let nth_list lfiles i -> elem in
00746 let _filemd5 _checkpack elem -> fmd5 in
00747 if fmd5 == nil then nil else
00748 set ndata = fmd5::ndata;
00749
00750 set i = i + 1;
00751 );
00752 ndata;
00753 );
00754 }
00755
00756
00757 mkAppletListFiles(xmlpath){
00758 let getFilesFromDirRecursive "tools/os3dlib" -> lib in
00759 let getFilesFromDirRecursive "tools/os3dplayer" -> player in
00760 let getMkAppletXmlResources xmlpath -> lres in
00761 listLowercase findExcluFile (lcat (lcat lib player) lres);
00762 }
00763
00764
00765 mkAppletGetAppMd5(xmlpath){
00766 mkAppletGetFilesMd5 mkAppletListFiles xmlpath;
00767 }
00768
00769
00770 cbMkAppletOkBtn(ctrlbtn, p){
00771 let p -> [xmlpath script ftpstr] in
00772 let getDirectoryWithoutLastSlash (getEdCtrlTextLineValue ftpstr.AFTP_ctrlWww) -> www in
00773 let getDirectoryWithoutFirstSlash getDirectoryWithoutLastSlash (getEdCtrlTextLineValue ftpstr.AFTP_ctrlDir) -> appdir in
00774 let if (!strcmpi "" (strtrim appdir)) then nil else strlowercase appdir -> appdir in
00775 let getDirectoryWithoutLastSlash (getEdCtrlTextLineValue ftpstr.AFTP_ctrlRoot) -> ftproot in
00776 let if !strcmp (strtrim ftproot) "" then "/" else (strcat ftproot "/") -> ftproot in
00777 let (getEdCtrlTextLineValue ftpstr.AFTP_ctrlHost) -> ftphost in
00778 let ftoi (getEdCtrlFloatValue ftpstr.AFTP_ctrlPort) -> ftpport in
00779 let (getEdCtrlTextLineValue ftpstr.AFTP_ctrlLogin) -> ftplogin in
00780 let (getEdCtrlTextLineValue ftpstr.AFTP_ctrlPass) -> ftppass in
00781 let (getEdCtrlCheckState ftpstr.AFTP_ctrlInWeb) -> webin in
00782 let if appdir == nil then
00783 strcatn (if (!strcmp "http://" substr www 0 7) || (!strcmp "https://" substr www 0 7) then nil else "http://")::www::"/"::nil
00784 else
00785 strcatn (if (!strcmp "http://" substr www 0 7) || (!strcmp "https://" substr www 0 7) then nil else "http://")::www::"/"::appdir::"/"::nil
00786 -> url in
00787 if (!strcmp (strtrim ftphost) "") || (ftpport == nil) || (!strcmp (strtrim ftplogin) "") || (!strcmp (strtrim ftppass) "") || (!strcmp (strtrim www) "") then
00788 (
00789 _DLGMessageBox _channel ftpstr.AFTP_ctrlWindow.EDW_win "Error" "Please check the form" 0;
00790 0;
00791 )
00792 else
00793 (
00794 set ftpstr.AFTP_sHost = ftphost;
00795 set ftpstr.AFTP_iport = ftpport;
00796 set ftpstr.AFTP_sLogin = ftplogin;
00797 set ftpstr.AFTP_sPass = ftppass;
00798 set ftpstr.AFTP_sDir = ftproot;
00799 set ftpstr.AFTP_sAppDir = appdir;
00800 set ftpstr.AFTP_sUrl = url;
00801 set ftpstr.AFTP_bWebIn = webin;
00802
00803 setEdCtrlTextValue ftpstr.AFTP_ctrlLog "";
00804 mkAppletEnableInterface ftpstr 0;
00805
00806 let getFileNameWithoutExt xmlpath -> fname in
00807 let mkAppletListFiles xmlpath -> lfiles in
00808 let strcatn (mkAppletAddFile url lfiles nil)::"\nscript\n"::script::nil -> cont in
00809 mkAppletCrypt ftpstr (strcat fname ".txt") cont (mkAppletUpdateZpFilesName lfiles ftpstr.AFTP_sAppDir);
00810 );
00811 0;
00812 }
00813
00814
00815 cbMkAppletCancelBtn(ctrlbtn, p){
00816 let p -> [winstr ftpstr] in
00817 (
00818 _TELNETClose ftpstr.AFTP_telnet;
00819 dsEdWindow winstr;
00820 set winMkApplet = nil;
00821 );
00822 0;
00823 }
00824
00825
00826 cbDestroyExportAppletWin(winstr, ftpstr){
00827 _TELNETClose ftpstr.AFTP_telnet;
00828 set winMkApplet = nil;
00829 0;
00830 }
00831
00832
00833 mkApplet(fatherstr, xmlpath, script, w, h){
00834 if winMkApplet != nil then nil else
00835 (
00836 let _GETscreenSize -> [sw sh] in
00837 let [430 405] -> [iw ih] in
00838 let getFileNameWithoutExt xmlpath -> fname in
00839
00840 let crEdModalDialogWindow _channel fatherstr ((sw / 2) - (iw / 2)) ((sh / 2) - (ih / 2)) iw ih WN_NOSCOL|WN_MENU nil "Export to Web Page" -> winstr in
00841 let crEdCtrlLabel winstr 10 12 205 20 "Ftp host" nil -> labelhost in
00842 let crEdCtrlTextLine winstr 220 10 (iw - 230) 20 "" nil EDWIN_RESIZE_MW -> ctrlhost in
00843 let crEdCtrlLabel winstr 10 37 205 20 "Ftp port" nil -> labelport in
00844 let crEdCtrlFloat winstr 220 35 60 20 (itof 21) 1.0 65535.0 1.0 0 nil EDWIN_RESIZE_MW -> ctrlport in
00845 let crEdCtrlLabel winstr 10 62 205 20 "Ftp login" nil -> labellogin in
00846 let crEdCtrlTextLine winstr 220 60 (iw - 230) 20 "" nil EDWIN_RESIZE_MW -> ctrllogin in
00847 let crEdCtrlLabel winstr 10 87 205 20 "Ftp password" nil -> labelpass in
00848 let crEdCtrlTextLine winstr 220 85 (iw - 230) 20 "" ET_BORDER|ET_AHSCROLL|ET_TABFOCUS|ET_PASSWORD EDWIN_RESIZE_MW -> ctrlpass in
00849 let crEdCtrlLabel winstr 10 112 205 20 "Ftp www root path (ex:/www)" nil -> labelroot in
00850 let crEdCtrlTextLine winstr 220 110 (iw - 230) 20 "/" nil EDWIN_RESIZE_MW -> ctrlroot in
00851 let crEdCtrlLabel winstr 10 137 205 20 "Ftp destination directory (ex:project)" nil -> labeldir in
00852 let crEdCtrlTextLine winstr 220 135 (iw - 230) 20 fname nil EDWIN_RESIZE_MW -> ctrldir in
00853 let crEdCtrlLabel winstr 10 162 205 20 "Http domain (ex:www.domain.com)" nil -> labelwww in
00854 let crEdCtrlTextLine winstr 220 160 (iw - 230) 20 "" nil EDWIN_RESIZE_MW -> ctrlwww in
00855 let crEdCtrlCheck winstr 10 185 (iw - 20) 20 "Insert the application in the web page" EDWIN_RESIZE_MW -> ctrlwebin in
00856 let crEdCtrlText winstr 10 210 (iw - 20) 150 "" nil EDWIN_RESIZE_MW -> ctrlinfos in
00857 let crEdCtrlButton winstr 10 (ih - 30) 90 20 "Ok" EDWIN_RESIZE_MW -> ctrlok in
00858 let crEdCtrlButton winstr (iw - 100) (ih - 30) 90 20 "Cancel" EDWIN_RESIZE_MW -> ctrlcancel in
00859 let mkFtpSetting [nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil winstr ctrlhost ctrlport ctrllogin ctrlpass ctrlroot ctrldir ctrlwww ctrlwebin ctrlinfos ctrlok ctrlcancel] -> ftpstr in
00860 (
00861 set winMkApplet = winstr;
00862 set ftpstr.AFTP_iWidth = w;
00863 set ftpstr.AFTP_iHeight = h;
00864 setEdCtrlButtonCb ctrlok mkfun2 @cbMkAppletOkBtn [xmlpath script ftpstr];
00865 setEdCtrlButtonCb ctrlcancel mkfun2 @cbMkAppletCancelBtn [winstr ftpstr];
00866
00867 setEdwindowCbDestroy winstr mkfun2 @cbDestroyExportAppletWin ftpstr;
00868 );
00869 );
00870 0;
00871 }
00872
00873