Author: sevein
Date: Sat Jun 9 15:21:48 2012
New Revision: 11754
Log:
Fix logic that calculates the number of items being shown in the treeview below
and above the active record
Modified:
branches/2.0/apps/qubit/modules/informationobject/actions/treeViewComponent.class.php
Modified:
branches/2.0/apps/qubit/modules/informationobject/actions/treeViewComponent.class.php
==============================================================================
---
branches/2.0/apps/qubit/modules/informationobject/actions/treeViewComponent.class.php
Sat Jun 9 00:02:51 2012 (r11753)
+++
branches/2.0/apps/qubit/modules/informationobject/actions/treeViewComponent.class.php
Sat Jun 9 15:21:48 2012 (r11754)
@@ -119,22 +119,51 @@
return $array;
}
- if (floor(self::SIBLINGS / 2) > floor($nextSiblingsCount))
+ // Half part of total of siblings to be shown
+ $half = floor(self::SIBLINGS / 2);
+
+ // Calculate number of items to slice from prevSiblings
+ if ($prevSiblingsCount < self::SIBLINGS)
{
- $prevSiblingsSlice = $nextSiblingsCount;
+ $prevSiblingsSlice = $prevSiblingsCount - $half;
+
+ if ($prevSiblingsSlice < 0)
+ {
+ $prevSiblingsSlice = 0;
+ }
}
- else
+ else if ($prevSiblingsCount == self::SIBLINGS)
{
- $prevSiblingsSlice = floor(self::SIBLINGS / 2);
+ if ($nextSiblingsCount < $half)
+ {
+ $prevSiblingsSlice = $nextSiblingsCount;
+ }
+ else
+ {
+ $prevSiblingsSlice = $half;
+ }
}
- if (floor(self::SIBLINGS / 2) > floor($prevSiblingsCount))
+ // Calculate number of items to slice from nextSiblings
+ if ($nextSiblingsCount < self::SIBLINGS)
{
- $nextSiblingsSlice = $prevSiblingsCount;
+ $nextSiblingsSlice = $nextSiblingsCount - $half;
+
+ if ($nextSiblingsSlice < 0)
+ {
+ $nextSiblingsSlice = 0;
+ }
}
- else
+ else if ($nextSiblingsCount == self::SIBLINGS)
{
- $nextSiblingsSlice = floor(self::SIBLINGS / 2);
+ if ($prevSiblingsCount < $half)
+ {
+ $nextSiblingsSlice = $prevSiblingsCount;
+ }
+ else
+ {
+ $nextSiblingsSlice = $half;
+ }
}
array_cut('shift', $this->treeview['prevSiblings'], $prevSiblingsSlice);
--
You received this message because you are subscribed to the Google Groups
"Qubit Toolkit Commits" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to
[email protected].
For more options, visit this group at
http://groups.google.com/group/qubit-commits?hl=en.