forked from BlogEngine/BlogEngine.NET
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathapp.js
More file actions
122 lines (99 loc) · 5.98 KB
/
app.js
File metadata and controls
122 lines (99 loc) · 5.98 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
(function () {
var app = angular.module("blogAdmin", ['ngRoute', 'ngAnimate', 'ngSanitize']);
var config = ["$routeProvider", function ($routeProvider) {
$routeProvider
.when("/", { templateUrl: "views/dashboard.html" })
.when("/content", { templateUrl: "views/content/posts.html" })
.when("/content/blogs", { templateUrl: "views/content/blogs.html" })
.when("/content/comments", { templateUrl: "views/content/comments.html" })
.when("/content/pages", { templateUrl: "views/content/pages.html" })
.when("/content/categories", { templateUrl: "views/content/categories.html" })
.when("/content/tags", { templateUrl: "views/content/tags.html" })
.when("/content/files", { templateUrl: "views/content/files.html" })
.when("/custom", { templateUrl: "views/custom/index.html" })
.when("/custom/themes", { templateUrl: "views/custom/themes.html" })
.when("/custom/widgets", { templateUrl: "views/custom/widgets.html" })
.when("/custom/packages", { templateUrl: "views/custom/packages.html" })
.when("/users", { templateUrl: "views/users/index.html" })
.when("/users/roles", { templateUrl: "views/users/roles.html" })
.when("/users/profile", { templateUrl: "views/users/profile.html" })
.when("/settings", { templateUrl: "views/settings/basic.html" })
.when("/settings/advanced", { templateUrl: "views/settings/advanced.html" })
.when("/settings/feed", { templateUrl: "views/settings/feed.html" })
.when("/settings/email", { templateUrl: "views/settings/email.html" })
.when("/settings/controls", { templateUrl: "views/settings/controls/contactform.html" })
.when("/settings/controls/blogroll", { templateUrl: "views/settings/controls/blogroll.html" })
.when("/settings/controls/pings", { templateUrl: "views/settings/controls/pings.html" })
.when("/settings/controls/error", { templateUrl: "views/settings/controls/error.html" })
.when("/settings/comments", { templateUrl: "views/settings/comments/index.html" })
.when("/settings/comments/filters", { templateUrl: "views/settings/comments/filters.html" })
.when("/settings/customecode", { templateUrl: "views/settings/customecode.html" })
.when("/settings/tools", { templateUrl: "views/settings/tools/check.html" })
.when("/settings/tools/export", { templateUrl: "views/settings/tools/export.html" })
.when("/settings/tools/import", { templateUrl: "views/settings/tools/import.html" })
.when("/help", { templateUrl: "views/help/index.html" })
.when("/about", { templateUrl: "views/about/index.html" })
.otherwise({ redirectTo: "/" });
}];
app.config(config);
app.directive('focusMe', ['$timeout', function ($timeout) {
return function (scope, element, attrs) {
scope.$watch(attrs.focusMe, function (value) {
if (value) {
$timeout(function () {
element.focus();
}, 700);
}
});
};
}]);
var run = ["$rootScope", "$log", function ($rootScope, $log) {
$rootScope.lbl = BlogAdmin.i18n;
$rootScope.SiteVars = SiteVars;
$rootScope.security = new security();
toastr.options.positionClass = 'toast-bottom-right';
toastr.options.backgroundpositionClass = 'toast-bottom-right';
}];
app.run(run);
var security = function () {
// dashboard
this.showTabDashboard = showTabDashboard();
this.viewErrorMessages = viewErrorMessages();
function showTabDashboard() { return UserVars.Rights.indexOf("ViewDashboard") > -1 ? true : false; }
function viewErrorMessages() { return UserVars.Rights.indexOf("ViewDetailedErrorMessages") > -1 ? true : false; }
// blogs
this.showTabBlogs = showTabBlogs();
function showTabBlogs() { return (SiteVars.IsPrimary == "True" && UserVars.IsAdmin == "True") ? true : false; }
// content
this.showTabContent = showTabContent();
function showTabContent() { return UserVars.Rights.indexOf("EditOwnPosts") > -1 ? true : false; }
// customization/packaging
this.showTabCustom = showTabCustom();
this.canManageExtensions = canManageExtensions();
this.canManageThemes = canManageThemes();
this.canManageWidgets = canManageWidgets();
this.canManagePackages = canManagePackages();
function showTabCustom() {
return (UserVars.Rights.indexOf("ManageExtensions") > -1 ||
UserVars.Rights.indexOf("ManageWidgets") > -1 ||
UserVars.Rights.indexOf("ManageThemes") > -1 ||
UserVars.Rights.indexOf("ManagePackages") > -1) ? true : false;
}
function canManageExtensions() { return UserVars.Rights.indexOf("ManageExtensions") > -1; }
function canManageThemes() { return UserVars.Rights.indexOf("ManageThemes") > -1; }
function canManageWidgets() { return UserVars.Rights.indexOf("ManageWidgets") > -1; }
function canManagePackages() { return UserVars.Rights.indexOf("ManagePackages") > -1; }
// users
this.showTabUsers = showTabUsers();
this.canManageUsers = canManageUsers();
this.canManageRoles = canManageRoles();
this.canManageProfile = canManageProfile();
function showTabUsers() { return (UserVars.Rights.indexOf("EditOtherUsers") > -1) ? true : false; }
function canManageUsers() { return UserVars.Rights.indexOf("EditOtherUsers") > -1 ? true : false; }
function canManageRoles() { return UserVars.Rights.indexOf("EditRoles") > -1 ? true : false; }
function canManageProfile() { return UserVars.Rights.indexOf("EditOwnUser") > -1 ? true : false; }
// settings
this.showTabSettings = showTabSettings();
function showTabSettings() { return UserVars.Rights.indexOf("AccessAdminSettingsPages") > -1 ? true : false; }
}
})();