Thread: [Isocial-svn] SF.net SVN: isocial: [46] public
Status: Pre-Alpha
Brought to you by:
aguidrevitch
From: <di...@us...> - 2008-03-09 12:04:49
|
Revision: 46 http://isocial.svn.sourceforge.net/isocial/?rev=46&view=rev Author: dim0s77 Date: 2008-03-09 05:04:55 -0700 (Sun, 09 Mar 2008) Log Message: ----------- messaging updated Modified Paths: -------------- app/controllers/message_controller.php app/locales/message/ru.php app/shared_model.php app/views/message/_rows.tpl app/views/message/inbox.tpl app/views/message/show.tpl app/views/shared/loggedin/pageheader.tpl config/routes.php public/stylesheets/Message.css Added Paths: ----------- app/views/message/_count.tpl app/views/message/_thread.tpl public/images/email.png public/images/email_open.png Modified: app/controllers/message_controller.php =================================================================== --- app/controllers/message_controller.php 2008-03-09 12:04:52 UTC (rev 45) +++ app/controllers/message_controller.php 2008-03-09 12:04:55 UTC (rev 46) @@ -9,6 +9,12 @@ } function inbox () { + $this->inbox_messages = $this->_getInboxMessages(); + $this->message_threads = $this->Message->count('thread_id', array('distinct' => 'thread_id', + 'conditions' => "sender_id = " . $this->current_user->getId())); + } + + function _getInboxMessages () { $messages = $this->current_user->inbox_message->load(); $inbox_messages = array(); if(!empty($messages)) { @@ -22,7 +28,7 @@ } } } - $this->inbox_messages = $inbox_messages; + return $inbox_messages; } function outbox () { @@ -64,25 +70,101 @@ $this->addError('_common', 'Sending message error', 'please, try again'); } } + + function reply () { + if (!empty($this->params['message'])) { + $recipient = $this->User->findFirst(array( 'id' => $this->params['message']['recipient'] )); + if ($recipient) { + $message = $this->current_user->outbox_message->build(); + $message->recipient->assign($recipient); + $message->setAttributes($this->params['message']); + if ($message->save()) { + $thread_id = $this->params['message']['thread_id']; + $thread = $this->Message->findFirst(array('thread_id' => $thread_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; + $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'))); + return $this->render(array('partial' =>'thread', + 'locals' => array('interlocutor' => $interlocutor, + 'messages' => $messages))); + } + } + } + } + } function send_successfully () { } function show () { - if (!empty($this->params['t'])){ - $thread = $this->Message->FindFirst(array( 'thread_id' => $this->params['t'] )); + if (!empty($this->params['t'])) { + $thread = $this->Message->findFirst(array('thread_id' => $this->params['t'] )); $user_id = $this->current_user->getId(); if ($thread->sender_id == $user_id || $thread->recipient_id == $user_id ) { - $this->recipient_id = $thread->sender_id == $user_id ? $thread->recipient_id : $thread->sender_id; + $recipient_id = $thread->sender_id == $user_id ? $thread->recipient_id : $thread->sender_id; + $this->interlocutor = $this->User->findFirst(array( 'id' => $recipient_id)); $this->messages = $this->Message->find('all', array('conditions' => array('thread_id' => $thread->getId()), - 'order' => 'created_at')); - $this->interlocutors[$user_id] = $this->current_user; - $this->interlocutors[$this->recipient_id] = $this->User->findFirst(array( 'id' => $this->recipient_id)); + 'order' => 'created_at', + 'include' => array('sender', 'recipient'))); return; } } $this->addError('_common', 'Thread unavailable', 'Sorry, the contents of this thread are temporarily unavailable. Please check back later.'); } + function inbox_count () { + $messages = $this->Message->find('all', array('conditions' => array('is_read' => '0'))); + return $this->render(array('partial' =>'count', + 'locals' => array('count' => count($messages)))); + } + + function mark_unread () { + return $this->_mark_messages(0); + } + + function mark_read () { + return $this->_mark_messages(1); + } + + function _mark_messages ($is_read) { + if (!empty($this->params['check_messages'])) { + $messages = $this->Message->find('all', + array('conditions' => array("id IN (" . $this->Message->_make_in_statement_from_array('id', $this->params['check_messages']) . ")", ))); + if ($messages) { + foreach ($messages as $message_loop_key => $message) { + if ($message->sender_id = $this->current_user->getId() || + $message->recipient_id = $this->current_user->getId()) { + $message->is_read = $is_read; + $message->save(); + } + } + } + } + return $this->render(array('partial' => 'rows', + 'locals' => array('messages' => $this->_getInboxMessages(), + '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']) . ")", ))); + if ($threads) { + 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"); + } + } + } + } + return $this->render(array('partial' => 'rows', + 'locals' => array('messages' => $this->_getInboxMessages(), + 'target' => 'sender'))); + } } ?> \ No newline at end of file Modified: app/locales/message/ru.php =================================================================== --- app/locales/message/ru.php 2008-03-09 12:04:52 UTC (rev 45) +++ app/locales/message/ru.php 2008-03-09 12:04:55 UTC (rev 46) @@ -19,6 +19,8 @@ $dictionary['All'] = 'все'; $dictionary['Mark as'] = 'Отметить как'; $dictionary['Delete'] = 'Удалить'; +$dictionary['New message'] = 'Новое сообщение'; +$dictionary['Message is readed'] = 'Сообщение прочитано'; $dictionary['Message successfully sended'] = 'Сообщение отправлено'; $dictionary['Thread unavailable'] = 'Нить сообщений недоступна'; $dictionary['Sorry, the contents of this thread are temporarily unavailable. Please check back later.'] = 'К сожалению, содержание этой нити сообщений временно недоступно. Повторите попытку позже.'; @@ -27,5 +29,7 @@ $dictionary['and'] = 'и'; $dictionary['Reply'] = 'Ответ'; $dictionary['Back to'] = 'Обратно во'; +$dictionary['Delete Thread'] = 'Удалить нить сообщений'; +$dictionary['Are you sure you want to delete this thread'] = 'Вы уверены, что хотите удалить эту нить сообщений'; ?> Modified: app/shared_model.php =================================================================== --- app/shared_model.php 2008-03-09 12:04:52 UTC (rev 45) +++ app/shared_model.php 2008-03-09 12:04:55 UTC (rev 46) @@ -14,6 +14,15 @@ */ class ActiveRecord extends AkActiveRecord { + + function _make_in_statement_from_array ($column_name, $values) { + $options = array(); + foreach ($values as $value) { + $options[] = $this->castAttributeForDatabase($column_name, $value); + } + return join(", ", $options); + } + } ?> Added: app/views/message/_count.tpl =================================================================== --- app/views/message/_count.tpl (rev 0) +++ app/views/message/_count.tpl 2008-03-09 12:04:55 UTC (rev 46) @@ -0,0 +1 @@ +{count} \ No newline at end of file Modified: app/views/message/_rows.tpl =================================================================== --- app/views/message/_rows.tpl 2008-03-09 12:04:52 UTC (rev 45) +++ app/views/message/_rows.tpl 2008-03-09 12:04:55 UTC (rev 46) @@ -1,11 +1,25 @@ <table class="message_row"> <tbody> {loop messages} -<tr><? $sender = $message->$target->load() ?> - <td class="msg_icon"> </td> - <td class="checkbox"><input onclick="" type="checkbox"></td> +<? $sender = $message->$target->load() ?> +<tr class="<? if (!$message->is_read) { echo 'new_message'; } ?>"> + <td class="msg_icon"> + <? if ($target == 'sender') { + echo '<a href="">'; + if (!$message->is_read) { + echo '<img src="/images/email.png" alt="_{New message}" class="">'; + } else { + echo '<img src="/images/email_open.png" alt="_{Message is readed}" class="">'; + } + echo '</a>'; + } else { + echo '<span> </span>'; + } + ?> + </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="name_and_datetime"> + <td class="info"> <span class="name"><a href="">{sender.name?}</a></span> <span class="datetime">{message.created_at?}</span> </td> @@ -13,7 +27,7 @@ <div class="wrapper"> <a href="/message/show?t={message.thread_id?}" class="subject">{message.subject?}</a> <div class="body_wrap"> - <? (utf8_strlen($message->body) > 50) ? $msg_body = utf8_substr($message->body, 0, 50) . " [..]" : $msg_body = $message->body; ?> + <? (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> </div> </div> @@ -30,4 +44,5 @@ </tbody> </table> -<div class="inbox_footer"><div class="mailbox_size">1 Message Threads</div></div> +<div class="inbox_footer"><div class="mailbox_size">{message_threads} _{Message Threads}</div></div> + Added: app/views/message/_thread.tpl =================================================================== --- app/views/message/_thread.tpl (rev 0) +++ app/views/message/_thread.tpl 2008-03-09 12:04:55 UTC (rev 46) @@ -0,0 +1,17 @@ +<div class="head"> + <h2 class="subject">{messages-0.subject}</h2> + <div class="interlocutors">_{Between} + <a href="">_{You}</a> _{and} <a href="">{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_info"> + <div class="name"><a href="">{message.sender.name?}</a></div> + <div class="date">{message.created_at?}</div> + </div> + <div class="message_body">{message.body?}</div> +</div> +<div class="divide_line"> </div> +{end} Modified: app/views/message/inbox.tpl =================================================================== --- app/views/message/inbox.tpl 2008-03-09 12:04:52 UTC (rev 45) +++ app/views/message/inbox.tpl 2008-03-09 12:04:55 UTC (rev 46) @@ -3,9 +3,9 @@ <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="none">_{None}</option> <option value="read">_{Read}</option> <option value="unread">_{Unread}</option> <option value="all">_{All}</option> @@ -14,15 +14,83 @@ </div> <div class="menu_block"> <ul id="inbox_action" class="buttons"> - <li class="disabled"><a>_{Mark as}:</a></li> - <li class="disabled"><a href="#" onclick="" id="unread">_{Unread},</a></li> - <li class="disabled"><a href="#" onclick="" id="read">_{Read};</a></li> - <li class="disabled"><a href="#" onclick="" id="delete">_{Delete}</a></li> + <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> </ul> </div> </div> -<?= $controller->render(array('partial' => 'rows', - 'locals' => array('messages' => $inbox_messages, - 'target' => 'sender'))) ?> +<form id="messages_form" action="/message/inbox" method="post" onsubmit="return false;"> + <div id="messages"> + <?= $controller->render(array('partial' => 'rows', + 'locals' => array('messages' => $inbox_messages, + 'target' => 'sender'))) ?> + </div> +</form> +<script> +function oncheck (element, is_read) { + checkread = $$('input[type=checkbox].checkread:checked'); + checkunread = $$('input[type=checkbox].checkunread:checked'); + + checkread.length ? $("unread_link").removeClassName('disabled') : $("unread_link").addClassName('disabled'); + checkunread.length ? $("read_link").removeClassName('disabled') : $("read_link").addClassName('disabled'); + checkunread.length || checkread.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 "read": + checkboxes = $$('input[type=checkbox].checkread:not(:checked)'); + checkboxes = checkboxes.concat($$('input[type=checkbox].checkunread:checked')); + break; + case "unread": + checkboxes = $$('input[type=checkbox].checkread:checked'); + checkboxes = checkboxes.concat($$('input[type=checkbox].checkunread:not(:checked)')); + break; + case "all": + checkboxes = $$('input[type=checkbox]:not(:checked)'); + break; + } + if (checkboxes) { + checkboxes.invoke('click'); + } +}; + +function mark_as_unread (element) { + new Ajax.Updater('messages', + '/message/mark_unread', + { method:'post', asynchronous:true, parameters:$('messages_form').serialize()}); + disable_action_links(); + return false; +} + +function mark_as_read (element) { + new Ajax.Updater('messages', + '/message/mark_read', + { method:'post', asynchronous:true, parameters:$('messages_form').serialize()}); + disable_action_links(); + return false; +} + +function delete_thread (element) { + new Ajax.Updater('messages', + '/message/delete_thread', + { method:'post', asynchronous:true, parameters:$('messages_form').serialize()}); + disable_action_links(); + return false; +} + +function disable_action_links () { + $("read_link").addClassName('disabled'); + $("unread_link").addClassName('disabled'); + $("delete_link").addClassName('disabled'); +} + +</script> Modified: app/views/message/show.tpl =================================================================== --- app/views/message/show.tpl 2008-03-09 12:04:52 UTC (rev 45) +++ app/views/message/show.tpl 2008-03-09 12:04:55 UTC (rev 46) @@ -3,45 +3,33 @@ <?= $controller->renderErrors() ?> <div class="messages_thread"> - <div class="thread_head"> - <h2 class="subject">{messages-0.subject} - <div class="interlocutors">_{Between} - <a href="">_{You}</a> _{and} - <a href=""><? $recipient = $interlocutors[$recipient_id] ?>{recipient.name}</a></div> - </h2> + <div id="messages"> + <?= $controller->render(array('partial' =>'thread', + 'locals' => array('interlocutor' => $interlocutor, + 'messages' => $messages))); ?> </div> - <hr width="600px"> -{loop messages} - <? $interlocutor = $interlocutors[$message->sender_id] ?> - <div class="message" id="msg{message_loop_counter}"> - <div class="column author_picture"><a href=""><img src="/images/nophoto_men_sm.gif" alt="" class=""></a></div> - <div class="column author_info"> - <div class="name"><a href="">{interlocutor.name?}</a></div> - <div class="date">{message.created_at?}</div> - <div class="extras"></div> - </div> - <div class="column body"> - <div class="text">{message.body?}</div> - </div> - </div> - <div class="msg_divide_btm"> </div> -{end} - <div class="reply_container"> - <form action="/message/send" method="post"> - <div class="row"><label>_{Reply}:</label></div> - <div class="row"><?= $form_helper->text_area('message', 'body', array('class' => 'textinput'))?></div> - <input id="message_recipient" name="message[recipient]" type="hidden" value="{recipient_id}" /> - <input id="message_thread_id" name="message[thread_id]" type="hidden" value="{message.thread_id}" /> - <input id="message_subject" name="message[subject]" type="hidden" value="re: {message.subject}" /> - <div class="msg_divide_btm"> </div> - <div class="row"> - <div class="submits"> - <input class="submitinput" type="submit" value="_{Send}"> - <input class="cancelinput" type="button" value="_{Back to} _{Inbox}" onclick=""> - </div> - <div class="sub_controls"><a href="#" onclick="">_{Delete}</a></div> + <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'))?> + <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=""> + </div> + <div class="sub_controls"><a href="#" onclick="Element.show('dlg'); return false;">_{Delete}</a></div> </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> Modified: app/views/shared/loggedin/pageheader.tpl =================================================================== --- app/views/shared/loggedin/pageheader.tpl 2008-03-09 12:04:52 UTC (rev 45) +++ app/views/shared/loggedin/pageheader.tpl 2008-03-09 12:04:55 UTC (rev 46) @@ -1,8 +1,16 @@ <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} (0)</a></li> + <li><a class="globallink" href="/message/">_{Messages} (<span id="messages_count">0</span>)</a></li> </ul> <ul id="headermenuright"> <li><a href="/user/logout">_{Logout}</a></li> -</ul> \ No newline at end of file +</ul> + +<script> +window.onload = function () { + new Ajax.PeriodicalUpdater('messages_count', '/message/inbox_count', { + method: 'get', frequency: 3, decay: 0 + }); +} +</script> Modified: config/routes.php =================================================================== --- config/routes.php 2008-03-09 12:04:52 UTC (rev 45) +++ config/routes.php 2008-03-09 12:04:55 UTC (rev 46) @@ -2,7 +2,7 @@ // You can find more about routes on /lib/AkRouters.php and /test/test_AkRouter.php -$Map->connect('/:controller/:action', array('controller' => 'default', 'action' => 'index')); +$Map->connect('/:controller/:action/:id', array('controller' => 'default', 'action' => 'index')); $Map->connect('/', array('controller' => 'default', 'action' => 'index')); ?> Added: public/images/email.png =================================================================== (Binary files differ) Property changes on: public/images/email.png ___________________________________________________________________ Name: svn:mime-type + application/octet-stream Added: public/images/email_open.png =================================================================== (Binary files differ) Property changes on: public/images/email_open.png ___________________________________________________________________ Name: svn:mime-type + application/octet-stream Modified: public/stylesheets/Message.css =================================================================== --- public/stylesheets/Message.css 2008-03-09 12:04:52 UTC (rev 45) +++ public/stylesheets/Message.css 2008-03-09 12:04:55 UTC (rev 46) @@ -31,11 +31,8 @@ display: block; } -.inbox_submenu .disabled a { +.inbox_submenu .disabled { color: #aaaaaa; -} - -.inbox_submenu .disabled a:hover { cursor: default; text-decoration: none; } @@ -57,6 +54,14 @@ width: 100%; } +.message_row .new_message { + background: #f4f8fc; +} + +.message_row .new_message .msg .subject { + font-weight: bold; +} + .message_row tr td { border-bottom: 1px solid #e1e1e1; padding: 5px 0px 5px 0px; @@ -67,8 +72,8 @@ display: block; margin-top: 1px; width: 17px; - height: 14px; - padding-left: 10px; + height: 19px; + padding: 0px 10px 0px 10px; text-decoration: none; } @@ -81,7 +86,7 @@ line-height: 1px; } -.message_row .name_and_datetime .name { +.message_row .info .name { display: block; width: 130px; margin-right: 20px; @@ -89,17 +94,13 @@ text-overflow: ellipsis; } -.name_and_datetime .datetime { +.message_row .info .datetime { display: block; padding: 1px 0px 0px 0px; font-size: 9px; color: #777777; } -.name_and_datetime .unread_name { - font-weight: bold; -} - .message_row .msg { margin-right: 10px; line-height: 14px; @@ -167,94 +168,75 @@ padding: 20px 30px 0px 30px; } -.thread_head { - margin: 0px 0px 0px 10px; +.head { + padding: 0px 0px 5px 185px; + border-bottom: 1px solid #777777; } -.thread_head h2 { - margin: 0px 20px 1px 153px; - padding: 0px 0px 0px 22px; +.head h2 { font-size: 15px; color: #333333; } -.thread_head h2 .interlocutors { +.head .interlocutors { + padding: 3px 0px 0px 0px; font-size: 11px; font-weight: normal; } .message { - display: block; - margin-top: 10px; - overflow: hidden; + //height: 1%; } -.message .column { +.message:after { + content: "."; + display: block; + height: 0; + clear: both; + visibility: hidden; +} + +.message div { float: left; - padding: 0px 0px 10px 0px; + padding: 5px 0px 10px 0px; } -.message .author_picture { +.message_author_pict { width: 50px; padding-bottom: 0px; } -.message .author_picture img { +.message_author_pict img { display: block; } -.message .author_info { +.message_author_info { width: 120px; - padding: 0px 10px 0px 0px; font-weight: normal; font-size: 9px; - text-align: right; } -.message .author_info .name { - padding: 3px 5px 0px 5px; +.message_author_info .name { + padding: 3px 0px 0px 0px; font-size: 11px; font-weight: bold; - overflow: hidden; + float: right; + text-align: right; } -.message.unread .author_info .name { - padding: 3px 5px 4px 20px; - background: #eff2f7 url('/inbox/images/new_message.gif') no-repeat 7px 5px; - border-top: 1px solid #d8dfea; - overflow: hidden; -} - -.message .author_info .date { - display: block; - padding: 2px 5px 2px 0px; +.message_author_info .date { + padding: 2px 0px 2px 0px; color: #777777; -} - -.message .author_info .extras a { float: right; - padding-right: 5px; - margin-bottom: 1px; } -.message .body { - padding: 3px 0px 14px 5px; -} - -.message.unread .body { - padding-top: 4px; -} - -.message .body .text { - width: 300px; +.message_body { + margin: 3px 5px 14px 15px; + width: 380px; word-wrap: break-word; } -.message .body .text.no_body { - color: #777777; -} - -.msg_divide_btm { +.divide_line { height: 1px; margin: 1px 0px 0px 185px; background: #dddddd; @@ -268,27 +250,71 @@ overflow: auto; } -.reply_container .row { - display: block; +.reply_container form { padding: 5px 0px 0px 185px; - margin-right: 20px; - clear: both; } -.row textarea { +.reply_container form label { + margin: 0px 0px 5px 0px; +} + +.reply_container form textarea { height: 100px; - width: 355px; + width: 360px; padding: 5px 0px 15px 3px; font-size: 11px; - overflow: hidden; + overflow: auto; } -.row .submits { +.reply_container form .submits { float: left; } -.row .sub_controls { +.reply_container form .sub_controls { padding-top: 11px; font-size: 9px; float: right; } + +.reply_container form .divide_line { + height: 1px; + margin: 1px 0px 0px 0px; + background: #dddddd; + overflow: hidden; +} + +.action_dialog { + border: 6px solid #999999; + width: 465px; + overflow: auto; + top: 34px; + position: relative; + z-index: 100; +} + +.action_dialog .header { + background-color: #6d84b4; + border: 1px solid #3b5998; + color: #ffffff; + font-weight: bold; + font-size: 13px; + padding: 6px 0px 6px 10px; +} + +.action_dialog .body { + background-color: #ffffff; + color: #000000; + font-size: 11px; + padding: 15px; +} + +.action_dialog .footer { + background-color: #f2f2f2; + border: 1px solid #a6a6a6; + overflow: auto; +} + +.action_dialog .footer .buttons { + margin: 0px 6px 0px 0px; + float: right; +} This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <agu...@us...> - 2008-03-09 16:40:04
|
Revision: 53 http://isocial.svn.sourceforge.net/isocial/?rev=53&view=rev Author: aguidrevitch Date: 2008-03-09 09:40:08 -0700 (Sun, 09 Mar 2008) Log Message: ----------- various city/common autocompletion improvements Modified Paths: -------------- app/application_controller.php app/helpers/city_helper.php app/views/layouts/application.tpl app/views/profile/basic.tpl app/views/shared/loggedin/pageheader.tpl public/javascripts/autocomplete.js public/stylesheets/autocomplete.css Added Paths: ----------- app/helpers/auto_complete_helper.php public/images/spinner-faded.gif public/images/spinner.gif Modified: app/application_controller.php =================================================================== --- app/application_controller.php 2008-03-09 14:40:12 UTC (rev 52) +++ app/application_controller.php 2008-03-09 16:40:08 UTC (rev 53) @@ -20,7 +20,7 @@ var $_errors = array(); var $models = array('User'); - var $app_helpers = array('City'); + var $app_helpers = array('AutoComplete', 'City'); var $current_user; function beforeAction ( $method = '' ) { Added: app/helpers/auto_complete_helper.php =================================================================== --- app/helpers/auto_complete_helper.php (rev 0) +++ app/helpers/auto_complete_helper.php 2008-03-09 16:40:08 UTC (rev 53) @@ -0,0 +1,57 @@ +<?php + +require_once(AK_LIB_DIR.DS.'AkActionView'.DS.'helpers'.DS.'javascript_helper.php'); +require_once(AK_LIB_DIR.DS.'AkActionView'.DS.'helpers'.DS.'tag_helper.php'); +require_once(AK_LIB_DIR.DS.'AkActionView'.DS.'helpers'.DS.'form_helper.php'); + +class AutoCompleteHelper extends JavascriptMacrosHelper { + + function auto_complete_field($field_id, $options = array()) + { + $function = "var {$field_id}_auto_completer = new Ajax.IAutocompleter("; + $function .= "'{$field_id}', "; + $function .= !empty($options['update']) ? "'{$options['update']}', " : "'{$field_id}_auto_complete', "; + $function .= "'".UrlHelper::url_for($options['url'])."'"; + + $js_options = array(); + foreach (array('paramName', + 'tokens', + 'frequency', + 'minChars', + 'indicator', + 'updateElement', + 'afterUpdateElement', + 'callback', + 'parameters') as $key) { + if (!empty($options[$key])) { + $js_options[$key] = $options[$key]; + } + } + + $function .= ', '.JavaScriptHelper::_options_for_javascript($js_options).')'; + return JavaScriptHelper::javascript_tag($function); + } + + function auto_complete_result($entries, $phrase = null) + { + if (empty($entres)) { + 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); + } + return TagHelper::content_tag('ul', join('', array_unique($items))); + } + + function text_field_with_auto_complete($object, $method, $tag_options = array(), $completion_options = array()) + { + $completion_options['indicator'] = "'{$object}_{$method}'"; + return parent::text_field_with_auto_complete($object, $method, $tag_options, $completion_options); + } +} + +?> \ No newline at end of file Modified: app/helpers/city_helper.php =================================================================== --- app/helpers/city_helper.php 2008-03-09 14:40:12 UTC (rev 52) +++ app/helpers/city_helper.php 2008-03-09 16:40:08 UTC (rev 53) @@ -1,38 +1,11 @@ <?php -require_once(AK_LIB_DIR.DS.'AkActionView'.DS.'helpers'.DS.'javascript_helper.php'); require_once(AK_LIB_DIR.DS.'AkActionView'.DS.'helpers'.DS.'tag_helper.php'); require_once(AK_LIB_DIR.DS.'AkActionView'.DS.'helpers'.DS.'form_helper.php'); -class CityHelper extends AkActionViewHelper +class CityHelper extends AutoCompleteHelper { - function auto_complete_field($field_id, $options = array()) - { - $function = "var {$field_id}_auto_completer = new Ajax.Autocompleter("; - $function .= "'{$field_id}', "; - $function .= !empty($options['update']) ? "'{$options['update']}', " : "'{$field_id}_auto_complete', "; - $function .= "'".UrlHelper::url_for($options['url'])."'"; - - $js_options = array(); - foreach (array('paramName', - 'tokens', - 'frequency', - 'minChars', - 'indicator', - 'updateElement', - 'afterUpdateElement', - 'callback', - 'parameters') as $key) { - if (!empty($options[$key])) { - $js_options[$key] = $options[$key]; - } - } - - $function .= ', '.JavaScriptHelper::_options_for_javascript($js_options).')'; - return JavaScriptHelper::javascript_tag($function); - } - function auto_complete_result($cities, $phrase = null) { if (empty($cities)) { @@ -61,7 +34,8 @@ 'skip_style' => true, 'url' => array('action' => 'auto_complete_for_city'), 'frequency' => 0.4, - 'afterUpdateElement' => "function (text, li) { $('{$object}_{$method}').value = li.id; $('{$object}_{$method}_prev').value = text.value; }" + 'indicator' => "'auto_{$object}_{$method}'", + 'afterUpdateElement' => "function (text, li) { \$('{$object}_{$method}').value = li.id; \$('{$object}_{$method}_prev').value = text.value; }" ), $completion_options); $hidden = $this->_controller->form_helper->hidden_field($object, $method); @@ -72,6 +46,7 @@ return $hidden . $hidden_prev . $text_field . $div . $javascript; } + } ?> Modified: app/views/layouts/application.tpl =================================================================== --- app/views/layouts/application.tpl 2008-03-09 14:40:12 UTC (rev 52) +++ app/views/layouts/application.tpl 2008-03-09 16:40:08 UTC (rev 53) @@ -7,8 +7,22 @@ <link href="/stylesheets/Application.css" rel="stylesheet" type="text/css"> <link href="/stylesheets/<?= $controller->getControllerName() ?>.css" rel="stylesheet" type="text/css"> <script src="/javascripts/prototype.js" type="text/javascript"></script> -<script src="/javascripts/scriptaculous.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 type="text/javascript"> + function push_onload_handler (func) { + if (!window._onload) window._onload = []; + window._onload.push(func); + } + + window.onload = function (event) { + if (window._onload) { + for (var i = 0; i < window._onload.length; i++) { + window._onload[i](event); + } + } + } +</script> </head> <body id="application"> <div id="main"> Modified: app/views/profile/basic.tpl =================================================================== --- app/views/profile/basic.tpl 2008-03-09 14:40:12 UTC (rev 52) +++ app/views/profile/basic.tpl 2008-03-09 16:40:08 UTC (rev 53) @@ -15,7 +15,7 @@ </div> <div class="formrow"> <label>_{Hometown}:</label> - <?= $city_helper->city_field('basic', 'city', array('class' => 'shorttextinput')); ?> + <?= $city_helper->city_field('basic', 'city', array('class' => 'autocomplete')); ?> </div> <div id="basic_country_div" class="formrow" style="display:none"> <label>_{Country}:</label> @@ -27,7 +27,7 @@ </div> <div class="formrow"> <label>_{Religious views}:</label> - <?= $javascript_macros_helper->text_field_with_auto_complete('basic', 'religious_view', array('autocomplete' => 'on', 'class' => 'shorttextinput'), array('skip_style' => true) )?> + <?= $auto_complete_helper->text_field_with_auto_complete('basic', 'religious_view', array('autocomplete' => 'on', 'class' => 'autocomplete'), array('skip_style' => true) )?> </div> <div class="formrow"> <label></label> @@ -37,30 +37,3 @@ </div> </div> </form> - -<script type="text/javascript"> - - - function city_changed () { - if (!$F('basic_city')) { - $('basic_country_div').hide(); - } - } - - function city_blurred () { - // check city existence - if ($F('basic_city')) { - // order is important !!! - $('basic_country_id').focus(); - $('basic_country_div').show(); - } - } - - /* - window.onload = function () { - $('basic_city').observe("keyup", city_changed); - $('auto_basic_city').observe("change", city_blurred); - } - */ - -</script> Modified: app/views/shared/loggedin/pageheader.tpl =================================================================== --- app/views/shared/loggedin/pageheader.tpl 2008-03-09 14:40:12 UTC (rev 52) +++ app/views/shared/loggedin/pageheader.tpl 2008-03-09 16:40:08 UTC (rev 53) @@ -8,9 +8,11 @@ </ul> <script> -window.onload = function () { - new Ajax.PeriodicalUpdater('messages_count', '/message/inbox_count', { - method: 'get', frequency: 3, decay: 0 - }); -} + push_onload_handler( + function (event) { + new Ajax.PeriodicalUpdater('messages_count', '/message/inbox_count', { + method: 'get', frequency: 3, decay: 0 + }); + } + ); </script> Added: public/images/spinner-faded.gif =================================================================== (Binary files differ) Property changes on: public/images/spinner-faded.gif ___________________________________________________________________ Name: svn:mime-type + application/octet-stream Added: public/images/spinner.gif =================================================================== (Binary files differ) Property changes on: public/images/spinner.gif ___________________________________________________________________ Name: svn:mime-type + application/octet-stream Modified: public/javascripts/autocomplete.js =================================================================== --- public/javascripts/autocomplete.js 2008-03-09 14:40:12 UTC (rev 52) +++ public/javascripts/autocomplete.js 2008-03-09 16:40:08 UTC (rev 53) @@ -1,3 +1,13 @@ +Ajax.IAutocompleter = Class.create(Ajax.Autocompleter, { + startIndicator: function() { + if(this.options.indicator) Element.addClassName(this.options.indicator, 'loading'); + }, + + stopIndicator: function() { + if(this.options.indicator) Element.removeClassName(this.options.indicator, 'loading'); + }, +}); + function city_updated (input, prev, hidden) { if ($F(input)) { if ($F(input) != $F(prev)) { @@ -3,9 +13,10 @@ $(input).value = ''; $(hidden).value = ''; - $(prev).value = ''; - new Effect.Highlight(input, { startcolor: '#ff0000'}); + $(prev).value = ''; + new Effect.Highlight(input, { keepBackgroundImage: true, startcolor: '#ff0000', afterFinish: function (obj) { obj.element.setStyle('') } }); } } else { $(hidden).value = ''; } } + Modified: public/stylesheets/autocomplete.css =================================================================== --- public/stylesheets/autocomplete.css 2008-03-09 14:40:12 UTC (rev 52) +++ public/stylesheets/autocomplete.css 2008-03-09 16:40:08 UTC (rev 53) @@ -3,6 +3,15 @@ margin-left: 4px; } +input.autocomplete { + padding-right: 18px; + background: url('/images/spinner-faded.gif') no-repeat right; +} + +input.autocomplete.loading { + background-image: url('/images/spinner.gif'); +} + span.indicator img { vertical-align: middle; } This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <agu...@us...> - 2008-05-01 19:05:35
|
Revision: 149 http://isocial.svn.sourceforge.net/isocial/?rev=149&view=rev Author: aguidrevitch Date: 2008-05-01 12:05:39 -0700 (Thu, 01 May 2008) Log Message: ----------- initial loadable dialogs support added Modified Paths: -------------- app/application_controller.php app/controllers/city_controller.php app/controllers/profile_controller.php app/helpers/city_helper.php app/helpers/dialog_helper.php app/installers/user_installer.php app/locales/city/ru.php app/locales/layout/ru.php app/models/city.php app/models/user.php app/views/city/_regions.tpl app/views/layouts/application.tpl app/views/message/show.tpl app/views/profile/basic.tpl app/views/profile/contact.tpl app/views/shared/loggedin/sidebar.tpl public/javascripts/autocomplete.js public/javascripts/dialog.js public/stylesheets/autocomplete.css public/stylesheets/dialog.css Added Paths: ----------- app/controllers/dialog_controller.php app/helpers/access_field_helper.php app/locales/dialog/ app/locales/dialog/ru.php app/models/contact_profile.php app/views/dialog/ app/views/dialog/_access.tpl app/views/dialog/_new_city.tpl public/images/lock_inactive.png Removed Paths: ------------- app/helpers/user_helper.php app/views/shared/dialog.tpl app/views/shared/new_city_dialog.tpl Modified: app/application_controller.php =================================================================== --- app/application_controller.php 2008-05-01 19:04:14 UTC (rev 148) +++ app/application_controller.php 2008-05-01 19:05:39 UTC (rev 149) @@ -21,7 +21,7 @@ var $_errors = array(); var $app_models = array('User', 'Message'); - var $app_helpers = array('AutoComplete', 'City', 'Dialog'); + var $app_helpers = array('AutoComplete', 'City', 'Dialog', 'AccessField'); var $current_user; function __construct () { Modified: app/controllers/city_controller.php =================================================================== --- app/controllers/city_controller.php 2008-05-01 19:04:14 UTC (rev 148) +++ app/controllers/city_controller.php 2008-05-01 19:05:39 UTC (rev 149) @@ -3,6 +3,7 @@ class CityController extends ApplicationController { var $layout = 'empty'; + var $models = array('Country', 'Region'); function add () { if ($this->Request->isPost() && !empty($this->params['city'])) { Added: app/controllers/dialog_controller.php =================================================================== --- app/controllers/dialog_controller.php (rev 0) +++ app/controllers/dialog_controller.php 2008-05-01 19:05:39 UTC (rev 149) @@ -0,0 +1,16 @@ +<?php + +class DialogController extends ApplicationController +{ + var $models = array('Country', 'Region'); + + function access () { + return $this->renderPartial('access'); + } + + function new_city () { + return $this->renderPartial('new_city'); + } +} + +?> \ No newline at end of file Modified: app/controllers/profile_controller.php =================================================================== --- app/controllers/profile_controller.php 2008-05-01 19:04:14 UTC (rev 148) +++ app/controllers/profile_controller.php 2008-05-01 19:05:39 UTC (rev 149) @@ -2,7 +2,7 @@ class ProfileController extends ApplicationController { - var $models = array('User', 'BasicProfile', 'Sex', 'Country', 'City', 'PoliticalView', 'ReligiousView'); + var $models = array('User', 'BasicProfile', 'Sex', 'Country', 'Region', 'City', 'PoliticalView', 'ReligiousView'); function index () { $this->redirectTo(array('action' => 'show')); @@ -34,24 +34,24 @@ function auto_complete_for_basic_profile_religious_view_id () { if (empty($this->params['basic_profile'])) { - $this->renderNothing(); - } else { - $entries = $this->ReligiousView->findVoted($this->params['basic_profile']['religious_view_id']); - if (!empty($entries)) { - $this->renderText( $this->auto_complete_helper->auto_complete_result($entries, 'name', $this->params['basic_profile']['religious_view_id']) ); - } else { $this->renderNothing(); + } else { + $entries = $this->ReligiousView->findVoted($this->params['basic_profile']['religious_view_id']); + if (!empty($entries)) { + $this->renderText( $this->auto_complete_helper->auto_complete_result($entries, 'name', $this->params['basic_profile']['religious_view_id']) ); + } else { + $this->renderNothing(); + } } - } } function contact () { $this->contact_profile = $this->current_user->contact_profile->load(); if ($this->Request->isPost()) { - if (!empty($this->params['contact_profile'])) { + if (!empty($this->params['contact_profile'])) { + } } - } } function relationships () { Added: app/helpers/access_field_helper.php =================================================================== --- app/helpers/access_field_helper.php (rev 0) +++ app/helpers/access_field_helper.php 2008-05-01 19:05:39 UTC (rev 149) @@ -0,0 +1,25 @@ +<? + +require_once(AK_LIB_DIR.DS.'AkActionView'.DS.'helpers'.DS.'form_helper.php'); +require_once(AK_LIB_DIR.DS.'AkActionView'.DS.'helpers'.DS.'tag_helper.php'); + +class AccessFieldHelper extends AkActionViewHelper +{ + + function access_field ($object, $method, $options = array()) { + $this->object =& $this->_controller->{$object}; + + if ($this->object) { + $value = $this->object->get($method); + } + + $hidden = $this->_controller->form_helper->hidden_field($object, $method); + $id = $this->_controller->dialog_helper->generateid(); + $options = array_merge(array('reference_element' => $id, 'hidden' => "{$object}_{$method}"), $options); + $dialog = $this->_controller->dialog_helper->dialog('/dialog/access', $options); + $div = TagHelper::content_tag('div', '', array('id' => $id, 'class' => 'lock short', 'onclick' => $dialog)); + return $hidden . $div; + } +} + +?> \ No newline at end of file Modified: app/helpers/city_helper.php =================================================================== --- app/helpers/city_helper.php 2008-05-01 19:04:14 UTC (rev 148) +++ app/helpers/city_helper.php 2008-05-01 19:05:39 UTC (rev 149) @@ -48,15 +48,25 @@ 'afterUpdateElement' => "function (text, li) { \$('{$object}_{$method}').value = li.id; \$('{$object}_{$method}_prev').value = text.value; }" ), $completion_options); - $hidden = $this->_controller->form_helper->hidden_field($object, $method); - $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); + $form_helper = new FormHelper (); + $hidden = $form_helper->hidden_field($object, $method); + $hidden_prev = $form_helper->hidden_field(null, null, array('id' => "{$object}_{$method}_prev", 'name' => "{$object}_{$method}_prev", 'value' => $this->value)); + $text_field = $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); - - return $hidden . $hidden_prev . $text_field . $div . $javascript; + $id = $this->_controller->dialog_helper->generateid(); + $dialog = $this->_controller->dialog_helper->dialog( + '/dialog/new_city', + array('reference_element' => $id, 'input' => $tag_options['id'], 'hidden' => "{$object}_{$method}")); + $new_city = TagHelper::tag('input', array( + 'id' => $id, + 'class' => 'submitinput', + 'type' => 'button', + 'value' => $this->t('Not Listed') . "?", + 'onclick' => $dialog)); + + return $hidden . $hidden_prev . $text_field . $new_city . $div . $javascript; } - } ?> Modified: app/helpers/dialog_helper.php =================================================================== --- app/helpers/dialog_helper.php 2008-05-01 19:04:14 UTC (rev 148) +++ app/helpers/dialog_helper.php 2008-05-01 19:05:39 UTC (rev 149) @@ -1,31 +1,24 @@ <?php require_once(AK_LIB_DIR.DS.'AkActionView'.DS.'helpers'.DS.'javascript_helper.php'); +require_once(AK_LIB_DIR.DS.'AkActionView'.DS.'helpers'.DS.'url_helper.php'); class DialogHelper extends AkActionViewHelper { + var $current = 1; - function dialog ($function_name, $title, $body, $onyes) { - - $id = $this->id($function_name); - $content = "<div id='$id' style='display: none'>$body</div>"; - $function = " -function {$function_name} (element) { - return new Dialog.Box('dlg', { - reference: element, - title: '" . $this->t($title) . "', - body: \$('$id').show(), - yes: '" . $this->t('Save') . "', - cancel: '" . $this->t('Cancel') . "', - onYes : function () { $onyes } - }); -}"; - - return $content . JavaScriptHelper::javascript_tag($function); + function generateid () { + return "dialog_trigger_" . $this->current++; } - function id ($function_name) { - return $function_name . '_content'; + function dialog ($url, $request_parameters = array()) { + + if (empty($request_parameters['reference_element'])) { + return "alert('id of element that triggered the dialog should be passed, please contact developers on this subject')"; + } + + $request_parameters = JavaScriptHelper::_options_for_javascript(array_map(create_function('$e', 'return "\'$e\'";'), $request_parameters)); + return "__remote_dialog('$url', {$request_parameters})"; } } Deleted: app/helpers/user_helper.php =================================================================== --- app/helpers/user_helper.php 2008-05-01 19:04:14 UTC (rev 148) +++ app/helpers/user_helper.php 2008-05-01 19:05:39 UTC (rev 149) @@ -1,36 +0,0 @@ -<?php - -class UserHelper extends AkActionViewHelper -{ - function cancel($url = array('action' => 'listing')) - { - return '<input type="button" value="'.$this->_controller->t('Cancel').'" style="width: auto;" onclick="window.location.href = \''.$this->_controller->urlFor($url).'\';" />'; - } - - function save() - { - return '<input type="submit" value="'.$this->_controller->t('OK').'" class="primary" />'; - } - - function confirm_delete() - { - return '<input type="submit" value="'.$this->_controller->t('Delete').'" />'; - } - - function link_to_show(&$record) - { - return $this->_controller->url_helper->link_to($this->_controller->t('Show'), array('action' => 'show', 'id' => $record->getId())); - } - - function link_to_edit(&$record) - { - return $this->_controller->url_helper->link_to($this->_controller->t('Edit'), array('action' => 'edit', 'id' => $record->getId())); - } - - function link_to_destroy(&$record) - { - return $this->_controller->url_helper->link_to($this->_controller->t('Delete'), array('action' => 'destroy', 'id' => $record->getId())); - } -} - -?> \ No newline at end of file Modified: app/installers/user_installer.php =================================================================== --- app/installers/user_installer.php 2008-05-01 19:04:14 UTC (rev 148) +++ app/installers/user_installer.php 2008-05-01 19:05:39 UTC (rev 149) @@ -164,7 +164,16 @@ END; "); + $this->execute( + "CREATE TABLE `permissions` ( + `id` int(11) NOT NULL PRIMARY KEY AUTO_INCREMENT, + `email` int(11), + FOREIGN KEY (user_id) REFERENCES users(id), + INDEX user_idx (user_id) + ) ENGINE=InnoDB"); + + $this->execute( "CREATE TABLE `basic_profiles` ( `id` int(11) NOT NULL PRIMARY KEY AUTO_INCREMENT, `user_id` int(11), @@ -187,15 +196,6 @@ ) ENGINE=InnoDB"); $this->execute( - "CREATE TABLE `email_profiles` ( - `id` int(11) NOT NULL PRIMARY KEY AUTO_INCREMENT, - `user_id` int(11), - `email` char(100) NOT NULL DEFAULT '', - FOREIGN KEY (user_id) REFERENCES users(id), - INDEX user_idx (user_id) - ) ENGINE=InnoDB"); - - $this->execute( "CREATE TABLE `ims` ( `id` int(11) NOT NULL PRIMARY KEY AUTO_INCREMENT, `name` char(100) NOT NULL DEFAULT '' Modified: app/locales/city/ru.php =================================================================== --- app/locales/city/ru.php 2008-05-01 19:04:14 UTC (rev 148) +++ app/locales/city/ru.php 2008-05-01 19:05:39 UTC (rev 149) @@ -4,9 +4,10 @@ $dictionary = array(); -$dictionary['City Name'] = 'Название'; +$dictionary['City Name'] = 'Название города'; $dictionary['Country'] = 'Страна'; $dictionary['Region'] = 'Область'; +$dictionary['city name can\'t be blank'] = 'поле не может быть пустым'; $dictionary['country can\'t be blank'] = 'поле не может быть пустым'; $dictionary['region can\'t be blank'] = 'поле не может быть пустым'; $dictionary['country does not exist'] = 'такой страны не существует'; Added: app/locales/dialog/ru.php =================================================================== --- app/locales/dialog/ru.php (rev 0) +++ app/locales/dialog/ru.php 2008-05-01 19:05:39 UTC (rev 149) @@ -0,0 +1,25 @@ +<?php + +// File created on: 2008-02-16 20:34:04 + +$dictionary = array(); + +$dictionary['Add New City'] = 'Добавить новый город'; +$dictionary['Select Country:'] = 'Выберите страну:'; +$dictionary['City Name'] = 'Название города'; +$dictionary['Country'] = 'Страна'; +$dictionary['Region'] = 'Область'; + +$dictionary['Who can see this?'] = 'Кто может видеть?'; +$dictionary['Email field'] = 'Email адрес'; +$dictionary['Mobile Phone field'] = 'Номер мобильного телефона'; +$dictionary['Land Phone field'] = 'Номер домашнего телефона'; +$dictionary['Website field'] = 'URL веб сайта'; +$dictionary['Everyone'] = 'Все'; +$dictionary['Friends of Friends'] = 'Друзья друзей'; +$dictionary['Only Friends'] = 'Только друзья'; +$dictionary['Only Me'] = 'Никто'; +$dictionary['Save'] = 'Сохранить'; + + +?> Modified: app/locales/layout/ru.php =================================================================== --- app/locales/layout/ru.php 2008-05-01 19:04:14 UTC (rev 148) +++ app/locales/layout/ru.php 2008-05-01 19:05:39 UTC (rev 149) @@ -22,10 +22,15 @@ $dictionary['Messages'] = 'Сообщения'; $dictionary['Save Changes'] = 'Сохранить'; +$dictionary['Save'] = 'Сохранить'; $dictionary['Cancel'] = 'Отмена'; +$dictionary['Not Listed'] = 'Не найден'; $dictionary['PhotoApp'] = 'Фото'; $dictionary['GroupApp'] = 'Группы'; $dictionary['EventApp'] = 'События'; + + + ?> Modified: app/models/city.php =================================================================== --- app/models/city.php 2008-05-01 19:04:14 UTC (rev 148) +++ app/models/city.php 2008-05-01 19:05:39 UTC (rev 149) @@ -10,6 +10,7 @@ } function validateOnCreate () { + $this->validatesPresenceOf('name', "City Name|city name can't be blank"); $this->validatesPresenceOf('country_id', "Country|country can't be blank"); $this->validatesPresenceOf('region_id', "Region|region can't be blank"); if (!$this->getErrors()) { Added: app/models/contact_profile.php =================================================================== --- app/models/contact_profile.php (rev 0) +++ app/models/contact_profile.php 2008-05-01 19:05:39 UTC (rev 149) @@ -0,0 +1,8 @@ +<?php + +class ContactProfile extends ActiveRecord +{ + var $belongs_to = array('User'); +} + +?> Modified: app/models/user.php =================================================================== --- app/models/user.php 2008-05-01 19:04:14 UTC (rev 148) +++ app/models/user.php 2008-05-01 19:05:39 UTC (rev 149) @@ -12,7 +12,7 @@ 'conditions' => 'is_recipient_del = 0'), ); - var $has_one = array('basic_profile'); + var $has_one = array('BasicProfile', 'ContactProfile'); function login($email, $password) { return $this->findFirst(array( 'email' => $email, 'password' => md5($password) )); Modified: app/views/city/_regions.tpl =================================================================== --- app/views/city/_regions.tpl 2008-05-01 19:04:14 UTC (rev 148) +++ app/views/city/_regions.tpl 2008-05-01 19:05:39 UTC (rev 149) @@ -1,2 +1,2 @@ -<label class="shortlabel">_{Region}</label> +<label>_{Region}</label> <?= $form_options_helper->select('city', 'region_id', $Region->collect($regions, 'name', 'id')) ?> Added: app/views/dialog/_access.tpl =================================================================== --- app/views/dialog/_access.tpl (rev 0) +++ app/views/dialog/_access.tpl 2008-05-01 19:05:39 UTC (rev 149) @@ -0,0 +1,33 @@ +<div id="access_dialog_<?= @$params['reference_element'] ?>" class="action_dialog access_dialog"> + <div id="dlgheader">_{Who can see this?}</div> + <div id="dlgbody"> + <div class="field"><?= $text_helper->translate(@$params['title']) ?></div> + <select id="select_<?= @$params['reference_element'] ?>"> + <option value="0">_{Everyone}</option> + <option value="1">_{Friends of Friends}</option> + <option value="2">_{Only Friends}</option> + <option value="4">_{Only Me}</option> + </select> + </div> + <div id="dlgfooter"> + <div id="dlgbuttons" class="buttons"> + <input id="dlgyes" class="submitinput" type="button" value="_{Save}"> + <input id="dlgcancel" class="cancelinput" type="button" value="_{Cancel}"> + </div> + <div class="clearfix"></div> + </div> + <script type="text/javascript"> + var hidden = $('<?= @$params['hidden'] ?>'); + new Dialog.Box('access_dialog_<?= @$params['reference_element'] ?>', { + reference: '<?= @$params['reference_element'] ?>', + width: '<?= @$params['width'] ?>', + onShow: function () { + $('select_<?= @$params['reference_element'] ?>').setValue( $F(hidden) ); + }, + onYes: function () { + hidden.setValue( $F('select_<?= @$params['reference_element'] ?>') ); + } + }).show(); + </script> +</div> + Added: app/views/dialog/_new_city.tpl =================================================================== --- app/views/dialog/_new_city.tpl (rev 0) +++ app/views/dialog/_new_city.tpl 2008-05-01 19:05:39 UTC (rev 149) @@ -0,0 +1,82 @@ +<div id="ncdlg" class="action_dialog city_dialog"> + <div id="dlgheader">_{Add New City}</div> + <div id="dlgbody"> + <form id="city_addition_form"> + <div class="editform"> + <div id="ncdlg_errors"></div> + <div class="formrow"> + <label class="xshortlabel">_{City Name}</label><?= $form_helper->text_field('city', 'name', array('class' => 'mediumtextinput')) ?> + </div> + <div class="formrow"> + <label class="xshortlabel">_{Country}</label> + <?= $form_options_helper->select('city', 'country_id', + $Country->collect($Country->find(), 'name', 'id'), + array(), + array('prompt' => $controller->t('Select Country:'))) ?> + </div> + <div id="ncdlg_regions_list" class="formrow"> + </div> + </div> + </form> + </div> + <div id="dlgfooter"> + <div id="dlgbuttons" class="buttons"> + <input id="dlgyes" class="submitinput" type="button" value="_{Save}"> + <input id="dlgcancel" class="cancelinput" type="button" value="_{Cancel}"> + </div> + <div class="clearfix"></div> + </div> + + <script type="text/javascript"> + + $('city_country_id').onchange = function () { + if ($F(this)) { + new Ajax.Updater('ncdlg_regions_list', '/city/get_regions', { + method: 'post', + postBody: $('city_addition_form').serialize() + }); + } + } + + var input = $('<?= @$params['input'] ?>'); + var hidden = $('<?= @$params['hidden'] ?>'); + new Dialog.Box('ncdlg', { + reference: '<?= @$params['reference_element'] ?>', + hide: false, + clone: false, + yes: '_{Save}', + cancel: '_{Cancel}', + + onShow: function (event, element) { + $('ncdlg_errors').update(); + $('ncdlg_regions_list').update(); + + $('city_country_id').setValue(0); + $('city_name').setValue($F(input)); + }, + + onYes: function (event, element) { + new Ajax.Request('/city/add', { + postBody: $('city_addition_form').serialize(), + onSuccess: function (response) { + if (response.responseText.isJSON()) { + var data = response.responseText.evalJSON(true); + if (data.id) { + $(hidden).setValue(data.id); + $(input).setValue(data.name); + Effect.Fade(element, {duration: 0.3}); + } + } else { + $('ncdlg_errors').update(response.responseText); + } + } + }); + }, + onCancel: function (event, element) { + Effect.Fade(element, { duration: 0.3 }); + } + }).show(); + + </script> + +</div> Modified: app/views/layouts/application.tpl =================================================================== --- app/views/layouts/application.tpl 2008-05-01 19:04:14 UTC (rev 148) +++ app/views/layouts/application.tpl 2008-05-01 19:05:39 UTC (rev 149) @@ -48,6 +48,6 @@ </div> </div> </div> - <?= $controller->renderShared('dialog') ?> + <?= $controller->renderShared('dialogs/loading') ?> </body> </html> Modified: app/views/message/show.tpl =================================================================== --- app/views/message/show.tpl 2008-05-01 19:04:14 UTC (rev 148) +++ app/views/message/show.tpl 2008-05-01 19:05:39 UTC (rev 149) @@ -27,6 +27,7 @@ </div> <script> +/* function delete_single_thread (element) { new Dialog.Box('dlg', { reference: element, @@ -49,6 +50,7 @@ return false; } +*/ function change_location (loc) { location.href="/message/" + loc; Modified: app/views/profile/basic.tpl =================================================================== --- app/views/profile/basic.tpl 2008-05-01 19:04:14 UTC (rev 148) +++ app/views/profile/basic.tpl 2008-05-01 19:05:39 UTC (rev 149) @@ -2,7 +2,6 @@ <?= $controller->renderErrors() ?> - <form action="/profile/basic" method="post"> <div class="editform"> <div class="formrow"> @@ -15,8 +14,7 @@ </div> <div class="formrow"> <label>_{Hometown}:</label> - <?= $city_helper->city_field('basic_profile', 'city_id', array('class' => 'textinput autocomplete')); ?> - <input class="submitinput" style="margin: 0px;" type="button" value="_{Not Listed}?" onclick="new_city_dialog(this, 'basic_profile_city_id', 'auto_basic_profile_city_id')"> + <?= $city_helper->city_field('basic_profile', 'city_id', array('class' => 'cityinput autocomplete')); ?> </div> <div class="formrow"> <label>_{Political views}:</label> @@ -24,7 +22,7 @@ </div> <div class="formrow"> <label>_{Religious views}:</label> - <?= $auto_complete_helper->text_field_with_auto_complete('basic_profile', 'religious_view_id', array('autocomplete' => 'on', 'class' => 'textinput autocomplete'), array('skip_style' => true))?> + <?= $auto_complete_helper->text_field_with_auto_complete('basic_profile', 'religious_view_id', array('autocomplete' => 'on', 'class' => 'shorttextinput autocomplete'), array('skip_style' => true))?> </div> <div class="formrow"> <label></label> @@ -34,5 +32,3 @@ </div> </div> </form> - -<?= $controller->renderShared('new_city_dialog') ?> \ No newline at end of file Modified: app/views/profile/contact.tpl =================================================================== --- app/views/profile/contact.tpl 2008-05-01 19:04:14 UTC (rev 148) +++ app/views/profile/contact.tpl 2008-05-01 19:05:39 UTC (rev 149) @@ -9,20 +9,15 @@ <div class="formcol"> <div class="middle"> <?= $current_user->email ?> - </div> - <a href="#" class="lock">_{Only my friends}</a> + </div> + <div class="third"> + <?= $access_field_helper->access_field('contact', 'email_access', array('title' => 'Email field')); ?> + </div> </div> + <div class="clearfix"></div> </div> <div class="formrow"> <label></label> - <div class="formcol"> - <div class="middle"> - <a href="#">Add / Remove Emails</a> - </div> - </div> - </div> - <div class="formrow"> - <label></label> <div class="formcol"><div class="divider"></div></div> </div> <div class="formrow"> @@ -30,8 +25,9 @@ <div class="formcol"> <div class="middle"> <?= $form_helper->text_field('contact', 'im', array('class' => 'shorttextinput') )?> - </div> - <select class="imselect"> + </div> + <div class="third"> + <select class="imselect"> <option>AIM</option> <option>Google talk</option> <option>Skype</option> @@ -40,15 +36,15 @@ <option>Gadu-Gadu</option> <option>ICQ</option> </select> + </div> </div> </div> <div class="formrow"> <label></label> <div class="formcol"> <div class="middle"> - <a href="#">Add another screen name</a> - </div> - <a href="#" class="lock">_{Only my friends}</a> + <a href="#">Add another screen name</a> + </div> </div> </div> <div class="formrow"> @@ -61,8 +57,10 @@ <div class="formcol"> <div class="middle"> <?= $form_helper->text_field('contact', 'mobile', array('class' => 'shorttextinput') )?> - </div> - <a href="#" class="lock">_{Only my friends}</a> + </div> + <div class="third"> + <?= $access_field_helper->access_field('contact', 'mobile_access', array('title' => 'Mobile Phone field')); ?> + </div> </div> </div> <div class="formrow"> @@ -70,8 +68,10 @@ <div class="formcol"> <div class="middle"> <?= $form_helper->text_field('contact', 'land', array('class' => 'shorttextinput') )?> - </div> - <a href="#" class="lock">_{Only my friends}</a> + </div> + <div class="third"> + <?= $access_field_helper->access_field('contact', 'land_access', array('title' => 'Land Phone field')); ?> + </div> </div> </div> <div class="formrow"> @@ -80,19 +80,11 @@ </div> <div class="formrow"> - <label>_{Country}:</label> - <div class="formcol"> - <div class="middle"> - <?= $form_options_helper->select('basic', 'country_id', $Country->collect($Country->find(), 'name', 'id'), array(), array('prompt' => $controller->t('Select Country:')) )?> - </div> - </div> - </div> - <div class="formrow"> <label>_{City}:</label> <div class="formcol"> <div class="middle"> - <?= $form_helper->text_field('address', 'city', array('class' => 'textinput') )?> - </div> + <?= $city_helper->city_field('contact_profile', 'city_id', array('class' => 'cityinput autocomplete')); ?> + </div> </div> </div> <div class="formrow"> @@ -100,28 +92,19 @@ <div class="formcol"> <div class="middle"> <?= $form_helper->text_field('address', 'mobile', array('class' => 'textinput') )?> - </div> + </div> </div> </div> - <div class="formrow"> - <label></label> - <div class="formcol"> - <div class="middle"></div> - <a href="#" class="lock">_{Only my friends}</a> - </div> - </div> - <div class="formrow"> - <label></label> - <div class="formcol"><div class="divider"></div></div> - </div> <div class="formrow"> <label>_{Website}:</label> <div class="formcol"> <div class="middle"> <?= $form_helper->text_area('address', 'website' )?> - </div> - <a href="#" class="lock">_{Only my friends}</a> + </div> + <div class="third"> + <?= $access_field_helper->access_field('contact', 'website_access', array('title' => 'Website field')); ?> + </div> </div> </div> @@ -132,4 +115,3 @@ </div> </div> </form> - Deleted: app/views/shared/dialog.tpl =================================================================== --- app/views/shared/dialog.tpl 2008-05-01 19:04:14 UTC (rev 148) +++ app/views/shared/dialog.tpl 2008-05-01 19:05:39 UTC (rev 149) @@ -1,13 +0,0 @@ -<div id="dlg" class="action_dialog" style="display: none"> - <div id="dlgheader"> </div> - <div id="dlgbody"> </div> - <div id="dlgfooter"> - <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 class="clearfix"></div> -</div> - Modified: app/views/shared/loggedin/sidebar.tpl =================================================================== --- app/views/shared/loggedin/sidebar.tpl 2008-05-01 19:04:14 UTC (rev 148) +++ app/views/shared/loggedin/sidebar.tpl 2008-05-01 19:05:39 UTC (rev 149) @@ -5,9 +5,8 @@ <form action="/search"> <div id="qsearchwrapper"> <div id="qsearchfield"> - <input id="query" name="query" type="text" class="textinput"> + <input id="query" name="query" type="text" class="mediumtextinput search"> </div> - <div id="qsearchimage"></div> </div> </form> </div> Deleted: app/views/shared/new_city_dialog.tpl =================================================================== --- app/views/shared/new_city_dialog.tpl 2008-05-01 19:04:14 UTC (rev 148) +++ app/views/shared/new_city_dialog.tpl 2008-05-01 19:05:39 UTC (rev 149) @@ -1,87 +0,0 @@ -<script type="text/javascript"> - - function reset_new_city_form () { - // resetting the form - $('ncdlg_errors').update(); - $('ncdlg_regions_list').update(); - $('city_country_id').selectedIndex = 0; - } - - function new_city_dialog(element, hidden, input) { - - new Dialog.Box('ncdlg', { - reference: element, - hide: false, - clone: false, - yes: '_{Save}', - cancel: '_{Cancel}', - onYes: function (event, element) { - new Ajax.Request('/city/add', { - postBody: $('city_addition_form').serialize(), - onSuccess: function (response) { - if (response.responseText.isJSON()) { - var data = response.responseText.evalJSON(true); - if (data.id) { - $(hidden).value = data.id; - $(input).value = data.name; - reset_new_city_form(); - Effect.Fade(element, {duration: 0.3}); - //element.hide(); - } - } else { - $('ncdlg_errors').update(response.responseText); - } - } - }); - }, - onCancel: function (event, element) { - reset_new_city_form(); - // hiding the dialog - //element.hide(); - Effect.Fade(element, {duration: 0.3}); - } - }); - $('city_name').value = $F(input); - return false; - } - - function country_changed(element) { - if ($F(element)) { - new Ajax.Updater('ncdlg_regions_list', '/city/get_regions', { - method: 'post', - postBody: $('city_addition_form').serialize() - }); - } - } -</script> -<div id="ncdlg" class="action_dialog" style="display: none"> - <div id="dlgheader">_{Add New City}</div> - <div id="dlgbody"> -<form id="city_addition_form"> - <div class="editform"> - <div id="ncdlg_errors"></div> - <div class="formrow"> - <label class="shortlabel">_{City Name}</label><?= $form_helper->text_field('city', 'name', array('class' => 'textinput')) ?> - </div> - <div class="formrow"> - <label class="shortlabel">_{Country}</label> - <?= $form_options_helper->select('city', 'country_id', - $Country->collect($Country->find(), 'name', 'id'), - array(), - array('onchange' => "country_changed(this);", - 'prompt' => $controller->t('Select Country:'))) ?> - </div> - <div id="ncdlg_regions_list" class="formrow"> - </div> - </div> -</form> - </div> - <div id="dlgfooter"> - <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 class="clearfix"></div> -</div> Added: public/images/lock_inactive.png =================================================================== (Binary files differ) Property changes on: public/images/lock_inactive.png ___________________________________________________________________ Name: svn:mime-type + application/octet-stream Modified: public/javascripts/autocomplete.js =================================================================== --- public/javascripts/autocomplete.js 2008-05-01 19:04:14 UTC (rev 148) +++ public/javascripts/autocomplete.js 2008-05-01 19:05:39 UTC (rev 149) @@ -8,7 +8,6 @@ }, onComplete: function(request) { - //alert(requist.responseText); this.updateChoices(request.responseText); } @@ -16,8 +15,8 @@ function city_updated (input, prev, hidden, form) { if ($F(input) && (!$F(hidden) || $F(input) != $F(prev))) { - $(hidden).value = ''; - $(prev).value = ''; + $(hidden).setValue(); + $(prev).setValue(); // now we should re-check // whether the city is in the database and put it's id to the hidden @@ -27,9 +26,9 @@ if (response.responseText.isJSON()) { var data = response.responseText.evalJSON(true); if (data.id) { - $(hidden).value = data.id; - $(input).value = data.name; - $(prev).value = data.name; + $(hidden).setValue(data.id); + $(input).setValue(data.name); + $(prev).setValue(data.name); } } else { $(form).show(); @@ -38,8 +37,8 @@ }); } else if (!$F(input)) { - $(hidden).value = ''; - $(prev).value = ''; + $(hidden).setValue(); + $(prev).setValue(); } } Modified: public/javascripts/dialog.js =================================================================== --- public/javascripts/dialog.js 2008-05-01 19:04:14 UTC (rev 148) +++ public/javascripts/dialog.js 2008-05-01 19:05:39 UTC (rev 149) @@ -1,4 +1,5 @@ var Dialog = {}; +Dialog._collection = {}; Dialog.Box = Class.create(); Object.extend(Dialog.Box.prototype, { initialize: function(element, options) { @@ -10,19 +11,14 @@ clone: true }, options || {}); - if (! this.options['reference']) { - alert('Reference element is not specified'); - return; - } - - this.reference = $(this.options['reference']); + this.reference = this.options['reference'] ? $(this.options['reference']) : null; if (!this.reference) { alert('Reference element is not specified'); return; } - this.dialog = this.options.clone ? Element.extend($(element).cloneNode(true)) : $(element); - document.body.appendChild(this.dialog); + //this.dialog = this.options.clone ? Element.extend($(element).cloneNode(true)) : $(element); + this.dialog = $(element); Object.extend(this.dialog.style, { position: 'absolute', @@ -34,6 +30,11 @@ var vdimensions = document.viewport.getDimensions(); var vscrolloffset = document.viewport.getScrollOffsets(); + if (this.options['width']) { + var width = new String(this.options['width']); + this.dialog.style.width = width.endsWith('px') ? width : width + 'px'; + } + if (this.options['hfloat'] == 'right') { this.dialog.style.right = vdimensions.width - offset.left - dimensions.width + "px"; } else { @@ -55,55 +56,65 @@ if (this.options.title) this.title.update(this.options.title); if (this.options.body) this.body.update(this.options.body); - 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)); - }; + if (this.yesButton) this.yesButton.observe('click', this.onYes.bind(this)); + if (this.noButton) this.noButton.observe('click', this.onNo.bind(this)); + if (this.cancelButton) this.cancelButton.observe('click', this.onCancel.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)); - }; + Dialog._collection[$(this.options.reference).id] = 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)); - }; - - Effect.Appear(this.dialog, { duration: 0.3 }); - }, + show: function (event) { + Element.insert(document.body, this.dialog); + Effect.Appear(this.dialog, { duration: 0.3 }); + if (this.options.onShow) { + this.options.onShow(event, this.dialog); + } + }, + + hide: function (event) { + Effect.Fade(this.dialog, { duration: 0.3 }); + if (this.options.onHide) { + this.options.onHide(event, this.dialog); + } + }, + _getDescendant: function (id) { return this.dialog.down('#' + id) || this.dialog.descendants().find( function (d) { return d.id == id; }); }, onYes: function (event) { - if (this.options.hide) Effect.Fade(this.dialog, { duration: 0.3 }); + if (this.options.hide) this.hide(); if (this.options.onYes) { this.options.onYes(event, this.dialog); } }, onNo: function (event) { - if (this.options.hide) Effect.Fade(this.dialog, { duration: 0.3 }); + if (this.options.hide) this.hide(); if (this.options.onNo) { this.options.onNo(event, this.dialog); } }, onCancel: function (event) { - if (this.options.hide) Effect.Fade(this.dialog, { duration: 0.3 }); + if (this.options.hide) this.hide(); if (this.options.onCancel) { this.options.onCancel(event, this.dialog); } } - - }); +function __remote_dialog (url, parameters) { + if (Dialog._collection[parameters.reference_element]) { + Dialog._collection[parameters.reference_element].show(); + } else { + new Ajax.Request(url, { + method: 'get', + parameters: parameters, + onSuccess: function (response) { + var html = new Element('div', { style: "display: none"}).update(response.responseText); + Element.insert(document.body, html); // triggering execution of javascripts + } + }); + } +} Modified: public/stylesheets/autocomplete.css =================================================================== --- public/stylesheets/autocomplete.css 2008-05-01 19:04:14 UTC (rev 148) +++ public/stylesheets/autocomplete.css 2008-05-01 19:05:39 UTC (rev 149) @@ -1,6 +1,6 @@ input.autocomplete { padding-right: 18px; - background: url('/images/spinner-faded.gif') no-repeat right; + background: url('/images/spinner-faded.gif') no-repeat right white; } input.autocomplete.loading { Modified: public/stylesheets/dialog.css =================================================================== --- public/stylesheets/dialog.css 2008-05-01 19:04:14 UTC (rev 148) +++ public/stylesheets/dialog.css 2008-05-01 19:05:39 UTC (rev 149) @@ -1,12 +1,15 @@ .action_dialog { border: 6px solid #999999; - width: 465px; overflow: auto; - top: 34px; position: relative; z-index: 100; + background-color: white; } +.action_dialog .loading { + padding: 30px; +} + .action_dialog #dlgheader { background-color: #6d84b4; border: 1px solid #3b5998; @@ -20,17 +23,35 @@ background-color: #ffffff; color: #000000; font-size: 11px; - padding: 15px; + padding: 10px; } .action_dialog #dlgfooter { background-color: #f2f2f2; border: 1px solid #a6a6a6; - float: left; - width: 463px; + padding: 5px; } .action_dialog #dlgfooter .buttons { margin: 0px 6px 0px 0px; float: right; } + +/* particular dialogs */ + +.loading_dialog { + width: 300px; +} + +.city_dialog { + width: 435px; +} + +.access_dialog { + width: 210px; +} + +.access_dialog .field { + padding-bottom: 10px; +} + This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <agu...@us...> - 2008-05-02 19:38:14
|
Revision: 156 http://isocial.svn.sourceforge.net/isocial/?rev=156&view=rev Author: aguidrevitch Date: 2008-05-02 12:38:21 -0700 (Fri, 02 May 2008) Log Message: ----------- this is supposed to fix ie6 select zindex bug, but it doesn't work for mine wine-emulated ie6 Modified Paths: -------------- public/javascripts/dialog.js public/stylesheets/common/Input.css public/stylesheets/dialog.css Modified: public/javascripts/dialog.js =================================================================== --- public/javascripts/dialog.js 2008-05-02 19:29:42 UTC (rev 155) +++ public/javascripts/dialog.js 2008-05-02 19:38:21 UTC (rev 156) @@ -66,6 +66,27 @@ show: function (event) { Element.insert(document.body, this.dialog); + if (!this.dialog.firstDescendant().hasClassName('select-free') ) { + //this.dialog.insert({top: '<iframe class="select-free" xsrc="about:blank"></iframe>'}); + this.dialog.insert('<!--[if lte IE 6.5]><iframe></iframe><![endif]-->'); + } + + /* + if (!this.dialog.firstDescendant().hasClassName('select-free') ) { + this.dialog.insert({ top: this.ieHack }); + } + + ieHack.setStyle({ + position: 'absolute', + left: this.dialog.offsetLeft + "px", + top: this.dialog.offsetTop + "px", + height: this.dialog.offsetHeight + "px", + width: this.dialog.offsetWidth + "px", + zIndex: this.dialog.zIndex - 10, + border: '1px solid red'}); + */ + + Effect.Appear(this.dialog, { duration: 0.3 }); if (this.options.onShow) { this.options.onShow(event, this.dialog); @@ -73,6 +94,7 @@ }, hide: function (event) { + Effect.Fade(this.dialog, { duration: 0.3 }); if (this.options.onHide) { this.options.onHide(event, this.dialog); Modified: public/stylesheets/common/Input.css =================================================================== --- public/stylesheets/common/Input.css 2008-05-02 19:29:42 UTC (rev 155) +++ public/stylesheets/common/Input.css 2008-05-02 19:38:21 UTC (rev 156) @@ -17,7 +17,7 @@ .cancelinput { color: black; - background-color: lightgray; + background-color: #dddddd; } .shorttextinput { Modified: public/stylesheets/dialog.css =================================================================== --- public/stylesheets/dialog.css 2008-05-02 19:29:42 UTC (rev 155) +++ public/stylesheets/dialog.css 2008-05-02 19:38:21 UTC (rev 156) @@ -1,3 +1,4 @@ + .action_dialog { border: 6px solid #999999; overflow: auto; @@ -2,8 +3,16 @@ position: relative; - z-index: 100; background-color: white; + overflow: hidden; } -.action_dialog .loading { - padding: 30px; +.action_dialog iframe { + display:none;/*sorry for IE5*/ + display/**/:block;/*sorry for IE5*/ + position:absolute;/*must have*/ + top:0;/*must have*/ + left:0;/*must have*/ + z-index:-1;/*must have*/ + filter:mask();/*must have*/ + width:100%;/* must have for any big value*/ + height:100%/* must have for any big value*/; } @@ -48,7 +57,7 @@ } .access_dialog { - width: 210px; + width: 240px; } .access_dialog .field { This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <fsn...@us...> - 2008-06-10 17:09:23
|
Revision: 236 http://isocial.svn.sourceforge.net/isocial/?rev=236&view=rev Author: fsnobody Date: 2008-06-10 10:09:30 -0700 (Tue, 10 Jun 2008) Log Message: ----------- start blogapp Modified Paths: -------------- app/controllers/photoapp/album_controller.php app/models/photoapp_photo.php app/views/shared/loggedin/sidebar.tpl config/routes.php public/stylesheets/common/Application.css Added Paths: ----------- app/controllers/blogapp/ app/controllers/blogapp/blog_controller.php app/controllers/blogapp/post_controller.php app/installers/blogapp/ app/installers/blogapp/blog_installer.php app/models/blogapp_attachment.php app/models/blogapp_post.php app/views/blogapp/ app/views/blogapp/post/ app/views/blogapp/post/_form.tpl app/views/blogapp/post/_menu.tpl app/views/blogapp/post/create.tpl app/views/blogapp/post/index.tpl public/images/blog.png public/stylesheets/blogapp/ public/stylesheets/blogapp/Blogapp.css public/stylesheets/blogapp/Post.css Added: app/controllers/blogapp/blog_controller.php =================================================================== --- app/controllers/blogapp/blog_controller.php (rev 0) +++ app/controllers/blogapp/blog_controller.php 2008-06-10 17:09:30 UTC (rev 236) @@ -0,0 +1,11 @@ +<?php + +class Blogapp_PostController extends ApplicationController +{ + var $models = array('blogapp', 'blogapp_post', 'blogapp_attach'); + + function index () { + } +} + +?> \ No newline at end of file Added: app/controllers/blogapp/post_controller.php =================================================================== --- app/controllers/blogapp/post_controller.php (rev 0) +++ app/controllers/blogapp/post_controller.php 2008-06-10 17:09:30 UTC (rev 236) @@ -0,0 +1,42 @@ +<?php + +class Blogapp_PostController extends ApplicationController +{ + var $models = array('blogapp', 'blogapp_post', 'blogapp_attachment'); + + function index () { + } + + function create () { + if (!empty($this->params['post']) && $this->Request->isPost() ){ + $post = $this->BlogappPost; + $post->media_item->build(); + $post->media_item->user_id = $this->current_user->getId(); + $post->media_item->setAttributes($this->params['post']); + $post->media_item->save(); + $post->media_item_id = $post->media_item->getId(); + $post->save(); + // attach + foreach ($this->uploaded_files as $file) { + unset($attach); + $attach = $this->BlogappAttachment; + $attach->post_id = $post->getId(); + $attach->base_file_id = $file->id; + $attach->save(); + } + + + //$this->debug($post->media_item); + + } + } + +// dev func + function debug($str) { + echo "<pre>"; + print_r($str); + echo "</pre>"; + } +} + +?> \ No newline at end of file Modified: app/controllers/photoapp/album_controller.php =================================================================== --- app/controllers/photoapp/album_controller.php 2008-06-03 09:20:51 UTC (rev 235) +++ app/controllers/photoapp/album_controller.php 2008-06-10 17:09:30 UTC (rev 236) @@ -255,11 +255,6 @@ return array('id' => $this->params['id']); } - function debug($str) { - echo "<pre>"; - print_r($str); - echo "</pre>"; - } } ?> \ No newline at end of file Added: app/installers/blogapp/blog_installer.php =================================================================== --- app/installers/blogapp/blog_installer.php (rev 0) +++ app/installers/blogapp/blog_installer.php 2008-06-10 17:09:30 UTC (rev 236) @@ -0,0 +1,30 @@ +<?php +class BlogInstaller extends AkInstaller +{ + var $module = 'blogapp'; + + function up_1() + { + $this->execute( + "CREATE TABLE `blogapp_posts` ( + `id` int(11) NOT NULL PRIMARY KEY AUTO_INCREMENT, + `media_item_id` int(11) NOT NULL, + FOREIGN KEY (media_item_id) REFERENCES media_items(id) + ) ENGINE=InnoDB"); + + $this->execute( + "CREATE TABLE `blogapp_attachments` ( + `id` int(11) NOT NULL PRIMARY KEY AUTO_INCREMENT, + `post_id` int(11) NOT NULL, + `base_file_id` int(11) NOT NULL, + FOREIGN KEY (base_file_id) REFERENCES base_files(id) + ) ENGINE=InnoDB"); + } + + function down_1() + { + $this->dropTable('blogapp_attachments'); + $this->dropTable('blogapp_posts'); + } +} +?> \ No newline at end of file Added: app/models/blogapp_attachment.php =================================================================== --- app/models/blogapp_attachment.php (rev 0) +++ app/models/blogapp_attachment.php 2008-06-10 17:09:30 UTC (rev 236) @@ -0,0 +1,14 @@ +<?php + +class BlogappAttachment extends ActiveRecord +{ + + var $belongs_to = array('post' => array('class_name' => 'BlogappPost', + 'primary_key_name' => 'post_id') + ); + + + var $has_many = array( 'stored_files' => array('class_name' => 'StoredFile', 'foreign_key' => 'base_file_id') ); +} + +?> Added: app/models/blogapp_post.php =================================================================== --- app/models/blogapp_post.php (rev 0) +++ app/models/blogapp_post.php 2008-06-10 17:09:30 UTC (rev 236) @@ -0,0 +1,19 @@ +<?php + +class BlogappPost extends ActiveRecord +{ + + var $has_one = array('media_item' => array('class_name' => 'MediaItem', + 'foreign_key' => 'media_item_id') + ); + var $has_many = array( 'attachments' => array('class_name' => 'BlogappAttachment', + 'foreign_key' => 'post_id') ); + + + + function validateOnCreate () + { + } +} + +?> Modified: app/models/photoapp_photo.php =================================================================== --- app/models/photoapp_photo.php 2008-06-03 09:20:51 UTC (rev 235) +++ app/models/photoapp_photo.php 2008-06-10 17:09:30 UTC (rev 236) @@ -7,9 +7,6 @@ 'media_item' => array('class_name' => 'MediaItem', 'primary_key_name' => 'media_item_id') ); - //var $has_one = array('media_item' => array('class_name' => 'MediaItem', 'primary_key_name' => 'media_item_id')); - - /* function beforeDestroy() { $this->stored_file->load(); Added: app/views/blogapp/post/_form.tpl =================================================================== --- app/views/blogapp/post/_form.tpl (rev 0) +++ app/views/blogapp/post/_form.tpl 2008-06-10 17:09:30 UTC (rev 236) @@ -0,0 +1,28 @@ + <div class="formrow"> + <?= $controller->renderErrors() ?> + </div> + + <div class="formrow"> + <label class="required">_{Post Name}:<br><small>(_{required})</small></label> + <div class="formcol"> + <?= $form_helper->text_field('post', 'title', array('class' => 'textinput')) ?> + </div> + <div class="clearfix"></div> + </div> + + <div class="formrow"> + <label class="required">_{Body}:<br><small>(_{required})</small></label> + <div class="formcol"> + <?= $form_helper->text_area('post', 'body', array('rows' => '5')) ?> + </div> + <div class="clearfix"></div> + </div> + + <div class="formrow"> + <label class="required">_{Attach}:<br><small>(_{required})</small></label> + <div class="formcol"> + <?= $form_helper->file_field('post', 'base_file_id', array('class' => 'textinput small')) ?> + </div> + <div class="clearfix"></div> + </div> + Added: app/views/blogapp/post/_menu.tpl =================================================================== --- app/views/blogapp/post/_menu.tpl (rev 0) +++ app/views/blogapp/post/_menu.tpl 2008-06-10 17:09:30 UTC (rev 236) @@ -0,0 +1,15 @@ +<div class="tabs"> + <div class="left"> + <ul class="toggle_tabs"> + <li class="first"><a href="/blogapp" class="<?= $controller->getActionName() == 'index' ? 'selected' : '' ?>">_{My Posts}</a></li><? + ?><li><a href="/blogapp" class="<?= in_array($controller->getActionName(), array('edit', 'create')) ? 'selected' : '' ?>">_{Edit / Create Post}</a></li><? + ?><li><a href="/blogapp" class="last <?= $controller->getActionName() == 'smth' ? 'selected' : '' ?>">_{Smth}</a></li> + </ul> + </div> + <div class="right"> + <ul class="toggle_tabs"> + <li class="first last"><a href="/blogapp/post/help" class="<?= $controller->getActionName() == 'help' ? 'selected' : '' ?>">_{Help}</a></li> + </ul> + </div> +</div> +<div class="clearfix"> </div> Added: app/views/blogapp/post/create.tpl =================================================================== --- app/views/blogapp/post/create.tpl (rev 0) +++ app/views/blogapp/post/create.tpl 2008-06-10 17:09:30 UTC (rev 236) @@ -0,0 +1,28 @@ +<?= $controller->renderPartial("menu") ?> + +<?= $controller->renderErrors() ?> + +The create + + +<div class="editform"> + + <form action="/blogapp/post/create" method="post" enctype="multipart/form-data"> + + <?= $controller->renderPartial("form") ?> + + <div class="formrow"> + <label> </label> + <div class="formcol"> + <input class="submitinput" type="submit" value="_{Create Post}"> + <input class="cancelinput" type="button" value="_{Cancel}"> + </div> + <div class="clearfix"></div> + </div> + + + + </form> +</div> + +<div class="clearfix"></div> Added: app/views/blogapp/post/index.tpl =================================================================== --- app/views/blogapp/post/index.tpl (rev 0) +++ app/views/blogapp/post/index.tpl 2008-06-10 17:09:30 UTC (rev 236) @@ -0,0 +1,19 @@ +<?= $controller->renderPartial("menu") ?> + +<?= $controller->renderErrors() ?> + +<div class="title_bar"> + <div class="avatar"> + <a href="/profile/show/"><img src="/images/nophoto_men_sm.gif" alt="" class=""></a> + </div> + <div class="info"> + <div class="header"> + <div class="name blogapp">_{My Posts}</div> + </div> + <div class="clearfix"></div> + <div class="subheader red"><a href="/blogapp/post/create">_{Create a New Post}</a></div> + </div> +<div class="clearfix"></div> +</div> + +<div class="clearfix"></div> Modified: app/views/shared/loggedin/sidebar.tpl =================================================================== --- app/views/shared/loggedin/sidebar.tpl 2008-06-03 09:20:51 UTC (rev 235) +++ app/views/shared/loggedin/sidebar.tpl 2008-06-10 17:09:30 UTC (rev 236) @@ -13,5 +13,6 @@ <div id="applications"> <a href="/photoapp" class="photoapp">_{PhotoApp}</a> <a href="/groupapp" class="groupapp">_{GroupApp}</a> + <a href="/blogapp" class="blogapp">_{BlogApp}</a> <a href="/event" class="eventapp">_{EventApp}</a> </div> \ No newline at end of file Modified: config/routes.php =================================================================== --- config/routes.php 2008-06-03 09:20:51 UTC (rev 235) +++ config/routes.php 2008-06-10 17:09:30 UTC (rev 236) @@ -8,6 +8,7 @@ $Map->connect('/groupapp/board/:action/:id', array('controller' => 'board', 'module' => 'groupapp')); $Map->connect('/groupapp/group/:action/:id', array('controller' => 'group', 'module' => 'groupapp')); $Map->connect('/photoapp/:controller/:action/:id', array('controller' => 'album', 'module' => 'photoapp')); +$Map->connect('/blogapp/:controller/:action/:id', array('controller' => 'post', 'module' => 'blogapp')); //$Map->connect('/preview/:action/:size/:path',array('controller' => 'preview', 'action' => 'index') ); $Map->connect('/preview/:size/*path', array('controller' => 'preview', 'action' => 'index')); Added: public/images/blog.png =================================================================== (Binary files differ) Property changes on: public/images/blog.png ___________________________________________________________________ Name: svn:mime-type + application/octet-stream Added: public/stylesheets/blogapp/Blogapp.css =================================================================== --- public/stylesheets/blogapp/Blogapp.css (rev 0) +++ public/stylesheets/blogapp/Blogapp.css 2008-06-10 17:09:30 UTC (rev 236) @@ -0,0 +1,48 @@ +.red { border: 1px solid red;} +.title_bar { + background-color: #ffffff; +} + +.title_bar .avatar { + margin: 10px 10px 0px 20px; + overflow: hidden; + height: 50px; + width: 50px; + z-index: 1; + position: relative; +} + +.title_bar .avatar img{ + display: block; +} + +.title_bar .info { + position: relative; + top: -50px; + left: 0px; + margin: 0px 0px -50px 0px; + padding: 0px 0px 0px 80px; +} + +.title_bar .info .header { + background: #f7f7f7; + z-index: 0; + border-bottom: solid 1px #cccccc; + margin: -10px 0px 7px -80px; + padding: 10px 0px 0px 80px; +} + + +.name { + font-weight: bold; + font-size: 14px; + padding: 7px 0px 7px 22px; +} + +.title_bar .info .subheader { +} + +.title_bar .head { + padding: 10px 0px 10px 30px; + border-bottom: solid 1px #cccccc; +} Added: public/stylesheets/blogapp/Post.css =================================================================== --- public/stylesheets/blogapp/Post.css (rev 0) +++ public/stylesheets/blogapp/Post.css 2008-06-10 17:09:30 UTC (rev 236) @@ -0,0 +1 @@ +.x {} \ No newline at end of file Modified: public/stylesheets/common/Application.css =================================================================== --- public/stylesheets/common/Application.css 2008-06-03 09:20:51 UTC (rev 235) +++ public/stylesheets/common/Application.css 2008-06-10 17:09:30 UTC (rev 236) @@ -253,6 +253,10 @@ background: url('/images/calendar.png') no-repeat 0px; } +.blogapp { + background: url('/images/blog.png') no-repeat 0px; +} + .linksarea a { padding: 2px 5px 2px 5px; } This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |