Posted By

tprimke on 07/01/10


Tagged

newLISPwiki


Versions (?)

Rename request handler


 / Published in: Lisp
 

  1. ;; request to rename a page
  2. (if (CGI:get "rename")
  3. (if (CGI:get "continue")
  4. (letn ( page-old (CGI:get "rename")
  5. page-old-filename (replace " " (dup page-old 1) "_")
  6. page-new (CGI:get "new")
  7. page-new-filename (replace " " (dup page-new 1) "_") )
  8. (if (= (length (trim page-new)) 0)
  9. (let ( body (append {<p>You haven't entered any new name for the page } page-old {.</p>}
  10. {<p>Try again on <a href="index.cgi?rename=} page-old
  11. {">rename page</a>, go to }
  12. {<a href="index.cgi?page=} page-old-filename {">} page-old {</a>, or }
  13. {get back to <a href="index.cgi">Home</a>.</p>} ) )
  14. (set 'body body)
  15. (set 'page-name "Rename")
  16. (CGI:put-page SETUP:template)
  17. (exit))
  18. (begin
  19. (change-refs page-old page-new)
  20. (rename-file (append "pages/" page-old-filename) (append "pages/" page-new-filename))
  21. (display-page "Home")
  22. (exit))))
  23. (letn ( page-name (CGI:get "rename")
  24. bdy (append {<p>You can rename the page } page-name {.</p>}
  25. {<form action="index.cgi" method="post">}
  26. {<input type="hidden" name="rename" value="} page-name {" />}
  27. {<input type="hidden" name="continue" value="" />}
  28. {<p>New page name: <input type="text" name="new" /></p>}
  29. {<p>Do you really want to rename the page ?&nbsp;}
  30. {<input type="submit" name="submit" class="button" value="Yes" /></p>}
  31. {</form>}
  32. {<p>You can cancel this action and get back to <a href="index.cgi">Home</a>.</p>}) )
  33. (set 'body bdy)
  34. (set 'page-name "Rename")
  35. (CGI:put-page SETUP:template)
  36. (exit))))

Report this snippet  

You need to login to post a comment.