Leaked source code of windows server 2003
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

747 lines
20 KiB

  1. VERSION 5.00
  2. Object = "{831FDD16-0C5C-11D2-A9FC-0000F8754DA1}#2.0#0"; "MSCOMCTL.OCX"
  3. Begin VB.Form frmKeywords
  4. BorderStyle = 1 'Fixed Single
  5. Caption = "Edit Keywords"
  6. ClientHeight = 9390
  7. ClientLeft = 0
  8. ClientTop = 330
  9. ClientWidth = 9495
  10. LinkTopic = "Form1"
  11. MaxButton = 0 'False
  12. MinButton = 0 'False
  13. ScaleHeight = 9390
  14. ScaleWidth = 9495
  15. Begin VB.Frame fraCreateModify
  16. Caption = "Create new/Modify Keyword"
  17. Height = 2175
  18. Left = 4800
  19. TabIndex = 4
  20. Top = 240
  21. Width = 4575
  22. Begin VB.CommandButton cmdCancel
  23. Caption = "Cancel"
  24. Height = 375
  25. Left = 1920
  26. TabIndex = 7
  27. Top = 1680
  28. Width = 1215
  29. End
  30. Begin VB.CommandButton cmdCreateModify
  31. Caption = "Create/Modify"
  32. Height = 375
  33. Left = 3240
  34. TabIndex = 8
  35. Top = 1680
  36. Width = 1215
  37. End
  38. Begin VB.TextBox txtKeyword
  39. Height = 285
  40. Left = 120
  41. TabIndex = 6
  42. Tag = "1"
  43. Top = 600
  44. Width = 4335
  45. End
  46. Begin VB.Label lblKeyword
  47. Caption = "Keyword:"
  48. Height = 255
  49. Left = 120
  50. TabIndex = 5
  51. Top = 360
  52. Width = 735
  53. End
  54. End
  55. Begin VB.CommandButton cmdClose
  56. Caption = "Close"
  57. Height = 375
  58. Left = 8160
  59. TabIndex = 22
  60. Top = 8880
  61. Width = 1215
  62. End
  63. Begin VB.ListBox lstAllKeywords
  64. Height = 2010
  65. Left = 120
  66. Sorted = -1 'True
  67. TabIndex = 1
  68. Tag = "1"
  69. Top = 360
  70. Width = 4575
  71. End
  72. Begin VB.CommandButton cmdModify
  73. Caption = "Modify"
  74. Height = 375
  75. Left = 3480
  76. TabIndex = 3
  77. Top = 2520
  78. Width = 1215
  79. End
  80. Begin VB.CommandButton cmdDelete
  81. Caption = "Delete"
  82. Height = 375
  83. Left = 2160
  84. TabIndex = 2
  85. Top = 2520
  86. Width = 1215
  87. End
  88. Begin VB.Frame fraSelectedKeyword
  89. Caption = "Selected Keyword"
  90. Height = 5775
  91. Left = 120
  92. TabIndex = 9
  93. Top = 3000
  94. Width = 9255
  95. Begin MSComctlLib.ListView lvwTitles
  96. Height = 2415
  97. Left = 120
  98. TabIndex = 21
  99. Tag = "1"
  100. Top = 3240
  101. Width = 9015
  102. _ExtentX = 15901
  103. _ExtentY = 4260
  104. LabelWrap = -1 'True
  105. HideSelection = -1 'True
  106. _Version = 393217
  107. ForeColor = -2147483640
  108. BackColor = -2147483643
  109. BorderStyle = 1
  110. Appearance = 1
  111. NumItems = 0
  112. End
  113. Begin VB.ListBox lstSynonymSetsForKeyword
  114. Height = 1815
  115. Left = 120
  116. Sorted = -1 'True
  117. TabIndex = 13
  118. Tag = "1"
  119. Top = 840
  120. Width = 4455
  121. End
  122. Begin VB.ListBox lstKeywordsInSynonymSet
  123. Height = 1815
  124. Left = 4680
  125. Sorted = -1 'True
  126. TabIndex = 17
  127. Tag = "1"
  128. Top = 840
  129. Width = 4455
  130. End
  131. Begin VB.Label lblKeywordsInSynonymSet3
  132. Caption = "contains the following Keywords:"
  133. Height = 255
  134. Left = 4680
  135. TabIndex = 16
  136. Top = 600
  137. Width = 4455
  138. End
  139. Begin VB.Label lblKeywordsInSynonymSet2
  140. Caption = "<Synonym Set>"
  141. BeginProperty Font
  142. Name = "MS Sans Serif"
  143. Size = 8.25
  144. Charset = 0
  145. Weight = 700
  146. Underline = 0 'False
  147. Italic = 0 'False
  148. Strikethrough = 0 'False
  149. EndProperty
  150. Height = 255
  151. Left = 6000
  152. TabIndex = 15
  153. Tag = "1"
  154. Top = 360
  155. Width = 3135
  156. End
  157. Begin VB.Label lblSynonymSetsForKeyword3
  158. Caption = "belongs to the following Synonym Sets:"
  159. Height = 255
  160. Left = 120
  161. TabIndex = 12
  162. Top = 600
  163. Width = 4455
  164. End
  165. Begin VB.Label lblSynonymSetsForKeyword2
  166. Caption = "<Keyword>"
  167. BeginProperty Font
  168. Name = "MS Sans Serif"
  169. Size = 8.25
  170. Charset = 0
  171. Weight = 700
  172. Underline = 0 'False
  173. Italic = 0 'False
  174. Strikethrough = 0 'False
  175. EndProperty
  176. Height = 255
  177. Left = 1200
  178. TabIndex = 11
  179. Tag = "1"
  180. Top = 360
  181. Width = 3255
  182. End
  183. Begin VB.Label lblTitles3
  184. Caption = "is associated with the following Titles:"
  185. Height = 255
  186. Left = 120
  187. TabIndex = 20
  188. Top = 3000
  189. Width = 4455
  190. End
  191. Begin VB.Label lblTitles2
  192. Caption = "<Keyword>"
  193. BeginProperty Font
  194. Name = "MS Sans Serif"
  195. Size = 8.25
  196. Charset = 0
  197. Weight = 700
  198. Underline = 0 'False
  199. Italic = 0 'False
  200. Strikethrough = 0 'False
  201. EndProperty
  202. Height = 255
  203. Left = 1200
  204. TabIndex = 19
  205. Tag = "1"
  206. Top = 2760
  207. Width = 3255
  208. End
  209. Begin VB.Label lblTitles1
  210. Caption = "The Keyword"
  211. Height = 255
  212. Left = 120
  213. TabIndex = 18
  214. Top = 2760
  215. Width = 975
  216. End
  217. Begin VB.Label lblSynonymSetsForKeyword1
  218. Caption = "The Keyword"
  219. Height = 255
  220. Left = 120
  221. TabIndex = 10
  222. Top = 360
  223. Width = 975
  224. End
  225. Begin VB.Label lblKeywordsInSynonymSet1
  226. Caption = "The Synonym Set"
  227. Height = 255
  228. Left = 4680
  229. TabIndex = 14
  230. Top = 360
  231. Width = 1335
  232. End
  233. End
  234. Begin VB.Label lblAllKeywords
  235. Caption = "All Keywords:"
  236. Height = 255
  237. Left = 120
  238. TabIndex = 0
  239. Top = 120
  240. Width = 1695
  241. End
  242. End
  243. Attribute VB_Name = "frmKeywords"
  244. Attribute VB_GlobalNameSpace = False
  245. Attribute VB_Creatable = False
  246. Attribute VB_PredeclaredId = True
  247. Attribute VB_Exposed = False
  248. Option Explicit
  249. Private p_clsKeywords As AuthDatabase.Keywords
  250. Private p_clsSynonymSets As AuthDatabase.SynonymSets
  251. Private p_clsTaxonomy As AuthDatabase.Taxonomy
  252. Private p_rsTitlesForKeyword As ADODB.Recordset
  253. Private p_blnModifying As Boolean
  254. Private Const STR_DEFAULT_KEYWORD_C As String = "<Keyword>"
  255. Private Const STR_DEFAULT_SYNONYM_SET_NAME_C As String = "<Synonym Set>"
  256. Private Sub Form_Load()
  257. On Error GoTo LErrorHandler
  258. Set p_clsKeywords = g_AuthDatabase.Keywords
  259. Set p_clsSynonymSets = g_AuthDatabase.SynonymSets
  260. Set p_clsTaxonomy = g_AuthDatabase.Taxonomy
  261. Set p_rsTitlesForKeyword = New ADODB.Recordset
  262. cmdClose.Cancel = True
  263. cmdCreateModify.Default = True
  264. p_InitializeTitlesListView
  265. p_UpdateAllKeywords
  266. p_SetModeModifying False
  267. p_SetToolTips
  268. SetFontInternal Me
  269. LEnd:
  270. Exit Sub
  271. LErrorHandler:
  272. p_DisplayErrorMessage "Form_Load"
  273. GoTo LEnd
  274. End Sub
  275. Private Sub Form_Unload(Cancel As Integer)
  276. Set p_clsKeywords = Nothing
  277. Set p_clsSynonymSets = Nothing
  278. Set p_clsTaxonomy = Nothing
  279. Set p_rsTitlesForKeyword = Nothing
  280. Set frmKeywords = Nothing
  281. End Sub
  282. Private Sub lstAllKeywords_Click()
  283. On Error GoTo LErrorHandler
  284. p_UpdateSynonymSetsForKeyword
  285. p_UpdateTitlesForKeyword
  286. p_EnableDeleteModify
  287. lblSynonymSetsForKeyword2.Caption = lstAllKeywords.Text
  288. lblTitles2.Caption = lstAllKeywords.Text
  289. LEnd:
  290. Exit Sub
  291. LErrorHandler:
  292. p_DisplayErrorMessage "lstAllKeywords_Click"
  293. GoTo LEnd
  294. End Sub
  295. Private Sub lstSynonymSetsForKeyword_Click()
  296. On Error GoTo LErrorHandler
  297. p_UpdateKeywordsInSynonymSet
  298. lblKeywordsInSynonymSet2.Caption = lstSynonymSetsForKeyword.Text
  299. LEnd:
  300. Exit Sub
  301. LErrorHandler:
  302. p_DisplayErrorMessage "lstSynonymSetsForKeyword_Click"
  303. GoTo LEnd
  304. End Sub
  305. Private Sub cmdDelete_Click()
  306. Dim intKID As Long
  307. On Error GoTo LErrorHandler
  308. intKID = lstAllKeywords.ItemData(lstAllKeywords.ListIndex)
  309. p_clsKeywords.Delete intKID
  310. p_UpdateAllKeywords
  311. LEnd:
  312. Exit Sub
  313. LErrorHandler:
  314. p_DisplayErrorMessage "cmdDelete_Click"
  315. GoTo LEnd
  316. End Sub
  317. Private Sub cmdModify_Click()
  318. On Error GoTo LErrorHandler
  319. p_DisableDeleteModify
  320. txtKeyword = lstAllKeywords.Text
  321. txtKeyword.SetFocus
  322. p_SetModeModifying True
  323. LEnd:
  324. Exit Sub
  325. LErrorHandler:
  326. p_DisplayErrorMessage "cmdModify_Click"
  327. GoTo LEnd
  328. End Sub
  329. Private Sub cmdCancel_Click()
  330. On Error GoTo LErrorHandler
  331. p_EnableDeleteModify
  332. txtKeyword = ""
  333. p_SetModeModifying False
  334. LEnd:
  335. Exit Sub
  336. LErrorHandler:
  337. p_DisplayErrorMessage "cmdCancel_Click"
  338. GoTo LEnd
  339. End Sub
  340. Private Sub cmdCreateModify_Click()
  341. On Error GoTo LErrorHandler
  342. If (p_blnModifying) Then
  343. p_Modify
  344. Else
  345. p_Create
  346. End If
  347. LEnd:
  348. Exit Sub
  349. LErrorHandler:
  350. p_DisplayErrorMessage "cmdCreateModify_Click"
  351. GoTo LEnd
  352. End Sub
  353. Private Sub cmdClose_Click()
  354. Unload Me
  355. End Sub
  356. Private Sub p_InitializeTitlesListView()
  357. With lvwTitles
  358. .AllowColumnReorder = True
  359. .FullRowSelect = True
  360. .GridLines = True
  361. .HideSelection = False
  362. .LabelEdit = lvwManual
  363. .View = lvwReport
  364. .ColumnHeaders.Add , , "Title", 2500
  365. .ColumnHeaders.Add , , "Description", 2500
  366. .ColumnHeaders.Add , , "URI of the topic", 2500
  367. End With
  368. End Sub
  369. Private Sub p_ClearAllKeywords()
  370. lstAllKeywords.Clear
  371. p_DisableDeleteModify
  372. End Sub
  373. Private Sub p_UpdateAllKeywords()
  374. Dim rs As ADODB.Recordset
  375. Set rs = New ADODB.Recordset
  376. p_ClearAllKeywords
  377. p_ClearSynonymSetsForKeyword
  378. p_ClearKeywordsInSynonymSet
  379. p_ClearTitles
  380. p_clsKeywords.GetAllKeywordsRs rs
  381. If (rs.RecordCount > 0) Then
  382. rs.MoveFirst
  383. End If
  384. Do While (Not rs.EOF)
  385. lstAllKeywords.AddItem rs("Keyword") & ""
  386. lstAllKeywords.ItemData(lstAllKeywords.NewIndex) = rs("KID")
  387. rs.MoveNext
  388. Loop
  389. If (lstAllKeywords.ListCount > 0) Then
  390. ' This simulates clicking the list box.
  391. lstAllKeywords.ListIndex = 0
  392. End If
  393. End Sub
  394. Private Sub p_ClearSynonymSetsForKeyword()
  395. lblSynonymSetsForKeyword2.Caption = STR_DEFAULT_KEYWORD_C
  396. lstSynonymSetsForKeyword.Clear
  397. End Sub
  398. Private Sub p_UpdateSynonymSetsForKeyword()
  399. Dim intKID As Long
  400. Dim rs As ADODB.Recordset
  401. Set rs = New ADODB.Recordset
  402. p_ClearSynonymSetsForKeyword
  403. p_ClearKeywordsInSynonymSet
  404. intKID = lstAllKeywords.ItemData(lstAllKeywords.ListIndex)
  405. p_clsSynonymSets.GetSynonymSetsForKeyword intKID, rs
  406. If (rs.RecordCount <> 0) Then
  407. rs.MoveFirst
  408. End If
  409. Do While (Not rs.EOF)
  410. lstSynonymSetsForKeyword.AddItem rs("Name") & ""
  411. lstSynonymSetsForKeyword.ItemData(lstSynonymSetsForKeyword.NewIndex) = rs("EID")
  412. rs.MoveNext
  413. Loop
  414. If (lstSynonymSetsForKeyword.ListCount > 0) Then
  415. ' This simulates clicking the list box.
  416. lstSynonymSetsForKeyword.ListIndex = 0
  417. End If
  418. End Sub
  419. Private Sub p_ClearKeywordsInSynonymSet()
  420. lblKeywordsInSynonymSet2.Caption = STR_DEFAULT_SYNONYM_SET_NAME_C
  421. lstKeywordsInSynonymSet.Clear
  422. End Sub
  423. Private Sub p_UpdateKeywordsInSynonymSet()
  424. Dim rs As ADODB.Recordset
  425. Dim intEID As Long
  426. Set rs = New ADODB.Recordset
  427. p_ClearKeywordsInSynonymSet
  428. intEID = lstSynonymSetsForKeyword.ItemData(lstSynonymSetsForKeyword.ListIndex)
  429. p_clsKeywords.GetKeywordsInSynonymSet intEID, rs
  430. If (rs.RecordCount <> 0) Then
  431. rs.MoveFirst
  432. End If
  433. Do While (Not rs.EOF)
  434. lstKeywordsInSynonymSet.AddItem rs("Keyword") & ""
  435. rs.MoveNext
  436. Loop
  437. End Sub
  438. Private Sub p_ClearTitles()
  439. lblTitles2.Caption = STR_DEFAULT_KEYWORD_C
  440. Do While (lvwTitles.ListItems.Count <> 0)
  441. lvwTitles.ListItems.Remove 1
  442. Loop
  443. End Sub
  444. Private Sub p_UpdateTitlesForKeyword()
  445. Dim intKID As Long
  446. Dim intIndex As Long
  447. Dim li As ListItem
  448. p_ClearTitles
  449. intKID = lstAllKeywords.ItemData(lstAllKeywords.ListIndex)
  450. p_clsTaxonomy.GetTitlesForKeyword intKID, p_rsTitlesForKeyword
  451. If (p_rsTitlesForKeyword.RecordCount <> 0) Then
  452. p_rsTitlesForKeyword.MoveFirst
  453. End If
  454. Do While (Not p_rsTitlesForKeyword.EOF)
  455. Set li = lvwTitles.ListItems.Add()
  456. li.Text = p_rsTitlesForKeyword("ENUTitle") & ""
  457. li.SubItems(1) = p_rsTitlesForKeyword("ENUDescription") & ""
  458. li.SubItems(2) = p_rsTitlesForKeyword("ContentURI") & ""
  459. p_rsTitlesForKeyword.MoveNext
  460. Loop
  461. End Sub
  462. Private Sub p_DisableAllKeywords()
  463. lstAllKeywords.Enabled = False
  464. End Sub
  465. Private Sub p_EnableAllKeywords()
  466. lstAllKeywords.Enabled = True
  467. End Sub
  468. Private Sub p_DisableDeleteModify()
  469. cmdDelete.Enabled = False
  470. cmdModify.Enabled = False
  471. End Sub
  472. Private Sub p_EnableDeleteModify()
  473. cmdDelete.Enabled = True
  474. cmdModify.Enabled = True
  475. End Sub
  476. Private Sub p_NameCreate()
  477. fraCreateModify.Caption = "Create new Keyword"
  478. cmdCreateModify.Caption = "Create"
  479. cmdCancel.Visible = False
  480. End Sub
  481. Private Sub p_NameModify()
  482. fraCreateModify.Caption = "Modify Keyword"
  483. cmdCreateModify.Caption = "Modify"
  484. cmdCancel.Visible = True
  485. End Sub
  486. Private Sub p_SetModeModifying(i_bln As Boolean)
  487. If (i_bln) Then
  488. p_NameModify
  489. p_blnModifying = True
  490. p_DisableAllKeywords
  491. Else
  492. p_NameCreate
  493. p_blnModifying = False
  494. p_EnableAllKeywords
  495. End If
  496. End Sub
  497. Private Sub p_DisplayErrorMessage( _
  498. ByVal i_strFunction As String _
  499. )
  500. Select Case Err.Number
  501. Case errContainsGarbageChar
  502. MsgBox "The Keyword " & txtKeyword & " contains garbage characters.", _
  503. vbExclamation + vbOKOnly
  504. Case errContainsStopSign
  505. MsgBox "The Keyword " & txtKeyword & " contains a Stop Sign.", _
  506. vbExclamation + vbOKOnly
  507. Case errContainsStopWord
  508. MsgBox "The Keyword " & txtKeyword & " contains a Stop Word.", _
  509. vbExclamation + vbOKOnly
  510. Case errContainsOperatorShortcut
  511. MsgBox "The Keyword " & txtKeyword & " contains an operator shortcut.", _
  512. vbExclamation + vbOKOnly
  513. Case errContainsVerbalOperator
  514. MsgBox "The Keyword " & txtKeyword & " contains a verbal operator.", _
  515. vbExclamation + vbOKOnly
  516. Case errContainsQuote
  517. MsgBox "The Keyword " & txtKeyword & " contains a quote.", _
  518. vbExclamation + vbOKOnly
  519. Case errAlreadyExists
  520. MsgBox "A Keyword with the name " & txtKeyword & "already exists", _
  521. vbExclamation + vbOKOnly
  522. Case errTooLong
  523. MsgBox "The Keyword " & txtKeyword & " is too long", _
  524. vbExclamation + vbOKOnly
  525. Case E_FAIL
  526. DisplayDatabaseLockedError
  527. Case errDatabaseVersionIncompatible
  528. DisplayDatabaseVersionError
  529. Case errNotPermittedForAuthoringGroup, errAuthoringGroupDiffers, _
  530. errAuthoringGroupNotPresent
  531. DisplayAuthoringGroupError
  532. Case Else
  533. g_ErrorInfo.SetInfoAndDump i_strFunction
  534. End Select
  535. End Sub
  536. Private Sub p_Create()
  537. Dim strKeyword As String
  538. strKeyword = RemoveExtraSpaces(txtKeyword.Text)
  539. If (strKeyword = "") Then
  540. Exit Sub
  541. End If
  542. p_clsKeywords.Create strKeyword
  543. p_UpdateAllKeywords
  544. txtKeyword.Text = ""
  545. txtKeyword.SetFocus
  546. End Sub
  547. Private Sub p_Modify()
  548. Dim strKeyword As String
  549. Dim intKID As Long
  550. strKeyword = RemoveExtraSpaces(txtKeyword.Text)
  551. If (strKeyword = "") Then
  552. Exit Sub
  553. End If
  554. intKID = lstAllKeywords.ItemData(lstAllKeywords.ListIndex)
  555. p_clsKeywords.Rename intKID, strKeyword
  556. p_UpdateAllKeywords
  557. p_SetModeModifying False
  558. txtKeyword = ""
  559. End Sub
  560. Private Sub p_SetToolTips()
  561. lblAllKeywords.ToolTipText = "This is a list of all keywords that have been " & _
  562. "created for this database."
  563. lstAllKeywords.ToolTipText = lblAllKeywords.ToolTipText
  564. txtKeyword.ToolTipText = "Type in a new keyword to add to the list."
  565. lblSynonymSetsForKeyword1.ToolTipText = "This is a list of all the synonym sets " & _
  566. "that the selected keyword belongs to."
  567. lblSynonymSetsForKeyword2.ToolTipText = lblSynonymSetsForKeyword1.ToolTipText
  568. lblSynonymSetsForKeyword3.ToolTipText = lblSynonymSetsForKeyword1.ToolTipText
  569. lstSynonymSetsForKeyword.ToolTipText = lblSynonymSetsForKeyword1.ToolTipText
  570. lblKeywordsInSynonymSet1.ToolTipText = "This is a list of all the keywords " & _
  571. "that the selected synonym set contains."
  572. lblKeywordsInSynonymSet2.ToolTipText = lblKeywordsInSynonymSet1.ToolTipText
  573. lblKeywordsInSynonymSet3.ToolTipText = lblKeywordsInSynonymSet1.ToolTipText
  574. lstKeywordsInSynonymSet.ToolTipText = lblKeywordsInSynonymSet1.ToolTipText
  575. lblTitles1.ToolTipText = "This is a table of the nodes or topics, " & _
  576. "and their properties, that the selected keyword is already associated with."
  577. lblTitles2.ToolTipText = lblTitles1.ToolTipText
  578. lblTitles3.ToolTipText = lblTitles1.ToolTipText
  579. lvwTitles.ToolTipText = lblTitles1.ToolTipText
  580. End Sub