Web Content Management Systems

Czech Technical University, Prague Faculty of Electrical Engineering Bachelor Thesis Web Content Management Systems V´ıt R˚ uˇziˇcka ˇ Supervisor: ...
Author: Isaac Pope
0 downloads 2 Views 769KB Size
Czech Technical University, Prague Faculty of Electrical Engineering

Bachelor Thesis

Web Content Management Systems V´ıt R˚ uˇziˇcka

ˇ Supervisor: Ing. Jiˇr´ı Skvor

Study Program: Computer Science and Engineering Study Branch: Computer Science and Engineering July 2008

ii

Declaration

I hereby declare that I have completed this bachelor thesis independently and that I have listed all the literature and publications used. I have no objection to usage of this work in compliance with the act §60 Zakona c. 121/2000Sb. (copyright law), and with the rights connected with the copyright act including the changes in the act.

Prague, July 10, 2008

.............................................................

iii

iv

Acknowledgement ˇ I would like to thank to Ing. Jiˇr´ı Skvor for helping me with the thesis and to my family and friends for support.

v

vi

Abstract This thesis provides an overview of web content management systems. The work focuses on Drupal and its modules, in particular ones dealing with content, user control and triggers. The result of this work is a research of CMS, especially Drupal and an implementation of some of it’s modules for Department of Computer science and Engineering on CTU.

Abstrakt Tato bakal´aˇrsk´a pr´ace se zab´ yv´a pˇrehledem webov´ ych redakˇcn´ıch syst´em˚ u. Pr´ace se ˇ soustˇreduje na Drupal a jeho moduly, obzvl´aˇstˇe na ty kter´e se zab´ yvaj´ı obsahem, kontrolou uˇzivatel˚ u a spouˇstˇeˇci. V´ ysledek t´eto pr´ace je reˇserˇse redakˇcn´ıch syst´em˚ u, obzvl´aˇsˇt ˇ Drupalu a implementace nˇekter´ ych jeho modul˚ u pro Katedru poˇc´ıtaˇc˚ u na CVUT.

vii

viii

Contents List of Figures

xiii

1 Introduction

1

1.1

What is CMS? . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .

1

1.2

Assignment Analysis . . . . . . . . . . . . . . . . . . . . . . . . . . . . .

1

1.2.1

1

Data Sources . . . . . . . . . . . . . . . . . . . . . . . . . . . . .

2 Choosing CMS

3

2.1

Requirements . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .

3

2.2

Analysis . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .

3

2.2.1

Joomla! . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .

3

2.2.2

WordPress . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .

4

2.2.3

MODx . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .

5

2.2.4

Moodle

. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .

5

2.2.5

CMS Made Simple . . . . . . . . . . . . . . . . . . . . . . . . . .

6

2.2.6

Comparison table . . . . . . . . . . . . . . . . . . . . . . . . . . .

6

3 Drupal

7

3.1

Drupal’s mission statement . . . . . . . . . . . . . . . . . . . . . . . . . .

7

3.2

Why Drupal . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .

7

3.3

About Drupal . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .

8

3.4

How Drupal works . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .

9

4 Drupal modules

11

4.1

Modules . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .

11

4.2

CCK and Views . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .

11

4.3

Actions and Triggers . . . . . . . . . . . . . . . . . . . . . . . . . . . . .

12

4.4

Users modules . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .

13

ix

5 Module creation 5.1

5.2

5.3

15

Writing a module . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .

15

5.1.1

hook node info . . . . . . . . . . . . . . . . . . . . . . . . . . . .

16

5.1.2

hook perm . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .

16

5.1.3

hook access . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .

17

5.1.4

hook form . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .

17

Understanding users . . . . . . . . . . . . . . . . . . . . . . . . . . . . .

18

5.2.1

The $User Object . . . . . . . . . . . . . . . . . . . . . . . . . . .

18

5.2.2

Login testing . . . . . . . . . . . . . . . . . . . . . . . . . . . . .

19

5.2.3

hook user() . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .

19

5.2.4

External login . . . . . . . . . . . . . . . . . . . . . . . . . . . . .

19

KP user authentication module . . . . . . . . . . . . . . . . . . . . . . .

20

6 Implementation 6.1

6.2

6.3

23

CCK and Views . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .

23

6.1.1

Understanding nodes . . . . . . . . . . . . . . . . . . . . . . . . .

23

6.1.2

CCK . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .

23

6.1.3

Views . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .

26

Actions and Triggers . . . . . . . . . . . . . . . . . . . . . . . . . . . . .

27

6.2.1

Actions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .

28

6.2.2

Triggers . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .

28

Other Modules and Themes . . . . . . . . . . . . . . . . . . . . . . . . .

30

6.3.1

Modules . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .

30

6.3.2

Themes . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .

30

7 Usability

33

7.1

Executive summary . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .

33

7.2

Results and Reccomentations . . . . . . . . . . . . . . . . . . . . . . . .

33

7.2.1

Creating content . . . . . . . . . . . . . . . . . . . . . . . . . . .

33

7.2.2

Posting and Managing content . . . . . . . . . . . . . . . . . . . .

34

7.2.3

Creating navigation . . . . . . . . . . . . . . . . . . . . . . . . . .

