Пример #1
0
 def get(self):
     getActivityId = int(str(self.request.url).split('/Sendmail/id_')[1])
     searchActivityInfos = Activitydb.gql("WHERE activity_id = :1",getActivityId)
     searchActivityInfo = searchActivityInfos.get()
     
     searchMailInfos = Maildb.all()  #get activity info.
     for searchinfo in searchMailInfos:
         name = searchinfo.name
         activity_name = searchActivityInfo.activity_name
         sign_start = str(searchActivityInfo.sign_start)
         sign_end = str(searchActivityInfo.sign_end)
         activity_start = str(searchActivityInfo.activity_start)
         activity_end = str(searchActivityInfo.activity_end)
         mail.send_mail(sender="*****@*****.**", #use admin mail
                        to=searchinfo.mail,
                        subject=u"[活動通知]"+activity_name+u"~ 準備開跑嚕!",
                        body=
                             name+ u" ,您好:"+"\n\n"
                             u"本團隊預定在 "+activity_start+u"將舉辦『" +activity_name + u"』活動"+ "\n"
                             u"報名的時間從 "+sign_start+ u"開放網路報名," + "\n"
                             u"由於名額有限,若有意願想參加,請儘速進入活動網頁報名。" + "\n\n"
                             u"\t詳細活動時間: "+ activity_start + " ~ " + activity_end + "\n"
                             u"\t詳細報名時間:"+ sign_start+ " ~ " +sign_end+"\n\n"
                             u"竭誠邀請您的參與\n\n輔大雲端服務中心 敬上\n\nhttp://xxxx.com" 
                         )
     self.redirect('/admin')
Пример #2
0
 def post(self):
     getId = int(self.request.get('activity_id'))
     deltemp = db.GqlQuery("SELECT * FROM Activitydb WHERE activity_id = :1",getId)
     result = deltemp.get()
     db.delete(result)
     
     activity = Activitydb()
     activity.activity_name = self.request.get('activity_name')
     activity.content = self.request.get('content')
     
     sign_start_Date = str(self.request.get('sign_StartDateTime')).split(" ")[0]
     sign_start_Time = str(self.request.get('sign_StartDateTime')).split(" ")[1]
     sign_end_Date = str(self.request.get('sign_EndDateTime')).split(" ")[0]
     sign_end_Time = str(self.request.get('sign_EndDateTime')).split(" ")[1]
     activity_start_Date = str(self.request.get('activity_StartDateTime')).split(" ")[0]
     activity_start_Time = str(self.request.get('activity_StartDateTime')).split(" ")[1]
     activity_end_Date = str(self.request.get('activity_EndDateTime')).split(" ")[0]
     activity_end_Time = str(self.request.get('activity_EndDateTime')).split(" ")[1]
     
     arr_sign_start_Date = str(sign_start_Date).split("-")
     arr_sign_start_Time = str(sign_start_Time).split(":")
     arr_sign_end_Date = str(sign_end_Date).split("-")
     arr_sign_end_Time = str(sign_end_Time).split(":")
     arr_activity_start_Date = str(activity_start_Date).split("-")
     arr_activity_start_Time = str(activity_start_Time).split(":")
     arr_activity_end_Date = str(activity_end_Date).split("-")
     arr_activity_end_Time = str(activity_end_Time).split(":")
     
     #input time formula: datetime.combine(Date,Time)
     #Date : date( int(Year),int(Month),int(Date) )   Time : time( int(hour),int(minute) )
     activity.sign_start = datetime.combine(date(int(arr_sign_start_Date[0]),int(arr_sign_start_Date[1]),int(arr_sign_start_Date[2])),time(int(arr_sign_start_Time[0]),int(arr_sign_start_Time[1]),int(arr_sign_start_Time[2])))
     activity.sign_end = datetime.combine(date(int(arr_sign_end_Date[0]),int(arr_sign_end_Date[1]),int(arr_sign_end_Date[2])),time(int(arr_sign_end_Time[0]),int(arr_sign_end_Time[1]),int(arr_sign_end_Time[2])))
     activity.activity_start = datetime.combine(date(int(arr_activity_start_Date[0]),int(arr_activity_start_Date[1]),int(arr_activity_start_Date[2])),time(int(arr_activity_start_Time[0]),int(arr_activity_start_Time[1]),int(arr_activity_start_Time[2])))
     activity.activity_end = datetime.combine(date(int(arr_activity_end_Date[0]),int(arr_activity_end_Date[1]),int(arr_activity_end_Date[2])),time(int(arr_activity_end_Time[0]),int(arr_activity_end_Time[1]),int(arr_activity_end_Time[2])))
     activity.site = self.request.get('site')
     activity.limit_num = int(self.request.get('limit_num'))
     activity.activity_id = int(self.request.get('activity_id'))
     activity.put()
     #self.redirect('/ActivityModify/Main')
     self.response.out.write( " <script> self.close(); </script> ")
