changeset 1:d2b86ef4f74b

Initial work on v0.0.2: * Update Contrib instructions to use inline-finds * Add additional checks to percentage calculation * Add missing lang * Add instructions for template changes in memberlist no-open-ticket
author IBBoard <dev@ibboard.co.uk>
date Mon, 15 Jun 2009 13:38:04 +0000
parents 609491027bb4
children 6c9b720fa73a
files Install.xml contrib/SpecialAndNormalRanksIntegration.xml
diffstat 2 files changed, 85 insertions(+), 49 deletions(-) [+]
line wrap: on
line diff
--- a/Install.xml	Fri Jun 05 20:32:20 2009 +0000
+++ b/Install.xml	Mon Jun 15 13:38:04 2009 +0000
@@ -28,7 +28,7 @@
 		<link-group>
 			<link type="contrib" href="contrib/SpecialAndNormalRanksIntegration.xml" lang="en-gb">Special and Normal Ranks MOD integration</link>
 		</link-group>
-		<mod-version>0.1</mod-version>
+		<mod-version>0.2</mod-version>
 		<installation>
 			<level>intermediate</level>
 			<time>600</time>
@@ -36,6 +36,15 @@
 		</installation>
 		<history>
 			<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>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">
@@ -59,7 +68,7 @@
 			</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)
+				<action type="before-add"><![CDATA[	if (!is_int($percent_complete) || $percent_complete < 0 || $percent_complete > 100)
 	{
 		$percent_complete = -1;
 	}]]></action>
@@ -81,7 +90,7 @@
 			</edit>
 			<edit>
 				<find><![CDATA[					$rank_title = $rank['rank_title'];]]></find>
-				<action type="before-add"><![CDATA[					if ($percent_complete == -1)
+				<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'];
@@ -104,7 +113,8 @@
 			<edit>
 				<find><![CDATA[?>]]></find>
 				<action type="before-add"><![CDATA[$lang = array_merge($lang, array(
-	'PERCENTAGE_PROGRESS' => '%s%%'
+	'PERCENTAGE_PROGRESS' => '%s%%',
+	'PROGRESS_TO_NEXT_RANK' => 'Progress to next rank:'
 ));
 ]]></action>
 			</edit>
@@ -124,6 +134,20 @@
 					<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-action>
+					<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 -->]]></action>
+				</inline-action>
+			</edit>
 		</open>
 		<open src="styles/prosilver/template/viewtopic_body.html">
 			<edit>
