Ejemplo n.º 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);
    }
Ejemplo n.º 2
0
    protected void bnSave_Click(object sender, EventArgs e)
    {
        // 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 urlpath = Wiki.Page.PathToUrlPath(path);
        int uniqCount=2;
        while (DbServices.PageExistsWithUrlpath(urlpath)) {
          path = txtPath.Text + " " + uniqCount.ToString();
          urlpath = Wiki.Page.PathToUrlPath(path);
          uniqCount++;
        }

        // Save it
        Wiki.Page page = new Wiki.Page();
        page.path = path;
        page.contents = txtRichEditor.Text.Trim();
        page.author = Auth.UserName;
        page.Save();
        Response.Redirect("./?" + page.urlpath);
    }
Ejemplo n.º 3
0
    protected void bnSave_Click(object sender, EventArgs e)
    {
        // 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 urlpath   = Wiki.Page.PathToUrlPath(path);
        int    uniqCount = 2;

        while (DbServices.PageExistsWithUrlpath(urlpath))
        {
            path    = txtPath.Text + " " + uniqCount.ToString();
            urlpath = Wiki.Page.PathToUrlPath(path);
            uniqCount++;
        }

        // Save it
        Wiki.Page page = new Wiki.Page();
        page.path     = path;
        page.contents = txtRichEditor.Text.Trim();
        page.author   = Auth.UserName;
        page.Save();
        Response.Redirect("./?" + page.urlpath);
    }
Ejemplo n.º 4
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;
     }
 }
Ejemplo n.º 5
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;
            }
        }
    }
Ejemplo n.º 6
0
 protected void bnSaveClose_Click(object sender, EventArgs e)
 {
     Wiki.Page page = Save();
     Response.Redirect("./?" + page.urlpath);
 }