Hi Stijn,
That's the way it used to be, just check the history of the content
object class and revert the methods. Some of it might even still be there.
Best regards,
Hans
On 24/05/2011 10:01, Stijn Van Hoecke wrote:
Hi all!
When reviewing the repository we (hogent) noticed that the version indicator
doesn't quite work... when looking in the code I noticed following code:
[DefaultContentObjectTableCellRenderer]
case ContentObject :: get_version_header() :
if ($content_object instanceof Versionable)
{
if ($content_object->get_id() != $content_object->get_object_number())
{
return '<img src="' . Theme :: get_image_path() . 'versions_multiple.png" alt="' .
Translation :: get('TwoOrMoreVersionsAvailable') . '" title="' . Translation ::
get('OneOrMoreVersionsAvailable') . '" />';
}
else
{
return '<img src="' . Theme :: get_image_path() . 'versions_none.png" alt="' . Translation
:: get('NoVersionsAvailable') . '" title="' . Translation :: get('NoVersionsAvailable') . '" />';
}
}
else
{
return '<img src="' . Theme :: get_image_path() . 'versions_none.png" alt="' . Translation
:: get('NotVersionable') . '" title="' . Translation :: get('NotVersionable') . '" />';
}
So if I read the above code right, the object is marked with versions if the id
differs from the object number.
When I take a look at the database structure, we have 2 tables with autoincrement
(AI) => content_object with AI on id, and content_object_version with AI on
object_number.
Assumed test case:
user 1 creates a CO with ID = 1 and ON (object_number) = 1
user 2 creates a CO with ID = 2 and ON = 2
user 3 creates a CO with ID = 3 and ON = 3
user 1 alters CO with ID = 1, and saves it as a new version => user 1 creates
a CO with ID = 4 and ON = 1
user 1 creates a CO with ID = 5 and ON = 4 (due to AI) IS MARKED AS VERSIONED
user 4 creates a CO with ID = 6 and ON = 5 (due to AI) IS MARKED AS VERSIONED
...
Whenever someone on the platform creates a version, the indication for every
user is wrong.
I have noticed this issue on different platforms, especially when you need to
alter the database due to corrupt files the version indication is lost.
I propose to add a "get_version_count" and "has_versions" function to the
content object, that actually counts the occurrence of the object and returns the exact number
(that can be set as comment), and determines if there are versions.
This way you can be sure you always have the correct indication, and there is
no check for equality in numbers.
If there are any remarks, please let us know!
Kind regards
Stijn Van Hoecke
Hogent
_______________________________________________
Dev mailing list
Dev@lists.chamilo.org
http://lists.chamilo.org/listinfo/dev
--
*Hans De Bisschop*
Adviseur | Lead Developer Chamilo 2.0
Software Coordinator Chamilo Association
Erasmushogeschool Brussel
Nijverheidskaai 170 | B-1070 Brussel
T 02 559 02 54 | i 254
hans.de.bissc...@ehb.be <mailto:hans.de.bissc...@ehb.be> |
www.erasmushogeschool.be <http://www.erasmushogeschool.be/>
Kom eens langs: www.erasmushogeschool.be/infodagen
<http://www.erasmushogeschool.be/infodagen>
of lees onze elektronische nieuwsbrief: ehbrief.ehb.be
<http://ehbrief.ehb.be/>
P Before printing, think about the environment
_______________________________________________
Dev mailing list
Dev@lists.chamilo.org
http://lists.chamilo.org/listinfo/dev