コード例 #1
0
        public static void StorePageLinks(CmsPage page) {
            var redirects = new List<RedirectEntity>();

            PopulatePageList(redirects, page);

            ThreadPool.QueueUserWorkItem(callback => AddPageLinksToDatabase(redirects));
        }
コード例 #2
0
        public static void RedirectToController(CmsPage page, string actionName = "index", Dictionary<string, object> additionalRouteData = null) {
            if (!page.IsAvailable) {
                PageHasExpired();
                return;
            }

            var type = GetControllerType(page);
            var controller = (Controller)Activator.CreateInstance(type);
            var controllerName = StripEnd(type.Name.ToLowerInvariant(), "controller");

            var routeData = new RouteData();
            routeData.Values["controller"] = controllerName;
            routeData.Values["action"] = actionName;
            routeData.Values["currentPage"] = ((IPageController)controller).GetTypedPage(page);

            if (additionalRouteData != null) {
                foreach (var data in additionalRouteData) {
                    routeData.Values.Add(data.Key, data.Value);
                }
            }

            HttpContext.Current.Response.Clear();
            var requestContext = new RequestContext(new HttpContextWrapper(HttpContext.Current), routeData);
            ((IController)controller).Execute(requestContext);
            HttpContext.Current.Response.End();
        }
コード例 #3
0
        public static IHtmlString BreadcrumbsFor(this HtmlHelper helper, CmsPage page, IDictionary<String, Object> htmlAttributes = null) {
            var ancestors = page.ParentPath.Reverse();

            if (!ancestors.Any()) {
                return null;
            }

            var itemClassName = PullHtmlAttribute(htmlAttributes, "itemClass");
            var linkClassName = PullHtmlAttribute(htmlAttributes, "linkClass");

            var stringBuilder = new StringBuilder();
            foreach (CmsPage ancestor in ancestors) {
                stringBuilder.Append("<li");

                AddOptionalClassName(itemClassName, stringBuilder);

                stringBuilder.AppendFormat("><a href=\"{0}\"", ancestor.PageUrl);

                AddOptionalClassName(linkClassName, stringBuilder);

                stringBuilder.AppendFormat(">{0}</a></li>", ancestor.PageName);
            }

            var list = new TagBuilder("ul");
            list.MergeAttributes(htmlAttributes);
            list.InnerHtml = stringBuilder.ToString();

            return new HtmlString(list.ToString());
        }
コード例 #4
0
        public static RouteValueDictionary GetRouteValues(CmsPage entry)
        {
            if (null == entry)
            {
                return new RouteValueDictionary();
            }

            return new RouteValueDictionary(new {id = entry.Id, name = entry.Alias});
        }
コード例 #5
0
        public static string PageLink(this HtmlHelper helper, CmsPage page)
        {
            if (null != page)
            {
                return page.GetUrl();
            }

            return string.Empty;
        }
コード例 #6
0
        internal static EditablePage CreateEditableChildPage(CmsPage page, Type type) {
            PageType pageType = PageType.GetPageType(type);

            if (pageType == null) {
                throw new Exception("Can't find page type for type " + type.Name);
            }

            EditablePage editablePage = CreateEditableChildPage(page, pageType.PageTypeId);
            return editablePage;
        }
コード例 #7
0
        public void IndexPage(CmsPage page) {
            var pageType = PageType.GetPageType(page.PageTypeId);
            var indexable = pageType.Instance as IIndexable;

            if (indexable != null) {
                var indexItem = indexable.MakeIndexItem(page);
                AddToIndex(indexItem);
            }

            IndexingFinished();
        }
コード例 #8
0
        private static void PopulatePageList(ICollection<RedirectEntity> redirects, CmsPage page) {
            redirects.Add(new RedirectEntity(page));

            if (!page.HasChildren) {
                return;
            }

            foreach (CmsPage child in page.Children) {
                PopulatePageList(redirects, child);
            }
        }
コード例 #9
0
        public JsonResult CreateAlias(string title, string userName)
        {
            if (string.IsNullOrEmpty(title))
            {
                title = "invalid value";
            }

            var page = new CmsPage();
            page.PageTitle = title;
            page.Alias = CmsPage.CreateAlias(title);
            pageService.CreateEntry(page, userName);
            return Json(new {alias = page.Alias, id = page.Id});
        }
コード例 #10
0
ファイル: MenuList.cs プロジェクト: cmarfia/KalikoCMS.Core
        protected override bool AddPage(CmsPage page) {
            if (page.VisibleInMenu) {
                if ((SelectedItemTemplate != null) && (CurrentPage.ParentPath.Contains(page.PageId))) {
                    CreateItem(Index, page.PageId, SelectedItemTemplate);
                }
                else {
                    CreateItem(Index, page.PageId, ItemTemplate);
                }

                return true;
            }

            return false;
        }
コード例 #11
0
ファイル: ArticlePage.cs プロジェクト: KalikoCMS/DemoSite.Mvc
        /// <summary>
        /// This function is required when implementing IIndexable and will feed the 
        /// search engine with the content that should be indexed when a page of this 
        /// particular page type is saved.
        /// You should always get the IndexItem object by calling GetBaseIndexItem and 
        /// add the content you wish to be indexed for search.
        /// </summary>
        /// <param name="page">The page that was saved</param>
        /// <returns>An object containing the content to be indexed</returns>
        public IndexItem MakeIndexItem(CmsPage page) {
            // We start by casting the generic CmsPage object to our page type
            var typedPage = page.ConvertToTypedPage<ArticlePage>();

            // Get the base index item with basic information already set
            var indexItem = typedPage.GetBaseIndexItem();

            // Add additional information to index, this is where you add the page's properties that should be searchable
            indexItem.Title = typedPage.Headline.Value;
            indexItem.Summary = typedPage.Preamble.Value;
            indexItem.Content = typedPage.Preamble.Value + " " + typedPage.MainBody.Value;
            indexItem.Tags = typedPage.Tags.ToString();
            
            // We set a category in order to be able to single out search hits
            indexItem.Category = "Article";
            
            return indexItem;
        }
コード例 #12
0
        public bool TryMvcSupport(int segmentPosition, string[] segments, PageIndexItem page) {
            if (page.PageId == Guid.Empty) {
                return false;
            }

            try {
                var parametersCount = segments.Length - segmentPosition - 1;
                var parameters = new string[parametersCount];
                Array.Copy(segments, segmentPosition + 1, parameters, 0, parametersCount);
                var cmsPage = new CmsPage(page, Language.CurrentLanguageId);
                RequestModule.RedirectToControllerAction(cmsPage, parameters);

                return true;
            }
            catch (Exception exception) {
                Logger.Write(exception, Logger.Severity.Info);
                return false;
            }
        }
コード例 #13
0
        public static IHtmlString MenuTreeFor(this HtmlHelper helper, CmsPage page, CmsPage rootPage, IDictionary<String, Object> htmlAttributes = null) {
            if (!rootPage.HasChildren) {
                return null;
            }

            var listClass = GetHtmlAttribute(htmlAttributes, "class");
            var itemClassName = PullHtmlAttribute(htmlAttributes, "itemClass");
            var selectedItemClassName = PullHtmlAttribute(htmlAttributes, "selectedItemClass");
            var linkClassName = PullHtmlAttribute(htmlAttributes, "linkClass");

            var stringBuilder = new StringBuilder();
            var pagePath = PageFactory.GetPagePath(page);

            AddChildrenToMenu(stringBuilder, rootPage, page, pagePath, itemClassName, selectedItemClassName, linkClassName, listClass);

            var list = new TagBuilder("ul");
            list.MergeAttributes(htmlAttributes);
            list.InnerHtml = stringBuilder.ToString();

            return new HtmlString(list.ToString());
        }
