tiki-history_sheets.php 2.7 KB
Newer Older
1
<?php
2
// (c) Copyright 2002-2015 by authors of the Tiki Wiki CMS Groupware Project
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
$tiki_sheet_div_style = '';
9
require_once ('tiki-setup.php');
10 11 12

$sheetlib = TikiLib::lib("sheet");

13 14 15 16 17
$auto_query_args = array(
	'sheetId',
	'idx_0',
	'idx_1'
);
18
$access->check_feature('feature_sheet');
19

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

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

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

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

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

$cookietab = 1;

$sheetlib->setup_jquery_sheet();
61
$headerlib->add_jq_onready(
62
	"
63
	$.sheet.tikiOptions = $.extend($.sheet.tikiOptions, {
64
		editable: false
65
	});
66

67
	jST = $('div.tiki_sheet')
68 69 70
		.sheet($.sheet.tikiOptions)
		.bind('paneScroll', $.sheet.paneScrollLocker)
		.bind('switchSheet', $.sheet.switchSheetLocker);
71

72
	$.sheet.setValuesForCompareSheet('$sheetIndexes[0]', $('input.compareSheet1'), '$sheetIndexes[1]', $('input.compareSheet2'));
73

74 75 76 77 78
	$('#go_fullscreen').toggle(function() {
		$.sheet.dualFullScreenHelper($('#tiki_sheet_container').parent());
	}, function() {
		$.sheet.dualFullScreenHelper($('#tiki_sheet_container').parent(), true);
	});
79 80
", 500
);
81 82

if ( $tiki_sheet_div_style) {
83
	$smarty->assign('tiki_sheet_div_style', $tiki_sheet_div_style);
84
}
85

86 87 88 89 90
include_once ('tiki-section_options.php');
ask_ticket('sheet');

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

91
// Display the template
92
$smarty->assign('mid', 'tiki-history_sheets.tpl');
93
$smarty->display("tiki.tpl");