EgonDev

November 29, 2007

OpsWeb Tour Part 2: Articles

Filed under: OpsWeb — Tags: — egoncasteel @ 12:54 pm

This is the second part of my tour of OpsWeb. In part 1 of my tour I showed you the Alerts module. This time I will show you the heart of the site the Article module.

The Article module is used to store, organize, manage, and share information used by the IS department. There are currently over 400 articles on OpswWeb. All of the articles are categorized, indexed and fully search able.  Articles on the site range from quick FAQ type articles to procedures on how to complete a task, and full documentation on different parts of the system.

One of the best feature of the Articles is the way it saves the articles. Each time a change is committed a diff of the old article and the revision is made and saved before the article is updated. So any past versions of the article can be seen and restored if needed.

November 8, 2007

On page links for each letter.

Filed under: What I Did Today — Tags: , — egoncasteel @ 3:35 pm

I did a bit of work on Opsweb yesterday that was neat. I have a page that list our security codes, and it was requested that there be links along the top for each letter going to that area of the list. Well there are a couple problems with that.

  • You can get the first letter of a list item really easy, but if you just stuck that in an anchor tag it would be messy even if it did work.
  • If you go looking for the next letter what happens if your list doesn’t include an item starting with that letter?

here is what I added to my class:

	public function alpha_anchor($title){
		$letter = strtoupper(substr($title, 0, 1));
		$search_result = array_search($letter, $this->alpha);
		if (!($search_result === false)){
			array_splice($this->alpha, $search_result, 1);
			return "<a name='$letter'/>";
		}
		return;
	}

public final  function __construct() {
	$this->alpha = explode(' ','A B C D E F G H I J K L M N O P Q R S T U V W X Y Z');

So when looping through the array returned from your DB query you run each title through the alpha_anchor method and only the first title of each letter gets an anchor tag.

Blog at WordPress.com.