| Line-No. / Ref. | Code Line |
| 0001 | Public Sub Fix_Time_Recording_Narrative() |
| 0002 | Dim strQuery As String |
| 0003 | Dim rs As Recordset |
| 0004 | Dim strAbstract As String |
| 0005 | Dim i As Long |
| 0006 | Dim j As Long |
| 0007 | strQuery = "SELECT Papers.ID, Papers.Author, Papers.Title, Papers.Abstract, Papers.Abstract_Quality, Papers.Write_Up_Note_ID FROM Papers WHERE (((Papers.Abstract) Like ""*This pseudo-Paper is intended as the mechanism to record time spent on the Note *"")) ORDER BY Papers.Author, Papers.Title;" |
| 0008 | Set rs = CurrentDb.OpenRecordset(strQuery) |
| 0009 | rs.MoveFirst |
| 0010 | Do Until rs.EOF |
| 0011 | strAbstract = rs.Fields(3) |
| 0012 | Debug.Print Now() & " - "; strAbstract |
| 0013 | 'Fix the abstract |
| 0014 | i = InStr(strAbstract, "'") |
| 0015 | If i > 0 Then |
| 0016 | strAbstract = Left(strAbstract, i) & "[" & Mid(strAbstract, i + 1) |
| 0017 | j = InStr(i + 1, strAbstract, "'") |
| 0018 | 'Check if already fixed! |
| 0019 | If j > 0 Then |
| 0020 | If InStr(Mid(strAbstract, i, j - i), "++") = 0 Then |
| 0021 | strAbstract = Left(strAbstract, j - 1) & "]++" & rs.Fields(5) & "++" & Mid(strAbstract, j) 'Add the note link |
| 0022 | 'Remove the old link, if necessary |
| 0023 | i = InStr(j, strAbstract, "|.|+N") |
| 0024 | If i > 0 Then |
| 0025 | j = InStr(i + 3, strAbstract, "|.|") |
| 0026 | If j > 0 Then |
| 0027 | strAbstract = Left(strAbstract, i - 1) & Mid(strAbstract, j) |
| 0028 | Else |
| 0029 | Stop |
| 0030 | End If |
| 0031 | End If |
| 0032 | Debug.Print Now() & " - "; strAbstract |
| 0033 | rs.Edit |
| 0034 | rs.Fields(3) = strAbstract |
| 0035 | rs.Update |
| 0036 | End If |
| 0037 | End If |
| 0038 | End If |
| 0039 | rs.MoveNext |
| 0040 | Loop |
| 0041 | Set rs = Nothing |
| 0042 | End Sub |
| Line-No. / Ref. | Code Line |
| 0001 | Public Function Functor_11(strQuery, strNote_Text) |
| 0002 | 'Development Log report - Last Quarter Completed Items - Category Sequence |
| 0003 | Dim rs As Recordset |
| 0004 | Dim strNote_Text_Local |
| 0005 | Dim Implementation_Period As String |
| 0006 | Dim Category As String |
| 0007 | Dim Development As String |
| 0008 | Dim Category_Saved As String |
| 0009 | Dim strCategory_Text As String |
| 0010 | strNote_Text_Local = "" |
| 0011 | Category_Saved = "ZZZZZ" |
| 0012 | strCategory_Text = "" |
| 0013 | Set rs = CurrentDb.OpenRecordset(strQuery) |
| 0014 | If Not rs.EOF Then |
| 0015 | rs.MoveFirst |
| 0016 | Functor_11 = "Yes" |
| 0017 | Else |
| 0018 | Functor_11 = "Yes" |
| 0019 | strNote_Text = "|..||.|Nothing to Report.|..|" |
| 0020 | Exit Function |
| 0021 | End If |
| 0022 | Do Until rs.EOF |
| 0023 | Category = rs.Fields(0) & "" |
| 0024 | Implementation_Period = rs.Fields(1) |
| 0025 | Development = rs.Fields(2) & "" |
| 0026 | If Category <> Category_Saved Then |
| 0027 | If Category_Saved <> "ZZZZZ" Then |
| 0028 | 'Finalise Previous Priority |
| 0029 | strCategory_Text = "|ii|" & strCategory_Text & "|ii|" |
| 0030 | strCategory_Text = "|.|" & Category_Saved & "" & strCategory_Text |
| 0031 | End If |
| 0032 | 'Ready for next Period |
| 0033 | strNote_Text_Local = strNote_Text_Local & strCategory_Text |
| 0034 | strCategory_Text = "" |
| 0035 | End If |
| 0036 | strCategory_Text = strCategory_Text & "|1|" & Development |
| 0037 | 'Move on ... |
| 0038 | Category_Saved = Category |
| 0039 | rs.MoveNext |
| 0040 | Loop |
| 0041 | 'Finish the list ... |
| 0042 | strCategory_Text = "|ii|" & strCategory_Text & "|ii|" |
| 0043 | strCategory_Text = "|.|" & Category_Saved & "" & strCategory_Text |
| 0044 | strNote_Text_Local = strNote_Text_Local & strCategory_Text |
| 0045 | 'Top and Tail |
| 0046 | strNote_Text_Local = "|..|" & strNote_Text_Local & "|..|" |
| 0047 | 'Tidy up |
| 0048 | Set rs = Nothing |
| 0049 | strNote_Text = strNote_Text_Local |
| 0050 | End Function |
| Line-No. / Ref. | Code Line |
| 0001 | Public Function Functor_13(Note_ID, Note_Title, Note_Text) |
| 0002 | 'Use Form_Documentation_Links to list Buttons referenced in Documenter |
| 0003 | Dim rs As Recordset |
| 0004 | Dim strQuery As String |
| 0005 | Dim Note_Text_Local As String |
| 0006 | Dim Section_Name As String |
| 0007 | Dim Section_Name_Saved As String |
| 0008 | Dim Control_Caption As String |
| 0009 | Dim Control_Name As String |
| 0010 | Dim Sections As Boolean |
| 0011 | strQuery = "SELECT Form_Documentation_Links.Section FROM Form_Documentation_Links INNER JOIN Form_Controls_Table ON (Form_Documentation_Links.Form_Name = Form_Controls_Table.Form_Name) AND (Form_Documentation_Links.Control_Name = Form_Controls_Table.Control_Name) GROUP BY Form_Documentation_Links.Section, Form_Documentation_Links.Note HAVING (((Form_Documentation_Links.Note) = " & Note_ID & ")) ORDER BY Form_Documentation_Links.Section;" |
| 0012 | Set rs = CurrentDb.OpenRecordset(strQuery) |
| 0013 | Sections = False |
| 0014 | DoEvents |
| 0015 | If Not rs.EOF Then |
| 0016 | rs.MoveLast |
| 0017 | If rs.RecordCount > 1 Then |
| 0018 | Sections = True |
| 0019 | End If |
| 0020 | End If |
| 0021 | DoEvents |
| 0022 | Set rs = Nothing |
| 0023 | strQuery = "SELECT Form_Documentation_Links.Section, Form_Controls_Table.Control_Caption, Form_Documentation_Links.Control_Name FROM Form_Documentation_Links INNER JOIN Form_Controls_Table ON (Form_Documentation_Links.Form_Name = Form_Controls_Table.Form_Name) AND (Form_Documentation_Links.Control_Name = Form_Controls_Table.Control_Name) WHERE (((Form_Documentation_Links.Note) = " & Note_ID & ")) ORDER BY Form_Documentation_Links.Section, Form_Controls_Table.Control_Caption;" |
| 0024 | Set rs = CurrentDb.OpenRecordset(strQuery) |
| 0025 | If Not rs.EOF Then |
| 0026 | rs.MoveFirst |
| 0027 | Else |
| 0028 | Functor_13 = "No" |
| 0029 | Exit Function |
| 0030 | End If |
| 0031 | If Sections = True Then |
| 0032 | Note_Text_Local = "|..|" |
| 0033 | Else |
| 0034 | Note_Text_Local = "|99|" |
| 0035 | End If |
| 0036 | Section_Name_Saved = "xxx" |
| 0037 | Do While Not rs.EOF |
| 0038 | Section_Name = rs.Fields(0) & "" |
| 0039 | Control_Caption = rs.Fields(1) |
| 0040 | Control_Name = rs.Fields(2) |
| 0041 | If Sections = True Then |
| 0042 | If Section_Name <> Section_Name_Saved Then |
| 0043 | If Section_Name_Saved <> "xxx" Then |
| 0044 | Note_Text_Local = Note_Text_Local & "|99|" |
| 0045 | End If |
| 0046 | Note_Text_Local = Note_Text_Local & "|.|" & Section_Name & "|99|" |
| 0047 | Section_Name_Saved = Section_Name |
| 0048 | End If |
| 0049 | End If |
| 0050 | Note_Text_Local = Note_Text_Local & "|1|" & Control_Caption & " (+C" & Control_Name & "_ClickC+)" |
| 0051 | rs.MoveNext |
| 0052 | Loop |
| 0053 | 'Finish Off |
| 0054 | Note_Text_Local = Note_Text_Local & "|99|" |
| 0055 | If Sections = True Then |
| 0056 | Note_Text_Local = Note_Text_Local & "|..|" |
| 0057 | End If |
| 0058 | Set rs = Nothing |
| 0059 | Note_Text = Note_Text_Local |
| 0060 | Functor_13 = "Yes" |
| 0061 | End Function |
| Line-No. / Ref. | Code Line |
| 0001 | Public Sub Website_Tidy() |
| 0002 | Dim rst As Recordset |
| 0003 | Dim rsLinks As Recordset |
| 0004 | Dim rsLog As Recordset |
| 0005 | Dim db As Database |
| 0006 | Dim Directory As String |
| 0007 | Dim DatabaseName_Temp As String |
| 0008 | Dim Directory_Type As String |
| 0009 | Dim File_Name As String |
| 0010 | Dim iFileType As Integer |
| 0011 | Dim iCount As Integer |
| 0012 | Dim iDeletion_Count As Integer |
| 0013 | Dim iAction_Count As Integer |
| 0014 | Dim Last_Regen_Date As Date |
| 0015 | Dim File_Last_Amended_Date As Date |
| 0016 | Dim fso As New FileSystemObject |
| 0017 | Dim f As File |
| 0018 | Dim strQuery As String |
| 0019 | Dim NoLinks As String |
| 0020 | Dim Run_Timestamp As Date |
| 0021 | Dim strAction As String |
| 0022 | Dim iCountMax As Integer |
| 0023 | Dim ConfirmDeletions As Boolean |
| 0024 | Dim OKToDelete As Boolean |
| 0025 | If MsgBox("Delete unwanted files from Website?", vbYesNo) <> vbYes Then |
| 0026 | Exit Sub |
| 0027 | End If |
| 0028 | If MsgBox("Confirm Deletions?", vbYesNo) <> vbYes Then |
| 0029 | ConfirmDeletions = False |
| 0030 | Else |
| 0031 | ConfirmDeletions = True |
| 0032 | End If |
| 0033 | Set db = CurrentDb |
| 0034 | iDeletion_Count = 0 |
| 0035 | iAction_Count = 0 |
| 0036 | iCount = 0 |
| 0037 | Run_Timestamp = Now() |
| 0038 | iCountMax = 5 |
| 0039 | strQuery = "Select * FROM Website_Tidy_Log WHERE Run_Timestamp > Now();" |
| 0040 | Set rsLog = db.OpenRecordset(strQuery) |
| 0041 | Set rst = db.OpenRecordset("SELECT Site_Map.Full_File_Name, Site_Map.Directory, Site_Map.FIle_Name, Site_Map.File_Timestamp, Site_Map.Size, Site_Map.Timestamp_Logged FROM Site_Map WHERE (((Site_Map.File_Timestamp) < Now() - 20) And ((Right([File_Name], 4)) = "".htm"")) ORDER BY Site_Map.Directory, Site_Map.FIle_Name;") |
| 0042 | If rst.EOF Then |
| 0043 | MsgBox ("Nothing to do") |
| 0044 | End |
| 0045 | End If |
| 0046 | rst.MoveFirst |
| 0047 | 'Find the Date ... |
| 0048 | Set rsLinks = db.OpenRecordset("SELECT * FROM Website_Regen_Latest;") 'Temporary use of wrong rs name! |
| 0049 | rsLinks.MoveFirst |
| 0050 | Last_Regen_Date = rsLinks.Fields(0) - 1 'Err on the side of safety |
| 0051 | Do While Not rst.EOF |
| 0052 | DatabaseName_Temp = rst.Fields(0) |
| 0053 | Directory = rst.Fields(1) & "" |
| 0054 | File_Name = rst.Fields(2) |
| 0055 | iFileType = 0 |
| 0056 | Directory_Type = "" |
| 0057 | If Directory = Directory_Type Then |
| 0058 | iFileType = 1 |
| 0059 | End If |
| 0060 | Directory_Type = "Acts\" |
| 0061 | If Left(Directory, Len(Directory_Type)) = Directory_Type Then |
| 0062 | iFileType = 2 |
| 0063 | End If |
| 0064 | Directory_Type = "Bridge\" |
| 0065 | If Left(Directory, Len(Directory_Type)) = Directory_Type Then |
| 0066 | iFileType = 3 |
| 0067 | End If |
| 0068 | Directory_Type = "Documentation\" |
| 0069 | If Left(Directory, Len(Directory_Type)) = Directory_Type Then |
| 0070 | iFileType = 4 |
| 0071 | End If |
| 0072 | Directory_Type = "EnigmaEnsemble\" |
| 0073 | If Left(Directory, Len(Directory_Type)) = Directory_Type Then |
| 0074 | iFileType = 5 |
| 0075 | End If |
| 0076 | Directory_Type = "Petes_PhD" |
| 0077 | If Left(Directory, Len(Directory_Type)) = Directory_Type Then |
| 0078 | iFileType = 6 |
| 0079 | End If |
| 0080 | Directory_Type = "Photos\" |
| 0081 | If Left(Directory, Len(Directory_Type)) = Directory_Type Then |
| 0082 | iFileType = 7 |
| 0083 | End If |
| 0084 | Directory_Type = "Sophie_Test\" |
| 0085 | If Left(Directory, Len(Directory_Type)) = Directory_Type Then |
| 0086 | iFileType = 8 |
| 0087 | End If |
| 0088 | 'Exclude Notes_nnn_links |
| 0089 | Directory_Type = "Notes\" |
| 0090 | If Left(Directory, Len(Directory_Type)) = Directory_Type Then |
| 0091 | If Left(File_Name, Len("Notes_")) = "Notes_" And Right(File_Name, Len("_Links.htm")) = "_Links.htm" Then |
| 0092 | iFileType = 9 |
| 0093 | End If |
| 0094 | End If |
| 0095 | If iFileType = 1 Then |
| 0096 | 'Exclude various categories ... |
| 0097 | If File_Name = "amendmenthistory.htm" Or File_Name = "Artwork.htm" Or File_Name = "BirkbeckPhilSoc.htm" Or File_Name = "Bridge.htm" Or File_Name = "ECBA_Search.htm" Or File_Name = "Electronic_Resources.htm" Or File_Name = "Family.htm" Or File_Name = "index.htm" Or File_Name = ".htm" Then |
| 0098 | iFileType = 9 |
| 0099 | Else |
| 0100 | If File_Name = "Bridge_Resume.htm" Or File_Name = "Bridge_Stats_Theo.htm" Or File_Name = "Christians.htm" Or File_Name = "Library_Detail.htm" Or File_Name = ".htm" Or File_Name = "Library_Summary.htm" Or File_Name = "TermPlan08Spring.htm" Or File_Name = "Tetrahedron.htm" Or File_Name = "TT_Search.htm" Or File_Name = "Bridge_Results_Ranking_Bernie_Fri.htm" Then |
| 0101 | iFileType = 9 |
| 0102 | End If |
| 0103 | End If |
| 0104 | If Left(File_Name, Len("Bridge_Results_Theo")) = "Bridge_Results_Theo" Then |
| 0105 | iFileType = 9 |
| 0106 | End If |
| 0107 | If Left(File_Name, Len("c8")) = "c8" Then |
| 0108 | iFileType = 9 |
| 0109 | End If |
| 0110 | If Left(File_Name, Len("c9")) = "c9" Then |
| 0111 | iFileType = 9 |
| 0112 | End If |
| 0113 | If Left(File_Name, Len("c10")) = "c10" Then |
| 0114 | iFileType = 9 |
| 0115 | End If |
| 0116 | If Left(File_Name, Len("commensal")) = "commensal" Then |
| 0117 | iFileType = 9 |
| 0118 | End If |
| 0119 | If Left(File_Name, Len("Dud_")) = "Dud_" Then |
| 0120 | iFileType = 9 |
| 0121 | End If |
| 0122 | If Left(File_Name, Len("obt")) = "obt" Then |
| 0123 | iFileType = 9 |
| 0124 | End If |
| 0125 | If Left(File_Name, Len("oh")) = "oh" Then |
| 0126 | iFileType = 9 |
| 0127 | End If |
| 0128 | If Left(File_Name, Len("pdg")) = "pdg" Then |
| 0129 | iFileType = 9 |
| 0130 | End If |
| 0131 | If Left(File_Name, Len("phil")) = "phil" Then |
| 0132 | iFileType = 9 |
| 0133 | End If |
| 0134 | If Left(File_Name, Len("SiteMap")) = "SiteMap" Then |
| 0135 | iFileType = 9 |
| 0136 | End If |
| 0137 | If Left(File_Name, Len("totl")) = "totl" Then |
| 0138 | iFileType = 9 |
| 0139 | End If |
| 0140 | If Left(File_Name, Len("tract")) = "tract" Then |
| 0141 | iFileType = 9 |
| 0142 | End If |
| 0143 | If Left(File_Name, Len("vb")) = "vb" Then |
| 0144 | iFileType = 9 |
| 0145 | End If |
| 0146 | If Left(File_Name, Len("web")) = "web" Then |
| 0147 | iFileType = 9 |
| 0148 | End If |
| 0149 | End If |
| 0150 | If iFileType < 2 Then |
| 0151 | If Dir(DatabaseName_Temp) <> "" Then |
| 0152 | Set f = fso.GetFile(DatabaseName_Temp) |
| 0153 | File_Last_Amended_Date = f.DateLastModified |
| 0154 | If File_Last_Amended_Date < Last_Regen_Date Then |
| 0155 | strQuery = "SELECT Raw_Links.Raw_Link, Raw_Links.Timestamp_Logged, Raw_Links.Link_Type FROM Raw_Links WHERE (((Raw_Links.Raw_Link) = """ & File_Name & """) And ((Raw_Links.Link_Type) <> ""Same Page"")) ORDER BY Raw_Links.Timestamp_Logged DESC;" |
| 0156 | Set rsLinks = db.OpenRecordset(strQuery) |
| 0157 | If rsLinks.EOF Then |
| 0158 | NoLinks = "No Links" |
| 0159 | Else |
| 0160 | NoLinks = "Links Exist" |
| 0161 | rsLinks.MoveFirst |
| 0162 | If rsLinks.Fields(1) < Last_Regen_Date Then |
| 0163 | NoLinks = NoLinks & " (Old Links Only)" |
| 0164 | Else |
| 0165 | NoLinks = NoLinks & " (Contains a Recent Link)" |
| 0166 | End If |
| 0167 | End If |
| 0168 | If ConfirmDeletions = True Then |
| 0169 | If MsgBox("Delete " & File_Name & " (" & File_Last_Amended_Date & "). " & NoLinks & Chr(10) & "Full path: " & DatabaseName_Temp, vbYesNo + vbDefaultButton1) = vbYes Then |
| 0170 | OKToDelete = True |
| 0171 | Else |
| 0172 | OKToDelete = False |
| 0173 | End If |
| 0174 | Else |
| 0175 | OKToDelete = True |
| 0176 | iCountMax = 100 |
| 0177 | End If |
| 0178 | If OKToDelete = True Then |
| 0179 | iDeletion_Count = iDeletion_Count + 1 |
| 0180 | Debug.Print Now() & " - " & iAction_Count & " - " & DatabaseName_Temp & ". " & NoLinks |
| 0181 | If Dir(DatabaseName_Temp) <> "" Then |
| 0182 | Kill DatabaseName_Temp |
| 0183 | Debug.Print Now() & " - " & iAction_Count & " - " & DatabaseName_Temp & ". Deleted!" |
| 0184 | strAction = "File Deleted" |
| 0185 | Else |
| 0186 | Debug.Print Now() & " - " & iAction_Count & " - " & DatabaseName_Temp & ". Item already deleted!" |
| 0187 | strAction = "File Not Found" |
| 0188 | Stop |
| 0189 | End If |
| 0190 | Else |
| 0191 | strAction = "Not Deleted" |
| 0192 | End If |
| 0193 | iAction_Count = iAction_Count + 1 |
| 0194 | rsLog.AddNew |
| 0195 | rsLog.Fields(0) = Run_Timestamp |
| 0196 | rsLog.Fields(1) = iAction_Count |
| 0197 | rsLog.Fields(2) = File_Name |
| 0198 | rsLog.Fields(3) = DatabaseName_Temp |
| 0199 | rsLog.Fields(4) = File_Last_Amended_Date |
| 0200 | rsLog.Fields(5) = NoLinks |
| 0201 | rsLog.Fields(6) = strAction |
| 0202 | rsLog.Fields(7) = Now() |
| 0203 | rsLog.Update |
| 0204 | 'Delete associated raw links from this file |
| 0205 | OK = Prune_Raw_Links(Replace(DatabaseName_Temp, File_Name, ""), File_Name) |
| 0206 | iCount = iCount + 1 |
| 0207 | If iCount > iCountMax Then |
| 0208 | If MsgBox("Stop Run?", vbYesNo + vbDefaultButton2) = vbYes Then |
| 0209 | MsgBox (Now() & " - Run stopped: " & iDeletion_Count & " unwanted files deleted from Website") |
| 0210 | DoCmd.OpenTable ("Website_Tidy_Log") |
| 0211 | End |
| 0212 | End If |
| 0213 | iCount = 0 |
| 0214 | End If |
| 0215 | End If |
| 0216 | End If |
| 0217 | End If |
| 0218 | rst.MoveNext |
| 0219 | Loop |
| 0220 | Set rsLog = Nothing |
| 0221 | Set rst = Nothing |
| 0222 | Set rsLinks = Nothing |
| 0223 | Set fso = Nothing |
| 0224 | DoCmd.OpenTable ("Website_Tidy_Log") |
| 0225 | MsgBox (Now() & " - " & iDeletion_Count & " unwanted files deleted from Website") |
| 0226 | End Sub |