private bool NavHandlerWiki(string args)
    {
        Guid PageID = Guid.Parse(args.Split(':')[1]);

        throw new PXRedirectToUrlException(PXUrl.ToAbsoluteUrl(HttpUtility.UrlPathEncode(string.Format("~/Wiki/ShowWiki.aspx?PageID={0}", PageID)))
                                           , null);
    }
예제 #2
0
        public virtual string BuildSource(string type, string source, Dictionary <string, string> paramMapping)
        {
            if (string.IsNullOrEmpty(type) || string.IsNullOrEmpty(source))
            {
                return(string.Empty);
            }

            StringBuilder url = new StringBuilder();

            if (type == "GI")
            {
                // GI
                url.Append(PXGenericInqGrph.INQUIRY_URL);
                url.Append("?name=").Append(source);
                url.Append("&hidePageTitle=true");
            }
            else
            {
                // Dashboard
                url.Append("~/Frames/Default.aspx");
                url.Append("?scrID=").Append(source); // DB000031
                url.Append("&hidePageTitle=true&HideScript=On");
            }

            foreach (KeyValuePair <string, string> entry in paramMapping)
            {
                url.Append("&").Append(GetParam(entry.Key, entry.Value));
            }

            return(PXUrl.SiteUrlWithPath().TrimEnd('/') +
                   url.ToString().Remove(0, 1));
        }
예제 #3
0
    private void CreateProductMenu(PXGraph graph, PXDropDown dd)
    {
        PXListItem liall = new PXListItem(PXMessages.LocalizeNoPrefix(PX.SM.Messages.SearchProduct));

        dd.Items.Add(liall);
        foreach (PXResult result in PXSelect <SPWikiProduct> .Select(graph))
        {
            SPWikiProduct wc = result[typeof(SPWikiProduct)] as SPWikiProduct;
            PXListItem    li = new PXListItem(wc.Description, wc.ProductID);
            dd.Items.Add(li);
        }

        for (int i = 0; i < dd.Items.Count; i++)
        {
            if (ProductID == dd.Items[i].Value)
            {
                dd.SelectedIndex = i;
            }
        }

        string path = PXUrl.SiteUrlWithPath();

        path += path.EndsWith("/") ? "" : "/";
        var url = string.Format("{0}Search/{1}?query={2}&adv=1",
                                path, this.ResolveClientUrl("~/Search/Wiki.aspx"), txtSearch.Value);

        url = url + "&wikiid=" + WikiID + "&wikinumber=" + WikiNumber + "&categoryID=" +
              CategoryID + "&productID=" + SearchCaptionProduct.Value + "&orderID=" +
              OrderID + "&isWiki=" + IsWiki + "&globalsearchcaption=" + Globalsearchcaption;
    }
예제 #4
0
    private void CreateOrderMenu(PXGraph graph, PXDropDown dd)
    {
        //public const string SearchCategory = "All category";
        PXListItem li1 = new PXListItem("Order by Most Recent", "0");

        dd.Items.Add(li1);
        PXListItem li2 = new PXListItem("Order by Views", "1");

        dd.Items.Add(li2);
        PXListItem li3 = new PXListItem("Order by Rating", "2");

        dd.Items.Add(li3);

        for (int i = 0; i < dd.Items.Count; i++)
        {
            if (OrderID == dd.Items[i].Value)
            {
                dd.SelectedIndex = i;
            }
        }

        string path = PXUrl.SiteUrlWithPath();

        path += path.EndsWith("/") ? "" : "/";
        var url = string.Format("{0}Search/{1}?query={2}&adv=1",
                                path, this.ResolveClientUrl("~/Search/Wiki.aspx"), txtSearch.Value);

        url = url + "&wikiid=" + WikiID + "&wikinumber=" + WikiNumber + "&categoryID=" + CategoryID + "&productID=" +
              ProductID + "&orderID=" + OrderCaption.Value + "&isWiki=" + IsWiki + "&globalsearchcaption=" + Globalsearchcaption;
    }
 protected void Page_Init(object sender, EventArgs e)
 {
     if (!this.IsPostBack)
     {
         PXContext.Session.PageInfo[PXUrl.ToAbsoluteUrl(Request.Path)] = null;
     }
 }
예제 #6
0
    protected void viewer_ReportCreated(object sender, EventArgs e)
    {
        object passed = PXContext.Session.PageInfo[VirtualPathUtility.ToAbsolute(this.Page.Request.Path)];
        PXReportsRedirectList reports = passed as PXReportsRedirectList;

        sessionReportParams.Add(reports == null ? passed : reports[0].Value);

        PXSiteMapProvider provider = SiteMap.Provider as PXSiteMapProvider;

        if (provider != null && reports != null)
        {
            if (reports.SeparateWindows)
            {
                if (reports.Count > 1)
                {
                    KeyValuePair <String, Object> pair;
                    do
                    {
                        reports.RemoveAt(0);
                        pair = reports.First();
                    } while (reports.Count > 1 && String.IsNullOrEmpty(pair.Key));

                    string reportID = pair.Key;
                    if (String.IsNullOrEmpty(reportID))
                    {
                        return;
                    }
                    string url = PXBaseDataSource.getScreenUrl(reportID);
                    if (!String.IsNullOrEmpty(url))
                    {
                        url = PXUrl.ToAbsoluteUrl(url);

                        NextReport           = new KeyValuePair <String, Object>(url, reports);
                        viewer.NextReportUrl = url;
                    }
                }
            }
            else
            {
                foreach (KeyValuePair <string, object> t in reports)
                {
                    string reportID = t.Key;
                    if (string.IsNullOrEmpty(reportID))
                    {
                        continue;
                    }
                    PXSiteMapNode reportNode = provider.FindSiteMapNodeByScreenID(reportID);
                    string        reportName;
                    if (reportNode != null && !string.IsNullOrEmpty(reportName = PXUrl.GetParameter(reportNode.Url, "ID")))
                    {
                        Report report = new Report();
                        report.ReportName = reportName;
                        viewer.Report.SiblingReports.Add(report);
                        sessionReportParams.Add(t.Value);
                    }
                }
            }
        }
    }
예제 #7
0
    protected void GlobalSearchCaption_Change(object sender, PXCallBackEventArgs e)
    {
        if (!string.IsNullOrEmpty(Request.RawUrl))
        {
            string path = PXUrl.SiteUrlWithPath();
            var    url  = "";
            switch (GlobalSearchCaption.SelectedIndex)
            {
            case 0:
                path  = PXUrl.SiteUrlWithPath();
                path += path.EndsWith("/") ? "" : "/";
                url   = string.Format("{0}Search/{1}?query={2}&adv=1",
                                      path, this.ResolveClientUrl("~/Search/Wiki.aspx"), txtSearch.Value);
                url = url + "&wikiid=" + WikiID + "&wikinumber=" + WikiNumber
                      + "&categoryID=" + CategoryID + "&productID=" + ProductID + "&orderID=" + OrderID + "&isWiki=1" + "&globalsearchcaption=" + GlobalSearchCaption.SelectedIndex.ToString();
                throw new Exception("Redirect0:" + url);

            case 1:
                path  = PXUrl.SiteUrlWithPath();
                path += path.EndsWith("/") ? "" : "/";
                url   = string.Format("{0}Search/{1}?query={2}&adv=1",
                                      path, this.ResolveClientUrl("~/Search/Entity.aspx"), txtSearch.Value);
                url = url + "&wikiid=" + WikiID + "&wikinumber=" + WikiNumber
                      + "&categoryID=" + CategoryID + "&productID=" + ProductID + "&orderID=" + OrderID + "&isWiki=0" + "&globalsearchcaption=" + GlobalSearchCaption.SelectedIndex.ToString();
                throw new Exception("Redirect0:" + url);

            case 2:
                path  = PXUrl.SiteUrlWithPath();
                path += path.EndsWith("/") ? "" : "/";
                url   = string.Format("{0}Search/{1}?query={2}&adv=1",
                                      path, this.ResolveClientUrl("~/Search/File.aspx"), txtSearch.Value);
                url = url + "&wikiid=" + WikiID + "&wikinumber=" + WikiNumber
                      + "&categoryID=" + CategoryID + "&productID=" + ProductID + "&orderID=" + OrderID + "&isWiki=0" + "&globalsearchcaption=" + GlobalSearchCaption.SelectedIndex.ToString();
                throw new Exception("Redirect0:" + url);

            case 3:
                path  = PXUrl.SiteUrlWithPath();
                path += path.EndsWith("/") ? "" : "/";
                url   = string.Format("{0}Search/{1}?query={2}&adv=1",
                                      path, this.ResolveClientUrl("~/Search/Note.aspx"), txtSearch.Value);
                url = url + "&wikiid=" + WikiID + "&wikinumber=" + WikiNumber +
                      "&categoryID=" + CategoryID + "&productID=" + ProductID + "&orderID=" + OrderID + "&isWiki=0" + "&globalsearchcaption=" + GlobalSearchCaption.SelectedIndex.ToString();
                throw new Exception("Redirect0:" + url);

            case 4:
                path  = PXUrl.SiteUrlWithPath();
                path += path.EndsWith("/") ? "" : "/";
                url   = string.Format("{0}Search/{1}?query={2}&adv=1",
                                      path, this.ResolveClientUrl("~/Search/FormsTitle.aspx"), txtSearch.Value);
                url = url + "&wikiid=" + WikiID + "&wikinumber=" + WikiNumber +
                      "&categoryID=" + CategoryID + "&productID=" + ProductID + "&orderID=" + OrderID + "&isWiki=0" + "&globalsearchcaption=" + GlobalSearchCaption.SelectedIndex.ToString();
                throw new Exception("Redirect0:" + url);
            }
        }
    }
    protected virtual string BuildUrl(string query, int?page)
    {
        var url = PXUrl.ToAbsoluteUrl(Request.AppRelativeCurrentExecutionFilePath) + "?query=" + HttpUtility.UrlEncode(query) + "&st=" + this.searchType + "&am=" + this.activeModule;

        if (page != null)
        {
            url = url + "&Page=" + page.Value;
        }

        return(url);
    }
예제 #9
0
 protected void OrderCaption_OrderChange(object sender, PXCallBackEventArgs e)
 {
     if (!string.IsNullOrEmpty(Request.RawUrl))
     {
         string path = PXUrl.SiteUrlWithPath();
         path += path.EndsWith("/") ? "" : "/";
         var url = string.Format("{0}Search/{1}?query={2}&adv=1",
                                 path, this.ResolveClientUrl("~/Search/WikiSP.aspx"), txtSearch.Value);
         url = url + "&wikiid=" + WikiID + "&wikinumber=" + WikiNumber + "&categoryID=" + CategoryID + "&productID=" + ProductID + "&orderID=" + OrderCaption.Value;
         throw new Exception("Redirect0:" + url);
     }
 }
    private bool NavHandler(string args)
    {
        Guid noteID = Guid.Parse(args.Split(':')[1]);

        try
        {
            PXEntitySearch search = new PXEntitySearch();
            search.Redirect(noteID);
        }
        catch (PXRedirectRequiredException ex)
        {
            string url = PX.Web.UI.PXDataSource.getMainForm(ex.Graph.GetType());
            if (url != null)
            {
                ex.Graph.Unload();
                PXContext.Session.RedirectGraphType[PXUrl.ToAbsoluteUrl(url)] = ex.Graph.GetType();
                throw new PXRedirectRequiredException(url, ex.Graph, "Redirect0:" + this.ResolveUrl/**/ (url));
            }
        }
        return(false);
    }

    private bool NavHandlerFiles(string args)
    {
        try
        {
            String FileName = args.Split(':')[1];
            WikiFileMaintenance      graph = PXGraph.CreateInstance <WikiFileMaintenance>();
            UploadFileWithIDSelector cur   =
                PXSelect <UploadFileWithIDSelector,
                          Where <UploadFileWithIDSelector.name,
                                 Equal <Required <UploadFileWithIDSelector.name> > > > .Select(graph, HttpUtility.UrlDecode(FileName));

            if (cur != null)
            {
                graph.Files.Current = cur;
            }
            PXRedirectHelper.TryRedirect(graph, PXRedirectHelper.WindowMode.Same);
        }
        catch (PXRedirectRequiredException ex)
        {
            string url = PX.Web.UI.PXDataSource.getMainForm(ex.Graph.GetType());
            if (url != null)
            {
                ex.Graph.Unload();
                PXContext.Session.RedirectGraphType[PXUrl.ToAbsoluteUrl(url)] = ex.Graph.GetType();
                throw new PXRedirectRequiredException(url, ex.Graph, "Redirect0:" + this.ResolveUrl/**/ (url));
            }
        }
        return(false);
    }
        protected virtual void GLConsolSetup_Url_FieldUpdating(PXCache sender, PXFieldUpdatingEventArgs e)
        {
            string value = e.NewValue as string;

            if (!String.IsNullOrEmpty(value))
            {
                string url          = PXUrl.IngoreAllQueryParameters(value);
                string mainPagePath = PXUrl.MainPagePath.TrimStart('~');
                if (url.EndsWith(mainPagePath, StringComparison.OrdinalIgnoreCase))
                {
                    e.NewValue = url.Substring(0, url.Length - mainPagePath.Length);
                }
            }
        }
예제 #12
0
        public void exportAsReport()
        {
            var design = Base.Designs.Current;

            if (design == null)
            {
                return;
            }

            string reportName = _nameRegex.Replace(design.Name ?? "", "");

            if (String.IsNullOrEmpty(reportName))
            {
                reportName = "Report1";
            }

            var report = new Report
            {
                Name      = reportName,
                SchemaUrl = PXUrl.SiteUrlWithPath(),
                Items     =
                {
                    new PageHeaderSection()
                    {
                        Name = "pageHeaderSection1"
                    },
                    new DetailSection()
                    {
                        Name = "detailSection1"
                    },
                    new PageFooterSection()
                    {
                        Name = "pageFooterSection1"
                    }
                }
            };

            var tableByAlias = ConvertTables(report);

            ConvertRelations(report, tableByAlias);
            ConvertParameters(report);
            ConvertFilters(report);
            ConvertGroups(report);
            ConvertSorts(report);

            byte[] data     = SerializeReport(report);
            var    fileInfo = new FileInfo(reportName + ".rpx", null, data);

            throw new PXRedirectToFileException(fileInfo, true);
        }
예제 #13
0
    protected void Page_Load(object sender, EventArgs e)
    {
        if (!PXAccess.FeatureInstalled <FeaturesSet.payrollModule>())
        {
            return;
        }

        PREarningTypeMaint graph = PXGraph.CreateInstance <PREarningTypeMaint>();
        string             url   = PXDataSource.getMainForm(graph.GetType());

        if (url == null)
        {
            return;
        }

        graph.Unload();
        PXContext.Session.RedirectGraphType[PXUrl.ToAbsoluteUrl(url)] = graph.GetType();
        Response.Redirect(this.ResolveUrl(url));
    }
    protected void Page_Load(object sender, EventArgs e)
    {
        var graph = PXGraph.CreateInstance <FileHandler>();

        try
        {
            BoxFolderCache relatedFolder = graph.FoldersByFolderID.Select(Request.QueryString["itemID"]);
            new EntityHelper(graph).NavigateToRow(relatedFolder.RefNoteID, PXRedirectHelper.WindowMode.Same);
        }
        catch (PXRedirectRequiredException ex)
        {
            string url = PXDataSource.getMainForm(ex.Graph.GetType());
            if (url != null)
            {
                ex.Graph.Unload();
                PXContext.Session.RedirectGraphType[PXUrl.ToAbsoluteUrl(url)] = ex.Graph.GetType();
                Response.Redirect(this.ResolveUrl(url));
            }
        }
    }
예제 #15
0
    private void CreateWikiMenu(PXGraph graph, PXDropDown dd)
    {
        PXListItem liall = new PXListItem("Entire Help");

        dd.Items.Add(liall);

        foreach (PXResult result in PXSelect <WikiDescriptor> .Select(graph))
        {
            WikiDescriptor wiki = result[typeof(WikiDescriptor)] as WikiDescriptor;
            if (wiki != null && wiki.PageID != null)
            {
                var node = PXSiteMap.Provider.FindSiteMapNodeFromKey((Guid)wiki.PageID);
                if (node != null)
                {
                    string     title = wiki.WikiTitle ?? node.Title;
                    PXListItem li    = new PXListItem(title, wiki.PageID.ToString());
                    dd.Items.Add(li);
                }
            }
        }
        for (int i = 0; i < dd.Items.Count; i++)
        {
            if (WikiID == dd.Items[i].Value)
            {
                dd.SelectedIndex = i;
            }
        }
        string path = PXUrl.SiteUrlWithPath();
        var    url  = "";

        path  = PXUrl.SiteUrlWithPath();
        path += path.EndsWith("/") ? "" : "/";
        url   = string.Format("{0}Search/{1}?query={2}&adv=1",
                              path, this.ResolveClientUrl("~/Search/Wiki.aspx"), txtSearch.Value);
        url = url + "&wikiid=" + SearchCaption.Value + "&wikinumber=" + SearchCaption.SelectedIndex.ToString() +
              "&categoryID=" + CategoryID + "&productID=" + ProductID + "&orderID=" + OrderID + "&isWiki=1" + "&globalsearchcaption=" + Globalsearchcaption;
    }
