0

这是一个在android项目的ssets\www\modules\node\node.js中获取drupal webservice节点的函数。当我单击内容并尝试在 android 模拟器的应用程序中检索节点时,出现错误消息“node_page_view reference error:nid is not defined”,应用程序似乎可以读取节点/%,所以我想调试该功能,见警报(节点);在下面的代码中。但是我重新运行程序,没有任何反应,有什么想法吗?

function node_page_view(node) {
    alert(node);
      try {
        if (drupalgap.settings.debug) {
          console.log('node_page_view()');
          console.log(JSON.stringify(arguments));
        }
        if (node) {
          var build = {
            'theme':'node',
            'node':node, // TODO - is this line of code doing anything?
            'title':{'markup':node.title}, // TODO - this is a core field and should probably by fetched from entity.js
            'content':{'markup':node.content},
          };
          // If the comments are hidden, do nothing.
          if (node.comment == 0) { }
          // If the comments are closed or open, show the comments.
          else if (node.comment == 1 || node.comment == 2) {

            // Build an empty list for the comments
            build.comments = {
              'theme':'jqm_item_list',
              'title':'Comments',
              'items':[],
              'attributes':{'id':'comment_listing_items'},
            };

            // If the comments are open, show the comment form.
            if (node.comment == 2) {
              build.comments_form = {
                'markup':
                  '<h2>Add comment</h2>' +
                    drupalgap_get_form('comment_edit', {'nid':node.nid})
              };
            }
          }

          return build;
        }
        else {
          alert('node_page_view - failed to load node (' + nid + ')');
        }
      }
      catch (error) {
        alert('node_page_view - ' + error);
      }
    }
4

1 回答 1

0

你试过温瑞吗?

http://people.apache.org/~pmuellr/weinre/docs/latest/

或医生:

https://github.com/filmaj/medic

于 2013-05-08T08:33:09.977 回答