-
Notifications
You must be signed in to change notification settings - Fork 0
/
main.frm
1986 lines (1739 loc) · 73.6 KB
/
main.frm
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
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
VERSION 5.00
Object = "{831FDD16-0C5C-11D2-A9FC-0000F8754DA1}#2.1#0"; "MSCOMCTL.OCX"
Object = "{E01CB74C-0B6E-4933-899F-96A702EAA873}#4.0#0"; "DiFtpCli6_FFhMOD.ocx"
Begin VB.Form frmMain
BorderStyle = 1 'Fixed Single
Caption = "BlosHome"
ClientHeight = 7725
ClientLeft = 150
ClientTop = 435
ClientWidth = 11430
Icon = "main.frx":0000
LinkTopic = "main"
MaxButton = 0 'False
ScaleHeight = 7725
ScaleWidth = 11430
StartUpPosition = 2 'CenterScreen
Begin VB.CommandButton cmdDownloadArt
Caption = "< &Move"
Enabled = 0 'False
Height = 510
Index = 1
Left = 5220
TabIndex = 13
Top = 4905
Width = 975
End
Begin VB.CommandButton cmdCleanupBlog
Caption = "Cle&an"
Enabled = 0 'False
Height = 615
Left = 5220
TabIndex = 15
Top = 6690
Width = 975
End
Begin VB.CommandButton cmdUploadArt
Caption = "Previe&w >"
Enabled = 0 'False
Height = 510
Index = 0
Left = 5220
TabIndex = 10
Top = 3030
Width = 975
End
Begin MSComctlLib.ImageList lstImg
Left = 5430
Top = 2205
_ExtentX = 1005
_ExtentY = 1005
BackColor = -2147483643
ImageWidth = 16
ImageHeight = 16
MaskColor = 12632256
_Version = 393216
BeginProperty Images {2C247F25-8591-11D1-B16A-00C0F0283628}
NumListImages = 4
BeginProperty ListImage1 {2C247F27-8591-11D1-B16A-00C0F0283628}
Picture = "main.frx":19B2
Key = "Category"
EndProperty
BeginProperty ListImage2 {2C247F27-8591-11D1-B16A-00C0F0283628}
Picture = "main.frx":1E0A
Key = "Article"
EndProperty
BeginProperty ListImage3 {2C247F27-8591-11D1-B16A-00C0F0283628}
Picture = "main.frx":2262
Key = "Preview"
EndProperty
BeginProperty ListImage4 {2C247F27-8591-11D1-B16A-00C0F0283628}
Picture = "main.frx":232B
Key = "Up"
EndProperty
EndProperty
End
Begin DiFtpCli6_FFhMOD.FtpCli FtpCli
Left = 5220
Top = 2475
_ExtentX = 873
_ExtentY = 873
UserName = ""
Password = ""
End
Begin VB.Timer timerCnnx
Enabled = 0 'False
Left = 5760
Top = 2550
End
Begin VB.CommandButton cmdBackupBlog
Caption = "BAC&KUP BLOG <<<<<"
Enabled = 0 'False
Height = 945
Left = 5220
TabIndex = 14
Top = 5730
Width = 975
End
Begin VB.CommandButton cmdDownloadArt
Caption = "< &Copy"
Enabled = 0 'False
Height = 510
Index = 0
Left = 5220
TabIndex = 12
Top = 4380
Width = 975
End
Begin VB.CommandButton cmdUploadArt
Caption = "Pu&blish >"
Enabled = 0 'False
Height = 510
Index = 1
Left = 5220
TabIndex = 11
Top = 3555
Width = 975
End
Begin VB.CommandButton cmdProj
Caption = "Parameter&s"
Enabled = 0 'False
Height = 675
Left = 120
TabIndex = 0
Top = 345
Width = 1590
End
Begin VB.Frame framRemote
Caption = "Remote blog"
Enabled = 0 'False
Height = 4935
Left = 6240
TabIndex = 16
Top = 2385
Width = 5070
Begin VB.OptionButton optStatusArt
Caption = "Public"
Enabled = 0 'False
Height = 315
Index = 1
Left = 4110
Style = 1 'Graphical
TabIndex = 24
Top = 4380
Value = -1 'True
Width = 750
End
Begin VB.OptionButton optStatusArt
Caption = "Private"
Enabled = 0 'False
Height = 315
Index = 0
Left = 4110
Style = 1 'Graphical
TabIndex = 20
Top = 4080
Width = 750
End
Begin VB.CommandButton cmdSeeRemoteArt
Caption = "&See online"
Enabled = 0 'False
Height = 255
Left = 945
TabIndex = 26
Top = 4500
Width = 1110
End
Begin VB.CommandButton cmdDelRemoteArt
Caption = "Dele&te"
Enabled = 0 'False
Height = 255
Left = 2070
TabIndex = 27
Top = 4500
Width = 900
End
Begin VB.CommandButton cmdRenRemoteArt
Caption = "Rena&me"
Enabled = 0 'False
Height = 255
Left = 2985
TabIndex = 28
Top = 4500
Width = 990
End
Begin VB.CommandButton cmdRenRemoteCat
Caption = "Re&name"
Enabled = 0 'False
Height = 255
Left = 2610
TabIndex = 23
Top = 4170
Width = 990
End
Begin VB.CommandButton cmdRmRemoteCat
Caption = "&Delete"
Enabled = 0 'False
Height = 255
Left = 1680
TabIndex = 22
Top = 4170
Width = 900
End
Begin VB.CommandButton cmdMkRemoteCat
Caption = "&Create"
Enabled = 0 'False
Height = 255
Left = 945
TabIndex = 21
Top = 4170
Width = 705
End
Begin MSComctlLib.ListView lstRemote
Height = 3465
Left = 105
TabIndex = 18
Top = 570
Width = 4845
_ExtentX = 8546
_ExtentY = 6112
View = 3
LabelEdit = 1
LabelWrap = -1 'True
HideSelection = 0 'False
FullRowSelect = -1 'True
_Version = 393217
Icons = "lstImg"
SmallIcons = "lstImg"
ForeColor = -2147483640
BackColor = -2147483643
BorderStyle = 1
Appearance = 1
Enabled = 0 'False
NumItems = 6
BeginProperty ColumnHeader(1) {BDD1F052-858B-11D1-B16A-00C0F0283628}
Text = "Name"
Object.Width = 2646
EndProperty
BeginProperty ColumnHeader(2) {BDD1F052-858B-11D1-B16A-00C0F0283628}
SubItemIndex = 1
Text = "Date"
Object.Width = 1852
EndProperty
BeginProperty ColumnHeader(3) {BDD1F052-858B-11D1-B16A-00C0F0283628}
SubItemIndex = 2
Text = "Time"
Object.Width = 1094
EndProperty
BeginProperty ColumnHeader(4) {BDD1F052-858B-11D1-B16A-00C0F0283628}
Alignment = 1
SubItemIndex = 3
Text = "Size"
Object.Width = 838
EndProperty
BeginProperty ColumnHeader(5) {BDD1F052-858B-11D1-B16A-00C0F0283628}
Alignment = 1
SubItemIndex = 4
Text = "Joint"
Object.Width = 917
EndProperty
BeginProperty ColumnHeader(6) {BDD1F052-858B-11D1-B16A-00C0F0283628}
SubItemIndex = 5
Text = "Enc."
Object.Width = 1058
EndProperty
End
Begin VB.Shape shapStatus
BorderColor = &H00404040&
BorderStyle = 3 'Dot
FillColor = &H00FFFFFF&
FillStyle = 0 'Solid
Height = 765
Left = 4035
Top = 3990
Width = 900
End
Begin VB.Label lblRemoteArts
AutoSize = -1 'True
Caption = "Article :"
Enabled = 0 'False
Height = 195
Left = 375
TabIndex = 25
Top = 4515
Width = 525
End
Begin VB.Label lblRemoteCats
AutoSize = -1 'True
Caption = "Category :"
Enabled = 0 'False
Height = 195
Left = 135
TabIndex = 19
Top = 4185
Width = 720
End
Begin VB.Label lblRemotePath
Height = 300
Left = 210
TabIndex = 17
Top = 270
Width = 4515
End
End
Begin VB.Frame framLocal
Caption = "Local workspace"
Enabled = 0 'False
Height = 4935
Left = 105
TabIndex = 2
Top = 2385
Width = 5070
Begin VB.CommandButton cmdCopyLocalArt
Caption = "Cop&y"
Enabled = 0 'False
Height = 255
Left = 1440
TabIndex = 6
Top = 4500
Width = 645
End
Begin VB.CommandButton cmdEditLocalArt
Caption = "E&dit"
Enabled = 0 'False
Height = 255
Left = 2115
TabIndex = 7
Top = 4500
Width = 645
End
Begin VB.CommandButton cmdRenLocalArt
Caption = "R&ename"
Enabled = 0 'False
Height = 255
Left = 3720
TabIndex = 9
Top = 4500
Width = 990
End
Begin VB.CommandButton cmdDelLocalArt
Caption = "De&lete"
Enabled = 0 'False
Height = 255
Left = 2790
TabIndex = 8
Top = 4500
Width = 900
End
Begin VB.CommandButton cmdMkLocalArt
Caption = "C&reate"
Enabled = 0 'False
Height = 255
Left = 780
TabIndex = 5
Top = 4500
Width = 630
End
Begin MSComctlLib.ListView lstLocal
Height = 4095
Left = 105
TabIndex = 3
Top = 285
Width = 4845
_ExtentX = 8546
_ExtentY = 7223
View = 3
LabelEdit = 1
Sorted = -1 'True
LabelWrap = -1 'True
HideSelection = 0 'False
FullRowSelect = -1 'True
_Version = 393217
Icons = "lstImg"
SmallIcons = "lstImg"
ForeColor = -2147483640
BackColor = -2147483643
BorderStyle = 1
Appearance = 1
Enabled = 0 'False
NumItems = 6
BeginProperty ColumnHeader(1) {BDD1F052-858B-11D1-B16A-00C0F0283628}
Text = "Name"
Object.Width = 2646
EndProperty
BeginProperty ColumnHeader(2) {BDD1F052-858B-11D1-B16A-00C0F0283628}
SubItemIndex = 1
Text = "Date"
Object.Width = 1852
EndProperty
BeginProperty ColumnHeader(3) {BDD1F052-858B-11D1-B16A-00C0F0283628}
SubItemIndex = 2
Text = "Time"
Object.Width = 1094
EndProperty
BeginProperty ColumnHeader(4) {BDD1F052-858B-11D1-B16A-00C0F0283628}
Alignment = 1
SubItemIndex = 3
Text = "Size"
Object.Width = 838
EndProperty
BeginProperty ColumnHeader(5) {BDD1F052-858B-11D1-B16A-00C0F0283628}
Alignment = 1
SubItemIndex = 4
Text = "Joint"
Object.Width = 917
EndProperty
BeginProperty ColumnHeader(6) {BDD1F052-858B-11D1-B16A-00C0F0283628}
SubItemIndex = 5
Text = "Enc."
Object.Width = 1058
EndProperty
End
Begin VB.Label lblLocalArts
AutoSize = -1 'True
Caption = "Article :"
Enabled = 0 'False
Height = 195
Left = 210
TabIndex = 4
Top = 4515
Width = 525
End
End
Begin MSComctlLib.StatusBar barStatus
Align = 2 'Align Bottom
Height = 285
Left = 0
Negotiate = -1 'True
TabIndex = 29
Top = 7440
Width = 11430
_ExtentX = 20161
_ExtentY = 503
ShowTips = 0 'False
_Version = 393216
BeginProperty Panels {8E3867A5-8586-11D1-B16A-00C0F0283628}
NumPanels = 2
BeginProperty Panel1 {8E3867AB-8586-11D1-B16A-00C0F0283628}
Object.Width = 5292
MinWidth = 5292
Text = "Offline"
TextSave = "Offline"
Key = "cnnx"
EndProperty
BeginProperty Panel2 {8E3867AB-8586-11D1-B16A-00C0F0283628}
Object.Width = 15875
MinWidth = 15875
Picture = "main.frx":2647
Key = "url"
EndProperty
EndProperty
End
Begin VB.CommandButton cmdCnnx
Caption = "Co&nnection"
Default = -1 'True
Enabled = 0 'False
Height = 1065
Left = 120
TabIndex = 1
Top = 1080
Width = 1590
End
Begin VB.Image imgDeco
Height = 2100
Left = 1800
Picture = "main.frx":29E3
Top = 45
Width = 9525
End
Begin VB.Line lineMenu
X1 = -30
X2 = 11430
Y1 = 30
Y2 = 30
End
Begin VB.Menu mnuProj
Caption = "&Project"
Begin VB.Menu mnuProj_New
Caption = "&New"
End
Begin VB.Menu mnuProj_Open
Caption = "&Open"
End
Begin VB.Menu mnuProj_Del
Caption = "&Delete"
End
End
Begin VB.Menu mnuLang
Caption = "&Language"
Begin VB.Menu mnuLang_EN
Caption = "&EN"
Checked = -1 'True
End
Begin VB.Menu mnuLang_FR
Caption = "&FR"
End
End
Begin VB.Menu mnuInfo
Caption = "&?"
Begin VB.Menu mnuInfo_Help
Caption = "&Help"
End
Begin VB.Menu mnuInfo_About
Caption = "&About"
End
End
End
Attribute VB_Name = "frmMain"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False
'BlosHome (c) FFh Lab / Eric Lequien, 2009-2013 - http://ffh-lab.com
'This frame represents the main interface
Option Explicit
Option Base 1
Private Type SECUFILE 'describe useful elements for checking file integrity (after transmission)
file As String 'filename, with or without path according to needing (without path if current remote dir)
goodsize As Long 'expected file size for the given file (will be compared with observed one after upload)
integrity As Integer 'result of size checking (-1:corrupted, 0:undefined, 1: OK, matches the good size)
End Type '***LATER : we could improve integrity checking using CRC32 or better (but slower)
Private bMouseoverStatusOpt As Boolean 'allows to differenciate manual and auto-click on optStatusArt
Private Sub barStatus_PanelDblClick(ByVal Panel As MSComctlLib.Panel)
If Panel.Key = "url" Then
'Attempts to reach the blog using the default Web browser
If Left$(barStatus.Panels.item("url").Text, 7) = "http://" Then
OpenMIME barStatus.Panels.item("url").Text
End If
End If
End Sub
Private Sub cmdBackupBlog_Click()
'Backups the entirety of remote blog toward a local diectory
'***TODO : write the function with these elements in mind :
'- local directory could be a subdir of project workspace, or beside it, or an app subdir like "backups"
'- backup could be compressed (using ZIP format, since already used in BlosHome), taking care of paths and timestamp
'- name of compressed archive could be something like "<project_name>_<date>_<hour>.zip"
'- backup process should save cgi-bin (blosxom-related) content too, including eventual timestamps-index plugin data
'- to preserve articles timestamps (if no timestamp-index plugin), we'll build a timestamps.txt for future reference
'***LATER : a restore feature should be added ; it should do this : upload, chemod of what required, touch every file
' from our referential "timestamps.txt" if not any "timestamp-index" plugin data has been found in backup.
MsgBox arMsg(70) & ".", vbInformation
End Sub
Private Sub cmdCleanupBlog_Click()
'Cleans the remote blog and local data
'***TODO : write this function with these elements in mind :
'- deletes eventual temporary files, remote orphan images (not binded with an article),
'- erase obsolets infos in local and remote meta.cache
'... [extendable list, according to BlosHome working and eventual subsequent waste it could imply)
MsgBox arMsg(70) & ".", vbInformation
End Sub
Private Sub cmdCnnx_Click()
'Attempts to connect/disconnect to FTP server
If Left(cmdCnnx.Caption, 1) = "C" Then
CnnxDcnnx True 'Connexion
Else
CnnxDcnnx False 'Déconnexion
End If
End Sub
Private Sub cmdCopyLocalArt_Click()
'Duplicates a local article (for the puirpose to create a new one on this base)
Dim strKey As String
Dim strArt As String
Dim strOrgArt As String
Dim strNewArt As String
Dim strTitle As String
Dim strMsg As String
Dim strDefault As String
Dim bOK As Boolean
'checking
If lstLocal.ListItems.Count = 0 Then Exit Sub
If lstLocal.SelectedItem.Selected = False Then
MsgBox arMsg(71) & " !", vbExclamation
Exit Sub
End If
strKey = lstLocal.SelectedItem.Key
strOrgArt = GetWorkspace() & "\" & strKey
If Dir(strCurrArt) = "" Then
MsgBox arMsg(72) & " !", vbExclamation
PopulateClearLocalList True
Exit Sub
End If
'user input
strTitle = arMsg(5)
strMsg = arMsg(6) & " '" & strKey & "'" & vbNewLine _
& vbNewLine _
& arMsg(7) & " : " & vbNewLine _
& "- " & arMsg(8) & " /*\<>|?" & Chr(34) & ":" & vbNewLine _
& "- " & arMsg(9) & vbNewLine _
& "- " & arMsg(10) & vbNewLine _
& "- " & arMsg(11) & vbNewLine _
& "- " & arMsg(12) & vbNewLine _
& "- " & arMsg(13) & " '" & structProj.art_ext & "' " & arMsg(14) & vbNewLine _
& vbNewLine _
& arMsg(15) & structProj.art_ext & "'"
strDefault = ""
bOK = False
Do
strArt = InputBox(strMsg, strTitle, strDefault)
If strArt = "" Then Exit Sub
strDefault = strArt 'save for eventual next loop
strArt = CheckAndMkFilename(UnAccent(LCase(strArt)), False, True)
If strArt <> "" Then
If IsNumeric(Left$(strArt, 1)) = False Then
bOK = True
Else
MsgBox arMsg(73) & " !", vbExclamation
bOK = False
End If
Else
MsgBox arMsg(74) & " !", vbExclamation
bOK = False
End If
If Right$(strArt, 4) <> structProj.art_ext Then
strArt = strArt & structProj.art_ext
End If
strNewArt = GetWorkspace() & "\" & strArt
If Dir(strNewArt) <> "" Then
MsgBox arMsg(75) & " !", vbExclamation
bOK = False
End If
Loop Until bOK = True
'effective application
Screen.MousePointer = vbHourglass
On Error GoTo cmdCopyLocalArt_Click_Error
FileCopy strOrgArt, strNewArt
If Dir(strNewArt) = "" Then Err.Raise 513
Screen.MousePointer = vbDefault
PopulateClearLocalList True
cmdCopyLocalArt_Click_End:
On Error GoTo 0
Exit Sub
cmdCopyLocalArt_Click_Error:
MsgBox arMsg(76) & " '" & strKey & "' !", vbExclamation
Resume cmdCopyLocalArt_Click_End
End Sub
Private Sub cmdDelLocalArt_Click()
'Deletes the selected local article
'WARNING : if in a circumstance associated images was moved beside article in the local workspace, it would be
' useful to delete-it too (at this time, images stay in their original location on disk and relative path
' are modified on fly during upload (direct publish or publish as preview cmds), and in zipped archive).
Dim strKey As String
Dim strArt As String
If lstLocal.ListItems.Count = 0 Then Exit Sub
If lstLocal.SelectedItem.Selected = False Then
MsgBox arMsg(71) & " !", vbExclamation
Exit Sub
End If
strKey = lstLocal.SelectedItem.Key
strArt = GetWorkspace() & "\" & strKey
If Dir(strArt) = "" Then
MsgBox arMsg(72) & " !", vbExclamation
PopulateClearLocalList True
Else
Dim nRet As Integer
nRet = MsgBox(arMsg(77) & " '" & strKey & "' ?", vbQuestion + vbYesNo)
If nRet = vbYes Then
Kill strArt
PopulateClearLocalList True
End If
End If
End Sub
Private Sub cmdDelRemoteArt_Click()
'Deletes the selected remote article
'***LATER : réindexes (or manage concerned cache/index data files directly) if a cache/index data file(s),
' autogenerated by cache/index plugins, are not automatically aware of deletion. For example,
' in my blogs, "/cgi-bin/blog/002entries_timestamp" generates "state/entries_timestamp.index".
Dim strKey As String
Dim strType As String
Dim strArt As String 'remote path
Dim strFilename As String 'filmename only
Dim strDisplayName As String 'different than filename in case of a private (preview) article ; because of prefix
Dim strTmpFile As String
Dim arNotDeleted() As String
Dim nIdx As Integer
Dim strMsg As String
Dim nRet As Integer
Dim bRet As Boolean
'checking
If lstRemote.SelectedItem.Selected = False Then
MsgBox arMsg(71) & " !", vbExclamation
Exit Sub
End If
strType = lstRemote.SelectedItem.SmallIcon
If strType <> "Article" And strType <> "Preview" Then
MsgBox arMsg(78) & " !", vbInformation
Exit Sub
End If
'init
strKey = lstRemote.SelectedItem.Key
strDisplayName = lstRemote.SelectedItem.Text
strFilename = FtpCli.RemoteFiles(strKey).FileName
strArt = FtpCli.RemoteDir & "/" & strFilename
strMsg = arMsg(16) & " '" & strDisplayName & "' ?"
nRet = MsgBox(strMsg, vbQuestion + vbYesNo)
If nRet = vbNo Then Exit Sub
On Error GoTo cmdDelRemoteArt_Click_Error
Screen.MousePointer = vbHourglass
'deletes the article and its eventual attached images
bRet = DelCurrRemoteArt(arNotDeleted)
If bRet = False Then
If arNotDeleted(1) = "failed" Then
Err.Raise 513
Else
Err.Raise 514
End If
End If
'user info
strMsg = arMsg(17) & " '" & strDisplayName & "' " & arMsg(18) & " !"
MsgBox strMsg, vbInformation
cmdDelRemoteArt_Click_End:
If strTmpFile <> "" And Dir(strTmpFile) <> "" Then Kill strTmpFile
Screen.MousePointer = vbDefault
On Error GoTo 0
Exit Sub
cmdDelRemoteArt_Click_Error:
Select Case Err.Number
Case 513
strMsg = arMsg(19) & " '" & strDisplayName & "'" & vbNewLine & arMsg(20) & " !"
Case 514
If arNotDeleted(1) = strFilename Then
strMsg = arMsg(21) & " '" & strDisplayName & "'" & vbNewLine & arMsg(20) & " !"
Else
strMsg = arMsg(22) & " '" & strDisplayName & "' " & arMsg(23) & "," & vbNewLine & _
arMsg(24) & " :"
For nIdx = LBound(arNotDeleted) To UBound(arNotDeleted)
strMsg = strMsg & vbNewLine & "- '" & arNotDeleted(nIdx) & "'"
Next
strMsg = strMsg & vbNewLine & vbNewLine & arMsg(25) & vbNewLine & _
arMsg(26) & " '" & arMsg(27) & "'"
End If
Case Else
MsgBox "Error #" & Err.Number & "@ bloshome/frmMain/cmdDelRemoteArt_Click/#" & Erl & " : " & Err.Description, vbExclamation
End Select
MsgBox strMsg, vbExclamation
Resume cmdDelRemoteArt_Click_End
End Sub
Private Sub cmdDownloadArt_Click(index As Integer)
'Rapatriates a copie of a published article (for the purpose to review-it or to use-it as base for a new article)
'***TODO : implement case which need real download if alternative fast-way appears to be impossible because of
' absence of this article in zipped archives ; we'll branch to future fct from cmdUploadArt_Click/***LATER
Dim strKey As String
Dim strDisplayName As String
Dim strFilename As String
Dim strArt As String
Dim strWorkspace As String
Dim strIdArchiv As String
Dim bRet As Boolean
Dim strTempFile As String 'useful to tests for checking if zipped article in archive is the right one :
Dim nPreparedArtSize As Long
Dim nCurrPreparedArtSize As Long
Dim nOrgAddedNameLen As Integer
Dim nCurrAddedNameLen As Integer
Dim arImg() As TRANSFILE
Dim nImgs As Integer
Dim strEnc As String
Dim strIgnored As String
Dim bSizeOK As Boolean
Dim bImgOK As Boolean
Dim bEncOK As Boolean
Dim bDone As Boolean
Dim strServerAttachs As String 'list using "," as separator
Dim strMsg As String
Dim nIdx As Integer
'init and security checking
On Error Resume Next 'avoid err #91 if lstRemote is empty
If lstRemote.SelectedItem.Selected = False Then
MsgBox arMsg(71) & " !", vbExclamation
Exit Sub
End If
On Error GoTo 0
strKey = lstRemote.SelectedItem.Key
strDisplayName = lstRemote.SelectedItem.Text
strFilename = FtpCli.RemoteFiles(strKey).FileName
strArt = FtpCli.RemoteDir & "/" & strFilename
strWorkspace = GetWorkspace() & "\"
If Dir(strWorkspace & strFilename) <> "" Then
MsgBox arMsg(79) & " ! ", vbInformation
Exit Sub
End If
Screen.MousePointer = vbHourglass
'attempts to avoid real download using local zipped archive
strIdArchiv = BuildIdArchive(strFilename)
bRet = SetGetArchive(strDisplayName, strIdArchiv, False, nOrgAddedNameLen, strServerAttachs)
If bRet = True Then
'checks if zipped article coming from archive is the same one as the one requested for download
'IMPORTANT : take cares to do that the tests itselves don't need any download !
'test if size of the article in format as ready-to-be-published = size of article currenly on blog
'NB : calculation of nPreparedArtSize takes the prepared size coming from archive without consideration
' of any eventual modifications in image names, then we add the true value of these modifications
' as it was observed during real publication. Finally, a size adjustement is done deducting the
' characters which has been eliminated during transfer because of OS difference ; Win (CRLF) -> *nix (LF)
'***LATER : extends the test to article's CRC/MD5 computation compared to CRC/MD5 info stored in meta.cache
strTempFile = GetTmpFile("FB")
FileCopy strWorkspace & strDisplayName, strTempFile
arImg = PrepArtForPublishing(strTempFile, nCurrPreparedArtSize, nCurrAddedNameLen, strIgnored, True)
Kill strTempFile
nPreparedArtSize = (nCurrPreparedArtSize - nCurrAddedNameLen) + nOrgAddedNameLen _
- CountOccurr(LoadText(strWorkspace & strDisplayName), vbNewLine)
If arImg(1).local = "failed" Or nPreparedArtSize <> FtpCli.RemoteFiles(strKey).FileSize Then
bSizeOK = False
Else
bSizeOK = True
End If
'tests if attached elements (ie. images, but could be expanded to others types) are identical
If arImg(1).local <> "" Then
nImgs = UBound(arImg)
Else
nImgs = 0
End If
If nImgs = Int(MetaCache(strArt, "Joint", "GET")) Then
bImgOK = True
Else
bImgOK = False
End If
'tests the encoding
If IsUTF8(LoadText(strWorkspace & strDisplayName)) = True Then
strEnc = "UTF-8"
Else
strEnc = "ANSI"
End If
If strEnc = UCase(MetaCache(strArt, "Encode", "GET")) Then
bEncOK = True
Else
bEncOK = False
End If
'results
If bSizeOK = True And bImgOK = True And bEncOK = True Then
bDone = True
Else
'deletes the article coming from archive, temporary stored in local workspace
'NB : the article coming from archive is not the right one => we deletes the extracted one in workspace,
' and its eventual attached images, before to proceed with a real download of the remote article !
'WARNING : takes care to not delete a file which would exist in workspace before archive extraction ;
' maybe that SetGetArchive should return arExtracted() in case of 'get'
'***LATER : deletes the eventual extracted images too
')
Kill strWorkspace & strDisplayName
bDone = False
End If
End If
'goes with real download (since alternative fast-way above failed)
'***TODO : This part has to be implemented ! We could creates a funtion which would combine download and upload
' operation, reusing code coming from cmdUploadArt_Click() ; this fct could be prototyped DownUpLoad(bOp)
If bDone = False Then
MsgBoxEx arMsg(80) & vbNewLine & arMsg(81) & vbNewLine & arMsg(82) & " !", vbInformation
Exit Sub
End If
'deletes the remote article and its eventual attached images if user asked for "move"
If index = 1 Then
Dim arNotDeleted() As String
bRet = DelCurrRemoteArt(arNotDeleted, strWorkspace & strDisplayName, strServerAttachs)
If bRet = False Then
If arNotDeleted(1) = "failed" Then
strMsg = arMsg(19) & " '" & strDisplayName & "'" & vbNewLine & arMsg(20) & " !"
Else
If arNotDeleted(1) = strFilename Then
strMsg = arMsg(21) & " '" & strDisplayName & "'" & vbNewLine & arMsg(20) & " !"
Else
strMsg = arMsg(22) & " '" & strDisplayName & "' " & arMsg(23) & "," & vbNewLine & _
arMsg(24) & " :"
For nIdx = LBound(arNotDeleted) To UBound(arNotDeleted)
strMsg = strMsg & vbNewLine & "- '" & arNotDeleted(nIdx) & "'"
Next
strMsg = strMsg & vbNewLine & vbNewLine & arMsg(25) & vbNewLine & _
arMsg(26) & " '" & arMsg(27) & "'"
End If
End If
MsgBox strMsg, vbExclamation
End If
PopulateRemoteList
End If
PopulateClearLocalList True
Screen.MousePointer = vbDefault
End Sub
Private Sub cmdEditLocalArt_Click()
'Loads the selected local article in the editor
Dim strKey As String
If lstLocal.ListItems.Count = 0 Then Exit Sub
If lstLocal.SelectedItem.Selected = False Then
MsgBox arMsg(71) & " !", vbExclamation
Exit Sub
End If
strKey = lstLocal.SelectedItem.Key
strCurrArt = GetWorkspace() & "\" & strKey
If Dir(strCurrArt) = "" Then
MsgBox arMsg(72) & " !", vbExclamation
PopulateClearLocalList True
strCurrArt = ""
Exit Sub
End If
If Dir(App.Path & "\" & EDITOR_DIR & "\" & EDITOR_TEMPLATE) = "" Then
'***LATER : extend the tests to others crucial files in the TinyMCE tree
MsgBox arMsg(83) & " !", vbExclamation
PopulateClearLocalList True
strCurrArt = ""
Exit Sub
End If
frmEdit.DoShow Me
End Sub
Private Sub cmdMkLocalArt_Click()
'Displays the editor for writing a new article
Dim strTitle As String
Dim strMsg As String
Dim strDefault As String
Dim strArt As String
Dim bOK As Boolean
Dim bRet As Boolean
'user input
strTitle = arMsg(28)
strMsg = arMsg(29) & "." & vbNewLine _
& vbNewLine _
& arMsg(7) & " : " & vbNewLine _
& "- " & arMsg(8) & " /*\<>|?" & Chr(34) & ":" & vbNewLine _
& "- " & arMsg(9) & vbNewLine _
& "- " & arMsg(10) & vbNewLine _
& "- " & arMsg(11) & vbNewLine _
& "- " & arMsg(12) & vbNewLine _
& "- " & arMsg(13) & " '" & structProj.art_ext & "' " & arMsg(14) & vbNewLine _
& vbNewLine & arMsg(15) & structProj.art_ext & "'"