Вы находитесь на странице: 1из 229

King Saud University

College of Computer and Information Sciences


Department of Information Technology

DRLO - Marifah
Digital Repository for Learning Objects

To the
Graduation Project Committee

Submitted by
Name ID#
Najla Alturaiki 424202408
Rana Qahtani 424201836
Sara Alkhudhair 424200339
Roaa Alsulaiman 424200928
Jawaher Alabdulkareem 424202685
Dhoha Almazroa 424200026

Supervised by:
Dr. Hend Al-Khalifa

2nd Semester 1429h / 2008


Table of Contents

ABSTRACT ................................................................................................................. 5
1. Introduction ............................................................................................................. 6
2. Background.............................................................................................................. 8
3. Literature Review.................................................................................................. 10
3.1. World-wide Learning Object Repositories:................................................. 10
3.1.1. MERLOT (Multimedia Educational Resource for Learning and
Online Teaching):.............................................................................................. 10
3.1.2. ARIADNE ................................................................................................ 10
3.1.3. ALI (Apple learning interchange) ......................................................... 10
3.1.4. LOLA EXCHANGE (Learning Objects, Learning Activities) ........... 11
3.1.5. Intute ........................................................................................................ 11
3.1.6. Wisc-online............................................................................................... 11
3.1.7. Connexions............................................................................................... 11
3.1.8. EducaNext ................................................................................................ 11
3.1.9. DELOR (Distributed Egyptian Learning Object Repository)............ 12
3.2. General Purpose Open Source (OS) Digital Repositories: ......................... 16
3.2.1. DSpace:..................................................................................................... 16
3.2.2. Fedora....................................................................................................... 17
3.2.3.CDSware (CERN Document Server Software) ..................................... 18
3.2.4. EPrints...................................................................................................... 19
4. Problem Definition ................................................................................................ 23
5. Metadata ................................................................................................................ 23
6. Objectives............................................................................................................... 26
7. Functional specifications ...................................................................................... 28
8. Recommender Systems ......................................................................................... 30
8.1. Introduction .................................................................................................... 30
8.2. RECOMMENDER SYSTEMS .................................................................... 31
8.2.1. memory- based collaborative filtering technique:................................... 32
8.2.2. model- based collaborative filtering technique: ...................................... 34
8.3. Our Approach................................................................................................. 36
8.3.1. LO Similarity Computation:..................................................................... 38
8.3.2. Prediction Computation:........................................................................... 38
8.3.3. Recommendation Generation: ................................................................. 38
9. System Analysis ..................................................................................................... 39
9.1. USE CASE DIAGRAM: ................................................................................ 39
9.2. Conceptual Model: ......................................................................................... 40
9.3. Use Case,SSD,Contract,Collaboration Diagrams ....................................... 41
9.4. Class Diagram: ............................................................................................... 74
9.5. ER Diagram:................................................................................................... 75
................................................................................................................................. 75
9.6. Data Base Schema: ......................................................................................... 76
9.7. Data Base Dictionary ..................................................................................... 77
10. Implementation.................................................................................................... 84
10.1 Registration.................................................................................................... 85
10.2 Login........................................................................................................... 86
10.3 User's Home Page.......................................................................................... 87
10.4 Recommender System................................................................................... 87

1
10.5 Browse ............................................................................................................ 87
10.6 View Learning Object................................................................................... 88
10.7 Tell a Friend................................................................................................... 90
10.8 Sort Learning Objects................................................................................... 90
10.9 Search ............................................................................................................. 90
10.9.1 Simple Search ......................................................................................... 90
10.9.2 Advanced Search .................................................................................... 91
10.10 Contribute a Learning Object.................................................................... 91
10.11 What is New ................................................................................................. 93
10.12 RSS................................................................................................................ 94
10.13 Average Rate................................................................................................ 94
10.14 Number Of Votes......................................................................................... 95
10.15 My Personal Collections ............................................................................. 95
10.15.1 Create a Personal Collection ............................................................... 96
10.15.2 Delete a Personal Collection ................................................................ 96
10.15.3 Rename a Personal Collection............................................................. 96
10.15.4 Add to Personal Collection .................................................................. 96
10.15.5 Delete a Personal Collection ................................................................ 96
10.16 Add Comment.............................................................................................. 97
10.17 Rating ........................................................................................................... 97
10.18 Report Back ................................................................................................. 98
10.19 Contatct Us............................................................................... 98
10.20 Password Recovery .................................................... 99
10. 21 Change Password ..................................................................................... 100
10.22 Update User's Profile ................................................................................ 100
10.23 Update .......................................................................................... 102
10.24 Download.................................................................................. 102
10.25 Number Of Downloads ...................................... 103
10.26 Number of Views.......................................................... 103
10.27 Number of Comments ......................................... 103
10.28 Users Report ...................................................................... 103
10.29 Learning Objects Report ............................... 104
10.30 Count LO report........................................................... 104
10.31 Admin Pages ........................................................................ 105
10.31.1 View Accounts Pages..................................... 106
10.31.2 Edit User Information Page .............. 107
10.31.3 Online Users Page............................................... 107
10.31.4 Filter Users By Roles Page................................................................. 108
10.31.4 Create User Page.................................................. 108
10.31.5 Manage Roles Page........................................... 109
10.31.6 Edit Main Categories Page ................. 109
10.31.7 Edit Sub Categories Page ...................... 110
10.31.8 Main categories page..................................... 110
10.31.9 Add New Main Category........................ 111
10.31.10 Add New Sub Category............................. 111
10.31.11 View learning object page..................... 112
10.31.12 Edit Learning Objects Page .............. 112
4.31.13 View comments page.......................................................................... 113
10.31.14 Unapproved Comments page .......................................................... 113
10.31.15 View Report Back Page ................................................................... 114

2
10.31.16 Send message to mailing list page ................................................... 114
1. 11. Testing......................................................................................... 115
11.1 Purpose .......................................................................................... 115
11.2 Scope ................................................................................................. 115
Testing Procedure...................................................................................................... 115
11.3 The Testers................................................................................ 115
 Dhoha A. Almazroa............................................................. 115
 Roa’a M. Alsulaiman ........................................................ 115
11.4 The procedure....................................................................... 115
Test Cases.............................................................................................................. 117
12.Bugging and Debugging..................................................................................... 146
12.1 Bugging......................................................................................................... 146
12.2 Debugging .................................................................................................... 146
13. Conclusion.......................................................................................................... 150
14. Future Work ...................................................................................................... 151
15. References .......................................................................................................... 152
16. Appendices ......................................................................................................... 154
16.1 TrackBack: .................................................................................................. 154
16.2 RSS................................................................................................................ 156
16.3 Federated Search......................................................................................... 157
16.4 Issues with Dspace....................................................................................... 163
16.5 Source Codes................................................................................................ 164

Table of Illustrations
Table of Figures

Figure 1.1: A Survey conducted and published by Open DOAR ………… ….7
Figure 8.1: The user-based collaborative filtering process……………………… ..32
Figure 8.2: Isolation of the co-rated items and similarity computation……………35
Figure 10.1: Registration Form................................................................................ 85
Figure 10.2:Validation of registration ..................................................................... 86
Figure 10.3: Login Form.......................................................................................... 86
Figure 10.4:User's home page.................................................................................. 87
Figure 10.5:Browse :.................................................................................................88
Figure 10.6:Browse sub category............................................................................. 88
Figure 10.7:View learning object............................................................................. 89
Figure 10.8:Tell a friend form.................................................................................. 90
Figure 10.9: Advanced Search................................................................................. 91
Figure 10.10:Upload form.................... ................................................................... 92
Figure 10.11: Upload help........................................................................................ 92
Figure 10.12:What is new......................................................................................... 93
Figure 10.13:RSS :.....................................................................................................93
Figure 10.14: My Personal collections..................................................................... 94
Figure 10.15:Add comment ..................................................................................... 95
Figure 10.16:Rating.................................................................................................. 97
Figure 10.17: Contact us........................................................................................... 97
Figure 10.18: Password recovery ............................................................................. 98

3
Figure 10.19: Change password................................................................................ 99
Figure 10.20:Location of user profile in .................................................................. 100
Figure 10.21:Update user's profile form:...................................................................101
Figure 10.22:Update learning object......................................................................... 101
Figure 10.23:Download window............................................................................... 102
Figure 10.24:Users report......................................................................................... 103
Figure 10.25: LO report............................................................................................ 104
Figure 10.26:Count LO page.................... ................................................................ 104
Figure 10.27: Admin page......................................................................................... 105
Figure 10.28:View accounts administration............................................................. 106
Figure 10.29:Edit user information........................................................................... 107
Figure 10.30: Online users........................................................................................ 107
Figure 10.31:Filter users by role .............................................................................. 108
Figure 10.32:Create a new user............................ ................................................... 108
Figure 10.33:Manage Roles...................................................................................... 109
Figure 10.34:Edit main categories page.................................................................... 109
Figure 10.35:Sub categories administration ...................................... ...................... 110
Figure 10.36: Categories administration................................................................... 110
Figure 10.37:Add new category................... ........................................................... 111
Figure 10.38: Add new sub category........................................................................ 111
Figure 10.39:LO administration..................................... ......................................... 112
Figure 10.40:Edit LO :..............................................................................................112
Figure 10.41: Comments Administration................................................................. 113
Figure 10.42:Unapproved comments ...................................................................... 113
Figure 10.43: Report back Administration............................................................... 114
Figure 10.44: Report back page............................................................................... 114

Table of tables

Table 3.1: Comparison between the examined repositories………………….13


Table 3.2: Comparison between the Open Sources repositories …………..20
Table 8.1: Data participate in prediction computation with its corresponding
percentage. ………………………………………………………………….37.

4
ABSTRACT

The latest development trend on e-learning is the development of relatively small

learning units or what is usually called as learning objects that are stored in digital

repositories with their kind of catalog entries or what it usually known as metadata of

learning objects.

In our project we propose a design for a digital repository that is dedicated for storing

Arabic learning objects. This is because there is a lack of digital repositories that offer

Arabic learning objects .The final design was reached through reviewing the current

available digital repositories for learning objects.

In this documentation we will present the concept of learning objects and digital

repositories. Then we will discuss the objectives of our project, a review of the

literature, steps of system analysis and finally the proposed design of the learning

object repository.

5
1. Introduction

In recent years, the concept of learning object has been widely used and

discussed by stakeholders in educational fields. A learning object is defined as a

digital, reusable piece of content that can be used to accomplish a learning objective.

That means that a learning object could be a text document, a movie, an mp3, a

picture or even a complete website.

Due to the large increase in the number of learning objects on the Internet, the need

for digital repositories that host them has appeared, and many of these digital

repositories have emerged to provide teachers and learners with digital learning

resources.

A digital repository for learning objects can be defined as a database system

to store, manage, search, retrieve and deliver digital resources that are used to perform

or support learning processes. Moreover, the learning objects stored in digital

repositories have to be indexed with some metadata in order to identify, search or

reuse them.

As other communities, Arabs have their own learning objects. They share

knowledge with each other in different formats and using different kinds of websites.

For example, people share knowledge in PowerPoint slides or in mp3. Moreover,

knowledge could be published as a post in a forum. Despite the fact that Arabic

learning objects are widely available on the Internet, they are not kept in a centralized

digital repository which makes them difficult to be found and managed. According to

a survey conducted and published by “Open DOAR” website, there were no Arabic

digital repositories found among the Digital Learning Object Repository (DLOR) that

6
exists on the web. For this reason, our project will focus on developing a DLOR to

bridge the gap in the Arab world.

Figure 1: A Survey conducted and published by Open DOAR, Accessed November

9, 2007 from http://www.opendoar.org/find.php?format=charts

7
2. Background

Building an educated society is a goal of many educators and academic

researchers. An educated society has learning implication on its members since they

have to have the required knowledge to shape their lives. This projects aims to help in

creating an educated culture by facilitating sharing and exchanging information. This

clarifies the need for a digital learning repository where searchable and reliable

resources are stored. A digital repository can hold a wide range of materials for a

variety of purposes and users. It can support research, learning, and administrative

processes.

In the learning environment, academic staff and students need to store and

retain their intellectual assets. They also need to make their work available and visible

to others, while managing their digital rights and maintaining the integrity of their

work.

A new concept in Learning Technologies is the notion of 'learning objects',

which they are stored in digital repositories. Learning objects, as defined by IEEE's

Learning Technology Standards Committee are "any entity, digital or non-digital,

which can be used, re-used or referenced during technology supported learning."

Examples of Learning Objects include multimedia content, instructional

content, learning objectives, instructional software and software tools, persons and

organizations.

A learning object has to be indexed with some metadata. Metadata is defined

as data that describe learning objects in different aspects for the purpose of their

access, modification, evaluation and association with other learning objects.

The metadata of learning objects may include the specification of hardware

and software to utilize the learning object, the level of the learning objects;

8
(Elementary, Secondary, or High Education), type of object, author, owner, terms of

distribution, teaching or interaction. It is possible for any given Learning Object to

have more than one set of Learning Object Metadata.

9
3. Literature Review

Since we determine to build our learning object repository, it was the time to

examine the available repositories to find out the features provided, and to decide

what functionality and features must be included in our system. The second step was

to determine which Open Source general purpose digital repositories we will be re-

engineering and tailoring to match our specific needs.

3.1. World-wide Learning Object Repositories:

3.1.1. MERLOT (Multimedia Educational Resource for Learning and Online

Teaching):

A leading edge, user-centered, searchable collection of peer reviewed, higher

education, online learning materials created by registered members, and a set of

faculty development support services.

• It contains 18336 learning materials.

• It has 54929 members.

3.1.2. ARIADNE

A European Association opened to the World, for Knowledge Sharing and Reuse.

The core of the ARIADNE infrastructure is a distributed network of learning

repositories.

3.1.3. ALI (Apple learning interchange)

The Apple Learning interchange (ALI) is a social network for educators. Has a wealth

of content ranging from simple lesson ideas to in-depth curriculum units for K-12

educators as well as a new channel for higher education faculty.

10
3.1.4. LOLA EXCHANGE (Learning Objects, Learning Activities)

LOLA is an exchange for facilitating the sharing of high-quality learning objects. It

contains materials for use across the curriculum.

3.1.5. Intute

Intute is a free online service providing you with access to the very best Web

resources for education and research. The service is created by a network of UK

universities and partners.

• It contains around 120636 LO

3.1.6. Wisc-online

The Wisconsin Online Resource Center is a digital library of learning objects

developed primarily by faculty from the Wisconsin Technical College System

(WTCS).

• It contains 2054 Objects.

3.1.7. Connexions

A place to view and share educational material made of small knowledge chunks

called modules that can be organized as courses, books, reports, etc.

• It contains 4987 reusable modules woven into 308 collections

3.1.8. EducaNext

EducaNext is a service supporting the creation and sharing of knowledge for Higher

Education. It is open to any member of the academic or research community.

11
3.1.9. DELOR (Distributed Egyptian Learning Object Repository)

An Egyptian Learning Objects Repository developed by Al-Mansoura University

as a part of the e-Learning Unit.

• Since 2005

• It contains around 13,750 LO

12
Table 3.1: Comparison between the examined repositories.

13
14
15
3.2. General Purpose Open Source (OS) Digital Repositories:

The landscape of software platforms for building repositories is constantly changing.

We outline below a brief profiles of some leading OS repository software platforms:

3.2.1. DSpace:

• DSpace is a digital library system designed to capture, store, index,

preserve, and redistributes the intellectual output of a university’s research

faculty in digital formats.

• Developed jointly by HP Labs and MIT Libraries.

• Features:

o Accepts all manner of digital formats.

o BSD license

o Workflow process for content submission.

o Import/export capabilities.

o Packager Ingester / Disseminator

o Ingestation / Dissemination Crosswalk

o Removing from Dspace: withdrawn / expunged.

o Stackable Authentication.

o Supervision and collaboration

o Storage Resource Broker (SRB)

o OpenURL / Mailing list / RSS feeds.

Example websites

• Cambridge University

• Hong Kong University of Science & Technology Library

• Massachusetts Institute of Technology

• Université de Montréal (Erudit)

16
3.2.2. Fedora

Jointly developed by University of Virginia and Cornell University, Fedora

(Flexible Extensible Digital Object Repository) serves as a foundation for building

interoperable web-based digital libraries, institutional repositories, and other

information management systems. It demonstrates how you can deploy a

distributed digital library architecture using web-based technologies, including

XML and Web services.

• Features

o Powerful digital object model

o Extensible metadata management

o Expressive inter-object relationships

o Web service integration

o Version management

o Configurable security architecture

o Preservation worthy

Example websites

o Institutional repositories: The ARROW Project (Australia)

o Electronic records: Yale University (USA)

o Distributed digital libraries: The National Science Digital Library

(USA).

17
3.2.3.CDSware (CERN Document Server Software)

Developed by CERN, the European Organization for Nuclear Research, based in

Geneva, CDSware is designed to run an electronic preprint server, online library

catalogue, or a document system on the web.

Features:

• Linux/Solaris operating systems.

• indexing technology and search engine

• Automated installation script and a system update script.

• Supports multiple language interfaces ( Arabic was not included).

• user-defined document baskets

• user-defined automated email notification alerts

• Amazon-like user comments for documents in repository and shared baskets

• Full text search.

• Multiple output formats (HTML, XML, MARC, OAI )

• Free and Paid support

Example website

• CERN document server.

18
3.2.4. EPrints

GNU EPrints is free, open source software developed at the University of

Southampton. It is designed to create a pre-print institutional repository for scholarly

research, but can be used for other purposes.

Features

· Any content type accepted

· Archive can use any metadata schema.

· Web-based interface

· Workflow features: content goes through “moderation process” for approval,

rejection, or return to author for amendment.

· Extensible through API using Perl programming language.

· Full text searching

· RSS output

Example websites
• California Institute of Technology

• CogPrints Cognitive Science Eprint Archive

• Digitale Publikationen der Ludwig-Maximilians-Universität München

19
Table 3.2: Comparison between the Open Sources repositories.

20
21
22
4. Problem Definition

There are many Arabic educational resources on the web scattered in personal

websites and forums, and created by members of the community. Searching for such

resources using regular search engines is not an easy task. The project main goal is to

create a digital repository for hosting learning objects and serving the needs of the

Arabic educational community. The repository will integrates advanced features that

cannot be fulfilled using well-know search engines.

5. Metadata

In any learning object repository, ‘Search’ and ‘Browse’ are the most used

methods to find a learning object. However, if these learning objects are not

identified, it will be impossible to reach a specific learning object. Therefore, in order

for a learning object to be accessible, it must be indexed with some form of Metadata.

“Metadata is structured data which describes the characteristics of a resource.

A metadata record consists of a number of pre-defined elements representing specific

attributes of a resource, and each element can have one or more values.”1 Sometimes

Metadata is defined as data about data or information about information.

There are many Metadata schemes that are used on the web; the most popular

ones are Dublin Core, AACR2 (Anglo-American Cataloguing Rules), GILS

(Government Information Locator Service), EAD (Encoded Archives Description),

IMS (IMS Global Learning Consortium), AGLS (Australian Government Locator

Service), and IEEE-LOM.

1
Chris Taylor, “An Introduction to Metadata”, (2003), <http://www.library.uq.edu.au/iad/ctmeta4.html>

23
The Dublin Core Education (DCEdu) schema will be used. “The original

objective of the Dublin Core was to define a set of elements that could be used by

authors to describe their own Web resources. The Dublin Core was developed to be

simple and concise, and to describe Web-based documents.”2 Metadata will be stored

as a table in the database.

The 15 elements of the DCEdu are:

1. Title Label: "Title"


The name given to the resource, usually by the Creator or Publisher.

2 . Author or Creator Label: "Creator"


The person or organization primarily responsible for creating the intellectual content
of the resource.

3. Subject and Keywords Label: "Subject"


The topic of the resource. Typically, subject will be expressed as keywords or phrases
that describe the subject or content of the resource.

4. Description Label: "Description"


A textual description of the content of the resource.

5. Publisher Label: "Publisher"


The entity responsible for making the resource available in its present form.
such as a publishing house, a university department, or a corporate entity.

6. Other Contributor Label: "Contributor"


A person or organization not specified in a Creator but whose contribution is
secondary to any person or organization specified in a Creator element

2
“Understanding Metadata”, (2004), < http://www.niso.org/standards/resources/UnderstandingMetadata.pdf>

24
7. Date Label: "Date"
A date associated with the creation or availability of the resource.

8. Resource Type Label: "Type"


The category of the resource, such as working paper, technical report, essay.

9. Format Label: "Format"


The data format of the resource, used to identify the software and possibly hardware
that might be needed to display or operate the resource.

10. Resource Identifier Label: "Identifier"


A string or number used to uniquely identify the resource.

11. Source Label: "Source"


Information about a second resource from which the present resource is derived.

12. Language Label: "Language"


The language of the intellectual content of the resource.

13. Relation Label: "Relation"


An identifier of a second resource and its relationship to the present resource.

14. Coverage Label: "Coverage"


The spatial or temporal characteristics of the intellectual content of the resource.

15. Rights Management Label: "Rights"


A rights management statement for the resource.

25
6. Objectives

The project aims to create an Arabic Digital Repository for Learning Objects

(DRLO) that serves the educational community in the Arab World. Although there

were a few attempts to create DRLOs by Arabs3, the need for a DRLO repository

arises because these attempts were not effective. These attempts did not gain

popularity among the educational community for reasons such as the use of English

interface, the restricted memberships, and the weak construction of the site. As a

result, our project’s vision is to be ‘The premiere online community for Arabs where

faculty, staff, and students share their learning materials.’4

Another goal of the project is to create a centralized repository that aggregates

learning objects created by Arabs. “There is some existence of Arabic learning objects

on the internet created by some members of the community”. However, these learning

materials are “scattered throughout the web in an arbitrary fashion”5. Therefore,

’Searching for these learning objects are a waste of time and resources; as there is no

proper mechanism to re-use a resource’6.

“The promise of digital learning objects repository lies in reusability. A

learning object might find usage beyond its original audience and instructional

context. Given the relatively high cost of developing good learning objects, the

3
Examples of learning object repositories created by Arabs, Specifically Egyptians, are the Egyptian Digital
Learning Object Repository (EDLOR) (http://www.freewebs.com/alaasadik1/bottom.htm) and the Distributed
Egyptian Learning Object Repository (DELOR) by Almansoura University.

4
“MERLOT - Multimedia Educational Resources for Learning and Online Teaching”, November 10, 2007, <
http://taste.merlot.org/>.
5
H. S. Al-Khalifa, “AraCore: an Arabic Learning Object Metadata for Indexing Learning Resources”, (2006),
<http://eprints.ecs.soton.ac.uk/13220/01/AraCore.pdf>.

6
j. Murali, “Learning objects repositories, “The Hindu (2003), Nov 17, 2003,
<http://www.hindu.com/biz/2003/11/17/stories/2003111700070200.htm>.

26
promise of reusability receives considerable attention from administrators and

publishers who are trying to amortize the cost of production and maximize the

potential return for each of these digital investments. “7

Finally, the project will hopefully enrich the learning process in the Arabic

educational field. Since the Saudi government policies are seeking for the informative

society, the educational field will support this ambition by concentrating on e-learning

projects. Therefore, our project will be considered as on of the important basis of the

e-learning projects needs.

7
G. Richards, “The Evolution of Learning Object Repository Technologies: Portals for On-line Objects for
Learning”, JOURNAL OF DISTANCE EDUCATION (2002), <http://cade.athabascau.ca/vol17.3/richards.pdf>

27
7. Functional specifications

We plan to implement the following functionalities in our Digital Learning Object


repository, which include:
1. LO Search and Retrieval:
1. Searching:
This function provides the users with the ability to find Learning Objects
based on keywords (simple search) or by metadata fields (advanced
search).
2. Browsing:
Allow users to locate contents by choosing the appropriate categories
and subcategories.
3. Federated search: (if time permits)
Allow users to simultaneously search multiple DLOR with a single query
from a single user interface.

2. LO Manipulation
1. Contributing:
Upload a new Learning Object to the repository. This operation is simply
done by uploading the LO and filling the required metadata fields.
2. Deleting a LO:
Delete the LO from the repository. Deletion can be done manually by the
administrator.
3. Modifying metadata:
Modify existing metadata for a LO.

3. LO Evaluation/ Ranking:
1. Rating :
Users can rate the quality and the usability of a given LO.
2. Recommendation:
This feature will recommend new LO to the system user, based on LO
rating, collected statistics and other useful information such as favorite
collections.

28
3. Reports and statistics:
Give statistical reports on the use of the repository by users; also give
information about the usage of LO within the system.
4. Quality Control:
Keep the quality of the Learning Objects high by providing services such
as "Reporting weak LO" and "Checking LO links".
5. Track back and RSS
These two features will enable our DLOR to disseminate its content
easily.

4. Administration:
1. Registration and authentication:
Allow unregistered user to join the members of the repository by filling
the registration form. For a member, (s)he must login to the system by
his/her username and password.
2. mailing:
Send e-mails to members (mailing list and update notifier) or non-
members (email an object to a friend).

7.1. Tools:

In building our project, we are going to use the following tools:

• Interface layer: Adobe Photoshop CS2 Macromedia Flash, CSS


• Coding layer: Microsoft visual studio 2005 ASP.Net, Visual Basic coding,
JavaScript and Ajax.
• Database Layer: Microsoft SQL Server 2005.

29
8. Recommender Systems

8.1. Introduction

The World Wide Web is getting overwhelmed by the amount of information

being added. According to a study done by Basex, a leading company in research and

advisory services; ‘information overload is the problem of year 2008.’8

Information is getting tremendously increased day after day in a way that

people cannot cope with this growth of information. Therefore, people are spending

more time looking for what they need because search engines’ results are not

sufficient anymore. Thus, there is a strong need for a new technology that can sieve

all the information on the web and extracts what people are really looking for.9

Employing a Recommender System is one such solution that assists Internet

users locate what they really need easily. Recommender Systems in other way read

users’ minds to find out what exactly they want.

“Recommender systems are examples of adaptive filters that use inference

drawn from users’ known behavior to recommend ‘items’ they have not yet seen.”10

There are several techniques that could implement a Recommender System. One of

these Techniques is using Collaborative Filtering (CF) which is the most widely used

in recommendation. “Collaborative filtering works by creating database of favorite

preference for items by users.” Recommended items of a user are derived from

databases of “neighbors” whom they have similar database preferences with that user.

8
Nate Anderson, “2008: The Year of Information Overload?“ ars technica (2008), Dec 26, 2007,
< http://arstechnica.com/news.ars/post/20071226-interruptions-info-overload-cost-us-economy-650-billion.html >.
9, 4
Badrul Sarwar, “Item-Based Collaborative Filtering Recommendation Algorithms”, (2001),
< http://www.inf.ed.ac.uk/teaching/courses/tts/papers/sarwar.pdf>.
10
Duncan Pemberton, “GroupMark: A WWW Recommender System Combining Collaborative and
Information Filtering”,(2000), < http://ui4all.ics.forth.gr/UI4ALL-
2000/files/Long_papers/Pemberton.pdf>

30
Most collaborative filtering approaches are rating-based automated recommender

systems. “Collaborative filtering has been very successful in both research and

practice, and in both information filtering applications and E-commerce applications.”

There are two main approaches for building a Recommender System using

Collaborative Filtering. One is so called User-based (Memory-based) algorithm and

the other approach is the Item-based (Model-based). We will address the two

approaches in detail the coming sections.

The question that might be asked is how useful is implementing a

Recommender System in an educational site such as a Digital Repository for Learning

Objects. Since number of learning objects will increase after launching the site,

finding a LO by browsing through categories or searching using keywords might

result in LOs that do not match a user preference; moreover, there might be LOs that

are not shown in search results but are the most LOs that match a user preference.

Thus a Recommender System will help users in exploring the desired LOs. However,

to make a Recommender System works properly, users’ must participate with the

recommendation process by rating LOs as they explore.

8.2. RECOMMENDER SYSTEMS

There are many recommendation algorithms and techniques which are used in many

applications. In this section we focus on one of the earliest and most successful

recommender technologies which are Collaborative Filtering (CF).

The CF algorithms are divided in two main categories:

1. memory-based (user-based / nearest neighbor)

2. model-based (item-base)

31
8.2.1. memory- based collaborative filtering technique:

This technique recommends an item to a target user based on the opinions of other

users. It employs statistical techniques to find a set of users known as neighbors, that

have almost the same history of the target user.

The user-based algorithm can be divided into three subtasks: representation,

neighborhood formation, and recommendation generation as shown in Figure 8. 1.

Figure 8.1: The user-based collaborative filtering process.11

8.2.1.1. Representation:

The input data in a recommender system is a collection of historical ratings of n users

on m items. This is usually presented as nxm matrix A. such that A(i,j) is one if the

user i rated the item j, and zero if he did not.

This nxm matrix is called the original representation.

11
Badrul Sarwar ,"Analysis of Recommendation Algorithms for Ecommerce", (2000), Accessed
January 14, 2008 from http://www.cs.umn.edu/~karypis/publications/Papers/PDF/ec00.pdf.

32
8.2.1.2. Neighborhood formation:

The most important step which compute the similarity between users to form a

proximity-based neighborhood between a target user and a number of like-minded

users.

This process is the model-building or learning process of this algorithm and it works

as follow:

For each user u found an ordered list of l users N ={N1,N2,…,Nl} such that u∉N

and sim(u,N1) is maximum, sim(u,N2) is the next maximum, and so on.

There are number of different methods to compute a similarity between two things,

we will present two popular methods:

Cosine-based Similarity:

In this method the two users are thought of as vectors, formally the similarity is given

by:

Sim(i,j) = cos(i,j) = __i . j_

|| i ||2 * || j ||2

Correlation- based Similarity:

In this method the similarity is measured by computing the Pearson-r correlation

corri,j.

33
Sim(i,j) = corri,j = Σu∈U (Ru,i - R i )(R u,j - R j )

√ Σu∈U (Ru,i - R i)2 √ (R u,j - R j2 )

8.2.1.3. Generation of Recommendation:

The final step in the recommender system, is to derive the top-N recommendation

from the neighborhood of users.

8.2.2. model- based collaborative filtering technique:

The main idea in this algorithm is to analyze the user-item representation

matrix to identify relations between different items and then to use these relations to

compute the prediction score for a given user-item pair. This technique does not need

to identify the neighborhood of similar users when recommendation is requested, so

they produce much faster recommendation than user-based algorithms.

This approach looks into the set of items that has been rated by the target user,

and compute how similar they are to the target item i and then select the k most

similar items.

This process can be divided into three subtasks: item Similarity computation,

and prediction computation and Generation of Recommendation.

34
8.2.2.1. Item Similarity Computation:

The basic idea is to isolate the users who have rated both items i and j, and then apply

the similarity computation techniques to determine the similarity between these two

items as shown in Figure 8.2.

Methods used here are the same methods mentioned in section 8.2.1.2

Figure 8.2: Isolation of the co-rated items and similarity computation.12

8.2.2.2. Prediction Computation:

Once we isolate the set of most similar items based on the similarity measures, the

next step is to look into the target user ratings and compute the prediction on item i

for this user.

To compute the prediction we used the weighted sum method:

Each rating is weighted by the corresponding similarity. Formally to compute the

prediction on the target item i for the user u use the following:

12
Badrul Sarwar, “Item-Based Collaborative Filtering Recommendation Algorithms”, (2001),
Accessed January 14, 2008 from: http://www.inf.ed.ac.uk/teaching/courses/tts/papers/sarwar.pdf

35
Pu,i = Σall similar items,N (Si,N * Ru,N )
Σall similar items,N (| Si,N |)

8.2.2.3. Recommendation Generation:

The last step is to recommend the target user with the items with top-N Prediction.

8.3. Our Approach

After studying both item-based and user-based collaborative filtering, we

found that using the item-based collaborative filtering is more suitable for a learning

object digital repository for two reasons.

First, the performances of item-based algorithms are significantly better than user-

based algorithms.13 Since number of users registering to the repository is far higher

than number of learning objects getting uploaded, item-based algorithms avoid any

relationships between items and users; instead, it concentrates on exploring

relationships between items only. Therefore, computations will be performed faster

that lead to a better performance.

The second reason is that item-based algorithms provide better quality than user-

based algorithms. User-based algorithms quality depends, in the first place, on

number of “neighbors”; the quality increases as number of neighbors, repository

members, increase. However, using item-based algorithms will result in a constant

13 4
Badrul Sarwar, “Item-Based Collaborative Filtering Recommendation Algorithms”, (2001),
< http://www.inf.ed.ac.uk/teaching/courses/tts/papers/sarwar.pdf>.

36
degree of quality whether number of neighbors is increasing or not. This is due to the

fact that item based algorithms concentrate on a user’s preference in the first place;

the recommendations are given based on what items he/she preferred in the past not

on what other people have preferred. As a result, item-based algorithms are more

accurate than user-based algorithms which lead to a better recommendation quality.

Our Approach

In this section we present our approach for making recommendations to guide

users in a personalized way to interesting Learning Objects they might like.

In our system we have data more than just rating to generate the prediction, Therefore

we decided to simulate the traditional item-based collaborative filtering algorithm,

taking into consideration the fast performance of this technique..

Table 8.1: Data participate in prediction computation with its corresponding percentage.

Data Value

Rate (R) 70%

No. Downloads (D) 20%

Trackback (T) 10%

Total 100%

Suppose we have a user u, u has a list of LOs that he rated them stored in his history.

37
For each LO under the category u has specified them in his interests' fields,

computes the LO similarity and prediction. Finally generate the recommendation.

8.3.1. LO Similarity Computation:

This computation is to determine the similarity between the current LO and all

LOs in u's history. Using the Correlation- based Similarity

Sim(i,j) = Σu∈U (Vu,i - V i )(V u,j - V j ) F1

√ Σu∈U (Vu,i - V 2i) √ (V u,j - V2j )

8.3.2. Prediction Computation:

To compute the prediction on the current LO, we used the weighted sum method:

Replace each [Rating] in the original equation with [(0.7 * Rating) + (0.2 * No.

Trackback ) +( 0.1 * No. Downloads)].

F2
Pu,i = Σall similar items,N (Si,N × Vu,N )
Σall similar items,N (| Si,N |)

* By replacing V IN F1 & F2 with its value


V= [(R × 0.7) + (D × 0.2) + (T × 0.1) ]

8.3.3. Recommendation Generation:

The last step is to recommend the user u with top three LOs.

38
9. System Analysis

9.1. USE CASE DIAGRAM:

"requires"
ReportBack Create a Personal
Collection Add To Personal
Collection

"requires"
Register

"requires"
Log-in

Log out

Search "includes"

ViewLO
User
Browse
"includes"

Contribute "requires"

Rate
Modify

AddComment
Tell a Friend "equivalents"

Delete

Send Emails

Admin

NOTE: all Use Cases requires "Log-in" use case


These Use Cases were derived from similar Repositories functionality discussed in
the literature review(chapter 3)

39
9.2. Conceptual Model:

40
9.3. Use Case,SSD,Contract,Collaboration Diagrams

Use case: Register

Use case: Register

Actor: user

Purpose: to create a user account

Overview: a user will provide information about him/her self as well as a password

in order to be a member.

Type: primary

Cross reference: --

Typical course of events:

Actor Actions: System Response:

1. This use case begins when a

user clicks on "register" link.

2. Opens a new page with empty fields to fill.

3. The user fills the required

fields correctly and may wish to

fill the optional fields.

4. Click "submit" button.

5. Check info entered by the user.

6. Create a new user account and update the

repository.

7. Redirect the user to his/her home Page.

41
Alternative Courses:

Line 5: either required fields are empty, data invalid or username/Email already exist,

redisplay the page again indicating errors.

SSD for Register

system

user
EnterRegistrationInfo(UserName,Pswd,Email,…)
RedirectToHomePage( )

Operation Contract:EnterRegistrationInfo

Name: EnterRegistrationInfo(UserName:string,Pswd:string,Email:string…)

Responsibility: Create a new User.

Cross reference: Use case Register

Pre-conditions: None

Post-conditions:

1. a new User instance U was created.

2. U.UserName was set to UserName

3. U.Pswd was set to Pswd

4. U.Email was set to Email …etc

5. U was associated with Repository.

42
Collaboration Diagram: EnterRegistrationInfo

EnterRegistrationInfo(UserName,Pswd,Email,..)
:Repository

1.U:=Create(UserName,Pswd,Email,..)User U:User

2.add(U)

:User

43
Use case: Log-in

Use case: Log in

Actor: user

Purpose: to login to the website

Overview: a user will enter his username and password in order to be able to use

the repository.

Type: primary

Cross reference:

Use Cases: the user must complete the Register use case.

Typical course of events:

Actor Actions: System Response:

1. This use case begins when a user

enters his/her username and password in

the login fields.

2. Clicks on "log in" button.

3. Checks info entered by the user.

4. Gives the user the permission to use

the repository.

Alternative Courses:

Line 3: either fields are empty or invalid data is entered, redisplay the page again

indicating errors.

44
SSD for Log-in

system

user
LogIn(UserName,Pswd)
Permission ( )

Operation Contract:LogIn

Name: LogIn(UserName:string,Pswd:string)

Responsibility: set this user account to be active.

Cross reference: Use case Log-in

Pre conditions: User (U) must be created

Post conditions: 1. U.Active was set to True.

Collaboration Diagram: LogIn

LogIn(UserName,Pswd)
:Repository

1.U:=findAccount(UserName,Pswd) User :User

2.SetToActive( )

U:User

45
Use Case Contribute.

Use Case: Contribute.

Actors: User.

Purpose: Add a new learning object to the repository.

Overview: A user adds a new learning object to the repository with a complete

information about that object.

Type: Primary.

Cross reference:

Use Cases: the user must complete the Log-in use case.

Typical Course of Events:

Actor Action System Response

1-This use case begins when the

user clicks on Contribute link.

2- Display a page with a form to be

filled with required information and

whether to upload the learning

object or to provide its URL.

3- Fills the form and chooses the type of

contribution:

a. If upload see section Upload LO.

b. If URL see section provide a URL.

4- Adds the learning object to the

repository.

5- Display a confirmation message.

46
Section: Upload LO:

Typical Course of Events:

Actor Action System Response

1- The user chooses contribution

by uploading the learning object.

2- Browse the learning object

from the user's computer.

3- the user Determines the place of

the learning object and selects it then

clicks Add.

Section: Provide a URL:

Typical Course of Events:

Actor Action System Response

1- The user chooses to contribute by URL.

2- puts the URL of the learning object in a specified

field then clicks on add.

SSD for Contribute

: System
User
AddLO(UserId ,Type,Creator ,SubCatID......etc).

Confirm-contribution(msg)

47
Operation Contract: AddLO.

Name :Add_LO(UserId ,Type, Creator ,SubCatID......etc).

Cross References: Use case Contribute.

Responsibilities: Add a new LO along with its Meta Data to the repository.

Pre-Conditions: 1- U.Active is set to true.

Post-Conditions: 1- A new LO instance (lo) was created.

2- A new MetaData instance (md) was created.

3- lo.UserId is set to UserId ,md.Type is set to Type......etc.

4- md was associated with lo based on LOID.

5- lo was associated with U based on UserId.

6- lo was associated with SubCategory based on SubCatID.

Collaboration Diagram:AddLO

AddLO(UserId,...) 1:CreateLO(UserId,…)
:Repository lo:LO

2:CreateMD(Creator,…)
Md:MetaData

3:Add(lo)
:LO

48
Use Case Browse.

Use Case: Browse.

Actors: User.

Purpose: browse learning objects by category and subcategory.

Overview: A user browses learning objects of a specified subcategory.

Type: Primary.

Typical Course of Events:

Actor Action System Response

1- This use case begins when a user

clicks on "Main Categories" link.

2-dispaly a list with different

Categories and subcategories .

3- The user Chooses a subcategory.

4-display all learning objects of

the selected subcategory.

5- clicks on the title of the

desired learning object. 6- Display the selected learning

object.

49
SSD for Browse

: System
User
Browse (SubCatID)

Display(LO)

Operation contract: Browse(SubCatID)

Operation: Search (SubCatID: Integer)

Cross Reference: Use case Browse.

Responsibilities: Browse LOs .

Pre-Condition: none.

Post-Condition: none

Collaboration Diagram: Browse

Browse(SubCatID)
:Repository

1.Browse(SubCatID)

1.1.Array[i]=. Browse(SubCatID): Identifier :LO


Sub:SubCat

1.2*.[for each]Display(LOID)
Lo:LO

50
Use case : Search

Use Case: search

Actor : user.

Purpose : search through the repository to find a LO.

Description : a user search through the repository using keywords.

Type : primary

Cross reference:

Use Cases: the user must complete the Log-in use case.

Typical course of events :

Actor action system response

1. This use case begins when a user Enters

a word in the specific search field and clicks

"Search" button.

a. If Advanced Search See section

Advanced search

2. the system searches through the

repository to retrieve the stored metadata.

3.display a new page with the results.

51
Section : Advanced search

Typical course of events :

Actor action system response

1. the user Clicks "Advanced search" link.

2.display a new page with a list of

metadata to be specified.

3. the user specifies the LO by identifying

the metadata

SSD for Search

: System
User
Search (Keyword)

Results(LO))

