Esempio n. 1
0
    protected override void OnInit(EventArgs e)
    {
        base.OnInit(e);

        // Initialize properties
        PortalHelper.EnsureScriptManager(Page);
    }
Esempio n. 2
0
    /// <summary>
    /// Initializes this layout binding control.
    /// </summary>
    private void Initialize()
    {
        // Initialize source layout controls
        ltrSourceLayoutIcon.Text          = PortalHelper.GetIconHtml(SourceLayout.LayoutThumbnailGUID, ValidationHelper.GetString(SourceLayout.LayoutIconClass, PortalHelper.DefaultPageLayoutIconClass));
        SourceLayoutDisplayNameLabel.Text = HTMLHelper.HTMLEncode(ResHelper.LocalizeString(SourceLayout.LayoutDisplayName));

        // Initialize target layout controls
        TargetLayout = DeviceProfileLayoutInfoProvider.GetTargetLayoutInfo(DeviceProfile, SourceLayout);
        if (TargetLayout != null)
        {
            ltrTargetLayoutIcon.Text          = PortalHelper.GetIconHtml(TargetLayout.LayoutThumbnailGUID, ValidationHelper.GetString(TargetLayout.LayoutIconClass, PortalHelper.DefaultPageLayoutIconClass));
            TargetLayoutDisplayNameLabel.Text = HTMLHelper.HTMLEncode(ResHelper.LocalizeString(TargetLayout.LayoutDisplayName));
        }
        else
        {
            ltrTargetLayoutIcon.Text          = PortalHelper.GetIconHtml(Guid.Empty, "icon-question-circle empty-device-layout-mapping");
            TargetLayoutDisplayNameLabel.Text = HTMLHelper.HTMLEncode(GetString("device_profile.layoutmapping.sethint"));
        }

        // Initialize script to open target layout selection dialog
        string baseUrl = URLHelper.ResolveUrl("~/CMSModules/DeviceProfiles/Pages/SelectLayout.aspx");
        string url     = String.Format("{0}?deviceProfileId={1:D}&sourceLayoutId={2:D}&targetLayoutId={3:D}", baseUrl, DeviceProfile.ProfileID, SourceLayout.LayoutId, TargetLayout != null ? TargetLayout.LayoutId : 0);
        string script  = String.Format("modalDialog('{0}', 'SelectLayout', '1000', '785', null)", URLHelper.AddParameterToUrl(url, "hash", QueryHelper.GetHash(url)));

        TargetLayoutItemControl.Attributes.Add("onclick", script);

        btnDelete.ToolTip       = GetString("device_profile.layoutmapping.unset");
        btnDelete.OnClientClick = "$cmsj.Event(event).stopPropagation(); Client_UnsetTargetLayout({sourceLayoutId:" + SourceLayout.LayoutId.ToString("D") + "}); return false;";
    }
    protected override void OnInit(EventArgs e)
    {
        currentUser            = MembershipContext.AuthenticatedUser;
        prefferedUICultureCode = currentUser.PreferredUICultureCode;

        if (IsWireframe() || (PortalContext.ViewMode.IsWireframe()))
        {
            categorySelector.RootPath = CATEGORY_WIREFRAMES;
            COOKIE_SELECTED_CATEGORY += "WF";
        }
        else if (IsUITemplate())
        {
            categorySelector.RootPath = CATEGORY_UIWEBPARTS;
            COOKIE_SELECTED_CATEGORY += "UI";
        }
        else
        {
            if (!PortalHelper.IsWireframingEnabled(SiteContext.CurrentSiteName))
            {
                categorySelector.RootPath = "/";
            }

            categorySelector.WhereCondition = String.Format("ObjectPath <> N'{0}' AND ObjectPath NOT LIKE N'{0}/%'", CATEGORY_UIWEBPARTS);
        }

        // Display only top level categories
        categorySelector.WhereCondition = SqlHelper.AddWhereCondition(categorySelector.WhereCondition, "ObjectLevel < 2");

        base.OnInit(e);
    }
