From 4eb9cf02a98a6a59a444fbf2906d1eeaca3667f1 Mon Sep 17 00:00:00 2001 From: sweta kumari Date: Tue, 6 Mar 2018 13:05:52 +0530 Subject: [PATCH] socioboard 3.0 update socioboard 3.0 update --- .../Controllers/FacebookController.cs | 9 + .../SavedFeedsManagementController.cs | 15 + .../Controllers/TwitterController.cs | 20 + .../Controllers/WebHookController.cs | 182 +++++++- src/Api.Socioboard/Helper/FacebookHelper.cs | 18 +- .../SavedFeedsManagementRepository.cs | 52 +++ src/Socioboard/wwwroot/_references.js | 1 + .../contents/socioboard/controllers/app.js | 2 +- .../socioboard/controllers/boardcontroller.js | 16 +- .../facebookfeedsmanagercontroller.js | 279 +++++++++++- .../instagramfeedsmanagercontroller.js | 42 ++ .../controllers/rssnewscontroller.js | 4 +- .../controllers/twitterfeedscontroller.js | 29 ++ .../twitterfeedsmanagercontroller.js | 80 +++- .../socioboard/js/admin/socioboard.js | 40 ++ .../socioboard/views/boardme/board.html | 11 +- .../feeds_manager/facebookfeedsmanager.html | 399 ++++++++++++++---- .../feeds_manager/instagramfeedsmanager.html | 4 +- .../feeds_manager/twitterfeedsmanager.html | 69 ++- .../socioboard/views/shared/sidebar.html | 5 +- 20 files changed, 1110 insertions(+), 167 deletions(-) diff --git a/src/Api.Socioboard/Controllers/FacebookController.cs b/src/Api.Socioboard/Controllers/FacebookController.cs index 289916426..3616777dc 100644 --- a/src/Api.Socioboard/Controllers/FacebookController.cs +++ b/src/Api.Socioboard/Controllers/FacebookController.cs @@ -724,5 +724,14 @@ public IActionResult Fbtype(string profileId) return Ok(Userdata); } + + [HttpGet("GetFbAccSingle")] + public IActionResult GetFbAccSingle(string accId) + { + DatabaseRepository dbr = new DatabaseRepository(_logger, _env); + Domain.Socioboard.Models.Facebookaccounts pageDetails = dbr.Single(t => t.FbUserId == accId); + return Ok(pageDetails); + } + } } diff --git a/src/Api.Socioboard/Controllers/SavedFeedsManagementController.cs b/src/Api.Socioboard/Controllers/SavedFeedsManagementController.cs index c0207d16f..3a71881a8 100644 --- a/src/Api.Socioboard/Controllers/SavedFeedsManagementController.cs +++ b/src/Api.Socioboard/Controllers/SavedFeedsManagementController.cs @@ -86,5 +86,20 @@ public IActionResult GetComments(string postId, long groupId) { return Ok(SavedFeedsManagementRepository.GetComments(postId, groupId, _appSettings)); } + + [HttpPost("aprove")] + public IActionResult aprove(string strid ,bool update) + { + bool status = SavedFeedsManagementRepository.changeaprove(strid, update, _appSettings); + return Ok(status); + } + + //ScheduleMsg + [HttpPost("ScheduleMsg")] + public IActionResult ScheduleMsg(string postId, long groupId ,string schtime) + { + bool status = SavedFeedsManagementRepository.scheduleMsgRepo(postId, groupId, schtime, _appSettings); + return Ok(status); + } } } diff --git a/src/Api.Socioboard/Controllers/TwitterController.cs b/src/Api.Socioboard/Controllers/TwitterController.cs index 3469f43e1..6cbb98929 100644 --- a/src/Api.Socioboard/Controllers/TwitterController.cs +++ b/src/Api.Socioboard/Controllers/TwitterController.cs @@ -13,6 +13,8 @@ using System.Text.RegularExpressions; using Domain.Socioboard.Interfaces.Services; using System.Threading; +using MongoDB.Bson; +using Api.Socioboard.Repositories; // For more information on enabling Web API for empty projects, visit http://go.microsoft.com/fwlink/?LinkID=397860 @@ -519,5 +521,23 @@ public IActionResult GettwitterSingle(string profileId) } + // [HttpPost("publish")] + //public IActionResult publish(string profileId,string twitterText, long userId , string imgUrl ,string strid) + //{ + // DatabaseRepository dbr = new DatabaseRepository(_logger, _appEnv); + // string ret = Helper.TwitterHelper.PostTwitterMessage(_appSettings, _redisCache, twitterText, profileId, userId, imgUrl, true, 0, "", dbr, _logger); + // if (ret =="") + // { + // string responce = SavedFeedsManagementRepository.publish( profileId, strid, _appSettings); + + // return Ok(responce); + // } + // else + // { + // return Ok("failed"); + // } + + + // } } } diff --git a/src/Api.Socioboard/Controllers/WebHookController.cs b/src/Api.Socioboard/Controllers/WebHookController.cs index cc324acfe..77235156c 100644 --- a/src/Api.Socioboard/Controllers/WebHookController.cs +++ b/src/Api.Socioboard/Controllers/WebHookController.cs @@ -367,20 +367,36 @@ public async Task Post() } if (x["changes"][0]["value"]["item"] == "comment") { + _logger.LogInformation("comment section started"); + string profileId = Convert.ToString(x["id"]); + _logger.LogInformation("profileId" + profileId); + string sendId = Convert.ToString(x["changes"][0]["value"]["sender_id"]); + _logger.LogInformation("sendId" + sendId); + string sendername = Convert.ToString(x["changes"][0]["value"]["sender_name"]); + _logger.LogInformation("sendId" + sendId); + string like = Convert.ToString(x["changes"][0]["value"]["item"]); _logger.LogInformation("like" + like); + string postid = Convert.ToString(x["changes"][0]["value"]["post_id"]); + _logger.LogInformation("postid" + postid); + string message = Convert.ToString(x["changes"][0]["value"]["message"]); + _logger.LogInformation("message" + message); + string postTime = Convert.ToString(x["changes"][0]["value"]["created_time"]); - _logger.LogInformation("postTime comment" + postTime); + _logger.LogInformation("postTime Comment" + postTime); + string comment_id = Convert.ToString(x["changes"][0]["value"]["comment_id"]); _logger.LogInformation("comment_id " + comment_id); if (!string.IsNullOrEmpty(comment_id)) { + _logger.LogInformation("saving data started"); + MongoFbPostComment fbPostComment = new MongoFbPostComment(); fbPostComment.Id = MongoDB.Bson.ObjectId.GenerateNewId(); fbPostComment.EntryDate = DateTime.UtcNow.ToString("yyyy/MM/dd HH:mm:ss"); @@ -391,17 +407,94 @@ public async Task Post() string printDate = dateTime.ToShortDateString() + " " + dateTime.ToShortTimeString(); string createddate = Convert.ToDateTime(printDate).ToString("yyyy-MM-dd h:mm tt"); DateTime convertedDate = DateTime.SpecifyKind(DateTime.Parse(createddate), DateTimeKind.Utc); - fbPostComment.Commentdate = convertedDate.ToString(); - _logger.LogInformation("commnet date" + fbPostComment.Commentdate); + try + { + fbPostComment.Commentdate = convertedDate.ToString(); + _logger.LogInformation("commnet date" + fbPostComment.Commentdate); + } + catch (Exception ex) + { + fbPostComment.Commentdate = " "; + _logger.LogInformation("commnetDate error" + ex.Message); + } + + //fbPostComment.Commentdate = DateTime.Parse(postTime).ToString("yyyy/MM/dd HH:mm:ss"); - fbPostComment.PostId = postid; - fbPostComment.Likes = 0; - fbPostComment.UserLikes = 0; - fbPostComment.PictureUrl = message; - fbPostComment.FromName = sendername; - fbPostComment.FromId = sendId; - fbPostComment.CommentId = comment_id; - fbPostComment.Comment = message; + try + { + fbPostComment.PostId = postid; + } + catch (Exception ex) + { + fbPostComment.PostId = " "; + _logger.LogInformation("PostId error" + ex.Message); + } + try + { + fbPostComment.Likes = Convert.ToInt16(like); + } + catch(Exception ex) + { + fbPostComment.Likes = 0; + _logger.LogInformation("Likes error" + ex.Message); + } + try + { + fbPostComment.UserLikes = 0; + } + catch(Exception ex) + { + fbPostComment.UserLikes = 0; + _logger.LogInformation("userlikes error" + ex.Message); + } + try + { + fbPostComment.PictureUrl = message; + } + catch(Exception ex) + { + fbPostComment.PictureUrl = " "; + _logger.LogInformation("PictureUrl error" + ex.Message); + } + try + { + fbPostComment.FromName = sendername; + } + catch (Exception ex) + { + fbPostComment.FromName = " "; + _logger.LogInformation("FromName error" + ex.Message); + } + + try + { + fbPostComment.FromId = sendId; + } + catch (Exception ex) + { + fbPostComment.FromId = " "; + _logger.LogInformation("FromId error" + ex.Message); + } + + try + { + fbPostComment.CommentId = comment_id; + } + catch (Exception ex) + { + fbPostComment.CommentId = " "; + _logger.LogInformation("CommentId error" + ex.Message); + } + try + { + fbPostComment.Comment = message; + } + catch (Exception ex) + { + fbPostComment.Comment = " "; + _logger.LogInformation("CommentId error" + ex.Message); + } + try { @@ -421,25 +514,30 @@ public async Task Post() { string profileId = Convert.ToString(x["id"]); _logger.LogInformation("ProfileId" + profileId); + string sendId = Convert.ToString(x["changes"][0]["value"]["sender_id"]); _logger.LogInformation("sendId" + sendId); + string sendername = Convert.ToString(x["changes"][0]["value"]["sender_name"]); _logger.LogInformation("sendername" + sendername); + string postid = Convert.ToString(x["changes"][0]["value"]["post_id"]); _logger.LogInformation("postid" + postid); + string message = Convert.ToString(x["changes"][0]["value"]["message"]); _logger.LogInformation("message" + message); + string postTime = Convert.ToString(x["changes"][0]["value"]["created_time"]); _logger.LogInformation("postTime" + postTime); + string share_id = Convert.ToString(x["changes"][0]["value"]["share_id"]); _logger.LogInformation("share_id" + share_id); + string link = Convert.ToString(x["changes"][0]["value"]["link"]); _logger.LogInformation("link" + link); - - Domain.Socioboard.Models.Mongo.MongoFacebookFeed _FacebookPagePost = new MongoFacebookFeed(); _FacebookPagePost.Id = ObjectId.GenerateNewId(); _FacebookPagePost.ProfileId = profileId; @@ -457,7 +555,7 @@ public async Task Post() try { _FacebookPagePost.FeedId = postid; - _logger.LogInformation("FeedId" + postid); + _logger.LogInformation("FeedId " + postid); } catch { @@ -562,12 +660,68 @@ public async Task Post() } if (x["changes"][0]["value"]["item"] == "like" || x["changes"][0]["value"]["item"] == "like") { + string profileId = Convert.ToString(x["id"]); + _logger.LogInformation("ProfileId" + profileId); string sendId = Convert.ToString(x["changes"][0]["value"]["sender_id"]); + _logger.LogInformation("sendId" + sendId); string sendername = Convert.ToString(x["changes"][0]["value"]["sender_name"]); + _logger.LogInformation("sendername" + sendername); string postid = Convert.ToString(x["changes"][0]["value"]["post_id"]); + _logger.LogInformation("postid" + postid); string postTime = Convert.ToString(x["changes"][0]["value"]["created_time"]); _logger.LogInformation("postTime in like part" + postTime); + string like = null; + try + { + like = Convert.ToString(x["changes"][0]["value"]["likes"]); + _logger.LogInformation("like " + like); + } + catch (Exception ex) + { + _logger.LogInformation("like error"+ex); + } + + + if (!string.IsNullOrEmpty(profileId)) + { + MongoFbPostComment fbPostComment = new MongoFbPostComment(); + fbPostComment.Id = MongoDB.Bson.ObjectId.GenerateNewId(); + fbPostComment.EntryDate = DateTime.UtcNow.ToString("yyyy/MM/dd HH:mm:ss"); + + double datevalue = Convert.ToDouble(postTime); + System.DateTime dateTime = new System.DateTime(1970, 1, 1, 0, 0, 0, 0); + dateTime = dateTime.AddSeconds(datevalue); + string printDate = dateTime.ToShortDateString() + " " + dateTime.ToShortTimeString(); + string createddate = Convert.ToDateTime(printDate).ToString("yyyy-MM-dd h:mm tt"); + DateTime convertedDate = DateTime.SpecifyKind(DateTime.Parse(createddate), DateTimeKind.Utc); + fbPostComment.Commentdate = convertedDate.ToString(); + _logger.LogInformation("commnet date" + fbPostComment.Commentdate); + //fbPostComment.Commentdate = DateTime.Parse(postTime).ToString("yyyy/MM/dd HH:mm:ss"); + fbPostComment.PostId = postid; + fbPostComment.Likes = Convert.ToInt16(like); + fbPostComment.UserLikes = 0; + // fbPostComment.PictureUrl = message; + fbPostComment.FromName = sendername; + fbPostComment.FromId = sendId; + // fbPostComment.CommentId = comment_id; + // fbPostComment.Comment = message; + try + { + + MongoRepository fbPostRepo = new MongoRepository("MongoFbPostComment", _appSettings); + fbPostRepo.Add(fbPostComment); + _logger.LogInformation("added data in MongoFbPostComment"); + } + catch (Exception ex) + { + _logger.LogInformation("comment error while adding in mongo"); + _logger.LogInformation(ex.Message); + _logger.LogError(ex.StackTrace); + } + } + + } } diff --git a/src/Api.Socioboard/Helper/FacebookHelper.cs b/src/Api.Socioboard/Helper/FacebookHelper.cs index 9ae13a462..fd4167b5d 100644 --- a/src/Api.Socioboard/Helper/FacebookHelper.cs +++ b/src/Api.Socioboard/Helper/FacebookHelper.cs @@ -208,15 +208,23 @@ public static string UrlComposeMessage(Domain.Socioboard.Enum.FbProfileType prof } else { - if (!string.IsNullOrEmpty(link)) - { - args["link"] = link; - } + //if (!string.IsNullOrEmpty(link)) + //{ + // args["link"] = link; + //} if (!string.IsNullOrEmpty(imagePath)) { args["picture"] = imagePath.Replace("&", "&"); } - ret = fb.Post("v2.7/" + fbUserId + "/feed", args).ToString();//v2.1 + try + { + ret = fb.Post("v2.7/" + fbUserId + "/feed", args).ToString();//v2.1 + } + catch(Exception ex) + { + + } + } ScheduledMessage scheduledMessage = new ScheduledMessage(); diff --git a/src/Api.Socioboard/Repositories/SavedFeedsManagementRepository.cs b/src/Api.Socioboard/Repositories/SavedFeedsManagementRepository.cs index db3e2f018..1d7dabce4 100644 --- a/src/Api.Socioboard/Repositories/SavedFeedsManagementRepository.cs +++ b/src/Api.Socioboard/Repositories/SavedFeedsManagementRepository.cs @@ -133,6 +133,58 @@ public static bool DeleteComment(string commentId, Helper.AppSettings _settings) return null; } } + + public static bool changeaprove(string strid, bool update, Helper.AppSettings _settings) + { + MongoRepository mongorepo = new MongoRepository("SavedFeedsManagement", _settings); + try + { + FilterDefinition filter = new BsonDocument("strId", strid); + var Update = Builders.Update.Set("review", update); + mongorepo.Update(Update, filter); + return true; + } + catch + { + return false; + } + } + + + public static string publish(string profileId, string strid, Helper.AppSettings _settings) + { + MongoRepository mongorepo = new MongoRepository("SavedFeedsManagement", _settings); + try + { + FilterDefinition filter = new BsonDocument("strId", strid); + var Update = Builders.Update.Set("status", "2"); + mongorepo.Update(Update, filter); + return "sucess"; + } + catch + { + return "failed"; + } + } + + + public static bool scheduleMsgRepo(string postId, long groupId,string schtime, Helper.AppSettings _settings) + { + MongoRepository mongorepo = new MongoRepository("SavedFeedsManagement", _settings); + try + { + + FilterDefinition filter = new BsonDocument("postId", postId); + var update = Builders.Update.Set("scheduleTime", schtime); + mongorepo.Update(update, filter); + return true; + } + catch + { + return false; + } + } + } } diff --git a/src/Socioboard/wwwroot/_references.js b/src/Socioboard/wwwroot/_references.js index bdf3716f2..90badb4cb 100644 --- a/src/Socioboard/wwwroot/_references.js +++ b/src/Socioboard/wwwroot/_references.js @@ -24,6 +24,7 @@ /// /// /// +/// /// /// /// diff --git a/src/Socioboard/wwwroot/contents/socioboard/controllers/app.js b/src/Socioboard/wwwroot/contents/socioboard/controllers/app.js index 4aef29947..c85b4607f 100644 --- a/src/Socioboard/wwwroot/contents/socioboard/controllers/app.js +++ b/src/Socioboard/wwwroot/contents/socioboard/controllers/app.js @@ -1112,7 +1112,7 @@ SocioboardApp.config(['$stateProvider', '$urlRouterProvider', function ($statePr // facebook feeds manager .state('facebookfeedsmanager', { - url: "/facebookfeedsmanager", + url: "/facebookfeedsmanager/{profileId}", templateUrl: "../contents/socioboard/views/feeds_manager/facebookfeedsmanager.html", data: { pageTitle: 'Facebook feeds manager', pageSubTitle: 'updated' }, controller: "FacebookFeedsManagerController", diff --git a/src/Socioboard/wwwroot/contents/socioboard/controllers/boardcontroller.js b/src/Socioboard/wwwroot/contents/socioboard/controllers/boardcontroller.js index 40f5d349b..81258767d 100644 --- a/src/Socioboard/wwwroot/contents/socioboard/controllers/boardcontroller.js +++ b/src/Socioboard/wwwroot/contents/socioboard/controllers/boardcontroller.js @@ -229,47 +229,45 @@ SocioboardApp.controller('BoardController', function ($rootScope, $scope, $http, $scope.cmpbtn = true; $scope.openComposeMessage = function (schedulemessage) { + // console.log(schedulemessage); jQuery('input:checkbox').removeAttr('checked'); if (schedulemessage.gplusboardaccprofileid != null) { var message = { //"shareMessage": schedulemessage.title, - //"picUrl": schedulemessage.imageurl, + "picUrl": schedulemessage.imageurl, "url": schedulemessage.feedlink, "feedId": schedulemessage.feedid, "fromId": schedulemessage.fromId, "fromName": schedulemessage.fromName, "socialMedia": "gplus" }; - console.log(message); - console.log("google"); + $rootScope.boardComposeMessage = message; } else if (schedulemessage.twitterprofileid != null) { var message = { //"shareMessage": schedulemessage.text, - //"picUrl": schedulemessage.imageurl, + "picUrl": schedulemessage.imageurl, "url": schedulemessage.feedurl, "feedId": schedulemessage.feedid, "fromId": schedulemessage.fromId, "fromName": schedulemessage.fromName, "socialMedia": "twitter" }; - console.log(message); - console.log("twitter"); + $rootScope.boardComposeMessage = message; } else if (schedulemessage.feedid != null) { var message = { //"shareMessage": schedulemessage.tags, - //"picUrl": schedulemessage.imageurl, + "picUrl": schedulemessage.imageurl, "url": schedulemessage.link, "feedId": schedulemessage.feedid, "fromId": schedulemessage.fromId, "fromName": schedulemessage.fromName, "socialMedia": "instagram" }; - console.log(message); - console.log("instagram"); + $rootScope.boardComposeMessage = message; } diff --git a/src/Socioboard/wwwroot/contents/socioboard/controllers/facebookfeedsmanagercontroller.js b/src/Socioboard/wwwroot/contents/socioboard/controllers/facebookfeedsmanagercontroller.js index 205826f3d..1ed78a5de 100644 --- a/src/Socioboard/wwwroot/contents/socioboard/controllers/facebookfeedsmanagercontroller.js +++ b/src/Socioboard/wwwroot/contents/socioboard/controllers/facebookfeedsmanagercontroller.js @@ -1,19 +1,292 @@ 'use strict'; -SocioboardApp.controller('FacebookFeedsManagerController', function ($rootScope, $scope, $http, $timeout) { +SocioboardApp.controller('FacebookFeedsManagerController', function ($rootScope, $scope, $http, $timeout, $stateParams, apiDomain, domain) { //alert('helo'); $scope.$on('$viewContentLoaded', function() { facebookfeedsmanager(); $('.collapsible').collapsible({ - accordion : false + accordion : false }); + console.log($stateParams.profileId); + + $scope.loadProfileDetails = function () { + $http.get(apiDomain + '/api/Facebook/GetFbAccSingle?accId=' + $stateParams.profileId) + .then(function (response) { + debugger; + $scope.profileData = response.data; + console.log($scope.profileData); + + }, function (reason) { + $scope.error = reason.data; + }); + } + $scope.loadProfileDetails(); $scope.openModels=function() { $('#chatComment').openModal(); $('#closeDiv').closeModal(); } + + + $scope.loadfeedsSavedData = function () { + $http.get(apiDomain + '/api/SavedFeedsManagement/GetSavedFeeds?profileId=' + $stateParams.profileId + '&groupId=' + $rootScope.groupId) + .then(function (response) { + debugger; + $scope.feedsSavedData = response.data; + + }, function (reason) { + $scope.error = reason.data; + }); + } + $scope.loadfeedsSavedData(); + + //for scheduleing feeds start + $scope.schdule = function(detail) { + + $http.get(apiDomain + '/api/SavedFeedsManagement/ScheduleMsg?profileId=' + $stateParams.profileId) + .then(function (response) { + $scope.schfeed = response.data; + }, function (reason) { + $scope.error = reason.data; + + }); + + } + //for scheduleing feeds end + + + + //aprove post + + $scope.aprovepost = function (value) { + debugger; + if (value.review == false) { + var d = value.strId + $http.post(apiDomain + '/api/SavedFeedsManagement/aprove?strid=' + d + '&update=' + 'true') + .then(function (response) { + swal({ + position: 'top-end', + type: 'success', + title: 'Your Post is aprove', + showConfirmButton: false, + timer: 5000 + }) + window.location.reload() + }) + + + } + else { + var e = value.strId + $http.post(apiDomain + '/api/SavedFeedsManagement/aprove?strid=' + e + '&update=' + 'false') + .then(function (response) { + swal({ + position: 'top-end', + type: 'success', + title: 'sucessfully changes ', + showConfirmButton: false, + timer: 5000 + }) + window.location.reload() + + }) + } + + + } + //End + + + + //code for compose message start + $scope.ComposeMessage = function () { + var message = $('#compose').val(); + var updatedmessage = ""; + var testmsg = message; + message = encodeURIComponent(message); + + $scope.findExtension(); + if (/\S/.test(testmsg)) { + $scope.checkfile(); + if ($scope.check == true) { + var formData = new FormData(); + formData.append('files', $("#input_file").get(0).files[0]); + $http({ + method: 'POST', + url: apiDomain + '/api/SavedFeedsManagement/SavePost?socialProfileId=' + $stateParams.profileId + '&userId=' + $rootScope.user.Id + '&groupId=' + $rootScope.groupId + '&profileType=1' + '&shareMessage=' + message + '&picUrl=' + $scope.profileData.profileUrl + '&mediaType=' + $scope.fileExtensionName + '&SocialProfileName=' + $scope.profileData.fbUserName + '&sbuserName=' + $rootScope.user.FirstName + ' ' + $rootScope.user.LastName + '&sbuserPic=' + $rootScope.user.ProfilePicUrl, + data: formData, + headers: { + 'Content-Type': undefined + }, + transformRequest: angular.identity, + }).then(function (response) { + if (response.data == true) { + swal('Post saved successfully'); + console.log(response.data); + $(".dropify-clear").click(); + } + + }, function (reason) { + + }); + } + else { + alertify.set({ delay: 3000 }); + alertify.error("File extension is not valid. Please upload an image file"); + $('#input-file-now').val(''); + } + } + else { + swal('Please enter some text to compose this message'); + } + } + //code for compose message end + + //code for checking the file format start + $scope.checkfile = function () { + var filesinput = $('#input_file');//composeImage + var fileExtension = ['jpeg', 'jpg', 'png', 'gif', 'bmp', 'mov', 'mp4', 'mpeg', 'wmv', 'avi', 'flv', '3gp']; + if (filesinput != undefined && filesinput[0].files[0] != null) { + if ($scope.hasExtension('#input_file', fileExtension)) { + $scope.check = true; + } + else { + $scope.check = false; + } + } + else { + $scope.check = true; + } + } + + $scope.hasExtension = function (inputID, exts) { + var fileName = $('#input_file').val(); + return (new RegExp('(' + exts.join('|').replace(/\./g, '\\.') + ')$')).test(fileName); + } + + //code for checking the file format end + $scope.findExtension = function () { + var fileName = $('#input_file'); + var fileExtensionImage = ['jpeg', 'jpg', 'png', 'gif', 'bmp']; + var fileExtensionVideo = ['mov', 'mp4', 'mpeg', 'wmv', 'avi', 'flv', '3gp']; + if ($scope.hasExtension('#input_file', fileExtensionImage)) { + $scope.fileExtensionName = 1; + } + else if ($scope.hasExtension('#input_file', fileExtensionVideo)) { + $scope.fileExtensionName = 2; + } + else { + $scope.fileExtensionName = 0; + } + } + + //Comments Management + $scope.openComment = function (selectedFeedData) { + $('#commentModal').openModal(); + $scope.selectedFeed = selectedFeedData; + + $http.get(apiDomain + '/api/SavedFeedsManagement/GetComments?postId=' + selectedFeedData.strId + '&groupId=' + $rootScope.groupId) + .then(function (response) { + $scope.allcomment = response.data; + }, function (reason) { + $scope.error = reason.data; + }); + + } + + $scope.hour_select = function (hrvalue) { + $scope.hourval = hrvalue; + + } + $scope.min_select = function (minvalu) { + $scope.minval = minvalu; + } + $scope.ampm_select = function (ampmval) { + $scope.ampmvalu = ampmval; + } + + + $scope.schedule = function (selectedFeedData) { + $('#scheduleModal').openModal(); + $scope.selectedFeed = selectedFeedData; + var datetime = $scope.hourval + ":" + $scope.minval + '' + $scope.ampmvalu + + $http.get(apiDomain + '/api/SavedFeedsManagement/ScheduleMsg?postId=' + selectedFeedData.strId + '&groupId=' + $rootScope.groupId + '&schtime=') + .then(function (response) { + $scope.allcomment = response.data; + }, function (reason) { + $scope.error = reason.data; + }); + + } + + + $scope.addComment = function (selectedFeedData, comment) { + $http({ + method: 'POST', + url: apiDomain + '/api/SavedFeedsManagement/SaveComment?postId=' + selectedFeedData.strId + '&profileId=' + selectedFeedData.socialProfileId + '&commentText=' + comment + '&userId=' + $rootScope.user.Id + '&groupId=' + $rootScope.groupId + '&userProfilePic=' + $rootScope.user.ProfilePicUrl + '&userName=' + $rootScope.user.FirstName + ' ' + $rootScope.user.LastName, + headers: { + 'Content-Type': undefined + }, + transformRequest: angular.identity, + }).then(function (response) { + if (response.data == "Posted") { + swal("Comment Posted"); + } + + }, function (reason) { + + }); + } + //END COMMENTS MANAGEMANT + + + //Delete Post + $scope.deletePost = function (tempPostId) { + swal({ + title: "Delete task", + text: "Post will be deleted", + type: "info", + showCancelButton: true, + closeOnConfirm: false, + showLoaderOnConfirm: true + }, function () { + $http.post(apiDomain + '/api/SavedFeedsManagement/DeletePost?postId=' + tempPostId) + .then(function (response) { + if (response.data == true) { + swal("Deleted"); + } + }, function (reason) { + $scope.error = reason.data; + }); + }); + } + //END DELETE POST + + //Show AND hide Header + $scope.hideheadernames = " Hide"; + var countheader = 0; + $scope.hideHeader = function () { + countheader++; + if (countheader % 2 == 0) { + $("#myHide").show(); + $scope.hideheadernames = " Hide"; + } + else { + $("#myHide").hide(); + $scope.hideheadernames = " Show"; + } + + console.log("headerd", $scope.hideheadernames); + } }); -}); \ No newline at end of file +}) +.filter('Url', function ($sce) { + return function (Url) { + return $sce.trustAsResourceUrl(Url); + }; +}); + diff --git a/src/Socioboard/wwwroot/contents/socioboard/controllers/instagramfeedsmanagercontroller.js b/src/Socioboard/wwwroot/contents/socioboard/controllers/instagramfeedsmanagercontroller.js index c6ae3dfe8..59bd7c1d4 100644 --- a/src/Socioboard/wwwroot/contents/socioboard/controllers/instagramfeedsmanagercontroller.js +++ b/src/Socioboard/wwwroot/contents/socioboard/controllers/instagramfeedsmanagercontroller.js @@ -144,6 +144,48 @@ SocioboardApp.controller('InstagramFeedsManagerController', function ($rootScope } //END COMMENTS MANAGEMANT + //aprove post + + $scope.aprovepost = function (value) { + debugger; + if (value.review == false) { + var d = value.strId + $http.post(apiDomain + '/api/SavedFeedsManagement/aprove?strid=' + d + '&update=' + 'true') + .then(function (response) { + swal({ + position: 'top-end', + type: 'success', + title: 'Your Post is aprove', + showConfirmButton: false, + timer: 5000 + }) + window.location.reload() + }) + + + } + else { + var e = value.strId + $http.post(apiDomain + '/api/SavedFeedsManagement/aprove?strid=' + e + '&update=' + 'false') + .then(function (response) { + swal({ + position: 'top-end', + type: 'success', + title: 'sucessfully changes ', + showConfirmButton: false, + timer: 5000 + }) + window.location.reload() + + }) + } + + + } + //End + + + //Delete Post $scope.deletePost = function (tempPostId) { swal({ diff --git a/src/Socioboard/wwwroot/contents/socioboard/controllers/rssnewscontroller.js b/src/Socioboard/wwwroot/contents/socioboard/controllers/rssnewscontroller.js index 27e740369..e0afab826 100644 --- a/src/Socioboard/wwwroot/contents/socioboard/controllers/rssnewscontroller.js +++ b/src/Socioboard/wwwroot/contents/socioboard/controllers/rssnewscontroller.js @@ -43,7 +43,7 @@ SocioboardApp.controller('RssNewsController', function ($rootScope, $scope, $htt swal({ title: "Are you sure?", - text: "You will not be able to send message via this account!", + text: "You want to delete this!", type: "warning", showCancelButton: true, confirmButtonColor: "#DD6B55", @@ -55,7 +55,7 @@ SocioboardApp.controller('RssNewsController', function ($rootScope, $scope, $htt $http.post(apiDomain + '/api/RssFeed/DeleteContentFeeds?contentfeedid=' + profileId) .then(function (response) { if (response.data == "success") { - swal("Deleted!", "Your profile has been deleted.", "success"); + swal("Deleted!", "content feed has been deleted.", "success"); window.location.reload(); //$scope.loadpageshareathon(); } diff --git a/src/Socioboard/wwwroot/contents/socioboard/controllers/twitterfeedscontroller.js b/src/Socioboard/wwwroot/contents/socioboard/controllers/twitterfeedscontroller.js index 9986cc0e2..f96255ae5 100644 --- a/src/Socioboard/wwwroot/contents/socioboard/controllers/twitterfeedscontroller.js +++ b/src/Socioboard/wwwroot/contents/socioboard/controllers/twitterfeedscontroller.js @@ -612,6 +612,35 @@ SocioboardApp.controller('TwitterFeedsController', function ($rootScope, $scope, // end codes to load recent Tweets } //end + + $scope.connect = function () { + debugger; + + $http.get(apiDomain + '/api/Twitter/feeds?profileId=' + $stateParams.profileId) + .then(function (response) { + debugger; + $scope.UserTweets = response.data; + //$scope.preloadmoretweets = true; + //if (response.data == null) { + // TweetsreachLast = true; + //} + //}, function (reason) { + //$scope.error = reason.data; + }); + // end codes to load recent Tweets + } + + $scope.keywordsearch = function (data) { + debugger; + var key = $('#categories').val(); + $http.get(apiDomain + '/api/Twitter/searchkeyword?profileId=' + $stateParams.profileId + '&keyword=' + key) + .then(function (response) { + debugger; + $scope.UserTweets = response.data; + }); + // end codes to load recent Tweets + } + }); }); diff --git a/src/Socioboard/wwwroot/contents/socioboard/controllers/twitterfeedsmanagercontroller.js b/src/Socioboard/wwwroot/contents/socioboard/controllers/twitterfeedsmanagercontroller.js index 760f4ba45..dd4c584be 100644 --- a/src/Socioboard/wwwroot/contents/socioboard/controllers/twitterfeedsmanagercontroller.js +++ b/src/Socioboard/wwwroot/contents/socioboard/controllers/twitterfeedsmanagercontroller.js @@ -43,8 +43,67 @@ SocioboardApp.controller('TwitterFeedsManagerController', function ($rootScope, + $scope.aprovepost = function (value) { + debugger; + if (value.review == false) + { + var d = value.strId + $http.post(apiDomain + '/api/SavedFeedsManagement/aprove?strid=' + d + '&update=' + 'true') + .then(function (response) { + swal({ + position: 'top-end', + type: 'success', + title: 'Your Post is aprove', + showConfirmButton: false, + timer: 5000 + }) + window.location.reload() + }) + + + } + else + { + var e = value.strId + $http.post(apiDomain + '/api/SavedFeedsManagement/aprove?strid=' + e+ '&update=' + 'false') + .then(function (response) { + swal({ + position: 'top-end', + type: 'success', + title: 'sucessfully changes ', + showConfirmButton: false, + timer: 5000 + }) + window.location.reload() + + }) + } + + + } + $scope.publish = function (post) { + debugger; + $http.post(apiDomain + '/api/Twitter/publish?profileId=' + $stateParams.profileId + '&twitterText=' + post.shareMessage + '&UserId=' + post.userId + '&imgUrl=' + post.url + '&strid=' + post.strId) + .then(function (response) { + + //if (response == "") { + swal({ + position: 'top-end', + type: 'success', + title: 'Your Post sucessfully publish ', + showConfirmButton: false, + timer: 4000 + }) + //} + //else { + // swal("Somthing Went Wrong"); + //} + + }); + } + $scope.ComposeMessage = function () { debugger; var message = $('#compose').val(); @@ -129,11 +188,22 @@ SocioboardApp.controller('TwitterFeedsManagerController', function ($rootScope, - - - - - + //Show AND hide Header + $scope.hideheadernames = " Hide"; + var countheader = 0; + $scope.hideHeader = function () { + debugger; + countheader++; + if (countheader % 2 == 0) { + $("#myHide").show(); + $scope.hideheadernames = " Hide"; + } + else { + $("#myHide").hide(); + $scope.hideheadernames = " Show"; + } + } + //END show AND hide Header }); diff --git a/src/Socioboard/wwwroot/contents/socioboard/js/admin/socioboard.js b/src/Socioboard/wwwroot/contents/socioboard/js/admin/socioboard.js index 1bedb0bbb..dd1463ebd 100644 --- a/src/Socioboard/wwwroot/contents/socioboard/js/admin/socioboard.js +++ b/src/Socioboard/wwwroot/contents/socioboard/js/admin/socioboard.js @@ -662,6 +662,46 @@ facebookfeeds = function () { }); } +// facebook feeds manager + +facebookfeedsmanager = function () { + // initialize core components + + $('.modal-trigger').leanModal(); + $('ul.tabs').tabs(); + $('select').material_select(); + $('.tooltipped').tooltip({ delay: 50 }); + $('.dropdown-button').dropdown({ + inDuration: 300, + outDuration: 225, + constrain_width: false, // Does not change width of dropdown to that of the activator + hover: true, // Activate on hover + gutter: 0, // Spacing from edge + belowOrigin: false, // Displays dropdown below the button + alignment: 'left' // Displays dropdown with edge aligned to the left of button + }); + + $('.datepicker').pickadate({ + selectMonths: true, // Creates a dropdown to control month + selectYears: 15 // Creates a dropdown of 15 years to control year + }); + $('.collapsible').collapsible({ + accordion: false // A setting that changes the collapsible behavior to expandable instead of the default accordion style + }); + + // Basic + $('.dropify').dropify(); + + + $('.facebookfeeds').slimScroll({ + color: '#3B5998', + size: '10px', + height: '600px', + alwaysVisible: true, + allowPageScroll: true + }); +} + twitterfeeds = function () { // initialize core components $('.modal-trigger').leanModal(); diff --git a/src/Socioboard/wwwroot/contents/socioboard/views/boardme/board.html b/src/Socioboard/wwwroot/contents/socioboard/views/boardme/board.html index fc6c7add3..e774c40b4 100644 --- a/src/Socioboard/wwwroot/contents/socioboard/views/boardme/board.html +++ b/src/Socioboard/wwwroot/contents/socioboard/views/boardme/board.html @@ -80,12 +80,12 @@
#{{bname}}
- + @{{feed.fromName}} - + @{{feed.fromName}} @@ -353,9 +353,12 @@

