X-Git-Url: http://git.sourceforge.jp/view?a=blobdiff_plain;f=PartsList%2FPartsList%2Fapp%2Fcontrollers%2FReplyController.scala;fp=PartsList%2FPartsList%2Fapp%2Fcontrollers%2FReplyController.scala;h=a7f0221de6318952d90f4f3d5d3da4238b35002e;hb=c5d629a927a71a4312a7a4983ce5ed5181fb87ad;hp=1cffdf5b1e96b3299d8e4f9028eb6e3fb84c7ef3;hpb=c3554f0c0f74f64743ec06c97d4d74ed650ec4d8;p=open-pdm-light%2FPartList.git diff --git a/PartsList/PartsList/app/controllers/ReplyController.scala b/PartsList/PartsList/app/controllers/ReplyController.scala index 1cffdf5..a7f0221 100644 --- a/PartsList/PartsList/app/controllers/ReplyController.scala +++ b/PartsList/PartsList/app/controllers/ReplyController.scala @@ -13,8 +13,12 @@ import controllers.services._ import org.squeryl._ import org.squeryl.PrimitiveTypeMode._ import scala.collection.immutable.Seq +import com.google.inject._ +import modules._ object ReplyController extends Controller{ + val inject = Guice.createInjector(new ServiceModules) + val sendMail = inject.getInstance(classOf[SendMail]) val replyRegistForm = Form( mapping( "message" -> nonEmptyText, @@ -32,7 +36,11 @@ object ReplyController extends Controller{ if(request == null) { Ok(views.html.errors.errorNotAuthentication()) } else { - Ok(views.html.createReplyForm(replyRegistForm, notifyId, replyId, replyType, partId, notifyType, state)) + var logInUser = UserForm("") + request.headers.get("remote_user").map { user => + logInUser = UserForm(user) + } + Ok(views.html.createReplyForm(replyRegistForm.fill(ReplyForm("", logInUser, null)), notifyId, replyId, replyType, partId, notifyType, state)) } } } @@ -62,9 +70,8 @@ object ReplyController extends Controller{ if(notifyType == 0 || notifyType == 1) { val targetPart = notify.part.head val users = targetPart.project.head.users - val sendMail = SendMail(2, replyUser.email, targetPart.id, 0, notifyType, state) for(user <- users) { - sendMail.sendMail(user.email) + sendMail.sendMail(2, replyUser.email, targetPart.id, 0, notifyType, state, user.email) } } // 設計変更通知/依頼の回答であれば、Notifyが紐付くDesin ChangeのdelRelation、addRelationの全ての上品番、 @@ -83,9 +90,8 @@ object ReplyController extends Controller{ usersBuffer.:+(user) } } - val sendMail = SendMail(2, replyUser.email, 0, notify.designCgange.head.id, notifyType, state) for(user <- usersBuffer.distinct) { - sendMail.sendMail(user.email) + sendMail.sendMail(2, replyUser.email, 0, notify.designCgange.head.id, notifyType, state, user.email) } } }