コード例 #14
0
        public override void RenderInViewMode(HtmlTextWriter writer, CmsPage page, int identifier, CmsLanguage langToRenderFor, string[] paramList)
        {
            UserFeedbackDb       db       = new UserFeedbackDb();
            UserFeedbackFormInfo formInfo = db.getUserFeedbackFormInfo(page, identifier, langToRenderFor, true);
            string ControlId = "UserFeedbackInfo_" + page.Id.ToString() + "_" + identifier.ToString() + "_" + langToRenderFor.shortCode + "_";

            string _errorMessage = "";
            string action        = PageUtils.getFromForm(ControlId + "Action", "");
            UserFeedbackSubmittedData submittedData = new UserFeedbackSubmittedData();
            bool formValuesLoadedFromSession        = false;

            if (action.Trim().ToLower() == "send")
            {
                // -- get the spam question index
                int spamQuestionIndex = (PageUtils.getFromForm(ControlId + "spamQuestionIndex", SpamTestQuestion.GetRandomQuestionIndex()));
                if (spamQuestionIndex >= SpamTestQuestion.Questions.Length || spamQuestionIndex < 0)
                {
                    spamQuestionIndex = SpamTestQuestion.GetRandomQuestionIndex();
                }

                SpamTestQuestion questionToAnswer = SpamTestQuestion.Questions[spamQuestionIndex];

                string spamQuestionAnswer = (PageUtils.getFromForm(ControlId + "spamQuestionAnswer", ""));

                submittedData.Name          = (PageUtils.getFromForm(ControlId + "Name", ""));
                submittedData.Name          = submittedData.Name.Trim();
                submittedData.EmailAddress  = PageUtils.getFromForm(ControlId + "Email", "");
                submittedData.EmailAddress  = submittedData.EmailAddress.Trim();
                submittedData.Location      = PageUtils.getFromForm(ControlId + "Location", "");
                submittedData.Location      = submittedData.Location.Trim();
                submittedData.TextAreaValue = PageUtils.getFromForm(ControlId + "Comments", "");
                submittedData.TextAreaValue = submittedData.TextAreaValue.Trim();
                submittedData.ReferringUrl  = PageUtils.getFromForm(ControlId + "Referer", "");

                // -- validate user submitted values
                if (questionToAnswer.Answer != spamQuestionAnswer)
                {
                    _errorMessage = "Your answer to the math question was incorrect. Please try again.";
                }
                else if (submittedData.Name == "")
                {
                    _errorMessage = getErrorEnterNameText(langToRenderFor);
                }
                else if (submittedData.EmailAddress == "")
                {
                    _errorMessage = getErrorEnterEmailText(langToRenderFor);
                }
                else if (!PageUtils.isValidEmailAddress(submittedData.EmailAddress))
                {
                    _errorMessage = getErrorEnterValidEmailText(langToRenderFor);
                }
                else if (submittedData.TextAreaValue == "")
                {
                    _errorMessage = getErrorEnterTextAreaQuestionText(langToRenderFor) + formInfo.TextAreaQuestion;
                }
                else
                {
                    // -- save the submitted value
                    submittedData.dateTimeSubmitted = DateTime.Now;
                    submittedData.TextAreaQuestion  = formInfo.TextAreaQuestion;

                    if (db.saveUserFeedbackSubmittedData(submittedData))
                    {
                        // -- success
                        //    save submitted values to the current session
                        if (HttpContext.Current != null && HttpContext.Current.Session != null)
                        {
                            System.Web.SessionState.HttpSessionState session = System.Web.HttpContext.Current.Session;
                            session[ControlId + "Name"]     = submittedData.Name;
                            session[ControlId + "Email"]    = submittedData.EmailAddress;
                            session[ControlId + "Location"] = submittedData.Location;
                        }
                        //    send notification email message
                        sendAdministratorNotification(formInfo, submittedData);
                        //   output the Thankyou message
                        writer.Write("<p><strong>" + formInfo.ThankyouMessage + "</strong></p>");
                        return;
                    }
                    else
                    {
                        _errorMessage = getErrorSavingText(langToRenderFor);
                    }
                }
            } // if save posted values
            else
            {
                // -- get previously submitted values from the current session
                if (System.Web.HttpContext.Current != null && System.Web.HttpContext.Current.Session != null)
                {
                    System.Web.SessionState.HttpSessionState session = System.Web.HttpContext.Current.Session;
                    if (session[ControlId + "Name"] != null)
                    {
                        submittedData.Name          = session[ControlId + "Name"].ToString();
                        formValuesLoadedFromSession = true;
                    }
                    if (session[ControlId + "Email"] != null)
                    {
                        submittedData.EmailAddress  = session[ControlId + "Email"].ToString();
                        formValuesLoadedFromSession = true;
                    }
                    if (session[ControlId + "Location"] != null)
                    {
                        submittedData.Location      = session[ControlId + "Location"].ToString();
                        formValuesLoadedFromSession = true;
                    }
                }
            }


            StringBuilder html = new StringBuilder();

            if (_errorMessage != "")
            {
                html.Append("<p class=\"FormErrorMessage\">" + _errorMessage + "</p>");
            }

            string formId = "UserFeedback";

            html.Append(page.getFormStartHtml(formId));

            html.Append("<em>" + getCompleteAllText(langToRenderFor) + "</em> ");
            if (formValuesLoadedFromSession)
            {
                html.Append(getValuesPreloadedText(langToRenderFor));
            }

            html.Append("<table>");
            html.Append("<tr>");
            html.Append("<td valign=\"top\">" + getNameText(langToRenderFor) + ":");
            html.Append("</td>");
            html.Append("<td valign=\"top\">");
            html.Append(PageUtils.getInputTextHtml(ControlId + "Name", ControlId + "Name", submittedData.Name, formInfo.FormFieldDisplayWidth, 255));
            html.Append("</td>");
            html.Append("</tr>");

            html.Append("<tr>");
            html.Append("<td valign=\"top\">" + getEmailText(langToRenderFor) + ":");
            html.Append("</td>");
            html.Append("<td valign=\"top\">");
            html.Append(PageUtils.getInputTextHtml(ControlId + "Email", ControlId + "Email", submittedData.EmailAddress, formInfo.FormFieldDisplayWidth, 255));
            html.Append("</td>");
            html.Append("</tr>");

            html.Append("<tr>");
            html.Append("<td valign=\"top\">" + getLocationText(langToRenderFor) + ":");
            html.Append("</td>");
            html.Append("<td valign=\"top\">");
            html.Append(PageUtils.getInputTextHtml(ControlId + "Location", ControlId + "Location", submittedData.Location, formInfo.FormFieldDisplayWidth, 255));
            html.Append("</td>");
            html.Append("</tr>");

            html.Append("<tr>");
            html.Append("<td valign=\"top\">");
            html.Append(formInfo.TextAreaQuestion);
            html.Append("</td>");
            html.Append("<td valign=\"top\">");
            html.Append(PageUtils.getTextAreaHtml(ControlId + "Comments", ControlId + "Comments", "", formInfo.FormFieldDisplayWidth, 7));
            html.Append("</td>");
            html.Append("</tr>");

            // -- spam stop question
            int qIndex = SpamTestQuestion.GetRandomQuestionIndex();
            SpamTestQuestion spamQuestion = SpamTestQuestion.Questions[qIndex];

            html.Append("<tr>");
            html.Append("<td valign=\"top\">");
            html.Append(spamQuestion.Question);
            html.Append("</td>");
            html.Append("<td valign=\"top\">");
            html.Append(PageUtils.getInputTextHtml(ControlId + "spamQuestionAnswer", ControlId + "spamQuestionAnswer", "", 5, 255));
            html.Append("</td>");
            html.Append("</tr>");

            html.Append("</table>");

            html.Append(PageUtils.getHiddenInputHtml(ControlId + "spamQuestionIndex", qIndex.ToString()));
            html.Append(PageUtils.getHiddenInputHtml(ControlId + "Action", "send"));
            html.Append(PageUtils.getHiddenInputHtml(ControlId + "Referer", PageUtils.getFromForm("r", "(unknown)")));

            html.Append("<input type=\"submit\" value=\"" + getSubmitButtonText(langToRenderFor) + "\">");
            html.Append(page.getFormCloseHtml(formId));

            writer.Write(html.ToString());
        } // RenderView
コード例 #15
0
 public override Rss.RssItem[] GetRssFeedItems(CmsPage page, CmsPlaceholderDefinition placeholderDefinition, CmsLanguage langToRenderFor)
 {
     return(new Rss.RssItem[0]); // nothing to render in RSS.
 }
コード例 #16
0
 private bool CheckIfActive(CmsPage page)
 {
     return(page.IsActive);
 }
コード例 #17
0
ファイル: TreeViewModule.cs プロジェクト: hvanreenen/bitplate
        public string BuildTree2(CmsPage page)
        {
            int viewMode = 1;//int.Parse(this.ViewModeCheckBoxList.SelectedValue);

            this.treeViewTemplate = base.GetSubTemplate("{TreeView}");
            this.treeNodeTemplate = base.GetSubTemplate("{TreeNode}");

            string tree      = treeViewTemplate;
            string rootNodes = "";
            string select    = "SELECT DataGroup.ID, DataGroup.Name, DataGroup.FK_Parent_Group, DataGroup.CompletePath, ";
            string from      = " FROM DataGroup ";

            if (!DataCollection.HasStaticLanguage && this.LanguageCode != "" && this.LanguageCode != Site.DefaultLanguage)
            {
                DataField titleField = DataField.GetFirst <DataField>("FK_DataCollection = '" + DataCollection.ID + "' AND MappingColumn='Title' AND type='group'");
                if (titleField.IsMultiLanguageField)
                {
                    select += "Lang.Title AS Title ";
                    from   += " JOIN DataGroupLanguage AS Lang ON DataGroup.ID = Lang.FK_DataGroup AND Lang.LanguageCode = '" + this.LanguageCode + "'";
                }
                else
                {
                    select += "DataGroup.Title ";
                }
            }
            else
            {
                select += "DataGroup.Title ";
            }

            string where = String.Format(" WHERE DataGroup.FK_DataCollection = '{0}' ", DataCollection.ID);
            string sort = getSort(DataCollection.DataGroupFields); //" ORDER BY DataGroup.OrderNumber";
            string sql  = select + from + where + sort;

            System.Data.DataTable allGroupsTable = DataBase.Get().GetDataTable(sql);

            string drillDownUrl  = "";
            string drillDownLink = "";
            ModuleNavigationAction navigationActionDrillDown = this.GetNavigationActionByTagName("{DrillDownLink}");

            if (navigationActionDrillDown != null)
            {
                drillDownUrl  = navigationActionDrillDown.GetNavigationUrl();
                drillDownLink = navigationActionDrillDown.CreateNavigationHyperlink("G", false, "BITTREEVIEW.isReloadRequired = false;");
            }


            foreach (System.Data.DataRow dataRow in allGroupsTable.Rows)//.Select("FK_Parent_Group Is Null", sort.Replace("ORDER BY ", "")))
            {
                //DataTable.Select() sorteert de items opnieuw. Dit is niet de bedoeling.
                if (dataRow["FK_Parent_Group"] == DBNull.Value)
                {
                    string rewriteUrl = CreateRewriteUrl(page, drillDownUrl, "G", new Guid(dataRow["ID"].ToString()), dataRow["CompletePath"].ToString(), dataRow["Title"].ToString());

                    string rootNode = this.treeNodeTemplate;
                    string name     = dataRow["Name"].ToString();
                    rootNode = rootNode
                               .Replace("{TreeNode.DrillDownLink}", drillDownLink)
                               .Replace("{TreeNode.Name}", dataRow["Name"].ToString())
                               .Replace("{TreeNode.Title}", dataRow["Title"].ToString())
                               .Replace("{/TreeNode.DrillDownLink}", "</a>")
                               .Replace("{TreeNode.ID}", "TreeNode" + dataRow["ID"].ToString().Replace("-", ""))
                               .Replace("{DrillDownUrl}", rewriteUrl)
                               .Replace("{ID}", dataRow["ID"].ToString())
                               .Replace("{TreeNode.ChildNodes}", this.BuildTreeNode2(page, allGroupsTable, rootNode, dataRow["ID"].ToString(), viewMode, drillDownUrl, drillDownLink));

                    rootNodes += rootNode;
                }
            }


            /* if (viewMode == 2) //groups and items
             * {
             *  foreach (DataItem item in dataCollection.Items)
             *  {
             *      TreeNode itemNode = new TreeNode();
             *      itemNode.Text = itemNode.Text;
             *      itemNode.Value = item.ID.ToString();
             *      DataCollectionTreeView.Nodes.Add(itemNode);
             *  }
             * } */
            tree = Content;
            tree = tree.Replace("<!--{TreeNode}-->" + treeNodeTemplate + "<!--{/TreeNode}-->", rootNodes);
            tree = tree.Replace("{TreeNode}" + treeNodeTemplate + "{/TreeNode}", rootNodes);
            string treeDiv = "<div class=\"bitTree\" data-tree-selected-id=\"TreeNode" + dataId.ToString("N") + "\">";

            tree = tree.Replace("<!--{TreeView}-->", treeDiv);
            tree = tree.Replace("{TreeView}", treeDiv);
            tree = tree.Replace("<!--{/TreeView}-->", "</div>");
            tree = tree.Replace("{/TreeView}", "</div>");

            return(tree);
        }
コード例 #18
0
        private void RenderViewIndividual(HtmlTextWriter writer, CmsPage page, int identifier, CmsLanguage langToRenderFor, string[] paramList)
        {
            ContactsDb             db   = new ContactsDb();
            ContactPlaceholderData data = db.getContactPlaceholderData(page, identifier, true);

            int contactId = PageUtils.getFromForm(CurrentContactIdFormName, -1);

            ContactData contactToView = ContactData.getContact(contactId);

            bool canEdit = page.currentUserCanWrite;

            string backUrl = page.Url;

            writer.Write("<p><a href=\"" + backUrl + "\">&#171; back to contact listing</a></p>");
            // -- begin output
            if (canEdit)
            {
                writer.Write(getAddEditContactForm(data, contactToView, page, identifier, langToRenderFor));
            }
            else
            {
                StringBuilder html = new StringBuilder();
                html.Append("<table border=\"0\">");

                string dividerLineHtml = getDividerLineHtml(2);

                html.Append(dividerLineHtml);

                html.Append("<tr>");
                html.Append("<td colspan=\"2\" align=\"center\"><h2>" + StringUtils.JoinNonBlanks(" ", new string[] { contactToView.firstName, contactToView.lastName }) + "</h2></td>");

                html.Append(dividerLineHtml);

                string colspan = "1";

                html.Append("<td>Categories:</td>");
                ContactDataCategory[] allCategories = ContactDataCategory.getAllContactCategories();
                html.Append("<td colspan=\"" + colspan + "\">");
                int cbid = 0;
                foreach (ContactDataCategory cat in allCategories)
                {
                    bool   check = (contactToView.contactCategoryIds.IndexOf(cat.CategoryId) > -1);
                    string cb    = PageUtils.getCheckboxHtml(cat.Title, "category", "category" + cbid.ToString(), cat.CategoryId.ToString(), check);
                    html.Append(cb + "<br />");
                    cbid++;
                } // foreach
                html.Append("</td>");

                html.Append(dividerLineHtml);

                html.Append("<tr>");
                html.Append("<td>Title:</td>");
                html.Append("<td colspan=\"" + colspan + "\">" + contactToView.title + "</td>");
                html.Append("</tr>");

                html.Append("<tr>");
                html.Append("<td>Organization:</td>");
                html.Append("<td colspan=\"" + colspan + "\">" + contactToView.organizationName + "</td>");
                html.Append("</tr>");

                html.Append(dividerLineHtml);

                html.Append("<tr>");
                html.Append("<td>Address 1:</td>");
                html.Append("<td colspan=\"" + colspan + "\">" + contactToView.address1 + "</td>");
                html.Append("</tr>");

                html.Append("<tr>");
                html.Append("<td>Address 2:</td>");
                html.Append("<td colspan=\"" + colspan + "\">" + contactToView.address2 + "</td>");
                html.Append("</tr>");

                html.Append("<tr>");
                html.Append("<td>City:</td>");
                html.Append("<td colspan=\"" + colspan + "\">" + contactToView.city + "</td>");
                html.Append("</tr>");

                html.Append("<tr>");
                html.Append("<td>Province/State:</td>");
                html.Append("<td colspan=\"" + colspan + "\">" + contactToView.provinceState + "</td>");
                html.Append("</tr>");

                html.Append("<tr>");
                html.Append("<td>Postal/Zip Code:</td>");
                html.Append("<td colspan=\"" + colspan + "\">" + contactToView.postalZipCode + "</td>");
                html.Append("</tr>");

                html.Append(dividerLineHtml);

                html.Append("<tr>");
                html.Append("<td>Phone Number 1:</td>");
                html.Append("<td colspan=\"" + colspan + "\">" + contactToView.phoneNumber1 + "</td>");
                html.Append("</tr>");

                html.Append("<tr>");
                html.Append("<td>Phone Number 2:</td>");
                html.Append("<td colspan=\"" + colspan + "\">" + contactToView.phoneNumber2 + "</td>");
                html.Append("</tr>");

                html.Append("<tr>");
                html.Append("<td>Fax Number:</td>");
                html.Append("<td colspan=\"" + colspan + "\">" + contactToView.faxNumber + "</td>");
                html.Append("</tr>");

                html.Append("<tr>");
                html.Append("<td>Mobile Number:</td>");
                html.Append("<td colspan=\"" + colspan + "\">" + contactToView.mobileNumber + "</td>");
                html.Append("</tr>");

                html.Append(dividerLineHtml);

                string emailDisplay = "";
                if (contactToView.emailAddress.Trim() != "")
                {
                    emailDisplay = "<a href=\"mailto:" + contactToView.SpamEncodedEmailAddress + "\">" + contactToView.SpamEncodedEmailAddress + "</a>";
                }

                html.Append("<tr>");
                html.Append("<td>Email Address:</td>");
                html.Append("<td colspan=\"" + colspan + "\">" + emailDisplay + "</td>");
                html.Append("</tr>");

                html.Append("</table>");

                writer.Write(html.ToString());
            }
        }
コード例 #19
0
        } // getAddEditContactForm

        public override Rss.RssItem[] GetRssFeedItems(CmsPage page, CmsPlaceholderDefinition placeholderDefinition, CmsLanguage langToRenderFor)
        {
            throw new Exception("The method or operation is not implemented.");
        }
コード例 #20
0
 /// <summary>
 /// Renders the placeholder to the RssFeed in view mode.
 /// </summary>
 /// <param name="rssFeed"></param>
 // public static Rss.RssItem[] GetRssFeedItems(CmsPage page, CmsPlaceholderDefinition placeholderDefinition , CmsLanguage langToRenderFor)
 public abstract Rss.RssItem[] GetRssFeedItems(CmsPage page, CmsPlaceholderDefinition placeholderDefinition, CmsLanguage langToRenderFor);
コード例 #21
0
 public void HandlePage(CmsPage page) {
     var templateUrl = RequestModule.GetTemplateUrl(page.IsAvailable, page.PageId, page.PageTypeId);
     RequestModule.RedirectToTemplate(templateUrl);
 }
コード例 #22
0
 /// <summary>
 /// reverts a placeholder to a prior revision.
 /// </summary>
 /// <param name="oldPage">the page to revert to.</param>
 /// <param name="currentPage">the version of the page that is currently displayed to users</param>
 /// <param name="identifiers">the placeholder identifiers to revert in-bulk</param>
 /// <param name="language">the page language to revert</param>
 /// <returns></returns>
 public abstract RevertToRevisionResult RevertToRevision(CmsPage oldPage, CmsPage currentPage, int[] identifiers, CmsLanguage language);
コード例 #23
0
 /// <summary>
 /// Renders the placeholder to the HtmlTextWriter in user-editable mode
 /// </summary>
 /// <param name="writer"></param>
 /// <param name="page"></param>
 /// <param name="identifier"></param>
 /// <param name="paramList"></param>
 public abstract void RenderInEditMode(HtmlTextWriter writer, CmsPage page, int identifier, CmsLanguage langToRenderFor, string[] paramList);
コード例 #24
0
 public static MvcHtmlString PageLink(this HtmlHelper helper, string linkText, CmsPage page,
                                      object htmlAttributes)
 {
     return helper.ActionLink(linkText ?? page.PageTitle, "Content", "Home",
                              new {area = "", id = page.Id, name = page.Alias}, htmlAttributes);
 }
コード例 #25
0
ファイル: PageList.cs プロジェクト: KalikoCMS/KalikoCMS.Core
        virtual protected bool AddPage(CmsPage page) {
            CreateItem(Index, page.PageId, ItemTemplate);

            return true;
        }
コード例 #26
0
 protected string GenerateEntryUrl(CmsPage entry)
 {
     return VirtualPathUtility.RemoveTrailingSlash(this.GetWebsiteUrl()) +
            Url.Action("Content", "Home", GetRouteValues(entry));
 }
コード例 #27
0
 public RaptorDataStore(CmsPage page)
     : base(page)
 {
 }
コード例 #28
0
 public Rss.RssItem CreateAndInitRssItem(CmsPage page, CmsLanguage langToRenderFor)
 {
     return(InitRssItem(new Rss.RssItem(), page, langToRenderFor));
 }
コード例 #29
0
 public WarpCorePageUri(CmsPage draft) : this($"{UriSchemeWarpCorePage}://repository/{CmsPageRepository.ApiId}/type/{CmsPage.ApiId}/{draft.ContentId}")
 {
 }
コード例 #30
0
 protected string GenerateEntryUrl(CmsPage entry)
 {
     return(VirtualPathUtility.RemoveTrailingSlash(this.GetWebsiteUrl()) +
            Url.Action("Content", "Home", GetRouteValues(entry)));
 }
コード例 #31
0
 private string RenderPreviewButton(CmsPage page) {
     return string.Format("<a href=\"{2}?id={0}&version={1} \" target=\"_blank\">Preview</a>", page.PageId, page.CurrentVersion, SiteSettings.Instance.PreviewPath);
 }
コード例 #32
0
        /*
         * public static string getStandardHtmlView_Old(SingleImageData image, FullSizeImageLinkMode fullSizeLinkMode, string fullSizeDisplayUrl)
         * {
         *  StringBuilder html = new StringBuilder();
         *  if (image.ImagePath != "")
         *  {
         *      bool linkToLarger = false;
         *      if (image.FullSizeDisplayBoxHeight > 0 || image.FullSizeDisplayBoxWidth > 0)
         *          linkToLarger = true;
         *
         *      string thumbUrl = showThumbPage.getThumbDisplayUrl(image.ImagePath, image.ThumbnailDisplayBoxWidth, image.ThumbnailDisplayBoxHeight);
         *      System.Drawing.Size ThumbSize = showThumbPage.getDisplayWidthAndHeight(image.ImagePath, image.ThumbnailDisplayBoxWidth, image.ThumbnailDisplayBoxHeight);
         *
         *      html.Append("<div class=\"SingleImagePlaceholder View\">");
         *      if (linkToLarger)
         *      {
         *          bool useSubmodal = CmsConfig.getConfigValue("SingleImagePlaceHolderUseSubModal", false);
         *          bool useMultibox = CmsConfig.getConfigValue("SingleImagePlaceHolderUseMultibox", false);
         *
         *
         *          int popupPaddingWidth = CmsConfig.getConfigValue("SingleImagePlaceHolderPopupPaddingWidth", 50);
         *          int popupPaddingHeight = CmsConfig.getConfigValue("SingleImagePlaceHolderPopupPaddingHeight", 60);
         *
         *          int maxPopWidth = CmsConfig.getConfigValue("SingleImagePlaceHolderPopupMaxWidth", 700 - popupPaddingWidth);
         *          int maxPopHeight = CmsConfig.getConfigValue("SingleImagePlaceHolderPopupMaxHeight", 500 - popupPaddingHeight);
         *
         *
         *          int minPopWidth = CmsConfig.getConfigValue("SingleImagePlaceHolderPopupMinWidth", 200);
         *          int minPopHeight = CmsConfig.getConfigValue("SingleImagePlaceHolderPopupMinHeight", 200);
         *
         *
         *          string showLargerPagePath = CmsConfig.getConfigValue("SingleImage.DisplayPath", "/_internal/showImage");
         *
         *          NameValueCollection largerParams = new NameValueCollection();
         *          largerParams.Add("i", image.SingleImageId.ToString());
         *          string showLargerPageUrl = CmsContext.getUrlByPagePath(showLargerPagePath, largerParams);
         *
         *          System.Drawing.Size imgLargeSize = showThumbPage.getDisplayWidthAndHeight(image.ImagePath, image.FullSizeDisplayBoxWidth, image.FullSizeDisplayBoxHeight);
         *
         *          if (ThumbSize.Width > imgLargeSize.Width || ThumbSize.Height > imgLargeSize.Height)
         *          {
         *              linkToLarger = false;
         *          }
         *          else
         *          {
         *
         *              int popWidth = imgLargeSize.Width + popupPaddingWidth;
         *              int popHeight = imgLargeSize.Height + popupPaddingHeight;
         *
         *              if (popWidth < minPopWidth)
         *                  popWidth = minPopWidth;
         *              if (popHeight < minPopHeight)
         *                  popHeight = minPopHeight;
         *
         *              if (popWidth > maxPopWidth)
         *                  popWidth = maxPopWidth;
         *              if (popHeight > maxPopHeight)
         *                  popHeight = maxPopHeight;
         *
         *              if (useSubmodal &&
         *                  (fullSizeLinkMode == FullSizeImageLinkMode.SubModalOrPopupFromConfig || fullSizeLinkMode == FullSizeImageLinkMode.SubModalWindow))
         *              {
         *                  string submodalCssClass = "class=\"submodal-" + popWidth.ToString() + "-" + popHeight.ToString() + "\"";
         *                  html.Append("<a " + submodalCssClass + " href=\"" + showLargerPageUrl + "\" >");
         *              }
         *              else if (useMultibox && (fullSizeLinkMode == FullSizeImageLinkMode.SubModalOrPopupFromConfig || fullSizeLinkMode == FullSizeImageLinkMode.SubModalWindow))
         *              {
         *                  string submodalCssClass = "class=\"mb\"";
         *                  html.Append("<a " + submodalCssClass + " href=\"" + showLargerPageUrl + "\" rel=\"width:" + popWidth + ",height:" + popHeight + "\" >");
         *              }
         *              else if (fullSizeLinkMode == FullSizeImageLinkMode.SingleImagePopup || fullSizeLinkMode == FullSizeImageLinkMode.SubModalOrPopupFromConfig)
         *              {
         *                  string onclick = "var w = window.open(this.href, 'popupLargeImage', 'toolbar=no,menubar=no,resizable=yes,scrollbars=yes,status=yes,height=" + popWidth.ToString() + ",width=" + popWidth.ToString() + "'); ";
         *                  onclick += " return false;";
         *                  html.Append("<a href=\"" + showLargerPageUrl + "\" onclick=\"" + onclick + "\">");
         *              }
         *              else if (fullSizeLinkMode == FullSizeImageLinkMode.ProvidedUrl)
         *                  html.Append("<a href=\"" + fullSizeDisplayUrl + "\">");
         *              else
         *                  linkToLarger = false;
         *          } // else
         *      } // if link to larger
         *
         *      string width = "";
         *      string height = "";
         *      if (!ThumbSize.IsEmpty)
         *      {
         *          width = " width=\"" + ThumbSize.Width + "\"";
         *          height = " height=\"" + ThumbSize.Height.ToString() + "\"";
         *      }
         *
         *      html.Append("<img src=\"" + thumbUrl + "\"" + width + "" + height + ">");
         *      if (linkToLarger)
         *      {
         *          html.Append("</a>");
         *      }
         *
         *      if (image.Caption.Trim() != "")
         *      {
         *          html.Append("<div class=\"caption\">");
         *          html.Append(image.Caption);
         *          html.Append("</div>"); // caption
         *      }
         *
         *      if (image.Credits.Trim() != "")
         *      {
         *          html.Append("<div class=\"credits\">");
         *          string creditsPrefix = CmsConfig.getConfigValue("SingleImage.CreditsPrefix", "");
         *          html.Append(creditsPrefix + image.Credits);
         *          html.Append("</div>"); // credits
         *      }
         *
         *      if (linkToLarger)
         *      {
         *          string clickToEnlargeText = CmsConfig.getConfigValue("SingleImage.ClickToEnlargeText", "");
         *          if (clickToEnlargeText != "")
         *          {
         *              html.Append("<div class=\"clickToEnlarge\">");
         *              html.Append(clickToEnlargeText);
         *              html.Append("</div>"); // clickToEnlarge
         *          }
         *      }
         *
         *      html.Append("</div>");
         *  }
         *
         *  return html.ToString();
         * }
         */

        public override void RenderInViewMode(HtmlTextWriter writer, CmsPage page, int identifier, CmsLanguage langToRenderFor, string[] paramList)
        {
            // -- all rendering in View mode is handled by getStandardHtmlView()
            SingleImageDb   db    = (new SingleImageDb());
            SingleImageData image = db.getSingleImage(page, identifier, langToRenderFor, true);

            int fullWidth  = CmsConfig.getConfigValue("SingleImage.FullSizeDisplayWidth", -1);
            int fullHeight = CmsConfig.getConfigValue("SingleImage.FullSizeDisplayHeight", -1);

            int thumbWidth  = getThumbDisplayWidth(page, paramList);
            int thumbHeight = getThumbDisplayHeight(page, paramList);

            int popupPaddingWidth  = CmsConfig.getConfigValue("SingleImage.PopupPaddingWidth", 50);
            int popupPaddingHeight = CmsConfig.getConfigValue("SingleImage.PopupPaddingHeight", 60);

            int maxPopWidth  = CmsConfig.getConfigValue("SingleImage.PopupMaxWidth", 700 - popupPaddingWidth);
            int maxPopHeight = CmsConfig.getConfigValue("SingleImage.PopupMaxHeight", 500 - popupPaddingHeight);


            int minPopWidth  = CmsConfig.getConfigValue("SingleImage.PopupMinWidth", 200);
            int minPopHeight = CmsConfig.getConfigValue("SingleImage.PopupMinHeight", 200);

            string withLinkTemplate    = CmsConfig.getConfigValue("SingleImage.WithLinkTemplate", "<a href=\"{5}\"><img src=\"{2}\" width=\"{0}\" height=\"{1}\" /></a>");
            string withoutLinkTemplate = CmsConfig.getConfigValue("SingleImage.WithoutLinkTemplate", "<img src=\"{2}\" width=\"{0}\" height=\"{1}\" />");

            string showLargerPagePath = CmsConfig.getConfigValue("SingleImage.DisplayPath", "/_internal/showImage");

            NameValueCollection largerParams = new NameValueCollection();

            largerParams.Add("i", image.SingleImageId.ToString());
            string showLargerPageUrl = CmsContext.getUrlByPagePath(showLargerPagePath, largerParams);

            System.Drawing.Size imgLargeSize = showThumbPage.getDisplayWidthAndHeight(image.ImagePath, fullWidth, fullHeight);

            int popWidth  = imgLargeSize.Width + popupPaddingWidth;
            int popHeight = imgLargeSize.Height + popupPaddingHeight;

            if (popWidth < minPopWidth)
            {
                popWidth = minPopWidth;
            }
            if (popHeight < minPopHeight)
            {
                popHeight = minPopHeight;
            }

            if (popWidth > maxPopWidth)
            {
                popWidth = maxPopWidth;
            }
            if (popHeight > maxPopHeight)
            {
                popHeight = maxPopHeight;
            }


            // -- create the SingleImageDisplayInfo object
            SingleImageDisplayInfo displayInfo = new SingleImageDisplayInfo();

            displayInfo.ImagePath = image.ImagePath;

            displayInfo.FullImageDisplayBox  = new System.Drawing.Size(fullWidth, fullHeight);
            displayInfo.ThumbImageDisplayBox = new System.Drawing.Size(thumbWidth, thumbHeight);
            displayInfo.PopupDisplayBox      = new System.Drawing.Size(popWidth, popHeight);

            displayInfo.FullImageDisplayUrl = showLargerPageUrl;

            displayInfo.ThumbDisplayWithLinkTemplate    = withLinkTemplate;
            displayInfo.ThumbDisplayWithoutLinkTemplate = withoutLinkTemplate;

            displayInfo.Caption = image.Caption;
            displayInfo.Credits = image.Credits;

            // -- Multilingual CreditsPromptPrefix
            string creditPrefix = CmsConfig.getConfigValue("SingleImage.CreditsPromptPrefix", "");

            string[] creditPrefixParts = creditPrefix.Split(new char[] { CmsConfig.PerLanguageConfigSplitter }, StringSplitOptions.RemoveEmptyEntries);
            if (creditPrefixParts.Length >= CmsConfig.Languages.Length)
            {
                int index = CmsLanguage.IndexOf(langToRenderFor.shortCode, CmsConfig.Languages);
                if (index >= 0)
                {
                    creditPrefix = creditPrefixParts[index];
                }
            }

            // -- Multilingual ClickToEnlargeText
            string clickToEnlargeText = CmsConfig.getConfigValue("SingleImage.ClickToEnlargeText", "");

            string[] clickToEnlargeTextParts = clickToEnlargeText.Split(new char[] { CmsConfig.PerLanguageConfigSplitter }, StringSplitOptions.RemoveEmptyEntries);
            if (clickToEnlargeTextParts.Length >= CmsConfig.Languages.Length)
            {
                int index = CmsLanguage.IndexOf(langToRenderFor.shortCode, CmsConfig.Languages);
                if (index >= 0)
                {
                    clickToEnlargeText = clickToEnlargeTextParts[index];
                }
            }

            displayInfo.CreditsPromptPrefix = creditPrefix;
            displayInfo.ClickToEnlargeText  = clickToEnlargeText;

            string html = getStandardHtmlView(displayInfo);

            writer.WriteLine(html.ToString());
        } // RenderView
コード例 #33
0
        private string getAddEditContactForm(ContactPlaceholderData data, ContactData contactToEdit, CmsPage page, int identifier, CmsLanguage langToRenderFor)
        {
            string ControlId = "Contacts_" + page.ID.ToString() + "_" + identifier.ToString() + langToRenderFor.shortCode;
            bool   editing   = (contactToEdit.contactId > -1);

            // -- process form actions
            string action              = PageUtils.getFromForm(ControlId + "action", "");
            string _userErrorMessage   = "";
            string _userMessage        = "";
            bool   _showContactDetails = true;

            if (editing && String.Compare(action, "deleteContact", true) == 0)
            {
                bool b = ContactData.DeleteContact(contactToEdit);
                if (b)
                {
                    _userMessage        = "The contact \"" + getNameDisplayOutput(data, contactToEdit) + "\" has been deleted";
                    _showContactDetails = false;
                }
                else
                {
                    _userErrorMessage = "Error: could not delete contact. There was a database error";
                }
            }
            else if (String.Compare(action, "addNewContact", true) == 0)
            {
                if (!editing)
                {
                    contactToEdit = new ContactData();
                }

                contactToEdit.firstName        = PageUtils.getFromForm(ControlId + "firstName", contactToEdit.firstName);
                contactToEdit.lastName         = PageUtils.getFromForm(ControlId + "lastName", contactToEdit.lastName);
                contactToEdit.title            = PageUtils.getFromForm(ControlId + "title", contactToEdit.title);
                contactToEdit.organizationName = PageUtils.getFromForm(ControlId + "organizationName", contactToEdit.organizationName);
                contactToEdit.address1         = PageUtils.getFromForm(ControlId + "address1", contactToEdit.address1);
                contactToEdit.address2         = PageUtils.getFromForm(ControlId + "address2", contactToEdit.address2);
                contactToEdit.city             = PageUtils.getFromForm(ControlId + "city", contactToEdit.city);
                contactToEdit.provinceState    = PageUtils.getFromForm(ControlId + "provinceState", contactToEdit.provinceState);
                contactToEdit.postalZipCode    = PageUtils.getFromForm(ControlId + "postalZipCode", contactToEdit.postalZipCode);
                contactToEdit.phoneNumber1     = PageUtils.getFromForm(ControlId + "phoneNumber1", contactToEdit.phoneNumber1);
                contactToEdit.phoneNumber2     = PageUtils.getFromForm(ControlId + "phoneNumber2", contactToEdit.phoneNumber2);
                contactToEdit.faxNumber        = PageUtils.getFromForm(ControlId + "faxNumber", contactToEdit.faxNumber);
                contactToEdit.mobileNumber     = PageUtils.getFromForm(ControlId + "mobileNumber", contactToEdit.mobileNumber);
                contactToEdit.emailAddress     = PageUtils.getFromForm(ControlId + "emailAddress", contactToEdit.emailAddress);

                string[] s_catIds = PageUtils.getFromForm(ControlId + "category");
                int[]    catIds   = StringUtils.ToIntArray(s_catIds);
                contactToEdit.contactCategoryIds.Clear();
                contactToEdit.contactCategoryIds.AddRange(catIds);

                if (contactToEdit.firstName.Trim() == "")
                {
                    _userErrorMessage = "Please enter the contact's first name";
                }
                else if (contactToEdit.lastName.Trim() == "")
                {
                    _userErrorMessage = "Please enter the contact's last name";
                }
                else if (contactToEdit.contactCategoryIds.Count < 1)
                {
                    _userErrorMessage = "Please select at least one category for the contact";
                }
                else
                {
                    bool b = contactToEdit.SaveToDatabase();
                    if (!b)
                    {
                        _userErrorMessage = "There was a problem saving the contact to the database";
                    }
                    else
                    {
                        if (editing)
                        {
                            string nameDisplay = getNameDisplayOutput(data, contactToEdit);
                            _userMessage = "The changes to \"" + nameDisplay + "\" have been saved.";
                        }
                        else
                        {
                            string nameDisplay = getNameDisplayOutput(data, contactToEdit);
                            _userMessage  = "The contact \"" + nameDisplay + "\" has been added.";
                            contactToEdit = new ContactData(); // remove all previously submitted values
                            editing       = false;
                        }
                    }
                }
            } // if process

            StringBuilder html = new StringBuilder();

            if (editing)
            {
                string nameDisplay = getNameDisplayOutput(data, contactToEdit);
                html.Append("<h2>Edit contact \"" + nameDisplay + "\":</h2>");
            }
            else
            {
                html.Append("<h2>Add a new contact:</h2>");
            }

            if (_userErrorMessage != "")
            {
                html.Append("<p style=\"color: red\">Error: " + _userErrorMessage + "</p>");
            }
            if (_userMessage != "")
            {
                html.Append("<p style=\"color: green\">" + _userMessage + "</p>");
            }

            if (!_showContactDetails)
            {
                return(html.ToString());
            }

            string formId = "editContact";

            html.Append(page.getFormStartHtml(formId));
            html.Append("<table border=\"0\">");

            string dividerLineHtml = getDividerLineHtml(4);

            html.Append(dividerLineHtml);

            html.Append("<tr>");
            html.Append("<td>First Name:</td>");
            html.Append("<td>" + PageUtils.getInputTextHtml(ControlId + "firstName", ControlId + "firstName", contactToEdit.firstName, 20, 255) + "</td>");


            html.Append("<td>Last Name:</td>");
            html.Append("<td>" + PageUtils.getInputTextHtml(ControlId + "lastName", ControlId + "lastName", contactToEdit.lastName, 20, 255) + "</td>");
            html.Append("</tr>");

            html.Append(dividerLineHtml);

            string colspan = "3";

            html.Append("<td>Categories:</td>");
            ContactDataCategory[] allCategories = ContactDataCategory.getAllContactCategories();
            html.Append("<td colspan=\"" + colspan + "\">");
            int cbid = 0;

            foreach (ContactDataCategory cat in allCategories)
            {
                bool   check = (contactToEdit.contactCategoryIds.IndexOf(cat.CategoryId) > -1);
                string cb    = PageUtils.getCheckboxHtml(cat.Title, ControlId + "category", ControlId + "category" + cbid.ToString(), cat.CategoryId.ToString(), check);
                html.Append(cb + "<br />");
                cbid++;
            }  // foreach
            html.Append("</td>");

            html.Append(dividerLineHtml);

            html.Append("<tr>");
            html.Append("<td>Title:</td>");
            html.Append("<td colspan=\"" + colspan + "\">" + PageUtils.getInputTextHtml(ControlId + "title", ControlId + "title", contactToEdit.title, 40, 255) + "</td>");
            html.Append("</tr>");

            html.Append("<tr>");
            html.Append("<td>Organization:</td>");
            html.Append("<td colspan=\"" + colspan + "\">" + PageUtils.getInputTextHtml(ControlId + "organizationName", ControlId + "organizationName", contactToEdit.organizationName, 40, 255) + "</td>");
            html.Append("</tr>");

            html.Append(dividerLineHtml);

            html.Append("<tr>");
            html.Append("<td>Address 1:</td>");
            html.Append("<td colspan=\"" + colspan + "\">" + PageUtils.getInputTextHtml(ControlId + "address1", ControlId + "address1", contactToEdit.address1, 40, 255) + "</td>");
            html.Append("</tr>");

            html.Append("<tr>");
            html.Append("<td>Address 2:</td>");
            html.Append("<td colspan=\"" + colspan + "\">" + PageUtils.getInputTextHtml(ControlId + "address2", ControlId + "address2", contactToEdit.address2, 40, 255) + "</td>");
            html.Append("</tr>");

            html.Append("<tr>");
            html.Append("<td>City:</td>");
            html.Append("<td colspan=\"" + colspan + "\">" + PageUtils.getInputTextHtml(ControlId + "city", ControlId + "city", contactToEdit.city, 40, 255) + "</td>");
            html.Append("</tr>");

            html.Append("<tr>");
            html.Append("<td>Province/State:</td>");
            html.Append("<td colspan=\"" + colspan + "\">" + PageUtils.getInputTextHtml(ControlId + "provinceState", ControlId + "provinceState", contactToEdit.provinceState, 20, 255) + "</td>");
            html.Append("</tr>");

            html.Append("<tr>");
            html.Append("<td>Postal/Zip Code:</td>");
            html.Append("<td colspan=\"" + colspan + "\">" + PageUtils.getInputTextHtml(ControlId + "postalZipCode", ControlId + "postalZipCode", contactToEdit.postalZipCode, 10, 255) + "</td>");
            html.Append("</tr>");

            html.Append(dividerLineHtml);

            html.Append("<tr>");
            html.Append("<td>Phone Number 1:</td>");
            html.Append("<td colspan=\"" + colspan + "\">" + PageUtils.getInputTextHtml(ControlId + "phoneNumber1", ControlId + "phoneNumber1", contactToEdit.phoneNumber1, 20, 255) + "</td>");
            html.Append("</tr>");

            html.Append("<tr>");
            html.Append("<td>Phone Number 2:</td>");
            html.Append("<td colspan=\"" + colspan + "\">" + PageUtils.getInputTextHtml(ControlId + "phoneNumber2", ControlId + "phoneNumber2", contactToEdit.phoneNumber2, 20, 255) + "</td>");
            html.Append("</tr>");

            html.Append("<tr>");
            html.Append("<td>Fax Number:</td>");
            html.Append("<td colspan=\"" + colspan + "\">" + PageUtils.getInputTextHtml(ControlId + "faxNumber", ControlId + "faxNumber", contactToEdit.faxNumber, 20, 255) + "</td>");
            html.Append("</tr>");

            html.Append("<tr>");
            html.Append("<td>Mobile Number:</td>");
            html.Append("<td colspan=\"" + colspan + "\">" + PageUtils.getInputTextHtml(ControlId + "mobileNumber", ControlId + "mobileNumber", contactToEdit.mobileNumber, 20, 255) + "</td>");
            html.Append("</tr>");

            html.Append(dividerLineHtml);

            html.Append("<tr>");
            html.Append("<td>Email Address:</td>");
            html.Append("<td colspan=\"" + colspan + "\">" + PageUtils.getInputTextHtml(ControlId + "emailAddress", ControlId + "emailAddress", contactToEdit.emailAddress, 40, 255) + "</td>");
            html.Append("</tr>");

            html.Append("</table>");

            html.Append(PageUtils.getHiddenInputHtml(ControlId + "action", "addNewContact"));


            if (editing)
            {
                html.Append(PageUtils.getHiddenInputHtml(CurrentContactIdFormName, contactToEdit.contactId.ToString()));
                html.Append("<input type=\"submit\" value=\"save changes\">");
            }
            else
            {
                html.Append("<input type=\"submit\" value=\"add contact\">");
            }


            html.Append(page.getFormCloseHtml(formId));

            if (editing)
            {
                formId = formId + "_Delete";
                html.Append(page.getFormStartHtml(formId));
                html.Append("<p align=\"right\">Delete:");
                html.Append(PageUtils.getHiddenInputHtml(CurrentContactIdFormName, contactToEdit.contactId.ToString()));
                html.Append(PageUtils.getHiddenInputHtml(ControlId + "action", "deleteContact"));
                html.Append("<input type=\"submit\" value=\"delete contact\">");
                html.Append("</p>");
                html.Append(page.getFormCloseHtml(formId));
            }

            return(html.ToString());
        } // getAddEditContactForm
コード例 #34
0
 private string getEditFormName(CmsPage page, int identifier, CmsLanguage langToRenderFor)
 {
     return("editSingleImage_" + page.ID.ToString() + identifier.ToString() + langToRenderFor.shortCode);
 }
コード例 #35
0
        /// <summary>
        /// Recursive is T: see what CmsZone a page is.
        /// Recursive is F: select the exact zone record given a cms page (i.e. boundary page).
        /// </summary>
        /// <param name="page"></param>
        /// <param name="recursive"></param>
        /// <returns></returns>
        public CmsPageSecurityZone fetchByPage(CmsPage page, bool recursive)
        {
            PageSecurityZoneRepository repository = new PageSecurityZoneRepository();

            return(repository.fetchByPage(page, recursive));
        }
コード例 #36
0
        public override void RenderInEditMode(HtmlTextWriter writer, CmsPage page, int identifier, CmsLanguage langToRenderFor, string[] paramList)
        {
            string formName = getEditFormName(page, identifier, langToRenderFor);

            SingleImageDb   db    = (new SingleImageDb());
            SingleImageData image = db.getSingleImage(page, identifier, langToRenderFor, true);

            string[] possibleTags = (new SingleImageDb()).getAllPossibleTags();



            StringBuilder html = new StringBuilder();
            // ------- CHECK THE FORM FOR ACTIONS
            string action = Hatfield.Web.Portal.PageUtils.getFromForm(formName + "_SingleImageAction", "");

            if (action.Trim().ToLower() == "saveimage")
            {
                image.ImagePath = PageUtils.getFromForm(formName + "ImagePath", "");
                // remove the Application path from the file location
                if (image.ImagePath.StartsWith(CmsContext.ApplicationPath))
                {
                    image.ImagePath = image.ImagePath.Substring(CmsContext.ApplicationPath.Length);
                }


                image.Caption = PageUtils.getFromForm(formName + "Caption", "");
                image.Credits = PageUtils.getFromForm(formName + "Credits", "");

                image.Tags = PageUtils.getFromForm(formName + "Tags");

                bool b = db.saveUpdatedSingleImage(page, identifier, langToRenderFor, image);
                if (!b)
                {
                    html.Append("Error: Image not saved - database error");
                }
            }

            string creditsPrefix = CmsConfig.getConfigValue("SingleImage.CreditsPrefix", "Credit:");

            int thumbWidth  = getThumbDisplayWidth(page, paramList);
            int thumbHeight = getThumbDisplayHeight(page, paramList);

            // ------- START RENDERING

            // note: no need to put in the <form></form> tags.

            html.Append("<div class=\"SingleImagePlaceholder Edit\">" + Environment.NewLine);
            string ImageRenderAreaId = formName + "ImageRendered";

            html.Append("<div id=\"" + ImageRenderAreaId + "\"></div>");
            html.Append(PageUtils.getHiddenInputHtml(formName + "ImagePath", formName + "ImagePath", image.ImagePath));

            List <string> editParams = new List <string>();

            editParams.Add("i=" + image.SingleImageId);
            editParams.Add("formName=" + formName);
            editParams.Add("tw=" + thumbWidth.ToString());
            editParams.Add("th=" + thumbHeight.ToString());

            string editUrl                    = CmsContext.ApplicationPath + "_system/tools/SingleImage/SingleImageEditor.aspx?" + string.Join("&", editParams.ToArray());;
            string jsResetFunctionName        = formName + "Reset";
            string jsUpdateRenderFunctionName = formName + "UpdateDisplay";

            html.Append("<table>");
            html.Append("<tr>" + Environment.NewLine);
            html.Append("<td colspan=\"2\">");
            html.Append("<p>");
            html.Append("<a id=\"" + formName + "OpenEditorLink\" href=\"" + editUrl + "\" onclick=\"window.open(this.href, 'SingleImageEdit','width=680,height=540'); return false;\">select image</a>");
            html.Append(" | ");
            html.Append("<a href=\"#\" onclick=\"" + jsResetFunctionName + "(); return false;\">clear</a>");
            if (CmsConfig.Languages.Length > 1)
            {
                html.Append(" | ");
                html.Append("copy from language: ");
                List <string> langCopyLinks = new List <string>();
                foreach (CmsLanguage lang in CmsConfig.Languages)
                {
                    if (lang != langToRenderFor)
                    {
                        string langClick = "document.getElementById('" + formName + "ImagePath').value = document.getElementById('" + getEditFormName(page, identifier, lang) + "ImagePath').value;" + jsUpdateRenderFunctionName + "(); if (document.getElementById('" + formName + "ImagePath').value == '') {alert('No image is selected because the source image is blank.');} return false;";
                        langCopyLinks.Add("<a href=\"#\" onclick=\"" + langClick + "\">" + lang.shortCode + "</a>");
                    }
                } // foreach
                html.Append(string.Join("; ", langCopyLinks.ToArray()));
            }
            html.Append("</p>");
            html.Append("</td>");
            html.Append("</tr>" + Environment.NewLine);


            html.Append("<tr><td>");
            html.Append("Caption:");
            html.Append("</td><td class=\"CaptionInputTD\">");
            html.Append(PageUtils.getInputTextHtml(formName + "Caption", formName + "Caption", image.Caption.ToString(), 40, 250));
            html.Append("</td></tr>");


            html.Append("<tr><td>");
            html.Append(creditsPrefix);
            html.Append("</td><td class=\"CreditInputTD\">");
            html.Append(PageUtils.getInputTextHtml(formName + "Credits", formName + "Credits", image.Credits.ToString(), 40, 250));
            html.Append("</td></tr>" + Environment.NewLine);

            if (possibleTags.Length > 0)
            {
                html.Append("<tr><td>");
                html.Append("Tags:");
                html.Append("</td><td>");
                foreach (string t in possibleTags)
                {
                    if (t != "")
                    {
                        html.Append(PageUtils.getCheckboxHtml(t.Trim(), formName + "Tags", formName + "tag_" + t, t.Trim(), Array.IndexOf(image.Tags, t) > -1));
                        html.Append("<br />");
                    }
                } // foreach
                html.Append("</td></tr>");
            }

            html.Append("</table>");
            html.Append("</div>" + Environment.NewLine);
            // -- hidden field actions
            html.Append("<input type=\"hidden\" name=\"" + formName + "_SingleImageAction\" value=\"saveImage\">");

            // -- javascript

            StringBuilder js = new StringBuilder();

            js.Append("function " + jsResetFunctionName + "() " + Environment.NewLine);
            js.Append("{ " + Environment.NewLine);
            js.Append("document.getElementById('" + formName + "ImagePath').value = '';" + Environment.NewLine);
            js.Append("document.getElementById('" + ImageRenderAreaId + "').innerHTML = '<span style=\"margin: 10px; padding: 10px; background: #edff96; border: 1px solid #C00;\">no image is selected</span>';" + Environment.NewLine);
            js.Append("} " + Environment.NewLine);

            js.Append("function " + jsUpdateRenderFunctionName + "() " + Environment.NewLine);
            js.Append("{ " + Environment.NewLine);
            js.Append(" var ImagePath = document.getElementById('" + formName + "ImagePath').value;" + Environment.NewLine);
            js.Append(" if (ImagePath == '') { " + Environment.NewLine);
            js.Append("   document.getElementById('" + ImageRenderAreaId + "').innerHTML = '<span style=\"margin: 10px; padding: 10px; background: #edff96; border: 1px solid #C00;\">no image is selected</span>';" + Environment.NewLine);
            js.Append(" } // if " + Environment.NewLine);
            js.Append(" else { " + Environment.NewLine);
            js.Append("   document.getElementById('" + ImageRenderAreaId + "').innerHTML = '<img src=\"" + CmsContext.ApplicationPath + "_system/tools/showThumb.aspx?file='+ImagePath+'&w=" + thumbWidth + "&h=" + thumbHeight + "&nocache='+((new Date()).getTime())+'\">';" + Environment.NewLine);
            js.Append(" } // else " + Environment.NewLine);
            js.Append(" document.getElementById('" + formName + "OpenEditorLink').href = '" + editUrl + "&SelImagePath='+ImagePath;" + Environment.NewLine);
            js.Append("} " + Environment.NewLine + Environment.NewLine);

            // add javascript to head section
            page.HeadSection.AddJSStatements(js.ToString());
            page.HeadSection.AddJSOnReady(jsUpdateRenderFunctionName + "();");



            writer.WriteLine(html.ToString());
        }
コード例 #37
0
        protected void Page_Load(object sender, EventArgs e)
        {
            if (Request.QueryString["pageid"] != null)
            {
                PageID = Request.QueryString["pageid"];
            }
            CmsPage page = BaseObject.GetById <CmsPage>(new Guid(PageID));

            if (page == null)
            {
                throw new Exception("Geen pagina geladen met id: " + PageID);
            }

            //je kunt niet zien of een pagina in editmode zit, want zit in iframe
            //hierom kijken we of er een bitplateuser is ingelogd.
            //zo ja, dan wordt er geen check gedaan op site-autorisatie en of de pagina actief is.
            bool allowEdit = (SessionObject.CurrentBitplateUser != null);

            if (allowEdit)
            {
                if (!CheckBitplateAutorisation(page))
                {
                    throw new Exception("U heeft geen rechten om deze pagina te bewerken.");
                }
            }
            else
            {
                if (!CheckIfActive(page))
                {
                    throw new Exception("Deze pagina is momenteel niet actief.");
                }

                if (!CheckSiteAutorisation(page))
                {
                    throw new Exception("U heeft geen rechten op deze pagina.");
                }
            }

            if (Request.Form["hiddenIFramePost"] != null)
            {
                string          id             = Request.Form["hiddenModuleID"].ToString();
                BaseModule      module         = BaseObject.GetById <BaseModule>(new Guid(id));
                IPostableModule postableModule = module.ConvertToType() as IPostableModule;
                PostResult      postResult     = postableModule.HandlePost(page, CollectionsHelper.ConvertFormParametersToDictionary(Request.Form));
                Response.Clear();
                Response.Write(postResult.ToJsonString());
                Response.Flush();
                Response.End();
            }

            if (Request.QueryString.AllKeys.Contains("mailing") && Request.QueryString["mailing"] != "")
            {
                Guid mailingId = Guid.Empty;
                Guid.TryParse(Request.QueryString["mailing"], out mailingId);
                if (mailingId != Guid.Empty)
                {
                    RegisterMailingLink(mailingId, page);
                }
            }

            if (!IsPostBack)
            {
                //if (SessionObject.CurrentLicense != null && SessionObject.CurrentLicense.IsValid)
                //{
                string pageHtml = page.Publish2();
                Response.Write(pageHtml);
                //}
                //else
                //{
                //    Response.Write("<div style=\"width: 350px; padding-top: 150px; margin: auto; font-size: 24px; text-align: center;\">Uw bitplate licentie is ongeldig!!</div>");
                //}
            }
        }
コード例 #38
0
        public void HandlePage(CmsPage page)
        {
            var templateUrl = RequestModule.GetTemplateUrl(page.IsAvailable, page.PageId, page.PageTypeId);

            RequestModule.RedirectToTemplate(templateUrl);
        }
コード例 #39
0
 public override RevertToRevisionResult RevertToRevision(CmsPage oldPage, CmsPage currentPage, int[] identifiers, CmsLanguage language)
 {
     return(RevertToRevisionResult.NotImplemented); // this placeholder doesn't implement revisions
 }
コード例 #40
0
 private static void ShallowCopyProperties(CmsPage page, EditablePage editablePage) {
     var propertyItems = page.Property.Select(Mapper.Map<PropertyItem, PropertyItem>).ToList();
     var propertyCollection = new PropertyCollection { Properties = propertyItems };
     
     editablePage.Property = propertyCollection;
 }
コード例 #41
0
        public override void RenderInViewMode(HtmlTextWriter writer, CmsPage page, int identifier, CmsLanguage langToRenderFor, string[] paramList)
        {
            addHeaderEntry(page);

            JavascriptEvent[] dummy        = new JavascriptEvent[] { };
            JavascriptEvent[] jsEventArray = new JavascriptEvent[] { new JavascriptEvent(JavascriptEventName.onkeypress, "return numbersOnly(event);") };
            string            controlId    = "registerProject_" + page.ID + "_" + identifier + "_" + langToRenderFor.shortCode;
            string            msg          = handleFormSubmit(langToRenderFor, controlId);

            if (msg != "")
            {
                writer.Write(msg);
                return;
            }

            StringBuilder sb = new StringBuilder(msg + EOL);

            sb.Append("<form class=\"registerProjectform\" method=\"get\">" + EOL);

//            string rpLangSubmitted = "registerProject_Lang";
//            sb.Append(PageUtils.getHiddenInputHtml(rpLangSubmitted, rpLangSubmitted, "") + EOL);

            string rpFormAction = "registerProject_FormAction";

            sb.Append(PageUtils.getHiddenInputHtml(rpFormAction, rpFormAction, "add") + EOL);

            string rpName = controlId + "_Name";

            sb.Append("<label>" + EOL);
            sb.Append(getNameText(langToRenderFor) + " *" + EOL);
            sb.Append("</label>" + EOL);
            sb.Append(PageUtils.getInputTextHtml(rpName, rpName, "", 40, 60, "mandatoryField", dummy) + EOL);

            string rpLocation = controlId + "_Location";

            sb.Append("<label>" + EOL);
            sb.Append(getLocationText(langToRenderFor) + " *" + EOL);
            sb.Append("</label>" + EOL);
            sb.Append(PageUtils.getInputTextHtml(rpLocation, rpLocation, "", 40, 60, "mandatoryField", dummy) + EOL);

            string rpDescription = controlId + "_Description";

            sb.Append("<label>" + EOL);
            sb.Append(getDescriptionText(langToRenderFor) + " *" + EOL);
            sb.Append("</label>" + EOL);
            sb.Append(PageUtils.getTextAreaHtml(rpDescription, rpDescription, "", 60, 6, "mandatoryField") + EOL);

            string rpContactPerson = controlId + "_ContactPerson";

            sb.Append("<label>" + EOL);
            sb.Append(getContactPersonText(langToRenderFor) + " *" + EOL);
            sb.Append("</label>" + EOL);
            sb.Append(PageUtils.getInputTextHtml(rpContactPerson, rpContactPerson, "", 40, 60, "mandatoryField", dummy) + EOL);

            string rpEmail = controlId + "_Email";

            sb.Append("<label>" + EOL);
            sb.Append(getEmailText(langToRenderFor) + " *" + EOL);
            sb.Append("</label>" + EOL);
            sb.Append(PageUtils.getInputTextHtml(rpEmail, rpEmail, "", 40, 60, "mandatoryField", dummy) + EOL);

            string rpTelephone1 = controlId + "_TelephoneArea";
            string rpTelephone2 = controlId + "_TelephoneNum";
            string rpTelephone3 = controlId + "_TelephoneExt";

            sb.Append("<label>" + EOL);
            sb.Append(getTelephoneText(langToRenderFor) + EOL);
            sb.Append("</label>" + EOL);
            sb.Append(PageUtils.getInputTextHtml(rpTelephone1, rpTelephone1, "", 4, 5, "", jsEventArray) + EOL);
            sb.Append(PageUtils.getInputTextHtml(rpTelephone2, rpTelephone2, "", 15, 15, "", jsEventArray) + EOL);
            sb.Append(PageUtils.getInputTextHtml(rpTelephone3, rpTelephone3, "", 4, 5, "", jsEventArray) + EOL);

            string rpCellphone1 = controlId + "_CellphoneArea";
            string rpCellphone2 = controlId + "_cellphoneNum";

            sb.Append("<label>" + EOL);
            sb.Append(getCellphoneText(langToRenderFor) + EOL);
            sb.Append("</label>" + EOL);
            sb.Append(PageUtils.getInputTextHtml(rpCellphone1, rpCellphone1, "", 4, 5, "", jsEventArray) + EOL);
            sb.Append(PageUtils.getInputTextHtml(rpCellphone2, rpCellphone2, "", 15, 15, "", jsEventArray) + EOL);

            string rpWebsite = controlId + "_Website";

            sb.Append("<label>" + EOL);
            sb.Append(getWebsiteText(langToRenderFor) + EOL);
            sb.Append("</label>" + EOL);
            sb.Append(PageUtils.getInputTextHtml(rpWebsite, rpWebsite, "", 40, 60) + EOL);

            string rpFundingSource = controlId + "_FundingSource";

            sb.Append("<label>" + EOL);
            sb.Append(getFundingSourceText(langToRenderFor) + EOL);
            sb.Append("</label>" + EOL);
            sb.Append(PageUtils.getInputTextHtml(rpFundingSource, rpFundingSource, "", 40, 60) + EOL);

            sb.Append("<p>" + EOL);
//            sb.Append("<input onclick=\"document.getElementById('" + rpLangSubmitted + "').value='" + langToRenderFor.shortCode + "';\" value=\"" + getSubmitButtonText(langToRenderFor) + "\" type=\"submit\" />" + EOL);
            sb.Append("<input value=\"" + getSubmitButtonText(langToRenderFor) + "\" type=\"submit\" />" + EOL);
            sb.Append("</p>" + EOL);

            sb.Append("<p>* " + getRequiredText(langToRenderFor) + "</p>" + EOL);

            sb.Append("</form>" + EOL);

            writer.Write(sb.ToString());
        }
コード例 #42
0
ファイル: PageData.cs プロジェクト: MasroorKhalid/AtomicCms
 public void Save(CmsPage page)
 {
     base.Save(page);
 }
コード例 #43
0
 public override RevertToRevisionResult RevertToRevision(CmsPage oldPage, CmsPage currentPage, int[] identifiers, CmsLanguage language)
 {
     return(RevertToRevisionResult.NotImplemented);
 }
コード例 #44
0
        internal static EditablePage CreateEditablePage(CmsPage page) {
            var editablePage = Mapper.Map<CmsPage, EditablePage>(page);
            ShallowCopyProperties(page, editablePage);

            return editablePage;
        }
コード例 #45
0
 public static DataStore GetStore(CmsPage page)
 {
     return((DataStore)Activator.CreateInstance(DataStoreType, page));
 }
コード例 #46
0
 public static void RedirectToController(CmsPage page, string actionName = "index", Dictionary<string, object> additionalRouteData = null) {
     RequestModule.RedirectToController(page, actionName, additionalRouteData);
 }
コード例 #47
0
 public PageSearchResults(CmsLanguage lang, CmsPage page)
 {
     Language = lang;
     Page     = page;
 }
コード例 #48
0
 public void HandlePage(PageIndexItem page) {
     var cmsPage = new CmsPage(page, Language.CurrentLanguageId);
     RequestModule.RedirectToController(cmsPage);
 }
コード例 #49
0
 public void PreviewPage(CmsPage page) {
     var templateUrl = RequestModule.GetTemplateUrl(true, page.PageId, page.PageTypeId);
     RequestModule.RedirectToTemplate(templateUrl);
 }
コード例 #50
0
 public static MvcHtmlString PageLink(this HtmlHelper helper, CmsPage page, object htmlAttributes)
 {
     return PageLink(helper, null, page, htmlAttributes);
 }
コード例 #51
0
        public string getSummaryDisplayFilterForm(ContactPlaceholderData data, ContactData[] contacts, CmsPage page, int identifier)
        {
            if (!data.allowFilterByCategory && !data.allowFilterByCompany)
            {
                return("");
            }

            string ControlId = "Contacts_" + page.ID.ToString() + "_" + identifier.ToString();

            string[] allOrganizations           = ContactData.getAllOrganizationNames(contacts);
            ContactDataCategory[] allCategories = ContactDataCategory.getAllContactCategories();
            if (allOrganizations.Length < 1 && allCategories.Length < 1)
            {
                return("");
            }

            StringBuilder html = new StringBuilder();
            int           cbid = 0;

            html.Append("<div class=\"ContactsFilterForm\">");
            string formId = ControlId + "filterContacts";

            html.Append(page.getFormStartHtml(formId));

            html.Append("<strong>Filter contacts</strong><br />");
            if (data.allowFilterByCategory)
            {
                if (allCategories.Length > 1)
                {
                    html.Append(" <em> by category:</em><br />");

                    int[] catsChecked = getCategoryIdsToDisplay(data);

                    foreach (ContactDataCategory cat in allCategories)
                    {
                        bool   check      = (catsChecked.Length == 0 || (Array.IndexOf(catsChecked, cat.CategoryId) > -1));
                        string displayUrl = getContactSummaryDisplayUrl(page, new int[] { cat.CategoryId }, new string[0]);
                        string display    = cat.Title;
                        // string link = " <a title=\"view only contacts in '" + cat.Title + "'\" href=\"" + displayUrl + "\">(view)</a>";
                        string cb = PageUtils.getCheckboxHtml(display, "contactCat", ControlId + "category" + cbid.ToString(), cat.CategoryId.ToString(), check);
                        html.Append(cb + "<br />");
                        cbid++;
                    } // foreach
                }
            }

            if (data.allowFilterByCompany)
            {
                if (allOrganizations.Length > 1)
                {
                    html.Append(" <em> by organization:</em><br />");

                    string[] orgsChecked = getOrgNamesToDisplay();

                    foreach (string org in allOrganizations)
                    {
                        bool   check      = (orgsChecked.Length == 0 || (Array.IndexOf(orgsChecked, org) > -1));
                        string displayUrl = getContactSummaryDisplayUrl(page, new int[0], new string[] { org });
                        string display    = org;
                        // string link = " <a title=\"view only contacts belonging to '" + org + "'\" href=\"" + displayUrl + "\">(view)</a>";

                        string cb = PageUtils.getCheckboxHtml(display, "contactOrg", ControlId + "orgName" + cbid.ToString(), org, check);
                        html.Append(cb + "<br />");
                        cbid++;
                    } // foreach
                }
            }
            if (cbid > 0)
            {
                html.Append("<input type=\"submit\" value=\"filter\">");

                string checkAllFnName  = ControlId + "Check";
                string checkNoneFnName = ControlId + "CheckNone";

                StringBuilder js = new StringBuilder();
                js.Append("function " + checkAllFnName + "() {" + Environment.NewLine);
                js.Append(" $('#" + formId + " input[type=checkbox]:not(:checked)' ).attr('checked', true);" + Environment.NewLine);
                js.Append("} " + Environment.NewLine);

                js.Append("function " + checkNoneFnName + "() {" + Environment.NewLine);
                js.Append(" $('#" + formId + " input[type=checkbox]:checked' ).attr('checked', false);" + Environment.NewLine);
                js.Append("} " + Environment.NewLine);

                page.HeadSection.AddJSStatements(js.ToString());
                page.HeadSection.AddJavascriptFile(JavascriptGroup.Library, "js/_system/jquery/jquery-1.4.1.min.js");

                html.Append("<br>Check: <a href=\"#\" onclick=\"" + checkAllFnName + "(); return false;\">all</a> | <a href=\"#\" onclick=\"" + checkNoneFnName + "(); return false;\">none</a>");
            }
            html.Append(page.getFormCloseHtml(formId));
            html.Append("</div>");
            return(html.ToString());
        }
