コード例 #1
0
ファイル: FilterPanel.cs プロジェクト: Alinian/Serenity
        private void RowOperatorChange(jQueryObject row)
        {
            if (row.Length == 0)
            {
                return;
            }

            jQueryObject editorDiv = row.Children("div.v");

            editorDiv.Html("");

            IFiltering filtering = GetFilteringFor(row);

            if (filtering == null)
            {
                return;
            }

            var operatorSelect = row.Children("div.o").Find("input.op-select").GetWidget <OperatorSelect>();

            if (operatorSelect.Value.IsEmptyOrNull())
            {
                return;
            }

            var op = filtering.GetOperators().FirstOrDefault(x => x.Key == operatorSelect.Value);

            if (op == null)
            {
                return;
            }

            filtering.Operator = op;
            filtering.CreateEditor();
        }
コード例 #2
0
        private void RowOperatorChange(jQueryObject row)
        {
            if (row.Length == 0)
            {
                return;
            }

            jQueryObject editorDiv = row.Children("div.v");

            editorDiv.Html("");

            IFilterHandler handler = GetFilterHandlerFor(row);

            if (handler == null)
            {
                return;
            }

            string op = row.Children("div.o").Children("select").GetValue();

            if (op == null || op == "")
            {
                return;
            }

            handler.CreateEditor(op);
        }
コード例 #3
0
        public static void AddFooter(WidgetObject menu, int recordCount)
        {
            jQueryObject footer = menu.Next();

            if (footer.Length == 0 || !footer.HasClass("sparkle-menu-footer"))
            {
                footer = jQuery.FromHtml("<div class='sparkle-menu-footer ui-front'></div>");
                menu.Parent().Append(footer);
            }

            if (footer != null)
            {
                footer.Html("");
                jQueryObject footerContent = jQuery.FromHtml("<span class='sparkle-menu-footer-content'></span>");
                jQueryObject footerLeft    = jQuery.FromHtml("<span class='sparkle-menu-footer-left'></span>");
                jQueryObject footerRight   = jQuery.FromHtml("<span class='sparkle-menu-footer-right'></span>");
                footerContent.Append(footerLeft);
                footerContent.Append(footerRight);
                footerLeft.Append(String.Format(SparkleResourceStrings.LookupFooter, recordCount));
                footer.Append(footerContent);
            }

            jQueryPosition pos    = menu.Position();
            int            height = menu.GetHeight();
            int            width  = menu.GetWidth();

            if (footer != null && footer.Length > 0)
            {
                footer.Show();
                footer.CSS("top", (pos.Top + height + 4).ToString() + "px");
                footer.CSS("left", (pos.Left).ToString() + "px");
                footer.Width(width);
            }
        }
コード例 #4
0
        /// <summary>
        /// Updats the HTML element with new HTML
        /// Also, loads the new JS object (module) to handle the behavior
        /// </summary>
        /// <param name="content">The element to be updated</param>
        /// <param name="value">The HTML with which to update it</param>
        private static void UpdateModule(jQueryObject content, string value)
        {
            Module module = null;

            // Find elements which have data-type attribute with any value
            // The attribute is applied to elements that can be updated
            jQueryObject dataTypes = content.Children("*[data-type]");

            // If updatable elements exist,
            if (dataTypes.Length > 0)
            {
                // Get the first element found
                Element element = dataTypes.First().GetElement(0);

                // Find the corresponding module
                module = Module.GetModule(element);

                // Now we have the module which should be unloaded and then updated
            }

            // Fade the element out and update with the new HTML
            content.FadeOut(250, delegate()
            {
                // Unload the module
                // BUGBUG: when can this be NULL
                if (null != module)
                {
                    module.Unload();
                }

                // Update the content
                content.Html(value);

                content.FadeIn(250);

                // Check if it has any child modules to be loaded
                dataTypes = content.Children("*[data-type]");

                if (dataTypes.Length > 0)
                {
                    // Load only the first
                    LoadModule(dataTypes.First().GetElement(0));

                    // BUGBUG: do we care about the rest?
                }
            });
        }
コード例 #5
0
        private void PopulateFileSymbols(jQueryObject fileElement, UploadedFile file, bool displayOriginalName)
        {
            fileElement.Html("");

            if (file == null || file.Filename.IsEmptyOrNull())
            {
                return;
            }

            var li = jQuery.FromHtml("<li/>");

            var isImage = UploadHelper.HasImageExtension(file.Filename);

            var thumb = jQuery.FromHtml("<a/>")
                        .AppendTo(li);

            var originalName = file.OriginalName ?? "";

            string fileName = file.Filename;

            //if (!fileName.StartsWith("temporary/"))
            //    fileName = "personelFoto/" + fileName;

            thumb.Attribute("href", UploadHelper.DbFileUrl(fileName));
            thumb.Attribute("target", "_blank");

            if (!originalName.IsEmptyOrNull())
            {
                thumb.Attribute("title", (originalName));
            }

            var img = J("<img/>").Attribute("src", UploadHelper.DbFileUrl(fileName)).AppendTo(thumb);

            UploadHelper.ColorBox(thumb, new object());

            if (displayOriginalName)
            {
                jQuery.FromHtml("<div/>")
                .AddClass("filename")
                .Text(originalName)
                .Attribute("title", originalName)
                .AppendTo(li);
            }

            li.AppendTo(fileElement);
        }
