示例#1
0
 public ActionResult IndexSaveSettings(VimeoSettingsPartViewModel vm)
 {
     try {
         _vimeoAdminServices.UpdateSettings(vm);
     } catch (VimeoRateException vre) {
         _orchardServices.Notifier.Error(T("Too many requests to Vimeo. Rate limits will reset on {0} UTC", vre.resetTime.Value.ToString()));
     } catch (Exception ex) {
         _orchardServices.Notifier.Error(T("{0}", ex.Message));
     }
     return(RedirectToAction("Index"));
 }
示例#2
0
        public ActionResult IndexTestSettings(VimeoSettingsPartViewModel vm)
        {
            if (!_orchardServices.Authorizer.Authorize(StandardPermissions.SiteOwner, T("Not allowed to manage Vimeo settings")))
            {
                return(new HttpUnauthorizedResult());
            }
            try {
                //update the access tokens by removing those flagged for deletion (as well as duplicates)
                _vimeoAdminServices.ConsolidateTokensList(vm);
                //test the remaining tokens
                string atsValid = _vimeoAdminServices.TokensAreValid(vm);
                if (atsValid == "OK")
                {
                    _orchardServices.Notifier.Information(T("Access Tokens are valid"));
                    //now test group, channel and album. We do not test this here, because access tokens are not committed to the db
                    //so the ones in the vm may not match.
                    //if (!string.IsNullOrWhiteSpace(vm.GroupName)) {
                    //    if (_vimeoAdminServices.GroupIsValid(vm))
                    //        _orchardServices.Notifier.Information(T("Group Name Valid"));
                    //    else
                    //        _orchardServices.Notifier.Error(T("Group Name not valid"));
                    //}
                    //if (!string.IsNullOrWhiteSpace(vm.ChannelName)) {
                    //    if (_vimeoAdminServices.ChannelIsValid(vm))
                    //        _orchardServices.Notifier.Information(T("Channel Name Valid"));
                    //    else
                    //        _orchardServices.Notifier.Error(T("Channel Name not valid"));
                    //}
                    //if (!string.IsNullOrWhiteSpace(vm.AlbumName)) {
                    //    if (_vimeoAdminServices.AlbumIsValid(vm))
                    //        _orchardServices.Notifier.Information(T("Album Name Valid"));
                    //    else
                    //        _orchardServices.Notifier.Error(T("Album Name not valid"));
                    //}
                }
                else
                {
                    _orchardServices.Notifier.Error(T("Access Tokens are not valid: {0}{1}", Environment.NewLine, atsValid));
                }
            } catch (VimeoRateException vre) {
                _orchardServices.Notifier.Error(T("Too many requests to Vimeo. Rate limits will reset on {0} UTC", vre.resetTime.Value.ToString()));
            } catch (Exception ex) {
                _orchardServices.Notifier.Error(T("{0}", ex.Message));
            }



            return(View(vm));
        }