diff --git a/modules/core/client/app/trans-string-en.js b/modules/core/client/app/trans-string-en.js index c9980adf..eb1c1a00 100644 --- a/modules/core/client/app/trans-string-en.js +++ b/modules/core/client/app/trans-string-en.js @@ -109,7 +109,11 @@ RANKING: 'Ranking', RULES: 'Rules', VIP: 'Vip', - FORUM: 'Forum' + FORUM: 'Forum', + ADMIN_USER_LIST: 'User List', + ADMIN_USER_VIEW: 'View User', + ADMIN_USER_EDIT: 'Edit User', + ADMIN_TORRENTS_LIST: 'Torrents LIst' }, //TorrentsController & views diff --git a/modules/core/client/app/trans-string-zh.js b/modules/core/client/app/trans-string-zh.js index b2e58633..c3849e00 100644 --- a/modules/core/client/app/trans-string-zh.js +++ b/modules/core/client/app/trans-string-zh.js @@ -109,7 +109,11 @@ RANKING: '排行榜', RULES: '规则', VIP: 'Vip', - FORUM: '论坛' + FORUM: '论坛', + ADMIN_USER_LIST: '用户管理', + ADMIN_USER_VIEW: '查看用户', + ADMIN_USER_EDIT: '编辑用户', + ADMIN_TORRENTS_LIST: '种子管理' }, //TorrentsController & views diff --git a/modules/torrents/client/config/admin/torrents-admin.client.menu.js b/modules/torrents/client/config/admin/torrents-admin.client.menu.js index 31c0f9a9..731ded63 100644 --- a/modules/torrents/client/config/admin/torrents-admin.client.menu.js +++ b/modules/torrents/client/config/admin/torrents-admin.client.menu.js @@ -11,7 +11,8 @@ function menuConfig(menuService) { menuService.addSubMenuItem('topbar', 'admin', { title: 'MENU_TORRENTS_ADMIN', - state: 'admin.torrents.list', + state: 'admin.torrents', + target: '_blank', position: 1 }); } diff --git a/modules/torrents/client/config/admin/torrents-admin.client.routes.js b/modules/torrents/client/config/admin/torrents-admin.client.routes.js new file mode 100644 index 00000000..a30a5b7d --- /dev/null +++ b/modules/torrents/client/config/admin/torrents-admin.client.routes.js @@ -0,0 +1,21 @@ +(function () { + 'use strict'; + + // Setting up route + angular + .module('torrents.admin.routes') + .config(routeConfig); + + routeConfig.$inject = ['$stateProvider']; + + function routeConfig($stateProvider) { + $stateProvider + .state('admin.torrents', { + url: '/torrents', + templateUrl: '/modules/torrents/client/views/admin/admin-list.client.view.html', + data: { + pageTitle: 'PAGETITLE.ADMIN_TORRENTS_LIST' + } + }); + } +}()); diff --git a/modules/torrents/client/controllers/admin/admin-list.client.controller.js b/modules/torrents/client/controllers/admin/admin-list.client.controller.js new file mode 100644 index 00000000..a9ed1450 --- /dev/null +++ b/modules/torrents/client/controllers/admin/admin-list.client.controller.js @@ -0,0 +1,279 @@ +(function () { + 'use strict'; + + angular + .module('torrents') + .controller('TorrentsAdminController', TorrentsAdminController); + + TorrentsAdminController.$inject = ['$scope', '$state', '$translate', '$timeout', 'Authentication', 'Notification', 'TorrentsService', + 'MeanTorrentConfig', 'DownloadService', '$window']; + + function TorrentsAdminController($scope, $state, $translate, $timeout, Authentication, Notification, TorrentsService, MeanTorrentConfig, + DownloadService, $window) { + var vm = this; + vm.user = Authentication.user; + vm.announce = MeanTorrentConfig.meanTorrentConfig.announce; + vm.tmdbConfig = MeanTorrentConfig.meanTorrentConfig.tmdbConfig; + vm.imdbConfig = MeanTorrentConfig.meanTorrentConfig.imdbConfig; + vm.resourcesTags = MeanTorrentConfig.meanTorrentConfig.resourcesTags; + vm.torrentSalesType = MeanTorrentConfig.meanTorrentConfig.torrentSalesType; + + vm.searchTags = []; + vm.searchKey = ''; + vm.releaseYear = undefined; + vm.topItems = 6; + + /** + * If user is not signed in then redirect back home + */ + if (!Authentication.user) { + $state.go('authentication.signin'); + } + + /** + * commentBuildPager + * pagination init + */ + vm.torrentBuildPager = function () { + vm.torrentPagedItems = []; + vm.torrentItemsPerPage = 8; + vm.torrentCurrentPage = 1; + vm.torrentFigureOutItemsToDisplay(); + }; + + /** + * commentFigureOutItemsToDisplay + * @param callback + */ + vm.torrentFigureOutItemsToDisplay = function (callback) { + vm.getMoviePageInfo(vm.torrentCurrentPage, function (items) { + vm.torrentFilterLength = items.total; + vm.torrentPagedItems = items.rows; + + if (callback) callback(); + }); + }; + + /** + * commentPageChanged + */ + vm.torrentPageChanged = function () { + var element = angular.element('#top_of_torrent_list'); + + $('.tb-v-middle').fadeTo(100, 0.01, function () { + vm.torrentFigureOutItemsToDisplay(function () { + $timeout(function () { + $('.tb-v-middle').fadeTo(400, 1, function () { + //window.scrollTo(0, element[0].offsetTop - 60); + $('html,body').animate({scrollTop: element[0].offsetTop - 60}, 200); + }); + }, 100); + }); + }); + }; + + /** + * onRadioTagClicked + * @param event + * @param n: tag name + */ + vm.onRadioTagClicked = function (event, n) { + var e = angular.element(event.currentTarget); + + if (e.hasClass('btn-success')) { + e.removeClass('btn-success').addClass('btn-default'); + vm.searchTags.splice(vm.searchTags.indexOf(n), 1); + } else { + e.addClass('btn-success').removeClass('btn-default').siblings().removeClass('btn-success').addClass('btn-default'); + vm.searchTags.push(n); + + angular.forEach(e.siblings(), function (se) { + if (vm.searchTags.indexOf(se.value) !== -1) { + vm.searchTags.splice(vm.searchTags.indexOf(se.value), 1); + } + }); + } + e.blur(); + vm.torrentBuildPager(); + }; + + /** + * onCheckboxTagClicked + * @param event + * @param n: tag name + */ + vm.onCheckboxTagClicked = function (event, n) { + var e = angular.element(event.currentTarget); + + if (e.hasClass('btn-success')) { + vm.searchTags.push(n); + } else { + vm.searchTags.splice(vm.searchTags.indexOf(n), 1); + } + vm.torrentBuildPager(); + }; + + /** + * onKeysKeyDown + * @param evt + */ + vm.onKeysKeyDown = function (evt) { + if (evt.keyCode === 13) { + vm.torrentBuildPager(); + } + }; + + /** + * getMoviePageInfo + * @param p: page number + */ + vm.getMoviePageInfo = function (p, callback) { + TorrentsService.get({ + skip: (p - 1) * vm.torrentItemsPerPage, + limit: vm.torrentItemsPerPage, + keys: vm.searchKey.trim(), + torrent_status: 'reviewed', + torrent_type: 'movie', + torrent_release: vm.releaseYear, + torrent_tags: vm.searchTags + }, function (items) { + if (items.length === 0) { + Notification.error({ + message: ' ' + $translate.instant('MOVIE_PAGE_INFO_EMPTY') + }); + } else { + callback(items); + console.log(items); + } + }, function (err) { + Notification.error({ + message: ' ' + $translate.instant('MOVIE_PAGE_INFO_ERROR') + }); + }); + }; + + /** + * getTagTitle + * @param tag: tag name + * @returns {*} + */ + vm.getTagTitle = function (tag) { + var tmp = tag; + var find = false; + angular.forEach(vm.resourcesTags.movie.radio, function (item) { + angular.forEach(item.value, function (sitem) { + if (sitem.name === tag) { + tmp = item.name; + find = true; + } + }); + }); + + if (!find) { + angular.forEach(vm.resourcesTags.movie.checkbox, function (item) { + angular.forEach(item.value, function (sitem) { + if (sitem.name === tag) { + tmp = item.name; + } + }); + }); + } + return tmp; + }; + + /** + * clearAllCondition + */ + vm.clearAllCondition = function () { + vm.searchKey = ''; + vm.searchTags = []; + $('.btn-tag').removeClass('btn-success').addClass('btn-default'); + + vm.torrentBuildPager(); + }; + + /** + * onTagClicked + * @param tag: tag name + */ + vm.onTagClicked = function (tag) { + $timeout(function () { + angular.element('#tag_' + tag).trigger('click'); + }, 100); + }; + + /** + * onReleaseClicked + * @param y + */ + vm.onReleaseClicked = function (y) { + if (vm.releaseYear === y) { + vm.releaseYear = undefined; + } else { + vm.releaseYear = y; + } + vm.torrentBuildPager(); + }; + + /** + * getSaleTypeDesc + */ + vm.getSaleTypeDesc = function (item) { + var desc = ''; + + angular.forEach(vm.torrentSalesType.value, function (st) { + if (st.name === item.torrent_sale_status) { + desc = st.desc; + } + }); + return desc; + }; + + /** + * onMoreTagsClicked + */ + vm.onMoreTagsClicked = function () { + var e = $('.more-tags'); + var i = $('#more-tags-icon'); + + if (!e.hasClass('panel-collapsed')) { + e.slideUp(); + e.addClass('panel-collapsed'); + i.removeClass('glyphicon-chevron-up').addClass('glyphicon-chevron-down'); + } else { + e.slideDown(); + e.removeClass('panel-collapsed'); + i.removeClass('glyphicon-chevron-down').addClass('glyphicon-chevron-up'); + } + }; + + /** + * downloadTorrent + * @param id + */ + vm.downloadTorrent = function (id) { + var url = '/api/torrents/download/' + id; + DownloadService.downloadFile(url, null, function (status) { + if (status === 200) { + Notification.success({ + message: ' ' + $translate.instant('TORRENTS_DOWNLOAD_SUCCESSFULLY') + }); + } + }, function (err) { + Notification.error({ + title: 'ERROR', + message: ' ' + $translate.instant('TORRENT_DOWNLOAD_ERROR') + }); + }); + }; + + /** + * openTorrentInfo + * @param id + */ + vm.openTorrentInfo = function (id) { + var url = $state.href('torrents.view', {torrentId: id}); + $window.open(url, '_blank'); + }; + } +}()); diff --git a/modules/torrents/client/controllers/torrents.client.controller.js b/modules/torrents/client/controllers/torrents.client.controller.js index 9eb5e0aa..eee9c9ab 100644 --- a/modules/torrents/client/controllers/torrents.client.controller.js +++ b/modules/torrents/client/controllers/torrents.client.controller.js @@ -23,8 +23,6 @@ vm.releaseYear = undefined; vm.topItems = 6; - vm.torrentTabs = []; - /** * If user is not signed in then redirect back home */ diff --git a/modules/torrents/client/views/admin/admin-list.client.view.html b/modules/torrents/client/views/admin/admin-list.client.view.html new file mode 100644 index 00000000..def5b5da --- /dev/null +++ b/modules/torrents/client/views/admin/admin-list.client.view.html @@ -0,0 +1,166 @@ +
+
+
+

