Get/set page deadline

Build 1501 on 14/Nov/2017  This topic last edited on: 21/Mar/2016, at 18:44

Get deadline when editing page

Dim deadline As Integer = CInt(UtilsBase.GetObjAttrValue(Page.GetPageId, "deadline"))

MsgBox(deadline)

Set deadline when editing page

Dim login As Common.ILogin = Editorial.EditorialLogin.GetLogin()

Dim obj As Schema.Class.pageObj = New GN4.Schema.Class.pageObj(login.Schema)

obj.deadlineAttr = -10

Dim ids As New List(Of Integer)

ids.Add(Page.GetPageId)

login.UpdateObjs(ids, New GenericObj() {obj.ToGenericObj(login.Schema, Schema.Class.pageObj.Attr.deadlineAttr)}, Nothing, False, False, True, False, Nothing)

Set deadline when saving edition

  <ShellCommand(CanExecute:="Ena_IsToBeSaved")> _

  Public Function Save() As Boolean

    ' save and update thumbnails (if user preferences are set accordingly - default is 'no')

    Dim e = Edition.Save

    If e <> 0 Then Return False 'e <> 0 => errors on save

    If e = 0 Or CBool(HasMissingThumbnails()) Then

      If SystemUserOptions.Edt_AdsUpdated Then ' it is set by AdsImport to update thumbs

        If SystemUserOptions.Edt_CreateThumbsOnAdsImport Then

          UpdateThumbnails(True' update also pages that have thumbs

        Else

          If SystemUserOptions.Edt_CreateThumbsOnSave Then UpdateThumbnails(False) 'handle new edition also if SystemUserOptions.Edt_AdsUpdated is wrongly true

        End If

      Else ' no ads are updated, handle only new edition

        If SystemUserOptions.Edt_CreateThumbsOnSave Then ' if user decided to do so

          UpdateThumbnails(False) ' update only pages that do not have thumbs

        End If

      End If

    End If

    ' update all deadlines

    Dim ids As New List(Of EditionItem)

    Dim deadline As Integer = -20

    Dim deadlinegap As Integer = 20

    For Each page As EdtPage In Edition.Pages

      page.deadlineAttr = deadline - deadlinegap

      deadline = page.deadlineAttr

    Next

    If ids.Count = 0 Then Exit Function

 

  Return True 'saving success

  End Function