Click here to Skip to main content
13,630,992 members
Click here to Skip to main content
Articles » Web Development » ASP.NET » General » Downloads

Stats

169.3K views
6K downloads
190 bookmarked
Posted 29 May 2011
Licenced CPOL

YouGrade - Asp.NET MVC Multimedia Exam Suite

A multimedia exam suite built on Asp.NET and Youtube
YouGrade
App_Data
YouGrade.mdf
YouGrade_log.LDF
Assemblies
AutoMapper.dll
bin
Content
Images
Buttons.PNG
Buttons2.png
Paper.jpg
ui-bg_diagonals-thick_18_b81900_40x40.png
ui-bg_diagonals-thick_20_666666_40x40.png
ui-bg_flat_10_000000_40x100.png
ui-bg_glass_100_f6f6f6_1x400.png
ui-bg_glass_100_fdf5ce_1x400.png
ui-bg_glass_65_ffffff_1x400.png
ui-bg_gloss-wave_35_f6a828_500x100.png
ui-bg_highlight-soft_100_eeeeee_1x100.png
ui-bg_highlight-soft_75_ffe45c_1x100.png
ui-icons_222222_256x240.png
ui-icons_228ef1_256x240.png
ui-icons_ef8c08_256x240.png
ui-icons_ffd27a_256x240.png
ui-icons_ffffff_256x240.png
YouGrade.PNG
themes
base
images
ui-bg_flat_0_aaaaaa_40x100.png
ui-bg_flat_75_ffffff_40x100.png
ui-bg_glass_55_fbf9ee_1x400.png
ui-bg_glass_65_ffffff_1x400.png
ui-bg_glass_75_dadada_1x400.png
ui-bg_glass_75_e6e6e6_1x400.png
ui-bg_glass_95_fef1ec_1x400.png
ui-bg_highlight-soft_75_cccccc_1x100.png
ui-icons_222222_256x240.png
ui-icons_2e83ff_256x240.png
ui-icons_454545_256x240.png
ui-icons_888888_256x240.png
ui-icons_cd0a0a_256x240.png
Controllers
DBScripts
Dtos
Model
YouGrade.edmx
Models
obj
Debug
Properties
Scripts
Views
Account
Home
Shared
Site.Master
YouGrade.csproj.user
YouGradeService.svc
YouGrade.mdf
YouGrade_log.LDF
AutoMapper.dll
Buttons.PNG
Buttons2.png
Paper.jpg
ui-bg_diagonals-thick_18_b81900_40x40.png
ui-bg_diagonals-thick_20_666666_40x40.png
ui-bg_flat_10_000000_40x100.png
ui-bg_glass_100_f6f6f6_1x400.png
ui-bg_glass_100_fdf5ce_1x400.png
ui-bg_glass_65_ffffff_1x400.png
ui-bg_gloss-wave_35_f6a828_500x100.png
ui-bg_highlight-soft_100_eeeeee_1x100.png
ui-bg_highlight-soft_75_ffe45c_1x100.png
ui-icons_222222_256x240.png
ui-icons_228ef1_256x240.png
ui-icons_ef8c08_256x240.png
ui-icons_ffd27a_256x240.png
ui-icons_ffffff_256x240.png
YouGrade.PNG
ui-bg_flat_0_aaaaaa_40x100.png
ui-bg_flat_75_ffffff_40x100.png
ui-bg_glass_55_fbf9ee_1x400.png
ui-bg_glass_65_ffffff_1x400.png
ui-bg_glass_75_dadada_1x400.png
ui-bg_glass_75_e6e6e6_1x400.png
ui-bg_glass_95_fef1ec_1x400.png
ui-bg_highlight-soft_75_cccccc_1x100.png
ui-icons_222222_256x240.png
ui-icons_2e83ff_256x240.png
ui-icons_454545_256x240.png
ui-icons_888888_256x240.png
ui-icons_cd0a0a_256x240.png
YouGrade.edmx
Site.Master
YouGrade.csproj.user
YouGradeService.svc
<%@ Master Language="C#" Inherits="System.Web.Mvc.ViewMasterPage<YouGrade.Dtos.ExamDefDto>" %>