예제 #16
0
    //---------------------------------------------------------------------------
    /// <summary>
    /// The page Load event handler.
    /// </summary>
    protected void Page_Load(object sender, EventArgs e)
    {
        var ds = PXPage.GetDefaultDataSource(this.Page);

        if (ds != null && ds.HasActiveContext)
        {
            if (ControlHelper.IsReloadPage(this))
            {
                var ctx = ds.DataGraph.GetContextViewDescriptor();
                if (ctx != null)
                {
                    if (ctx.HeaderValues != null)
                    {
                        screenTitle = string.Join(" - ", ctx.HeaderValues).ToUpper();
                    }
                    if (this.Visible)
                    {
                        var cm = PXCallbackManager.GetInstance();
                        PXCallbackManager.RegisterJavaScript(
                            string.Format("px.elemByID('{0}').innerHTML = '{1}';", LabelScreen.ClientID, screenTitle));
                    }
                }
            }
            else
            {
                screenTitle = " ";
            }
        }

        if (!string.IsNullOrEmpty(screenTitle))
        {
            this.ScreenTitle = HttpUtility.HtmlDecode(screenTitle);
        }
        if (!Page.IsCallback)
        {
            Page.EnableViewState = false;
            RegisterSyncTreeVars();
        }
        if (!this.Visible)
        {
            return;
        }

        Page.ClientScript.RegisterClientScriptBlock(GetType(), "addToFavorites", "var addToFavorites=\"" + PXMessages.Localize(InfoMessages.AddToFavorites) + "\";", true);
        Page.ClientScript.RegisterClientScriptBlock(GetType(), "removeFromFavorites", "var removeFromFavorites=\"" + PXMessages.Localize(InfoMessages.RemoveFromFavorites) + "\";", true);
        if (!this.Page.IsCallback || ControlHelper.IsReloadPage(tlbPath))
        {
            InitHelpMenu();
            RearrangeAuditMenu();
        }

        if (!willShowWelcomePage && this.Request.RawUrl.IndexOf("CS100000.aspx", StringComparison.InvariantCultureIgnoreCase) < 0 &&
            this.Request.RawUrl.IndexOf("/soap/", StringComparison.InvariantCultureIgnoreCase) == -1 &&
            this.Request.RawUrl.IndexOf("/wiki/", StringComparison.InvariantCultureIgnoreCase) == -1)
        {
            if (!PXAccess.FeatureSetInstalled("PX.Objects.CS.FeaturesSet"))
            {
                PXSiteMapNode cs = PXSiteMap.Provider.FindSiteMapNodeByScreenID("CS100000");
                if (cs != null)
                {
                    string navigateUrl = ResolveUrl(cs.Url);
                    if (!Page.IsCallback)
                    {
                        Response.Redirect(navigateUrl);
                    }
                }
            }
        }

        string localPath = Request.Url.LocalPath;

        if (!PXUrl.IsMainPage(Request.RawUrl) && !Request.Url.Query.Contains("PopupPanel=On"))
        {
            if (!localPath.EndsWith("Default.aspx"))
            {
                string lastUrl = (string)PXContext.Session["LastUrl"];
                if (String.IsNullOrEmpty(lastUrl) || lastUrl.EndsWith("Default.aspx"))
                {
                    Controls.Add(new LiteralControl("<script  type=\"text/javascript\">try { window.top.lastUrl=null; } catch (ex) {}</script>\n"));
                }
            }
            PXContext.Session.SetString("LastUrl", Request.RawUrl);
        }

        if (!Page.IsPostBack && !String.IsNullOrEmpty(ScreenID))
        {
            PX.Data.PXAuditJournal.Register(ScreenID);
        }

        if (!string.IsNullOrEmpty(screenTitle))
        {
            string relPath = ResolveUrl(Request.RawUrl);
            string url     = ResolveUrl(Request.RawUrl);
            LabelScreen.HRef = (Page != null && Page.GetType().Name == "wiki_showwiki_aspx") ? PXSessionStateStore.GetSessionUrl(HttpContext.Current, url) : url;

            if (PXSiteMap.CurrentNode != null && PXList.Provider.HasList(PXSiteMap.CurrentNode.ScreenID))
            {
                string        listScreenID = PXList.Provider.GetListID(PXSiteMap.CurrentNode.ScreenID);
                PXSiteMapNode listNode     = PXSiteMap.Provider.FindSiteMapNodeByScreenID(listScreenID);
                if (listNode != null)
                {
                    LabelScreen.HRef         = ResolveUrl(listNode.Url);
                    LabelScreen.ServerClick += (o, args) =>
                    {
                        PXList.Provider.SetCurrentSearches(PXSiteMap.CurrentNode.ScreenID, null);
                        Response.Redirect(ControlHelper.FixHideScriptUrl(PXPageCache.FixPageUrl(ResolveUrl(listNode.Url)), false));
                    };
                }
            }
            if (screenUrl != null)
            {
                LabelScreen.HRef = screenUrl;
            }

            this.ScreenTitle = screenTitle;
        }

        if (!Page.IsCallback)
        {
            Page.ClientScript.RegisterClientScriptBlock(GetType(), "toolbarNum", "var __toolbarID=\"" + this.tlbTools.ClientID + "\";", true);
        }
        if (ControlHelper.IsReloadPage(this))
        {
            SharedColumnSettings.SaveGrids();
        }
    }
예제 #17
0
    protected void Page_Load(object sender, EventArgs e)
    {
        ds.PrepareScreen();

        PXGenericInqGrph genGraph = (PXGenericInqGrph)ds.DataGraph;

        if (genGraph.Design != null)
        {
            // Check access rights - they are handled by SiteMapProvider by URL
            // but GI can be opened by using different URLs (by ID and by Name)
            if (!PXGraph.ProxyIsActive && !PXGraph.GeneratorIsActive && this.Context != null)
            {
                string nodeUrl = PXUrl.IgnoreSystemParameters(PXUrl.ToRelativeUrl(this.Request.Url.ToString()));
                var    node    = PXSiteMap.Provider.FindSiteMapNodeUnsecure(nodeUrl);

                if (node == null || !node.IsAccessibleToUser(this.Context))
                {
                    // If there is no access to the GI itself or it is not in site map,
                    // consider it as a "Preview" mode in the GI designer and check access rights for the GI designer itself
                    var designerNode = PXSiteMap.Provider.FindSiteMapNodeByGraphType(typeof(PX.Data.Maintenance.GI.GenericInquiryDesigner).FullName);

                    if (designerNode == null)
                    {
                        Redirector.SmartRedirect(HttpContext.Current, PXUrl.MainPagePath);
                        return;
                    }
                }
            }

            if (genGraph.Design.PrimaryScreenID != null && PXList.Provider.IsList(genGraph.Design.PrimaryScreenID))
            {
                PXContext.Session.SetString(LastEntryScreenSessionKey, genGraph.Design.PrimaryScreenID);
            }

            // Clear saved searches in case if parameters changed
            if (genGraph.Design.DesignID != null && PXGenericInqGrph.ParametersChanged[genGraph.Design.DesignID.Value])
            {
                ds.SavedSearchesClear(true);
                PXGenericInqGrph.ParametersChanged[genGraph.Design.DesignID.Value] = false;
            }
        }
        else         // GI configuration with defined ID/Name does not exist in this company (for example, when changing company)
        {
            string screenID = PXContext.Session[LastEntryScreenSessionKey] as string;
            PXContext.Session.SetString("LastUrl", null);             // clear last url to prevent loading GI page again (Main page loads LastUrl when there is no ScreenID)
            string redirectUrl = PXUrl.MainPagePath;
            if (!String.IsNullOrEmpty(screenID))
            {
                redirectUrl += "?ScreenID=" + screenID;
            }
            Redirector.SmartRedirect(HttpContext.Current, redirectUrl);
        }
        PXContext.SetSlot <Guid?>("__GEN_INQ_DESIGN_ID__", genGraph.Design.DesignID);
        var phF = this.FindControl("cont2");

        if (!form.Visible)
        {
            //grid.GridStyles.ToolsCell.CssClass += " transparent";
            form.Parent.Parent.Visible = false;
        }
    }
    protected virtual void Page_LoadComplete(object sender, EventArgs e)
    {
        string noteID = Request.Params["navigate"];

        if (!string.IsNullOrEmpty(noteID))
        {
            try
            {
                PXEntitySearch search = new PXEntitySearch();
                search.Redirect(Guid.Parse(noteID));
            }
            catch (PXRedirectRequiredException ex)
            {
                string url = PX.Web.UI.PXDataSource.getMainForm(ex.Graph.GetType());
                if (url != null)
                {
                    ex.Graph.Unload();
                    PXContext.Session.RedirectGraphType[PXUrl.ToAbsoluteUrl(url)] = ex.Graph.GetType();
                    Response.Redirect(this.ResolveUrl/**/ (url));
                    //throw new PXRedirectRequiredException(url, ex.Graph, "Redirect0:" + this.ResolveUrl/**/(url));
                }
            }
        }

        string fileName = Request.Params["file"];

        if (!string.IsNullOrEmpty(fileName))
        {
            try
            {
                WikiFileMaintenance      graph = PXGraph.CreateInstance <WikiFileMaintenance>();
                UploadFileWithIDSelector cur   =
                    PXSelect <UploadFileWithIDSelector,
                              Where <UploadFileWithIDSelector.name,
                                     Equal <Required <UploadFileWithIDSelector.name> > > > .Select(graph, HttpUtility.UrlDecode(fileName));

                if (cur != null)
                {
                    graph.Files.Current = cur;
                }
                PXRedirectHelper.TryRedirect(graph, PXRedirectHelper.WindowMode.Same);
            }
            catch (PXRedirectRequiredException ex)
            {
                string url = PX.Web.UI.PXDataSource.getMainForm(ex.Graph.GetType());
                if (url != null)
                {
                    ex.Graph.Unload();
                    PXContext.Session.RedirectGraphType[PXUrl.ToAbsoluteUrl(url)] = ex.Graph.GetType();
                    Response.Redirect(this.ResolveUrl/**/ (url));
                    //throw new PXRedirectRequiredException(url, ex.Graph, "Redirect0:" + this.ResolveUrl/**/(url));
                }
            }
        }
        //if (Page.IsPostBack && !Page.IsCallback)
        //	AcceptInput();

        //int page = 0;
        //int.TryParse(Request.Params["page"], out page);
        string query = TrimLongString(txtSearch.Text);

        switch (searchType)
        {
        case SearchService.SearchLookupType.ActiveModule:
        case SearchService.SearchLookupType.AllEntities:
            if (PerformSearchEntity(query, pageIndex))
            {
                divMessage.Visible = false;
            }
            break;

        case SearchService.SearchLookupType.ActiveWiki:
        case SearchService.SearchLookupType.AllHelp:
            if (PerformSearchArticle(query, pageIndex))
            {
                divMessage.Visible = false;
            }
            break;

        case SearchService.SearchLookupType.Files:
            if (PerformSearchFile(query, pageIndex))
            {
                divMessage.Visible = false;
            }
            break;
        }
    }
