first commit
This commit is contained in:
@@ -0,0 +1,40 @@
|
||||
{**
|
||||
* templates/controllers/listbuilder/listbuilder.tpl
|
||||
*
|
||||
* Copyright (c) 2014-2021 Simon Fraser University
|
||||
* Copyright (c) 2000-2021 John Willinsky
|
||||
* Distributed under the GNU GPL v3. For full terms see the file docs/COPYING.
|
||||
*
|
||||
* Displays a Listbuilder object
|
||||
*}
|
||||
|
||||
{assign var=staticId value="component-"|concat:$grid->getId()}
|
||||
{assign var=gridId value=$staticId|concat:'-'|uniqid}
|
||||
{assign var=gridTableId value=$gridId|concat:"-table"}
|
||||
{assign var=gridActOnId value=$gridTableId|concat:">tbody:first"}
|
||||
|
||||
<script>
|
||||
$(function() {ldelim}
|
||||
$('#{$gridId|escape}').pkpHandler(
|
||||
'$.pkp.controllers.listbuilder.ListbuilderHandler',
|
||||
{ldelim}
|
||||
{include file="controllers/listbuilder/listbuilderOptions.tpl"}
|
||||
{rdelim}
|
||||
);
|
||||
});
|
||||
</script>
|
||||
|
||||
|
||||
<div id="{$gridId|escape}" class="pkp_controllers_grid pkp_controllers_listbuilder formWidget">
|
||||
|
||||
{* Use this disabled input to store LB deletions. See ListbuilderHandler.js *}
|
||||
<input disabled="disabled" type="hidden" class="deletions" />
|
||||
|
||||
<div class="wrapper">
|
||||
{include file="controllers/grid/gridHeader.tpl"}
|
||||
{include file="controllers/listbuilder/listbuilderTable.tpl"}
|
||||
{if $hasOrderLink}
|
||||
{include file="controllers/grid/gridOrderFinishControls.tpl" gridId=$staticId}
|
||||
{/if}
|
||||
</div>
|
||||
</div>
|
||||
@@ -0,0 +1,48 @@
|
||||
{**
|
||||
* templates/controllers/grid/listbuilderGridCell.tpl
|
||||
*
|
||||
* Copyright (c) 2014-2021 Simon Fraser University
|
||||
* Copyright (c) 2000-2021 John Willinsky
|
||||
* Distributed under the GNU GPL v3. For full terms see the file docs/COPYING.
|
||||
*
|
||||
* a regular listbuilder grid cell (with or without actions)
|
||||
*}
|
||||
{if $id}
|
||||
{assign var=cellId value="cell-"|concat:$id}
|
||||
{else}
|
||||
{assign var=cellId value=""}
|
||||
{/if}
|
||||
<span {if $cellId}id="{$cellId|escape}" {/if}class="pkp_linkActions gridCellContainer">
|
||||
<div class="gridCellDisplay">
|
||||
{if $column->getFlag('sourceType') === \PKP\controllers\listbuilder\ListbuilderHandler::LISTBUILDER_SOURCE_TYPE_SELECT}
|
||||
{**
|
||||
* Include a hidden element containing the current key.
|
||||
* Used e.g. to match the currently selected value.
|
||||
*}
|
||||
<input type="hidden" value="{$labelKey|escape}" />
|
||||
{/if}
|
||||
|
||||
{* Display the current value *}
|
||||
{include file="controllers/grid/gridCellContents.tpl"}
|
||||
</div>
|
||||
|
||||
<div class="gridCellEdit">
|
||||
{if $column->getFlag('sourceType') === \PKP\controllers\listbuilder\ListbuilderHandler::LISTBUILDER_SOURCE_TYPE_TEXT}
|
||||
{if $column->hasFlag('multilingual')}{* Multilingual *}
|
||||
|
||||
{assign var="FBV_id" value="newRowId"}
|
||||
{assign var="FBV_uniqId" value=""|uniqid}
|
||||
{assign var="FBV_name" value="newRowId["|concat:$column->getId()|escape|concat:"]"}
|
||||
{include file="form/textInput.tpl" formLocale=$primaryLocale FBV_id=$FBV_id FBV_name=$FBV_name FBV_value=$label FBV_tabIndex=$column->getFlag('tabIndex') FBV_multilingual=true formLocales=$formLocales}
|
||||
|
||||
{else}{* Not multilingual *}
|
||||
<input type="text" name="newRowId[{$column->getId()|escape}]" class="textField" {if $column->getFlag('tabIndex')}tabindex="{$column->getFlag('tabIndex')}"{/if} value="{$label|escape}" />
|
||||
{/if}
|
||||
{elseif $column->getFlag('sourceType') == \PKP\controllers\listbuilder\ListbuilderHandler::LISTBUILDER_SOURCE_TYPE_SELECT}
|
||||
<select name="newRowId[{$column->getId()|escape}]" class="selectMenu">
|
||||
{* Populated by JavaScript in ListbuilderHandler.js *}
|
||||
<option value="{$labelKey|escape}">{translate key="common.loading"}</option>
|
||||
</select>
|
||||
{/if}
|
||||
</div>
|
||||
</span>
|
||||
@@ -0,0 +1,55 @@
|
||||
{**
|
||||
* templates/controllers/listbuilderGridRow.tpl
|
||||
*
|
||||
* Copyright (c) 2014-2021 Simon Fraser University
|
||||
* Copyright (c) 2000-2021 John Willinsky
|
||||
* Distributed under the GNU GPL v3. For full terms see the file docs/COPYING.
|
||||
*
|
||||
* a listbuilder grid row
|
||||
*}
|
||||
{if $row->getId()}
|
||||
{assign var=rowId value="component-"|concat:$row->getGridId():"-row-":$row->getId()}
|
||||
{else}
|
||||
{assign var=rowId value="component-"|concat:$row->getGridId():"-row-tempId-"|uniqid}
|
||||
{/if}
|
||||
<tr {if $rowId}id="{$rowId|escape}" {/if}class="{if $rowId}element{$row->getId()|escape} {/if}gridRow">
|
||||
{capture assign="listbuilderRowActions"}
|
||||
<div class="row_actions">
|
||||
{foreach from=$row->getActions(\PKP\controllers\grid\GridRow::GRID_ACTION_POSITION_ROW_LEFT) item=action}
|
||||
{include file="linkAction/linkAction.tpl" action=$action contextId=$rowId}
|
||||
{/foreach}
|
||||
</div>
|
||||
{/capture}
|
||||
{foreach from=$cells item=cell name=listbuilderCells}
|
||||
{if $smarty.foreach.listbuilderCells.first}
|
||||
<td class="first_column">
|
||||
{if $row->getId()}
|
||||
<input type="hidden" name="rowId" value="{$row->getId()|escape}" />
|
||||
{/if}
|
||||
{if !$row->getId() || $row->getIsModified()}
|
||||
<input type="hidden" disabled="disabled" class="isModified" value="1" />
|
||||
{else}
|
||||
<input type="hidden" disabled="disabled" class="isModified" value="0" />
|
||||
{/if}
|
||||
<div class="row_container">
|
||||
<div class="gridCell row_file">{$cell}</div>
|
||||
</div>
|
||||
{if $smarty.foreach.listbuilderCells.last}
|
||||
{$listbuilderRowActions}
|
||||
{/if}
|
||||
</td>
|
||||
{else}
|
||||
{if $column->hasFlag('alignment')}
|
||||
{assign var=alignment value=$column->getFlag('alignment')}
|
||||
{else}
|
||||
{assign var=alignment value=\PKP\controllers\grid\GridColumn::COLUMN_ALIGNMENT_CENTER}
|
||||
{/if}
|
||||
<td style="text-align: {$alignment}" class="gridCell">
|
||||
{$cell}
|
||||
{if $smarty.foreach.listbuilderCells.last && $row->getActions(\PKP\controllers\grid\GridRow::GRID_ACTION_POSITION_ROW_LEFT)}
|
||||
{$listbuilderRowActions}
|
||||
{/if}
|
||||
</td>
|
||||
{/if}
|
||||
{/foreach}
|
||||
</tr>
|
||||
@@ -0,0 +1,25 @@
|
||||
{**
|
||||
* templates/controllers/listbuilder/listbuilderOptions.tpl
|
||||
*
|
||||
* Copyright (c) 2014-2021 Simon Fraser University
|
||||
* Copyright (c) 2000-2021 John Willinsky
|
||||
* Distributed under the GNU GPL v3. For full terms see the file docs/COPYING.
|
||||
*
|
||||
* Listbuilder java script handler options.
|
||||
*}
|
||||
|
||||
|
||||
gridId: {$grid->getId()|json_encode},
|
||||
fetchRowUrl: {url|json_encode op='fetchRow' params=$gridRequestArgs escape=false},
|
||||
fetchOptionsUrl: {url|json_encode op='fetchOptions' params=$gridRequestArgs escape=false},
|
||||
availableOptions: {$availableOptions|json_encode},
|
||||
{if $grid->getSaveType() == \PKP\controllers\listbuilder\ListbuilderHandler::LISTBUILDER_SAVE_TYPE_INTERNAL}
|
||||
saveUrl: {url|json_encode op='save' params=$gridRequestArgs escape=false},
|
||||
saveFieldName: null,
|
||||
{else}{* \PKP\controllers\listbuilder\ListbuilderHandler::LISTBUILDER_SAVE_TYPE_EXTERNAL *}
|
||||
saveUrl: null,
|
||||
saveFieldName: {$grid->getSaveFieldName()|json_encode},
|
||||
{/if}
|
||||
sourceType: {$grid->getSourceType()|json_encode},
|
||||
bodySelector: '#{$gridActOnId|escape:javascript}',
|
||||
features: {include file='controllers/grid/feature/featuresOptions.tpl' features=$features},
|
||||
@@ -0,0 +1,42 @@
|
||||
{**
|
||||
* templates/controllers/listbuilder/listbuilderBody.tpl
|
||||
*
|
||||
* Copyright (c) 2014-2021 Simon Fraser University
|
||||
* Copyright (c) 2000-2021 John Willinsky
|
||||
* Distributed under the GNU GPL v3. For full terms see the file docs/COPYING.
|
||||
*
|
||||
* The table part of a Listbuilder object
|
||||
*}
|
||||
|
||||
<table id="{$gridTableId|escape}">
|
||||
{if $columns|@count > 1}{* include column titles as th elements if there is more than one column *}
|
||||
{include file="controllers/grid/columnGroup.tpl" columns=$columns}
|
||||
<thead>
|
||||
<tr>
|
||||
{foreach from=$columns item=column}
|
||||
{if $column->hasFlag('alignment')}
|
||||
{assign var=alignment value=$column->getFlag('alignment')}
|
||||
{else}
|
||||
{assign var=alignment value=\PKP\controllers\grid\GridColumn::COLUMN_ALIGNMENT_LEFT}
|
||||
{/if}
|
||||
<th scope="col" style="text-align: {$alignment};">
|
||||
{$column->getLocalizedTitle()|escape}
|
||||
</th>
|
||||
{/foreach}
|
||||
</tr>
|
||||
</thead>
|
||||
{/if}
|
||||
<tbody>
|
||||
{foreach from=$rows item=lb_row}
|
||||
{$lb_row}
|
||||
{/foreach}
|
||||
{**
|
||||
We need the last (=empty) line even if we have rows
|
||||
so that we can restore it if the user deletes all rows.
|
||||
**}
|
||||
<tr class="empty"{if $rows} style="display: none;"{/if}>
|
||||
<td colspan="{$columns|@count}">{translate key="grid.noItems"}</td>
|
||||
</tr>
|
||||
<div class="newRow"></div>
|
||||
</tbody>
|
||||
</table>
|
||||
Reference in New Issue
Block a user