%
%>
<%
asp_include "include/courses_variables.asp",false
asp_include "include/xtempl.asp",false
asp_include "classes/runnerpage.asp",false
asp_include "classes/searchclause.asp",false
add_nocache_headers
if IsEqual(postvalue("editType"),"inline") then
inlineedit = EDIT_INLINE
else
if IsEqual(postvalue("editType"),EDIT_POPUP) then
inlineedit = EDIT_POPUP
else
inlineedit = EDIT_SIMPLE
end if
end if
doAssignmentByRef id,postvalue("id")
if IsEqual(asp_intval(id),0) then
id = 1
end if
flyId = CSmartDbl(id)+1
Set xt = (CreateClass("Xtempl",0,Empty,Empty,Empty,Empty,Empty,Empty,Empty))
xt.assign_p2 "id",id
Set params = (CreateDictionary2("pageType",PAGE_EDIT,"id",id))
setArrElement params,"tName",strTableName
setArrElementByRef params,"xt",xt
setArrElement params,"mode",inlineedit
setArrElement params,"includes_js",includes_js
setArrElement params,"includes_jsreq",includes_jsreq
setArrElement params,"includes_css",includes_css
setArrElement params,"locale_info",locale_info
setArrElement params,"pageEditLikeInline",IsEqual(inlineedit,EDIT_INLINE)
setArrElement params,"useTabsOnEdit",useTabsOnEdit(strTableName)
if bValue(ArrayElement(params,"useTabsOnEdit")) then
setArrElement params,"arrEditTabs",GetEditTabs(strTableName)
end if
Set pageObject = (CreateClass("RunnerPage",1,params,Empty,Empty,Empty,Empty,Empty,Empty))
if not IsEqual(GetRequestValue(Request,"action"),"") then
if bValue(pageObject.lockingObj) then
doAssignmentByRef arrkeys,explode("&",GetRequestValue(Request,"keys"))
GetCollectionBounds arrkeys,edit_loopIdx2,edit_loopMax2
do while edit_loopIdx2<=edit_loopMax2
ind = GetCollectionKey(arrkeys,edit_loopIdx2)
doAssignment val,ArrayElement(arrkeys,ind)
setArrElement arrkeys,ind,asp_urldecode(val)
edit_loopIdx2=edit_loopIdx2+1
loop
if IsEqual(GetRequestValue(Request,"action"),"unlock") then
pageObject.lockingObj.UnlockRecord_p3 strTableName,arrkeys,GetRequestValue(Request,"sid")
Response.End
else
if IsEqual(GetRequestValue(Request,"action"),"lockadmin") and (bValue(IsAdmin()) or IsEqual(Session("AccessLevel"),ACCESS_LEVEL_ADMINGROUP)) then
pageObject.lockingObj.UnlockAdmin_p3 strTableName,arrkeys,IsEqual(GetRequestValue(Request,"startEdit"),"yes")
if IsEqual(GetRequestValue(Request,"startEdit"),"no") then
ResponseWrite "unlock"
else
if IsEqual(GetRequestValue(Request,"startEdit"),"yes") then
ResponseWrite "lock"
end if
end if
Response.End
else
if IsEqual(GetRequestValue(Request,"action"),"confirm") then
ResponseWrite " confirm"
if not bValue(pageObject.lockingObj.ConfirmLock_p3(strTableName,arrkeys,message)) then
end if
ResponseWrite message
Response.End
end if
end if
end if
else
Response.End
end if
end if
doAssignment filename,doAssignment(status,doAssignment(message,doAssignment(mesClass,doAssignment(usermessage,doAssignment(strWhereClause,doAssignment(bodyonload,""))))))
doAssignment showValues,doAssignment(showRawValues,doAssignment(showFields,doAssignment(showDetailKeys,doAssignment(key,doAssignment(var_next,doAssignment(prev,CreateDictionary()))))))
doAssignment HaveData,doAssignment(enableCtrlsForEditing,true)
doAssignment error_happened,doAssignment(readevalues,doAssignment(IsSaved,false))
doAssignment templatefile,IIF(IsEqual(inlineedit,EDIT_INLINE),"courses_inline_edit.htm","courses_edit.htm")
doAssignmentByRef auditObj,GetAuditObject(strTableName)
pageObject.searchClauseObj.parseRequest
setArrElement Session,CSmartStr(strTableName) & "_advsearch",serialize(pageObject.searchClauseObj)
doAssignment detailKeys,pageObject.detailKeysByM
doAssignmentByRef editFields,pageObject.getFieldsByPageType()
doAssignmentByRef onLoadJsCode,GetTableData(pageObject.tName,".jsOnloadEdit","")
pageObject.addOnLoadJsEvent_p1 onLoadJsCode
if bValue(pageObject.lockingObj) then
system_attrs = "style='display:none;'"
system_message = ""
end if
if not IsEqual(inlineedit,EDIT_INLINE) then
pageObject.addButtonHandlers
end if
doAssignmentByRef url_page,asp_substr(GetRequestValue(Request.ServerVariables,"SCRIPT_NAME"),CSmartDbl(asp_strrpos(GetRequestValue(Request.ServerVariables,"SCRIPT_NAME"),"/",empty))+1,12)
if bValue(eventObj.exists_p1("BeforeProcessEdit")) then
eventObj.BeforeProcessEdit_p1 conn
end if
Set keys = (CreateDictionary())
skeys = ""
Set savedKeys = (CreateDictionary())
setArrElement keys,"CourseID",asp_urldecode(postvalue("editid1"))
setArrElement savedKeys,"CourseID",asp_urldecode(postvalue("editid1"))
skeys = CSmartStr(skeys) & (CSmartStr(asp_rawurlencode(postvalue("editid1"))) & "&")
if not IsEqual(skeys,"") then
doAssignmentByRef skeys,asp_substr(skeys,0,-1)
end if
if not IsEqual(inlineedit,EDIT_INLINE) then
Set dpParams = (CreateDictionary())
if bValue(pageObject.isShowDetailTables) then
doAssignment ids,id
setArrElementN pageObject.jsSettings,CreateArray3("tableSettings",strTableName,"dpParams"),CreateDictionary2("tableNames",ArrayElement(dpParams,"strTableNames"),"ids",ArrayElement(dpParams,"ids"))
pageObject.AddJSFile_p1 "include/detailspreview"
end if
end if
if not IsEqual(inlineedit,EDIT_INLINE) then
if bValue(pageObject.captchaExists()) then
pageObject.doCaptchaCode
end if
end if
if IsEqual(GetRequestValue(RequestForm(),"a"),"edited") then
doAssignmentByRef strWhereClause,whereAdd(strWhereClause,KeyWhere(keys,""))
oldValuesRead = false
if (bValue(eventObj.exists_p1("AfterEdit")) or bValue(eventObj.exists_p1("BeforeEdit"))) or bValue(auditObj) then
doAssignmentByRef rsold,db_query(gSQLWhere(strWhereClause,""),conn)
doAssignmentByRef dataold,db_fetch_array(rsold)
oldValuesRead = true
end if
doAssignment evalues,doAssignment(efilename_values,doAssignment(blobfields,CreateDictionary()))
condition = 1
if bValue(condition) then
doAssignmentByRef value,postvalue("value_CourseTitle_" & CSmartStr(id))
doAssignmentByRef var_type,postvalue("type_CourseTitle_" & CSmartStr(id))
if bValue(FieldSubmitted("CourseTitle_" & CSmartStr(id))) then
doAssignmentByRef value,prepare_for_db("CourseTitle",value,var_type,"","")
else
value = false
end if
if not IsFalse(value) then
if (bValue(0) and "CourseTitle"="Password") and IsEqual(url_page,"admin_users_") then
doAssignmentByRef value,md5(value)
end if
setArrElement evalues,"CourseTitle",value
end if
end if
condition = 1
if bValue(condition) then
doAssignmentByRef value,postvalue("value_CEUCredit_" & CSmartStr(id))
doAssignmentByRef var_type,postvalue("type_CEUCredit_" & CSmartStr(id))
if bValue(FieldSubmitted("CEUCredit_" & CSmartStr(id))) then
doAssignmentByRef value,prepare_for_db("CEUCredit",value,var_type,"","")
else
value = false
end if
if not IsFalse(value) then
if (bValue(0) and "CEUCredit"="Password") and IsEqual(url_page,"admin_users_") then
doAssignmentByRef value,md5(value)
end if
setArrElement evalues,"CEUCredit",value
end if
end if
condition = 1
if bValue(condition) then
doAssignmentByRef value,postvalue("value_Location_" & CSmartStr(id))
doAssignmentByRef var_type,postvalue("type_Location_" & CSmartStr(id))
if bValue(FieldSubmitted("Location_" & CSmartStr(id))) then
doAssignmentByRef value,prepare_for_db("Location",value,var_type,"","")
else
value = false
end if
if not IsFalse(value) then
if (bValue(0) and "Location"="Password") and IsEqual(url_page,"admin_users_") then
doAssignmentByRef value,md5(value)
end if
setArrElement evalues,"Location",value
end if
end if
condition = 1
if bValue(condition) then
doAssignmentByRef value,postvalue("value_CourseDates_" & CSmartStr(id))
doAssignmentByRef var_type,postvalue("type_CourseDates_" & CSmartStr(id))
if bValue(FieldSubmitted("CourseDates_" & CSmartStr(id))) then
doAssignmentByRef value,prepare_for_db("CourseDates",value,var_type,"","")
else
value = false
end if
if not IsFalse(value) then
if (bValue(0) and "CourseDates"="Password") and IsEqual(url_page,"admin_users_") then
doAssignmentByRef value,md5(value)
end if
setArrElement evalues,"CourseDates",value
end if
end if
condition = 1
if bValue(condition) then
doAssignmentByRef value,postvalue("value_DurationInDays_" & CSmartStr(id))
doAssignmentByRef var_type,postvalue("type_DurationInDays_" & CSmartStr(id))
if bValue(FieldSubmitted("DurationInDays_" & CSmartStr(id))) then
doAssignmentByRef value,prepare_for_db("DurationInDays",value,var_type,"","")
else
value = false
end if
if not IsFalse(value) then
if (bValue(0) and "DurationInDays"="Password") and IsEqual(url_page,"admin_users_") then
doAssignmentByRef value,md5(value)
end if
setArrElement evalues,"DurationInDays",value
end if
end if
condition = 1
if bValue(condition) then
doAssignmentByRef value,postvalue("value_Tuitionfees_" & CSmartStr(id))
doAssignmentByRef var_type,postvalue("type_Tuitionfees_" & CSmartStr(id))
if bValue(FieldSubmitted("Tuitionfees_" & CSmartStr(id))) then
doAssignmentByRef value,prepare_for_db("Tuitionfees",value,var_type,"","")
else
value = false
end if
if not IsFalse(value) then
if (bValue(0) and "Tuitionfees"="Password") and IsEqual(url_page,"admin_users_") then
doAssignmentByRef value,md5(value)
end if
setArrElement evalues,"Tuitionfees",value
end if
end if
GetCollectionBounds efilename_values,edit_loopIdx3,edit_loopMax3
do while edit_loopIdx3<=edit_loopMax3
ekey = GetCollectionKey(efilename_values,edit_loopIdx3)
doAssignment value,ArrayElement(efilename_values,ekey)
setArrElement evalues,ekey,value
edit_loopIdx3=edit_loopIdx3+1
loop
if bValue(pageObject.lockingObj) then
lockmessage = ""
if not bValue(pageObject.lockingObj.ConfirmLock_p3(strTableName,savedKeys,lockmessage)) then
enableCtrlsForEditing = false
system_attrs = "style='dispaly:block;'"
if IsEqual(inlineedit,EDIT_INLINE) then
if bValue(IsAdmin()) or IsEqual(Session("AccessLevel"),ACCESS_LEVEL_ADMINGROUP) then
doAssignmentByRef lockmessage,pageObject.lockingObj.GetLockInfo_p4(strTableName,savedKeys,false,id)
end if
setArrElement returnJSON,"success",false
setArrElement returnJSON,"message",lockmessage
setArrElement returnJSON,"enableCtrls",enableCtrlsForEditing
setArrElement returnJSON,"confirmTime",pageObject.lockingObj.ConfirmTime
ResponseWrite (""
Response.End
else
if bValue(IsAdmin()) or IsEqual(Session("AccessLevel"),ACCESS_LEVEL_ADMINGROUP) then
doAssignmentByRef system_message,pageObject.lockingObj.GetLockInfo_p4(strTableName,savedKeys,true,id)
else
doAssignment system_message,lockmessage
end if
end if
status = "DECLINED"
readevalues = true
end if
end if
if IsEqual(readevalues,false) then
retval = true
if bValue(eventObj.exists_p1("BeforeEdit")) then
doAssignmentByRef retval,eventObj.BeforeEdit_p6(evalues,strWhereClause,dataold,keys,usermessage,bValue(inlineedit))
end if
if bValue(retval) and bValue(pageObject.isCaptchaOk) then
if not IsEqual(inlineedit,EDIT_INLINE) then
setArrElement Session,CSmartStr(strTableName) & "_count_captcha",CSmartDbl(Session(CSmartStr(strTableName) & "_count_captcha"))+1
end if
if bValue(DoUpdateRecord(strOriginalTableName,evalues,blobfields,strWhereClause,id,pageObject)) then
IsSaved = true
if bValue(pageObject.lockingObj) and IsEqual(inlineedit,EDIT_INLINE) then
pageObject.lockingObj.UnlockRecord_p3 strTableName,savedKeys,""
end if
if bValue(auditObj) or bValue(eventObj.exists_p1("AfterEdit")) then
GetCollectionBounds dataold,edit_loopIdx4,edit_loopMax4
do while edit_loopIdx4<=edit_loopMax4
idx = GetCollectionKey(dataold,edit_loopIdx4)
doAssignment val,ArrayElement(dataold,idx)
if not bValue(asp_array_key_exists(idx,evalues)) then
setArrElement evalues,idx,val
end if
edit_loopIdx4=edit_loopIdx4+1
loop
end if
if bValue(auditObj) then
auditObj.LogEdit_p4 strTableName,evalues,dataold,keys
end if
if bValue(eventObj.exists_p1("AfterEdit")) then
eventObj.AfterEdit_p5 evalues,KeyWhere(keys,""),dataold,keys,bValue(inlineedit)
end if
mesClass = "mes_ok"
else
if not IsEqual(inlineedit,EDIT_INLINE) then
mesClass = "mes_not"
end if
end if
else
doAssignment message,usermessage
readevalues = true
status = "DECLINED"
end if
end if
if bValue(readevalues) then
doAssignment keys,savedKeys
end if
end if
if bValue(pageObject.lockingObj) then
doAssignmentByRef enableCtrlsForEditing,pageObject.lockingObj.LockRecord_p2(strTableName,keys)
if not bValue(enableCtrlsForEditing) then
if IsEqual(inlineedit,EDIT_INLINE) then
if bValue(IsAdmin()) or IsEqual(Session("AccessLevel"),ACCESS_LEVEL_ADMINGROUP) then
doAssignmentByRef lockmessage,pageObject.lockingObj.GetLockInfo_p4(strTableName,keys,false,id)
else
doAssignment lockmessage,pageObject.lockingObj.LockUser
end if
setArrElement returnJSON,"success",false
setArrElement returnJSON,"message",lockmessage
setArrElement returnJSON,"enableCtrls",enableCtrlsForEditing
setArrElement returnJSON,"confirmTime",pageObject.lockingObj.ConfirmTime
ResponseWrite my_json_encode(returnJSON)
Response.End
end if
system_attrs = "style='display:block;'"
doAssignment system_message,pageObject.lockingObj.LockUser
if bValue(IsAdmin()) or IsEqual(Session("AccessLevel"),ACCESS_LEVEL_ADMINGROUP) then
doAssignmentByRef rb,pageObject.lockingObj.GetLockInfo_p4(strTableName,keys,true,id)
if not IsEqual(rb,"") then
doAssignment system_message,rb
end if
end if
end if
end if
if bValue(pageObject.lockingObj) and not IsEqual(inlineedit,EDIT_INLINE) then
setArrElement pageObject.body,"begin",CSmartStr(ArrayElement(pageObject.body,"begin")) & (((((("
") & CSmartStr(system_message)) & "
")
end if
message = ((("
") & CSmartStr(message)) & "
"
if (bValue(IsSaved) and bValue(no_output_done())) and IsEqual(inlineedit,EDIT_SIMPLE) then
setArrElement Session,"message",IIF(message,message,"")
keyGetQ = ""
keyGetQ = CSmartStr(keyGetQ) & (("editid1=" & CSmartStr(asp_rawurldecode(ArrayElement(keys,"CourseID")))) & "&")
doAssignmentByRef keyGetQ,asp_substr(keyGetQ,0,CSmartDbl(asp_strlen(keyGetQ))-1)
asp_header (("Location: courses_" & CSmartStr(pageObject.getPageType())) & ".asp?") & CSmartStr(keyGetQ)
Response.End
end if
if IsEqual(inlineedit,EDIT_SIMPLE) and not IsEmpty(Session("message")) then
doAssignment message,Session("message")
asp_unsetElement Session,"message"
end if
doAssignmentByRef query,queryData_courses.Copy()
doAssignmentByRef strWhereClause,KeyWhere(keys,"")
doAssignmentByRef strSQL,gSQLWhere(strWhereClause,"")
doAssignment strSQLbak,strSQL
if bValue(eventObj.exists_p1("BeforeQueryEdit")) then
eventObj.BeforeQueryEdit_p2 strSQL,strWhereClause
end if
if IsEqual(strSQLbak,strSQL) then
doAssignmentByRef strSQL,gSQLWhere(strWhereClause,"")
end if
LogInfo strSQL
doAssignmentByRef rs,db_query(strSQL,conn)
doAssignmentByRef data,db_fetch_array(rs)
if not bValue(data) then
if IsEqual(inlineedit,EDIT_SIMPLE) then
asp_header "Location: courses_list.asp?a=return"
Response.End
else
Set data = (CreateDictionary())
end if
end if
Set readonlyfields = (CreateDictionary())
if bValue(readevalues) then
setArrElement data,"CourseTitle",ArrayElement(evalues,"CourseTitle")
setArrElement data,"CEUCredit",ArrayElement(evalues,"CEUCredit")
setArrElement data,"Location",ArrayElement(evalues,"Location")
setArrElement data,"CourseDates",ArrayElement(evalues,"CourseDates")
setArrElement data,"DurationInDays",ArrayElement(evalues,"DurationInDays")
setArrElement data,"Tuitionfees",ArrayElement(evalues,"Tuitionfees")
end if
if bValue(eventObj.exists_p1("ProcessValuesEdit")) then
eventObj.ProcessValuesEdit_p1 data
end if
includes = ""
if not IsEqual(inlineedit,EDIT_INLINE) then
if IsEqual(inlineedit,EDIT_SIMPLE) then
includes = CSmartStr(includes) & "" & vbcrlf
if IsIdentical(pageObject.debugJSMode,true) then
includes = CSmartStr(includes) & "" & vbcrlf
else
includes = CSmartStr(includes) & "" & vbcrlf
end if
includes = CSmartStr(includes) & "" & vbcrlf
includes = CSmartStr(includes) & (("" & vbcrlf)
if bValue(pageObject.isShowDetailTables) then
includes = CSmartStr(includes) & "
"
end if
setArrElement pageObject.body,"begin",CSmartStr(ArrayElement(pageObject.body,"begin")) & CSmartStr(includes)
end if
if not bValue(pageObject.isAppearOnTabs_p1("CourseTitle")) then
xt.assign_p2 "CourseTitle_fieldblock",true
else
xt.assign_p2 "CourseTitle_tabfieldblock",true
end if
xt.assign_p2 "CourseTitle_label",true
if bValue(isEnableSection508()) then
xt.assign_section_p3 "CourseTitle_label",(""
end if
if not bValue(pageObject.isAppearOnTabs_p1("CEUCredit")) then
xt.assign_p2 "CEUCredit_fieldblock",true
else
xt.assign_p2 "CEUCredit_tabfieldblock",true
end if
xt.assign_p2 "CEUCredit_label",true
if bValue(isEnableSection508()) then
xt.assign_section_p3 "CEUCredit_label",(""
end if
if not bValue(pageObject.isAppearOnTabs_p1("Location")) then
xt.assign_p2 "Location_fieldblock",true
else
xt.assign_p2 "Location_tabfieldblock",true
end if
xt.assign_p2 "Location_label",true
if bValue(isEnableSection508()) then
xt.assign_section_p3 "Location_label",(""
end if
if not bValue(pageObject.isAppearOnTabs_p1("CourseDates")) then
xt.assign_p2 "CourseDates_fieldblock",true
else
xt.assign_p2 "CourseDates_tabfieldblock",true
end if
xt.assign_p2 "CourseDates_label",true
if bValue(isEnableSection508()) then
xt.assign_section_p3 "CourseDates_label",(""
end if
if not bValue(pageObject.isAppearOnTabs_p1("DurationInDays")) then
xt.assign_p2 "DurationInDays_fieldblock",true
else
xt.assign_p2 "DurationInDays_tabfieldblock",true
end if
xt.assign_p2 "DurationInDays_label",true
if bValue(isEnableSection508()) then
xt.assign_section_p3 "DurationInDays_label",(""
end if
if not bValue(pageObject.isAppearOnTabs_p1("Tuitionfees")) then
xt.assign_p2 "Tuitionfees_fieldblock",true
else
xt.assign_p2 "Tuitionfees_tabfieldblock",true
end if
xt.assign_p2 "Tuitionfees_label",true
if bValue(isEnableSection508()) then
xt.assign_section_p3 "Tuitionfees_label",(""
end if
xt.assign_p2 "show_key1",htmlspecialchars(GetData(data,"CourseID",""))
if not bValue(Session(CSmartStr(strTableName) & "_noNextPrev")) and IsEqual(inlineedit,EDIT_SIMPLE) then
Set var_next = (CreateDictionary())
Set prev = (CreateDictionary())
pageObject.getNextPrevRecordKeys_p4 data,"Edit",var_next,prev
end if
doAssignment nextlink,doAssignment(prevlink,"")
if bValue(asp_count(var_next)) then
xt.assign_p2 "next_button",true
nextlink = CSmartStr(nextlink) & ("editid1=" & CSmartStr(htmlspecialchars(asp_rawurlencode(ArrayElement(var_next,1)))))
xt.assign_p2 "nextbutton_attrs",("id=""nextButton" & CSmartStr(id)) & """ align=""absmiddle"""
else
xt.assign_p2 "next_button",false
end if
if bValue(asp_count(prev)) then
xt.assign_p2 "prev_button",true
prevlink = CSmartStr(prevlink) & ("editid1=" & CSmartStr(htmlspecialchars(asp_rawurlencode(ArrayElement(prev,1)))))
xt.assign_p2 "prevbutton_attrs",("id=""prevButton" & CSmartStr(id)) & """ align=""absmiddle"""
else
xt.assign_p2 "prev_button",false
end if
xt.assign_p2 "resetbutton_attrs",("id=""resetButton" & CSmartStr(id)) & """"
if IsEqual(inlineedit,EDIT_SIMPLE) then
xt.assign_p2 "back_button",true
xt.assign_p2 "backbutton_attrs",("id=""backButton" & CSmartStr(id)) & """"
end if
onmouseover = "this.focus();"
onmouseover = ("onmouseover=""" & CSmartStr(onmouseover)) & """"
xt.assign_p2 "save_button",true
if not bValue(enableCtrlsForEditing) then
xt.assign_p2 "savebutton_attrs",(("id=""saveButton" & CSmartStr(id)) & """ disabled=""true"" style='background-color:#dcdcdc' ") & CSmartStr(onmouseover)
else
xt.assign_p2 "savebutton_attrs",(("id=""saveButton" & CSmartStr(id)) & """") & CSmartStr(onmouseover)
end if
xt.assign_p2 "reset_button",true
end if
if bValue(message) then
xt.assign_p2 "message_block",true
xt.assign_p2 "message",message
end if
if IsEqual(postvalue("a"),"edited") and (IsEqual(inlineedit,EDIT_INLINE) or IsEqual(inlineedit,EDIT_POPUP)) then
if not bValue(data) then
doAssignment data,evalues
HaveData = false
end if
keylink = ""
keylink = CSmartStr(keylink) & ("&key1=" & CSmartStr(htmlspecialchars(asp_rawurlencode(ArrayElement(data,"CourseID")))))
value = ""
doAssignmentByRef value,ProcessLargeText(GetData(data,"CourseID",""),"field=CourseID" & CSmartStr(keylink),"",MODE_LIST,"")
setArrElement showValues,"CourseID",value
setArrElement showFields,asp_count(showFields),"CourseID"
setArrElement showRawValues,"CourseID",asp_substr(ArrayElement(data,"CourseID"),0,100)
value = ""
doAssignmentByRef value,ProcessLargeText(GetData(data,"CourseTitle",""),"field=CourseTitle" & CSmartStr(keylink),"",MODE_LIST,"")
setArrElement showValues,"CourseTitle",value
setArrElement showFields,asp_count(showFields),"CourseTitle"
setArrElement showRawValues,"CourseTitle",asp_substr(ArrayElement(data,"CourseTitle"),0,100)
value = ""
doAssignmentByRef value,ProcessLargeText(GetData(data,"CEUCredit","Number"),"field=CEUCredit" & CSmartStr(keylink),"",MODE_LIST,"")
setArrElement showValues,"CEUCredit",value
setArrElement showFields,asp_count(showFields),"CEUCredit"
setArrElement showRawValues,"CEUCredit",asp_substr(ArrayElement(data,"CEUCredit"),0,100)
value = ""
doAssignmentByRef value,ProcessLargeText(GetData(data,"Location",""),"field=Location" & CSmartStr(keylink),"",MODE_LIST,"")
setArrElement showValues,"Location",value
setArrElement showFields,asp_count(showFields),"Location"
setArrElement showRawValues,"Location",asp_substr(ArrayElement(data,"Location"),0,100)
value = ""
doAssignmentByRef value,ProcessLargeText(GetData(data,"CourseDates",""),"field=CourseDates" & CSmartStr(keylink),"",MODE_LIST,"")
setArrElement showValues,"CourseDates",value
setArrElement showFields,asp_count(showFields),"CourseDates"
setArrElement showRawValues,"CourseDates",asp_substr(ArrayElement(data,"CourseDates"),0,100)
value = ""
doAssignmentByRef value,ProcessLargeText(GetData(data,"DurationInDays",""),"field=DurationInDays" & CSmartStr(keylink),"",MODE_LIST,"")
setArrElement showValues,"DurationInDays",value
setArrElement showFields,asp_count(showFields),"DurationInDays"
setArrElement showRawValues,"DurationInDays",asp_substr(ArrayElement(data,"DurationInDays"),0,100)
value = ""
doAssignmentByRef value,ProcessLargeText(GetData(data,"Tuitionfees","Number"),"field=Tuitionfees" & CSmartStr(keylink),"",MODE_LIST,"")
setArrElement showValues,"Tuitionfees",value
setArrElement showFields,asp_count(showFields),"Tuitionfees"
setArrElement showRawValues,"Tuitionfees",asp_substr(ArrayElement(data,"Tuitionfees"),0,100)
if bValue(IsSaved) then
if bValue(pageObject.lockingObj) then
pageObject.lockingObj.UnlockRecord_p3 strTableName,keys,""
end if
setArrElement returnJSON,"success",true
setArrElement returnJSON,"keys",keys
setArrElement returnJSON,"vals",showValues
setArrElement returnJSON,"fields",showFields
setArrElement returnJSON,"rawVals",showRawValues
setArrElement returnJSON,"detKeys",showDetailKeys
setArrElement returnJSON,"userMess",usermessage
else
setArrElement returnJSON,"success",false
setArrElement returnJSON,"message",message
if bValue(pageObject.lockingObj) then
setArrElement returnJSON,"lockMessage",system_message
end if
end if
ResponseWrite (""
Response.End
end if
regex = ""
regexmessage = ""
regextype = ""
Set control = (CreateDictionary())
GetCollectionBounds editFields,edit_loopIdx5,edit_loopMax5
do while edit_loopIdx5<=edit_loopMax5
edit_arrKey5 = GetCollectionKey(editFields,edit_loopIdx5)
doAssignment fName,ArrayElement(editFields,edit_arrKey5)
doAssignmentByRef gfName,GoodFieldName(fName)
Set controls = (CreateDictionary1("controls",CreateDictionary()))
if not bValue(detailKeys) or not bValue(asp_in_array(fName,detailKeys,false)) then
setArrElement control,gfName,CreateDictionary()
setArrElementN control,CreateArray2(gfName,"func"),"xt_buildeditcontrol"
setArrElementN control,CreateArray2(gfName,"params"),CreateDictionary()
setArrElementN control,CreateArray3(gfName,"params","id"),id
setArrElementN control,CreateArray3(gfName,"params","field"),fName
setArrElementN control,CreateArray3(gfName,"params","value"),ArrayElement(data,fName)
doAssignmentByRef arrValidate,getValidation(fName,strTableName)
setArrElementN control,CreateArray3(gfName,"params","validate"),arrValidate
Set additionalCtrlParams = (CreateDictionary())
setArrElement additionalCtrlParams,"disabled",not bValue(enableCtrlsForEditing)
setArrElementN control,CreateArray3(gfName,"params","additionalCtrlParams"),additionalCtrlParams
end if
setArrElementN controls,CreateArray2("controls","ctrlInd"),0
setArrElementN controls,CreateArray2("controls","id"),id
setArrElementN controls,CreateArray2("controls","fieldName"),fName
if IsEqual(inlineedit,EDIT_INLINE) then
if not bValue(detailKeys) or not bValue(asp_in_array(fName,detailKeys,false)) then
setArrElementN control,CreateArray3(gfName,"params","mode"),"inline_edit"
end if
setArrElementN controls,CreateArray2("controls","mode"),"inline_edit"
else
if not bValue(detailKeys) or not bValue(asp_in_array(fName,detailKeys,false)) then
setArrElementN control,CreateArray3(gfName,"params","mode"),"edit"
end if
setArrElementN controls,CreateArray2("controls","mode"),"edit"
end if
if not bValue(detailKeys) or not bValue(asp_in_array(fName,detailKeys,false)) then
xt.assignbyref_p2 CSmartStr(gfName) & "_editcontrol",ArrayElement(control,gfName)
else
if bValue(detailKeys) and bValue(asp_in_array(fName,detailKeys,false)) then
setArrElementN controls,CreateArray2("controls","value"),ArrayElement(data,fName)
end if
end if
doAssignmentByRef strCategoryControl,pageObject.hasDependField_p1(fName)
if not IsFalse(strCategoryControl) and bValue(asp_in_array(strCategoryControl,editFields,false)) then
Set vals = (CreateDictionary2(fName,ArrayElement(data,fName),strCategoryControl,ArrayElement(data,strCategoryControl)))
else
Set vals = (CreateDictionary1(fName,ArrayElement(data,fName)))
end if
doAssignmentByRef preload,pageObject.fillPreload_p2(fName,vals)
if not IsFalse(preload) then
setArrElementN controls,CreateArray2("controls","preloadData"),preload
end if
pageObject.fillControlsMap_p1 controls
pageObject.fillFieldToolTips_p1 fName
if IsEqual(GetEditFormat(fName,""),"Time") then
pageObject.fillTimePickSettings_p2 fName,ArrayElement(data,fName)
end if
if IsEqual(ViewFormat(fName,""),FORMAT_MAP) then
setArrElement pageObject.googleMapCfg,"isUseGoogleMap",true
end if
if (bValue(detailKeys) and bValue(asp_in_array(fName,detailKeys,false))) and bValue(asp_array_key_exists(fName,data)) then
if (IsEqual(GetEditFormat(fName,""),EDIT_FORMAT_LOOKUP_WIZARD) or IsEqual(GetEditFormat(fName,""),EDIT_FORMAT_RADIO)) and IsEqual(GetpLookupType(fName,""),LT_LOOKUPTABLE) then
doAssignmentByRef value,DisplayLookupWizard(fName,ArrayElement(data,fName),data,"",MODE_VIEW)
else
if bValue(NeedEncode(fName,"")) then
doAssignmentByRef value,ProcessLargeText(GetData(data,fName,ViewFormat(fName,"")),"field=" & CSmartStr(asp_rawurlencode(htmlspecialchars(fName))),"",MODE_VIEW,"")
else
doAssignmentByRef value,GetData(data,fName,ViewFormat(fName,""))
end if
end if
xt.assign_p2 CSmartStr(gfName) & "_editcontrol",value
end if
edit_loopIdx5=edit_loopIdx5+1
loop
pageObject.fillCntrlTabGroups
setArrElementN pageObject.jsSettings,CreateArray3("tableSettings",strTableName,"keys"),keys
setArrElementN pageObject.jsSettings,CreateArray3("tableSettings",strTableName,"prevKeys"),prev
setArrElementN pageObject.jsSettings,CreateArray3("tableSettings",strTableName,"nextKeys"),var_next
if bValue(pageObject.lockingObj) then
setArrElementN pageObject.jsSettings,CreateArray3("tableSettings",strTableName,"sKeys"),skeys
setArrElementN pageObject.jsSettings,CreateArray3("tableSettings",strTableName,"enableCtrls"),enableCtrlsForEditing
setArrElementN pageObject.jsSettings,CreateArray3("tableSettings",strTableName,"confirmTime"),pageObject.lockingObj.ConfirmTime
end if
pageObject.fillSetCntrlMaps
if bValue(pageObject.isShowDetailTables) and not IsEqual(inlineedit,EDIT_INLINE) then
Set options = (CreateDictionary())
setArrElement options,"mode",LIST_DETAILS
setArrElement options,"pageType",PAGE_LIST
setArrElement options,"masterPageType",PAGE_EDIT
setArrElement options,"mainMasterPageType",PAGE_EDIT
setArrElement options,"masterTable",strTableName
setArrElement options,"firstTime",1
if bValue(asp_count(ArrayElement(dpParams,"ids"))) then
asp_include "classes/listpage.asp",false
asp_include "classes/listpage_embed.asp",false
asp_include "classes/listpage_dpinline.asp",false
xt.assign_p2 "detail_tables",true
end if
Set dControlsMap = (CreateDictionary())
flyId = CSmartDbl(ids)+1
d = 0
edit_exitLoop6=false
do while IsLess(d,asp_count(ArrayElement(dpParams,"ids")))
edit_exitLoop6=false
do
doAssignment strTableName,ArrayElement(ArrayElement(dpParams,"strTableNames"),d)
asp_include ("include/" & CSmartStr(GetTableURL(strTableName))) & "_settings.asp",false
if not bValue(CheckSecurity(Session(("_" & CSmartStr(strTableName)) & "_OwnerID"),"Search")) then
strTableName = "courses"
exit do
end if
setArrElement options,"xt",CreateClass("Xtempl",0,Empty,Empty,Empty,Empty,Empty,Empty,Empty)
setArrElement options,"id",ArrayElement(ArrayElement(dpParams,"ids"),d)
setArrElement options,"flyId",postInc(flyId)
mkr = 1
GetCollectionBounds ArrayElement(mKeys,strTableName),edit_loopIdx7,edit_loopMax7
do while edit_loopIdx7<=edit_loopMax7
edit_arrKey7 = GetCollectionKey(ArrayElement(mKeys,strTableName),edit_loopIdx7)
doAssignment mk,ArrayElement(ArrayElement(mKeys,strTableName),edit_arrKey7)
setArrElementN options,CreateArray2("masterKeysReq",postInc(mkr)),ArrayElement(data,mk)
edit_loopIdx7=edit_loopIdx7+1
loop
doAssignmentByRef listPageObject,method_ListPage_createListPage(this_object,strTableName,options)
listPageObject.prepareForBuildPage
flyId = CSmartDbl(listPageObject.recId)+1
if bValue(listPageObject.isDispGrid()) then
listPageObject.fillSetCntrlMaps
setArrElementN pageObject.jsSettings,CreateArray2("tableSettings",strTableName),ArrayElement(ArrayElement(listPageObject.jsSettings,"tableSettings"),strTableName)
setArrElementN dControlsMap,CreateArray2(strTableName,"gridRows"),ArrayElement(ArrayElement(ArrayElement(ArrayElement(listPageObject.controlsHTMLMap,strTableName),PAGE_LIST),ArrayElement(ArrayElement(dpParams,"ids"),d)),"gridRows")
setArrElementN dControlsMap,CreateArray2(strTableName,"video"),ArrayElement(ArrayElement(ArrayElement(ArrayElement(listPageObject.controlsHTMLMap,strTableName),PAGE_LIST),ArrayElement(ArrayElement(dpParams,"ids"),d)),"video")
setArrElementN dControlsMap,CreateArray2(strTableName,"gMaps"),ArrayElement(ArrayElement(ArrayElement(ArrayElement(listPageObject.controlsHTMLMap,strTableName),PAGE_LIST),ArrayElement(ArrayElement(dpParams,"ids"),d)),"gMaps")
GetCollectionBounds ArrayElement(ArrayElement(listPageObject.jsSettings,"global"),"shortTNames"),edit_loopIdx8,edit_loopMax8
do while edit_loopIdx8<=edit_loopMax8
key = GetCollectionKey(ArrayElement(ArrayElement(listPageObject.jsSettings,"global"),"shortTNames"),edit_loopIdx8)
doAssignment val,ArrayElement(ArrayElement(ArrayElement(listPageObject.jsSettings,"global"),"shortTNames"),key)
if not bValue(asp_array_key_exists(key,ArrayElement(ArrayElement(pageObject.jsSettings,"global"),"shortTNames"))) then
setArrElementN pageObject.jsSettings,CreateArray3("global","shortTNames",key),val
end if
edit_loopIdx8=edit_loopIdx8+1
loop
pageObject.copyAllJSFiles_p1 listPageObject.grabAllJSFiles()
pageObject.copyAllCSSFiles_p1 listPageObject.grabAllCSSFiles()
end if
xt.assign_p2 "displayDetailTable_" & CSmartStr(GoodFieldName(strTableName)),CreateDictionary2("func","showDetailTable","params",CreateDictionary2("dpObject",listPageObject,"dpParams",strTableName))
loop while false
if edit_exitLoop6 then _
exit do
d = CSmartDbl(d)+1
loop
strTableName = "courses"
setArrElementN pageObject.controlsHTMLMap,CreateArray4(strTableName,PAGE_EDIT,id,"dControlsMap"),dControlsMap
end if
if IsEqual(inlineedit,EDIT_SIMPLE) then
setArrElementN pageObject.jsSettings,CreateArray2("global","idStartFrom"),CSmartDbl(flyId)+1
setArrElement pageObject.body,"end",CSmartStr(ArrayElement(pageObject.body,"end")) & ""
else
setArrElement returnJSON,"controlsMap",pageObject.controlsHTMLMap
setArrElement returnJSON,"settings",pageObject.jsSettings
end if
pageObject.addCommonJs
doAssignmentByRef jscode,pageObject.PrepareJS()
if IsEqual(inlineedit,EDIT_SIMPLE) then
setArrElement pageObject.body,"end",CSmartStr(ArrayElement(pageObject.body,"end")) & (("")
xt.assign_p2 "body",pageObject.body
xt.assign_p2 "flybody",true
else
if IsEqual(inlineedit,EDIT_POPUP) then
xt.assign_p2 "footer",""
xt.assign_p2 "flybody",pageObject.body
xt.assign_p2 "body",true
end if
end if
xt.assign_p2 "style_block",true
pageObject.xt.assign_p2 "legendBreak"," "
if bValue(eventObj.exists_p1("BeforeShowEdit")) then
eventObj.BeforeShowEdit_p3 xt,templatefile,data
end if
if IsEqual(inlineedit,EDIT_POPUP) then
xt.load_template_p1 templatefile
setArrElement returnJSON,"html",CSmartStr(xt.fetch_loaded_p1("style_block")) & CSmartStr(xt.fetch_loaded_p1("flybody"))
if bValue(pageObject.isShowDetailTables) then
setArrElement returnJSON,"html",CSmartStr(ArrayElement(returnJSON,"html")) & CSmartStr(xt.fetch_loaded_p1("detail_tables"))
end if
setArrElement returnJSON,"idStartFrom",CSmartDbl(flyId)+1
ResponseWrite my_json_encode(returnJSON)
else
if IsEqual(inlineedit,EDIT_INLINE) then
xt.load_template_p1 templatefile
setArrElement returnJSON,"html",CreateDictionary()
GetCollectionBounds editFields,edit_loopIdx9,edit_loopMax9
edit_exitLoop9=false
do while edit_loopIdx9<=edit_loopMax9
edit_exitLoop9=false
do
edit_arrKey9 = GetCollectionKey(editFields,edit_loopIdx9)
doAssignment fName,ArrayElement(editFields,edit_arrKey9)
if bValue(detailKeys) and bValue(asp_in_array(fName,detailKeys,false)) then
exit do
end if
setArrElementN returnJSON,CreateArray2("html",fName),xt.fetchVar_p1(CSmartStr(GoodFieldName(fName)) & "_editcontrol")
loop while false
if edit_exitLoop9 then _
exit do
edit_loopIdx9=edit_loopIdx9+1
loop
ResponseWrite my_json_encode(returnJSON)
else
xt.display_p1 templatefile
end if
end if
%>