GetScript() public method

public GetScript ( String parameter, String stringConfirmation = "", bool usePostBack = false ) : String
parameter String
stringConfirmation String
usePostBack bool
return String
        private void ProcessDefault(IMemberInfo memberInfo, object objValue, IModelColumn columnModel, int RowNumber, ref String Value)
        {
            String displayFormat = "{0}";

            if (columnModel != null)
            {
                var valuePath = columnModel.GetValue <String>("FieldName").Split('.');
                if (!(objValue is XPBaseObject) && !(objValue is String) && !objValue.GetType().IsPrimitive)
                {
                    if (valuePath.Length > 1)
                    {
                        IMemberInfo mInfo;
                        var         val = ObjectFormatValues.GetValueRecursive(String.Join(".", valuePath.Skip(1).Take(valuePath.Length - 1)), objValue, out mInfo);
                        if (val != new object())
                        {
                            objValue = String.Concat(val);
                        }
                    }
                }

                if (String.Concat(columnModel.DisplayFormat) != "")
                {
                    displayFormat = columnModel.DisplayFormat;
                }
                else
                if (memberInfo.MemberTypeInfo != null)
                {
                    var attr = memberInfo.MemberTypeInfo.FindAttribute <ObjectCaptionFormatAttribute>();
                    if (attr != null)
                    {
                        displayFormat = attr.FormatString;
                        Value         = String.Format(new ObjectFormatter(), displayFormat, objValue);
                    }
                    else
                    {
                        var defPropAttr = memberInfo.MemberTypeInfo.FindAttribute <XafDefaultPropertyAttribute>();
                        if (defPropAttr != null)
                        {
                            displayFormat = attr.FormatString;
                            Value         = "{0:" + defPropAttr.Name + "}";
                            Value         = String.Format(new ObjectFormatter(), displayFormat, objValue);
                        }
                    }
                }
                ;
            }

            if (Value == "")
            {
                Value = String.Format(displayFormat, objValue);
            }

            if (memberInfo.MemberTypeInfo != null && memberInfo.MemberTypeInfo.IsDomainComponent && columnModel != null)
            {
                Value = String.Format(@"<a href=""javascript:;"" onclick=""event = event || window.event; event.stopPropagation(); {0}"">{1}</a>", Handler.GetScript(String.Format("'BrowseObject|{0}|{1}'", RowNumber, columnModel.PropertyName)), Value);
            }
        }
        public void InnerRender()
        {
            ContentStart.Text  = "";
            ContentFinish.Text = "";

            String displayText = String.Concat(Value);

            try
            {
                displayText = Value == null ? EmptyText : String.Format(new ObjectFormatter(), String.Concat(DisplayFormat) == "" ? "{0}" : DisplayFormat, Value);
            }
            catch
            {
            }
            if (TextOnly)
            {
                ContentStart.Text += String.Format(@"<span><a href=""javascript:;"" onclick=""{1}"">{0}</a></span>", displayText, Handler.GetScript("'Link=true'"));
            }
            else
            {
                ContentStart.Text += String.Format(@"                    
                    <div class=""btn-group"" role=""group"" aria-label=""..."">                
                        <button type=""button"" class=""btn btn-default btn-sm"" onclick=""{0}"">
                            <span data-bind=""label"">{1}</span> 
                            <span class=""caret""></span>
                        </button>                        
                    </div>{2}"
                                                   , Handler.GetScript("'Show=true'")
                                                   , displayText
                                                   , Buttons.InnerRender());
            }
        }
        public String InnerRender()
        {
            Content.Text = "";

            Content.Text += String.Concat(ContentBefore);

            var idx = 0;

            foreach (var button in Buttons)
            {
                Content.Text += String.Format("<{3} {4} class='{2}' style='min-width: 30px;' onclick=\"{1}\">{0}</{3}>"
                                              , button.Caption
                                              , Handler != null ? Handler.GetScript(String.Format("'{0}'", idx)) : ""
                                              , button.CssClass
                                              , button.Tag
                                              , (button.Tag == "a" ? "href='javascript:;'" : button.Tag == "button" ? "type='button'" : "")
                                              );
                idx++;
            }

            Content.Text += String.Concat(ContentAfter);

            return(Content.Text);
        }
