Ejemplo n.º 1
0
    protected void Page_Init(object sender, EventArgs e)
    {
        string query = Request.QueryString["query"];

        WikiID                = Request.QueryString["wikiid"];
        WikiNumber            = Request.QueryString["wikinumber"];
        CategoryID            = Request.QueryString["categoryID"];
        ProductID             = Request.QueryString["productID"];
        OrderID               = Request.QueryString["orderID"];
        imgMessage            = PXFormView1.FindControl("imgMessage") as Image;
        lblMessage            = PXFormView1.FindControl("lblMessage") as Label;
        lblResults            = PXFormView1.FindControl("lblResults") as Label;
        txtSearch             = PXFormView1.FindControl("txtSearch") as PXTextEdit;
        chkSearchReplace      = PXFormView1.FindControl("chkSearchReplace") as PXCheckBox;
        txtReplace            = PXFormView1.FindControl("txtReplace") as PXTextEdit;
        SearchCaption         = PXFormView1.FindControl("SearchCaption") as PXDropDown;
        SearchCaptionCategory = PXFormView1.FindControl("SearchCaptionCategory") as PXDropDown;
        SearchCaptionProduct  = PXFormView1.FindControl("SearchCaptionProduct") as PXDropDown;
        OrderCaption          = PXFormView1.FindControl("OrderCaption") as PXDropDown;
        Go = PXFormView1.FindControl("btnSearch") as PXButton;

        mainContentTable = CreateMainTable();
        pager            = CreatePager(query);
        PXFormView1.TemplateContainer.Controls.Add(MainContentTable);
        SetEditBoxAttrributes();
        FullText = true;

        if (this.searchType == SearchType.Wiki)
        {
            this.txtSearch.ToolTip = PXMessages.LocalizeNoPrefix(Messages.ttipHelpSearch);
        }
        else if (this.searchType == SearchType.Files)
        {
            this.txtSearch.ToolTip = PXMessages.LocalizeNoPrefix(Messages.ttipFileSearch);
        }
        else if (this.searchType == SearchType.Entity)
        {
            this.txtSearch.ToolTip = PXMessages.LocalizeNoPrefix(Messages.ttipEntitySearch);
        }
        else if (this.searchType == SearchType.Notes)
        {
            this.txtSearch.ToolTip = PXMessages.LocalizeNoPrefix(Messages.ttipNoteSearch);
        }
        FormatSearchCaption();
        RegisterThisId();
        imgMessage.ImageUrl = ResolveUrl("~/App_Themes/Default/Images/Message/information.gif");

        if (query == null || string.IsNullOrEmpty(query.Trim()))
        {
            imgMessage.Visible = true;
            lblMessage.Visible = true;
            lblResults.Visible = false;
            lblMessage.Text    = PXMessages.LocalizeNoPrefix(Messages.SpecifySearchRequest);
            return;
        }

        imgMessage.Visible = false;
        lblMessage.Visible = false;
        lblResults.Visible = true;
    }
Ejemplo n.º 2
0
    protected void Page_Load(object sender, EventArgs e)
    {
        this.usrCaption.CustomizationAvailable = false;
        ver1     = PXFormView1.FindControl("ver1") as PXLabel;
        ver2     = PXFormView1.FindControl("ver2") as PXLabel;
        content1 = PXFormView1.FindControl("content1") as HtmlContainerControl;
        content2 = PXFormView1.FindControl("content2") as HtmlContainerControl;
        this.usrCaption.ScreenID = "WI.00.00.50";

        ver1.Text = Request.QueryString["id1"];
        ver2.Text = Request.QueryString["id2"];

        Guid pageID = PX.Common.GUID.CreateGuid(Request.QueryString["pageID"]) ?? Guid.Empty;
        int  id1    = 0;
        int  id2    = 0;


        if (!string.IsNullOrEmpty(ver1.Text) && !Int32.TryParse(ver1.Text, out id1))
        {
            id1 = 0;
        }
        if (!string.IsNullOrEmpty(ver2.Text) && !Int32.TryParse(ver2.Text, out id2))
        {
            id2 = 0;
        }

        string art1, art2;
        bool   docompare = true;

        art1 = GetArticle(pageID, id1, ver1, this.pnlStatLeft);
        CollectLeftStats(art1);
        art2 = GetArticle(pageID, id2, ver2, this.pnlStatRight);
        CollectRightStats(art2);
        if (string.IsNullOrEmpty(art1))
        {
            art1      = PX.Data.PXMessages.LocalizeNoPrefix(PX.SM.Messages.SourceArticle);
            docompare = false;
        }
        if (string.IsNullOrEmpty(art2))
        {
            art2      = PX.Data.PXMessages.LocalizeNoPrefix(PX.SM.Messages.DestinationArticle);
            docompare = false;
        }

        if (docompare)
        {
            CompareArticles(art1, art2, ref art1, ref art2);
        }
        this.content1.InnerHtml = art1;
        this.content2.InnerHtml = art2;
    }
    string[] parsePages()
    {
        var pnl = PXFormView1.FindControl("pnlResults") as PXSmartPanel;

        if (pnl != null)
        {
            var pages = pnl.FindControl("pages") as HiddenField;
            if (pages != null)
            {
                return((pages.Value ?? "").Split('&'));
            }
        }
        return(new string[] {});
    }
    private void StorePages(int prev, int next)
    {
        //                            <asp:HiddenField ID="pages" runat="server" />

        var pnlResults = PXFormView1.FindControl("pnlResults") as PXSmartPanel;

        if (pnlResults != null)
        {
            var hidden = pnlResults.FindControl("pages") as HiddenField;
            if (hidden != null)
            {
                hidden.Value = prev.ToString() + "&" + next.ToString();
            }
        }
    }