コード例 #52
0
 public static string PageUrl(this UrlHelper helper, CmsPage page)
 {
     var context = helper.RequestContext.HttpContext;
     return Utils.GetBaseUrl(context.Request.ApplicationPath, context.Request.Url, false) +
            helper.Action("Content", "Home", new {area = "", id = page.Id, name = page.Alias});
 }
コード例 #53
0
        public void PreviewPage(CmsPage page)
        {
            var templateUrl = RequestModule.GetTemplateUrl(true, page.PageId, page.PageTypeId);

            RequestModule.RedirectToTemplate(templateUrl);
        }
コード例 #54
0
 public void HandlePage(CmsPage page) {
     RequestModule.RedirectToController(page);
 }
コード例 #55
0
        internal static EditablePage CreateEditableChildPage(CmsPage page, int pageTypeId) {
            var pageType = PageType.GetPageType(pageTypeId);

            if (pageType == null) {
                var exception = new Exception(string.Format("Pagetype with id '{0}' not found!", pageTypeId));
                Logger.Write(exception, Logger.Severity.Critical);
                throw exception;
            }

            var editablePage = new EditablePage {
                PageId = Guid.NewGuid(),
                PageTypeId = pageTypeId,
                ParentId = page.PageId,
                LanguageId = page.LanguageId,
                CurrentVersion = 1,
                ChildSortDirection = pageType.DefaultChildSortDirection,
                ChildSortOrder = pageType.DefaultChildSortOrder
            };

            if (page.PageId == SiteSettings.RootPage) {
                editablePage.RootId = editablePage.PageId;
                editablePage.TreeLevel = 0;
            }
            else {
                editablePage.RootId = page.RootId;
                editablePage.TreeLevel = page.TreeLevel + 1;
            }

            return editablePage;
        }
コード例 #56
0
 public static bool isContactsPage(CmsPage page)
 {
     return(StringUtils.IndexOf(page.getAllPlaceholderNames(), "Contacts", StringComparison.CurrentCultureIgnoreCase) > -1);
 }
コード例 #57
0
 private CmsPage GetCurrentPage() {
     return (_currentPage = ((PageTemplate) Page).CurrentPage);
 }
コード例 #58
0
        public override void RenderInEditMode(HtmlTextWriter writer, CmsPage page, int identifier, CmsLanguage langToRenderFor, string[] paramList)
        {
            string ControlId = "Contacts_" + page.ID.ToString() + "_" + identifier.ToString() + langToRenderFor.shortCode;

            ContactsDb             db   = new ContactsDb();
            ContactPlaceholderData data = new ContactPlaceholderData();

            data = db.getContactPlaceholderData(page, identifier, true);

            string action = PageUtils.getFromForm(ControlId + "_action", "");

            if (String.Compare(action, "saveNewValues", true) == 0)
            {
                data.numColumnsToShow        = PageUtils.getFromForm(ControlId + "numColumnsToShow", data.numColumnsToShow);
                data.forceFilterToCategoryId = PageUtils.getFromForm(ControlId + "forceFilterToCategoryId", data.forceFilterToCategoryId);
                data.nameDisplayMode         = (ContactPlaceholderData.ContactNameDisplayMode)PageUtils.getFromForm(ControlId + "nameDisplayMode", typeof(ContactPlaceholderData.ContactNameDisplayMode), data.nameDisplayMode);

                data.allowFilterByCategory = PageUtils.getFromForm(ControlId + "allowFilterByCategory", false);
                data.allowFilterByCompany  = PageUtils.getFromForm(ControlId + "allowFilterByCompany", false);

                data.accessLevelToAddContacts  = (BaseCmsPlaceholder.AccessLevel)PageUtils.getFromForm(ControlId + "accessLevelToAddContacts", typeof(BaseCmsPlaceholder.AccessLevel), data.accessLevelToAddContacts);
                data.accessLevelToEditContacts = (BaseCmsPlaceholder.AccessLevel)PageUtils.getFromForm(ControlId + "accessLevelToEditContacts", typeof(BaseCmsPlaceholder.AccessLevel), data.accessLevelToEditContacts);
                db.saveUpdatedContactPlaceholderData(page, identifier, data);
            }


            StringBuilder html = new StringBuilder();

            html.Append("Contacts Display Configuration:");


            html.Append("<table>");

            html.Append("<tr>");
            html.Append("<td>Force Category filter to display: </td>");
            html.Append("<td>");
            ContactDataCategory[] allCats = ContactDataCategory.getAllContactCategories();
            NameValueCollection   options = new NameValueCollection();

            options.Add("-1", "do not force category to filter");
            foreach (ContactDataCategory cat in allCats)
            {
                options.Add(cat.CategoryId.ToString(), cat.Title);
            } // foreach
            html.Append(PageUtils.getDropDownHtml(ControlId + "forceFilterToCategoryId", ControlId + "forceFilterToCategoryId", options, data.forceFilterToCategoryId.ToString()));
            html.Append("</td>");
            html.Append("</tr>");

            html.Append("<tr>");
            html.Append("<td>Allow filter by: </td>");
            html.Append("<td>");
            html.Append(PageUtils.getCheckboxHtml("Category", ControlId + "allowFilterByCategory", ControlId + "allowFilterByCategory", true.ToString(), data.allowFilterByCompany));
            html.Append("<br>");
            html.Append(PageUtils.getCheckboxHtml("Company Name", ControlId + "allowFilterByCompany", ControlId + "allowFilterByCompany", true.ToString(), data.allowFilterByCompany));
            html.Append("</td>");
            html.Append("</tr>");


            html.Append("<tr>");
            html.Append("<td>Number of columns: </td>");
            html.Append("<td>");
            html.Append(PageUtils.getInputTextHtml(ControlId + "numColumnsToShow", ControlId + "numColumnsToShow", data.numColumnsToShow.ToString(), 3, 5));
            html.Append("</td>");
            html.Append("</tr>");

            html.Append("<tr>");
            html.Append("<td>Name display format: </td>");
            html.Append("<td>");
            html.Append(PageUtils.getDropDownHtml(ControlId + "nameDisplayMode", ControlId + "nameDisplayMode", Enum.GetNames(typeof(ContactPlaceholderData.ContactNameDisplayMode)), Enum.GetName(typeof(ContactPlaceholderData.ContactNameDisplayMode), data.nameDisplayMode)));
            html.Append("</td>");
            html.Append("</tr>");

            // -- deprecated items
            PageUtils.getHiddenInputHtml(ControlId + "accessLevelToAddContacts", Enum.GetName(typeof(BaseCmsPlaceholder.AccessLevel), BaseCmsPlaceholder.AccessLevel.CmsAuthor));
            PageUtils.getHiddenInputHtml(ControlId + "accessLevelToEditContacts", Enum.GetName(typeof(BaseCmsPlaceholder.AccessLevel), BaseCmsPlaceholder.AccessLevel.CmsAuthor));

            html.Append("</table>");

            html.Append(PageUtils.getHiddenInputHtml(ControlId + "_action", "saveNewValues"));

            writer.Write(html.ToString());
        } // RenderEditSummary
コード例 #59
0
        protected void RegisterPartials()
        {
            Handle.GET("/content/partials/cms", () => {
                CmsPage page = new CmsPage();

                page.RefreshData();

                return page;
            });

            Handle.GET("/content/partials/cms/item/{?}", (string key) => {
                CmsItemPage page = new CmsItemPage();

                page.Item.Data = DbHelper.FromID(DbHelper.Base64DecodeObjectID(key)) as WebContent;

                return page;
            });

            Handle.GET("/content/partials/deny", () => {
                return new Page() {
                    Html = "/Content/viewmodels/DenyPage.html"
                };
            });
        }
コード例 #60
0
        } // RenderViewSummary

        private string getSummaryDisplay(ContactPlaceholderData data, ContactData[] contacts, CmsLanguage langToRenderFor, CmsPage page)
        {
            StringBuilder html = new StringBuilder();

            if (contacts.Length < 1)
            {
                html.Append("<p><em>there are no contacts to display</em></p>");
            }
            else
            {
                html.Append("<table class=\"ContactsSummaryList\"><tr>");

                int numContactsPerCol = Convert.ToInt32(Math.Ceiling((double)contacts.Length / (double)data.numColumnsToShow));
                if (numContactsPerCol == 1 && (contacts.Length > data.numColumnsToShow))
                {
                    numContactsPerCol++;
                }
                if (numContactsPerCol < 1)
                {
                    numContactsPerCol = contacts.Length;
                }

                bool internalTableStarted = false;
                for (int contactCount = 0; contactCount < contacts.Length; contactCount++)
                {
                    if ((contactCount % numContactsPerCol) == 0)
                    {
                        if (internalTableStarted)
                        {
                            html.Append("</table></td>");
                        }
                        html.Append("<td valign=\"top\"><table>");
                        internalTableStarted = true;
                    }

                    ContactData contact    = contacts[contactCount];
                    string      detailsUrl = getContactDetailsDisplayUrl(contact, page);
                    html.Append("<tr><td class=\"ContactInformationDisplay\">");
                    html.Append("<strong><a href=\"" + detailsUrl + "\">" + getNameDisplayOutput(data, contact) + "</a></strong>");
                    string details = getContactDetailsSummaryDisplay(contact);
                    if (details != "")
                    {
                        html.Append("<br />" + details);
                    }
                    html.Append("</td></tr>");
                } // foreach
                if (internalTableStarted)
                {
                    html.Append("</table></td>");
                }

                html.Append("</tr></table>");
            }

            return(html.ToString());
        }