Пример #1
0
public static System.Web.WebPages.HelperResult Slide(BlockRenderContext context, int currentScore = 0)
{
return new System.Web.WebPages.HelperResult(__razor_helper_writer => {


 

WebViewPage.WriteLiteralTo(@__razor_helper_writer, "\t<div class=\"slide\">\r\n\t\t<h1>\r\n\t\t\t");


WebViewPage.WriteTo(@__razor_helper_writer, context.Slide.Title);

WebViewPage.WriteLiteralTo(@__razor_helper_writer, "\r\n\t\t\t<span class=\"score\">");


WebViewPage.WriteTo(@__razor_helper_writer, Score(currentScore, context.Slide.MaxScore));

WebViewPage.WriteLiteralTo(@__razor_helper_writer, "</span>\r\n\t\t</h1>\r\n");


 		foreach (var block in context.Slide.Blocks)
		{
			
WebViewPage.WriteTo(@__razor_helper_writer, Block((dynamic)block, context));

                                  
		}

WebViewPage.WriteLiteralTo(@__razor_helper_writer, "\t</div>\r\n");



});

}
Пример #2
0
public static System.Web.WebPages.HelperResult Block(AbstractQuestionBlock block, BlockRenderContext context)
{
return new System.Web.WebPages.HelperResult(__razor_helper_writer => {


 
	var mark = "";
	var style = "";
	QuizBlockData model = context.GetBlockData(block);
	if (model.QuizState != QuizState.NotPassed)
	{
		if (model.QuizModel != null && model.QuizModel.ResultsForQuizes != null)
		{
			bool res;
			res = model.QuizModel.ResultsForQuizes.TryGetValue(block.Id, out res) && res;
			mark = "glyphicon " + (res ? "glyphicon-ok" : "glyphicon-remove");
			style = "color: " + (res ? "green" : "red");
		}
	}

WebViewPage.WriteLiteralTo(@__razor_helper_writer, "\t<h4><i class=\"");


WebViewPage.WriteTo(@__razor_helper_writer, mark);

WebViewPage.WriteLiteralTo(@__razor_helper_writer, "\" style=\"");


WebViewPage.WriteTo(@__razor_helper_writer, style);

WebViewPage.WriteLiteralTo(@__razor_helper_writer, "\"></i> ");


WebViewPage.WriteTo(@__razor_helper_writer, block.QuestionIndex);

WebViewPage.WriteLiteralTo(@__razor_helper_writer, ". ");


                     WebViewPage.WriteTo(@__razor_helper_writer, block.Text.RenderTex());

WebViewPage.WriteLiteralTo(@__razor_helper_writer, "</h4>\r\n");


	
WebViewPage.WriteTo(@__razor_helper_writer, QuizBlock((dynamic)block, context));

                                    

WebViewPage.WriteLiteralTo(@__razor_helper_writer, "\t<hr class=\"quiz-block-delimiter\"/>\r\n");



});

}
Пример #3
0
public static System.Web.WebPages.HelperResult Blocks(BlockRenderContext context, HtmlHelper Html)
{
return new System.Web.WebPages.HelperResult(__razor_helper_writer => {


 
	foreach (var blockRange in context.Slide.GetBlocksRangesWithSameVisibility())
	{
		if (!blockRange[0].Hide)
		{
			foreach (var block in blockRange)
			{
				
WebViewPage.WriteTo(@__razor_helper_writer, Block((dynamic)block, context, Html));

                                         
			}
		}
		else if (context.RevealHidden)
		{

WebViewPage.WriteLiteralTo(@__razor_helper_writer, "\t\t\t<div class=\"revealed\" data-toggle=\"tooltip\" data-placement=\"left\" title=\"Этот " +
"блок студенты не видят\">\r\n");


 				foreach (var block in blockRange)
				{
					
WebViewPage.WriteTo(@__razor_helper_writer, Block((dynamic)block, context, Html));

                                          
				}

WebViewPage.WriteLiteralTo(@__razor_helper_writer, "\t\t\t</div>\r\n");


		}
	}

});

}
Пример #4
0
public static System.Web.WebPages.HelperResult Block(ExerciseBlock block, BlockRenderContext context)
{
return new System.Web.WebPages.HelperResult(__razor_helper_writer => {


 
	ExerciseBlockData data = context.GetBlockData(block) ?? new ExerciseBlockData();
	var action = data.CanSkip ? "$('#ShowSolutionsAlert').modal('show')" : string.Format("window.location='{0}'", data.AcceptedSolutionUrl);

WebViewPage.WriteLiteralTo(@__razor_helper_writer, "\t<textarea id=\"secretCodeExercise\" class=\"hide\">");


     WebViewPage.WriteTo(@__razor_helper_writer, block.ExerciseInitialCode.EnsureEnoughLines(4));

WebViewPage.WriteLiteralTo(@__razor_helper_writer, "</textarea>\r\n");



WebViewPage.WriteLiteralTo(@__razor_helper_writer, "\t<textarea class=\"code code-exercise\" data-lang=\"");


      WebViewPage.WriteTo(@__razor_helper_writer, block.LangId);

WebViewPage.WriteLiteralTo(@__razor_helper_writer, "\">");


                      WebViewPage.WriteTo(@__razor_helper_writer, data.LatestAcceptedSolution ?? block.ExerciseInitialCode.EnsureEnoughLines(4));

WebViewPage.WriteLiteralTo(@__razor_helper_writer, "</textarea>\r\n");



WebViewPage.WriteLiteralTo(@__razor_helper_writer, "\t<script>\r\n\t\tfunction cleanUserCode() {\r\n\t\t\tvar $secretCodeExercise = $(\'#secretC" +
"odeExercise\');\r\n\t\t\t$(\'.code-exercise\')[0].codeMirrorEditor.setValue($secretCodeE" +
"xercise.text());\r\n\t\t}\r\n\t</script>\r\n");


	if (data.ShowControls)
	{

WebViewPage.WriteLiteralTo(@__razor_helper_writer, "\t\t<div class=\"solution-control btn-group ctrl-group\">\r\n\t\t\t<button type=\"button\" c" +
"lass=\"run-solution-button btn btn-primary no-rounds ");


                                    WebViewPage.WriteTo(@__razor_helper_writer, data.IsLti ? "run-solution-button-lti" : "");

WebViewPage.WriteLiteralTo(@__razor_helper_writer, "\" data-url=\"");


                                                                                             WebViewPage.WriteTo(@__razor_helper_writer, data.RunSolutionUrl);

WebViewPage.WriteLiteralTo(@__razor_helper_writer, "\">\r\n\t\t\t\tRun\r\n\t\t\t</button>\r\n\r\n");


 			if (!data.DebugView)
			{
				var e = ((ExerciseSlide)context.Slide).Exercise.HintsMd;

WebViewPage.WriteLiteralTo(@__razor_helper_writer, "\t\t\t\t<button id=\"GetHintButton\" type=\"button\" class=\"btn btn-default hints-btn\"\r\n\t" +
"\t\t\t        data-course-id=\"");


WebViewPage.WriteTo(@__razor_helper_writer, context.Course.Id);

WebViewPage.WriteLiteralTo(@__razor_helper_writer, "\" data-slide-index=\"");


                       WebViewPage.WriteTo(@__razor_helper_writer, context.Slide.Index);

WebViewPage.WriteLiteralTo(@__razor_helper_writer, "\" data-hints-count=\"");


                                                               WebViewPage.WriteTo(@__razor_helper_writer, e.Count);

WebViewPage.WriteLiteralTo(@__razor_helper_writer, "\"\r\n\t\t\t\t        data-url=\"");


WebViewPage.WriteTo(@__razor_helper_writer, data.GetHintUrl);

WebViewPage.WriteLiteralTo(@__razor_helper_writer, "\">\r\n\t\t\t\t\tGet hint\r\n\t\t\t\t</button>\r\n");


				if (!data.IsLti)
				{

WebViewPage.WriteLiteralTo(@__razor_helper_writer, "\t\t\t\t\t<button type=\"button\" class=\"btn btn-default giveup-btn\" onclick=\"");


                            WebViewPage.WriteTo(@__razor_helper_writer, action);

WebViewPage.WriteLiteralTo(@__razor_helper_writer, "\">\r\n\t\t\t\t\t\tShow solutions\r\n\t\t\t\t\t</button>\r\n");


				}

WebViewPage.WriteLiteralTo(@__razor_helper_writer, "\t\t\t\t<button type=\"button\" class=\"btn btn-default reset-btn no-rounds\" onclick=\" c" +
"leanUserCode() \">\r\n\t\t\t\t\tReset\r\n\t\t\t\t</button>\r\n");


			}

WebViewPage.WriteLiteralTo(@__razor_helper_writer, "\t\t</div>\r\n");



		
WebViewPage.WriteTo(@__razor_helper_writer, RunErrors());

              


WebViewPage.WriteLiteralTo(@__razor_helper_writer, "\t\t<div class=\"panel-group ctrl-group\" id=\"hints-accordion\">\r\n\t\t\t<div id=\"hints-pl" +
"ace\"></div>\r\n\t\t</div>\r\n");


		if (!data.IsLti)
		{
			
WebViewPage.WriteTo(@__razor_helper_writer, YouWillLoseScoresDialog(data));

                                 
		}
	}
	if (data.DebugView)
	{

WebViewPage.WriteLiteralTo(@__razor_helper_writer, "\t\t<div>\r\n\t\t\t<h3>Подсказки</h3>\r\n\t\t\t<ol>\r\n");


 				foreach (var hint in block.HintsMd)
				{

WebViewPage.WriteLiteralTo(@__razor_helper_writer, "\t\t\t\t\t<li>\r\n\t\t\t\t\t\t");


WebViewPage.WriteTo(@__razor_helper_writer, MvcHtmlString.Create(hint.RenderMd(context.BaseUrl)));

WebViewPage.WriteLiteralTo(@__razor_helper_writer, "\r\n\t\t\t\t\t</li>\r\n");


				}

WebViewPage.WriteLiteralTo(@__razor_helper_writer, "\t\t\t</ol>\r\n\t\t</div>\r\n");


	}

});

}
Пример #5
0
public static System.Web.WebPages.HelperResult Block(ImageGaleryBlock block, BlockRenderContext context)
{
return new System.Web.WebPages.HelperResult(__razor_helper_writer => {


 

WebViewPage.WriteLiteralTo(@__razor_helper_writer, "\t<div class=\"flexslider\">\r\n\t\t<ul class=\"slides\">\r\n");


 			foreach (var imageUrl in block.ImageUrls)
			{

WebViewPage.WriteLiteralTo(@__razor_helper_writer, "\t\t\t\t<li>\r\n\t\t\t\t\t<img src=\"");


WebViewPage.WriteTo(@__razor_helper_writer, string.Format("{0}/{1}", context.BaseUrl, imageUrl));

WebViewPage.WriteLiteralTo(@__razor_helper_writer, "\" alt=\"");


                               WebViewPage.WriteTo(@__razor_helper_writer, imageUrl);

WebViewPage.WriteLiteralTo(@__razor_helper_writer, "\"/>\r\n\t\t\t\t</li>\r\n");


			}

WebViewPage.WriteLiteralTo(@__razor_helper_writer, "\t\t</ul>\r\n\t</div>\r\n");



});

}
Пример #6
0
public static System.Web.WebPages.HelperResult Block(YoutubeBlock block, BlockRenderContext context)
{
return new System.Web.WebPages.HelperResult(__razor_helper_writer => {


 

WebViewPage.WriteLiteralTo(@__razor_helper_writer, "\t<div class=\"video-container\">\r\n\t\t<iframe class=\"embedded-video\" width=\"864\" heig" +
"ht=\"480\" src=\"https://www.youtube.com/embed/");


                                                  WebViewPage.WriteTo(@__razor_helper_writer, block.VideoId);

WebViewPage.WriteLiteralTo(@__razor_helper_writer, "\" allowfullscreen></iframe>\r\n\t</div>\r\n");



WebViewPage.WriteLiteralTo(@__razor_helper_writer, @"	<div>
		<a href=""javascript://"" class=""popover-trigger""
		   title=""Как ускорить видео?""
		   data-content=""Если по иконке с шестеренкой нет возможности ускорить видео, то вам нужно &lt;a target='blank' href='http://youtube.com/html5'>вручную включить&lt;/a> использование HTML5-плеера."">
			Как ускорить видео?
		</a>
	</div>
");



});

}
Пример #7
0
public static System.Web.WebPages.HelperResult Block(TexBlock block, BlockRenderContext context)
{
return new System.Web.WebPages.HelperResult(__razor_helper_writer => {


 
	foreach (var texLine in block.TexLines)
	{

WebViewPage.WriteLiteralTo(@__razor_helper_writer, "\t\t<div class=\"tex\">\\displaystyle ");


WebViewPage.WriteTo(@__razor_helper_writer, texLine.Trim());

WebViewPage.WriteLiteralTo(@__razor_helper_writer, "</div>\r\n");


	}

});

}
Пример #8
0
public static System.Web.WebPages.HelperResult QuizBlock(OrderingBlock block, BlockRenderContext context)
{
return new System.Web.WebPages.HelperResult(__razor_helper_writer => {


 
	var items = block.ShuffledItems();
	var correctItems = block.Items;
	QuizBlockData model = context.GetBlockData(block) ?? new QuizBlockData(new QuizModel(), 1, QuizState.NotPassed);
	if (model.QuizState != QuizState.NotPassed && model.QuizModel.AnswersToQuizes[block.Id].FirstOrDefault() != null)
	{
		var userAnswers = model.QuizModel.AnswersToQuizes[block.Id].Select(x => x.ItemId).ToList();
		items = items.OrderBy(item => userAnswers.IndexOf(item.GetHash())).ToArray();
	}

WebViewPage.WriteLiteralTo(@__razor_helper_writer, "\t<div class=\"quiz-block-ordering ");


WebViewPage.WriteTo(@__razor_helper_writer, context.CanUserFillQuiz ? "" : "not-movable");

WebViewPage.WriteLiteralTo(@__razor_helper_writer, "\" id=\'");


                                            WebViewPage.WriteTo(@__razor_helper_writer, block.Id + "_quizBlock");

WebViewPage.WriteLiteralTo(@__razor_helper_writer, "\'>\r\n");


 		if (model.QuizState == QuizState.Total && model.ShowCorrectAnswer)
		{

WebViewPage.WriteLiteralTo(@__razor_helper_writer, "\t\t\t<div class=\"quiz-block-ordering__correct-description row\">\r\n\t\t\t\t<div class=\"te" +
"xt-success col-sm-5 col-sm-offset-6\">Правильный ответ</div>\r\n\t\t\t</div>\r\n");


		}

WebViewPage.WriteLiteralTo(@__razor_helper_writer, "\t\t<ul>\r\n");


 			for (var itemIndex = 0; itemIndex < items.Length; itemIndex++)
			{
				var item = items[itemIndex];

WebViewPage.WriteLiteralTo(@__razor_helper_writer, "\t\t\t\t<li class=\"row\">\r\n\t\t\t\t\t<div class=\"quiz quiz-block-ordering__item col-xs-12 c" +
"ol-sm-5\" data-item-id=\"");


                                       WebViewPage.WriteTo(@__razor_helper_writer, item.GetHash());

WebViewPage.WriteLiteralTo(@__razor_helper_writer, "\">\r\n");


 						if (context.CanUserFillQuiz)
						{

WebViewPage.WriteLiteralTo(@__razor_helper_writer, "\t\t\t\t\t\t\t<div class=\"quiz-block-ordering__item__icons\">\r\n\t\t\t\t\t\t\t\t<span class=\"glyph" +
"icon glyphicon-arrow-up\"></span>\r\n\t\t\t\t\t\t\t\t<span class=\"glyphicon glyphicon-arrow" +
"-down\"></span>\r\n\t\t\t\t\t\t\t</div>\r\n");


						}

WebViewPage.WriteLiteralTo(@__razor_helper_writer, "\t\t\t\t\t\t<input autocomplete=\"off\" id=\'");


WebViewPage.WriteTo(@__razor_helper_writer, block.Id + "quizBlock" + item.GetHash());

WebViewPage.WriteLiteralTo(@__razor_helper_writer, "\' type=\"hidden\">\r\n\t\t\t\t\t\t<div class=\"text\">");


WebViewPage.WriteTo(@__razor_helper_writer, item.Text.RenderTex());

WebViewPage.WriteLiteralTo(@__razor_helper_writer, "</div>\r\n\t\t\t\t\t</div>\r\n");


 					if (model.QuizState == QuizState.Total && model.ShowCorrectAnswer)
					{
						var correctItem = correctItems[itemIndex];

WebViewPage.WriteLiteralTo(@__razor_helper_writer, "\t\t\t\t\t\t<div class=\"quiz-block-ordering__item correct col-xs-12 col-sm-offset-1 col" +
"-sm-5\">\r\n\t\t\t\t\t\t\t");


WebViewPage.WriteTo(@__razor_helper_writer, correctItem.Text.RenderTex());

WebViewPage.WriteLiteralTo(@__razor_helper_writer, "\r\n\t\t\t\t\t\t</div>\r\n");


					}

WebViewPage.WriteLiteralTo(@__razor_helper_writer, "\t\t\t\t</li>\r\n");


			}

WebViewPage.WriteLiteralTo(@__razor_helper_writer, "\t\t</ul>\r\n\t</div>\r\n");


	if (model.QuizState == QuizState.Total && !string.IsNullOrEmpty(block.Explanation))
	{

WebViewPage.WriteLiteralTo(@__razor_helper_writer, "\t\t<div class=\"text-muted\">");


WebViewPage.WriteTo(@__razor_helper_writer, block.Explanation);

WebViewPage.WriteLiteralTo(@__razor_helper_writer, "</div>\r\n");


	}

});

}
Пример #9
0
public static System.Web.WebPages.HelperResult QuizBlock(IsTrueBlock block, BlockRenderContext context)
{
return new System.Web.WebPages.HelperResult(__razor_helper_writer => {


 
	var tchecked = "";
	var fchecked = "";
	var trueItemClass = "";
	var falseItemClass = "";
	var ttitle = "";
	var ftitle = "";
	QuizBlockData model = context.GetBlockData(block) ?? new QuizBlockData(new QuizModel(), 1, QuizState.NotPassed);
	if (model.QuizState != QuizState.NotPassed && model.QuizModel.AnswersToQuizes[block.Id].FirstOrDefault() != null)
	{
		var userAnswer = model.QuizModel.AnswersToQuizes[block.Id].FirstOrDefault() == "True";
		tchecked = userAnswer ? "checked" : "";
		fchecked = userAnswer ? "" : "checked";
		if (model.QuizState == QuizState.Total)
		{
			trueItemClass = block.Answer ? "right-quiz" : userAnswer ? "wrong-quiz" : "";
			falseItemClass = !block.Answer ? "right-quiz" : !userAnswer ? "wrong-quiz" : "";
		}
	}
	if (model.QuizState == QuizState.Total)
	{
		ttitle = (block.Answer ? "Правильный" : "Неправильный") + " вариант";
		ftitle = (!block.Answer ? "Правильный" : "Неправильный") + " вариант";
	}

WebViewPage.WriteLiteralTo(@__razor_helper_writer, "\t<div class=\"radio quiz-block-mark\" id=\"");


WebViewPage.WriteTo(@__razor_helper_writer, block.Id + "_quizBlock");

WebViewPage.WriteLiteralTo(@__razor_helper_writer, "\">\r\n\t\t<div class=\"quiz\">\r\n\t\t\t<label class=\"");


WebViewPage.WriteTo(@__razor_helper_writer, trueItemClass);

WebViewPage.WriteLiteralTo(@__razor_helper_writer, "\" title=\"");


WebViewPage.WriteTo(@__razor_helper_writer, ttitle);

WebViewPage.WriteLiteralTo(@__razor_helper_writer, "\"><input autocomplete=\"off\" ");


                                WebViewPage.WriteTo(@__razor_helper_writer, tchecked);

WebViewPage.WriteLiteralTo(@__razor_helper_writer, " id=\'");


                                               WebViewPage.WriteTo(@__razor_helper_writer, block.Id + "quizBlock" + "True");

WebViewPage.WriteLiteralTo(@__razor_helper_writer, "\' name=\'");


                                                                                         WebViewPage.WriteTo(@__razor_helper_writer, block.Id + "group");

WebViewPage.WriteLiteralTo(@__razor_helper_writer, "\' type=\"radio\">Верно</label>\r\n");


 			if (model.QuizState == QuizState.Total && block.Answer)
			{

WebViewPage.WriteLiteralTo(@__razor_helper_writer, "\t\t\t\t<i class=\"glyphicon glyphicon-ok\" style=\"color: green\" title=\"");


                       WebViewPage.WriteTo(@__razor_helper_writer, ttitle);

WebViewPage.WriteLiteralTo(@__razor_helper_writer, "\"></i>\r\n");


			}

WebViewPage.WriteLiteralTo(@__razor_helper_writer, "\t\t</div>\r\n\t\t<div class=\"quiz\">\r\n\t\t\t<label class=\"");


WebViewPage.WriteTo(@__razor_helper_writer, falseItemClass);

WebViewPage.WriteLiteralTo(@__razor_helper_writer, "\" title=\"");


WebViewPage.WriteTo(@__razor_helper_writer, ftitle);

WebViewPage.WriteLiteralTo(@__razor_helper_writer, "\"><input autocomplete=\"off\" ");


                                 WebViewPage.WriteTo(@__razor_helper_writer, fchecked);

WebViewPage.WriteLiteralTo(@__razor_helper_writer, " id=\'");


                                                WebViewPage.WriteTo(@__razor_helper_writer, block.Id + "quizBlock" + "False");

WebViewPage.WriteLiteralTo(@__razor_helper_writer, "\' name=\'");


                                                                                           WebViewPage.WriteTo(@__razor_helper_writer, block.Id + "group");

WebViewPage.WriteLiteralTo(@__razor_helper_writer, "\' type=\"radio\">Неверно</label>\r\n");


 			if (model.QuizState == QuizState.Total && !block.Answer)
			{

WebViewPage.WriteLiteralTo(@__razor_helper_writer, "\t\t\t\t<i class=\"glyphicon glyphicon-ok\" style=\"color: green\" title=\"");


                       WebViewPage.WriteTo(@__razor_helper_writer, ftitle);

WebViewPage.WriteLiteralTo(@__razor_helper_writer, "\"></i>\r\n");


			}

WebViewPage.WriteLiteralTo(@__razor_helper_writer, "\t\t</div>\r\n\t</div>\r\n");


	if (model.QuizState == QuizState.Total && !string.IsNullOrEmpty(block.Explanation))
	{

WebViewPage.WriteLiteralTo(@__razor_helper_writer, "\t\t<div class=\"text-muted\">");


WebViewPage.WriteTo(@__razor_helper_writer, block.Explanation);

WebViewPage.WriteLiteralTo(@__razor_helper_writer, "</div>\r\n");


	}

});

}
Пример #10
0
public static System.Web.WebPages.HelperResult Slide(BlockRenderContext context, int currentScore = 0)
{
return new System.Web.WebPages.HelperResult(__razor_helper_writer => {


 

WebViewPage.WriteLiteralTo(@__razor_helper_writer, "\t<div class=\"slide\">\r\n\t\t<h1>\r\n\t\t\t");


WebViewPage.WriteTo(@__razor_helper_writer, context.Slide.Title);

WebViewPage.WriteLiteralTo(@__razor_helper_writer, "\r\n\t\t\t<span class=\"score\">");


WebViewPage.WriteTo(@__razor_helper_writer, Score(currentScore, context.Slide.MaxScore));

WebViewPage.WriteLiteralTo(@__razor_helper_writer, "</span>\r\n\t\t</h1>\r\n");


 		foreach (var block in context.Slide.Blocks)
		{
			var questionBlock = block as AbstractQuestionBlock;
			if (questionBlock != null)
			{

WebViewPage.WriteLiteralTo(@__razor_helper_writer, "\t\t\t\t<h4><i class=\"glyphicon\"></i> ");


WebViewPage.WriteTo(@__razor_helper_writer, questionBlock.QuestionIndex);

WebViewPage.WriteLiteralTo(@__razor_helper_writer, ". ");


                     WebViewPage.WriteTo(@__razor_helper_writer, questionBlock.Text.RenderTex());

WebViewPage.WriteLiteralTo(@__razor_helper_writer, "</h4>\r\n");


			}

			
WebViewPage.WriteTo(@__razor_helper_writer, Block((dynamic)block, context));

                                  

			if (questionBlock != null)
			{

WebViewPage.WriteLiteralTo(@__razor_helper_writer, "\t\t\t\t<hr class=\"quiz-block-delimiter\"/>\r\n");


			}
		}

WebViewPage.WriteLiteralTo(@__razor_helper_writer, "\t</div>\r\n");



});

}
Пример #11
0
public static System.Web.WebPages.HelperResult QuizBlock(FillInBlock block, BlockRenderContext context)
{
return new System.Web.WebPages.HelperResult(__razor_helper_writer => {


 
	var value = "";
	var quizRes = "";
	QuizBlockData model = context.GetBlockData(block) ?? new QuizBlockData(new QuizModel(), 1, QuizState.NotPassed);
	if (model.QuizState != QuizState.NotPassed && model.QuizModel.AnswersToQuizes[block.Id].FirstOrDefault() != null)
	{
		var answers = model.QuizModel.AnswersToQuizes[block.Id];
		var userAnswer = answers.FirstOrDefault();
		value = userAnswer.Text;
		quizRes = model.QuizState == QuizState.Total
			? (userAnswer.IsRightAnswer ? "right-quiz" : "wrong-quiz") : "";
	}
	var sample = block.Sample;
	var readonlyAttr = context.CanUserFillQuiz ? "" : "readonly";

WebViewPage.WriteLiteralTo(@__razor_helper_writer, "\t<div class=\"quiz quiz-block-input\">\r\n\t\t<label ");


WebViewPage.WriteTo(@__razor_helper_writer, GetGuestOnclick(context.IsGuest));

WebViewPage.WriteLiteralTo(@__razor_helper_writer, ">\r\n");


 			if (block.Multiline)
			{

WebViewPage.WriteLiteralTo(@__razor_helper_writer, " \t\t\t\t<textarea class=\"form-control ");


WebViewPage.WriteTo(@__razor_helper_writer, quizRes);

WebViewPage.WriteLiteralTo(@__razor_helper_writer, "\" id=\'");


       WebViewPage.WriteTo(@__razor_helper_writer, block.Id + "quizBlock");

WebViewPage.WriteLiteralTo(@__razor_helper_writer, "\' maxlength=\"");


                                            WebViewPage.WriteTo(@__razor_helper_writer, QuizController.MAX_FILLINBLOCK_SIZE);

WebViewPage.WriteLiteralTo(@__razor_helper_writer, "\" ");


                                                                                  WebViewPage.WriteTo(@__razor_helper_writer, GetGuestDisable(context.IsGuest));

WebViewPage.WriteLiteralTo(@__razor_helper_writer, " ");


                                                                                                                    WebViewPage.WriteTo(@__razor_helper_writer, readonlyAttr);

WebViewPage.WriteLiteralTo(@__razor_helper_writer, " cols=\"70\" rows=\"5\">");


                                                                                                                                                     WebViewPage.WriteTo(@__razor_helper_writer, value);

WebViewPage.WriteLiteralTo(@__razor_helper_writer, "</textarea>\r\n");


			}
			else
			{

WebViewPage.WriteLiteralTo(@__razor_helper_writer, "\t\t\t\t<input\r\n\t\t\t\t\tautocomplete=\"off\"\r\n\t\t\t\t\tclass=\"form-control ");


WebViewPage.WriteTo(@__razor_helper_writer, quizRes);

WebViewPage.WriteLiteralTo(@__razor_helper_writer, "\"\r\n\t\t\t\t\tvalue=\"");


WebViewPage.WriteTo(@__razor_helper_writer, value);

WebViewPage.WriteLiteralTo(@__razor_helper_writer, "\" id=\'");


WebViewPage.WriteTo(@__razor_helper_writer, block.Id + "quizBlock");

WebViewPage.WriteLiteralTo(@__razor_helper_writer, "\'\r\n\t\t\t\t\tmaxlength=\"");


WebViewPage.WriteTo(@__razor_helper_writer, QuizController.MAX_FILLINBLOCK_SIZE);

WebViewPage.WriteLiteralTo(@__razor_helper_writer, "\"\r\n\t\t\t\t\tsize=\"68\"\r\n\t\t\t\t\t");


WebViewPage.WriteTo(@__razor_helper_writer, GetGuestDisable(context.IsGuest));

WebViewPage.WriteLiteralTo(@__razor_helper_writer, "\r\n\t\t\t\t\t");


WebViewPage.WriteTo(@__razor_helper_writer, readonlyAttr);

WebViewPage.WriteLiteralTo(@__razor_helper_writer, "/>\r\n");


			}

WebViewPage.WriteLiteralTo(@__razor_helper_writer, "\t\t</label>\r\n\t</div>\r\n");


	if (model.QuizState == QuizState.Total)
	{
		if (model.ShowCorrectAnswer)
		{

WebViewPage.WriteLiteralTo(@__razor_helper_writer, "\t\t\t<div>Правильный ответ: ");


WebViewPage.WriteTo(@__razor_helper_writer, sample);

WebViewPage.WriteLiteralTo(@__razor_helper_writer, "</div>\r\n");


		}
		if (!string.IsNullOrEmpty(block.Explanation))
		{

WebViewPage.WriteLiteralTo(@__razor_helper_writer, "\t\t\t<div class=\"text-muted\">");


WebViewPage.WriteTo(@__razor_helper_writer, block.Explanation);

WebViewPage.WriteLiteralTo(@__razor_helper_writer, "</div>\r\n");


		}
	}

});

}
Пример #12
0
public static System.Web.WebPages.HelperResult Block(ExerciseBlock block, BlockRenderContext context, HtmlHelper Html)
{
return new System.Web.WebPages.HelperResult(__razor_helper_writer => {


 

WebViewPage.WriteLiteralTo(@__razor_helper_writer, "\t<div class=\"exercise\">\r\n");


  		
			ExerciseBlockData data = context.GetBlockData(block) ?? new ExerciseBlockData(context.Course.Id, context.Slide as ExerciseSlide) { IsGuest = context.IsGuest, IsLti = context.IsLti };
			var manualCheckingId = context.ManualChecking != null ? (int?)context.ManualChecking.Id : null;

			if (Html != null)
			{
				
WebViewPage.WriteTo(@__razor_helper_writer, Html.Action("Submission", "Exercise", new { courseId = context.Course.Id, slideId = context.Slide.Id, submissionId = context.VersionId, manualCheckingId = manualCheckingId, isLti = data.IsLti, instructorView = manualCheckingId != null }));

                                                                                                                                                                                                                                                  
			}
			else
			{

WebViewPage.WriteLiteralTo(@__razor_helper_writer, "\t\t\t\t<div class=\"exercise__submission\">\r\n\t\t\t\t\t<textarea class=\"code code-exercise " +
"hidden\" data-lang=\"");


                 WebViewPage.WriteTo(@__razor_helper_writer, block.LangId);

WebViewPage.WriteLiteralTo(@__razor_helper_writer, "\">");


                                 WebViewPage.WriteTo(@__razor_helper_writer, block.ExerciseInitialCode.EnsureEnoughLines(4));

WebViewPage.WriteLiteralTo(@__razor_helper_writer, "</textarea>\r\n\t\t\t\t\t<div class=\"loading-spinner\">\r\n\t\t\t\t\t\t<img src=\"/Content/loading" +
".gif\" />\r\n\t\t\t\t\t</div>\r\n\t\t\t\t\t");


WebViewPage.WriteTo(@__razor_helper_writer, ExerciseControls(new ExerciseControlsModel(context.Course.Id, (ExerciseSlide)context.Slide)
				   {
					   IsCodeEditableAndSendable = true,
					   DebugView = data.DebugView,
					   RunSolutionUrl = data.RunSolutionUrl,
				   }));

WebViewPage.WriteLiteralTo(@__razor_helper_writer, "\r\n\r\n\t\t\t\t\t");


WebViewPage.WriteTo(@__razor_helper_writer, RunErrors());

WebViewPage.WriteLiteralTo(@__razor_helper_writer, "\r\n\t\t\t</div>\r\n");


			}
		

WebViewPage.WriteLiteralTo(@__razor_helper_writer, "\t\t\r\n\r\n");


 		if (data.DebugView)
		{

WebViewPage.WriteLiteralTo(@__razor_helper_writer, "\t\t\t<div>\r\n\t\t\t\t<h3>Подсказки</h3>\r\n\t\t\t\t<ol>\r\n");


 					foreach (var hint in data.Block.HintsMd)
					{

WebViewPage.WriteLiteralTo(@__razor_helper_writer, "\t\t\t\t\t\t<li>\r\n\t\t\t\t\t\t\t");


WebViewPage.WriteTo(@__razor_helper_writer, MvcHtmlString.Create(hint.RenderMd(context.BaseUrl)));

WebViewPage.WriteLiteralTo(@__razor_helper_writer, "\r\n\t\t\t\t\t\t</li>\r\n");


					}

WebViewPage.WriteLiteralTo(@__razor_helper_writer, "\t\t\t\t</ol>\r\n\t\t\t\t<h3>Комментарий после решения</h3>\r\n\t\t\t\t<p>");


WebViewPage.WriteTo(@__razor_helper_writer, data.Block.CommentAfterExerciseIsSolved);

WebViewPage.WriteLiteralTo(@__razor_helper_writer, "</p>\r\n\t\t\t</div>\r\n");


		}

WebViewPage.WriteLiteralTo(@__razor_helper_writer, "\r\n");


 		if (context.ManualChecking != null)
		{
			var checking = (ManualExerciseChecking)context.ManualChecking;

			
WebViewPage.WriteTo(@__razor_helper_writer, Html.Partial("~/Views/Exercise/_ExerciseScoreForm.cshtml", new ExerciseScoreFormModel(context.Course.Id, (ExerciseSlide) context.Slide, checking, context.GroupId, context.VersionId == null || checking.Submission.Id == context.VersionId)));

                                                                                                                                                                                                                                                 
		}

WebViewPage.WriteLiteralTo(@__razor_helper_writer, "\t</div>\r\n");



});

}
Пример #13
0
public static System.Web.WebPages.HelperResult Block(YoutubeBlock block, BlockRenderContext context, HtmlHelper Html)
{
return new System.Web.WebPages.HelperResult(__razor_helper_writer => {


 

WebViewPage.WriteLiteralTo(@__razor_helper_writer, "\t<div class=\"video-container\">\r\n\t\t<iframe class=\"embedded-video\" width=\"864\" heig" +
"ht=\"480\" src=\"https://www.youtube.com/embed/");


                                                  WebViewPage.WriteTo(@__razor_helper_writer, block.VideoId);

WebViewPage.WriteLiteralTo(@__razor_helper_writer, "\" frameborder=\"0\" allowfullscreen></iframe>\r\n\t</div>\r\n");



WebViewPage.WriteLiteralTo(@__razor_helper_writer, @"	<div>
		<a href=""javascript://"" class=""popover-trigger pull-right""
		   title=""Как ускорить видео?""
		   data-content=""Выберите скорость в иконке с шестеренкой или используйте горячие клавиши Shift+> и Shift+<""
		   data-placement=""bottom"">
			<span class=""glyphicon glyphicon-question-sign""></span>
			Ускорить видео?
		</a>
	</div>
");



});

}
Пример #14
0
public static System.Web.WebPages.HelperResult Block(AbstractQuestionBlock block, BlockRenderContext context, HtmlHelper Html)
{
return new System.Web.WebPages.HelperResult(__razor_helper_writer => {


 
	var mark = "";
	var style = "";
	var blockScore = -1;
	QuizBlockData model = context.GetBlockData(block);
	if (model.QuizState != QuizState.NotPassed && model.QuizState != QuizState.WaitForCheck && model.QuizState != QuizState.IsChecking)
	{
		if (model.QuizModel != null && model.QuizModel.ResultsForQuizes != null)
		{
			var res = model.QuizModel.ResultsForQuizes.TryGetValue(block.Id, out blockScore) && blockScore == block.MaxScore;
			mark = "glyphicon " + (res ? "glyphicon-ok" : "glyphicon-remove");
			style = "color: " + (res ? "green" : "red");
		}
	}

WebViewPage.WriteLiteralTo(@__razor_helper_writer, "\t<h4>\r\n\t\t<i class=\"");


WebViewPage.WriteTo(@__razor_helper_writer, mark);

WebViewPage.WriteLiteralTo(@__razor_helper_writer, "\" style=\"");


WebViewPage.WriteTo(@__razor_helper_writer, style);

WebViewPage.WriteLiteralTo(@__razor_helper_writer, "\"></i> ");


WebViewPage.WriteTo(@__razor_helper_writer, block.QuestionIndex);

WebViewPage.WriteLiteralTo(@__razor_helper_writer, ". ");


                  WebViewPage.WriteTo(@__razor_helper_writer, block.Text.RenderTex());

WebViewPage.WriteLiteralTo(@__razor_helper_writer, "\r\n\t\t<sup class=\"text-muted\">\r\n");


 			if (blockScore >= 0)
			{

WebViewPage.WriteLiteralTo(@__razor_helper_writer, "\t\t\t\t<span>\r\n\t\t\t\t\t");


WebViewPage.WriteTo(@__razor_helper_writer, blockScore);

WebViewPage.WriteLiteralTo(@__razor_helper_writer, " из ");


WebViewPage.WriteTo(@__razor_helper_writer, block.MaxScore);

WebViewPage.WriteLiteralTo(@__razor_helper_writer, " балл");


WebViewPage.WriteTo(@__razor_helper_writer, block.MaxScore == 1 ? "а" : "ов");

WebViewPage.WriteLiteralTo(@__razor_helper_writer, "\r\n\t\t\t\t</span>\r\n");


			}
			else
			{
				
WebViewPage.WriteTo(@__razor_helper_writer, block.MaxScore.PluralizeInRussian(new RussianPluralizationOptions
					{
						One = "балл",
						Two = "балла",
						Five = "баллов",
						smallNumbersAreWords = false,
						hideNumberOne = false
					}
				));

     
			}

WebViewPage.WriteLiteralTo(@__razor_helper_writer, "\t\t</sup>\r\n\t</h4>\r\n");



	
WebViewPage.WriteTo(@__razor_helper_writer, QuizBlock((dynamic)block, context));

                                    
	if (context.ManualChecking != null)
	{

WebViewPage.WriteLiteralTo(@__razor_helper_writer, "\t\t<h4>Оцените от 0 до ");


WebViewPage.WriteTo(@__razor_helper_writer, block.MaxScore);

WebViewPage.WriteLiteralTo(@__razor_helper_writer, "</h4>\r\n");



WebViewPage.WriteLiteralTo(@__razor_helper_writer, "\t\t<div>\r\n\t\t\t<input type=\"number\" class=\"form-control\" min=\"0\" max=\"");


               WebViewPage.WriteTo(@__razor_helper_writer, block.MaxScore);

WebViewPage.WriteLiteralTo(@__razor_helper_writer, "\" name=\"quiz__score__");


                                                    WebViewPage.WriteTo(@__razor_helper_writer, block.Id);

WebViewPage.WriteLiteralTo(@__razor_helper_writer, "\" />\r\n\t\t</div>\r\n");


	}


WebViewPage.WriteLiteralTo(@__razor_helper_writer, "\t<div class=\"quiz-block-delimiter\"></div>\r\n");



});

}
Пример #15
0
public static System.Web.WebPages.HelperResult QuizBlock(MatchingBlock block, BlockRenderContext context)
{
return new System.Web.WebPages.HelperResult(__razor_helper_writer => {


 
	var fixedItems = block.GetMatches(block.ShuffleFixed);
	var movableItems = block.GetMatches(true);

	QuizBlockData model = context.GetBlockData(block) ?? new QuizBlockData(new QuizModel(), 1, QuizState.NotPassed);
	if (model.QuizState != QuizState.NotPassed && model.QuizModel.AnswersToQuizes[block.Id].FirstOrDefault() != null)
	{
		var userAnswers = model.QuizModel.AnswersToQuizes[block.Id];
		fixedItems = block.GetMatches().OrderBy(item => userAnswers.FindIndex(answer => item.GetHashForFixedItem() == answer.ItemId)).ToList();
		movableItems = GetMovableItemsAccordingToUserAnswers(userAnswers, fixedItems);
	}

WebViewPage.WriteLiteralTo(@__razor_helper_writer, "\t<div class=\"quiz-block-matching ");


WebViewPage.WriteTo(@__razor_helper_writer, context.CanUserFillQuiz ? "" : "not-movable");

WebViewPage.WriteLiteralTo(@__razor_helper_writer, "\" id=\'");


                                            WebViewPage.WriteTo(@__razor_helper_writer, block.Id + "_quizBlock");

WebViewPage.WriteLiteralTo(@__razor_helper_writer, "\'>\r\n");


 		if (model.QuizState == QuizState.NotPassed)
		{

WebViewPage.WriteLiteralTo(@__razor_helper_writer, "\t\t\t<div class=\"quiz-block-matching__description text-muted\">Перетащите элементы и" +
"з правого столбца на свободные места</div>\r\n");


		}


 		if (model.QuizState == QuizState.Total)
		{

WebViewPage.WriteLiteralTo(@__razor_helper_writer, "\t\t\t<div class=\"quiz-block-matching__correct-description row\">\r\n\t\t\t\t<div class=\"te" +
"xt-muted col-sm-3 col-sm-offset-3\">Ваш вариант</div>\r\n");


 				if (model.ShowCorrectAnswer)
				{

WebViewPage.WriteLiteralTo(@__razor_helper_writer, "\t\t\t\t\t<div class=\"text-success col-sm-3 col-sm-offset-1\">Правильный вариант</div>\r" +
"\n");


				}

WebViewPage.WriteLiteralTo(@__razor_helper_writer, "\t\t\t</div>\r\n");


		}

WebViewPage.WriteLiteralTo(@__razor_helper_writer, "\t\t<ul>\r\n");


 			for (var itemIndex = 0; itemIndex < fixedItems.Count; itemIndex++)
			{
				var fixedItem = fixedItems[itemIndex];
				var movableItem = movableItems[itemIndex];
				var isRightClass = "";
				if (model.QuizState == QuizState.Total && model.ShowCorrectAnswer)
				{
					isRightClass = fixedItem.Id == movableItem.Id ? "right" : "wrong";
				}

WebViewPage.WriteLiteralTo(@__razor_helper_writer, "\t\t\t\t<li>\r\n\t\t\t\t\t<div class=\"quiz quiz-block-matching__item ");


     WebViewPage.WriteTo(@__razor_helper_writer, isRightClass);

WebViewPage.WriteLiteralTo(@__razor_helper_writer, " row\">\r\n\t\t\t\t\t\t<input autocomplete=\"off\" id=\'");


WebViewPage.WriteTo(@__razor_helper_writer, block.Id + "quizBlock" + fixedItem.GetHashForFixedItem());

WebViewPage.WriteLiteralTo(@__razor_helper_writer, "\' type=\"hidden\">\r\n\t\t\t\t\t\t<div class=\"quiz-block-matching__fixed-item col-xs-3\" dat" +
"a-item-id=\"");


                               WebViewPage.WriteTo(@__razor_helper_writer, fixedItem.GetHashForFixedItem());

WebViewPage.WriteLiteralTo(@__razor_helper_writer, "\">");


                                                                 WebViewPage.WriteTo(@__razor_helper_writer, fixedItem.FixedItem.RenderTex());

WebViewPage.WriteLiteralTo(@__razor_helper_writer, "</div>\r\n");


 						if (model.QuizState == QuizState.NotPassed)
						{

WebViewPage.WriteLiteralTo(@__razor_helper_writer, "\t\t\t\t\t\t\t<div class=\"quiz-block-matching__droppable col-xs-3\" data-block-id=\"");


                                WebViewPage.WriteTo(@__razor_helper_writer, block.Id);

WebViewPage.WriteLiteralTo(@__razor_helper_writer, "\" data-item-id=\"");


                                                         WebViewPage.WriteTo(@__razor_helper_writer, fixedItem.GetHashForFixedItem());

WebViewPage.WriteLiteralTo(@__razor_helper_writer, "\"></div>\r\n");



WebViewPage.WriteLiteralTo(@__razor_helper_writer, "\t\t\t\t\t\t\t<div class=\"quiz-block-matching__source__droppable col-xs-3 col-sm-offset-" +
"1 added\" data-block-id=\"");


                                                              WebViewPage.WriteTo(@__razor_helper_writer, block.Id);

WebViewPage.WriteLiteralTo(@__razor_helper_writer, "\" data-movable-item-id=\"");


                                                                                               WebViewPage.WriteTo(@__razor_helper_writer, movableItem.GetHashForMovableItem());

WebViewPage.WriteLiteralTo(@__razor_helper_writer, "\">\r\n\t\t\t\t\t\t\t\t<div class=\"quiz-block-matching__movable-item\" data-block-id=\"");


                           WebViewPage.WriteTo(@__razor_helper_writer, block.Id);

WebViewPage.WriteLiteralTo(@__razor_helper_writer, "\" data-item-id=\"");


                                                    WebViewPage.WriteTo(@__razor_helper_writer, movableItem.GetHashForMovableItem());

WebViewPage.WriteLiteralTo(@__razor_helper_writer, "\">");


                                                                                          WebViewPage.WriteTo(@__razor_helper_writer, movableItem.MovableItem.RenderTex());

WebViewPage.WriteLiteralTo(@__razor_helper_writer, "</div>\r\n\t\t\t\t\t\t\t</div>\r\n");


						}
						else
						{

WebViewPage.WriteLiteralTo(@__razor_helper_writer, "\t\t\t\t\t\t\t<div class=\"quiz-block-matching__droppable col-xs-3 added\" data-block-id=\"" +
"");


                                      WebViewPage.WriteTo(@__razor_helper_writer, block.Id);

WebViewPage.WriteLiteralTo(@__razor_helper_writer, "\" data-item-id=\"");


                                                               WebViewPage.WriteTo(@__razor_helper_writer, fixedItem.GetHashForFixedItem());

WebViewPage.WriteLiteralTo(@__razor_helper_writer, "\" data-movable-item-id=\"");


                                                                                                                       WebViewPage.WriteTo(@__razor_helper_writer, movableItem.GetHashForMovableItem());

WebViewPage.WriteLiteralTo(@__razor_helper_writer, "\">\r\n\t\t\t\t\t\t\t\t<div class=\"quiz-block-matching__movable-item\" data-block-id=\"");


                           WebViewPage.WriteTo(@__razor_helper_writer, block.Id);

WebViewPage.WriteLiteralTo(@__razor_helper_writer, "\" data-item-id=\"");


                                                    WebViewPage.WriteTo(@__razor_helper_writer, movableItem.GetHashForMovableItem());

WebViewPage.WriteLiteralTo(@__razor_helper_writer, "\">");


                                                                                          WebViewPage.WriteTo(@__razor_helper_writer, movableItem.MovableItem.RenderTex());

WebViewPage.WriteLiteralTo(@__razor_helper_writer, "</div>\r\n\t\t\t\t\t\t\t</div>\r\n");


							if (model.QuizState == QuizState.Total && model.ShowCorrectAnswer)
							{

WebViewPage.WriteLiteralTo(@__razor_helper_writer, "\t\t\t\t\t\t\t\t<div class=\"quiz-block-matching__fixed-item correct col-xs-3 col-sm-offse" +
"t-1\">\r\n\t\t\t\t\t\t\t\t\t");


WebViewPage.WriteTo(@__razor_helper_writer, fixedItem.MovableItem.RenderTex());

WebViewPage.WriteLiteralTo(@__razor_helper_writer, "\r\n\t\t\t\t\t\t\t\t</div>\r\n");


							}
							if (context.CanUserFillQuiz)
							{

WebViewPage.WriteLiteralTo(@__razor_helper_writer, "\t\t\t\t\t\t\t\t<div class=\"quiz-block-matching__source__droppable col-xs-3 col-sm-offset" +
"-1\" data-block-id=\"");


                                                         WebViewPage.WriteTo(@__razor_helper_writer, block.Id);

WebViewPage.WriteLiteralTo(@__razor_helper_writer, "\">\r\n\t\t\t\t\t\t\t\t</div>\r\n");


							}
						}

WebViewPage.WriteLiteralTo(@__razor_helper_writer, "\t\t\t\t\t\t\r\n\t\t\t\t\t</div>\r\n\t\t\t\t</li>\r\n");


			}

WebViewPage.WriteLiteralTo(@__razor_helper_writer, "\t\t</ul>\r\n\t</div>\r\n");


	if (model.QuizState == QuizState.Total && !string.IsNullOrEmpty(block.Explanation))
	{

WebViewPage.WriteLiteralTo(@__razor_helper_writer, "\t\t<div class=\"text-muted\">");


WebViewPage.WriteTo(@__razor_helper_writer, block.Explanation);

WebViewPage.WriteLiteralTo(@__razor_helper_writer, "</div>\r\n");


	}

});

}
Пример #16
0
public static System.Web.WebPages.HelperResult QuizBlock(ChoiceBlock block, BlockRenderContext context)
{
return new System.Web.WebPages.HelperResult(__razor_helper_writer => {


 
	var items = block.ShuffledItems();
	var isMultiply = block.Multiple;
	var typeInp = isMultiply ? "checkbox" : "radio";
	QuizBlockData model = context.GetBlockData(block) ?? new QuizBlockData(new QuizModel(), 1, QuizState.NotPassed);

WebViewPage.WriteLiteralTo(@__razor_helper_writer, "\t<div class=\"quiz-block-mark ");


WebViewPage.WriteTo(@__razor_helper_writer, typeInp);

WebViewPage.WriteLiteralTo(@__razor_helper_writer, "\" id=\'");


 WebViewPage.WriteTo(@__razor_helper_writer, block.Id + "_quizBlock");

WebViewPage.WriteLiteralTo(@__razor_helper_writer, "\'>\r\n");


 		for (var itemIndex = 0; itemIndex < items.Length; itemIndex++)
		{
			var item = items[itemIndex];
			var id = isMultiply ? itemIndex + "noMult" : model.BlockIndex.ToString();
			var itemChecked = model.QuizState != QuizState.NotPassed && model.QuizModel.AnswersToQuizes[block.Id].Contains(item.Id);
			var ans = itemChecked ? "checked" : "";
			var itemClass = "";
			var title = "";
			if (model.QuizState == QuizState.Total)
			{
				itemClass = item.IsCorrect ? "right-quiz" : itemChecked ? "wrong-quiz" : "";
				title = (item.IsCorrect ? "Правильный" : "Неправильный") + " вариант";
			}

WebViewPage.WriteLiteralTo(@__razor_helper_writer, "\t\t\t<div class=\"quiz\">\r\n\t\t\t\t<label class=\"");


WebViewPage.WriteTo(@__razor_helper_writer, itemClass);

WebViewPage.WriteLiteralTo(@__razor_helper_writer, "\" title=\"");


WebViewPage.WriteTo(@__razor_helper_writer, title);

WebViewPage.WriteLiteralTo(@__razor_helper_writer, "\">\r\n\t\t\t\t\t<input ");


WebViewPage.WriteTo(@__razor_helper_writer, ans);

WebViewPage.WriteLiteralTo(@__razor_helper_writer, " autocomplete=\"off\" id=\'");


WebViewPage.WriteTo(@__razor_helper_writer, block.Id + "quizBlock" + item.Id);

WebViewPage.WriteLiteralTo(@__razor_helper_writer, "\' name=");


                                        WebViewPage.WriteTo(@__razor_helper_writer, "group" + id);

WebViewPage.WriteLiteralTo(@__razor_helper_writer, " type=\"");


                                                             WebViewPage.WriteTo(@__razor_helper_writer, typeInp);

WebViewPage.WriteLiteralTo(@__razor_helper_writer, "\">\r\n\t\t\t\t\t");


WebViewPage.WriteTo(@__razor_helper_writer, item.Description.RenderTex());

WebViewPage.WriteLiteralTo(@__razor_helper_writer, "\r\n\t\t\t\t</label>\r\n");


 				if (model.QuizState == QuizState.Total && item.IsCorrect)
				{

WebViewPage.WriteLiteralTo(@__razor_helper_writer, "\t\t\t\t\t<i class=\"glyphicon glyphicon-ok\" style=\"color: green\" title=\"");


                        WebViewPage.WriteTo(@__razor_helper_writer, title);

WebViewPage.WriteLiteralTo(@__razor_helper_writer, "\"></i>\r\n");


				}


 				if (model.QuizState == QuizState.Total && !string.IsNullOrEmpty(item.Explanation))
				{

WebViewPage.WriteLiteralTo(@__razor_helper_writer, "\t\t\t\t\t<p class=\"text-muted\">");


WebViewPage.WriteTo(@__razor_helper_writer, item.Explanation);

WebViewPage.WriteLiteralTo(@__razor_helper_writer, "</p>\r\n");


				}

WebViewPage.WriteLiteralTo(@__razor_helper_writer, "\t\t\t</div>\r\n");


		}

WebViewPage.WriteLiteralTo(@__razor_helper_writer, "\t</div>\r\n");



});

}
Пример #17
0
public static System.Web.WebPages.HelperResult QuizBlock(FillInBlock block, BlockRenderContext context)
{
return new System.Web.WebPages.HelperResult(__razor_helper_writer => {


 
	var value = "";
	var quizRes = "";
	QuizBlockData model = context.GetBlockData(block) ?? new QuizBlockData(new QuizModel(), 1, QuizState.NotPassed);
	if (model.QuizState != QuizState.NotPassed && model.QuizModel.AnswersToQuizes[block.Id].FirstOrDefault() != null)
	{
		value = model.QuizModel.AnswersToQuizes[block.Id].FirstOrDefault();
		quizRes = (model.QuizState == QuizState.Total)
			? (model.QuizModel.AnswersToQuizes[block.Id][1] == "False" ? "wrong-quiz" : "right-quiz") : "";
	}
	var sample = block.Sample;

WebViewPage.WriteLiteralTo(@__razor_helper_writer, "\t<div class=\"quiz quiz-block-input\">\r\n\t\t<label>\r\n\t\t\t<input autocomplete=\"off\" cla" +
"ss=\"form-control ");


      WebViewPage.WriteTo(@__razor_helper_writer, quizRes);

WebViewPage.WriteLiteralTo(@__razor_helper_writer, "\" value=\"");


                       WebViewPage.WriteTo(@__razor_helper_writer, value);

WebViewPage.WriteLiteralTo(@__razor_helper_writer, "\" id=\'");


                                    WebViewPage.WriteTo(@__razor_helper_writer, block.Id + "quizBlock");

WebViewPage.WriteLiteralTo(@__razor_helper_writer, "\' maxlength=\"");


                                                                         WebViewPage.WriteTo(@__razor_helper_writer, QuizController.MAX_FILLINBLOCK_SIZE);

WebViewPage.WriteLiteralTo(@__razor_helper_writer, "\">\r\n\t\t</label>\r\n\t</div>\r\n");


	if (model.QuizState == QuizState.Total)
	{

WebViewPage.WriteLiteralTo(@__razor_helper_writer, "\t\t<div>Правильный ответ: ");


WebViewPage.WriteTo(@__razor_helper_writer, sample);

WebViewPage.WriteLiteralTo(@__razor_helper_writer, "</div>\r\n");


		if (!string.IsNullOrEmpty(block.Explanation))
		{

WebViewPage.WriteLiteralTo(@__razor_helper_writer, "\t\t\t<div class=\"text-muted\">");


WebViewPage.WriteTo(@__razor_helper_writer, block.Explanation);

WebViewPage.WriteLiteralTo(@__razor_helper_writer, "</div>\r\n");


		}
	}

});

}
Пример #18
0
public static System.Web.WebPages.HelperResult Block(MdBlock block, BlockRenderContext context)
{
return new System.Web.WebPages.HelperResult(__razor_helper_writer => {


 
	
WebViewPage.WriteTo(@__razor_helper_writer, MvcHtmlString.Create(block.Markdown.RenderMd(context.BaseUrl)));

                                                                

});

}
Пример #19
0
public static System.Web.WebPages.HelperResult Block(CodeBlock block, BlockRenderContext context)
{
return new System.Web.WebPages.HelperResult(__razor_helper_writer => {


 

WebViewPage.WriteLiteralTo(@__razor_helper_writer, "\t<textarea class=\"code code-sample\" data-lang=\"");


    WebViewPage.WriteTo(@__razor_helper_writer, block.LangId);

WebViewPage.WriteLiteralTo(@__razor_helper_writer, "\" data-ver=\"");


                             WebViewPage.WriteTo(@__razor_helper_writer, block.LangVer);

WebViewPage.WriteLiteralTo(@__razor_helper_writer, "\">");


                                             WebViewPage.WriteTo(@__razor_helper_writer, block.Code);

WebViewPage.WriteLiteralTo(@__razor_helper_writer, "</textarea>\r\n");



});

}
Пример #20
0
public static System.Web.WebPages.HelperResult Block(ExerciseBlock block, BlockRenderContext context)
{
return new System.Web.WebPages.HelperResult(__razor_helper_writer => {


 
	ExerciseBlockData data = context.GetBlockData(block) ?? new ExerciseBlockData();
	var action = data.CanSkip ? "$('#ShowSolutionsAlert').modal('show')" : string.Format("window.location='{0}'", data.AcceptedSolutionUrl);

WebViewPage.WriteLiteralTo(@__razor_helper_writer, "\t<textarea id=\"secretCodeExercise\" class=\'hide\'>");


     WebViewPage.WriteTo(@__razor_helper_writer, block.ExerciseInitialCode.EnsureEnoughLines(4));

WebViewPage.WriteLiteralTo(@__razor_helper_writer, "</textarea>\r\n");



WebViewPage.WriteLiteralTo(@__razor_helper_writer, "\t<div class=\"sphere-engine-tm\">Powered by <a target=\"blank\" href=\"http://sphere-e" +
"ngine.com\">Sphere Engine™</a> and <a target=\"blank\" href=\"http://codemirror.net/" +
"\">CodeMirror</a></div>\r\n");



WebViewPage.WriteLiteralTo(@__razor_helper_writer, "\t<textarea class=\'code code-exercise\' data-lang=\"");


      WebViewPage.WriteTo(@__razor_helper_writer, block.LangId);

WebViewPage.WriteLiteralTo(@__razor_helper_writer, "\">");


                      WebViewPage.WriteTo(@__razor_helper_writer, data.LatestAcceptedSolution ?? block.ExerciseInitialCode.EnsureEnoughLines(4));

WebViewPage.WriteLiteralTo(@__razor_helper_writer, "</textarea>\r\n");



WebViewPage.WriteLiteralTo(@__razor_helper_writer, "\t<script>\r\n\t\tfunction cleanUserCode() {\r\n\t\t\tvar $secretCodeExercise = $(\'#secretC" +
"odeExercise\');\r\n\t\t\t$(\'.code-exercise\')[0].codeMirrorEditor.setValue($secretCodeE" +
"xercise.text());\r\n\t\t}\r\n\t</script>\r\n");


	if (data.ShowControls)
	{

WebViewPage.WriteLiteralTo(@__razor_helper_writer, "\t\t<div class=\"solution-control btn-group ctrl-group\">\r\n\t\t\t<button type=\"button\" c" +
"lass=\"run-solution-button btn btn-primary no-rounds ");


                                    WebViewPage.WriteTo(@__razor_helper_writer, data.IsLti ? "run-solution-button-lti" : "");

WebViewPage.WriteLiteralTo(@__razor_helper_writer, "\" data-url=\"");


                                                                                             WebViewPage.WriteTo(@__razor_helper_writer, data.RunSolutionUrl);

WebViewPage.WriteLiteralTo(@__razor_helper_writer, "\">\r\n\t\t\t\tRun\r\n\t\t\t</button>\r\n\r\n");


  			 var e = ((ExerciseSlide)context.Slide).Exercise.HintsMd; 

WebViewPage.WriteLiteralTo(@__razor_helper_writer, "\t\t\t<button id=\"GetHintButton\" type=\"button\" class=\"btn btn-default hints-btn\" onc" +
"lick=\" showHintForUser(\'");


                                                              WebViewPage.WriteTo(@__razor_helper_writer, context.Course.Id);

WebViewPage.WriteLiteralTo(@__razor_helper_writer, "\', \'");


                                                                                    WebViewPage.WriteTo(@__razor_helper_writer, context.Slide.Index);

WebViewPage.WriteLiteralTo(@__razor_helper_writer, "\', \'");


                                                                                                            WebViewPage.WriteTo(@__razor_helper_writer, e.Count);

WebViewPage.WriteLiteralTo(@__razor_helper_writer, "\') \" data-url=\"");


                                                                                                                                   WebViewPage.WriteTo(@__razor_helper_writer, data.GetHintUrl);

WebViewPage.WriteLiteralTo(@__razor_helper_writer, "\">\r\n\t\t\t\tGet hint\r\n\t\t\t</button>\r\n");


 			if (!data.IsLti)
			{

WebViewPage.WriteLiteralTo(@__razor_helper_writer, "\t\t\t\t<button type=\"button\" class=\"btn btn-default giveup-btn\" onclick=\"");


                           WebViewPage.WriteTo(@__razor_helper_writer, action);

WebViewPage.WriteLiteralTo(@__razor_helper_writer, "\">\r\n\t\t\t\t\tShow solutions\r\n\t\t\t\t</button>\r\n");


			}

WebViewPage.WriteLiteralTo(@__razor_helper_writer, "\t\t\t<button type=\"button\" class=\"btn btn-default reset-btn no-rounds\" onclick=\" cl" +
"eanUserCode() \">\r\n\t\t\t\tReset\r\n\t\t\t</button>\r\n\t\t</div>\r\n");




WebViewPage.WriteLiteralTo(@__razor_helper_writer, "\t\t<div class=\"run-result run-service-error\">\r\n\t\t\t<div class=\"run-verdict label-wa" +
"rning\">Ошибка сервера :(</div>\r\n\t\t\t<pre class=\"no-rounds\"><code class=\"run-detai" +
"ls\"></code></pre>\r\n\t\t</div>\r\n");




WebViewPage.WriteLiteralTo(@__razor_helper_writer, "\t\t<div class=\"run-result run-compile-error\">\r\n\t\t\t<div class=\"run-verdict label-da" +
"nger\">Ошибка компиляции</div>\r\n\t\t\t<pre class=\"no-rounds\"><code class=\"run-detail" +
"s\"></code></pre>\r\n\t\t</div>\r\n");




WebViewPage.WriteLiteralTo(@__razor_helper_writer, @"		<div class=""run-result run-style-error"">
			<div class=""run-verdict label-danger"">Нарушение стилевых требований</div>
			<pre class=""no-rounds""><code class=""run-details""></code></pre>
			<div>
				<small>В некоторых ситуациях стилевые проверки тут могут быть жестче, чем необходимо в реальной жизни.</small>
			</div>
		</div>
");




WebViewPage.WriteLiteralTo(@__razor_helper_writer, "\t\t<div class=\"run-result run-wa\">\r\n\t\t\t<div class=\"run-verdict label-danger\">Невер" +
"ный результат</div>\r\n\t\t\t<div class=\"diff-table tablesorter\"></div>\r\n\t\t</div>\r\n");




WebViewPage.WriteLiteralTo(@__razor_helper_writer, "\t\t<div class=\"run-result run-wa-no-diff\">\r\n\t\t\t<div class=\"run-verdict label-dange" +
"r\">Неверный результат</div>\r\n\t\t\t<pre class=\"no-rounds\"><code class=\"run-details\"" +
"></code></pre>\r\n\t\t</div>\r\n");




WebViewPage.WriteLiteralTo(@__razor_helper_writer, "\t\t<div class=\"run-result run-success\">\r\n\t\t\t<div class=\"run-verdict label-success " +
"clearfix\">Успех!</div>\r\n\t\t\t<pre class=\"no-rounds\"><code class=\"run-details\"></co" +
"de></pre>\r\n\t\t</div>\r\n");




WebViewPage.WriteLiteralTo(@__razor_helper_writer, "\t\t<div class=\"panel-group ctrl-group\" id=\"hints-accordion\">\r\n\t\t\t<div id=\"hints-pl" +
"ace\"></div>\r\n\t\t</div>\r\n");


		if (!data.IsLti)
		{
			
WebViewPage.WriteTo(@__razor_helper_writer, Alert(data));

               
		}
	}
	else
	{

WebViewPage.WriteLiteralTo(@__razor_helper_writer, "\t\t<div>\r\n\t\t\t<h3>Подсказки</h3>\r\n\t\t\t<ol>\r\n");


 				foreach (var hint in block.HintsMd)
				{

WebViewPage.WriteLiteralTo(@__razor_helper_writer, "\t\t\t\t\t<li>\r\n\t\t\t\t\t\t");


WebViewPage.WriteTo(@__razor_helper_writer, MvcHtmlString.Create(hint.RenderMd(context.BaseUrl)));

WebViewPage.WriteLiteralTo(@__razor_helper_writer, "\r\n\t\t\t\t\t</li>\r\n");


				}

WebViewPage.WriteLiteralTo(@__razor_helper_writer, "\t\t\t</ol>\r\n\t\t</div>\r\n");


	}

});

}