Table of Contents
- Welcome to CWS Web Tutorials
- How to Set Up and Access My Account
- How to Make a Web Form
- Using CWS Tools
- Single-Sign-On (SSO) Library
1. Welcome to CWS Web Tutorials
The tutorials are designed with general information to help you with your websites. Some of the information provided in the tutorials address specific details about tools used on the Central Web Server. Our goal is to help you gain a quick understanding of the methods and processes to complete your tasks quickly and effectively. If you need additional information please contact IS Computer Consulting
2. How to Set Up and Access My Account
To work on this system you should use File Transfer or Secure Shell to connect to the file server access.cws.oregonstate.edu where the web server accesses the files it needs for the Web.
[NOTE:] This is not the ONID system. However, this system uses the ONID system to authenticate your access, give you access to your authorized site and your ONID directory.
The files are commonly placed on the server by the following file transfer methods: FTP (File Transfer Protocol), SFTP (Secure File Transfer Protocol), SSH (Secure Shell protocol), or SCP (Secure Copy Protocol). You use these protocols to move content from a local computer to the remote server and vice versa. This method also allows you to maintain a backup copy of your site locally, for working up new versions and for archival purposes.
If you are using FTP and get a message that your password has expired (or receive an error 530) then you will need to update your password. Instructions for changing your password are provided in the ONID system.
Log in to access.cws.oregonstate.edu to work on your site and change to the directory where your site is located. Initially, you arrive in your ONID account directory.
You must change to your site's working directory to post your pages and changes. The directory path will be something like:
- /www/httpd-docs/dept/... (for department accounts),
- /www/httpd-docs/instruct/... (for course accounts), or
- /www/httpd-docs/groups/... (for group accounts).
- /www/virtual/... (for virtual hosted sites).
You should have received an e-mail detailing your path and some of these directions when you received access to work on the site. That directory path is where you put your web files. Web pages will be available directly from the web without any extra changes. (Some new web editors have made a public_html directory in the site - please do not. Those directories are only used for personal web accounts on the ONID system and are not necessary for the sites within the main server.)
Your main home page should be named index.htm or index.html or index.cfm or index.php by convention. The home page file name must also be in all lower case letters. If a directory is called, and a file name was not specified, the system first looks for index.htm by default. If that file is not found it then looks for the other known alternatives. If none of these files are found then your visitor will receive an error message.
3. How to Make a Web Form
A great way to learn how to create forms is to practice writing simple forms and to examine a variety of examples available on the Internet. We provide annotated links to HTML forms' tutorial sites.
- 3.1 Basic Forms
- HTML forms are not too difficult to create. If you already have knowledge of HTML, then writing your own form will take only a few short minutes. The following sites provide a basic understanding of HTML forms, with step by step examples:
- HTML Form: Basic Concept:provides basic concept of HTML form and examples of each form tag and field
- HTML Form Tutorials: provides an introduction, examples, and step by step explanation of how to create each form tag and form field
- HTML Form Tag Tutorials: provides explanation and examples of form tags
- Guide to HTML forms: provides an overview and example
- 3.2 HTML Editors
- HTML editors come in two flavors: text editors and "What You See Is What You Get (WYSIWYG)" editors. Your choice of editor will be influenced by what you want to do. HTML editors range in price from free to several hundred dollars.
With WYSIWYG HTML editors, each editor has its own strengths and weaknesses. Here are some thoughts on popular ones:
- Macromedia Dreamweaver MX (30 days free trial)
Dreamweaver's seamless design allows you to easily insert multimedia content and create dramatic effects using dynamic HTML. It also takes some of the guesswork out of web page creation by telling you which effects work with Netscape Navigator and which work with Internet Explorer. This latest iteration of Dreamweaver adds many options for advanced users, such as integrating XML and building ColdFusion database structures.- Microsoft FrontPage (30 days free trial)
Microsoft's new version of its familiar editor offers the easy functionality of the Microsoft office interaface with a few new features. As a result of the new Publishing feature, the FrontPage Wizard makes creating web pages as easy as picking choices from a menu. For example, an image editor within the program allows simple adjustments without necessitating opening another program.
- 3.3 Validation Services
- Before publishing your work, we recommend you to validate your HTML files through a free service like the W3C Markup Validation Service. These services will tell you if your code conforms to the W3C Recommendations and other standards. If you are not sure your coding conforms to HTML specifications, this can be a useful teaching tool.
- 3.4 Accessibility
- An accessible web site is a site that can be accessed by everyone including people with disabilities like hearing and vision impairments. People with disabilities most often surf the web using assistive technologies like screen readers and braille displays. The links listed below provide excellent guidelines on how to make web pages accessible:
- 3.5 OSU Logos
- To implement high resolution images of the official OSU logos for publications and the web, please read rules and guidelines from University Publications's Graphic ID page.
- 3.6 Making a Hit Counter
- Page hit counters are available to anyone who has web pages delivered by either the ONID file server (with shell.onid.orst.edu) or the Central Web file server (with access.cws.oregonstate.edu) including any and all specially hosted addresses. Please read instructions on how to implement a hit counter and examples.
4. Using CWS Tools
- 4.1 Campus Map
- The Campus Map is a tool intended to give an interactive map of the OSU campus. The most basic of these features are those that show the positions of buildings, streets, and the respective names or abreviations across campus. It also provides the user with the ability to create a link for a custom map. This link can be used with web sites, in e-mails, or even for advertizing and event location. To create a map link, open up the campus map, modify it the way you woult like the link to appear, then click the "Link" button on the top.
- 4.2 Survey Tool
- The OSU Survey Tool empowers the OSU community with the ability to create, manage and collect custom surveys through the web. It also provides result reporting and multiple export options. You can also find survey tips which provides information on how to find a survey you are looking for, how to take a survey, and contact information. To create a survey, you will need to login with your ONID account. Once you login, you will find survey creation help.
- 4.3 Email Tools
- Before we implement an Email tool, we first must understand a different between mailto and formmail. A mailto tool is an attribute in anchor tag, <a>, that allows an user to email directly from a WWW browser to a particular email address or multiple email addresses. On the other hand, formmail is a generalised cgi script written in perl that allows the creation of forms sending form information to a specified email address.
-
- WebMailer: get a fixed link for an e-mail address.
- OSU Web E-mail Form: search and e-mail someone at OSU.
- 4.4 Search Tool
- The following is an example form you may add to your site. Visitors to your site may use this form to conduct searches directly from your site. These searches may be for all of OSU or for your site only.
- 4.4.1 Insert Search Tool Script
-
<form method="get" action="http://search.oregonstate.edu/web"> <input type="text" name="query" size="15" maxlength="256" /> <input type="checkbox" name="site" value="yoursite.edu/directoryname" checked="checked" />Search this site only. <input type="submit" value="Go" title="Search OSU." /> </form>
- 4.4.2 Limiting the search to your site
- The "site" checkbox tells the search engine which site to limit its search to. To limit the search to your site only, the value of the "site" checkbox should be your site address (without the http://). In the example it is oregonstate.edu/cws, which limits the search to the CWS site. If all you want is an OSU-wide search, erase this line to do a normal search.
- 4.4.3 Minimum requirements for this form
-
- your site must be currently indexed by our search engine
- form action must be action="http://search.oregonstate.edu/web/"
- form method must be method="get"
- a text input named "query"
- a submit button
- 4.4.4 Writing Search Syntax
- Our search tool uses Apache's Lucene information retrieval toolkit to index and search entries. Listed below are common search techniques Lucene offers, along with notes about how it is being used here. For a complete list of seach techniques, please read Lucene's general search syntax.
Type Examples Notes Booleans (flower OR animal) AND human "AND" and "OR" must be in all caps; use parenthesis for precedence; default multi-token search (e.g. "roky erickson") will OR all tokens Required values +LTjason +employee
+employee -danial'+' before term is like "AND", '-' before term is like "NOT" Phrases "pure choice" [vs.]
pure choiceRanges date:20050105-20050520
5. Single-Sign-On (SSO) Library
The SSO Library is a high level library written in PHP by CWS which provides convenient ONID SSO authentication and session management functionality. Developed primarily for websites hosted by CWS, this library is highly configurable and easy to integrate into new or existing websites.
- 5.1 What is ONID Single-Sign-On (SSO)?
- ONID Single-Sign-On (SSO) allows a user to authenticate to a web page once using their ONID credentials. After the user is authenticated, they can go to any other participating ONID SSO web site and gain access without entering their ONID credentials again. ONID SSO does NOT provide authorization. If different levels of access are desired, then an SSO enabled application must implement some type of permission management. Read more about ONID SSO.
- 5.2 SSO Library Features
-
- No need to use low-level ONID SSO xml-rpc methods directly
- Highly configurable - easily enable SSO authentication for all or only parts of your web site
- Provides transparent session management across multiple CWS web servers
- Works with non CWS hosted sites (ONID SSO only supports oregonstate.edu domains)
- 5.3 Using the SSO Library in Your Application
- To use the SSO Library, you must:
- Signup and register your site with ONID SSO following these instructions
- Download the SSO Library, sso.tar.gz
- Extract the library files and place the sso folder in your web directory
- Edit the sso/sso.php file and change the $sso_site_config variable to suit your needs
Listed below are four basic example configurations. We also provide API documentation for advanced configuration.
-
- 5.3.1 Authentication without session handling
- Edit $sso_site_config as follows:
$sso_site_config = array( 'sso_service' => 'enter your service name here', 'sso_password' => 'enter your service password here', 'logout_redirect' => '1'. 'sess_enable' => '0' );
- At the top of all your site's files before any output has been sent to the browser, you must include this line of code:
include_once('sso/sso.php'); - Your logout page, logout.php, should look like this:
include_once('sso.php'); sso_logout(); - 5.3.2 Session handling with no authentication
- Edit $sso_site_config as follows: (do not specify a service name and password)
$sso_site_config = array( 'sess_enable' => '1', // database information (optional, for use with MySQL) 'db_username' => 'enter your database username here', 'db_password' => 'enter your database password here', 'db_name' => 'enter your database name here', );
- At the top of all your site's files before any output has been sent to the browser, you must include this line of code:
include_once('sso/sso.php'); // Session has now been started - you can now use $_SESSION as usual // For example $count = $_SESSION['my_counter']; $count++; $_SESSION['my_counter'] = $count; - 5.3.3 Authentication with session handling for authenticated users only
- Edit $sso_site_config as follows:
$sso_site_config = array( 'sso_service' => 'enter your service name here', 'sso_password' => 'enter your service password here', 'logout_redirect' => '1', 'sess_enable' => '1' // database information (optional, for use with MySQL) 'db_username' => 'enter your database username here', 'db_password' => 'enter your database password here', 'db_name' => 'enter your database name here', );
- At the top of all your site's files before any output has been sent to the browser, you must include this line of code:
include_once('sso/sso.php'); // If you are authenticated, session is now started // you should now have access to userinfo in the $_SESSION, here's an example echo "User name: ".$_SESSION['sso']['username']; echo "OSU uid: ".$_SESSION['ldap']['osuuid']; - Your logout page, logout.php, should look like this:
include_once('sso.php'); sso_logout(); - 5.3.4 Authentication with session handling for authenticated and non-authenticated users
- Edit $sso_site_config as follows:
$sso_site_config = array( 'sso_service' => 'enter your service name here', 'sso_password' => 'enter your service password here', 'logout_redirect' => '0', 'sess_enable' => '1', 'sess_cookie' => 'enter any cookie name here except sso' // database information (optional, for use with MySQL) 'db_username' => 'enter your database username here', 'db_password' => 'enter your database password here', 'db_name' => 'enter your database name here', );
- At the top of all your site's files before any output has been sent to the browser, you must include these lines of code:
include_once('sso/sso.php'); // start session for everybody sso_session_check(); // authenticate - but will not redirect to login page if (sso_authenticate(false)) { // you're now authenticated. sso_session_fill_userinfo(); echo "Welcome ".$_SESSION['sso']['username'] } // at this point, do more calls to sso_authenticate(false) as needed to // differentiate between anonymous and authenticated access - Your logout page, logout.php, should look like this:
include_once('sso.php'); sso_logout(false);

