share-extras / wiki-rich-content

Enrich the default Share wiki page view with support for dynamic tables of contents, embedded document previews, in-line data lists/tables and syntax-highlighted code
Apache License 2.0
5 stars 6 forks source link

datatables on Alfresco 4.1.5 EE #5

Closed jservajean closed 10 years ago

jservajean commented 10 years ago

I tried to define a datatable using the required syntax (table class="datatable:71824d77-9cd8-44c3-b3e4-dbca7e17dc49" border="0"), and what I get is a table with the desired head columns but the body contains no rows (a single row telling "No records found.") Any Idea ?

wabson commented 10 years ago

Some questions to start. Which browser are you using? Are there any errors in the browser's JavaScript console? Screenshots?

jservajean commented 10 years ago

Using firefox 27.0.1 Alfresco 4.1.5 EE There is an error in firebug's javascipt console :

"NetworkError: 500 Erreur Interne de Servlet - http://localhost:8080/share/proxy/alfresco/slingshot/datalists/data/node/workspace/SpacesStore/a534356f-8dd6-4d9a-8ffb-dc1adb140c01"

Details of the failing xhr POST shows JSON data is {"fields":["dl_issueID","cm_title","dl_issueAssignedTo","dl_issueStatus","dl_issuePriority","cm_description","dl_issueDueDate","dl_issueComments","cm_attachments"],"filter":{"filterId":"all","filterData":""}}

Screenshots dl wiki

wabson commented 10 years ago

Thanks, I imagine the problem is being caused by the 500 response coming back from the web script then. Can you post the response body that the browser gets back? There should be a stacktrace or some more detail on the problem in there.

jservajean commented 10 years ago

here it is :

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
   <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
   <style type="text/css">
body
{
   font: 13px/1.231 arial,helvetica,clean,sans-serif;
   color: #000000;
}

body,div,p
{
   margin: 0;
   padding: 0;
}

div
{
    text-align: center;
}

ul
{
   text-align: left;
}

li
{
   padding: 0.2em;
}

div.panel
{
   display: inline-block;
}
   </style>
   <title>Alfresco Share &raquo; System Error</title>
</head>
<body>
   <div>
      <br/>
      <img src="/share/themes/default/images/app-logo.png">
      <br/>
      <br/>
      <p style="font-size:150%">A server error has occured.</p>
      <br/>
      <p>There are a number of reasons why this could have happened:</p>
      <div class="panel">
         <ul>
            <li>You have attempted to access a page that does not exist - check the URL in the address bar.</li>
            <li>You have attempted to access a page that is not accessable to you, such as a private Site dashboard.</li>
            <li>A valid page has been requested but the server was unable to render it due to an internal error - contact your administrator.</li>
         <ul>
      </div>
      <br/>
      <a href="/share">Return to your dashboard page</a>
      <br/>
      <br/>
      <br/>
      <a href="http://www.alfresco.com">Alfresco Software</a> Inc. &copy; 2005-2013 All rights reserved.
   </div>
   <div>
<!--
javax.servlet.ServletException: Possible CSRF attack noted when comparing token in session and request header. Request: POST /share/proxy/alfresco/slingshot/datalists/data/node/workspace/SpacesStore/a534356f-8dd6-4d9a-8ffb-dc1adb140c01
    at org.alfresco.web.site.servlet.CSRFFilter$AssertTokenAction.run(CSRFFilter.java:632)
    at org.alfresco.web.site.servlet.CSRFFilter.doFilter(CSRFFilter.java:290)
    at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:235)
    at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
    at org.alfresco.web.site.servlet.SSOAuthenticationFilter.doFilter(SSOAuthenticationFilter.java:374)
    at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:235)
    at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
    at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:233)
    at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:191)
    at org.apache.catalina.authenticator.AuthenticatorBase.invoke(AuthenticatorBase.java:470)
    at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:127)
    at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:102)
    at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:109)
    at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:293)
    at org.apache.coyote.http11.Http11AprProcessor.process(Http11AprProcessor.java:877)
    at org.apache.coyote.http11.Http11AprProtocol$Http11ConnectionHandler.process(Http11AprProtocol.java:594)
    at org.apache.tomcat.util.net.AprEndpoint$Worker.run(AprEndpoint.java:1675)
    at java.lang.Thread.run(Thread.java:662)
-->

   </div>
</div>
</body>
</html>```
martiniusDE commented 10 years ago

hello,

same problem with Alfresco Community 4.2.f. To solve the problem, am I right to set the token in the POST header with every request?

var csrf_token = Alfresco.util.CSRFPolicy.getToken();
if (csrf_token) {
  $("body").bind("ajaxSend", function(elm, xhr, s){
    if (s.type == "POST") {
      xhr.setRequestHeader('Alfresco-CSRFToken', csrf_token);
    }
  });
}

[Source: http://blog.productivist.com/csrfs-and-alfresco-enterprise-4-1-4]

wabson commented 10 years ago

Thanks for the feedback, I have tested the fix for the CSRF token issue and datalists now work fine for me. v2.1.2 is available in the releases section and via Maven.