isocial-svn Mailing List for isocial (Page 10)
Status: Pre-Alpha
Brought to you by:
aguidrevitch
You can subscribe to this list here.
2008 |
Jan
|
Feb
(11) |
Mar
(80) |
Apr
(22) |
May
(90) |
Jun
(28) |
Jul
(33) |
Aug
(12) |
Sep
(3) |
Oct
|
Nov
|
Dec
|
---|
From: <di...@us...> - 2008-03-14 16:12:09
|
Revision: 79 http://isocial.svn.sourceforge.net/isocial/?rev=79&view=rev Author: dim0s77 Date: 2008-03-14 09:12:10 -0700 (Fri, 14 Mar 2008) Log Message: ----------- changed URL's in messages. added functionality to 'back' buttons and 'delete' links Modified Paths: -------------- app/controllers/message_controller.php app/locales/message/ru.php app/views/message/_rows.tpl app/views/message/show.tpl config/routes.php Modified: app/controllers/message_controller.php =================================================================== --- app/controllers/message_controller.php 2008-03-14 14:26:37 UTC (rev 78) +++ app/controllers/message_controller.php 2008-03-14 16:12:10 UTC (rev 79) @@ -10,10 +10,12 @@ function inbox () { $this->inbox_messages = $this->_getBoxMessages('inbox_message'); + $this->last_box = 'inbox'; } function outbox () { $this->outbox_messages = $this->_getBoxMessages('outbox_message'); + $this->last_box = 'outbox'; } function _getBoxMessages ($box_message) { @@ -90,15 +92,16 @@ } function show () { - if (!empty($this->params['t'])) { - $thread = $this->Message->findFirst(array('thread_id' => $this->params['t'] )); + if (!empty($this->params['id'])) { + $this->last_box = !empty($this->params['from']) ? $this->params['from'] : 'inbox'; + $thread = $this->Message->findFirst(array('thread_id' => $this->params['id'] )); $user_id = $this->current_user->getId(); if ($thread->sender_id == $user_id || $thread->recipient_id == $user_id ) { $recipient_id = $thread->sender_id == $user_id ? $thread->recipient_id : $thread->sender_id; $this->interlocutor = $this->User->findFirst(array( 'id' => $recipient_id)); $messages = $this->Message->find('all', array('conditions' => array('thread_id' => $thread->getId()), - 'order' => 'created_at', - 'include' => array('sender', 'recipient'))); + 'order' => 'created_at', + 'include' => array('sender', 'recipient'))); if(!empty($messages)) { foreach ($messages as $message_loop_key => $message) { if ($message->recipient_id == $this->current_user->getId()) { Modified: app/locales/message/ru.php =================================================================== --- app/locales/message/ru.php 2008-03-14 14:26:37 UTC (rev 78) +++ app/locales/message/ru.php 2008-03-14 16:12:10 UTC (rev 79) @@ -28,7 +28,9 @@ $dictionary['You'] = 'Вы'; $dictionary['and'] = 'и'; $dictionary['Reply'] = 'Ответ'; -$dictionary['Back to'] = 'Обратно во'; +$dictionary['Back'] = 'Обратно'; +$dictionary['to Inbox'] = 'во входящие'; +$dictionary['to Outbox'] = 'в отправленные'; $dictionary['Delete Thread'] = 'Удалить нить сообщений'; $dictionary['Are you sure you want to delete this thread'] = 'Вы уверены, что хотите удалить эту нить сообщений'; $dictionary['Delete Threads'] = 'Удалить нити'; Modified: app/views/message/_rows.tpl =================================================================== --- app/views/message/_rows.tpl 2008-03-14 14:26:37 UTC (rev 78) +++ app/views/message/_rows.tpl 2008-03-14 16:12:10 UTC (rev 79) @@ -25,10 +25,10 @@ </td> <td class="msg"> <div class="wrapper"> - <a href="/message/show?t={message.thread_id?}" class="subject">{message.subject?}</a> + <a href="/message/show/{last_box}/{message.thread_id?}" class="subject">{message.subject?}</a> <div class="body_wrap"> <? (utf8_strlen($message->body) > 47) ? $msg_body = utf8_substr($message->body, 0, 47) . " [..]" : $msg_body = $message->body; ?> - <a href="/message/show?t={message.thread_id?}" class="body">{msg_body?}</a> + <a href="/message/show/{last_box}/{message.thread_id?}" class="body">{msg_body?}</a> </div> </div> </td> Modified: app/views/message/show.tpl =================================================================== --- app/views/message/show.tpl 2008-03-14 14:26:37 UTC (rev 78) +++ app/views/message/show.tpl 2008-03-14 16:12:10 UTC (rev 79) @@ -11,16 +11,46 @@ <div class="reply_container"> <form id="reply_message_form" action="/message/show" method="post" onsubmit="return false;"> <label>_{Reply}:</label> - <?= $form_helper->text_area('message', 'body', array('class' => 'textinput'))?> + <textarea class="textinput" cols="40" id="message_body" name="message[body]" rows="20"></textarea> <input id="message_recipient" name="message[recipient]" type="hidden" value="{interlocutor.id}" /> <input id="message_thread_id" name="message[thread_id]" type="hidden" value="{messages-0.thread_id}" /> <input id="message_subject" name="message[subject]" type="hidden" value="re: {messages-0.subject}" /> <div class="divide_line"> </div> <div class="submits"> <input class="submitinput" type="submit" value="_{Send}" onclick="new Ajax.Updater('messages', '/message/reply', { method:'post', asynchronous:true, parameters:Form.serialize('reply_message_form')}); $('message_body').clear(); return false;"> - <input class="cancelinput" type="button" value="_{Back to} _{Inbox}" onclick=""> + <input class="cancelinput" type="button" value="_{Back} <? if ($last_box == 'outbox') { ?>_{to Outbox}<? } else { ?>_{to Inbox}<? } ?>" onclick="change_location('{last_box}')"> </div> - <div class="sub_controls"><a href="#" onclick="Element.show('dlg'); return false;">_{Delete}</a></div> + <div class="sub_controls"><a href="#" onclick="delete_single_thread(this)" name="{messages-0.id}">_{Delete}</a></div> </form> </div> </div> + +<script> +function delete_single_thread (element) { + new Dialog.Box({ + reference: element, + title: '_{Delete Thread}', + body: '_{Are you sure you want to delete this thread}?', + yes: '_{Delete}', + cancel: '_{Cancel}', + onYes : function () { + new Ajax.Updater('messages', + '/message/delete_inbox_thread', + { method:'post', + asynchronous:true, + parameters: 'check_messages[]=' + element.name, + onComplete: function () { + change_location({last_box}); + } + }); + } + }); + + return false; +} + +function change_location (loc) { + location.href="/message/" + loc; +} + +</script> Modified: config/routes.php =================================================================== --- config/routes.php 2008-03-14 14:26:37 UTC (rev 78) +++ config/routes.php 2008-03-14 16:12:10 UTC (rev 79) @@ -4,5 +4,6 @@ $Map->connect('/', array('controller' => 'default', 'action' => 'index')); $Map->connect('/:controller/:action/:id', array('controller' => 'default', 'action' => 'index')); +$Map->connect('/:controller/:action/:from/:id', array('controller' => 'message', 'action' => 'show')); ?> This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <agu...@us...> - 2008-03-14 14:26:31
|
Revision: 78 http://isocial.svn.sourceforge.net/isocial/?rev=78&view=rev Author: aguidrevitch Date: 2008-03-14 07:26:37 -0700 (Fri, 14 Mar 2008) Log Message: ----------- russian translations added Modified Paths: -------------- app/locales/message/ru.php Modified: app/locales/message/ru.php =================================================================== --- app/locales/message/ru.php 2008-03-14 13:58:15 UTC (rev 77) +++ app/locales/message/ru.php 2008-03-14 14:26:37 UTC (rev 78) @@ -31,6 +31,8 @@ $dictionary['Back to'] = 'Обратно во'; $dictionary['Delete Thread'] = 'Удалить нить сообщений'; $dictionary['Are you sure you want to delete this thread'] = 'Вы уверены, что хотите удалить эту нить сообщений'; +$dictionary['Delete Threads'] = 'Удалить нити'; +$dictionary['Are you sure you want to delete selected threads'] = 'Вы уверены, что хотите удалить выбранные нити сообщений'; $dictionary['sent you a message'] = 'прислал(а) Вам сообщение'; $dictionary['on'] = 'на'; $dictionary['To reply to this message, follow the link below'] = 'Чтобы ответить на это сообщение, следуйте по ссылке ниже'; This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <di...@us...> - 2008-03-14 14:05:56
|
Revision: 77 http://isocial.svn.sourceforge.net/isocial/?rev=77&view=rev Author: dim0s77 Date: 2008-03-14 06:58:15 -0700 (Fri, 14 Mar 2008) Log Message: ----------- Added links to users profile from messages box Modified Paths: -------------- app/views/message/_rows.tpl app/views/message/_thread.tpl Modified: app/views/message/_rows.tpl =================================================================== --- app/views/message/_rows.tpl 2008-03-14 12:30:54 UTC (rev 76) +++ app/views/message/_rows.tpl 2008-03-14 13:58:15 UTC (rev 77) @@ -18,9 +18,9 @@ ?> </td> <td class="checkbox"><input onclick="oncheck(this, {?message.is_read}{message.is_read}{else}0{end})" type="checkbox" class="check{?message.is_read}read{else}unread{end}" id="{message.id}" name="check_messages[]" value="{message.id}"></td> - <td class="profile_photo"><a href=""><img src="/images/nophoto_men_sm.gif" alt="" class=""></a></td> + <td class="profile_photo"><a href="/profile/show/{sender.id}"><img src="/images/nophoto_men_sm.gif" alt="" class=""></a></td> <td class="info"> - <span class="name"><? if ($target == 'recipient') { ?>_{To}: <? } ?><a href="">{sender.name?}</a></span> + <span class="name"><? if ($target == 'recipient') { ?>_{To}: <? } ?><a href="/profile/show/{sender.id}">{sender.name?}</a></span> <span class="datetime">{message.created_at?}</span> </td> <td class="msg"> Modified: app/views/message/_thread.tpl =================================================================== --- app/views/message/_thread.tpl 2008-03-14 12:30:54 UTC (rev 76) +++ app/views/message/_thread.tpl 2008-03-14 13:58:15 UTC (rev 77) @@ -1,14 +1,18 @@ <div class="head"> <h2 class="subject">{messages-0.subject}</h2> <div class="interlocutors">_{Between} - <a href="">_{You}</a> _{and} <a href="">{interlocutor.name}</a> + <? if ($messages[0]->sender->id == $interlocutor->id) { ?> + <a href="/profile/show/{interlocutor.id}">{interlocutor.name}</a> _{and} <a href="/profile/show/<?= $current_user->getId(); ?>">_{You}</a> + <? } else { ?> + <a href="/profile/show/<?= $current_user->getId(); ?>">_{You}</a> _{and} <a href="/profile/show/{interlocutor.id}">{interlocutor.name}</a> + <? } ?> </div> </div> {loop messages} <div class="message" id="msg{message_loop_counter}"> - <div class="message_author_pict"><a href=""><img src="/images/nophoto_men_sm.gif" alt="" class=""></a></div> + <div class="message_author_pict"><a href="/profile/show/{message.sender.id}"><img src="/images/nophoto_men_sm.gif" alt="" class=""></a></div> <div class="message_author_info"> - <div class="name"><a href="">{message.sender.name?}</a></div> + <div class="name"><a href="/profile/show/{message.sender.id}">{message.sender.name?}</a></div> <div class="date">{message.created_at?}</div> </div> <div class="message_body">{message.body?}</div> This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <agu...@us...> - 2008-03-14 12:30:52
|
Revision: 76 http://isocial.svn.sourceforge.net/isocial/?rev=76&view=rev Author: aguidrevitch Date: 2008-03-14 05:30:54 -0700 (Fri, 14 Mar 2008) Log Message: ----------- basic profile installer fixed Modified Paths: -------------- app/installers/basic_profile_installer.php Modified: app/installers/basic_profile_installer.php =================================================================== --- app/installers/basic_profile_installer.php 2008-03-14 09:59:17 UTC (rev 75) +++ app/installers/basic_profile_installer.php 2008-03-14 12:30:54 UTC (rev 76) @@ -15,7 +15,6 @@ `updated_at` datetime NOT NULL, FOREIGN KEY (user_id) REFERENCES users(id), FOREIGN KEY (sex_id) REFERENCES sexes(id), - FOREIGN KEY (country_id) REFERENCES countries(id), FOREIGN KEY (city_id) REFERENCES cities(id), FOREIGN KEY (political_view_id) REFERENCES political_views(id) ) ENGINE=InnoDB"); This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <agu...@us...> - 2008-03-14 09:59:15
|
Revision: 75 http://isocial.svn.sourceforge.net/isocial/?rev=75&view=rev Author: aguidrevitch Date: 2008-03-14 02:59:17 -0700 (Fri, 14 Mar 2008) Log Message: ----------- minor profile updates Modified Paths: -------------- app/controllers/profile_controller.php config/routes.php Added Paths: ----------- app/views/profile/show.tpl Modified: app/controllers/profile_controller.php =================================================================== --- app/controllers/profile_controller.php 2008-03-13 20:22:12 UTC (rev 74) +++ app/controllers/profile_controller.php 2008-03-14 09:59:17 UTC (rev 75) @@ -5,8 +5,14 @@ var $models = array('User', 'BasicProfile', 'Sex', 'Country', 'City', 'PoliticalView', 'ReligiousView'); function index () { + $this->redirectTo(array('action' => 'show')); } + function show () { + $id = !empty($this->params['id']) ? $this->params['id'] : $this->current_user->getId(); + $this->user = $this->User->find($id); + } + function basic () { $this->basic_profile = $this->current_user->basic_profile->load(); if (!empty($this->params['basic_profile'])) { Added: app/views/profile/show.tpl =================================================================== --- app/views/profile/show.tpl (rev 0) +++ app/views/profile/show.tpl 2008-03-14 09:59:17 UTC (rev 75) @@ -0,0 +1 @@ +<?= $user->email ?> \ No newline at end of file Modified: config/routes.php =================================================================== --- config/routes.php 2008-03-13 20:22:12 UTC (rev 74) +++ config/routes.php 2008-03-14 09:59:17 UTC (rev 75) @@ -2,7 +2,7 @@ // You can find more about routes on /lib/AkRouters.php and /test/test_AkRouter.php +$Map->connect('/', array('controller' => 'default', 'action' => 'index')); $Map->connect('/:controller/:action/:id', array('controller' => 'default', 'action' => 'index')); -$Map->connect('/', array('controller' => 'default', 'action' => 'index')); ?> This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <agu...@us...> - 2008-03-13 20:22:08
|
Revision: 74 http://isocial.svn.sourceforge.net/isocial/?rev=74&view=rev Author: aguidrevitch Date: 2008-03-13 13:22:12 -0700 (Thu, 13 Mar 2008) Log Message: ----------- further city_helper improvements, basic profile saving partially works Modified Paths: -------------- app/application_controller.php app/controllers/profile_controller.php app/helpers/auto_complete_helper.php app/helpers/city_helper.php app/installers/basic_profile_installer.php app/installers/city_installer.php app/locales/profile/ru.php app/models/city.php app/models/user.php app/views/profile/basic.tpl app/views/profile/personal.tpl localities_to_sql.pl public/javascripts/autocomplete.js Added Paths: ----------- app/models/basic_profile.php Modified: app/application_controller.php =================================================================== --- app/application_controller.php 2008-03-13 14:22:40 UTC (rev 73) +++ app/application_controller.php 2008-03-13 20:22:12 UTC (rev 74) @@ -193,7 +193,8 @@ array( 'conditions' => $conditions, 'include' => 'country', - 'limit' => 10 + 'limit' => 10, + 'order' => 'is_native DESC, name' ) ); $this->renderText( $this->city_helper->auto_complete_result($entries, $query, $this->params['city']) ); Modified: app/controllers/profile_controller.php =================================================================== --- app/controllers/profile_controller.php 2008-03-13 14:22:40 UTC (rev 73) +++ app/controllers/profile_controller.php 2008-03-13 20:22:12 UTC (rev 74) @@ -2,27 +2,35 @@ class ProfileController extends ApplicationController { - var $models = 'user, basic_profile, sex, country, city, political_view, religious_view'; + var $models = array('User', 'BasicProfile', 'Sex', 'Country', 'City', 'PoliticalView', 'ReligiousView'); function index () { } function basic () { + $this->basic_profile = $this->current_user->basic_profile->load(); + if (!empty($this->params['basic_profile'])) { + $this->BasicProfile->setAttributes($this->params['basic_profile']); + $this->BasicProfile->user->assign($this->current_user); + if ($this->Request->isPost() && $this->BasicProfile->save()) { + $this->redirectTo(array('action' => 'basic')); + } + } } function auto_complete_for_basic_religious_view () { - if (empty($this->params['basic']['religious_view'])) { + if (empty($this->params['basic_profile']['religious_view'])) { echo 1; $this->renderNothing(); } else { $entries = $this->ReligiousView->find('all', array('conditions' => array( - 'name LIKE ?', '%' . $this->params['basic']['religious_view'] . '%' + 'name LIKE ?', '%' . $this->params['basic_profile']['religious_view'] . '%' ), ) ); - $this->renderText( $this->auto_complete_helper->auto_complete_result($entries, 'name', $this->params['basic']['religious_view']) ); + $this->renderText( $this->auto_complete_helper->auto_complete_result($entries, 'name', $this->params['basic_profile']['religious_view']) ); } } Modified: app/helpers/auto_complete_helper.php =================================================================== --- app/helpers/auto_complete_helper.php 2008-03-13 14:22:40 UTC (rev 73) +++ app/helpers/auto_complete_helper.php 2008-03-13 20:22:12 UTC (rev 74) @@ -28,7 +28,7 @@ } } - $function .= ', '.JavaScriptHelper::_options_for_javascript($js_options).')'; + $function .= ', '.JavaScriptHelper::_options_for_javascript($js_options).');'; return JavaScriptHelper::javascript_tag($function); } Modified: app/helpers/city_helper.php =================================================================== --- app/helpers/city_helper.php 2008-03-13 14:22:40 UTC (rev 73) +++ app/helpers/city_helper.php 2008-03-13 20:22:12 UTC (rev 74) @@ -24,7 +24,15 @@ function city_field($object, $method, $tag_options = array(), $completion_options = array()) { + $this->object =& $this->_controller->{$object}; + $this->value = ''; + if ($this->object && $city_id = $this->object->get($method)) { + $city = $this->_controller->City->find($city_id); + $this->value = $city->name; + } + $tag_options = array_merge(array( + 'value' => $this->value, 'name' => "city", 'id' => "auto_{$object}_{$method}", 'onblur' => "city_updated(this, '{$object}_{$method}_prev', '{$object}_{$method}')", @@ -39,8 +47,8 @@ ), $completion_options); $hidden = $this->_controller->form_helper->hidden_field($object, $method); - $hidden_prev = $this->_controller->form_helper->hidden_field($object, $method, array('id' => "{$object}_{$method}_prev", 'name' => "{$object}_{$method}_prev")); - $text_field = $this->_controller->form_helper->text_field($object, $method, $tag_options); + $hidden_prev = $this->_controller->form_helper->hidden_field(null, null, array('id' => "{$object}_{$method}_prev", 'name' => "{$object}_{$method}_prev", 'value' => $this->value)); + $text_field = $this->_controller->form_helper->text_field(null, null, $tag_options); $div = TagHelper::content_tag('div', '', array('id' => "auto_{$object}_{$method}_auto_complete", 'class' => 'auto_complete')); $javascript = $this->auto_complete_field("auto_{$object}_{$method}", $completion_options); Modified: app/installers/basic_profile_installer.php =================================================================== --- app/installers/basic_profile_installer.php 2008-03-13 14:22:40 UTC (rev 73) +++ app/installers/basic_profile_installer.php 2008-03-13 20:22:12 UTC (rev 74) @@ -8,9 +8,8 @@ `id` int(11) NOT NULL PRIMARY KEY AUTO_INCREMENT, `user_id` int(11) NOT NULL, `sex_id` int(11), - `country_id` int(11), `city_id` int(11), - `birthdate` datetime DEFAULT NULL, + `birthdate` date DEFAULT NULL, `political_view_id` int(11), `created_at` datetime NOT NULL, `updated_at` datetime NOT NULL, Modified: app/installers/city_installer.php =================================================================== --- app/installers/city_installer.php 2008-03-13 14:22:40 UTC (rev 73) +++ app/installers/city_installer.php 2008-03-13 20:22:12 UTC (rev 74) @@ -11,10 +11,10 @@ `first_id` int(11), `second_id` int(11), `third_id` int(11), - `is_alternative` bool NOT NULL DEFAULT 0, + `is_native` bool NOT NULL DEFAULT 0, `name` char(100) NOT NULL DEFAULT '', INDEX oid_idx (oid), - INDEX name_idx (name), + INDEX name_idx (name, first_id), FOREIGN KEY (country_id) REFERENCES countries(id) ) ENGINE=InnoDB"); Modified: app/locales/profile/ru.php =================================================================== --- app/locales/profile/ru.php 2008-03-13 14:22:40 UTC (rev 73) +++ app/locales/profile/ru.php 2008-03-13 20:22:12 UTC (rev 74) @@ -43,5 +43,9 @@ $dictionary['Interests'] = 'Интересы'; $dictionary['Favorite Music'] = 'Любимая музыка'; $dictionary['Favorite TV Shows'] = 'Любимые ТВ шоу'; +$dictionary['Favorite Movies'] = 'Любимые фильмы'; +$dictionary['Favorite Books'] = 'Любимые книги'; +$dictionary['Favorite Quotes'] = 'Любимые цитаты'; +$dictionary['About me'] = 'Обо мне'; ?> Added: app/models/basic_profile.php =================================================================== --- app/models/basic_profile.php (rev 0) +++ app/models/basic_profile.php 2008-03-13 20:22:12 UTC (rev 74) @@ -0,0 +1,8 @@ +<?php + +class BasicProfile extends ActiveRecord +{ + var $belongs_to = array('User', 'City'); +} + +?> Modified: app/models/city.php =================================================================== --- app/models/city.php 2008-03-13 14:22:40 UTC (rev 73) +++ app/models/city.php 2008-03-13 20:22:12 UTC (rev 74) @@ -2,7 +2,7 @@ class City extends ActiveRecord { - var $belongs_to = array('country'); + var $belongs_to = array('Country'); } ?> Modified: app/models/user.php =================================================================== --- app/models/user.php 2008-03-13 14:22:40 UTC (rev 73) +++ app/models/user.php 2008-03-13 20:22:12 UTC (rev 74) @@ -11,6 +11,8 @@ 'foreign_key' => 'recipient_id', 'conditions' => 'is_recipient_del = 0'), ); + + var $has_one = array('basic_profile'); function login($email, $password) { return $this->findFirst(array( 'email' => $email, 'password' => md5($password) )); Modified: app/views/profile/basic.tpl =================================================================== --- app/views/profile/basic.tpl 2008-03-13 14:22:40 UTC (rev 73) +++ app/views/profile/basic.tpl 2008-03-13 20:22:12 UTC (rev 74) @@ -7,23 +7,23 @@ <div class="editform"> <div class="formrow"> <label>_{Sex}:</label> - <?= $form_options_helper->select('basic', 'sex_id', $Sex->collect($Sex->find(), 'name', 'id'), array(), array('prompt' => $controller->t('Select Sex:')) )?> + <?= $form_options_helper->select('basic_profile', 'sex_id', $Sex->collect($Sex->find(), 'name', 'id'), array(), array('prompt' => $controller->t('Select Sex:')) )?> </div> <div class="formrow"> <label>_{Birthday}:</label> - <?= $date_helper->date_select('basic', 'birthdate', array('start_year' => 1940) )?> + <?= $date_helper->date_select('basic_profile', 'birthdate', array('start_year' => 1940) )?> </div> <div class="formrow"> <label>_{Hometown}:</label> - <?= $city_helper->city_field('basic', 'city', array('class' => 'autocomplete')); ?> + <?= $city_helper->city_field('basic_profile', 'city_id', array('class' => 'autocomplete')); ?> </div> <div class="formrow"> <label>_{Political views}:</label> - <?= $form_options_helper->select('basic', 'political_view_id', $PoliticalView->collect($PoliticalView->find(), 'name', 'id'), array(), array('prompt' => $controller->t('Select Political Views:')) )?> + <?= $form_options_helper->select('basic_profile', 'political_view_id', $PoliticalView->collect($PoliticalView->find(), 'name', 'id'), array(), array('prompt' => $controller->t('Select Political Views:')) )?> </div> <div class="formrow"> <label>_{Religious views}:</label> - <?= $auto_complete_helper->text_field_with_auto_complete('basic', 'religious_view', array('autocomplete' => 'on', 'class' => 'autocomplete'), array('skip_style' => true) )?> + <?= $auto_complete_helper->text_field_with_auto_complete('basic_profile', 'religious_view', array('autocomplete' => 'on', 'class' => 'autocomplete'), array('skip_style' => true) )?> </div> <div class="formrow"> <label></label> Modified: app/views/profile/personal.tpl =================================================================== --- app/views/profile/personal.tpl 2008-03-13 14:22:40 UTC (rev 73) +++ app/views/profile/personal.tpl 2008-03-13 20:22:12 UTC (rev 74) @@ -25,6 +25,26 @@ </div> <div class="formrow"> + <label>_{Favorite Movies}:</label> + <?= $form_helper->text_area('personal', 'movies')?> + </div> + + <div class="formrow"> + <label>_{Favorite Books}:</label> + <?= $form_helper->text_area('personal', 'books')?> + </div> + + <div class="formrow"> + <label>_{Favorite Quotes}:</label> + <?= $form_helper->text_area('personal', 'quotes')?> + </div> + + <div class="formrow"> + <label>_{About me}:</label> + <?= $form_helper->text_area('personal', 'about')?> + </div> + + <div class="formrow"> <label></label> <input class="submitinput" type="submit" value="_{Save Changes}"> <input class="cancelinput" type="button" value="_{Cancel}"> Modified: localities_to_sql.pl =================================================================== --- localities_to_sql.pl 2008-03-13 14:22:40 UTC (rev 73) +++ localities_to_sql.pl 2008-03-13 20:22:12 UTC (rev 74) @@ -34,14 +34,21 @@ my $second_id = defined $data[10] && $other{$data[10]} ? $other{$data[10]} : 'NULL'; my $third_id = defined $data[11] && $other{$data[11]} ? $other{$data[11]} : 'NULL'; - my @names = ($data[1], split(/\s*,\s*/, $data[2]), split(/\s*,\s*/, $data[3])); my $i = 0; - foreach my $name (@names) { - my $is_alt = $i > 0 ? 1 : 0; + foreach my $name ($data[1], split(/\s*,\s*/, $data[2])) { $name =~ s/\"/'/g; - print "INSERT INTO cities VALUES ($id, $oid, $country_id, $first_id, $second_id, $third_id, $is_alt, \"$name\");\n"; + print "INSERT INTO cities VALUES ($id, $oid, $country_id, $first_id, $second_id, $third_id, 0, \"$name\");\n"; $id++; $i++; } + + foreach my $name (split(/\s*,\s*/, $data[3])) { + $name =~ s/\"/'/g; + print "INSERT INTO cities VALUES ($id, $oid, $country_id, $first_id, $second_id, $third_id, 1, \"$name\");\n"; + $id++; + $i++; + } + + } } Modified: public/javascripts/autocomplete.js =================================================================== --- public/javascripts/autocomplete.js 2008-03-13 14:22:40 UTC (rev 73) +++ public/javascripts/autocomplete.js 2008-03-13 20:22:12 UTC (rev 74) @@ -8,7 +8,7 @@ }, onComplete: function(request) { - alert(requist.responseText); + //alert(requist.responseText); this.updateChoices(request.responseText); } This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <di...@us...> - 2008-03-13 14:22:34
|
Revision: 73 http://isocial.svn.sourceforge.net/isocial/?rev=73&view=rev Author: dim0s77 Date: 2008-03-13 07:22:40 -0700 (Thu, 13 Mar 2008) Log Message: ----------- send email after messaging Modified Paths: -------------- app/controllers/message_controller.php app/locales/message/ru.php Added Paths: ----------- app/views/message/email/ app/views/message/email/send.tpl Modified: app/controllers/message_controller.php =================================================================== --- app/controllers/message_controller.php 2008-03-13 13:29:50 UTC (rev 72) +++ app/controllers/message_controller.php 2008-03-13 14:22:40 UTC (rev 73) @@ -46,12 +46,12 @@ if (!$message->thread_id) { $message->thread_id = $message->getId(); if ($message->save()) { + $this->message = $message; + $this->sendMail( $recipient->email ); $this->redirectTo(array('action' => 'send_successfully')); return; } } - $this->redirectTo(array('action' => 'send_successfully')); - return; } } $this->addError('_common', 'Sending message error', 'please, try again'); @@ -66,6 +66,8 @@ $message->recipient->assign($recipient); $message->setAttributes($this->params['message']); if ($message->save()) { + $this->message = $message; + $this->sendMail( $recipient->email, 'email/send' ); $thread_id = $this->params['message']['thread_id']; $thread = $this->Message->findFirst(array('thread_id' => $thread_id )); $user_id = $this->current_user->getId(); Modified: app/locales/message/ru.php =================================================================== --- app/locales/message/ru.php 2008-03-13 13:29:50 UTC (rev 72) +++ app/locales/message/ru.php 2008-03-13 14:22:40 UTC (rev 73) @@ -31,5 +31,8 @@ $dictionary['Back to'] = 'Обратно во'; $dictionary['Delete Thread'] = 'Удалить нить сообщений'; $dictionary['Are you sure you want to delete this thread'] = 'Вы уверены, что хотите удалить эту нить сообщений'; +$dictionary['sent you a message'] = 'прислал(а) Вам сообщение'; +$dictionary['on'] = 'на'; +$dictionary['To reply to this message, follow the link below'] = 'Чтобы ответить на это сообщение, следуйте по ссылке ниже'; ?> Added: app/views/message/email/send.tpl =================================================================== --- app/views/message/email/send.tpl (rev 0) +++ app/views/message/email/send.tpl 2008-03-13 14:22:40 UTC (rev 73) @@ -0,0 +1,13 @@ +Subject: <?= $controller->current_user->name ?> _{sent you a message} _{on} iSocial... +From: iSocial <no-...@ma...> + +<?= $controller->current_user->name ?> _{sent you a message}. + +<p>{message.subject}</p> +<p>"{message.body}"</p> + +<p>_{To reply to this message, follow the link below}:<br> +<? $link = AK_SITE_URL . "message/show?t=" . $message->thread_id ?> +<a href="{link}">{link}</a>.</p> + + This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <agu...@us...> - 2008-03-13 13:29:45
|
Revision: 72 http://isocial.svn.sourceforge.net/isocial/?rev=72&view=rev Author: aguidrevitch Date: 2008-03-13 06:29:50 -0700 (Thu, 13 Mar 2008) Log Message: ----------- autocomplete / city autocomplete fixed Modified Paths: -------------- app/application_controller.php app/controllers/profile_controller.php app/helpers/auto_complete_helper.php app/views/profile/basic.tpl public/javascripts/autocomplete.js Modified: app/application_controller.php =================================================================== --- app/application_controller.php 2008-03-13 11:34:29 UTC (rev 71) +++ app/application_controller.php 2008-03-13 13:29:50 UTC (rev 72) @@ -172,6 +172,33 @@ function _to_base64_utf8 ($value) { return "=?utf-8?B?" . base64_encode($value) . "?="; } + + function auto_complete_for_city () { + if (empty($this->params['city'])) { + $this->renderNothing(); + } else { + $query = $this->params['city']; + $aquery = utf8_to_ascii($query); + if ($aquery != $query) { + $conditions = array( + 'first_id IS NOT NULL AND name LIKE ? OR name LIKE ?', $query . '%', $aquery . '%' + ); + } else { + $conditions = array( + 'first_id IS NOT NULL AND name LIKE ?', $query . '%' + ); + } + + $entries = $this->City->find('all', + array( + 'conditions' => $conditions, + 'include' => 'country', + 'limit' => 10 + ) + ); + $this->renderText( $this->city_helper->auto_complete_result($entries, $query, $this->params['city']) ); + } + } function unread_messages_count () { return $this->current_user ? $this->Message->unread_messages_count($this->current_user->getId()) : 0; Modified: app/controllers/profile_controller.php =================================================================== --- app/controllers/profile_controller.php 2008-03-13 11:34:29 UTC (rev 71) +++ app/controllers/profile_controller.php 2008-03-13 13:29:50 UTC (rev 72) @@ -10,35 +10,9 @@ function basic () { } - function auto_complete_for_basic_city () { - if (empty($this->params['basic']['city'])) { - $this->renderNothing(); - } else { - $query = $this->params['basic']['city']; - $aquery = utf8_to_ascii($query); - if ($aquery != $query) { - $conditions = array( - 'first_id IS NOT NULL AND name LIKE ? OR name LIKE ?', $query . '%', $aquery . '%' - ); - } else { - $conditions = array( - 'first_id IS NOT NULL AND name LIKE ?', $query . '%' - ); - } - - $entries = $this->City->find('all', - array( - 'conditions' => $conditions, - 'include' => 'country', - 'limit' => 10 - ) - ); - $this->renderText( $this->_city_auto_complete_result($entries, $query) ); - } - } - function auto_complete_for_basic_religious_view () { if (empty($this->params['basic']['religious_view'])) { + echo 1; $this->renderNothing(); } else { $entries = $this->ReligiousView->find('all', @@ -48,7 +22,7 @@ ), ) ); - $this->renderText( $this->_auto_complete_result($entries, 'name', $this->params['basic']['religious_view']) ); + $this->renderText( $this->auto_complete_helper->auto_complete_result($entries, 'name', $this->params['basic']['religious_view']) ); } } Modified: app/helpers/auto_complete_helper.php =================================================================== --- app/helpers/auto_complete_helper.php 2008-03-13 11:34:29 UTC (rev 71) +++ app/helpers/auto_complete_helper.php 2008-03-13 13:29:50 UTC (rev 72) @@ -32,17 +32,13 @@ return JavaScriptHelper::javascript_tag($function); } - function auto_complete_result($entries, $phrase = null) + function auto_complete_result($entries, $field, $phrase = null) { - if (empty($entres)) { + if (empty($entries)) { return ''; } foreach ($entries as $entry) { - $name = !empty($phrase) - ? TextHelper::highlight( TextHelper::h($entry->name), $phrase) - : TextHelper::h($entry->name); - $item = TagHelper::content_tag('div', $name); - $items[] = TagHelper::content_tag('li', $item); + $items[] = TagHelper::content_tag('li',!empty($phrase) ? TextHelper::highlight(TextHelper::h($entry->get($field)), $phrase) : TextHelper::h(@$entry->get($field))); } return TagHelper::content_tag('ul', join('', array_unique($items))); } Modified: app/views/profile/basic.tpl =================================================================== --- app/views/profile/basic.tpl 2008-03-13 11:34:29 UTC (rev 71) +++ app/views/profile/basic.tpl 2008-03-13 13:29:50 UTC (rev 72) @@ -17,10 +17,6 @@ <label>_{Hometown}:</label> <?= $city_helper->city_field('basic', 'city', array('class' => 'autocomplete')); ?> </div> - <div id="basic_country_div" class="formrow" style="display:none"> - <label>_{Country}:</label> - <?= $form_options_helper->select('basic', 'country_id', $Country->collect($Country->find('all', array('order' => 'name')), 'name', 'id'), array(), array('prompt' => $controller->t('Select Country:')) )?> - </div> <div class="formrow"> <label>_{Political views}:</label> <?= $form_options_helper->select('basic', 'political_view_id', $PoliticalView->collect($PoliticalView->find(), 'name', 'id'), array(), array('prompt' => $controller->t('Select Political Views:')) )?> Modified: public/javascripts/autocomplete.js =================================================================== --- public/javascripts/autocomplete.js 2008-03-13 11:34:29 UTC (rev 71) +++ public/javascripts/autocomplete.js 2008-03-13 13:29:50 UTC (rev 72) @@ -5,7 +5,13 @@ stopIndicator: function() { if(this.options.indicator) Element.removeClassName(this.options.indicator, 'loading'); + }, + + onComplete: function(request) { + alert(requist.responseText); + this.updateChoices(request.responseText); } + }); function city_updated (input, prev, hidden) { This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <agu...@us...> - 2008-03-13 11:34:23
|
Revision: 71 http://isocial.svn.sourceforge.net/isocial/?rev=71&view=rev Author: aguidrevitch Date: 2008-03-13 04:34:29 -0700 (Thu, 13 Mar 2008) Log Message: ----------- Opera javascript fixes Modified Paths: -------------- app/views/message/outbox.tpl public/javascripts/autocomplete.js public/javascripts/dialog.js Modified: app/views/message/outbox.tpl =================================================================== --- app/views/message/outbox.tpl 2008-03-13 11:21:12 UTC (rev 70) +++ app/views/message/outbox.tpl 2008-03-13 11:34:29 UTC (rev 71) @@ -99,7 +99,7 @@ } } ); - }, + } }); return false; } Modified: public/javascripts/autocomplete.js =================================================================== --- public/javascripts/autocomplete.js 2008-03-13 11:21:12 UTC (rev 70) +++ public/javascripts/autocomplete.js 2008-03-13 11:34:29 UTC (rev 71) @@ -5,7 +5,7 @@ stopIndicator: function() { if(this.options.indicator) Element.removeClassName(this.options.indicator, 'loading'); - }, + } }); function city_updated (input, prev, hidden) { Modified: public/javascripts/dialog.js =================================================================== --- public/javascripts/dialog.js 2008-03-13 11:21:12 UTC (rev 70) +++ public/javascripts/dialog.js 2008-03-13 11:34:29 UTC (rev 71) @@ -24,7 +24,7 @@ Object.extend(this.dialog.style, { position: 'absolute', - zIndex: 9999, + zIndex: 9999 }); var offset = this.reference.viewportOffset(); @@ -57,21 +57,21 @@ default: this.yesButton.value = this.options.yes; this.yesButton.observe('click', this.onYes.bind(this)); - } + }; switch (this.options.no) { case 0, false, undefined: this.noButton.hide(); break; default: this.noButton.value = this.options.no; this.noButton.observe('click', this.onNo.bind(this)); - } + }; switch (this.options.cancel) { case 0, false, undefined: this.cancelButton.hide(); break; default: this.cancelButton.value = this.options.cancel; this.cancelButton.observe('click', this.onCancel.bind(this)); - } + }; this.dialog.show(); This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <agu...@us...> - 2008-03-13 11:31:47
|
Revision: 70 http://isocial.svn.sourceforge.net/isocial/?rev=70&view=rev Author: aguidrevitch Date: 2008-03-13 04:21:12 -0700 (Thu, 13 Mar 2008) Log Message: ----------- dialogs work in Konqueror now Modified Paths: -------------- public/javascripts/dialog.js Modified: public/javascripts/dialog.js =================================================================== --- public/javascripts/dialog.js 2008-03-13 10:27:24 UTC (rev 69) +++ public/javascripts/dialog.js 2008-03-13 11:21:12 UTC (rev 70) @@ -43,13 +43,15 @@ this.dialog.style.bottom = offset.top + "px"; } - this.dialog.down('#dlgheader').innerHTML = this.options.title; - this.dialog.down('#dlgbody').innerHTML = this.options.body; - - this.yesButton = this.dialog.down('#dlgyes'); - this.noButton = this.dialog.down('#dlgno'); - this.cancelButton = this.dialog.down('#dlgcancel'); + this.title = this._getDescendant('dlgheader'); + this.body = this._getDescendant('dlgbody'); + this.yesButton = this._getDescendant('dlgyes'); + this.noButton = this._getDescendant('dlgno'); + this.cancelButton = this._getDescendant('dlgcancel'); + this.title.innerHTML = this.options.title; + this.body.innerHTML = this.options.body; + switch (this.options.yes) { case 0, false, undefined: this.yesButton.hide(); break; default: @@ -75,6 +77,11 @@ }, + _getDescendant: function (id) { + return this.dialog.down('#' + id) || + this.dialog.descendants().find( function (d) { return d.id == id; }); + }, + onYes: function (event) { this.dialog.hide(); if (this.options.onYes) { This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <di...@us...> - 2008-03-13 10:27:19
|
Revision: 69 http://isocial.svn.sourceforge.net/isocial/?rev=69&view=rev Author: dim0s77 Date: 2008-03-13 03:27:24 -0700 (Thu, 13 Mar 2008) Log Message: ----------- added deleted dialog for inbox messages Modified Paths: -------------- app/controllers/message_controller.php app/models/message.php app/views/message/inbox.tpl app/views/message/outbox.tpl Modified: app/controllers/message_controller.php =================================================================== --- app/controllers/message_controller.php 2008-03-12 20:37:58 UTC (rev 68) +++ app/controllers/message_controller.php 2008-03-13 10:27:24 UTC (rev 69) @@ -160,20 +160,20 @@ function _delete_thread () { if (!empty($this->params['check_messages'])) { $threads = $this->Message->find('all', - array('conditions' => - array("id IN (" . $this->Message->_make_in_statement_from_array('id', $this->params['check_messages']) . ") AND sender_id = ? OR recipient_id = ?", - $this->current_user->getId(), $this->current_user->getId() - ) - ) - ); + array('conditions' => + array("id IN (" . $this->Message->_make_in_statement_from_array('id', $this->params['check_messages']) . ") AND (sender_id = ? OR recipient_id = ?)", + $this->current_user->getId(), $this->current_user->getId() + ) + ) + ); if ($threads) { foreach ($threads as $thread_loop_key => $thread) { $this->Message->updateAll("is_sender_del = 1", "sender_id = " . $this->current_user->getId() . " AND thread_id = " . $thread->thread_id); $this->Message->updateAll("is_recipient_del = 1", "recipient_id = " . $this->current_user->getId() . " AND thread_id = " . $thread->thread_id); - $thread->reload(); - if ($thread->is_sender_del && $thread->is_recipient_del) { + $thread->reload(); + if ($thread->is_sender_del && $thread->is_recipient_del) { $this->Message->destroyAll("thread_id = " . $thread->thread_id); - } + } } } } Modified: app/models/message.php =================================================================== --- app/models/message.php 2008-03-12 20:37:58 UTC (rev 68) +++ app/models/message.php 2008-03-13 10:27:24 UTC (rev 69) @@ -6,7 +6,7 @@ 'recipient' => array('class_name' => 'User', 'primary_key_name' => 'recipient_id')); function unread_messages_count ( $recipient_id ) { - return $this->count('id', array('conditions' => array("recipient_id = ? AND is_read = 0", $recipient_id))); + return $this->count('id', array('conditions' => array("recipient_id = ? AND is_read = 0 AND is_recipient_del = 0", $recipient_id))); } } Modified: app/views/message/inbox.tpl =================================================================== --- app/views/message/inbox.tpl 2008-03-12 20:37:58 UTC (rev 68) +++ app/views/message/inbox.tpl 2008-03-13 10:27:24 UTC (rev 69) @@ -86,33 +86,54 @@ } function delete_threads (element) { - new Ajax.Updater('messages', - '/message/delete_inbox_thread', - { method:'post', - asynchronous:true, - parameters:$('messages_form').serialize(), - onSuccess: function () { - disable_action_links(); - } - }); + new Dialog.Box({ + reference: element, + title: '_{Delete Threads}', + body: '_{Are you sure you want to delete selected threads}?', + yes: '_{Delete}', + cancel: '_{Cancel}', + onYes : function () { + new Ajax.Updater('messages', + '/message/delete_inbox_thread', + { method:'post', + asynchronous:true, + parameters:$('messages_form').serialize(), + onSuccess: function () { + disable_action_links(); + } + }); + } + }); + return false; } function delete_single_thread (element) { - new Ajax.Updater('messages', - '/message/delete_inbox_thread', - { method:'post', - asynchronous:true, - parameters: 'check_messages[]=' + element.name, - onComplete: function () { - disable_action_links(); - tocheck = new Array(); - $$('input[type=checkbox]').each( function (el) { - if (checkids.indexOf(el.value) != -1) { tocheck.push(el); } + new Dialog.Box({ + reference: element, + title: '_{Delete Thread}', + body: '_{Are you sure you want to delete this thread}?', + yes: '_{Delete}', + cancel: '_{Cancel}', + onYes : function () { + new Ajax.Updater('messages', + '/message/delete_inbox_thread', + { method:'post', + asynchronous:true, + parameters: 'check_messages[]=' + element.name, + onComplete: function () { + disable_action_links(); + tocheck = new Array(); + $$('input[type=checkbox]').each( + function (el) { + if (checkids.indexOf(el.value) != -1) { tocheck.push(el); } + }); + tocheck.invoke('click'); + } }); - tocheck.invoke('click'); - } - }); + } + }); + return false; } Modified: app/views/message/outbox.tpl =================================================================== --- app/views/message/outbox.tpl 2008-03-12 20:37:58 UTC (rev 68) +++ app/views/message/outbox.tpl 2008-03-13 10:27:24 UTC (rev 69) @@ -53,6 +53,12 @@ function delete_threads (element) { new Dialog.Box({ + reference: element, + title: '_{Delete Threads}', + body: '_{Are you sure you want to delete selected threads}?', + yes: '_{Delete}', + cancel: '_{Cancel}', + hfloat: 'left', onYes : function () { new Ajax.Updater('messages', '/message/delete_outbox_thread', @@ -73,23 +79,24 @@ new Dialog.Box({ reference: element, title: '_{Delete Thread}', - body: '_{Are you sure you want to delete this thread} ?', + body: '_{Are you sure you want to delete this thread}?', yes: '_{Delete}', - cancel: '_{Cancel}', + cancel: '_{Cancel}', onYes : function () { - new Ajax.Updater('messages', - '/message/delete_outbox_thread', - { method:'post', - asynchronous:true, - parameters: 'check_messages[]=' + element.name, - onComplete: function () { - $("delete_link").addClassName('disabled'); - tocheck = new Array(); - $$('input[type=checkbox]').each( function (el) { - if (checkids.indexOf(el.value) != -1) { tocheck.push(el); } - }); - tocheck.invoke('click'); - } + new Ajax.Updater('messages', + '/message/delete_outbox_thread', + { method:'post', + asynchronous:true, + parameters: 'check_messages[]=' + element.name, + onComplete: function () { + $("delete_link").addClassName('disabled'); + tocheck = new Array(); + $$('input[type=checkbox]').each( + function (el) { + if (checkids.indexOf(el.value) != -1) { tocheck.push(el); } + }); + tocheck.invoke('click'); + } } ); }, This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <agu...@us...> - 2008-03-12 20:37:53
|
Revision: 68 http://isocial.svn.sourceforge.net/isocial/?rev=68&view=rev Author: aguidrevitch Date: 2008-03-12 13:37:58 -0700 (Wed, 12 Mar 2008) Log Message: ----------- initial upload of javascript dialogs Modified Paths: -------------- app/views/layouts/application.tpl app/views/message/outbox.tpl app/views/message/show.tpl Added Paths: ----------- app/views/shared/dialog.tpl public/javascripts/dialog.js Modified: app/views/layouts/application.tpl =================================================================== --- app/views/layouts/application.tpl 2008-03-11 20:13:41 UTC (rev 67) +++ app/views/layouts/application.tpl 2008-03-12 20:37:58 UTC (rev 68) @@ -9,6 +9,7 @@ <script src="/javascripts/prototype.js" type="text/javascript"></script> <script src="/javascripts/scriptaculous.js?load=effects,controls,autocomplete" type="text/javascript"></script> <script src="/javascripts/autocomplete.js" type="text/javascript"></script> +<script src="/javascripts/dialog.js" type="text/javascript"></script> <script type="text/javascript"> function push_onload_handler (func) { if (!window._onload) window._onload = []; @@ -57,5 +58,6 @@ </div> </div> </div> +<?= $controller->renderShared('dialog') ?> </body> </html> Modified: app/views/message/outbox.tpl =================================================================== --- app/views/message/outbox.tpl 2008-03-11 20:13:41 UTC (rev 67) +++ app/views/message/outbox.tpl 2008-03-12 20:37:58 UTC (rev 68) @@ -52,7 +52,9 @@ }; function delete_threads (element) { - new Ajax.Updater('messages', + new Dialog.Box({ + onYes : function () { + new Ajax.Updater('messages', '/message/delete_outbox_thread', { method:'post', asynchronous:true, @@ -60,12 +62,22 @@ onSuccess: function () { $("delete_link").addClassName('disabled'); } - }); + } + ); + } + }); return false; } function delete_single_thread (element) { - new Ajax.Updater('messages', + new Dialog.Box({ + reference: element, + title: '_{Delete Thread}', + body: '_{Are you sure you want to delete this thread} ?', + yes: '_{Delete}', + cancel: '_{Cancel}', + onYes : function () { + new Ajax.Updater('messages', '/message/delete_outbox_thread', { method:'post', asynchronous:true, @@ -78,7 +90,10 @@ }); tocheck.invoke('click'); } - }); + } + ); + }, + }); return false; } Modified: app/views/message/show.tpl =================================================================== --- app/views/message/show.tpl 2008-03-11 20:13:41 UTC (rev 67) +++ app/views/message/show.tpl 2008-03-12 20:37:58 UTC (rev 68) @@ -24,12 +24,3 @@ </form> </div> </div> - -<div class="action_dialog" id="dlg"> - <div class="header">_{Delete Thread}</div> - <div class="body">_{Are you sure you want to delete this thread}?</div> - <div class="footer"><div class="buttons"> - <input class="submitinput" type="button" value="_{Delete}"> - <input class="cancelinput" type="button" value="_{Cancel}"> - </div></div> -</div> Added: app/views/shared/dialog.tpl =================================================================== --- app/views/shared/dialog.tpl (rev 0) +++ app/views/shared/dialog.tpl 2008-03-12 20:37:58 UTC (rev 68) @@ -0,0 +1,12 @@ +<div id="dlg" class="action_dialog" style="display: none"> + <div id="dlgheader" class="header"> </div> + <div id="dlgbody" class="body"> </div> + <div id="dlgfooter" class="footer"> + <div id="dlgbuttons" class="buttons"> + <input id="dlgyes" class="submitinput" type="button" value="_{Yes}"> + <input id="dlgno" class="submitinput" type="button" value="_{No}"> + <input id="dlgcancel" class="cancelinput" type="button" value="_{Cancel}"> + </div> + </div> +</div> + Added: public/javascripts/dialog.js =================================================================== --- public/javascripts/dialog.js (rev 0) +++ public/javascripts/dialog.js 2008-03-12 20:37:58 UTC (rev 68) @@ -0,0 +1,99 @@ +var Dialog = {}; +Dialog.Box = Class.create(); +Object.extend(Dialog.Box.prototype, { + initialize: function(options) { + + this.options = Object.extend({ + hfloat: 'right', + vfloat: 'bottom' + }, options || {}); + + if (! this.options['reference']) { + alert('Reference element is not specified'); + return; + } + + this.reference = $(this.options['reference']); + if (!this.reference) { + alert('Reference element is not specified'); + return; + } + + this.dialog = Element.extend($('dlg').cloneNode(true)); + document.body.appendChild(this.dialog); + + Object.extend(this.dialog.style, { + position: 'absolute', + zIndex: 9999, + }); + + var offset = this.reference.viewportOffset(); + var dimensions = this.reference.getDimensions(); + var vdimensions = document.viewport.getDimensions(); + + if (this.options['hfloat'] == 'right') { + this.dialog.style.right = vdimensions.width - offset.left - dimensions.width + "px"; + } else { + this.dialog.style.left = offset.left + "px"; + } + + if (this.options['vfloat'] == 'bottom') { + this.dialog.style.top = offset.top + dimensions.height + "px"; + } else { + this.dialog.style.bottom = offset.top + "px"; + } + + this.dialog.down('#dlgheader').innerHTML = this.options.title; + this.dialog.down('#dlgbody').innerHTML = this.options.body; + + this.yesButton = this.dialog.down('#dlgyes'); + this.noButton = this.dialog.down('#dlgno'); + this.cancelButton = this.dialog.down('#dlgcancel'); + + switch (this.options.yes) { + case 0, false, undefined: this.yesButton.hide(); break; + default: + this.yesButton.value = this.options.yes; + this.yesButton.observe('click', this.onYes.bind(this)); + } + + switch (this.options.no) { + case 0, false, undefined: this.noButton.hide(); break; + default: + this.noButton.value = this.options.no; + this.noButton.observe('click', this.onNo.bind(this)); + } + + switch (this.options.cancel) { + case 0, false, undefined: this.cancelButton.hide(); break; + default: + this.cancelButton.value = this.options.cancel; + this.cancelButton.observe('click', this.onCancel.bind(this)); + } + + this.dialog.show(); + + }, + + onYes: function (event) { + this.dialog.hide(); + if (this.options.onYes) { + this.options.onYes(event) + } + }, + onNo: function (event) { + this.dialog.hide(); + if (this.options.onNo) { + this.options.onNo(event) + } + }, + onCancel: function (event) { + this.dialog.hide(); + if (this.options.onCancel) { + this.options.onCancel(event) + } + } + + +}); + \ No newline at end of file This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <agu...@us...> - 2008-03-11 20:13:56
|
Revision: 67 http://isocial.svn.sourceforge.net/isocial/?rev=67&view=rev Author: aguidrevitch Date: 2008-03-11 13:13:41 -0700 (Tue, 11 Mar 2008) Log Message: ----------- thread deletion improvements Modified Paths: -------------- app/controllers/message_controller.php Modified: app/controllers/message_controller.php =================================================================== --- app/controllers/message_controller.php 2008-03-11 20:05:46 UTC (rev 66) +++ app/controllers/message_controller.php 2008-03-11 20:13:41 UTC (rev 67) @@ -170,7 +170,10 @@ foreach ($threads as $thread_loop_key => $thread) { $this->Message->updateAll("is_sender_del = 1", "sender_id = " . $this->current_user->getId() . " AND thread_id = " . $thread->thread_id); $this->Message->updateAll("is_recipient_del = 1", "recipient_id = " . $this->current_user->getId() . " AND thread_id = " . $thread->thread_id); - $this->Message->destroyAll("is_sender_del = 1 AND is_recipient_del = 1 AND thread_id = " . $thread->thread_id); + $thread->reload(); + if ($thread->is_sender_del && $thread->is_recipient_del) { + $this->Message->destroyAll("thread_id = " . $thread->thread_id); + } } } } This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <agu...@us...> - 2008-03-11 20:07:07
|
Revision: 63 http://isocial.svn.sourceforge.net/isocial/?rev=63&view=rev Author: aguidrevitch Date: 2008-03-11 12:52:18 -0700 (Tue, 11 Mar 2008) Log Message: ----------- deletion problems fixed Modified Paths: -------------- app/controllers/message_controller.php Modified: app/controllers/message_controller.php =================================================================== --- app/controllers/message_controller.php 2008-03-11 19:36:02 UTC (rev 62) +++ app/controllers/message_controller.php 2008-03-11 19:52:18 UTC (rev 63) @@ -160,15 +160,17 @@ function _delete_thread () { if (!empty($this->params['check_messages'])) { $threads = $this->Message->find('all', - array('conditions' => array("id IN (" . $this->Message->_make_in_statement_from_array('id', $this->params['check_messages']) . ")", ))); + array('conditions' => + array("id IN (" . $this->Message->_make_in_statement_from_array('id', $this->params['check_messages']) . ") AND sender_id = ? OR recipient_id = ?", + $this->current_user->getId(), $this->current_user->getId() + ) + ) + ); if ($threads) { foreach ($threads as $thread_loop_key => $thread) { - if ($thread->sender_id == $this->current_user->getId() || - $thread->recipient_id == $this->current_user->getId()) { - $is_del = $thread->sender_id == $this->current_user->getId() ? 'is_sender_del' : 'is_recipient_del'; - $this->Message->updateAll("$is_del = 1", "thread_id = " . $thread->getId()); - $this->Message->destroyAll("is_sender_del = 1 AND is_recipient_del = 1"); - } + $is_del = $thread->sender_id == $this->current_user->getId() ? 'is_sender_del' : 'is_recipient_del'; + $this->Message->updateAll("$is_del = 1", "thread_id = " . $thread->thread_id); + $this->Message->destroyAll("is_sender_del = 1 AND is_recipient_del = 1", "thread_id = " . $thread->thread_id); } } } This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <agu...@us...> - 2008-03-11 20:06:45
|
Revision: 66 http://isocial.svn.sourceforge.net/isocial/?rev=66&view=rev Author: aguidrevitch Date: 2008-03-11 13:05:46 -0700 (Tue, 11 Mar 2008) Log Message: ----------- deletion problems fixed, try 4 Modified Paths: -------------- app/controllers/message_controller.php Modified: app/controllers/message_controller.php =================================================================== --- app/controllers/message_controller.php 2008-03-11 20:02:15 UTC (rev 65) +++ app/controllers/message_controller.php 2008-03-11 20:05:46 UTC (rev 66) @@ -168,10 +168,8 @@ ); if ($threads) { foreach ($threads as $thread_loop_key => $thread) { - list($user_col, $del_col) = $thread->sender_id == $this->current_user->getId() - ? array('sender_id', 'is_sender_del') - : array('recipient_id', 'is_recipient_del'); - $this->Message->updateAll("$del_col = 1", "$user_col = " . $this->current_user->getId() . " AND thread_id = " . $thread->thread_id); + $this->Message->updateAll("is_sender_del = 1", "sender_id = " . $this->current_user->getId() . " AND thread_id = " . $thread->thread_id); + $this->Message->updateAll("is_recipient_del = 1", "recipient_id = " . $this->current_user->getId() . " AND thread_id = " . $thread->thread_id); $this->Message->destroyAll("is_sender_del = 1 AND is_recipient_del = 1 AND thread_id = " . $thread->thread_id); } } This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <agu...@us...> - 2008-03-11 20:02:20
|
Revision: 65 http://isocial.svn.sourceforge.net/isocial/?rev=65&view=rev Author: aguidrevitch Date: 2008-03-11 13:02:15 -0700 (Tue, 11 Mar 2008) Log Message: ----------- deletion problems fixed, try 3 Modified Paths: -------------- app/controllers/message_controller.php Modified: app/controllers/message_controller.php =================================================================== --- app/controllers/message_controller.php 2008-03-11 19:54:15 UTC (rev 64) +++ app/controllers/message_controller.php 2008-03-11 20:02:15 UTC (rev 65) @@ -168,8 +168,10 @@ ); if ($threads) { foreach ($threads as $thread_loop_key => $thread) { - $is_del = $thread->sender_id == $this->current_user->getId() ? 'is_sender_del' : 'is_recipient_del'; - $this->Message->updateAll("$is_del = 1", "thread_id = " . $thread->thread_id); + list($user_col, $del_col) = $thread->sender_id == $this->current_user->getId() + ? array('sender_id', 'is_sender_del') + : array('recipient_id', 'is_recipient_del'); + $this->Message->updateAll("$del_col = 1", "$user_col = " . $this->current_user->getId() . " AND thread_id = " . $thread->thread_id); $this->Message->destroyAll("is_sender_del = 1 AND is_recipient_del = 1 AND thread_id = " . $thread->thread_id); } } This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <agu...@us...> - 2008-03-11 19:54:12
|
Revision: 64 http://isocial.svn.sourceforge.net/isocial/?rev=64&view=rev Author: aguidrevitch Date: 2008-03-11 12:54:15 -0700 (Tue, 11 Mar 2008) Log Message: ----------- deletion problems fixed, try 2 Modified Paths: -------------- app/controllers/message_controller.php Modified: app/controllers/message_controller.php =================================================================== --- app/controllers/message_controller.php 2008-03-11 19:52:18 UTC (rev 63) +++ app/controllers/message_controller.php 2008-03-11 19:54:15 UTC (rev 64) @@ -170,7 +170,7 @@ foreach ($threads as $thread_loop_key => $thread) { $is_del = $thread->sender_id == $this->current_user->getId() ? 'is_sender_del' : 'is_recipient_del'; $this->Message->updateAll("$is_del = 1", "thread_id = " . $thread->thread_id); - $this->Message->destroyAll("is_sender_del = 1 AND is_recipient_del = 1", "thread_id = " . $thread->thread_id); + $this->Message->destroyAll("is_sender_del = 1 AND is_recipient_del = 1 AND thread_id = " . $thread->thread_id); } } } This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <agu...@us...> - 2008-03-11 19:35:57
|
Revision: 62 http://isocial.svn.sourceforge.net/isocial/?rev=62&view=rev Author: aguidrevitch Date: 2008-03-11 12:36:02 -0700 (Tue, 11 Mar 2008) Log Message: ----------- minor visual improvements to message deletion Modified Paths: -------------- app/views/message/inbox.tpl app/views/message/outbox.tpl Modified: app/views/message/inbox.tpl =================================================================== --- app/views/message/inbox.tpl 2008-03-11 19:21:38 UTC (rev 61) +++ app/views/message/inbox.tpl 2008-03-11 19:36:02 UTC (rev 62) @@ -90,9 +90,11 @@ '/message/delete_inbox_thread', { method:'post', asynchronous:true, - parameters:$('messages_form').serialize() + parameters:$('messages_form').serialize(), + onSuccess: function () { + disable_action_links(); + } }); - disable_action_links(); return false; } Modified: app/views/message/outbox.tpl =================================================================== --- app/views/message/outbox.tpl 2008-03-11 19:21:38 UTC (rev 61) +++ app/views/message/outbox.tpl 2008-03-11 19:36:02 UTC (rev 62) @@ -56,9 +56,11 @@ '/message/delete_outbox_thread', { method:'post', asynchronous:true, - parameters:$('messages_form').serialize() + parameters:$('messages_form').serialize(), + onSuccess: function () { + $("delete_link").addClassName('disabled'); + } }); - $("delete_link").addClassName('disabled'); return false; } This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <di...@us...> - 2008-03-11 19:21:34
|
Revision: 61 http://isocial.svn.sourceforge.net/isocial/?rev=61&view=rev Author: dim0s77 Date: 2008-03-11 12:21:38 -0700 (Tue, 11 Mar 2008) Log Message: ----------- delete message after mark it as deleted by two interlocutors Modified Paths: -------------- app/controllers/message_controller.php app/installers/message_installer.php app/locales/message/ru.php app/models/user.php app/views/message/outbox.tpl Modified: app/controllers/message_controller.php =================================================================== --- app/controllers/message_controller.php 2008-03-11 18:57:11 UTC (rev 60) +++ app/controllers/message_controller.php 2008-03-11 19:21:38 UTC (rev 61) @@ -165,7 +165,9 @@ foreach ($threads as $thread_loop_key => $thread) { if ($thread->sender_id == $this->current_user->getId() || $thread->recipient_id == $this->current_user->getId()) { - $this->Message->destroyAll("thread_id = $thread->thread_id"); + $is_del = $thread->sender_id == $this->current_user->getId() ? 'is_sender_del' : 'is_recipient_del'; + $this->Message->updateAll("$is_del = 1", "thread_id = " . $thread->getId()); + $this->Message->destroyAll("is_sender_del = 1 AND is_recipient_del = 1"); } } } Modified: app/installers/message_installer.php =================================================================== --- app/installers/message_installer.php 2008-03-11 18:57:11 UTC (rev 60) +++ app/installers/message_installer.php 2008-03-11 19:21:38 UTC (rev 61) @@ -5,14 +5,16 @@ { $this->execute( "CREATE TABLE `messages` ( - `id` int(11) NOT NULL PRIMARY KEY AUTO_INCREMENT, - `sender_id` int(11) NOT NULL DEFAULT 0, - `recipient_id` int(11) NOT NULL DEFAULT 0, - `thread_id` int(11) NOT NULL DEFAULT 0, - `subject` char(255) NOT NULL DEFAULT '', - `body` text NOT NULL DEFAULT '', - `created_at` datetime NOT NULL, - `is_read` tinyint(1) NOT NULL DEFAULT '0', + `id` int(11) NOT NULL PRIMARY KEY AUTO_INCREMENT, + `sender_id` int(11) NOT NULL DEFAULT 0, + `recipient_id` int(11) NOT NULL DEFAULT 0, + `thread_id` int(11) NOT NULL DEFAULT 0, + `subject` char(255) NOT NULL DEFAULT '', + `body` text NOT NULL DEFAULT '', + `created_at` datetime NOT NULL, + `is_read` tinyint(1) NOT NULL DEFAULT '0', + `is_sender_del` tinyint(1) NOT NULL DEFAULT '0', + `is_recipient_del` tinyint(1) NOT NULL DEFAULT '0', FOREIGN KEY (sender_id) REFERENCES users(id), FOREIGN KEY (recipient_id) REFERENCES users(id) ) ENGINE=InnoDB"); Modified: app/locales/message/ru.php =================================================================== --- app/locales/message/ru.php 2008-03-11 18:57:11 UTC (rev 60) +++ app/locales/message/ru.php 2008-03-11 19:21:38 UTC (rev 61) @@ -21,7 +21,7 @@ $dictionary['Delete'] = 'Удалить'; $dictionary['New message'] = 'Новое сообщение'; $dictionary['Message is readed'] = 'Сообщение прочитано'; -$dictionary['Message successfully sended'] = 'Сообщение отправлено'; +$dictionary['Message successfully sent'] = 'Сообщение отправлено'; $dictionary['Thread unavailable'] = 'Нить сообщений недоступна'; $dictionary['Sorry, the contents of this thread are temporarily unavailable. Please check back later.'] = 'К сожалению, содержание этой нити сообщений временно недоступно. Повторите попытку позже.'; $dictionary['Between'] = 'в беседе участвуют:'; Modified: app/models/user.php =================================================================== --- app/models/user.php 2008-03-11 18:57:11 UTC (rev 60) +++ app/models/user.php 2008-03-11 19:21:38 UTC (rev 61) @@ -2,8 +2,14 @@ class User extends ActiveRecord { - var $has_many = array('outbox_messages' => array('class_name' => 'Message', 'order' => 'created_at desc', 'foreign_key' => 'sender_id'), - 'inbox_messages' => array('class_name' => 'Message', 'order' => 'created_at desc', 'foreign_key' => 'recipient_id'), + var $has_many = array('outbox_messages' => array('class_name' => 'Message', + 'order' => 'created_at desc', + 'foreign_key' => 'sender_id', + 'conditions' => 'is_sender_del = 0'), + 'inbox_messages' => array('class_name' => 'Message', + 'order' => 'created_at desc', + 'foreign_key' => 'recipient_id', + 'conditions' => 'is_recipient_del = 0'), ); function login($email, $password) { Modified: app/views/message/outbox.tpl =================================================================== --- app/views/message/outbox.tpl 2008-03-11 18:57:11 UTC (rev 60) +++ app/views/message/outbox.tpl 2008-03-11 19:21:38 UTC (rev 61) @@ -28,7 +28,7 @@ <script> var checkids = new Array(); function oncheck (element, is_read) { - checkids = $$('input[type=checkbox]:checked').toArray(); + checked = $$('input[type=checkbox]:checked'); checkids.clear(); for (var index = 0; index < checked.length; index++) { checkids.push(checked[index].id); This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <agu...@us...> - 2008-03-11 18:57:08
|
Revision: 60 http://isocial.svn.sourceforge.net/isocial/?rev=60&view=rev Author: aguidrevitch Date: 2008-03-11 11:57:11 -0700 (Tue, 11 Mar 2008) Log Message: ----------- number of unread messages is displayed instantly on page load (was ajax update only) Modified Paths: -------------- app/application_controller.php app/controllers/message_controller.php app/models/message.php app/views/shared/loggedin/pageheader.tpl Modified: app/application_controller.php =================================================================== --- app/application_controller.php 2008-03-10 16:47:44 UTC (rev 59) +++ app/application_controller.php 2008-03-11 18:57:11 UTC (rev 60) @@ -19,7 +19,7 @@ var $_errors = array(); - var $models = array('User'); + var $app_models = array('User', 'Message'); var $app_helpers = array('AutoComplete', 'City'); var $current_user; @@ -173,66 +173,9 @@ return "=?utf-8?B?" . base64_encode($value) . "?="; } - - function auto_complete_for_city () { - if (empty($this->params['city'])) { - $this->renderNothing(); - } else { - $query = $this->params['city']; - - $entries = $this->City->find('all', - array('conditions' => - array( - 'first_id IS NOT NULL AND name LIKE ?', $query . '%' - ), - 'include' => 'country', - 'limit' => 10 - ) - ); - - $limit = empty($entries) ? 10 : 10 - count($entries); - if ($limit) { - $aquery = utf8_to_ascii($query); - if ($aquery != $query) { - $asciied = $this->City->find('all', - array('conditions' => - array( - 'first_id IS NOT NULL AND name LIKE ?', $aquery . '%' - ), - 'include' => 'country', - 'limit' => $limit - ) - ); - } - } - - if (empty($entries) && empty($asciied)) { - $entries = array(); - } else if (empty($entries)) { - $entries = $asciied; - } else if (empty($asciied)) { - $entries = $entries; - } else { - $entries = array_merge($entries, $asciied); - } - $this->renderText( $this->city_helper->auto_complete_result($entries, $query) ); - } + function unread_messages_count () { + return $this->current_user ? $this->Message->unread_messages_count($this->current_user->getId()) : 0; } - - function _auto_complete_result ($items, $field, $phrase = '') { - // converting to an array - $entries = array(); - foreach ($items as $item) { - $entry = array(); - foreach ($item->getColumns() as $column => $details) { - $entry[$column] = $item->get($column); - } - $entries[] = $entry; - } - - return $this->javascript_macros_helper->auto_complete_result($entries, $field, $phrase); - } - } ?> Modified: app/controllers/message_controller.php =================================================================== --- app/controllers/message_controller.php 2008-03-10 16:47:44 UTC (rev 59) +++ app/controllers/message_controller.php 2008-03-11 18:57:11 UTC (rev 60) @@ -113,11 +113,7 @@ } function inbox_count () { - if ($this->current_user) { - $count = $this->Message->count('id', array('conditions' => array("recipient_id = ? AND is_read = 0", $this->current_user->getId()))); - return $this->renderText($count); - } - return $this->renderNothing(); + return $this->renderText( $this->unread_messages_count() ); } function mark_unread () { Modified: app/models/message.php =================================================================== --- app/models/message.php 2008-03-10 16:47:44 UTC (rev 59) +++ app/models/message.php 2008-03-11 18:57:11 UTC (rev 60) @@ -5,6 +5,9 @@ var $belongs_to = array('sender' => array('class_name' => 'User', 'primary_key_name' => 'sender_id'), 'recipient' => array('class_name' => 'User', 'primary_key_name' => 'recipient_id')); + function unread_messages_count ( $recipient_id ) { + return $this->count('id', array('conditions' => array("recipient_id = ? AND is_read = 0", $recipient_id))); + } } ?> Modified: app/views/shared/loggedin/pageheader.tpl =================================================================== --- app/views/shared/loggedin/pageheader.tpl 2008-03-10 16:47:44 UTC (rev 59) +++ app/views/shared/loggedin/pageheader.tpl 2008-03-11 18:57:11 UTC (rev 60) @@ -1,7 +1,7 @@ <ul id="headermenuleft"> <li><a class="globallink" href="/profile/">_{Profile}</a> <a href="/profile/basic">_{edit}</a></li> <li><a class="globallink" href="/friend/">_{Friends}</a></li> - <li><a class="globallink" href="/message/">_{Messages} (<span id="messages_count">0</span>)</a></li> + <li><a class="globallink" href="/message/">_{Messages} (<span id="messages_count"><?= $controller->unread_messages_count() ?></span>)</a></li> </ul> <ul id="headermenuright"> <li><a href="/user/logout">_{Logout}</a></li> This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <di...@us...> - 2008-03-10 16:47:38
|
Revision: 59 http://isocial.svn.sourceforge.net/isocial/?rev=59&view=rev Author: dim0s77 Date: 2008-03-10 09:47:44 -0700 (Mon, 10 Mar 2008) Log Message: ----------- added deleting of single thread Modified Paths: -------------- app/controllers/message_controller.php app/views/message/_rows.tpl app/views/message/inbox.tpl app/views/message/outbox.tpl Modified: app/controllers/message_controller.php =================================================================== --- app/controllers/message_controller.php 2008-03-10 13:36:49 UTC (rev 58) +++ app/controllers/message_controller.php 2008-03-10 16:47:44 UTC (rev 59) @@ -21,12 +21,11 @@ $box_messages = array(); if(!empty($messages)) { foreach ($messages as $message_loop_key => $message) { - if (!isset($inbox_messages[$message->thread_id])) { + if (!isset($box_messages[$message->thread_id])) { $box_messages[$message->thread_id] = $message; } } } - $user_id = $box_message == 'inbox_message' ? 'sender_id' : 'recipient_id'; $this->message_threads = count($box_messages); return $box_messages; } @@ -159,7 +158,7 @@ $this->_delete_thread(); return $this->render(array('partial' => 'rows', 'locals' => array('messages' => $this->_getBoxMessages('outbox_message'), - 'target' => 'sender'))); + 'target' => 'recipient'))); } function _delete_thread () { Modified: app/views/message/_rows.tpl =================================================================== --- app/views/message/_rows.tpl 2008-03-10 13:36:49 UTC (rev 58) +++ app/views/message/_rows.tpl 2008-03-10 16:47:44 UTC (rev 59) @@ -33,7 +33,7 @@ </div> </td> <td class="delete_msg"> - <a href="#" onclick=""> </a> + <a href="#" onclick="delete_single_thread(this)" name="{message.id}"> </a> </td> </tr> {else} @@ -45,4 +45,3 @@ </table> <div class="inbox_footer"><div class="mailbox_size">{message_threads} _{Message Threads}</div></div> - Modified: app/views/message/inbox.tpl =================================================================== --- app/views/message/inbox.tpl 2008-03-10 13:36:49 UTC (rev 58) +++ app/views/message/inbox.tpl 2008-03-10 16:47:44 UTC (rev 59) @@ -17,7 +17,7 @@ <li><a class="disabled">_{Mark as}:</a></li> <li><a href="#" onclick="mark_as_unread(this)" id="unread_link" class="disabled">_{Unread},</a></li> <li><a href="#" onclick="mark_as_read(this)" id="read_link" class="disabled">_{Read};</a></li> - <li><a href="#" onclick="delete_thread(this)" id="delete_link" class="disabled">_{Delete}</a></li> + <li><a href="#" onclick="delete_threads(this)" id="delete_link" class="disabled">_{Delete}</a></li> </ul> </div> </div> @@ -31,9 +31,15 @@ </form> <script> +var checkids = new Array(); function oncheck (element, is_read) { + checked = $$('input[type=checkbox]:checked'); checkread = $$('input[type=checkbox].checkread:checked'); checkunread = $$('input[type=checkbox].checkunread:checked'); + checkids.clear(); + for (var index = 0; index < checked.length; index++) { + checkids.push(checked[index].id); + } checkread.length ? $("unread_link").removeClassName('disabled') : $("unread_link").addClassName('disabled'); checkunread.length ? $("read_link").removeClassName('disabled') : $("read_link").addClassName('disabled'); @@ -79,14 +85,35 @@ return false; } -function delete_thread (element) { +function delete_threads (element) { new Ajax.Updater('messages', '/message/delete_inbox_thread', - { method:'post', asynchronous:true, parameters:$('messages_form').serialize()}); + { method:'post', + asynchronous:true, + parameters:$('messages_form').serialize() + }); disable_action_links(); return false; } +function delete_single_thread (element) { + new Ajax.Updater('messages', + '/message/delete_inbox_thread', + { method:'post', + asynchronous:true, + parameters: 'check_messages[]=' + element.name, + onComplete: function () { + disable_action_links(); + tocheck = new Array(); + $$('input[type=checkbox]').each( function (el) { + if (checkids.indexOf(el.value) != -1) { tocheck.push(el); } + }); + tocheck.invoke('click'); + } + }); + return false; +} + function disable_action_links () { $("read_link").addClassName('disabled'); $("unread_link").addClassName('disabled'); Modified: app/views/message/outbox.tpl =================================================================== --- app/views/message/outbox.tpl 2008-03-10 13:36:49 UTC (rev 58) +++ app/views/message/outbox.tpl 2008-03-10 16:47:44 UTC (rev 59) @@ -12,12 +12,12 @@ </div> <div class="menu_block"> <ul id="inbox_action" class="buttons"> - <li><a href="#" onclick="delete_thread(this)" id="delete_link" class="disabled">_{Delete}</a></li> + <li><a href="#" onclick="delete_threads(this)" id="delete_link" class="disabled">_{Delete}</a></li> </ul> </div> </div> -<form id="messages_form" action="/message/inbox" method="post" onsubmit="return false;"> +<form id="messages_form" action="/message/outbox" method="post" onsubmit="return false;"> <div id="messages"> <?= $controller->render(array('partial' => 'rows', 'locals' => array('messages' => $outbox_messages, @@ -26,8 +26,13 @@ </form> <script> +var checkids = new Array(); function oncheck (element, is_read) { - checked = $$('input[type=checkbox]:checked'); + checkids = $$('input[type=checkbox]:checked').toArray(); + checkids.clear(); + for (var index = 0; index < checked.length; index++) { + checkids.push(checked[index].id); + } checked.length ? $("delete_link").removeClassName('disabled') : $("delete_link").addClassName('disabled'); }; @@ -46,13 +51,34 @@ } }; -function delete_thread (element) { +function delete_threads (element) { new Ajax.Updater('messages', '/message/delete_outbox_thread', - { method:'post', asynchronous:true, parameters:$('messages_form').serialize()}); + { method:'post', + asynchronous:true, + parameters:$('messages_form').serialize() + }); $("delete_link").addClassName('disabled'); return false; } +function delete_single_thread (element) { + new Ajax.Updater('messages', + '/message/delete_outbox_thread', + { method:'post', + asynchronous:true, + parameters: 'check_messages[]=' + element.name, + onComplete: function () { + $("delete_link").addClassName('disabled'); + tocheck = new Array(); + $$('input[type=checkbox]').each( function (el) { + if (checkids.indexOf(el.value) != -1) { tocheck.push(el); } + }); + tocheck.invoke('click'); + } + }); + return false; +} + </script> This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <di...@us...> - 2008-03-10 13:36:48
|
Revision: 58 http://isocial.svn.sourceforge.net/isocial/?rev=58&view=rev Author: dim0s77 Date: 2008-03-10 06:36:49 -0700 (Mon, 10 Mar 2008) Log Message: ----------- added functionality to outbox messages Modified Paths: -------------- app/controllers/message_controller.php app/views/message/_rows.tpl app/views/message/inbox.tpl app/views/message/outbox.tpl Modified: app/controllers/message_controller.php =================================================================== --- app/controllers/message_controller.php 2008-03-10 09:29:13 UTC (rev 57) +++ app/controllers/message_controller.php 2008-03-10 13:36:49 UTC (rev 58) @@ -27,15 +27,14 @@ } } $user_id = $box_message == 'inbox_message' ? 'sender_id' : 'recipient_id'; - $this->message_threads = $this->Message->count('thread_id', array('distinct' => 'thread_id', - 'conditions' => "$user_id = " . $this->current_user->getId())); + $this->message_threads = count($box_messages); return $box_messages; } function send () { if (!empty($this->params['message']) && - !empty($this->params['message']['recipient']) && - !empty($this->params['message']['body'])) { + !empty($this->params['message']['recipient']) && + !empty($this->params['message']['body'])) { $recipient = $this->User->findFirst(array( 'id' => $this->params['message']['recipient'] )); if ($recipient) { $message = $this->current_user->outbox_message->build(); @@ -149,7 +148,21 @@ 'target' => 'sender'))); } - function delete_thread () { + function delete_inbox_thread () { + $this->_delete_thread(); + return $this->render(array('partial' => 'rows', + 'locals' => array('messages' => $this->_getBoxMessages('inbox_message'), + 'target' => 'sender'))); + } + + function delete_outbox_thread () { + $this->_delete_thread(); + return $this->render(array('partial' => 'rows', + 'locals' => array('messages' => $this->_getBoxMessages('outbox_message'), + 'target' => 'sender'))); + } + + function _delete_thread () { if (!empty($this->params['check_messages'])) { $threads = $this->Message->find('all', array('conditions' => array("id IN (" . $this->Message->_make_in_statement_from_array('id', $this->params['check_messages']) . ")", ))); @@ -162,9 +175,6 @@ } } } - return $this->render(array('partial' => 'rows', - 'locals' => array('messages' => $this->_getBoxMessages('inbox_message'), - 'target' => 'sender'))); } } ?> \ No newline at end of file Modified: app/views/message/_rows.tpl =================================================================== --- app/views/message/_rows.tpl 2008-03-10 09:29:13 UTC (rev 57) +++ app/views/message/_rows.tpl 2008-03-10 13:36:49 UTC (rev 58) @@ -2,7 +2,7 @@ <tbody> {loop messages} <? $sender = $message->$target->load() ?> -<tr class="<? if (!$message->is_read) { echo 'new_message'; } ?>"> +<tr class="<? if ($target == 'sender' && !$message->is_read) { echo 'new_message'; } ?>"> <td class="msg_icon"> <? if ($target == 'sender') { echo '<a href="">'; Modified: app/views/message/inbox.tpl =================================================================== --- app/views/message/inbox.tpl 2008-03-10 09:29:13 UTC (rev 57) +++ app/views/message/inbox.tpl 2008-03-10 13:36:49 UTC (rev 58) @@ -81,7 +81,7 @@ function delete_thread (element) { new Ajax.Updater('messages', - '/message/delete_thread', + '/message/delete_inbox_thread', { method:'post', asynchronous:true, parameters:$('messages_form').serialize()}); disable_action_links(); return false; Modified: app/views/message/outbox.tpl =================================================================== --- app/views/message/outbox.tpl 2008-03-10 09:29:13 UTC (rev 57) +++ app/views/message/outbox.tpl 2008-03-10 13:36:49 UTC (rev 58) @@ -3,23 +3,56 @@ <div class="inbox_submenu"> <div class="menu_block selector"> <label for="action_select">_{Select}: - <select class="" onchange="" id="action_select" name="action_selector"> + <select class="" onchange="onselect(this)" id="action_select" name="action_selector"> <option selected="selected" value="_">---------</option> - <option value="">_{None}</option> - <option value="read">_{Read}</option> - <option value="unread">_{Unread}</option> + <option value="none">_{None}</option> <option value="all">_{All}</option> </select> </label> </div> <div class="menu_block"> <ul id="inbox_action" class="buttons"> - <li class="disabled"><a href="#" onclick="" id="delete">_{Delete}</a></li> + <li><a href="#" onclick="delete_thread(this)" id="delete_link" class="disabled">_{Delete}</a></li> </ul> </div> </div> -<?= $controller->render(array('partial' => 'rows', - 'locals' => array('messages' => $outbox_messages, - 'target' => 'recipient'))) ?> +<form id="messages_form" action="/message/inbox" method="post" onsubmit="return false;"> + <div id="messages"> + <?= $controller->render(array('partial' => 'rows', + 'locals' => array('messages' => $outbox_messages, + 'target' => 'recipient'))) ?> + </div> +</form> +<script> +function oncheck (element, is_read) { + checked = $$('input[type=checkbox]:checked'); + checked.length ? $("delete_link").removeClassName('disabled') : $("delete_link").addClassName('disabled'); +}; + +function onselect (element) { + var checkboxes; + switch (element.getValue()) { + case "none": + checkboxes = $$('input[type=checkbox]:checked'); + break; + case "all": + checkboxes = $$('input[type=checkbox]:not(:checked)'); + break; + } + if (checkboxes) { + checkboxes.invoke('click'); + } +}; + +function delete_thread (element) { + new Ajax.Updater('messages', + '/message/delete_outbox_thread', + { method:'post', asynchronous:true, parameters:$('messages_form').serialize()}); + $("delete_link").addClassName('disabled'); + return false; +} + +</script> + This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <agu...@us...> - 2008-03-10 09:29:09
|
Revision: 57 http://isocial.svn.sourceforge.net/isocial/?rev=57&view=rev Author: aguidrevitch Date: 2008-03-10 02:29:13 -0700 (Mon, 10 Mar 2008) Log Message: ----------- city selection improved Modified Paths: -------------- app/controllers/profile_controller.php app/installers/city_installer.php localities_to_sql.pl Modified: app/controllers/profile_controller.php =================================================================== --- app/controllers/profile_controller.php 2008-03-09 19:52:38 UTC (rev 56) +++ app/controllers/profile_controller.php 2008-03-10 09:29:13 UTC (rev 57) @@ -14,43 +14,25 @@ if (empty($this->params['basic']['city'])) { $this->renderNothing(); } else { - $query = $this->params['basic']['city']; + $query = $this->params['basic']['city']; + $aquery = utf8_to_ascii($query); + if ($aquery != $query) { + $conditions = array( + 'first_id IS NOT NULL AND name LIKE ? OR name LIKE ?', $query . '%', $aquery . '%' + ); + } else { + $conditions = array( + 'first_id IS NOT NULL AND name LIKE ?', $query . '%' + ); + } $entries = $this->City->find('all', - array('conditions' => - array( - 'first_id IS NOT NULL AND name LIKE ?', $query . '%' - ), - 'include' => 'country', - 'limit' => 10 + array( + 'conditions' => $conditions, + 'include' => 'country', + 'limit' => 10 ) ); - - $limit = empty($entries) ? 10 : 10 - count($entries); - if ($limit) { - $aquery = utf8_to_ascii($query); - if ($aquery != $query) { - $asciied = $this->City->find('all', - array('conditions' => - array( - 'first_id IS NOT NULL AND name LIKE ?', $aquery . '%' - ), - 'include' => 'country', - 'limit' => $limit - ) - ); - } - } - - if (empty($entries) && empty($asciied)) { - $entries = array(); - } else if (empty($entries)) { - $entries = $asciied; - } else if (empty($asciied)) { - $entries = $entries; - } else { - $entries = array_merge($entries, $asciied); - } $this->renderText( $this->_city_auto_complete_result($entries, $query) ); } } Modified: app/installers/city_installer.php =================================================================== --- app/installers/city_installer.php 2008-03-09 19:52:38 UTC (rev 56) +++ app/installers/city_installer.php 2008-03-10 09:29:13 UTC (rev 57) @@ -11,8 +11,10 @@ `first_id` int(11), `second_id` int(11), `third_id` int(11), + `is_alternative` bool NOT NULL DEFAULT 0, `name` char(100) NOT NULL DEFAULT '', INDEX oid_idx (oid), + INDEX name_idx (name), FOREIGN KEY (country_id) REFERENCES countries(id) ) ENGINE=InnoDB"); Modified: localities_to_sql.pl =================================================================== --- localities_to_sql.pl 2008-03-09 19:52:38 UTC (rev 56) +++ localities_to_sql.pl 2008-03-10 09:29:13 UTC (rev 57) @@ -19,7 +19,7 @@ print "INSERT INTO countries VALUES ($id, $oid, '$name');\n"; $id++; } else { - $other{$name} = $oid; + $other{$name} ||= $oid; } } @@ -35,10 +35,13 @@ my $third_id = defined $data[11] && $other{$data[11]} ? $other{$data[11]} : 'NULL'; my @names = ($data[1], split(/\s*,\s*/, $data[2]), split(/\s*,\s*/, $data[3])); + my $i = 0; foreach my $name (@names) { + my $is_alt = $i > 0 ? 1 : 0; $name =~ s/\"/'/g; - print "INSERT INTO cities VALUES ($id, $oid, $country_id, $first_id, $second_id, $third_id, \"$name\");\n"; + print "INSERT INTO cities VALUES ($id, $oid, $country_id, $first_id, $second_id, $third_id, $is_alt, \"$name\");\n"; $id++; + $i++; } } } This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <agu...@us...> - 2008-03-09 19:52:32
|
Revision: 56 http://isocial.svn.sourceforge.net/isocial/?rev=56&view=rev Author: aguidrevitch Date: 2008-03-09 12:52:38 -0700 (Sun, 09 Mar 2008) Log Message: ----------- 'remember me' login option works now Modified Paths: -------------- app/controllers/user_controller.php Modified: app/controllers/user_controller.php =================================================================== --- app/controllers/user_controller.php 2008-03-09 19:33:31 UTC (rev 55) +++ app/controllers/user_controller.php 2008-03-09 19:52:38 UTC (rev 56) @@ -29,22 +29,26 @@ return; } - $this->_loginUser($this->params['email'], $this->params['password']); - - $this->addError( - '_common', - 'Incorrect e-mail/password combination', - 'Passwords are case sensitive. Please check your CAPS lock key' - ); + if (!$this->_loginUser($this->params['email'], $this->params['password'], @$this->params['remember_me'])) { + $this->addError( + '_common', + 'Incorrect e-mail/password combination', + 'Passwords are case sensitive. Please check your CAPS lock key' + ); + } } - function _loginUser ($email, $password) + function _loginUser ($email, $password, $remember_me = false) { $user = $this->User->login($email, $password); if ($user && $user->active) { $this->_login($user->id); + if ($remember_me) { + setcookie(session_name(), session_id(), time() + 60 * 60 * 24 * 365 * 3, '/'); + } $this->redirectToAction( 'home' ); } + return false; } function logout () { This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <agu...@us...> - 2008-03-09 19:33:28
|
Revision: 55 http://isocial.svn.sourceforge.net/isocial/?rev=55&view=rev Author: aguidrevitch Date: 2008-03-09 12:33:31 -0700 (Sun, 09 Mar 2008) Log Message: ----------- unread message count simplified / speedup Modified Paths: -------------- app/controllers/message_controller.php Removed Paths: ------------- app/views/message/_count.tpl Modified: app/controllers/message_controller.php =================================================================== --- app/controllers/message_controller.php 2008-03-09 17:38:17 UTC (rev 54) +++ app/controllers/message_controller.php 2008-03-09 19:33:31 UTC (rev 55) @@ -115,8 +115,11 @@ } function inbox_count () { - $this->count = $this->Message->count('id', array('conditions' => array("recipient_id = ? AND is_read = 0", $this->current_user->getId()))); - return $this->render(array('partial' =>'count')); + if ($this->current_user) { + $count = $this->Message->count('id', array('conditions' => array("recipient_id = ? AND is_read = 0", $this->current_user->getId()))); + return $this->renderText($count); + } + return $this->renderNothing(); } function mark_unread () { Deleted: app/views/message/_count.tpl =================================================================== --- app/views/message/_count.tpl 2008-03-09 17:38:17 UTC (rev 54) +++ app/views/message/_count.tpl 2008-03-09 19:33:31 UTC (rev 55) @@ -1 +0,0 @@ -{count} \ No newline at end of file This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |