aboutsummaryrefslogtreecommitdiff
path: root/h-source
diff options
context:
space:
mode:
authorAntonio Gallo <tonicucoz@gmail.com>2011-12-27 07:27:36 +0000
committerAntonio Gallo <tonicucoz@gmail.com>2011-12-27 07:27:36 +0000
commit7bda3432520d07d31220fc66b3e552e1eed46f82 (patch)
tree5d9381cd3eb10999db4088ffa931a334f8bd4dcc /h-source
parentb5d776bc5c8261ac75a74ed3070ca13a6eb741ca (diff)
mobile: added language dialog
Diffstat (limited to 'h-source')
-rw-r--r--h-source/Application/Controllers/BaseController.php16
-rw-r--r--h-source/Application/Include/languages.php17
-rw-r--r--h-source/Application/Views/Mobile/footer.php17
-rw-r--r--h-source/Application/Views/Mobile/header.php11
-rw-r--r--h-source/Application/Views/Mobile/right.php3
-rw-r--r--h-source/Public/Css/mobile.css6
6 files changed, 59 insertions, 11 deletions
diff --git a/h-source/Application/Controllers/BaseController.php b/h-source/Application/Controllers/BaseController.php
index 69b47ac..7bd8027 100644
--- a/h-source/Application/Controllers/BaseController.php
+++ b/h-source/Application/Controllers/BaseController.php
@@ -100,13 +100,14 @@ class BaseController extends Controller
Lang::$current = $data['lang'];
}
+ $data['langIcon'] = Lang::getIcon(Lang::$current);
+ $data['langLabel'] = Lang::getLabel(Lang::$current);
+
//set desktop or mobile version
Version::set();
//subfolder of the Views folder where to look for view files
Params::$viewSubfolder = Version::getViewSubfolder();
-
-
$data['tm'] = $this->_topMenuClasses;
$this->_queryString = $this->sanitizeQueryString($this->_queryString);
@@ -240,15 +241,20 @@ class BaseController extends Controller
{
$status = $this->_queryString;
$cPage = $this->querySanitized ? $this->currPage : $this->baseUrl."/home/index";
- $link = "<ul class='languages_link_box'>\n";
+
+ $mobileDataRole = Version::get() === "mobile" ? "data-role='listview'" : null;
+
+ $link = "<ul $mobileDataRole class='languages_link_box'>\n";
foreach (Lang::$complete as $abbr => $fullName)
{
$linkClass = (strcmp($abbr,$lang) === 0) ? "class='current_lang'" : null;
$status[0] = $abbr;
$href = Url::createUrl($status);
$fullNameArray = explode(',',$fullName);
- $text = "<img src='".$this->baseUrl."/Public/Img/Famfamfam/".$fullNameArray[0]."'><span>".$fullNameArray[1]."</span>";
- $link .= "\t<li><a $linkClass href='".$cPage.$href."'>$text</a></li>\n";
+ $text = "<img class='ui-li-icon' src='".$this->baseUrl."/Public/Img/Famfamfam/".$fullNameArray[0]."'><span>".$fullNameArray[1]."</span>";
+
+ $mobileRel = Version::get() === "mobile" ? "rel='external'" : null;
+ $link .= "\t<li><a $mobileRel $linkClass href='".$cPage.$href."'>$text</a></li>\n";
}
$link .= "</ul>\n";
return $link;
diff --git a/h-source/Application/Include/languages.php b/h-source/Application/Include/languages.php
index b47f1b2..3757009 100644
--- a/h-source/Application/Include/languages.php
+++ b/h-source/Application/Include/languages.php
@@ -33,16 +33,27 @@ class Lang
'de' => 'de.png,Deutsch',
);
- public static function getLabel($langCode)
+ //$pos=0: icon, $pos=1:lang name
+ public static function getLangInfo($langCode,$pos)
{
if (array_key_exists($langCode,self::$complete))
{
$all = explode(',',self::$complete[$langCode]);
- return $all[1];
+ return $all[$pos];
}
return $langCode;
}
+ public static function getLabel($langCode)
+ {
+ return self::getLangInfo($langCode,1);
+ }
+
+ public static function getIcon($langCode)
+ {
+ return self::getLangInfo($langCode,0);
+ }
+
public static $i18n = array(
'it' => array
(
@@ -358,6 +369,8 @@ class Lang
/*0310*/"does_not_work" => "non funziona",
/*0311*/"works_without_3D" => "funziona senza 3D",
/*0312*/"works_with_3D" => "funziona con 3D",
+ /*0313*/"list of languages" => "elenco delle lingue",
+ /*0314*/"Choose the language" => "Scegli la lingua",
),
'es' => array
(
diff --git a/h-source/Application/Views/Mobile/footer.php b/h-source/Application/Views/Mobile/footer.php
index c49ad4b..3490393 100644
--- a/h-source/Application/Views/Mobile/footer.php
+++ b/h-source/Application/Views/Mobile/footer.php
@@ -36,5 +36,22 @@
</div> <!--fine page-->
+<!-- Start of second page: language dialog -->
+<div data-role="page" id="language-dialog">
+
+ <div data-role="header" data-theme="a">
+ <h1><?php echo gtext('Choose the language');?></h1>
+ </div><!-- /header -->
+
+ <div data-role="content" data-theme="d">
+ <?php echo $language_links;?>
+ </div><!-- /content -->
+
+
+ <div data-role="footer">
+ <p><?php echo gtext('list of languages');?></p>
+ </div><!-- /footer -->
+</div><!-- /page popup -->
+
</body>
</html>
diff --git a/h-source/Application/Views/Mobile/header.php b/h-source/Application/Views/Mobile/header.php
index 1d109c8..f79012e 100644
--- a/h-source/Application/Views/Mobile/header.php
+++ b/h-source/Application/Views/Mobile/header.php
@@ -36,13 +36,20 @@ $currPos = $querySanitized ? $this->controller."/".$this->action : 'home/index';
<meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=no">
<link rel="stylesheet" type="text/css" href="<?php echo $this->baseUrl;?>/Public/Js/jquery/jquery.mobile-1.0.css">
- <link rel="stylesheet" type="text/css" href="<?php echo $this->baseUrl;?>/Public/Js/jquery/h-node-theme.css">
<script type="text/javascript" src="<?php echo $this->baseUrl;?>/Public/Js/jquery/jquery-1.7.1.min.js"></script>
<script type="text/javascript" src="<?php echo $this->baseUrl;?>/Public/Js/jquery/jquery.mobile-1.0.min.js"></script>
<script type="text/javascript" src="<?php echo $this->baseUrl;?>/Public/Js/functions.js"></script>
<link rel="stylesheet" type="text/css" href="<?php echo $this->baseUrl?>/Public/Css/mobile.css">
+
+ <style type='text/css'>
+ .ui-icon-current-lang
+ {
+ background-image: url(<?php echo $this->baseUrl;?>/Public/Img/Famfamfam/<?php echo $langIcon;?>);
+ background-position:1px 4px;
+ }
+ </style>
<script type="text/javascript">
@@ -70,7 +77,7 @@ $currPos = $querySanitized ? $this->controller."/".$this->action : 'home/index';
<ul>
<li><a href="#" class="ui-btn-active">Home</a></li>
<li><a href="#">Hardware</a></li>
- <li><a data-icon="gear" href="#">English</a></li>
+ <li><a data-icon="current-lang" data-rel="dialog" href="#language-dialog"><?php echo $langLabel;?></a></li>
</ul>
</div><!-- /navbar -->
diff --git a/h-source/Application/Views/Mobile/right.php b/h-source/Application/Views/Mobile/right.php
index 47e9af9..55225a6 100644
--- a/h-source/Application/Views/Mobile/right.php
+++ b/h-source/Application/Views/Mobile/right.php
@@ -18,4 +18,5 @@
//
// You should have received a copy of the GNU General Public License
// along with h-source. If not, see <http://www.gnu.org/licenses/>.
-?> \ No newline at end of file
+?>
+
diff --git a/h-source/Public/Css/mobile.css b/h-source/Public/Css/mobile.css
index 55e470c..f86bc74 100644
--- a/h-source/Public/Css/mobile.css
+++ b/h-source/Public/Css/mobile.css
@@ -45,9 +45,13 @@ img
}
-
/*jquery mobile*/
.ui-bar-a {
background: #B7F18C;
}
+/*.ui-icon, .ui-icon-searchfield:after {
+ -moz-border-radius: 0px;
+ -webkit-border-radius: 0px;
+ background: url("images/icons-18-white.png") no-repeat scroll 0 0 rgba(0, 0, 0, 0.4);
+}*/