Commit f654b3e5 authored by RobertPlummer's avatar RobertPlummer

[FIX] Tons for fixes for sheet

[MOD] Moved all functionality from tiki-history_sheets.js to grid.js
[MOD] In tiki-sheets.tpl, I changed Edit #1 to "Config", so now we can edit and configure sheets
[MOD] A few title changes to make it easier for end users
parent 484cc625
......@@ -2673,7 +2673,6 @@ lib/sheet/ole/pps.php -text
lib/sheet/ole/pps/file.php -text
lib/sheet/ole/pps/index.php -text
lib/sheet/ole/pps/root.php -text
lib/sheet/tiki-history_sheets.js -text
lib/shipping/FedEx_v8.wsdl -text
lib/shipping/provider_fedex.php -text
lib/shipping/provider_ups.php -text
......
This diff is collapsed.
......@@ -2351,18 +2351,16 @@ class SheetLib extends TikiLib
}
}
function setup_jquery_sheet_history() {
global $headerlib;
$this->setup_jquery_sheet();
if (!$this->setup_jQuery_sheet_history_files) {
$headerlib->add_jsfile( 'lib/sheet/tiki-history_sheets.js' );
$this->setup_jQuery_sheet_history_files = true;
}
}
function sheet_history( $sheetId ) {
return $this->fetchAll( "SELECT DISTINCT `begin` as stamp, `user`, DATE_FORMAT(FROM_UNIXTIME(`begin`), '%M %D %Y %h:%i:%s') as prettystamp FROM `tiki_sheet_values` WHERE `sheetId` = ? ORDER BY begin DESC", array( $sheetId ) );
return $this->fetchAll( "
SELECT DISTINCT
`tiki_sheet_values`.`begin` as stamp,
`tiki_sheet_values`.`user`,
DATE_FORMAT(FROM_UNIXTIME(`tiki_sheet_values`.`begin`), '%M %D %Y %h:%i:%s') as prettystamp
FROM `tiki_sheet_values`
INNER JOIN `tiki_sheets` ON `tiki_sheets`.`sheetId` = `tiki_sheet_values`.`sheetId`
WHERE `tiki_sheets`.`sheetId` = ? OR `tiki_sheets`.`parentSheetId` = ?
ORDER BY begin DESC", array( $sheetId, $sheetId ) );
}
function rollback_sheet($id, $readdate=null) {
......@@ -2601,7 +2599,7 @@ class SheetLib extends TikiLib
function diff_sheets_as_html( $id, $dates = null )
{
global $prefs, $sheetlib;
function count_longest( $array1, $array2 )
{
return (count($array1) > count($array2) ? count($array1) : count($array2));
......@@ -2678,8 +2676,8 @@ class SheetLib extends TikiLib
return $result;
}
$grids1 = join_with_sub_grids($_REQUEST["sheetId"], $dates[0]);
$grids2 = join_with_sub_grids($_REQUEST["sheetId"], $dates[1]);
$grids1 = join_with_sub_grids($id, $dates[0]);
$grids2 = join_with_sub_grids($id, $dates[1]);
for ( $i = 0; $i < count_longest($grids1, $grids2); $i++ ) { //cycle through the sheets within a spreadsheet
$result1 .= "<table title='".$grids1[$i]->getTitle()."'>";
......
// (c) Copyright 2002-2010 by authors of the Tiki Wiki/CMS/Groupware Project
//
// 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.
// $Id$:
function compareSheetsSubmitClick(o) {
var sheetId = $('#sheetId').val();
var sheetReadDates = 'idx_0=' + $('input.compareSheet1:checked').val() + '&idx_1=' + $('input.compareSheet2:checked').val() + '&';
window.location = "tiki-history_sheets.php?sheetId=" + sheetId + "&" + sheetReadDates;
return false;
}
function compareSheetClick() {
var set1 = $("input.compareSheet1");
var set2 = $("input.compareSheet2");
var checked1 = $("input.compareSheet1:checked");
var checked2 = $("input.compareSheet2:checked");
var set = set1.add(set2);
set.removeAttr('disabled');
function disable(obj1, objIndex, obj2, after) {
for (var i = (after ? obj1.index(objIndex) + 1 : 0); i < (after ? obj1.length : obj1.index(objIndex)); i++) {
obj2.eq(i).attr('disabled', 'true');
}
}
disable(set1, checked1, set2, true);
disable(set2, checked2, set1);
}
function setValuesForCompareSheet(value1, value2) {
value1 = (value1 ? ":eq(" + value1 + ")" : ":first");
value2 = (value2 ? ":eq(" + value2 + ")" : ":last");
$("input.compareSheet1").filter(value1).click();
$("input.compareSheet2").filter(value2).click();
compareSheetClick();
}
function dualFullScreenHelper(reset) {
var tikiSheets = $('div.tiki_sheet');
$($.sheet.instance).each(function(i) {
var jS = this;
var tikiSheet = tikiSheets.eq(i);
if (!reset) {
jS.sizeOriginal = {
height: tikiSheet.height(),
width: tikiSheet.width()
};
jS.s.width = tikiSheet.parent().width();
jS.s.height = $(window).height();
tikiSheet.siblings().each(function() {
jS.s.height -= $(this).height();
});
$('#tiki_sheet_container').siblings().each(function() {
jS.s.height -= $(this).height();
});
} else {
jS.s.width = jS.sizeOriginal.width;
jS.s.height = jS.sizeOriginal.height;
}
this.sheetSyncSize();
});
}
$(function () {
$('#go_fullscreen').toggle(function() {
var parent = $(this).parent().parent();
$('<div id="tiki_sheet_container_fullscreen" style="left: 0px; top: 0px; z-index: 99999; background-color: white;" parentId="' + parent.attr('id') + '" />')
.css('position', 'absolute')
.width($(window).width())
.height($(window).height())
.html(parent.children())
.prependTo($('body'));
dualFullScreenHelper();
}, function() {
var parent = $(this).parent().parent();
var parentId = parent.attr('parentId');
$('#' + parentId)
.html(parent.children());
parent.remove();
dualFullScreenHelper(true);
});
});
\ No newline at end of file
......@@ -4,75 +4,79 @@
<div>
{$description}
</div>
{tabset}
{if not $grid_content eq ''}
{tab name="{tr}View{/tr}"}
<table style="width: 100%;" id="tiki_sheet_container">
<form>
{tabset}
{if not $grid_content eq ''}
{tab name="{tr}View{/tr}"}
<table style="width: 100%;" id="tiki_sheet_container">
<tr>
<td>
{pagination_links cant=$ver_cant itemname="{tr}Sheet{/tr}" offset_arg="idx_0" offset="`$sheetIndexes[0]`" show_numbers=n}{/pagination_links}
</td>
<td>
{pagination_links cant=$ver_cant itemname="{tr}Sheet{/tr}" offset_arg="idx_1" offset="`$sheetIndexes[1]`" show_numbers=n}{/pagination_links}
</td>
</tr>
<tr>
{section name=date loop=$grid_content}
<td style="width: 50%;">
<div style="font-size: 1.5em; text-align: center;">
Revision: {$history[$smarty.section.date.index].prettystamp}
</div>
<div class="tiki_sheet" {if !empty($tiki_sheet_div_style)} style="{$tiki_sheet_div_style}"{/if}>
{$grid_content[$smarty.section.date.index]}
</div>
<div style="text-align: center;">
{button href="tiki-view_sheets.php?sheetId=$sheetId&readdate=`$history[$smarty.section.date.index].stamp`&parse=y" class="view_button" _text="{tr}View{/tr}" _htmlelement="role_main" _title="{tr}View{/tr}"}
{button href="tiki-view_sheets.php?sheetId=$sheetId&readdate=`$history[$smarty.section.date.index].stamp`&parse=clone" class="clone_button" _text="{tr}Clone{/tr}" _htmlelement="role_main" _title="{tr}Clone{/tr}"}
{button href="tiki-view_sheets.php?sheetId=$sheetId&readdate=`$history[$smarty.section.date.index].stamp`&parse=rollback" class="rollback_button" _text="{tr}Rollback{/tr}" _htmlelement="role_main" _title="{tr}Rollback{/tr}"}
</div>
</td>
{/section}
</tr>
</table>
<div class="navbar" style="text-align: center;">
{button _id="go_fullscreen" _text="{tr}Toggle Full Screen{/tr}"}
</div>
{/tab}
{/if}
{tab name="{tr}Date Selection{/tr}"}
<table style="width: 100%;">
<tr>
<td>
{pagination_links cant=$ver_cant itemname="{tr}Sheet{/tr}" offset_arg="idx_0" offset="`$sheetIndexes[0]`" show_numbers=n}{/pagination_links}
</td>
<td>
{pagination_links cant=$ver_cant itemname="{tr}Sheet{/tr}" offset_arg="idx_1" offset="`$sheetIndexes[1]`" show_numbers=n}{/pagination_links}
</td>
<th>{tr}Edit Date{/tr}</th>
<th>{tr}User{/tr}</th>
<th>{tr}Actions{/tr}</th>
<th colspan="2">
<input type="hidden" name="sheetId" id="sheetId" value="{$sheetId}" />
<input type="submit" id="compareSheetsSubmit" value="compare" return false;" />
</th>
</tr>
<tr>
{section name=date loop=$grid_content}
<td style="width: 50%;">
<div style="font-size: 1.5em; text-align: center;">Revision: {$datesFormatted[$smarty.section.date.index]}</div>
<div class="tiki_sheet" {if !empty($tiki_sheet_div_style)} style="{$tiki_sheet_div_style}"{/if}>
{$grid_content[$smarty.section.date.index]}
</div>
<div style="text-align: center;">
{button href="tiki-view_sheets.php?sheetId=$sheetId&readdate=`$history[$smarty.section.date.index].stamp`&parse=y" class="view_button" _text="{tr}View{/tr}" _htmlelement="role_main" _title="{tr}View{/tr}"}
{button href="tiki-view_sheets.php?sheetId=$sheetId&readdate=`$history[$smarty.section.date.index].stamp`&parse=clone" class="clone_button" _text="{tr}Clone{/tr}" _htmlelement="role_main" _title="{tr}Clone{/tr}"}
{button href="tiki-view_sheets.php?sheetId=$sheetId&readdate=`$history[$smarty.section.date.index].stamp`&parse=rollback" class="rollback_button" _text="{tr}Rollback{/tr}" _htmlelement="role_main" _title="{tr}Rollback{/tr}"}
</div>
{section name=revision_date loop=$history}
<tr>
<td>
{$history[revision_date].prettystamp}
</td>
{/section}
</tr>
<td>
{$history[revision_date].user}
</td>
<td style="text-align: center;">
<a href="tiki-view_sheets.php?sheetId={$sheetId}&readdate={$history[revision_date].stamp}&parse=y" title="{tr}View Spreadsheet{/tr}">{tr}View{/tr}</a> |
<a href="tiki-view_sheets.php?sheetId={$sheetId}&readdate={$history[revision_date].stamp}&parse=clone" title="{tr}Clone Spreadsheet{/tr}">{tr}Clone{/tr}</a> |
<a href="tiki-view_sheets.php?sheetId={$sheetId}&readdate={$history[revision_date].stamp}&parse=rollback" title="{tr}Roll Back Spreadsheet{/tr}">{tr}Roll-Back{/tr}</a>
</td>
<td style="vertical-align: middle; text-align: center;">
<input type="radio" name="idx_0" class="compareSheet1" value="{$smarty.section.revision_date.index}" onclick="$.sheet.compareSheetClick($('input.compareSheet1'), $('input.compareSheet2'));" />
</td>
<td style="vertical-align: middle; text-align: center;">
<input type="radio" name="idx_1" class="compareSheet2" value="{$smarty.section.revision_date.index}" onclick="$.sheet.compareSheetClick($('input.compareSheet1'), $('input.compareSheet2'));" />
</td>
</tr>
{/section}
</table>
<div class="navbar" style="text-align: center;">
{button _id="go_fullscreen" _text="{tr}Toggle Full Screen{/tr}"}
</div>
{/tab}
{/if}
{tab name="{tr}Date Selection{/tr}"}
<table style="width: 100%;">
<tr>
<th>{tr}Edit Date{/tr}</th>
<th>{tr}User{/tr}</th>
<th colspan="2">
<input type="hidden" id="sheetId" value="{$sheetId}" />
<input type="button" id="compareSheetsSubmit" value="compare" onclick="compareSheetsSubmitClick(this); return false;" />
</th>
<th>{tr}Actions{/tr}</th>
</tr>
{section name=revision_date loop=$history}
<tr>
<td>
{$history[revision_date].prettystamp}
</td>
<td>
{$history[revision_date].user}
</td>
<td style="vertical-align: middle; text-align: center;">
<input type="radio" name="compareSheet1" class="compareSheet1" value="{$smarty.section.revision_date.index}" onclick="compareSheetClick(this);" />
</td>
<td style="vertical-align: middle; text-align: center;">
<input type="radio" name="compareSheet2" class="compareSheet2" value="{$smarty.section.revision_date.index}" onclick="compareSheetClick(this);" />
</td>
<td style="text-align: center;">
<a href="tiki-view_sheets.php?sheetId={$sheetId}&readdate={$history[revision_date].stamp}&parse=y" title="{tr}View Spreadsheet{/tr}">{tr}View{/tr}</a> |
<a href="tiki-view_sheets.php?sheetId={$sheetId}&readdate={$history[revision_date].stamp}&parse=clone" title="{tr}Clone Spreadsheet{/tr}">{tr}Clone{/tr}</a> |
<a href="tiki-view_sheets.php?sheetId={$sheetId}&readdate={$history[revision_date].stamp}&parse=rollback" title="{tr}Roll Back Spreadsheet{/tr}">{tr}Roll-Back{/tr}</a>
</td>
</tr>
{/section}
</table>
{/tab}
{/tabset}
\ No newline at end of file
{/tabset}
</form>
\ No newline at end of file
......@@ -52,7 +52,7 @@
{/if}
{if $sheets[changes].tiki_p_edit_sheet eq 'y'}
<a class="gallink" href="tiki-sheets.php?offset={$offset}&amp;sort_mode={$sort_mode}&amp;edit_mode=1&amp;sheetId={$sheets[changes].sheetId}">
{icon _id='page_edit' alt="{tr}Edit{/tr}"}
{icon _id='page_edit' alt="{tr}Configure{/tr}"}
</a>
<a class="gallink" href="tiki-sheets.php?offset={$offset}&amp;sort_mode={$sort_mode}&amp;removesheet=y&amp;sheetId={$sheets[changes].sheetId}">
{icon _id='cross' alt="{tr}Delete{/tr}"}
......@@ -69,12 +69,12 @@
{/tab}
{if $tiki_p_edit_sheet eq 'y'}
{capture name=title}{if $sheetId eq 0}{tr}Create{/tr}{else}{tr}Edit{/tr}{/if}{/capture}
{capture name=title}{if $sheetId eq 0}{tr}Create{/tr}{else}{tr}Configure{/tr}{/if}{/capture}
{tab name=$smarty.capture.title}
{if $sheetId eq 0}
<h2>{tr}Create a sheet{/tr}</h2>
{else}
<h2>{tr}Edit this sheet:{/tr} {$title}</h2>
<h2>{tr}Configure this sheet:{/tr} {$title}</h2>
{if $tiki_p_edit_sheet eq 'y'}
<div class="navbar">
{button href="tiki-sheets.php?edit_mode=1&amp;sheetId=0" _text="{tr}Create New Sheet{/tr}"}
......@@ -107,14 +107,14 @@
</td>
</tr>
<tr>
<td>{tr}Parent SheetId:{/tr}</td>
<td>{tr}Join with Spreadsheet:{/tr}</td>
<td>
<select name="parentSheetId">
<option value="">{tr}None{/tr}</option>
{section name=sheet loop=$sheets}
{if $sheets[sheet].parentSheetId eq '0'}
{if not $sheets[sheet].parentSheetId}
<option value="{$sheets[sheet].sheetId}"{if $parentSheetId eq $sheets[sheet].sheetId} selected="selected"{/if}>
{$sheets[sheet].title|escape}
{$sheets[sheet].title|escape} - ({$sheets[sheet].sheetId})
</option>
{/if}
{/section}
......
......@@ -16,8 +16,6 @@ $auto_query_args = array(
);
$access->check_feature('feature_sheet');
$sheetlib->setup_jquery_sheet_history();
$info = $sheetlib->get_sheet_info( $_REQUEST['sheetId'] );
if (empty($info)) {
$smarty->assign('Incorrect parameter');
......@@ -47,52 +45,40 @@ if ( isset($_REQUEST['idx_0']) ) {
$sheetIndexes[0] = 1; //this sets defalut for initial page load
}
if ( isset($_REQUEST['idx_1']) ) {
$sheetIndexes[1] = $_REQUEST['idx_1'];
$sheetIndexes[1] = $_REQUEST['idx_1'];
} else {
$sheetIndexes[1] = 0; //this sets defalut for initial page load
}
//display the history picker if no sheets are defined
if ( count($sheetIndexes) > 1 ) {
$dates = array();
$datesFormatted = array();
$smarty->assign_by_ref( 'sheetIndexes', $sheetIndexes );
$j = 0;
foreach( $sheetIndexes as $i ) {
$dates[$j] = $history[(int)$i]['stamp'];
$datesFormatted[$j] = date("F j, Y, g:i a", strftime($dates[$j]));
$j++;
}
// for revision info
$smarty->assign( 'datesFormatted' , $datesFormatted );
$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, {
editable: false,
fnPaneScroll: $.sheet.paneScrollLocker,
fnSwitchSheet: $.sheet.switchSheetLocker
});
// for pagination
$smarty->assign( 'ver_cant' , count($history) );
//$paginate = (isset($_REQUEST['paginate']) && $_REQUEST['paginate'] == 'on');
//$smarty->assign('paginate', $paginate);
$smarty->assign( 'grid_content', $sheetlib->diff_sheets_as_html($_REQUEST["sheetId"], $dates) );
$('div.tiki_sheet').each(function() {
$(this).sheet($.sheet.tikiOptions);
});
$cookietab = 1;
$headerlib->add_jq_onready("
$.sheet.tikiOptions = $.extend($.sheet.tikiOptions, {
editable: false,
fnPaneScroll: $.sheet.paneScrollLocker,
fnSwitchSheet: $.sheet.switchSheetLocker
});
$('div.tiki_sheet').each(function() {
$(this).sheet($.sheet.tikiOptions);
});
setValuesForCompareSheet('$sheetIndexes[0]','$sheetIndexes[1]');
", 500);
$.sheet.setValuesForCompareSheet('$sheetIndexes[0]', $('input.compareSheet1'), '$sheetIndexes[1]', $('input.compareSheet2'));
if ( $tiki_sheet_div_style) {
$smarty->assign('tiki_sheet_div_style', $tiki_sheet_div_style);
}
$('#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);
}
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