Ejemplo n.º 1
0
 public static ResponseCollection Comment(
     this ResponseCollection res,
     Context context,
     SiteSettings ss,
     Column column,
     Comments comments,
     int deleteCommentId)
 {
     comments
     .Where(o => context.Forms.Exists("Comment" + o.CommentId))
     .ForEach(comment =>
              res.ReplaceAll(
                  Selector(comment.CommentId),
                  new HtmlBuilder().Comment(
                      context: context,
                      ss: ss,
                      column: column,
                      comment: comment,
                      readOnly: false)));
     if (deleteCommentId != 0)
     {
         res
         .Remove(Selector(deleteCommentId))
         .Focus("#Comments");
     }
     return(res);
 }
Ejemplo n.º 2
0
        private static ResponseCollection ViewFilters(
            this ResponseCollection res, Context context, SiteSettings ss, View view)
        {
            switch (context.Forms.ControlId())
            {
            case "ViewSelector":
            case "ReduceViewFilters":
            case "ExpandViewFilters":
                return(res.ReplaceAll("#ViewFilters", new HtmlBuilder()
                                      .ViewFilters(context: context, ss: ss, view: view))
                       .ReplaceAll("#ShowHistoryField",
                                   new HtmlBuilder().FieldCheckBox(
                                       fieldId: "ShowHistoryField",
                                       fieldCss: "field-auto-thin",
                                       controlId: "ViewFilters_ShowHistory",
                                       controlCss: " auto-postback",
                                       method: "post",
                                       _checked: view.ShowHistory == true,
                                       labelText: Displays.ShowHistory(context: context),
                                       _using: ss.HistoryOnGrid == true)));

            default:
                return(res);
            }
        }
Ejemplo n.º 3
0
 public static ResponseCollection View(
     this ResponseCollection res, Context context, SiteSettings ss, View view)
 {
     return(res
            .ViewFilters(context: context, ss: ss, view: view)
            .ClearFormData("View", "startsWith"));
 }
Ejemplo n.º 4
0
 public static ResponseCollection ViewMode(
     this ResponseCollection res,
     SiteSettings ss,
     View view,
     GridData gridData,
     string invoke       = null,
     Message message     = null,
     bool loadScroll     = false,
     bool bodyOnly       = false,
     string bodySelector = null,
     HtmlBuilder body    = null)
 {
     return(res
            .Html(!bodyOnly ? "#ViewModeContainer" : bodySelector, body)
            .View(ss: ss, view: view)
            .ReplaceAll("#Breadcrumb", new HtmlBuilder()
                        .Breadcrumb(ss: ss))
            .ReplaceAll("#CopyDirectUrlToClipboard", new HtmlBuilder()
                        .CopyDirectUrlToClipboard(ss: ss))
            .ReplaceAll("#Aggregations", new HtmlBuilder()
                        .Aggregations(
                            ss: ss,
                            aggregations: gridData.Aggregations))
            .ReplaceAll("#MainCommandsContainer", new HtmlBuilder()
                        .MainCommands(
                            ss: ss,
                            siteId: ss.SiteId,
                            verType: Versions.VerTypes.Latest))
            .Invoke(invoke)
            .Message(message)
            .LoadScroll(loadScroll)
            .ClearFormData());
 }
 private static ResponseCollection ClearFormData(
     this ResponseCollection res,
     Context context,
     SiteSettings ss,
     bool editOnGrid)
 {
     if (editOnGrid)
     {
         new FormDataSet(
             context: context,
             ss: ss)
         .Where(o => o.Suffix.IsNullOrEmpty())
         .ForEach(formData =>
                  formData.Data.Keys.ForEach(controlId =>
                                             res.ClearFormData(
                                                 controlId,
                                                 type: ss.SaveViewType == SiteSettings.SaveViewTypes.None
                                 ? "ignoreView"
                                 : null)));
     }
     else
     {
         res.ClearFormData(
             type: ss.SaveViewType == SiteSettings.SaveViewTypes.None
                 ? "ignoreView"
                 : null);
     }
     return(res);
 }
Ejemplo n.º 6
0
 public static ResponseCollection Comment(
     this ResponseCollection res,
     SiteSettings ss,
     Column column,
     Comments comments,
     int deleteCommentId)
 {
     comments
     .Where(o => Forms.Exists("Comment" + o.CommentId))
     .ForEach(comment =>
              res.ReplaceAll(
                  Selector(comment.CommentId),
                  new HtmlBuilder().Comment(
                      ss: ss,
                      column: column,
                      comment: comment,
                      verType: Versions.VerTypes.Latest)));
     if (deleteCommentId != 0)
     {
         res
         .Remove(Selector(deleteCommentId))
         .Focus("#Comments");
     }
     return(res);
 }