Esempio n. 4
0
        public HttpResponseMessage GetContactById(int ID)
        {
            ContactInfo result = new ContactInfo();

            result = PortalHelper.GetContactById(ID);
            return(Request.CreateResponse(HttpStatusCode.OK, result));
        }
    /// <summary>
    /// Saves the widget data and create string for inline widget.
    /// </summary>
    private string SaveInline()
    {
        // Validate data
        if (!SaveForm(formCustom) ||
            (mWidgetInfo == null) ||
            (mFields == null))
        {
            return(String.Empty);
        }

        DataRow dr = formCustom.DataRow;

        var additionalFieldNames = GetAdditionalFieldsNames();

        string script = PortalHelper.GetAddInlineWidgetScript(mWidgetInfo, dr, mFields, additionalFieldNames);

        if (!string.IsNullOrEmpty(script))
        {
            // Add to recently used widgets collection
            MembershipContext.AuthenticatedUser.UserSettings.UpdateRecentlyUsedWidget(mWidgetInfo.WidgetName);
            return(script);
        }

        return(string.Empty);
    }
Esempio n. 6
0
    /// <summary>
    /// Sets the view mode.
    /// </summary>
    /// <param name="viewMode">The view mode</param>
    private void SetViewMode(ViewModeEnum viewMode)
    {
        if (PortalHelper.IsOnSiteEditingEnabled(SiteContext.CurrentSiteName) && AuthenticationHelper.IsAuthenticated())
        {
            // Remove the "viewmode" param from url and redirect
            string returnUrl = URLHelper.RemoveParameterFromUrl(RequestContext.CurrentURL, "viewmode");

            PortalContext.ViewMode = viewMode;

            // Switch view mode
            if (viewMode.IsEditLive())
            {
                //  Handle default alias path
                if (URLRewritingContext.CurrentPageInfoSource == PageInfoSource.DefaultAliasPath)
                {
                    string aliasPath = PageInfoProvider.GetDefaultAliasPath(RequestContext.CurrentDomain, SiteContext.CurrentSiteName);
                    if (!String.IsNullOrEmpty(aliasPath))
                    {
                        string query = URLHelper.GetQuery(returnUrl);
                        returnUrl = URLHelper.ResolveUrl(DocumentURLProvider.GetUrl(aliasPath));
                        returnUrl = URLHelper.AppendQuery(returnUrl, query);
                    }
                }
            }
            else if (is404)
            {
                // Redirect to the root document when page not found
                returnUrl = ResolveUrl("~/");
            }

            // Redirect to the URL
            URLHelper.Redirect(returnUrl);
        }
    }
Esempio n. 7
0
        public override void PostDraw(SpriteBatch spriteBatch, Color lightColor)
        {
            if (!IsTeleporting)
            {
                return;
            }
            float     r             = currentAngle;
            Texture2D texture       = ExtraTexture;
            Texture2D portalTexture = Main.projectileTexture[ProjectileID.PortalGunGate];
            Vector2   offset        = currentAngle.ToRotationVector2() * (teleportRadius + 14);
            Vector2   portalOffset  = currentAngle.ToRotationVector2() * teleportRadius;
            int       portalFrame   = (animationFrame / 5) % 4;
            int       portalHeight  = portalTexture.Height / 4;
            Rectangle portalBounds  = new Rectangle(0, portalHeight * portalFrame, portalTexture.Width, portalHeight);
            Vector2   portalOrigin  = new Vector2(portalBounds.Width / 2, portalBounds.Height / 2);

            for (int sign = -1; sign <= 1; sign += 2)
            {
                Vector2 pos         = teleportTarget.Center + sign * offset;
                Vector2 portalPos   = teleportTarget.Center + sign * portalOffset;
                Color   portalColor = PortalHelper.GetPortalColor(sign == 1 ? 0 : 1);
                portalColor.A = byte.MaxValue;
                float portalR      = sign == 1 ? r : r + MathHelper.Pi;
                int   fadeOutFrame = teleportDuration - teleportCycleFrames / 2;
                float fadeFraction = 2f * (teleportFrame > fadeOutFrame ? teleportDuration - teleportFrame : teleportFrame) / teleportCycleFrames;
                lightColor  *= Math.Min(1f, fadeFraction);
                portalColor *= Math.Min(1f, fadeFraction);
                spriteBatch.Draw(texture, pos - Main.screenPosition,
                                 texture.Bounds, lightColor, r, texture.Bounds.Center.ToVector2(), 1, 0, 0);
                spriteBatch.Draw(portalTexture, portalPos - Main.screenPosition,
                                 portalBounds, portalColor, portalR, portalOrigin, 1, 0, 0);
            }
        }
Esempio n. 8
0
    protected override void OnInit(EventArgs e)
    {
        base.OnInit(e);

        PortalHelper.EnsureScriptManager(Page);

        // Initialize checkbox for special values
        if ((FieldInfo != null) && (FieldInfo.DataType != FieldDataType.Boolean))
        {
            if (CheckedValue == null)
            {
                CheckedValue = DataHelper.GetNotEmpty(GetValue("CheckedValue"), "");
            }
            if (UncheckedValue == null)
            {
                UncheckedValue = DataHelper.GetNotEmpty(GetValue("UncheckedValue"), "");
            }

            if (FieldInfo.DataType == FieldDataType.Decimal)
            {
                HandleDecimalValue();
                return;
            }

            if (FieldInfo.DataType == FieldDataType.Double)
            {
                HandleDoubleValue();
                return;
            }

            HandleStringValue();
        }
    }
Esempio n. 9
0
        /// <summary>
        /// Method is called after confirmation option is selected
        /// </summary>
        /// <param name="context">IDialogContext object</param>
        /// <param name="result">Result object</param>
        /// <returns>Returns Task object</returns>
        public async Task OnConfirmationOptionSelected(IDialogContext context, IAwaitable <string> result)
        {
            try
            {
                string optionSelected = await result;

                switch (optionSelected)
                {
                case "Book":
                    PortalHelper.BookApointment(this.confirmedAppointment);
                    await context.PostAsync($"Your online appointment is confirmed on {confirmedAppointment.Date.ToShortDateString()} at {confirmedAppointment.Date.ToShortTimeString()}. You will receive an email with online meeting joining link.");

                    break;

                case "Cancel":

                    // context.Call(new RootDialog(), this.ResumeAfterOptionDialog);
                    break;
                }

                context.Done <object>(null);
            }
            catch (TooManyAttemptsException)
            {
                await context.PostAsync($"Ooops! Too many attemps :(. But don't worry, I'm handling that exception and you can try again!");

                context.Done <object>(null);
            }
        }
Esempio n. 10
0
    /// <summary>
    /// Initializes the control properties.
    /// </summary>
    protected void SetupControl()
    {
        if (StopProcessing)
        {
            // Do not process
        }
        else
        {
            // Build the checkbox
            StringBuilder sb = new StringBuilder();

            sb.Append("<input type=\"checkbox\"");
            if (IsDesign)
            {
                sb.Append(" onmousedown=\"SetWebPartProperty('", this.ShortClientID, "', 'Checked', (this.checked = !this.checked) + ''); return false;\"");
            }
            else
            {
                sb.Append(PortalHelper.GetDisabledFormElementAttributes());
            }
            if (Checked)
            {
                sb.Append(" checked=\"checked\"");
            }
            sb.Append(" />");

            ltlChk.Text  = sb.ToString();
            ltlText.Text = Text;
        }
    }
Esempio n. 11
0
        public HttpResponseMessage GetContacts()
        {
            List <ContactInfo> result = new List <ContactInfo>();

            result = PortalHelper.GetContacts();
            return(Request.CreateResponse(HttpStatusCode.OK, result));
        }
Esempio n. 12
0
    protected void Page_Load(object sender, EventArgs e)
    {
        // Redirect to the web site root by default
        string returnUrl = URLHelper.ResolveUrl("~/");

        // Check whether on-site editing is enabled
        if (PortalHelper.IsOnSiteEditingEnabled(CMSContext.CurrentSiteName))
        {
            CurrentUserInfo cui = CMSContext.CurrentUser;
            // Check the permissions
            if ((cui != null) && cui.IsEditor && cui.IsAuthorizedPerResource("cms.content", "ExploreTree") && cui.IsAuthorizedPerResource("cms.content", "Read"))
            {
                // Set edit-live view mode
                PortalContext.SetViewMode(ViewModeEnum.EditLive);
            }
            else
            {
                // Redirect to access denied page when the current user does not have permissions for the OnSite editing
                CMSPage.RedirectToUINotAvailable();
            }

            // Try get return URL
            string queryUrl = QueryHelper.GetString("returnurl", String.Empty);
            if (!String.IsNullOrEmpty(queryUrl) && (queryUrl.StartsWith("~/") || queryUrl.StartsWith("/")))
            {
                // Remove return url duplication if exist
                int commaIndex = queryUrl.IndexOfCSafe(",", 0, false);
                if (commaIndex > 0)
                {
                    queryUrl = queryUrl.Substring(0, commaIndex);
                }
                returnUrl = URLHelper.ResolveUrl(queryUrl);
            }
            // Use default alias path if return url isn't defined
            else
            {
                string aliasPath = PageInfoProvider.GetDefaultAliasPath(URLHelper.GetCurrentDomain(), CMSContext.CurrentSiteName);
                if (!String.IsNullOrEmpty(aliasPath))
                {
                    // Get the document which will be displayed for the default alias path
                    TreeProvider tr   = new TreeProvider();
                    TreeNode     node = tr.SelectSingleNode(CMSContext.CurrentSiteName, aliasPath, CMSContext.PreferredCultureCode, true);
                    if (node != null)
                    {
                        aliasPath = node.NodeAliasPath;
                    }

                    returnUrl = DocumentURLProvider.GetUrl(aliasPath);
                    returnUrl = URLHelper.ResolveUrl(returnUrl);
                }
            }

            // Remove view mode value from query string
            returnUrl = URLHelper.RemoveParameterFromUrl(returnUrl, "viewmode");
        }

        // Redirect to the requested page
        URLHelper.Redirect(returnUrl);
    }
Esempio n. 13
0
        /// <summary>
        /// Gets Available Appointments
        /// </summary>
        /// <param name="searchQuery">Appointment search query object</param>
        /// <returns>Collection of Appointments</returns>
        private async Task <IEnumerable <Appointment> > GetAppointmentsAsync(AppointmentsQuery searchQuery)
        {
            var appointments = PortalHelper.GetAvailableAppointments(searchQuery.Date);

            appointments.Sort((h1, h2) => h1.Date.CompareTo(h2.Date));

            return(appointments);
        }
Esempio n. 14
0
    protected void Page_Load(object sender, EventArgs e)
    {
        // If ID�s not specified return
        if ((TemplateID == 0) || (GatewayID == 0))
        {
            return;
        }

        // Get gateway name
        NotificationGatewayInfo ngi = NotificationGatewayInfoProvider.GetNotificationGatewayInfo(GatewayID);

        if (ngi == null)
        {
            throw new Exception("NotificationGatewayInfo with this GatewayID does not exist.");
        }

        // Setup control according to NotificationGatewayInfo
        plcSubject.Visible   = ngi.GatewaySupportsEmail;
        plcPlainText.Visible = ngi.GatewaySupportsPlainText;
        plcHTMLText.Visible  = ngi.GatewaySupportsHTMLText;

        if (plcHTMLText.Visible)
        {
            // Initialize HTML editor
            htmlText.AutoDetectLanguage           = false;
            htmlText.DefaultLanguage              = Thread.CurrentThread.CurrentCulture.TwoLetterISOLanguageName;
            htmlText.EditorAreaCSS                = PortalHelper.GetHtmlEditorAreaCss(SiteContext.CurrentSiteName);
            htmlText.ToolbarSet                   = "Basic";
            htmlText.MediaDialogConfig.UseFullURL = true;
            htmlText.LinkDialogConfig.UseFullURL  = true;
            htmlText.QuickInsertConfig.UseFullURL = true;
        }

        // If gateway does not support any of text fields inform about it.
        if (!ngi.GatewaySupportsEmail && !ngi.GatewaySupportsHTMLText && !ngi.GatewaySupportsPlainText)
        {
            ShowWarning(string.Format(GetString("notifications.templatetext.notextbox"), HTMLHelper.HTMLEncode(ngi.GatewayDisplayName)));
        }

        // Get existing TemplateTextInfoObject or create new object
        NotificationTemplateTextInfo ntti = NotificationTemplateTextInfoProvider.GetNotificationTemplateTextInfo(GatewayID, TemplateID);

        if (ntti == null)
        {
            ntti = new NotificationTemplateTextInfo();
        }

        // Set edited object
        EditedObject = ntti;

        // Setup properties
        if (!URLHelper.IsPostback())
        {
            TemplateSubject   = ntti.TemplateSubject;
            TemplateHTMLText  = ntti.TemplateHTMLText;
            TemplatePlainText = ntti.TemplatePlainText;
        }
    }
 protected override void OnInit(EventArgs e)
 {
     base.OnInit(e);
     // Initialize properties
     if (!string.IsNullOrEmpty(WatermarkText) || FilterEnabled || (!string.IsNullOrEmpty(AutoCompleteServiceMethod) && !string.IsNullOrEmpty(AutoCompleteServicePath)))
     {
         PortalHelper.EnsureScriptManager(Page);
     }
 }
Esempio n. 16
0
    protected override void OnInit(EventArgs e)
    {
        base.OnInit(e);

        // Initialize properties
        PortalHelper.EnsureScriptManager(Page);
        btnDown.ScreenReaderDescription = GetString("spinner.decrement");
        btnUp.ScreenReaderDescription   = GetString("spinner.increment");
    }
    /// <summary>
    /// Initializes the control properties.
    /// </summary>
    protected void SetupControl()
    {
        if (StopProcessing)
        {
            // Do not process
        }
        else
        {
            // Build the format
            StringBuilder sb = new StringBuilder();

            bool isRadioButtonList = ControlType.EqualsCSafe("radiobutton", true);

            if (isRadioButtonList)
            {
                sb.Append("<input type=\"radio\" value=\"{3}\"");
            }
            else
            {
                sb.Append("<input type=\"checkbox\" class=\"", this.ShortClientID, "_check\"");
            }

            if (IsDesign)
            {
                if (isRadioButtonList)
                {
                    sb.Append(" name=\"", this.ShortClientID, "_radio\" onmousedown=\"RadioListClick(this, '", this.ShortClientID, "', 'SelectedItem'); return false;\"");
                }
                else
                {
                    sb.Append(" onmousedown=\"CheckListClick(this, '", this.ShortClientID, "', 'SelectedItems'); return false;\" value=\"{3}\"");
                }
            }
            else
            {
                sb.Append(PortalHelper.GetDisabledFormElementAttributes());
            }
            sb.Append(" {1} /> {0}");

            if (Horizontal)
            {
                sb.Append("&nbsp;");
            }
            else
            {
                sb.Append("<br />");
            }

            ltlText.ItemFormat = sb.ToString();
            ltlText.Text       = Items;

            ltlText.SelectedItems    = SelectedItems;
            ltlText.SelectedItemText = " checked=\"checked\"";
        }
    }
Esempio n. 18
0
 protected override void OnInit(EventArgs e)
 {
     base.OnInit(e);
     PortalHelper.EnsureScriptManager(Page);
     if (FinishNextButton != null)
     {
         FinishNextButton.Click += FinishNextButton_Click;
     }
     CurrentMaster.HeadElements.Text   += @"<base target=""_self"" />";
     CurrentMaster.HeadElements.Visible = true;
 }
Esempio n. 19
0
        /// <summary>
        /// Resumes after appointments dialog is completed
        /// </summary>
        /// <param name="context">The context object</param>
        /// <param name="result">Return Task object</param>
        /// <returns>Returns Task</returns>
        private async Task ResumeAfterAppointmentsFormDialog(IDialogContext context, IAwaitable <AppointmentsQuery> result)
        {
            try
            {
                var searchQuery = await result;

                var appointments = await this.GetAppointmentsAsync(searchQuery);

                var appointmentsQueryFormDialog = FormDialog.FromForm(
                    this.BuildAppointmentsForm,
                    FormOptions.PromptInStart);
                if (appointments.Count() == 0)
                {
                    var nextAppointment = PortalHelper.GetNextAvailableAppointment(searchQuery.Date.AddDays(1));
                    if (nextAppointment != null)
                    {
                        this.dynamicPromptOption1 = nextAppointment.Date.ToShortDateString() + " " + nextAppointment.Date.ToShortTimeString();
                        this.dynamicPromptOption2 = "Some other date";
                        PromptDialog.Choice(context, this.ResumeAfterNextAppointment, new List <string>()
                        {
                            this.dynamicPromptOption1, this.dynamicPromptOption2
                        }, $"Oops! No appointment available on {searchQuery.Date.ToShortDateString()}.", "Sorry! I didn't get that. Try typing one of options listed above", 5);
                    }
                    else
                    {
                        await context.PostAsync("Please type another date.");

                        context.Call(appointmentsQueryFormDialog, this.ResumeAfterAppointmentsFormDialog);
                    }
                }
                else
                {
                    // await context.PostAsync($"I found in total {Appointments.Count()} appoitments for your dates:");
                    var appDlg = new AppointmentsListDialog();
                    appDlg.Appointments = appointments.ToList();
                    context.Call(appDlg, this.ResumeAfterOptionDialog);
                }
            }
            catch (FormCanceledException ex)
            {
                string reply;

                if (ex.InnerException == null)
                {
                    reply = "You have canceled the operation. Quitting from the AppointmentsDialog";
                }
                else
                {
                    reply = $"Oops! Something went wrong :( Technical Details: {ex.InnerException.Message}";
                }

                await context.PostAsync(reply);
            }
        }
    /// <summary>
    /// Page load.
    /// </summary>
    protected void Page_Load(object sender, EventArgs e)
    {
        // Ensure the script manager
        PortalHelper.EnsureScriptManager(Page);

        if (StopProcessing)
        {
            SiteCultureSelector.StopProcessing = true;
        }
        else
        {
            SiteCultureSelector.ReloadData();
        }
    }
    /// <summary>
    /// Returns form info with widget properties.
    /// </summary>
    /// <param name="wi">Widget</param>
    protected FormInfo GetWidgetProperties(WidgetInfo wi)
    {
        WebPartInfo wpi = WebPartInfoProvider.GetWebPartInfo(wi.WidgetWebPartID);

        if (wpi != null)
        {
            string widgetProperties = FormHelper.MergeFormDefinitions(wpi.WebPartProperties, wi.WidgetProperties);

            FormInfo zoneTypeDefinition = PortalHelper.GetPositionFormInfo(zoneType);
            FormInfo fi = FormHelper.GetWidgetFormInfo(wi.WidgetName, Enum.GetName(typeof(WidgetZoneTypeEnum), zoneType), widgetProperties, zoneTypeDefinition, false);
            return(fi);
        }
        return(null);
    }
        public ModuleInfo CopyModule(PortalSettings portalSettings, int moduleId, int sourcePageId, int targetPageId, string pane, bool includeSettings, out KeyValuePair <HttpStatusCode, string> message, bool moveBahaviour = false)
        {
            var sourceModule = GetModule(portalSettings, moduleId, sourcePageId, out message);

            if (sourceModule == null)
            {
                return(null);
            }
            var targetPage = TabController.Instance.GetTab(targetPageId, portalSettings.PortalId);

            message = new KeyValuePair <HttpStatusCode, string>(HttpStatusCode.NotFound, string.Format(Localization.GetString("Prompt_PageNotFound", Constants.LocalResourcesFile), targetPageId));

            if (targetPage == null)
            {
                return(null);
            }

            var currentPortalSetting = PortalController.Instance.GetCurrentPortalSettings();

            if (
                currentPortalSetting == portalSettings ||
                targetPage.PortalID == portalSettings.PortalId ||
                PortalHelper.IsRequestForSiteGroup(targetPage.PortalID, portalSettings.PortalId)
                )
            {
                try
                {
                    if (moveBahaviour)
                    {
                        ModuleController.Instance.MoveModule(sourceModule.ModuleID, sourceModule.TabID, targetPage.TabID, pane);
                    }
                    else
                    {
                        ModuleController.Instance.CopyModule(sourceModule, targetPage, pane, includeSettings);
                    }
                    ModuleController.Instance.ClearCache(targetPageId);
                }
                catch (Exception ex)
                {
                    Logger.Error(ex);
                    message = new KeyValuePair <HttpStatusCode, string>(HttpStatusCode.InternalServerError, Localization.GetString(moveBahaviour ? "Prompt_ErrorWhileMoving" : "Prompt_ErrorWhileCopying"));
                }
                // get the new module
                return(ModuleController.Instance.GetModule(sourceModule.ModuleID, targetPageId, true));
            }
            else
            {
                return(null);
            }
        }
Esempio n. 23
0
 /// <summary>
 /// Initializes HTML editor's settings.
 /// </summary>
 protected void InitHTMLEditor()
 {
     htmlContent.AutoDetectLanguage = false;
     htmlContent.DefaultLanguage    = Thread.CurrentThread.CurrentCulture.TwoLetterISOLanguageName;
     // Set direction
     htmlContent.ContentsLangDirection = LanguageDirection.LeftToRight;
     if (CultureHelper.IsPreferredCultureRTL())
     {
         htmlContent.ContentsLangDirection = LanguageDirection.RightToLeft;
     }
     if (SiteContext.CurrentSite != null)
     {
         htmlContent.EditorAreaCSS = PortalHelper.GetHtmlEditorAreaCss(SiteContext.CurrentSiteName);
     }
 }