示例#4
0
        public void InnerRender()
        {
            Content.Text = "";

            if (TextOnly)
            {
                Content.Text += String.Format(@"<span>{0}</span>", (SelectedItem != null) ? SelectedItem.Text : "");
            }
            else
            {
                if (Items.Count > 3)
                {
                    Content.Text += String.Format(@"
                        <div class=""btn-group"">
                            <button type=""button"" class=""btn btn-default btn-sm dropdown-toggle"" onclick=""var elems = $(this).parent().find('.modal').modal();"">
                                <span data-bind=""label"">{0}</span>&nbsp;<span class=""caret""></span>
                            </button>                            
                            <div class=""modal fade"" tabindex=""-1"" role=""dialog"" aria-hidden=""true"">
                                <div class=""modal-dialog"">
                                    <div class=""modal-content"">
                                        <div class=""modal-header"">
                                            <h4>{1}</h4>
                                        </div>
                                        <div class=""modal-body"">  
                                            <table class=""table table-hover"">
                    ", Value == null ? EmptyText : SelectedItem == null ? EmptyText : SelectedItem.Text, EmptyText);

                    foreach (XafBootstrapDropdownItem item in Items.List.OrderBy(f => f.Text))
                    {
                        String changeEvent = String.Format(@"onclick=""$(this).parents('.modal').modal('hide'); window.DataChanged=true; {0};""", Handler.GetScript(String.Format("'NewValue={0}'", item.Index)));
                        Content.Text += String.Format(@"
                                        <tr><td {1} style='vertical-align: middle'>{2}{0}</td></tr>", item.Text, changeEvent, String.Concat(item.ImageUrl) != "" ? String.Format("<img class='img-circle' style='max-width: {0}px; max-height: {1}px;' src='{2}'/> ", Items.ItemImageWidth, Items.ItemImageHeight, item.ImageUrl) : "");
                    }

                    Content.Text += String.Format(@"
                                            </table>
                                        </div>
                                        <div class=""modal-footer"">
                                            <button type=""button"" class=""btn btn-default"" data-dismiss=""modal"">{0}</button>
                                        </div>
                                    </div>
                                </div>
                            </div>
                        </div>
                    ", XAF_Bootstrap.Templates.Helpers.GetLocalizedText(@"DialogButtons", "Cancel"));
                }
                else
                {
                    Content.Text += String.Format(@"
                        <div class=""btn-group"">
                            <button type=""button"" class=""btn btn-default btn-sm dropdown-toggle"" data-toggle=""dropdown"">
                                <span data-bind=""label"">{0}</span>&nbsp;<span class=""caret""></span>
                            </button>
                            <ul class=""dropdown-menu"" role=""menu"">
                    ", Value == null ? EmptyText : SelectedItem == null ? EmptyText : SelectedItem.Text);


                    foreach (XafBootstrapDropdownItem item in Items.List.OrderBy(f => f.Text))
                    {
                        String changeEvent = String.Format(@"onclick="" window.DataChanged=true;{0};""", Handler.GetScript(String.Format("'NewValue={0}'", item.Index)));
                        Content.Text += String.Format(@"
                            <li role=""presentation""><a role=""menuitem"" tabindex=""-1"" {1}><span class=""text-success"">{0}</span>{2}</a></li>"
                                                      , item.Text
                                                      , changeEvent
                                                      , (String.Concat(item.Hint) != "" ? "<br>" + item.Hint : ""));
                    }

                    Content.Text += @"
                        </ul>
                    </div>
                    ";
                }
            }
        }
        private void InitCollector(Boolean isEditing)
        {
            Collector = new CollectorControl();

            CallbackHandler handler = new CallbackHandler("ThemeConfigurationCallbackHandler");
            handler.OnCallback += handler_OnCallback;

            var popup = new HTMLText(String.Format(@"
                <div class=""modal fade"" id=""popupThemeLoader"">
                    <div class=""modal-dialog modal-lg"">
                        <div class=""modal-content"">
                            <div class=""modal-header"">
                                <button type=""button"" class=""close"" data-dismiss=""modal"" aria-label=""Close""><span aria-hidden=""true"">&times;</span></button>
                                <h4 class=""modal-title"">Theme CSS uploading</h4>
                            </div>
                            <div class=""modal-body"">
                                <div class=""form-group"">
                                    <label for=""themeName"">Theme name</label>
                                    <input name=""themeName"" type=""text"" class=""form-control"" id=""themeName"" placeholder=""Name of destination theme folder"">
                                </div>

                                <div class=""form-group"">
                                    <label for=""bootstrapCSS"">Bootstrap CSS</label>
                                    <textarea name=""bootstrapCSS"" class=""form-control"" rows=""20"" id=""bootstrapCSS"" placeholder=""Main Bootstrap CSS content""></textarea>
                                </div>
                            </div>
                            <div class=""modal-footer"">
                                <button type=""button"" class=""btn btn-default pull-right"" data-dismiss=""modal"">Cancel</button>
                                <button type=""button"" class=""btn btn-default pull-right"" data-dismiss=""modal"" onclick="" startProgress(); setTimeout(function() {{ {0} }}, 1000);"">OK</button>
                            </div>
                        </div>
                    </div>
                </div>
            ", handler.GetScript("'save'")));

            var popupButton = new HTMLText(@"<button class=""btn btn-default btn-sm"" type=""button"" onclick=""$('#popupThemeLoader').modal();""><span class=""glyphicon glyphicon-upload""></span> Upload</button>");

            Collector.Controls.Add(Edit);
            if (isEditing)
            {
                Collector.Controls.Add(popup);
                Collector.Controls.Add(popupButton);
            }
        }
        public String InnerRender()
        {
            Content.Text = "";

            var values        = String.Concat(Value).Split(new String[] { Delimeter }, StringSplitOptions.RemoveEmptyEntries).ToList();
            var selectedItems = new List <XafBootstrapTagSelectorItem>();

            foreach (var value in values)
            {
                var item = Items.List.FirstOrDefault(f => f.Value == value);
                if (item != null && selectedItems.IndexOf(item) == -1)
                {
                    selectedItems.Add(item);
                }
            }

            if (TextOnly)
            {
                Content.Text += String.Format(@"<span>{0}</span>", String.Join(DisplayDelimeter, selectedItems.Select(f => String.Format(@"{0}", f.Text))));
            }
            else
            {
                Content.Text += String.Format(@"<input type='hidden' value='{0}' name='{1}'/>", HttpUtility.UrlEncode(String.Concat(Value)), ClientID + "_value");
                Content.Text += String.Format(@"
                    <div class=""btn-group"">
                        <span class=""form-control"" style=""height: auto; padding: 0px; {5}"">{0}" + (AllowSelectValues && selectedItems.Count < Items.Count ? @" <span class=""btn btn-xs btn-info"" style=""margin: 1px"" onclick=""var elems = $(this).parents('.btn-group').find('.modal.selector').modal();""> ... </span>" : "") + @" {2}</span>"
                                              + (AllowAddCustomValues ? @"
                        <div class=""modal editor fade"" tabindex=""-1"" role=""dialog"" aria-hidden=""true"">
                            <div class=""modal-dialog"">
                                <div class=""modal-content"">                        
                                    <div class=""modal-body"">
                                        <div class=""input-group input-group-sm"">
                                          <input type=""text"" class=""form-control"" placeholder="""">
                                          <span class=""input-group-btn"">
                                            <button class=""btn btn-default"" type=""button"" onclick=""$(this).parents('.btn-group').find('.modal.editor').modal('hide'); {4}"">{3}</button>
                                          </span>
                                        </div>
                                    </div>        
                                </div>                            
                            </div>
                        </div>" : "") + (AllowSelectValues ? @"
                        <div class=""modal selector fade"" tabindex=""-1"" role=""dialog"" aria-hidden=""true"">
                            <div class=""modal-dialog"">
                                <div class=""modal-content"">
                                    <div class=""modal-header"">
                                        <span style='font-size: 18px;'>{1}</span>                                        
                                        <input type=""text"" class=""form-control input-sm pull-right"" placeholder=""{6}"" onkeyup=""var rows = $(this).parents('.modal-content').find('table tr'); var val = $.trim($(this).val()).replace(/ +/g, ' ').toLowerCase(); rows.show().filter(function() {{ var text = $(this).text().replace(/\s+/g, ' ').toLowerCase(); return !~text.indexOf(val); }}).hide();"" value="""" style=""min-width:75px; max-width: 300px;"">
                                    </div>
                                    <div class=""modal-body"">  
                                        <div class=""table-responsive"" style=""max-height: 480px; overflow: auto"">
                                            <table class=""table table-hover"">
                " : ""), Value == null ? EmptyText : String.Join("", selectedItems.Select(f => String.Format(@"<span class=""btn btn-xs btn-default"" style=""margin: 1px"" onclick=""{1}"">{0}</span>", f.Text, Handler.GetScript("'Remove=" + Items.List.IndexOf(f) + "'"))))
                                              , EmptyText
                                              , TextEqualValues() && AllowAddCustomValues ? @"<span class=""btn btn-xs btn-info"" style=""margin: 1px"" onclick=""var elems = $(this).parents('.btn-group').find('.modal.editor').modal();""> + </span>" : ""
                                              , XAF_Bootstrap.Templates.Helpers.GetLocalizedText(@"DialogButtons", "Add")
                                              , Handler.GetScript("'AddValue=' + $(this).parents('.input-group').find('input').val()")
                                              , Value == null ? "padding-left: 6px;" : ""
                                              , XAF_Bootstrap.Templates.Helpers.GetLocalizedText(@"XAF Bootstrap\Dialogs", "FastSearchText")
                                              );

                if (AllowSelectValues)
                {
                    foreach (XafBootstrapTagSelectorItem item in Items.List.Where(f => selectedItems.IndexOf(f) == -1).OrderBy(f => f.Text))
                    {
                        String changeEvent = @"onclick=""if ($(this).hasClass(&quot;bg-success&quot;)) {{ $(this).removeClass(&quot;bg-success&quot;).removeClass(&quot;text-primary&quot;); }} else {{ $(this).addClass(&quot;bg-success&quot;).addClass(&quot;text-primary&quot;); }} """;
                        Content.Text += String.Format(@"
                                        <tr><td {1} idx=""{3}"" style='vertical-align: middle'>{2}{0}</td></tr>"
                                                      , item.Text
                                                      , changeEvent
                                                      , String.Concat(item.ImageUrl) != "" ? String.Format("<img class='img-circle' style='max-width: {0}px; max-height: {1}px;' src='{2}'/> "
                                                                                                           , Items.ItemImageWidth
                                                                                                           , Items.ItemImageHeight
                                                                                                           , item.ImageUrl) : ""
                                                      , Items.List.IndexOf(item));
                    }

                    Content.Text += String.Format(@"
                                                </table>
                                            </div>                                     
                                        </div>
                                        <div class=""modal-footer"">                                        
                                            <button type=""button"" class=""btn btn-default"" data-dismiss=""modal"" onclick=""var values = ''; var items = $(this).parents('.modal').find('.bg-success'); for(i = 0; i < items.length; i++) values += $(items[i]).attr('idx') + '" + Delimeter + @"'; {1}"">{0}</button>
                                        </div>
                                    </div>
                                </div>
                            </div>                    
                    ", XAF_Bootstrap.Templates.Helpers.GetLocalizedText(@"DialogButtons", "OK")
                                                  , Handler.GetScript("'NewValue=' + values"));
                }

                Content.Text += @"
                    </div>";
            }

            return(Content.Text);
        }
 private String GetHandlerScript(ITreeNode structure)
 {
     return(structure.Children.Count == 0 ? handler.GetScript(String.Format("'select|{0}'", GetKey(structure))) : handler.GetScript(String.Format("'navigate|{0}'", GetKey(structure))));
 }
示例#8
0
        public void InnerRender()
        {
            Content.Text = "";

            var values        = String.Concat(Value).Split(new String[] { "," }, StringSplitOptions.RemoveEmptyEntries).ToList();
            var selectedItems = new List <XafBootstrapTagSelectorItem>();

            foreach (var value in values)
            {
                var item = Items.List.FirstOrDefault(f => f.Value == value);
                if (item != null && selectedItems.IndexOf(item) == -1)
                {
                    selectedItems.Add(item);
                }
            }

            if (TextOnly)
            {
                Content.Text += String.Format(@"<span>{0}</span>", String.Join(", ", selectedItems.Select(f => String.Format(@"{0}", f.Text))));
            }
            else
            {
                Content.Text += String.Format(@"
                    <div class=""btn-group"">
                        <span class=""form-control"" style=""height: auto; padding: 0px;"">{0}" + (selectedItems.Count < Items.Count ? @" <span class=""btn btn-xs btn-info"" style=""margin: 1px"" onclick=""var elems = $(this).parents('.btn-group').find('.modal.selector').modal();""> ... </span>" : "") + @" {2}</span>
                        <div class=""modal editor fade"" tabindex=""-1"" role=""dialog"" aria-hidden=""true"">
                            <div class=""modal-dialog"">
                                <div class=""modal-content"">                        
                                    <div class=""modal-body"">
                                        <div class=""input-group input-group-sm"">
                                          <input type=""text"" class=""form-control"" placeholder="""">
                                          <span class=""input-group-btn"">
                                            <button class=""btn btn-default"" type=""button"" onclick=""$(this).parents('.btn-group').find('.modal.editor').modal('hide'); {4}"">{3}</button>
                                          </span>
                                        </div>
                                    </div>        
                                </div>                            
                            </div>
                        </div>
                        <div class=""modal selector fade"" tabindex=""-1"" role=""dialog"" aria-hidden=""true"">
                            <div class=""modal-dialog"">
                                <div class=""modal-content"">
                                    <div class=""modal-header"">
                                        <h4>{1}</h4>
                                    </div>
                                    <div class=""modal-body"">  
                                        <table class=""table table-hover"">
                ", Value == null ? EmptyText : String.Join("", selectedItems.Select(f => String.Format(@"<span class=""btn btn-xs btn-default"" style=""margin: 1px"" onclick=""{1}"">{0}</span>", f.Text, Handler.GetScript("'Remove=" + Items.List.IndexOf(f) + "'"))))
                                              , EmptyText
                                              , TextEqualValues() ? @"<span class=""btn btn-xs btn-info"" style=""margin: 1px"" onclick=""var elems = $(this).parents('.btn-group').find('.modal.editor').modal();""> + </span>" : ""
                                              , XAF_Bootstrap.Templates.Helpers.GetLocalizedText(@"DialogButtons", "Add")
                                              , Handler.GetScript("'AddValue=' + $(this).parents('.input-group').find('input').val()")
                                              );

                foreach (XafBootstrapTagSelectorItem item in Items.List.Where(f => selectedItems.IndexOf(f) == -1).OrderBy(f => f.Text))
                {
                    String changeEvent = @"onclick=""if ($(this).hasClass(&quot;bg-success&quot;)) {{ $(this).removeClass(&quot;bg-success&quot;); }} else {{ $(this).addClass(&quot;bg-success&quot;); }} """;
                    Content.Text += String.Format(@"
                                    <tr><td {1} idx=""{3}"" style='vertical-align: middle'>{2}{0}</td></tr>"
                                                  , item.Text
                                                  , changeEvent
                                                  , String.Concat(item.ImageUrl) != "" ? String.Format("<img class='img-circle' style='max-width: {0}px; max-height: {1}px;' src='{2}'/> "
                                                                                                       , Items.ItemImageWidth
                                                                                                       , Items.ItemImageHeight
                                                                                                       , item.ImageUrl) : ""
                                                  , Items.List.IndexOf(item));
                }

                Content.Text += String.Format(@"
                                        </table>                                        
                                    </div>
                                    <div class=""modal-footer"">                                        
                                        <button type=""button"" class=""btn btn-default"" data-dismiss=""modal"" onclick=""var values = ''; var items = $(this).parents('.modal').find('.bg-success'); for(i = 0; i < items.length; i++) values += $(items[i]).attr('idx') + ','; {1}"">{0}</button>
                                    </div>
                                </div>
                            </div>
                        </div>
                    </div>
                ", XAF_Bootstrap.Templates.Helpers.GetLocalizedText(@"DialogButtons", "OK")
                                              , Handler.GetScript("'NewValue=' + values"));
            }
        }