<%@ Import Namespace="System.Data" %>
<%@ Import Namespace="System.Data.Entity" %>
<!DOCTYPE html>
<html>
<head runat="server">
    <title>
        <asp:ContentPlaceHolder ID="TitleContent" runat="server" />
    </title>
    <link href="<%: Url.Content("~/Content/Site.css") %>" rel="stylesheet" type="text/css" />
    <link href="<%: Url.Content("~/Content/jquery-ui-1.8.13.custom.css") %>" rel="stylesheet" type="text/css" />
    <link rel="shortcut icon" href=""<%: Url.Content("~/Content/Images/YouGrade.PNG") %>" type="image/x-icon" />
    <link href="http://fonts.googleapis.com/css?family=Brawler:regular" rel="stylesheet" type="text/css"/>
    <link  href="http://fonts.googleapis.com/css?family=Cherry+Cream+Soda:regular" rel="stylesheet" type="text/css"/>
    <link  href="http://fonts.googleapis.com/css?family=Schoolbell:regular" rel="stylesheet" type="text/css"/>
    <script src="<%: Url.Content("~/Scripts/jquery-1.5.1.min.js") %>" type="text/javascript"></script>
    <script src="<%: Url.Content("~/Scripts/modernizr-1.7.min.js") %>" type="text/javascript"></script>
    <script src="<%: Url.Content("~/Scripts/jquery-ui-1.8.13.custom.min.js") %>" type="text/javascript"></script>
    <script type="text/javascript" src="<%: Url.Content("~/Scripts/swfobject.js") %>"></script>
    <script type="text/javascript">
        var question;
        // The video to load.
        var videoID = "iapcKVn7DdY"
        http: //www.youtube.com/watch?v=
        // Lets Flash from another domain call JavaScript
        var params = { allowScriptAccess: "always", wmode: "transparent" };
        // The element id of the Flash embed
        var atts = { id: "ytPlayer" };
        // All of the magic handled by SWFObject (http://code.google.com/p/swfobject/)
        swfobject.embedSWF("http://www.youtube.com/v/" + videoID + "&enablejsapi=1&playerapiid=ytPlayer&wmode=opaque",
                   "videoDiv", "480", "295", "8", null, null, params, atts);
        var ytplayer;

        $(window).load(function () {

            // Dialog			
            $('#endExamDialog').dialog({
                autoOpen: false,
                modal: true,
                width: 600,
                buttons: {
                    "Ok": function () {
                        $(this).dialog("close");
                    }
                }
            });

            $('.button').hover(
                function () {
                    $(this).removeClass('ui-state-default');
                    $(this).addClass('ui-state-hover');
                },
                function () {
                    $(this).addClass('ui-state-default');
                    $(this).removeClass('ui-state-hover');
                });
        });

        function onYouTubePlayerReady(playerId) {
            ytplayer = document.getElementById(playerId);
            getQuestion();
        }

        function play() {
            renderQuestion(question);
        }

        function getQuestion() {
            $.ajax({
                url: '/Home/GetQuestion',
                type: 'GET',
                cache: false,
                dataType: 'json',
                error: function (jqXHR, textStatus, errorThrown) {
                    alert(errorThrown);
                },
                success: function (json) {
                    question = json;
                    renderQuestion(json);
                }
            });
        }

        function moveToPreviousQuestion() {
            saveAnswer();
            $.ajax({
                url: '/Home/MoveToPreviousQuestion',
                type: 'GET',
                cache: false,
                dataType: 'json',
                error: function (jqXHR, textStatus, errorThrown) {
                    alert(errorThrown);
                },
                success: function (json) {
                    renderQuestion(json);
                }
            });
        }

        function moveToNextQuestion() {
            saveAnswer();
            $.ajax({
                url: '/Home/MoveToNextQuestion',
                type: 'GET',
                cache: false,
                dataType: 'json',
                error: function (jqXHR, textStatus, errorThrown) {
                    alert(errorThrown);
                },
                success: function (json) {
                    renderQuestion(json);
                }
            });
        }

        function saveAnswer(afterSaveAnswer) {
            var answers = '';
            $.each($('.alternatives > input'), function (key, value) {
                if ($(this).attr('value') == 'on') {
                    answers = answers + String.fromCharCode(65 + key);
                }
            });

            $.ajax({
                url: '/Home/SaveAnswer',
                type: 'POST',
                cache: false,
                dataType: 'json',
                data: ({
                    questionId: question.Id,
                    answers: answers
                }),
                error: function (jqXHR, textStatus, errorThrown) {
                    alert(errorThrown);
                },
                success: function (json) {
                    //                    renderQuestion(json);
                    if (afterSaveAnswer != null) {
                        afterSaveAnswer();
                    }
                }
            });
        }

        function endExam() {
            ytplayer.pauseVideo();
            saveAnswer(function () {
                $('#endExamDialog').dialog('open');
                $.ajax({
                    url: '/Home/EndExam',
                    type: 'GET',
                    cache: false,
                    dataType: 'json',
                    data: ({}),
                    error: function (jqXHR, textStatus, errorThrown) {
                        alert(errorThrown);
                    },
                    success: function (json) {
                        $("#progressbarYourResults").progressbar({
                            value: json.result
                        });
                        $('#yourResult').html(json.result);

                        $("#progressbarMinimum").progressbar({
                            value: json.minimum
                        });
                        $('#minimum').html(json.minimum);
                    }
                });
            });
        }

        function renderQuestion(q) {
            question = q;

            ytplayer.stopVideo();
            ytplayer.loadVideoById(q.Url, q.StartSeconds);
            ytplayer.playVideo();

            $('.questionTitle').html('<div class="questionTitle">Question ' + q.Id + '</div>');
            $('.questionText').html(q.Text);

            $('.alternatives').html('');
            for (var i = 0; i < q.Alternatives.length; i++) {
                var checked = q.Alternatives[i].IsChecked ? 'checked="true"' : '';
                var type = q.IsMultiSelect ? 'checkbox' : 'radio';
                $('.alternatives').append('<input id="alt' + q.Alternatives[i].Id + '" name="alternatives" type="' + type + '" ' + checked + ' />' + q.Alternatives[i].Id + '. ' + q.Alternatives[i].Text + '<br />');
            }
        }
    </script>