Пример #3
0
    def post(self):
        activity = Activitydb()
        
        activity.activity_name = self.request.get('activity_name')
        activity.content = self.request.get('content')
        
        sign_start_Date = str(self.request.get('sign_StartDateTime')).split(" ")[0]
        sign_start_Time = str(self.request.get('sign_StartDateTime')).split(" ")[1]
        sign_end_Date = str(self.request.get('sign_EndDateTime')).split(" ")[0]
        sign_end_Time = str(self.request.get('sign_EndDateTime')).split(" ")[1]
        activity_start_Date = str(self.request.get('activity_StartDateTime')).split(" ")[0]
        activity_start_Time = str(self.request.get('activity_StartDateTime')).split(" ")[1]
        activity_end_Date = str(self.request.get('activity_EndDateTime')).split(" ")[0]
        activity_end_Time = str(self.request.get('activity_EndDateTime')).split(" ")[1]
        
        arr_sign_start_Date = str(sign_start_Date).split("-")
        arr_sign_start_Time = str(sign_start_Time).split(":")
        arr_sign_end_Date = str(sign_end_Date).split("-")
        arr_sign_end_Time = str(sign_end_Time).split(":")
        arr_activity_start_Date = str(activity_start_Date).split("-")
        arr_activity_start_Time = str(activity_start_Time).split(":")
        arr_activity_end_Date = str(activity_end_Date).split("-")
        arr_activity_end_Time = str(activity_end_Time).split(":")
        
        
        
        #input time formula: datetime.combine(Date,Time)
        #Date : date( int(Year),int(Month),int(Date) )   Time : time( int(hour),int(minute) )
        activity.sign_start = datetime.combine(date(int(arr_sign_start_Date[0]),int(arr_sign_start_Date[1]),int(arr_sign_start_Date[2])),time(int(arr_sign_start_Time[0]),int(arr_sign_start_Time[1]),int(arr_sign_start_Time[2])))
        activity.sign_end = datetime.combine(date(int(arr_sign_end_Date[0]),int(arr_sign_end_Date[1]),int(arr_sign_end_Date[2])),time(int(arr_sign_end_Time[0]),int(arr_sign_end_Time[1]),int(arr_sign_end_Time[2])))
        activity.activity_start = datetime.combine(date(int(arr_activity_start_Date[0]),int(arr_activity_start_Date[1]),int(arr_activity_start_Date[2])),time(int(arr_activity_start_Time[0]),int(arr_activity_start_Time[1]),int(arr_activity_start_Time[2])))
        activity.activity_end = datetime.combine(date(int(arr_activity_end_Date[0]),int(arr_activity_end_Date[1]),int(arr_activity_end_Date[2])),time(int(arr_activity_end_Time[0]),int(arr_activity_end_Time[1]),int(arr_activity_end_Time[2])))
        activity.site = self.request.get('site')

        if self.request.get('limit_num') != "" :
            activity.limit_num = int(self.request.get('limit_num'))
        #activity.activity_id = int(self.request.get('activity_id'))
        searchinfo = db.GqlQuery("SELECT * FROM Activitydb ORDER BY activity_id DESC")  #排序為了取的活動最大編號
        search_result = searchinfo.get();
        
        
            
        if self.request.get('activity_id') != "" :
            activity.activity_id = int(self.request.get('activity_id')) #使用基本設定<目前只容許到10000>
        else:
            if search_result == None:
                activity.activity_id = 10000;#第一筆活動
            else:
                activity.activity_id = search_result.activity_id+1 #目前設定
        
        activity.put()
        self.redirect('/Sendmail/id_'+str(activity.activity_id)) #to send mail<must to modify>