Thread: [Isocial-svn] SF.net SVN: isocial: [33]
Status: Pre-Alpha
Brought to you by:
aguidrevitch
From: <agu...@us...> - 2008-02-29 12:59:03
|
Revision: 33 http://isocial.svn.sourceforge.net/isocial/?rev=33&view=rev Author: aguidrevitch Date: 2008-02-29 02:19:57 -0800 (Fri, 29 Feb 2008) Log Message: ----------- sharing errors, sidebar, pageheader templates Modified Paths: -------------- app/application_controller.php app/controllers/user_controller.php app/views/user/confirm.tpl app/views/user/forgot_password.tpl app/views/user/login.tpl app/views/user/register.tpl app/views/user/reset_password.tpl config/DEFAULT-config.php Added Paths: ----------- app/views/shared/ app/views/shared/compiled/ app/views/shared/compiled/errors.tpl.php app/views/shared/default/ app/views/shared/default/compiled/ app/views/shared/default/compiled/pageheader.tpl.php app/views/shared/default/compiled/sidebar.tpl.php app/views/shared/default/pageheader.tpl app/views/shared/default/sidebar.tpl app/views/shared/errors.tpl app/views/shared/loggedin/ app/views/shared/loggedin/compiled/ app/views/shared/loggedin/compiled/pageheader.tpl.php app/views/shared/loggedin/compiled/sidebar.tpl.php app/views/shared/loggedin/pageheader.tpl app/views/shared/loggedin/sidebar.tpl Removed Paths: ------------- app/views/default/_pageheader.tpl app/views/default/_sidebar.tpl app/views/user/_errors.tpl app/views/user/_pageheader.tpl app/views/user/_pageheader_loggedin.tpl app/views/user/_sidebar.tpl app/views/user/_sidebar_loggedin.tpl Modified: app/application_controller.php =================================================================== --- app/application_controller.php 2008-02-26 11:33:47 UTC (rev 32) +++ app/application_controller.php 2008-02-29 10:19:57 UTC (rev 33) @@ -138,14 +138,24 @@ return $this->_errors; } + function renderShared ( $template ) + { + return $this->render(array('template' => AK_VIEWS_DIR . DS . "shared/$template" , 'layout' => false, 'partial' => true)); + } + + function renderErrors () + { + return $this->renderShared("errors"); + } + function renderSidebar() { - return $this->renderPartial("sidebar"); + return $this->renderShared("default/sidebar"); } function renderPageHeader() { - return $this->renderPartial("pageheader"); + return $this->renderShared("default/pageheader"); } function _fix_email ($value) { Modified: app/controllers/user_controller.php =================================================================== --- app/controllers/user_controller.php 2008-02-26 11:33:47 UTC (rev 32) +++ app/controllers/user_controller.php 2008-02-29 10:19:57 UTC (rev 33) @@ -150,14 +150,14 @@ function renderSidebar () { if ($this->current_user) { - return $this->renderPartial("sidebar_loggedin"); + return $this->renderShared("loggedin/sidebar"); } return parent::renderSidebar(); } function renderPageHeader () { if ($this->current_user) { - return $this->renderPartial("pageheader_loggedin"); + return $this->renderShared("loggedin/pageheader"); } return parent::renderPageHeader(); } Deleted: app/views/default/_pageheader.tpl =================================================================== --- app/views/default/_pageheader.tpl 2008-02-26 11:33:47 UTC (rev 32) +++ app/views/default/_pageheader.tpl 2008-02-29 10:19:57 UTC (rev 33) @@ -1,3 +0,0 @@ -<ul id="headermenuright"> - <li><a href="/user/login">_{Login}</a></li> -</ul> \ No newline at end of file Deleted: app/views/default/_sidebar.tpl =================================================================== --- app/views/default/_sidebar.tpl 2008-02-26 11:33:47 UTC (rev 32) +++ app/views/default/_sidebar.tpl 2008-02-29 10:19:57 UTC (rev 33) @@ -1,20 +0,0 @@ -<div id="quicklogin"> - <form action="/user/login" method="post"> - <label> - <span>_{Email}:</span> - <input class="textinput" type="text" name="email"> - </label> - <label> - <span>_{Password}:</span> - <input class="textinput" type="password" name="password"> - </label> - <label class="persistent"> - <input class="checkboxinput" type="checkbox" name="remember_me"> - <span>_{Remember me}</span> - </label> - <input class="submitinput" type="submit" value="_{Login}"> - - </form> - - <a href="/user/forgot_password">_{Forgot Password?}</a> -</div> \ No newline at end of file Added: app/views/shared/compiled/errors.tpl.php =================================================================== --- app/views/shared/compiled/errors.tpl.php (rev 0) +++ app/views/shared/compiled/errors.tpl.php 2008-02-29 10:19:57 UTC (rev 33) @@ -0,0 +1,14 @@ +<?php if (count($controller->getErrors())) { + foreach ($controller->getErrors() as $field => $values) { + foreach ($values as $value) { + echo '<div class="error">'; + echo '<h1>' . $value[0] . '</h1>'; + if (isset($value[1])) { + echo '<p>' . $value[1] . '</p>'; + } + echo '</div>'; + } + break; + } +} +?> Added: app/views/shared/default/compiled/pageheader.tpl.php =================================================================== --- app/views/shared/default/compiled/pageheader.tpl.php (rev 0) +++ app/views/shared/default/compiled/pageheader.tpl.php 2008-02-29 10:19:57 UTC (rev 33) @@ -0,0 +1,3 @@ +<ul id="headermenuright"> + <li><a href="/user/login"><?php echo $text_helper->translate('Login', array()); ?></a></li> +</ul> \ No newline at end of file Added: app/views/shared/default/compiled/sidebar.tpl.php =================================================================== --- app/views/shared/default/compiled/sidebar.tpl.php (rev 0) +++ app/views/shared/default/compiled/sidebar.tpl.php 2008-02-29 10:19:57 UTC (rev 33) @@ -0,0 +1,4 @@ +<div id="quicklogin"> + <?php echo $text_helper->translate('Everyone Can Join', array()); ?> +<a class="linkbutton" href="/user/register"><div><?php echo $text_helper->translate('Sign Up', array()); ?></div></a> +</div> \ No newline at end of file Added: app/views/shared/default/pageheader.tpl =================================================================== --- app/views/shared/default/pageheader.tpl (rev 0) +++ app/views/shared/default/pageheader.tpl 2008-02-29 10:19:57 UTC (rev 33) @@ -0,0 +1,3 @@ +<ul id="headermenuright"> + <li><a href="/user/login">_{Login}</a></li> +</ul> \ No newline at end of file Added: app/views/shared/default/sidebar.tpl =================================================================== --- app/views/shared/default/sidebar.tpl (rev 0) +++ app/views/shared/default/sidebar.tpl 2008-02-29 10:19:57 UTC (rev 33) @@ -0,0 +1,4 @@ +<div id="quicklogin"> + _{Everyone Can Join} +<a class="linkbutton" href="/user/register"><div>_{Sign Up}</div></a> +</div> \ No newline at end of file Added: app/views/shared/errors.tpl =================================================================== --- app/views/shared/errors.tpl (rev 0) +++ app/views/shared/errors.tpl 2008-02-29 10:19:57 UTC (rev 33) @@ -0,0 +1,15 @@ +<? +if (count($controller->getErrors())) { + foreach ($controller->getErrors() as $field => $values) { + foreach ($values as $value) { + echo '<div class="error">'; + echo '<h1>' . $value[0] . '</h1>'; + if (isset($value[1])) { + echo '<p>' . $value[1] . '</p>'; + } + echo '</div>'; + } + break; + } +} +?> Added: app/views/shared/loggedin/compiled/pageheader.tpl.php =================================================================== --- app/views/shared/loggedin/compiled/pageheader.tpl.php (rev 0) +++ app/views/shared/loggedin/compiled/pageheader.tpl.php 2008-02-29 10:19:57 UTC (rev 33) @@ -0,0 +1,8 @@ +<ul id="headermenuleft"> + <li><a class="globallink" href="/profile/"><?php echo $text_helper->translate('Profile', array()); ?></a> <a href="/profile/edit"><?php echo $text_helper->translate('edit', array()); ?></a></li> + <li><a class="globallink" href="/friend/"><?php echo $text_helper->translate('Friends', array()); ?></a></li> + <li><a class="globallink" href="/message/"><?php echo $text_helper->translate('Inbox', array()); ?> (0)</a></li> +</ul> +<ul id="headermenuright"> + <li><a href="/user/logout"><?php echo $text_helper->translate('Logout', array()); ?></a></li> +</ul> \ No newline at end of file Added: app/views/shared/loggedin/compiled/sidebar.tpl.php =================================================================== --- app/views/shared/loggedin/compiled/sidebar.tpl.php (rev 0) +++ app/views/shared/loggedin/compiled/sidebar.tpl.php 2008-02-29 10:19:57 UTC (rev 33) @@ -0,0 +1,18 @@ +<div id="qsearch"> + <div> + <h2>Search</h2> + </div> + <form action="/search"> + <div id="qsearchwrapper"> + <div id="qsearchfield"> + <input id="query" name="query" type="text" class="textinput"> + </div> + <div id="qsearchimage">a + </div> + </div> + </form> +</div> +<div id="applications"> + <div>Photos</div> + <div>Groups</div> +</div> \ No newline at end of file Added: app/views/shared/loggedin/pageheader.tpl =================================================================== --- app/views/shared/loggedin/pageheader.tpl (rev 0) +++ app/views/shared/loggedin/pageheader.tpl 2008-02-29 10:19:57 UTC (rev 33) @@ -0,0 +1,8 @@ +<ul id="headermenuleft"> + <li><a class="globallink" href="/profile/">_{Profile}</a> <a href="/profile/edit">_{edit}</a></li> + <li><a class="globallink" href="/friend/">_{Friends}</a></li> + <li><a class="globallink" href="/message/">_{Inbox} (0)</a></li> +</ul> +<ul id="headermenuright"> + <li><a href="/user/logout">_{Logout}</a></li> +</ul> \ No newline at end of file Added: app/views/shared/loggedin/sidebar.tpl =================================================================== --- app/views/shared/loggedin/sidebar.tpl (rev 0) +++ app/views/shared/loggedin/sidebar.tpl 2008-02-29 10:19:57 UTC (rev 33) @@ -0,0 +1,18 @@ +<div id="qsearch"> + <div> + <h2>Search</h2> + </div> + <form action="/search"> + <div id="qsearchwrapper"> + <div id="qsearchfield"> + <input id="query" name="query" type="text" class="textinput"> + </div> + <div id="qsearchimage">a + </div> + </div> + </form> +</div> +<div id="applications"> + <div>Photos</div> + <div>Groups</div> +</div> \ No newline at end of file Deleted: app/views/user/_errors.tpl =================================================================== --- app/views/user/_errors.tpl 2008-02-26 11:33:47 UTC (rev 32) +++ app/views/user/_errors.tpl 2008-02-29 10:19:57 UTC (rev 33) @@ -1,15 +0,0 @@ -<? -if (count($controller->getErrors())) { - foreach ($controller->getErrors() as $field => $values) { - foreach ($values as $value) { - echo '<div class="error">'; - echo '<h1>' . $value[0] . '</h1>'; - if (isset($value[1])) { - echo '<p>' . $value[1] . '</p>'; - } - echo '</div>'; - } - break; - } -} -?> Deleted: app/views/user/_pageheader.tpl =================================================================== --- app/views/user/_pageheader.tpl 2008-02-26 11:33:47 UTC (rev 32) +++ app/views/user/_pageheader.tpl 2008-02-29 10:19:57 UTC (rev 33) @@ -1,3 +0,0 @@ -<ul id="headermenuright"> - <li><a href="/user/login">_{Login}</a></li> -</ul> \ No newline at end of file Deleted: app/views/user/_pageheader_loggedin.tpl =================================================================== --- app/views/user/_pageheader_loggedin.tpl 2008-02-26 11:33:47 UTC (rev 32) +++ app/views/user/_pageheader_loggedin.tpl 2008-02-29 10:19:57 UTC (rev 33) @@ -1,8 +0,0 @@ -<ul id="headermenuleft"> - <li><a class="globallink" href="/profile/">_{Profile}</a> <a href="/profile/edit">_{edit}</a></li> - <li><a class="globallink" href="/friend/">_{Friends}</a></li> - <li><a class="globallink" href="/message/">_{Inbox} (0)</a></li> -</ul> -<ul id="headermenuright"> - <li><a href="/user/logout">_{Logout}</a></li> -</ul> \ No newline at end of file Deleted: app/views/user/_sidebar.tpl =================================================================== --- app/views/user/_sidebar.tpl 2008-02-26 11:33:47 UTC (rev 32) +++ app/views/user/_sidebar.tpl 2008-02-29 10:19:57 UTC (rev 33) @@ -1,4 +0,0 @@ -<div id="quicklogin"> - _{Everyone Can Join} -<a class="linkbutton" href="/user/register"><div>_{Sign Up}</div></a> -</div> \ No newline at end of file Deleted: app/views/user/_sidebar_loggedin.tpl =================================================================== --- app/views/user/_sidebar_loggedin.tpl 2008-02-26 11:33:47 UTC (rev 32) +++ app/views/user/_sidebar_loggedin.tpl 2008-02-29 10:19:57 UTC (rev 33) @@ -1,18 +0,0 @@ -<div id="qsearch"> - <div> - <h2>Search</h2> - </div> - <form action="/search"> - <div id="qsearchwrapper"> - <div id="qsearchfield"> - <input id="query" name="query" type="text" class="textinput"> - </div> - <div id="qsearchimage">a - </div> - </div> - </form> -</div> -<div id="applications"> - <div>Photos</div> - <div>Groups</div> -</div> \ No newline at end of file Modified: app/views/user/confirm.tpl =================================================================== --- app/views/user/confirm.tpl 2008-02-26 11:33:47 UTC (rev 32) +++ app/views/user/confirm.tpl 2008-02-29 10:19:57 UTC (rev 33) @@ -2,7 +2,7 @@ <? if ($controller->getErrors()) { - echo $controller->renderPartial("errors"); + echo $controller->renderErrors(); } else { ?> <p>_{Thank you for registration}</p><br> <p><a href="/user/login">_{go to login}</a></p> Modified: app/views/user/forgot_password.tpl =================================================================== --- app/views/user/forgot_password.tpl 2008-02-26 11:33:47 UTC (rev 32) +++ app/views/user/forgot_password.tpl 2008-02-29 10:19:57 UTC (rev 33) @@ -1,6 +1,6 @@ <div class="title">_{Trouble Accessing Your Account}?</div> -<?= $controller->renderPartial("errors") ?> +<?= $controller->renderErrors() ?> <p>_{Forgot Password}? _{Enter your login email below}. _{We will send you an email with a link to reset your password}.</p> Modified: app/views/user/login.tpl =================================================================== --- app/views/user/login.tpl 2008-02-26 11:33:47 UTC (rev 32) +++ app/views/user/login.tpl 2008-02-29 10:19:57 UTC (rev 33) @@ -1,6 +1,6 @@ <div class="title">_{iSocial Login}</div> -<?= $controller->renderPartial("errors") ?> +<?= $controller->renderErrors() ?> <form action="/user/login" method="post"> <div class="loginform"> Modified: app/views/user/register.tpl =================================================================== --- app/views/user/register.tpl 2008-02-26 11:33:47 UTC (rev 32) +++ app/views/user/register.tpl 2008-02-29 10:19:57 UTC (rev 33) @@ -1,6 +1,6 @@ <div class="title">_{Sign Up}</div> -<?= $controller->renderPartial("errors") ?> +<?= $controller->renderErrors() ?> <form action="/user/register" method="post"> <div class="loginform"> Modified: app/views/user/reset_password.tpl =================================================================== --- app/views/user/reset_password.tpl 2008-02-26 11:33:47 UTC (rev 32) +++ app/views/user/reset_password.tpl 2008-02-29 10:19:57 UTC (rev 33) @@ -2,7 +2,7 @@ <? if ($controller->getErrors()) { - echo $controller->renderPartial("errors"); + echo $controller->renderErrors(); } else { ?> <div align="center">_{Please enter a new password}.</div> <form action="/user/reset_password" method="post"> Modified: config/DEFAULT-config.php =================================================================== --- config/DEFAULT-config.php 2008-02-26 11:33:47 UTC (rev 32) +++ config/DEFAULT-config.php 2008-02-29 10:19:57 UTC (rev 33) @@ -50,6 +50,8 @@ // disable automatic translations define('AK_AUTOMATICALLY_UPDATE_LANGUAGE_FILES', false); +// disable security checks, at least before http://trac.akelos.org/ticket/122 gets fixed +define('AK_TEMPLATE_SECURITY_CHECK', false); define('I_NOREPLAY_EMAIL', ''); This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <di...@us...> - 2008-02-29 15:53:22
|
Revision: 34 http://isocial.svn.sourceforge.net/isocial/?rev=34&view=rev Author: dim0s77 Date: 2008-02-29 07:53:28 -0800 (Fri, 29 Feb 2008) Log Message: ----------- added the basis for messaging Modified Paths: -------------- app/application_controller.php app/controllers/default_controller.php app/controllers/user_controller.php app/locales/layout/ru.php app/views/shared/loggedin/compiled/pageheader.tpl.php app/views/shared/loggedin/pageheader.tpl app/views/user/home.tpl public/stylesheets/Application.css Added Paths: ----------- app/controllers/message_controller.php app/installers/message_installer.php app/locales/message/ app/locales/message/en.php app/locales/message/ru.php app/views/message/ app/views/message/_menu.tpl app/views/message/inbox.tpl app/views/message/outbox.tpl app/views/message/send.tpl public/stylesheets/Message.css Modified: app/application_controller.php =================================================================== --- app/application_controller.php 2008-02-29 10:19:57 UTC (rev 33) +++ app/application_controller.php 2008-02-29 15:53:28 UTC (rev 34) @@ -150,12 +150,12 @@ function renderSidebar() { - return $this->renderShared("default/sidebar"); + return $this->renderShared("loggedin/sidebar"); } function renderPageHeader() { - return $this->renderShared("default/pageheader"); + return $this->renderShared("loggedin/pageheader"); } function _fix_email ($value) { Modified: app/controllers/default_controller.php =================================================================== --- app/controllers/default_controller.php 2008-02-29 10:19:57 UTC (rev 33) +++ app/controllers/default_controller.php 2008-02-29 15:53:28 UTC (rev 34) @@ -8,9 +8,20 @@ function index() { if ($this->_getUserFromSession()) { - $this->redirectTo(array( 'controller' => 'user', 'action' => 'index')); - } + $this->redirectTo(array( 'controller' => 'user', 'action' => 'index')); + } } + + function renderSidebar() + { + return $this->renderShared("default/sidebar"); + } + + function renderPageHeader() + { + return $this->renderShared("default/pageheader"); + } + } ?> \ No newline at end of file Added: app/controllers/message_controller.php =================================================================== --- app/controllers/message_controller.php (rev 0) +++ app/controllers/message_controller.php 2008-02-29 15:53:28 UTC (rev 34) @@ -0,0 +1,21 @@ +<?php + +class MessageController extends ApplicationController +{ + //var $models = 'user, message'; + + function index () { + $this->redirectTo(array('action' => 'inbox')); + } + + function inbox () { + } + + function outbox () { + } + + function send () { + } + +} +?> \ No newline at end of file Modified: app/controllers/user_controller.php =================================================================== --- app/controllers/user_controller.php 2008-02-29 10:19:57 UTC (rev 33) +++ app/controllers/user_controller.php 2008-02-29 15:53:28 UTC (rev 34) @@ -8,16 +8,7 @@ function beforeAction ( $method = '' ) { $user = $this->_getUserFromSession(); - if (!$user && - $method != 'login' && - $method != 'logout' && - $method != 'register' && - $method != 'thankyou' && - $method != 'laststep' && - $method != 'confirm' && - $method != 'forgot_password' && - $method != 'reset_password' - ) { + if (!$user && $method == 'home') { $this->redirectToAction( 'login' ); } } @@ -149,15 +140,15 @@ } function renderSidebar () { - if ($this->current_user) { - return $this->renderShared("loggedin/sidebar"); + if (!$this->current_user) { + return $this->renderShared("default/sidebar"); } return parent::renderSidebar(); } function renderPageHeader () { - if ($this->current_user) { - return $this->renderShared("loggedin/pageheader"); + if (!$this->current_user) { + return $this->renderShared("default/pageheader"); } return parent::renderPageHeader(); } Added: app/installers/message_installer.php =================================================================== --- app/installers/message_installer.php (rev 0) +++ app/installers/message_installer.php 2008-02-29 15:53:28 UTC (rev 34) @@ -0,0 +1,28 @@ +<?php +class MessageInstaller extends AkInstaller +{ + function up_1() + { + $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, + `subject` char(255) NOT NULL DEFAULT '', + `body` text NOT NULL DEFAULT '', + `created_at` datetime NOT NULL, + `updated_at` datetime NOT NULL, + `read` tinyint(1) NOT NULL DEFAULT '0' + ) ENGINE=InnoDB"); + + } + + function down_1() + { + /**/ + $this->dropTable('messages'); + /**/ + } +} + +?> Modified: app/locales/layout/ru.php =================================================================== --- app/locales/layout/ru.php 2008-02-29 10:19:57 UTC (rev 33) +++ app/locales/layout/ru.php 2008-02-29 15:53:28 UTC (rev 34) @@ -18,6 +18,6 @@ $dictionary['or'] = 'или'; $dictionary['Profile'] = 'Профиль'; $dictionary['Friends'] = 'Друзья'; -$dictionary['Inbox'] = 'Сообщения'; +$dictionary['Messages'] = 'Сообщения'; ?> Added: app/locales/message/en.php =================================================================== --- app/locales/message/en.php (rev 0) +++ app/locales/message/en.php 2008-02-29 15:53:28 UTC (rev 34) @@ -0,0 +1,7 @@ +<?php + +// File created on: 2008-02-17 15:13:51 + +$dictionary = array(); + +?> Added: app/locales/message/ru.php =================================================================== --- app/locales/message/ru.php (rev 0) +++ app/locales/message/ru.php 2008-02-29 15:53:28 UTC (rev 34) @@ -0,0 +1,25 @@ +<?php + +// File created on: 2008-02-17 15:13:51 + +$dictionary = array(); +$dictionary['Inbox'] = 'Входящие'; +$dictionary['Outbox'] = 'Отправленные'; +$dictionary['Send Message'] = 'Послать сообщение'; +$dictionary['You currently don\'t have any messages'] = 'В настоящее время у Вас нет сообщений'; +$dictionary['To'] = 'Кому'; +$dictionary['Subject'] = 'Тема'; +$dictionary['Message'] = 'Сообщение'; +$dictionary['Send'] = 'Послать'; +$dictionary['Cancel'] = 'Отмена'; +$dictionary['Select'] = 'Выбрать'; +$dictionary['None'] = 'Ничего'; +$dictionary['Read'] = 'Прочтенные'; +$dictionary['Unread'] = 'Непрочтенные'; +$dictionary['All'] = 'Все'; +$dictionary['Mark as Unread'] = 'Отметить как непрочтенные'; +$dictionary['Mark as Read'] = 'Отметить как прочтенные'; +$dictionary['Delete'] = 'Удалить'; + + +?> Added: app/views/message/_menu.tpl =================================================================== --- app/views/message/_menu.tpl (rev 0) +++ app/views/message/_menu.tpl 2008-02-29 15:53:28 UTC (rev 34) @@ -0,0 +1,12 @@ +<div class="tabs"> + <div class="left"> + <ul class="toggle_tabs"> + <li class="first"><a href="/message/inbox" class="<?= $controller->getActionName() == 'inbox' ? 'selected' : '' ?>">_{Inbox}</a></li><li><a href="/message/outbox" class="last <?= $controller->getActionName() == 'outbox' ? 'selected' : '' ?>">_{Outbox}</a></li> + </ul> + </div> + <div class="right"> + <ul class="toggle_tabs"> + <li class="first last"><a href="/message/send" class="<?= $controller->getActionName() == 'send' ? 'selected' : '' ?>">_{Send Message}</a></li> + </ul> + </div> +</div> Added: app/views/message/inbox.tpl =================================================================== --- app/views/message/inbox.tpl (rev 0) +++ app/views/message/inbox.tpl 2008-02-29 15:53:28 UTC (rev 34) @@ -0,0 +1,25 @@ +<?= $controller->renderPartial("menu") ?> + +<div class="inbox_submenu"> + <div class="menu_block selector"> + <label for="action_select">_{Select}: + <select class="" onchange="" 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="all">_{All}</option> + </select> + </label> + </div> + <div class="menu_block"> + <ul id="inbox_action" class="buttons"> + <li class="disabled"><a href="#" onclick="" id="unread">_{Mark as Unread}</a></li> + <li class="disabled"><a href="#" onclick="" id="read">_{Mark as Read}</a></li> + <li class="disabled"><a href="#" onclick="" id="delete">_{Delete}</a></li> + </ul> + </div> +</div> +<div class="no_messages">_{You currently don't have any messages}.<br><br> + <img src="/images/icons/message.gif" alt="" class=""> <a href="/message/send">_{Send Message}.</a> +</div> Added: app/views/message/outbox.tpl =================================================================== --- app/views/message/outbox.tpl (rev 0) +++ app/views/message/outbox.tpl 2008-02-29 15:53:28 UTC (rev 34) @@ -0,0 +1,23 @@ +<?= $controller->renderPartial("menu") ?> + +<div class="inbox_submenu"> + <div class="menu_block selector"> + <label for="action_select">_{Select}: + <select class="" onchange="" 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="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> + </ul> + </div> +</div> +<div class="no_messages">_{You currently don't have any messages}.<br><br> + <img src="/images/icons/message.gif" alt="" class=""> <a href="/message/send">_{Send Message}.</a> +</div> Added: app/views/message/send.tpl =================================================================== --- app/views/message/send.tpl (rev 0) +++ app/views/message/send.tpl 2008-02-29 15:53:28 UTC (rev 34) @@ -0,0 +1,25 @@ +<?= $controller->renderPartial("menu") ?> + +<?= $controller->renderErrors() ?> + +<form action="/message/send" method="post"> + <div class="messageform"> + <div class="formrow"> + <label>_{To}:</label> + <?= $form_helper->text_field('message', '', array('class' => 'textinput') )?> + </div> + <div class="formrow"> + <label>_{Subject}:</label> + <?= $form_helper->text_field('message', 'subject', array('class' => 'textinput'))?> + </div> + <div class="formrow"> + <label>_{Message}:</label> + <textarea id="message" name="message" class="textinput"></textarea> + </div> + <div class="formrow"> + <label></label> + <input class="submitinput" type="submit" value="_{Send}"> + <input class="cancelinput" type="button" value="_{Cancel}"> + </div> + </div> +</form> Modified: app/views/shared/loggedin/compiled/pageheader.tpl.php =================================================================== --- app/views/shared/loggedin/compiled/pageheader.tpl.php 2008-02-29 10:19:57 UTC (rev 33) +++ app/views/shared/loggedin/compiled/pageheader.tpl.php 2008-02-29 15:53:28 UTC (rev 34) @@ -1,7 +1,7 @@ <ul id="headermenuleft"> <li><a class="globallink" href="/profile/"><?php echo $text_helper->translate('Profile', array()); ?></a> <a href="/profile/edit"><?php echo $text_helper->translate('edit', array()); ?></a></li> <li><a class="globallink" href="/friend/"><?php echo $text_helper->translate('Friends', array()); ?></a></li> - <li><a class="globallink" href="/message/"><?php echo $text_helper->translate('Inbox', array()); ?> (0)</a></li> + <li><a class="globallink" href="/message/"><?php echo $text_helper->translate('Messages', array()); ?> (0)</a></li> </ul> <ul id="headermenuright"> <li><a href="/user/logout"><?php echo $text_helper->translate('Logout', array()); ?></a></li> Modified: app/views/shared/loggedin/pageheader.tpl =================================================================== --- app/views/shared/loggedin/pageheader.tpl 2008-02-29 10:19:57 UTC (rev 33) +++ app/views/shared/loggedin/pageheader.tpl 2008-02-29 15:53:28 UTC (rev 34) @@ -1,7 +1,7 @@ <ul id="headermenuleft"> <li><a class="globallink" href="/profile/">_{Profile}</a> <a href="/profile/edit">_{edit}</a></li> <li><a class="globallink" href="/friend/">_{Friends}</a></li> - <li><a class="globallink" href="/message/">_{Inbox} (0)</a></li> + <li><a class="globallink" href="/message/">_{Messages} (0)</a></li> </ul> <ul id="headermenuright"> <li><a href="/user/logout">_{Logout}</a></li> Modified: app/views/user/home.tpl =================================================================== --- app/views/user/home.tpl 2008-02-29 10:19:57 UTC (rev 33) +++ app/views/user/home.tpl 2008-02-29 15:53:28 UTC (rev 34) @@ -1 +1 @@ -Hello <?= $current_user->name ?> +_{Hello}, <?= $current_user->name ?> Modified: public/stylesheets/Application.css =================================================================== --- public/stylesheets/Application.css 2008-02-29 10:19:57 UTC (rev 33) +++ public/stylesheets/Application.css 2008-02-29 15:53:28 UTC (rev 34) @@ -3,7 +3,7 @@ font-size: 11px; } -input { +input, textarea { padding: 3px; border: 1px solid #bdc7d8; font-family: verdana, arial, sans-serif; @@ -17,17 +17,23 @@ font-weight: bolder; } - label.persistent { line-height: 16px; font: 11px normal; padding: 1px 0px 3px 0px; } -label input { +label input, label select { font-weight: normal; } +select{ + border:1px solid #BDC7D8; + font-family:verdana,arial,sans-serif; + font-size:11px; + padding:2px; +} + a { color: #3b5998; text-decoration: none; @@ -183,7 +189,7 @@ #pagecontent #content { clear: both; - padding: 20px; + padding: 0; } #pagefooter { @@ -258,6 +264,17 @@ border-right: 1px solid #0e1f5b; } +.cancelinput { + cursor: pointer; + color: black; + background-color: lightgray; + padding: 2px 15px 3px 15px; + margin: 5px 0px 5px 0px; + border-top: 1px solid #d9dfea; + border-left: 1px solid #d9dfea; + border-bottom: 1px solid #0e1f5b; + border-right: 1px solid #0e1f5b; +} .textinput, .passwordinput { width: 123px; @@ -291,7 +308,7 @@ #content .title { font-weight: bold; font-size: 13px; - padding: 0px 0px 10px 0px; + padding: 10px 20px; border-bottom: 1px solid #dddddd; margin-bottom: 10px; } Added: public/stylesheets/Message.css =================================================================== --- public/stylesheets/Message.css (rev 0) +++ public/stylesheets/Message.css 2008-02-29 15:53:28 UTC (rev 34) @@ -0,0 +1,57 @@ +#content .tabs { padding: 20px 0 15px; border-bottom:1px solid #898989; display:block; } +.tabs .left { padding-left: 10px; float: left; } +.tabs .right { padding-right:10px;float:right; } + +.toggle_tabs { margin:0; padding:0; list-style:none; text-align:center; display: block; } +.toggle_tabs li { display:inline; padding:2px 0px 3px; background:#f1f1f1; } +.toggle_tabs li a { border:1px solid #898989; border-left:0; color:#333; font-weight:bold; padding:2px 8px 3px 9px; } +.toggle_tabs li a small { font-size:11px; font-weight:normal; } +.toggle_tabs li a:focus { outline:0px; } +.toggle_tabs li.first a { border:1px solid #898989; } +.toggle_tabs li a.selected { margin-left:-1px; background:#6d84b4; border:1px solid #3b5998; border-left:1px solid #5973a9; border-right:1px solid #5973a9; color:#fff; } +.toggle_tabs li.last a.selected { margin-left:-1px; border-left:1px solid #5973a9; border-right:1px solid #36538f; } +.toggle_tabs li.first a.selected { margin:0; border-left:1px solid #36538f; border-right:1px solid #5973a9; } +.toggle_tabs li.first.last a.selected { border:1px solid #36538f; } +.toggle_tabs li a.selected:hover { text-decoration:none; } +.toggle_tabs li a.disabled { color:#999;cursor:default; } +.toggle_tabs li a.disabled:hover { text-decoration:none; } + +#content .inbox_submenu { background:#f7f7f7; border-bottom:1px solid #ccc; padding: 8px 20px 28px; } +.inbox_submenu .menu_block { float:left; } +.inbox_submenu .menu_block.selector { padding-right:5px; } +.inbox_submenu .menu_block.selector select { margin-left:5px; } +.inbox_submenu .buttons { list-style:none; margin:0px; padding:0px; } +.inbox_submenu .buttons li { float:left; } +.inbox_submenu .buttons li a { padding:4px 5px 4px 5px; display:block; } +.inbox_submenu .disabled a { color:#aaa; } +.inbox_submenu .disabled a:hover { cursor:default; text-decoration:none; } + +.no_messages { color:#666; font-size:13px; padding:100px 0px 110px 0px; text-align:center; } +.no_messages strong { color:#333; font-weight:bold; } + +#content .messageform { + margin: 20px auto 20px auto; + width: 510px; +} + +.messageform .formrow { + vertical-align: top; + padding: 0px 0px 3px 0px; +} + +.formrow label { + display: block; + width: 90px; + float: left; + text-align: right; + padding: 3px 10px 3px; +} + +.formrow textarea { + height: 150px; +} + +.formrow .textinput { + width: 350px; +} + This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <agu...@us...> - 2008-03-04 16:29:17
|
Revision: 38 http://isocial.svn.sourceforge.net/isocial/?rev=38&view=rev Author: aguidrevitch Date: 2008-03-04 08:29:23 -0800 (Tue, 04 Mar 2008) Log Message: ----------- autocomplete city selection, city belongs to country Modified Paths: -------------- app/application_controller.php app/controllers/profile_controller.php app/installers/basic_profile_installer.php app/views/layouts/application.tpl app/views/profile/basic.tpl app/views/user/home.tpl Added Paths: ----------- app/installers/city_installer.php app/models/city.php public/stylesheets/autocomplete.css Modified: app/application_controller.php =================================================================== --- app/application_controller.php 2008-03-03 18:02:41 UTC (rev 37) +++ app/application_controller.php 2008-03-04 16:29:23 UTC (rev 38) @@ -170,6 +170,22 @@ function _to_base64_utf8 ($value) { return "=?utf-8?B?" . base64_encode($value) . "?="; } + + 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/profile_controller.php =================================================================== --- app/controllers/profile_controller.php 2008-03-03 18:02:41 UTC (rev 37) +++ app/controllers/profile_controller.php 2008-03-04 16:29:23 UTC (rev 38) @@ -2,7 +2,7 @@ class ProfileController extends ApplicationController { - var $models = 'user, basic_profile, sex, country, political_view'; + var $models = 'user, basic_profile, sex, country, city, political_view'; function index () { } @@ -10,6 +10,16 @@ function basic () { } + function auto_complete_for_basic_hometown () { + if (!empty($this->params['basic']['country_id'])) { + $conditions = array('country_id = ? AND name LIKE ?', $this->params['basic']['country_id'], '%' . $this->params['basic']['hometown'] . '%' ); + } else { + $conditions = array('name LIKE ?', '%' . $this->params['basic']['hometown'] . '%' ); + } + $entries = $this->City->find('all', array('conditions' => $conditions)); + $this->renderText( $this->_auto_complete_result($entries, 'name', $this->params['basic']['hometown']) ); + } + function contact () { } Modified: app/installers/basic_profile_installer.php =================================================================== --- app/installers/basic_profile_installer.php 2008-03-03 18:02:41 UTC (rev 37) +++ app/installers/basic_profile_installer.php 2008-03-04 16:29:23 UTC (rev 38) @@ -9,7 +9,7 @@ `user_id` int(11) NOT NULL, `sex_id` int(11), `country_id` int(11), - `hometown` char(255) NOT NULL DEFAULT '', + `city_id` int(11), `birthdate` datetime DEFAULT NULL, `political_view_id` int(11), `created_at` datetime NOT NULL, @@ -17,6 +17,7 @@ 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"); Added: app/installers/city_installer.php =================================================================== --- app/installers/city_installer.php (rev 0) +++ app/installers/city_installer.php 2008-03-04 16:29:23 UTC (rev 38) @@ -0,0 +1,24 @@ +<?php +class CityInstaller extends AkInstaller +{ + function up_1() + { + $this->execute( + "CREATE TABLE `cities` ( + `id` int(11) NOT NULL PRIMARY KEY AUTO_INCREMENT, + `country_id` int(11), + `name` char(100) NOT NULL DEFAULT '', + FOREIGN KEY (country_id) REFERENCES countries(id) + ) ENGINE=InnoDB"); + + } + + function down_1() + { + /**/ + $this->dropTable('cities'); + /**/ + } +} + +?> Added: app/models/city.php =================================================================== --- app/models/city.php (rev 0) +++ app/models/city.php 2008-03-04 16:29:23 UTC (rev 38) @@ -0,0 +1,7 @@ +<?php + +class City extends ActiveRecord +{ +} + +?> Modified: app/views/layouts/application.tpl =================================================================== --- app/views/layouts/application.tpl 2008-03-03 18:02:41 UTC (rev 37) +++ app/views/layouts/application.tpl 2008-03-04 16:29:23 UTC (rev 38) @@ -3,8 +3,11 @@ <head> <title><?= @$title ?></title> <link href="/stylesheets/reset.css" rel="stylesheet" type="text/css"> +<link href="/stylesheets/autocomplete.css" rel="stylesheet" type="text/css"> <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> </head> <body id="application"> <div id="main"> Modified: app/views/profile/basic.tpl =================================================================== --- app/views/profile/basic.tpl 2008-03-03 18:02:41 UTC (rev 37) +++ app/views/profile/basic.tpl 2008-03-04 16:29:23 UTC (rev 38) @@ -18,7 +18,7 @@ </div> <div class="formrow"> <label>_{Hometown}:</label> - <?= $form_helper->text_field('basic', '', array('class' => 'shorttextinput') )?> + <?= $javascript_macros_helper->text_field_with_auto_complete('basic', 'hometown', array('autocomplete' => 'on', 'class' => 'shorttextinput'), array('skip_style' => true, 'with' => '"basic%5Bcountry_id%5D=" + $F("basic_country_id") + "&" + value') )?> </div> <div class="formrow"> <label>_{Political views}:</label> Modified: app/views/user/home.tpl =================================================================== --- app/views/user/home.tpl 2008-03-03 18:02:41 UTC (rev 37) +++ app/views/user/home.tpl 2008-03-04 16:29:23 UTC (rev 38) @@ -1 +1 @@ -_{Hello}, <?= $current_user->name ?> +<p>_{Hello}, <?= $current_user->name ?></p> Added: public/stylesheets/autocomplete.css =================================================================== --- public/stylesheets/autocomplete.css (rev 0) +++ public/stylesheets/autocomplete.css 2008-03-04 16:29:23 UTC (rev 38) @@ -0,0 +1,42 @@ +div.auto_complete { + margin-top: -1px; + background: #ffffff; + width: 100%; +} + +div.auto_complete ul { + border-top: 1px solid #bdc7d8; + border-left: 1px solid #bdc7d8; + border-right: 1px solid #bdc7d8; + font-family: verdana, arial, sans-serif; + font-size: 11px; + margin:0; + padding:0; + width:100%; + list-style-type:none; +} + +div.auto_complete ul li { + margin: 0; + border-bottom: 1px solid #bdc7d8; + padding: 4px; + cursor: pointer; +} + +div.auto_complete ul li.selected { + background-color: #3b5998; + color: white; +} + +div.auto_complete ul li strong.highlight { + background:#d8dfea; + margin:0; + padding:0; +} + +div.auto_complete ul li.selected strong.highlight { + background:#5670a6; + color:#fff; + margin:0; + padding:0; +} This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <agu...@us...> - 2008-03-05 20:19:44
|
Revision: 41 http://isocial.svn.sourceforge.net/isocial/?rev=41&view=rev Author: aguidrevitch Date: 2008-03-05 12:19:44 -0800 (Wed, 05 Mar 2008) Log Message: ----------- minimal city autocompletion helper added Modified Paths: -------------- app/application_controller.php app/controllers/profile_controller.php app/installers/city_installer.php app/installers/country_installer.php app/locales/profile/ru.php app/models/city.php app/views/layouts/application.tpl app/views/profile/basic.tpl public/stylesheets/autocomplete.css Added Paths: ----------- README.txt app/helpers/city_helper.php app/installers/religious_view_installer.php app/models/religious_view.php localities_to_sql.pl Added: README.txt =================================================================== --- README.txt (rev 0) +++ README.txt 2008-03-05 20:19:44 UTC (rev 41) @@ -0,0 +1,6 @@ +City/Country databases: + + * http://www.world-gazetteer.com/wg.php?x=1129163518&men=stdl&lng=en&gln=xx&dat=32&srt=npan&col=aohdq + * http://www.world-gazetteer.com/dataen.zip + * http://earth-info.nga.mil/gns/html/namefiles.htm + * http://www.maxmind.com/app/worldcities Modified: app/application_controller.php =================================================================== --- app/application_controller.php 2008-03-05 18:39:57 UTC (rev 40) +++ app/application_controller.php 2008-03-05 20:19:44 UTC (rev 41) @@ -1,6 +1,7 @@ <?php require_once(AK_LIB_DIR.DS.'AkActionController.php'); +require_once(AK_APP_DIR.DS.'vendor'.DS.'utf8_to_ascii'.DS.'utf8_to_ascii.php'); /** * This file is application-wide controller file. You can put all @@ -19,6 +20,7 @@ var $_errors = array(); var $models = array('User'); + var $app_helpers = array('City'); var $current_user; function beforeAction ( $method = '' ) { @@ -171,6 +173,52 @@ 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 _auto_complete_result ($items, $field, $phrase = '') { // converting to an array $entries = array(); Modified: app/controllers/profile_controller.php =================================================================== --- app/controllers/profile_controller.php 2008-03-05 18:39:57 UTC (rev 40) +++ app/controllers/profile_controller.php 2008-03-05 20:19:44 UTC (rev 41) @@ -2,7 +2,7 @@ class ProfileController extends ApplicationController { - var $models = 'user, basic_profile, sex, country, city, political_view'; + var $models = 'user, basic_profile, sex, country, city, political_view, religious_view'; function index () { } @@ -10,15 +10,65 @@ function basic () { } - function auto_complete_for_basic_hometown () { - if (!empty($this->params['basic']['country_id'])) { - $conditions = array('country_id = ? AND name LIKE ?', $this->params['basic']['country_id'], '%' . $this->params['basic']['hometown'] . '%' ); + function auto_complete_for_basic_city () { + if (empty($this->params['basic']['city'])) { + $this->renderNothing(); } else { - $conditions = array('name LIKE ?', '%' . $this->params['basic']['hometown'] . '%' ); + $query = $this->params['basic']['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_auto_complete_result($entries, $query) ); } - $entries = $this->City->find('all', array('conditions' => $conditions)); - $this->renderText( $this->_auto_complete_result($entries, 'name', $this->params['basic']['hometown']) ); } + + function auto_complete_for_basic_religious_view () { + if (empty($this->params['basic']['religious_view'])) { + $this->renderNothing(); + } else { + $entries = $this->ReligiousView->find('all', + array('conditions' => + array( + 'name LIKE ?', '%' . $this->params['basic']['religious_view'] . '%' + ), + ) + ); + $this->renderText( $this->_auto_complete_result($entries, 'name', $this->params['basic']['religious_view']) ); + } + } function contact () { } Added: app/helpers/city_helper.php =================================================================== --- app/helpers/city_helper.php (rev 0) +++ app/helpers/city_helper.php 2008-03-05 20:19:44 UTC (rev 41) @@ -0,0 +1,79 @@ +<?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 +{ + + 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)) { + return ''; + } + foreach ($cities as $city) { + $name = !empty($phrase) + ? TextHelper::highlight( TextHelper::h($city->name), $phrase) + : TextHelper::h($city->name); + $item = TagHelper::content_tag('div', $name) ; + $comment = TagHelper::content_tag('div', $city->country->name, array('class' => 'informal')) ; + $items[] = TagHelper::content_tag('li', $name . $comment, array('id' => $city->getId())); + } + return TagHelper::content_tag('ul', join('', array_unique($items))); + } + + function city_field($object, $method, $tag_options = array(), $completion_options = array()) + { + $tag_options = array_merge(array( + 'name' => "city", + 'id' => "auto_{$object}_{$method}", + 'onblur' => "if (!$('{$object}_{$method}').value || \$F(this.id) != \$F('{$object}_{$method}_prev')) { $(this.id).value = ''; $('{$object}_{$method}').value = null; $('{$object}_{$method}_prev').value = null; new Effect.Highlight(this.id, { startcolor: '#ff0000'})}", + 'autocomplete' => 'on', + ), $tag_options); + $completion_options = array_merge(array( + 'skip_style' => true, + 'url' => array('action' => 'auto_complete_for_city'), + 'minChars' => 3, + 'frequency' => 0.4, + 'callback' => "function (element, value) { $('{$object}_{$method}').value = null; return value} ", + '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($object, $method, array('id' => "{$object}_{$method}_prev", 'name' => "{$object}_{$method}_prev")); + $text_field = $this->_controller->form_helper->text_field($object, $method, $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; + } +} + +?> Modified: app/installers/city_installer.php =================================================================== --- app/installers/city_installer.php 2008-03-05 18:39:57 UTC (rev 40) +++ app/installers/city_installer.php 2008-03-05 20:19:44 UTC (rev 41) @@ -6,8 +6,13 @@ $this->execute( "CREATE TABLE `cities` ( `id` int(11) NOT NULL PRIMARY KEY AUTO_INCREMENT, + `oid` int(11), `country_id` int(11), + `first_id` int(11), + `second_id` int(11), + `third_id` int(11), `name` char(100) NOT NULL DEFAULT '', + INDEX oid_idx (oid), FOREIGN KEY (country_id) REFERENCES countries(id) ) ENGINE=InnoDB"); Modified: app/installers/country_installer.php =================================================================== --- app/installers/country_installer.php 2008-03-05 18:39:57 UTC (rev 40) +++ app/installers/country_installer.php 2008-03-05 20:19:44 UTC (rev 41) @@ -5,257 +5,12 @@ { $this->execute( "CREATE TABLE `countries` ( - `id` int(11) PRIMARY KEY + `id` int(11) PRIMARY KEY, + `oid` int(11), + `name` char(255), + UNIQUE name_idx (name), + INDEX oid_idx (oid) ) ENGINE=InnoDB"); - - $fields = array(); - foreach (Ak::langs() as $lang) { - $fields[] = $lang . "_name"; - $this->execute("ALTER TABLE countries ADD column ${lang}_name char(255) NOT NULL DEFAULT \"\""); - } - $fields = join(", ", $fields); - - foreach (array(1 => "Åland Islands", - 2 => "Afghanistan", - 3 => "Albania", - 4 => "Algeria", - 5 => "American Samoa", - 6 => "Andorra", - 7 => "Angola", - 8 => "Anguilla", - 9 => "Antigua and Barbuda", - 10 => "Argentina", - 11 => "Armenia", - 12 => "Aruba", - 13 => "Australia", - 14 => "Austria", - 15 => "Azerbaijan", - 16 => "Bahamas", - 17 => "Bahrain", - 18 => "Bangladesh", - 19 => "Barbados", - 20 => "Belarus", - 21 => "Belgium", - 22 => "Belize", - 23 => "Benin", - 24 => "Bermuda", - 25 => "Bhutan", - 26 => "Bolivia", - 27 => "Bosnia and Herzegovina", - 28 => "Botswana", - 29 => "Brazil", - 30 => "British Virgin Islands", - 31 => "Brunei Darussalam", - 32 => "Bulgaria", - 33 => "Burkina Faso", - 34 => "Burundi", - 35 => "Côte d'Ivoire", - 36 => "Cambodia", - 37 => "Cameroon", - 38 => "Canada", - 39 => "Cape Verde", - 40 => "Cayman Islands", - 41 => "Central African Republic", - 42 => "Chad", - 43 => "Chile", - 44 => "China", - 45 => "Colombia", - 46 => "Comoros", - 47 => "Congo, Democratic Republic", - 48 => "Congo", - 49 => "Cook Islands", - 50 => "Costa Rica", - 51 => "Croatia", - 52 => "Cuba", - 53 => "Cyprus", - 54 => "Czech Republic", - 55 => "Denmark", - 56 => "Djibouti", - 57 => "Dominican Republic", - 58 => "Dominica", - 59 => "Ecuador", - 60 => "Egypt", - 61 => "El Salvador", - 62 => "Equatorial Guinea", - 63 => "Eritrea", - 64 => "Estonia", - 65 => "Ethiopia", - 66 => "Faeroe Islands", - 67 => "Falkland Islands (Malvinas)", - 68 => "Fiji", - 69 => "Finland", - 70 => "France", - 71 => "French Guiana", - 72 => "French Polynesia", - 73 => "Gabon", - 74 => "Gambia", - 75 => "Georgia", - 76 => "Germany", - 77 => "Ghana", - 78 => "Gibraltar", - 79 => "Greece", - 80 => "Greenland", - 81 => "Grenada", - 82 => "Guadeloupe", - 83 => "Guam", - 84 => "Guatemala", - 85 => "Guinea-Bissau", - 86 => "Guinea", - 87 => "Guyana", - 88 => "Haiti", - 89 => "Honduras", - 90 => "Hong Kong", - 91 => "Hungary", - 92 => "Iceland", - 93 => "India", - 94 => "Indonesia", - 95 => "Iran (Islamic Republic of)", - 96 => "Iraq", - 97 => "Ireland", - 98 => "Isle of Man", - 99 => "Israel", - 100 => "Italy", - 101 => "Jamaica", - 102 => "Japan", - 103 => "Jordan", - 104 => "Kazakhstan", - 105 => "Kenya", - 106 => "Kiribati", - 107 => "Korea, Republic of", - 108 => "Korea, South", - 109 => "Kuwait", - 110 => "Kyrgyzstan", - 111 => "Lao People's Democratic Republic", - 112 => "Latvia", - 113 => "Lebanon", - 114 => "Lesotho", - 115 => "Liberia", - 116 => "Libyan Arab Jamahiriya", - 117 => "Liechtenstein", - 118 => "Lithuania", - 119 => "Luxembourg", - 120 => "Macao", - 121 => "Macedonia", - 122 => "Madagascar", - 123 => "Malawi", - 124 => "Malaysia", - 125 => "Maldives", - 126 => "Mali", - 127 => "Malta", - 128 => "Marshall Islands", - 129 => "Martinique", - 130 => "Mauritania", - 131 => "Mauritius", - 132 => "Mayotte", - 133 => "Mexico", - 134 => "Micronesia", - 135 => "Monaco", - 136 => "Mongolia", - 137 => "Montserrat", - 138 => "Morocco", - 139 => "Mozambique", - 140 => "Myanmar", - 141 => "Namibia", - 142 => "Nauru", - 143 => "Nepal", - 144 => "Netherlands Antilles", - 145 => "Netherlands", - 146 => "New Caledonia", - 147 => "New Zealand", - 148 => "Nicaragua", - 149 => "Nigeria", - 150 => "Niger", - 151 => "Niue", - 152 => "Norfolk Island", - 153 => "Northern Mariana Islands", - 154 => "Norway", - 155 => "Occupied Palestinian Territory", - 156 => "Oman", - 157 => "Pakistan", - 158 => "Palau", - 159 => "Panama", - 160 => "Papua New Guinea", - 161 => "Paraguay", - 162 => "Peru", - 163 => "Philippines", - 164 => "Pitcairn", - 165 => "Poland", - 166 => "Portugal", - 167 => "Puerto Rico", - 168 => "Qatar", - 169 => "Réunion", - 170 => "Republic of Moldova", - 171 => "Romania", - 172 => "Russian Federation", - 173 => "Rwanda", - 174 => "Saint Helena", - 175 => "Saint Kitts and Nevis", - 176 => "Saint Lucia", - 177 => "Saint Pierre and Miquelon", - 178 => "Saint Vincent and the Grenadines", - 179 => "Samoa", - 180 => "San Marino", - 181 => "Sao Tome and Principe", - 182 => "Saudi Arabia", - 183 => "Senegal", - 184 => "Serbia and Montenegro", - 185 => "Seychelles", - 186 => "Sierra Leone", - 187 => "Singapore", - 188 => "Slovakia", - 189 => "Slovenia", - 190 => "Solomon Islands", - 191 => "Somalia", - 192 => "South Africa", - 193 => "Spain", - 194 => "Sri Lanka", - 195 => "Sudan", - 196 => "Suriname", - 197 => "Svalbard and Jan Mayen Islands", - 198 => "Swaziland", - 199 => "Sweden", - 200 => "Switzerland", - 201 => "Syrian Arab Republic", - 202 => "Tajikistan", - 203 => "Tanzania", - 204 => "Thailand", - 205 => "Timor-Leste", - 206 => "Togo", - 207 => "Tokelau", - 208 => "Tonga", - 209 => "Trinidad and Tobago", - 210 => "Tunisia", - 211 => "Turkey", - 212 => "Turkmenistan", - 213 => "Turks and Caicos Islands", - 214 => "Tuvalu", - 215 => "Uganda", - 216 => "Ukraine", - 217 => "United Arab Emirates", - 218 => "United Kingdom", - 219 => "United States Virgin Islands", - 220 => "United States", - 221 => "Uruguay", - 222 => "Uzbekistan", - 223 => "Vanuatu", - 224 => "Vatican City State (Holy See)", - 225 => "Venezuela", - 226 => "Viet Nam", - 227 => "Wallis and Futuna Islands", - 228 => "Western Sahara", - 229 => "Yemen", - 230 => "Zambia", - 231 => "Zimbabwe") as $id => $country) - { - - $values = array(); - foreach (Ak::langs() as $lang) { - Ak::lang($lang); - $values[] = '"' . Ak::t($country) . '"'; - } - $values = join(", ", $values); - $this->execute("INSERT INTO countries (id, $fields) VALUES ($id, $values)"); - } } function down_1() Added: app/installers/religious_view_installer.php =================================================================== --- app/installers/religious_view_installer.php (rev 0) +++ app/installers/religious_view_installer.php 2008-03-05 20:19:44 UTC (rev 41) @@ -0,0 +1,22 @@ +<?php +class ReligiousViewInstaller extends AkInstaller +{ + function up_1() + { + $this->execute( + "CREATE TABLE `religious_views` ( + `id` int(11) NOT NULL PRIMARY KEY AUTO_INCREMENT, + `name` char(100) NOT NULL DEFAULT '' + ) ENGINE=InnoDB"); + + } + + function down_1() + { + /**/ + $this->dropTable('religious_view'); + /**/ + } +} + +?> Modified: app/locales/profile/ru.php =================================================================== --- app/locales/profile/ru.php 2008-03-05 18:39:57 UTC (rev 40) +++ app/locales/profile/ru.php 2008-03-05 20:19:44 UTC (rev 41) @@ -15,14 +15,14 @@ $dictionary['Select Sex:'] = 'Выберите пол:'; $dictionary['Birthday'] = 'Дата рождения'; -$dictionary['Country'] = 'Страна'; +$dictionary['Country of birth'] = 'Страна рождения'; $dictionary['Select Country:'] = 'Выберите страну:'; $dictionary['Hometown'] = 'Родной город'; $dictionary['Political views'] = 'Политические взгляды'; $dictionary['Select Political Views:'] = 'Выберите политические взгляды:'; -$dictionary['Religious views'] = 'Религия'; +$dictionary['Religious views'] = 'Вероисповедание'; $dictionary['Only my friends'] = 'Только для друзей'; $dictionary['Emails'] = 'Адреса Email'; Modified: app/models/city.php =================================================================== --- app/models/city.php 2008-03-05 18:39:57 UTC (rev 40) +++ app/models/city.php 2008-03-05 20:19:44 UTC (rev 41) @@ -2,6 +2,7 @@ class City extends ActiveRecord { + var $belongs_to = array('country'); } ?> Added: app/models/religious_view.php =================================================================== --- app/models/religious_view.php (rev 0) +++ app/models/religious_view.php 2008-03-05 20:19:44 UTC (rev 41) @@ -0,0 +1,7 @@ +<?php + +class ReligiousView extends ActiveRecord +{ +} + +?> Modified: app/views/layouts/application.tpl =================================================================== --- app/views/layouts/application.tpl 2008-03-05 18:39:57 UTC (rev 40) +++ app/views/layouts/application.tpl 2008-03-05 20:19:44 UTC (rev 41) @@ -8,6 +8,7 @@ <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/autocomplete.js" type="text/javascript"></script> </head> <body id="application"> <div id="main"> Modified: app/views/profile/basic.tpl =================================================================== --- app/views/profile/basic.tpl 2008-03-05 18:39:57 UTC (rev 40) +++ app/views/profile/basic.tpl 2008-03-05 20:19:44 UTC (rev 41) @@ -2,6 +2,7 @@ <?= $controller->renderErrors() ?> + <form action="/profile/basic" method="post"> <div class="editform"> <div class="formrow"> @@ -13,26 +14,53 @@ <?= $date_helper->date_select('basic', 'birthdate', array('start_year' => 1940) )?> </div> <div class="formrow"> + <label>_{Hometown}:</label> + <?= $city_helper->city_field('basic', 'city', array('class' => 'shorttextinput')); ?> + </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(), 'name', 'id'), array(), array('prompt' => $controller->t('Select Country:')) )?> + <?= $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>_{Hometown}:</label> - <?= $javascript_macros_helper->text_field_with_auto_complete('basic', 'hometown', array('autocomplete' => 'on', 'class' => 'shorttextinput'), array('skip_style' => true, 'with' => '"basic%5Bcountry_id%5D=" + $F("basic_country_id") + "&" + value') )?> - </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:')) )?> </div> <div class="formrow"> <label>_{Religious views}:</label> - <?= $form_helper->text_field('basic', 'religious_views', array('class' => 'shorttextinput') ) ?> + <?= $javascript_macros_helper->text_field_with_auto_complete('basic', 'religious_view', array('autocomplete' => 'on', 'class' => 'shorttextinput'), array('skip_style' => true) )?> </div> <div class="formrow"> <label></label> <input class="submitinput" type="submit" value="_{Save Changes}"> <input class="cancelinput" type="button" value="_{Cancel}"> + <a href="javascript: alert($F('basic_city') + ':' + $F('basic_city_prev'))">asdfsadf</a> </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> Added: localities_to_sql.pl =================================================================== --- localities_to_sql.pl (rev 0) +++ localities_to_sql.pl 2008-03-05 20:19:44 UTC (rev 41) @@ -0,0 +1,44 @@ +#!/usr/bin/perl + +use strict; +use warnings; +use File::Slurp; + +my $id = 1; +my %countries; +my %other; +foreach( read_file($ARGV[0]) ) { + chomp(); + my @data = split /\t/; + + my $oid = $data[0]; + my $name = $data[1]; + if ($data[4] eq 'country') { + + $countries{$name} = $id; + print "INSERT INTO countries VALUES ($id, $oid, '$name');\n"; + $id++; + } else { + $other{$name} = $oid; + } +} + +$id = 1; +foreach ( read_file($ARGV[0]) ) { + chomp(); + my @data = split /\t/; + if ($data[4] ne 'country' && defined $data[8]) { + my $oid = $data[0]; + my $country_id = defined $data[8] && $countries{$data[8]} ? $countries{$data[8]} : 'NULL'; + my $first_id = defined $data[9] && $other{$data[9]} ? $other{$data[9]} : 'NULL'; + 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])); + foreach my $name (@names) { + $name =~ s/\"/'/g; + print "INSERT INTO cities VALUES ($id, $oid, $country_id, $first_id, $second_id, $third_id, \"$name\");\n"; + $id++; + } + } +} Property changes on: localities_to_sql.pl ___________________________________________________________________ Name: svn:executable + * Modified: public/stylesheets/autocomplete.css =================================================================== --- public/stylesheets/autocomplete.css 2008-03-05 18:39:57 UTC (rev 40) +++ public/stylesheets/autocomplete.css 2008-03-05 20:19:44 UTC (rev 41) @@ -1,3 +1,10 @@ +span.indicator { + display: none; +} +span.indicator img { + vertical-align: middle +} + div.auto_complete { margin-top: -1px; background: #ffffff; @@ -22,6 +29,11 @@ padding: 4px; cursor: pointer; } +div.auto_complete ul li .informal { + color: #bdc7d8; + font-weight: bold; + padding-left: 6px; +} div.auto_complete ul li.selected { background-color: #3b5998; @@ -40,3 +52,4 @@ margin:0; padding:0; } + This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <agu...@us...> - 2008-03-09 12:04:48
|
Revision: 45 http://isocial.svn.sourceforge.net/isocial/?rev=45&view=rev Author: aguidrevitch Date: 2008-03-09 05:04:52 -0700 (Sun, 09 Mar 2008) Log Message: ----------- minor updates Modified Paths: -------------- app/helpers/city_helper.php app/locales/user/ru.php app/views/default/index.tpl app/views/layouts/application.tpl app/views/message/send_successfully.tpl app/views/profile/groups.tpl app/views/profile/picture.tpl app/views/user/confirm.tpl app/views/user/forgot_password.tpl app/views/user/home.tpl app/views/user/laststep.tpl app/views/user/reset_password.tpl app/views/user/thankyou.tpl public/stylesheets/Application.css public/stylesheets/autocomplete.css Modified: app/helpers/city_helper.php =================================================================== --- app/helpers/city_helper.php 2008-03-07 13:55:11 UTC (rev 44) +++ app/helpers/city_helper.php 2008-03-09 12:04:52 UTC (rev 45) @@ -54,16 +54,14 @@ $tag_options = array_merge(array( 'name' => "city", 'id' => "auto_{$object}_{$method}", - 'onblur' => "if (!$('{$object}_{$method}').value || \$F(this.id) != \$F('{$object}_{$method}_prev')) { $(this.id).value = ''; $('{$object}_{$method}').value = null; $('{$object}_{$method}_prev').value = null; new Effect.Highlight(this.id, { startcolor: '#ff0000'})}", + 'onblur' => "city_updated(this, '{$object}_{$method}_prev', '{$object}_{$method}')", 'autocomplete' => 'on', ), $tag_options); $completion_options = array_merge(array( 'skip_style' => true, 'url' => array('action' => 'auto_complete_for_city'), - 'minChars' => 3, 'frequency' => 0.4, - 'callback' => "function (element, value) { $('{$object}_{$method}').value = null; return value} ", - 'afterUpdateElement' => "function (text, li) { $('{$object}_{$method}').value = li.id; $('{$object}_{$method}_prev').value = text.value; } " + '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); Modified: app/locales/user/ru.php =================================================================== --- app/locales/user/ru.php 2008-03-07 13:55:11 UTC (rev 44) +++ app/locales/user/ru.php 2008-03-09 12:04:52 UTC (rev 45) @@ -44,8 +44,8 @@ $dictionary['Confirmation error'] = 'Ошибка подтверждения'; $dictionary['bad confirmation link'] = 'ссылка подтверждения содержит ошибки'; $dictionary['Password reset error'] = 'Ошибка сброса пароля'; -$dictionary['no user found with the given email'] = 'пользователь с указанным email не зарегистрирован'; -$dictionary['bad reset link'] = 'ссылка сброса пароля содержит ошибки'; +$dictionary['No user found with the given e-mail'] = 'пользователь с указанным email не зарегистрирован'; +$dictionary['Bad reset link'] = 'ссылка сброса пароля содержит ошибки'; $dictionary['Trouble Accessing Your Account'] = 'Проблема с доступом к Вашей учетной записи'; $dictionary['Forgot Password'] = 'Забыли пароль'; $dictionary['Enter your login email below'] = 'Введите свой email адрес ниже'; Modified: app/views/default/index.tpl =================================================================== --- app/views/default/index.tpl 2008-03-07 13:55:11 UTC (rev 44) +++ app/views/default/index.tpl 2008-03-09 12:04:52 UTC (rev 45) @@ -1,3 +1,3 @@ -<p> +<p class="indent"> <a class="linkbutton" href="/user/register"><div>_{Sign Up}</div></a> </p> \ No newline at end of file Modified: app/views/layouts/application.tpl =================================================================== --- app/views/layouts/application.tpl 2008-03-07 13:55:11 UTC (rev 44) +++ app/views/layouts/application.tpl 2008-03-09 12:04:52 UTC (rev 45) @@ -8,6 +8,7 @@ <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/autocomplete.js" type="text/javascript"></script> </head> <body id="application"> <div id="main"> Modified: app/views/message/send_successfully.tpl =================================================================== --- app/views/message/send_successfully.tpl 2008-03-07 13:55:11 UTC (rev 44) +++ app/views/message/send_successfully.tpl 2008-03-09 12:04:52 UTC (rev 45) @@ -1,3 +1,3 @@ <?= $controller->renderPartial("menu") ?> -<p>_{Message successfully sended}</p> \ No newline at end of file +<p class="indent">_{Message successfully sent}</p> \ No newline at end of file Modified: app/views/profile/groups.tpl =================================================================== --- app/views/profile/groups.tpl 2008-03-07 13:55:11 UTC (rev 44) +++ app/views/profile/groups.tpl 2008-03-09 12:04:52 UTC (rev 45) @@ -2,4 +2,4 @@ <?= $controller->renderErrors() ?> -<p>Coming soon</p> \ No newline at end of file +<p class="indent">Coming soon</p> \ No newline at end of file Modified: app/views/profile/picture.tpl =================================================================== --- app/views/profile/picture.tpl 2008-03-07 13:55:11 UTC (rev 44) +++ app/views/profile/picture.tpl 2008-03-09 12:04:52 UTC (rev 45) @@ -2,4 +2,4 @@ <?= $controller->renderErrors() ?> -<p>Coming soon</p> \ No newline at end of file +<p class="indent">Coming soon</p> \ No newline at end of file Modified: app/views/user/confirm.tpl =================================================================== --- app/views/user/confirm.tpl 2008-03-07 13:55:11 UTC (rev 44) +++ app/views/user/confirm.tpl 2008-03-09 12:04:52 UTC (rev 45) @@ -4,6 +4,6 @@ if ($controller->getErrors()) { echo $controller->renderErrors(); } else { ?> - <p>_{Thank you for registration}</p><br> - <p><a href="/user/login">_{go to login}</a></p> + <p class="indent">_{Thank you for registration}</p><br> + <p class="indent"><a href="/user/login">_{go to login}</a></p> <? } ?> Modified: app/views/user/forgot_password.tpl =================================================================== --- app/views/user/forgot_password.tpl 2008-03-07 13:55:11 UTC (rev 44) +++ app/views/user/forgot_password.tpl 2008-03-09 12:04:52 UTC (rev 45) @@ -2,7 +2,7 @@ <?= $controller->renderErrors() ?> -<p>_{Forgot Password}? _{Enter your login email below}. +<p class="indent">_{Forgot Password}? _{Enter your login email below}. _{We will send you an email with a link to reset your password}.</p> <form action="/user/forgot_password" method="post"> @@ -18,4 +18,4 @@ </div> </form> -<p>_{If you have a different problem accessing your account, please see our} <a href="/help">_{Login Problems Help Page}</a>.</p> \ No newline at end of file +<p class="indent">_{If you have a different problem accessing your account, please see our} <a href="/help">_{Login Problems Help Page}</a>.</p> \ No newline at end of file Modified: app/views/user/home.tpl =================================================================== --- app/views/user/home.tpl 2008-03-07 13:55:11 UTC (rev 44) +++ app/views/user/home.tpl 2008-03-09 12:04:52 UTC (rev 45) @@ -1 +1 @@ -<p>_{Hello}, <?= $current_user->name ?></p> +<p class="indent">_{Hello}, <?= $current_user->name ?></p> Modified: app/views/user/laststep.tpl =================================================================== --- app/views/user/laststep.tpl 2008-03-07 13:55:11 UTC (rev 44) +++ app/views/user/laststep.tpl 2008-03-09 12:04:52 UTC (rev 45) @@ -1,2 +1,2 @@ <div class="title">_{Last step}</div> -<p>_{Check please your email and click on confirmation link}.</p> +<p class="indent">_{Check please your email and click on confirmation link}.</p> Modified: app/views/user/reset_password.tpl =================================================================== --- app/views/user/reset_password.tpl 2008-03-07 13:55:11 UTC (rev 44) +++ app/views/user/reset_password.tpl 2008-03-09 12:04:52 UTC (rev 45) @@ -2,7 +2,7 @@ <?= $controller->renderErrors(); ?> -<p>_{Please enter a new password}.</p> +<p class="indent">_{Please enter a new password}.</p> <form action="/user/reset_password" method="post"> <div class="editform"> <div class="formrow"> Modified: app/views/user/thankyou.tpl =================================================================== --- app/views/user/thankyou.tpl 2008-03-07 13:55:11 UTC (rev 44) +++ app/views/user/thankyou.tpl 2008-03-09 12:04:52 UTC (rev 45) @@ -1,2 +1,2 @@ <div class="title">_{Thank you for registration}</div> -<p>_{Registration complete}</p> +<p class="indent">_{Registration complete}</p> Modified: public/stylesheets/Application.css =================================================================== --- public/stylesheets/Application.css 2008-03-07 13:55:11 UTC (rev 44) +++ public/stylesheets/Application.css 2008-03-09 12:04:52 UTC (rev 45) @@ -193,8 +193,7 @@ padding: 0; } -#content p { - margin: 0px; +#pagecontent #content p.indent { padding: 30px; } Modified: public/stylesheets/autocomplete.css =================================================================== --- public/stylesheets/autocomplete.css 2008-03-07 13:55:11 UTC (rev 44) +++ public/stylesheets/autocomplete.css 2008-03-09 12:04:52 UTC (rev 45) @@ -1,8 +1,10 @@ span.indicator { - display: none; + display: none; + margin-left: 4px; } + span.indicator img { - vertical-align: middle + vertical-align: middle; } div.auto_complete { 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-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 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 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: <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: <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 16:23:46
|
Revision: 80 http://isocial.svn.sourceforge.net/isocial/?rev=80&view=rev Author: aguidrevitch Date: 2008-03-14 09:23:52 -0700 (Fri, 14 Mar 2008) Log Message: ----------- css fixes for top menu to be correctly displayed in all browsers Modified Paths: -------------- app/views/message/_menu.tpl app/views/profile/_menu.tpl public/stylesheets/Application.css Modified: app/views/message/_menu.tpl =================================================================== --- app/views/message/_menu.tpl 2008-03-14 16:12:10 UTC (rev 79) +++ app/views/message/_menu.tpl 2008-03-14 16:23:52 UTC (rev 80) @@ -11,3 +11,4 @@ </ul> </div> </div> +<div class="clearfix"> </div> Modified: app/views/profile/_menu.tpl =================================================================== --- app/views/profile/_menu.tpl 2008-03-14 16:12:10 UTC (rev 79) +++ app/views/profile/_menu.tpl 2008-03-14 16:23:52 UTC (rev 80) @@ -11,3 +11,4 @@ </ul> </div> </div> +<div class="clearfix"></div> \ No newline at end of file Modified: public/stylesheets/Application.css =================================================================== --- public/stylesheets/Application.css 2008-03-14 16:12:10 UTC (rev 79) +++ public/stylesheets/Application.css 2008-03-14 16:23:52 UTC (rev 80) @@ -47,7 +47,7 @@ a.logo { position: absolute; display: block; - width: 151px; + width: 150px; height: 55px; background-image: url(/images/logo.gif); } @@ -269,6 +269,14 @@ padding-left: 20px; } +.clearfix { + clear: both; + height: 0px; + width: 0px; + line-heght: 0px; + overflow: hidden; +} + .photoapp { background: url('/images/photo.png') no-repeat 0px; } @@ -352,18 +360,22 @@ #content .tabs { display:block; - padding: 20px 0px 15px 0px; + padding: 20px 0px 0px 0px; border-bottom: 1px solid #898989; + float: left; + width: 645px; } .tabs .left { float: left; padding-left: 10px; + margin-bottom: -1px; } .tabs .right { float: right; padding-right: 10px; + margin-bottom: -1px; } .toggle_tabs { @@ -378,6 +390,7 @@ display: inline; padding: 2px 0px 3px 0px; background: #f1f1f1; + line-height: 22px; } .toggle_tabs li a { This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <agu...@us...> - 2008-03-16 13:46:00
|
Revision: 83 http://isocial.svn.sourceforge.net/isocial/?rev=83&view=rev Author: aguidrevitch Date: 2008-03-16 06:46:01 -0700 (Sun, 16 Mar 2008) Log Message: ----------- getting rid of images Modified Paths: -------------- app/views/message/_rows.tpl public/stylesheets/Message.css Modified: app/views/message/_rows.tpl =================================================================== --- app/views/message/_rows.tpl 2008-03-14 20:16:11 UTC (rev 82) +++ app/views/message/_rows.tpl 2008-03-16 13:46:01 UTC (rev 83) @@ -5,13 +5,7 @@ <tr class="<? if ($target == 'sender' && !$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="' . $text_helper->translate("New message", array()) . '">'; - } else { - echo '<img src="/images/email_open.png" alt="' . $text_helper->translate("Message is read", array()) . '">'; - } - echo '</a>'; + echo '<a class="'. ($message->is_read ? 'email_open' : 'email_closed') . ' href=""></a>'; } else { echo '<span> </span>'; } Modified: public/stylesheets/Message.css =================================================================== --- public/stylesheets/Message.css 2008-03-14 20:16:11 UTC (rev 82) +++ public/stylesheets/Message.css 2008-03-16 13:46:01 UTC (rev 83) @@ -221,3 +221,15 @@ padding: 7px 0px 0px 0px; color: #999999; } + +.email_closed { + width: 16px; + height: 16px; + background: url('/images/email.png') no-repeat 10px; +} + +.email_open { + width: 16px; + height: 16px; + background: url('/images/email_open.png') no-repeat 10px; +} \ 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-16 17:42:57
|
Revision: 84 http://isocial.svn.sourceforge.net/isocial/?rev=84&view=rev Author: aguidrevitch Date: 2008-03-16 10:43:01 -0700 (Sun, 16 Mar 2008) Log Message: ----------- generic autocomplete fields implemented, currently used for religious views field in basic user profile 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/religious_view_installer.php app/models/basic_profile.php app/models/religious_view.php app/shared_model.php app/views/profile/basic.tpl public/stylesheets/Application.css Modified: app/application_controller.php =================================================================== --- app/application_controller.php 2008-03-16 13:46:01 UTC (rev 83) +++ app/application_controller.php 2008-03-16 17:43:01 UTC (rev 84) @@ -197,7 +197,11 @@ 'order' => 'is_native DESC, name' ) ); - $this->renderText( $this->city_helper->auto_complete_result($entries, $query, $this->params['city']) ); + if (!empty($entries)) { + $this->renderText( $this->city_helper->auto_complete_result($entries, $query, $this->params['city']) ); + } else { + $this->renderNothing(); + } } } Modified: app/controllers/profile_controller.php =================================================================== --- app/controllers/profile_controller.php 2008-03-16 13:46:01 UTC (rev 83) +++ app/controllers/profile_controller.php 2008-03-16 17:43:01 UTC (rev 84) @@ -15,28 +15,31 @@ 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()) { + if ($this->Request->isPost() && !empty($this->params['basic_profile'])) { + + $this->basic_profile->setAttributes($this->params['basic_profile']); + if (!empty($this->params['basic_profile']['religious_view_id'])) { + $religious_view = $this->ReligiousView->voteOrCreate($this->params['basic_profile']['religious_view_id'], + $this->current_user); + $this->basic_profile->religious_view->assign($religious_view); + } + + if ($this->basic_profile->save()) { $this->redirectTo(array('action' => 'basic')); } } } - function auto_complete_for_basic_religious_view () { - if (empty($this->params['basic_profile']['religious_view'])) { - echo 1; + function auto_complete_for_basic_profile_religious_view_id () { + if (empty($this->params['basic_profile'])) { $this->renderNothing(); } else { - $entries = $this->ReligiousView->find('all', - array('conditions' => - array( - 'name LIKE ?', '%' . $this->params['basic_profile']['religious_view'] . '%' - ), - ) - ); - $this->renderText( $this->auto_complete_helper->auto_complete_result($entries, 'name', $this->params['basic_profile']['religious_view']) ); + $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(); + } } } Modified: app/helpers/auto_complete_helper.php =================================================================== --- app/helpers/auto_complete_helper.php 2008-03-16 13:46:01 UTC (rev 83) +++ app/helpers/auto_complete_helper.php 2008-03-16 17:43:01 UTC (rev 84) @@ -38,15 +38,56 @@ return ''; } foreach ($entries as $entry) { - $items[] = TagHelper::content_tag('li',!empty($phrase) ? TextHelper::highlight(TextHelper::h($entry->get($field)), $phrase) : TextHelper::h(@$entry->get($field))); + $items[] = TagHelper::content_tag('li', + !empty($phrase) + ? TextHelper::highlight(TextHelper::h($entry->get($field)), $phrase) + : TextHelper::h(@$entry->get($field)), array('id' => $entry->getId())); } 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); + + $this->object =& $this->_controller->{$object}; + $this->value = ''; + + if ($this->object) { + $id = $this->object->get($method); + if ($id) { + $model = @$completion_options['model']; + if (!$model) { + foreach ($this->object->getAssociated('belongsTo') as $name => $association) { + if ($association->getAssociationOption('primary_key_name') == $method) { + $model = $association; + break; + } + } + } + $dep = $model->find($id); + if (!empty($dep)) { + $this->value = $dep->name; + } + } + } + + $tag_options = array_merge(array( + 'value' => $this->value, + 'autocomplete' => 'on', + ), $tag_options); + + $completion_options = array_merge(array( + 'skip_style' => true, + 'url' => array('action' => "auto_complete_for_{$object}_{$method}"), + 'frequency' => 0.4, + 'indicator' => "'{$object}_{$method}'", + ), $completion_options); + + $text_field = $this->_controller->form_helper->text_field($object, $method, $tag_options); + $div = TagHelper::content_tag('div', '', array('id' => "{$object}_{$method}_auto_complete", 'class' => 'auto_complete')); + $javascript = $this->auto_complete_field("{$object}_{$method}", $completion_options); + + return $text_field . $div . $javascript; } } Modified: app/helpers/city_helper.php =================================================================== --- app/helpers/city_helper.php 2008-03-16 13:46:01 UTC (rev 83) +++ app/helpers/city_helper.php 2008-03-16 17:43:01 UTC (rev 84) @@ -28,7 +28,9 @@ $this->value = ''; if ($this->object && $city_id = $this->object->get($method)) { $city = $this->_controller->City->find($city_id); - $this->value = $city->name; + if (!empty($city)) { + $this->value = $city->name; + } } $tag_options = array_merge(array( Modified: app/installers/basic_profile_installer.php =================================================================== --- app/installers/basic_profile_installer.php 2008-03-16 13:46:01 UTC (rev 83) +++ app/installers/basic_profile_installer.php 2008-03-16 17:43:01 UTC (rev 84) @@ -9,14 +9,19 @@ `user_id` int(11) NOT NULL, `sex_id` int(11), `city_id` int(11), + `city_other` char(100), + `country_id` int(11), `birthdate` date DEFAULT NULL, `political_view_id` int(11), + `religious_view_id` int(11), `created_at` datetime NOT NULL, `updated_at` datetime NOT NULL, FOREIGN KEY (user_id) REFERENCES users(id), FOREIGN KEY (sex_id) REFERENCES sexes(id), FOREIGN KEY (city_id) REFERENCES cities(id), - FOREIGN KEY (political_view_id) REFERENCES political_views(id) + FOREIGN KEY (country_id) REFERENCES countries(id), + FOREIGN KEY (political_view_id) REFERENCES political_views(id), + FOREIGN KEY (religious_view_id) REFERENCES religious_views(id) ) ENGINE=InnoDB"); } Modified: app/installers/religious_view_installer.php =================================================================== --- app/installers/religious_view_installer.php 2008-03-16 13:46:01 UTC (rev 83) +++ app/installers/religious_view_installer.php 2008-03-16 17:43:01 UTC (rev 84) @@ -6,15 +6,42 @@ $this->execute( "CREATE TABLE `religious_views` ( `id` int(11) NOT NULL PRIMARY KEY AUTO_INCREMENT, - `name` char(100) NOT NULL DEFAULT '' + `name` char(100) NOT NULL DEFAULT '', + `votes` int(11) NOT NULL DEFAULT 0, + INDEX name_idx (name, votes) ) ENGINE=InnoDB"); + $this->execute( + "CREATE TABLE `religious_view_votes` ( + `id` int(11) NOT NULL PRIMARY KEY AUTO_INCREMENT, + `user_id` int(11), + `religious_view_id` int(11), + FOREIGN KEY (user_id) REFERENCES users(id), + FOREIGN KEY (religious_view_id) REFERENCES religious_views(id) + ) ENGINE=InnoDB"); + + $this->execute( + "CREATE TRIGGER rvv_insert AFTER INSERT ON religious_view_votes + FOR EACH ROW BEGIN + UPDATE `religious_views` SET votes = votes + 1 WHERE id = NEW.religious_view_id; + END; + "); + + $this->execute( + "CREATE TRIGGER rvv_delete AFTER DELETE ON religious_view_votes + FOR EACH ROW BEGIN + UPDATE `religious_views` SET votes = votes - 1 WHERE id = OLD.religious_view_id; + END; + "); } function down_1() { /**/ - $this->dropTable('religious_view'); + // triggers should be dropped automatically + // http://dev.mysql.com/doc/refman/5.1/en/drop-trigger.html + $this->dropTable('religious_view_votes'); + $this->dropTable('religious_views'); /**/ } } Modified: app/models/basic_profile.php =================================================================== --- app/models/basic_profile.php 2008-03-16 13:46:01 UTC (rev 83) +++ app/models/basic_profile.php 2008-03-16 17:43:01 UTC (rev 84) @@ -2,7 +2,7 @@ class BasicProfile extends ActiveRecord { - var $belongs_to = array('User', 'City'); + var $belongs_to = array('User', 'City', 'PoliticalView', 'ReligiousView'); } ?> Modified: app/models/religious_view.php =================================================================== --- app/models/religious_view.php 2008-03-16 13:46:01 UTC (rev 83) +++ app/models/religious_view.php 2008-03-16 17:43:01 UTC (rev 84) @@ -1,7 +1,15 @@ <?php -class ReligiousView extends ActiveRecord +class ReligiousView extends VotableActiveRecord { + var $votes_model = 'ReligiousViewVote'; + } +class ReligiousViewVote extends ActiveRecord { + + var $primary_key_name = 'religious_view_id'; + +} + ?> Modified: app/shared_model.php =================================================================== --- app/shared_model.php 2008-03-16 13:46:01 UTC (rev 83) +++ app/shared_model.php 2008-03-16 17:43:01 UTC (rev 84) @@ -25,4 +25,57 @@ } +class VotableActiveRecord extends ActiveRecord { + + var $votes_model; + var $min_votes_to_appear = 2; + + function &voteOrCreate ($value, $user) { + + if ($this->votes_model) { + @include_once(AkInflector::toModelFilename($this->votes_model)); + } + + $this->votes_object = new $this->votes_model(); + + $record = $this->findFirst(array('conditions' => array("name LIKE ?", $value))); + if (empty($record)) { + $this->name = $value; + $this->save(); + $record =& $this; + } + + if ($record->votes < $this->min_votes_to_appear) { + + $vote = $this->votes_object->findFirst( + array('conditions' => + array('user_id = ? and ' . $this->votes_object->primary_key_name . ' = ?', $user->getId(), $record->getId()) + ) + ); + + if (empty($vote)) { + $this->votes_object->setAttributes(array( + 'user_id' => $user->getId(), + $this->votes_object->primary_key_name => $record->getId() + )); + + if ($this->votes_object->save()) { + $record->reload(); + } + } + } + return $record; + } + + function &findVoted ($value) { + $records = $this->find('all', + array('conditions' => + array('name LIKE ? AND votes >= ' . $this->min_votes_to_appear, '%'. $value . '%') + ) + ); + return $records; + } + +} + ?> Modified: app/views/profile/basic.tpl =================================================================== --- app/views/profile/basic.tpl 2008-03-16 13:46:01 UTC (rev 83) +++ app/views/profile/basic.tpl 2008-03-16 17:43:01 UTC (rev 84) @@ -23,7 +23,7 @@ </div> <div class="formrow"> <label>_{Religious views}:</label> - <?= $auto_complete_helper->text_field_with_auto_complete('basic_profile', 'religious_view', 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' => 'textinput autocomplete'), array('skip_style' => true))?> </div> <div class="formrow"> <label></label> Modified: public/stylesheets/Application.css =================================================================== --- public/stylesheets/Application.css 2008-03-16 13:46:01 UTC (rev 83) +++ public/stylesheets/Application.css 2008-03-16 17:43:01 UTC (rev 84) @@ -375,7 +375,6 @@ width: 645px; } - .tabs .left { float: left; padding-left: 10px; This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <agu...@us...> - 2008-03-16 18:52:53
|
Revision: 85 http://isocial.svn.sourceforge.net/isocial/?rev=85&view=rev Author: aguidrevitch Date: 2008-03-16 11:52:55 -0700 (Sun, 16 Mar 2008) Log Message: ----------- project name can be changed easily now, as well as outgoing email Modified Paths: -------------- app/application_controller.php app/locales/layout/en.php app/locales/layout/ru.php app/locales/user/en.php app/locales/user/ru.php app/views/layouts/application.tpl app/views/message/email/send.tpl app/views/user/email/confirm.tpl app/views/user/email/forgot_password.tpl app/views/user/email/register.tpl app/views/user/login.tpl config/DEFAULT-config.php Added Paths: ----------- app/helpers/translate_helper.php app/vendor/ext_sintags/ app/vendor/ext_sintags/ExtSintags/ app/vendor/ext_sintags/ExtSintags/ExtSintagsParser.php app/vendor/ext_sintags/ExtSintags.php Removed Paths: ------------- app/views/shared/compiled/ app/views/shared/default/compiled/ app/views/shared/loggedin/compiled/ Modified: app/application_controller.php =================================================================== --- app/application_controller.php 2008-03-16 17:43:01 UTC (rev 84) +++ app/application_controller.php 2008-03-16 18:52:55 UTC (rev 85) @@ -2,6 +2,7 @@ require_once(AK_LIB_DIR.DS.'AkActionController.php'); require_once(AK_APP_DIR.DS.'vendor'.DS.'utf8_to_ascii'.DS.'utf8_to_ascii.php'); +require_once(AK_APP_DIR.DS.'vendor'.DS.'ext_sintags'.DS.'ExtSintags.php'); /** * This file is application-wide controller file. You can put all @@ -20,9 +21,10 @@ var $_errors = array(); var $app_models = array('User', 'Message'); - var $app_helpers = array('AutoComplete', 'City'); + var $app_helpers = array('AutoComplete', 'City', 'Translate'); var $current_user; + function beforeAction ( $method = '' ) { $this->_validateLoginStatus(); } Added: app/helpers/translate_helper.php =================================================================== --- app/helpers/translate_helper.php (rev 0) +++ app/helpers/translate_helper.php 2008-03-16 18:52:55 UTC (rev 85) @@ -0,0 +1,16 @@ +<?php + +class TranslateHelper extends TextHelper { + + /** + * Translate strings to the current locale. PROJECT_NAME will be replaced with real project name + */ + function translate($string, $args = null, $locale_namespace = null) + { + $result = Ak::t($string, $args, empty($locale_namespace) ? + AkInflector::underscore($this->_controller->getControllerName()) : $locale_namespace); + return str_replace('PROJECT_NAME', PROJECT_NAME, $result); + } +} + +?> \ No newline at end of file Modified: app/locales/layout/en.php =================================================================== --- app/locales/layout/en.php 2008-03-16 17:43:01 UTC (rev 84) +++ app/locales/layout/en.php 2008-03-16 18:52:55 UTC (rev 85) @@ -4,19 +4,6 @@ $dictionary = array(); -$dictionary['Email'] = 'Email'; -$dictionary['Password'] = 'Password'; -$dictionary['Login'] = 'Login'; -$dictionary['Remember me'] = 'Remember me'; -$dictionary['Forgot Password?'] = 'Forgot Password?'; -$dictionary['Hello world'] = 'Hello world'; -$dictionary['About iSocial'] = 'About iSocial'; -$dictionary['Terms'] = 'Terms'; -$dictionary['Help'] = 'Help'; -$dictionary['Sign Up'] = 'Sign Up'; -$dictionary['Everyone Can Join'] = 'Everyone Can Join'; - - $dictionary['PhotoApp'] = 'Photos'; $dictionary['GroupApp'] = 'Groups'; $dictionary['EventApp'] = 'Events'; Modified: app/locales/layout/ru.php =================================================================== --- app/locales/layout/ru.php 2008-03-16 17:43:01 UTC (rev 84) +++ app/locales/layout/ru.php 2008-03-16 18:52:55 UTC (rev 85) @@ -10,7 +10,7 @@ $dictionary['Remember me'] = 'Запомнить меня'; $dictionary['Forgot Password?'] = 'Забыли пароль?'; $dictionary['Hello world'] = 'Привет, мир'; -$dictionary['About iSocial'] = 'Про iSocial'; +$dictionary['About PROJECT_NAME'] = 'Про PROJECT_NAME'; $dictionary['Terms'] = 'Соглашение'; $dictionary['Help'] = 'Помощь'; $dictionary['Sign Up'] = 'Регистрация'; Modified: app/locales/user/en.php =================================================================== --- app/locales/user/en.php 2008-03-16 17:43:01 UTC (rev 84) +++ app/locales/user/en.php 2008-03-16 18:52:55 UTC (rev 85) @@ -3,8 +3,5 @@ // File created on: 2008-02-17 15:13:51 $dictionary = array(); -$dictionary['iSocial Login'] = 'iSocial Login'; -$dictionary['Incorrect email/password combination'] = 'Incorrect email/password combination'; -$dictionary['Passwords are case sensitive. Please check your CAPS lock key'] = 'Passwords are case sensitive. Please check your CAPS lock key'; ?> Modified: app/locales/user/ru.php =================================================================== --- app/locales/user/ru.php 2008-03-16 17:43:01 UTC (rev 84) +++ app/locales/user/ru.php 2008-03-16 18:52:55 UTC (rev 85) @@ -3,8 +3,8 @@ // File created on: 2008-02-17 15:13:51 $dictionary = array(); -$dictionary['iSocial Login'] = 'Вход в iSocial'; -$dictionary['Sign Up for iSocial'] = 'Регистрация в iSocial'; +$dictionary['PROJECT_NAME Login'] = 'Вход в PROJECT_NAME'; +$dictionary['Sign Up for PROJECT_NAME'] = 'Регистрация в PROJECT_NAME'; $dictionary['Sign Up'] = 'Регистрация'; $dictionary['Incorrect email/password combination'] = 'Неправильные email и/или пароль'; $dictionary['Passwords are case sensitive. Please check your CAPS lock key'] = 'Пароли чувствительны к регистру. Проверьте, не нажата ли клавиша Caps Lock'; @@ -29,15 +29,15 @@ $dictionary['Check please your email and click on confirmation link'] = 'Проверьте, пожалуйста, Ваш email и подтвердите регистрацию переходом по ссылке'; $dictionary['go to login'] = 'войти'; $dictionary['Confirmation'] = 'Подтверждение'; -$dictionary['Thank you for signing up on iSocial'] = 'Спасибо за регистрацию в iSocial'; +$dictionary['Thank you for signing up on PROJECT_NAME'] = 'Спасибо за регистрацию в PROJECT_NAME'; $dictionary['With best regards'] = 'С наилучшими пожеланиями'; -$dictionary['The iSocial Team'] = 'команда iSocial'; +$dictionary['The PROJECT_NAME Team'] = 'команда PROJECT_NAME'; $dictionary['Hey'] = 'Привет'; -$dictionary['iSocial confirm registration'] = 'Подтверждение регистрации в iSocial'; -$dictionary['You recently registered for iSocial using this email address.'] = 'Вы только что зарегистрировались в iSocial используя этот email адрес'; +$dictionary['PROJECT_NAME confirm registration'] = 'Подтверждение регистрации в PROJECT_NAME'; +$dictionary['You recently registered for PROJECT_NAME using this email address.'] = 'Вы только что зарегистрировались в PROJECT_NAME используя этот email адрес'; $dictionary['To complete your registration, follow the link below'] = 'Для завершения регистрации, перейдите по ссылке ниже'; $dictionary['If clicking on the link doesn\'t work, try copying and pasting it into your browser'] = 'Если переход по ссылке не работает, попробуйте скопировать ее и вставить в адресную строку Вашего браузера'; -$dictionary['If you did not register for iSocial, please disregard this message'] = 'Если Вы не регистрировались в iSocial, проигнорируйте, пожалуйста, это сообщение'; +$dictionary['If you did not register for PROJECT_NAME, please disregard this message'] = 'Если Вы не регистрировались в PROJECT_NAME, проигнорируйте, пожалуйста, это сообщение'; $dictionary['Check out'] = 'Посетите'; $dictionary['if you have any questions'] = 'если у Вас есть какие-либо вопросы'; $dictionary['Thanks'] = 'Спасибо'; @@ -58,7 +58,7 @@ $dictionary['Please enter a new password'] = 'Введите, пожалуйста, новый пароль'; $dictionary['Link for login'] = 'Ссылка для входа'; $dictionary['here'] = 'здесь'; -$dictionary['iSocial Password Reset Confirmation'] = 'Подтверждение сброса пароля на iSocial'; +$dictionary['PROJECT_NAME Password Reset Confirmation'] = 'Подтверждение сброса пароля на PROJECT_NAME'; $dictionary['You recently requested a new password'] = 'Вы недавно запросили новый пароль'; $dictionary['To reset your password, follow the link below'] = 'Чтобы сбросить Ваш старый пароль, перейдите по ссылке ниже'; $dictionary['If you did not reset your password, please disregard this message'] = 'Если Вы не хотите менять пароль, не обращайте внимание на это письмо'; Added: app/vendor/ext_sintags/ExtSintags/ExtSintagsParser.php =================================================================== --- app/vendor/ext_sintags/ExtSintags/ExtSintagsParser.php (rev 0) +++ app/vendor/ext_sintags/ExtSintags/ExtSintagsParser.php 2008-03-16 18:52:55 UTC (rev 85) @@ -0,0 +1,21 @@ +<?php +class ExtSintagsParser extends AkSintagsParser +{ + function Translation($match, $state) + { + switch ($state){ + case AK_LEXER_ENTER: + $this->_translation_tokens = array(); + $this->output .= '<?php echo $translate_helper->translate(\''; + break; + case AK_LEXER_UNMATCHED: + $this->output.= $this->_unescapeChars(str_replace("'","\'",$match), true); + break; + case AK_LEXER_EXIT: + $this->output .= '\', array('.(empty($this->_translation_tokens)?'':join(', ',$this->_translation_tokens)).')); ?>'; + } + return true; + } +} + +?> \ No newline at end of file Added: app/vendor/ext_sintags/ExtSintags.php =================================================================== --- app/vendor/ext_sintags/ExtSintags.php (rev 0) +++ app/vendor/ext_sintags/ExtSintags.php 2008-03-16 18:52:55 UTC (rev 85) @@ -0,0 +1,16 @@ +<?php + +require_once(AK_LIB_DIR.DS.'AkActionView'.DS.'TemplateEngines'.DS.'AkSintags.php'); +require_once(AK_APP_DIR.DS.'vendor'.DS.'ext_sintags'.DS.'ExtSintags'.DS.'ExtSintagsParser.php'); + +class ExtSintags extends AkSintags +{ + + function toPhp() + { + $Parser =& new ExtSintagsParser(); + return $Parser->parse($this->_code); + } +} + +?> \ No newline at end of file Modified: app/views/layouts/application.tpl =================================================================== --- app/views/layouts/application.tpl 2008-03-16 17:43:01 UTC (rev 84) +++ app/views/layouts/application.tpl 2008-03-16 18:52:55 UTC (rev 85) @@ -47,11 +47,11 @@ </div> <div id="pagefooter"> <div class="copyright"> - <a href="http://isocial.sourceforge.net/">iSocial © 2008</a>; + <a href="http://isocial.sourceforge.net/">_{PROJECT_NAME} © 2008</a>; </div> <div class="linksarea"> <ul> - <li><a href="/">_{About iSocial}</a></li> + <li><a href="/">_{About PROJECT_NAME}</a></li> <li><a href="/">_{Terms}</a></li> <li><a href="/">_{Help}</a></li> </ul> Modified: app/views/message/email/send.tpl =================================================================== --- app/views/message/email/send.tpl 2008-03-16 17:43:01 UTC (rev 84) +++ app/views/message/email/send.tpl 2008-03-16 18:52:55 UTC (rev 85) @@ -1,5 +1,5 @@ -Subject: <?= $controller->current_user->name ?> _{sent you a message} _{on} iSocial... -From: iSocial <no-...@ma...> +Subject: <?= $controller->current_user->name ?> _{sent you a message} _{on} _{PROJECT_NAME}... +From: <?= NOREPLY_EMAIL ?> <?= $controller->current_user->name ?> _{sent you a message}. Modified: app/views/user/email/confirm.tpl =================================================================== --- app/views/user/email/confirm.tpl 2008-03-16 17:43:01 UTC (rev 84) +++ app/views/user/email/confirm.tpl 2008-03-16 18:52:55 UTC (rev 85) @@ -1,13 +1,13 @@ -Subject: _{Thank you for signing up on iSocial} -From: iSocial <no-...@ma...> +Subject: _{Thank you for signing up on PROJECT_NAME} +From: <?= NOREPLY_EMAIL ?> <? $user = $controller->User->findFirst(array( 'email' => $controller->params['email'] )) ?> <p>_{Hey}, <?= $user->name ?>!</p> -<p>_{Thank you for signing up on iSocial}.</p> +<p>_{Thank you for signing up on PROJECT_NAME}.</p> <? $link = AK_SITE_URL . "user/login" ?> <p>_{Link for login} <a href="{link}">_{here}</a>.</p> <p>_{With best regards},<br> -_{The iSocial Team}</p> +_{The PROJECT_NAME Team}</p> Modified: app/views/user/email/forgot_password.tpl =================================================================== --- app/views/user/email/forgot_password.tpl 2008-03-16 17:43:01 UTC (rev 84) +++ app/views/user/email/forgot_password.tpl 2008-03-16 18:52:55 UTC (rev 85) @@ -1,5 +1,5 @@ -Subject: _{iSocial Password Reset Confirmation} -From: iSocial <no-...@ma...> +Subject: _{PROJECT_NAME Password Reset Confirmation} +From: <?= NOREPLY_EMAIL ?> <? $user = $controller->User->findFirst(array( 'email' => $controller->params['email'] )) ?> <p>_{Hey}, <?= $user->name ?>!</p> @@ -15,4 +15,4 @@ _{Check out} <a href="{link}">{link}</a> _{if you have any questions}.</p> <p>_{Thanks},<br> -_{The iSocial Team}</p> +_{The PROJECT_NAME Team}</p> Modified: app/views/user/email/register.tpl =================================================================== --- app/views/user/email/register.tpl 2008-03-16 17:43:01 UTC (rev 84) +++ app/views/user/email/register.tpl 2008-03-16 18:52:55 UTC (rev 85) @@ -1,18 +1,18 @@ -Subject: _{iSocial confirm registration} -From: iSocial <no-...@ma...> +Subject: _{PROJECT_NAME confirm registration} +From: <?= NOREPLY_EMAIL ?> <p>_{Hey}, <?= $controller->User->name ?>!</p> -<p>_{You recently registered for iSocial using this email address.} _{To complete your registration, follow the link below}:<br> +<p>_{You recently registered for PROJECT_NAME using this email address.} _{To complete your registration, follow the link below}:<br> <? $link = AK_SITE_URL . "user/confirm?uuid=" . $controller->Confirmation->uuid . "&email=" . $controller->User->email ?> <a href="<?= $link ?>"><?= $link ?></a><br> (_{If clicking on the link doesn't work, try copying and pasting it into your browser})</p> -<p>_{If you did not register for iSocial, please disregard this message}.<br> +<p>_{If you did not register for PROJECT_NAME, please disregard this message}.<br> <? $link = AK_SITE_URL . "help" ?> _{Check out} <a href="{link}">{link}</a> _{if you have any questions}.</p> <p>_{Thanks},<br> -_{The iSocial Team}</p> +_{The PROJECT_NAME Team}</p> Modified: app/views/user/login.tpl =================================================================== --- app/views/user/login.tpl 2008-03-16 17:43:01 UTC (rev 84) +++ app/views/user/login.tpl 2008-03-16 18:52:55 UTC (rev 85) @@ -1,4 +1,4 @@ -<div class="title">_{iSocial Login}</div> +<div class="title">_{PROJECT_NAME Login}</div> <?= $controller->renderErrors() ?> @@ -24,7 +24,7 @@ </div> <div class="formrow"> <label></label> - _{or} <strong><a href="/user/register">_{Sign Up for iSocial}</a></strong> + _{or} <strong><a href="/user/register">_{Sign Up for PROJECT_NAME}</a></strong> </div> <p class="formrow forgotpassword"> <label></label> Modified: config/DEFAULT-config.php =================================================================== --- config/DEFAULT-config.php 2008-03-16 17:43:01 UTC (rev 84) +++ config/DEFAULT-config.php 2008-03-16 18:52:55 UTC (rev 85) @@ -52,9 +52,17 @@ define('AK_AUTOMATICALLY_UPDATE_LANGUAGE_FILES', false); // disable security checks, at least before http://trac.akelos.org/ticket/122 gets fixed define('AK_TEMPLATE_SECURITY_CHECK', false); +// overriding default translation mechanics +define('AK_DEFAULT_TEMPLATE_ENGINE', 'ExtSintags'); -define('I_NOREPLAY_EMAIL', ''); +define('PROJECT_NAME', 'iSocial'); +define('NOREPLY_EMAIL', 'no-reply <no-...@is...>'); +if (!defined(NOREPLY_EMAIL) || + !defined(PROJECT_NAME)) { + die("NOREPLY_EMAIL, PROJECT_NAME should be defined"); +} + include_once(dirname(__FILE__).DIRECTORY_SEPARATOR.'boot.php'); This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <agu...@us...> - 2008-03-16 20:08:28
|
Revision: 87 http://isocial.svn.sourceforge.net/isocial/?rev=87&view=rev Author: aguidrevitch Date: 2008-03-16 13:08:31 -0700 (Sun, 16 Mar 2008) Log Message: ----------- minor fixes to marking messages + css fixes Modified Paths: -------------- app/controllers/message_controller.php public/stylesheets/Message.css Modified: app/controllers/message_controller.php =================================================================== --- app/controllers/message_controller.php 2008-03-16 18:56:29 UTC (rev 86) +++ app/controllers/message_controller.php 2008-03-16 20:08:31 UTC (rev 87) @@ -122,10 +122,12 @@ } function mark_unread () { + $this->last_box = 'inbox'; // there is no way message can be read/unread in outbox return $this->_mark_messages(0); } function mark_read () { + $this->last_box = 'inbox'; // there is no way message can be read/unread in outbox return $this->_mark_messages(1); } Modified: public/stylesheets/Message.css =================================================================== --- public/stylesheets/Message.css 2008-03-16 18:56:29 UTC (rev 86) +++ public/stylesheets/Message.css 2008-03-16 20:08:31 UTC (rev 87) @@ -223,13 +223,9 @@ } .email_closed { - width: 16px; - height: 16px; background: url('/images/email.png') no-repeat 10px; } .email_open { - width: 16px; - height: 16px; background: url('/images/email_open.png') no-repeat 10px; } \ 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-17 11:39:31
|
Revision: 88 http://isocial.svn.sourceforge.net/isocial/?rev=88&view=rev Author: aguidrevitch Date: 2008-03-17 04:39:36 -0700 (Mon, 17 Mar 2008) Log Message: ----------- a better way of handling PROJECT_NAME implemented Modified Paths: -------------- app/application_controller.php app/controllers/message_controller.php config/DEFAULT-config.php Added Paths: ----------- app/vendor/ext_template/ app/vendor/ext_template/ExtPhpTemplateHandler.php Removed Paths: ------------- app/helpers/translate_helper.php app/vendor/ext_sintags/ Modified: app/application_controller.php =================================================================== --- app/application_controller.php 2008-03-16 20:08:31 UTC (rev 87) +++ app/application_controller.php 2008-03-17 11:39:36 UTC (rev 88) @@ -2,7 +2,7 @@ require_once(AK_LIB_DIR.DS.'AkActionController.php'); require_once(AK_APP_DIR.DS.'vendor'.DS.'utf8_to_ascii'.DS.'utf8_to_ascii.php'); -require_once(AK_APP_DIR.DS.'vendor'.DS.'ext_sintags'.DS.'ExtSintags.php'); +require_once(AK_APP_DIR.DS.'vendor'.DS.'ext_template'.DS.'ExtPhpTemplateHandler.php'); /** * This file is application-wide controller file. You can put all @@ -21,10 +21,18 @@ var $_errors = array(); var $app_models = array('User', 'Message'); - var $app_helpers = array('AutoComplete', 'City', 'Translate'); + var $app_helpers = array('AutoComplete', 'City'); var $current_user; + function _loadActionView () { + $this->Template =& new AkActionView($this->_getTemplateBasePath(), $this->Request->getParameters(), $this->Request->getController()); + $this->Template->_controllerInstance =& $this; + $this->Template->_registerTemplateHandler('tpl','ExtPhpTemplateHandler'); + + return parent::_loadActionView(); + } + function beforeAction ( $method = '' ) { $this->_validateLoginStatus(); } Modified: app/controllers/message_controller.php =================================================================== --- app/controllers/message_controller.php 2008-03-16 20:08:31 UTC (rev 87) +++ app/controllers/message_controller.php 2008-03-17 11:39:36 UTC (rev 88) @@ -134,7 +134,12 @@ 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']) . ")"))); + 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 ($messages) { foreach ($messages as $message_loop_key => $message) { if ($message->sender_id == $this->current_user->getId() || Deleted: app/helpers/translate_helper.php =================================================================== --- app/helpers/translate_helper.php 2008-03-16 20:08:31 UTC (rev 87) +++ app/helpers/translate_helper.php 2008-03-17 11:39:36 UTC (rev 88) @@ -1,16 +0,0 @@ -<?php - -class TranslateHelper extends TextHelper { - - /** - * Translate strings to the current locale. PROJECT_NAME will be replaced with real project name - */ - function translate($string, $args = null, $locale_namespace = null) - { - $result = Ak::t($string, $args, empty($locale_namespace) ? - AkInflector::underscore($this->_controller->getControllerName()) : $locale_namespace); - return str_replace('PROJECT_NAME', PROJECT_NAME, $result); - } -} - -?> \ No newline at end of file Added: app/vendor/ext_template/ExtPhpTemplateHandler.php =================================================================== --- app/vendor/ext_template/ExtPhpTemplateHandler.php (rev 0) +++ app/vendor/ext_template/ExtPhpTemplateHandler.php 2008-03-17 11:39:36 UTC (rev 88) @@ -0,0 +1,14 @@ +<?php + +require_once(AK_LIB_DIR.DS.'AkActionView.php'); +require_once(AK_LIB_DIR.DS.'AkActionView'.DS.'AkPhpTemplateHandler.php'); + +class ExtPhpTemplateHandler extends AkPhpTemplateHandler +{ + function render(&$____code, $____local_assigns, $____file_path) + { + $output = parent::render($____code, $____local_assigns, $____file_path); + return str_replace('PROJECT_NAME', PROJECT_NAME, $output); + } +} +?> Modified: config/DEFAULT-config.php =================================================================== --- config/DEFAULT-config.php 2008-03-16 20:08:31 UTC (rev 87) +++ config/DEFAULT-config.php 2008-03-17 11:39:36 UTC (rev 88) @@ -52,8 +52,6 @@ define('AK_AUTOMATICALLY_UPDATE_LANGUAGE_FILES', false); // disable security checks, at least before http://trac.akelos.org/ticket/122 gets fixed define('AK_TEMPLATE_SECURITY_CHECK', false); -// overriding default translation mechanics -define('AK_DEFAULT_TEMPLATE_ENGINE', 'ExtSintags'); define('PROJECT_NAME', 'iSocial'); define('NOREPLY_EMAIL', 'no-reply <no-...@is...>'); This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <di...@us...> - 2008-03-17 14:22:07
|
Revision: 89 http://isocial.svn.sourceforge.net/isocial/?rev=89&view=rev Author: dim0s77 Date: 2008-03-17 07:22:12 -0700 (Mon, 17 Mar 2008) Log Message: ----------- show count of all unread messages in the thread Modified Paths: -------------- app/controllers/message_controller.php app/installers/religious_view_installer.php app/locales/message/ru.php app/views/message/_rows.tpl app/views/message/inbox.tpl public/stylesheets/Message.css Modified: app/controllers/message_controller.php =================================================================== --- app/controllers/message_controller.php 2008-03-17 11:39:36 UTC (rev 88) +++ app/controllers/message_controller.php 2008-03-17 14:22:12 UTC (rev 89) @@ -24,8 +24,15 @@ if(!empty($messages)) { foreach ($messages as $message_loop_key => $message) { if (!isset($box_messages[$message->thread_id])) { - $box_messages[$message->thread_id] = $message; + $box_messages[$message->thread_id]['message'] = $message; } + if (!$message->is_read) { + if (!isset($box_messages[$message->thread_id]['unread'])) { + $box_messages[$message->thread_id]['unread'] = 1; + } else { + $box_messages[$message->thread_id]['unread']++; + } + } } } $this->message_threads = count($box_messages); @@ -135,18 +142,15 @@ 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']) . ") AND (sender_id = ? OR recipient_id = ?)", - $this->current_user->getId(), $this->current_user->getId() - ) - ) - ); + array("thread_id IN (" . $this->Message->_make_in_statement_from_array('thread_id', $this->params['check_messages']) . ") AND (recipient_id = ?)", + $this->current_user->getId() + ) + ) + ); 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(); - } + $message->is_read = $is_read; + $message->save(); } } } Modified: app/installers/religious_view_installer.php =================================================================== --- app/installers/religious_view_installer.php 2008-03-17 11:39:36 UTC (rev 88) +++ app/installers/religious_view_installer.php 2008-03-17 14:22:12 UTC (rev 89) @@ -7,15 +7,15 @@ "CREATE TABLE `religious_views` ( `id` int(11) NOT NULL PRIMARY KEY AUTO_INCREMENT, `name` char(100) NOT NULL DEFAULT '', - `votes` int(11) NOT NULL DEFAULT 0, + `votes` int(11) NOT NULL DEFAULT 0, INDEX name_idx (name, votes) ) ENGINE=InnoDB"); $this->execute( "CREATE TABLE `religious_view_votes` ( `id` int(11) NOT NULL PRIMARY KEY AUTO_INCREMENT, - `user_id` int(11), - `religious_view_id` int(11), + `user_id` int(11), + `religious_view_id` int(11), FOREIGN KEY (user_id) REFERENCES users(id), FOREIGN KEY (religious_view_id) REFERENCES religious_views(id) ) ENGINE=InnoDB"); @@ -23,15 +23,15 @@ $this->execute( "CREATE TRIGGER rvv_insert AFTER INSERT ON religious_view_votes FOR EACH ROW BEGIN - UPDATE `religious_views` SET votes = votes + 1 WHERE id = NEW.religious_view_id; - END; + UPDATE `religious_views` SET votes = votes + 1 WHERE id = NEW.religious_view_id; + END; "); $this->execute( "CREATE TRIGGER rvv_delete AFTER DELETE ON religious_view_votes FOR EACH ROW BEGIN UPDATE `religious_views` SET votes = votes - 1 WHERE id = OLD.religious_view_id; - END; + END; "); } Modified: app/locales/message/ru.php =================================================================== --- app/locales/message/ru.php 2008-03-17 11:39:36 UTC (rev 88) +++ app/locales/message/ru.php 2008-03-17 14:22:12 UTC (rev 89) @@ -20,6 +20,7 @@ $dictionary['Mark as'] = 'Отметить как'; $dictionary['Delete'] = 'Удалить'; $dictionary['New message'] = 'Новое сообщение'; +$dictionary['unread messages'] = 'новых сообщений'; $dictionary['Message is readed'] = 'Сообщение прочитано'; $dictionary['Message successfully sent'] = 'Сообщение отправлено'; $dictionary['Thread unavailable'] = 'Нить сообщений недоступна'; Modified: app/views/message/_rows.tpl =================================================================== --- app/views/message/_rows.tpl 2008-03-17 11:39:36 UTC (rev 88) +++ app/views/message/_rows.tpl 2008-03-17 14:22:12 UTC (rev 89) @@ -1,33 +1,38 @@ <table class="message_row"> <tbody> {loop messages} -<? $sender = $message->$target->load() ?> -<tr class="<? if ($target == 'sender' && !$message->is_read) { echo 'new_message'; } ?>"> +<? $sender = $message['message']->$target->load() ?> +<tr class="<? if ($target == 'sender' && !$message['message']->is_read) { echo 'new_message'; } ?>"> <td class="msg_icon"> <? if ($target == 'sender') { - echo '<a class="'. ($message->is_read ? 'email_open' : 'email_closed') . ' href=""></a>'; + if ($message['message']->is_read) { + echo '<a class="email_open" href="#" onclick="oncheck(this, 1)"></a>'; + } else { + echo '<a class="email_closed" href="#" onclick="oncheck(this, 0)"></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="checkbox"><input onclick="oncheck(this, {?message-message.is_read}{message-message.is_read}{else}0{end})" type="checkbox" class="check{?message-message.is_read}read{else}unread{end}" id="{message-message.thread_id}" name="check_messages[]" value="{message-message.thread_id}"></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="/profile/show/{sender.id}">{sender.name?}</a></span> - <span class="datetime">{message.created_at?}</span> + <div class="name"><? if ($target == 'recipient') { ?>_{To}: <? } ?><a href="/profile/show/{sender.id}">{sender.name?}</a></div> + <div class="datetime">{message-message.created_at?}</div> + <div class="unread_count">{?message-unread}_{unread messages}: {message-unread}{end}</div> </td> <td class="msg"> <div class="wrapper"> - <a href="/message/show/{last_box}/{message.thread_id?}" class="subject">{message.subject?}</a> + <a href="/message/show/{last_box}/{message-message.thread_id?}" class="subject">{message-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/{last_box}/{message.thread_id?}" class="body">{msg_body?}</a> + <? (utf8_strlen($message['message']->body) > 47) ? $msg_body = utf8_substr($message['message']->body, 0, 47) . " [..]" : $msg_body = $message['message']->body; ?> + <a href="/message/show/{last_box}/{message-message.thread_id?}" class="body">{msg_body?}</a> </div> </div> </td> <td class="delete_msg"> - <a href="#" onclick="delete_single_thread(this); return false;" name="{message.id}"> </a> + <a href="#" onclick="delete_single_thread(this); return false;" name="{message-message.id}"> </a> </td> </tr> {else} Modified: app/views/message/inbox.tpl =================================================================== --- app/views/message/inbox.tpl 2008-03-17 11:39:36 UTC (rev 88) +++ app/views/message/inbox.tpl 2008-03-17 14:22:12 UTC (rev 89) @@ -3,7 +3,7 @@ <div class="submenu"> <div class="menu_block selector"> <label for="action_select">_{Select}: - <select onchange="doselect(this)" id="action_select" name="action_selector"> + <select onchange="doselect(this)" id="action_select" name="action_select"> <option selected="selected" value="_">---------</option> <option value="none">_{None}</option> <option value="read">_{Read}</option> @@ -142,6 +142,7 @@ } function disable_action_links () { + $("action_select").selectedIndex = 0; $("read_link").addClassName('disabled'); $("unread_link").addClassName('disabled'); $("delete_link").addClassName('disabled'); Modified: public/stylesheets/Message.css =================================================================== --- public/stylesheets/Message.css 2008-03-17 11:39:36 UTC (rev 88) +++ public/stylesheets/Message.css 2008-03-17 14:22:12 UTC (rev 89) @@ -62,6 +62,13 @@ color: #777777; } +.message_row .info .unread_count { + display: block; + padding: 1px 0px 0px 0px; + font-size: 9px; + color: #000000; +} + .message_row .msg { margin-right: 10px; line-height: 14px; This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <di...@us...> - 2008-03-18 11:02:12
|
Revision: 93 http://isocial.svn.sourceforge.net/isocial/?rev=93&view=rev Author: dim0s77 Date: 2008-03-18 04:02:18 -0700 (Tue, 18 Mar 2008) Log Message: ----------- mark thread as read/unread by click on thread icon Modified Paths: -------------- app/controllers/message_controller.php app/views/message/_rows.tpl app/views/message/inbox.tpl public/stylesheets/Message.css Modified: app/controllers/message_controller.php =================================================================== --- app/controllers/message_controller.php 2008-03-17 20:05:51 UTC (rev 92) +++ app/controllers/message_controller.php 2008-03-18 11:02:18 UTC (rev 93) @@ -18,8 +18,10 @@ $this->last_box = 'outbox'; } - function _getBoxMessages ($box_message) { - $messages = $this->current_user->$box_message->load(); + function _getBoxMessages ($box_message, $thread_id = '') { + $messages = $thread_id ? + $this->current_user->$box_message->find('all', array('conditions' => array("thread_id = ?", $thread_id))) : + $this->current_user->$box_message->load(); $box_messages = array(); if(!empty($messages)) { foreach ($messages as $message_loop_key => $message) { @@ -129,12 +131,12 @@ } function mark_unread () { - $this->last_box = 'inbox'; // there is no way message can be read/unread in outbox + $this->last_box = 'inbox'; return $this->_mark_messages(0); } function mark_read () { - $this->last_box = 'inbox'; // there is no way message can be read/unread in outbox + $this->last_box = 'inbox'; return $this->_mark_messages(1); } @@ -148,10 +150,7 @@ ) ); if ($messages) { - foreach ($messages as $message_loop_key => $message) { - $message->is_read = $is_read; - $message->save(); - } + $this->_update_messages($messages, "is_read = $is_read"); } } return $this->render(array('partial' => 'rows', @@ -159,6 +158,47 @@ 'target' => 'sender'))); } + function _update_messages ($messages, $updates) { + $ids = array(); + foreach ($messages as $message_loop_key => $message) { + $ids[] = $message->getId(); + } + $this->Message->updateAll($updates, + "id IN (" . $this->Message->_make_in_statement_from_array('id', $ids) . ")" + ); + } + + function mark_unread_row () { + $this->last_box = 'inbox'; + return $this->_mark_message_row(0); + } + + function mark_read_row () { + $this->last_box = 'inbox'; + return $this->_mark_message_row(1); + } + + function _mark_message_row ($is_read) { + if (!empty($this->params['row_id'])) { + list ($row_name, $thread_id) = explode("-", $this->params['row_id']); + if ($row_name == "thread" && $thread_id) { + $messages = $this->Message->find('all', + array('conditions' => + array("thread_id = ? AND (recipient_id = ?)", + $thread_id, $this->current_user->getId() + ) + ) + ); + if ($messages) { + $this->_update_messages($messages, "is_read = $is_read"); + return $this->render(array('partial' => 'row', + 'locals' => array('messages' => $this->_getBoxMessages('inbox_message', $thread_id)) + )); + } + } + } + } + function delete_inbox_thread () { $this->_delete_thread(); return $this->render(array('partial' => 'rows', Modified: app/views/message/_rows.tpl =================================================================== --- app/views/message/_rows.tpl 2008-03-17 20:05:51 UTC (rev 92) +++ app/views/message/_rows.tpl 2008-03-18 11:02:18 UTC (rev 93) @@ -2,18 +2,11 @@ <tbody> {loop messages} <? $sender = $message['message']->$target->load() ?> -<tr class="<? if ($target == 'sender' && !$message['message']->is_read) { echo 'new_message'; } ?>"> +<tr id="thread-{message-message.thread_id}" class="<? if ($target == 'sender' && !$message['message']->is_read) { echo 'new_message'; } ?>"> <td class="msg_icon"> - <? if ($target == 'sender') { - if ($message['message']->is_read) { - echo '<a class="email_open" href="#" onclick="oncheck(this, 1)"></a>'; - } else { - echo '<a class="email_closed" href="#" onclick="oncheck(this, 0)"></a>'; - } - } else { - echo '<span> </span>'; - } - ?> + <? if ($target == 'sender') { ?> + <a class="email_img" href="#" onclick="on{?message-message.is_read}un{end}read('thread-{message-message.thread_id}')"></a> + <? } else { echo '<span> </span>'; } ?> </td> <td class="checkbox"><input onclick="oncheck(this, {?message-message.is_read}{message-message.is_read}{else}0{end})" type="checkbox" class="check{?message-message.is_read}read{else}unread{end}" id="{message-message.thread_id}" name="check_messages[]" value="{message-message.thread_id}"></td> <td class="profile_photo"><a href="/profile/show/{sender.id}"><img src="/images/nophoto_men_sm.gif" alt="" class=""></a></td> Modified: app/views/message/inbox.tpl =================================================================== --- app/views/message/inbox.tpl 2008-03-17 20:05:51 UTC (rev 92) +++ app/views/message/inbox.tpl 2008-03-18 11:02:18 UTC (rev 93) @@ -148,4 +148,29 @@ $("delete_link").addClassName('disabled'); } +function onread (row_id) { + new Ajax.Updater(row_id, + '/message/mark_read_row', + { method:'post', + asynchronous: true, + parameters: 'row_id=' + row_id, + onSuccess: function () { + $(row_id).removeClassName('new_message'); + } + }); + return false; +} + +function onunread (row_id) { + new Ajax.Updater(row_id, + '/message/mark_unread_row', + { method:'post', + asynchronous: true, + parameters: 'row_id=' + row_id, + onSuccess: function () { + $(row_id).addClassName('new_message'); + } + }); +} + </script> Modified: public/stylesheets/Message.css =================================================================== --- public/stylesheets/Message.css 2008-03-17 20:05:51 UTC (rev 92) +++ public/stylesheets/Message.css 2008-03-18 11:02:18 UTC (rev 93) @@ -23,6 +23,14 @@ font-weight: bold; } +.message_row .new_message .email_img { + background: url('/images/email.png') no-repeat 10px; +} + +.message_row .email_img { + background: url('/images/email_open.png') no-repeat 10px; +} + .message_row tr td { border-bottom: 1px solid #e1e1e1; padding: 5px 0px 5px 0px; @@ -229,10 +237,3 @@ color: #999999; } -.email_closed { - background: url('/images/email.png') no-repeat 10px; -} - -.email_open { - background: url('/images/email_open.png') no-repeat 10px; -} \ 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: <di...@us...> - 2008-04-17 09:00:59
|
Revision: 123 http://isocial.svn.sourceforge.net/isocial/?rev=123&view=rev Author: dim0s77 Date: 2008-04-17 02:01:04 -0700 (Thu, 17 Apr 2008) Log Message: ----------- Added templates for group edition Modified Paths: -------------- app/controllers/groupapp/group_controller.php app/locales/groupapp/group/ru.php app/views/groupapp/group/_bar.tpl app/views/groupapp/group/edit_members.tpl public/stylesheets/Application.css public/stylesheets/reset.css Added Paths: ----------- app/views/groupapp/group/_editbar.tpl app/views/groupapp/group/edit_customize.tpl app/views/groupapp/group/edit_info.tpl app/views/groupapp/group/edit_moderators.tpl Modified: app/controllers/groupapp/group_controller.php =================================================================== --- app/controllers/groupapp/group_controller.php 2008-04-15 18:35:30 UTC (rev 122) +++ app/controllers/groupapp/group_controller.php 2008-04-17 09:01:04 UTC (rev 123) @@ -43,8 +43,20 @@ $this->importErrors( $this->GroupappGroup->getErrors() ); } + function edit_info () { + $this->step = 'edit_info'; + } + + function edit_customize () { + $this->step = 'edit_customize'; + } + + function edit_moderators () { + $this->step = 'edit_moderators'; + } + function edit_members () { - $this->step = 'group_members'; + $this->step = 'edit_members'; if (!empty($this->params['member'])){ $this->GroupappGroup->setAttributes($this->params['member']); if ($this->Request->isPost() && $this->GroupappGroup->save()){ Modified: app/locales/groupapp/group/ru.php =================================================================== --- app/locales/groupapp/group/ru.php 2008-04-15 18:35:30 UTC (rev 122) +++ app/locales/groupapp/group/ru.php 2008-04-17 09:01:04 UTC (rev 123) @@ -20,6 +20,7 @@ $dictionary['Group Info'] = 'Информация о группе'; $dictionary['Customize'] = 'Дополнительно'; $dictionary['Members'] = 'Участники'; +$dictionary['Moderators'] = 'Модераторы'; $dictionary['Group Name'] = 'Название группы'; $dictionary['Description'] = 'Описание'; Modified: app/views/groupapp/group/_bar.tpl =================================================================== --- app/views/groupapp/group/_bar.tpl 2008-04-15 18:35:30 UTC (rev 122) +++ app/views/groupapp/group/_bar.tpl 2008-04-17 09:01:04 UTC (rev 123) @@ -5,8 +5,7 @@ ?><li><a href="/groupapp/group/customize/{group.id?}" class="<? if ($step == 'group_customize') { echo 'selected'; } else if ($step == 'group_members') { echo ''; } else echo 'disabled' ?>">_{Step} 2: _{Customize}</a></li><? - ?><li><a href="/groupapp/group/edit_members/{group.id?}" class="<? if ($step == 'group_members') { echo 'selected'; } - else echo 'disabled' ?>">_{Step} 3: _{Members}</a></li> + ?><li><a href="/groupapp/group/edit_members/{group.id?}" class="disabled">_{Step} 3: _{Members}</a></li> </ul> </div> </div> Added: app/views/groupapp/group/_editbar.tpl =================================================================== --- app/views/groupapp/group/_editbar.tpl (rev 0) +++ app/views/groupapp/group/_editbar.tpl 2008-04-17 09:01:04 UTC (rev 123) @@ -0,0 +1,11 @@ +<div class="minitabs"> + <div class="left"> + <ul class="toggle_minitabs"> + <li class="first"><a href="/groupapp/group/edit_info/{group.id?}" class="<?= $step == 'edit_info' ? 'selected' : '' ?>">_{Group Info}</a> + </li><li><a href="/groupapp/group/edit_customize/{group.id?}" class="<?= $step == 'edit_customize' ? 'selected' : '' ?>">_{Customize}</a> + </li><li><a href="/groupapp/group/edit_moderators/{group.id?}" class="<?= $step == 'edit_moderators' ? 'selected' : '' ?>">_{Moderators}</a> + </li><li><a href="/groupapp/group/edit_members/{group.id?}" class="<?= $step == 'edit_members' ? 'selected' : '' ?>">_{Members}</a></li> + </ul> + </div> +</div> +<div class="clearfix"> </div> Added: app/views/groupapp/group/edit_customize.tpl =================================================================== --- app/views/groupapp/group/edit_customize.tpl (rev 0) +++ app/views/groupapp/group/edit_customize.tpl 2008-04-17 09:01:04 UTC (rev 123) @@ -0,0 +1,10 @@ +<?= $controller->renderPartial("menu") ?> + +<div class="title_bar"> + <div class="head"> + <div class="name groupapp">_{Edit} {group_name?}</div> + </div> +</div> +<div class="clearfix"></div> + +<?= $controller->renderPartial("editbar") ?> Added: app/views/groupapp/group/edit_info.tpl =================================================================== --- app/views/groupapp/group/edit_info.tpl (rev 0) +++ app/views/groupapp/group/edit_info.tpl 2008-04-17 09:01:04 UTC (rev 123) @@ -0,0 +1,10 @@ +<?= $controller->renderPartial("menu") ?> + +<div class="title_bar"> + <div class="head"> + <div class="name groupapp">_{Edit} {group_name?}</div> + </div> +</div> +<div class="clearfix"></div> + +<?= $controller->renderPartial("editbar") ?> Modified: app/views/groupapp/group/edit_members.tpl =================================================================== --- app/views/groupapp/group/edit_members.tpl 2008-04-15 18:35:30 UTC (rev 122) +++ app/views/groupapp/group/edit_members.tpl 2008-04-17 09:01:04 UTC (rev 123) @@ -7,7 +7,7 @@ </div> <div class="clearfix"></div> -<?= $controller->renderPartial("bar") ?> +<?= $controller->renderPartial("editbar") ?> <div class="formwrapper"> <form action="/groupapp/group/edit_members/{group.id?}" method="post"> Added: app/views/groupapp/group/edit_moderators.tpl =================================================================== --- app/views/groupapp/group/edit_moderators.tpl (rev 0) +++ app/views/groupapp/group/edit_moderators.tpl 2008-04-17 09:01:04 UTC (rev 123) @@ -0,0 +1,10 @@ +<?= $controller->renderPartial("menu") ?> + +<div class="title_bar"> + <div class="head"> + <div class="name groupapp">_{Invite people to} {group_name?}</div> + </div> +</div> +<div class="clearfix"></div> + +<?= $controller->renderPartial("editbar") ?> Modified: public/stylesheets/Application.css =================================================================== --- public/stylesheets/Application.css 2008-04-15 18:35:30 UTC (rev 122) +++ public/stylesheets/Application.css 2008-04-17 09:01:04 UTC (rev 123) @@ -408,7 +408,6 @@ border-left: 0px; color: #333; font-weight: bold; - margin-rigth: 10px; padding :4px 8px 6px 9px; background: #f1f1f1; } @@ -626,7 +625,7 @@ .minitabs .left { float: left; - padding-left: 10px; + padding-left: 8px; margin-bottom: -1px; } @@ -660,6 +659,11 @@ outline: 0px; } +.toggle_minitabs li a:hover { + background: #c5cee1; + text-decoration: none; +} + .toggle_minitabs li a.selected { background: #3b5998; color: #ffffff; Modified: public/stylesheets/reset.css =================================================================== --- public/stylesheets/reset.css 2008-04-15 18:35:30 UTC (rev 122) +++ public/stylesheets/reset.css 2008-04-17 09:01:04 UTC (rev 123) @@ -30,7 +30,7 @@ blockquote:before, blockquote:after, q:before, q:after { content: ''; - content: none; + /* content: none; */ } /* remember to define focus styles! */ This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <fsn...@us...> - 2008-05-13 08:51:28
|
Revision: 187 http://isocial.svn.sourceforge.net/isocial/?rev=187&view=rev Author: fsnobody Date: 2008-05-13 01:51:32 -0700 (Tue, 13 May 2008) Log Message: ----------- album view design v2 Modified Paths: -------------- app/views/photoapp/album/view.tpl public/stylesheets/photoapp/Album.css Modified: app/views/photoapp/album/view.tpl =================================================================== --- app/views/photoapp/album/view.tpl 2008-05-13 05:48:43 UTC (rev 186) +++ app/views/photoapp/album/view.tpl 2008-05-13 08:51:32 UTC (rev 187) @@ -19,6 +19,16 @@ <div class="img"> <img src="/preview/index/100x100/<?= $photo->get('img')?>" /> </div> + <div class="links"> + <ul class="actions_list"> + <li><a href="/photoapp/album/edit_photo/<?= $photo->get('id')?>">_{Edit Photo}</a></li> + <li><a href="/photoapp/album/delete_photo/<?= $photo->get('id')?>">_{Delete Photo}</a></li> + </ul> + </div> +<!-- + <div><a href="#">_{Edit}</a></div> + <div><a href="#">_{Delete}</a></div> +--> </div> {end} Modified: public/stylesheets/photoapp/Album.css =================================================================== --- public/stylesheets/photoapp/Album.css 2008-05-13 05:48:43 UTC (rev 186) +++ public/stylesheets/photoapp/Album.css 2008-05-13 08:51:32 UTC (rev 187) @@ -188,6 +188,9 @@ text-align: center; padding-top: 10px; } +.photo_view .img { + height: 100px; +} .photo_comment .data { float: left; @@ -288,7 +291,7 @@ float: left; border: 1px solid #dedeee; width: 110px; - height: 120px; + height: 136px; padding: 3px; margin: 2px 3px; text-align: center; This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <di...@us...> - 2008-05-14 10:34:31
|
Revision: 201 http://isocial.svn.sourceforge.net/isocial/?rev=201&view=rev Author: dim0s77 Date: 2008-05-14 03:34:38 -0700 (Wed, 14 May 2008) Log Message: ----------- added templates for replying to message and topic Modified Paths: -------------- app/controllers/groupapp/board_controller.php app/locales/groupapp/board/ru.php app/views/groupapp/board/show_topic.tpl app/views/groupapp/board/start_topic.tpl timesheet/dim0s77.txt Added Paths: ----------- app/views/groupapp/board/reply_to_post.tpl app/views/groupapp/board/reply_to_topic.tpl Modified: app/controllers/groupapp/board_controller.php =================================================================== --- app/controllers/groupapp/board_controller.php 2008-05-14 10:32:30 UTC (rev 200) +++ app/controllers/groupapp/board_controller.php 2008-05-14 10:34:38 UTC (rev 201) @@ -68,15 +68,15 @@ 'user_id' => $this->current_user->getId() )); if ($member) { - $topic = $member->message->build(); - $topic->setAttributes($this->params['topic']); - if (empty($topic->subject)) { - $topic->subject = $this->t('(no topic)'); + $message = $member->message->build(); + $message->setAttributes($this->params['topic']); + if (empty($message->subject)) { + $message->subject = $this->t('(no topic)'); } - if ($topic->save()) { - if (!$topic->topic_id) { - $topic->topic_id = $topic->getId(); - if ($topic->save()) { + if ($message->save()) { + if (!$message->topic_id) { + $message->topic_id = $message->getId(); + if ($message->save()) { $this->redirectTo(array('action' => 'show_topic', 'id' => $topic->getId())); return; } @@ -94,6 +94,17 @@ } } + + function reply_to_topic () { + if (!empty($this->params['id'])) { + } + } + + function reply_to_post () { + if (!empty($this->params['id'])) { + } + } + } ?> Modified: app/locales/groupapp/board/ru.php =================================================================== --- app/locales/groupapp/board/ru.php 2008-05-14 10:32:30 UTC (rev 200) +++ app/locales/groupapp/board/ru.php 2008-05-14 10:34:38 UTC (rev 201) @@ -24,6 +24,7 @@ $dictionary['There are no discussions'] ='Обсуждений пока нет'; $dictionary['Topic'] = 'Тема'; +$dictionary['Create new Topic'] = 'Создать новую тему'; $dictionary['Delete Topic'] = 'Удалить тему'; $dictionary['Reply to Topic'] = 'Ответить по теме'; $dictionary['You'] = 'Вы'; @@ -32,7 +33,7 @@ $dictionary['Reply'] = 'Ответить'; $dictionary['to Your Post'] = 'себе'; $dictionary['replies'] = 'ответов'; -$dictionary['Post'] = ''; +$dictionary['Post'] = 'Сообщение'; $dictionary['Mark as Irrelevant'] = 'Пометить как неуместное'; $dictionary['Delete Post'] = 'Удалить сообщение'; $dictionary['Report'] = 'Пожаловаться'; Added: app/views/groupapp/board/reply_to_post.tpl =================================================================== --- app/views/groupapp/board/reply_to_post.tpl (rev 0) +++ app/views/groupapp/board/reply_to_post.tpl 2008-05-14 10:34:38 UTC (rev 201) @@ -0,0 +1,25 @@ +<?= $controller->renderPartial("head") ?> + +<?= $controller->renderErrors() ?> + +<form action="/groupapp/board/reply_to_post" method="post"> + <div class="editform"> + <div class="formrow"> + <label>_{Topic}:</label> + <?= $form_helper->text_field('topic', 'subject', array('class' => 'textinput'))?> + </div> + <div class="formrow"> + <label>_{Post}:</label> + <?= $form_helper->text_area('topic', 'body', array('class' => 'textinput'))?> + </div> + <div class="formrow"> + <label> + {?topic.group_id}<input id="topic_group_id" name="topic[group_id]" type="hidden" value="{topic.group_id?}" />{end} + {?topic.topic_id}<input id="topic_topic_id" name="topic[topic_id]" type="hidden" value="{topic.topic_id?}" />{end} + {?topic.reply_message_id}<input id="topic_reply_topic_id" name="topic[reply_message_id]" type="hidden" value="{topic.reply_message_id?}" />{end} + </label> + <input class="submitinput" type="submit" value="_{Post}"> + <input class="cancelinput" type="button" value="_{Cancel}"> + </div> + </div> +</form> Added: app/views/groupapp/board/reply_to_topic.tpl =================================================================== --- app/views/groupapp/board/reply_to_topic.tpl (rev 0) +++ app/views/groupapp/board/reply_to_topic.tpl 2008-05-14 10:34:38 UTC (rev 201) @@ -0,0 +1,25 @@ +<?= $controller->renderPartial("head") ?> + +<?= $controller->renderErrors() ?> + +<form action="/groupapp/board/reply_to_topic" method="post"> + <div class="editform"> + <div class="formrow"> + <label>_{Topic}:</label> + <?= $form_helper->text_field('topic', 'subject', array('class' => 'textinput'))?> + </div> + <div class="formrow"> + <label>_{Post}:</label> + <?= $form_helper->text_area('topic', 'body', array('class' => 'textinput'))?> + </div> + <div class="formrow"> + <label> + {?topic.group_id}<input id="topic_group_id" name="topic[group_id]" type="hidden" value="{topic.group_id?}" />{end} + {?topic.topic_id}<input id="topic_topic_id" name="topic[topic_id]" type="hidden" value="{topic.topic_id?}" />{end} + {?topic.reply_message_id}<input id="topic_reply_message_id" name="topic[reply_message_id]" type="hidden" value="{topic.reply_message_id?}" />{end} + </label> + <input class="submitinput" type="submit" value="_{Post}"> + <input class="cancelinput" type="button" value="_{Cancel}"> + </div> + </div> +</form> Modified: app/views/groupapp/board/show_topic.tpl =================================================================== --- app/views/groupapp/board/show_topic.tpl 2008-05-14 10:32:30 UTC (rev 200) +++ app/views/groupapp/board/show_topic.tpl 2008-05-14 10:34:38 UTC (rev 201) @@ -8,7 +8,7 @@ </div> <div class="menu_block right"> - <a href="#">_{Delete Topic}</a> | <a href="#">_{Reply to Topic}</a> + <a href="/groupapp/board/reply_to_topic/{messages-0.topic_id?}">_{Reply to Topic}</a> </div> </div> @@ -23,18 +23,18 @@ <div class="actions"> <ul class="actions_list"> - <li><a href="/groupapp/">_{Reply} <? if ($current_user->getId() == $message->user_id) echo $text_helper->translate('to Your Post'); ?></a></li> + <li><a href="/groupapp/board/reply_to_post/{message.id?}">_{Reply} <? if ($current_user->getId() == $message->user_id) echo $text_helper->translate('to Your Post'); ?></a></li> <? if ($current_user->getId() != $message->user_id) { ?> - <li><a href="/groupapp/group/edit_info/{group.id?}">_{Mark as Irrelevant}</a></li> - <li><a href="/groupapp/group/edit_members/{group.id?}">_{Report}</a></li> + <li><a href="#">_{Mark as Irrelevant}</a></li> + <li><a href="#">_{Report}</a></li> <? } ?> - <li><a href="/groupapp/group/edit_members/{group.id?}">_{Delete Post}</a></li> + <li><a href="#">_{Delete Post}</a></li> </ul> </div> <div class="avatar"> <a href="/profile/show/{message.user_id?}"><img src="/images/nophoto_men_sm.gif" alt="" class=""></a> - <div class="subtext">_{Post} #{message_loop_counter}</div> + <div class="subtext">#{message_loop_counter}</div> <input id="message_id{message.id?}" name="message_id{message.id?}" type="hidden" value="{message_loop_counter}" /> <div class="subtext black">_{replies}: </div> </div> Modified: app/views/groupapp/board/start_topic.tpl =================================================================== --- app/views/groupapp/board/start_topic.tpl 2008-05-14 10:32:30 UTC (rev 200) +++ app/views/groupapp/board/start_topic.tpl 2008-05-14 10:34:38 UTC (rev 201) @@ -13,8 +13,10 @@ <?= $form_helper->text_area('topic', 'body', array('class' => 'textinput'))?> </div> <div class="formrow"> - <label><input id="topic_group_id" name="topic[group_id]" type="hidden" value="{topic.group_id?}" /></label> - <input class="submitinput" type="submit" value="_{Post new topic}"> + <label> + {?topic.group_id}<input id="topic_group_id" name="topic[group_id]" type="hidden" value="{topic.group_id?}" />{end} + </label> + <input class="submitinput" type="submit" value="_{Create new Topic}"> <input class="cancelinput" type="button" value="_{Cancel}"> </div> </div> Modified: timesheet/dim0s77.txt =================================================================== --- timesheet/dim0s77.txt 2008-05-14 10:32:30 UTC (rev 200) +++ timesheet/dim0s77.txt 2008-05-14 10:34:38 UTC (rev 201) @@ -16,3 +16,5 @@ 2008-05-09,12:00,15:00,groupapp,RT:3,"create template for topics" 2008-05-13,16:30,17:40,groupapp,RT:3,"Add functionality to the 'show topic' tab" + +2008-05-14,12:40,13:35,groupapp,RT:3,"discussions for group (replying to topic)" This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <fsn...@us...> - 2008-07-02 17:31:24
|
Revision: 259 http://isocial.svn.sourceforge.net/isocial/?rev=259&view=rev Author: fsnobody Date: 2008-07-02 10:31:31 -0700 (Wed, 02 Jul 2008) Log Message: ----------- poehali Modified Paths: -------------- app/controllers/blogapp/post_controller.php app/locales/layout/ru.php app/views/blogapp/post/_form.tpl app/views/blogapp/post/create.tpl app/views/blogapp/post/view.tpl app/views/photoapp/album/view.tpl public/stylesheets/blogapp/Post.css Added Paths: ----------- app/locales/blogapp/ app/locales/blogapp/post/ app/locales/blogapp/post/ru.php Modified: app/controllers/blogapp/post_controller.php =================================================================== --- app/controllers/blogapp/post_controller.php 2008-07-02 17:01:53 UTC (rev 258) +++ app/controllers/blogapp/post_controller.php 2008-07-02 17:31:31 UTC (rev 259) @@ -23,14 +23,14 @@ $post = $this->BlogappPost->find($this->params['id']); if ($this->current_user->getId() == $post->user_id ){ $post->media_item->load(); - $post->attachments = $post->attachment->load(); - foreach ($post->attachments as $k => $attach) { + $this->attachments = $post->attachment->load(); + foreach ($this->attachments as $k => $attach) { $attach->stored_file->load(); } $this->post = $post; } - } + } // view function create () { if (!empty($this->params['post']) && $this->Request->isPost() ){ Added: app/locales/blogapp/post/ru.php =================================================================== --- app/locales/blogapp/post/ru.php (rev 0) +++ app/locales/blogapp/post/ru.php 2008-07-02 17:31:31 UTC (rev 259) @@ -0,0 +1,6 @@ +<?php + +$dictionary = array(); + +$dictionary['Post Title'] = "Заголовок поста"; +?> \ No newline at end of file Modified: app/locales/layout/ru.php =================================================================== --- app/locales/layout/ru.php 2008-07-02 17:01:53 UTC (rev 258) +++ app/locales/layout/ru.php 2008-07-02 17:31:31 UTC (rev 259) @@ -48,5 +48,4 @@ $dictionary['Address field'] = 'Домашний адрес'; $dictionary['Website field'] = 'URL веб сайта'; - ?> Modified: app/views/blogapp/post/_form.tpl =================================================================== --- app/views/blogapp/post/_form.tpl 2008-07-02 17:01:53 UTC (rev 258) +++ app/views/blogapp/post/_form.tpl 2008-07-02 17:31:31 UTC (rev 259) @@ -3,7 +3,7 @@ </div> <div class="formrow"> - <label class="required">_{Post Name}:<br><small>(_{required})</small></label> + <label class="required">_{Post Title}:<br><small>(_{required})</small></label> <div class="formcol"> <?= $form_helper->text_field('post', 'title', array('class' => 'textinput')) ?> </div> Modified: app/views/blogapp/post/create.tpl =================================================================== --- app/views/blogapp/post/create.tpl 2008-07-02 17:01:53 UTC (rev 258) +++ app/views/blogapp/post/create.tpl 2008-07-02 17:31:31 UTC (rev 259) @@ -2,9 +2,6 @@ <?= $controller->renderErrors() ?> -The create - - <div class="editform"> <form action="/blogapp/post/create" method="post" enctype="multipart/form-data"> Modified: app/views/blogapp/post/view.tpl =================================================================== --- app/views/blogapp/post/view.tpl 2008-07-02 17:01:53 UTC (rev 258) +++ app/views/blogapp/post/view.tpl 2008-07-02 17:31:31 UTC (rev 259) @@ -13,7 +13,15 @@ <div class="text"> <?= $post->media_item->get('body');?> </div> + </div> + <div class="clearfix"></div> + <div class="attachments red"> + {loop attachments} + <div class="item"> + #<?= $attachment->stored_file->name; ?># + </div> + {end} </div> <div class="clearfix"></div> <div class="info">Автор: OWNER | Комментарии (7) | Комментировать</div> Modified: app/views/photoapp/album/view.tpl =================================================================== --- app/views/photoapp/album/view.tpl 2008-07-02 17:01:53 UTC (rev 258) +++ app/views/photoapp/album/view.tpl 2008-07-02 17:31:31 UTC (rev 259) @@ -7,11 +7,11 @@ <div class="uploaded_container"> <?= $form_tag_helper->start_form_tag(array('action'=>'view')) ?> <?= $form_helper->hidden_field('photo', 'action_view', array('value' => 'do_view'))?> - <? if ($photos == 0) {?> + <? if ($photos == 0):?> <div class="noalbums"> _{You have no any uploaded photos to this album}. </div> - <? } else {?> + <? else: ?> <div class="edit_container"> {loop photos} @@ -39,7 +39,7 @@ </div> <div class="clearfix"></div> - <? }?> + <? endif ?> </form> Modified: public/stylesheets/blogapp/Post.css =================================================================== --- public/stylesheets/blogapp/Post.css 2008-07-02 17:01:53 UTC (rev 258) +++ public/stylesheets/blogapp/Post.css 2008-07-02 17:31:31 UTC (rev 259) @@ -1,4 +1,18 @@ .x {} +.attachments { + padding: 3px; +} + +.attachments .item{ + float: left; + border: 1px solid #dedeee; + width: 110px; + height: 156px; + padding: 3px; + margin: 2px 3px; + text-align: center; +} + .post_item { padding: 10px 10px 20px 10px; } This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <di...@us...> - 2008-07-04 14:46:03
|
Revision: 268 http://isocial.svn.sourceforge.net/isocial/?rev=268&view=rev Author: dim0s77 Date: 2008-07-04 07:46:11 -0700 (Fri, 04 Jul 2008) Log Message: ----------- added menu to the group members. paginate group members view Modified Paths: -------------- app/controllers/groupapp/group_controller.php app/views/groupapp/group/browse.tpl app/views/groupapp/group/edit_members.tpl app/views/groupapp/group/members.tpl app/views/groupapp/group/show_group.tpl public/stylesheets/common/MiniTab.css Added Paths: ----------- app/views/groupapp/group/_membersbar.tpl Modified: app/controllers/groupapp/group_controller.php =================================================================== --- app/controllers/groupapp/group_controller.php 2008-07-04 14:44:59 UTC (rev 267) +++ app/controllers/groupapp/group_controller.php 2008-07-04 14:46:11 UTC (rev 268) @@ -247,7 +247,7 @@ $type_id = $this->subgroup_type_id > 0 ? " = " . $this->subgroup_type_id : " BETWEEN " . $this->group_type_id * 100 . " and " . ($this->group_type_id + 1) * 100; - $_filter_pagination = array('items_per_page' => 2, 'count_conditions' => "type_id" . $type_id ); + $_filter_pagination = array('items_per_page' => 10, 'count_conditions' => "type_id" . $type_id ); $group_pages = $this->pagination_helper->getPaginator($this->GroupappGroup, $_filter_pagination);// paginator $this->first_group = ($group_pages->getCurrentPage() - 1) * $group_pages->getItemsPerPage() + 1; $this->last_group = ($group_pages->getCurrentPage() * $group_pages->getItemsPerPage() < $group_pages->getItemCount()) ? @@ -262,30 +262,46 @@ function show_members () { $this->step = 'show_members'; + $this->members_role = 4; $this->_members(); - $this->renderAction('members.tpl'); } function show_moderators () { $this->step = 'show_moderators'; + $this->members_role = 3; $this->_members(); - $this->renderAction('members.tpl'); } function show_administrators () { $this->step = 'show_administrators'; + $this->members_role = 2; $this->_members(); - $this->renderAction('members.tpl'); } - function show_owners () { - $this->step = 'show_owners'; - $this->_members(); - $this->renderAction('members.tpl'); - } - function _members () { $this->_calcGroupMembersCount(); + + if (!count($this->group_members)) { + $this->renderAction('members.tpl'); + return; + } + + $members = array(); + foreach ($this->group_members as $group_member) { + if ($this->members_role == 4 || + ($this->members_role == 3 && $group_member->groupapp_member_role_id == $this->members_role) || + ($this->members_role <= 2 && $group_member->groupapp_member_role_id <= $this->members_role) + ) { + $members[] = $group_member; + } + } + + $_filter_pagination = array('items_per_page' => 10); + $member_pages = $this->array_pagination_helper->getPaginator("groupapp_member_pages", $members, $_filter_pagination);// paginator + $this->pages_links = $member_pages->links(); + $this->members = $this->array_pagination_helper->getPageItems("groupapp_member_pages", $members); + + $this->renderAction('members.tpl'); } function show_board () { Added: app/views/groupapp/group/_membersbar.tpl =================================================================== --- app/views/groupapp/group/_membersbar.tpl (rev 0) +++ app/views/groupapp/group/_membersbar.tpl 2008-07-04 14:46:11 UTC (rev 268) @@ -0,0 +1,27 @@ +<div class="minitabs"> + <div class="left"> + <ul class="toggle_minitabs"> + {?members_count} + <li><a href="/groupapp/group/show_members/{group.id?}" class="<?= !empty($step) && $step == 'show_members' ? 'selected' : '' ?> right_border">_{All Members}: {members_count}</a> + {else} + <li class="empty right_border">_{All Members}: 0 + {end} + {?moderators_count} + </li><li><a href="/groupapp/group/show_moderators/{group.id?}" class="<?= !empty($step) && $step == 'show_moderators' ? 'selected' : '' ?> right_border">_{Moderators}: {moderators_count}</a> + {else} + <li class="empty right_border">_{Moderators}: 0 + {end} + <? if ($admins_count || $owners_count): ?> + </li><li><a href="/groupapp/group/show_administrators/{group.id?}" class="<?= !empty($step) && $step == 'show_administrators' ? 'selected' : '' ?>">_{Administrators}: <?= $admins_count + $owners_count ?></a></li> + <? else: ?> + <li class="empty right_border">_{Administrators}: 0 + <? endif ?> + </ul> + </div> + <div class="right"> + <ul class="toggle_minitabs"> + {pages_links?} + </ul> + </div> +</div> +<div class="clearfix"> </div> Modified: app/views/groupapp/group/browse.tpl =================================================================== --- app/views/groupapp/group/browse.tpl 2008-07-04 14:44:59 UTC (rev 267) +++ app/views/groupapp/group/browse.tpl 2008-07-04 14:46:11 UTC (rev 268) @@ -14,6 +14,8 @@ <?= $controller->renderPartial("menu") ?> +<?= $controller->renderErrors() ?> + {?all_groups_count} <div class="groups_list"> <div class="head"> Modified: app/views/groupapp/group/edit_members.tpl =================================================================== --- app/views/groupapp/group/edit_members.tpl 2008-07-04 14:44:59 UTC (rev 267) +++ app/views/groupapp/group/edit_members.tpl 2008-07-04 14:46:11 UTC (rev 268) @@ -7,6 +7,8 @@ <?= $controller->renderPartial("editbar") ?> +<?= $controller->renderErrors() ?> + <div class="formwrapper"> <form action="/groupapp/group/edit_members/{group.id?}" method="post"> <div class="invite_column"> Modified: app/views/groupapp/group/members.tpl =================================================================== --- app/views/groupapp/group/members.tpl 2008-07-04 14:44:59 UTC (rev 267) +++ app/views/groupapp/group/members.tpl 2008-07-04 14:46:11 UTC (rev 268) @@ -9,26 +9,31 @@ <?= $controller->renderPartial("membersbar") ?> -{?group_members} +<?= $controller->renderErrors() ?> + +{?members} <div class="groups_list"> <div class="container"> - {loop group_members} + {loop members} <div class="group_row"> <div class="actions wide"> <ul class="actions_list"> - <li><a href="/profile/show/{group_member.id?}">_{View Profile}</a></li> - <li><a href="/message/send/{group_member.id?}">_{Send a Message}</a></li> - <li><a href="/friend/{group_member.id?}">_{View Friends}</a></li> + <li><a href="/profile/show/{member.id?}">_{View Profile}</a></li> + <li><a href="/message/send/{member.id?}">_{Send a Message}</a></li> + <li><a href="/friend/{member.id?}">_{View Friends}</a></li> </ul> </div> <div class="avatar"> - <a href="/profile/show/{group_member.id?}"><img src="/images/nophoto_men_sm.gif" alt="" class=""></a> + <a href="/profile/show/{member.id?}"><img src="/images/nophoto_men_sm.gif" alt="" class=""></a> </div> <div class="info"> - <div class="other"><span class="param">_{Name}:</span> <span class="name"><a href="/profile/show/{group_member.id?}">{group_member.user.name?}</a></span></div> + <div class="other"> + <span class="param">_{Name}:</span> + <span class="name"><a href="/profile/show/{member.id?}">{member.user.name?}</a></span> + </div> </div> <div class="clearfix"></div> Modified: app/views/groupapp/group/show_group.tpl =================================================================== --- app/views/groupapp/group/show_group.tpl 2008-07-04 14:44:59 UTC (rev 267) +++ app/views/groupapp/group/show_group.tpl 2008-07-04 14:46:11 UTC (rev 268) @@ -5,6 +5,8 @@ </div> <div class="clearfix"></div> +<?= $controller->renderErrors() ?> + <div class="two_column"> <div class="right_small"> <div class="right_content"> @@ -137,7 +139,7 @@ <div class="box_title">_{Members}</div> </div> <div class="menu"> - <div class="action"><a href="/groupapp/group/members/{group.id?}">_{See all}</a></div> + <div class="action"><a href="/groupapp/group/show_members/{group.id?}">_{See all}</a></div> <div class="info">_{Members count}: {members_count?}</div> </div> <div class="clearfix"></div> Modified: public/stylesheets/common/MiniTab.css =================================================================== --- public/stylesheets/common/MiniTab.css 2008-07-04 14:44:59 UTC (rev 267) +++ public/stylesheets/common/MiniTab.css 2008-07-04 14:46:11 UTC (rev 268) @@ -31,13 +31,29 @@ margin: 0px; } +.toggle_minitabs li.empty { + color: #777777; + display: block; + float: left; + padding: 5px; + margin-bottom: 1px; +} + +.toggle_minitabs li.empty.right_border { + border-right: 1px solid #cccccc; +} + .toggle_minitabs li a { display: block; color: #3b5998; - padding: 5px 4px 5px 4px; - margin: 0px 4px 1px 4px; + padding: 5px; + margin-bottom: 1px; } +.toggle_minitabs li a.right_border { + border-right: 1px solid #cccccc; +} + .toggle_minitabs li a:focus { outline: 0px; } This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <agu...@us...> - 2008-03-21 19:58:54
|
Revision: 111 http://isocial.svn.sourceforge.net/isocial/?rev=111&view=rev Author: aguidrevitch Date: 2008-03-21 12:59:00 -0700 (Fri, 21 Mar 2008) Log Message: ----------- city autocompletion improved Modified Paths: -------------- app/application_controller.php app/helpers/city_helper.php app/models/city.php app/views/profile/basic.tpl public/javascripts/autocomplete.js Modified: app/application_controller.php =================================================================== --- app/application_controller.php 2008-03-20 20:03:08 UTC (rev 110) +++ app/application_controller.php 2008-03-21 19:59:00 UTC (rev 111) @@ -183,39 +183,53 @@ function _to_base64_utf8 ($value) { return "=?utf-8?B?" . base64_encode($value) . "?="; } + + function _get_conditions_for_city( $to_ascii = true) { + $query = $this->params['city']; + $aquery = utf8_to_ascii($query); + if ($to_ascii && $aquery != $query) { + $conditions = array( + 'name LIKE ? OR name LIKE ?', $query . '%', $aquery . '%' + ); + } else { + $conditions = array( + 'name LIKE ?', $query . '%' + ); + } + return $conditions; + } 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( - 'name LIKE ? OR name LIKE ?', $query . '%', $aquery . '%' - ); - } else { - $conditions = array( - 'name LIKE ?', $query . '%' - ); - } - $entries = $this->City->find('all', array( - 'conditions' => $conditions, + 'conditions' => $this->_get_conditions_for_city(), 'include' => 'country', 'limit' => 10, 'order' => 'name' ) ); - if (!empty($entries)) { - $this->renderText( $this->city_helper->auto_complete_result($entries, $query, $this->params['city']) ); - } else { - $this->renderNothing(); - } + + $this->renderText(empty($entries) ? ' ' : $this->city_helper->auto_complete_result($entries, $this->params['city'])); } } + function get_id_for_city () { + if (empty($this->params['city'])) { + $this->renderNothing(); + } else { + $entry = $this->City->findFirst( + array( + 'conditions' => $this->_get_conditions_for_city(false), + ) + ); + + $this->renderText(empty($entry) ? ' ' : $entry->toJson()); + } + } + function unread_messages_count () { return $this->current_user ? $this->Message->unread_messages_count($this->current_user->getId()) : 0; } Modified: app/helpers/city_helper.php =================================================================== --- app/helpers/city_helper.php 2008-03-20 20:03:08 UTC (rev 110) +++ app/helpers/city_helper.php 2008-03-21 19:59:00 UTC (rev 111) @@ -25,36 +25,36 @@ 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); - if (!empty($city)) { - $this->value = $city->name; + $this->value = ''; + if ($this->object && $city_id = $this->object->get($method)) { + $city = $this->_controller->City->find($city_id); + if (!empty($city)) { + $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}')", - 'autocomplete' => 'on', + $tag_options = array_merge(array( + 'value' => $this->value, + 'name' => "city", + 'id' => "auto_{$object}_{$method}", + 'onblur' => "city_updated(this, '{$object}_{$method}_prev', '{$object}_{$method}')", + 'autocomplete' => 'on', ), $tag_options); - $completion_options = array_merge(array( - 'skip_style' => true, - 'url' => array('action' => 'auto_complete_for_city'), - 'frequency' => 0.4, - 'indicator' => "'auto_{$object}_{$method}'", - 'afterUpdateElement' => "function (text, li) { \$('{$object}_{$method}').value = li.id; \$('{$object}_{$method}_prev').value = text.value; }" + $completion_options = array_merge(array( + 'skip_style' => true, + 'url' => array('action' => 'auto_complete_for_city'), + 'frequency' => 0.4, + '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); $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')); + $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; + return $hidden . $hidden_prev . $text_field . $div . $javascript; } } Modified: app/models/city.php =================================================================== --- app/models/city.php 2008-03-20 20:03:08 UTC (rev 110) +++ app/models/city.php 2008-03-21 19:59:00 UTC (rev 111) @@ -3,7 +3,7 @@ class City extends VotableActiveRecord { var $belongs_to = array('Country'); - var $votes_model = 'ReligiousViewVote'; + var $votes_model = 'CityViewVote'; } class CityVote extends ActiveRecord Modified: app/views/profile/basic.tpl =================================================================== --- app/views/profile/basic.tpl 2008-03-20 20:03:08 UTC (rev 110) +++ app/views/profile/basic.tpl 2008-03-21 19:59:00 UTC (rev 111) @@ -29,7 +29,7 @@ <label></label> <input class="submitinput" type="submit" value="_{Save Changes}"> <input class="cancelinput" type="button" value="_{Cancel}"> - <a href="javascript: alert($F('basic_city') + ':' + $F('basic_city_prev'))">asdfsadf</a> + <a href="javascript: alert($F('basic_profile_city_id'))">(debug)</a> </div> </div> </form> Modified: public/javascripts/autocomplete.js =================================================================== --- public/javascripts/autocomplete.js 2008-03-20 20:03:08 UTC (rev 110) +++ public/javascripts/autocomplete.js 2008-03-21 19:59:00 UTC (rev 111) @@ -14,14 +14,31 @@ }); -function city_updated (input, prev, hidden) { +function city_updated (input, prev, hidden, form) { if ($F(input) && (!$F(hidden) || $F(input) != $F(prev))) { - $(input).value = ''; - $(hidden).value = ''; + $(hidden).value = ''; $(prev).value = ''; - new Effect.Highlight(input, { keepBackgroundImage: true, startcolor: '#ff0000', afterFinish: function (obj) { obj.element.setStyle('') } }); + + // now we should re-check + // whether the city is in the database and put it's id to the hidden + new Ajax.Request('/profile/get_id_for_city', { + postBody: 'city=' + $F(input), + onSuccess: function(response) { + 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; + } + } else { + $(form).show(); + } + } + }); + } else if (!$F(input)) { - $(hidden).value = ''; + $(hidden).value = ''; $(prev).value = ''; } This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |