Skip to content

Commit

Permalink
Working on login and user menu
Browse files Browse the repository at this point in the history
  • Loading branch information
gubi committed Jul 31, 2014
1 parent a729e1a commit e365d8d
Show file tree
Hide file tree
Showing 8 changed files with 406 additions and 61 deletions.
14 changes: 7 additions & 7 deletions common/include/classes/parse_json_config.class.php
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ function __construct($config = "") {
// Uncomment if you want to remote json menu
//$config = "common/include/conf/menu.json";
include("common/include/conf/menu.php");
$config = $menu;
$config = $menu;
}
// Same as comment before
//$this->json_conf = json_decode(file_get_contents($config), true);
Expand All @@ -23,7 +23,7 @@ private function walk($array, $key) {
}
$data = $this->walk($v, $key);
if($data != false){
return $data;
return $data;
}
}
return false;
Expand Down Expand Up @@ -53,14 +53,14 @@ private function extract_attributes($map_toolbox) {
}
} else {
//print_r($this->walk($map_toolbox, $mo_key));
$attributes[] = '"class="btn btn-default dropdown-toggle" data-toggle="dropdown"';
$attributes[] = 'class="dropdown-toggle" data-toggle="dropdown"';
}
}
return $attributes;
}
public function menu($menu_position, $ul_class = array()) {
$menu_list = '<ul';
if(!is_array($ul_class)) {
if(!is_array($ul_class)) {
$menu_list .= (trim($ul_class) !== "" ? ' class="' . $ul_class . '"' : '');
} else {
foreach($ul_class as $k => $v) {
Expand All @@ -86,15 +86,15 @@ public function menu($menu_position, $ul_class = array()) {

public function contextmenu($menu_position, $ul_class = array()) {
$menu_list = '<ul';
if(!is_array($ul_class)) {
if(!is_array($ul_class)) {
$menu_list .= (trim($ul_class) !== "" ? ' class="' . $ul_class . '"' : '');
} else {
foreach($ul_class as $k => $v) {
$menu_list .= " " . $k . '="' . $v . '"';
}
}
$menu_list .= ">\n";

foreach($this->walk($this->json_conf, $menu_position) as $obj => $map_toolbox) {
if($obj !== "_comment") {
$divider = "";
Expand All @@ -119,4 +119,4 @@ public function contextmenu($menu_position, $ul_class = array()) {
$menu_list .= "</ul>";
return $menu_list;
}
}
}
13 changes: 6 additions & 7 deletions common/include/conf/menu.php
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@
*/
"About us" => array(
"content" => array(
"icon" => "fa fa-tencent-weibo",
"icon" => "fa fa-leaf",
"text" => "About us"
),
"attributes" => array(
Expand All @@ -49,7 +49,7 @@
"childs" => array(
"About us" => array(
"content" => array(
"icon" => "fa fa-leaf",
"icon" => "fa fa-comment-o",
"text" => "About us"
),
"attributes" => array(
Expand All @@ -67,7 +67,7 @@
),
"Feedback" => array(
"content" => array(
"icon" => "fa fa-comment-o",
"icon" => "fa fa-comments-o",
"text" => "Give us your feedback"
),
"attributes" => array(
Expand Down Expand Up @@ -112,8 +112,7 @@
"href" => "/Links"
)
)
),
"divider" => "vertical-divider"
)
),
"Search" => array(
"content" => array(
Expand All @@ -122,8 +121,8 @@
),
"attributes" => array(
"href" => "/Search"
)//,
//"divider" => "vertical-divider"
),
"divider" => "vertical-divider"
),
/*
"Map" => array(
Expand Down
157 changes: 129 additions & 28 deletions common/include/conf/role_definitions.json
Original file line number Diff line number Diff line change
@@ -1,42 +1,143 @@
{
"Legend": {
"Description": "Split the array keys in two characters: the first one indicates the context, the second one indicates the function on the context.",
"Contexts functions standard": {
"A": "Add",
"E": "Edit",
"D": "Delete",
"U": "upload",
"V": "view",
"M": "move, manage order"
"dictionary": {
"groups": {
"B": {
"icon": "fa fa-fw fa-paper-plane-o",
"label": "Blog",
"link": "",
"order": 0,
"separator": false,
"type": "static"
},
"C": {
"icon": "fa fa-fw fa-files-o",
"label": "Contents",
"link": "",
"order": 0,
"separator": false,
"type": "static"
},
"D": {
"icon": "fa fa-fw fa-cubes",
"label": "Data",
"link": "https://data.pgrdiversity.bioversity.org",
"order": 1,
"separator": false,
"type": "dynamic"
},
"O": {
"icon": "fa fa-fw fa-list-alt",
"label": "Metadata",
"link": "/Metadata",
"order": 2,
"separator": true,
"type": "dynamic"
},
"M": {
"icon": "fa fa-fw fa-list-alt",
"label": "Menu",
"link": "/Manager/Menu",
"order": 3,
"separator": false,
"type": "dynamic"
},
"m": {
"icon": "fa fa-fw fa-compass",
"label": "Map",
"link": "/Manager/Map",
"order": 4,
"separator": false,
"type": "dynamic"
},
"G": {
"icon": "fa fa-fw fa-bar-chart-o",
"label": "Graphs",
"link": "/Manager/Graphs",
"order": 5,
"separator": false,
"type": "dynamic"
},
"U": {
"icon": "fa fa-fw fa-group",
"label": "Users",
"link": "/Manager/Users",
"order": 6,
"separator": false,
"type": "dynamic"
}
},
"functions": {
"A": {
"label": "Add"
},
"D": {
"label": "Delete"
},
"E": {
"label": "Edit"
},
"F": {
"label": "Full access"
},
"M": {
"label": "Move, manage, order"
},
"S": {
"label": "Settings"
},
"U": {
"label": "Upload"
},
"V": {
"label": "View"
}
}
},
"Users": {
"UA": "Add users",
"UE": "Edit users data",
"UD": "Delete users",
"US": "Subscribe users",
"UV": "view users data"
},
"Contents": {
"CA": "Add contents",
"CE": "Edit contents",
"CD": "Delete contents",
"CU": "Upload files to contents",
"MA": "Add item to menu",
"ME": "Edit item of menu",
"MD": "Delete item of menu",
"MM": "Move items of menu"
},
"Blog": {
"BA": "Add posts",
"BE": "Edit posts",
"BD": "Delete posts",
"BE": "Edit posts",
"BS": "Blog settings",
"BU": "Upload files"
},
"Contents": {
"CA": "Add contents",
"CD": "Delete contents",
"CE": "Edit contents",
"CU": "Upload files to contents"
},
"Data": {
"DA": "Add data",
"DE": "Edit data",
"DD": "Delete data",
"DE": "Edit data",
"DS": "Data settings",
"DU": "Upload data"
},
"Metadata": {
"OA": "Add metadata",
"OD": "Delete metadata",
"OE": "Edit metadata",
"OF": "Full access",
"OS": "Metadata settings",
"OV": "View metadata"
},
"Graphs": {
"GS": "Graphs settings"
},
"Map": {
"mS": "Map settings"
},
"Menu": {
"MA": "Add item to menu",
"MD": "Delete item of menu",
"ME": "Edit item of menu",
"MM": "Move items of menu"
},
"Users": {
"UA": "Add users",
"UD": "Delete users",
"UE": "Edit users data",
"US": "Users settings",
"UV": "View users data"
}
}
Loading

0 comments on commit e365d8d

Please sign in to comment.