</head>
<body>
    <div class="page">
        <header>
            <div id="title">
                <h1>
                <img src="../../Content/Images/YouGrade.PNG" width="120" />
                <div class="examTitle"><%=ViewData.Model.Name %></div></h1>
            </div>
            <div id="logindisplay">
                &nbsp;<%--<% Html.RenderPartial("LogOnUserControl"); %>--%>
            </div>
            <nav>
                <ul id="menu">
                    <li><%: Html.ActionLink("Home", "Index", "Home")%></li>
                    <%--<li><%: Html.ActionLink("About", "About", "Home")%></li>--%>
                </ul>
            </nav>
        </header>
        <section id="main">
<%--            <div id="background">
                <img src="../../Content/Images/Paper.jpg" class="stretch" alt="" />
            </div>--%>
            <!-- ui-dialog -->
            <div id="endExamDialog" title="<%=ViewData.Model.Name %> - Results" style="z-index:1000;">
                <p>Your Result: <span id="yourResult"></span></p>
                <div id="progressbarYourResults"></div>
                <p>Minimum: <span id="minimum"></span></p>
                <div id="progressbarMinimum"></div>
            </div>
            <asp:ContentPlaceHolder ID="MainContent" runat="server" />
            <footer>
            </footer>
        </section>
    </div>
</body>
</html>

By viewing downloads associated with this article you agree to the Terms of Service and the article's licence.

If a file you wish to view isn't highlighted, and is a text file (not binary), please let us know and we'll add colourisation support for it.

License

This article, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

Share

About the Author


You may also be interested in...

Permalink | Advertise | Privacy | Cookies | Terms of Use | Mobile
Web03 | 2.8.180712.1 | Last Updated 8 Jun 2011
Article Copyright 2011 by Marcelo Ricardo de Oliveira
Everything else Copyright © CodeProject, 1999-2018
Layout: fixed | fluid