Operation contract: Search(Keyword)

Operation: Search (Keyword: Text)

Cross Reference: Use case Search

Responsibilities: Search for Los by their metadata.

Pre-Condition: none.

Post-Condition: none

52
Collaboration Diagram: Search

Search(Keyword) 1Array[i]=. Search(Keyword): Identifier MetaData


:Repository

2*.[for each]Display(LOID)
Lo:LO

53
Use Case: Rate LO

Use Case: Rate LO

Actors: User

Purpose: To evaluate a LO.

Overview: A user chooses to rank a LO based on 5 degrees of rating.

Type: Optional

Cross Reference:

Use Case: A user must have completed the Log-in use case.

Typical course of events

Actor Action System Response

1. This use case begins when a user


clicks on the star scale (from 1 star to
5 stars)

2. Redisplays the page with the new


rating.

SSD for RateLO

: System
User
RateLO (StarNo, LOID)

NewRate(Rate)

54
Operation contract: RateLO

Operation: RateLO (StarNo: integer)

Cross Reference: Use case RateLO

Responsibilities: To rate a LO .

Pre-Condition:U. Active is set to true

Post-Condition: 1- A new Rating instance r was created.

2- r.NoStars was set to StarNO.

3- r was associated with U based on UserId.

4- r was associated with lo based on LOID.

Collaboration Diagram: RateLO

RateLO (StarNo)
: Repository 1. RateLO (StarNo) lo: LO

1.1 CreateRaing(StarNo,LOID,UserId)

r:Rating

55
Use Case: modify

Use Case: Modify

Actors: User

Purpose: Modify metadata for a specific LO.

Overview: A user chooses the LO and modifies the metadata.

Type: Optional

Cross references:

Use Cases: A user must have completed the Log-in use case

Typical course of events

Actor Action System Response

1. This use case begins when an


owner of a LO clicks on "Modify"
link.
2. Display metadata form with current
information.
3. The user modifies the metadata.
4. The user clicks on save.
5. Update the repository.
6. Display confirmation message.

SSD for Modify

: System

User
Modify (LOID)
CurrentInfo(Creator,title,.. )
NewInfo(Creator,title,.. )
Confirm (msg)

56
Operation contract: Modify

Name: Modify (LOID: integer)

Cross Reference: Use case Modify

Responsibilities: display current metadata for a specific LO.

Pre-Condition: U. Active is set to true

Post-Condition: none

Collaboration Diagram: Modify

Modify (LOID) : Repository 1. Modify (LOID):lo : LO

3. Modify (Identifier) 2. Modify (LOID)

md:MD Lo:LO

Operation contract: NewInfo

Name: Modify (Creator:string, Title:string,…etc)

Cross Reference: Use case NewInfo

Responsibilities: modify current metadata for a specific LO.

Pre-Condition: U. Active is set to true

Post-Condition: 1- lo instance was updated with new values.

2- md instance was updated with new values.

57
Collaboration Diagram: NewInfo

NewInfo(Creator,title,..) 1.NewLOInfo(audience) Lo:LO


: Repository

2.NewMDInfo(Creator,title,..) md:MD

58
Use Case: Delete

Use Case: Delete

Actors: Admin

Purpose: Delete a LO.

Overview: the administrator chooses a LO to be deleted.

Type: Optional

Cross references:

Use Cases: Admin must have completed the Log-in use case

Typical course of events

Actor Action System Response

1. This use case begins when an


administrator enters the LOID in the
specific field.

2. Admin clicks on "Delete" button. .


3. Display a prompt window.
4. Admin clicks on yes.
5. Delete LO.
6. Update the repository.

SSD for Delete

: System
User
Delete (LOID)

Confirm (msg)

59
Operation contract: Delete

Name: Delete (LOID: integer)

Cross Reference: Use case Delete

Responsibilities: Delete a specific LO.

Pre-Condition: admin. Active is set to true

Post-Condition: 1.lo instance was deleted.

2. md instance was deleted.

3. The association with subcategory was deleted.

4. The associated personal collection instances were deleted.

5. The associated Report Back instances were deleted

6. The associated comment instances were deleted

7. The associated Viewing instances were deleted

8. The associated Rating instances were deleted

9. The association with User U was deleted

10. The associated Track Back instances were deleted

Collaboration Diagram: Delete

Delete (LOID)
: Repository 1. Delete (LOID) : lo

60
Use Case: ReportBack

Use Case: ReportBack

Actors: User

Purpose: flag a LO as inappropriate for some reason

Overview: A user chooses to report on a LO by selecting a specific reason.

On completion the report should be reviewed by the Admin.

Type: optional

Cross References:

Use cases: the user must have completed the Log-in use case .

Typical course of actions:

Actor Action System Response

1. This use case begins when a user

clicks on a "Report Back" link

2. Displays a window that shows a drop

down menu titled by "Select a Reason"

which consist of 4 options : Technical,

Content veracity, Spam or other , and a

"Report" button.

3. The user chooses one of the options

and then clicks the report button.

4. Update the Repository with the new

report

5. Displays a new page with a thank you

message

61
SSD for ReportBack:

:System

User
ReportBack (LOID, Reason)

Confirm (Message)

Operation Contract: ReportBack

Name: ReportBack (LOID: number , Reason: string)

Responsibility: Choose to Report on a LO, Select a reason.

Cross References: Use case ReportBack

Pre-conditions: U.Active was set to true, an instance of LO lo was created

Post-conditions: 1. A Report was created.

2. Report.reason was set to Reason

3. Report.LOID was set to LOID

Collaboration Diagram: ReportBack

MakeReport (LOID, Reason) : Repository

1 MakeReport (LOID, Reason)


: Report

62
Use case : Create a Personal Collection

Use case : Create a Personal Collection

Actor : User.

Purpose : create a container that gathers the user's favorite LOs.

Over view : a user creates a personal collection and names it .

Type : optional

Cross Reference:

Use case : a user must have completed the Log-in use case.

Typical course of events :

Actor action System response

1. this use case begins when a user

clicks on "My Favorites" link.

2. a new page appears with the

current collections along with a

name field to create a new

collection.

3. the user enters a name for the new personal

Collection.

4. the user clicks on the create button.

5. create a new collection.

6. redisplay the page with the

updated collections' list.

63
Alternative Courses

Line 3: The Personal collection name is already exists.

SSD for CreateaPersonalCollection (PCID)

: System
User
CreateaCollection (name,UserId)
RedisplayPage( )

Operation Contract: CreateCollection.

Operation: CreateCollection(UserId: integer, name: string)

Cross reference : Use case Create a Personal Collection.

Responsibilities: Create a new personal collection.

Pre conditions : U.Active was set to true

Post conditions :

1. a new Personal Collection instance PC was created.

2. PC.name was set to name.

3. PC was associated to the user U based on UserId.

Collaboration diagram : CreateCollection

CreateCollection(UserId,name) : Repository

1. Create(UserId,name) Personal
collection
64
Use Case: AddToPersonalCollection

Use Case: AddToPersonalCollection

Actors: User

Purpose: Add a preferred LO to a specific Personal Collection container.

Overview: A user chooses to add the current LO to my favorites then selects the

container to be added in.

Type: Optional

Cross Reference:

Use Case: A user must have completed the Log-in use case.

Use Case: A user must have completed the Create a Personal

Collection use case.

Typical course of events

Actor Action System Response

1. This use case begins when a user


clicks on “Add to My Favorites” link.
2. A new page pop window appears
with a drop down list of current
collection(s).
3. The user selects a collection

4. The user then clicks on “Add”


button
5. Adds a LO to the desired
collection.

7. Displays a confirmation message.

65
SSD for AddToPersonalCollection (CollectionID, LOID)

: System
User
AddToPersonalCollection (PCID, LOID)

ConfirmMessage(Mesage )

Operation contract: AddToPersonalCollection (PCID, LOID)

Operation: AddToPersonalCollection (PCID: integer, LOID: integer)

Cross Reference: Use case AddToPersonalCollection

Responsibilities: To add a LO to a specific collection.

Pre-Condition: U. Active is set to true

Post-Condition: PC.LOID was set to LOID .

Collaboration Diagram: AddToPersonalCollection (PCID, LOID)

AddToPersonalCollection (PCID, LOID)


: Repository

2. AddToPC (LOID)
: pc
1. pc= RetrievePC(PCID)
: PC

66
Use Case: Tell a Friend

Use Case: Tell a Friend

Actors: User

Purpose: To send a LO link to specific recipient.

Overview: The user specifies the message and the recipient of the mail and

then sends the mail.

Type: Optional

Typical course of events

Actor Action System Response

1. This use case begins when a user


clicks on “Tell a Friend” link.
2. A new page appears with empty
fields to fill.
3. A user then fills the required fields

4. After filling the fields, the user


clicks on “Send” button
5. Checks for any invalid input or
empty fields.

6. Sends the e-mail.

7. A new page appears with a


confirmation message.

Alternative Courses

Line 6: Invalid inputs entered or empty fields indicated.

67
SSD for Tell a Friend :

system

user
TellaFriend(Msg,SEmail,REmail)
confirm()

Operation contract: TellaFriend(Msg,SEmail,REmail)

Operation: TellaFriend

Cross Reference: none

Responsibilities: To tell s friend about a LO.

Pre-Condition: none.

Post-Condition: none.

Collaboration Diagram: TellaFriend(Msg,SEmail,REmail)

tellaFriend(Msg,SEmail,REmail ) 1.telllafeiend(Msg,SEmail,REmail ) Lo:LO


:Repository

68
Use Case: Send e-mails

Use Case: Send e-mails

Actors: Administrator

Purpose: To send e-mails to the mailing list subscribers.

Overview: An administrator specifies the message and sends the e-mail.

Type: Optional

Cross Reference:

Use Case: An administrator must have completed the Log-in use case.

Typical course of events

Actor Action System Response

1. This use case begins when an


administrator clicks on “send an e-
mail” link.

2. A new page appears with empty


message field to fill.
3. The administrator types the
message.

4. After filling the field, the


administrator clicks on “send” button

5. Checks for any wrong input or


empty fields.

6. Sends the e-mail to all people in


the mailing list.

7. A new page appears with a


confirmation message.

Alternative Courses: Line 6: Invalid or Empty message field indicated.

69
SSD for Send Email:

system

user
SendEmail(Msg)
confirm()

Operation Contract: SendEmail(Msg)

Name: SendEmail( Msg: Text)

Responsibility: send email to the mailing list subscribers.

Cross reference: use case log in.

Pre conditions: U.Active is set to true.

Post conditions: none.

Collaboration Diagram: SendEmail(Msg)

SendEmail(Msg ) 1Array[i]=.sendeamil( ) :User


:Repository

2*.[for each][RecieveMail=True].sendeamil(Msg )
U:User

70
Use case: Log out

Use case: Log out

Actor: user

Purpose: to logout from the website

Overview: a user will logout from the repository.

Type: primary

Cross reference:

Use Cases: the user must complete the Log-in use case.

Typical course of events:

Actor Actions: System Response:

1. This use case begins when a user clicks

on "Log out" button.

2. End the user session.

SSD for Log-out

system

user
LogOut()
EndSession()

71
Operation Contract:LogOut

Name: LogOut( )

Responsibility: End the user session

Cross reference: Use case Log-out

Pre conditions: U.Active is set to true.

Post conditions:

1. U.Active was set to False.

Collaboration Diagram: LogOut

LogOut( ) 1.LogOut( ) U:User


:Repository

72
Recommender System:

73
9.4. Class Diagram:

74
9.5. ER Diagram:

75
9.6. Data Base Schema:
aspnet_PersonalizationPerUser
aspnet_WebEvent_Events Id

EventI d aspnet_SchemaVersions aspnet_Applications


Pat hI d
Applic ationNam e
EventTim eUtc Feat ur e
UserI d

aspnet_Paths
Lower edApplicat ionNam e
EventTim e Com pat ibleSchem aVersion
PageSet t ings
Applic ationI d
EventType I sCurr ent Ver sion Applic at ionI d
LastUpdatedDat e
Descr ipt ion
EventSequence PathId

EventOccur rence
aspnet_Membership Path
Applic at ionI d

EventCode LoweredPat h
User Id

EventDetailCode

Password

M essage

PasswordFor m at

Applic at ionPath

PasswordSalt

Applic at ionVir tualPath

M achineNam e
M obilePIN
aspnet_PersonalizationAllUsers
Em ail PathI d
Request Ur l

LoweredEm ail
PageSet tings
Except ionType

PasswordQuestion
Last Updat edDate
Det ails

PasswordAnswer

I sAppr oved

I sLockedOut

aspnet_Roles
CreateDat e

Last LoginDat e
Applic ationId

Last Passwor dChangedDat e


RoleI d

Last Lockout Dat e


RoleNam e

FailedPasswor dAt t em pt Count


Lower edRoleNam e

FailedPasswor dAt t em pt WindowSt art


Descr ipt ion

FailedPasswor dAnswer At tem pt Count

FailedPasswor dAnswer At tem pt WindowSt ar t

Com m ent

Comment
Cno

LOI D

com m ent

dat e

UserI d

I sAppr oved

aspnet_UsersInRoles
UserI d

RoleId

Viewing
LOID

User Id
aspnet_Profile
User Id

Pr oper t yNam es

Pr oper t yValuesSt r ing

Pr oper t yValuesBinary

Last Updat edDate

aspnet_Users
Applicat ionI d

UserI d

UserNam e

User_InterestFields
Lower edUser Nam e

M obileAlias
User I d

IsAnonym ous
Inter est Field

LastActiv it yDat e

LO
LOI D

SubCat I D

BundleURL

NoOf Downloads

NoOf Views ReportBack


RBI D
TrackBacks

MetaData audience
LOI D

I dentif ier
reason
User Id

Tit le
dat e

PersonalCollection Creator
UserI d

PCI D
Language

PCNam e
For m at

UserI d
Dat e

Cont ribut or

Description

Coverage Rating
UserI d
Publis her

Relat ion
SubCategory LOI D

SubCatI D

Right s
TrackBack NoStar s

PersonalCollection_LO Sour ce
SubCatNam e
LOID

PCID Cat ID
Subj ect TBID

LOID

Type Tit le

excer pt

ur l

Category
Cat ID

Cat Name

76
9.7. Data Base Dictionary

Tables

Table Description
aspnet_Applications --
aspnet_Membership User's membership
aspnet_Paths --
aspnet_PersonalizationAllUsers --
aspnet_PersonalizationPerUser --
aspnet_Profile --
aspnet_Roles --
aspnet_SchemaVersions --
aspnet_Users User's accounts
aspnet_UsersInRoles --
aspnet_WebEvent_Events --
Category Main Categories
Comment Comments on LO
LO Learning Object
MetaData MetaData for LO
PersonalCollection User Personal Collection
PersonalCollection_LO LO contained in PC
Rating Ratings on LO
ReportBack Reports on LO
SubCategory Sub Categories
TrackBack TrackBack on LO
User_InterestFields Users interest fields
Viewing Viewing of LO

Columns

Table Column Datatype Description


aspnet_Applications ApplicationName NVarChar -
(256)
aspnet_Applications LoweredApplicationName NVarChar -
(256)
aspnet_Applications ApplicationId UniqueIdent Primary key
ifier
aspnet_Applications Description NVarChar -
(256)
aspnet_Membership ApplicationId UniqueIdent Link to
ifier aspnet_Applic
ations table
aspnet_Membership UserId UniqueIdent Link to
ifier aspnet_Users
table

77
aspnet_Membership Password NVarChar User's
(128) password
aspnet_Membership PasswordFormat Int -
aspnet_Membership PasswordSalt NVarChar -
(128)
aspnet_Membership MobilePIN NVarChar -
(16)
aspnet_Membership Email NVarChar User's email
(256)
aspnet_Membership LoweredEmail NVarChar -
(256)
aspnet_Membership PasswordQuestion NVarChar -
(256)
aspnet_Membership PasswordAnswer NVarChar -
(128)
aspnet_Membership IsApproved Bit -
aspnet_Membership IsLockedOut Bit -
aspnet_Membership CreateDate DateTime -
aspnet_Membership LastLoginDate DateTime -
aspnet_Membership LastPasswordChangedDate DateTime -
aspnet_Membership LastLockoutDate DateTime -
aspnet_Membership FailedPasswordAttemptCount Int -
aspnet_Membership FailedPasswordAttemptWindow DateTime -
Start
aspnet_Membership FailedPasswordAnswerAttemptC Int -
ount
aspnet_Membership FailedPasswordAnswerAttempt DateTime -
WindowStart
aspnet_Membership Comment NText -
aspnet_Paths ApplicationId UniqueIdent Link to
ifier aspnet_Applic
ations table
aspnet_Paths PathId UniqueIdent Primary key
ifier
aspnet_Paths Path NVarChar -
(256)
aspnet_Paths LoweredPath NVarChar -
(256)
aspnet_Personalization PathId UniqueIdent Link to
AllUsers ifier aspnet_Paths
table
aspnet_Personalization PageSettings Image -
AllUsers
aspnet_Personalization LastUpdatedDate DateTime -
AllUsers
aspnet_Personalization Id UniqueIdent Primary key
PerUser ifier
aspnet_Personalization PathId UniqueIdent Link to

78
PerUser ifier aspnet_Paths
table
aspnet_Personalization UserId UniqueIdent Link to
PerUser ifier aspnet_Users
table
aspnet_Personalization PageSettings Image -
PerUser
aspnet_Personalization LastUpdatedDate DateTime -
PerUser
aspnet_Profile UserId UniqueIdent Link to
ifier aspnet_Users
table
aspnet_Profile PropertyNames NText -
aspnet_Profile PropertyValuesString NText -
aspnet_Profile PropertyValuesBinary Image -
aspnet_Profile LastUpdatedDate DateTime -
aspnet_Roles ApplicationId UniqueIdent Link to
ifier aspnet_Applic
ations table
aspnet_Roles RoleId UniqueIdent Primary key
ifier
aspnet_Roles RoleName NVarChar -
(256)
aspnet_Roles LoweredRoleName NVarChar -
(256)
aspnet_Roles Description NVarChar -
(256)
aspnet_SchemaVersion Feature NVarChar Primary key
s (128)
aspnet_SchemaVersion CompatibleSchemaVersion NVarChar Primary key
s (128)
aspnet_SchemaVersion IsCurrentVersion Bit -
s
aspnet_Users ApplicationId UniqueIdent Link to
ifier aspnet_Applic
ations table
aspnet_Users UserId UniqueIdent Primary key
ifier
aspnet_Users UserName NVarChar -
(256)
aspnet_Users LoweredUserName NVarChar -
(256)
aspnet_Users MobileAlias NVarChar -
(16)
aspnet_Users IsAnonymous Bit -
aspnet_Users LastActivityDate DateTime -
aspnet_UsersInRoles UserId UniqueIdent Link to
ifier aspnet_Users

79
table
aspnet_UsersInRoles RoleId UniqueIdent Link to
ifier aspnet_Roles
table
aspnet_WebEvent_Eve EventId Char (32) Primary key
nts
aspnet_WebEvent_Eve EventTimeUtc DateTime -
nts
aspnet_WebEvent_Eve EventTime DateTime -
nts
aspnet_WebEvent_Eve EventType NVarChar -
nts (256)
aspnet_WebEvent_Eve EventSequence Decimal -
nts (19,0)
aspnet_WebEvent_Eve EventOccurrence Decimal -
nts (19,0)
aspnet_WebEvent_Eve EventCode Int -
nts
aspnet_WebEvent_Eve EventDetailCode Int -
nts
aspnet_WebEvent_Eve Message NVarChar -
nts (1024)
aspnet_WebEvent_Eve ApplicationPath NVarChar -
nts (256)
aspnet_WebEvent_Eve ApplicationVirtualPath NVarChar -
nts (256)
aspnet_WebEvent_Eve MachineName NVarChar -
nts (256)
aspnet_WebEvent_Eve RequestUrl NVarChar -
nts (1024)
aspnet_WebEvent_Eve ExceptionType NVarChar -
nts (256)
aspnet_WebEvent_Eve Details NText -
nts
Category CatID Int Primary key
Category CatName VarChar category name
(50)
Comment Cno Int Primary key
Comment LOID Int Link to LO
table
Comment comment Text the comment
Comment date SmallDateT when it was
ime added
Comment UserId UniqueIdent Link to
ifier aspnet_Users
table
Comment IsApproved Bit To approve
comments

80
before
displaying
them
LO LOID Int Primary key
LO SubCatID Int Link to
SubCategory
table
LO BundleURL VarChar Learning
(100) Object URL
LO NoOfDownloads Int number of
downloads for
this LO
LO NoOfViews Int number of
Views for this
LO
LO TrackBacks Int number of
TrackBacks
for this LO
LO audience VarChar LO target
(50)
LO UserId UniqueIdent Link to
ifier aspnet_Users
table
MetaData Identifier Int Link to LO
table
MetaData Title VarChar LO title
(50)
MetaData Creator VarChar LO creator
(50)
MetaData Language VarChar (5) Language of
the contents
MetaData Format VarChar format of the
(20) LO (ex: pdf,
swf,..etc)
MetaData Date SmallDateT when it was
ime added
MetaData Contributor VarChar who was
(50) responsible for
making
contributions
to the LO
MetaData Description Text breif
description of
the contents
MetaData Coverage Text The spatial or
temporal topic
of the LO, the
spatial
applicability of

81
the LO, or the
jurisdiction
under which
the LO is
relevant.
MetaData Publisher VarChar who is
(50) responsible for
making the LO
available
MetaData Relation Text related Los
MetaData Rights Text Information
about rights
held in and
over the LO.
MetaData Source Text related
resource from
which the
described LO
is derived
MetaData Subject VarChar topic of the LO
(100)
MetaData Type VarChar The nature or
(50) genre of the
LO (ex:image,
sound, text,
..etc)
PersonalCollection PCID SmallInt Primary key
PersonalCollection PCName VarChar personal
(50) collection
name
PersonalCollection UserId UniqueIdent Link to
ifier aspnet_Users
table
PersonalCollection_LO PCID SmallInt Link to
PersonalCollec
tion table
PersonalCollection_LO LOID Int Link to LO
table
Rating UserId UniqueIdent Link to
ifier aspnet_Users
table
Rating LOID Int Link to LO
table
Rating NoStars SmallInt the rating
degree
representing
by 5 stars scale
ReportBack RBID Int Primary key
ReportBack LOID Int Link to LO

82
table
ReportBack reason VarCharMa reason of the
x report
ReportBack date SmallDateT when it was
ime added
ReportBack UserId UniqueIdent Link to
ifier aspnet_Users
table
SubCategory SubCatID Int Primary key
SubCategory SubCatName VarChar sub category
(50) name
SubCategory CatID Int Link to
Category table
TrackBack LOID Int Link to
SubCategory
table
TrackBack TBID Int Id of the
TrackBack
TrackBack Title VarCharMa title of the
x TrackBack
TrackBack excerpt VarCharMa the msg
x
TrackBack url VarCharMa URL of the
x other site
User_InterestFields UserId UniqueIdent Link to
ifier aspnet_Users
table
User_InterestFields InterestField VarChar Partial key
(500)
Viewing LOID Int Link to the LO
table
Viewing UserId UniqueIdent Id of the user
ifier who viewed
the LO

83
10. Implementation

In this part we will provide a complete details about the implementation of


Marifa the digital repository for learning objects. Before starting with the
implementation details, we will talk briefly about the tools that helped us to develop
the website. In order to develop the website we used Microsoft Visual Studio 2005
.The pages are created using asp.net web applications. We preferred to choose the
VB.NET as a programming language. In addition, Ajax provided us with technique to
ensure interactivity to our web site. We used Microsoft SQL server 2005 and
Microsoft SQL server Management studio to access the database in a graphical
manner, configure and build the complex queries and manage the security of
accessing the database. In order to document our databases, we used Data dictionary
creator. It stores all the information in Extended Properties so it is easier to keep the
documentation in sync with the database as it changes.

The hierarchy of Marifah:

Marifah