Ejemplo n.º 7
0
 public static ResponseCollection RemoveComment(
     this ResponseCollection res, int commentId, bool _using)
 {
     return(_using
         ? res
            .Remove("#Comment" + commentId)
            .Focus("#Comments")
         : res);
 }
Ejemplo n.º 8
0
 public static ResponseCollection ViewMode(
     this ResponseCollection res,
     Context context,
     SiteSettings ss,
     View view,
     string invoke       = null,
     Message message     = null,
     bool editOnGrid     = false,
     bool loadScroll     = false,
     bool bodyOnly       = false,
     string bodySelector = null,
     ServerScriptModelRow serverScriptModelRow = null,
     HtmlBuilder body = null)
 {
     return(res
            .Html(!bodyOnly ? "#ViewModeContainer" : bodySelector, body)
            .View(context: context, ss: ss, view: view)
            .Invoke("initRelatingColumnWhenViewChanged")
            .ReplaceAll(
                "#Breadcrumb",
                new HtmlBuilder().Breadcrumb(
                    context: context,
                    ss: ss),
                _using: context.Controller == "items")
            .ReplaceAll("#Guide", new HtmlBuilder()
                        .Guide(
                            context: context,
                            ss: ss))
            .ReplaceAll("#CopyDirectUrlToClipboard", new HtmlBuilder()
                        .CopyDirectUrlToClipboard(
                            context: context,
                            view: view))
            .ReplaceAll("#Aggregations", new HtmlBuilder()
                        .Aggregations(
                            context: context,
                            ss: ss,
                            view: view))
            .ReplaceAll("#MainCommandsContainer", new HtmlBuilder()
                        .MainCommands(
                            context: context,
                            ss: ss,
                            view: view,
                            verType: Versions.VerTypes.Latest,
                            backButton: !context.Publish && !editOnGrid,
                            serverScriptModelRow: serverScriptModelRow))
            .SetMemory("formChanged", false, _using: !editOnGrid)
            .Invoke(invoke)
            .Message(message)
            .Messages(context.Messages)
            .LoadScroll(loadScroll)
            .ClearFormData(
                context: context,
                ss: ss,
                editOnGrid: editOnGrid)
            .Log(context.GetLog()));
 }
 public static ResponseCollection View(
     this ResponseCollection res, Context context, SiteSettings ss, View view)
 {
     return(res
            .ViewFilters(
                context: context,
                ss: ss,
                view: view)
            .ClearFormData(
                target: "View",
                type: "startsWith",
                _using: ss.SaveViewType != SiteSettings.SaveViewTypes.None));
 }
Ejemplo n.º 10
0
 public static ResponseCollection PrependComment(
     this ResponseCollection res,
     Comments comments,
     Versions.VerTypes verType)
 {
     return(Forms.Data("Comments").Trim() != string.Empty
         ? res
            .Val("#Comments", string.Empty)
            .Focus("#Comments")
            .Prepend("#CommentList", new HtmlBuilder()
                     .Comment(comment: comments[0], verType: verType))
         : res);
 }
Ejemplo n.º 11
0
        private static ResponseCollection ViewFilters(
            this ResponseCollection res, Context context, SiteSettings ss, View view)
        {
            switch (context.Forms.ControlId())
            {
            case "ViewSelector":
            case "ReduceViewFilters":
            case "ExpandViewFilters":
                return(res.ReplaceAll("#ViewFilters", new HtmlBuilder()
                                      .ViewFilters(context: context, ss: ss, view: view)));

            default:
                return(res);
            }
        }
Ejemplo n.º 12
0
 public static ResponseCollection PrependComment(
     this ResponseCollection res,
     SiteSettings ss,
     Column column,
     Comments comments,
     Versions.VerTypes verType)
 {
     return(Forms.Data("Comments").Trim() != string.Empty
         ? res
            .Val("#Comments", string.Empty)
            .Focus("#Comments")
            .Prepend("#CommentList", new HtmlBuilder()
                     .Comment(
                         ss: ss,
                         column: column,
                         comment: comments[0],
                         readOnly: false))
         : res);
 }