@@ -135,9 +159,26 @@
 		<open src="styles/prosilver/themes/common.css">
 			<edit>
 				<find><![CDATA[.clear {]]></find>
-				<action type="before-add"><![CDATA[.rank_progress_bar {border: 1px solid #b4bac0; margin-right: 1em; position: relative }
-.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>
+				<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">
--- a/contrib/SpecialAndNormalRanksIntegration.xml	Fri Jun 05 20:32:20 2009 +0000
+++ b/contrib/SpecialAndNormalRanksIntegration.xml	Mon Jun 15 13:38:04 2009 +0000
@@ -11,7 +11,7 @@
 	<header>
 		<license>http://opensource.org/licenses/gpl-license.php GNU General Public License v2</license>
 		<title lang="en-gb">User Rank Progression Bar - Special and Normal Rank MOD Integration</title>
-		<description lang="en-gb">These additional instructions provide integration with the Special and Normal Rank Images MOD so that users with both a special and normal rank can see their progress towards the next rank.</description>
+		<description lang="en-gb">These additional instructions provide integration with the Special and Normal Rank Images MOD (v1.1.0, which will become v1.2.0) so that users with both a special and normal rank can see their progress towards the next rank.</description>
 		<author-group>
 			<author>
 				<realname>IBBoard</realname>
@@ -23,7 +23,7 @@
 		<link-group>
 			<link type="parent" href="../Install.xml" lang="en-gb">Main install instructions</link>
 		</link-group>
-		<mod-version>0.1</mod-version>
+		<mod-version>0.2</mod-version>
 		<installation>
 			<level>intermediate</level>
 			<time>180</time>
@@ -32,6 +32,14 @@
 		<history>
 			<entry>
 				<date>2009-06-03</date>
+				<rev-version>0.2</rev-version>
+				<changelog lang="en-gb">
+					<change>Update: Replace large "find and replace" with small modifications in functions_display.php</change>
+					<change>Add: Add extra instructions to bring it up to date with v1.1.0 of the Special and Normal Rank Images MOD</change>
+				</changelog>
+			</entry>
+			<entry>
+				<date>2009-06-03</date>
 				<rev-version>0.1</rev-version>
 				<changelog lang="en-gb">
 					<change>Initial release</change>
@@ -41,51 +49,38 @@
 	</header>
 	<action-group>
 		<open src="includes/functions_display.php">
-		<!-- The documentation for this method currently duplicates the standard method, so as this is my MOD we'll just do the easy method and replace the lot -->
+			<edit>
+				<find><![CDATA[* @param string &$rank_img_src the rank image source is stored here after execution]]></find>
+				<action type="after-add"></action>
+			</edit>
 			<edit>
-				<find><![CDATA[/**
-* Get user's additional (normal) rank title and image if they have a special rank
-*
-* @param int $user_rank the current stored users rank id
-* @param int $user_posts the users number of posts
-* @param string &$rank_title the rank title will be stored here after execution
-* @param string &$rank_img the rank image as full img tag is stored here after execution
-* @param string &$rank_img_src the rank image source is stored here after execution
-*
-*/
-function get_user_additional_rank($user_rank, $user_posts, &$rank_title, &$rank_img, &$rank_img_src)
-{
-	if (!empty($user_rank))
-	{
-		//Always pass 0 to save duplicating get_user_rank
-		get_user_rank(0, $user_posts, $rank_title, $rank_img, $rank_img_src);
-	}
-	//else the user doesn't have a special rank and so they don't have a special rank
-}]]></find>
-				<action type="replace-with"><![CDATA[/**
-* Get user's additional (normal) rank title and image if they have a special rank
-*
-* @param int $user_rank the current stored users rank id
-* @param int $user_posts the users number of posts
-* @param string &$rank_title the rank title will be stored here after execution
-* @param string &$rank_img the rank image as full img tag is stored here after execution
-* @param string &$rank_img_src the rank image source is stored here after execution
-* @param int &$percent_complete the percentage of the way a user is to the next rank will be stored here after execution, where -1 meaning "not applicable"
-*
-*/
-function get_user_additional_rank($user_rank, $user_posts, &$rank_title, &$rank_img, &$rank_img_src, &$percent_complete)
-{
-	if (!empty($user_rank))
-	{
-		//Always pass 0 to save duplicating get_user_rank
-		get_user_rank(0, $user_posts, $rank_title, $rank_img, $rank_img_src, $percent_complete);
-	}
-	//else the user doesn't have a special rank and so they don't have a special rank
-}]]></action>
+				<find><![CDATA[function get_user_additional_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"><![CDATA[, $percentage_progress]]></inline-action>
+				</inline-edit>
+			</edit>
+			<edit>
+				<find><![CDATA[		get_user_rank(0, $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>
 		</open>
 		<open src="memberlist.php">
 			<edit>
+				<find><![CDATA[get_user_rank($user_rank, (($user_id == ANONYMOUS) ? false : $row['user_posts']), $memberrow['RANK_TITLE'], $memberrow['RANK_IMG'], $memberrow['RANK_IMG_SRC']);]]></find>
+				<inline-edit>
+					<inline-find>$memberrow['RANK_IMG_SRC']</inline-find>
+					<inline-action type="after-add"><![CDATA[, $memberrow['PERCENTAGE_PROGRESS_NUM']]]></inline-action>
+				</inline-edit>
+			</edit>
+			<edit>
+				<find><![CDATA[				if (isset($cp_row['row']) && sizeof($cp_row['row']))]]></find>
+				<action type="before-add"><![CDATA[]]></action>
+			</edit>
+			<edit>
 				<find><![CDATA[		get_user_additional_rank($data['user_rank'], $data['user_posts'], $rank_title, $rank_img, $rank_img_src);]]></find>
 				<inline-edit>
 					<inline-find>$rank_img_src</inline-find>