LO
LO Search and LO Manipulation: Evaluation/Ranking: Registration & Administration:
Retreiving: Authentication:
-Contribute LO - Rating
- Search. - Delet LO - Registration - Admin Pages.
- Advanced Search -Modify Metadata
- Reports & tatistics - Login - Managing Roles.
-Browsing -Personal Collections - RSS Feeds. -Categories Administration
- Report back - Recommendation - Metadata Administration
-Comment - Membership
Administration

84
10.1 Registration

Registration process adds a visitor of Marifa to the member list. This begins
when a user clicks on "bcbd ‫م‬bfghi‫ آ‬klmhn " link under the form of login.
The user will be directed to a page that contains a form to be filled with his
information including his user name, password, e-mail, first name, last name and his
educational level as shown in figure 1.1. In addition, the user will check on his
interest fields in the check boxes. When the user clicks on "klmhon" button , a query
will be sent to the database to add this user with his information to the users table.

Figure 10.1

In the case of wrong entered information to the form of registration, the same page
will be displayed again and the user will be informed with the reason and the place of
the wrong input as shown in figure 1.2:

85
Figure 10.2

10.2 Login
Login is the process of authenticating registered users .It starts when the user
clicks on "‫ل‬qor‫ د‬klmhon" button after writing his user name and password. A query will
be sent to the database to make sure that entered information are found and true. If the
user is authenticated, he logs in and can access his profile and other services offered
by Marifa, otherwise he redirected to the previous page and forced to write valid
information. Figure 1.3 shows the location of login form.

Figure 10.3

86
10.3 User's Home Page
After Logging in, the user will be directed to his home page. This page allows
the user to control his personal account and any learning object added by him. In
addition, it contains a link to add a new learning object. Figure 1.4 shows the user's
home page.

Figure 10.4

10.4 Recommender System


The user's home page provides a list of recommended learning objects for that
user depending on his interest fields, RSS , trackbacks and rating.

10.5 Browse
Browsing learning objects is the process of exploring all learning objects in a
categorized way in order to help the user to find the desired learning object easily.
Browsing learning objects can be done in two ways; either by clicking on the list of
subcategories in the home page or by clicking on the link “tlholuvw‫م ا‬yhoz{‫ ”ا‬which is
found in the home page that directs the user to the page “Browse. asp” which lists all
categories with their sub categories as shown in figure 1.5 . When the user clicks on a
sub category, a query will be sent with the ID of the clicked sub category to get all

87
learning objects available in this sub category and will be displayed as shown in
figure 1.6.

Figure 10.5

Figure 10.6

10.6 View Learning Object


Viewing learning object is the process of listing all metadata information and
other statistical information of a specific learning object and then exploring the
learning object. The process starts by either browsing through learning objects, as
stated before, or by using Marifa's search engine. Query string is used to link browse

88
or search result pages, to the learning object page”ViewLO.asp” .The linking code is
shown below:

<a href="ViewLO.aspx?LOID=<%# Eval ("LOID")%>"> <asp:Image ID="IMG1"


runat="server" ImageUrl='~/images/View.gif' style="position: static"
/></a>

LOID is added to the query that views the intended learning object and its associated
metadata; the query is as follows:

SELECT LO.LOID, LO.SubCatID, LO.UserId, LO.BundleURL, LO.NoOfDownloads,


LO.NoOfViews, LO.TrackBacks, LO.rating, LO.audience, MetaData.Identifier,
MetaData.Title, MetaData.Creator, MetaData.Language, MetaData.Format,
MetaData.Date, MetaData.Contributor, MetaData.Description,
MetaData.Coverage, MetaData.Publisher, MetaData.Relation, MetaData.Rights,
MetaData.Source, MetaData.Subject, MetaData.Type
FROM LO CROSS JOIN
MetaData
WHERE (LOID = @LOID)

Figure 1.7 shows the page of viewing a learning object:

Figure 10.7

89
10.7 Tell a Friend
Tell a friend is a process that allows a user to tell his/her friend about a certain
learning object, this process begins when the user clicks on "}cbo~ }cbow ko€‫ "أر‬button,
fills the form with his name,his email,his friend's email and if he want to write a
message ,then he clicks on "k€‫"إر‬button as shown in figure 1.8.

Figure 10.8

10.8 Sort Learning Objects


Is the process of sorting learning object in diffrent ways: from newest to oldest
, from oldest to newest, sort by title or by auther. This process begins when the user
select the type of sorting from drop down list shown at the top of the page of listing
all learning objects of a specific subcategory.

10.9 Search
10.9.1 Simple Search
Searching for learning objects is the process to find the desired learning object
easily.Simple search begins when the user adds keywords in the text box at the top of
the home page, chooses the type of matching; match any word or match the sentences
exactly then clicks on "„o…†" button. If there is a result, they will appear in a separate
page. Otherwise, a message will appear to inform the user that there were no results.

90
10.9.2 Advanced Search

Advanced search begins when the user clicks on the "‫م‬bo‡gˆ „o…†"link in the
site’s home page , the AdvancedSearch page will be opened and the user will fill the
form with information including: the title, keywords, author ,description and clicks on
"„o…†" button. If there is, results found they would be listed. Otherwise, a message that
informs the user that there were no results. Figure 1.9 shows advanced search page.

Figure 10.9

10.10 Contribute a Learning Object


Contributing or adding learning objects is the process of adding a new learning
object to the repository along with its Metadata. The process begins when the user
clicks on "‹oilŒn ŽoŒˆ t‰yoŠ‫ "إ‬link at the user's home page to open the uploading page as
shown in the figure 1.10.

91
Figure 10.10
Upload page is divided into three main parts:
1. The necessary fields (required fields) are:

• Title
• Creator
• Subject and Keywords
• Audience
• Resource type
• Category
• Language

2. The optional fields:


• Description
• Publisher
• Other contributor
• Rights
• Source
• Coverage
• Relations
3. The type of uploading:
The user must choose from two types of adding a learning object to the repository:
• Browse the computer to find the desired LO.
• On the other hand, add a link to other websites where the LO is already
there.
In addition, this page provides the user with a link to a "help" page that describes the
meaning of each field in both Arabic and English.
The help page is shown in figure 1.11:

92
Figure 10.11

As shown in the previous figure, the help page is designed to use collapse
panels. In the case of a successful uploading, the confirmation page will appear.
And in case of failure uploading caused by missing the required fields the page will
be redisplayed indicating the missing fields with red "*" and a description of the error
at the end of the required fields part of the page. Other failure cases will display the
error page to the user.

10.11 What is New


What is new is a process that lists the last 10 learning object added to the repository.
This process begins when the user clicks on "to‰vˆ bocbd" link in the home page.This
link directs the user to tha page recent.aspx as shown in figure 1.12:

Figure 10.12

93
10.12 RSS
RSS web feed formats are used to publish frequently updated content of the
main categories .This process begins when the users click on "‫ك ان‬vgo’‫"ا‬link, then he
chooses the category and click on subscribe to this field. As shown in figure 1.13.

Figure 10.13
RSS is shown below:

<?xml version="1.0" encoding="utf-8" ?>


<rss version="2.0">

<channel>

<title>345678‫ ا‬3:;<=>‫< ا‬/title>


<description>‫ض‬6‫ــ‬A B:‫ــ‬C‫ا‬DEF8 3‫ــ‬GF4HI‫ا‬ ‫م‬DF48K‫ــ‬L 3:A67‫ــ‬8‫ا‬ ,
</description>
<link>religion.aspx</link>3OPQ ‫م‬DF48‫ا‬
<language>ar</language>

</channel>
</rss>

10.13 Average Rate


Average rate is the process of computing the average rate of each learning object in a
five star rating control, this process begins when the BrowseSub page is loaded .
The form of rating control is:

94
<ajaxToolkit:Rating
ID="Rating1" runat="server" AutoPostBack="True" CssClass="ratingStar"
CurrentRating='<%# MyFunc("Rating1",Container.DataItem("LOID")) %>'
Direction="RightToLeft" EmptyStarCssClass="Empty"
FilledStarCssClass="Saved" RatingDirection="RightToLeftBottomToTop"
StarCssClass="ratingItem" WaitingStarCssClass="Filled" Width="76px"
ReadOnly="True" BehaviorID="Rating1_RatingExtender" Enabled="False"
EnableTheming="False" EnableViewState="False">
</ajaxToolkit:Rating>

10.14 Number Of Votes


Is the prosess of counting the number of votes for a specific learning object,
this number appears when the user views a learning object page.

10.15 My Personal Collections


This page is available only for members .It is accessed by clicking on
"‹n“”o•ˆ" link in the user's home page as shown in figure 1.14. It displays the
member's personal collections that are created by the member. Also, it allows him to
create a new personal collection and rename or delete any collection that is already
existed. Moreover , the user can browse the contents of any collection. The user also
can add any learning object to his personal collection.

Figure 10.14

95
10.15.1 Create a Personal Collection
It allows the member to create his own personal collection. When the user
writes the name of the new personal collection in the text box and clicks on "‫ء‬y—o˜‫"إ‬
button, a query will be sent to the database to add this new user's collection. A
validation will be made to make sure that the name of the new personal collection is
unique in the previously created personal collections by that user.

10.15.2 Delete a Personal Collection


This process allows the user to delete a personal collection created before.
When the user clicks on "‫šف‬o›" link next to the personal collection name, a query will
be sent to the database to delete this collection along with its contents.

10.15.3 Rename a Personal Collection


This process allows the user to rename a previously created personal
collection. When the user clicks on "œo€‫ ا‬kcbon " next to the personal collection name ,
a text box will appear and the user will write the new name of the collection and
when he clicks on "kcbon" a query will be sent to the database to change the name of
the personal collection.

10.15.4 Add to Personal Collection

After viewing learning object, the user can add a learning object to his
personal collection. This can be done by clicking on "‹gŒ”o•ˆ žow‫Ž إ‬oŠ‫ "أ‬button. Then, a
query will be sent to the database to add this learning object to the list of learning
objects in this specific collection. Also, a validation will be performed to check if this
learning object is already exists in that collection .If so, a message will appear to
inform the user with this error.

10.15.5 Delete a Personal Collection


This process allows the user to delete a learning object from a personal
collection , this can be done by clicking on "‫ض‬vo " next to the personal collection
name, a list of all learning objects contained in the collection will be displayed , the
user clicks on "‫ "›šف‬to delete this learning object.

96
10.16 Add Comment
Is the process to add comment for learning object, this process begins when the user
clicks on "}olŒn t‰yoŠ‫ "ا‬image and and write the comment then clicks on send the
comment as shown in figur 1.15.

Figure 10.15

10.17 Rating
Is a process to rating the learnig object in five star scale, this process begins when the
user moves the mouse cursor on the rating control and choose number of stars as
shown in figuer 4.16

Figure 10.16

97
10.18 Report Back
Is the process that allows users to send a message to administrator if there is a
problem in a specific learning object, this process begins when the user clicks on
"¡olŒ¢n" icon in the page of viewing the learning object , writes a message in the text
box . When he clicks on "k€‫ "أر‬the mesage will be sent to the Administrator.

10.19 Contatct Us
Is the process which allows the user to send an email to the administrator , this
process begins when the user clicks on contact us link , fills the form of Contact Us
with his name , email, and the message text . When he clicks on "ko€‫ "أر‬as shown in
figure 1.17:

Figure 10.17

98
10.20 Password Recovery
This process helps registered users when someone forgets his password and cannot
login.When a user clicks on "‫ور‬viw‫ ا‬tiŒ‫ آ‬¤lh˜" under the form of login .Then, he will be
directed to a page with a form to allow the user to enter his email as figure 1.18
shows. When the user clicks on "‫ل‬yo€‫ " ار‬button , a messagelcontaining his password
will be sent to his email.

Figure 10.18

99
10. 21 Change Password
This process is available only for logged in users. The user can change his
password by clicking on "vhow‫ ا‬toiŒ‫ آ‬voll¥n " link in the user's home page. He will be
directed to a page contains a form to write the old and new password then he will
clicks on "‫ور‬voiw‫ ا‬toiŒ‫ آ‬voll¥n " then the new password will replace the old one .Figure
1.19 shows the form of changing passwords.

Figure 10.19

10.22 Update User's Profile


This process is available only for members. It starts when the user clicks on " ‹•Œˆ
‹of—w‫ "ا‬in the user's home page (figure 1.20). Then he will be directed to a page that
contains a form which is filled with his current information stored in his profile then
he changes the needed feilds and he clicks on "¦o•›" . Finally, the user will be directed
to a page contains a conformation message .as shown in figure 1.21 .

100
Figure 10.20

Figure 10.21

101
10.23 Update
This process is available for members only.It allows them to update the metadata
of any learning object they added previously. This page is accessed by clicking on
"tolilŒgw‫دري ا‬yoˆ" in the user's home page , a list if all categories will be displayed
,when the user clicks on one of these categories a list of all learning objects added by
that user will be displayed . The user will click on "kcbogŒw yo¨‫ ه‬ª¥Š‫ "ا‬to display a form
of metadada for a specific learning object (figure 1.22). The user change desired fields
.When he clicks on "‫“ت‬cbogw‫¦ ا‬o•›" , aquery will be sent to the database to update the
Metadata of that learning object.

Figure 10.22

10.24 Download
After viewing a learning object, the user can download it to his PC, if the learning object is
uploaded to the database of Marifa repository, the user can download it by clicking on " ‫ة‬b‫ه‬y—oˆ
ŽoŒiw‫ "ا‬button in the page that views the learning object's metadata, a window will appear to ask
the user if he wants to save it or just open this object (figure 1.23), if he selects to save it , he will
choose the location in his PC to save that object. Otherwise, the learning object is not uploaded
to the database . In other words , the database contains a URL to that learning object and the
user will be directed to the learning object page.

Figure 10.23

102
10.25 Number Of Downloads
Is the process of counting the number of downloads of a specific learning object,
this process begins when user clicks on "kooli…n" button, a counter variable is
incremented by one and a new query will be sent to the database to update the number
of downloads of that learning object . Finally , this number is diplayed in
"viewLO.aspx" page under "‫ة‬b‫ه‬y—ˆ" lable.

10.26 Number of Views


Is the process to count the number of users who view a specific learning object.This
process begins when a user clicks on the link that directs the user to the page which
contains the metadata of that learning object.A counter variable is incremented by one
and a new query will be sent to the database to update the number of views of that
learning object . Finally , this number is diplayed in "viewLO.aspx" page under
"kli…n" lable.

10.27 Number of Comments


Is the process to count the number of users who added comment for a specific
learning object
The Number of comments code is:
<asp:SqlDataSource ID="NoCommentsDataSource" runat="server"
ConnectionString="<%$ ConnectionStrings:DBConnectionString1 %>"
SelectCommand="SELECT COUNT(Cno) AS NoCount FROM Comment
WHERE (LOID = @LOID)">
<SelectParameters>

10.28 Users Report


This report will display a weekly statistics in charts that show the number of
registered users. We used Crystal Report to compute this statistics (figure 1.24).

Figure 10.24

103
10.29 Learning Objects Report
This report will display the repository categories, sub categories and the LOID, title
and the creator for each LO. when the user clicks on one of the mentioned LO fields,
you will see the rest of Metadata for the chosen LO. We use Crystal Report to
compute this statistics (figure 1.25).

Figure 10.25

10.30 Count LO report


This report will display numbers that represent the total number of Los in each sub
category, and the number in the last row of each category represents the total number
of LOs in that category. Lastly, the number of all LOs in Marifa will be counted also
and displayed in the last row. We used Crystal Report to compute this statistics
(figure 1.26).

Figure 10.26

104
10.31 Admin Pages
The purpose of these pages is for administrating the repository. They are dealing
directly with the pages and information stored in the database (figure 1.27).

Figure 10.27
All admin pages codes are consisted of gridviews that are connected to the database
through SQLDataSource. a sample of these pages shows the code of the Categories
administration page is shown below:

<asp:GridView ID="GridView1" runat="server" AllowPaging="True"


AllowSorting="True"
AutoGenerateColumns="False" BackColor="White"
BorderColor="#DEDFDE" BorderStyle="None"
BorderWidth="1px" CellPadding="4" DataKeyNames="CatID"
DataSourceID="SqlDataSource1"
EmptyDataText="There are no data records to display."
ForeColor="Black" GridLines="Vertical">
<FooterStyle BackColor="#CCCC99" />
<RowStyle BackColor="#F7F7DE" />
<Columns>
<asp:CommandField ShowDeleteButton="True"
ShowEditButton="True" ShowSelectButton="True" />
<asp:BoundField DataField="CatID" HeaderText="CatID"
ReadOnly="True" SortExpression="CatID" />
<asp:BoundField DataField="CatName"
HeaderText="CatName" SortExpression="CatName" />
</Columns>
<PagerStyle BackColor="#F7F7DE" ForeColor="Black"
HorizontalAlign="Right" />
<SelectedRowStyle BackColor="#CE5D5A" Font-Bold="True"
ForeColor="White" />
<HeaderStyle BackColor="#6B696B" Font-Bold="True"
ForeColor="White" />
<AlternatingRowStyle BackColor="White" />
</asp:GridView>
<asp:SqlDataSource ID="SqlDataSource1" runat="server"
ConnectionString="<%$ ConnectionStrings:DBConnectionString2 %>"
DeleteCommand="DELETE FROM [Category] WHERE [CatID] =
@CatID" InsertCommand="INSERT INTO [Category] ([CatName]) VALUES
(@CatName)"

105
ProviderName="<%$
ConnectionStrings:DBConnectionString2.ProviderName %>"
SelectCommand="SELECT [CatID], [CatName] FROM [Category]"
UpdateCommand="UPDATE [Category] SET [CatName] = @CatName
WHERE [CatID] = @CatID">
<DeleteParameters>
<asp:Parameter Name="CatID" Type="Int32" />
</DeleteParameters>
<InsertParameters>
<asp:Parameter Name="CatName" Type="String" />
</InsertParameters>
<UpdateParameters>
<asp:Parameter Name="CatName" Type="String" />
<asp:Parameter Name="CatID" Type="Int32" />
</UpdateParameters>
</asp:SqlDataSource>

10.31.1 View Accounts Pages


This page lists all the accounts information (user Id, user name, email, interest fields,
create date, last login date) as shown in figure 1.28.This is done by sending a query to
the database to retrieve all accounts information in a table.

Figure 10.28

106
10.31.2 Edit User Information Page
The page shows member’s information when the administrator clicks on "view"
button. This information can be edited by clicking on edit button, and editing the
information, and then click on update button.
On the other hand, this user can be deleted by clicking on delete button, also the role
of user (member, administrators) can be edited by checking the checkbox of the role,
then clicking on update role (figure 1.29).

Figure 10.29

10.31.3 Online Users Page


When the administrator clicks on "yolwy› ‫ون‬bod‫ا‬qgiw‫ء ا‬y”o {‫ "ا‬link in the Administrator's
control panel , The page lists all users and administrators who are currently logged in
(figure 1.30).

Figure 10.30

107
10.31.4 Filter Users By Roles Page
When the administrator clicks on "to qimiw‫­ ا‬ho› ‫ء‬y”o ‫ض ا‬vo " , she will select the
type of filtering, by member, by Administrators or all users .Then, a page is displayed
which lists all users filtered by the selected role.(figure 1.31).

Figure 10.31

10.31.4 Create User Page


In this page, the administrator can create a new user. This is accomplished when she
clicks on "bocbd q”o  klmhon" in his control panel. A page will be displayed that contains
a form to be filled with information about this new user including: user name,
password, email and the role of that usre (figure 1.32).

Figure 10.32

108
10.31.5 Manage Roles Page
This page allows the administrator to manage roles of users registered in
Marifah . This page is accessed when she clicks on "‫ت‬yo qimiw‫ "إدارة ا‬button , a page
will be dispayed contains a table of roles includes: Role name , number of users in
each role and a button to delete this role. In addition , this page allows the
administrator to create a new role by writing the name of the new role in a text box
and clicking on "Add Role" button (figure 1.33).

Figure 10.33

10.31.6 Edit Main Categories Page


The page lists the main categories in Marifah .This page is accessed when the
administrator clicks on "tlholuvw‫ت ا‬y•l¨ogw‫ "ا‬in the control panel .These records can be
edited and filtered (selected).This view is derived from a single database table (figure
1.34) .

Figure 10.34

109
10.31.7 Edit Sub Categories Page
The page lists all subcategories in the repository .These records can be deleted, edited,
and filtered (selected)." this view is derived from a single database table" see figure
1.35.

Figure 10.35

10.31.8 Main categories page


The page lists all main categories along with their subcategories. These records can
be only viewed and/ore filtered (selected). This view consists of more than one table.
So ,modification or deletion is not permitted (figure 1.36).

Figure 10.36

110
10.31.9 Add New Main Category
This page allows to the administrator to add a new main category to the repository .As
shown in figure 1.37 the administrator can create a new category by writing its name
in the text box and clicks on "t‰yŠ‫"إ‬.

Figure 10.37

10.31.10 Add New Sub Category


This page allows to the administrator to add a new sub category to the repository. As
shown in figure 4.38, the administrator can add a new sub category by clicking on
"bocbd ‹o v‰ Žl¨on t‰yoŠ‫( "إ‬figure 1.38). Then , the user will select the category from
dropdownlist and will write the name of the new sub category in the text box and
clicks on "t‰yŠ‫"إ‬.

Figure 10.38

111
10.31.11 View learning object page
The page lists all the stored Learning Objects in the repository along with their
metadata (figure1.39) .

Figure 10.39

10.31.12 Edit Learning Objects Page


The page shows the metadata and general information of learning object who
selected on “view LO” page by clicking on view link, these information and metadata
can be edited by clicking on edit button, edit the information, then click on update
button. Also , this learning object can be deleted by clicking on delete button (figure
1.40).

Figure 10.40

112
4.31.13 View comments page
This page lists all comments on the stored LO in the repository.These records can be
deleted, edited, and new records can be added only if the described LO is already
added, this view is derived from a single database table (figure 1.41).

Figure 10.41

10.31.14 Unapproved Comments page

this page lists all the unapproved comments on a stored LO in the repository. These
records can be deleted, edited, and approved.This view is derived from a single
database table, if the comment approved then it will be sent automatically to view
comments page (figure 1.42).

Figure 10.42

113
10.31.15 View Report Back Page
The page lists all report backs on the stored LO in the repository. These records can
be deleted. This view is derived from a single database table (figure 1.43).

Figure 10.43

10.31.16 Send message to mailing list page


This page allows the admin to send a message to the mailing list, as figure 1.44
shows:

Figure 10.44

114
1. 11. Testing
11.1 Purpose
The purpose of this chapter is to present some of the test cases made on
Marifah site that have been done by the testing team. The document will contain
information about the testers, the procedure performed and results. The document will
explain how the discovered bugs during the test phase were debugged.

11.2 Scope
The chapter is divided to five main sections which are the main segments of
the site. The sections are the following: LO search and retrieval, LO manipulation, LO
evaluation and ranking, Registration and Authentication, and Administration. Within
each section, several subsections that focus on the site functionalities and within each
functionality there are several test cases trying to cover all the possible actions made
by the user. The total number of test cases made on Marifah site is 74 test cases.

Testing Procedure

11.3 The Testers


Dhoha A. Almazroa
Roa’a M. Alsulaiman

11.4 The procedure


The processes of the testing stage started with the early phase of the
implementation. Tests were made continuously by all of the members after the end of
each module to make sure that they are working properly.
Starting with component testing, each module was tested independently by the
member team. After integrating some modules together, system testing was performed
to make sure that modules are interacting properly. Finally another system testing was
performed on the whole system after the final integration.
The strategy used in testing the site is the gray-box test. Gray-box test defined
as “The combination of black box and white box testing. Intention of this testing is to

115
find out defects related to bad design or bad implementation of the system.”14 Tests
were performed as black-box tests but because testers do know the internal working
of the site, testers can make better-informed test cases choices.
As we stated earlier, the actual test phase started after the final integration
phase where we tried to perform all the possible actions made by the user to figure out
which actions went wrong after the integration. . Of the 74 test cases made by the
testers, only 6 test cases have failed which means most of the test cases have passed.
Then came the bugging and debugging phase were bugs are identified and fixed by
members of the team.

14
definition from “Testing Geek” website, http://www.testinggeek.com/graybox.asp

116
Test Cases

1. LO Search and Retrieval:


a. Search

Number T1
Title Search
Description This function submits the search query to the search service within the site. It
returns links of learning objects in case results were found or a string
representing there were no results.
Test Cases Test Case Number T1a
Details Input a string that is known to be present.
Input Text box="‫ء‬qŠqw‫ "ا‬and selecting radio button
“tiŒ‫ أي آ‬t‡†y®ˆ”
Expected Output One result, a link to the learning object " t•~
‫ء‬qŠqw‫" ا‬
Actual Output One result, a link to the Learning Object " t•~
‫ء‬qŠqw‫" ا‬
Result Pass
Test Case Number T1b
Details Input a string that is not known to be present.
Input Text box="v•hw‫ "ا‬and selecting radio button
“tiŒ‫ أي آ‬t‡†y®ˆ”
Expected Output A string indicates that no results were found.
Actual Output A string indicates that no results were found.
Result Pass
Test Case Number T1c
Details Click on search button with no text in the
textbox.
Input Empty string
Expected Output Nothing happens.
Actual Output Nothing happens.
Result Pass

117
b. Advanced Search

Number T2
Title Advanced search
Description This function submits the search query to the advanced search service within the
site. It returns links of learning objects in case results were found or a string
representing there were no results.
Test Cases Test Case Number T2a
Details Leave all fields blank, and press the search button
Input Clicking the search button
Excepted Output A string indicates that no results were found.
Actual Output Incorrect syntax
Result Failed
Test Case Number T2b
Details Choose " tlu‫ا‬bg†‫ ا‬tŒ›viw‫ "ا‬from the Audience field,
leave the rest of fields empty, and press the search
button
Input Audience= " tlu‫ا‬bg†‫ ا‬tŒ›viw‫"ا‬
Expected Output One result, a link to the Learning Object
"v—w‫ر ا‬q…† "
Actual Output A string indicates that no results were found.
Result Failed
Test Case Number T2c
Details Input a LO title that is known to be present.
Input Title= “v—w‫ر ا‬q…†”
Expected Output One result, a link to the Learning Object
"v—w‫ر ا‬q…† "
Actual Output One result, a link to the Learning Object
"v—w‫ر ا‬q…† "
Result Passed
Test Case Number T2d
Details Search for LOs with a specific language.
Input Language=”tl†vw‫”ا‬
Expected Output 118 LOs found with language=”tl†vw‫”ا‬
Actual Output 118 LOs found with language=”tl†vw‫”ا‬
Result Passed

118
Test Case Number T2e
Details Search for LOs in a specific Subcategory
Input Subcategory=”bcqmgw‫ان و ا‬v‡w‫"ا‬
Expected Output 3 LOs found with Subcategory=”bcqmgw‫ان و ا‬v‡w‫"ا‬
Actual Output 3 LOs found with Subcategory=”bcqmgw‫ان و ا‬v‡w‫"ا‬
Result Passed
Test Case Number T2f
Details Search for LOs with a specific format.
Input Format=”document”
Expected Output 3 LOs found with Format=”document”
Actual Output 3 LOs found with Format=”document”
Result Passed
Test Case Number T2g
Details Search for LO by matching the whole sentence.
Input Title=”v¯°w‫ ”~“ة ا‬and selecting radio button
“ylŒ‫ آ‬tŒimw‫ ا‬t‡†y®ˆ”
Expected Output No learning objects found.
Actual Output No learning objects found.
Result Passed
Test Case Number T2h
Details Search for LO by matching any word in the sentence.
Input Title=”v¯°w‫ ”~“ة ا‬and selecting radio button
“tiŒ‫ أي آ‬t‡†y®ˆ”
Expected Output 18 LOs found with each title containing the word
“‫”~“ة‬
Actual Output 18 LOs found with each title containing the word
“‫”~“ة‬
Result Passed

119
c. Browsing

Number T3
Title Browse
Description Browsing through categories then subcategories in order to reach learning objects.
Test Cases Test Case Number T3a
Details Clicking on a category then a sub category to reach
learning object(s).
Input Clicking on category "tlˆ“€±‫ ا‬tcv—w‫ "ا‬and
subcategory "bcqmgw‫ان و ا‬v‡w‫" ا‬
Expected Output List of 6 learning objects.
Actual Output All learning objects that is within the Subcategory "
"bcqmgw‫ان و ا‬v‡w‫ا‬
Result Pass
Test Case Number T3b
Details Clicking on a category then a sub category to reach
learning object(s).
Input Clicking on Category "tl†vw‫ ا‬t¥Œw‫ "ا‬and Subcategory "
"‹†vw‫ا{دب ا‬
Expected Output No list of results and a message “ ‹‰ tlilŒn ‫ت‬y•Œˆ bdqn 
‫ž ان‬g› ‹ v•w‫Ž ا‬l¨gw‫ ”هšا ا‬since this subcategory is
empty.
Actual Output No list of results and a message “ ‹‰ tlilŒn ‫ت‬y•Œˆ bdqn 
‫ž ان‬g› ‹ v•w‫Ž ا‬l¨gw‫ ”هšا ا‬and the LO sorting
dropdown list.
Result Fail

120
2. LO manipulation
a. Contributing a LO

Number T4
Title Contribute a LO
Description Adding a learning object to the database either by uploading a LO or linking
a webpage that contains a LO, and specifying the metadata of the added LO.
Test Cases Test Case Number T4a
Details Reaching upload page by URL with user not
signed- in.
Input Typing the URL
“http://localhost:1066/MA3RIFAH/uplaod.aspx”
Expected Output A massage indicating that the user can not reach
upload page without being signed- in.
Actual Output Upload page appears.
Result Failed
Test Case Number T4b
Details Reaching upload page by URL with user
signed- in.
Input Typing the URL
“http://localhost:1066/MA3RIFAH/uplaod.aspx”
Expected Output Upload page appears.
Actual Output Upload page appears.
Result Pass
Test Case Number T4c
Details A user fills the required fields only and links a
LO to the site
Input Title="thifw‫ء ا‬yi€{‫ "ا‬Author=" v†yd blw‫"و‬
Keywords="b ‫ا‬qz-thir" Audience= tŒ›viw‫"ا‬
"t®€qgiw‫ ا‬resource type="‫ض‬v /³u‫ا‬v’"
language= "‹†v "and upload=”
http://www.schoolarabia.net/arabic

/asma_khamse_tadreeb/asma1.htm”
Expected Output A confirmation message of the contribution
process, and the LO has been added to the
database.
Actual Output A confirmation message of the contribution
process, and the LO has been added to the
database.
Result Pass

121
Test Case Number T4d
Details A member fills some of the required fields only
and links a LO to the site
Input Title="y¯n‫ا‬qr‫ن و أ‬y‫"آ‬, Audience="t®€qgiw‫ ا‬tŒ›viw‫"ا‬
Resource Type="‫"‰“ش‬, language="‹†v "
Expected Output Asterisks appear next to the empty required
fields (author and keyword fields) and a message
indicates that author and keywords fields are
empty and must be filled.
Actual Output Asterisks appear next to the empty required
fields (author and keyword fields) and a message
indicates that author and keywords fields are
empty and must be filled.
Result Pass
Test Case Number T4e
Details A member fills the required fields only and
uploads a file to the site.
Input Title=”yl€µ ‫رة‬yz”, Author=”bi…ˆ ‫ن‬y®Œ€”,
Keywords=”œwyw‫ ا‬-‫رة‬yz -yl€‫”ا‬, Audience=” tŒ›viw‫ا‬
t®€qgiw‫”ا‬, Resource Type=”Video”,
Language=”‹†v ”, And Upload Fields=”
C:\myfile\Asia.3gp”.
Expected Output A confirmation message of the contribution
process, and the LO has been added to the
database.
Actual Output A confirmation message of the contribution
process, and the LO has been added to the
database.
Result Pass
Test Case Number T4f
Details A member fills some of the required fields only
and uploads a LO to the site
Input Title=”‫ء‬yiw‫”دورة ا‬, Audience=”t®€qgiw‫ ا‬tŒ›viw‫”ا‬,
resource type=”video”, language=”‹†v ”, and
upload fields=” C:\myfile\water cycle.3gp”.
Expected Output Asterisks appear next to the empty required
fields (author and keyword fields) and a message
indicates that author and keywords fields are
empty and must be filled.

122
Actual Output Asterisks appear next to the empty required
fields (author and keyword fields) and a message
indicates that author and keywords fields are
empty and must be filled.
Result Pass

123
b. Deleting a LO

