Change page workstate by a dialog box
" <summary>Displays a dialog allowing the workstate of a page to be changed. Called
" from a clickscript button.</summary>
" <param name="source">The source of the click.</param>
<ShellCommand()> _
Public Sub ChangePageWorkstateDialogClick(ByVal source As IClickScriptSource)
ChangePageSZWDlg()
End Sub
<ShellCommand(CanExecute:="Ena_HasSelectedPageObjects")> _
Public Sub ChangePageSZWDlg()
Dim selectedObjects As IGenericAttrObjList = Main.GetSelectedObjects
Dim c As Short = 0
Dim curSId As Integer = 0, curZId As Integer = 0, curWId As Integer = 0
Dim editionId As Integer = DBDesc.InvalidId
Dim tit As String = String.Empty
For Each selectedObject In selectedObjects
If c = 0 Then
curSId = selectedObject.GetAttribute("sectionRef")
curZId = selectedObject.GetAttribute("zoneRef")
curWId = selectedObject.GetAttribute("workstateRef")
tit = selectedObject.GetAttribute("descName")
If editionId = DBDesc.InvalidId Then
editionId = selectedObject.GetAttribute("editionRef")
End If
Else
If selectedObject.GetAttribute("sectionRef") <> curSId Then
curSId = 0
End If
If selectedObject.GetAttribute("zoneRef") <> curZId Then
curZId = 0
End If
If selectedObject.GetAttribute("workstateRef") <> curWId Then
curWId = 0
End If
If c = 1 Then
tit += " + ..."
End If
End If
c += 1
Next
Dim titleId As Integer = DBDesc.InvalidId
If Not editionId = DBDesc.InvalidId Then
Dim edition As Schema.Class.editionObj = EditorialLogin.Get().GetEdition(editionId)
If Not edition Is Nothing Then
titleId = edition.titleRefAttr
End If
End If
ChangePageSZWDlgAux(selectedObjects.Ids, curSId, curZId, curWId, Main, tit, titleId)
End Sub
Public Shared Function ChangePageSZWDlgAux(ByVal Ids, ByVal curSId, ByVal curZId, ByVal curWId, ByVal iMain, ByVal tit, ByVal titleId)
Dim idlg As New InputDlg
idlg.Title = tit
Dim title As Title = Nothing
If Not titleId = DBDesc.InvalidId Then
title = FredApp.GetAppGlobal().GetTitle(titleId)
End If
Dim section As InputDlg.Combo = New InputDlg.Combo
If Not title Is Nothing Then
section.SetList(title.m_Sections.ToIdName())
End If
Dim csection = idlg.AddCombo(My.Resources.IDS_Section, section, section.ToIdx(curSId))
Dim zone As InputDlg.Combo = New InputDlg.Combo
If Not title Is Nothing Then
zone.SetList(title.m_Zones.ToIdName())
End If
Dim czone = idlg.AddCombo(My.Resources.IDS_Zone, zone, zone.ToIdx(curZId))
Dim workstate As InputDlg.Combo = New InputDlg.Combo
workstate.AddItem(WinUI.Properties.Resources.STR_NONE, 0)
For Each ws As Schema.Class.workstateObj In EditorialLogin.Get().GetWorkstates()
If ws.levelsAttr.Get(Schema.Class.workstateObj.levelsEnum.PageVal) Then
workstate.AddItem(ws.nameAttr, ws.idAttr)
End If
Next
Dim wsidx = workstate.ToIdx(curWId)
If wsidx = -1 Then wsidx = 0
Dim cWorkstate = idlg.AddCombo(My.Resources.IDS_Workstate, workstate, wsidx)
If idlg.ShowDialog() Then
Dim iSectId = idlg.GetComboData(csection)
Dim iZoneId = idlg.GetComboData(czone)
Dim iWorkstateId = idlg.GetComboData(cWorkstate)
Dim login As Common.ILogin = Editorial.EditorialLogin.GetLogin()
Dim obj As Schema.Class.pageObj = New GN4.Schema.Class.pageObj(login.Schema)
obj.sectionRefAttr = iSectId
obj.zoneRefAttr = iZoneId
obj.workstateRefAttr = iWorkstateId
login.UpdateObjs(Ids, New GenericObj() {obj.ToGenericObj(login.Schema, Schema.Class.pageObj.Attr.sectionRefAttr Or Schema.Class.pageObj.Attr.zoneRefAttr Or Schema.Class.pageObj.Attr.workstateRefAttr)}, Nothing, False, False, True, False, Nothing)
iMain.Refresh()
Return True
End If
Return False
End Function