Ejemplo n.º 1
0
        public string GetSubmit(int qid, int qtype, ref string AngularJS)
        {
            string option   = SafeSC.ReadFileStr(M_Exam_Sys_Questions.OptionDir + qid + ".opt");
            string emptyTlp = "<span style='color:red;'>未定义选项</span>";
            //if (string.IsNullOrEmpty(option)) return "";
            int           id      = qid;
            JArray        arr     = JsonConvert.DeserializeObject <JArray>(option);
            StringBuilder builder = new StringBuilder();

            switch (qtype)
            {
            case (int)M_Exam_Sys_Questions.QType.Radio:
            {
                if (arr == null || arr.Count < 1)
                {
                    return(emptyTlp);
                }
                string name = "srad_" + id;
                string tlp  = "<li class='opitem'><label><input type='radio' name='{0}' value='{1}'>{1}. {2}</label></li>";
                foreach (JObject obj in arr)
                {
                    builder.Append(string.Format(tlp, name, obj["op"], obj["val"]));
                }
            }
            break;

            case (int)M_Exam_Sys_Questions.QType.Multi:
            {
                if (arr == null || arr.Count < 1)
                {
                    return(emptyTlp);
                }
                string name = "mchk_" + id;
                string tlp  = "<li class='opitem'><label><input class='opitem' type='checkbox' name='{0}' value='{1}'>{1}. {2}</label></li>";
                foreach (JObject obj in arr)
                {
                    builder.Append(string.Format(tlp, name, obj["op"], obj["val"]));
                }
            }
            break;

            case (int)M_Exam_Sys_Questions.QType.FillBlank:
            {
                //string tlp = "<div contenteditable='true' class='answerdiv'>解:</div>";
                //builder.Append(tlp);
            }
            break;

            case (int)M_Exam_Sys_Questions.QType.Answer:    //放置一个ueditor
            {
                string name = "answer_" + id;
                string tlp  = "<div id='" + name + "' contenteditable='true' class='answerdiv'>解:</div>";
                builder.Append(tlp);
            }
            break;

            case (int)M_Exam_Sys_Questions.QType.FillTextBlank:
            {
                if (arr == null || arr.Count < 1)
                {
                    return(emptyTlp);
                }
                string name = "filltextblank_" + id;
                string tlp  = "<li style='float:none;' ng-repeat='item in list." + name + "|orderBy:\"id\"'>"
                              + "<div><div class='title'>{{item.id}},{{item.title}}</div>"
                              + "<ul class='submitul'>"
                              + "<li class='opitem' ng-repeat='opt in item.opts'><label><input type='radio' class='opitem' ng-value='opt.op' ng-model='item.answer'/>{{opt.op}}. <span ng-bind-html='opt.val | to_trusted'></span></label></li>"
                              + "</ul></div><div style='clear:both;'></div></li>";
                AngularJS += "$scope.list[\"" + name + "\"]=" + option + ";idsArr.push(" + id + ");";
                builder.Append(tlp);
            }
            break;
            }
            return(builder.ToString());
        }
Ejemplo n.º 2
0
        /// <summary>
        /// 根据版位的类型获取相应模板的内容
        /// </summary>
        /// <param name="zoneType"></param>
        /// <returns></returns>
        public string GetADZoneJSTemplateContent(int zoneType)
        {
            string templateName = this.GetTemplateName(zoneType);

            return(SafeSC.ReadFileStr(ADJSTlpDir + templateName));
        }