From 12722d1df3c688e2bac071b3f585b92844f307c9 Mon Sep 17 00:00:00 2001 From: Alexey Verkhovsky Date: Sun, 23 Jan 2005 19:14:45 +0000 Subject: [PATCH] Cleaning up edit_web.rhtml; extracted all the JavaScript to a static file --- app/views/wiki/edit_web.rhtml | 125 +++++++----------- public/javascripts/.java_script_files_go_here | 0 public/javascripts/edit_web.js | 48 +++++++ 3 files changed, 96 insertions(+), 77 deletions(-) delete mode 100755 public/javascripts/.java_script_files_go_here create mode 100644 public/javascripts/edit_web.js diff --git a/app/views/wiki/edit_web.rhtml b/app/views/wiki/edit_web.rhtml index 0477233f..b26619b3 100755 --- a/app/views/wiki/edit_web.rhtml +++ b/app/views/wiki/edit_web.rhtml @@ -3,73 +3,91 @@

Name and address

- The name of the web is included in the title on all pages. The address is the base path that all pages within the web live beneath. + The name of the web is included in the title on all pages. + The address is the base path that all pages within the web live beneath. Ex: the address "rails" gives URLs like /rails/show/HomePage.
- Name:    - Address: + Name:    + Address: (Letters and digits only)

Specialize

Turning safe mode on will strip HTML tags and stylesheet options from the content of all pages. - Turning on "brackets only" will require all wiki words to be as [[wiki word]] and WikiWord won't work. - Additions to the stylesheet take precedence over the existing styles. Hint: View source on a page you want to - style to find ID names on individual tags. See styles >> + Turning on "brackets only" will require all wiki words to be as [[wiki word]] and WikiWord + won't work. + Additions to the stylesheet take precedence over the existing styles. + Hint: View source on a page you want to style to find ID names on individual tags. + + See styles >> +
Markup:    Color:    - > Safe mode + /> Safe mode    - > Brackets only + /> + Brackets only    - > Count pages + /> Count pages - +

Password protection for this web (<%= @web.name %>)

- This is the password that visitors need to view and edit this web. Setting the password to nothing will remove the password protection. + This is the password that visitors need to view and edit this web. + Setting the password to nothing will remove the password protection.
- Password:    - Verify: + Password: +    + Verify:

Publish read-only version of this web (<%= @web.name %>)

- You can turn on a read-only version of this web that's accessible even when the regular web is password protected. + You can turn on a read-only version of this web that's accessible even when the regular web + is password protected. The published version is accessible through URLs like /wiki/published/HomePage.
- > Publish this web + /> Publish this web

Enter system password - + and - +

...or forget changes and create a new web
@@ -81,62 +99,15 @@

Other administrative tasks

+

+ + Clean up by entering system password + + and + + +

+
-

- - Clean up by entering system password - - and - - -

- - + diff --git a/public/javascripts/.java_script_files_go_here b/public/javascripts/.java_script_files_go_here deleted file mode 100755 index e69de29b..00000000 diff --git a/public/javascripts/edit_web.js b/public/javascripts/edit_web.js new file mode 100644 index 00000000..d9dbe7a9 --- /dev/null +++ b/public/javascripts/edit_web.js @@ -0,0 +1,48 @@ +function proposeAddress() { + document.getElementById('address').value = + document.getElementById('name').value.replace(/[^a-zA-Z0-9]/g, "").toLowerCase(); +} + +function cleanAddress() { + document.getElementById('address').value = + document.getElementById('address').value.replace(/[^a-zA-Z0-9]/g, "").toLowerCase(); +} + +function validateSetup() { + if (document.getElementById('system_password').value == "") { + alert("You must enter the system password"); + return false; + } + + if (document.getElementById('name').value == "") { + alert("You must pick a name for the web"); + return false; + } + + if (document.getElementById('address').value == "") { + alert("You must pick an address for the web"); + return false; + } + + if (document.getElementById('password').value != "" && + document.getElementById('password').value != document.getElementById('password_check').value) { + alert("The password and its verification doesn't match"); + return false; + } + + return true; +} + +// overriding auto-complete by form managers +// code by Chris Holland, lifted from +// http://chrisholland.blogspot.com/2004/11/banks-protect-privacy-disable.html +function overrideAutocomplete() { + if (document.getElementsByTagName) { + var inputElements = document.getElementsByTagName("input"); + for (i=0; inputElements[i]; i++) { + if (inputElements[i].className && (inputElements[i].className.indexOf("disableAutoComplete") != -1)) { + inputElements[i].setAttribute("autocomplete","off"); + }//if current input element has the disableAutoComplete class set. + }//loop thru input elements + } +}