Get article data

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

Get the article object from the current article

Dim oArticle = Ted.GetActiveArticle

Dim oArticle = Fred.GetActiveArticle

Get the article object from the article id

Dim oArticle = EditorialLogin.Get().ArticleGet(articleid, False)

Note: this oArticle is not the same object as the one obtained from Ted.GetActiveArticle (iArticle). This oArticle object is as it is in the database. Therefore, not all properties are available.

Get article elements from the article id

Dim oArticle = EditorialLogin.Get().ArticleGet(articleid, False)

Dim oTxts = EditorialLogin.Get().ArticleGetTextIds(oArticle, txtlist, reflist)

Get article words and lines from the article id

Dim oArticle = EditorialLogin.Get().ArticleGet(articleId, CDbl(modified))

artName = oArticle.nameAttr

artNWrd = oArticle.bodyNWordsAttr

artNLines = oArticle.bodyNLinesAttr

Are the article elements of the given article id in measure?

Use the jumpsAttrs.count of the TxtGeometry object to find out if the article elements are linked, and then textOverNAttr attribute to find out if they're in measure.

For Each articleid As Integer In articleIds

 Dim overnhead, overnbody, overncaption As Integer

 overnhead = 0 : overnbody = 0 : overncaption = 0

 

 Dim objArticle As articleObj = EditorialLogin.Get().ArticleGet(articleid, False)

 For Each sourceArticleText As ChildrenEntry In objArticle.txtsAttr

                 Dim sourceText As GenericObj = CType(sourceArticleText.Ref, GenericObj)

   If Not sourceText Is Nothing Then

           Dim txtGeometry As txtGeometryObj = EditorialLogin.Get().TxtGetGeometry(sourceArticleText.Id, regionId)

     If Not txtGeometry Is Nothing Then

             If txtGeometry.jumpsAttr.Count > 0 Then

               If sourceText.ObjectType.Name = EdConfig.headname Then overnhead = overnhead + txtGeometry.textOverNAttr

         If sourceText.ObjectType.Name = EdConfig.bodyname Then overnbody = overnbody + txtGeometry.textOverNAttr

         If sourceText.ObjectType.Name = EdConfig.photoname Then

                 overncaption = overncaption + txtGeometry.textOverNAttr

         End If

       End If

     End If

   End If

 Next

 

 If overnhead + overnbody + overncaption <> 0 Then

                 strInvalidArticleMsg += "The article '" & objArticle.nameAttr + "' with Id: " & articleid & " is not totally fit." & vbCrLf

   'We move the article back to its original folder

   Dim list As List(Of Integer) = New List(Of Integer)

   list.Add(articleid)

   UtilsBase.SendToSilent(list, aFolders.Item(articleid))

 End If

Next

Get image object from article ref id

Dim imgobj As Schema.Class.imgObj = EditorialLogin.Get().GetImg(objObj.Id)

See also Get image data.

Get article id from txt id

 MsgBox(AddInUtils.GetArticleIdFromTxtId(Page.GetSelectedTxtId))

 

Public Shared Function GetArticleIdFromTxtId(txtid As Integer) As Integer

  ' returns id of the parent article from the element (txt) id

  'v1 on 26/Sep/2012 (BS)

  Dim clientLogin As Client.ClientLogin = DataConnection.Instance.ClientLogin

  Dim resObj As List(Of Common.GenericAccessObj) = clientLogin.GetAccessObjs(New Integer() {txtid}, New Common.ObjLoadDesc(ObjLoadMode.None, Common.ObjLoadExtra.Parent))

  If (resObj IsNot Nothing And resObj.Count > 0) Then

    Dim txt As Common.GenericAccessObj = resObj(0)

    Dim parentid As Integer = CType(txt.GetExtra(ObjLoadExtra.Parent), Integer)

    Return parentid

  Else

    Return 0

  End If

End Function