Commit 6d0cf866 authored by sylvieg's avatar sylvieg

[MOD]tracker: move export from admin to view tracker page + new perm to export...

[MOD]tracker: move export from admin to view tracker page + new perm to export + some fix on perm when exporting field with special perms
parent fb37bf91
......@@ -1240,6 +1240,7 @@ installer/schema/20081105_calendar_items_allday_tiki.sql -text
installer/schema/20081107_menu42_tiki.sql -text
installer/schema/20081112_tiki_p_tracker_view_comments_tiki.sql -text
installer/schema/20081114_tiki_banner_tiki.sql -text
installer/schema/20081119_tiki_p_export_tracker_tiki.sql -text
installer/shell.php -text
installer/tiki-installer.php -text
/jhot.php -text
......
......@@ -2924,6 +2924,7 @@ INSERT INTO users_permissions (permName, permDesc, level, type) VALUES ('tiki_p_
INSERT INTO users_permissions (permName, permDesc, level, type) VALUES ('tiki_p_view_trackers_closed', 'Can view trackers closed items', 'registered', 'trackers');
INSERT INTO users_permissions (permName, permDesc, level, type) VALUES ('tiki_p_view_trackers_pending', 'Can view trackers pending items', 'editors', 'trackers');
INSERT INTO users_permissions (permName, permDesc, level, type) VALUES ('tiki_p_watch_trackers', 'Can watch tracker', 'registered', 'trackers');
INSERT INTO users_permissions (permName, permDesc, level, type) VALUES ('tiki_p_export_tracker', 'Can export tracker items', 'registered', 'trackers');
INSERT INTO users_permissions (permName, permDesc, level, type, admin) VALUES ('tiki_p_admin_wiki', 'Can admin the wiki', 'editors', 'wiki', 'y');
INSERT INTO users_permissions (permName, permDesc, level, type) VALUES ('tiki_p_assign_perm_wiki_page', 'Can assign perms to wiki pages', 'admin', 'wiki');
......
#sylvieg
INSERT INTO users_permissions (permName, permDesc, level, type) VALUES ('tiki_p_export_tracker', 'Can export tracker items', 'registered', 'trackers');
......@@ -762,7 +762,7 @@ class TrackerLib extends TikiLib {
return $retval;
}
function get_item_fields($trackerId, $itemId, $listfields, &$itemUser) {
global $prefs, $user;
global $prefs, $user, $tiki_p_admin_trackers;
$fields = array();
$fil = array();
$kx = '';
......@@ -790,6 +790,9 @@ class TrackerLib extends TikiLib {
$fopt['fieldId'] = $fieldId;
$fieldId = $fopt['fieldId'];
$fopt['value'] = ( isset($fil[$fieldId]) ) ? $fil[$fieldId] : '';
if ($tiki_p_admin_trackers != 'y' && ($fopt['isHidden'] == 'y' || ($fopt['isHidden'] == 'c' && $itemUser != $user))) {
$fopt['value'] = '';
}
$fopt['linkId'] = '';
if (!empty($fopt['options'])) {
$fopt['options_array'] = split(',', $fopt['options']);
......
......@@ -358,31 +358,6 @@ categories = {$catsdump}
</form>
{if $trackerId}
<h2>{tr}Export CSV data{/tr}</h2>
<form action="tiki-export_tracker.php?trackerId={$trackerId}" method="post">
<table class="normal">
<tr class="formcolor"><td>{tr}File{/tr}</td><td>{tr}Tracker{/tr}_{$trackerId}.csv</td></tr>
<tr class="formcolor"><td>{tr}Charset encoding{/tr}</td><td><select name="encoding"><option value="UTF-8" selected="selected">{tr}UTF-8{/tr}</option><option value="ISO-8859-1">{tr}ISO-8859-1{/tr}</option></select></td></tr>
<tr class="formcolor"><td>{tr}Separator{/tr}</td><td><input type="text" name="separator" value="," /></td></tr>
<tr class="formcolor"><td>{tr}Delimitors{/tr}</td><td><input type="text" name="delimitorL" value='"' /><input type="text" name="delimitorR" value='"' /></td></tr>
<tr class="formcolor"><td>{tr}Carriage Return inside Field Value{/tr}</td><td><input type="text" name="CR" value='%%%' /></td></tr>
<tr class="formcolor"><td>{tr}Parse{/tr}</td><td><input type="checkbox" name="parse" /></td></tr>
<tr class="formcolor"><td>{tr}Info{/tr}</td><td><input name="showItemId" type="checkbox" checked="checked" />itemId
<br /><input type="checkbox" name="showStatus"{if $info.showStatus eq 'y'} checked="checked"{/if} />{tr}status{/tr}
<br /><input type="checkbox" name="showCreated"{if $info.showCreated eq 'y'} checked="checked"{/if} />{tr}created{/tr}
<br /><input type="checkbox" name="showLastModif"{if $info.showLastModif eq 'y'} checked="checked"{/if} />{tr}lastModif{/tr}
</td></tr>
<tr class="formcolor"><td>{tr}Fields{/tr}</td><td><input type="radio" name="which" value="list"/> {tr}Fields visible in items list{/tr}
<br /><input type="radio" name="which" value="ls"/> {tr}Fields searchable or visible in items list{/tr}
<br /><input type="radio" name="which" value="item"/> {tr}Fields visible in an item view{/tr}
<br /><input type="radio" name="which" value="all" checked="checked"/> {tr}All fields{/tr}
<br /><input type="text" name="listfields" /> {tr}or list of fields separated by comma{/tr}
</td></tr>
<tr class="formcolor"><td>{tr}Filter{/tr}</td><td>{include file="wiki-plugins/wikiplugin_trackerfilter.tpl" showFieldId="y" inForm="y"}</td></tr>
<tr class="formcolor"><td>&nbsp;</td><td><input type="submit" name="export" value="{tr}Export{/tr}" /></td></tr>
</table>
</form>
<h2>{tr}Import CSV data{/tr}</h2>
<form action="tiki-import_tracker.php?trackerId={$trackerId}" method="post" enctype="multipart/form-data">
<table class="normal">
......
{strip}
{if $heading ne 'n'}
{if $showItemId ne 'n'}
{assign var='comma' value='y'}
{$delimitorL}itemId{$delimitorR}
{/if}
{if $showStatus ne 'n'}
{if $comma eq 'y'}{$separator}{else}{assign var='comma' value='y'}{/if}
{$delimitorL}status{$delimitorR}
{/if}
{if $showCreated ne 'n'}
{if $comma eq 'y'}{$separator}{else}{assign var='comma' value='y'}{/if}
{$delimitorL}created{$delimitorR}
{/if}
{if $showLastModif ne 'n'}
{if $comma eq 'y'}{$separator}{else}{assign var='comma' value='y'}{/if}
{$delimitorL}lastModif{$delimitorR}
{/if}
{if !empty($listfields)}
{if $comma eq 'y'}{$separator}{else}{assign var='comma' value='y'}{/if}
{foreach item=field key=fieldId from=$listfields name=list}
{$delimitorL}{$field.name} -- {$fieldId}{$delimitorR}
{if !$smarty.foreach.list.last}{$separator}{/if}
{/foreach}
{/if}
{assign var='comma' value='n'}
{/strip}
{strip}
{/if}
{foreach from=$items item=item}
{assign var='comma' value='n'}
{if $showItemId ne 'n'}
{assign var='comma' value='y'}
{$delimitorL}{$item.itemId}{$delimitorR}
{/if}
{if $showStatus eq 'y'}
{if $comma eq 'y'}{$separator}{else}{assign var='comma' value='y'}{/if}
{$delimitorL}{$item.status}{$delimitorR}
{/if}
{if $showCreated ne 'n'}
{if $comma eq 'y'}{$separator}{else}{assign var='comma' value='y'}{/if}
{$delimitorL}{$item.created|tiki_short_datetime}{$delimitorR}
{/if}
{if $showLastModif ne 'n'}
{if $comma eq 'y'}{$separator}{else}{assign var='comma' value='y'}{/if}
{$delimitorL}{$item.lastModif|tiki_short_datetime}{$delimitorR}
{/if}
{if !empty($listfields)}
{if $comma eq 'y'}{$separator}{else}{assign var='comma' value='y'}{/if}
{foreach item=field_value from=$item.field_values name=list}
{if $field_value.isHidden ne 'c' or $item.creator eq $user or $tiki_p_admin_trackers eq 'y'}
{capture name="line"}{include file="tracker_item_field_value.tpl" list_mode='csv' showlinks='n'}{/capture}{$delimitorL}{$smarty.capture.line|replace:"\r\n":"`$CR`"|replace:"\n":"`$CR`"|replace:"<br />":"`$CR`"|replace:"`$delimitorL`":"`$delimitorL``$delimitorL`"|replace:"`$delimitorR`":"`$delimitorR``$delimitorR`"}{$delimitorR}
{else}
{$delimitorL}{$delimitorR}
{/if}
{if !$smarty.foreach.list.last}{$separator}{/if}
{/foreach}
{/if}
{/strip}
{/foreach}
\ No newline at end of file
{* $Id$ *}
<h2>{tr}Export Tracker Items{/tr}</h2>
<form action="tiki-view_tracker.php?trackerId={$trackerId}&cookietab=3" method="post">
<table class="normal">
<tr class="formcolor">
<td><label for="tracker">{tr}Tracker{/tr}</label></td>
<td>
<select name="trackerId" onchange="this.form.submit();" id="tracker">
{foreach from=$trackers item=tracker}
<option value="{$tracker.trackerId}" title="{$tracker.description|escape}"{if $tracker.trackerId eq $trackerId} selected="selected"{/if}>
{$tracker.name|escape}
</option>
{/foreach}
</select>
</td>
</tr>
</table>
</form>
<form action="tiki-export_tracker.php" method="post">
<table class="normal">
<tr class="formcolor">
<td>{tr}File{/tr}</td>
<td>{tr}Tracker{/tr}_{$trackerId}.csv</td>
</tr>
<tr class="formcolor">
<td><label for="encoding">{tr}Charset encoding{/tr}</label></td>
<td><select name="encoding" id="emcoding"><option value="UTF-8" selected="selected">{tr}UTF-8{/tr}</option><option value="ISO-8859-1">{tr}ISO-8859-1{/tr}</option></select></td>
</tr>
<tr class="formcolor">
<td><label for="separator">{tr}Separator{/tr}</label></td>
<td><input type="text" name="separator" id="separator" value="," /></td>
</tr>
<tr class="formcolor">
<td><label for="delimitorL">{tr}Delimitors{/tr}</label></td>
<td><input type="text" name="delimitorL" id="delimitorL" value='"' /><input type="text" name="delimitorR" value='"' /></td>
</tr>
<tr class="formcolor">
<td><label for="CR">{tr}Carriage Return inside Field Value{/tr}</label></td>
<td><input type="text" name="CR" id="CR" value='%%%' /></td>
</tr>
<tr class="formcolor">
<td><label for="parse">{tr}Parse as Wiki Text{/tr}</label></td>
<td><input type="checkbox" name="parse" id="parse" /></td>
</tr>
<tr class="formcolor">
<td>{tr}Info{/tr}</td>
<td>
<input name="showItemId" id="showItemId" type="checkbox" checked="checked" /><label for="showItemId">{tr}itemId{/tr}</label>
<br /><input type="checkbox" name="showStatus" id="showStatus"{if $info.showStatus eq 'y'} checked="checked"{/if} /><label for="showStatus">{tr}status{/tr}</label>
<br /><input type="checkbox" name="showCreated" id="showCreated"{if $info.showCreated eq 'y'} checked="checked"{/if} /><label for="showCreated">{tr}created{/tr}</label>
<br /><input type="checkbox" name="showLastModif" id="showLastModif"{if $info.showLastModif eq 'y'} checked="checked"{/if} /><label for="lastModif">{tr}lastModif{/tr}</label>
</td>
</tr>
<tr class="formcolor">
<td>{tr}Fields{/tr}</td>
<td>
<input type="radio" name="which" id="list" value="list"/> <label for="list">{tr}Fields visible in items list{/tr}</label>
<br /><input type="radio" name="which" id="ls" value="ls"/> <label for="ls">{tr}Fields searchable or visible in items list{/tr}</label>
<br /><input type="radio" name="which" id="item" value="item"/> <label for="item">{tr}Fields visible in an item view{/tr}</label>
<br /><input type="radio" name="which" id="all" value="all" checked="checked"/> <label for="all">{tr}All fields{/tr}</label>
<br /><input type="radio" name="which" id="these" value="these"> <label for="these">{tr}These fields{/tr}</label>
<select multiple="multiple" name="listfields[]" id="listfields">
{foreach from=$fields item=ix}
{if ($ix.isHidden eq 'n' or $ix.isHidden eq 'c' or $ix.isHidden eq 'p' or $tiki_p_admin_trackers eq 'y') and $ix.type ne 'x' and $ix.type ne 'h' and ($ix.type ne 'p' or $ix.options_array[0] ne 'password') and (empty($ix.visibleBy) or in_array($default_group, $ix.visibleBy) or $tiki_p_admin_trackers eq 'y')}
<option value="{$ix.fieldId}">{$ix.name|escape}</option>
{/if}
{/foreach}
</select>
{remarksbox type="tip" title="Tip"}{tr}Use Ctrl+Click to select multiple fields.{/tr}{/remarksbox}
</td>
</tr>
<tr class="formcolor">
<td>{tr}Filter{/tr}</td>
<td>{include file="wiki-plugins/wikiplugin_trackerfilter.tpl" showFieldId="y" inForm="y"}</td></tr>
<tr class="formcolor"><td>&nbsp;</td><td><input type="submit" name="export" value="{tr}Export{/tr}" /></td>
</tr>
</table>
</form>
......@@ -48,7 +48,7 @@
{if !empty($listfields)}
{if $comma eq 'y'}{$separator}{else}{assign var='comma' value='y'}{/if}
{foreach item=field_value from=$item.field_values name=list}
{if $field_value.isHidden ne 'c' or $item.creator eq $user or $tiki_p_admin_trackers eq 'y'}
{if $field_value.isHidden ne 'c' or ($field_value.isHidden eq 'c' and ($item.itemUser eq $user or $tiki_p_admin_trackers eq 'y'))}
{capture name="line"}{include file="tracker_item_field_value.tpl" list_mode='csv' showlinks='n'}{/capture}{$delimitorL}{$smarty.capture.line|replace:"\r\n":"`$CR`"|replace:"\n":"`$CR`"|replace:"<br />":"`$CR`"|replace:"`$delimitorL`":"`$delimitorL``$delimitorL`"|replace:"`$delimitorR`":"`$delimitorR``$delimitorR`"}{$delimitorR}
{else}
{$delimitorL}{$delimitorR}
......
......@@ -75,14 +75,19 @@
{/section}
</div><br />{/if}
{if $prefs.feature_tabs eq 'y'}
{cycle name=tabs values="1,2,3" print=false advance=false reset=true}
{cycle name=tabs values="1,2,3,4" print=false advance=false reset=true}
<div class="tabs">
{if $tiki_p_view_trackers eq 'y' or ($tracker_info.writerCanModify eq 'y' and $user)}
<span id="tab{cycle name=tabs advance=false assign=tabi}{$tabi}" class="tabmark"><a href="javascript:tikitabs({cycle name=tabs},3);">{tr}Tracker Items for{/tr} <i>{$tracker_info.name}</i></a></span>
<span id="tab{cycle name=tabs advance=false assign=tabi}{$tabi}" class="tabmark"><a href="javascript:tikitabs({cycle name=tabs},4);">{tr}Tracker Items for{/tr} <i>{$tracker_info.name}</i></a></span>
{/if}
{if $tiki_p_create_tracker_items eq 'y'}
<span id="tab{cycle name=tabs advance=false assign=tabi}{$tabi}" class="tabmark"><a href="javascript:tikitabs({cycle name=tabs},3);">{tr}Insert New Item{/tr}</a></span>
<span id="tab{cycle name=tabs advance=false assign=tabi}{$tabi}" class="tabmark"><a href="javascript:tikitabs({cycle name=tabs},4);">{tr}Insert New Item{/tr}</a></span>
{/if}
{if $tiki_p_export_tracker eq 'y'}
<span id="tab{cycle name=tabs advance=false assign=tabi}{$tabi}" class="tabmark"><a href="javascript:tikitabs({cycle name=tabs},4);">{tr}Export Tracker Items{/tr}</a></span>
{/if}
</div>
{/if}
......@@ -539,6 +544,15 @@ document.write('<div class="categSelectAll"><input type="checkbox" id="clickall
<br /><em>{tr}Fields marked with a * are mandatory.{/tr}</em>
</div>
{/if}
{* -------------------------------------------------- tab with export --- *}
{if $tiki_p_export_tracker eq 'y'}
<div id="content{cycle name=content assign=focustab}{$focustab}"{if $prefs.feature_tabs eq 'y'} class="tabcontent"{/if}>
{include file=tiki-export_tracker.tpl}
</div>
{/if}
{foreach from=$fields key=ix item=field_value}
{assign var=fid value=$field_value.fieldId}
{if $listfields.$fid.http_request}
......
......@@ -43,7 +43,11 @@ if ($tiki_p_view_trackers != 'y') {
$filters = array();
if (!empty($_REQUEST['listfields'])) {
$filters['fieldId'] = split(',', $_REQUEST['listfields']);
if (is_string($_REQUEST['listfields'])) {
$filters['fieldId'] = split(',', $_REQUEST['listfields']);
} elseif (is_array($_REQUEST['listfields'])) {
$filters['fieldId'] = $_REQUEST['listfields'];
}
} elseif (isset($_REQUEST['which']) && $_REQUEST['which'] == 'ls') {
$filters['or'] = array('isSearchable'=>'y', 'isTblVisible'=>'y');
} elseif (isset($_REQUEST['which']) && $_REQUEST['which'] == 'list') {
......@@ -195,6 +199,6 @@ while (($items = $trklib->list_items($_REQUEST['trackerId'], $offset, $maxRecord
} else
echo $data;
}
if (!empty($fp))
if (!empty($fp)) {
fclose($fp);
?>
}
......@@ -818,6 +818,13 @@ $users = $userlib->list_all_users();
$groups = $userlib->list_all_groups();
$smarty->assign_by_ref('users', $users);
$smarty->assign_by_ref('groups', $groups);
if ($tiki_p_export_tracker) {
$trackers = $tikilib->list_trackers();
$smarty->assign_by_ref('trackers', $trackers['data']);
include_once('lib/wiki-plugins/wikiplugin_trackerfilter.php');
$filters = wikiplugin_trackerFilter_get_filters($_REQUEST['trackerId']);
$smarty->assign_by_ref('filters', $filters);
}
include_once('tiki-section_options.php');
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment