Example #1
0
        protected override void OnInit(EventArgs e)
        {
            base.OnInit(e);

            if (WebSiteId == Guid.Empty)
            {
                Response.Redirect(ResolveUrl("~/SiteNotFound.aspx"));
            }

            if (Page.Master != null)
            {
                var head          = Page.Master.FindControl("head");
                var lrlCounteCode = new Literal()
                {
                    Text = ScriptTemplates.Counter(SiteId)
                };
                head.Controls.Add(lrlCounteCode);
                var analytics     = Page.Master.FindControl("analytics");
                var lrlScriptCode = new Literal()
                {
                    Text = ScriptTemplates.Script(true)
                };
                analytics.Controls.Add(lrlScriptCode);
            }
        }
Example #2
0
    private static void CreateScreen_AfterCompilation()
    {
        var waitForCompilation = EditorPrefs.GetBool("Temp.EditorWaitCompilation.CreateFeatureComplex");

        if (waitForCompilation == true)
        {
            EditorPrefs.DeleteKey("Temp.EditorWaitCompilation.CreateFeatureComplex");

            var dir           = EditorPrefs.GetString("Temp.EditorWaitCompilation.CreateFeatureComplex.Dir");
            var assetName     = EditorPrefs.GetString("Temp.EditorWaitCompilation.CreateFeatureComplex.Name");
            var assetNameOrig = EditorPrefs.GetString("Temp.EditorWaitCompilation.CreateFeatureComplex.Name.Orig");
            var assetPath     = EditorPrefs.GetString("Temp.EditorWaitCompilation.CreateFeatureComplex.ScriptPath");
            var newAssetPath  = EditorPrefs.GetString("Temp.EditorWaitCompilation.CreateFeatureComplex.NewScriptPath");

            if (assetNameOrig.EndsWith("Screen") == false)
            {
                var content = System.IO.File.ReadAllText(assetPath);
                content = content.Replace(@"/*#SCRIPTNAME_POST#*/", "Screen");
                System.IO.File.WriteAllText(assetPath, content);
            }
            else
            {
                var content = System.IO.File.ReadAllText(assetPath);
                content = content.Replace(@"/*#SCRIPTNAME_POST#*/", "");
                System.IO.File.WriteAllText(assetPath, content);
            }

            AssetDatabase.MoveAsset(assetPath, newAssetPath);
            AssetDatabase.ImportAsset(newAssetPath, ImportAssetOptions.ForceSynchronousImport);

            var guid = AssetDatabase.AssetPathToGUID(newAssetPath);
            var defs = new Dictionary <string, string>()
            {
                { "GUID", guid },
            };

            ScriptTemplates.CreateEmptyDirectory(dir, "Screens");
            ScriptTemplates.CreateEmptyDirectory(dir, "Components");
            ScriptTemplates.CreateEmptyDirectory(dir, "Layouts");

            var asset = AssetDatabase.LoadAssetAtPath <TextAsset>(newAssetPath);
            AssignIcon(asset, new GUIContent(Resources.Load <Texture>("EditorAssets/Scripts/window_icon")));


            ScriptTemplates.Create(dir + "/Screens", assetName + "Screen.prefab", "61-ScreenAsset", allowRename: false, customDefines: defs);
        }
    }
Example #3
0
    internal static void Create(string fileName, string templateName, System.Collections.Generic.Dictionary <string, string> customDefines = null, bool allowRename = true, System.Action <Object> onCreated = null)
    {
        var obj  = Selection.activeObject;
        var path = AssetDatabase.GetAssetPath(obj);

        if (System.IO.File.Exists(path) == true)
        {
            path = System.IO.Path.GetDirectoryName(path);
        }

        if (string.IsNullOrEmpty(path) == true)
        {
            path = "Assets/";
        }

        ScriptTemplates.Create(path, fileName, templateName, customDefines, allowRename, onCreated);
    }
Example #4
0
    public static void CreateScreen()
    {
        ScriptTemplates.Create("New Screen.cs", "01-ScreenTemplate", onCreated: (asset) => {
            var path      = ScriptTemplates.GetDirectoryFromAsset(asset);
            var assetName = asset.name;
            if (assetName.EndsWith("Screen") == true)
            {
                assetName = assetName.Replace("Screen", string.Empty);
            }
            ScriptTemplates.CreateEmptyDirectory(path, assetName);
            var dir          = path + "/" + assetName;
            var newAssetPath = dir + "/" + assetName + "Screen.cs";

            EditorPrefs.SetBool("Temp.EditorWaitCompilation.CreateFeatureComplex", true);
            EditorPrefs.SetString("Temp.EditorWaitCompilation.CreateFeatureComplex.Dir", dir);
            EditorPrefs.SetString("Temp.EditorWaitCompilation.CreateFeatureComplex.Name", assetName);
            EditorPrefs.SetString("Temp.EditorWaitCompilation.CreateFeatureComplex.Name.Orig", asset.name);
            EditorPrefs.SetString("Temp.EditorWaitCompilation.CreateFeatureComplex.ScriptPath", AssetDatabase.GetAssetPath(asset));
            EditorPrefs.SetString("Temp.EditorWaitCompilation.CreateFeatureComplex.NewScriptPath", newAssetPath);
        });
    }
Example #5
0
        /// <summary>
        /// Binds the data.
        /// </summary>
        private void BindData()
        {
            ucPortal.SiteId = SiteId;
            ucPortal.Module = "Settings";

            ucSiteDomains.SiteId = SiteId;
            ucSiteDomains.Module = "Settings";

            EnumHelper.EnumToDropDownList <HtmlEditorMode>(ref ddlHtmlEditorMode, false);
            var site = DataManager.Sites.SelectById(SiteId);

            if (site.AccessProfileID.HasValue)
            {
                var accessProfile = DataManager.AccessProfile.SelectById(site.AccessProfileID.Value);
                if (accessProfile != null && accessProfile.DomainsCount > 0)
                {
                    chxIsBlockAccessFromDomainsOutsideOfList.Checked = true;
                    plAccessBlock.Visible = false;
                }
            }
            else
            {
                chxIsBlockAccessFromDomainsOutsideOfList.Checked = site.IsBlockAccessFromDomainsOutsideOfList;
            }

            txtName.Text = site.Name;
            txtLinkProcessingURL.Text       = site.LinkProcessingURL;
            lrlCounterCode.Text             = HttpUtility.HtmlEncode(ScriptTemplates.Counter(SiteId));
            lrlScriptCode.Text              = HttpUtility.HtmlEncode(ScriptTemplates.Script(true));
            chxShowHiddenMessages.Checked   = site.ShowHiddenMessages;
            ddlHtmlEditorMode.SelectedIndex = ddlHtmlEditorMode.FindItemIndexByValue(site.HtmlEditorModeID.ToString());
            List <tbl_Sites> fakeList = new List <tbl_Sites>();

            fakeList.Add(site);
            fvSmtp.DataSource = fakeList;
            fvSmtp.DataBind();
        }
 public static void CreateView()
 {
     ScriptTemplates.Create("New View.cs", "60-NoViewTemplate");
 }
Example #7
0
 private static void OnScriptsReloaded()
 {
     ScriptTemplates.CreateScreen_AfterCompilation();
 }
