public override void Destroy()
 {
     if (_input != null)
     {
         _input.Remove();
     }
 }
示例#2
0
        public string GetFetchXmlForQuery(FetchQuerySettings config, string searchTerm)
        {
            jQueryObject fetchElement = config.FetchXml.Find("fetch");

            fetchElement.Attribute("count", "{0}");
            fetchElement.Attribute("paging-cookie", "{1}");
            fetchElement.Attribute("page", "{2}");
            fetchElement.Attribute("returntotalrecordcount", "true");
            fetchElement.Attribute("distinct", "true");
            fetchElement.Attribute("no-lock", "true");

            jQueryObject orderByElement = fetchElement.Find("order");

            orderByElement.Remove();

            // Add the search string and adjust any lookup columns
            jQueryObject conditions = fetchElement.Find("filter[isquickfindfields='1']");

            conditions.First().Children().Each(delegate(int index, Element element)
            {
                // Is this a lookup column?
                string logicalName = element.GetAttribute("attribute").ToString();
                if (LookupAttributes.ContainsKey(logicalName))
                {
                    element.SetAttribute("attribute", logicalName + "name");
                }
            });
            // Add the sort order placeholder
            string fetchXml = config.FetchXml.GetHtml().Replace("</entity>", "{3}</entity>");

            // Add the Query term
            fetchXml = fetchXml.Replace("#Query#", XmlHelper.Encode(searchTerm));
            return(fetchXml);
        }
示例#3
0
 public override void Destroy()
 {
     ((jQueryObject)Script.Literal("$.datepicker.dpDiv")).Stop(true, true);
     _input.Plugin <DatePickerPlugIn>().DatePicker(DatePickerMethod2.Hide);
     _input.Plugin <DatePickerPlugIn>().DatePicker(DatePickerMethod2.Destroy);
     _container.Remove();
 }
示例#4
0
 public override void Destroy()
 {
     _input.Plugin <AutoCompleteObject>().AutoComplete(AutoCompleteMethod.Close);
     _input.Plugin <AutoCompleteObject>().AutoComplete(AutoCompleteMethod.Destroy);
     _container.Remove();
     _autoComplete.Remove();
     _autoComplete = null;
 }
示例#5
0
 public override void Destroy()
 {
     ((jQueryObject)Script.Literal("$.datepicker.dpDiv")).Stop(true, true);
     _input.Plugin <DatePickerPlugIn>().DatePicker(DatePickerMethod2.Hide);
     _input.Plugin <DatePickerPlugIn>().DatePicker(DatePickerMethod2.Destroy);
     Hide(); // Ensure the calendar is hidden when ending an edit
     _container.Remove();
 }
示例#6
0
 public void DeleteItem(int row)
 {
     numRows--;
     rowData.RemoveAt(row);
                 #if CLIENT
     if (isAttached && !rebuilding)
     {
         int  newSelection    = SelectedRowIndex;
         bool changeSelection = false;
         if (SelectedRowIndex == row)
         {
             if (numRows > 0)
             {
                 if (newSelection == numRows)
                 {
                     newSelection = numRows - 1;
                 }
             }
             else
             {
                 newSelection = -1;
             }
             changeSelection = true;
         }
         jQueryObject q = jQuery.FromElement(GetValuesTBody().Rows[row]).Remove(), next = q.Next();
         q.Remove();
         for (; next.Size() > 0; next = next.Next())
         {
             if (next.Is("." + EvenRowClass))
             {
                 next.RemoveClass(EvenRowClass);
                 next.AddClass(OddRowClass);
             }
             else
             {
                 next.RemoveClass(OddRowClass);
                 next.AddClass(EvenRowClass);
             }
         }
         if (changeSelection)
         {
             selectedRowIndex = -1;                             // hack to make the next procedure sure the GUI must be updated
             SelectedRowIndex = newSelection;
             OnSelectionChanged(EventArgs.Empty);
         }
         return;
     }
                 #endif
     if (selectedRowIndex >= row)
     {
         selectedRowIndex--;
     }
     rowTextsIfNotRendered.RemoveAt(row);
     rowClassesIfNotRendered.RemoveAt(row);
 }
示例#7
0
        private void DeleteRowClick(jQueryEvent e)
        {
            e.PreventDefault();
            jQueryObject row = J(e.Target).Closest("div.filter-line");

            row.Remove();
            if (this.rowsDiv.Children().Length == 0)
            {
                Search();
            }

            UpdateParens();
            UpdateButtons();
        }
        public static string GetFetchXmlParentFilter(FetchQuerySettings query, string parentAttribute)
        {
            jQueryObject fetchElement = query.FetchXml.Find("fetch");

            fetchElement.Attribute("count", "{0}");
            fetchElement.Attribute("paging-cookie", "{1}");
            fetchElement.Attribute("page", "{2}");
            fetchElement.Attribute("returntotalrecordcount", "true");
            fetchElement.Attribute("distinct", "true");
            fetchElement.Attribute("no-lock", "true");
            jQueryObject orderByElement = fetchElement.Find("order");

            // Get the default order by field - currently only supports a single sort by column
            query.OrderByAttribute = orderByElement.GetAttribute("attribute");
            query.OrderByDesending = orderByElement.GetAttribute("descending") == "true";

            orderByElement.Remove();

            // Get the root filter (if there is one)
            jQueryObject filter = fetchElement.Find("entity>filter");

            if (filter != null)
            {
                // Check that it is an 'and' filter
                string filterType = filter.GetAttribute("type");
                if (filterType == "or")
                {
                    // wrap up in an and filter
                    jQueryObject andFilter = jQuery.FromHtml("<filter type='and'>" + filter.GetHtml() + "</filter>");

                    // remove existing filter
                    filter.Remove();

                    filter = andFilter;
                    // Add in the existing filter
                    fetchElement.Find("entity").Append(andFilter);
                }
            }

            // Add in the parent query filter
            jQueryObject parentFilter = jQuery.FromHtml("<condition attribute='" + parentAttribute + "' operator='eq' value='" + ParentRecordPlaceholder + "'/>");

            filter.Append(parentFilter);

            // Add the order by placeholder for the EntityDataViewModel
            return(query.FetchXml.GetHtml().Replace("</entity>", "{3}</entity>"));
        }
        public string GetFetchXmlForQuery(string entityLogicalName, string queryName, string searchTerm)
        {
            FetchQuerySettings config;

            if (queryName == "QuickFind")
            {
                config = EntityLookup[entityLogicalName].QuickFindQuery;
            }
            else
            {
                config = EntityLookup[entityLogicalName].Views[queryName];
            }
            jQueryObject fetchElement = config.FetchXml.Find("fetch");

            fetchElement.Attribute("distinct", "true");
            fetchElement.Attribute("no-lock", "true");

            jQueryObject orderByElement = fetchElement.Find("order");

            orderByElement.Remove();

            // Add the search string and adjust any lookup columns
            jQueryObject conditions = fetchElement.Find("filter[isquickfindfields='1']");

            conditions.First().Children().Each(delegate(int index, Element element)
            {
                // Is this a lookup column?
                string logicalName = element.GetAttribute("attribute").ToString();
                if (LookupAttributes.ContainsKey(logicalName))
                {
                    element.SetAttribute("attribute", logicalName + "name");
                }
            });
            // Add the sort order placeholder
            string fetchXml = config.FetchXml.GetHtml();//.Replace("</entity>", "{3}</entity>");

            // Add the Query term
            fetchXml = fetchXml.Replace("#Query#", XmlHelper.Encode(searchTerm));
            return(fetchXml);
        }
示例#10
0
        private void LinkFn(FloatingWindowScope scope, jQueryObject element, dynamic attr)
        {
            myElement = element;
            myScope   = scope;
            items.Add(element, scope);

            element.Click((elem, @event) => Focus());

            scope.Parent.SwingAway = (a, b, c) => { SwingAway(a, b, element, c); };
            scope.Parent.SwingBack = (c) => { SwingBack(scope, element, c); };
            scope.Parent.Minimize  = () =>
            {
                scope.Parent.Minimized = true;
                scope.Minimize();
            };
            scope.Parent.DestroyWindow = () =>
            {
                scope.Destroy();
                element.Remove();
            };


            scope.PositionStyles = new FloatingWindowPosition()
            {
                Left = scope.Left, Top = scope.Top, Display = "block"
            };
            scope.PositionStyles.ZIndex = 10000;

            if (scope.Left.IndexOf("%") != -1)
            {
                scope.PositionStyles.MarginLeft = (-(int.Parse(scope.Width.Replace("px", "")) / 2)) + "px";
            }
            if (scope.Top.IndexOf("%") != -1)
            {
                scope.PositionStyles.MarginTop = (-(int.Parse(scope.Height.Replace("px", "")) / 2)) + "px";
            }


            scope.SizeStyle = new Size()
            {
                Width = scope.Width, Height = scope.Height,
            };
            scope.Maximize = () =>
            {
                if (!scope.IsMaximized)
                {
                    scope.LastPositionStyles = scope.PositionStyles;
                    scope.LastSizeStyle      = scope.SizeStyle;
                    scope.PositionStyles     = new FloatingWindowPosition()
                    {
                        Left    = "0",
                        Top     = "0",
                        Display = "block"
                    };
                    scope.SizeStyle = new Size()
                    {
                        Width = "100%", Height = "100%",
                    };
                }
                else
                {
                    scope.PositionStyles     = scope.LastPositionStyles;
                    scope.SizeStyle          = scope.LastSizeStyle;
                    scope.LastPositionStyles = null;
                    scope.LastSizeStyle      = null;
                }

                scope.IsMaximized = !scope.IsMaximized;
            };
            scope.Close = () =>
            {
                if (scope.OnClose != null)
                {
                    scope.OnClose();
                }
                if (scope.Parent.OnClose != null)
                {
                    scope.Parent.OnClose();
                }
                //todo destroy
                scope.PositionStyles.Display = "none";
            };
            scope.Minimize = () =>
            {
//                myUIManagerService.OnMinimize(scope);
                scope.Parent.SwingAway(SwingDirection.Bottom,
                                       false,
                                       () => { scope.PositionStyles.Display = "none"; });
            };
            scope.Restore = () =>
            {
                scope.Parent.SwingBack(null);
                scope.PositionStyles.Display = "block";
            };
            Focus();

            if (scope.Parent.OnReady != null)
            {
                scope.Parent.OnReady();
            }
        }
 public override void Cleanup()
 {
     _thumbsList.Remove();
     _thumbsList = null;
 }
示例#12
0
        public string GetFetchXmlForQuery(string entityLogicalName, string queryName, string searchTerm, SearchTermOptions searchOptions)
        {
            FetchQuerySettings config;

            if (queryName == "QuickFind")
            {
                config = EntityLookup[entityLogicalName].QuickFindQuery;
            }
            else
            {
                config = EntityLookup[entityLogicalName].Views[queryName];
            }
            jQueryObject fetchElement = config.FetchXml.Clone().Find("fetch");

            fetchElement.Attribute("distinct", "true");
            fetchElement.Attribute("no-lock", "true");

            jQueryObject orderByElement = fetchElement.Find("order");

            orderByElement.Remove();

            // Add the search string and adjust any lookup columns
            jQueryObject conditions = fetchElement.Find("filter[isquickfindfields='1']");

            conditions.First().Children().Each(delegate(int index, Element element)
            {
                // Is this a lookup column?
                string logicalName = element.GetAttribute("attribute").ToString();
                if (LookupAttributes.ContainsKey(logicalName))
                {
                    element.SetAttribute("attribute", logicalName + "name");
                }
            });

            //See what field types can we use for query and remove those attributes we cannot query using this search term.
            if (Number.IsNaN(Int32.Parse(searchTerm)))
            {
                fetchElement.Find("condition[value='#QueryInt#']").Remove();
            }
            if (Number.IsNaN(Decimal.Parse(searchTerm)))
            {
                fetchElement.Find("condition[value='#QueryCurrency#']").Remove();
            }
            if (Number.IsNaN(Date.Parse(searchTerm).GetDate()))
            {
                fetchElement.Find("condition[value='#QueryDateTime#']").Remove();
            }
            if (Number.IsNaN(Double.Parse(searchTerm)))
            {
                fetchElement.Find("condition[value='#QueryFloat#']").Remove();
            }
            // Add the sort order placeholder
            string fetchXml = fetchElement.Parent().GetHtml();//.Replace("</entity>", "{3}</entity>");

            //Prepare search term based on options
            string textSearchTerm = searchTerm;

            if (searchOptions != null && (searchOptions & SearchTermOptions.PrefixWildcard) == SearchTermOptions.PrefixWildcard)
            {
                //Trimming, in case there are already wildcards with user input
                while (textSearchTerm.StartsWith("*") || textSearchTerm.StartsWith("%"))
                {
                    textSearchTerm = textSearchTerm.Substring(1, textSearchTerm.Length);
                }
                textSearchTerm = "%" + textSearchTerm;
            }
            if (searchOptions != null && (searchOptions & SearchTermOptions.SuffixWildcard) == SearchTermOptions.SuffixWildcard)
            {
                //Trimming, in case there are already wildcards
                while (textSearchTerm.EndsWith("*") || textSearchTerm.EndsWith("%"))
                {
                    textSearchTerm = textSearchTerm.Substring(0, textSearchTerm.Length - 1);
                }
                textSearchTerm = textSearchTerm + "%";
            }

            // Add the Query term
            fetchXml = fetchXml.Replace("#Query#", XmlHelper.Encode(textSearchTerm))
                       .Replace("#QueryInt#", Int32.Parse(searchTerm).ToString())
                       .Replace("#QueryCurrency#", Double.Parse(searchTerm).ToString())
                       .Replace("#QueryDateTime#", XmlHelper.Encode(Date.Parse(searchTerm).Format("MM/dd/yyyy")))
                       .Replace("#QueryFloat#", Double.Parse(searchTerm).ToString());

            return(fetchXml);
        }
        private void LinkFn(FloatingWindowScope scope, jQueryObject element, dynamic attr)
        {
            myElement = element;
            myScope = scope;
            items.Add(element, scope);

            element.Click((elem, @event) => Focus());

            scope.Parent.SwingAway = (a, b, c) => { SwingAway(a, b, element, c); };
            scope.Parent.SwingBack = (c) => { SwingBack(scope, element, c); };
            scope.Parent.Minimize = () =>
            {
                scope.Parent.Minimized = true;
                scope.Minimize();
            };
            scope.Parent.DestroyWindow = () =>
            {
                scope.Destroy();
                element.Remove();
            };


            scope.PositionStyles = new FloatingWindowPosition() { Left = scope.Left, Top = scope.Top, Display = "block" };
            scope.PositionStyles.ZIndex = 10000;

            if (scope.Left.IndexOf("%") != -1)
            {
                scope.PositionStyles.MarginLeft = (-(int.Parse(scope.Width.Replace("px", "")) / 2)) + "px";
            }
            if (scope.Top.IndexOf("%") != -1)
            {
                scope.PositionStyles.MarginTop = (-(int.Parse(scope.Height.Replace("px", "")) / 2)) + "px";
            }


            scope.SizeStyle = new Size() { Width = scope.Width, Height = scope.Height, };
            scope.Maximize = () =>
            {
                if (!scope.IsMaximized)
                {
                    scope.LastPositionStyles = scope.PositionStyles;
                    scope.LastSizeStyle = scope.SizeStyle;
                    scope.PositionStyles = new FloatingWindowPosition()
                    {
                        Left = "0",
                        Top = "0",
                        Display = "block"
                    };
                    scope.SizeStyle = new Size() { Width = "100%", Height = "100%", };
                }
                else
                {
                    scope.PositionStyles = scope.LastPositionStyles;
                    scope.SizeStyle = scope.LastSizeStyle;
                    scope.LastPositionStyles = null;
                    scope.LastSizeStyle = null;
                }

                scope.IsMaximized = !scope.IsMaximized;
            };
            scope.Close = () =>
            {
                if (scope.OnClose != null)
                {
                    scope.OnClose();
                }
                if (scope.Parent.OnClose != null)
                {
                    scope.Parent.OnClose();
                }
                //todo destroy
                scope.PositionStyles.Display = "none";
            };
            scope.Minimize = () =>
            {
//                myUIManagerService.OnMinimize(scope);
                scope.Parent.SwingAway(SwingDirection.Bottom,
                    false,
                    () => { scope.PositionStyles.Display = "none"; });
            };
            scope.Restore = () =>
            {
                scope.Parent.SwingBack(null);
                scope.PositionStyles.Display = "block";
            };
            Focus();

            if (scope.Parent.OnReady != null)
                scope.Parent.OnReady();
        }
示例#14
0
 public override void Destroy()
 {
     base.Destroy();
     input.Remove();
     currencySymbol.Remove();
 }
示例#15
0
 public void Destroy()
 {
     _hoverButtons.Remove();
 }
 public override void Destroy()
 {
     base.Destroy();
     input.Remove();
 }
示例#17
0
        public void DataBindEvents(Grid grid, DataViewBase dataView, string gridContainerDivId)
        {
            // Data Sorting
            grid.OnSort.Subscribe(delegate(EventData o, Object item)
            {
                SortColData sorting = (SortColData)item;
                dataView.Sort(sorting);
                grid.Invalidate();
                grid.Render();
            });

            // Session Grid DataBinding
            grid.OnAddNewRow.Subscribe(delegate(EventData o, Object item)
            {
                EditEventData data = (EditEventData)item;
                dataView.AddItem(data.item);


                Column column = data.column;
                grid.InvalidateRow(dataView.GetLength() - 1);

                grid.UpdateRowCount();
                grid.Render();
            });

            dataView.OnRowsChanged.Subscribe(delegate(EventData e, object a)
            {
                OnRowsChangedEventArgs args = (OnRowsChangedEventArgs)a;
                if (args != null && args.Rows != null)
                {
                    grid.InvalidateRows(args.Rows);
                    grid.Render();
                }
                else
                {
                    // Assume that a new row has been added
                    grid.InvalidateRow(dataView.GetLength());
                    grid.UpdateRowCount();
                    grid.Render();
                }
                grid.ResizeCanvas();
            });


            jQueryObject loadingIndicator = null;


            // Wire up the validation error
            jQueryObject validationIndicator = null;
            Action <EventData, object> clearValidationIndicator = delegate(EventData e, object a)
            {
                if (validationIndicator != null)
                {
                    validationIndicator.Hide();
                    validationIndicator.Remove();
                }
            };

            grid.OnCellChange.Subscribe(clearValidationIndicator);
            grid.OnActiveCellChanged.Subscribe(clearValidationIndicator);
            grid.OnBeforeCellEditorDestroy.Subscribe(clearValidationIndicator);

            grid.OnValidationError.Subscribe(delegate(EventData e, object a)
            {
                ValidationEventArgs args          = (ValidationEventArgs)a;
                ValidationResult validationResult = (ValidationResult)args.ValidationResults;
                jQueryObject activeCellNode       = (jQueryObject)args.CellNode;
                object editor       = args.Editor;
                string errorMessage = "";
                if (validationResult.Message != null)
                {
                    errorMessage = validationResult.Message;
                }
                bool valid_result = validationResult.Valid;

                // Add the message to the tooltip on the cell
                if (!valid_result)
                {
                    jQuery.FromObject(activeCellNode).Attribute("title", errorMessage);
                    clearValidationIndicator(e, a);
                    validationIndicator = jQuery.FromHtml("<div class='popup-box-container'><div width='16px' height='16px' class='sparkle-imagestrip-inlineedit_warning popup-box-icon' alt='Error' id='icon'/><div class='popup-box validation-text'/></div>").AppendTo(Document.Body);
                    validationIndicator.Find(".validation-text").Text(errorMessage);

                    string colisionPosition = ValidationPopupUseFitPosition ? "fit fit" : "none none";
                    Script.Literal(@"{0}.position({{
                                            my: 'left bottom',
                                            at: 'left top',
                                            collision: '{2}',
                                            of: {1}
                                        }})
                                        .show({{
                                        effect: 'blind'
                                        }})
                                        .delay( 500000 )
                                        .hide({{
                                            effect: 'fade',
                                            duration: 'slow', 
                                        }},
                                            function() {{
                                                $( this ).remove();
                                                
                                            }});
                                        ", validationIndicator, activeCellNode, colisionPosition);
                }
                else
                {
                    clearValidationIndicator(e, a);
                    jQuery.FromObject(activeCellNode).Attribute("title", "");
                }
            });

            // Wire up the loading spinner
            dataView.OnDataLoading.Subscribe(delegate(EventData e, object a)
            {
                loadingIndicator = ShowLoadingIndicator(loadingIndicator, gridContainerDivId);
                foreach (Column col in grid.GetColumns())
                {
                    if (col.MaxWidth != null)
                    {
                        col.MaxWidth = 400;
                    }
                }
            });

            dataView.OnDataLoaded.Subscribe(delegate(EventData e, object a)
            {
                DataLoadedNotifyEventArgs args = (DataLoadedNotifyEventArgs)a;
                if (args != null)
                {
                    if (args.ErrorMessage == null)
                    {
                        for (int i = args.From; i <= args.To; i++)
                        {
                            grid.InvalidateRow(i);
                        }
                        grid.UpdateRowCount();
                        grid.Render();
                    }
                    else
                    {
                        Script.Alert("There was a problem refreshing the grid.\nPlease contact your system administrator:\n" + args.ErrorMessage);
                    }
                }
                if (loadingIndicator != null)
                {
                    loadingIndicator.Plugin <jQueryBlockUI>().Unblock();
                }
            });

            // Wire up edit complete to property changed
            grid.OnCellChange.Subscribe(delegate(EventData e, object data)
            {
                OnCellChangedEventData eventData = (OnCellChangedEventData)data;
                dataView.RaisePropertyChanged("");
            });
        }
 public override void Destroy()
 {
     _input.Remove();
 }