Ejemplo n.º 5
0
    protected override void Page_Init(object sender, EventArgs e)
    {
        base.Page_Init(sender, e);

        Rate            = PXFormView2.FindControl("Rate") as PXDropDown;
        LblRate         = PXFormView2.FindControl("lblRate") as PXLabel;
        PXKB            = PXFormView1.FindControl("PXKB") as PXLabel;
        PXCategori      = PXFormView1.FindControl("PXCategori") as PXLabel;
        PXProduct       = PXFormView1.FindControl("PXProduct") as PXLabel;
        PXKBName        = PXFormView1.FindControl("PXKBName") as PXLabel;
        PXCreateDate    = PXFormView1.FindControl("PXCreateDate") as PXLabel;
        PXLastPublished = PXFormView1.FindControl("PXLastPublished") as PXLabel;
        PXLastModified  = PXFormView1.FindControl("PXLastModified") as PXLabel;
        PXViews         = PXFormView1.FindControl("PXViews") as PXLabel;
        PXRating        = PXFormView1.FindControl("PXRating") as PXLabel;
        PXImage1        = PXFormView1.FindControl("PXImage1") as PXImage;
        PXImage2        = PXFormView1.FindControl("PXImage2") as PXImage;
        PXImage3        = PXFormView1.FindControl("PXImage3") as PXImage;
        PXImage4        = PXFormView1.FindControl("PXImage4") as PXImage;
        PXImage5        = PXFormView1.FindControl("PXImage5") as PXImage;
        PXdAvRate       = PXFormView1.FindControl("PXdAvRate") as PXLabel;
        UserMessage     = PXFormView3.FindControl("UserMessage") as PXLabel;
        rateid          = Request["rateid"];
        feedbackid      = Request["feedbackid"];
        pageid          = Request["pageid"];

        if (pageid != null)
        {
            Guid currentwikipage = new Guid(pageid);
            if (!String.IsNullOrEmpty(pageid))
            {
                InitHeader(currentwikipage);
            }

            var wiki = (PXResult <WikiPage, WikiDescriptor, WikiRevision>) PXSelectJoin <WikiPage,
                                                                                         InnerJoin <WikiDescriptor, On <WikiDescriptor.pageID, Equal <WikiPage.wikiID> >,
                                                                                                    InnerJoin <WikiRevision, On <WikiRevision.pageID, Equal <WikiPage.pageID> > > >,
                                                                                         Where <WikiPage.pageID, Equal <Required <WikiPage.pageID> > > > .Select(
                new PXGraph(), currentwikipage);

            if (wiki == null)
            {
                HideRateMenu();
            }
            else
            {
                var currentwiki = wiki[typeof(WikiDescriptor)] as WikiDescriptor;
                if (!PXSiteMap.IsPortal || currentwiki == null || currentwiki.SPWikiArticleType != WikiArticleType.KBArticle)
                {
                    HideRateMenu();
                }
                else
                {
                    CreateRateMenu(Rate);
                }
            }
        }
        else
        {
            HideRateMenu();
        }
    }
    protected void Page_Init(object sender, EventArgs e)
    {
        RegisterThisId();

        #region Init Controls
        //Since Controls are placed inside the PXForm we need to manually find them and init the referencing them variables:
        divMessage = PXFormView1.FindControl("divMessage") as Control;
        lblMessage = PXFormView1.FindControl("lblMessage") as Label;
        txtSearch  = PXFormView1.FindControl("txtSearch") as PXTextEdit;
        btnSearch  = PXFormView1.FindControl("btnSearch") as PXButton;
        filterrow  = PXFormView1.FindControl("filterrow") as HtmlTableRow;

        var pnlResults = PXFormView1.FindControl("pnlResults") as PXSmartPanel;
        resultsTable       = pnlResults.FindControl("resultsTable") as HtmlTable;
        lblFullTextWarning = pnlResults.FindControl("lblFullTextWarning") as Label;
        linkPrev           = pnlResults.FindControl("linkPrev") as LinkButton;
        linkNext           = pnlResults.FindControl("linkNext") as LinkButton;

        divTips                   = PXFormView1.FindControl("divTips") as HtmlGenericControl;
        lblSearchTips             = PXFormView1.FindControl("lblSearchTips") as Label;
        liCheckSpelling           = PXFormView1.FindControl("liCheckSpelling") as HtmlGenericControl;
        liSimplifyQuery           = PXFormView1.FindControl("liSimplifyQuery") as HtmlGenericControl;
        liTryOtherWords           = PXFormView1.FindControl("liTryOtherWords") as HtmlGenericControl;
        lblSearchTips.Text        = PXMessages.LocalizeNoPrefix(Messages.SearchTips);
        liCheckSpelling.InnerText = PXMessages.LocalizeNoPrefix(Messages.CheckSpelling);
        liSimplifyQuery.InnerText = PXMessages.LocalizeNoPrefix(Messages.SimplifyQuery);
        liTryOtherWords.InnerText = PXMessages.LocalizeNoPrefix(Messages.TryOtherWords);
        lblActiveModule           = PXFormView1.FindControl("lblActiveModule") as PXLabel;
        btnClearActiveModule      = PXFormView1.FindControl("btnClearActiveModule") as PXButton;
        btnShowList               = PXFormView1.FindControl("btnShowList") as PXButton;
        cellList                  = PXFormView1.FindControl("cellList") as HtmlTableCell;
        filtertable               = PXFormView1.FindControl("filtertable") as HtmlTable;
        #endregion

        lblMessage.Text = PXMessages.LocalizeNoPrefix(Messages.SpecifySearchRequest);

        activeModule = Request.Params["am"];
        Guid am;
        if (Guid.TryParse(activeModule, out am))
        {
            comboBoxLookupList = SearchService.BuildComboList(am);
        }
        else
        {
            comboBoxLookupList = SearchService.BuildComboList(null);
        }

        searchType = comboBoxLookupList[0].Type;

        string query = Request.Params["query"];
        string st    = Request.Params["st"];
        if (!string.IsNullOrEmpty(st))
        {
            Enum.TryParse <SearchService.SearchLookupType>(Request.Params["st"], true, out searchType);
        }

        if (am == Guid.Empty)
        {
            if (searchType == SearchService.SearchLookupType.ActiveModule)
            {
                searchType = SearchService.SearchLookupType.AllEntities;
            }
            else if (searchType == SearchService.SearchLookupType.ActiveWiki)
            {
                searchType = SearchService.SearchLookupType.AllHelp;
            }
        }

        txtSearch.Text = Request.Params["query"];

        if (query == null || string.IsNullOrEmpty(query.Trim()))
        {
            divMessage.Visible = true;
        }
        else
        {
            divMessage.Visible = false;
        }

        if (searchType == SearchService.SearchLookupType.ActiveModule ||
            searchType == SearchService.SearchLookupType.ActiveWiki ||
            searchType == SearchService.SearchLookupType.Files || searchType == SearchService.SearchLookupType.Screen)
        {
            filtertable.Visible  = true;
            lblActiveModule.Text = comboBoxLookupList.Single(a => a.Type.Equals(searchType)).Name;
        }
        else
        {
            filtertable.Visible = false;
        }

        SearchService.SearchLookupType newSt = searchType;
        if (searchType == SearchService.SearchLookupType.ActiveModule || searchType == SearchService.SearchLookupType.Files || searchType == SearchService.SearchLookupType.Screen)
        {
            newSt = SearchService.SearchLookupType.AllEntities;
        }

        if (searchType == SearchService.SearchLookupType.ActiveWiki)
        {
            newSt = SearchService.SearchLookupType.AllHelp;
        }

        UriBuilder urlClear = new UriBuilder(new Uri(HttpContext.Current.Request.GetExternalUrl(), this.ResolveUrl(Request.RawUrl)));
        btnClearActiveModule.NavigateUrl = urlClear.Path + string.Format("?query={0}&am={1}&st={2}", query, activeModule, newSt);

        btnClearActiveModule.RenderAsButton = false;
        btnShowList.RenderAsButton          = false;
        //txtSearch.BorderColor = Color.Transparent;

        foreach (SearchService.SearchLookupItem item in comboBoxLookupList)
        {
            bool addActiveModule = true;
            bool addActiveWiki   = true;
            bool addAllEntity    = true;
            bool addAllHelp      = true;


            if (searchType == SearchService.SearchLookupType.ActiveModule)
            {
                addActiveModule = false;
                addAllEntity    = false;
            }

            if (searchType == SearchService.SearchLookupType.ActiveWiki)
            {
                addActiveWiki = false;
                addAllHelp    = false;
            }

            if (searchType == SearchService.SearchLookupType.AllEntities)
            {
                addAllEntity = false;
            }

            if (searchType == SearchService.SearchLookupType.AllHelp)
            {
                addAllHelp = false;
            }

            //bool addItem = true;

            if (item.Type == SearchService.SearchLookupType.ActiveModule && !addActiveModule)
            {
                continue;
            }
            if (item.Type == SearchService.SearchLookupType.ActiveWiki && !addActiveWiki)
            {
                continue;
            }
            if (item.Type == SearchService.SearchLookupType.AllEntities && !addAllEntity)
            {
                continue;
            }
            if (item.Type == SearchService.SearchLookupType.AllHelp && !addAllHelp)
            {
                continue;
            }

            UriBuilder url         = new UriBuilder(new Uri(HttpContext.Current.Request.GetExternalUrl(), this.ResolveUrl(Request.RawUrl)));
            string     navigateUrl = url.Path + string.Format("?query={0}&am={1}&st={2}", query, activeModule, item.Type);

            //var link = new HyperLink() { CssClass = "comboItem", NavigateUrl = navigateUrl, Text = item.Name };
            //cellList.Controls.Add(link);

            PXButton button = new PXButton();
            button.ApplyStyleSheetSkin(this.Page);
            button.RenderAsButton                        = false;
            button.TextAlign                             = HorizontalAlign.Left;
            button.CssClass                              = "comboItem";
            button.Text                                  = item.Name;
            button.Styles.Hover.Cursor                   = WebCursor.Hand;
            button.NavigateUrl                           = navigateUrl;
            button.AutoCallBack.Command                  = "navigate";
            button.AutoCallBack.Enabled                  = true;
            button.AutoCallBack.Behavior.PostData        = PostDataMode.Container;
            button.AutoCallBack.Behavior.RepaintControls = RepaintMode.All;
            button.AutoCallBack.Behavior.ContainerID     = "PXFormView1";
            button.AutoCallBack.Behavior.BlockPage       = true;
            button.ID = "Button_" + item.Type;
            cellList.Controls.Add(button);
        }
    }