[Customisation Database Commits] r224 - in /trunk/titania: contributions/ includes/objects/ language/en/ modules/contribs/ styles/default/template/contributions/ styles/default/theme/
Nathan Guse
exreaction at phpbb.com
Tue Jun 16 22:51:45 UTC 2009
Author: exreaction
Date: Tue Jun 16 22:51:44 2009
New Revision: 224
Log:
Yay, contribution details page displays!
Added:
trunk/titania/styles/default/template/contributions/contribution_footer.html
trunk/titania/styles/default/template/contributions/contribution_header.html
Removed:
trunk/titania/styles/default/template/contributions/details_footer.html
trunk/titania/styles/default/template/contributions/details_header.html
Modified:
trunk/titania/contributions/index.php
trunk/titania/includes/objects/author.php
trunk/titania/includes/objects/contribution.php
trunk/titania/language/en/common.php
trunk/titania/modules/contribs/contribs_details.php
trunk/titania/styles/default/template/contributions/contribution_details.html
trunk/titania/styles/default/theme/common.css
Modified: trunk/titania/contributions/index.php
==============================================================================
*** trunk/titania/contributions/index.php (original)
--- trunk/titania/contributions/index.php Tue Jun 16 22:51:44 2009
***************
*** 17,24 ****
include(TITANIA_ROOT . 'common.' . PHP_EXT);
include(TITANIA_ROOT . 'includes/core/modules.' . PHP_EXT);
! $id = request_var('id', '');
! $mode = request_var('mode', '');
// Auto assign some ID's to eliminate the need for id param on most URLs
if (!$id)
--- 17,25 ----
include(TITANIA_ROOT . 'common.' . PHP_EXT);
include(TITANIA_ROOT . 'includes/core/modules.' . PHP_EXT);
! $id = request_var('id', '');
! $mode = request_var('mode', '');
! $contrib_id = request_var('c', '');
// Auto assign some ID's to eliminate the need for id param on most URLs
if (!$id)
***************
*** 48,51 ****
--- 49,58 ----
'body' => $module->get_tpl_name(),
));
+ $template->assign_vars(array(
+ 'U_CONTRIB_DETAILS' => titania_sid('contributions/index', 'c=' . $contrib_id),
+ 'U_CONTRIB_SUPPORT' => titania_sid('contributions/index', 'mode=support&c=' . $contrib_id),
+ 'U_CONTRIB_FAQ' => titania_sid('contributions/index', 'mode=faq&c=' . $contrib_id),
+ ));
+
titania::page_footer();
Modified: trunk/titania/includes/objects/author.php
==============================================================================
*** trunk/titania/includes/objects/author.php (original)
--- trunk/titania/includes/objects/author.php Tue Jun 16 22:51:44 2009
***************
*** 130,135 ****
--- 130,147 ----
}
/**
+ * Get username string
+ *
+ * @param mixed $mode Can be profile (for getting an url to the profile), username (for obtaining the username), colour (for obtaining the user colour), full (for obtaining a html string representing a coloured link to the users profile) or no_profile (the same as full but forcing no profile link)
+ *
+ * @return string username string
+ */
+ public function get_username_string($mode = 'full')
+ {
+ return get_username_string($mode, $this->user_id, $this->username, $this->user_colour);
+ }
+
+ /**
* Get profile url
*
* @return string
Modified: trunk/titania/includes/objects/contribution.php
==============================================================================
*** trunk/titania/includes/objects/contribution.php (original)
--- trunk/titania/includes/objects/contribution.php Tue Jun 16 22:51:44 2009
***************
*** 197,253 ****
*/
public function get_author()
{
! if (!class_exists('titania_author'))
{
! require TITANIA_ROOT . 'includes/objects/author.' . PHP_EXT;
}
! $author = new titania_author($this->contrib_user_id);
! $author->load();
!
! return $author;
! }
!
! /**
! * Get the download as an object
! *
! * @param bool $validated
! *
! * @return titania_download
! */
! public function get_download($validated = true)
! {
! if (!class_exists('titania_download'))
{
! require TITANIA_ROOT . 'includes/objects/download.' . PHP_EXT;
}
! $revision_id = ($validated) ? $this->contrib_validated_revision : $this->contrib_revision;
!
! $download = new titania_download();
! $download->load($revision_id);
!
! return $download;
! }
! /*
! * Get download URL
! *
! * @return string
! */
! public function get_download_url()
! {
! return append_sid(TITANIA_ROOT . 'download/file.' . PHP_EXT, 'contrib_id=' . $this->contrib_id);
}
/**
* Get downloads per day
*
* @return string
*/
public function get_downloads_per_day()
{
! static $day_seconds = 86400; // 24 * 60 * 60
// Cannot calculate anything without release date
// No point in showing this if there were no downloads
--- 197,228 ----
*/
public function get_author()
{
! if ($this->author)
{
! return $this->author;
}
! if (!class_exists('titania_author'))
{
! require TITANIA_ROOT . 'includes/objects/author.' . PHP_EXT;
}
! $this->author = new titania_author($this->contrib_user_id);
! $this->author->load();
! return $this->author;
}
/**
* Get downloads per day
*
* @return string
+ *
+ * @todo Get the oldest revision_id to display this?
*/
public function get_downloads_per_day()
{
! return 0;
// Cannot calculate anything without release date
// No point in showing this if there were no downloads
***************
*** 259,270 ****
$time_elapsed = titania::$time - $this->contrib_release_date;
// The release was just today, show nothing.
! if ($time_elapsed <= $day_seconds)
{
return '';
}
! return sprintf(phpbb::$user->lang['DOWNLOADS_PER_DAY'], $this->contrib_downloads / ($time_elapsed / $day_seconds));
}
/**
--- 234,245 ----
$time_elapsed = titania::$time - $this->contrib_release_date;
// The release was just today, show nothing.
! if ($time_elapsed <= 86400)
{
return '';
}
! return sprintf(phpbb::$user->lang['DOWNLOADS_PER_DAY'], $this->contrib_downloads / ($time_elapsed / 86400));
}
/**
***************
*** 286,291 ****
--- 261,268 ----
* Recommend contribution to a friend
*
* @return bool true if mail sent
+ *
+ * @todo I think this should be moved out from here. Takes up a lot of lines and handling it should be the job of the module
*/
public function email_friend()
{
***************
*** 423,494 ****
}
/**
! * Passes common variables to the template
*
* @return void
*/
! public function assign_common()
{
if (!$this->author)
{
! $this->author = $this->get_author();
! }
!
! if (!$this->download)
! {
! $this->download = $this->get_download();
}
phpbb::$template->assign_vars(array(
- // General urls
- 'U_CONTRIB_DETAILS' => append_sid(titania::$page, array('id' => 'details', 'contrib_id' => $this->contrib_id)),
- 'U_CONTRIB_SUPPORT' => append_sid(titania::$page, array('id' => 'support', 'contrib_id' => $this->contrib_id)),
- 'U_CONTRIB_SCREENSHOTS' => append_sid(titania::$page, array('id' => 'screenshots', 'contrib_id' => $this->contrib_id)),
- 'U_CONTRIB_FAQ' => append_sid(titania::$page, array('id' => 'faq', 'contrib_id' => $this->contrib_id)),
-
- // Contribution data
- 'CONTRIB_TITLE' => $this->contrib_name,
- ));
- }
-
- /**
- * Passes details to the template
- *
- * @return void
- */
- public function assign_details()
- {
- phpbb::$template->assign_vars(array(
// Author data
! 'AUTHOR_NAME' => $this->author->author_username,
! 'AUTHOR_REALNAME' => $this->author->author_realname,
'U_AUTHOR_PROFILE' => $this->author->get_profile_url(),
'U_AUTHOR_PROFILE_PHPBB' => $this->author->get_phpbb_profile_url(),
'U_AUTHOR_PROFILE_PHPBB_COM' => $this->author->get_phpbb_com_profile_url(),
// Contribution data
! 'CONTRIB_DESC' => $this->generate_text_for_display(),
!
! 'CONTRIB_VIEWS' => $this->contrib_views,
! 'CONTRIB_DOWNLOADS' => $this->contrib_downloads, // Total downloads
! 'CONTRIB_DOWNLOADS_PER_DAY' => $this->get_downloads_per_day(),
!
! 'CONTRIB_RATING' => sprintf(phpbb::$user->lang['RATING_OUT_OF_FIVE'], $this->contrib_rating),
! 'CONTRIB_RATINGS' => $this->contrib_rating_count,
!
! 'CONTRIB_VERSION' => $this->contrib_version,
! 'CONTRIB_PHPBB_VERSION' => get_version_string($this->contrib_phpbb_version),
!
! 'CONTRIB_RELEASE_DATE' => phpbb::$user->format_date($this->contrib_release_date),
! 'CONTRIB_UPDATE_DATE' => ($this->contrib_update_date > $this->contrib_release_date) ? phpbb::$user->format_date($this->contrib_update_date) : '',
! 'U_CONTRIB_DOWNLOAD' => $this->get_download_url(),
! // Download data
! 'DOWNLOAD_SIZE' => get_formatted_filesize($this->download->filesize),
! 'DOWNLOAD_CHECKSUM' => $this->download->download_hash,
! 'DOWNLOAD_COUNT' => $this->download->download_count, // Revision downloads
));
if (!phpbb::$user->data['is_bot'])
--- 400,435 ----
}
/**
! * Passes details to the template
*
* @return void
*/
! public function assign_details()
{
if (!$this->author)
{
! $this->get_author();
}
phpbb::$template->assign_vars(array(
// Author data
! 'AUTHOR_NAME' => $this->author->username,
! 'AUTHOR_NAME_FULL' => $this->author->get_username_string(),
! 'AUTHOR_REALNAME' => $this->author->author_realname,
'U_AUTHOR_PROFILE' => $this->author->get_profile_url(),
'U_AUTHOR_PROFILE_PHPBB' => $this->author->get_phpbb_profile_url(),
'U_AUTHOR_PROFILE_PHPBB_COM' => $this->author->get_phpbb_com_profile_url(),
// Contribution data
! 'CONTRIB_TITLE' => $this->contrib_name,
! 'CONTRIB_DESC' => $this->generate_text_for_display(),
! 'CONTRIB_VIEWS' => $this->contrib_views,
! 'CONTRIB_DOWNLOADS' => $this->contrib_downloads,
! 'CONTRIB_RATING' => $this->contrib_rating,
! 'CONTRIB_RATINGS' => $this->contrib_rating_count,
));
if (!phpbb::$user->data['is_bot'])
Modified: trunk/titania/language/en/common.php
==============================================================================
*** trunk/titania/language/en/common.php (original)
--- trunk/titania/language/en/common.php Tue Jun 16 22:51:44 2009
***************
*** 57,62 ****
--- 57,63 ----
'CUSTOMISATION_DATABASE' => 'Customisation Database',
'DESCRIPTION' => 'Description',
+ 'DETAILS' => 'Details',
'DOWNLOAD_ACCESS_DENIED' => 'You are not allowed to download the requested file.',
'DOWNLOAD_NOT_FOUND' => 'The requested file could not be found.',
));
Modified: trunk/titania/modules/contribs/contribs_details.php
==============================================================================
*** trunk/titania/modules/contribs/contribs_details.php (original)
--- trunk/titania/modules/contribs/contribs_details.php Tue Jun 16 22:51:44 2009
***************
*** 87,99 ****
}
}
public function details($contrib_id)
{
titania::load_object('contribution');
$contrib = new titania_contribution($contrib_id);
! $contrib->load();
}
/**
--- 87,108 ----
}
}
+ /**
+ * Display details page
+ *
+ * @param int $contrib_id
+ */
public function details($contrib_id)
{
titania::load_object('contribution');
$contrib = new titania_contribution($contrib_id);
! if (!$contrib->load())
! {
! trigger_error('ERROR_CONTRIB_NOT_FOUND');
! }
+ $contrib->assign_details();
}
/**
Modified: trunk/titania/styles/default/template/contributions/contribution_details.html
==============================================================================
*** trunk/titania/styles/default/template/contributions/contribution_details.html (original)
--- trunk/titania/styles/default/template/contributions/contribution_details.html Tue Jun 16 22:51:44 2009
***************
*** 1,4 ****
! <!-- INCLUDE contributions/details_header.html -->
<h2 class="section-title">{CONTRIB_TITLE} :: {L_DETAILS}</h2>
--- 1,4 ----
! <!-- INCLUDE contributions/contribution_header.html -->
<h2 class="section-title">{CONTRIB_TITLE} :: {L_DETAILS}</h2>
***************
*** 10,29 ****
<td align="left">{CONTRIB_TITLE}</td>
</tr>
<tr>
- <td align="right"><strong>{L_CATEGORY}:</strong></td>
- <td align="left">{CONTRIB_TAGS}</td>
- </tr>
- <tr>
<td align="right"><strong>{L_CONTRIB_AUTHOR}:</strong></td>
! <td align="left"><a href="{U_AUTHOR_PROFILE}">{AUTHOR_NAME}</a><!-- IF AUTHOR_REALNAME --> ({AUTHOR_REALNAME})<!-- ENDIF --></td>
! </tr>
! <tr>
! <td align="right"><strong>{L_VERSION}:</strong></td>
! <td align="left">{CONTRIB_VERSION}</td>
! </tr>
! <tr>
! <td align="right"><strong>{L_PHPBB_VERSION}:</strong></td>
! <td align="left">{CONTRIB_PHPBB_VERSION}</td>
</tr>
</table>
</div>
--- 10,17 ----
<td align="left">{CONTRIB_TITLE}</td>
</tr>
<tr>
<td align="right"><strong>{L_CONTRIB_AUTHOR}:</strong></td>
! <td align="left">{AUTHOR_NAME_FULL}<!-- IF AUTHOR_REALNAME --> ({AUTHOR_REALNAME})<!-- ENDIF --></td>
</tr>
</table>
</div>
***************
*** 77,80 ****
{CONTRIB_DESC}
<!-- ENDIF -->
! <!-- INCLUDE contributions/details_footer.html -->
\ No newline at end of file
--- 65,68 ----
{CONTRIB_DESC}
<!-- ENDIF -->
! <!-- INCLUDE contributions/contribution_footer.html -->
\ No newline at end of file
Added: trunk/titania/styles/default/template/contributions/contribution_footer.html
==============================================================================
*** trunk/titania/styles/default/template/contributions/contribution_footer.html (added)
--- trunk/titania/styles/default/template/contributions/contribution_footer.html Tue Jun 16 22:51:44 2009
***************
*** 0 ****
--- 1,12 ----
+ <span class="corners-bottom blue"><span></span></span></div>
+ </div>
+
+ <span class="corners-bottom"><span></span></span>
+ </div>
+ </div>
+
+ </div>
+ </div>
+ <div class="clear"></div>
+
+ <!-- INCLUDE overall_footer.html -->
\ No newline at end of file
Added: trunk/titania/styles/default/template/contributions/contribution_header.html
==============================================================================
*** trunk/titania/styles/default/template/contributions/contribution_header.html (added)
--- trunk/titania/styles/default/template/contributions/contribution_header.html Tue Jun 16 22:51:44 2009
***************
*** 0 ****
--- 1,17 ----
+ <!-- INCLUDE overall_header.html -->
+
+ <div class="main-content">
+ <div class="main-column">
+ <div id="tabs">
+ <ul>
+ <li<!-- IF S_MODE_ID eq 'details' || S_MODE_ID eq 'email' --> class="activetab"<!-- ENDIF -->><a href="{U_CONTRIB_DETAILS}"><span>{L_CONTRIB_DETAILS}</span></a></li>
+ <li<!-- IF S_MODE_ID eq 'support' --> class="activetab"<!-- ENDIF -->><a href="{U_CONTRIB_SUPPORT}"><span>{L_CONTRIB_SUPPORT}</span></a></li>
+ <li<!-- IF S_MODE_ID eq 'faq' --> class="activetab"<!-- ENDIF -->><a href="{U_CONTRIB_FAQ}"><span>{L_CONTRIB_FAQ}</span></a></li>
+ </ul>
+ </div>
+ <div class="bluebg">
+ <div class="inner">
+ <span class="corners-top"><span></span></span>
+
+ <div class="contrib-content">
+ <div class="inner"><span class="corners-top blue"><span></span></span>
\ No newline at end of file
Removed: trunk/titania/styles/default/template/contributions/details_footer.html
==============================================================================
*** trunk/titania/styles/default/template/contributions/details_footer.html (original)
--- trunk/titania/styles/default/template/contributions/details_footer.html (removed)
***************
*** 1,12 ****
- <span class="corners-bottom blue"><span></span></span></div>
- </div>
-
- <span class="corners-bottom"><span></span></span>
- </div>
- </div>
-
- </div>
- </div>
- <div class="clear"></div>
-
- <!-- INCLUDE overall_footer.html -->
\ No newline at end of file
--- 0 ----
Removed: trunk/titania/styles/default/template/contributions/details_header.html
==============================================================================
*** trunk/titania/styles/default/template/contributions/details_header.html (original)
--- trunk/titania/styles/default/template/contributions/details_header.html (removed)
***************
*** 1,19 ****
- <!-- INCLUDE overall_header.html -->
-
- <div class="main-content">
- <!-- INCLUDE contributions/search_box.html -->
- <div class="main-column">
- <div id="tabs">
- <ul>
- <li<!-- IF S_MODE_ID eq 'details' || S_MODE_ID eq 'email' --> class="activetab"<!-- ENDIF -->><a href="{U_CONTRIB_DETAILS}"><span>{L_CONTRIB_DETAILS}</span></a></li>
- <li<!-- IF S_MODE_ID eq 'support' --> class="activetab"<!-- ENDIF -->><a href="{U_CONTRIB_SUPPORT}"><span>{L_CONTRIB_SUPPORT}</span></a></li>
- <li<!-- IF S_MODE_ID eq 'screenshots' --> class="activetab"<!-- ENDIF -->><a href="{U_CONTRIB_SCREENSHOTS}"><span>{L_CONTRIB_SCREENSHOTS}</span></a></li>
- <li<!-- IF S_MODE_ID eq 'faq' --> class="activetab"<!-- ENDIF -->><a href="{U_CONTRIB_FAQ}"><span>{L_CONTRIB_FAQ}</span></a></li>
- </ul>
- </div>
- <div class="bluebg">
- <div class="inner">
- <span class="corners-top"><span></span></span>
-
- <div class="contrib-content">
- <div class="inner"><span class="corners-top blue"><span></span></span>
\ No newline at end of file
--- 0 ----
Modified: trunk/titania/styles/default/theme/common.css
==============================================================================
*** trunk/titania/styles/default/theme/common.css (original)
--- trunk/titania/styles/default/theme/common.css Tue Jun 16 22:51:44 2009
***************
*** 120,127 ****
}
.main-column {
- width: 78%;
- float: right;
margin-left: 1%;
}
--- 120,125 ----
More information about the customisationdb-commits
mailing list