[Isocial-svn] SF.net SVN: isocial: [207] timesheet
Status: Pre-Alpha
Brought to you by:
aguidrevitch
From: <di...@us...> - 2008-05-15 18:21:20
|
Revision: 207 http://isocial.svn.sourceforge.net/isocial/?rev=207&view=rev Author: dim0s77 Date: 2008-05-15 11:20:44 -0700 (Thu, 15 May 2008) Log Message: ----------- discussion board: 'reply to topic' implemented Modified Paths: -------------- app/controllers/groupapp/board_controller.php app/locales/groupapp/board/ru.php app/views/groupapp/board/_menu.tpl app/views/groupapp/board/reply_to_post.tpl app/views/groupapp/board/reply_to_topic.tpl app/views/groupapp/board/show_topic.tpl app/views/groupapp/board/start_topic.tpl public/stylesheets/common/Form.css timesheet/dim0s77.txt Modified: app/controllers/groupapp/board_controller.php =================================================================== --- app/controllers/groupapp/board_controller.php 2008-05-15 17:15:37 UTC (rev 206) +++ app/controllers/groupapp/board_controller.php 2008-05-15 18:20:44 UTC (rev 207) @@ -12,8 +12,9 @@ 'include' => 'user' ) ); - $group = $this->GroupappGroup->findFirst(array( 'id = ?' => $this->params['id'] )); + $group = $this->GroupappGroup->find( $this->params['id'] ); $topics = array(); + $persons = array(); if(!empty($messages)) { foreach ($messages as $message_loop_key => $message) { if (!isset($topics[$message->topic_id])) { @@ -49,9 +50,10 @@ $member = $this->GroupappMember->findFirst(array( 'group_id' => $messages[0]->group_id, 'user_id' => $this->current_user->getId() )); - $group = $this->GroupappGroup->findFirst(array( 'id' => $messages[0]->group_id )); + $group = $this->GroupappGroup->find( $messages[0]->group_id ); if (($group && $group->access == 1) || $member) { $this->messages = $messages; + $this->group = $group; } else { $this->addError('_common', 'Access denied', 'Group id closed. You can\'t to see this topic'); } @@ -65,8 +67,8 @@ if (!empty($this->params['topic']) && !empty($this->params['topic']['group_id']) && !empty($this->params['topic']['body'])) { - if ( $group = $this->GroupappGroup->findFirst(array( 'id' => $this->params['topic']['group_id'] )) ) { - $member = $this->GroupappMember->findFirst(array( 'group_id' => $group->getId(), + if ( $this->group = $this->GroupappGroup->find( $this->params['topic']['group_id'] ) ) { + $member = $this->GroupappMember->findFirst(array( 'group_id' => $this->group->getId(), 'user_id' => $this->current_user->getId() )); if ($member) { @@ -88,8 +90,8 @@ } $this->addError('_common', 'Sending message error', 'please, try again'); } else if (!empty($this->params['id'])) { - if ( $group = $this->GroupappGroup->findFirst(array( 'id' => $this->params['id'] )) ) { - $this->topic = $group->message->build(); + if ( $this->group = $this->GroupappGroup->find( $this->params['id'] ) ) { + $this->topic = $this->group->message->build(); } } else { $this->addError('_common', 'Start topic error', 'please, specify group'); @@ -98,8 +100,44 @@ function reply_to_topic () { - if (!empty($this->params['id'])) { + if (!empty($this->params['topic']) && + !empty($this->params['topic']['group_id']) && + !empty($this->params['topic']['topic_id']) && + !empty($this->params['topic']['body'])) { + if ( $this->group = $this->GroupappGroup->find( $this->params['topic']['group_id'] ) ) { + $member = $this->GroupappMember->findFirst(array( 'group_id' => $this->group->getId(), + 'user_id' => $this->current_user->getId() + )); + if ($member) { + $message = $member->message->build(); + $message->setAttributes($this->params['topic']); + if ($message->save()) { + $this->redirectTo(array('action' => 'show_topic', 'id' => $message->topic_id)); + return; + } + } + } + $this->addError('_common', 'Sending message error', 'please, try again'); + } else if (!empty($this->params['id'])) { + $messages = $this->GroupappMessage->find('all', array( + 'conditions' => array("topic_id = ?", $this->params['id']) + ) + ); + if ($messages) { + $member = $this->GroupappMember->findFirst(array( 'group_id' => $messages[0]->group_id, + 'user_id' => $this->current_user->getId() + )); + $group = $this->GroupappGroup->find( $messages[0]->group_id ); + if (($group && $group->access == 1) || $member) { + $this->messages = $messages; + $this->group = $group; + } else { + $this->addError('_common', 'Access denied', 'Group id closed. You can\'t reply to this topic'); + } + return; + } } + $this->addError('_common', 'Topic not found', 'This topic is not founded'); } function reply_to_post () { Modified: app/locales/groupapp/board/ru.php =================================================================== --- app/locales/groupapp/board/ru.php 2008-05-15 17:15:37 UTC (rev 206) +++ app/locales/groupapp/board/ru.php 2008-05-15 18:20:44 UTC (rev 207) @@ -38,9 +38,12 @@ $dictionary['wrote'] = 'по теме'; $dictionary['replied to post'] = 'в ответ на сообщение'; $dictionary['Reply'] = 'Ответить'; +$dictionary['Post'] = 'Сообщение'; +$dictionary['Post reply'] = 'Ответить'; +$dictionary['Post Reply'] = 'Послать ответ'; +$dictionary['Your reply'] = 'Ваш ответ'; $dictionary['to Your Post'] = 'себе'; $dictionary['replies'] = 'ответов'; -$dictionary['Post'] = 'Сообщение'; $dictionary['Mark as Irrelevant'] = 'Пометить как неуместное'; $dictionary['Delete Post'] = 'Удалить сообщение'; $dictionary['Report'] = 'Пожаловаться'; Modified: app/views/groupapp/board/_menu.tpl =================================================================== --- app/views/groupapp/board/_menu.tpl 2008-05-15 17:15:37 UTC (rev 206) +++ app/views/groupapp/board/_menu.tpl 2008-05-15 18:20:44 UTC (rev 207) @@ -1,13 +1,20 @@ <div class="tabs"> <div class="left"> <ul class="toggle_tabs"> - <li class="first"><a href="/groupapp/board" class="<?= $controller->getActionName() == 'index' ? 'selected' : '' ?>">_{Discussion Board}</a></li><? - if ($controller->getActionName() == 'show_topic') { ?><li><a href="/groupapp/board/show_topic/{topic.id?}" class="last selected">_{Topic View}</a></li><? } ?> + <li class="first"><a href="/groupapp/board/{group.id?}" class="<?= $controller->getActionName() == 'index' ? 'selected' : '' ?>">_{Discussion Board}</a></li><? + if ($controller->getActionName() == 'show_topic' || + $controller->getActionName() == 'reply_to_topic' + ) { ?><li><a href="/groupapp/board/show_topic/{messages-0.topic_id?}" class="<?= $controller->getActionName() == 'show_topic' ? 'last selected' : '' ?>" >_{Topic View}</a></li><? } ?><? + if ($controller->getActionName() == 'reply_to_topic') { ?> + <li><a href="/groupapp/board/reply_to_topic/{messages-0.topic_id?}" class="last selected">_{Post Reply}</a></li> + <? } ?> </ul> </div> <div class="right"> <ul class="toggle_tabs"> - <li class="first last"><a href="/groupapp/board/start_topic" class="<?= $controller->getActionName() == 'start_topic' ? 'selected' : '' ?>">_{Start New Topic}</a></li> +<? if ($controller->getActionName() != 'reply_to_topic' && $controller->getActionName() != 'reply_to_post') { ?> + <li class="first last"><a href="/groupapp/board/start_topic/{group.id?}" class="<?= $controller->getActionName() == 'start_topic' ? 'selected' : '' ?>">_{Start New Topic}</a></li> +<? } ?> </ul> </div> </div> Modified: app/views/groupapp/board/reply_to_post.tpl =================================================================== --- app/views/groupapp/board/reply_to_post.tpl 2008-05-15 17:15:37 UTC (rev 206) +++ app/views/groupapp/board/reply_to_post.tpl 2008-05-15 18:20:44 UTC (rev 207) @@ -14,9 +14,10 @@ </div> <div class="formrow"> <label> - {?topic.group_id}<input id="topic_group_id" name="topic[group_id]" type="hidden" value="{topic.group_id?}" />{end} - {?topic.topic_id}<input id="topic_topic_id" name="topic[topic_id]" type="hidden" value="{topic.topic_id?}" />{end} - {?topic.reply_message_id}<input id="topic_reply_topic_id" name="topic[reply_message_id]" type="hidden" value="{topic.reply_message_id?}" />{end} + <!-- <?= $form_helper->hidden_field('topic', 'group_id', array('value' => $group->getId()))?> --> + <!-- {?topic.group_id}<input id="topic_group_id" name="topic[group_id]" type="hidden" value="{topic.group_id?}" />{end} --> + <!-- {?topic.topic_id}<input id="topic_topic_id" name="topic[topic_id]" type="hidden" value="{topic.topic_id?}" />{end} --> + <!-- {?topic.reply_message_id}<input id="topic_reply_topic_id" name="topic[reply_message_id]" type="hidden" value="{topic.reply_message_id?}" />{end} --> </label> <input class="submitinput" type="submit" value="_{Post}"> <input class="cancelinput" type="button" value="_{Cancel}"> Modified: app/views/groupapp/board/reply_to_topic.tpl =================================================================== --- app/views/groupapp/board/reply_to_topic.tpl 2008-05-15 17:15:37 UTC (rev 206) +++ app/views/groupapp/board/reply_to_topic.tpl 2008-05-15 18:20:44 UTC (rev 207) @@ -1,25 +1,33 @@ <?= $controller->renderPartial("head") ?> +{?messages} +<div class="submenu"> + <div class="menu_block"> + <div class="header">_{Topic}: <a href="/groupapp/board/show_topic/{messages-0.topic_id}">{messages-0.subject?}</a></div> + </div> +</div> +<div class="clearfix"></div> + <?= $controller->renderErrors() ?> -<form action="/groupapp/board/reply_to_topic" method="post"> +<form action="/groupapp/board/reply_to_topic/{messages-0.topic_id?}" method="post"> <div class="editform"> <div class="formrow"> - <label>_{Topic}:</label> - <?= $form_helper->text_field('topic', 'subject', array('class' => 'textinput'))?> - </div> - <div class="formrow"> - <label>_{Post}:</label> + <label> </label><span class="label">_{Your reply}</span><br> <?= $form_helper->text_area('topic', 'body', array('class' => 'textinput'))?> </div> <div class="formrow"> <label> - {?topic.group_id}<input id="topic_group_id" name="topic[group_id]" type="hidden" value="{topic.group_id?}" />{end} - {?topic.topic_id}<input id="topic_topic_id" name="topic[topic_id]" type="hidden" value="{topic.topic_id?}" />{end} - {?topic.reply_message_id}<input id="topic_reply_message_id" name="topic[reply_message_id]" type="hidden" value="{topic.reply_message_id?}" />{end} + <?= $form_helper->hidden_field('topic', 'group_id', array('value' => $messages[0]->group_id))?> + <?= $form_helper->hidden_field('topic', 'topic_id', array('value' => $messages[0]->topic_id))?> + <?= $form_helper->hidden_field('topic', 'subject', array('value' => $messages[0]->subject))?> </label> - <input class="submitinput" type="submit" value="_{Post}"> + <input class="submitinput" type="submit" value="_{Post reply}"> <input class="cancelinput" type="button" value="_{Cancel}"> </div> </div> </form> +<div class="clearfix"></div> +{else} +<?= $controller->renderErrors() ?> +{end} Modified: app/views/groupapp/board/show_topic.tpl =================================================================== --- app/views/groupapp/board/show_topic.tpl 2008-05-15 17:15:37 UTC (rev 206) +++ app/views/groupapp/board/show_topic.tpl 2008-05-15 18:20:44 UTC (rev 207) @@ -4,7 +4,7 @@ <div class="submenu"> <div class="menu_block"> - <div class="header">_{Topic}: {messages-0.subject?}</div> + <div class="header">_{Topic}: <a href="/groupapp/board/show_topic/{messages-0.topic_id}">{messages-0.subject?}</a></div> </div> <div class="menu_block right"> @@ -35,7 +35,7 @@ <div class="avatar"> <a href="/profile/show/{message.user_id?}"><img src="/images/nophoto_men_sm.gif" alt="" class=""></a> <div class="subtext">#{message_loop_counter}</div> - <input id="message_id{message.id?}" name="message_id{message.id?}" type="hidden" value="{message_loop_counter}" /> + <?= $form_helper->hidden_field('message_id', $message->id, array('value' => $message_loop_counter))?> </div> <div class="message"> @@ -45,7 +45,7 @@ <? } else { ?><a href="/profile/show/{message.user_id?}"><span class="other_user">{message.user.name?}</span></a><? } ?> </span> {?message.reply_message_id} - <span>_{replied to post} #<script>document.write($('message_id{message.reply_message_id?}').readAttribute('value'));</script></span> + <span>_{replied to post} #<script>document.write($('message_id_<?= $message->reply_message_id ?>').readAttribute('value'));</script></span> {else}_{wrote}{end} <div class="subtext">{message.created_at?}</div> </div> Modified: app/views/groupapp/board/start_topic.tpl =================================================================== --- app/views/groupapp/board/start_topic.tpl 2008-05-15 17:15:37 UTC (rev 206) +++ app/views/groupapp/board/start_topic.tpl 2008-05-15 18:20:44 UTC (rev 207) @@ -2,7 +2,7 @@ <?= $controller->renderErrors() ?> -<form action="/groupapp/board/start_topic" method="post"> +<form action="/groupapp/board/start_topic/{group.id?}" method="post"> <div class="editform"> <div class="formrow"> <label>_{Topic}:</label> @@ -14,7 +14,7 @@ </div> <div class="formrow"> <label> - {?topic.group_id}<input id="topic_group_id" name="topic[group_id]" type="hidden" value="{topic.group_id?}" />{end} + <?= $form_helper->hidden_field('topic', 'group_id', array('value' => $group->getId()))?> </label> <input class="submitinput" type="submit" value="_{Create new Topic}"> <input class="cancelinput" type="button" value="_{Cancel}"> Modified: public/stylesheets/common/Form.css =================================================================== --- public/stylesheets/common/Form.css 2008-05-15 17:15:37 UTC (rev 206) +++ public/stylesheets/common/Form.css 2008-05-15 18:20:44 UTC (rev 207) @@ -14,6 +14,12 @@ line-height: 16px; } +.editform .formrow .label { + font-weight: bold; + color: #666666; + padding: 3px 10px 3px 0px; +} + .formrow label { font-weight: bold; color: #666666; Modified: timesheet/dim0s77.txt =================================================================== --- timesheet/dim0s77.txt 2008-05-15 17:15:37 UTC (rev 206) +++ timesheet/dim0s77.txt 2008-05-15 18:20:44 UTC (rev 207) @@ -21,3 +21,4 @@ 2008-05-14,15:00,16:35,groupapp,RT:3,"discussions for group (replying to topic)" 2008-05-15,10:20,12:20,groupapp,RT:3,"discussion board: topics list" +2008-05-15,18:35,21:15,groupapp,RT:3,"discussion board: reply to topic" This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |