2017-07-02 66 views

回答

0

該策略在使用傳統DSpace工作流與可配置工作流時略有不同。

以下答案適用於DSpace 5;對於其他DSpace版本,這些更改可能需要略有不同。任務表

唯一ID(傳統DSpace的工作流程只)

第一個問題解決的是兩個表具有相同的ID。更改dspace-xmlui/src/main/java/org/dspace/app/xmlui/aspect/xmlworkflow/Submissions.java以爲這兩個表創建不同的ID。

 // Tasks you own 
-  Table table = workflow.addTable("workflow-tasks",ownedItems.size() + 2,5); 
+  Table table = workflow.addTable("workflow-tasks-owned",ownedItems.size() + 2,5);  
     table.setHead(T_w_head2); 

同樣對於池中的任務進一步在同一個文件中。

修復表結構

添加了幾個模板,以確保該表有thead/tbody/tfoot結構。

<xsl:template match="dri:table[@n='workflow-tasks-pooled' or @n='workflow-tasks-owned']"> 
      <xsl:apply-templates select="dri:head"/> 
      <div class="table-responsive"> 
        <table> 
          <xsl:call-template name="standardAttributes"> 
            <xsl:with-param name="class">ds-table table table-striped table-hover</xsl:with-param> 
          </xsl:call-template> 
          <xsl:apply-templates select="dri:row[1]"/> 
          <tbody> 
            <xsl:apply-templates select="dri:row[position()!=1 and position()!=last()]"/> 
          </tbody> 
          <xsl:apply-templates select="dri:row[last()]"/> 
        </table> 
      </div> 
    </xsl:template> 

    <xsl:template match="dri:table[@n='workflow-tasks-pooled' or @n='workflow-tasks-owned']/dri:row[@role='header']"> 
      <thead> 
      <tr class="ds-table-header-row"> 
        <xsl:apply-templates select="dri:cell"/> 
      </tr> 
      </thead> 
    </xsl:template> 

    <xsl:template match="dri:table[@n='workflow-tasks-pooled' or @n='workflow-tasks-owned']/dri:row[last()]"> 
      <tfoot> 
        <tr> 
          <xsl:apply-templates select="dri:cell"/> 
        </tr> 
      </tfoot> 
    </xsl:template> 

修復的JavaScript/CSS路徑

dspace-xmlui-mirage2/src/main/webapp/styles/classic_mirage_color_scheme/_main.scss進口是不完全正確。解決這些問題,像這樣:

index bc58570..95444c7 100644 
--- a/dspace-xmlui-mirage2/src/main/webapp/styles/classic_mirage_color_scheme/_main.scss 
+++ b/dspace-xmlui-mirage2/src/main/webapp/styles/classic_mirage_color_scheme/_main.scss 
@@ -31,8 +31,8 @@ 
@import "classic_mirage_color_scheme/vocabulary-support"; 

@import "classic_mirage_color_scheme/jquery_ui"; 
[email protected] "classic_mirage_color_scheme/dataTables.bootstrap"; 
+//@import "classic_mirage_color_scheme/dataTables.bootstrap"; 
@import "shared/dspace-bootstrap-tweaks"; 
@import "../vendor/jquery-ui/themes/base/jquery-ui.css"; 
[email protected] "../vendor/datatables/media/css/jquery.dataTables.min.css"; 
[email protected] "../vendor/datatables/media/css/dataTables.bootstrap.css"; 
@import "style"; 

激活數據表功能

然後,加入以下theme.js激活datatables功能。在您的配置中進行交換 - 以下更改將會發生:

  • 當表格中至少有5個項目時,啓用分頁和過濾功能;
  • 允許除第一個(其中包含複選框)之外的所有列進行排序;
  • 默認禁用排序;和
  • 在一些語言的調整。

如果您使用的是傳統工作流程,則需要調整ID。

$(function() { 
var poolTable = $('#aspect_xmlworkflow_Submissions_table_workflow-tasks-pooled'); 
poolTable.DataTable({ 
    "paging": poolTable.find("tbody tr").size() >= 5, 
    "autoWidth": true, 
    "info": false, 
    "searching": poolTable.find("tbody tr").size() >= 5, 
    "columnDefs": [ 
     { targets: 0, orderable: false, searchable: false } 
    ], 
    "order": [], 
    "oLanguage" : { 
     "sSearch": "Filter tasks:" 
    } 
}); 
poolTable.closest(".dataTables_wrapper").before("<p class='help'>Click on a column header to sort the table by that column.</p>"); 

var ownedTable = $('#aspect_xmlworkflow_Submissions_table_workflow-tasks-owned'); 
ownedTable.DataTable({ 
    "paging": ownedTable.find("tbody tr").size() >= 5, 
    "autoWidth": true, 
    "info": false, 
    "searching": ownedTable.find("tbody tr").size() >= 5, 
    "columnDefs": [ 
     { targets: 0, orderable: false, searchable: false } 
    ], 
    "order": [] 
}); 
ownedTable.closest(".dataTables_wrapper").before("<p class='help'>Click on a column header to sort the table by that column.</p>"); 
}); 
相關問題