IsImageUsedInEdition Script

Build 1501 on 14/Nov/2017  This topic last edited on: 11/Jan/2013, at 17:30

Description

Returns true if the image with the specified id already exists as an editorial image placed on page(s) in the edition, with the specified id.

The maximum number of pages to be returned in the "pages" string is configurable in EditorialConfig as <Item Name="glbMaxLinkedPages " Value="3" />.

Syntax

dim e as Boolean = IsImageUsedInEdition(imageId, editionIdList, pages) as Boolean

ImageId

id of image or img to be checked

editionidlist

list of edition ids to be checked, e.g. assuming only one edition with the id 55535, the syntax is utilbase.IsImageUsedInEdition(21345, new integer() {55535}, pages)

pages

string passed by reference that contains either "0" (to display the list of all pages where the item appears), or "X" (where X is 1,2,3 or whatever number), to display only the first X pages. Updates to the list of editions/pages, each in a separate line.

Example

Dim pages As String = EdConfig.glbMaxLinkedPages

  If UtilsBase.IsImageUsedInEdition(selectedObject.Id, New Integer() {Page.GetPageEditionId}, pages) = True Then

    If Not bc Is Nothing Then

      bc.Dispose()

      bc = Nothing

    End If

    Dim e As MsgBoxResult = MsgBox(String.Format(My.Resources.IDS_IsImageUsedInEdition, pages, EdConfig.glbMaxLinkedPages), MsgBoxStyle.YesNo, m_Label)

    If e = MsgBoxResult.No Then

      If Not bc Is Nothing Then

        bc.Dispose()

        bc = Nothing

      End If

      Return effects <> DragDropEffects.None

    End If

  End If