--- /dev/null
+<?php
+/**
+ * ¥á¥Ã¥»¡¼¥¸¡¡ÅÐÏ¿¡¦É½¼¨µ¡Ç½¡¡action¥¯¥é¥¹
+ * ¥á¥Ã¥»¡¼¥¸¾ðÊó¡¡³Îǧ¡¦ÅÐÏ¿½èÍý
+ * @package acs/webapp/modules/User/action
+ * @author nakau
+ * @since PHP 4.0
+ * @version $Revision: 1.1 $ $Date: 2008/03/06
+ */
+// $Id: MessagePreAction.class.php,v 1.1 2008/03/24 07:09:27 y-yuki Exp $
+
+
+class MessagePreAction extends BaseAction
+{
+ //field
+ var $form;
+
+ // POST
+ function execute() {
+ $context = $this->getContext();
+ $controller = $context->getController();
+ $request = $context->getRequest();
+ $user = $context->getUser();
+
+ //mode¡¡²èÌ̤ÎÁ«°Ü¤ò¼èÆÀ¤¹¤ë
+ $move_id = $request->getParameter('move_id');
+ // ¥æ¡¼¥¶¡¼¾ðÊó
+ $acs_user_info_row = $user->getAttribute('acs_user_info_row');
+ // ÂоݤȤʤëUserID¤ò¼èÆÀ
+ $user_community_id = $request->getParameter('id');
+ // ¥æ¡¼¥¶¾ðÊó
+ $target_user_info_row = ACSUser::get_user_info_row_by_user_community_id($user_community_id);
+ /* ÆþÎϲèÌ̤è¤ê */
+ if($move_id==1){
+ //¡ù¡ù¡¡¤³¤³¤«¤é¤Û¤ÜƱ¤¸
+ // ²èÌ̾å¤Î¥Õ¥©¡¼¥à¾ðÊó¤ò¼èÆÀ¤¹¤ë
+ $form['subject'] = $request->getParameter('subject'); //·ï̾¡§subject
+ $form['body'] = $request->getParameter('body'); //ÆâÍÆ¡§body
+ $form['info_mail'] = $request->getParameter('info_mail'); //¥á¡¼¥ëÄÌÃΡ§info_mail
+ $user->setAttribute('new_form_obj',$form);
+ $request->setAttribute('target_user_info_row', $target_user_info_row);
+ //¡ù¡ù¡¡¤³¤³¤Þ¤Ç¤Û¤ÜƱ¤¸
+ return View::SUCCESS;
+
+ /* ÅÐÏ¿³ÎÄê¥Ü¥¿¥ó¡Ö¤Ï¤¤¡×¤è¤ê */
+ }else if($move_id==2){
+ $acs_user_info_row = $user->getAttribute('acs_user_info_row');
+ $user_community_id = $request->getParameter('id');
+ //¡ù¡ù¡¡¤³¤³¤«¤é¤Û¤ÜƱ¤¸
+ // ²èÌ̾å¤Î¥Õ¥©¡¼¥à¾ðÊó¤ò¼èÆÀ¤¹¤ë
+ $form = $user->getAttribute('new_form_obj');
+ $new_file_obj = $form['file_obj'];
+ $form['user_community_id'] = $user_community_id;
+ $form['acs_user_info_id'] = $acs_user_info_row['user_community_id'];
+ //¡ù¡ù¡¡¤³¤³¤Þ¤Ç¤Û¤ÜƱ¤¸
+ // DB¤Ø¤Î½ñ¤¹þ¤ßÅù
+ ACSDB::_do_query("BEGIN");
+ // Message¥Æ¡¼¥Ö¥ë¾ðÊó
+ $ret = ACSMessage::set_message($form);
+ if($ret){
+ ACSDB::_do_query("COMMIT");
+ }else{
+ ACSDB::_do_query("ROLLBACK");
+ }
+
+ // ÄÌÃΥ᡼¥ëÁ÷¿®½èÍý
+ if ($form['info_mail'] == "on") {
+ ACSMessage::send_info_mail($ret, $form['user_community_id'], $form['acs_user_info_id']);
+ }
+
+ // ½ñ¤¹þ¤ß¸å¡¢GET¤Î½èÍý¤Ø
+ $action_url = $this->getControllerPath('User', 'MessageBox') . '&id=' . $acs_user_info_row['user_community_id'].'&move_id=2';
+ header("Location: $action_url");
+ }
+ }
+
+ function getRequestMethods() {
+ return Request::POST;
+ }
+
+ function validate () {
+ return TRUE;
+ }
+
+ function registerValidators (&$validatorManager) {
+ $context = $this->getContext();
+ $request = $context->getRequest();
+ $move_id = $request->getParameter('move_id');
+
+ // ÆþÎϲèÌ̤«¤é¤Î¾ì¹ç¤Î¤ß¡¢ÆþÎÏ¥Á¥§¥Ã¥¯¤ò¤¹¤ë
+ if ($move_id == 1) {
+ /* ɬ¿Ü¥Á¥§¥Ã¥¯ */
+ parent::regValidateName($validatorManager,
+ "subject",
+ true,
+ ACSMsg::get_msg('User', 'MessagePreAction.class.php', 'M001'));
+ }
+ }
+
+ function handleError () {
+ // ÆþÎϲèÌÌɽ¼¨
+ return $this->execute();
+ }
+
+ function isSecure () {
+ return false;
+ }
+
+ function getCredential() {
+ return array('EXECUTE');
+ }
+
+ function get_execute_privilege () {
+ $context = $this->getContext();
+ $user = $context->getUser();
+
+ // Èó¥í¥°¥¤¥ó¥æ¡¼¥¶¡¢ËܿͰʳ°¤ÏNG
+ if ($user->hasCredential('PUBLIC_USER')
+ || !$user->hasCredential('USER_PAGE_OWNER')) {
+ return false;
+ }
+ }
+}
+
+?>