[Cs-webapplibs-commits] SF.net SVN: cs-webapplibs:[161] trunk/0.3/cs_tabs.class.php
Status: Beta
Brought to you by:
crazedsanity
|
From: <cra...@us...> - 2010-05-27 14:31:49
|
Revision: 161
http://cs-webapplibs.svn.sourceforge.net/cs-webapplibs/?rev=161&view=rev
Author: crazedsanity
Date: 2010-05-27 14:31:40 +0000 (Thu, 27 May 2010)
Log Message:
-----------
Fix tab selection to be a bit more forgiving.
/cs_tabs.class.php:
* select_tab():
-- try to matching tabname to the beginning of each tabname or the
end of each url if the actual tab name given doesn't exist.
-- returns selected tab name.
Modified Paths:
--------------
trunk/0.3/cs_tabs.class.php
Modified: trunk/0.3/cs_tabs.class.php
===================================================================
--- trunk/0.3/cs_tabs.class.php 2010-05-13 18:16:07 UTC (rev 160)
+++ trunk/0.3/cs_tabs.class.php 2010-05-27 14:31:40 UTC (rev 161)
@@ -66,7 +66,22 @@
* @return (void)
*/
public function select_tab($tabName) {
- $this->selectedTab = $tabName;
+ $selected = $tabName;
+
+ if(!$this->tab_exists($tabName)) {
+ $fixedTabName = strtolower($tabName);
+ foreach($this->tabsArr as $name => $info) {
+ if(preg_match('/^'. $tabName .'/', $name)) {
+ $selected = $name;
+ }
+ elseif(preg_match('/'. $tabName .'$/', $info['url'])) {
+ $selected = $name;
+ }
+ }
+ }
+
+ $this->selectedTab = $selected;
+ return($this->selectedTab);
}//end select_tab()
//---------------------------------------------------------------------------------------------
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|