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);
        }
    }
示例#2
0
    private Control GenerateFilesLinkPanel()
    {
        PXSmartPanel result = new PXSmartPanel();

        result.ID                   = "filesLinkPanel";
        result.Key                  = "FilesLink";
        result.AllowResize          = false;
        result.AutoCallBack.Enabled = true;
        result.AutoCallBack.Command = "Refresh";
        result.AutoCallBack.Target  = "form";
        result.Style[HtmlTextWriterStyle.Position] = "absolute";
        result.Style[HtmlTextWriterStyle.Left]     = Unit.Pixel(250).ToString();
        result.Style[HtmlTextWriterStyle.Top]      = Unit.Pixel(250).ToString();
        result.Width  = Unit.Pixel(400);
        result.Height = Unit.Pixel(150);

        PXFormView form = new PXFormView();

        form.ID            = "form";
        form.Caption       = "WebDAV Links for the list of files";
        form.AllowCollapse = false;
        form.DataSourceID  = "ds";
        form.DataMember    = "FilesLink";
        form.Style[HtmlTextWriterStyle.Position] = "absolute";
        form.Style[HtmlTextWriterStyle.Left]     = Unit.Pixel(9).ToString();
        form.Style[HtmlTextWriterStyle.Top]      = Unit.Pixel(9).ToString();
        form.Width  = Unit.Pixel(363);
        form.Height = Unit.Pixel(100);

        PXLabel extLabel = new PXLabel("External Link");

        extLabel.ID = "lblExt";
        extLabel.Style[HtmlTextWriterStyle.Position] = "absolute";
        extLabel.Style[HtmlTextWriterStyle.Left]     = Unit.Pixel(9).ToString();
        extLabel.Style[HtmlTextWriterStyle.Top]      = Unit.Pixel(9).ToString();
        extLabel.ApplyStyleSheetSkin(Page);
        form.TemplateContainer.Controls.Add(extLabel);
        PXTextEdit extEdit = new PXTextEdit();

        extEdit.ID        = "edExt";
        extEdit.LabelID   = "lblExt";
        extEdit.DataField = "InternalPath";
        extEdit.ReadOnly  = true;
        extEdit.Style[HtmlTextWriterStyle.Position] = "absolute";
        extEdit.Style[HtmlTextWriterStyle.Left]     = Unit.Pixel(81).ToString();
        extEdit.Style[HtmlTextWriterStyle.Top]      = Unit.Pixel(9).ToString();
        extEdit.Width = Unit.Pixel(250);
        extEdit.ApplyStyleSheetSkin(Page);
        form.TemplateContainer.Controls.Add(extEdit);

        PXLabel pubLabel = new PXLabel("Public Link");

        pubLabel.ID = "lblPub";
        pubLabel.Style[HtmlTextWriterStyle.Position] = "absolute";
        pubLabel.Style[HtmlTextWriterStyle.Left]     = Unit.Pixel(9).ToString();
        pubLabel.Style[HtmlTextWriterStyle.Top]      = Unit.Pixel(36).ToString();
        pubLabel.ApplyStyleSheetSkin(Page);
        form.TemplateContainer.Controls.Add(pubLabel);
        PXTextEdit pubEdit = new PXTextEdit();

        pubEdit.ID        = "edPub";
        pubEdit.LabelID   = "lblPub";
        pubEdit.DataField = "ExternalPath";
        pubEdit.ReadOnly  = true;
        pubEdit.Style[HtmlTextWriterStyle.Position] = "absolute";
        pubEdit.Style[HtmlTextWriterStyle.Left]     = Unit.Pixel(81).ToString();
        pubEdit.Style[HtmlTextWriterStyle.Top]      = Unit.Pixel(36).ToString();
        pubEdit.Width = Unit.Pixel(250);
        pubEdit.ApplyStyleSheetSkin(Page);
        form.TemplateContainer.Controls.Add(pubEdit);

        PXButton closeButton = new PXButton();

        closeButton.Text         = "Close";
        closeButton.DialogResult = WebDialogResult.Cancel;
        closeButton.Style[HtmlTextWriterStyle.Position] = "absolute";
        closeButton.Style[HtmlTextWriterStyle.Left]     = Unit.Pixel(247).ToString();
        closeButton.Style[HtmlTextWriterStyle.Top]      = Unit.Pixel(63).ToString();
        closeButton.Width = Unit.Pixel(90);
        closeButton.ApplyStyleSheetSkin(Page);
        form.TemplateContainer.Controls.Add(closeButton);

        form.ApplyStyleSheetSkin(Page);

        result.Controls.Add(form);
        return(result);
    }
示例#3
0
	private Control GenerateFilesLinkPanel()
	{
		PXSmartPanel result = new PXSmartPanel();
		result.ID = "filesLinkPanel";
		result.Key = "FilesLink";
		result.AllowResize = false;
		result.AutoCallBack.Enabled = true;
		result.AutoCallBack.Command = "Refresh";
		result.AutoCallBack.Target = "form";
		result.Style[HtmlTextWriterStyle.Position] = "absolute";
		result.Style[HtmlTextWriterStyle.Left] = Unit.Pixel(250).ToString();
		result.Style[HtmlTextWriterStyle.Top] = Unit.Pixel(250).ToString();
		result.Width = Unit.Pixel(400);
		result.Height = Unit.Pixel(150);

		PXFormView form = new PXFormView();
		form.ID = "form";
		form.Caption = "WebDAV Links for the list of files";
		form.AllowCollapse = false;
		form.DataSourceID = "ds";
		form.DataMember = "FilesLink";
		form.Style[HtmlTextWriterStyle.Position] = "absolute";
		form.Style[HtmlTextWriterStyle.Left] = Unit.Pixel(9).ToString();
		form.Style[HtmlTextWriterStyle.Top] = Unit.Pixel(9).ToString();
		form.Width = Unit.Pixel(363);
		form.Height = Unit.Pixel(100);

		PXLabel extLabel = new PXLabel("External Link");
		extLabel.ID = "lblExt";
		extLabel.Style[HtmlTextWriterStyle.Position] = "absolute";
		extLabel.Style[HtmlTextWriterStyle.Left] = Unit.Pixel(9).ToString();
		extLabel.Style[HtmlTextWriterStyle.Top] = Unit.Pixel(9).ToString();
		extLabel.ApplyStyleSheetSkin(Page);
		form.TemplateContainer.Controls.Add(extLabel);
		PXTextEdit extEdit = new PXTextEdit();
		extEdit.ID = "edExt";
		extEdit.LabelID = "lblExt";
		extEdit.DataField = "InternalPath";
		extEdit.ReadOnly = true;
		extEdit.Style[HtmlTextWriterStyle.Position] = "absolute";
		extEdit.Style[HtmlTextWriterStyle.Left] = Unit.Pixel(81).ToString();
		extEdit.Style[HtmlTextWriterStyle.Top] = Unit.Pixel(9).ToString();
		extEdit.Width = Unit.Pixel(250);
		extEdit.ApplyStyleSheetSkin(Page);
		form.TemplateContainer.Controls.Add(extEdit);

		PXLabel pubLabel = new PXLabel("Public Link");
		pubLabel.ID = "lblPub";
		pubLabel.Style[HtmlTextWriterStyle.Position] = "absolute";
		pubLabel.Style[HtmlTextWriterStyle.Left] = Unit.Pixel(9).ToString();
		pubLabel.Style[HtmlTextWriterStyle.Top] = Unit.Pixel(36).ToString();
		pubLabel.ApplyStyleSheetSkin(Page);
		form.TemplateContainer.Controls.Add(pubLabel);
		PXTextEdit pubEdit = new PXTextEdit();
		pubEdit.ID = "edPub";
		pubEdit.LabelID = "lblPub";
		pubEdit.DataField = "ExternalPath";
		pubEdit.ReadOnly = true;
		pubEdit.Style[HtmlTextWriterStyle.Position] = "absolute";
		pubEdit.Style[HtmlTextWriterStyle.Left] = Unit.Pixel(81).ToString();
		pubEdit.Style[HtmlTextWriterStyle.Top] = Unit.Pixel(36).ToString();
		pubEdit.Width = Unit.Pixel(250);
		pubEdit.ApplyStyleSheetSkin(Page);
		form.TemplateContainer.Controls.Add(pubEdit);

		PXButton closeButton = new PXButton();
		closeButton.Text = "Close";
		closeButton.DialogResult = WebDialogResult.Cancel;
		closeButton.Style[HtmlTextWriterStyle.Position] = "absolute";
		closeButton.Style[HtmlTextWriterStyle.Left] = Unit.Pixel(247).ToString();
		closeButton.Style[HtmlTextWriterStyle.Top] = Unit.Pixel(63).ToString();
		closeButton.Width = Unit.Pixel(90);
		closeButton.ApplyStyleSheetSkin(Page);
		form.TemplateContainer.Controls.Add(closeButton);

		form.ApplyStyleSheetSkin(Page);

		result.Controls.Add(form);
		return result;
	}