Mercurial > repos > phpBB-MODs > User_Rank_Progression_Bar
view install.xml @ 25:f78df71952a4 default tip
Added tag 1.0.1 for changeset 0015bde97600
author | IBBoard <dev@ibboard.co.uk> |
---|---|
date | Sat, 08 Oct 2011 16:44:59 +0100 |
parents | 706b0d6c2ba1 |
children |
line wrap: on
line source
<?xml version="1.0" encoding="utf-8" standalone="yes"?> <?xml-stylesheet type="text/xsl" href="modx.prosilver.en.xsl"?> <!--For security purposes, please check: http://www.phpbb.com/mods/ for the latest version of this MOD. Although MODs are checked before being allowed in the MODs Database there is no guarantee that there are no security problems within the MOD. No support will be given for MODs not found within the MODs Database which can be found at http://www.phpbb.com/mods/--> <mod xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns="http://www.phpbb.com/mods/xml/modx-1.2.5.xsd"> <header> <license>http://opensource.org/licenses/gpl-license.php GNU General Public License v2</license> <title lang="en-gb">User Rank Progression Bar</title> <description lang="en-gb">This MOD will show a progress bar for each user, showing how far they have progressed towards the next rank in a rank set.</description> <author-notes lang="en-gb"><![CDATA[This mod behaves in the same way as Smix's Rank Progress Bar mod, but has been rewritten for efficiency, additional features and compatibility with other mods. Thanks to Smix for writing the original and to youngjediknight for first pointing me to it. The styling used by this mod is entirely arbitrary and was included as an example. You may wish to use different HTML and CSS for your template. If you don't want the progress bar to appear in all of the locations below (e.g. you just want it in a topic but not in PMs, profile view or members list) then just ignore the changes to the relevant template (.html) file. Note: If you are also installing my "Multi-Race Rank Themes" MOD then install the other mod first and then this mod. Because the additional parameter to the get_user_rank function is optional for the Multi-Race Rank Themes mod it must be the last parameter in the list.]]></author-notes> <author-group> <author> <realname>IBBoard</realname> <email>phpbb@ibboard.co.uk</email> <username>IBBoard</username> <homepage>http://www.ibboard.co.uk</homepage> </author> </author-group> <link-group> <link type="template" href="subsilver2.xml" lang="en-gb">subsilver2</link> <link type="contrib" href="contrib/SpecialAndNormalRanksIntegration.xml" lang="en-gb">Special and Normal Ranks MOD integration</link> </link-group> <mod-version>1.0.3</mod-version> <installation> <level>intermediate</level> <time>600</time> <target-version>3.0.9</target-version> </installation> <history> <entry> <date>2011-08-27</date> <rev-version>1.0.3</rev-version> <changelog lang="en-gb"> <change>No major changes (updated target version and fixed contrib)</change> </changelog> </entry> <entry> <date>2010-10-30</date> <rev-version>1.0.2</rev-version> <changelog lang="en-gb"> <change>Change: Add fractions of a percent, as suggested by the phpBB team (1 decimal place)</change> </changelog> </entry> <entry> <date>2010-10-03</date> <rev-version>1.0.1</rev-version> <changelog lang="en-gb"> <change>Fix: Add default value for percentage complete in get_user_rank so that we are more compatible with other MODs</change> <change>Fix: Change order of find in viewtopic.php to fix AutoMOD</change> </changelog> </entry> <entry> <date>2010-08-01</date> <rev-version>1.0</rev-version> <changelog lang="en-gb"> <change>Update to final release</change> <change>Fix: Switch two instructions to correct ordering of code changes in viewtopic.php</change> </changelog> </entry> <entry> <date>2010-07-06</date> <rev-version>0.2.1</rev-version> <changelog lang="en-gb"> <change>Fix additional SubSilver instructions</change> </changelog> </entry> <entry> <date>2009-06-15</date> <rev-version>0.2</rev-version> <changelog lang="en-gb"> <change>Add: Add templating for Memberlist, profiles and PMs</change> <change>Add: Add subsilver2 stylings</change> <change>Fix: Add missing lang value</change> <change>Fix: Add extra checks to progress calculation to handle pre-existing values and the final rank in a scheme</change> </changelog> </entry> <entry> <date>2009-06-03</date> <rev-version>0.1</rev-version> <changelog lang="en-gb"> <change>Initial release - just puts progress bar on viewtopic page</change> </changelog> </entry> </history> </header> <action-group> <open src="includes/functions_display.php"> <edit> <find><![CDATA[* @param string &$rank_img_src the rank image source is stored here after execution]]></find> <action type="after-add"><![CDATA[* @param int &$percent_complete the percentage of the way a user is to the next rank, where -1 means "not applicable"]]></action> </edit> <edit> <find><![CDATA[function get_user_rank($user_rank, $user_posts, &$rank_title, &$rank_img, &$rank_img_src)]]></find> <inline-edit> <inline-find>, &$rank_img_src</inline-find> <inline-action type="after-add">, &$percent_complete = 0</inline-action> </inline-edit> </edit> <edit> <find><![CDATA[ if (!empty($user_rank))]]></find> <action type="before-add"><![CDATA[ if (!is_int($percent_complete) || $percent_complete < 0 || $percent_complete > 100) { $percent_complete = -1; }]]></action> </edit> <edit> <find><![CDATA[ else if ($user_posts !== false) {]]></find> <action type="after-add"><![CDATA[ $next_rank_post_count = -1;]]></action> </edit> <edit> <find><![CDATA[ if ($user_posts >= $rank['rank_min'])]]></find> <action type="before-add"><![CDATA[ if ($user_posts < $rank['rank_min']) { $next_rank_post_count = $rank['rank_min']; } else ]]> </action> </edit> <edit> <find><![CDATA[ $rank_title = $rank['rank_title'];]]></find> <action type="before-add"><![CDATA[ if ($percent_complete == -1 && $next_rank_post_count > -1) { $rank_difference = $next_rank_post_count - $rank['rank_min']; $user_progress = $user_posts - $rank['rank_min']; $percent_complete = round(($user_progress / $rank_difference) * 100, 1); } ]]> </action> </edit> </open> <open src="includes/ucp/ucp_pm_viewmessage.php"> <edit> <find><![CDATA[ 'RANK_IMG' => $user_info['rank_image'],]]></find> <action type="after-add"><![CDATA[ 'PERCENTAGE_PROGRESS_NUM' => $user_info['percentage_progress'], 'PERCENTAGE_PROGRESS' => sprintf($user->lang['PERCENTAGE_PROGRESS'], $user_info['percentage_progress']),]]></action> </edit> <edit> <find><![CDATA[get_user_rank($user_row['user_rank'], $user_row['user_posts'], $user_row['rank_title'], $user_row['rank_image'], $user_row['rank_image_src']);]]></find> <inline-edit> <inline-find>, $user_row['rank_image_src']</inline-find> <inline-action type="after-add">, $user_row['percentage_progress']</inline-action> </inline-edit> </edit> </open> <open src="language/en/common.php"> <edit> <find><![CDATA[?>]]></find> <action type="before-add"><![CDATA[$lang = array_merge($lang, array( 'PERCENTAGE_PROGRESS' => '%s%%', 'PROGRESS_TO_NEXT_RANK' => 'Progress to next rank:' )); ]]></action> </edit> </open> <open src="memberlist.php"> <edit> <find><![CDATA[ get_user_rank($row['user_rank'], (($row['user_id'] == ANONYMOUS) ? false : $row['user_posts']), $rank_title, $rank_img, $rank_img_src);]]></find> <inline-edit> <inline-find>$rank_img_src</inline-find> <inline-action type="after-add"><![CDATA[, $percentage_progress]]></inline-action> </inline-edit> </edit> <edit> <find><![CDATA[ get_user_rank($data['user_rank'], (($user_id == ANONYMOUS) ? false : $data['user_posts']), $rank_title, $rank_img, $rank_img_src);]]></find> <inline-edit> <inline-find>$rank_img_src</inline-find> <inline-action type="after-add"><![CDATA[, $percentage_progress]]></inline-action> </inline-edit> </edit> <edit> <find><![CDATA[ 'RANK_IMG_SRC' => $rank_img_src,]]></find> <action type="after-add"><![CDATA[ 'PERCENTAGE_PROGRESS_NUM' => $percentage_progress, 'PERCENTAGE_PROGRESS' => sprintf($user->lang['PERCENTAGE_PROGRESS'], $percentage_progress),]]></action> </edit> </open> <open src="styles/prosilver/template/memberlist_body.html"> <edit> <find><![CDATA[<!-- IF memberrow.RANK_IMG --><span class="rank-img">{memberrow.RANK_IMG}</span><!-- ELSE --><span class="rank-img">{memberrow.RANK_TITLE}</span><!-- ENDIF -->]]></find> <inline-edit> <inline-find><![CDATA[<!-- ENDIF -->]]></inline-find> <inline-action type="after-add"><![CDATA[<!-- IF memberrow.PERCENTAGE_PROGRESS_NUM > -1 --><div class="rank_progress_bar" title="{L_PROGRESS_TO_NEXT_RANK}"><span style="width:{memberrow.PERCENTAGE_PROGRESS_NUM}%" class="bar"></span><span>{memberrow.PERCENTAGE_PROGRESS}</span></div><!-- ENDIF -->]]></inline-action> </inline-edit> </edit> </open> <open src="styles/prosilver/template/memberlist_view.html"> <edit> <find><![CDATA[<!-- IF RANK_IMG --><dd style="text-align: center;">{RANK_IMG}</dd><!-- ENDIF -->]]></find> <action type="after-add"><![CDATA[<!-- IF PERCENTAGE_PROGRESS_NUM > -1 --><dd>{L_PROGRESS_TO_NEXT_RANK}<div class="rank_progress_bar"><span style="width:{PERCENTAGE_PROGRESS_NUM}%" class="bar"></span><span>{PERCENTAGE_PROGRESS}</span></div></dd><!-- ENDIF -->]]></action> </edit> <edit> <find><![CDATA[<!-- IF RANK_IMG --><dt><!-- IF RANK_TITLE --> <!-- ELSE -->{L_RANK}:<!-- ENDIF --></dt> <dd>{RANK_IMG}</dd><!-- ENDIF -->]]></find> <action type="after-add"><![CDATA[<!-- IF PERCENTAGE_PROGRESS_NUM > -1 --><dt>{L_PROGRESS_TO_NEXT_RANK}</dt><dd><div class="rank_progress_bar"><span style="width:{PERCENTAGE_PROGRESS_NUM}%" class="bar"></span><span>{PERCENTAGE_PROGRESS}</span></div></dd><!-- ENDIF -->]]></action> </edit> </open> <open src="styles/prosilver/template/ucp_pm_viewmessage.html"> <edit> <find><![CDATA[ <!-- IF RANK_IMG --><dd>{RANK_IMG}</dd><!-- ENDIF -->]]></find> <action type="after-add"><![CDATA[ <!-- IF PERCENTAGE_PROGRESS_NUM > -1 --><dd>{L_PROGRESS_TO_NEXT_RANK}<div class="rank_progress_bar"><span style="width:{PERCENTAGE_PROGRESS_NUM}%" class="bar"></span><span>{PERCENTAGE_PROGRESS}</span></div></dd><!-- ENDIF -->]]></action> </edit> </open> <open src="styles/prosilver/template/viewtopic_body.html"> <edit> <find><![CDATA[ <!-- IF postrow.RANK_TITLE or postrow.RANK_IMG --><dd>{postrow.RANK_TITLE}<!-- IF postrow.RANK_TITLE and postrow.RANK_IMG --><br /><!-- ENDIF -->{postrow.RANK_IMG}</dd><!-- ENDIF -->]]></find> <action type="after-add"><![CDATA[ <!-- IF postrow.PERCENTAGE_PROGRESS_NUM > -1 --><dd>{L_PROGRESS_TO_NEXT_RANK}<div class="rank_progress_bar"><span style="width:{postrow.PERCENTAGE_PROGRESS_NUM}%" class="bar"></span><span>{postrow.PERCENTAGE_PROGRESS}</span></div></dd><!-- ENDIF -->]]> </action> </edit> </open> <open src="styles/prosilver/theme/common.css"> <edit> <find><![CDATA[.clear {]]></find> <action type="before-add"><![CDATA[.rank_progress_bar { border: 1px solid #b4bac0; margin-right: 1em; position: relative; clear:right } .rank_progress_bar span { z-index:2; position:relative } .rank_progress_bar .bar { background-color: #fff; border-right: 1px solid #b4bac0; display:block; height: 100%; z-index:1; position:absolute; top: 0; left: 0 }]]></action> </edit> </open> <open src="viewtopic.php"> <edit> <find><![CDATA[ if ($poster_id == ANONYMOUS) { $user_cache[$poster_id] = array(]]></find> <action type="after-add"><![CDATA[ 'percentage_progress' => -1,]]></action> </edit> <edit> <find><![CDATA[get_user_rank($row['user_rank'], false, $user_cache[$poster_id]['rank_title'], $user_cache[$poster_id]['rank_image'], $user_cache[$poster_id]['rank_image_src']);]]></find> <inline-edit> <inline-find>$user_cache[$poster_id]['rank_image_src']</inline-find> <inline-action type="after-add"><![CDATA[, $user_cache[$poster_id]['percentage_progress']]]></inline-action> </inline-edit> </edit> <edit> <find><![CDATA[ $id_cache[] = $poster_id; $user_cache[$poster_id] = array(]]></find> <action type="after-add"><![CDATA[ 'percentage_progress' => -1,]]></action> </edit> <edit> <find><![CDATA[get_user_rank($row['user_rank'], $row['user_posts'], $user_cache[$poster_id]['rank_title'], $user_cache[$poster_id]['rank_image'], $user_cache[$poster_id]['rank_image_src']);]]></find> <inline-edit> <inline-find>$user_cache[$poster_id]['rank_image_src']</inline-find> <inline-action type="after-add"><![CDATA[, $user_cache[$poster_id]['percentage_progress']]]></inline-action> </inline-edit> </edit> <edit> <find><![CDATA[ 'RANK_IMG_SRC' => $user_cache[$poster_id]['rank_image_src'],]]></find> <action type="after-add"><![CDATA[ 'PERCENTAGE_PROGRESS_NUM' => $user_cache[$poster_id]['percentage_progress'], 'PERCENTAGE_PROGRESS' => sprintf($user->lang['PERCENTAGE_PROGRESS'], $user_cache[$poster_id]['percentage_progress']),]]></action> </edit> </open> </action-group> </mod>