protected override ApiRequest ParseRequestInfo(IDictionary<string, string> groups, Tenant t)
        {
            var type = groups["type"];
            if (type == "task")
            {
                return new ApiRequest(string.Format("project/{0}/task", groups["projectId"]))
                {
                    Parameters = new List<RequestParameter>
                        {
                            new RequestParameter("description", new PlainTextContentResolver()),
                            new RequestParameter("deadline", new TaskDeadlineResolver()),
                            new RequestParameter("priority", new TaskPriorityResolver()),
                            new RequestParameter("milestoneid", new TaskMilestoneResolver()),
                            new RequestParameter("responsibles", new TaskResponsiblesResolver()),
                            new RequestParameter("responsible", new TaskResponsibleResolver()),
                            new RequestParameter("title", new TitleResolver(TaskDeadlineResolver.Pattern, TaskPriorityResolver.Pattern, TaskMilestoneResolver.Pattern, TaskResponsiblesResolver.Pattern))
                        }
                };
            }

            return new ApiRequest(string.Format("project/{0}/message", groups["projectId"]))
                {
                    Parameters = new List<RequestParameter>
                        {
                            new RequestParameter("title", new TitleResolver()),
                            new RequestParameter("content", new HtmlContentResolver())
                        }
                };
        }
Пример #2
0
 protected void Page_Load(object sender, EventArgs e)
 {
     AjaxPro.Utility.RegisterTypeForAjax(this.GetType());
     Page.ClientScript.RegisterClientScriptInclude(typeof(string), "TimeAndLanguage_script", WebPath.GetPath("usercontrols/management/TimeAndLanguage/js/TimeAndLanguage.js"));
     Page.ClientScript.RegisterClientScriptBlock(this.GetType(), "TimeAndLanguage_style", "<link rel=\"stylesheet\" type=\"text/css\" href=\"" + WebSkin.GetUserSkin().GetAbsoluteWebPath("usercontrols/management/TimeAndLanguage/css/<theme_folder>/TimeAndLanguage.css") + "\">", false);
     _currentTenant = CoreContext.TenantManager.GetCurrentTenant();
 }
 public FileMoveCopyOperation(Tenant tenant, List<object> folders, List<object> files, object toFolder, bool copy, FileConflictResolveType resolveType)
     : base(tenant, folders, files)
 {
     this._toFolder = toFolder;
     this._copy = copy;
     this._resolveType = resolveType;
 }
        protected void Page_Load(object sender, EventArgs e)
        {
            AjaxPro.Utility.RegisterTypeForAjax(GetType());

            Page.ClientScript.RegisterClientScriptInclude(typeof(string), "firsttime1_script", WebPath.GetPath("usercontrols/firsttime/js/manager.js"));

            _curTenant = CoreContext.TenantManager.GetCurrentTenant();
        }