+
+
+
+
+
{{ 'CA_KEYWORD' | translate}}:
+
+
+
+ +
+
+ + {{ 'MORE_TAGS' | translate}} + + + {{ 'CA_RESET' | translate}} + + +
+
+
+ + +
+
+
+
+ +
+
+ + +
+
+ + + + + + + + + + + + + + + + + + + + + +
{{ 'TABLE_FIELDS.INFO' | translate}}{{ 'TABLE_FIELDS.VOTES' | translate}}{{ 'TABLE_FIELDS.LIFETIME' | translate}}{{ 'TABLE_FIELDS.SIZE' | translate}}{{ 'TABLE_FIELDS.SEEDS_LEECHERS_FINISHED' | translate}}{{ 'TABLE_FIELDS.PUBLISHER' | translate}}
+
+
+ ... +
+
+
{{item.torrent_original_title}} + / {{item.torrent_title}} + + {{ 'CA_DOWNLOAD' | translate}} + +
+ +
+ {{t}} +
+ +
{{item.torrent_filename | filename}}
+ +
+ + + {{ item.torrent_release}} + + + {{item.torrent_sale_status}} {{item.torrent_sale_expires | unlife}} + + + + {{ 'RESOURCESTAGS.' + vm.getTagTitle(t) + '.' + t | translate}} + + +
+
+
+
+ IMDB {{item.torrent_imdb_votes | number : 1}} + {{item.createdat | life}}{{item.torrent_size | bytes:2}}{{item.user.displayName}}
+
+ +
+ + +
+
+
\ No newline at end of file diff --git a/modules/users/client/config/users-admin.client.menus.js b/modules/users/client/config/users-admin.client.menus.js index 105542e7..ceae4f01 100644 --- a/modules/users/client/config/users-admin.client.menus.js +++ b/modules/users/client/config/users-admin.client.menus.js @@ -11,7 +11,8 @@ function menuConfig(menuService) { menuService.addSubMenuItem('topbar', 'admin', { title: 'MENU_USERS_ADMIN', - state: 'admin.users' + state: 'admin.users', + target: '_blank' }); } }()); diff --git a/modules/users/client/config/users-admin.client.routes.js b/modules/users/client/config/users-admin.client.routes.js index b9784695..cfdd0e55 100644 --- a/modules/users/client/config/users-admin.client.routes.js +++ b/modules/users/client/config/users-admin.client.routes.js @@ -16,7 +16,7 @@ controller: 'UserListController', controllerAs: 'vm', data: { - pageTitle: 'Users List' + pageTitle: 'PAGETITLE.ADMIN_USER_LIST' } }) .state('admin.user', { @@ -28,7 +28,7 @@ userResolve: getUser }, data: { - pageTitle: 'Edit {{ userResolve.displayName }}' + pageTitle: 'PAGETITLE.ADMIN_USER_VIEW' } }) .state('admin.user-edit', { @@ -40,7 +40,7 @@ userResolve: getUser }, data: { - pageTitle: 'Edit User {{ userResolve.displayName }}' + pageTitle: 'PAGETITLE.ADMIN_USER_EDIT' } });