34

7.2.4

User management . . . . . . . . . . . . . . . . . . . . . . . . . . .

34

7.2.5

Post test . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .

35

7.2.6

Usability Conclusion . . . . . . . . . . . . . . . . . . . . . . . . .

35

8 Conclusion

37 x

A Content of the Enclosed CD and User Manual A.1 Content of the enclosed CD . . . . . . . . . . . . . . . . . . . . . . . . . B Acronyms

41 41 42

xi

xii

List of Figures 3.1

Drupal’s technology stack. [VW07] . . . . . . . . . . . . . . . . . . . . .

3.2

Enabling additional modules give more functionality. [VW07]

5.1

External user authentication. [VW07]

6.1

Node types are derived from the basic node and may add fields. [VW07]

24

6.2

Input form for creating a new content type

. . . . . . . . . . . . . . . .

25

6.3

Input form for adding a new field . . . . . . . . . . . . . . . . . . . . . .

26

6.4

Adding the content Software in classrooms . . . . . . . . . . . . . . . . .

26

6.5

Fields in Software in classrooms content type . . . . . . . . . . . . . . .

27

6.6

Form for adding new view . . . . . . . . . . . . . . . . . . . . . . . . . .

27

6.7

Administrator interface of the Views module . . . . . . . . . . . . . . . .

28

6.8

Menu - classrooms - software in the clicked classroom . . . . . . . . . . .

29

6.9

All of the actions listed . . . . . . . . . . . . . . . . . . . . . . . . . . . .

29

6.10 Selecting the action for the trigger . . . . . . . . . . . . . . . . . . . . . .

29

7.1

35

. . . . . .

10

. . . . . . . . . . . . . . . . . . .

22

Test given to participants after the experiment [BS08]

xiii

9

. . . . . . . . . .

xiv

Chapter 1 Introduction 1.1

What is CMS?

CMS is an acronym which stands for Content Management System. A CMS is a tool that enables a variety of (centralised) technical and (decentralised) non technical staff to create, edit, manage and finally publish (in a number of formats) a variety of content (such as text, graphics, video, documents etc), whilst being constrained by a centralised set of rules, process and workflows that ensure coherent, validated electronic content. [Wil08]

1.2

Assignment Analysis

The Computer Science and Engineering Department has been using a content management system called INFO336 for years now. The system was written from a scratch by ˇ Ing. Jiˇr´ı Skvor and it’s grown considerably since it’s creation. There have been some problems with modularity and expansion of the system lately. That’s why it was decided that new CMS should be looked for, one which would satisfy all of the requirements.

1.2.1

Data Sources

The current database which is running on PostgreSQL holds information about all the users, their roles and usergroups. There are courses, timetables. Data are also regularly exported from udb.feld and KOS. It should be possible for all these information to be transfered to the new system.

1

2

CHAPTER 1. INTRODUCTION

Chapter 2 Choosing CMS In this chapter we will discuss the requirements that the CSE Department needs from the system. We will also analyze different content management systems and see if they meet our requirements.

2.1

Requirements

The requirements for the new CMS were clearly described in the assignment. The CMS has to be open source and it has to be based on PHP, which also means that there will be a MySQL or PostgreSQL database. The chosen CMS has to be customizable and modular. The users must be easy to manage and the roles and access privileges must be easy to set. The system must have a good interface for searching. The system must be a full replacement for the INFO336 system, which contained user information for students and employees, their work loads and study, research and administrative groups. It comprised of information about student’s thesis, it allowed news publishing, bulk e-mails to different groups and contained a list of topics for the thesis. It also included a list of classrooms, their equipment and a timetable.

2.2

Analysis

In this section we will analyze five other widely used CMS’s other then Drupal, we will focus on Drupal later on in this work. We will review pros and cons of each system and we will decide if they meet the requirements that we laid out earlier. We will also look into module creation processes for the following CMS.

2.2.1

Joomla!

Joomla! is, like Drupal, a cutting edge in content management. It has a big and active community of developers and users and has been well-tested and is extensible. Joomla! has object oriented, pattern based API, which is well organised into logical framework packages, allowing the developers to use best practises and allows good ex3

4

CHAPTER 2. CHOOSING CMS

tensibility. Among the new features of 1.5 version is MVC (Model-view-controller) which allows a clear separation between logic and presentation. That means good maintainability and reusability of the code. Developers can hook into nearly any part of the application using the event system. There are five types of extensions for Joomla!: • Components - add custom functions to your site that can be selected from menus • Modules - data already exists and you just want a new way to present it on your site • Plugins - data, content, or custom functions replace information in articles or functions extend core features • Templates - define the look, feel, and navigation capabilities of your site • Languages - define additional languages for your site [tea08d] Modules are made out of four basic file types: • Main entry point file - .php, it performs initialization routines, call helper routines and include the template. • Information file - .xml, it contains configuration parameters and contains all the files that need to be installed by Joomla! installer. • Helper file - .php, it contains information about the module and its usage. • Module template - .php, it will collect data from Main entry point file and generate HTML displayed on the page. Module development in Joomla! is a fairly simple, straightforward process. Joomla! also allows a very good user control, thus satisfying all the requirements and would be a good choice for the CSE department.

2.2.2

WordPress

WordPress is a semantic publishing platform, which excels in blogging, but is completely customizable and can be used for anything. WordPress is semantic because it generates XHTML markup with meaning. It produces web pages that work without any style applied, work correctly with screen readers used by blind people, and validate by conforming to published web standards. [RTDS06] Customizations for WordPress are called Plugins. They are written in PHP scripting language and can be integrated to the core using access points and methods provided by the WordPress API. Hooks are places in the program which can be changed by programmer input.

2.2. ANALYSIS

5

An example is the ’action’ hook called ’wp footer’. Just before the end of the HTML page WordPress is generating, it checks to see whether any plugins have registered functions for the ’wp footer’ action hook, and runs them in turn. [tea08g] We can see similar ways of ’hacking’ the core in all systems. WordPress is a good CMS, which meets our requirements, but it is used mostly for blogs, therefore the modularity is not good enough and that is why I would not recommend it for the CSE department.

2.2.3

MODx

MODx refrains from saying it is CMS, but calls itself the Content Management Framework. It was awarded the Most Promising Open Source CMS of 2007. [Ran07] MODx is the first CMS to fully support Web 2.0 Ajax, it has a flexible PHP API, is XHTML 1.1 strict and works CSS to capacity. It allows the programmer to implement custom content types and works well with users and menus. MODx is very modular, it lets you create and edit • Templates - HTML markup tags that determine the layout and appearance of your site. • Snippets - Add logic to websites. They can be used to create menus, determine who is logged in, or any other thing possible with the API. • Chunks - Blocks of plain text or (X)HTML markup that is inserted directly into your page at the location you place the tags • Widgets - Components used to format the Input Value to some desired visual output on web sites. • Plugins - Lets you run a code in case of some event (page load, page not found, page render, ...) • Modules - Application that runs on top of the MODx architecture. [tea08e] All in all MODx is a great CMS which meets our requirements and I would recommend keeping up with the progress and think about using it as the CS department CMS in the future.

2.2.4

Moodle

Moodle is also a CMS, but in this case the acronym stands for ’Course Management System’. It is meant for use by academic community. Moodle has a large and committed community, it is worth mentioning that the site with most courses is E-learning on VUT Brno [tea08f] which has 19233 courses and 41305 users. CTU Prague has also implemented Moodle for their use [Tol08] The M in Moodle stands for modular, and the

6

CHAPTER 2. CHOOSING CMS

easiest, most maintainable way to add new functionality to Moodle is by using one of the many plugin APIs. there are many types of plugin that one can write: • Activity modules. • Admin reports. • Course and Gradebook plugins. • Database plugins. • Many others including Filters, Blocks, Question engine and so on. Moodle has a fair amount of plugins, but it is not as customisable as is necessary and is made for a different use then what the CSE department needs and therefore I can not recommend it.

2.2.5

CMS Made Simple

CMSMS is, as the title suggests, a simple and straightforward CMS. That does not mean that it would not be a flexible system. Among it’s advantages is that after an easy setup it is easy to maintain the site even for people who are not technically skilled. It is modular, users may create their own • User defined tags - Simple way to insert PHP code into your site. • Modules - They are used for everything else, they contain the action file which call CMSMS actions, a method file which handles various methods that are called by CMSMS. It includes the main code file which contains the code, template file which is used for displaying and other files such as language and picture files. [con08] CMSMS is a good CMS which meets our requirements, however compared to Drupal or Joomla! it is not robust enough for use for the whole CSE department, that is why I do not recommend it.

2.2.6

Comparison table

CMS Drupal Joomla! WordPress MODx Moodle CMSMS

Modularity excellent excellent poor excellent average average

Community excellent excellent excellent average average average

User control excellent excellent average excellent average average

Community excellent excellent excellent average excellent average

Security excellent excellent average excellent average poor

Accessibility excellent excellent excellent average average average

Chapter 3 Drupal In this section we will discuss why I chose Drupal for CS department’s CMS. We will talk about system requirements, and Drupal installation. We will also look into Drupal advantages and disadvantages.

3.1

Drupal’s mission statement By building on relevant standards and open source technologies, Drupal supports and enhances the potential of the Internet as a medium where diverse and geographically-separated individuals and groups can collectively produce, discuss, and share information and ideas. With a central interest in and focus on communities and collaboration, Drupal’s flexibility allows the collaborative production of online information systems and communities. [BS08]

3.2

Why Drupal

We will discuss features that are important to the CSE department in this section. • External Authentication Capability - external module is required. • Modularity - the site is completely modular and modules are easy to develop and add/remove. • Authorization Granularity - customizing permissions is allowed, users are divided into groups. • Ease of patching / maintaining - patches and new versions of core are downloaded from the main site, unzipped and the old files are overwritten. • Performance / Optimization - Drupal’s performance depends on resource demands of the site traffic and configuration of underlying technologies. 7

8

CHAPTER 3. DRUPAL • Administrative Control - is very good as is and external modules can be downloaded to make it even easier. • Developer Community - there are many Drupal conferences, events, and user groups worldwide. • Security - Drupal has a dedicated security team, a security website, email alerts and an RSS feed for updates. • Accessibility - Drupal is Section 508 compliant • Total Cost of Ownership - free

[Kea08]

3.3

About Drupal

Drupal is a powerful open-source Content Management System which has a very strong community supporting it. Drupal is a modular system which is used by vast amount of users for different web sites including • Community web portals • Discussion sites • Corporate web sites • Intranet applications • Personal web sites or blogs • E-commerce applications • Resource directories • Social Networking sites [tea08a] Drupal recently released new version 6.2 and it already has lot of modules and themes to support it. Modules provide functionality that extend Drupal core and we will do an in-depth analysis of them later in the thesis. Drupal is heavily customizable and can be individualized according to user needs. It has a role-based permission system which means that users will be assigned permissions according to their roles and and groups. All Drupal content is fully indexed and searchable. Users can authenticate using external authentication. Drupal’s theme system separates content from presentation, which allows the users to change the look and feel of the website easily. Drupal is a multi-platform system, which can run on any of the widely used operating systems (Apache or IIS, Unix / Linux / BSD / Solaris / Windows / Mac OS X). It’s database independent, it can run on MySQL,

3.4. HOW DRUPAL WORKS

9

PostgreSQL and other SQL databases can be used by writing a database backend containing fourteen functions and creating a matching SQL database theme. Everything in the system is logged, tracking and statistics provide a good feedback for the administrator. [tea07] Drupal is a set of scripts written in PHP that provide the framework and basic functionality for building feature-rich and dynamic web sites. It is a content management system (CMS), because it greatly simplifies the process of authoring, managing, and publishing content — such as text, images, files, and audio—to the Web. It is a forum, a blogging tool, and an organizer of information. It is an extensible platform on which you can build custom modules, and it is a set of programming APIs that allows web developers to create custom web applications very rapidly and efficiently. [RTDS06] Drupal is extensible, standards-compliant, and strives for clean code and a small footprint. Drupal is designed to be customized, but customization is done by overriding the core or by adding modules, not by modifying the code in the core. [VW07]

3.4

How Drupal works

Figure 3.1: Drupal’s technology stack. [VW07] As we can see on figure 3.1 Drupal can run on any system that supports PHP and therefore doesn’t care much which OS is used. The server which is most used for Drupal is Apache, but it can run on IIS too. Figure 3.1 also shows that the system is database independent and even though MySQL is most used, it can run on any SQL server using the Database Abstraction Layer. Drupal’s PHP code is written with strict coding standards and the code is OOD (Object Oriented Design) but not OOP (Object Oriented Programming). Drupal’s PHP code is discussed to be OOP starting with version 7. Discussion is here: http://drupal.org/node/240269 When the user goes to the website drupal.org and downloads the latest stable release of Drupal, he gets the core of the system. The core is a lightweight framework, which is responsible for providing the basic functionality which supports the modules. The basic system contains modules which can’t be removed and then there is a score of modules which can enhance the functionality, as shown on figure 3.2. Things like adding new content types and behaviors are handled by the modules.

10

CHAPTER 3. DRUPAL

Figure 3.2: Enabling additional modules give more functionality. [VW07]

Chapter 4 Drupal modules In this chapter we will talk about how the modules work, about hooks and module technical details. We will also depict some of the modules that are used in the Drupal installation that goes with this thesis.

4.1

Modules

One can add features to his Drupal installation by installing modules. There are hundreds of modules written by members of Drupal community available for download from http://drupal.org/project/Modules. One can also write his own module, we will discuss that in the next chapter. This is well pictured in figure 3.2. Drupal makes use of the inversion of control design pattern, in which modular functionality is called by the framework at the appropriate time. These opportunities for modules to do their thing are called hooks. [VW07] Hooks are something like internal Drupal events. Hooks allow the module to ’hook into’ what’s happening in Drupal. For instance when a user logs in, Drupal fires the user hook, which means that all user hook functions that are named according to the convention will be called.

4.2

CCK and Views

One of the assignment tasks for the CSE department CMS was that there need to be different kinds of content such as faculty work loads, software in the classrooms, timetables and so on. An answer to this need is in Content Construction Kit - CCK and Views. The Content Construction Kit allows you create and customize fields using a web browser. CCK is actually a group of modules. The primary module is called ’Content’ and it is required in order to use any other CCK modules. The tarball includes a few other modules, which comprise the ’Core CCK’ modules. They include: 11

12

CHAPTER 4. DRUPAL MODULES • Text • Number • Nodereference • Userreference • Optionwidgets • Fieldgroup

[Cha06] An administrator can set access rights to different content types and their fields. He can import data into CCK nodes, create shared fields and fill the options to be picked from database. If you have installed Views, CCK will automatically make all your custom fields available in Views. You can create a new view and you’ll see that all your custom fields appear as options in several places. You can add them to the ’Fields’ section of your view, as Views ’Filters’, as ’Sorts’, and as ’Arguments’. You’ll be able to choose from the same ’formatters’ as you saw on the ’Display fields’ screen, and have an option to display multiple value fields on individual rows in the results, or grouped together in a single row. [Mil05] The Views provide a method of viewing any information that Drupal has access to. The administrator has access to the fields from CCK, to the default node fields and to all useful information in Drupal’s database. This tool is essentially a smart query builder that, given enough information, can build the proper query, execute it, and display the results. [Mil05] An add-on for views module is available, it’s AJAX Views, which allows use of Ajax paging for the result of the views.

4.3

Actions and Triggers

Triggers are events in Drupal such as posting new comment or an article, user logging in or someone viewing some kind of content. Trigger ’triggers’ an action in case of one of these things happening. For example when you post a new article and someone comments on it, it triggers an action which is sends you an e-mail. Actions are tasks that the system can do, for example hiding a piece of content or blocking the user. They are something that happens after the trigger and allow you to integrate Drupal to other systems. Actions and triggers give you the ability to add some extra dynamic features to your Drupal installation without any coding or real technical knowledge. [tea08c]

4.4. USERS MODULES

4.4

13

Users modules

There are several modules that extend the user functionality of Drupal, some of which are useful for our project as well. Module ’Apply for role’ allows users to apply for a role and administrators to approve their application. The role will be automatically assigned to the user on approval. This module is useful because CSE department heavily depends on user groups and roles. Drupal also allows external user authentication which is very useful for our purposes. Drupal can authenticate using OpenID, Shibboleth, Facebook, Windows Live ID, Google groups and many others. Another module allows ’shared sign ons’ between related Drupal sites on one server with a shared database.

14

CHAPTER 4. DRUPAL MODULES

Chapter 5 Module creation In this section we will talk about writing a module for Drupal, we will also take a closer look at setting up some of the modules discussed in the previous chapter.

5.1

Writing a module

