Subversion Repositories DevTools

Rev

Rev 1408 | Rev 1442 | Go to most recent revision | Show entire file | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed

Rev 1408 Rev 1416
Line 1077... Line 1077...
1077
 
1077
 
1078
End Function
1078
End Function
1079
 
1079
 
1080
 
1080
 
1081
Function WalkWiki(isTeksten)
1081
Function WalkWiki(isTeksten)
1082
    Dim wikiNames
-
 
1083
    Dim thisHit
-
 
1084
    Dim nHits
-
 
1085
    Dim rsPages
-
 
1086
    Dim myText
1082
    Dim myText
1087
 
-
 
1088
    myText = isTeksten
1083
    myText = isTeksten
1089
 
-
 
1090
    'Bjarne
-
 
1091
    'myText = Replace(myText, "ä", "")
-
 
1092
    'myText = Replace(myText, "ö", "")
-
 
1093
    'myText = Replace(myText, "ü", "")
-
 
1094
    'myText = Replace(myText, "æ", "")
-
 
1095
    'myText = Replace(myText, "ø", "")
-
 
1096
    'myText = Replace(myText, "å", "")
-
 
1097
    'myText = Replace(myText, "Ä", "")
-
 
1098
    'myText = Replace(myText, "Ö", "")
-
 
1099
    'myText = Replace(myText, "Ü", "")
-
 
1100
    'myText = Replace(myText, "Æ", "")
-
 
1101
    'myText = Replace(myText, "Ø", "")
-
 
1102
    'myText = Replace(myText, "Å", "")
-
 
1103
 
-
 
1104
 
-
 
1105
 
-
 
1106
    'find wikiNames:
-
 
1107
    'gRE.Pattern = "([A-Z][a-z]+)([A-Z][a-z]+)+"
-
 
1108
    'Bjarne
-
 
1109
    gRE.Pattern = "([A-Z][a-z0-9]+)([A-Z][a-z0-9]+)+"
-
 
1110
    Set wikiNames = gRE.Execute(myText)
-
 
1111
    nHits = wikiNames.Count
-
 
1112
 
-
 
1113
    'find the duplicates:  (dinoch 07 Nov 00)
-
 
1114
    Dim i, j
-
 
1115
    Dim isDuplicate()
-
 
1116
    ReDim isDuplicate(nHits)
-
 
1117
    isDuplicate(0)= 0
-
 
1118
    For i = 0 To nHits-2
-
 
1119
    For j = i+1 To nHits-1
-
 
1120
      isDuplicate(j)=0
-
 
1121
      If (wikiNames.Item(i) = wikiNames.Item(j)) Then
-
 
1122
          isDuplicate(j)=1
-
 
1123
          Exit For
-
 
1124
      End If
-
 
1125
    Next
-
 
1126
    Next
-
 
1127
 
-
 
1128
    For j = 0 To nHits-1
-
 
1129
    If (isDuplicate(j) = 0) Then
-
 
1130
        'only process the name if it is not a duplicate
-
 
1131
        thisHit = wikiNames.Item(j)  '
-
 
1132
        EmitDebug 12, 2, "WalkWiki:thisHit(" & thisHit & ")<br/>"
-
 
1133
        ' insert hyperlinks as appropriate
-
 
1134
        ' - added & and = to exclude certain URLs (2002/4/12 greinerk@yahoo.com)
-
 
1135
        ' - added umlauts (MARKUS)
-
 
1136
    'gRE.Pattern = "([^=>?&A-Za-z0-9\/])(" & thisHit & ")([^=A-Za-z])"
-
 
1137
    'Bjarne
-
 
1138
    gRE.Pattern = "([^=>?&A-Za-z0-9\/])(" & thisHit & ")([^=A-Za-z])"
-
 
1139
 
-
 
1140
        EmitDebug 12.1, 2, "WalkWiki:thisHit regexp=" & gRE.Pattern  & "<br/>"
-
 
1141
 
-
 
1142
        sqlQuery = "select Title from " & gDbTableName & " where title='" & thisHit & "'"
-
 
1143
        EmitDebug 13, 2, "sqlquery: " & sqlquery & "<br/>"
-
 
1144
        
-
 
1145
        'Set rsPages = gDataConn.Execute(sqlQuery)
-
 
1146
        set rsPages = WrappedQueryExecute( gDataConn, sqlQuery )  ' ERV 3/2007        
-
 
1147
 
-
 
1148
        'EmitDebug 14, 2, "rs.recordcount: " & rsPages.recordcount & "<br/>"
-
 
1149
        EmitDebug 15, 2, "eof/bof: " & rsPages.eof & "/" & rsPages.bof & "<br/>"
-
 
1150
 
-
 
1151
        If rsPages.eof = False Then
-
 
1152
        ' found, make a link
-
 
1153
        EmitDebug 16, 2, "walkwiki: topic found<br/>"
-
 
1154
        'myText = gRE.Replace(myText, "$1<a href=""" & gScript & "?$2"">$2</a>$3")
-
 
1155
        'myText = gRE.Replace(myText, "$1<a href=""" & gScriptURL & "&o=$2"">$2</a>$3")
-
 
1156
        'Bjarne
-
 
1157
        If gSpaceNames = 1 Then
-
 
1158
           myText = gRE.Replace(myText, "$1<a href=""" & gScriptURL & "&o=$2"">" & SpaceName(thisHit) & "</a>$3")
-
 
1159
        Else
-
 
1160
           myText = gRE.Replace(myText, "$1<a href=""" & gScriptURL & "&o=$2"">$2</a>$3")
-
 