예제 #19
0
    private void CreateGlobalSearchCaption(PXGraph graph, PXDropDown dd)
    {
        PXListItem liWikis = new PXListItem("Help");

        dd.Items.Add(liWikis);

        PXListItem liEntities = new PXListItem("Entities");

        dd.Items.Add(liEntities);

        PXListItem liFiles = new PXListItem("Files");

        dd.Items.Add(liFiles);

        PXListItem liNotes = new PXListItem("Notes");

        dd.Items.Add(liNotes);

        PXListItem liScreens = new PXListItem("Form Titles");

        dd.Items.Add(liScreens);

        Int32 select;

        Int32.TryParse(Globalsearchcaption, out select);
        dd.SelectedIndex = select;

        string path = PXUrl.SiteUrlWithPath();
        var    url  = "";

        switch (dd.SelectedIndex)
        {
        case 0:
            path  = PXUrl.SiteUrlWithPath();
            path += path.EndsWith("/") ? "" : "/";
            url   = string.Format("{0}Search/{1}?query={2}&adv=1",
                                  path, this.ResolveClientUrl("~/Search/Wiki.aspx"), txtSearch.Value);
            url = url + "&wikiid=" + WikiID + "&wikinumber=" + WikiNumber
                  + "&categoryID=" + CategoryID + "&productID=" + ProductID + "&orderID=" + OrderID + "&isWiki=1" + "&globalsearchcaption=" + dd.SelectedIndex.ToString();
            break;

        case 1:
            path  = PXUrl.SiteUrlWithPath();
            path += path.EndsWith("/") ? "" : "/";
            url   = string.Format("{0}Search/{1}?query={2}&adv=1",
                                  path, this.ResolveClientUrl("~/Search/Entity.aspx"), txtSearch.Value);
            url = url + "&wikiid=" + WikiID + "&wikinumber=" + WikiNumber
                  + "&categoryID=" + CategoryID + "&productID=" + ProductID + "&orderID=" + OrderID + "&isWiki=0" + "&globalsearchcaption=" + dd.SelectedIndex.ToString();
            break;

        case 2:
            path  = PXUrl.SiteUrlWithPath();
            path += path.EndsWith("/") ? "" : "/";
            url   = string.Format("{0}Search/{1}?query={2}&adv=1",
                                  path, this.ResolveClientUrl("~/Search/File.aspx"), txtSearch.Value);
            url = url + "&wikiid=" + WikiID + "&wikinumber=" + WikiNumber
                  + "&categoryID=" + CategoryID + "&productID=" + ProductID + "&orderID=" + OrderID + "&isWiki=0" + "&globalsearchcaption=" + dd.SelectedIndex.ToString();
            break;

        case 3:
            path  = PXUrl.SiteUrlWithPath();
            path += path.EndsWith("/") ? "" : "/";
            url   = string.Format("{0}Search/{1}?query={2}&adv=1",
                                  path, this.ResolveClientUrl("~/Search/Note.aspx"), txtSearch.Value);
            url = url + "&wikiid=" + WikiID + "&wikinumber=" + WikiNumber +
                  "&categoryID=" + CategoryID + "&productID=" + ProductID + "&orderID=" + OrderID + "&isWiki=0" + "&globalsearchcaption=" + dd.SelectedIndex.ToString();
            break;

        case 4:
            path  = PXUrl.SiteUrlWithPath();
            path += path.EndsWith("/") ? "" : "/";
            url   = string.Format("{0}Search/{1}?query={2}&adv=1",
                                  path, this.ResolveClientUrl("~/Search/FormsTitle.aspx"), txtSearch.Value);
            url = url + "&wikiid=" + WikiID + "&wikinumber=" + WikiNumber +
                  "&categoryID=" + CategoryID + "&productID=" + ProductID + "&orderID=" + OrderID + "&isWiki=0" + "&globalsearchcaption=" + dd.SelectedIndex.ToString();
            break;
        }
    }
예제 #20
0
        static void Main(string[] args)
        {
            Console.WriteLine("Hello World!");
            //ClassRun cr = new ClassRun();
            //cr.run().Wait();

            //YouGet youGet = new YouGet(null);
            //youGet.Run();
            //Console.ReadKey();

            //var con = new PXActionContext
            //{
            //    Url = "https://www.bilibili.com/video/av15530330",
            //    WorkingDictory = "bilibili",
            //    FilenamePrefix = "av15530330"
            //};

            //Console.WriteLine(">>>WebpageSnapshot");
            //IPXAction webpageSnapshot = new Snapshot(con);
            //webpageSnapshot.OnStatusChange += WebpageSnapshot_OnStatusChange;
            //webpageSnapshot.Run().Wait();
            //Console.WriteLine(">>>YouGet");
            //IPXAction youGet = new YouGet(con);
            //youGet.OnStatusChange += WebpageSnapshot_OnStatusChange;
            //youGet.Run().Wait();

            //RSS rSS = new RSS(new Trigger.PXTriggerContext
            //{
            //    Id = "niubi"
            //});
            //rSS.Start();
            //Console.Read();

            //ILocalStorage configs = new LocalStorageRealFile("test.json");
            //ILocalStorage localStorage1 = new LocalStorage("snapshot-1", configs);
            //ILocalStorage localStorage2 = new LocalStorage("snapshot-2", configs);
            //ILocalStorage local22 = new LocalStorage("2-2", localStorage2);
            ////localStorage1.Set("1-key", "1-value");
            ////localStorage1.Set("1-key-2", "1-value-2");
            ////localStorage1.Set("1-key-3", "");
            ////localStorage1.Set("1-key-4", null);
            ////localStorage1.Set("1-object", new testclass());
            ////localStorage2.Set("2-key", "2-value");
            ////local22.Set("22-key", "22-value");
            //Console.WriteLine(localStorage1.Get("1-key"));
            //Console.WriteLine(localStorage2.Get("2-key"));
            //Console.WriteLine(localStorage1.Get<testclass>("1-object"));
            //Console.WriteLine(local22.Get("22-key"));

            //ILocalStorage localStorage1 = new LocalStorage("snapshot-1.json", realFile);
            //localStorage1.Set("1-key", "1-value");
            //localStorage1.Set("1-key-2", "1-value-2");
            //localStorage1.Set("1-object", new { a = 1, b = 2 });

            //PXColleMaster pm = new PXColleMaster();
            //pm.Start();
            //PXTriggerContext context = new PXTriggerContext
            //{
            //    Id = "nb",
            //    Key = "test"
            //};
            //pm.AddTrigger(context);
            //pm.TriggerM.Start("nb");
            //Console.Read();

            var a = new PXNodeType
            {
                Key       = "123",
                Templates = new Dictionary <string, string>
                {
                    { "homepages", "url[]" },
                    { "realname", "string" }
                },
                CreatedAt = new DateTimeOffset(2020, 5, 14, 0, 0, 0, TimeSpan.Zero)
            };

            var b = new PXNodeType
            {
                Key       = "456",
                Templates = new Dictionary <string, string>
                {
                    { "homepages", "url[]" },
                    { "realname", "string" }
                }
            };

            var aa = new List <PXNodeType>();

            aa.Add(a);
            aa.Add(b);

            var url3 = new PXUrl
            {
                Id       = "1-3",
                Name     = "https://www.instagram.com/mafumafu_ig",
                Connects = new Dictionary <string, string>
                {
                    { "1", "prop.homepages" }
                }
            };

            //var serializer = new YamlDotNet.Serialization.Serializer();
            //serializer.Serialize(Console.Out, aa);

            PXNode c = a;
            PXNode d = new PXNode();

            Console.WriteLine(c.Get());
            Console.WriteLine(d.Get());

            Console.ReadKey();
        }
