text: July 21, 2018 14:15:53 Library.fmp12 - menuCitation -1-
  tagMenu: menuCitation
  #
  #
  #Prevent halting of script.
  Set Variable [ $$doNotHaltOtherScripts; Value:1 ]
  #
  #If user is in tag field and has changed spelling
  #exit this tag record, otherwise current reference record
  #will get deleted by the spelling check script.
  Go to Field [ ]
  #
  #Clear brainstorm and test tags so there conditional
  #formatting in the Learn window is removed.
  If [ $$citationMatch = "brainstorm" or $$citationMatch = "test" ]
  Select Window [ Name: "Learn"; Current file ]
  Go to Field [ ]
  Set Variable [ $$tagBrainstorm ]
  Set Variable [ $$tagtest ]
  Set Variable [ $$tagRecordID ]
  Set Variable [ $$tagEdit ]
  End If
  #
  #Set testlearn internal reference field conditional
  #formatting to tan.
  Set Variable [ $$internal ]
  Sort Records [ Keep records in sorted order; Specified Sort Order: testlearn::date; descending
  testlearn::timestamp; descending ]
  [ Restore; No dialog ]
  #
  Select Window [ Name: "Tag Menus"; Current file ]
  Set Variable [ $$doNotHaltOtherScripts ]
  #
  #
  #Set citationMatch to color menu button with inUse color.
  Set Variable [ $$citationMatch; Value:"cite" ]
  #
  Set Variable [ $$stoploadCitation; Value:1 ]
  Set Variable [ $$stopLoadTagRecord; Value:1 ]
  Freeze Window
  #
  #Goto correct layout.
  If [ Left (Get (LayoutName) ; 1) = "l" ]
  Go to Layout [ “learnMenu3CiteS” (reference) ]
  Else If [ Left (Get (LayoutName) ; 1) = "r" ]
  Go to Layout [ “ReferenceMenu3CiteNoPicture” (reference) ]
  End If
  #
  #Find references for reference module.
  Show All Records
  #
  #Omit locked records, which are the copyright
  #images used by default copyright tags.
  Constrain Found Set [ Specified Find Requests: Omit Records; Criteria: reference::lock: “lock” ]
  [ Restore ]
  #
  #Sort and go to the first record. Due to bugs,
  #two sorts are required to get to the first record.
  Sort Records [ Keep records in sorted order; Specified Sort Order: testlearn::date; descending
  testlearn::timestamp; descending ]
  [ Restore; No dialog ]
  If [ TEMP::InventoryLibraryYN = "" ]
  Sort Records [ Keep records in sorted order; Specified Sort Order: tagKeywordPrimary::orderOrLock; based on value list: “order
  Pulldown List”
  tagKeywordPrimary::tag; ascending
  reference::referenceShort; ascending ]
  [ Restore; No dialog ]
  Else
  #There is no cite menu for inventory libraries,
  #so no need to perform a sort.
  End If
  Go to Record/Request/Page
  [ First ]
  Scroll Window
  [ Home ]
  #
  #If current reference record in the main window
  #is tagged with a citation, find it.
  If [ $$cite ≠ "" ]
  Loop
  Exit Loop If [ $$cite = reference::_Lreference ]
  Go to Record/Request/Page
  [ Next; Exit after last ]
  End Loop
  #
  #Set main reference window's reference record's
  #citationItem variable to this citation menu's
  #current record.
  Set Variable [ $$citationItem; Value:reference::_Lreference ]
  Refresh Window
  End If
  #
  #
  #If no layout preference is set, then on iDevices
  #go the layout with no pictures, and to the
  #layout with pictures on desktop computers.
  If [ TEMP::layoutRtagCite = "" ]
  If [ Get (SystemPlatform) = 3 ]
  Go to Layout [ “ReferenceMenu3CiteNoPicture” (reference) ]
  Set Field [ TEMP::layoutRtagCite; "more" & Get (LayoutName) ]
  Else
  Go to Layout [ “ReferenceMenu3Cite” (reference) ]
  Set Field [ TEMP::layoutRtagCite; "less" & Get (LayoutName) ]
  End If
  Else
  #
  #Go the layout the user has selected.
  Go to Layout [ Middle ( TEMP::layoutRtagCite ; 5 ; 42 ) ]
  End If
  #
  #
  #Now that looping thru records is comlete,
  #turn back on record load scripts.
  Set Variable [ $$stoploadCitation ]
  Set Variable [ $$stopLoadTagRecord ]
  #
  #Just in case user was in nonTag field on this
  #window when user clicked a menu button on
  #the other window, exit all fields.
  Select Window [ Name: "References"; Current file ]
  If [ Get (LastError) = 112 ]
  Select Window [ Name: "Learn"; Current file ]
  Go to Field [ ]
  Else If [ Get (LastError) ≠ 112 ]
  Go to Field [ ]
  End If
  Refresh Window
  Select Window [ Name: "Tag Menus"; Current file ]
  Perform Script [ “loadRefCiteTag” ]
  #
  