Number T5
Title Delete a LO
Description An administrator deletes a learning object from the database.
Test Cases Test Case Number T5a
Details An administrator logs to the admin page, selects the
“Learning object” choice then selects the “Edit LO
Information” then types the LOID in order to remove
it from the database.
Input An integer=“24” in the textbox indicating the LOID
of the LO to be removed.
Expected Output Reload LO table with LO of the LOID=24 removed
and the associated metadata.
Actual Output Reload LO table with LO of the LOID=24 removed
and the associated metadata.
Result Pass
Test Case Number T5b
Details An administrator logs to the admin page, selects the
“Learning Object” choice then selects the “Edit LO
Information” then clicks the “Remove” button
without specifying the LOID
Input Empty string
Expected Output Nothing happens
Actual Output Nothing happens
Result Pass
Test Case Number T5c
Details An administrator logs to the admin page, selects the
“Learning Object” choice then selects the “Edit LO
Information” then clicks the “remove” button with a
wrong LOID
Input An integer=“1” in the textbox indicating the LOID of
the LO to be removed.
Expected Output Error Message appears indicating that a LO with the
specified LOID does not exist.
Actual Output Nothing happens
Result Fail

124
c. Modify Metadata

Number T6
Title Modify LO Metadata
Description This function retrieves the metadata for the selected LOID, it allows a user to
replace the inserted values with new ones by placing them in the fields, then
pressing the update button
Test Cases Test Case Number T6a
Details After a specific LOID has been chosen to be
updated, and the page loads, Delete what has been
inserted in the title text box, and press the update
button.
Input All original meta data table values, except for the
title being deleted, and the original audience from
LO table.
Excepted Output A message indicates that the title field is required.
Actual Output A message indicates that the title field is required.
Result Passed
Test Case Number T6b
Details After a specific LOID has been chosen to be
updated, and the page loads, replace what has been
written in the creator text box, with new value and
press the update button
Input All original meta data table values, the new creator
value, and the original audience from LO table.
Expected output A message indicates that the update has been
successfully performed.
Actual output A message indicating that the update has been
successfully performed.
Result Pass

125
d. Personal Collections
Number T7
Title Personal Collection Manipulation
Description A user creates a Personal Collection (PC) or multiple PCs with the ability to
rename or delete a PC. Learning Objects are added to PCs for a quick access
to favorite LOs. LOs can be removed from PCs.
Test Cases Test Case Number T7a
Details Access MyPC page without signing-in.
Input Access MyPC page indirectly through the
following URL: http://localhost:2620/MA3RIFAH/

reg/MyPC.aspx
Expected Output A message indicating that the user cannot
access the page without being signed-in.
Actual Output MyPC page of last user signed-in in the user’s
computer loads.
Result Fail
Test Case Number T7b
Details Access MyPC page through “My Home Page”
and user is signed-in.
Input Click on My Personal Collection link.
Expected Output My Personal Collection page appears.
Actual Output My Personal Collection page appears.
Result Pass
Test Case Number T7c
Details Adding a LO to a PC with no PC have been
created.
Input Click on “Add to My PC” in any LO page.
Expected Output Message indicating the no PCs were created.
Actual Output Message indicating the no PCs were created.
Result Pass
Test Case Number T7d
Details Rename a PC with an existing PC name
Input A String of the new name
Expected Output A message indicating that a PC with the
specified name has been created before.
Actual Output A message indicating that a PC with the
specified name has been created before.
Result Pass
Test Case Number T7e
Details Adding LO to a PC with user not signed- in

126
Input Click on “Add to my PC” in any LO page.
Expected Output Message indicating that the user did not sign-
in.
Actual Output Message indicating that the user did not sign-
in.
Result Pass
Test Case Number T7f
Details Rename a PC with an existing PC name.
Input A String of the new name
Expected Output A message indicating that a PC with the
specified name has been created before.
Actual Output A message indicating that a PC with the
specified name has been created before.
Result Pass

127
e. Report Back
Number T8
Title Report about a Learning Object.
Description A user reports about a Learning Object in cases where there is something
wrong about a Learning object such as a broken link, inaccurate content, or
placed in a wrong category.
Test Cases Test Case Number T8a
Details Report Back without signing-in.
Input Clicking on report back link in any LO page.
Expected Output A popup window with message indicating that
the user did not sign-in.
Actual Output A popup window with message indicating that
the user did not sign-in.
Result Pass
Test Case Number T8b
Details Report Back twice for the same LO.
Input Clicking on report back link in any LO page.
Expected Output A popup window with message indicating that
the user had reported about the LO before.
Actual Output A popup window with message indicating that
the user had reported about the LO before.
Result Pass
Test Case Number T8c
Details Report Back once with user signed-in
Input Clicking on report back link.
Expected Output A popup window with a text box to fill out the
reason of reporting.
Actual Output A popup window with a text box to fill out the
reason of reporting.
Result Pass

128
f. Comments
Number T9
Title Viewing and Adding comments for each learning object.
Description Users may read comments posted by other members about their opinion on
the LO; plus, members can post a comment about any LO. Comments are not
view to the public until it gets an approval by an administrator.
Test Cases Test Case Number T9a
Details A user adds a comment while he/she is not
signed-in.
Input A click on “Add a Comment” link in any LO
page.
Expected Output A message indicating that the user is not
signed-in.
Actual Output A message indicating that the user is not
signed-in.
Result Pass
Test Case Number T9b
Details A user adds a comment while he/she is signed-
in.
Input A click on “Add a Comment” link in a LO
page.
Expected Output A text box and a “Submit” button appear.
Actual Output A text box and a “Submit” button appear.
Result Pass
Test Case Number T9c
Details A user submits a comment about a specific LO.
Input A string “klid ‫ ”درس‬is typed in the message
text box in LOID=163 page.
Expected Output A new page appears with a confirmation
message, the page will redirect to the LO page
within 5 seconds.
Actual Output A new page appears with a confirmation
message, the page will redirect to the LO page
within 5 seconds.
Result Pass

129
3. LO Evaluation/Ranking
a. Rating
Number T10
Title Rate a LO
Description A user rates a learning object by specifying the number of stars the LO
deserves from a five star scale.
Test Cases Test Case Number T10a
Details Un logged user tries to rate a LO.
Input A Click on the third star on the 5 stars scale.
Expected Output A message indicates that the user cannot rate
without being logged-in.
Actual Output A message indicates that the user cannot rate
without being logged-in.
Result Pass
Test Case Number T10b
Details A logged user tries to rate a LO
Input A Click on the first star on the 5 stars scale
Expected Output A “Thank You” message appears and the new
rate average is updated.
Actual Output A “Thank You” message appears and the new
rate average is updated.
Result Pass
Test Case Number T10c
Details A logged user tries to rate an LO that he has
rated it once before
Input A Click on the fifth star on the 5 star scale.
Expected Output A message indicating that the user has rated
before
Actual Output A message indicating that the user has rated
before
Result Pass

130
b. Reports And Statistics
Number T11
Title Display reports and statistics
Description These tools present general statistics about the LOs usage, providing charts that
show how popular each Lo is, according to the entered rating.
Test Case Test Case Number T11a
Details Choose to view any of the reports while not
being connected to the existing server; the server
name have not been set to the current name
Input Click to preview a report
Expected Output A page showing a non existing server name
Actual output A page showing a non existing server name
Result Pass

131
c. RSS Feeds
Number T12
Title RSS Feed
Description This function allows the user to subscribe in of the allowable categories. Then,
he will be updated with the latest feeds.
Test cases Test Case Number T12a
Details The user tries to subscribe in a field that he has
already subscribed in it.
Input A click on a category from the list of the categories
in the RSS page
Expected Output A message indicating that the user has already
subscribed in the selected field

Actual Output A message indicating that the user has already


subscribed in the selected field

Result Pass

Test Case Number T12b


Details The user tries to subscribe in one of the available
categories in the RSS page
Input A click on " tlˆ“€±‫ ا‬tcv—w‫"ا‬

Expected Output A message indicating that subscription has been


done successfully

Actual Output A message indicating that subscription has been


done successfully

Result Pass

132
d. Recommendation
To test the recommender system, we created 10 users with each user having a
unique number. Some users have Interest fields and some don’t as shown on the
following table.
User no. 10 9 8 7 6 5 4 3 2 1
User
bwyr tˆy€‫أ‬ ‫از‬q‰ ‫اف‬q˜ bi…ˆ ‫رة‬q˜ ‫ء‬y•l‫ه‬ ‫اء‬v€‫إ‬ v…€ œc‫ر‬
Name
‫ان و‬v‡w‫ا‬
‫اءة‬v‡w‫ا‬
bcqmgw‫ا‬
‫و‬ „cb…w‫ا‬
¹‡•w‫وا‬
twy®iw‫ا‬ Žcv—w‫ا‬
Interest vlh•gw‫وا‬ bl›qn ‫م‬qŒ  „cb…w‫ا‬
None None None ‫و‬ ¹‡•w‫ا‬ ‫ان‬v‡w‫ا‬
Fields ‫ و‬bl›qn‫و‬ ¹‡‰ ‫و‬ ­€y…w‫ا‬ Žcv—w‫ا‬
„cb…w‫ا‬ ‫و‬
‫ة‬bl‡ 
‫و‬ bcqmgw‫ا‬
„cb…w‫وا‬
ºc‫ر‬ygw‫ا‬
Žcv—w‫ا‬
1 2
5 and
SubCatID ,2,4,5, None None and None 10 4 27 5
1
and 6 4

The following table shows subcategories that we are interested in exploring them.
‫م‬qŒ  ‫اء و‬v‡w‫ا‬ „cb…w‫ا‬ ‫ان و‬v‡w‫ا‬
SubCatName ºc‫ر‬ygw‫ا‬ ¹‡•w‫ا‬
­€y…w‫ا‬ twy®iw‫ا‬ Žcv—w‫ا‬ bcqmgw‫ا‬
SubCatID 13 27 10 5 4 1
Number of
0
3 0 16 29 2
LOs

133
The following table shows for each user what learning objects have he/she
rated, in which sub category the rated learning object follows and how many stars the
user gave to the learning object on a five star scale.

UserName SubcatID LOID Rate (out of 5)


5 47 3
œc‫ر‬ 5 119 5
7 35 2
1 64 4
5 74 5
v…€
5 121 1
7 35 3
‫اء‬v€‫إ‬ 8 85 3
‫ء‬y•l‫ه‬ None None None
5 47 2
‫رة‬q˜ 5 70 3
5 121 1
6 142 4
bi…ˆ
6 145 5
1 89 3
2 37 5
‫اف‬q˜ 4 26 1
5 70 4
6 124 1
‫از‬q‰ None None None
1 64 4
1 89 1
tˆy€‫أ‬ 6 141 1
6 142 3
6 145 5
1 64 5
bwyr
1 89 4

Then, users have added 11 learning object from different fields as shown below.

LOID SubcatID SubcatName


158 1 bcqmgw‫ان و ا‬v‡w‫ا‬
159 1 bcqmgw‫ان و ا‬v‡w‫ا‬
163 1 bcqmgw‫ان وا‬v‡w‫ا‬
164 5 Žcv—w‫„ ا‬cb…w‫ا‬
165 4 ¹‡•w‫ا‬
167 4 ¹‡•w‫ا‬
168 4 ¹‡•w‫ا‬
170 2 bl›qn
172 13 ºc‫ر‬ygw‫ا‬
173 13 ºc‫ر‬ygw‫ا‬
175 7 ‹†vw‫ا{دب ا‬

134
Based on the information about the users and their behavior, we will try to test
all possible situations that the recommender system may deal with; in other words, the
possible situations when the recommender system will recommend LOs for a user and
the situations when the recommender system will not recommend LOs for a user.
Note: IF indicated interest fields, and numbers indicate subcategories.
Number T13
Title Test The Recommender System
Description The Recommender System suggests LOs for users based on their LO rating,
number of track backs, number of downloads, and the user’s interest fields.
Test Cases Test Case Number T13a
Details The case when a user has an interest field and
votes within the interest fields and other fields
(Case of User 1)
Input IF=5 Rate= 5,5,7
Expected Output A recommendation of an LO within
SubCatID 5
Actual Output A recommendation of an LO within
SubCatID 5
Result Pass
Test Case Number T13b
Details The case when a user has more than 1 interest
fields and votes within the interest fields and
other fields (Case of User 2)
Input IF= 5,1 Rate=1,5,5,7
Expected Output A recommendation of an LO within
SubCatID 1
Actual Output A recommendation of an LO within
SubCatID 1
Result Pass
Test Case Number T13c
Details The case when a user has an interest field and
votes out of the interest field(Case of User 3)
Input IF= 27 Rate=8
Expected Output No recommendation
Actual Output No recommendation
Result Pass
Test Case Number T13d
Details The case when a user has an interest field and

135
did not vote at all (Case of User 4)
Input IF=10
Expected Output No recommendation
Actual Output No recommendation
Result Pass
Test Case Number T13e
Details The case when a user has interest fields and
votes within one if the interest field(Case of
User 5)
Input IF= 10,5, 13 Rate=5,5,5
Expected Output A recommendation of an LO within
SubCatID 5
Actual Output A recommendation of an LO within
SubCatID 5
Result Pass
Test Case Number T13f
Details The case when a user has no interest fields but
votes (Case of user 6)
Input Rate=6,6
Expected Output No recommendation
Actual Output No recommendation
Result Pass
Test Case Number T13g
Details The case when a user has no interest fields and
did not vote which is usually the case of a new
member (case of user 8)
Input None
Expected Output No recommendation
Actual Output No recommendation
Result Pass

136
4. Registration and Authentication
a. Registration
Number T14
Title Test the registration of a new user
Description Test the register function using correct and incorrect values to check that valid
entries are accepted and invalid entries are rejected
Test Case Test Case Number T14a
Details Fill all the fields in the registration form , with a
user name that is already exist then click the
"register" button"
Input All registration form fields with the user name
filled with "admin"
Expected Output A message indicating that the user name already
exist , with a pleasure to choose another name
Actual output A message indicating that the user name already
exist , with a pleasure to choose another name
Result Pass
Test Case Number T14b
Details Fill all the fields in the registration form with a
password that consist if two characters only,
then click the "register" button
Input All the registration form fields with the
password "hi"
Expected Output A message indicating that the password must
consist of at least 4 characters
Actual Output A message indicating that the password must
consist of at least 4 characters
Result Pass
Test Case Number T14b
Details Fill all the fields in the registration form , with
an email address that is already exist then click
the "register" button"
Input All registration form fields with the email filled
with "star1319@hotmail.com"
Expected Output A message indicating that the entered email
address is already in use
Actual Output A message indicating that the entered email
address is already in use
Result Pass

137
b. Log-in
Number T15
Title Test the login mechanism
Description Test the login function using correct and incorrect values to check that valid
users are accepted and invalid users are rejected.
Test Case Test Case Number T15a
Details Enter a correct user name in the user name text
box and a wrong password in the password text
box
Input A user name "admin" and a password
"12admon"
Expected Output A message indicating that the entered user name
and/or password is incorrect
Actual output A message indicating that the entered user name
and/or password is incorrect
Result Pass
Test Case Number T15b
Details Enter a wrong user name in the user name text
box and a wrong password in the password text
box
Input A user name "aduser" and a password
"12admon"
Expected Output A message indicating that the entered user name
and/or password is incorrect
Actual Output A message indicating that the entered user name
and/or password is incorrect
Result Pass
Test Case Number T15c
Details Enter an invalid user name in the user name text
box and a valid password in the password text
box
Input A user name "aduser" and a password "admin"
Expected Output A message indicating that the entered user name
and/or password is incorrect
Actual Output A message indicating that the entered user name
and/or password is incorrect
Result Pass
Test Case Number T15d
Details Enter a valid user name and a valid password

138
Input A user name "admin" and a password "admin"
Expected Output Redirecting the user to his home page
Actual Output Redirecting the user to his home page
Result Pass

139
5. Administration
a. Admin Pages
Number T16
Title Test the admin pages
Description After logging in as an admin, try to access all the privileges that the admin has
Test cases Test Case Number T16a
Details Choose one of the users "3beer", then try to change
the assigned role from a member to an admin
Input A click on the "update role" button.
Expected Output A message indicating that the role has been updates
successfully
Actual Output A message indicating that the role has been updates
successfully
Result Pass
Test Case Number T16b
Details Changing the user email address by clicking the edit
button
Input The new email address 3beer@yahoo.com, click on
"edit"
Expected Output View to the page again, with the new email shown ,
and the message "updated' appears
Actual Output View to the page again, with the new email shown ,
and the message "updated' appears
Result Pass
Test Case Number T16c
Details Editing the user profile information by clicking the
"edit" button under the profile, then clearing the first
name field
Input All previous values with the first name field, click on
"edit"
Expected Output A message indicating that all the fields must be filled
and the operation have not performed successfully
Actual Output A message indicating that all the fields must be filled
and the operation have not performed successfully
Result Pass
Test Case Number T16d
Details Choosing to delete the current user
Input A click on the "delete user " button
Expected Output A prompt asking if the admin is sure to delete the

140
user
Actual Output A prompt asking if the admin is sure to delete the
user
Result Pass
Test Case Number T16e
Details Fill all the form fields and leave the email field
empty
Input Click on the "create" button
Expected Output A message indicating that the email field must be
filled
Actual Output A message indicating that the email field must be
filled
Result Pass
Test Case Number T16f
Details Fill all the form fields, with the user name filled with
"3beer"
Input Click on the "create" button
Expected Output A message indicating that the user name already exist
Actual Output A message indicating that the user name already exist
Result Pass

141
b. Managing Roles
Number T17
Title Manage Roles
Description This function tests the performance of the two role ; administration and
members
Test Cases Test Case Number T17a
Details Choose to add a role without entering any text
in the new role text bob
Input A click on the "add Role" button
Expected Output A message indicating that the parameter "new
Role" must not be empty
Actual Output A message indicating that the parameter "new
Role" must not be empty
Result Pass
Test Case Number T17b
Details Enter the text "moderator" in the new Role
text box
Input A click on the "add a role" button
Expected Output A message indicating that the new role has
been created successfully
Actual Output A message indicating that the new role has
been created successfully
Result Pass
Test Case Number T17c
Details Choose to delete the moderator role
Input Click on the "delete" button beside the
moderator
Expected Output A prompt if the admin is sure to delete the role
Actual Output A prompt if the admin is sure to delete the role
Result Pass

142
c. Categories Administration
Number T18
Title Categories Administration
Description In this function, The admin select one of the categories, modify its name, add
new categories and sub categories and delete existing ones.
Test Case Test Case Number T18a
Details Choose to edit the name of one of the main
categories "
Input Replace "tlˆ“€±‫ ا‬tcv—w‫ " ا‬with a new category
name "tcv—w‫ا‬," then click on the "update button"
Expected Output The new category name " tcv—w‫ "ا‬appears
Actual output The new category name " tcv—w‫ "ا‬appears
Result Pass
Test Case Number T18b
Details Choose to Add the new category" »Œ•w‫Œœ ا‬ " by
typing it on the category text box
Input Click on the " t‰yŠ‫ "إ‬button
Expected Output A message indicating that the category has been
successfully added
Actual output A message indicating that the category has been
successfully added
Result Pass
Test Case Number T18c
Details Choose the "tl†vw‫ ا‬t¥Œw‫ "ا‬category from the drop
down menu , then enter " t¼“¢w‫ "ا‬in the text box
Input Click on the " t‰yŠ‫ "إ‬button
Expected Output A message indicating that the sub category has
been successfully added
Actual Output A message indicating that the sub category has
been successfully added
Result Pass
Test Case Number T18d
Details Choose to edit the sub category "t¼“¢w‫ "ا‬by
clicking the edit button beside its ID "36", then
enter " t¼“¢w‫Œœ ا‬ " in the sub category name text
box
Input A click on the "update" button
Expected Output The row appear again with the modification has
been performed

143
Actual Output The row appear again with the modification has
been performed
Result Pass
Test Case Number T18e
Details Choose to delete the subcategory "t¼“¢w‫Œœ ا‬ "
Input Click on the "delete" button
Expected Output The list of subcategories appear without the
subcategory "t¼“¢w‫Œœ ا‬ "
Actual Output The list of subcategories appear without the
subcategory "t¼“¢w‫Œœ ا‬ "
Result Pass

144
d. Metadata Administration
Number T19
Title Metadata Administration
Description In this function , the admin Modify values of metadata
Test Case Test Case Number T19a
Details Choose to modify the metadata for the LO with
the identifier 27 by clicking on the "edit" button
, then enter "unknown" in the contributor field
Input Click on the update button
Expected Output The row appears again with the contributor field
has been modified
Actual output The row appears again with the contributor field
has been modified
Result Pass

e. Membership Administration
Number T20
Title Membership Administration
Description In this function, The admin Deletes a member
Test Case Test Case Number T20a
Details Choose to delete one of the members
Input Click on the "delete" button In the specified
member row
Expected Output The list of members appear again with the
specified member has been deleted
Actual output The list of members appear again with the
specified member has been deleted
Result Pass

145
12.Bugging and Debugging
12.1 Bugging
After testing all the sites’ functions, 6 test cases have failed. For test case
T2a which was clicking the search button and leaving all the fields empty, the
error was a syntax error. For test case T2b which was choosing the “Audience”
field only and then clicking search button, the problem was that the search engine
did not find any match although there were expected LOs to appear. For test case
T3b which was browsing an empty subcategory. The sorting drop down menu
appears although there were no LOs to sort. For test case T4a which was
accessing upload page through URL by anonymous, the user have gained the
access to the page although he/she did not sign in. For test case T5e which was
delete a LO that is does not exist. Nothing indicates that the LO with the specified
LO does not exist. For test case T7a which was accessing “My PC” page through
URL by anonymous; the user have gained the access to the page although he/she
did not sign in.

12.2 Debugging
In the debugging phase, we try to correct all the errors that were discovered
during the test phase. Test cases T2a and T2b were fixed by placing a Boolean
variable that shows if the user has filled at least one field. Test case T3b was fixed
by binding the visibility of the dropdown menu with number of LOs in the sub
category, it the sub category is empty, and then the sorting dropdown menu will
be invisible. For test cases T4a and T7a, the solution was to aggregate all the
pages that require log-in in one folder. Test case T5e was fixed by placing a label
indicates that there are no LO with the specified LOID, the label appears each
time an administrator wishes to delete a LO that does not exist.

Failed Test Cases after Debugging


Test Case Number T2a
Details Leave all fields blank, and press the search button
Input Clicking the search button
Excepted Output A string indicates that no results were found.

146
Actual Output A string indicates that no results were found.
Result Pass

Test Case Number T2b


Details Choose " tlu‫ا‬bg†‫ ا‬tŒ›viw‫ "ا‬from the Audience field, leave the rest of
fields empty, and press the search button
Input Audience= " tlu‫ا‬bg†‫ ا‬tŒ›viw‫"ا‬
Expected Output One result, a link to the Learning Object "v—w‫ر ا‬q…† "
Actual Output One result, a link to the Learning Object "v—w‫ر ا‬q…† "
Result Pass

Test Case Number T4a


Details Reaching upload page by URL with user not signed- in.
Input Typing the URL “http://localhost:1066/MA3RIFAH/uplaod.aspx”
Expected Output A massage indicating that the user can not reach upload page
without being signed- in.
Actual Output Upload page appears.
Result Pass

Test Case Number T5c


Details An administrator logs to the admin page, selects the “Learning
Object” choice then selects the “Edit LO Information” then clicks the
“remove” button with a wrong LOID
Input An integer=“1” in the textbox indicating the LOID of the LO to be
removed.
Expected Output Error Message appears indicating that a LO with the specified LOID
does not exist.
Actual Output Nothing happens
Result Pass

Test Case Number T3b


Details Clicking on a category then a sub category to reach learning

147
object(s).
Input Clicking on Category "tl†vw‫ ا‬t¥Œw‫ "ا‬and Subcategory "‹†vw‫" ا{دب ا‬
Expected Output No list of results and a message “ Žl¨gw‫ ‰‹ هšا ا‬tlilŒn ‫ت‬y•Œˆ bdqn 
‫ž ان‬g› ‹ v•w‫ ”ا‬since this subcategory is empty.
Actual Output No list of results and a message “ Žl¨gw‫ ‰‹ هšا ا‬tlilŒn ‫ت‬y•Œˆ bdqn 
‫ž ان‬g› ‹ v•w‫ ”ا‬and the LO sorting dropdown list.
Result Pass

Test Case Number T7a


Details Access MyPC page without signing-in.
Input Access MyPC page indirectly through the following URL:
http://localhost:2620/MA3RIFAH/

reg/MyPC.aspx
Expected Output A message indicating that the user cannot access the page
without being signed-in.
Actual Output A message indicating that the user cannot access the page
without being signed-in.
Result Pass

148
Number T1
Title
Description
Test Case Test Case Number T1a
Details
Input
Expected Output
Actual output
Result Pass
Test Case Number T1b
Details
Input
Expected Output
Actual Output
Result Pass

149
13. Conclusion
Fortunately, we have managed to develop Marifah site within 10 months
starting on august 2007 and ending on July 2008. The analysis and design phase were
completed by the end of the first semester whereas the implementation phase was
completed by the end of the second semester.

As we mentioned at the beginning of the reference manual, Marifah website is


devoted for storing Arabic learning objects and trying to bridge the gap of lack of
digital repositories for learning objects in the Arab world.

Marifah site contains many useful tools for managing learning objects. Users
can contribute learning object in two ways either by linking a webpage or uploading
directly to the repository. This is a unique feature that few repositories on the web can
deal with. Moreover, users can explore the site easily and in an organized way by
organizing learning object into categories then sub categories and providing many
tools to evaluate, distribute, and comment on learning objects. Finally, the
recommender system, the sites most unique feature and the latest trend on the web
that will assist members of Marifah in choosing what learning objects are suitable for
their interest.

The project has consumed all of our time and effort and it was a struggle for us
to complete Marifah website ontime; however, after the completion of the website, we
felt, as members of the project team, so proud that we could manage to achieve what
we have done and we hopefully could manage to accomplish our vision which was
creating a premiere online community for Arabs where faculty, staff, and students
share their learning materials.

150
14. Future Work
The website at the present contains the basic functionalities that any digital
repository for learning object has plus the unique feature of LO recommendation;
moreover, the site is capable to encompass extra functionalities that will enhance the
site in the future. The functionalities that will be added in the future are the following:

1. Adding the auto-complete feature in the site’s search engine to facilitate he


search process.
2. It would be better to add the federated search to expand the search range.
3. After the site gains popularity, the users’ similarity of the recommendation
process will be stored as a table to speed up the recommendation process.
4. In future, the user might be able to download several LOs at the same time
instead of downloading each LO solely.
5. The Link Checker feature will be added in future to fix broken links that might
exist.

151
15. References
 “ the digital repository comes of age “ , (2003, July), (edu cause :
transforming education through information technologies) Available:
http://www.educause.edu/ir/library/pdf/NLI0358.pdf (Accessed:
2007,october 22)

 - “briefing paper- higher education sector “ , (2005, august), ( Digital


repositories, helping universities and colleges).Available :
http://www.jisc.ac.uk/uploaded_documents/HE_repositories_briefing_paper_2
005.pdf (Accessed: 2007,october 22)

 - "introduction to learning objects",(2003, November 3),(Learning Objects


portal), Available:
http://ilearn.senecac.on.ca/lop/information/session1/m4_s1c2.html (Accessed:
2007, October 19).

 - ”Metadata" (2007, October 19),(wikipedia,the free encyclopedia),


Available: http://en.wikipedia.org/wiki/Metadata (Accessed:2007,October 18).

 - Powell, Andy ( 1998, July 15), "Metadata for the web" ,(UKOLN),
Available:http://www.ukoln.ac.uk/metadata/presentations/ukolug98/tsld001.htm,(
Accessed:2007,October 19).

 - Al-Khalifa, Hend (2007),"“Automatic Document-Level Semantic Metadata


Annotation Using Folksonomies and Domain Ontologies",(Hend Al-Khalifa)
Available:http://eprints.ecs.soton.ac.uk/14181/01/Hend_Thesis.pdf
,(Accessed:2007,October 19).

 “watch and learn : how recommendation systems are redefining the web”
(2006,dec,13), (user interface engineering), Available :
www.uie.com/articles/recommendation-systems/, Accessed: (2007,oct)

 “recommender system”,(Wikepedia), Available:


http://en.wekipedia.org/wiki/recommendation_systrm, Accessed: (2007,oct)

 "Introduction to RSS", (2007), (web reference), Available:


http://www.webreference.com/authoring/languages/xml/rss/intro/ (Accessed:
2007,oct, 31)

 " RSS Syndication and Aggregation ", (2007), (web reference), Available:
http://www.webreference.com/authoring/languages/xml/rss/intro/2.html
(Accessed: 2007,oct, 31)

 " WebRef and the Future of RSS", (2007), (web reference), Available:
http://www.webreference.com/authoring/languages/xml/rss/intro/3.html
(Accessed: 2007,oct, 31)

152
 Pilgrim, Mark. (December 18, 2002), " What Is RSS ", (O'reilly xml.com),
Available: http://www.xml.com/pub/a/2002/12/18/dive-into-xml.html
(Accessed: 2007,oct, 31).

 " Federated Search Engines ", (16-19 Mr/Ap 2004), (search right), Available:
http://www.searchitright.com/federated_search_engines.htm (Accessed:
2007,oct, 28).

 " Federated Search in an Age of Web Services ", (2005), (E-prints in Library
and Information Science), Available: http://eprints.rclis.org/archive/00006828/
(Accessed: 2007,oct, 28).

 " Federated Search ", (2007), (the E-Learning Framework), Available:


http://www.elframework.org/common_services/federated_search (Accessed:
2007,oct, 28).

 "Federated Search Engines", (2001-2003), (ala), Available:


http://www.ala.org/ala/alctscontent/alctspubsbucket/webpublications/catalogin
g/researchtopics/federated.htm (Accessed: 2007,oct, 29).

 "Tennant ,Roy",(6/15/2003), "The right solution: Federated search tools",


(Library Joural.com), Available:
http://www.libraryjournal.com/article/CA302427.html?display=searchResults
&stt=001&text=tennant (Accessed: 2007,oct, 29).

 ”RSS" (2007),(wikipedia,the free encyclopedia),Available:


http://en.wikipedia.org/wiki/RSS_(protocol) (Accessed:2007,October 29).

 “Alpha Testing” (2007), (Visual Tutor Project)

 “Gray-box test” " (2008),( Testing Geek),Available:


http://www.testinggeek.com/graybox.asp (Accessed:2008, June 16).

 ”Federated search" (2007),(wikipedia,the free encyclopedia),


search (Accessed:2007,October federated/wiki/org.wikipedia.en://httpAvailable:
29).

153
16. Appendices

16.1 TrackBack:

A Linkback is a method for Web authors to obtain notifications when other authors link to

one of their documents.

The three methods differ in how they accomplish this task:

▪ Refback ▪ Trackback ▪ Pingback

• Trackback is an acknowledgment. This acknowledgment is sent via a network signal

(ping) from Site 2 to the Site 1. The Site 1 often publishes a link back to Site 2 indicating its

worthiness.

• Pingback is a signal (ping) sent from Site 2 to Site 1. However, it's also a link. When

Site1 receives the notification signal, it automatically goes back to Site 2 checking for the

existence of a live incoming link. If that link exists, the Pingback is recorded successfully.

154
Trackback Pingback

Code on linking server examines added or updated documents,


Trigger
extracts links, and sends notification to linked server for each
mechanism
link found

Notification
HTTP POST XML-RPC call
medium

• Linking site name

• Linking post title


• Linked post URL
Information sent
• Linking post excerpt
• Linking post URL
by linking server
• Linking post URL

• Linked post ID number

Additional

information
IP address of linking server
presented to

linked server

• Notification mechanism
All the information desired by
has a complete technical
the linked server (Linking site
specification
beneficent
name, post title, excerpt) is
• Less susceptible to
present in the notification itself
spamming

155
16.2 RSS

Really Simple Syndication


Or
Rich Site Summary

 Simple technology designed to distribute (or syndicate ) frequently updated


content such as blog entries or news headlines .

 specified using XML

 How RSS work?


1) Create the feed, then post it’s URL on the Web site.
2) The recipient add that URL into a program called a “reader”
3) To send a message, simply add entries to the feed .
• Messages have three parts:
 a title
 a summary
 and a body

4) The reader visits the specified XML Web page at specific intervals and
check for updates.

 You can arrange your feeds into folders and even set alerts and sounds for
when a particular web feed is updated

 RSS solves problems such as:


 increasing traffic
 gathering and distributing news
 article maintenance

RSS vs. IRSS


 RSS:
 only one RSS XML file.

 Individualized RSS (IRSS) :


 a separate, unique RSS XML file for each recipient.

156
16.3 Federated Search

• Federated search -also known as parallel search, metasearch, or