Esempio n. 24
0
    /// <summary>
    /// Registers the header action buttons.
    /// </summary>
    private void RegisterHeaderActionButtons()
    {
        // Place actions to the main menu if required
        if (UseMainMenu && Visible)
        {
            // Try get current menu
            EditMenu em = PagePlaceholder.PortalManager.CurrentEditMenu;
            if (em != null)
            {
                // Add button
                if (DisplayAddButton)
                {
                    HeaderAction ha = new HeaderAction()
                    {
                        Enabled       = WidgetActionsEnabled,
                        Text          = GetAddWidgetButtonText(),
                        OnClientClick = addScript,
                        Tooltip       = PortalHelper.LocalizeStringForUI("addwidget.tooltip"),
                        GenerateSeparatorBeforeAction = true,
                        ButtonStyle = ButtonStyle.Default
                    };

                    btnAddWidget.Visible = false;
                    em.AddExtraAction(ha);
                }

                // Reset button
                if (DisplayResetButton)
                {
                    HeaderAction ha = new HeaderAction
                    {
                        Enabled       = WidgetActionsEnabled,
                        Text          = GetResetButtonText(),
                        OnClientClick = "if (!confirm(" + ScriptHelper.GetString(PortalHelper.LocalizeStringForUI("widgets.resetzoneconfirmtext")) + ")) { return false; } else { " + ControlsHelper.GetPostBackEventReference(this, "reset") + " }",
                        Tooltip       = PortalHelper.LocalizeStringForUI("resetwidget.tooltip"),
                        GenerateSeparatorBeforeAction = !DisplayAddButton,
                        ButtonStyle = ButtonStyle.Default
                    };

                    btnReset.Visible = false;
                    em.AddExtraAction(ha);
                }

                // Hide empty widget action panel
                pnlWidgetActions.Visible = false;
            }
        }
    }
Esempio n. 25
0
        void _timer_Elapsed(object sender, System.Timers.ElapsedEventArgs e)
        {
            FileLogHelper.LogFunction(this.GetType().Name, "Timer Elapsed", @Globals.FileLogPath);

            _timer.Enabled = false;
            _timer.Stop();

            List <Guid> lstPortalIds = PortalHelper.GetPortalList(_sda);

            foreach (Guid portalId in lstPortalIds)
            {
                ProcessRequests(portalId);
            }

            _timer.Enabled = true;
            _timer.Start();
        }
Esempio n. 26
0
        public override void AfterMoving()
        {
            base.AfterMoving();
            if (!IsTeleporting)
            {
                return;
            }
            Vector2 portalOffset = currentAngle.ToRotationVector2() * (teleportRadius - 14);
            // always add an orange trail
            Color trailColor = PortalHelper.GetPortalColor(1);

            trailColor.A = byte.MaxValue;
            int cycleFrame = teleportFrame % teleportCycleFrames;

            for (int i = 0; i < 3; i++)
            {
                int dustIdx = Dust.NewDust(Projectile.position, 16, 16, DustID.PortalBoltTrail);
                Main.dust[dustIdx].color     = trailColor;
                Main.dust[dustIdx].noLight   = true;
                Main.dust[dustIdx].noGravity = true;
                Main.dust[dustIdx].velocity  = Projectile.velocity / 2f + Utils.RandomVector2(Main.rand, -0.25f, 0.25f);
            }
            for (int sign = -1; sign <= 1; sign++)
            {
                Vector2 portalPosition = teleportTarget.Center + portalOffset;
                Color   portalColor    = PortalHelper.GetPortalColor(sign == 1 ? 0 : 1);
                Lighting.AddLight(portalPosition, portalColor.ToVector3());
                bool shouldAddDust =
                    (sign == 1 && cycleFrame == teleportCycleFrames / 2 - 1) ||
                    (sign == -1 && cycleFrame == teleportCycleFrames / 2 + 1);
                if (shouldAddDust)
                {
                    portalColor.A = byte.MaxValue;
                    for (int i = 0; i < 10; i++)
                    {
                        int dustIdx = Dust.NewDust(Projectile.position, 24, 24, DustID.PortalBolt);
                        Main.dust[dustIdx].color     = portalColor;
                        Main.dust[dustIdx].noLight   = true;
                        Main.dust[dustIdx].noGravity = true;
                    }
                }
            }
        }
