Skip to content

Commit

Permalink
refs #1654 : enhancement - automatic mobile skin load.
Browse files Browse the repository at this point in the history
 - i/ and m/ URLs are removed.

From now on, textcube loads skin/blog/lucid when
  - blog.useiPhoneMode is true
  - device agent is recognized as the one of mobile devices.

TODO:
  - mobile <-> desktop mode button
  - move skin location to under resource/ directory.
  - upgrade skin parser to read skins outside /skin/blog directory.
  - Lots of mobile skin design / functions
  • Loading branch information
inureyes committed Mar 6, 2014
1 parent 5cc9389 commit 8a01336
Show file tree
Hide file tree
Showing 38 changed files with 206 additions and 1,365 deletions.
16 changes: 1 addition & 15 deletions framework/Dispatcher.php
Original file line number Diff line number Diff line change
Expand Up @@ -118,9 +118,7 @@ private function URIinterpreter() {
case 'index.gif':
$uri['interfaceType'] = 'icon';
break;
case 'i':case 'm':
$uri['interfaceType'] = 'mobile';
break;
//case 'i':case 'm': -> overload at preprocessor.php
case 'checkup':
$uri['interfaceType'] = 'checkup';
break;
Expand Down Expand Up @@ -165,18 +163,6 @@ private function URIinterpreter() {
$pathPart = implode("/",$uri['fragment']);
$interfacePath = 'interface/blog/'.$pathPart.'/index.php';
break;
case 'i': case 'm':
if(isset($uri['fragment'][1])) {
if(in_array($uri['fragment'][1],array('archive','category','entry','guestbook','imageResizer','link','login','logout','pannels','protected','search','tag','trackback'))) {
$pathPart = $uri['fragment'][0].'/'.$uri['fragment'][1];
} else if($uri['fragment'][1] == 'comment') {
$pathPart = $uri['fragment'][0].'/'.$uri['fragment'][1].(isset($uri['fragment'][2]) ? '/'.$uri['fragment'][2] : '').(isset($uri['fragment'][3]) ? '/'.$uri['fragment'][3] : '');
}
} else {
$pathPart = $uri['fragment'][0];
}
$interfacePath = 'interface/'.$pathPart.'/index.php';
break;
default:
}
}
Expand Down
17 changes: 3 additions & 14 deletions interface/blog/entry.php
Original file line number Diff line number Diff line change
Expand Up @@ -6,25 +6,14 @@
'GET' => array(
'category' => array('int',0,'mandatory'=>false),
'page' => array('int', 1, 'default' => 1),
'mode' => array(array('mobile','desktop','tablet'),'mandatory'=>false),
'mode' => array(array('mobile','desktop','tablet'),'mandatory'=>false),
'commentId' => array('int',0,'mandatory'=>false),
'commentInput' => array('bool','mandatory'=>false)
)
);

require ROOT . '/library/preprocessor.php';

$browserUtil = Utils_Browser::getInstance();
if(Setting::getBlogSettingGlobal('useiPhoneUI',true) && ($browserUtil->isMobile() == true)
&& (!isset($_GET['mode']) || $_GET['mode'] != 'desktop')
&& (!isset($_SESSION['mode']) || !in_array($_SESSION['mode'],array('desktop')))) {
if(empty($suri['value'])) {
header("Location: $blogURL/i"); exit;
} else {
header("Location: $blogURL/i/entry/".$suri['value']); exit;
}
}

if(empty($suri['value'])) {
list($entries, $paging) = getEntriesWithPaging($blogid, $suri['page'], $blog['entriesOnPage']);
} else {
Expand Down Expand Up @@ -53,10 +42,10 @@
require ROOT . '/interface/common/blog/entries.php';
} else if (empty($entries)) {
header('HTTP/1.1 404 Not Found');
if (empty($skin->pageError)) {
if (empty($skin->pageError)) {
dress('article_rep', '<div class="TCwarning">' . _text('존재하지 않는 페이지입니다.') . '</div>', $view);
} else {
dress('article_rep', NULL, $view);
dress('article_rep', NULL, $view);
dress('page_error', $skin->pageError, $view);
}
unset($paging);
Expand Down
7 changes: 4 additions & 3 deletions interface/common/blog/begin.php
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
<?php
<?php
/// Copyright (c) 2004-2014, Needlworks / Tatter Network Foundation
/// All rights reserved. Licensed under the GPL.
/// See the GNU General Public License for more details. (/documents/LICENSE, /documents/COPYRIGHT)
Expand All @@ -11,8 +11,9 @@
$pageTitle = $entries[0]['title'];
else
$pageTitle = '';
if (!isset($skin))
$skin = new Skin($skinSetting['skin']);
if (!isset($skin)) {
$skin = new Skin($context->getProperty('skin.skin'));
}
$context = Model_Context::getInstance();
$view = $skin->outter;
$view = str_replace('[##_SKIN_head_end_##]',getScriptsOnHead().'[##_SKIN_head_end_##]', $view); // TO DO : caching this part.
Expand Down
23 changes: 0 additions & 23 deletions interface/i/archive/index.php

This file was deleted.

21 changes: 0 additions & 21 deletions interface/i/category/index.php

This file was deleted.

54 changes: 0 additions & 54 deletions interface/i/comment/add/index.php

This file was deleted.

55 changes: 0 additions & 55 deletions interface/i/comment/comment/add/index.php

This file was deleted.

30 changes: 0 additions & 30 deletions interface/i/comment/comment/index.php

This file was deleted.

34 changes: 0 additions & 34 deletions interface/i/comment/delete/action/index.php

This file was deleted.

41 changes: 0 additions & 41 deletions interface/i/comment/delete/index.php

This file was deleted.

38 changes: 0 additions & 38 deletions interface/i/comment/index.php

This file was deleted.

Loading

0 comments on commit 8a01336

Please sign in to comment.