broadcast search- is the simultaneous search of multiple online databases

and is an emerging feature of automated, Web-based library and information

retrieval systems.

• From a technical standpoint, this software uses a distributed search method

across heterogeneous databases using multiple search protocols

• consists of:

o transforming a query and broadcasting it to a group of disparate

databases with the appropriate syntax

o merging the results collected from the databases

o presenting them in a unified format with minimal duplication

o providing a means, performed either automatically or by the portal

user, to sort the merged result set

• In traditional search engines such as Google, only sources that have been

indexed by the search engine’s crawler technology can be searched, retrieved

and accessed.

o The large volume of documents housed in databases is not open to

traditional Internet search engines because of limitations in crawler

technology.

157
• Federated searching resolves this issue and makes these deep Web

documents searchable without having to visit each database individually

 The deep Web (or Deepnet, invisible Web or hidden Web)

refers to World Wide Web content that is not part of the surface

Web indexed by search engines

• Federated search computer programs allow users to search multiple data

sources with a single query from a single user interface.

o the query is sent to every individual database in the portal or federated

search list.

o Access details for the individual databases must be preset in the portal

by its owner

• Federated search need not place any requirements or burdens on owners of the

individual data sources, other than handling increased traffic

• The types of resources that can be searched include local and remote library

catalogs, abstracting and indexing databases, full-text aggregator databases,

and digital repositories

• When the search vocabulary or data model of the search system is different

from the data model of one or more of the foreign target systems the query

must be translated into the each of the foreign target systems. This can be

done using simple data-element translation or may require semantic

translation:

158
o Hand-coded, graphical manual :

 This feature is dependent on the source and destination data

element name being the same. Transformation programs are

automatically created in SQL, XSLT, Java programming

language or C++.

o Data-driven mapping:

 This is the newest approach in data mapping and involves

simultaneously evaluating actual data values in two data

sources using heuristics and statistics to automatically discover

complex mappings between two data sets. This approach is

used to find transformations between two data sets and will

discover substrings, concatenations, arithmetic, case statements

as well as other kinds of transformation logic. This approach

also discovers data exceptions that do not follow the discovered

transformation logic.

o Semantic mapping is similar to the auto-connect feature of data

mappers with the exception that a metadata registry can be consulted to

look up data element synonyms.

 For example, if the source system lists FirstName but the

destination lists PersonGivenName, the mappings will still be

made if these data elements are listed as synonyms in the

metadata registry.

159
• Challenges:

o The use of multiple names to describe the same thing plagues the

information industry

o access multiple, password-protected databases behind the scenes

o show users their results in one easy-to-read interface.

o The de-duping challenge

 the ability to de-duplicate search results reliably

 If the de-duping algorithms are too strict ◊duplicates may get

through

 if they are too loose, items that are not really duplicates may be

merged.

 Most products allow the library to set the de-duplication

protocol or protocols that should be applied, but some limit the

total number of records that can be de-duped per search.

o Making sense of results (How do the interface designers ensure the

highest-quality hits are returned first)

• Federated search software uses standardized protocols to access

databases. The most common protocol used is Z39.50.

• Z39.50:

o Widely employed in libraries.

o Connection to OPACs and other databases

o Setup is straightforward

o Fairly stable connection

160
• API (application Programming Interface)

o Stable protocol with quick, precise results.

• XML Gateway:

o Exchange of XML documents

o Structure way to search a DB or resource

o Programmed specifically for each resource

o Stable and consistent results

• HTTP connector:

o Mimics end user searching through the generation of URLs

o Individualy programmed for each resource

o Also called screen scraping

o Least structured and stable of the protocol types.

• Federated search engines are different from the metasearch engines

commonly found on the Internet :

o metasearch engines run searches via multiple Web search engines that

spider the open Web

o Federated searches concentrate mostly on textual information and

offer subscription-based premium content database searching ignored

by Web-oriented metasearch engines that miss these invisible Web

sources.

o Another difference: Web metasearch engines offer free search but

Federated search engines are enterprise software

161
• limitations of the current generation of federated search engines include:

o The lack of a uniform authentication standard means that some

databases are inaccessible to federated search engines.

o True, full, deduplication is impossible because databases download

results in small sets and metadata standards vary by resource.

o Relevancy ranking is limited by the quality of the metadata, which

usually does not include abstracts or full-text information.

• BENEFITS AND DRAWBACKS OF FEDERATED SEARCH:

o The reduced time it takes to do a basic search is benefit enough.

o ” Federated searching is not for power searching needs” Just as with

searching metasearch engines, only basic Boolean commands can be

used.

o federated searching is a good starting point, but never the ending

point, for sophisticated search needs

o Since we live in a fast-paced world, federated searching will find more

and more applications, not just in the library world but the commercial

sector as well, to save time and money and to enhance the user's search

experience.

162
16.4 Issues with Dspace
During the first two weeks of the current semester ,we were trying to use the Dspace
Open source in order to reengineer it. So we began to download the required tools and
install them, but we faced many issues within and after the installation of the Dspace
such as:

• Undefined Errors The resulting errors were ambiguous and not defined.
All actions seemed to be incorrect and had the same error message which
is "Internal System Error" and that was a time consuming for us since we
were trying to do the steps over and over again and finding the same errors
appears. After completing the installation , we found that some of the
operations in Dspace like Submission were led us to the same error
message.
• Uncooperative Community The supporting team of Dspace were not
responding, we sent a lot of e-mails asking them to help us in solving some
issues that we failed to fix, but unfortunately no one replied.
• Language One of the demands that the interface of the repository
should be in Arabic and when we tried to change the language by
following some steps written for that reason, unfortunately nothing has
been changed, we tried a lot of things by changing some of the code but
we got the same result. After doing some search for repositories written in
Arabic using the Dspace we note that there were no presence of Arabic
interface using Dspace nor any previous attempt came out with what we
wanted.

There were some difficulties to understand this open source, and other problems we
failed to answer, all that could be solved but would cost us more time, and the time
was our concern so we decided to move on and start to build and implement the
system from scratch.

163
16.5 Source Codes

1-Search
The search code in search.aspx.vb as follow:

Protected Sub Page_Load(ByVal sender As Object, ByVal e As


System.EventArgs) Handles Me.Load

If Request.Params("mode") = "simple" Then


Simple()
ElseIf Request.Params("mode") = "advance" Then
advance()
Else
Response.Redirect("Default.aspx")
Exit Sub
End If
End Sub

******************