Esempio n. 27
0
    protected override void OnInit(EventArgs e)
    {
        // Load the root category of the selector
        DataClassInfo dci = DocumentManager.NewNodeClass;

        if (dci != null)
        {
            selTemplate.RootCategory = dci.ClassPageTemplateCategoryID;
            if (!RequestHelper.IsPostBack())
            {
                selTemplate.SetDefaultTemplate(dci.ClassDefaultPageTemplateID);
            }

            if (dci.ClassName.EqualsCSafe("cms.wireframe", true) && PortalHelper.IsWireframingEnabled(CMSContext.CurrentSiteName))
            {
                selTemplate.IsWireframe = true;
            }
        }

        base.OnInit(e);
    }
Esempio n. 28
0
    /// <summary>
    /// Handles the Load event of the Page control.
    /// </summary>
    protected void Page_Load(object sender, EventArgs e)
    {
        var cui = CurrentUser;

        if (cui != null)
        {
            if (cui.IsAuthorizedPerUIElement("CMS.OnSiteEdit", "OnSiteHighlight"))
            {
                // Highlight button
                MenuItem highlightItem = new MenuItem();
                highlightItem.CssClass      = "BigButton";
                highlightItem.ImageAlign    = ImageAlign.Top;
                highlightItem.IconClass     = "icon-square-dashed-line";
                highlightItem.OnClientClick = "OEHighlightToggle(event, this);";
                highlightItem.Text          = PortalHelper.LocalizeStringForUI("onsiteedit.highlight");
                highlightItem.Tooltip       = PortalHelper.LocalizeStringForUI("onsiteedit.highlighttooltip");
                highlightItem.ImageAltText  = PortalHelper.LocalizeStringForUI("onsiteedit.highlight");

                otherMenu.Buttons.Add(highlightItem);
            }

            if (cui.IsAuthorizedPerUIElement("CMS.OnSiteEdit", "OnSiteHidden"))
            {
                // Hidden button
                MenuItem hiddenItem = new MenuItem();
                hiddenItem.CssClass     = "BigButton OnSiteHiddenButton";
                hiddenItem.ImageAlign   = ImageAlign.Top;
                hiddenItem.IconClass    = "icon-eye-slash";
                hiddenItem.Text         = PortalHelper.LocalizeStringForUI("general.hidden");
                hiddenItem.Tooltip      = PortalHelper.LocalizeStringForUI("onsiteedit.hiddentooltip");
                hiddenItem.ImageAltText = PortalHelper.LocalizeStringForUI("general.hidden");

                // Add temporary empty sub menu item to ensure generating of the sub menu functions
                SubMenuItem epmtyItem = new SubMenuItem();
                hiddenItem.SubItems.Add(epmtyItem);

                otherMenu.Buttons.Add(hiddenItem);
            }
        }
    }
    protected override void OnInit(EventArgs e)
    {
        base.OnInit(e);

        PortalHelper.EnsureScriptManager(Page);

        // Initialize checkbox for special values
        if ((FieldInfo != null) && (FieldInfo.DataType != FormFieldDataTypeEnum.Boolean))
        {
            if (CheckedValue == null)
            {
                CheckedValue = DataHelper.GetNotEmpty(GetValue("CheckedValue"), "");
            }
            if (UncheckedValue == null)
            {
                UncheckedValue = DataHelper.GetNotEmpty(GetValue("UncheckedValue"), "");
            }

            string innerValueString = ValidationHelper.GetString(innerValue, null);
            checkbox.Checked = CMSString.Equals(CheckedValue.ToString(), innerValueString);
        }
    }
    /// <summary>
    /// Prepares script with array of editable regions.
    /// </summary>
    protected void LoadRegionList()
    {
        // Get all Editable controls within 'plcContent'
        List <ICMSEditableControl> regionList = PortalHelper.CollectEditableControls(plcContent);

        // Create array of regions IDs in javascript. We will use it to find out the focused region
        StringBuilder script = new StringBuilder();

        script.AppendFormat("var focusedRegionID = '';\n var regions = new Array({0});\n var regionIDs = new Array({0});\n", regionList.Count);

        for (int i = 0; i < regionList.Count; i++)
        {
            CMSEditableRegion editRegion = (CMSEditableRegion)regionList[i];
            if (editRegion != null)
            {
                script.AppendFormat("regions[{0}] = '{1}_HtmlEditor'; \n ", i, editRegion.ClientID);
                script.AppendFormat("regionIDs[{0}] = '{1}'; \n ", i, editRegion.ID);
            }
        }

        ScriptHelper.RegisterStartupScript(Page, typeof(string), "IssueRegions", ScriptHelper.GetScript(script.ToString()));
    }