Пример #5
0
        public BackupPortalTask(Tenant tenant, string fromConfigPath, string toFilePath)
            : base(tenant, fromConfigPath)
        {
            if (string.IsNullOrEmpty(toFilePath))
                throw new ArgumentNullException("toFilePath");

            BackupFilePath = toFilePath;
        }
        protected void Page_Load(object sender, EventArgs e)
        {
            AjaxPro.Utility.RegisterTypeForAjax(this.GetType());
            Page.ClientScript.RegisterClientScriptInclude(this.GetType(), "accountlink_script", WebPath.GetPath("usercontrols/users/userprofile/js/usersettings.js"));
            _userSkinSettings.Controls.Add(LoadControl(SkinSettings.Location));
            _currentTenant = CoreContext.TenantManager.GetCurrentTenant();

        }
        public FileDownloadOperation(Tenant tenant, Dictionary<object, string> folders, Dictionary<object, string> files)
            : base(tenant, folders.Select(f => f.Key).ToList(), files.Select(f => f.Key).ToList())
        {
            Id = Owner.ToString() + OperationType.ToString(); //one download per user

            _files = files;

            _quotaDocsEdition = TenantExtra.GetTenantQuota().DocsEdition;
        }
        protected void Page_Load(object sender, EventArgs e)
        {
            AjaxPro.Utility.RegisterTypeForAjax(GetType());
            Page.RegisterBodyScripts(ResolveUrl("~/usercontrols/management/TimeAndLanguage/js/TimeAndLanguage.js"));

            Page.RegisterStyleControl(VirtualPathUtility.ToAbsolute("~/usercontrols/management/TimeAndLanguage/css/TimeAndLanguage.less"));

            _currentTenant = CoreContext.TenantManager.GetCurrentTenant();
        }
        protected void Page_Load(object sender, EventArgs e)
        {
            AjaxPro.Utility.RegisterTypeForAjax(GetType());
            
            InitScript();

            _curTenant = CoreContext.TenantManager.GetCurrentTenant();
            _dateandtimeHolder.Controls.Add(LoadControl(TimeAndLanguage.Location));

            IsVisibleTestData = SetupInfo.PortalTestDataEnable;
        }
        public TransferProgressItem(ILog log, int tenantId, string targetRegion)
            : base(log, tenantId)
        {
            if (string.IsNullOrEmpty(targetRegion))
                throw new ArgumentException("Empty target region.", "targetRegion");

            this.targetRegion = targetRegion;

            TransferMail = true;
            tenant = CoreContext.TenantManager.GetTenant(tenantId);
        }
 public FileMoveCopyOperation(Tenant tenant,
                              List<object> folders,
                              List<object> files,
                              string toFolderId,
                              bool copy,
                              FileConflictResolveType resolveType,
                              Dictionary<string, string> httpRequestHeaders)
     : this(tenant, folders, files, toFolderId, copy, resolveType)
 {
     this.httpRequestHeaders = httpRequestHeaders;
 }
        public TransferPortalTask(Tenant tenant, string fromConfigPath, string toConfigPath)
            : base(tenant, fromConfigPath)
        {
            if (toConfigPath == null)
                throw new ArgumentNullException("toConfigPath");

            ToConfigPath = toConfigPath;

            DeleteBackupFileAfterCompletion = true;
            BlockOldPortalAfterStart = true;
            DeleteOldPortalAfterCompletion = true;
        }
        protected override ApiRequest ParseRequestInfo(IDictionary<string,string> groups, Tenant t)
        {
            var folder = groups["folder"];
            
            int id;
            if (!int.TryParse(folder, out id))
            {
                folder = '@' + folder;
            }

            return new ApiRequest(string.Format("files/{0}/upload", folder)) {FilesToPost = new List<RequestFileInfo>()};
        }
        protected void Page_Load(object sender, EventArgs e)
        {
            AjaxPro.Utility.RegisterTypeForAjax(GetType());

            InitScript();

            _curTenant = CoreContext.TenantManager.GetCurrentTenant();

            var timeAndLanguage = (TimeAndLanguage)LoadControl(TimeAndLanguage.Location);
            timeAndLanguage.WithoutButton = true;
            _dateandtimeHolder.Controls.Add(timeAndLanguage);
        }
Пример #15
0
        protected FileOperation(Tenant tenant, List<object> folders, List<object> files)
        {
            if (tenant == null) throw new ArgumentNullException("tenant");

            Id = Guid.NewGuid().ToString();
            CurrentTenant = tenant;
            Owner = ASC.Core.SecurityContext.CurrentAccount.ID;
            principal = Thread.CurrentPrincipal;
            culture = Thread.CurrentThread.CurrentCulture.Name;

            Folders = folders ?? new List<object>();
            Files = files ?? new List<object>();
            Source = string.Join(splitCharacter, Folders.Select(f => "folder_" + f).Concat(Files.Select(f => "file_" + f)).ToArray());
        }