Example #8
0
        /// <summary>
        /// Generates the counter result.
        /// </summary>
        /// <param name="counter">The counter.</param>
        /// <param name="siteDomain">The site domain.</param>
        private void GenerateCounterResult(ref CheckSiteStatus counter, tbl_SiteDomain siteDomain, bool isNotFound = false)
        {
            if (!counter.ErrorLinks.Any())
            {
                counter.Score          = 50;
                counter.ErrorTypeClass = "success";

                try
                {
                    Uri siteUrl = GetDomainUrl(siteDomain.Domain);
                    if (IsLeadForceDomain(siteUrl))
                    {
                        siteDomain.StatusID = (int)SiteDomainStatus.LeadForceDomain;
                        if (isNotFound)
                        {
                            counter.Message = "Домен найден, но не привязан к мини сайту";
                        }
                        else
                        {
                            counter.Message = string.Format("Счетчик найден. Проверено {0} страниц сайта.", counter.SuccessLinks.Count);
                        }
                    }
                    else
                    {
                        siteDomain.StatusID = (int)SiteDomainStatus.Checking;
                        counter.Message     = string.Format("Счетчик найден. Проверено {0} страниц сайта.", counter.SuccessLinks.Count);
                    }
                }
                catch (Exception ex)
                {
                    Log.Error("Ошибка проверки домена LeadForce", ex);
                    siteDomain.StatusID = (int)SiteDomainStatus.Checking;
                }

                Update(siteDomain);
            }
            else
            {
                siteDomain.StatusID = (int)SiteDomainStatus.CheckingFailed;
                Update(siteDomain);

                counter.ErrorTypeClass = "error";
                counter.Message        =
                    string.Format(
                        @"Счетчик не найден на {0} страницах из {1} проверенных. <a href=""javascript:;"" onclick=""$('.checkedLinks').show();"">Подробнее...</a><div style=""display:none"" class=""checkedLinks""><br/>{2}<br/></div><br/>Для установки счетчика Вам необходимо подключить к Вашему сайту код:
<div class=""row"">
    <label>Код счетчика (часть 1):</label><br />
    <span class=""note"">(размещать в &lt;head&gt; или в начале документа)</span>
    <table class=""tbl-counter-code"">
        <tr>
            <td><pre><code>{3}</code></pre></td>
        </tr>
    </table>
</div>
<div class=""row"">
    <label>Код счетчика (часть 2):</label><br />
    <span class=""note"">(размещать в конце файла перед &lt;/body&gt;)</span>
    <table class=""tbl-counter-code"">
        <tr>
            <td><pre><code>{4}</code></pre></td>
        </tr>
    </table>
</div>",
                        counter.ErrorLinks.Count,
                        counter.ErrorLinks.Count + counter.SuccessLinks.Count,
                        string.Join("<br/> ", counter.ErrorLinks.Select(o => string.Format("<a href=\"{0}\" target=\"_blank\">{0}</a>", o))),
                        HttpUtility.HtmlEncode(ScriptTemplates.Counter(siteDomain.SiteID)),
                        HttpUtility.HtmlEncode(ScriptTemplates.Script(true)));
            }
        }
Example #9
0
 public static void CreateView()
 {
     ScriptTemplates.Create("New View.cs", "62-ViewParticlesTemplate");
 }
 public static void CreateView()
 {
     ScriptTemplates.Create("New View.cs", "63-ViewGraphicsTemplate");
 }
 public static void CreateView()
 {
     ScriptTemplates.Create("New View.cs", "61-ViewMonoBehaviourTemplate");
 }
