summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--core/controllers/welcome.php65
-rw-r--r--core/views/welcome.html.php90
2 files changed, 117 insertions, 38 deletions
diff --git a/core/controllers/welcome.php b/core/controllers/welcome.php
index c62ccbc8..6d0399dc 100644
--- a/core/controllers/welcome.php
+++ b/core/controllers/welcome.php
@@ -39,26 +39,10 @@ class Welcome_Controller extends Template_Controller {
$this->template->deepest_photo = null;
}
- try {
- $this->template->comment_count = ORM::factory("comment")->count_all();
- } catch (Exception $e) {
- $this->template->comment_count = 0;
- }
-
- try {
- $this->template->tag_count = ORM::factory("tag")->count_all();
- $this->template->most_tagged = Database::instance()
- ->select("item_id AS id", "COUNT(tag_id) AS count")
- ->from("items_tags")
- ->groupby("item_id")
- ->orderby("count", "DESC")
- ->limit(1)
- ->get()
- ->current();
- } catch (Exception $e) {
- $this->template->tag_count = 0;
- $this->template->most_tagged = 0;
- }
+ $this->_load_user_info();
+ $this->_load_group_info();
+ $this->_load_comment_info();
+ $this->_load_tag_info();
set_error_handler($old_handler);
@@ -341,4 +325,45 @@ class Welcome_Controller extends Template_Controller {
ksort($modules);
return $modules;
}
+
+ private function _load_group_info() {
+ try {
+ $this->template->groups = ORM::factory("group")->find_all();
+ } catch (Exception $e) {
+ $this->template->groups = array();
+ }
+ }
+
+ private function _load_user_info() {
+ try {
+ $this->template->users = ORM::factory("user")->find_all();
+ } catch (Exception $e) {
+ $this->template->users = array();
+ }
+ }
+
+ private function _load_comment_info() {
+ try {
+ $this->template->comment_count = ORM::factory("comment")->count_all();
+ } catch (Exception $e) {
+ $this->template->comment_count = 0;
+ }
+ }
+
+ private function _load_tag_info() {
+ try {
+ $this->template->tag_count = ORM::factory("tag")->count_all();
+ $this->template->most_tagged = Database::instance()
+ ->select("item_id AS id", "COUNT(tag_id) AS count")
+ ->from("items_tags")
+ ->groupby("item_id")
+ ->orderby("count", "DESC")
+ ->limit(1)
+ ->get()
+ ->current();
+ } catch (Exception $e) {
+ $this->template->tag_count = 0;
+ $this->template->most_tagged = 0;
+ }
+ }
}
diff --git a/core/views/welcome.html.php b/core/views/welcome.html.php
index 7b34927f..0eca24fc 100644
--- a/core/views/welcome.html.php
+++ b/core/views/welcome.html.php
@@ -70,26 +70,37 @@
display: none;
}
- ul#tabs {
+ ul.tabs {
margin-left: 0;
padding: 1em 0 2px 1em;
white-space: nowrap;
border-bottom: 1px solid black;
}
- ul#tabs li {
+ ul.tabs li {
display: inline;
list-style-type: none;
}
- ul#tabs a {
+ ul.tabs a {
padding: 3px 10px;
color: #fff;
background-color: #036;
text-decoration: none;
}
- ul#tabs a:hover {
+ div#access {
+ margin-top: -20px;
+ padding: 0px;
+ padding-left: 20px;
+ }
+
+ div#access ul.tabs a {
+ background-color: #830;
+ border: 1px solid white;
+ }
+
+ ul.tabs a:hover {
background-color: #369;
}
@@ -108,7 +119,6 @@
tr.core td {
border-bottom: 1px solid black;
-
}
a {
@@ -141,9 +151,10 @@
meantime, here are some useful links to get you started.
</p>
- <ul id="tabs">
+ <ul class="tabs">
<li><a href="javascript:show('config')">Configuration</a></li>
<li><a href="javascript:show('actions')">Actions</a></li>
+ <li><a href="javascript:show('access')">Access</a></li>
<li><a href="javascript:show('info')">Info</a></li>
<li><a href="javascript:show('benchmarks')">Benchmarks</a></li>
<li><a href="javascript:show('docs')">Docs</a></li>
@@ -151,21 +162,34 @@
<div id="activities">
<script>
- show = function(section) {
- var section_id = "#" + section;
- if ($(section_id).css("display") == "block") {
- return;
+ show = function(show1, show2, immediate) {
+ if (!show1) {
+ show1 = "configuration";
+ } else if (show1 == "access" && !show2) {
+ show2 = "access_users";
+ }
+ var acts = $("div.activity");
+ for (var i = 0; i < acts.length; i++) {
+ act = acts[i];
+ if (act.id != show1 && act.id != show2) {
+ if (immediate) {
+ $("#" + act.id).hide();
+ } else {
+ $("#" + act.id).slideUp();
+ }
+ } else {
+ if (immediate) {
+ $("#" + act.id).show();
+ } else {
+ $("#" + act.id).slideDown();
+ }
+ }
}
- $("div.activity").slideUp();
- $(section_id).slideDown();
- $.cookie("active_section", section);
+ $.cookie("show1", show1);
+ $.cookie("show2", show2);
}
$(document).ready(function(){
- var active_section = $.cookie("active_section");
- if (!active_section) {
- active_section = 'config';
- }
- $("#" + active_section).show();
+ show($.cookie("show1"), $.cookie("show2"), true);
$("#photo_upload").MultiFile();
});
</script>
@@ -218,6 +242,36 @@
</fieldset>
</div>
+ <div id="access" class="activity">
+ <ul class="tabs">
+ <li><a href="javascript:show('access', 'access_users')">Users</a></li>
+ <li><a href="javascript:show('access', 'access_groups')">Groups</a></li>
+ <li><a href="javascript:show('access', 'access_permissions')">Permissions</a></li>
+ </ul>
+
+ <div id="access_users" class="activity">
+ <ul>
+ <? foreach ($users as $user): ?>
+ <li> <?= $user->name ?> </li>
+ <? endforeach ?>
+ </ul>
+ </div>
+
+ <div id="access_groups" class="activity">
+ <ul>
+ <? foreach ($groups as $group): ?>
+ <li> <?= $group->name ?> </li>
+ <? endforeach ?>
+ </ul>
+ </div>
+
+ <div id="access_permissions" class="activity">
+ <p>
+ <i>Nothing yet</i>
+ </p>
+ </div>
+ </div>
+
<div id="info" class="activity">
<ul>
<li> <?= html::anchor("welcome/mptt?type=text", "MPTT tree (text)") ?> </li>