tiki-history_sheets.php 2.74 KB
Newer Older
1
<?php
2
// (c) Copyright 2002-2011 by authors of the Tiki Wiki CMS Groupware Project
changi67's avatar
changi67 committed
3
// 
4 5
// All Rights Reserved. See copyright.txt for details and a complete list of authors.
// Licensed under the GNU LESSER GENERAL PUBLIC LICENSE. See license.txt for details.
changi67's avatar
changi67 committed
6
// $Id$
7

8
$section = 'sheet';
9
$tiki_sheet_div_style = '';
10 11
require_once ('tiki-setup.php');
require_once ('lib/sheet/grid.php');
12 13 14 15 16
$auto_query_args = array(
	'sheetId',
	'idx_0',
	'idx_1'
);
17
$access->check_feature('feature_sheet');
18

19 20 21 22 23 24
$info = $sheetlib->get_sheet_info( $_REQUEST['sheetId'] );
if (empty($info)) {
	$smarty->assign('Incorrect parameter');
	$smarty->display('error.tpl');
	die;
}	
25

26 27 28 29
$objectperms = Perms::get( 'sheet', $_REQUEST['sheetId'] );
if ($tiki_p_admin != 'y' && !$objectperms->view_sheet && !($user && $info['author'] == $user)) {
	$smarty->assign('msg', tra('Permission denied'));
	$smarty->display('error.tpl');
30 31
	die;
}
32
$smarty->assign('objectperms', $objectperms);
33
$smarty->assign('sheetId', $_REQUEST["sheetId"]);
34 35 36
$smarty->assign('title', $info['title']);
$smarty->assign('description', $info['description']);
$smarty->assign('page_mode', 'view' );
37

38
$history = $sheetlib->sheet_history( $_REQUEST['sheetId'] );
39
$smarty->assign_by_ref( 'history', $history );
40

41
$sheetIndexes = array();
42 43 44 45 46 47
if ( isset($_REQUEST['idx_0']) ) {
	$sheetIndexes[0] = $_REQUEST['idx_0'];	
} else {
	$sheetIndexes[0] = 1; //this sets defalut for initial page load
}
if ( isset($_REQUEST['idx_1']) ) {
48
	$sheetIndexes[1] = $_REQUEST['idx_1'];
49 50 51
} else {
	$sheetIndexes[1] = 0; //this sets defalut for initial page load
}
52

53 54 55 56 57 58 59 60 61
$smarty->assign_by_ref( 'sheetIndexes', $sheetIndexes );
$smarty->assign( 'ver_cant' , count($history) );
$smarty->assign( 'grid_content', $sheetlib->diff_sheets_as_html($_REQUEST["sheetId"], array($history[$sheetIndexes[0]]['stamp'], $history[$sheetIndexes[1]]['stamp'])) );

$cookietab = 1;

$sheetlib->setup_jquery_sheet();
$headerlib->add_jq_onready("
	$.sheet.tikiOptions = $.extend($.sheet.tikiOptions, {
62
		editable: false
63
	});
64
	
65 66 67 68
	$('div.tiki_sheet')
		.sheet($.sheet.tikiOptions)
		.bind('paneScroll', $.sheet.paneScrollLocker)
		.bind('switchSheet', $.sheet.switchSheetLocker);
69
	
70
	$.sheet.setValuesForCompareSheet('$sheetIndexes[0]', $('input.compareSheet1'), '$sheetIndexes[1]', $('input.compareSheet2'));
71
	
72 73 74 75 76 77 78 79 80
	$('#go_fullscreen').toggle(function() {
		$.sheet.dualFullScreenHelper($('#tiki_sheet_container').parent());
	}, function() {
		$.sheet.dualFullScreenHelper($('#tiki_sheet_container').parent(), true);
	});
", 500);

if ( $tiki_sheet_div_style) {
	$smarty->assign('tiki_sheet_div_style',  $tiki_sheet_div_style);
81
}
82

83 84 85 86 87
include_once ('tiki-section_options.php');
ask_ticket('sheet');

$smarty->assign('lock', true);

88
// Display the template
89
$smarty->assign('mid', 'tiki-history_sheets.tpl');
90
$smarty->display("tiki.tpl");