Sub Simple()
If Request.QueryString("Type").ToString() = 1 Then
Dim conn As SqlConnection
Dim dt As DataTable
conn = New
SqlConnection(ConfigurationManager.ConnectionStrings("DBConnectionStr
ing1").ToString())
Dim cmd As SqlCommand = conn.CreateCommand()

Dim s() As String =


Request.QueryString("Text").ToString.Split(" ")
Dim finaltext As New Text.StringBuilder("")
For Each str As String In s 'search for each word in the
phrase
finaltext.Append("MetaData.Title LIKE '%" & str & "%' or
MetaData.Subject LIKE '%" & str & "%' or ")
Next

finaltext.Append("MetaData.Title='#####')")

'sorting the results


If Me.DropDownList1.SelectedValue = 1 Then
finaltext.Append(" ORDER BY MetaData.Title ASC")
ElseIf Me.DropDownList1.SelectedValue = 2 Then
finaltext.Append(" ORDER BY MetaData.Creator ASC")
ElseIf Me.DropDownList1.SelectedValue = 3 Then
finaltext.Append(" ORDER BY MetaData.Date ASC")
ElseIf Me.DropDownList1.SelectedValue = 4 Then
finaltext.Append(" ORDER BY MetaData.Date DESC")
Else 'The default option
finaltext.Append(" ORDER BY MetaData.Date DESC")
End If

164
cmd.CommandText = "SELECT LO.LOID, LO.SubCatID, LO.UserId,
LO.BundleURL, LO.NoOfDownloads, LO.NoOfViews, LO.TrackBacks,
LO.rating, LO.audience, MetaData.Identifier, MetaData.Title,
MetaData.Creator, MetaData.Language, MetaData.Format, MetaData.Date,
MetaData.Contributor, MetaData.Description, MetaData.Coverage,
MetaData.Publisher, MetaData.Relation, MetaData.Rights,
MetaData.Source, MetaData.Subject, MetaData.Type FROM LO INNER
JOIN MetaData ON LO.LOID = MetaData.Identifier WHERE ( " &
finaltext.ToString()

Dim da As New SqlDataAdapter(cmd)


dt = New DataTable
da.Fill(dt)

If dt.Rows.Count = 0 Then
Me.ResultLabel.Text = "r sH5 ‫ر‬Du48‫ ا‬vFA wx yLKz; .. "
Me.numResults.Visible = False
Me.Label1.Visible = False
Me.DropDownList1.Visible = False
Else
Me.numResults.Text = "{ ‫د‬K}‫ & " ا‬dt.Rows.Count.ToString()
& " 3~:H"
Me.DataList1.DataSource = dt
DataList1.DataBind()
End If
Else
SimpleExactPhrase() 'exact phrase
End If

End Sub
**********************

Sub advance()

If Request.QueryString("SearchType").ToString() = 1 Then
'search for any word

Dim conn As SqlConnection


Dim dt As DataTable
conn = New
SqlConnection(ConfigurationManager.ConnectionStrings("DBConnectionStr
ing1").ToString())

Dim cmd As SqlCommand = conn.CreateCommand()


Dim finaltext As New Text.StringBuilder("")

If Request.QueryString("Title") IsNot Nothing Then


Dim s1() As String =
Request.QueryString("Title").ToString.Split(" ")
For Each str As String In s1
finaltext.Append("MetaData.Title LIKE '%" & str &
"%' or ")
Next
finaltext.Append("MetaData.Title='#####'")

End If

If Request.QueryString("Subject") IsNot Nothing Then


Dim s2() As String =
Request.QueryString("Subject").ToString.Split(" ")

165
If finaltext.Length <> 0 Then
finaltext.Append("and ")
End If
For Each str As String In s2
finaltext.Append("MetaData.Subject LIKE '%" & str
& "%' or ")
Next
finaltext.Append("MetaData.Subject='#####'")
End If

If Request.QueryString("Creator") IsNot Nothing Then


Dim s2() As String =
Request.QueryString("Creator").ToString.Split(" ")
If finaltext.Length <> 0 Then
finaltext.Append("and ")
End If
For Each str As String In s2
finaltext.Append("MetaData.Creator LIKE '%" & str
& "%' or ")
Next
finaltext.Append("MetaData.Creator='#####'")
End If

If Request.QueryString("Description") IsNot Nothing Then


Dim s3() As String =
Request.QueryString("Description").ToString.Split(" ")
If finaltext.Length <> 0 Then
finaltext.Append("and ")
End If
For Each str As String In s3
finaltext.Append("MetaData.Description LIKE '%" &
str & "%' or ")
Next
finaltext.Append("MetaData.Description like '%#####%'
")
End If

If Request.QueryString("Level") IsNot Nothing Then


Dim s5 As String =
Request.QueryString("Level").ToString()
If finaltext.Length <> 0 Then
finaltext.Append("and ")
End If
finaltext.Append("LO.audience LIKE '%" & s5 & "%'")
End If

If Request.QueryString("Type") IsNot Nothing Then


Dim s6 As String =
Request.QueryString("Type").ToString()
If finaltext.Length <> 0 Then
finaltext.Append("and ")
End If
finaltext.Append("MetaData.Type LIKE '%" & s6 & "%'")
End If

If Request.QueryString("SubCat") IsNot Nothing Then


Dim s7 As String =
Request.QueryString("SubCat").ToString()
If finaltext.Length <> 0 Then

166
finaltext.Append("and ")
End If
finaltext.Append("LO.SubCatID=" & s7)
End If

If Request.QueryString("Lang") IsNot Nothing Then


Dim s8 As String =
Request.QueryString("Lang").ToString()
If finaltext.Length <> 0 Then
finaltext.Append("and ")
End If
finaltext.Append("MetaData.Language like '%" & s8 &
"%'")
End If

'sorting the results


If Me.DropDownList1.SelectedValue = 1 Then
finaltext.Append(" ORDER BY MetaData.Title ASC")
ElseIf Me.DropDownList1.SelectedValue = 2 Then
finaltext.Append(" ORDER BY MetaData.Creator ASC")
ElseIf Me.DropDownList1.SelectedValue = 3 Then
finaltext.Append(" ORDER BY MetaData.Date ASC")
ElseIf Me.DropDownList1.SelectedValue = 4 Then
finaltext.Append(" ORDER BY MetaData.Date DESC")
Else
finaltext.Append(" ORDER BY MetaData.Date DESC")
End If

cmd.CommandText = "SELECT LO.LOID, LO.SubCatID,


LO.UserId, LO.BundleURL, LO.NoOfDownloads, LO.NoOfViews,
LO.TrackBacks, LO.rating, LO.audience, MetaData.Identifier,
MetaData.Title, MetaData.Creator, MetaData.Language, MetaData.Format,
MetaData.Date, MetaData.Contributor, MetaData.Description,
MetaData.Coverage, MetaData.Publisher, MetaData.Relation,
MetaData.Rights, MetaData.Source, MetaData.Subject, MetaData.Type
FROM LO INNER JOIN MetaData ON LO.LOID = MetaData.Identifier WHERE
" & finaltext.ToString()

Dim da As New SqlDataAdapter(cmd)


dt = New DataTable
da.Fill(dt)

If dt.Rows.Count = 0 Then
Me.ResultLabel.Text = "r sH5 ‫ر‬Du48‫ ا‬vFA wx yLKz; .. "
Me.numResults.Visible = False
Me.Label1.Visible = False
Me.DropDownList1.Visible = False
Else
Me.numResults.Text = "{ ‫د‬K}‫& " ا‬
dt.Rows.Count.ToString() & " 3~:H"
Me.DataList1.DataSource = dt
DataList1.DataBind()
End If
Else
CompExactPhrase() 'exact phrase
End If
End Sub

**************************
Sub SimpleExactPhrase()

167
Dim conn As SqlConnection
Dim dt As DataTable
conn = New
SqlConnection(ConfigurationManager.ConnectionStrings("DBConnectionStr
ing1").ToString())

Dim cmd As SqlCommand = conn.CreateCommand()


Dim finaltext As New Text.StringBuilder("")

If Request.QueryString("Text") IsNot Nothing Then


Dim str As String =
Request.QueryString("Text").ToString()
finaltext.Append("MetaData.Title LIKE '%" & str & "%' or
MetaData.Subject LIKE '%" & str & "%'")
End If

If Me.DropDownList1.SelectedValue = 1 Then
finaltext.Append(" ORDER BY MetaData.Title ASC")
ElseIf Me.DropDownList1.SelectedValue = 2 Then
finaltext.Append(" ORDER BY MetaData.Creator ASC")
ElseIf Me.DropDownList1.SelectedValue = 3 Then
finaltext.Append(" ORDER BY MetaData.Date ASC")
ElseIf Me.DropDownList1.SelectedValue = 4 Then
finaltext.Append(" ORDER BY MetaData.Date DESC")
Else 'default option
finaltext.Append(" ORDER BY MetaData.Date DESC")

End If

cmd.CommandText = "SELECT LO.LOID, LO.SubCatID, LO.UserId,


LO.BundleURL, LO.NoOfDownloads, LO.NoOfViews, LO.TrackBacks,
LO.rating, LO.audience, MetaData.Identifier, MetaData.Title,
MetaData.Creator, MetaData.Language, MetaData.Format, MetaData.Date,
MetaData.Contributor, MetaData.Description, MetaData.Coverage,
MetaData.Publisher, MetaData.Relation, MetaData.Rights,
MetaData.Source, MetaData.Subject, MetaData.Type FROM LO INNER
JOIN MetaData ON LO.LOID = MetaData.Identifier WHERE " &
finaltext.ToString()

Dim da As New SqlDataAdapter(cmd)


dt = New DataTable
da.Fill(dt)

If dt.Rows.Count = 0 Then
Me.ResultLabel.Text = "r sH5 ‫ر‬Du48‫ ا‬vFA wx yLKz; .. "
Me.numResults.Visible = False
Me.Label1.Visible = False
Me.DropDownList1.Visible = False
Else
Me.numResults.Text = "{ ‫د‬K}‫& " ا‬
dt.Rows.Count.ToString() & " 3~:H"
Me.DataList1.DataSource = dt
DataList1.DataBind()
End If

End Sub
**************************

Sub CompExactPhrase()
Dim conn As SqlConnection

168
Dim dt As DataTable
conn = New
SqlConnection(ConfigurationManager.ConnectionStrings("DBConnectionStr
ing1").ToString())

Dim cmd As SqlCommand = conn.CreateCommand()


Dim finaltext As New Text.StringBuilder("")
'cmd.CommandType = CommandType.StoredProcedure
'cmd.CommandText = "AdvSearch"

If Request.QueryString("Title") IsNot Nothing Then


Dim str As String =
Request.QueryString("Title").ToString()
finaltext.Append("MetaData.Title LIKE '%" & str & "%'")
End If

If Request.QueryString("Subject") IsNot Nothing Then


Dim s2 As String =
Request.QueryString("Subject").ToString()
If finaltext.Length <> 0 Then
finaltext.Append("and ")
End If
finaltext.Append("MetaData.Subject LIKE '%" & s2 & "%'
")
End If

If Request.QueryString("Creator") IsNot Nothing Then


Dim s3 As String =
Request.QueryString("Creator").ToString()
If finaltext.Length <> 0 Then
finaltext.Append("and ")
End If
finaltext.Append("MetaData.Creator LIKE '%" & s3 & "%'
")

End If

If Request.QueryString("Description") IsNot Nothing Then


Dim s4 As String =
Request.QueryString("Description").ToString()
If finaltext.Length <> 0 Then
finaltext.Append("and ")
End If
finaltext.Append("MetaData.Description LIKE '%" & s4 &
"%' ")
End If

If Request.QueryString("Level") IsNot Nothing Then


Dim s5 As String =
Request.QueryString("Level").ToString()
If finaltext.Length <> 0 Then
finaltext.Append("and ")
End If
finaltext.Append("LO.audience LIKE '%" & s5 & "%'")
End If

If Request.QueryString("Type") IsNot Nothing Then


Dim s6 As String = Request.QueryString("Type").ToString()

169
If finaltext.Length <> 0 Then
finaltext.Append("and ")
End If
finaltext.Append("MetaData.Type LIKE '%" & s6 & "%'")
End If

If Request.QueryString("SubCat") IsNot Nothing Then


Dim s7 As String =
Request.QueryString("SubCat").ToString()
If finaltext.Length <> 0 Then
finaltext.Append("and ")
End If
finaltext.Append("LO.SubCatID=" & s7)
End If

If Request.QueryString("Lang") IsNot Nothing Then


Dim s8 As String = Request.QueryString("Lang").ToString()
If finaltext.Length <> 0 Then
finaltext.Append("and ")
End If
finaltext.Append("MetaData.Language like '%" & s8 & "%'")
End If

'sorting the results


If Me.DropDownList1.SelectedValue = 1 Then
finaltext.Append(" ORDER BY MetaData.Title ASC")
ElseIf Me.DropDownList1.SelectedValue = 2 Then
finaltext.Append(" ORDER BY MetaData.Creator ASC")
ElseIf Me.DropDownList1.SelectedValue = 3 Then
finaltext.Append(" ORDER BY MetaData.Date ASC")
ElseIf Me.DropDownList1.SelectedValue = 4 Then
finaltext.Append(" ORDER BY MetaData.Date DESC")
Else
finaltext.Append(" ORDER BY MetaData.Date DESC")
End If

cmd.CommandText = "SELECT LO.LOID, LO.SubCatID, LO.UserId,


LO.BundleURL, LO.NoOfDownloads, LO.NoOfViews, LO.TrackBacks,
LO.rating, LO.audience, MetaData.Identifier, MetaData.Title,
MetaData.Creator, MetaData.Language, MetaData.Format, MetaData.Date,
MetaData.Contributor, MetaData.Description, MetaData.Coverage,
MetaData.Publisher, MetaData.Relation, MetaData.Rights,
MetaData.Source, MetaData.Subject, MetaData.Type FROM LO INNER
JOIN MetaData ON LO.LOID = MetaData.Identifier WHERE " &
finaltext.ToString()

Dim da As New SqlDataAdapter(cmd)


dt = New DataTable
da.Fill(dt)

If dt.Rows.Count = 0 Then
Me.ResultLabel.Text = "r sH5 ‫ر‬Du48‫ ا‬vFA wx yLKz; .. "
Me.numResults.Visible = False
Me.Label1.Visible = False
Me.DropDownList1.Visible = False
Else
Me.numResults.Text = "{ ‫د‬K}‫& " ا‬
dt.Rows.Count.ToString() & " 3~:H"
Me.DataList1.DataSource = dt

170
DataList1.DataBind()
End If

End Sub
The advanced search in AdvancedSearch.aspx.vb as follow:

Protected Sub AdvancedSearchButton_Click(ByVal sender As Object,


ByVal e As System.EventArgs) Handles AdvancedSearchButton.Click
Dim url As New Text.StringBuilder("search.aspx?mode=advance")
Dim n As String = ""
If Me.keywordTextBox.Text <> "" Then
url.Append("&Subject=" & Me.keywordTextBox.Text)
End If
If Me.TitleTextBox.Text <> "" Then
url.Append("&Title=" & Me.TitleTextBox.Text)
End If
If Me.CreatorTextBox.Text <> "" Then
url.Append("&Creator=" & Me.CreatorTextBox.Text)
End If
If Me.DescriptionTextBox.Text <> "" Then
url.Append("&Description=" & Me.DescriptionTextBox.Text)
End If
If Me.DropDownList1.SelectedIndex <> 0 Then
url.Append("&Level=" & Me.DropDownList1.SelectedValue)
End If
If Me.TypesList.SelectedIndex <> 0 Then
url.Append("&Type=" & Me.TypesList.SelectedValue)
End If
If Me.DropDownList2.SelectedIndex <> 0 Then
url.Append("&SubCat=" & Me.DropDownList2.SelectedValue)
End If
If Me.LanguageList.SelectedIndex <> 0 Then
url.Append("&Lang=" & Me.LanguageList.SelectedValue)
End If
url.Append("&SearchType=" & Me.SearchTypeList1.SelectedValue)

Response.Redirect(url.ToString.Replace(Microsoft.VisualBasic.vbLf,
""))
End Sub

2- RSS
<?xml version="1.0" encoding="utf-8" ?>
<rss version="2.0">

<channel>

<title>345678‫ ا‬3:;<=>‫< ا‬/title>


<description>‫ض‬6A B:C‫ا‬DEF8 3GF4HI‫م ا‬DF48KL 3:A678‫ ا‬,
</description>
<link>religion.aspx</link>3OPQ ‫م‬DF48‫ا‬
<language>ar</language>

</channel>
</rss>

171
3- Users Report
<body>
<form id="form1" runat="server">
<div>
<cr:crystalreportviewer id="CrystalReportViewer1"
runat="server" autodatabind="True"
height="50px" reportsourceid="CrystalReportSource1"
style="position: relative"
width="350px"></cr:crystalreportviewer>
<cr:crystalreportsource id="CrystalReportSource1"
runat="server">
<Report FileName="usersstats.rpt"></Report>
</cr:crystalreportsource>

</div>
</form>
</body>

4- LO Report
<body>
<form id="form1" runat="server">
<div>
<CR:CrystalReportViewer ID="CrystalReportViewer1"
runat="server" AutoDataBind="True"
Height="50px" ReportSourceID="CrystalReportSource1"
Style="position: relative"
Width="350px" />
<CR:CrystalReportSource ID="CrystalReportSource1"
runat="server">
<Report FileName="book.rpt">
</Report>
</CR:CrystalReportSource>
&nbsp;&nbsp;

</div>
</form>
</body>

5- Count LO Report
<body>
<form id="form1" runat="server">
<div>
<CR:CrystalReportViewer ID="CrystalReportViewer1"
runat="server" AutoDataBind="True"
Height="50px" ReportSourceID="CrystalReportSource1"
Style="position: relative"
Width="350px" />
<CR:CrystalReportSource ID="CrystalReportSource1"
runat="server">
<Report FileName="countLO.rpt"></Report>

172
</CR:CrystalReportSource>

</div>
</form>
</body>

6- Browse:
Imports System.IO
Imports System.data
Imports System.Data.SqlClient

Partial Class BrowseSub


Inherits System.Web.UI.Page

Protected Sub Page_Load(ByVal sender As Object, ByVal e As


System.EventArgs) Handles Me.Load
Dim C As Integer

Dim myConnection As SqlConnection


Dim myTransaction As SqlTransaction = Nothing
Dim reader As SqlDataReader

Dim cmd As String


cmd = " SELECT COUNT(LOID)FROM LO WHERE SubCatID=@SubCatID"

Try
myConnection = New
SqlConnection(ConfigurationManager.ConnectionStrings("DBConnectionStr
ing1").ToString())
myConnection.Open()
myTransaction = myConnection.BeginTransaction()

Dim myCommand As SqlCommand = New SqlCommand(cmd,


myConnection, myTransaction)
myCommand.Parameters.AddWithValue("SubCatID",
Request.QueryString("SubCatID"))

reader = myCommand.ExecuteReader()
reader.Read()

C = CInt(reader(0))
reader.Close()

myCommand.ExecuteNonQuery()
myTransaction.Commit()

Catch ex As Exception
If (myTransaction.Equals(Nothing) = False) Then
myTransaction.Rollback()
End If

Finally

173
myConnection.Dispose()
End Try

If C <= 0 Then
Label1.Visible = True
Label2.Visible = False
Me.DropDownList1.Visible = False
Else
Me.HyperLink1.Visible = True
End If
If Me.DropDownList1.SelectedValue = 1 Then
DataList1.DataSourceID = ("SqlDataSource3")

ElseIf Me.DropDownList1.SelectedValue = 2 Then


DataList1.DataSourceID = ("SqlDataSource4")

ElseIf Me.DropDownList1.SelectedValue = 3 Then


DataList1.DataSourceID = ("SqlDataSource5")

ElseIf Me.DropDownList1.SelectedValue = 4 Then


DataList1.DataSourceID = ("SqlDataSource6")
End If

End Sub
Public Function MyFunc(ByVal r As Object, ByVal LOID As String)
As Integer

Dim myConnection As SqlConnection


Dim myTransaction As SqlTransaction = Nothing
Dim myCommand As SqlCommand
Dim reader As SqlDataReader
Dim avg As Integer
Dim test As Boolean = True

Dim cmd As String = " select avg(NoStars) from Rating where


LOID='" + LOID + "' "

Try

myConnection = New
SqlConnection(ConfigurationManager.ConnectionStrings("DBConnectionStr
ing1").ToString())

myConnection.Open()

myTransaction = myConnection.BeginTransaction()

myCommand = New SqlCommand(cmd, myConnection,


myTransaction)

reader = myCommand.ExecuteReader()

reader.Read()

avg = CInt(reader(0))

174
reader.Close()

myTransaction.Commit()

Catch ex As Exception
If (myTransaction.Equals(Nothing) = False) Then
myTransaction.Rollback()
test = False

Return 0

End If

Finally
myConnection.Dispose()

End Try
If test = True Then
Return avg
End If

End Function

Public Function count(ByVal LOID As String) As Integer

Dim myConnection As SqlConnection


Dim myTransaction As SqlTransaction = Nothing
Dim myCommand As SqlCommand
Dim reader As SqlDataReader
Dim con As Integer
Dim test As Boolean = True

Dim cmd As String = " Select count(UserId) from Rating where


LOID='" + LOID + "'"
Try

myConnection = New
SqlConnection(ConfigurationManager.ConnectionStrings("DBConnectionStr
ing1").ToString())

myConnection.Open()

myTransaction = myConnection.BeginTransaction()

myCommand = New SqlCommand(cmd, myConnection,


myTransaction)

reader = myCommand.ExecuteReader()

175
reader.Read()

con = CInt(reader(0))

reader.Close()

myTransaction.Commit()
Catch ex As Exception
If (myTransaction.Equals(Nothing) = False) Then
myTransaction.Rollback()
test = False
Return 0

End If

Finally
myConnection.Dispose()

End Try
If test = True Then
Return con
End If

End Function

Protected Sub FormView1_PageIndexChanging(ByVal sender As Object,


ByVal e As System.Web.UI.WebControls.FormViewPageEventArgs) Handles
FormView1.PageIndexChanging

End Sub
End Class

Query string method was used in linking subcategories to the next page; example of
the links as follows:

<div class="SubCat" style="text-align: right" id="DIV1">


&nbsp;
<a href="BrowseSub.aspx?SubCatID=27">‫ƒن‬6G8‫… و ا‬5D~H8‫<ا‬/a><br />
&nbsp;
<a href="BrowseSub.aspx?SubCatID=1">…:†D‡ ‫…ة و‬:GA</a><br />
&nbsp;
<a href="BrowseSub.aspx?SubCatID=2">‰‫ـ‬GP8‫<ا‬/a><br />
&nbsp;
<a href="BrowseSub.aspx?SubCatID=3">w5…Š‫‹ ا‬5678‫<ا‬/a><br />
&nbsp;
<a href="BrowseSub.aspx?SubCatID=4">6‫ـ‬:ŒPH8‫<ا‬/a><br />
</div>

Data list is used to arrange the learning objects in the page; part of the code is as
follows:

176
<asp:DataList ID="DataList1" runat="server" DataKeyField="LOID"
DataSourceID="SqlDataSource1"
Style="position: static">
<ItemTemplate>
<table style="position: static" dir="rtl">
<tr>
<td align="right" colspan="7" style="height: 34px">
&nbsp;<asp:Label ID="TitleLabel"
runat="server" Font-Bold="True" Font-Size="11pt" ForeColor="#F20000"
Style="direction: rtl; position: static;
text-align: right" Text='<%# Eval("Title") %>'></asp:Label></td>
<td align="right" colspan="1" style="height:
34px; width: 50px;" dir="rtl">

7- Sort Learning Objects:


The query of sorting learning object as follow:

<asp:SqlDataSource ID="SqlDataSource3" runat="server"


ConnectionString="Data
Source=.\SQLEXPRESS;AttachDbFilename=|DataDirectory|\DB.mdf;Integrate
d Security=True;User Instance=True"
ProviderName="System.Data.SqlClient" SelectCommand="SELECT LO.LOID,
LO.SubCatID, LO.UserId, LO.BundleURL, LO.NoOfDownloads, LO.NoOfViews,
LO.TrackBacks, LO.rating, LO.audience, MetaData.Identifier,
MetaData.Title, MetaData.Creator, MetaData.Language, MetaData.Format,
MetaData.Date, MetaData.Contributor, MetaData.Description,
MetaData.Coverage, MetaData.Publisher, MetaData.Relation,
MetaData.Rights, MetaData.Source, MetaData.Subject, MetaData.Type
FROM LO INNER JOIN MetaData ON LO.LOID = MetaData.Identifier WHERE
(LO.SubCatID = @SubCatID) ORDER BY MetaData.Date DESC">
<SelectParameters>
<asp:QueryStringParameter Name="SubCatID"
QueryStringField="SubCatID" />
</SelectParameters>
</asp:SqlDataSource>

<asp:SqlDataSource ID="SqlDataSource4" runat="server"


ConnectionString="Data
Source=.\SQLEXPRESS;AttachDbFilename=|DataDirectory|\DB.mdf;Integrate
d Security=True;User Instance=True"
ProviderName="System.Data.SqlClient" SelectCommand="SELECT LO.LOID,
LO.SubCatID, LO.UserId, LO.BundleURL, LO.NoOfDownloads, LO.NoOfViews,
LO.TrackBacks, LO.rating, LO.audience, MetaData.Identifier,
MetaData.Title, MetaData.Creator, MetaData.Language, MetaData.Format,
MetaData.Date, MetaData.Contributor, MetaData.Description,
MetaData.Coverage, MetaData.Publisher, MetaData.Relation,
MetaData.Rights, MetaData.Source, MetaData.Subject, MetaData.Type
FROM LO INNER JOIN MetaData ON LO.LOID = MetaData.Identifier WHERE
(LO.SubCatID = @SubCatID) ORDER BY MetaData.Date ASC">
<SelectParameters>
<asp:QueryStringParameter Name="SubCatID"
QueryStringField="SubCatID" />
</SelectParameters>
</asp:SqlDataSource>

177
<asp:SqlDataSource ID="SqlDataSource5" runat="server"
ConnectionString="Data
Source=.\SQLEXPRESS;AttachDbFilename=|DataDirectory|\DB.mdf;Integrate
d Security=True;User Instance=True"
ProviderName="System.Data.SqlClient" SelectCommand="SELECT LO.LOID,
LO.SubCatID, LO.UserId, LO.BundleURL, LO.NoOfDownloads, LO.NoOfViews,
LO.TrackBacks, LO.rating, LO.audience, MetaData.Identifier,
MetaData.Title, MetaData.Creator, MetaData.Language, MetaData.Format,
MetaData.Date, MetaData.Contributor, MetaData.Description,
MetaData.Coverage, MetaData.Publisher, MetaData.Relation,
MetaData.Rights, MetaData.Source, MetaData.Subject, MetaData.Type
FROM LO INNER JOIN MetaData ON LO.LOID = MetaData.Identifier WHERE
(LO.SubCatID = @SubCatID) ORDER BY MetaData.Title ASC">
<SelectParameters>
<asp:QueryStringParameter Name="SubCatID"
QueryStringField="SubCatID" />
</SelectParameters>
</asp:SqlDataSource>

<asp:SqlDataSource ID="SqlDataSource6" runat="server"


ConnectionString="Data
Source=.\SQLEXPRESS;AttachDbFilename=|DataDirectory|\DB.mdf;Integrate
d Security=True;User Instance=True"
ProviderName="System.Data.SqlClient" SelectCommand="SELECT LO.LOID,
LO.SubCatID, LO.UserId, LO.BundleURL, LO.NoOfDownloads, LO.NoOfViews,
LO.TrackBacks, LO.rating, LO.audience, MetaData.Identifier,
MetaData.Title, MetaData.Creator, MetaData.Language, MetaData.Format,
MetaData.Date, MetaData.Contributor, MetaData.Description,
MetaData.Coverage, MetaData.Publisher, MetaData.Relation,
MetaData.Rights, MetaData.Source, MetaData.Subject, MetaData.Type
FROM LO INNER JOIN MetaData ON LO.LOID = MetaData.Identifier WHERE
(LO.SubCatID = @SubCatID) ORDER BY MetaData.Creator ASC">
<SelectParameters>
<asp:QueryStringParameter Name="SubCatID"
QueryStringField="SubCatID" />
</SelectParameters>
</asp:SqlDataSource>

The part of code in .vb page is:


Protected Sub Page_Load(ByVal sender As Object, ByVal e As
System.EventArgs) Handles Me.Load
Dim C As Integer

Dim myConnection As SqlConnection


Dim myTransaction As SqlTransaction = Nothing
Dim reader As SqlDataReader

Dim cmd As String


cmd = " SELECT COUNT(LOID)FROM LO WHERE SubCatID=@SubCatID"

Try
myConnection = New
SqlConnection(ConfigurationManager.ConnectionStrings("DBConnectionStr
ing1").ToString())
myConnection.Open()
myTransaction = myConnection.BeginTransaction()

Dim myCommand As SqlCommand = New SqlCommand(cmd,


myConnection, myTransaction)

178
myCommand.Parameters.AddWithValue("SubCatID",
Request.QueryString("SubCatID"))

reader = myCommand.ExecuteReader()
reader.Read()

C = CInt(reader(0))
reader.Close()

myCommand.ExecuteNonQuery()
myTransaction.Commit()

Catch ex As Exception
If (myTransaction.Equals(Nothing) = False) Then
myTransaction.Rollback()
End If

Finally
myConnection.Dispose()
End Try

If C <= 0 Then
Label1.Visible = True
Else
Me.HyperLink1.Visible = True
End If

If Me.DropDownList1.SelectedValue = 1 Then
DataList1.DataSourceID = ("SqlDataSource3")

ElseIf Me.DropDownList1.SelectedValue = 2 Then


DataList1.DataSourceID = ("SqlDataSource4")

ElseIf Me.DropDownList1.SelectedValue = 3 Then


DataList1.DataSourceID = ("SqlDataSource5")

ElseIf Me.DropDownList1.SelectedValue = 4 Then


DataList1.DataSourceID = ("SqlDataSource6")
End If

End Sub

8-Average rate:
The form of rating control is:
<ajaxToolkit:Rating
ID="Rating1" runat="server" AutoPostBack="True" CssClass="ratingStar"
CurrentRating='<%# MyFunc("Rating1",Container.DataItem("LOID")) %>'
Direction="RightToLeft" EmptyStarCssClass="Empty"
FilledStarCssClass="Saved" RatingDirection="RightToLeftBottomToTop"
StarCssClass="ratingItem" WaitingStarCssClass="Filled" Width="76px"
ReadOnly="True" BehaviorID="Rating1_RatingExtender" Enabled="False"
EnableTheming="False" EnableViewState="False">

179
</ajaxToolkit:Rating>

The average rate code is:


Public Function MyFunc(ByVal r As Object, ByVal LOID As String) As
Integer

Dim myConnection As SqlConnection


Dim myTransaction As SqlTransaction = Nothing
Dim myCommand As SqlCommand
Dim reader As SqlDataReader
Dim avg As Integer
Dim test As Boolean = True

Dim cmd As String = " select avg(NoStars) from Rating where


LOID='" + LOID + "' "

Try

myConnection = New
SqlConnection(ConfigurationManager.ConnectionStrings("DBConnectionStr
ing1").ToString())

myConnection.Open()

myTransaction = myConnection.BeginTransaction()

myCommand = New SqlCommand(cmd, myConnection,


myTransaction)

reader = myCommand.ExecuteReader()

reader.Read()

avg = CInt(reader(0))

reader.Close()

myTransaction.Commit()

Catch ex As Exception
If (myTransaction.Equals(Nothing) = False) Then
myTransaction.Rollback()
test = False

Return 0

180
End If

Finally
myConnection.Dispose()

End Try
If test = True Then
Return avg
End If

End Function

9- Number of votes
Public Function count(ByVal LOID As String) As Integer

Dim myConnection As SqlConnection


Dim myTransaction As SqlTransaction = Nothing
Dim myCommand As SqlCommand
Dim reader As SqlDataReader
Dim con As Integer
Dim test As Boolean = True

Dim cmd As String = " Select count(UserId) from Rating where


LOID='" + LOID + "'"
Try

myConnection = New
SqlConnection(ConfigurationManager.ConnectionStrings("DBConnectionStr
ing1").ToString())

myConnection.Open()

myTransaction = myConnection.BeginTransaction()

myCommand = New SqlCommand(cmd, myConnection,


myTransaction)

reader = myCommand.ExecuteReader()

reader.Read()

con = CInt(reader(0))

reader.Close()

myTransaction.Commit()
Catch ex As Exception

181
If (myTransaction.Equals(Nothing) = False) Then
myTransaction.Rollback()
test = False

Return 0
End If
Finally
myConnection.Dispose()

End Try
If test = True Then
Return con
End If

End Function

10- View Learning Object


View LO query:

SELECT LO.LOID, LO.SubCatID, LO.UserId, LO.BundleURL, LO.NoOfDownloads,


LO.NoOfViews, LO.TrackBacks, LO.rating, LO.audience, MetaData.Identifier,
MetaData.Title, MetaData.Creator, MetaData.Language, MetaData.Format,
MetaData.Date, MetaData.Contributor, MetaData.Description,
MetaData.Coverage, MetaData.Publisher, MetaData.Relation, MetaData.Rights,
MetaData.Source, MetaData.Subject, MetaData.Type
FROM LO CROSS JOIN
MetaData
WHERE (LOID = @LOID)

Form View was used to arrange page; part of the code is as follows:

<asp:FormView ID="FormView1" runat="server"


DataKeyNames="LOID,Identifier" DataSourceID="SqlDataSource1"
Style="position: static" Width="386px">
<EditItemTemplate>
LOID:
<asp:Label ID="LOIDLabel1" runat="server" Text='<%# Eval("LOID")
%>'></asp:Label><br />
SubCatID:
<asp:TextBox ID="SubCatIDTextBox" runat="server"
Text='<%# Bind("SubCatID") %>'>
</asp:TextBox><br />

11- Download learning object:


Protected Sub ImageButton1_Click1 (ByVal sender As Object, ByVal e
As System.EventArgs)

182
Dim user As MembershipUser F= Membership.GetUser()
Dim filename As String =
CType(FormView1.FindControl("BundleURLLabel"), Label).Text
If filename.StartsWith("http://") Then
Dim scriptString As String = "<script
language='JavaScript'>window.open('" + filename + "');</script>"
ClientScript.RegisterStartupScript(Me.GetType(), "",
scriptString)
Else
Response.Clear()
Response.ContentType = "application/octet-stream"
Response.AddHeader("Content-Disposition", _
"attachment; filename=""" & filename & """")
Response.Flush()
Response.WriteFile(filename)
End If
End Sub
End Class

Number of download:
Is the process to count the number of user who download this learning
object, this process begins when user click on the download button

The Number of download code as follow:

Protected Sub ImageButton1_Click1(ByVal sender As Object, ByVal e


As System.Web.UI.ImageClickEventArgs)

Dim i As String =
CType(FormView1.FindControl("NoOfDownloadsLabel"), Label).Text
i = i + 1
Dim myConnection As SqlConnection
Dim myTransaction As SqlTransaction = Nothing

Dim cmd As String


cmd = " UPDATE LO SET NoOfDownloads = @NoOfDownloads WHERE
(LOID = @LOID)"

Try
myConnection = New
SqlConnection(ConfigurationManager.ConnectionStrings("DBConnectionStr
ing1").ToString())
myConnection.Open()
myTransaction = myConnection.BeginTransaction()

Dim myCommand As SqlCommand = New SqlCommand(cmd,


myConnection, myTransaction)

myCommand.Parameters.AddWithValue("NoOfDownloads", i)
myCommand.Parameters.AddWithValue("LOID",
CType(FormView1.FindControl("LOIDLabel"), Label).Text)
myCommand.ExecuteNonQuery()
myTransaction.Commit()

Catch ex As Exception
If (myTransaction.Equals(Nothing) = False) Then
myTransaction.Rollback()
End If

Finally
myConnection.Dispose()

183
End Try

End sub

12- Add comment:


Protected Sub Button2_Click(ByVal sender As Object, ByVal e As
System.EventArgs) Handles Button2.Click
Dim user As MembershipUser = Membership.GetUser()

Dim myConnection As SqlConnection


Dim myTransaction As SqlTransaction = Nothing

Dim cmd As String


cmd = "INSERT INTO Comment (LOID,comment,date, UserId) Values
(@LOID,@comment,@date,@UserId)"

Try
myConnection = New
SqlConnection(ConfigurationManager.ConnectionStrings("DBConnectionStr
ing1").ToString())
myConnection.Open()
myTransaction = myConnection.BeginTransaction()

Dim myCommand As SqlCommand = New SqlCommand(cmd,


myConnection, myTransaction)

myCommand.Parameters.AddWithValue("LOID",
CType(FormView1.FindControl("LOIDLabel"), Label).Text)
myCommand.Parameters.AddWithValue("date", DateTime.Now())
myCommand.Parameters.AddWithValue("comment",
TextBox1.Text)
myCommand.Parameters.AddWithValue("UserId",
user.ProviderUserKey.ToString())

myCommand.ExecuteNonQuery()
myTransaction.Commit()

Catch ex As Exception
If (myTransaction.Equals(Nothing) = False) Then
myTransaction.Rollback()
End If

Finally
myConnection.Dispose()
End Try

Response.Redirect("AddCommSuccess.aspx?LOID=" +
CType(FormView1.FindControl("LOIDLabel"), Label).Text)

End Sub

13- Number of comments:


<asp:SqlDataSource ID="NoCommentsDataSource" runat="server"
ConnectionString="<%$ ConnectionStrings:DBConnectionString1 %>"

184
SelectCommand="SELECT COUNT(Cno) AS NoCount FROM Comment
WHERE (LOID = @LOID)">
<SelectParameters>

14- Rating:
Protected Sub Rating1_Changed(ByVal sender As Object, ByVal e As
AjaxControlToolkit.RatingEventArgs) Handles Rating1.Changed

Dim user As MembershipUser = Membership.GetUser


Dim LO As String = CType(FormView1.FindControl("LOIDLabel"),
Label).Text

Dim myConnection As SqlConnection


Dim myTransaction As SqlTransaction = Nothing
Dim test As Boolean = True

Dim cmd As String = "INSERT INTO Rating(UserId,LOID,NoStars)


Values (@UserID, @LOID,@NoStars)"

Try

myConnection = New
SqlConnection(ConfigurationManager.ConnectionStrings("DBConnectionStr
ing1").ToString())

myConnection.Open()

myTransaction = myConnection.BeginTransaction()

Dim myCommand As SqlCommand = New SqlCommand(cmd,


myConnection, myTransaction)

myCommand.Parameters.AddWithValue("UserId",
user.ProviderUserKey.ToString())
myCommand.Parameters.AddWithValue("LOID", LO)
myCommand.Parameters.AddWithValue("NoStars",
Rating1.CurrentRating)

myCommand.ExecuteNonQuery()

185
myTransaction.Commit()

Catch ex As Exception
If (myTransaction.Equals(Nothing) = False) Then
myTransaction.Rollback()
If Not (My.User.IsAuthenticated) Then
Rating1.CurrentRating = 0
Rating1.ReadOnly = True
labelValue1.ForeColor = Drawing.Color.Red
labelValue1.Text = "ً‫ا‬DPA..r sG‡ ‘:~ŒHL ‫ل‬D“…8‫"ا‬
test = False

Else
Rating1.CurrentRating = 0
Rating1.ReadOnly = True
labelValue1.ForeColor = Drawing.Color.Red
labelValue1.Text = "ً
‫ا‬DPA..…G8 ”E• s::GH8KL K
ًG–Œ;"
test = False

End If

End If

Finally
myConnection.Dispose()

End Try
If (test = True) Then
Rating1.ReadOnly = True
labelValue1.Text = "‫ا‬6—˜..™H‫رآ‬K7I › s::GH8‫"ا‬

End If

End Sub

14- Number of view:


Protected Sub Page_Load(ByVal sender As Object, ByVal e As
System.EventArgs) Handles Me.Load
If Not (My.User.IsAuthenticated) Then
Me.Panel1.Visible = False
Label5.Visible = True

End If

Dim i As String =
CType(FormView1.FindControl("NoOfViewsLabel"), Label).Text
i = i + 1
Dim myConnection As SqlConnection
Dim myTransaction As SqlTransaction = Nothing

186
Dim cmd As String
cmd = " UPDATE LO SET NoOfViews = @NoOfViews WHERE (LOID =
@LOID)"

Try
myConnection = New
SqlConnection(ConfigurationManager.ConnectionStrings("DBConnectionStr
ing1").ToString())
myConnection.Open()
myTransaction = myConnection.BeginTransaction()

Dim myCommand As SqlCommand = New SqlCommand(cmd,


myConnection, myTransaction)

myCommand.Parameters.AddWithValue("NoOfViews", i)
myCommand.Parameters.AddWithValue("LOID",
CType(FormView1.FindControl("LOIDLabel"), Label).Text)

myCommand.ExecuteNonQuery()
myTransaction.Commit()

Catch ex As Exception
If (myTransaction.Equals(Nothing) = False) Then
myTransaction.Rollback()
End If

Finally
myConnection.Dispose()
End Try

End Sub

15- Tell a friend:


Protected Sub Button1_Click(ByVal sender As Object, ByVal e As
System.EventArgs) Handles Button1.Click

Try
Dim ToAddress As String = TextBox3.Text

Dim msg As New MailMessage(TextBox2.Text, ToAddress)


msg.From = New MailAddress(TextBox2.Text)
msg.Subject = " ‫ة‬DA‫ " ;œ د‬+ TextBox1.Text
Dim url As Uri = Me.Request.UrlReferrer
msg.Body = url.PathAndQuery

msg.IsBodyHtml = False
msg.SubjectEncoding =
System.Text.Encoding.GetEncoding("windows-1256")
msg.BodyEncoding =
System.Text.Encoding.GetEncoding("windows-1256")

Dim smtp As New SmtpClient


smtp.Host = "localhost"
smtp.Port = 25

187
smtp.DeliveryMethod = SmtpDeliveryMethod.Network

smtp.Send(msg)
Label6.Text = "Message sent successesfully !"
Catch ex As SmtpException
Label6.Text = "Error : " + ex.Message
End Try
End Sub

16- Report back:


Protected Sub Button1_Click(ByVal sender As Object, ByVal e As
System.EventArgs) Handles Button1.Click
Dim user As MembershipUser = Membership.GetUser()

Dim myConnection As SqlConnection


Dim myTransaction As SqlTransaction = Nothing

Dim cmd As String

cmd = "INSERT INTO ReportBack (LOID,reason,date,UserId)


Values (@LOID,@reason,@date,@UserId)"

myConnection = New
SqlConnection(ConfigurationManager.ConnectionStrings("DBConnectionStr
ing1").ToString())
myConnection.Open()
myTransaction = myConnection.BeginTransaction()
Dim myCommand As SqlCommand = New SqlCommand(cmd,
myConnection, myTransaction)

myCommand.Parameters.AddWithValue("LOID",
Request.QueryString("LOID"))
myCommand.Parameters.AddWithValue("reason", TextBox1.Text)
myCommand.Parameters.AddWithValue("date", DateTime.Now())
myCommand.Parameters.AddWithValue("UserId",
user.ProviderUserKey.ToString())

Label1.Visible = True

myCommand.ExecuteNonQuery()
myTransaction.Commit()

End Sub

Protected Sub Page_Load(ByVal sender As Object, ByVal e As


System.EventArgs) Handles Me.Load
If Not (My.User.IsAuthenticated) Then
Label4.Visible = True
Else
Dim user As MembershipUser = Membership.GetUser()

Dim myConnection As SqlConnection


Dim myTransaction As SqlTransaction = Nothing
Dim reader As SqlDataReader

Dim cmd As String


Dim count As Integer

188
cmd = " SELECT COUNT(RBID)FROM ReportBack WHERE
UserId=@UserId AND LOID=@LOID"

'Try
myConnection = New
SqlConnection(ConfigurationManager.ConnectionStrings("DBConnectionStr
ing1").ToString())
myConnection.Open()
myTransaction = myConnection.BeginTransaction()

Dim myCommand As SqlCommand = New SqlCommand(cmd,


myConnection, myTransaction)

myCommand.Parameters.AddWithValue("LOID",
Request.QueryString("LOID"))
myCommand.Parameters.AddWithValue("UserId",
user.ProviderUserKey.ToString())

reader = myCommand.ExecuteReader()
reader.Read()
count = CInt(reader(0))
reader.Close()

If count >= 1 Then


Label2.Visible = True
Else
Label3.Visible = True
TextBox1.Visible = True
Button1.Visible = True
End If
End If
End Sub

17- Countact us:


Protected Sub Button2_Click(ByVal sender As Object, ByVal e As
System.EventArgs) Handles Button2.Click
SendMail(TextEmail.Text, TextMsg.Text)
Response.Redirect("default.aspx")

End Sub

Private Sub SendMail(ByVal from As String, ByVal body As String)


Dim mailServerName As String = "localhost"
Dim message As MailMessage = New MailMessage(from,
"it.group5@hotmail.com", "ContactUs", body)
Dim mailClient As SmtpClient = New SmtpClient

mailClient.Host = mailServerName
mailClient.Port = 25
mailClient.Send(message)
message.Dispose()
End Sub

18- Admin Pages:

189
All codes of admin pages consists of gridviews that are connected to the database
through SQLDataSource. A sample of these pages that shows the code of Categories
administration page is shown below:

<asp:GridView ID="GridView1" runat="server" AllowPaging="True"


AllowSorting="True"
AutoGenerateColumns="False" BackColor="White"
BorderColor="#DEDFDE" BorderStyle="None"
BorderWidth="1px" CellPadding="4" DataKeyNames="CatID"
DataSourceID="SqlDataSource1"
EmptyDataText="There are no data records to display."
ForeColor="Black" GridLines="Vertical">
<FooterStyle BackColor="#CCCC99" />
<RowStyle BackColor="#F7F7DE" />
<Columns>
<asp:CommandField ShowDeleteButton="True"
ShowEditButton="True" ShowSelectButton="True" />
<asp:BoundField DataField="CatID" HeaderText="CatID"
ReadOnly="True" SortExpression="CatID" />
<asp:BoundField DataField="CatName"
HeaderText="CatName" SortExpression="CatName" />
</Columns>
<PagerStyle BackColor="#F7F7DE" ForeColor="Black"
HorizontalAlign="Right" />
<SelectedRowStyle BackColor="#CE5D5A" Font-Bold="True"
ForeColor="White" />
<HeaderStyle BackColor="#6B696B" Font-Bold="True"
ForeColor="White" />
<AlternatingRowStyle BackColor="White" />
</asp:GridView>
<asp:SqlDataSource ID="SqlDataSource1" runat="server"
ConnectionString="<%$ ConnectionStrings:DBConnectionString2 %>"
DeleteCommand="DELETE FROM [Category] WHERE [CatID] =
@CatID" InsertCommand="INSERT INTO [Category] ([CatName]) VALUES
(@CatName)"
ProviderName="<%$
ConnectionStrings:DBConnectionString2.ProviderName %>"
SelectCommand="SELECT [CatID], [CatName] FROM [Category]"
UpdateCommand="UPDATE [Category] SET [CatName] = @CatName
WHERE [CatID] = @CatID">
<DeleteParameters>
<asp:Parameter Name="CatID" Type="Int32" />
</DeleteParameters>
<InsertParameters>
<asp:Parameter Name="CatName" Type="String" />
</InsertParameters>
<UpdateParameters>
<asp:Parameter Name="CatName" Type="String" />
<asp:Parameter Name="CatID" Type="Int32" />
</UpdateParameters>
</asp:SqlDataSource>

18.1- View accounts page:

190
<asp:GridView ID="GridView1" runat="server" AllowPaging="True"
AllowSorting="True"
AutoGenerateColumns="False" BackColor="White"
BorderColor="#DEDFDE" BorderStyle="None"
BorderWidth="1px" CellPadding="4"
DataSourceID="SqlDataSource2" EmptyDataText="There are no data
records to display."
ForeColor="Black" GridLines="Vertical">
<FooterStyle BackColor="#CCCC99" />
<RowStyle BackColor="#F7F7DE" />
<Columns>
<asp:TemplateField SortExpression="UserName">
<HeaderTemplate>view</HeaderTemplate>
<ItemTemplate >
<a href="EditUser.aspx?username=<%# Eval("UserName")
%>">view</a>
</ItemTemplate>
</asp:TemplateField>
<asp:BoundField DataField="UserId"
HeaderText="UserId" SortExpression="UserId" ReadOnly="True" />
<asp:BoundField DataField="UserName"
HeaderText="UserName" SortExpression="UserName" />
<asp:BoundField DataField="Password"
HeaderText="Password" SortExpression="Password" />
<asp:BoundField DataField="Email" HeaderText="Email"
SortExpression="Email" />
<asp:BoundField DataField="InterestField"
HeaderText="InterestField" SortExpression="InterestField" />
<asp:BoundField DataField="CreateDate"
HeaderText="CreateDate" SortExpression="CreateDate" ReadOnly="True"
/>
<asp:BoundField DataField="LastLoginDate"
HeaderText="LastLoginDate" SortExpression="LastLoginDate"
ReadOnly="True" />

</Columns>
<PagerStyle BackColor="#F7F7DE" ForeColor="Black"
HorizontalAlign="Right" />
<SelectedRowStyle BackColor="#CE5D5A" Font-Bold="True"
ForeColor="White" />
<HeaderStyle BackColor="#6B696B" Font-Bold="True"
ForeColor="White" />
<AlternatingRowStyle BackColor="White" />
</asp:GridView>
&nbsp;
<asp:SqlDataSource ID="SqlDataSource2" runat="server"
ConnectionString="<%$ ConnectionStrings:DBConnectionString2 %>"
DeleteCommand="DELETE FROM [aspnet_Users] WHERE [UserId]
= @UserId" InsertCommand="INSERT INTO [aspnet_Users]
([ApplicationId], [UserId], [UserName], [LoweredUserName],
[MobileAlias], [IsAnonymous], [LastActivityDate]) VALUES
(@ApplicationId, @UserId, @UserName, @LoweredUserName, @MobileAlias,
@IsAnonymous, @LastActivityDate)"
ProviderName="<%$
ConnectionStrings:DBConnectionString2.ProviderName %>"
SelectCommand="SELECT aspnet_Users.UserId, aspnet_Users.UserName,
aspnet_Membership.Password, aspnet_Membership.Email,
aspnet_Membership.CreateDate, aspnet_Membership.LastLoginDate,
aspnet_Profile.PropertyValuesString,
User_InterestFields.InterestField FROM aspnet_Users INNER JOIN
aspnet_Membership ON aspnet_Users.UserId = aspnet_Membership.UserId

191
INNER JOIN aspnet_Profile ON aspnet_Users.UserId =
aspnet_Profile.UserId INNER JOIN User_InterestFields ON
aspnet_Users.UserId = User_InterestFields.UserId"
UpdateCommand="UPDATE [aspnet_Users] SET [ApplicationId]
= @ApplicationId, [UserName] = @UserName, [LoweredUserName] =
@LoweredUserName, [MobileAlias] = @MobileAlias, [IsAnonymous] =
@IsAnonymous, [LastActivityDate] = @LastActivityDate WHERE [UserId] =
@UserId">
<DeleteParameters>
<asp:Parameter Name="UserId" Type="Object" />
</DeleteParameters>
<InsertParameters>
<asp:Parameter Name="ApplicationId" Type="Object" />
<asp:Parameter Name="UserId" Type="Object" />
<asp:Parameter Name="UserName" Type="String" />
<asp:Parameter Name="LoweredUserName" Type="String"
/>
<asp:Parameter Name="MobileAlias" Type="String" />
<asp:Parameter Name="IsAnonymous" Type="Boolean" />
<asp:Parameter Name="LastActivityDate"
Type="DateTime" />
</InsertParameters>
<UpdateParameters>
<asp:Parameter Name="ApplicationId" Type="Object" />
<asp:Parameter Name="UserName" Type="String" />
<asp:Parameter Name="LoweredUserName" Type="String"
/>
<asp:Parameter Name="MobileAlias" Type="String" />
<asp:Parameter Name="IsAnonymous" Type="Boolean" />
<asp:Parameter Name="LastActivityDate"
Type="DateTime" />
<asp:Parameter Name="UserId" Type="Object" />
</UpdateParameters>
</asp:SqlDataSource>

</div>
</form>
</body>

18.2- Edit user information page:


Partial Class ADMIN_EditUser
Inherits System.Web.UI.Page

Dim username As String


Dim user As MembershipUser
Dim user2 As ProfileCommon

Protected Sub Page_Load(ByVal sender As Object, ByVal e As


System.EventArgs) Handles Me.Load

username = Request.QueryString("username")

If (username = Nothing Or username = "") Then

Response.Redirect("MainPage.aspx")
End If
user = Membership.GetUser(username)

192
user2 = Profile.GetProfile(username)

If Not Me.IsPostBack() Then


Dim role As String() = Roles.GetRolesForUser(username)

For Each r As String In role


Me.CheckBoxList1.Items.FindByValue(r).Selected = True

Next
End If

End Sub

Protected Sub DeleteUser(ByVal sender As Object, ByVal e As


EventArgs) Handles Button2.Click

Membership.DeleteUser(username, True)
Response.Redirect("MainPage.aspx")
End Sub

Protected Sub UpdateUser(ByVal sender As Object, ByVal e As


DetailsViewUpdateEventArgs)

Try
user.Email = e.NewValues(0).ToString()
user.IsApproved = e.NewValues(1).ToString()

Membership.UpdateUser(user)

e.Cancel = True
UserInfo.ChangeMode(DetailsViewMode.ReadOnly)
Label1.Text = "updated.."
Catch ex As Exception

Label1.Text = "…‫ ;œ ‡žآ‬3Ÿ–4‡ B:  ‫ل‬DGŠ‫ا‬.. r sH‡ 3:FE48‫ا‬


‘—7L ¡:OQ"

e.Cancel = True
UserInfo.ChangeMode(DetailsViewMode.ReadOnly)
End Try

End Sub

Protected Sub UpdateProfile(ByVal sender As Object, ByVal e As


DetailsViewUpdateEventArgs)

Try
user2.ReciveMail = e.NewValues(0).ToString()
user2.FirstNme = e.NewValues(1).ToString()
user2.EducationalLevel = e.NewValues(2).ToString()
user2.LastName = e.NewValues(3).ToString()

user2.Save()
e.Cancel = True
UserProfile.ChangeMode(DetailsViewMode.ReadOnly)
Label3.Text = "updated.."
Catch ex As Exception

193
Label3.Text = "…‫ ;œ ‡žآ‬3Ÿ–4‡ B:  ‫ل‬DGŠ‫ا‬.. r sH‡ 3:FE48‫ا‬
‘—7L ¡:OQ"

e.Cancel = True
UserProfile.ChangeMode(DetailsViewMode.ReadOnly)
End Try

End Sub

Protected Sub Button3_Click(ByVal sender As Object, ByVal e As


System.EventArgs) Handles Button3.Click

For Each item As ListItem In Me.CheckBoxList1.Items


If item.Selected = True Then
If Not Roles.IsUserInRole(username, item.Value) Then
Roles.AddUserToRole(username, item.Value)
Label2.Text = " roles updated successfuly"
End If
Else

If (Roles.IsUserInRole(username, item.Value)) Then


Roles.RemoveUserFromRole(username, item.Value)
Label2.Text = " roles updated successfuly"
End If
End If
Next

End Sub

18.3- Online Users Page:


Protected Sub Page_PreRender(ByVal sender As Object, ByVal e As
System.EventArgs) Handles Me.PreRender
Dim allUsers As MembershipUserCollection =
Membership.GetAllUsers()
Dim filteredUsers As MembershipUserCollection = New
MembershipUserCollection()
For Each user As MembershipUser In allUsers

If user.IsOnline = True Then

filteredUsers.Add(user)
End If
Next
Users.DataSource = filteredUsers
Users.DataBind()
End Sub

18.4- Filter Users By Roles Page:


Protected Sub Page_Init1(ByVal sender As Object, ByVal e As
System.EventArgs) Handles Me.Init
UserRoles.DataSource = Roles.GetAllRoles()
UserRoles.DataBind()

194
End Sub

Protected Sub Page_PreRender1(ByVal sender As Object, ByVal e As


System.EventArgs) Handles Me.PreRender

Dim allUsers As MembershipUserCollection =


Membership.GetAllUsers()
Dim filteredUsers As MembershipUserCollection = New
MembershipUserCollection()

If UserRoles.SelectedIndex > 0 Then

Dim usersInRole As String() =


Roles.GetUsersInRole(UserRoles.SelectedValue)
For Each user As MembershipUser In allUsers

For Each userInRole As String In usersInRole

If userInRole = user.UserName Then

filteredUsers.Add(user)
Exit For
End If
Next
Next

Else

filteredUsers = allUsers
End If
Users.DataSource = filteredUsers
Users.DataBind()
End Sub

18.5- Create user page:


Protected Sub Button1_Click(ByVal sender As Object, ByVal e As
System.EventArgs) Handles Button1.Click
Try
'create new user
Dim NewUser As MembershipUser
'Dim field As ListItem
NewUser = Membership.CreateUser(Me.UserName.Text,
Me.Password.Text, Me.EmailTxtBox.Text)

For Each rolebox As ListItem In Me.CheckBoxList1.Items

If (rolebox.Selected) Then

Roles.AddUserToRole(UserName.Text, rolebox.Text)
End If
Next

Catch ex As MembershipCreateUserException
Msg.Text = GetErrorMessage(ex.StatusCode)
Catch ex As HttpException
Msg.Text = ex.Message

195
End Try

End Sub

Public Function GetErrorMessage(ByVal status As


MembershipCreateStatus) As String

Select Case status


Case MembershipCreateStatus.DuplicateUserName
Return "s=‫…م ا‬¢HŒI‫د ا‬D£D; K
ً‫ـ‬G–Œ; ، ‫ء‬K£68‫ل ا‬K“‫ اد‬s=‫ا‬
‫…م‬¢HŒ; 6“ƒ"

Case MembershipCreateStatus.DuplicateEmail
Return "…5¦8‫—¨و§ ا‬8©‫«ي ا‬8‫‰ ا‬HF“‫…م أد‬¢HŒ; K
ً‫ـ‬G–Œ;"

Case MembershipCreateStatus.InvalidPassword
Return "3EF‫ور آ‬6I‫ ®­ ا‬3O:OQ ، ¯} ‫‘ أن‬G‡© œA 4 ."

Case MembershipCreateStatus.InvalidEmail
Return "…5¦8‫—¨و§ ا‬8©‫¡ ®­ ا‬:OQ ‫ء‬K£68‫ ا‬38‫و‬K°‫ة ا‬6;
‫ى‬6“‫"أ‬

Case MembershipCreateStatus.InvalidAnswer
Return " "

Case MembershipCreateStatus.InvalidQuestion
Return " "

Case MembershipCreateStatus.InvalidUserName
Return "s=‫…م ا‬¢HŒI‫¡ ®­ ا‬:OQ ، ‫ء‬K£68‫ ا‬38‫و‬K°‫ة ا‬6; ‫ى‬6“‫"أ‬

Case MembershipCreateStatus.ProviderError
Return "‹=ž …G8 ‫ž †…ث‬z“ ‫ء‬K³´‫‘ أ‬:~ŒH8‫ ا‬، ‫ء‬K£68‫ا‬
38‫و‬K°‫ة ا‬6; ‫ى‬6“‫" ا‬

Case MembershipCreateStatus.UserRejected
Return "‹=ž …G8 ‫ž †…ث‬z“ ‫ء‬K³´‫‘ أ‬:~ŒH8‫ ا‬، ‫ء‬K£68‫ا‬
38‫و‬K°‫ة ا‬6; ‫ى‬6“‫" ا‬

Case Else
Return "‹=ž …G8 ‫ž †…ث‬z“ ‫ء‬K³´‫‘ أ‬:~ŒH8‫ ا‬، ‫ء‬K£68‫ا‬
38‫و‬K°‫ة ا‬6; ‫ى‬6“‫" ا‬
End Select
End Function

18.6- Manage roles page:


Dim createRoleSuccess As Boolean = True

Protected Sub Page_PreRender(ByVal sender As Object, ByVal e As


System.EventArgs) Handles Me.PreRender

Dim RoleList As DataTable = New DataTable()


RoleList.Columns.Add("Role Name")
RoleList.Columns.Add("# of Users")

Dim allRoles As String() = Roles.GetAllRoles()

For Each roleName As String In allRoles

196
Dim numberOfUsersInRole As Integer =
Roles.GetUsersInRole(roleName).Length
Dim roleRow As String() = {roleName,
numberOfUsersInRole.ToString()}
RoleList.Rows.Add(roleRow)
Next

UserRoles.DataSource = RoleList
UserRoles.DataBind()

If (createRoleSuccess) Then
NewRole.Text = ""
End If
End Sub

Protected Sub AddRole(ByVal sender As Object, ByVal e As


EventArgs)

Try

Roles.CreateRole(NewRole.Text)
label1.Text = "Role was added successfuly"
createRoleSuccess = True

Catch ex As Exception

label1.Text = ex.Message
createRoleSuccess = False
End Try
End Sub

Protected Sub DeleteRole(ByVal sender As Object, ByVal e As


CommandEventArgs)
Try

Roles.DeleteRole(e.CommandArgument.ToString())
label1.Text = "Role was deleted successfuly"

Catch ex As Exception

label1.Text = ex.Message
End Try
End Sub

18.7- Edit Main categories page:


<asp:GridView ID="GridView1" runat="server" AllowPaging="True"
AllowSorting="True"
AutoGenerateColumns="False" DataKeyNames="CatID,SubCatID"
DataSourceID="SqlDataSource2"
EmptyDataText="There are no data records to display."
BackColor="White" BorderColor="#DEDFDE" BorderStyle="None"
BorderWidth="1px" CellPadding="4" ForeColor="Black"
GridLines="Vertical">

197
<Columns>
<asp:CommandField ShowSelectButton="True" />
<asp:BoundField DataField="CatID" HeaderText="CatID"
InsertVisible="False" ReadOnly="True"
SortExpression="CatID" />
<asp:BoundField DataField="CatName"
HeaderText="CatName" SortExpression="CatName" />
<asp:BoundField DataField="SubCatID"
HeaderText="SubCatID" InsertVisible="False"
ReadOnly="True" SortExpression="SubCatID" />
<asp:BoundField DataField="SubCatName"
HeaderText="SubCatName" SortExpression="SubCatName" />
</Columns>
<FooterStyle BackColor="#CCCC99" />
<RowStyle BackColor="#F7F7DE" />
<PagerStyle BackColor="#F7F7DE" ForeColor="Black"
HorizontalAlign="Right" />
<SelectedRowStyle BackColor="#CE5D5A" Font-Bold="True"
ForeColor="White" />
<HeaderStyle BackColor="#6B696B" Font-Bold="True"
ForeColor="White" />
<AlternatingRowStyle BackColor="White" />
</asp:GridView>
<asp:SqlDataSource ID="SqlDataSource2" runat="server"
ConnectionString="<%$ ConnectionStrings:DBConnectionString1 %>"
SelectCommand="SELECT Category.CatID, Category.CatName,
SubCategory.SubCatID, SubCategory.SubCatName FROM Category INNER JOIN
SubCategory ON Category.CatID = SubCategory.CatID">
</asp:SqlDataSource>

18.8- Edit Sub categories page:


<asp:GridView ID="GridView1" runat="server" AllowPaging="True"
AllowSorting="True"
AutoGenerateColumns="False" BackColor="White"
BorderColor="#DEDFDE" BorderStyle="None"
BorderWidth="1px" CellPadding="4"
DataKeyNames="SubCatID" DataSourceID="SqlDataSource1"
EmptyDataText="There are no data records to display."
Font-Bold="False" Font-Italic="False"
Font-Size="12pt" Font-Underline="True"
ForeColor="Black" GridLines="Vertical">
<FooterStyle BackColor="#CCCC99" />
<RowStyle BackColor="#F7F7DE" />
<Columns>
<asp:CommandField ShowDeleteButton="True"
ShowEditButton="True" ShowSelectButton="True" />
<asp:BoundField DataField="SubCatID"
HeaderText="SubCatID" ReadOnly="True" SortExpression="SubCatID" />
<asp:BoundField DataField="SubCatName"
HeaderText="SubCatName" SortExpression="SubCatName" />
<asp:BoundField DataField="CatID"
HeaderText="CatID" SortExpression="CatID" />
</Columns>
<PagerStyle BackColor="#F7F7DE" ForeColor="Black"
HorizontalAlign="Right" />
<SelectedRowStyle BackColor="#CE5D5A" Font-
Bold="True" ForeColor="White" />

198
<HeaderStyle BackColor="#6B696B" Font-Bold="True"
ForeColor="White" />
<AlternatingRowStyle BackColor="White" />
</asp:GridView>
<asp:SqlDataSource ID="SqlDataSource1" runat="server"
ConnectionString="<%$ ConnectionStrings:DBConnectionString2 %>"
DeleteCommand="DELETE FROM [SubCategory] WHERE
[SubCatID] = @SubCatID" InsertCommand="INSERT INTO [SubCategory]
([SubCatName], [CatID]) VALUES (@SubCatName, @CatID)"
ProviderName="<%$
ConnectionStrings:DBConnectionString2.ProviderName %>"
SelectCommand="SELECT [SubCatID], [SubCatName], [CatID] FROM
[SubCategory]"
UpdateCommand="UPDATE [SubCategory] SET [SubCatName]
= @SubCatName, [CatID] = @CatID WHERE [SubCatID] = @SubCatID">
<DeleteParameters>
<asp:Parameter Name="SubCatID" Type="Int32" />
</DeleteParameters>
<InsertParameters>
<asp:Parameter Name="SubCatName" Type="String" />
<asp:Parameter Name="CatID" Type="Int32" />
</InsertParameters>
<UpdateParameters>
<asp:Parameter Name="SubCatName" Type="String" />
<asp:Parameter Name="CatID" Type="Int32" />
<asp:Parameter Name="SubCatID" Type="Int32" />
</UpdateParameters>
</asp:SqlDataSource>

18.9- Main categories page:


<asp:GridView ID="GridView1" runat="server" AllowPaging="True"
AllowSorting="True"
AutoGenerateColumns="False" BackColor="White"
BorderColor="#DEDFDE" BorderStyle="None"
BorderWidth="1px" CellPadding="4" DataKeyNames="CatID"
DataSourceID="SqlDataSource1"
EmptyDataText="There are no data records to display."
ForeColor="Black" GridLines="Vertical">
<FooterStyle BackColor="#CCCC99" />
<RowStyle BackColor="#F7F7DE" />
<Columns>
<asp:CommandField ShowEditButton="True"
ShowSelectButton="True" />
<asp:BoundField DataField="CatID" HeaderText="CatID"
ReadOnly="True" SortExpression="CatID" />
<asp:BoundField DataField="CatName"
HeaderText="CatName" SortExpression="CatName" />
</Columns>
<PagerStyle BackColor="#F7F7DE" ForeColor="Black"
HorizontalAlign="Right" />
<SelectedRowStyle BackColor="#CE5D5A" Font-Bold="True"
ForeColor="White" />
<HeaderStyle BackColor="#6B696B" Font-Bold="True"
ForeColor="White" />
<AlternatingRowStyle BackColor="White" />
</asp:GridView>

199
<asp:SqlDataSource ID="SqlDataSource1" runat="server"
ConnectionString="<%$ ConnectionStrings:DBConnectionString2 %>"
DeleteCommand="DELETE FROM [Category] WHERE [CatID] =
@CatID" InsertCommand="INSERT INTO [Category] ([CatName]) VALUES
(@CatName)"
ProviderName="<%$
ConnectionStrings:DBConnectionString2.ProviderName %>"
SelectCommand="SELECT [CatID], [CatName] FROM [Category]"
UpdateCommand="UPDATE [Category] SET [CatName] = @CatName
WHERE [CatID] = @CatID">
<DeleteParameters>
<asp:Parameter Name="CatID" Type="Int32" />
</DeleteParameters>
<InsertParameters>
<asp:Parameter Name="CatName" Type="String" />
</InsertParameters>
<UpdateParameters>
<asp:Parameter Name="CatName" Type="String" />
<asp:Parameter Name="CatID" Type="Int32" />
</UpdateParameters>
</asp:SqlDataSource>

18.10- Add new main Category:


Protected Sub Button1_Click(ByVal sender As Object, ByVal e As
System.EventArgs) Handles Button1.Click
Dim myConnection As SqlConnection
Dim myTransaction As SqlTransaction = Nothing

Dim correct As Boolean = True


Dim cmd As String = "INSERT INTO Category (CatName) Values
(@CatName)"

Try

myConnection = New
SqlConnection(ConfigurationManager.ConnectionStrings("DBConnectionStr
ing1").ToString())

myConnection.Open()

myTransaction = myConnection.BeginTransaction()

Dim myCommand As SqlCommand = New SqlCommand(cmd,


myConnection, myTransaction)

myCommand.Parameters.AddWithValue("CatName",
TextBox1.Text)

myCommand.ExecuteNonQuery()

myTransaction.Commit()

Catch ex As Exception
If (myTransaction.Equals(Nothing) = False) Then

200
myTransaction.Rollback()
correct = False

End If

Finally
myConnection.Dispose()

End Try

If correct = False Then


Label1.Text = " ‫ž †…ث‬z“ K;"
Else
Label1.Text = " ”· 3¸KC>‫ح ا‬K~³L"
End If

End Sub

18.11 - Add New Sub Category


Protected Sub Button1_Click(ByVal sender As Object, ByVal e As
System.EventArgs) Handles Button1.Click
Dim myConnection As SqlConnection
Dim myTransaction As SqlTransaction = Nothing
Dim reader As SqlDataReader
Dim correct As Boolean = True

Dim cmd As String = "SELECT CatID FROM Category WHERE


CatName ='" + Me.DropDownList1.SelectedValue + "'"

Try

myConnection = New
SqlConnection(ConfigurationManager.ConnectionStrings("DBConnectionStr
ing1").ToString())

myConnection.Open()

myTransaction = myConnection.BeginTransaction()

Dim myCommand As SqlCommand = New SqlCommand(cmd,


myConnection, myTransaction)

reader = myCommand.ExecuteReader()

reader.Read()

ID = CInt(reader(0))

reader.Close()

201
cmd = "INSERT INTO SubCategory (CatID,SubCatName) Values
(@CatID,@SubCatName)"

myCommand = New SqlCommand(cmd, myConnection,


myTransaction)

myCommand.Parameters.AddWithValue("CatID", ID)
myCommand.Parameters.AddWithValue("SubCatName",
TextBox1.Text)

myCommand.ExecuteNonQuery()

myTransaction.Commit()

Catch ex As Exception
If (myTransaction.Equals(Nothing) = False) Then
myTransaction.Rollback()
correct = False

End If

Finally
myConnection.Dispose()

End Try

If correct = False Then


Label1.Text = " ‫ž †…ث‬z“ K;"
Else
Label1.Text = " ”· 3¸KC>‫ح ا‬K~³L"
End If

End Sub

18.12 - View Learning Object Page:


<asp:GridView ID="GridView1" runat="server" AllowPaging="True"
AllowSorting="True"
AutoGenerateColumns="False" BackColor="White"
BorderColor="#DEDFDE" BorderStyle="None"
BorderWidth="1px" CellPadding="4"
DataSourceID="SqlDataSource1" EmptyDataText="There are no data
records to display."
ForeColor="Black" GridLines="Vertical">
<FooterStyle BackColor="#CCCC99" />
<RowStyle BackColor="#F7F7DE" />
<PagerStyle BackColor="#F7F7DE" ForeColor="Black"
HorizontalAlign="Right" />
<SelectedRowStyle BackColor="#CE5D5A" Font-Bold="True"
ForeColor="White" />
<HeaderStyle BackColor="#6B696B" Font-Bold="True"
ForeColor="White" />
<AlternatingRowStyle BackColor="White" />
<Columns>
<asp:BoundField DataField="LOID" HeaderText="LOID"
InsertVisible="False" ReadOnly="True"

202
SortExpression="LOID" />
<asp:BoundField DataField="Title" HeaderText="Title"
SortExpression="Title" />
<asp:BoundField DataField="SubCatName"
HeaderText="SubCatName" SortExpression="SubCatName" />
<asp:BoundField DataField="UserName"
HeaderText="UserName" SortExpression="UserName" />
<asp:BoundField DataField="NoOfViews"
HeaderText="NoOfViews" SortExpression="NoOfViews" />
<asp:BoundField DataField="NoOfDownloads"
HeaderText="NoOfDownloads" SortExpression="NoOfDownloads" />
<asp:BoundField DataField="TrackBacks"
HeaderText="TrackBacks" SortExpression="TrackBacks" />
<asp:TemplateField SortExpression="UserName">
<HeaderTemplate>view</HeaderTemplate>
<ItemTemplate >
<a href="EditLO.aspx?LOID=<%# Eval("LOID") %>">view</a>
</ItemTemplate>
</asp:TemplateField>
</Columns>
</asp:GridView>
<asp:SqlDataSource ID="SqlDataSource1" runat="server"
ConnectionString="<%$ ConnectionStrings:DBConnectionString2 %>"
DeleteCommand="DELETE FROM [LO] WHERE [LOID] = @LOID"
InsertCommand="INSERT INTO [LO] ([SubCatID], [BundleURL],
[NoOfDownloads], [NoOfViews], [TrackBacks], [rating], [audience],
[UserId]) VALUES (@SubCatID, @BundleURL, @NoOfDownloads, @NoOfViews,
@TrackBacks, @rating, @audience, @UserId)"
ProviderName="<%$
ConnectionStrings:DBConnectionString2.ProviderName %>"
SelectCommand="SELECT LO.LOID, LO.NoOfDownloads, LO.NoOfViews,
LO.TrackBacks, MetaData.Title, SubCategory.SubCatName,
aspnet_Users.UserName FROM LO INNER JOIN MetaData ON LO.LOID =
MetaData.Identifier INNER JOIN aspnet_Users ON LO.UserId =
aspnet_Users.UserId INNER JOIN SubCategory ON LO.SubCatID =
SubCategory.SubCatID"
UpdateCommand="UPDATE [LO] SET [SubCatID] = @SubCatID,
[BundleURL] = @BundleURL, [NoOfDownloads] = @NoOfDownloads,
[NoOfViews] = @NoOfViews, [TrackBacks] = @TrackBacks, [rating] =
@rating, [audience] = @audience, [UserId] = @UserId WHERE [LOID] =
@LOID">
<DeleteParameters>
<asp:Parameter Name="LOID" Type="Int32" />
</DeleteParameters>
<UpdateParameters>
<asp:Parameter Name="SubCatID" Type="Int32" />
<asp:Parameter Name="BundleURL" Type="String" />
<asp:Parameter Name="NoOfDownloads" Type="Int32" />
<asp:Parameter Name="NoOfViews" Type="Int32" />
<asp:Parameter Name="TrackBacks" Type="Int32" />
<asp:Parameter Name="rating" Type="Double" />
<asp:Parameter Name="audience" Type="String" />
<asp:Parameter Name="UserId" Type="Object" />
<asp:Parameter Name="LOID" Type="Int32" />
</UpdateParameters>
<InsertParameters>
<asp:Parameter Name="SubCatID" Type="Int32" />
<asp:Parameter Name="BundleURL" Type="String" />
<asp:Parameter Name="NoOfDownloads" Type="Int32" />
<asp:Parameter Name="NoOfViews" Type="Int32" />
<asp:Parameter Name="TrackBacks" Type="Int32" />

203
<asp:Parameter Name="rating" Type="Double" />
<asp:Parameter Name="audience" Type="String" />
<asp:Parameter Name="UserId" Type="Object" />
</InsertParameters>
</asp:SqlDataSource>

18.13 - Edit learning objects page:


Protected Sub Button1_Click(ByVal sender As Object, ByVal e As
System.EventArgs) Handles Button1.Click
Dim myConnection As SqlConnection
Dim myTransaction As SqlTransaction = Nothing
Dim reader As SqlDataReader
Dim filename As String = ""

Dim LOID As String = Request.QueryString("LOID")

Dim cmd As String = "SELECT BundleURL FROM LO WHERE LOID= " +


LOID
' Dim cmd As String = "DELETE FROM LO WHERE LOID=@LOID"

Try

myConnection = New
SqlConnection(ConfigurationManager.ConnectionStrings("DBConnectionStr
ing1").ToString())

myConnection.Open()

myTransaction = myConnection.BeginTransaction()

Dim myCommand As SqlCommand = New SqlCommand(cmd,


myConnection, myTransaction)

reader = myCommand.ExecuteReader()

reader.Read()

filename = CStr(reader(0))
reader.Close()

cmd = "DELETE FROM LO WHERE LOID = " + LOID


myCommand = New SqlCommand(cmd, myConnection,
myTransaction)

myCommand.ExecuteNonQuery()

If (filename.Contains("c\Uploads")) Then

File.Delete(Server.MapPath(filename))

End If

myTransaction.Commit()

Catch ex As Exception
If (myTransaction.Equals(Nothing) = False) Then
myTransaction.Rollback()

204
Label1.Text = "‫ž †…ث‬z“ K; ‫ء‬K³´‫ أ‬3:FEA ‫"اŠ«ف‬

End If

Finally
myConnection.Dispose()

End Try

If (Label1.Text = "") Then


Server.Transfer("Admin.aspx")
End If

End Sub

18.14- View comments page:


<asp:GridView ID="GridView1" runat="server" AllowPaging="True"
AllowSorting="True"
AutoGenerateColumns="False" BackColor="White"
BorderColor="#DEDFDE" BorderStyle="None"
BorderWidth="1px" CellPadding="4" DataKeyNames="Cno,LOID"
DataSourceID="SqlDataSource1"
EmptyDataText="There are no data records to display."
ForeColor="Black" GridLines="Vertical">
<FooterStyle BackColor="#CCCC99" />
<RowStyle BackColor="#F7F7DE" />
<Columns>
<asp:CommandField ShowDeleteButton="True"
ShowEditButton="True" />
<asp:BoundField DataField="Cno" HeaderText="Cno"
ReadOnly="True" SortExpression="Cno" />
<asp:BoundField DataField="LOID" HeaderText="LOID"
ReadOnly="True" SortExpression="LOID" />
<asp:BoundField DataField="comment"
HeaderText="comment" SortExpression="comment" ReadOnly="True" />
<asp:BoundField DataField="date" HeaderText="date"
SortExpression="date" ReadOnly="True" />
<asp:BoundField DataField="UserId"
HeaderText="UserId" SortExpression="UserId" ReadOnly="True" />
<asp:CheckBoxField DataField="IsApproved"
HeaderText="IsApproved" SortExpression="IsApproved" />
</Columns>
<PagerStyle BackColor="#F7F7DE" ForeColor="Black"
HorizontalAlign="Right" />
<SelectedRowStyle BackColor="#CE5D5A" Font-Bold="True"
ForeColor="White" />
<HeaderStyle BackColor="#6B696B" Font-Bold="True"
ForeColor="White" />
<AlternatingRowStyle BackColor="White" />
</asp:GridView>
<asp:SqlDataSource ID="SqlDataSource1" runat="server"
ConnectionString="<%$ ConnectionStrings:DBConnectionString2 %>"
DeleteCommand="DELETE FROM [Comment] WHERE [Cno] = @Cno
AND [LOID] = @LOID" InsertCommand="INSERT INTO [Comment] ([LOID],
[comment], [date], [UserId], [IsApproved]) VALUES (@LOID, @comment,
@date, @UserId, @IsApproved)"

205
ProviderName="<%$
ConnectionStrings:DBConnectionString2.ProviderName %>"
SelectCommand="SELECT Comment.*, Cno AS Expr1, LOID AS Expr2, comment
AS Expr3, date AS Expr4, UserId AS Expr5, IsApproved AS Expr6 FROM
Comment WHERE (IsApproved = 1)"
UpdateCommand="UPDATE [Comment] SET [IsApproved] =
@IsApproved WHERE [Cno] = @Cno AND [LOID] = @LOID">
<DeleteParameters>
<asp:Parameter Name="Cno" Type="Int32" />
<asp:Parameter Name="LOID" Type="Int32" />
</DeleteParameters>
<InsertParameters>
<asp:Parameter Name="LOID" Type="Int32" />
<asp:Parameter Name="comment" Type="String" />
<asp:Parameter Name="date" Type="DateTime" />
<asp:Parameter Name="UserId" Type="Object" />
<asp:Parameter Name="IsApproved" Type="Boolean" />
</InsertParameters>
<UpdateParameters>
<asp:Parameter Name="IsApproved" Type="Boolean" />
<asp:Parameter Name="Cno" Type="Int32" />
<asp:Parameter Name="LOID" Type="Int32" />
</UpdateParameters>
</asp:SqlDataSource>

18.15- Unapproved Comments page:


<asp:GridView ID="GridView1" runat="server" AllowPaging="True"
AllowSorting="True"
AutoGenerateColumns="False" BackColor="White"
BorderColor="#DEDFDE" BorderStyle="None"
BorderWidth="1px" CellPadding="4" DataKeyNames="Cno,LOID"
DataSourceID="SqlDataSource1"
EmptyDataText="There are no data records to display."
ForeColor="Black" GridLines="Vertical">
<FooterStyle BackColor="#CCCC99" />
<RowStyle BackColor="#F7F7DE" />
<Columns>
<asp:CommandField ShowDeleteButton="True"
ShowEditButton="True" />
<asp:BoundField DataField="Cno" HeaderText="Cno"
ReadOnly="True" SortExpression="Cno" />
<asp:BoundField DataField="LOID" HeaderText="LOID"
ReadOnly="True" SortExpression="LOID" />
<asp:BoundField DataField="comment"
HeaderText="comment" SortExpression="comment" ReadOnly="True" />
<asp:BoundField DataField="date" HeaderText="date"
SortExpression="date" ReadOnly="True" />
<asp:BoundField DataField="UserId"
HeaderText="UserId" SortExpression="UserId" ReadOnly="True" />
<asp:CheckBoxField DataField="IsApproved"
HeaderText="IsApproved" SortExpression="IsApproved" />
</Columns>
<PagerStyle BackColor="#F7F7DE" ForeColor="Black"
HorizontalAlign="Right" />
<SelectedRowStyle BackColor="#CE5D5A" Font-Bold="True"
ForeColor="White" />

206
<HeaderStyle BackColor="#6B696B" Font-Bold="True"
ForeColor="White" />
<AlternatingRowStyle BackColor="White" />
</asp:GridView>
<asp:SqlDataSource ID="SqlDataSource1" runat="server"
ConnectionString="<%$ ConnectionStrings:DBConnectionString2 %>"
DeleteCommand="DELETE FROM [Comment] WHERE [Cno] = @Cno
AND [LOID] = @LOID" InsertCommand="INSERT INTO [Comment] ([LOID],
[comment], [date], [UserId], [IsApproved]) VALUES (@LOID, @comment,
@date, @UserId, @IsApproved)"
ProviderName="<%$
ConnectionStrings:DBConnectionString2.ProviderName %>"
SelectCommand="SELECT Comment.*, Cno AS Expr1, LOID AS Expr2, comment
AS Expr3, date AS Expr4, UserId AS Expr5, IsApproved AS Expr6 FROM
Comment WHERE (IsApproved = 0)"
UpdateCommand="UPDATE [Comment] SET [IsApproved] =
@IsApproved WHERE [Cno] = @Cno AND [LOID] = @LOID">
<DeleteParameters>
<asp:Parameter Name="Cno" Type="Int32" />
<asp:Parameter Name="LOID" Type="Int32" />
</DeleteParameters>
<InsertParameters>
<asp:Parameter Name="LOID" Type="Int32" />
<asp:Parameter Name="comment" Type="String" />
<asp:Parameter Name="date" Type="DateTime" />
<asp:Parameter Name="UserId" Type="Object" />
<asp:Parameter Name="IsApproved" Type="Boolean" />
</InsertParameters>
<UpdateParameters>
<asp:Parameter Name="IsApproved" Type="Boolean" />
<asp:Parameter Name="Cno" Type="Int32" />
<asp:Parameter Name="LOID" Type="Int32" />
</UpdateParameters>
</asp:SqlDataSource>

18.16- View Report Back Page:


<asp:GridView ID="GridView1" runat="server" AllowPaging="True"
AllowSorting="True"
AutoGenerateColumns="False" BackColor="White"
BorderColor="#DEDFDE" BorderStyle="None"
BorderWidth="1px" CellPadding="4"
DataKeyNames="RBID,LOID" DataSourceID="SqlDataSource1"
EmptyDataText="There are no data records to display."
ForeColor="Black" GridLines="Vertical">
<FooterStyle BackColor="#CCCC99" />
<RowStyle BackColor="#F7F7DE" />
<Columns>
<asp:CommandField ShowDeleteButton="True" />
<asp:BoundField DataField="RBID" HeaderText="RBID"
ReadOnly="True" SortExpression="RBID" />
<asp:BoundField DataField="LOID" HeaderText="LOID"
ReadOnly="True" SortExpression="LOID" />
<asp:BoundField DataField="reason"
HeaderText="reason" SortExpression="reason" />
<asp:BoundField DataField="date" HeaderText="date"
SortExpression="date" />
<asp:BoundField DataField="UserId"
HeaderText="UserId" SortExpression="UserId" />

207
</Columns>
<PagerStyle BackColor="#F7F7DE" ForeColor="Black"
HorizontalAlign="Right" />
<SelectedRowStyle BackColor="#CE5D5A" Font-Bold="True"
ForeColor="White" />
<HeaderStyle BackColor="#6B696B" Font-Bold="True"
ForeColor="White" />
<AlternatingRowStyle BackColor="White" />
</asp:GridView>
<asp:SqlDataSource ID="SqlDataSource1" runat="server"
ConnectionString="<%$ ConnectionStrings:DBConnectionString2 %>"
DeleteCommand="DELETE FROM [ReportBack] WHERE [RBID] =
@RBID AND [LOID] = @LOID"
InsertCommand="INSERT INTO [ReportBack] ([RBID], [LOID],
[reason], [date], [UserId]) VALUES (@RBID, @LOID, @reason, @date,
@UserId)"
ProviderName="<%$
ConnectionStrings:DBConnectionString2.ProviderName %>"
SelectCommand="SELECT [RBID], [LOID], [reason], [date], [UserId] FROM
[ReportBack]"
UpdateCommand="UPDATE [ReportBack] SET [reason] =
@reason, [date] = @date, [UserId] = @UserId WHERE [RBID] = @RBID AND
[LOID] = @LOID">
<DeleteParameters>
<asp:Parameter Name="RBID" Type="Int32" />
<asp:Parameter Name="LOID" Type="Int32" />
</DeleteParameters>
<InsertParameters>
<asp:Parameter Name="RBID" Type="Int32" />
<asp:Parameter Name="LOID" Type="Int32" />
<asp:Parameter Name="reason" Type="String" />
<asp:Parameter Name="date" Type="DateTime" />
<asp:Parameter Name="UserId" Type="Object" />
</InsertParameters>
<UpdateParameters>
<asp:Parameter Name="reason" Type="String" />
<asp:Parameter Name="date" Type="DateTime" />
<asp:Parameter Name="UserId" Type="Object" />
<asp:Parameter Name="RBID" Type="Int32" />
<asp:Parameter Name="LOID" Type="Int32" />
</UpdateParameters>
</asp:SqlDataSource>

18.17- Send Message to Mailing List Page:

The send message to mailing list code as follow:

Protected Sub Button1_Click(ByVal sender As Object, ByVal e As


System.EventArgs) Handles Button1.Click
Dim myConnection As SqlConnection
Dim myTransaction As SqlTransaction = Nothing
Dim reader As SqlDataReader
Dim cmd As String = "SELECT Email, UserId FROM
aspnet_membership"

Dim user As ProfileCommon

208
Try
myConnection = New
SqlConnection(ConfigurationManager.ConnectionStrings("DBConnectionStr
ing1").ToString())
myConnection.Open()
myTransaction = myConnection.BeginTransaction()

Dim myCommand As SqlCommand = New SqlCommand(cmd,


myConnection, myTransaction)
Dim ToAddress As String = "test@yahoo.com"
Dim msg As New MailMessage("najla_m_t@yahoo.com",
ToAddress)

Dim smtp As New SmtpClient


smtp.Host = "localhost"
smtp.Port = 25
smtp.DeliveryMethod = SmtpDeliveryMethod.Network

reader = myCommand.ExecuteReader()

While reader.Read()

user.GetProfile(reader(1).ToString())

If user.ReciveMail = True Then


ToAddress = reader(0)
msg = New MailMessage("najla_m_t@yahoo.com",
ToAddress)
msg.Subject = TextBox1.Text
msg.Body = TextBox2.Text
msg.IsBodyHtml = False
msg.SubjectEncoding =
System.Text.Encoding.GetEncoding("windows-1256")
msg.BodyEncoding =
System.Text.Encoding.GetEncoding("windows-1256")
smtp.Send(msg)
End If
End While

reader.Close()

Label4.Text = "Message sent successesfully !"


Catch ex As SmtpException
Label4.Text = "Error : " + ex.Message
End Try
End Sub

19- User's Home Page:


protected Sub Page_Load(ByVal sender As Object, ByVal e As
System.EventArgs) Handles Me.Load

209
'declaration
Dim myConnection As SqlConnection
Dim myTransaction As SqlTransaction = Nothing

'database readers
Dim reader As SqlDataReader
Dim readerj As SqlDataReader
Dim readeru As SqlDataReader
Dim readeravg As SqlDataReader
Dim readeravgi As SqlDataReader
Dim readeravgj As SqlDataReader

'current user
Dim user As MembershipUser = Membership.GetUser()

' some temp variables to calculate the sums used in the


similarity computation
Dim sum1 As Double = 0, sum2 As Double = 0, sum3 As Double =
0

'used for the prediction computation


Dim sum4 As Double = 0, sum5 As Double = 0

'Rate_ux = rating of user u on item x


'Down_x = number of downloads of item x
'Track_x - number of TrackBacks of item x
Dim Rate_ui As Double = 0, Rate_uj As Double = 0, Down_i As
Double, Down_j As Double, Track_i As Double, Track_j As Double

'for keeping the top N predictions with there corresponding


LOID
Dim Top1 As Double = 0, Top2 As Double = 0, Top3 As Double =
0
Dim LOID1 As Integer = 0, LOID2 As Integer = 0, LOID3 As
Integer = 0
Dim Title1 As String = "", Title2 As String = "", Title3 As
String = ""
Dim temp_Top As Double = 0, temp_LOID As Integer = 0,
Temp_Title As String = ""

' similarity and prediction


Dim sim As Double = 0
Dim prediction As Double = 0

'select the interest fields for the current user


Dim cmd As String = "SELECT InterestField FROM
User_InterestFields WHERE UserId = @UserID"

'begin the transactions


'using try,catch to catch any unhandeled error
Try

myConnection = New
SqlConnection(ConfigurationManager.ConnectionStrings("DBConnectionStr
ing1").ToString())

myConnection.Open()

myTransaction = myConnection.BeginTransaction()

210
Dim myCommand As SqlCommand = New SqlCommand(cmd,
myConnection, myTransaction)

myCommand.Parameters.AddWithValue("UserID",
user.ProviderUserKey.ToString())

reader = myCommand.ExecuteReader()

If reader.Read() Then

'for each interest field


Dim interests As String() = reader(0).ToString().Split(",")
If interests.Length > 1 Then
For Each field As String In interests
If field <> "" Then

'get the subCatID for this interest field


cmd = "SELECT SubCatID FROM SubCategory WHERE SubCatName
LIKE '" + field + "'"

myCommand = New SqlCommand(cmd, myConnection, myTransaction)

reader.Close()

reader = myCommand.ExecuteReader()

'insure current user alresdy selected interest fields


If (reader.Read()) Then

' select items to calculate the similarity


' select all items in this "field" and not seen by current
user
' also retrieve the number of downloads and trackbacks for
each selected item

cmd = "SELECT LO.LOID, LO.NoOfDownloads, LO.TrackBacks,


MetaData.Title FROM LO CROSS JOIN MetaData WHERE
LO.LOID=MetaData.Identifier AND SubCatID= @ID AND LOID NOT IN (SELECT
LOID FROM Rating WHERE UserId = @UserId)"
myCommand = New SqlCommand(cmd, myConnection, myTransaction)

myCommand.Parameters.AddWithValue("UserId",
user.ProviderUserKey.ToString())
myCommand.Parameters.AddWithValue("ID", CInt(reader(0)))

'close the reader holding the SubCatID


reader.Close()

'excute the selection


reader = myCommand.ExecuteReader()

reader.Read()

'for each selected item i


'start the calculations
If (reader.HasRows) Then

211
While (reader.Read())

'calculate 20% of the current number of downloads


Down_i = 0.2 * CInt(reader(1))
'calculate 10% of the current number of trackBacks
Track_i = 0.1 * CInt(reader(2))

'select all items j already have been reted by the current


user
'also select the number of downloads and Trackbacks for each
selected item
cmd = "SELECT Rating.LOID,LO.NoOfDownloads, LO.TrackBacks,
Rating.NoStars FROM Rating cross join LO WHERE Rating.UserId =
@UserId AND NoStars > 0 "
myCommand = New SqlCommand(cmd, myConnection, myTransaction)

myCommand.Parameters.AddWithValue("UserId",
user.ProviderUserKey.ToString())

readerj = myCommand.ExecuteReader()

'insure the current user already rate some LOs


If (readerj.Read()) Then

'for each selected item j

While (readerj.Read())
'calculate 20% of the current number of downloads
Down_j = 0.2 * CInt(readerj(1))
'calculate 10% of the current number of trackBacks
Track_j = 0.1 * CInt(readerj(2))

'select each user who have rated BOTH i and j to calculate the
similarity between them
cmd = "SELECT UserId FROM Rating WHERE NoStars > 0 AND LOID = @j AND
UserId IN ( SELECT UserId From Rating WHERE LOID =@i AND NoStars > 0)
"

myCommand = New SqlCommand(cmd, myConnection, myTransaction)

myCommand.Parameters.AddWithValue("UserId",
user.ProviderUserKey.ToString())

myCommand.Parameters.AddWithValue("i", reader(0))

myCommand.Parameters.AddWithValue("j", readerj(0))

readeru = myCommand.ExecuteReader()

'insure there are users who rate both


If (readeru.HasRows) Then

'for each selected user u


While (readeru.Read())

'select the average rating for this user u


cmd = "SELECT AVG(NoStars) from Rating WHERE UserId= @user "
myCommand = New SqlCommand(cmd, myConnection, myTransaction)

212
myCommand.Parameters.AddWithValue("user", readeru(0))
readeravg = myCommand.ExecuteReader()

readeravg.Read()

'select the rating of user u on the item i


cmd = "SELECT NoStars from Rating WHERE LOID= @i AND UserId= @user"

myCommand = New SqlCommand(cmd, myConnection, myTransaction)

myCommand.Parameters.AddWithValue("i", reader(0))

myCommand.Parameters.AddWithValue("user", readeru(0))
readeravgi = myCommand.ExecuteReader()

readeravgi.Read()

'select the rating of user u on item j


cmd = "SELECT NoStars from Rating WHERE LOID= @j AND UserId=
@user"
myCommand = New SqlCommand(cmd, myConnection, myTransaction)

myCommand.Parameters.AddWithValue("j", readerj(0))

myCommand.Parameters.AddWithValue("user", readeru(0))

readeravgj = myCommand.ExecuteReader()

readeravgj.Read()

'some copmutations
Rate_ui = (CInt(readeravgi(0)) - CInt(readeravg(0)) * 0.7) +
Down_i + Track_i
Rate_uj = (CInt(readeravgj(0)) - CInt(readeravg(0)) * 0.7) +
Down_j + Track_j

sum1 += Rate_ui * Rate_uj


sum2 += Rate_ui * Rate_ui
sum3 += Rate_uj * Rate_uj

'closing unused readers

readeravgi.Close()

readeravgj.Close()

readeravg.Close()

'next user
End While

'end of the users' list.. close the reader


readeru.Close()

'after calculating the sum of rating for all users

213
'calculate the similarity between items i and j
sim = (sum1 / (System.Math.Sqrt(sum2) * System.Math.Sqrt(sum3)))

' empty sums for the next j


sum1 = sum2 = sum3 = 0

'prediction computation
sum4 += sim * readerj(3)
sum5 += sim

End If

'next j
End While

'end of the j's list


readerj.Close()

' compute the prediction of item i


If (sum5 > 0) Then
prediction = sum4 / sum5

Else
prediction = 0
End If

'empty the variables for the next i


sum4 = 0
sum5 = 0

If (prediction > Top3) Then


Top3 = prediction
LOID3 = reader(0)
Title3 = reader(3)

'sort
If (Top3 > Top2) Then
temp_Top = Top3
Top3 = Top2
Top2 = temp_Top
temp_LOID = LOID3
LOID3 = LOID2
LOID2 = temp_LOID
Temp_Title = Title3
Title3 = Title2
Title2 = Temp_Title

End If
If (Top2 > Top1) Then
temp_Top = Top2
Top2 = Top1
Top1 = temp_Top
temp_LOID = LOID2
LOID2 = LOID1
LOID1 = temp_LOID
Temp_Title = Title2
Title2 = Title1
Title1 = Temp_Title
End If
End If

214
End If

'next i
End While

End If
'end of the i's list
reader.Close()
End If
End If

'next interest field


Next
' end of interest fields

End If
End If

Catch ex As Exception
If (myTransaction.Equals(Nothing) = False) Then
myTransaction.Rollback()
Label2.Text = "‫«را‬A..‫ž †…ث‬z“ K; ‫ء‬K³´‫ أ‬3:FEA 3:QDH8‫"ا‬

End If

Finally
myConnection.Dispose()
'no errors
If (Label2.Text = "") Then
If (Top1 > 0) Then
Me.HyperLink1.NavigateUrl = "ViewLO.aspx?LOID=" +
CStr(LOID1)
Me.HyperLink1.Text = CStr(Title1)
If (Top2 > 0) Then
Me.HyperLink1.NavigateUrl = "ViewLO.aspx?LOID=" +
CStr(LOID2)
Me.HyperLink1.Text = CStr(Title2)
If (Top3 > 0) Then
Me.HyperLink1.NavigateUrl = "ViewLO.aspx?LOID=" +
CStr(LOID3)
Me.HyperLink1.Text = CStr(Title3)

End If
End If
Else
Label1.Text = " © …£D‡ »¼KH K:8K†"
Me.HyperLink1.NavigateUrl =
"javascript:openPopup('Details.aspx')"
Me.HyperLink1.Text = "‘:QKPH8‫"ا‬
End If

End If

End Try

215
End Sub
Protected Sub Button1_Click(ByVal sender As Object, ByVal e As
System.EventArgs) Handles Button1.Click
Dim UserId As String
Dim user As MembershipUser
user = Membership.GetUser()
UserId = user.ProviderUserKey.ToString()
Dim URL As String = "~/reg/myLOs.aspx?UserId=" + UserId
Response.Redirect(URL)

End Sub

20- Password Recovery:


Dim cmd As String = "SELECT Password, UserName FROM aspnet_membership
WHERE Email='" + TextBox1.Text + "'"

reader = myCommand.ExecuteReader()
reader.Read()

If reader.HasRows Then
Dim smtp As New SmtpClient
smtp.Host = "localhost"
smtp.Port = 25
smtp.DeliveryMethod = SmtpDeliveryMethod.Network

Dim msg = New MailMessage("najla_m_t@yahoo.com",


TextBox1.Text)
'msg.Subject = "Your Password"
'msg.Body = " your passwrd is " + reader(0) + ""
msg.Subject = "‫دة‬K4H=‫ ا‬3EF‫ور آ‬6I‫ › ا‬3¸64;"
msg.Body = " s=‫…م ا‬¢HŒI‫ ا‬: " + reader(1) + ""
msg.Body = " 3EF‫ور آ‬6I‫ ا‬: " + reader(0) + ""
msg.IsBodyHtml = False
msg.SubjectEncoding =
System.Text.Encoding.GetEncoding("windows-1256")
msg.BodyEncoding =
System.Text.Encoding.GetEncoding("windows-1256")
smtp.Send(msg)

Else
Label1.Text = " …5¦8‫—¨و§ ا‬8©‫¾½ ا‬K“"

End If
reader.Close()

Label2.Text = "{ ‫ل‬K=‫ إر‬3EF‫ور آ‬6I‫ ا‬À‫…ك إ‬56L §‫—¨و‬8>‫" ا‬


Catch ex As SmtpException
'Label2.Text = "Error : " + ex.Message
Label2.Text = " ‫دة‬K4H=©‫ ا‬3:FEA ‫ء‬K³´‫ أ‬K; žz“ ‫"†…ث‬

216
21- Registration:
Dim NewUser As MembershipUser
'Dim field As ListItem
NewUser = Membership.CreateUser(Me.UserName.Text,
Me.Password.Text, Me.EmailTxtBox.Text)

Dim nn As ProfileCommon =
Profile.GetProfile(NewUser.UserName) 'create the profile
nn.LastName = Lname.Text
nn.FirstNme = Fname.Text
nn.EducationalLevel = EduLevelList.SelectedValue
nn.ReciveMail = RecieveEmails.Checked
nn.Save()
AddDrop(NewUser.ProviderUserKey.ToString())

FormsAuthentication.RedirectFromLoginPage(Me.UserName.Text, True)
'login the user directly after registration

Public Function AddDrop(ByVal UserID As String) As String


Using conn As SqlConnection = New
SqlConnection(ConfigurationManager.ConnectionStrings("DBConnectionStr
ing1").ConnectionString)
Dim cmd As SqlCommand = conn.CreateCommand
cmd.CommandText = "INSERT INTO User_InterestFields
(UserId,InterestField) Values (@UserID,@InterestField)"

cmd.Parameters.AddWithValue("UserId", UserID)

Dim value As String = ""


For i As Byte = 0 To Me.InterestFields.Items.Count - 1
If Me.InterestFields.Items(i).Selected = True Then
value +=
Me.InterestFields.Items(i).Text.ToString()
value += ", "
End If
Next
cmd.Parameters.AddWithValue("InterestField", value)

Dim re As Integer
Try

conn.Open()
re = cmd.ExecuteNonQuery()
If re > 0 Then
Return "Success"
Else
Return "unSuccess"
End If
Catch ex As Exception
Return "unSuccess"
Finally
conn.Close()
End Try

End Using
End Function

217
The code for handling errors in registration is:

ublic Function GetErrorMessage(ByVal status As


MembershipCreateStatus) As String

Select Case status


Case MembershipCreateStatus.DuplicateUserName
Return "s=‫…م ا‬¢HŒI‫د ا‬D£D; K
ً‫ـ‬G–Œ; ، ‫ء‬K£68‫ل ا‬K“‫ اد‬s=‫ا‬
‫…م‬¢HŒ; 6“ƒ"

Case MembershipCreateStatus.DuplicateEmail
Return "…5¦8‫—¨و§ ا‬8©‫«ي ا‬8‫‰ ا‬HF“‫…م أد‬¢HŒ; K
ً‫ـ‬G–Œ;"

Case MembershipCreateStatus.InvalidPassword
Return "3EF‫ور آ‬6I‫ ®­ ا‬3O:OQ ، ¯} ‫‘ أن‬G‡© œA 4 ."

Case MembershipCreateStatus.InvalidEmail
Return "…5¦8‫—¨و§ ا‬8©‫¡ ®­ ا‬:OQ ‫ء‬K£68‫ ا‬38‫و‬K°‫ة ا‬6;
‫ى‬6“‫"أ‬

Case MembershipCreateStatus.InvalidAnswer
Return " "

Case MembershipCreateStatus.InvalidQuestion
Return " "

Case MembershipCreateStatus.InvalidUserName
Return "s=‫…م ا‬¢HŒI‫¡ ®­ ا‬:OQ ، ‫ء‬K£68‫ ا‬38‫و‬K°‫ة ا‬6; ‫ى‬6“‫"أ‬

Case MembershipCreateStatus.ProviderError
Return "‹=ž …G8 ‫ž †…ث‬z“ ‫ء‬K³´‫‘ أ‬:~ŒH8‫ ا‬، ‫ء‬K£68‫ا‬
38‫و‬K°‫ة ا‬6; ‫ى‬6“‫" ا‬

Case MembershipCreateStatus.UserRejected
Return "‹=ž …G8 ‫ž †…ث‬z“ ‫ء‬K³´‫‘ أ‬:~ŒH8‫ ا‬، ‫ء‬K£68‫ا‬
38‫و‬K°‫ة ا‬6; ‫ى‬6“‫ت اذا و ا‬6EH=‫ ا‬3F—7I‫< ا‬
ÄŸ K³ÆFL‫ أ‬KdzA "

Case Else
Return "‹=ž …G8 ‫ž †…ث‬z“ ‫ء‬K³´‫‘ أ‬:~ŒH8‫ ا‬، ‫ء‬K£68‫ا‬
38‫و‬K°‫ة ا‬6; ‫ى‬6“‫ت اذا و ا‬6EH=‫ ا‬3F—7I‫< ا‬ÄŸ K³ÆFL‫ أ‬KdzA"
End Select
End Function

22- Change Password:

The code written in the source html:

<%@ Page Language="VB" MasterPageFile="~/MasterPage.master"


AutoEventWireup="false" CodeFile="ChangePassword.aspx.vb"
Inherits="ChangePassword" title="Untitled Page" %>F
<asp:Content ID="Content1" ContentPlaceHolderID="ContentPlaceHolder1"
Runat="Server">
<asp:ChangePassword ID="ChangePassword1" runat="server"
CancelButtonText="‫ء‬KÆ8‫ إ‬6;È‫"ا‬

218
ChangePasswordButtonText="­:Ƈ 3EF‫ور آ‬6I‫ "ا‬Style="direction:
rtl; text-align: right"
CancelDestinationPageUrl="~/UserHomePage.aspx"
ChangePasswordFailureText="3EF‫ور آ‬6I‫ ®­ ا‬3O:OQ ، 3EF‫ور آ‬6I‫…ة ا‬5…É‫ا‬
‘G‡© œA 4 " ChangePasswordTitleText="­:Ƈ 3‫ــ‬EF‫ور آ‬6I‫" ا‬
ConfirmNewPasswordLabelText="…:‫ ‡žآ‬3EF‫ور آ‬6I‫…ة ا‬5…É‫"ا‬
ConfirmPasswordCompareErrorMessage="3EF‫ور آ‬6I‫…ة ا‬5…É‫ ®­ ا‬3GLKzH;"
ConfirmPasswordRequiredErrorMessage="…L© œ; …:‫ ‡žآ‬3EF‫ور آ‬6I‫"ا‬
ContinueButtonText="34LKHI‫"ا‬
ContinueDestinationPageUrl="~/UserHomePage.aspx"
NewPasswordLabelText="3EF‫ور آ‬6I‫…ة ا‬5…É‫"ا‬
NewPasswordRegularExpressionErrorMessage="‫ء‬K£68‫ل ا‬K“‫ اد‬3EF‫ور آ‬6;
‫ى‬6“‫ "أ‬NewPasswordRequiredErrorMessage="3EF‫ور آ‬6I‫…ة ا‬5…É‫ ا‬3LDFz; "
PasswordLabelText="3EF‫ور آ‬6I‫ ا‬3ʅG8‫"ا‬
PasswordRequiredErrorMessage="3EF‫ور آ‬6I‫ ا‬3ʅG8‫ ا‬3LDFz; "
SuccessText="{ ­:Ƈ 3EF‫ور آ‬6I‫ ا‬3‫ـ‬QKË‫™ ا‬L" SuccessTitleText="”·
3:FE48‫ح ا‬K~³L" UserNameLabelText="s=‫…م ا‬¢HŒI‫ "ا‬Font-Bold="True" Font-
Size="Medium">
</asp:ChangePassword>
</asp:Content>

23- Upload Learning Object:


<asp:Panel ID="titlePanel" runat="server" CssClass="collapesHeader"
style="text-align: right">
&nbsp;&nbsp; Title \
‫ان‬D³48‫& ا‬nbsp;
<asp:Image ID="Image1" runat="server"
ImageUrl="images/collapse.jpg" style="text-align: left" />&nbsp;
</asp:Panel>

<asp:Panel ID="titledesPanel" runat="server"


CssClass="collapesDefinition">
s=©‫ ا‬vz4I‫‹ ا‬FEF8 œ; ‘–• ‹8ÌI‫ أو ا‬6˜K³8‫<ا‬br />
The name given to the resource, usually by the Creator
or Publisher. </asp:Panel>

<ajaxToolkit:CollapsiblePanelExtender
ID="CollapsiblePanelExtender1" runat="server"
TargetControlID="titledesPanel"
ExpandControlID="titlePanel"
CollapseControlID="titlePanel"
Collapsed="true"

ImageControlID="Image1"
CollapsedImage="images/expand.jpg"
ExpandedImage="images/collapse.jpg"
SuppressPostBack= "true" >

</ajaxToolkit:CollapsiblePanelExtender>

The Upload code is::

219
Protected Sub Button2_Click(ByVal sender As Object, ByVal e As
System.EventArgs) Handles Button2.Click

Dim user As MembershipUser = Membership.GetUser()


Dim filename As String
If (FileUpload1.Enabled = True) Then
filename = "c:\Uploads\" + System.Guid.NewGuid.ToString()
+ System.IO.Path.GetExtension(FileUpload1.FileName)
ElseIf (ADDLINK.Enabled) Then
filename = ADDLINK.Text

End If

Dim myConnection As SqlConnection


Dim myTransaction As SqlTransaction = Nothing
Dim reader As SqlDataReader

Dim cmd As String = "SELECT SubCatID FROM SubCategory WHERE


subCatName ='" + CatList.SelectedValue + "'"

Try

myConnection = New
SqlConnection(ConfigurationManager.ConnectionStrings("DBConnectionStr
ing1").ToString())

myConnection.Open()

myTransaction = myConnection.BeginTransaction()

Dim myCommand As SqlCommand = New SqlCommand(cmd,


myConnection, myTransaction)

reader = myCommand.ExecuteReader()

reader.Read()

ID = CInt(reader(0))

reader.Close()

cmd = "INSERT INTO LO


(SubCatID,UserId,BundleURL,audience) Values
(@SubCatID,@UserId,@Bundle,@audience)"
myCommand = New SqlCommand(cmd, myConnection,
myTransaction)

myCommand.Parameters.AddWithValue("UserId",
user.ProviderUserKey.ToString())
myCommand.Parameters.AddWithValue("SubCatID", ID)
myCommand.Parameters.AddWithValue("Bundle", filename)

220
myCommand.Parameters.AddWithValue("audience",
CheckBoxList1.SelectedValue)

myCommand.ExecuteNonQuery()
If (FileUpload1.Enabled = True) Then
FileUpload1.PostedFile.SaveAs(filename)
End If

cmd = "select LOID from LO where LO.BundleURL ='" +


filename + "'"
myCommand = New SqlCommand(cmd, myConnection,
myTransaction)
reader = myCommand.ExecuteReader()
reader.Read()

ID = CInt(reader(0))

cmd = "INSERT INTO MetaData


(Identifier,Title,Creator,Language,Format,Date,Contributor,Descriptio
n,Coverage,Publisher,Relation,Rights,Source,Subject,Type) Values
(@ID,@Title,@Creator,@language,@Format,@Date,@Contributor,@Descriptio
n,@Coverage,@Publisher,@Relation,@Rights,@Source,@Subject,@Type)"
myCommand = New SqlCommand(cmd, myConnection,
myTransaction)

myCommand.Parameters.AddWithValue("Title", TitleBox.Text)
myCommand.Parameters.AddWithValue("Format",
System.IO.Path.GetExtension(filename))
myCommand.Parameters.AddWithValue("Creator",
CreatorBox.Text)
myCommand.Parameters.AddWithValue("Language",
LanguageList.SelectedValue)

myCommand.Parameters.AddWithValue("ID", ID)
myCommand.Parameters.AddWithValue("Description",
DescriptionBox.Text)

myCommand.Parameters.AddWithValue("Contributor",
ContributorBox.Text)
myCommand.Parameters.AddWithValue("Date", DateTime.Now())
myCommand.Parameters.AddWithValue("Coverage",
CoverageBox.Text)
myCommand.Parameters.AddWithValue("Publisher",
PublisherBox.Text)
myCommand.Parameters.AddWithValue("Relation",
RelationBox.Text)
myCommand.Parameters.AddWithValue("Rights",
RightsBox.Text)
myCommand.Parameters.AddWithValue("Source",
SourceBox.Text)
myCommand.Parameters.AddWithValue("Subject",
SubjectBox.Text)
myCommand.Parameters.AddWithValue("Type",
TypesList.SelectedValue)

myCommand.ExecuteNonQuery()

reader.Close()

221
myTransaction.Commit()

Catch ex As Exception
If (myTransaction.Equals(Nothing) = False) Then
myTransaction.Rollback()
Server.Transfer("ErrorUploading.aspx")

End If

Finally
myConnection.Dispose()

End Try

Server.Transfer("confirmUploading.aspx")

End Sub

Protected Sub AddLinkCheck_Click(ByVal sender As Object, ByVal e


As System.EventArgs)
FileUpload1.Visible = False
FileUpload1.Enabled = False
ADDLINK.Enabled = True
ADDLINK.Visible = True

End Sub

Protected Sub UPLOAD_Click1(ByVal sender As Object, ByVal e As


System.EventArgs)
FileUpload1.Visible = True
FileUpload1.Enabled = True
ADDLINK.Enabled = False
ADDLINK.Visible = False

End Sub

24- User's profile updating:


Protected Sub Page_Load(ByVal sender As Object, ByVal e As
System.EventArgs) Handles Me.Load

If Page.IsPostBack = False Then

Dim user As MembershipUser = Membership.GetUser()


Dim user2 As ProfileCommon =
Profile.GetProfile(user.UserName.ToString())
Dim myConnection As SqlConnection
Dim myTransaction As SqlTransaction = Nothing
Dim reader As SqlDataReader
Dim cmd As String = "SELECT InterestField FROM
User_InterestFields WHERE UserId ='" +
user.ProviderUserKey.ToString() + "'"

Me.EmailBox.Text = user.Email.ToString()
Me.LastActiveDate.Text = user.LastActivityDate.ToString()

222
Me.CreateDate.Text = user.CreationDate.ToString()
Me.LNameBox.Text = user2.LastName.ToString()
Me.FNameBox.Text = user2.FirstNme.ToString()

Dim eduLevel As String =


user2.EducationalLevel.ToString()
Dim recMail As Boolean = user2.ReciveMail

If
(Me.RadioButtonList2.Items.Contains(Me.RadioButtonList2.Items.FindByV
alue(eduLevel))) Then

Me.RadioButtonList2.Items.FindByValue(eduLevel).Selected = True
End If

Me.RadioButtonList1.Items.FindByValue(recMail).Selected =
True

Try

myConnection = New
SqlConnection(ConfigurationManager.ConnectionStrings("DBConnectionStr
ing1").ToString())

myConnection.Open()

myTransaction = myConnection.BeginTransaction()

Dim myCommand As SqlCommand = New SqlCommand(cmd,


myConnection, myTransaction)

reader = myCommand.ExecuteReader()

reader.Read()

Dim interests As String() =


reader(0).ToString().Split(",")
If interests.Length >= 1 Then
For Each field As String In interests
If field <> "" Then

If
(Me.CheckBoxList1.Items.Contains(Me.CheckBoxList1.Items.FindByValue(f
ield))) Then

Me.CheckBoxList1.Items.FindByValue(field).Selected = True
End If

End If

Next

End If

Catch ex As Exception
If (myTransaction.Equals(Nothing) = False) Then
myTransaction.Rollback()

End If

223
Finally
myConnection.Dispose()

End Try
End If
End Sub

Protected Sub Button2_Click(ByVal sender As Object, ByVal e As


System.EventArgs) Handles Button2.Click

Dim user As MembershipUser = Membership.GetUser()


Dim user2 As ProfileCommon =
Profile.GetProfile(user.UserName.ToString())

Dim myConnection As SqlConnection


Dim myTransaction As SqlTransaction = Nothing
Dim cmd As String

Try

myConnection = New
SqlConnection(ConfigurationManager.ConnectionStrings("DBConnectionStr
ing1").ToString())

myConnection.Open()

user.Email = EmailBox.Text
Membership.UpdateUser(user)

user2.LastName = LNameBox.Text

user2.FirstNme = FNameBox.Text

user2.EducationalLevel =
Me.RadioButtonList2.SelectedValue
user2.ReciveMail = Me.RadioButtonList1.SelectedValue
user2.Save()

cmd = "UPDATE User_InterestFields SET InterestField=


@InterestField WHERE UserId ='" + user.ProviderUserKey.ToString() +
"'"
Dim myCommand As SqlCommand = New SqlCommand(cmd,
myConnection, myTransaction)

Dim value As String = ""


For i As Byte = 0 To Me.CheckBoxList1.Items.Count - 1
If Me.CheckBoxList1.Items(i).Selected = True Then
value +=
Me.CheckBoxList1.Items(i).Text.ToString()
If i < Me.CheckBoxList1.Items.Count - 2 Then
value += ","
End If
End If
Next
myCommand.Parameters.AddWithValue("InterestField", value)

myCommand.ExecuteNonQuery()

224
Catch ex As Exception

End Try

Server.Transfer("ConfirmUpdatingProfile.aspx")

End Sub

Protected Sub Button1_Click(ByVal sender As Object, ByVal e As


System.EventArgs) Handles Button1.Click
Server.Transfer("UserHomePage.aspx")

End Sub

25 - My Personal Collections:
Protected Sub Page_Load(ByVal sender As Object, ByVal e As
System.EventArgs) Handles Me.Load
If Page.IsPostBack = False Then
Dim user As MembershipUser = Membership.GetUser()
Me.ListPCs.SelectParameters.Add("UserId",
user.ProviderUserKey.ToString())

End If
End Sub
Protected Sub Button1_Click(ByVal sender As Object, ByVal e As
System.EventArgs) Handles Button1.Click
Dim user As MembershipUser = Membership.GetUser()

Dim reader As SqlDataReader


Dim myConnection As SqlConnection
Dim myTransaction As SqlTransaction = Nothing

Dim cmd As String = "SELECT PCID FROM PersonalCollection


WHERE (UserId=@UserId AND PCName=@PCName)"
Dim cmd2 As String = "INSERT INTO PersonalCollection
(PCName,UserId) Values (@PCName,@UserId)"

Try
myConnection = New
SqlConnection(ConfigurationManager.ConnectionStrings("DBConnectionStr
ing1").ToString())
myConnection.Open()
myTransaction = myConnection.BeginTransaction()

Dim myCommand As SqlCommand = New SqlCommand(cmd,


myConnection, myTransaction)

myCommand.Parameters.AddWithValue("UserId",
user.ProviderUserKey.ToString())
myCommand.Parameters.AddWithValue("PCName",
TextBox1.Text)

225
reader = myCommand.ExecuteReader()
reader.Read()
If reader.HasRows Then
MsgBox("3FÅP; ‫«ا‬Í s=©‫د ا‬D£D; ‫ء‬K£68‫­ ا‬:Ƈ s=©‫)"ا‬
reader.Close()
Else
reader.Close()
myCommand = New SqlCommand(cmd2, myConnection,
myTransaction)

myCommand.Parameters.AddWithValue("PCName",
TextBox1.Text)
myCommand.Parameters.AddWithValue("UserId",
user.ProviderUserKey.ToString())

myCommand.ExecuteNonQuery()

myTransaction.Commit()
DataBind()

End If

The piece of code written in the source html is shown below:

<asp:BoundField DataField="PCID" HeaderText="PCID" ReadOnly="True"


SortExpression="PCID"
Visible="False" />
<asp:BoundField DataField="LOID" HeaderText="LOID"
ReadOnly="True" SortExpression="LOID"
Visible="False" />
<asp:HyperLinkField DataNavigateUrlFields="LOID"
DataNavigateUrlFormatString="../any/ViewLO.aspx?LOID={0}"
DataTextField="Title" HeaderText="‫ان‬D³48‫ "ا‬/>
<asp:CommandField ShowDeleteButton="True" DeleteText="‫"†«ف‬
/>

26- My Learning Objects:


Protected Sub Page_Load(ByVal sender As Object, ByVal e As
System.EventArgs) Handles Me.Load
Dim C As Integer
Dim user As MembershipUser = Membership.GetUser()

myCommand.CommandText = " SELECT COUNT(LOID)FROM LO WHERE


UserId='" + user.ProviderUserKey.ToString() + "'"
myCommand.Connection.Open()
reader =
myCommand.ExecuteReader(CommandBehavior.CloseConnection)
reader.Read()

C = reader(0)
If C = 0 Then

TextBox2.Text = "r sG‡ 3¸KCÎL ‫…ر‬Ï; §E:F4‡ І ‫ن‬Ñ‫"ا‬


End If
reader.Close()

226
myConnection.Close()
End Sub

27- Update:
Protected Sub Page_Load(ByVal sender As Object, ByVal e As
System.EventArgs) Handles Me.Load
If Not Page.IsPostBack Then
Dim loid As Integer = Request.QueryString("LOID")
myCommand.CommandText = "SELECT * FROM MetaData WHERE
Identifier =" & loid

myCommand.Connection.Open()
reader =
myCommand.ExecuteReader(CommandBehavior.CloseConnection)

reader.Read()
TitleBox.Text = reader.GetString(1)
CreatorBox.Text = reader.GetString(2)
LanguageList.Text = reader.GetString(3)
' FormatList.Text = reader.GetString(4)
ContributorBox.Text = reader.GetString(6)
DescriptionBox.Text = reader.GetString(7)
CoverageBox.Text = reader.GetString(8)
PublisherBox.Text = reader.GetString(9)
RelationBox.Text = reader.GetString(10)
RightsBox.Text = reader.GetString(11)
SourceBox.Text = reader.GetString(12)
SubjectBox.Text = reader.GetString(13)
' TypesList.Text = reader.GetString(14)
reader.Close()

End If
If Not Page.IsPostBack Then
Dim loid As Integer = Request.QueryString("LOID")
myCommand.CommandText = "SELECT audience FROM LO WHERE
LOID =" & loid
myCommand.Connection.Open()
reader =
myCommand.ExecuteReader(CommandBehavior.CloseConnection)
reader.Read()
'AudienceBox.Text = reader.GetString(0)
RadioButtonList1.Text = reader.GetString(0)
reader.Close()
End If
End Sub

Protected Sub Button1_Click(ByVal sender As Object, ByVal e As


System.EventArgs) Handles Button1.Click
Dim loid As Integer = Request.QueryString("LOID")

myCommand.CommandText = "update MetaData set Title='" &


TitleBox.Text & "',Creator='" & CreatorBox.Text & "',Contributor='" &
ContributorBox.Text & "',Description='" & DescriptionBox.Text &
"',Coverage='" & CoverageBox.Text & "',Publisher='" &
PublisherBox.Text & "',Relation='" & RelationBox.Text & "',Rights='"

227
& RightsBox.Text & "',Source='" & SourceBox.Text & "',Subject='" &
SubjectBox.Text & "',Language='" & LanguageList.SelectedValue & "'
where Identifier=" & loid
myConnection.Open()
myCommand.ExecuteNonQuery()
myConnection.Close()
myCommand.CommandText = "update LO set Audience='" &
RadioButtonList1.SelectedValue & "' where LOID =" & loid
myConnection.Open()
myCommand.ExecuteNonQuery()
myConnection.Close()

End Sub

228

Вам также может понравиться