gruffen commited on 2011-05-19 06:34:17
Showing 4 changed files, with 36 additions and 5 deletions.
... | ... |
@@ -30,7 +30,8 @@ $txt['shdp_frontpage_type_bbcode'] = 'Bulletin board code (as given in the main |
30 | 30 |
|
31 | 31 |
$txt['shdp_frontpage_appear'] = 'When it should appear'; |
32 | 32 |
$txt['shdp_frontpage_appear_always'] = 'Always as the front page'; |
33 |
-$txt['shdp_frontpage_appear_firstload'] = 'Only at the first time of login'; |
|
33 |
+$txt['shdp_frontpage_appear_firstload'] = 'Only at the first time of login (and then remain hidden)'; |
|
34 |
+$txt['shdp_frontpage_appear_firstdefault'] = 'At the first time of login (with tickets being the default "home")'; |
|
34 | 35 |
|
35 | 36 |
$txt['shdp_frontpage_content'] = 'Main content'; |
36 | 37 |
|
... | ... |
@@ -36,7 +36,10 @@ function shd_frontpage_helpdesk(&$subactions) |
36 | 36 |
return; |
37 | 37 |
|
38 | 38 |
// Are we doing it this load or not? |
39 |
- if (!empty($modSettings['shdp_frontpage_appear']) && $modSettings['shdp_frontpage_appear'] == 'firstload') |
|
39 |
+ if (empty($modSettings['shdp_frontpage_appear'])) |
|
40 |
+ $modSettings['shdp_frontpage_appear'] = 'firstdefault'; |
|
41 |
+ |
|
42 |
+ if ($modSettings['shdp_frontpage_appear'] == 'firstload') |
|
40 | 43 |
{ |
41 | 44 |
// So, check $_SESSION. If it's set (i.e. we've been here this session, leave; otherwise skip this section, we're coming here every time) |
42 | 45 |
if (isset($_SESSION['shdp_frontpage'])) |
... | ... |
@@ -44,8 +47,14 @@ function shd_frontpage_helpdesk(&$subactions) |
44 | 47 |
else |
45 | 48 |
$_SESSION['shdp_frontpage'] = 1; |
46 | 49 |
} |
50 |
+ elseif ($modSettings['shdp_frontpage_appear'] == 'firstdefault') |
|
51 |
+ { |
|
52 |
+ if (!isset($_SESSION['shdp_frontpage'])) |
|
53 |
+ $_SESSION['shdp_frontpage'] = 1; |
|
54 |
+ } |
|
47 | 55 |
|
48 | 56 |
// Fix the navigation to have a tickets button as well as the main button |
57 |
+ if ($modSettings['shdp_frontpage_appear'] != 'always') |
|
49 | 58 |
$context['shd_home'] = 'action=helpdesk;sa=tickets'; |
50 | 59 |
$navigation = $context['navigation']; |
51 | 60 |
$context['navigation'] = array(); |
... | ... |
@@ -80,7 +89,7 @@ function shd_frontpage_options($return_config) |
80 | 89 |
isAllowedTo('admin_forum'); |
81 | 90 |
|
82 | 91 |
$config_vars = array( |
83 |
- array('select', 'shdp_frontpage_appear', array('always' => $txt['shdp_frontpage_appear_always'], 'firstload' => $txt['shdp_frontpage_appear_firstload'])), |
|
92 |
+ array('select', 'shdp_frontpage_appear', array('always' => $txt['shdp_frontpage_appear_always'], 'firstload' => $txt['shdp_frontpage_appear_firstload'], 'firstdefault' => $txt['shdp_frontpage_appear_firstdefault'])), |
|
84 | 93 |
'', |
85 | 94 |
array('select', 'shdp_frontpage_type', array('php' => $txt['shdp_frontpage_type_php'], 'bbcode' => $txt['shdp_frontpage_type_bbcode'])), |
86 | 95 |
array('large_text', 'shdp_frontpage_content', 'size' => 30), |
... | ... |
@@ -225,4 +234,21 @@ function shd_frontpage_aftermain() |
225 | 234 |
); |
226 | 235 |
} |
227 | 236 |
|
237 |
+function shd_frontpage_mainmenu(&$menu_buttons) |
|
238 |
+{ |
|
239 |
+ global $context, $scripturl, $modSettings; |
|
240 |
+ |
|
241 |
+ // Enabled? |
|
242 |
+ if (empty($modSettings['shdp_frontpage_content']) || !in_array('front_page', $context['shd_plugins'])) |
|
243 |
+ return; |
|
244 |
+ |
|
245 |
+ if (!empty($modSettings['shdp_frontpage_appear']) && $modSettings['shdp_frontpage_appear'] == 'firstdefault' && !empty($_SESSION['shdp_frontpage'])) |
|
246 |
+ { |
|
247 |
+ if (empty($modSettings['shd_helpdesk_only']) && isset($menu_buttons['helpdesk'])) |
|
248 |
+ $menu_buttons['helpdesk']['href'] = $scripturl . '?action=helpdesk;sa=tickets'; |
|
249 |
+ elseif (!empty($modSettings['shd_helpdesk_only'])) |
|
250 |
+ $menu_buttons['home']['href'] = $scripturl . '?action=helpdesk;sa=tickets'; |
|
251 |
+ } |
|
252 |
+} |
|
253 |
+ |
|
228 | 254 |
?> |
229 | 255 |
\ No newline at end of file |
... | ... |
@@ -41,6 +41,8 @@ function template_shd_frontpage_admin() |
41 | 41 |
|
42 | 42 |
if (empty($modSettings['shdp_frontpage_type'])) |
43 | 43 |
$modSettings['shdp_frontpage_type'] = 'bbcode'; |
44 |
+ if (empty($modSettings['shdp_frontpage_appear'])) |
|
45 |
+ $modSettings['shdp_frontpage_appear'] = 'firstdefault'; |
|
44 | 46 |
|
45 | 47 |
echo ' |
46 | 48 |
<div id="admincenter"> |
... | ... |
@@ -59,8 +61,9 @@ function template_shd_frontpage_admin() |
59 | 61 |
</dt> |
60 | 62 |
<dd style="width: 68%;"> |
61 | 63 |
<select name="shdp_frontpage_appear" id="shdp_frontpage_appear"> |
62 |
- <option value="always" selected="selected">', $txt['shdp_frontpage_appear_always'], '</option> |
|
63 |
- <option value="firstload">', $txt['shdp_frontpage_appear_firstload'], '</option> |
|
64 |
+ <option value="always"', $modSettings['shdp_frontpage_appear'] == 'always' ? ' selected="selected"' : '', '>', $txt['shdp_frontpage_appear_always'], '</option> |
|
65 |
+ <option value="firstload"', $modSettings['shdp_frontpage_appear'] == 'firstload' ? ' selected="selected"' : '', '>', $txt['shdp_frontpage_appear_firstload'], '</option> |
|
66 |
+ <option value="firstdefault"', $modSettings['shdp_frontpage_appear'] == 'firstdefault' ? ' selected="selected"' : '', '>', $txt['shdp_frontpage_appear_firstdefault'], '</option> |
|
64 | 67 |
</select> |
65 | 68 |
</dd> |
66 | 69 |
</dl> |
67 | 70 |