| CoverName string `json:"coverName,omitempty"` | CoverName string `json:"coverName,omitempty"` | ||||
| //for web spa operation | //for web spa operation | ||||
| spaErrMsg []string | |||||
| spaFlashTitle string | |||||
| spaFlashMsg []string | |||||
| } | } | ||||
| func (m crmdMeeting) save() (newMeeting crmdMeeting, err error) { | func (m crmdMeeting) save() (newMeeting crmdMeeting, err error) { | ||||
| } | } | ||||
| func (m *crmdMeeting) clearSpaErr(e string) { | func (m *crmdMeeting) clearSpaErr(e string) { | ||||
| m.spaErrMsg = []string{} | |||||
| m.spaFlashMsg = []string{} | |||||
| } | } | ||||
| func (m *crmdMeeting) addSpaErr(e string) { | |||||
| m.spaErrMsg = append(m.spaErrMsg, e) | |||||
| func (m *crmdMeeting) addFlashMsg(e string) { | |||||
| m.spaFlashMsg = append(m.spaFlashMsg, e) | |||||
| } | } | ||||
| func (m crmdMeeting) ErrorMessage() string { | |||||
| v := strings.Join(m.spaErrMsg, "<br>") | |||||
| func (m crmdMeeting) FlashMessage() string { | |||||
| v := strings.Join(m.spaFlashMsg, "<br>") | |||||
| return v | return v | ||||
| } | } | ||||
| func (m crmdMeeting) FlashTitle() string { | |||||
| return m.spaFlashTitle | |||||
| } | |||||
| func (m *crmdMeeting) setFlashTitle(val string) string { | |||||
| m.spaFlashTitle = val | |||||
| return m.spaFlashTitle | |||||
| } | |||||
| func (m crmdMeeting) hasError() bool { | func (m crmdMeeting) hasError() bool { | ||||
| return len(m.spaErrMsg) > 0 | |||||
| return len(m.spaFlashMsg) > 0 | |||||
| } | } | ||||
| func (m crmdMeeting) CoverCacheURL() string { | func (m crmdMeeting) CoverCacheURL() string { |
| aftershow: function(){} //Function for after opening timepicker | aftershow: function(){} //Function for after opening timepicker | ||||
| }); | }); | ||||
| if ($("#errmsg").text() !="" && $("#errmsg").text() != "{{.ErrorMessage}}"){ | |||||
| if ($("#errmsg").text() !="" && $("#errmsg").text() != "{{.FlashMessage}}"){ | |||||
| $('#modalerr').modal('open'); | $('#modalerr').modal('open'); | ||||
| } | } | ||||
| console.log("spa ready"); | console.log("spa ready"); | ||||
| }); | }); | ||||
| $("form").submit(function(event){ | |||||
| if ( $(this).find("input.Iagree").is(":checked") == false) { | |||||
| alert("发起活动之前,请选择同意主办方须知"); | |||||
| event.preventDefault(); | |||||
| } | |||||
| }); | |||||
| closeWechatBrowser(); | closeWechatBrowser(); | ||||
| } | } | ||||
| }); | }); | ||||
| </script> | </script> | ||||
| </body> | </body> | ||||
| </html> | </html> |
| <!-- Modal Structure --> | <!-- Modal Structure --> | ||||
| <div id="modalerr" class="modal deep-orange"> | <div id="modalerr" class="modal deep-orange"> | ||||
| <div class="modal-content"> | <div class="modal-content"> | ||||
| <h5>您好</h5> | |||||
| <p id="errmsg">{{.ErrorMessage}}</p> | |||||
| <h5>{{.FlashTitle}}</h5> | |||||
| <p id="errmsg">{{.FlashMessage}}</p> | |||||
| </div> | </div> | ||||
| <div class="modal-footer"> | <div class="modal-footer"> | ||||
| <a href="#!" class="modal-action modal-close waves-effect waves-green btn-flat">知道了</a> | <a href="#!" class="modal-action modal-close waves-effect waves-green btn-flat">知道了</a> | ||||
| <script src="materialize/js/materialize.js"></script> | <script src="materialize/js/materialize.js"></script> | ||||
| <script src="index.js"></script> | <script src="index.js"></script> | ||||
| <script src="assets/js/spa.js"></script> | <script src="assets/js/spa.js"></script> | ||||
| <script type="text/javascript"> | |||||
| $("form").submit(function(event){ | |||||
| if ( $(this).find("input.Iagree").is(":checked") == false) { | |||||
| alert("发起活动之前,请选择同意主办方须知"); | |||||
| event.preventDefault(); | |||||
| } | |||||
| }); | |||||
| </script> | |||||
| </body> | </body> |
| {"files":{"edit.html":{"frameworks":["spa","pg.insight.events","pg.code-validator","pg.asset.manager","pg.project.items","mat0.97.5","pg.html","pg.components"],"last_page_width":896},"404.html":{"frameworks":["spa","pg.insight.events","pg.code-validator","pg.asset.manager","pg.project.items","mat0.97.5","pg.html","pg.components"],"last_page_width":1024},"livecast.html":{"frameworks":["spa","pg.insight.events","pg.code-validator","pg.project.items","pg.asset.manager","mat0.97.5","pg.html","pg.components"],"last_page_width":1024},"newEvents.html":{"frameworks":["spa","pg.insight.events","pg.code-validator","pg.project.items","pg.asset.manager","mat0.97.5","pg.html","pg.components"],"last_page_width":1024},"newevent.html":{"frameworks":["spa","pg.insight.events","pg.asset.manager","pg.code-validator","pg.project.items","mat0.97.5","pg.html","pg.components"],"last_page_width":1024},"editmeeting.html":{"frameworks":["spa","pg.insight.events","pg.asset.manager","pg.code-validator","pg.project.items","mat0.97.5","pg.html","pg.components"],"last_page_width":1024},"403.html":{"frameworks":["spa","pg.insight.events","pg.code-validator","pg.asset.manager","pg.project.items","mat0.97.5","pg.html","pg.components"],"last_page_width":1024},"400.html":{"frameworks":["spa","pg.insight.events","pg.code-validator","pg.asset.manager","pg.project.items","mat0.97.5","pg.html","pg.components"],"last_page_width":1024},"500.html":{"frameworks":["spa","pg.insight.events","pg.code-validator","pg.asset.manager","pg.project.items","mat0.97.5","pg.html","pg.components"],"last_page_width":1024}},"breakpoints":["28.875em","33.875em","35.875em","38.875em","40.125em","46.75em","360px","390px","420px","450px","480px","510px","540px","570px","601px","630px","660px","690px","720px","750px","780px","810px","840px","870px","900px","930px","960px","993px","1200px"],"frameworks":["spa","pg.insight.events","pg.asset.manager","pg.code-validator","pg.project.items","mat0.97.5","pg.html","pg.components"],"template_framework_id":"materialize"} | |||||
| {"files":{"edit.html":{"frameworks":["spa","pg.insight.events","pg.code-validator","pg.asset.manager","pg.project.items","mat0.97.5","pg.html","pg.components"],"last_page_width":896},"404.html":{"frameworks":["spa","pg.insight.events","pg.code-validator","pg.asset.manager","pg.project.items","mat0.97.5","pg.html","pg.components"],"last_page_width":1024},"livecast.html":{"frameworks":["spa","pg.insight.events","pg.code-validator","pg.project.items","pg.asset.manager","mat0.97.5","pg.html","pg.components"],"last_page_width":1024},"newEvents.html":{"frameworks":["spa","pg.insight.events","pg.code-validator","pg.project.items","pg.asset.manager","mat0.97.5","pg.html","pg.components"],"last_page_width":1024},"newevent.html":{"frameworks":["spa","pg.insight.events","pg.asset.manager","pg.code-validator","pg.project.items","mat0.97.5","pg.html","pg.components"],"last_page_width":1024},"editmeeting.html":{"frameworks":["spa","pg.insight.events","pg.asset.manager","pg.code-validator","pg.project.items","mat0.97.5","pg.html","pg.components"],"last_page_width":1024},"403.html":{"frameworks":["spa","pg.insight.events","pg.code-validator","pg.asset.manager","pg.project.items","mat0.97.5","pg.html","pg.components"],"last_page_width":1024},"400.html":{"frameworks":["spa","pg.insight.events","pg.code-validator","pg.asset.manager","pg.project.items","mat0.97.5","pg.html","pg.components"],"last_page_width":1024},"500.html":{"frameworks":["spa","pg.insight.events","pg.code-validator","pg.asset.manager","pg.project.items","mat0.97.5","pg.html","pg.components"],"last_page_width":1024}},"breakpoints":["28.875em","33.875em","35.875em","38.875em","40.125em","46.75em","360px","390px","420px","450px","480px","510px","540px","570px","601px","630px","660px","690px","720px","750px","780px","810px","840px","870px","900px","930px","960px","993px","1200px"],"frameworks":["spa","pg.insight.events","pg.code-validator","pg.asset.manager","pg.project.items","mat0.97.5","pg.html","pg.components"],"template_framework_id":"materialize"} |
| meeting.ID = m.ID | meeting.ID = m.ID | ||||
| updatedMeeting, err := meeting.save() | updatedMeeting, err := meeting.save() | ||||
| if err == nil { | if err == nil { | ||||
| updatedMeeting.setFlashTitle("成功保存") | |||||
| updatedMeeting.addFlashMsg("活动信息已经成功保存,其他校友可通过公众号查阅本活动信息") | |||||
| updatedMeeting.showEdit(w) | updatedMeeting.showEdit(w) | ||||
| return | return | ||||
| } | } | ||||
| if ok { | if ok { | ||||
| m.Name = val[0] | m.Name = val[0] | ||||
| } else { | } else { | ||||
| m.addSpaErr("活动主题/标题不能为空") | |||||
| m.addFlashMsg("活动主题/标题不能为空") | |||||
| } | } | ||||
| val, ok = form["description"] | val, ok = form["description"] | ||||
| if ok { | if ok { | ||||
| m.Description = val[0] | m.Description = val[0] | ||||
| } else { | } else { | ||||
| m.addSpaErr("清添加描述活动本身") | |||||
| m.addFlashMsg("清添加描述活动本身") | |||||
| } | } | ||||
| startdate, sok := form["startdate"] | startdate, sok := form["startdate"] | ||||
| if sok && hok && rok { | if sok && hok && rok { | ||||
| m.buildStartDate(startdate[0], starthour[0], duration[0]) | m.buildStartDate(startdate[0], starthour[0], duration[0]) | ||||
| } else { | } else { | ||||
| m.addSpaErr("活动日期,开始时间,持续时间 不能为空") | |||||
| m.addFlashMsg("活动日期,开始时间,持续时间 不能为空") | |||||
| } | } | ||||
| val, ok = form["venue"] | val, ok = form["venue"] | ||||
| if ok { | if ok { | ||||
| m.Venue = val[0] | m.Venue = val[0] | ||||
| } else { | } else { | ||||
| m.addSpaErr("请添加活动地点/集合地点") | |||||
| m.addFlashMsg("请添加活动地点/集合地点") | |||||
| } | } | ||||
| return !m.hasError() | return !m.hasError() | ||||
| value := strings.TrimSpace(date) + " " + strings.TrimSpace(hour) + " AEST" //Force Sydney time | value := strings.TrimSpace(date) + " " + strings.TrimSpace(hour) + " AEST" //Force Sydney time | ||||
| t, err := time.Parse(layout, value) | t, err := time.Parse(layout, value) | ||||
| if err != nil { | if err != nil { | ||||
| m.addSpaErr("开始日期,时间,无法识别") | |||||
| m.addFlashMsg("开始日期,时间,无法识别") | |||||
| return | return | ||||
| } | } | ||||
| utc, err := time.LoadLocation("UTC") | utc, err := time.LoadLocation("UTC") | ||||
| var hour, minute int | var hour, minute int | ||||
| cnt, err := fmt.Sscanf(duration, "%d:%d", &hour, &minute) | cnt, err := fmt.Sscanf(duration, "%d:%d", &hour, &minute) | ||||
| if cnt != 2 && err != nil { | if cnt != 2 && err != nil { | ||||
| m.addSpaErr("持续时间不正确") | |||||
| m.addFlashMsg("持续时间不正确") | |||||
| return | return | ||||
| } | } | ||||
| m.Duration = (hour * 3600) + (minute * 60) | m.Duration = (hour * 3600) + (minute * 60) |