Пример #16
0
 public Tenant SetTenantVersion(Tenant tenant, int version)
 {
     if (tenant == null) throw new ArgumentNullException("tenant");
     if (tenant.Version != version)
     {
         tenant.Version = version;
         SaveTenant(tenant);
     }
     else
     {
         throw new ArgumentException("This is current version already");
     }
     return tenant;
 }
        protected void Page_Load(object sender, EventArgs e)
        {
            AjaxPro.Utility.RegisterTypeForAjax(this.GetType());

            Page.RegisterBodyScripts(ResolveUrl("~/usercontrols/management/maildomainsettings/js/maildomainsettings.js"));
            Page.RegisterStyleControl(VirtualPathUtility.ToAbsolute("~/usercontrols/management/maildomainsettings/css/maildomainsettings.less"));

            _currentTenant = CoreContext.TenantManager.GetCurrentTenant();
            _studioTrustedDomainSettings = SettingsManager.Instance.LoadSettings<StudioTrustedDomainSettings>(TenantProvider.CurrentTenantID);
            _enableInviteUsers = TenantStatisticsProvider.GetUsersCount() < TenantExtra.GetTenantQuota().ActiveUsers;

            if (!_enableInviteUsers)
                _studioTrustedDomainSettings.InviteUsersAsVisitors = true;
        }
        public FileImportOperation(Tenant tenant, IDocumentProvider docProvider, List<DataToImport> files, object parentId, bool overwrite, string folderName)
            : base(tenant, null, null)
        {
            Id = Owner.ToString() + OperationType.ToString();
            Source = docProvider.Name;
            _docProvider = docProvider;
            _files = files ?? new List<DataToImport>();
            _parentId = parentId;
            _overwrite = overwrite;
            _folderName = folderName;

            var toFolderObj = Global.DaoFactory.GetFolderDao().GetFolder(_parentId);

            if (toFolderObj != null && toFolderObj.RootFolderType == FolderType.BUNCH)
                _markAsNewRecipientIDs = Global.GetProjectTeam(toFolderObj).ToList();
        }
        protected override ApiRequest ParseRequestInfo(IDictionary<string,string> groups, Tenant t)
        {
            var callInfo = new ApiRequest("community/" + groups["type"])
                {
                    Parameters = new List<RequestParameter>
                        {
                            new RequestParameter("content", new HtmlContentResolver()),
                            new RequestParameter("title", new TitleResolver(BlogTagsResolver.Pattern)),
                            new RequestParameter("subscribeComments", true),
                            new RequestParameter("type", 1),
                            new RequestParameter("tags", new BlogTagsResolver())
                        }
                };

            return callInfo;
        }
Пример #20
0
        public TextSearchResult Search(string query, Tenant tenant)
        {
            var result = new TextSearchResult(module);

            if (string.IsNullOrEmpty(query) || !Directory.Exists(path))
            {
                return result;
            }

            var dir = Lucene.Net.Store.FSDirectory.Open(new DirectoryInfo(path));
            var searcher = new IndexSearcher(dir, false);
            try
            {
                var analyzer = new AnalyzersProvider().GetAnalyzer(tenant.GetCulture().TwoLetterISOLanguageName);
                var parser = new QueryParser(Lucene.Net.Util.Version.LUCENE_29, "Text", analyzer);
                parser.SetDefaultOperator(QueryParser.Operator.AND);
                if (TextIndexCfg.MaxQueryLength < query.Length)
                {
                    query = query.Substring(0, TextIndexCfg.MaxQueryLength);
                }
                Query q = null;
                try
                {
                    q = parser.Parse(query);
                }
                catch (Lucene.Net.QueryParsers.ParseException) { }
                if (q == null)
                {
                    q = parser.Parse(QueryParser.Escape(query));
                }

#pragma warning disable 618
                var hits = searcher.Search(q);
#pragma warning restore 618
                for (int i = 0; i < hits.Length(); i++)
                {
                    var doc = hits.Doc(i);
                    result.AddIdentifier(doc.Get("Id"));
                }
            }
            finally
            {
                searcher.Close();
                dir.Close();
            }
            return result;
        }
        public FileMoveCopyOperation(Tenant tenant,
                                     List<object> folders,
                                     List<object> files,
                                     string toFolderId,
                                     bool copy,
                                     FileConflictResolveType resolveType)
            : base(tenant, folders, files)
        {
            _toFolderId = toFolderId;
            _copy = copy;
            _resolveType = resolveType;

            var toFolder = Global.DaoFactory.GetFolderDao().GetFolder(toFolderId);

            if (toFolder != null && toFolder.RootFolderType == FolderType.BUNCH)
                _markAsNewRecipientIDs = Global.GetProjectTeam(toFolder).ToList();
        }
Пример #22
0
        protected override ApiRequest ParseRequestInfo(IDictionary<string, string> groups, Tenant t)
        {
            ApiRequest requestInfo;
            if (groups["type"] == @"forum.topic")
            {
                requestInfo = new ApiRequest(string.Format("community/{0}/{1}", groups["type"].Replace(@"\", "").Replace('.', '/'), groups["postId"]))
                    {
                        Parameters = new List<RequestParameter>
                            {
                                new RequestParameter("subject", new TitleResolver()),
                                new RequestParameter("content", new HtmlContentResolver())
                            }
                    };

                if (!string.IsNullOrEmpty(groups["parentId"]))
                {
                    requestInfo.Parameters.Add(new RequestParameter("parentPostId", groups["parentId"]));
                }
            }
            else
            {
                requestInfo = new ApiRequest(string.Format("{0}/{1}/comment", groups["type"].Replace(@"\", "").Replace('.', '/'), groups["postId"]))
                    {
                        Parameters = new List<RequestParameter>
                            {
                                new RequestParameter("content", new HtmlContentResolver())
                            }
                    };

                if (!string.IsNullOrEmpty(groups["parentId"]))
                {
                    requestInfo.Parameters.Add(new RequestParameter("parentId", groups["parentId"]));
                }
            }

            if (CommunityTypes.Contains(groups["type"]))
            {
                requestInfo.Url = "community/" + requestInfo.Url;
            }

            return requestInfo;
        }
Пример #23
0
        public string RegisterTenant(TenantRegistrationInfo ri, out Tenant tenant)
        {
            tenant = null;

            if (ri == null) throw new ArgumentNullException("registrationInfo");
            if (string.IsNullOrEmpty(ri.Name)) throw new Exception("Community name can not be empty");
            if (string.IsNullOrEmpty(ri.Address)) throw new Exception("Community address can not be empty");

            if (string.IsNullOrEmpty(ri.Email)) throw new Exception("Account email can not be empty");
            if (string.IsNullOrEmpty(ri.FirstName)) throw new Exception("Account firstname can not be empty");
            if (string.IsNullOrEmpty(ri.LastName)) throw new Exception("Account lastname can not be empty");
            if (string.IsNullOrEmpty(ri.Password)) ri.Password = Crypto.GeneratePassword(6);

            // create tenant
            tenant = new Tenant(ri.Address.ToLowerInvariant())
            {
                Name = ri.Name,
                Language = ri.Culture.Name,
                TimeZone = ri.TimeZoneInfo,
            };
            tenant = tenantService.SaveTenant(tenant);

            // create user
            var user = new UserInfo()
            {
                UserName = ri.Email.Substring(0, ri.Email.IndexOf('@')),
                LastName = ri.LastName,
                FirstName = ri.FirstName,
                Email = ri.Email,
            };
            user = userService.SaveUser(tenant.TenantId, user);
            userService.SetUserPassword(tenant.TenantId, user.ID, ri.Password);
            userService.SaveUserGroupRef(tenant.TenantId, new UserGroupRef(user.ID, Constants.GroupAdmin.ID, UserGroupRefType.Contains));

            // save tenant owner
            tenant.OwnerId = user.ID;
            tenant = tenantService.SaveTenant(tenant);

            return CreateAuthenticationCookie(tenant.TenantId, user.ID);
        }
Пример #24
0
        protected void Page_Load(object sender, EventArgs e)
        {
            AjaxPro.Utility.RegisterTypeForAjax(this.GetType());

            _studioViewSettings = SettingsManager.Instance.LoadSettings<StudioViewSettings>(TenantProvider.CurrentTenantID);
            _currentTenant = CoreContext.TenantManager.GetCurrentTenant();

            _studioViewSettingsHolder.Visible = SetupInfo.IsVisibleSettings("ViewSettings");

            //main domain settings
            _mailDomainSettings.Controls.Add(LoadControl(MailDomainSettings.Location));

            //Portal version
            if (SetupInfo.IsVisibleSettings<VersionSettings.VersionSettings>())
                _portalVersionSettings.Controls.Add(LoadControl(VersionSettings.VersionSettings.Location));

            _timelngHolder.Controls.Add(LoadControl(TimeAndLanguage.Location));

            //promo settings
            if (SetupInfo.IsVisibleSettings<PromoSettings>())
                _studioNotifyBarSettingsHolder.Controls.Add(LoadControl(PromoSettings.Location));

            //strong security password settings
            _strongPasswordSettings.Controls.Add(LoadControl(PasswordSettings.Location));

            if (SetupInfo.IsVisibleSettings<AccessSettings>())
                _restrictedAccessSettings.Controls.Add(LoadControl(AccessSettings.Location));

            invLink.Controls.Add(LoadControl(InviteLink.Location));

            //sms settings
            if (SetupInfo.IsVisibleSettings<StudioSmsNotificationSettings>())
                _smsValidationSettings.Controls.Add(LoadControl(SmsValidationSettings.Location));

            _admMessSettings.Controls.Add(LoadControl(AdminMessageSettings.Location));
        }
Пример #25
0
 public static DateTime DateTimeNow(Tenant tenant)
 {
     return DateTimeNow(tenant.TimeZone);
 }
Пример #26
0
 public static DateTime DateTimeToUtc(Tenant tenant, DateTime dbDateTime)
 {
     return DateTimeToUtc(tenant.TimeZone, dbDateTime);
 }
Пример #27
0
 public void SendMsgConfirmChangeOwner(Tenant t, string newOwnerName, string confirmOwnerUpdateUrl)
 {
     var u = CoreContext.UserManager.GetUsers(t.OwnerId);
     client.SendNoticeToAsync(
                 Constants.ActionConfirmOwnerChange,
                 null,
                 new[] { u },
                 new[] { EMailSenderName },
                 null,
                 new TagValue("ConfirmPortalOwnerUpdate", confirmOwnerUpdateUrl),
                 new TagValue(Constants.TagUserName, newOwnerName),
                 new TagValue(Constants.TagOwnerName, u.DisplayUserName()));
 }
Пример #28
0
 public void SendMsgDnsChange(Tenant t, string confirmDnsUpdateUrl, string portalAddress, string portalDns)
 {
     var u = CoreContext.UserManager.GetUsers(t.OwnerId);
     client.SendNoticeToAsync(
                 Constants.ActionDnsChange,
                 null,
                 new[] { u },
                 new[] { EMailSenderName },
                 null,
                 new TagValue("ConfirmDnsUpdate", confirmDnsUpdateUrl),
                 new TagValue("PortalAddress", AddHttpToUrl(portalAddress)),
                 new TagValue("PortalDns", AddHttpToUrl(portalDns ?? string.Empty)),
                 new TagValue(Constants.TagOwnerName, u.DisplayUserName()));
 }
Пример #29
0
        public void SendMsgPortalDeletionSuccess(Tenant t, string url)
        {
            var u = CoreContext.UserManager.GetUsers(t.OwnerId);

            client.SendNoticeToAsync(
                        Constants.ActionPortalDeleteSuccess,
                        null,
                        new[] { u },
                        new[] { EMailSenderName },
                        null,
                        new TagValue("FeedBackUrl", url),
                        new TagValue(Constants.TagOwnerName, u.DisplayUserName()));
        }
Пример #30
0
 public void SendMsgPortalDeactivation(Tenant t, string d_url, string a_url)
 {
     var u = CoreContext.UserManager.GetUsers(t.OwnerId);
     client.SendNoticeToAsync(
                 Constants.ActionPortalDeactivate,
                 null,
                 new[] { u },
                 new[] { EMailSenderName },
                 null,
                 new TagValue(Constants.TagActivateUrl, a_url),
                 new TagValue(Constants.TagDeactivateUrl, d_url),
                 new TagValue(Constants.TagOwnerName, u.DisplayUserName()));
 }