Drupal’s code is designed from the ground up to be modular and extensible. Drupal is a very lean framework for building applications and the default installation is often referred to as the Drupal core. Functionality is added to the core by enabling modules, which are files that contain PHP code and reside in the sites/all/modules subdirectory of our Drupal installation. [VW07] There are 2 files that are necessary for the module, their extensions are .info and .module. The info file is formatted like a standard .ini file in PHP (see http://php.net/parse ini file). An example of data in the info file follows: ; $id$ name = Advanced help description = Allow advanced help and documentation. core = 6.x version = ’6.x-1.0’ project = ’advanced\_help’ datestamp = ’1212174004’

First thing in the file is a CVS (Concurrent versioning system) identification tag, then the file provides a name and description of the module to the system. Another compulsory tag is the core, the others are optional. To understand the module creation it will be best to show it on the module that I was creating for new content type using a tutorial on drupal.org. A simple node-type (or content type) such as ’page’ or ’story’ is the most elemental aspect of a Drupal site. In it’s most basic form it is nothing more than a Title, Body, and an optional Teaser. [tea08b] 15

16

CHAPTER 5. MODULE CREATION

It’s time to start with the .module file, which does all the work. It’s extension is .module and it contains PHP code which implements the hook functions. In our case we will be implementing four hooks: • hook node info() • hook perm() • hook access() • hook form() All hooks are named modulename hook, where ’hook’ is a pre-defined function name suffix. The .module file (which is named the same like .info file) starts with an opening PHP tag and a CVS identification tag, followed by a comment:

[Mot08] kp users.info ; $Id$ name = Katedra Pocitacu users description = "Enables authentication of users from Katedra pocitacu database" core = 6.x

22

CHAPTER 5. MODULE CREATION

Figure 5.1: External user authentication. [VW07]

Chapter 6 Implementation In this chapter we will try to understand nodes in Drupal, we will create a new content type using CCK and then show it on our Drupal installation using Views. We will also make a new action and then set a trigger to start it when needed. Everything will be illustrated with screenshots.

6.1

CCK and Views

Using CCK and Views is a good way of getting around having to use a module if one wants a new content type.

6.1.1

Understanding nodes

Node is a piece of content which has a unique Node ID ($nid) There are many different kinds of nodes, or node types. Some common node types are ’blog entry,’ ’poll,’ and ’book page.’ Often the term content type is used as a synonym for node type, although a node type is really a more abstract concept and can be thought of as a container, as Figure 6.1 represents. [VW07] All nodes have the same underlying data structure, which means that all content can be treated the same programatically. All of the operations that can be performed on content are supported natively by Drupal because all content types are nodes. However users, blocks and comments are not nodes and can’t be treated the same way.

6.1.2

CCK

We will create a Software in the classrooms content type to illustrate the use of CCK + Views. Go to Administer - Content management - Content types - Add content type In the figure 6.2 we can see that the content type has to have a Name and a Type. Another compulsory part is the ’Title field label’ under the tab Submission form 23

24

CHAPTER 6. IMPLEMENTATION

Figure 6.1: Node types are derived from the basic node and may add fields. [VW07] settings. Nodes that are made using CCK must have a title, even though that can be inconvenient at times. It’s there to allow administrator to view a list of it’s content. Body field, however, can be omitted. A minimum number of words for the body can also be set. The Workflow settings tab is used to set if each time a Software in classrooms is submitted it’s • Published • Promoted to front page • Sticky at the top of lists • Create new revision We won’t set any of these options as we don’t want that data to flood the main page. We will set a special page for Sw in classrooms using Views later on. We can also set the multilingual support in this tab. The Comment settings tab is the last one, we will disable the comments as we don’t want the users to be able to add comments to the jokes. After clicking the Save content type button, we are taken to the list of all content types. Here we click ’edit’ so we can manage the fields of the Software in classrooms type. After clicking ’Add field’, we are taken to the form shown on figure 6.3 We will use a field ’Classrooms’ for our example. We can choose from following options when choosing a field type: • Date types • Decimal • Float • Integer • Text

6.1. CCK AND VIEWS

25

Figure 6.2: Input form for creating a new content type • Node reference • User reference Administrator can add the field types by adding extra modules, like we did with the ’date’ module to add the date types. After choosing the type and clicking continue, we are asked to choose a widget type for inputting the chosen field type. For the ’Text’ type there are following widgets: check boxes/radio buttons, single on/off checkbox, text field and text area (multiple rows). In our case we choose the check boxes/radio buttons as we only want the user to be able to select one classroom and then pick the software in it as shown in figure 6.4. Next are the global settings in which we can set the default and allowed values (PHP code can be entered here to get the data from the database). Global settings such as number of values or if the value is required can be set here as well. We will add a ’software’ field next using the same method, and we’ll choose the check boxes and set the allowed values to all the software that’s in the classrooms. We will use the classrooms for sorting the Software in classrooms in Views later on. The created content type and it’s new fields can be seen in figure 6.5. If Display fields button is clicked, we can configure how this content type’s fields and field labels should be displayed. We can also set how the fields are displayed if they are displayed in following context: • RSS Item

26

CHAPTER 6. IMPLEMENTATION

Figure 6.3: Input form for adding a new field

Figure 6.4: Adding the content Software in classrooms • Search Index • Search Result It could be displayed either default, plain text, trimmed or hidden.

6.1.3

Views

We’ll go to Administer - Site building - Views - Add. We will get a form shown in the figure 6.6. After selecting what we need, we will be taken to the main administer area which is shown on figure 6.7. We do the following things here: 1. Add a page display (other choices are Attachment, Block, Date browser and Feed). 2. Click on ’Add Fields’ and select Software in classrooms Classrooms and Software . 3. Under Page settings set a path to make a URL for the view. 4. Click the ’Menu setting’ and select Normal menu entry. 5. We can set the paging, style and filters, if necessary.

6.2. ACTIONS AND TRIGGERS

27

Figure 6.5: Fields in Software in classrooms content type 6. Click on the add arguments icon, and add the User: Roles argument. Set the title to ’%1’, the ’Action to take if argument is not present’ to Summary, sorted ascending, and leave the other settings as they are. Now we achieved a view of our new new content type. The menu now contains a hyperlink ’Software in classrooms’ and when clicked, there are hyper linked classrooms. When those are clicked, all software listed the specific classroom will be shown paged according to our wishes. This is shown on figure 6.8

Figure 6.6: Form for adding new view

6.2

Actions and Triggers

We will make an example use of Action and triggers in our installation of Drupal here.

28

CHAPTER 6. IMPLEMENTATION

Figure 6.7: Administrator interface of the Views module

6.2.1

Actions

There are two types of actions: simple and advanced. Simple actions do not require any additional configuration, and are listed automatically (as seen in figure 6.9). Advanced actions can do more than simple actions; for example, send an e-mail to a specified address, check for certain words within a piece of content or forward a user to another page. All of the actions are listed in figure 6.9. These are the simple steps to create a new action to send an e-mail to administrator if new user has registered: • Go to ’Administer’ page and then go to Actions. • Create a ’Send e-mail’ action. • In the Recipient box type an e-mail. In the Subject put something like ’New member has joined’ and put whatever we want into the body of e-mail. [tea08c] When we’re done creating the action it will be listed in figure 6.9.

6.2.2

Triggers

The first thing we need to do is to enable the Triggers module in the Administer - Site building - Modules section. This is done by checking the checkbox next to the Trigger

6.2. ACTIONS AND TRIGGERS

29

Figure 6.8: Menu - classrooms - software in the clicked classroom

Figure 6.9: All of the actions listed module. Then follow these simple steps to set up the trigger • Go to Triggers and click on ’Users’. • Scroll down to the ’After a user account has been created’ trigger and then in the drop down box select the Action that you just created and then click Assign (shown in the figure 6.10) • We will now receive an email when a new member joins.

Figure 6.10: Selecting the action for the trigger

30

CHAPTER 6. IMPLEMENTATION

6.3

Other Modules and Themes

In this chapter we will describe other modules and themes used to make administrator’s work easier and user feel more welcome.

6.3.1

Modules

Here is a list of extra modules we used for implementing the CSE Department CMS: • User Permissions 6.x-1.x-dev - Provides the ability to manage permissions for individual users without the need to manually create a role for an individual user. • Administration Menu 6.x-1.x-dev - Renders a menu tree for administrative purposes as dropdown menu at the top of the window. • Content 6.x-2.0-beta - Allows administrators to define new content types. • Views 6.x-2.0-beta4 - Create customized lists and queries from your database. • Trigger 6.2 - Enables actions to be fired on certain system events, such as when new content is created. • Date 6.x-2.0-beta2 - Defines CCK date/time fields and widgets. • Advanced help 6.x-1.0 - Allow advanced help and documentation. • Apply for role 6.x-1.2 - Allows users apply for roles. • Persistent Login 6.x-1.4-beta2 - Provides a ’Remember Me’ checkbox in the login form • Katedra Pocitacu users - Enables authentication of users from CSE Department database • Press Release - Enables the creation of press releases.

6.3.2

Themes

Here is a list of themes that we tried on the system: • 4 Seasons 6.x-1.18 - A clean 3 column, fixed width theme (960px). • Bluemarine 6.2 - Table-based multi-column theme with a marine and ash color scheme. • Chameleon 6.2 - Minimalist tabled theme with light colors. • Channel Nine 6.x-1.2 - Unique 4 columns with no header. • Contented7 6.x-2.6 - Tableless, multi-column, fluid width theme.

6.3. OTHER MODULES AND THEMES • Garland 6.2 - Tableless, recolorable, multi-column, fluid width theme (default). • Internet Center 6.x-1.1 - 2 columns, fixed width. • Marvin 6.2 - Boxy tabled theme in all grays. • Pushbutton 6.2 - Tabled, multi-column theme in blue and orange tones.

31

32

CHAPTER 6. IMPLEMENTATION

Chapter 7 Usability In this chapter we will use the results of a recent Drupal Usability Research Report performed by the University of Baltimore.

7.1

Executive summary

The study was focused on the administrator interface of Drupal. It was performed with 8 participants which all had previous experience with web development and Content Management Systems other than Drupal. The questions that the study examines are following: • What are the main challenges to new Drupal users? • Is the language and terminology used in the administrative interface intuitive to users? • Is the format and language of the proposed IRT node form accessible and intuitive to users? • How long does it take users to perform basic web development tasks with no formal Drupal training? [BS08]

7.2

Results and Reccomentations

In this section we will discuss the usability of Drupal in practical tasks performed by the study participants.

7.2.1

Creating content

Participants had no problems finding the ’Create content’ link in the main page navigation, however it was hard for them to discern the difference between two default content 33

34

CHAPTER 7. USABILITY

types page and story. Participants were also surprised that a WYSIWYG text editor for the body of the content was not a native part of the Drupal installation. More task oriented distinguishers should be created for content types to avoid confusion between the default ones. It would be a good idea to implement the WYSIWYG text editor into the main Drupal installation.

7.2.2

Posting and Managing content

The participants were confused that the administrative interface is a part of the web site. In other CMS’s they were used to it’s a different interface altogether. In the option ’Promote to front page’ the participants expected the term ’Home page’ to be used. When trying to manage content the participants were confused about finding a link to existing pages. In the Administer landing page there were, according to participants, too many options and they expressed a feeling of being overwhelmed. A visual feedback that distinguishes between administrative menu and pages should be implemented in the basic theme. More node form options should be visible. Some categories in the Administer page could be lumped together in order not to overwhelm the users.

7.2.3

Creating navigation

It was very difficult for the participants to create navigation links and they were usually unaware that they completed the task. They also weren’t sure what the primary and secondary link is. It was difficult for some participants to understand the term ’blocks’ and were unsuccessful to discern what they mean through trial and error. The navigation links located in the upper right corner in the default theme were not even noticed by one participant. It would be good to rethink the terms ’primary link’ and ’secondary link’. A primary link could be moved to the left side where the users expect them rather then right side. Distinguish between administrative and website parent item links within the node form.

7.2.4

User management

When asked to create a user which can create and edit content, but can’t play with the structure and design of the site the participants typically started under ’user’ rather than ’role’ which led to some confusion. Permission page was overwhelming to participants and some of the Drupal terminology was unclear (what is a node?). Participants had no problems with creating new users but were not sure about setting up the role and permissions for it. There was also some confusion with weak password warning as there are no guidelines how a strong password looks like. A more hierarchical, task oriented labeling scheme can help new users on the User Management landing page. Try also to group as many option as possible under one category. [BS08]

7.2. RESULTS AND RECCOMENTATIONS

7.2.5

35

Post test

There was a post test which sums up the participants experience with Drupal, it’s shown in figure 7.1.

Figure 7.1: Test given to participants after the experiment [BS08]

7.2.6

Usability Conclusion

Usability tests have proved that Drupal still has a lot to work on but there are no major problems with users using the system. The Administrators have to take time to understand Drupal’s terminology and it’s administrative interface. There are modules and themes which make things much easier as well. The users are able to choose a theme that suits them better and if the page is well maintained there should be no problems with navigating around the system for the CSE Department students and faculty.

36

CHAPTER 7. USABILITY

Chapter 8 Conclusion When I started working on this thesis months ago I never thought that this subject would be so extensive. I worked with PHP, MySQL and I developed web sites but this kind of work was completely different. When I first started researching this subject, I went to http://www.opensourcecms.com and found that there are dozens of CMS’s out there and I wasn’t sure where to start. After couple days of concise research I found two strong open source PHP based Content Management Systems - Joomla! and Drupal. What tipped things in favor of Drupal was a strong Czech community and overall rating on many CMS awards. Learning the Drupal terminology (such as nodes, cron, taxonomy and others) was a challenge by itself. Understanding inner workings and going beyond the basics took days of research again. I was lucky to find some very useful and information filled books both in Czech and English. Drupal documentation on it’s websites (http://drupal.org/handbooks) is also very clear and touches almost all the issues that I had to solve. Another interesting and important thing to learn was module creation. I learned how to implement hooks and created a simple module using tutorials available on the Drupal website. The assignment was to create a module for new content type. This problem was solved with CCK and Views modules. Another important part of the assignment was user control which is very well implemented in Drupal core and with some extra modules it makes for a very strong Drupal feature. Searching and modular implementation of all segments of current information system is no problem for the system as well. A feature that people are notified with e-mail when a new content is added is solved with Triggers and Actions modules. I also tried many other modules and themes which make administrator’s work easier and the user to feel better. Another thoroughly researched feature was implementation of external user authentication for which I created an external database and tested an external module that I created using [VW07] and [Mot08]. For the future development of the system for Computer Science and Engineering Department it’s necessary to apply the external user authentication to the existing database. It’s necessary for the system to use the triggers to run the PHP code that updates other CSE department pages (webis and KOS). It’s important to learn using CCK well and prepare for upcoming module Views2 which will make the work with custom content types even easier. My experience using Drupal is a positive one, even though the system is sometimes too 37

38

CHAPTER 8. CONCLUSION

robust and one gets overwhelmed by all the features and ins and outs of the system. I believe that Drupal has a bright future and I would like to become active in the growing community and help Drupal get better. There are already many people that are employed as Drupal administrators in various companies and I believe that knowing Drupal will be useful in the future.

Bibliography [ax08]

ax. Forms api, 2008. http://api.drupal.org/api/file/developer/topics/formsapi.html.

[BS08]

Malia Nagle Paul Coyle Cynthia York Maleka Ingram Becca Scollan, Abby Byrnes. Drupal usability research report. May, 2008.

[Cha06]

Jonathan Chaffer. Content http://drupal.org/project/cck.

[con08]

CMSMS contributor. User handbook/developers guide/module tutorial, 2008. http://www.cmsmadesimple.org.

[Kea08]

Justin C. Klein Keane. Creating drupal external authentication, 2008. http://justin.madirish.net/node/147.

[Mil05]

Earl Miles. Views, 2005. http://drupal.org/project/views.

[Mot08]

Darren Mothersele. Using an external data source for drupal user authentication and login, 2008. http://www.darrenmothersele.com/content/usingexternal-data-source-drupal-user-authentication-and-login.

[Ran07]

Zaigham Rana. Modx, the most promising open source content management system, 2007. http://modxcms.com/modx-the-most-promising-open-sourcecontent-management-system.html.

construction

kit

(cck),

2006.

[RTDS06] Mike Little Robert T. Douglass and Jared W. Smith. Building Online Communities with Drupal, phpBB, and WordPress. Apress, 233 Spring Street, 6th Floor, New York, NY 10013, 2006. [tea07]

Drupal team. Drupal features, 2007. http://drupal.org/features.

[tea08a]

Drupal team. About drupal, 2008. http://drupal.org/about.

[tea08b]

Drupal team. Create new http://drupal.org/node/231019.

[tea08c]

Drupal team. Using the new actions and triggers functions in drupal 6, 2008. http://drupal.org/node/199254.

[tea08d]

Joomla team. Joomla! documentation, 2008. http://www.joomla.org.

[tea08e]

MODx team. Modx http://modxcms.com/documentation.html. 39

content-type

for

drupal

documentation,

6.x,

2008.

2008.

40

BIBLIOGRAPHY

[tea08f]

Moodle team. Moodle statistics, 2008. http://moodle.org/stats/.

[tea08g]

WordPress team. Wordpress http://www.wordpress.org.

plugin,

2008.

[Tol08]

V. Tolar. Moodle - prostˇred´ı pro v´ yuku po internetu, http://ocw.cvut.cz/moodle/.

2008.

[VW07]

John K. VanDyk and Matt Westgate. Pro Drupal Development. Apress, 233 Spring Street, 6th Floor, New York, NY 10013, 2007.

[Wil08]

Steve Williams. What is a content management system, or cms?, 2008. http://www.contentmanager.eu.com/history.htm.

how

to

write

a

Appendix A Content of the Enclosed CD and User Manual A.1

Content of the enclosed CD

The content of the enclosed CD is organized into two main directories. • \thesis Contains the pdf version of this thesis • \implementation Includes the implementation - the database .sql file and the website

41

Appendix B Acronyms CMS - Content Management System CSE - Computer Science and Engineering API - Aplication Program Interface MVC - Model View Controller XML - Extendable Markup Language XHTML - Extendable Hypertext Markup Language HTML - Hypertext Markup Language CSS - Cascading Style Sheets SQL - Structured Query Language CMSMS - Content Management System Made Simple OS - Operating System IIS - Internet Information Services OOD - Object Oriented Design OOP - Object Oriented Programming WYSIWYG - What You See Is What You Get URL - Uniform Resource Locator CCK - Content Construction Kit CVS - Concurrent Versioning System RSS - Really Simple Syndication KOS - Komponenta Studium

42

Suggest Documents