dimanche 28 février 2016

Function to return a list - issue with filtering the output

I try to output only articles if authorsid = authorid.

Beside that the whole function works exactly as I want, here it is:

The general idea is to limit access to only own articles.

So, my question is: how do I limit the results to show only articles written by the owner of the page we are on (authorsid = authorid).

function ArticlesListReturn(returned) {
    xml = returned.documentElement;
    var rel = document.getElementById('related_category_articles');
    rel.options.length = 0;
    var status = getXMLData('status');
    var title = '';
    var id = '';
    var authorid = '';


    if (status == 0) {
      alert("%%LNG_jsArticleListError%%" + errormsg);
    } else {
      var authorid = document.getElementById("authorid").value; // Serge

      //    authorsid = getNextXMLData('authors',x);
      for (var x = 0; x < xml.getElementsByTagName('titles').length; x++) {


        title = getNextXMLData('titles', x);
        id = getNextXMLData('ids', x);
        authorsid = getNextXMLData('authors', x);

        alert(authorsid) // authors of each article - it returns the proper values
        alert(authorid) // author of the page we are on - it returns the proper value

        rel.options
        var count = 0;

        rel.options[x] = new Option(title, id, authorid); // lign that returns results

        title = '';
        id = '';
        authorid = '';

      }

Aucun commentaire:

Enregistrer un commentaire