1161
        End If
-
 
1162
        Else
-
 
1163
        ' not found, make a ? link
-
 
1164
        EmitDebug 17, 2, "walkwiki: topic not found<br/>"
-
 
1165
        'myText = gRE.Replace(myText, "$1<span>$2</span><a href=""" & gScript & "?a=edit&o=$2"">?</a>$3")
-
 
1166
        'myText = gRE.Replace(myText, "$1<span>" & left(thisHit, len(thisHit)-1) & "</span><a href=""" & gScriptURL & "&a=edit&o=$2"">" & right(thisHit,1) & "</a>$3")
-
 
1167
        'Bjarne
-
 
1168
        'If gSpaceNames = 1 Then
-
 
1169
        '   myText = gRE.Replace(myText, "$1<span>" & left(SpaceName(thisHit), len(SpaceName(thisHit))-1) & "</span><a href=""" & gScriptURL & "&a=edit&o=$2"">" & right(thisHit,1) & "</a>$3")
-
 
1170
        'Else
-
 
1171
           'myText = gRE.Replace(myText, "$1<span>" & left(thisHit, len(thisHit)-1) & "</span><a title='Click to create this page' href=""" & gScriptURL & "&a=edit&o=$2"">" & right(thisHit,1) & "</a>$3")
-
 
1172
        myText = gRE.Replace(myText, "$1<a title='Click to create this page' class='NoWikiYet' href=""" & gScriptURL & "&a=edit&o=$2"">" & thisHit & "</a>$3")
-
 
1173
        'End If
-
 
1174
        End If
-
 
1175
 
-
 
1176
        EmitDebug 18, 3, "WalkWiki:myText(" & myText & ")<br/>"
-
 
1177
 
-
 
1178
    End If
-
 
1179
 
-
 
1180
    Next
-
 
1181
 
-
 
1182
    'WalkWiki = WalkWiki2(myText)
1084
    WalkWiki = myText
1183
 
-
 
1184
    WalkWiki = myText   ' WalkWiki2 removed by Elrey 3/2006
-
 
1185
 
1085
 
1186
End Function
1086
End Function
1187
 
1087
 
1188
 
-
 
1189
'ElreyRonald - added to support [[wikiword]] - see above
-
 
1190
Function WalkWiki2_old(isTeksten)
-
 
1191
    Dim wikiNames
-
 
1192
    Dim thisHit
-
 
1193
    Dim nHits
-
 
1194
    Dim rsPages
-
 
1195
    Dim myText
-
 
1196
 
-
 
1197
    myText = isTeksten
-
 
1198
 
-
 
1199
    gRE.Pattern = "(\[\[[A-Za-z0-9\_\s]+\]\])+"
-
 
1200
 
-
 
1201
    Set wikiNames = gRE.Execute(myText)
-
 
1202
    nHits = wikiNames.Count
-
 
1203
 
-
 
1204
    Dim i, j
-
 
1205
    Dim isDuplicate()
-
 
1206
    ReDim isDuplicate(nHits)
-
 
1207
    isDuplicate(0)= 0
-
 
1208
    For i = 0 To nHits-2
-
 
1209
      For j = i+1 To nHits-1
-
 
1210
        isDuplicate(j)=0
-
 
1211
        If (wikiNames.Item(i) = wikiNames.Item(j)) Then
-
 
1212
          isDuplicate(j)=1
-
 
1213
          Exit For
-
 
1214
        End If
-
 
1215
 
-
 
1216
      Next
-
 
1217
    Next
-
 
1218
 
-
 
1219
    For j = 0 To nHits-1
-
 
1220
      If (isDuplicate(j) = 0 ) Then
-
 
1221
        'only process the name if it is not a duplicate
-
 
1222
        thisHit = RemoveBrackets(wikiNames.Item(j))
-
 
1223
 
-
 
1224
        gRE.Pattern = "([^=>?&A-Za-z0-9\/\[])(\[\[)(" & thisHit & ")(\]\])([^=A-Za-z0-9\]])"
-
 
1225
        sqlQuery = "select Title from " & gDbTableName & " where title='" & RemoveSpaces(thisHit) & "'"
-
 
1226
        Set rsPages = gDataConn.Execute(sqlQuery)
-
 
1227
        If rsPages.eof = False Then
-
 
1228
           myText = gRE.Replace(myText, "$1<a href=""" & gScriptURL & "&o=$3"">$3</a>$5")
-
 
1229
        Else
-
 
1230
           myText = gRE.Replace(myText, "$1" & left(thisHit, len(thisHit)-1) & _
-
 
1231
            "<a href=""" & gScriptURL & "&a=edit&o=$3"">" & right(thisHit,1) & "</a>$5")
-
 
1232
        End If
-
 
1233
 
-
 
1234
        myText = replace( myText, "&o=" & thisHit , "&o=" & RemoveSpaces(thisHit)  )
-
 
1235
 
-
 
1236
     End If
-
 
1237
 
-
 
1238
    Next
-
 
1239
 
-
 
1240
    WalkWiki2 = myText
-
 
1241
 
-
 
1242
End function
-
 
1243
 
-
 
1244
 
-
 
1245
 
-
 
1246
 
-
 
1247
 
-
 
1248
function RemoveBrackets(s)
1088
function RemoveBrackets(s)
1249
  Dim ts
1089
  Dim ts
1250
  ts = replace( s, "[","")
1090
  ts = replace( s, "[","")
1251
  ts = replace( ts, "]","")
1091
  ts = replace( ts, "]","")
1252
  RemoveBrackets = ts
1092
  RemoveBrackets = ts