FindPageByUrlpath() публичный статический Метод

public static FindPageByUrlpath ( string urlpath ) : Page
urlpath string
Результат Wiki.Page
Пример #1
0
    Wiki.Page Save()
    {
        // Get the slashes correct and trim it
        txtPath.Text = txtPath.Text.Replace('\\', '/').Trim();
        // Ensure they start with a slash
        if (!txtPath.Text.StartsWith("/"))
        {
            txtPath.Text = "/" + txtPath.Text;
        }

        // Ensure its a unique name
        String path       = txtPath.Text;
        string newurlpath = Wiki.Page.PathToUrlPath(path);

        // Are they renaming it? If so, check for dupes
        if (urlpath.ToLower() != newurlpath.ToLower())
        {
            int uniqCount = 2;
            while (DbServices.PageExistsWithUrlpath(newurlpath))
            {
                path       = txtPath.Text + " " + uniqCount.ToString();
                newurlpath = Wiki.Page.PathToUrlPath(path);
                uniqCount++;
            }
        }

        Wiki.Page page = DbServices.FindPageByUrlpath(urlpath);
        page.path     = path;
        page.contents = txtRichEditor.Text.Trim();
        page.author   = Auth.UserName;
        page.Save();

        return(page);
    }
Пример #2
0
 protected void Page_Load(object sender, EventArgs e)
 {
     Wiki.Page page = DbServices.FindPageByUrlpath(Util.PathFromUrl);
     if (page != null)
     {
         litHeader.Text     = NiceName(page.path);
         litContents.Text   = page.contents;
         hlEdit.NavigateUrl = "edit.aspx?" + page.urlpath;
     }
     else
     {
         litHeader.Text   = "Page not found";
         litContents.Text = "Page not found";
         hlEdit.Visible   = false;
     }
 }
Пример #3
0
    protected void Page_Load(object sender, EventArgs e)
    {
        Auth.OnlyAdminAllowed();

        urlpath = Util.PathFromUrl;

        if (!IsPostBack)
        {
            Wiki.Page page = DbServices.FindPageByUrlpath(urlpath);
            litHeader.Text       = page.path;
            txtPath.Text         = page.path;
            txtRichEditor.Text   = page.contents;
            hlCancel.NavigateUrl = "./?" + urlpath;

            // If it's the home page, don't allow them to change the path or remove it
            if (urlpath == "/")
            {
                txtPath.Enabled  = false;
                bnDelete.Enabled = false;
            }
        }
    }