예제 #21
0
    protected void Rate_PageRate(object sender, EventArgs e)
    {
        Filltables();
        Guid currentwikipage = new Guid(pageid);

        PXGraph article = PXGraph.CreateInstance(typeof(KBArticleMaint));

        PXCache response        = article.Caches[typeof(KBResponse)];
        PXCache responsesummary = article.Caches[typeof(KBResponseSummary)];

        PXResult <WikiPage, WikiPageLanguage, WikiRevision> result = (PXResult <WikiPage, WikiPageLanguage, WikiRevision>) PXSelectJoin
                                                                     <WikiPage,
                                                                      InnerJoin <WikiPageLanguage, On <WikiPageLanguage.pageID, Equal <WikiPage.pageID> >,
                                                                                 InnerJoin <WikiRevision, On <WikiRevision.pageID, Equal <WikiPage.pageID> > > >,
                                                                      Where <WikiPage.pageID, Equal <Required <WikiPage.pageID> > >,
                                                                      OrderBy <Desc <WikiRevision.pageRevisionID> > > .SelectWindowed(new PXGraph(), 0, 1, currentwikipage);

        Guid userId = PXAccess.GetUserID();
        PXResult <KBResponseSummary> resultsummary = (PXResult <KBResponseSummary>) PXSelect <KBResponseSummary, Where <KBResponseSummary.pageID, Equal <Required <KBResponseSummary.pageID> > > >
                                                     .SelectWindowed(article, 0, 1, currentwikipage);

        PXResult <KBResponse> resnonse = (PXResult <KBResponse>) PXSelect <KBResponse,
                                                                           Where <KBResponse.userID, Equal <Required <KBResponse.userID> >,
                                                                                  And <KBResponse.pageID, Equal <Required <KBResponse.pageID> > > > > .SelectWindowed(article, 0, 1, userId, currentwikipage);

        if (result != null)
        {
            WikiPage         wp  = result[typeof(WikiPage)] as WikiPage;
            WikiPageLanguage wpl = result[typeof(WikiPageLanguage)] as WikiPageLanguage;

            KBResponseSummary kbrs        = responsesummary.CreateInstance() as KBResponseSummary;
            KBResponse        newresnonse = response.CreateInstance() as KBResponse;

            if (resultsummary != null)
            {
                kbrs = resultsummary[typeof(KBResponseSummary)] as KBResponseSummary;
            }

            if (resnonse != null)
            {
                newresnonse = resnonse[typeof(KBResponse)] as KBResponse;
                if (wp != null && wpl != null && newresnonse.NewMark != null)
                {
                    if (newresnonse.OldMark != 0)
                    {
                        kbrs.Marksummary = kbrs.Marksummary - newresnonse.OldMark;
                        kbrs.Marksummary = kbrs.Marksummary + newresnonse.NewMark;
                    }
                    else
                    {
                        kbrs.Markcount   = kbrs.Markcount + 1;
                        kbrs.Marksummary = kbrs.Marksummary + newresnonse.NewMark;
                    }

                    int    AvRate      = (int)((int)kbrs.Marksummary / (int)kbrs.Markcount);
                    Int32  Marksummary = (int)kbrs.Marksummary;
                    Int32  Markcount   = (int)kbrs.Markcount;
                    double dAvRate     = (double)Marksummary / (double)Markcount;
                    kbrs.AvRate = dAvRate;

                    responsesummary.Update(kbrs);
                    responsesummary.PersistUpdated(kbrs);
                    responsesummary.Clear();


                    newresnonse.PageID                 = currentwikipage;
                    newresnonse.RevisionID             = 1;
                    newresnonse.OldMark                = newresnonse.NewMark;
                    newresnonse.Date                   = PXTimeZoneInfo.Now;
                    newresnonse.Summary                = "";
                    newresnonse.CreatedByID            = wp.CreatedByID;
                    newresnonse.CreatedByScreenID      = "WP00000";
                    newresnonse.CreatedDateTime        = wp.CreatedDateTime;
                    newresnonse.LastModifiedByID       = wp.LastModifiedByID;
                    newresnonse.LastModifiedByScreenID = "WP00000";
                    newresnonse.LastModifiedDateTime   = wp.LastModifiedDateTime;

                    response.Update(newresnonse);
                    response.PersistUpdated(newresnonse);
                    response.Clear();
                }
            }

            else
            {
                if (wp != null && wpl != null && newresnonse.NewMark != null)
                {
                    newresnonse.PageID                 = currentwikipage;
                    newresnonse.RevisionID             = 1;
                    newresnonse.OldMark                = newresnonse.NewMark;
                    newresnonse.Date                   = PXTimeZoneInfo.Now;
                    newresnonse.UserID                 = userId;
                    newresnonse.Summary                = "";
                    newresnonse.CreatedByID            = wp.CreatedByID;
                    newresnonse.CreatedByScreenID      = "WP00000";
                    newresnonse.CreatedDateTime        = wp.CreatedDateTime;
                    newresnonse.LastModifiedByID       = wp.LastModifiedByID;
                    newresnonse.LastModifiedByScreenID = "WP00000";
                    newresnonse.LastModifiedDateTime   = wp.LastModifiedDateTime;

                    if (kbrs == null || kbrs.PageID == null)
                    {
                        kbrs.PageID                 = currentwikipage;
                        kbrs.CreatedByID            = wp.CreatedByID;
                        kbrs.CreatedByScreenID      = "WP00000";
                        kbrs.CreatedDateTime        = wp.CreatedDateTime;
                        kbrs.LastModifiedByID       = wp.LastModifiedByID;
                        kbrs.LastModifiedByScreenID = "WP00000";
                        kbrs.LastModifiedDateTime   = wp.LastModifiedDateTime;
                        kbrs.Markcount              = 1;
                        kbrs.Marksummary            = newresnonse.NewMark;

                        int    AvRate      = (int)((int)kbrs.Marksummary / (int)kbrs.Markcount);
                        Int32  Marksummary = (int)kbrs.Marksummary;
                        Int32  Markcount   = (int)kbrs.Markcount;
                        double dAvRate     = (double)Marksummary / (double)Markcount;
                        kbrs.AvRate = dAvRate;

                        responsesummary.Insert(kbrs);
                        responsesummary.PersistInserted(kbrs);
                        responsesummary.Clear();
                    }
                    else
                    {
                        kbrs.Markcount   = kbrs.Markcount + 1;
                        kbrs.Marksummary = kbrs.Marksummary + newresnonse.NewMark;
                        responsesummary.Update(kbrs);
                        responsesummary.PersistUpdated(kbrs);
                        responsesummary.Clear();
                    }
                    response.Insert(newresnonse);
                    response.PersistInserted(newresnonse);
                    response.Clear();
                }
            }

            string path = PXUrl.SiteUrlWithPath();
            path += path.EndsWith("/") ? "" : "/";
            var url = string.Format("{0}Wiki/{1}?pageid={2}",
                                    path, this.ResolveClientUrl("~/Wiki/ShowWiki.aspx"), pageid);
            url = url + "&rateid=" + Rate.Value;
            throw new Exception("Redirect0:" + url);
        }
    }
    protected void viewer_ReportCreated(object sender, EventArgs e)
    {
        object passed = PXContext.Session.PageInfo[VirtualPathUtility.ToAbsolute(this.Page.Request.Path)];

        if (passed == null)
        {
            object passedByRawUrl = PXContext.Session.PageInfo[VirtualPathUtility.ToAbsolute(this.Page.Request.RawUrl)];
            var    pars           = passedByRawUrl as Dictionary <string, string>;
            if (pars != null)
            {
                string autoexport;
                if (pars.TryGetValue(ReportLauncherHelper._AUTO_EXPORT_PDF, out autoexport) &&
                    autoexport == "true")
                {
                    viewer.AutoExportPDF = true;
                    pars.Remove(ReportLauncherHelper._AUTO_EXPORT_PDF);
                }
                passed = new Dictionary <string, string>(pars);
            }
            else
            {
                passed = passedByRawUrl;
            }
        }
        PXReportsRedirectList reports = passed as PXReportsRedirectList;

        sessionReportParams.Add(reports == null ? passed : reports[0].Value);

        PXSiteMapProvider provider = SiteMap.Provider as PXSiteMapProvider;

        if (provider != null && reports != null)
        {
            if (reports.SeparateWindows)
            {
                if (reports.Count > 1)
                {
                    KeyValuePair <String, Object> pair;
                    do
                    {
                        reports.RemoveAt(0);
                        pair = reports.First();
                    } while (reports.Count > 1 && String.IsNullOrEmpty(pair.Key));

                    string reportID = pair.Key;
                    if (String.IsNullOrEmpty(reportID))
                    {
                        return;
                    }
                    string url = PXBaseDataSource.getScreenUrl(reportID);
                    if (!String.IsNullOrEmpty(url))
                    {
                        url = PXUrl.ToAbsoluteUrl(url) + "&preserveSession=true";

                        NextReport           = new KeyValuePair <String, Object>(url, reports);
                        viewer.NextReportUrl = url;
                    }
                }
            }
            else
            {
                foreach (KeyValuePair <string, object> t in reports)
                {
                    string reportID = t.Key;
                    if (string.IsNullOrEmpty(reportID))
                    {
                        continue;
                    }
                    PXSiteMapNode reportNode = provider.FindSiteMapNodeByScreenID(reportID);
                    string        reportName;
                    if (reportNode != null && !string.IsNullOrEmpty(reportName = PXUrl.GetParameter(reportNode.Url, "ID")))
                    {
                        Report report = new Report();
                        report.ReportName = reportName;
                        viewer.Report.SiblingReports.Add(report);
                        sessionReportParams.Add(t.Value);
                    }
                }
            }
        }
    }