コード例 #6
0
        protected override void AfterLoadEntity()
        {
            base.AfterLoadEntity();

            jQueryObject registrationForm = this.toolbar.FindButton(".s-ServiceRegistrationTechnicianForm").Toggle(this.IsEditMode);

            if (this.IsEditMode)
            {
                registrationForm.Html("<div class=\"button-outer\"> "
                                      + "<a style=\"display: block;\" target=\"_blank\" href=\""
                                      + Q.ResolveUrl("~/TvHastanesi/ServiceTicketForm?ServiceTicketId=") + this.EntityId + "&FormType=" + ServiceTicketFormType.RegistrationTechnician + "\"> <span class=\"button-inner\" >"
                                      + " Teknisyen Formu </span></a></div>");
            }

            jQueryObject registrationUserForm = this.toolbar.FindButton(".s-ServiceRegistrationUserForm").Toggle(this.IsEditMode);

            if (this.IsEditMode)
            {
                registrationUserForm.Html("<div class=\"button-outer\"> "
                                          + "<a style=\"display: block;\" target=\"_blank\" href=\""
                                          + Q.ResolveUrl("~/TvHastanesi/ServiceTicketForm?ServiceTicketId=") + this.EntityId + "&FormType=" + ServiceTicketFormType.RegistationUser + "\"> <span class=\"button-inner\" >"
                                          + " Müşteri Formu </span></a></div>");
            }

            jQueryObject uretim = this.toolbar.FindButton(".s-SonyKrediFaturaButton").Toggle(this.IsEditMode);

            if (this.IsEditMode)
            {
                uretim.Html("<div class=\"button-outer\"> "
                            + "<a style=\"display: block;\" target=\"_blank\" href=\""
                            //+ Q.ResolveUrl("~/TvHastanesi/SonyKrediFaturaReport?serviceTicketId=") + this.EntityId + "&FormType=" + ServiceTicketFormType.Sony + "\"> <span class=\"button-inner\" >"
                            + Q.ResolveUrl("~/TvHastanesi/ServiceTicketForm?serviceTicketId=") + this.EntityId + "&FormType=" + ServiceTicketFormType.Sony + "\"> <span class=\"button-inner\" >"
                            + " Servis Faturası </span></a></div>");
            }

            AfterLoadEntity_ShowHideFields();
        }
コード例 #7
0
        public static void PopulateFileSymbols(
            jQueryObject container,
            List <UploadedFile> items,
            bool displayOriginalName = false,
            string urlPrefix         = null)
        {
            items = items ?? new List <UploadedFile>();
            container.Html("");

            for (var index = 0; index < items.Count; index++)
            {
                var item = items[index];
                var li   = jQuery.FromHtml("<li/>")
                           .AddClass("file-item")
                           .Data("index", index);

                bool isImage = HasImageExtension(item.Filename);

                if (isImage)
                {
                    li.AddClass("file-image");
                }
                else
                {
                    li.AddClass("file-binary");
                }

                var editLink = "#" + index;

                var thumb = jQuery.FromHtml("<a/>")
                            .AddClass("thumb")
                            .AppendTo(li);

                string originalName = item.OriginalName ?? "";

                if (isImage)
                {
                    string fileName = item.Filename;
                    if (urlPrefix != null && fileName != null && !fileName.StartsWith("temporary/"))
                    {
                        fileName = urlPrefix + fileName;
                    }

                    thumb.Attribute("href", DbFileUrl(fileName));
                    thumb.Attribute("target", "_blank");

                    if (!originalName.IsEmptyOrNull())
                    {
                        thumb.Attribute("title", (originalName));
                    }

                    thumb.CSS("backgroundImage", "url(" + DbFileUrl(ThumbFileName(item.Filename)) + ")");
                    ColorBox(thumb, new object());
                }

                if (displayOriginalName)
                {
                    jQuery.FromHtml("<div/>")
                    .AddClass("filename")
                    .Text(originalName)
                    .Attribute("title", originalName)
                    .AppendTo(li);
                }

                li.AppendTo(container);
            }
            ;
        }
コード例 #8
0
ファイル: Q.HtmlUtils.cs プロジェクト: fzhenmei/Serenity
 public static void ClearOptions(jQueryObject select)
 {
     select.Html("");
 }
コード例 #9
0
        public static void PopulateFileSymbols(
            jQueryObject container,
            List<UploadedFile> items,
            bool displayOriginalName = false,
            string urlPrefix = null)
        {
            items = items ?? new List<UploadedFile>();
            container.Html("");

            for (var index = 0; index < items.Count; index++)
            {
                var item = items[index];
                var li = jQuery.FromHtml("<li/>")
                    .AddClass("file-item")
                    .Data("index", index);

                bool isImage = HasImageExtension(item.Filename);

                if (isImage)
                    li.AddClass("file-image");
                else
                    li.AddClass("file-binary");

                var editLink = "#" + index;

                var thumb = jQuery.FromHtml("<a/>")
                    .AddClass("thumb")
                    .AppendTo(li);

                string originalName = item.OriginalName ?? "";

                if (isImage)
                {
                    string fileName = item.Filename;
                    if (urlPrefix != null && fileName != null && !fileName.StartsWith("temporary/"))
                        fileName = urlPrefix + fileName;

                    thumb.Attribute("href", DbFileUrl(fileName));
                    thumb.Attribute("target", "_blank");

                    if (!originalName.IsEmptyOrNull())
                        thumb.Attribute("title", (originalName));

                    thumb.CSS("backgroundImage", "url(" + DbFileUrl(ThumbFileName(item.Filename)) + ")");
                    ColorBox(thumb, new object());
                }

                if (displayOriginalName)
                {
                    jQuery.FromHtml("<div/>")
                        .AddClass("filename")
                        .Text(originalName)
                        .Attribute("title", originalName)
                        .AppendTo(li);
                }

                li.AppendTo(container);
            };
        }
コード例 #10
0
 public static void ClearOptions(jQueryObject select)
 {
     select.Html("");
 }