Example #12
0
        /// <summary>
        /// Binds the data.
        /// </summary>
        private void BindData()
        {
            BindStats();

            ucSiteDomains.SiteId = ucPortal.SiteId = _siteId;
            ucSiteDomains.Module = ucPortal.Module = "Sites";

            ucPayerCompany.SiteID = SiteId;
            ucPriceList.SiteID    = SiteId;

            var site = DataManager.Sites.SelectById(_siteId);

            var emailActions = DataManager.EmailActions.SelectAll();

            BindEmailActions(rblUnsubscribeActions, emailActions);
            BindEmailActions(rblServiceAdvertisingActions, emailActions);

            rcbAccessProfile.DataSource     = DataManager.AccessProfile.SelectAll(null);
            rcbAccessProfile.DataTextField  = "Title";
            rcbAccessProfile.DataValueField = "ID";
            rcbAccessProfile.DataBind();
            rcbAccessProfile.Items.Insert(0, new RadComboBoxItem("Выберите профиль", Guid.Empty.ToString())
            {
                Selected = true
            });

            if (site != null)
            {
                txtName.Text = site.Name;
                txtLinkProcessingURL.Text              = site.LinkProcessingURL;
                lrlCounterCode.Text                    = HttpUtility.HtmlEncode(ScriptTemplates.Counter(_siteId));
                lrlScriptCode.Text                     = HttpUtility.HtmlEncode(ScriptTemplates.Script(true));
                chxIsActive.Checked                    = site.IsActive;
                chxIsTemplate.Checked                  = site.IsTemplate;
                txtSmtpHost.Text                       = site.SmtpHost;
                txtSmtpUsername.Text                   = site.SmtpUsername;
                txtSmtpPassword.Attributes["value"]    = site.SmtpPassword;
                txtSmtpPort.Text                       = site.SmtpPort.ToString();
                txtSystemEmail.Text                    = site.SystemEmail;
                chxIsAllowUseSystemEmail.Checked       = site.IsAllowUseSystemEmail;
                chxIsSendEmailToSubscribedUser.Checked = site.IsSendEmailToSubscribedUser;
                chxIsSendFromLeadForce.Checked         = site.IsSendFromLeadForce;
                txtSessionTimeout.Text                 = site.SessionTimeout.ToString();
                txtUserSessionTimeout.Text             = site.UserSessionTimeout.ToString();

                if (site.MainUserID.HasValue)
                {
                    var user = DataManager.User.SelectById(site.MainUserID.Value);
                    ucMainUser.SelectedIdNullable = user.ID;
                    ucMainUser.SelectedText       = user.Login;
                }
                rdpActiveUntilDate.SelectedDate = site.ActiveUntilDate;
                if (site.PriceListID.HasValue)
                {
                    var priceList = DataManager.PriceList.SelectById(site.PriceListID.Value);
                    ucPriceList.SelectedIdNullable = priceList.ID;
                    ucPriceList.SelectedText       = priceList.Title;
                }
                if (site.PayerCompanyID.HasValue)
                {
                    var company = DataManager.Company.SelectById(CurrentUser.Instance.SiteID, site.PayerCompanyID.Value);
                    ucPayerCompany.SelectedIdNullable = company.ID;
                    ucPayerCompany.SelectedText       = company.Name;
                }

                if (site.UnsubscribeActionID != null)
                {
                    rblUnsubscribeActions.SelectedIndex = rblUnsubscribeActions.Items.IndexOf(rblUnsubscribeActions.Items.FindByValue(site.UnsubscribeActionID.ToString()));
                }

                if (site.ServiceAdvertisingActionID != null)
                {
                    rblServiceAdvertisingActions.SelectedIndex = rblServiceAdvertisingActions.Items.IndexOf(rblServiceAdvertisingActions.Items.FindByValue(site.ServiceAdvertisingActionID.ToString()));
                }

                txtMaxFileSize.Text = site.MaxFileSize.ToString();
                txtFileQuota.Text   = site.FileQuota.ToString();

                lrlClientCount.Text = DataManager.Contact.SelectCount(_siteId).ToString();


                if (site.AccessProfileID != null)
                {
                    rcbAccessProfile.SelectedIndex = rcbAccessProfile.Items.FindItemIndexByValue(site.AccessProfileID.ToString());

                    var accessProfile = DataManager.AccessProfile.SelectById(site.AccessProfileID.Value);
                    if (accessProfile != null && accessProfile.DomainsCount > 0)
                    {
                        chxIsBlockAccessFromDomainsOutsideOfList.Checked = true;
                        plAccessBlock.Visible = false;
                    }
                }

                plCounterCode.Visible = true;
            }
            else
            {
                plMainUser.Visible         = false;
                txtSessionTimeout.Text     = "30";
                txtUserSessionTimeout.Text = "30";
                pUser.Visible = true;
                rblUnsubscribeActions.SelectedIndex = rblUnsubscribeActions.Items.IndexOf(rblUnsubscribeActions.Items.FindByValue("3"));
            }
        }
Example #13
0
        protected void Page_Load(object sender, EventArgs e)
        {
            Page.Header.DataBind();

            if (!string.IsNullOrEmpty(Request.QueryString["code"]))
            {
                _activityCode = Request.QueryString["code"];
            }

            rblFormMode.Items.Clear();
            tsFormMode.Tabs.Clear();
            foreach (var mode in EnumHelper.EnumToList <FormMode>())
            {
                rblFormMode.Items.Add(new ListItem(EnumHelper.GetEnumDescription(mode), ((int)mode).ToString()));
                tsFormMode.Tabs.Add(new Telerik.Web.UI.RadTab(EnumHelper.GetEnumDescription(mode), ((int)mode).ToString()));
            }
            rblFormMode.SelectedIndex = 0;

            lrlCounterCode.Text = HttpUtility.HtmlEncode(ScriptTemplates.Form(CurrentUser.Instance.SiteID, _activityCode)
                                                         .Replace("$Mode", ((int)FormMode.Inner).ToString())
                                                         .Replace("$FromVisit", string.Empty)
                                                         .Replace("$Through", string.Empty)
                                                         .Replace("$Period", string.Empty)
                                                         .Replace("$Parameter", string.Empty));

            //rblPeriod.Items.Clear();
            foreach (var period in EnumHelper.EnumToList <Period>())
            {
                rblPeriod.Items.Add(new ListItem(EnumHelper.GetEnumDescription(period), ((int)period).ToString()));
            }

            foreach (var category in EnumHelper.EnumToList <FormContactCategory>())
            {
                rblContactCategory.Items.Add(new ListItem(EnumHelper.GetEnumDescription(category), ((int)category).ToString()));
            }
            rblContactCategory.Items.FindByValue("0").Selected = true;

            foreach (var align in EnumHelper.EnumToList <PopupAlign>())
            {
                rblPopupAlign.Items.Add(new ListItem("", ((int)align).ToString()));
            }
            rblPopupAlign.Items.FindByValue("4").Selected = true;

            foreach (var effect in EnumHelper.EnumToList <PopupEffectAppear>())
            {
                ddlPopupEffectAppear.Items.Add(new ListItem(EnumHelper.GetEnumDescription(effect), ((int)effect).ToString()));
            }

            foreach (var position in EnumHelper.EnumToList <FloatingButtonPosition>())
            {
                ddlFloatingButtonPosition.Items.Add(new ListItem(EnumHelper.GetEnumDescription(position), ((int)position).ToString()));
            }

            if (!Page.ClientScript.IsClientScriptIncludeRegistered("FormCodeJS"))
            {
                ScriptManager.RegisterClientScriptInclude(this, typeof(FormCode), "FormCodeJS", ResolveUrl("~/Scripts/formcode.js"));
            }

            if (!Page.ClientScript.IsClientScriptIncludeRegistered("HighlightJS"))
            {
                ScriptManager.RegisterClientScriptInclude(this, typeof(FormCode), "HighlightJS", ResolveUrl("~/Scripts/highlight.pack.js"));
            }

            if (!Page.ClientScript.IsClientScriptBlockRegistered("FormCodeTemplateJS"))
            {
                var script = string.Format("<script type=\"text/javascript\">var popupFormTemplate = \"{0}\"; var integratedFormTemplate = \"{1}\"; var autocallFormTemplate = \"{2}\"; var floatingButtonFormTemplate = \"{3}\"; var callOnClosingFormTemplate = \"{4}\";$('pre code').each(function(i, e) {{ hljs.highlightBlock(e); }});</script>",
                                           HttpUtility.HtmlEncode(ScriptTemplates.PopupForm(CurrentUser.Instance.SiteID, _activityCode)),
                                           HttpUtility.HtmlEncode(ScriptTemplates.IntegratedForm(CurrentUser.Instance.SiteID, _activityCode)),
                                           HttpUtility.HtmlEncode(ScriptTemplates.AutoCallForm(CurrentUser.Instance.SiteID, _activityCode)),
                                           HttpUtility.HtmlEncode(ScriptTemplates.FloatingButtonForm(CurrentUser.Instance.SiteID, _activityCode)),
                                           HttpUtility.HtmlEncode(ScriptTemplates.CallOnClosingForm(CurrentUser.Instance.SiteID, _activityCode))).Replace("\r\n", "\\r\\n");
                ScriptManager.RegisterClientScriptBlock(this, typeof(FormCode), "FormCodeTemplateJS", script, false);
            }

            var fsProvider = new FileSystemProvider();
            var floatingButtonDirectory = fsProvider.GetFloatingButtonDirectory(CurrentUser.Instance.SiteID);

            rfeFloatingButtonIcon.Configuration.ViewPaths         = new[] { floatingButtonDirectory };
            rfeFloatingButtonIcon.Configuration.UploadPaths       = new[] { floatingButtonDirectory };
            rfeFloatingButtonIcon.Configuration.DeletePaths       = new[] { floatingButtonDirectory };
            rfeFloatingButtonIcon.Configuration.MaxUploadFileSize = 1048576;

            hlSettings.NavigateUrl = UrlsData.AP_Settings("Settings").Replace("/FormCode.aspx", "");
        }