Categories Featured

Select your file [Ex: gif, jpeg, png, mp4, ...]

-
+
+
+ +
@@ -441,7 +444,7 @@

Categories Featured

$('#waterfall').NewWaterfall(); }); - // 自动加载更多 + // 自动加载更多 automatic load more function random(min, max) { return min + Math.floor(Math.random() * (max - min + 1)) } diff --git a/src/Socioboard/wwwroot/contents/socioboard/views/feeds_manager/facebookfeedsmanager.html b/src/Socioboard/wwwroot/contents/socioboard/views/feeds_manager/facebookfeedsmanager.html index 0bdcb2366..6d826a3df 100644 --- a/src/Socioboard/wwwroot/contents/socioboard/views/feeds_manager/facebookfeedsmanager.html +++ b/src/Socioboard/wwwroot/contents/socioboard/views/feeds_manager/facebookfeedsmanager.html @@ -1,3 +1,8 @@ +
@@ -5,89 +10,96 @@
-
+ +
+
+ +
{{profileData.fbUserName}}
+ + +
+
+ +
-
@@ -95,64 +107,230 @@
Chanchal
+ +
+ + + + diff --git a/src/Socioboard/wwwroot/contents/socioboard/views/feeds_manager/instagramfeedsmanager.html b/src/Socioboard/wwwroot/contents/socioboard/views/feeds_manager/instagramfeedsmanager.html index 1984e7a38..0423f1440 100644 --- a/src/Socioboard/wwwroot/contents/socioboard/views/feeds_manager/instagramfeedsmanager.html +++ b/src/Socioboard/wwwroot/contents/socioboard/views/feeds_manager/instagramfeedsmanager.html @@ -77,12 +77,12 @@
{{profileData.insUserName}}
diff --git a/src/Socioboard/wwwroot/contents/socioboard/views/feeds_manager/twitterfeedsmanager.html b/src/Socioboard/wwwroot/contents/socioboard/views/feeds_manager/twitterfeedsmanager.html index d74ac48a8..032e107c3 100644 --- a/src/Socioboard/wwwroot/contents/socioboard/views/feeds_manager/twitterfeedsmanager.html +++ b/src/Socioboard/wwwroot/contents/socioboard/views/feeds_manager/twitterfeedsmanager.html @@ -5,15 +5,33 @@
-
+
{{profileData.twitterScreenName}}
-
+ + +
  • @@ -27,10 +45,10 @@
    {{profileData.twitterScreenName}}
-
+
@@ -40,12 +58,12 @@
{{profileData.twitterScreenName}}
@@ -54,39 +72,14 @@
{{profileData.twitterScreenName}}
- - -
  • - {{fbfeed._facebookFeed.fromName}} - -
    - - -
    - -
    -
    -
  • + + + diff --git a/src/Socioboard/wwwroot/contents/socioboard/views/shared/sidebar.html b/src/Socioboard/wwwroot/contents/socioboard/views/shared/sidebar.html index ded4841c8..61a8912d5 100644 --- a/src/Socioboard/wwwroot/contents/socioboard/views/shared/sidebar.html +++ b/src/Socioboard/wwwroot/contents/socioboard/views/shared/sidebar.html @@ -264,8 +264,9 @@