Thread: [Isocial-svn] SF.net SVN: isocial:[294] app
Status: Pre-Alpha
Brought to you by:
aguidrevitch
From: <fsn...@us...> - 2008-08-26 10:23:27
|
Revision: 294 http://isocial.svn.sourceforge.net/isocial/?rev=294&view=rev Author: fsnobody Date: 2008-08-26 10:23:36 +0000 (Tue, 26 Aug 2008) Log Message: ----------- create system photoalbum on confirm or first login (is_default=1) Modified Paths: -------------- app/controllers/blogapp/post_controller.php app/controllers/user_controller.php app/installers/blogapp/blog_installer.php app/installers/photoapp/album_installer.php app/models/blogapp_post.php app/views/blogapp/post/_form.tpl Modified: app/controllers/blogapp/post_controller.php =================================================================== --- app/controllers/blogapp/post_controller.php 2008-08-25 12:48:57 UTC (rev 293) +++ app/controllers/blogapp/post_controller.php 2008-08-26 10:23:36 UTC (rev 294) @@ -8,7 +8,7 @@ $this->posts = $this->BlogappPost->find('all', array('conditions' => array('user_id = ' . $this->current_user->getId()))); //$this->debug($this->posts); for ($i = 0 ; $i < count($this->posts) ; $i++) { - // $this->posts[$i]->media_item->load(); + $this->posts[$i]->media_item->load(); /* $this->posts[$i]->attachments = $this->posts[$i]->attachment->load(); foreach ($this->posts[$i]->attachments as $k => $attach) { @@ -32,6 +32,36 @@ } // view + function image_list () { +$script = "var tinyMCEImageList = new Array( + [\"Logo 1\", \"/home/eerunov/development/local/tmp/editor_javascript/tinymce/examples/logo.jpg\"], + [\"Logo 2 Over\", \"/home/eerunov/development/local/tmp/editor_javascript/tinymce/examples/logo_over.jpg\"] +);"; + + $user_id = $this->current_user->getId(); + if ($user_id) { + $file = new StoredFile(); + $file->user_id = $this->current_user->getId(); + $path = $file->path(); + //$this->debug($path); + $imgs = array_diff(scandir(AK_PUBLIC_DIR . DS . $path), array('.', '..')); + //$this->debug($imgs); + if (count($imgs) > 0) { + $script = "var tinyMCEImageList = new Array("; + foreach ($imgs as $nn => $img_name) { + $script .= "[\"" . $img_name . "\", \"" . "/preview/100x100/" . $path . $img_name . "\"],"; + } + $script = substr($script, 0, strlen($script) - 1); + $script .=");"; + } + + + //$str = $this->renderToString(array( 'template' => 'image_list.tpl', 'locals' => $locals )); + //$this->debug($str); + return $this->renderText( $script ); + } + } // image_list + function create () { if (!empty($this->params['post']) && $this->Request->isPost() ){ $post = $this->BlogappPost; Modified: app/controllers/user_controller.php =================================================================== --- app/controllers/user_controller.php 2008-08-25 12:48:57 UTC (rev 293) +++ app/controllers/user_controller.php 2008-08-26 10:23:36 UTC (rev 294) @@ -2,7 +2,7 @@ class UserController extends ApplicationController { - var $models = array('User', 'Confirmation', 'GroupappGroup'); + var $models = array('User', 'Confirmation', 'GroupappGroup', 'PhotoappAlbum'); function beforeAction ( $method = '' ) { @@ -42,6 +42,10 @@ $user = $this->User->login($email, $password); if ($user && $user->active) { $this->_login($user->id); + $system_album = $this->PhotoappAlbum->findFirst(array('owner' => $user->id, 'is_default' => 1)); + if (!$system_album) + $this->create_system_photoalbum($user); + if ($remember_me) { setcookie(session_name(), session_id(), time() + 60 * 60 * 24 * 365 * 3, '/'); } @@ -50,6 +54,19 @@ return false; } + function create_system_photoalbum($user) { + // create system PhotoAlbum + $system_album = new $this->PhotoappAlbum; + $album_opt = array( + 'name' => 'system', + 'owner' => $user->getId(), + 'description' => 'system storage', + 'is_default' => 1 + ); + $system_album->setAttributes($album_opt); + $system_album->save(); + } + function logout () { $this->_logout(); $this->redirectToAction( 'login' ); @@ -84,6 +101,8 @@ $user->active = 1; if ($user->save()) { $confirmation->destroy(); + $this->create_system_photoalbum($user); + $this->sendMail($user->email); return; } Modified: app/installers/blogapp/blog_installer.php =================================================================== --- app/installers/blogapp/blog_installer.php 2008-08-25 12:48:57 UTC (rev 293) +++ app/installers/blogapp/blog_installer.php 2008-08-26 10:23:36 UTC (rev 294) @@ -13,6 +13,7 @@ FOREIGN KEY (media_item_id) REFERENCES media_items(id) ) ENGINE=InnoDB"); +/* $this->execute( "CREATE TABLE `blogapp_attachments` ( `id` int(11) NOT NULL PRIMARY KEY AUTO_INCREMENT, @@ -20,12 +21,14 @@ `base_file_id` int(11) NOT NULL, FOREIGN KEY (base_file_id) REFERENCES base_files(id) ) ENGINE=InnoDB"); +*/ } + function down_1() { $this->dropTable('blogapp_attachments'); - $this->dropTable('blogapp_posts'); + //$this->dropTable('blogapp_posts'); } } ?> \ No newline at end of file Modified: app/installers/photoapp/album_installer.php =================================================================== --- app/installers/photoapp/album_installer.php 2008-08-25 12:48:57 UTC (rev 293) +++ app/installers/photoapp/album_installer.php 2008-08-26 10:23:36 UTC (rev 294) @@ -15,7 +15,8 @@ `privacy` char(100) NOT NULL DEFAULT '', `description` char(255) NOT NULL DEFAULT '', `created_at` datetime NOT NULL , - `img` char(255) NOT NULL DEFAULT '' + `img` char(255) NOT NULL DEFAULT '', + `is_default` int(1) NOT NULL DEFAULT 0 ) ENGINE=InnoDB"); Modified: app/models/blogapp_post.php =================================================================== --- app/models/blogapp_post.php 2008-08-25 12:48:57 UTC (rev 293) +++ app/models/blogapp_post.php 2008-08-26 10:23:36 UTC (rev 294) @@ -11,8 +11,7 @@ 'primary_key_name' => 'media_item_id') ); - var $has_many = array( 'attachments' => array('class_name' => 'BlogappAttachment', - 'foreign_key' => 'post_id') ); + //var $has_many = array( 'attachments' => array('class_name' => 'BlogappAttachment', 'foreign_key' => 'post_id') ); Modified: app/views/blogapp/post/_form.tpl =================================================================== --- app/views/blogapp/post/_form.tpl 2008-08-25 12:48:57 UTC (rev 293) +++ app/views/blogapp/post/_form.tpl 2008-08-26 10:23:36 UTC (rev 294) @@ -1,3 +1,33 @@ +<script src="/javascripts/tiny_mce/tiny_mce.js" type="text/javascript"></script> +<!-- tinyMCE --> +<script language="javascript" type="text/javascript"> + // Notice: The simple theme does not use all options some of them are limited to the advanced theme + tinyMCE.init({ + mode : "textareas", + theme : "advanced", + plugins : "advimage", + external_image_list_url : "http://isocial/blogapp/post/image_list", + theme_advanced_buttons1 : "bold,italic,underline,strikethrough,image", + theme_advanced_buttons2 : "", + theme_advanced_buttons3 : "", + theme_advanced_toolbar_location : "top", + theme_advanced_toolbar_align : "center", + file_browser_callback : "fileBrowserCallBack", + extended_valid_elements : "a[name|href|target|title|onclick]" + + }); + + + function fileBrowserCallBack(field_name, url, type, win) { + // This is where you insert your custom filebrowser logic + //alert("Example of filebrowser callback: field_name: " + field_name + ", url: " + url + ", type: " + type); + //alert(win.document.getElementById(field_name)); + // win.document.getElementById(field_name).select(); + // Insert new URL, this would normaly be done in a popup + //win.document.forms[0].elements[field_name].value = "someurl.htm"; + } +</script> +<!-- /tinyMCE --> <div class="formrow"> <?= $controller->renderErrors() ?> </div> @@ -14,10 +44,16 @@ <label class="required">_{Body}:<br><small>(_{required})</small></label> <div class="formcol"> <?= $form_helper->text_area('post', 'body', array('rows' => '5')) ?> + <!--textarea id="elm1" name="elm1" rows="10" cols="40"> + Some <b>element</b>, this is to be editor 1. + <p>Some paragraph. <a href="http://www.sourceforge.net">Some link</a></p> + <img src="logo.jpg"> + </textarea --> </div> <div class="clearfix"></div> </div> +<!-- <div class="formrow"> <label class="required">_{Attach}:<br><small>(_{required})</small></label> <div class="formcol"> @@ -25,4 +61,5 @@ </div> <div class="clearfix"></div> </div> +--> This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <di...@us...> - 2008-08-26 11:12:50
|
Revision: 295 http://isocial.svn.sourceforge.net/isocial/?rev=295&view=rev Author: dim0s77 Date: 2008-08-26 11:13:00 +0000 (Tue, 26 Aug 2008) Log Message: ----------- Show all groups in browse page by default Modified Paths: -------------- app/controllers/groupapp/group_controller.php app/views/groupapp/group/browse.tpl Modified: app/controllers/groupapp/group_controller.php =================================================================== --- app/controllers/groupapp/group_controller.php 2008-08-26 10:23:36 UTC (rev 294) +++ app/controllers/groupapp/group_controller.php 2008-08-26 11:13:00 UTC (rev 295) @@ -273,13 +273,19 @@ $this->_extract_group_types(); $all_group_types = $this->GroupappGroupType->find('all'); - $this->group_type_id = (!empty($this->params['g']) && is_numeric($this->params['g'])) ? $this->params['g'] : 2; + $this->group_type_id = (!empty($this->params['g']) && is_numeric($this->params['g'])) ? $this->params['g'] : 0; $this->subgroup_type_id = (!empty($this->params['sg']) && is_numeric($this->params['sg'])) ? $this->params['sg'] : 0; - $type_id = $this->subgroup_type_id > 0 ? " = " . $this->subgroup_type_id : - " BETWEEN " . $this->group_type_id * 100 . " and " . ($this->group_type_id + 1) * 100; + $type_id = ''; + $_filter_pagination = array('items_per_page' => 10); + $_filter = array('include' => 'picture'); + if ($this->group_type_id) { + $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['count_conditions'] = "type_id" . $type_id; + $_filter['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()) ? @@ -289,7 +295,6 @@ $links = $group_pages->paginator->getLinks(); $this->pages_links = $links['first'] . ' ' . $links['back'] . ' ' . $links['pages'] . ' ' . $links['next'] . ' ' . $links['last']; - $_filter = array('conditions' => 'type_id' . $type_id, 'include' => 'picture'); $options = array_merge($_filter, $this->pagination_helper->getFindOptions($this->GroupappGroup)); $this->groups = $this->GroupappGroup->find('all', $options); Modified: app/views/groupapp/group/browse.tpl =================================================================== --- app/views/groupapp/group/browse.tpl 2008-08-26 10:23:36 UTC (rev 294) +++ app/views/groupapp/group/browse.tpl 2008-08-26 11:13:00 UTC (rev 295) @@ -43,11 +43,13 @@ <div class="title_text">_{Filter groups by}:</div> <div class="filter_name">_{type}</div> <select id="group_type_id" onchange="javascript: window.location.href='?g=' + this.options[this.selectedIndex].value"> + <option <? if($group_type_id == 0): ?>selected="selected" <? endif ?>value="0">_{All}</option> {loop group_types} <option <? $this_group_type_id = $group_type->id ?><? if($this_group_type_id == $group_type_id): ?>selected="selected" <? endif ?>value="{group_type.id?}"><?= $gt[$this_group_type_id] ?></option> {end} </select> + <? if($group_type_id): ?> <div class="filter_name">_{subtype}</div> <ul class="subgroups_list"> <? if ($subgroup_type_id == 0): ?> @@ -64,6 +66,8 @@ <? endif ?> {end} </ul> + <? endif ?> + </div> </div> @@ -99,7 +103,7 @@ <a href="/groupapp/group/show_members/{group.id?}">{group.members_count}</a> </div> <div class="other"><span class="param">_{Type}:</span> - <a href="/groupapp/group/browse/?g={group_type_id}"><?= $gt[$group_type_id] ?></a> - + <a href="/groupapp/group/browse/?g={group_type_id}"><?= $gt[$subgroup_types[$group->type_id]] ?></a> - <a href="/groupapp/group/browse/?g={group_type_id}&sg={group.type_id}"><?= $gt[$group->type_id] ?></a> </div> </div> This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <fsn...@us...> - 2008-08-26 11:14:47
|
Revision: 296 http://isocial.svn.sourceforge.net/isocial/?rev=296&view=rev Author: fsnobody Date: 2008-08-26 11:14:57 +0000 (Tue, 26 Aug 2008) Log Message: ----------- close ui for edit or delete system(default) album Modified Paths: -------------- app/controllers/blogapp/post_controller.php app/controllers/photoapp/album_controller.php app/views/photoapp/album/_edit_menu.tpl app/views/photoapp/album/index.tpl Modified: app/controllers/blogapp/post_controller.php =================================================================== --- app/controllers/blogapp/post_controller.php 2008-08-26 11:13:00 UTC (rev 295) +++ app/controllers/blogapp/post_controller.php 2008-08-26 11:14:57 UTC (rev 296) @@ -33,19 +33,15 @@ } // view function image_list () { -$script = "var tinyMCEImageList = new Array( - [\"Logo 1\", \"/home/eerunov/development/local/tmp/editor_javascript/tinymce/examples/logo.jpg\"], - [\"Logo 2 Over\", \"/home/eerunov/development/local/tmp/editor_javascript/tinymce/examples/logo_over.jpg\"] -);"; - $user_id = $this->current_user->getId(); if ($user_id) { + +// $photos = $this->PhotoappPhoto->find('all', array('conditions' => array('album_id = ' . $this->params['id']))); $file = new StoredFile(); $file->user_id = $this->current_user->getId(); $path = $file->path(); - //$this->debug($path); $imgs = array_diff(scandir(AK_PUBLIC_DIR . DS . $path), array('.', '..')); - //$this->debug($imgs); + if (count($imgs) > 0) { $script = "var tinyMCEImageList = new Array("; foreach ($imgs as $nn => $img_name) { Modified: app/controllers/photoapp/album_controller.php =================================================================== --- app/controllers/photoapp/album_controller.php 2008-08-26 11:13:00 UTC (rev 295) +++ app/controllers/photoapp/album_controller.php 2008-08-26 11:14:57 UTC (rev 296) @@ -221,6 +221,9 @@ } } else if ($this->params['id']) { $this->album = $this->PhotoappAlbum->find($this->params['id']); + if ($this->album->is_default == 1) { + $this->redirectTo(array('action' => 'index')); // system album - not permited for edit + } return; } } @@ -232,8 +235,8 @@ if (!empty($this->params['album']) ){ // delete $album = $this->PhotoappAlbum->find($this->params['id']); - if ($album && $album->get('owner') == $this->current_user->getId() && $this->Request->isPost()) { - + + if ($album && $album->get('owner') == $this->current_user->getId() && $this->Request->isPost() && $album->is_default == 0) { $photos = $this->PhotoappPhoto->find('all', array('conditions' => array('album_id = ' . $this->params['id']))); if ($photos) { $this->PhotoappPhoto->destroyAll("album_id = " . $this->params['id']); // delete photos in album @@ -244,6 +247,8 @@ } else { $this->importErrors( $this->PhotoappAlbum->getErrors() ); } + } else { + $this->redirectTo(array('action' => 'index')); // can't be deleted } } else if (!empty($this->params['id']) && $this->PhotoappAlbum->find($this->params['id'])) { // pre delete Modified: app/views/photoapp/album/_edit_menu.tpl =================================================================== --- app/views/photoapp/album/_edit_menu.tpl 2008-08-26 11:13:00 UTC (rev 295) +++ app/views/photoapp/album/_edit_menu.tpl 2008-08-26 11:14:57 UTC (rev 296) @@ -4,8 +4,8 @@ <li class="first"><a href="/photoapp/album/add_photo/<?= $album->getId()?>" class="<?= $controller->getActionName() == 'add_photo' ? 'selected' : '' ?>">_{Add photos}</a></li><? ?><li class="first"><a href="/photoapp/album/view/<?= $album->getId()?>" class="<?= in_array($controller->getActionName(),array( 'edit_photo', 'view')) ? 'selected' : '' ?>">_{View}</a></li><? ?><li class="first"><a href="/photoapp/album/uploaded/<?= $album->getId()?>" class="<?= $controller->getActionName() == 'uploaded' ? 'selected' : '' ?>">_{Edit uploaded}</a></li><? - ?><li><a href="/photoapp/album/edit/<?= $album->getId()?>" class="last <?= $controller->getActionName() == 'edit' ? 'selected' : '' ?>">_{Edit info}</a></li><? - ?><li><a href="/photoapp/album/delete/<?= $album->getId()?>" class="last <?= $controller->getActionName() == 'delete' ? 'selected' : '' ?>">_{Delete}</a></li> + ?><? if ($album->is_default == 0) {?><li><a href="/photoapp/album/edit/<?= $album->getId()?>" class="last <?= $controller->getActionName() == 'edit' ? 'selected' : '' ?>">_{Edit info}</a></li><?}?><? + ?><? if ($album->is_default == 0) {?><li><a href="/photoapp/album/delete/<?= $album->getId()?>" class="last <?= $controller->getActionName() == 'delete' ? 'selected' : '' ?>">_{Delete}</a></li><?}?> </ul> </div> </div> Modified: app/views/photoapp/album/index.tpl =================================================================== --- app/views/photoapp/album/index.tpl 2008-08-26 11:13:00 UTC (rev 295) +++ app/views/photoapp/album/index.tpl 2008-08-26 11:14:57 UTC (rev 296) @@ -40,7 +40,7 @@ <ul class="actions_list"> <li><a href="/photoapp/album/add_photo/<?= $my_album->getId()?>">_{Edit Album}</a></li> <li><a href="/photoapp/album/view/<?= $my_album->getId()?>">_{View Album}</a></li> - <li><a href="/photoapp/album/delete/<?= $my_album->getId()?>">_{Delete Album}</a></li> + <? if ($my_album->is_default == 0) {?><li><a href="/photoapp/album/delete/<?= $my_album->getId()?>">_{Delete Album}</a></li><?}?> </ul> </div> </div> This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <fsn...@us...> - 2008-08-26 12:35:28
|
Revision: 298 http://isocial.svn.sourceforge.net/isocial/?rev=298&view=rev Author: fsnobody Date: 2008-08-26 12:35:38 +0000 (Tue, 26 Aug 2008) Log Message: ----------- image_list created on system album photos Modified Paths: -------------- app/controllers/blogapp/post_controller.php app/installers/blogapp/blog_installer.php Modified: app/controllers/blogapp/post_controller.php =================================================================== --- app/controllers/blogapp/post_controller.php 2008-08-26 11:36:51 UTC (rev 297) +++ app/controllers/blogapp/post_controller.php 2008-08-26 12:35:38 UTC (rev 298) @@ -2,7 +2,7 @@ class Blogapp_PostController extends ApplicationController { - var $models = array('blogapp', 'blogapp_post', 'blogapp_attachment', ); + var $models = array('blogapp', 'blogapp_post', 'PhotoappPhoto', 'PhotoappAlbum'); function index () { $this->posts = $this->BlogappPost->find('all', array('conditions' => array('user_id = ' . $this->current_user->getId()))); @@ -22,11 +22,13 @@ function view () { $post = $this->BlogappPost->find($this->params['id']); if ($this->current_user->getId() == $post->user_id ){ +/* $post->media_item->load(); $this->attachments = $post->attachment->load(); foreach ($this->attachments as $k => $attach) { $attach->stored_file->load(); } +*/ $this->post = $post; } @@ -36,22 +38,39 @@ $user_id = $this->current_user->getId(); if ($user_id) { -// $photos = $this->PhotoappPhoto->find('all', array('conditions' => array('album_id = ' . $this->params['id']))); - $file = new StoredFile(); - $file->user_id = $this->current_user->getId(); - $path = $file->path(); - $imgs = array_diff(scandir(AK_PUBLIC_DIR . DS . $path), array('.', '..')); + $album = $this->PhotoappAlbum->findFirst(array('owner' => $this->params['id'], 'is_default' => 1 )); + $photos = array(); + if ($album){ + $_filter = array('conditions' => "album_id =" . $album->getId()); + $photos = $this->PhotoappPhoto->find('all', $_filter); - if (count($imgs) > 0) { - $script = "var tinyMCEImageList = new Array("; - foreach ($imgs as $nn => $img_name) { - $script .= "[\"" . $img_name . "\", \"" . "/preview/100x100/" . $path . $img_name . "\"],"; - } - $script = substr($script, 0, strlen($script) - 1); - $script .=");"; + //print_r($photos); + //echo "#" . count($photos) . "#"; + + $file = new StoredFile(); + $file->user_id = $this->current_user->getId(); + $path = $file->path(); +/* + $imgs = array_diff(scandir(AK_PUBLIC_DIR . DS . $path), array('.', '..')); +*/ + + $script = "var tinyMCEImageList = new Array( "; + if ($photos) { + foreach ($photos as $k => $photo) { + $photo->media_item->load(); + $photo->stored_file->load(); + $img_name = $photo->stored_file->name; + //print_r($photo->media_item->title); + $script .= "[\"" . $img_name . "\", \"" . "/preview/100x100/" . $path . $img_name . "\"],"; + } // foreach + $script = substr($script, 0, strlen($script) - 1); + }// photos + $script .=");"; + } + //$str = $this->renderToString(array( 'template' => 'image_list.tpl', 'locals' => $locals )); //$this->debug($str); return $this->renderText( $script ); Modified: app/installers/blogapp/blog_installer.php =================================================================== --- app/installers/blogapp/blog_installer.php 2008-08-26 11:36:51 UTC (rev 297) +++ app/installers/blogapp/blog_installer.php 2008-08-26 12:35:38 UTC (rev 298) @@ -27,8 +27,8 @@ function down_1() { - $this->dropTable('blogapp_attachments'); - //$this->dropTable('blogapp_posts'); + //$this->dropTable('blogapp_attachments'); + $this->dropTable('blogapp_posts'); } } ?> \ 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-08-28 12:03:31
|
Revision: 299 http://isocial.svn.sourceforge.net/isocial/?rev=299&view=rev Author: dim0s77 Date: 2008-08-28 12:03:39 +0000 (Thu, 28 Aug 2008) Log Message: ----------- Added sorting by column to array_paginator_helper Modified Paths: -------------- app/controllers/groupapp/group_controller.php app/helpers/array_pagination_helper.php app/locales/groupapp/group/ru.php app/views/groupapp/group/index.tpl Modified: app/controllers/groupapp/group_controller.php =================================================================== --- app/controllers/groupapp/group_controller.php 2008-08-26 12:35:38 UTC (rev 298) +++ app/controllers/groupapp/group_controller.php 2008-08-28 12:03:39 UTC (rev 299) @@ -46,13 +46,25 @@ $this->user_groups_count = count($user_groups); + $this->sort_type = !empty($this->params['s']) ? $this->params['s'] : ''; + $_filter_pagination = array('items_per_page' => 10); - $group_pages = $this->array_pagination_helper->getPaginator("user_group_pages", $user_groups, $_filter_pagination);// paginator - + $group_pages = $this->array_pagination_helper->getPaginator("user_group_pages", + $user_groups, + $_filter_pagination);// paginator + if (!empty($this->params['sort']) && !empty($this->params['direction'])) { + $user_groups = $this->array_pagination_helper->sortByColumn($user_groups, + $this->GroupappGroup, + $this->params['sort'], + $this->params['direction'] + ); + } $links = $group_pages->paginator->getLinks(); - $this->pages_links = $links['first'] . ' ' . $links['back'] . ' ' . $links['pages'] . ' ' . $links['next'] . ' ' . $links['last']; - $this->user_groups = $this->array_pagination_helper->getPageItems("user_group_pages", $user_groups); + $this->pages_links = $links['first'] . ' ' . $links['back'] . ' ' . + $links['pages'] . ' ' . + $links['next' ] . ' ' . $links['last']; + $this->user_groups = $this->array_pagination_helper->getPageItems("user_group_pages", $user_groups); $this->user_picture = $this->_current_user_picture(); $this->_extract_group_types(); Modified: app/helpers/array_pagination_helper.php =================================================================== --- app/helpers/array_pagination_helper.php 2008-08-26 12:35:38 UTC (rev 298) +++ app/helpers/array_pagination_helper.php 2008-08-28 12:03:39 UTC (rev 299) @@ -39,6 +39,28 @@ return $page_items; } + + function sortByColumn($items, $active_record, $column_name, $direction) + { + if (!$active_record->hasColumn($column_name)) { + return $items; + } + switch ($active_record->getColumnType($column_name)) { + case "string": + $f = '$val = strcmp($a->' . $column_name . ', $b->' . $column_name . '); '. + 'return ("' . $direction . '" == "asc") ? $val : $val * -1;'; + usort($items, create_function('$a,$b', $f)); + break; + case "integer": + $f = 'if ($a->' . $column_name . ' == $b->' . $column_name. ') { return 0; } ' . + '$val = ($a->' . $column_name . ' > $b->' . $column_name . ') ? 1 : -1; ' . + 'return ("' . $direction . '" == "asc") ? $val : $val * -1;'; + usort($items, create_function('$a,$b', $f)); + break; + } + return $items; + } + } ?> \ No newline at end of file Modified: app/locales/groupapp/group/ru.php =================================================================== --- app/locales/groupapp/group/ru.php 2008-08-26 12:35:38 UTC (rev 298) +++ app/locales/groupapp/group/ru.php 2008-08-28 12:03:39 UTC (rev 299) @@ -22,10 +22,9 @@ $dictionary['persons'] = 'участников'; $dictionary['Start New Topic'] = 'Начать новую тему'; $dictionary['Topics count'] = 'Обсуждаемых тем'; -$dictionary['All groups'] = 'Все Ваши группы'; -$dictionary['Recently Updated'] = 'Обновленные последними'; +$dictionary['All groups'] = 'Все мои группы'; $dictionary['By Group Member Size'] = 'По количеству пользователей'; -$dictionary['Groups You Admin'] = 'Администрируемые Вами'; +$dictionary['Groups You Admin'] = 'Администрируемые мной'; $dictionary['You are in groups'] = 'Число групп, в которых Вы состоите'; $dictionary['Step'] = 'Шаг'; Modified: app/views/groupapp/group/index.tpl =================================================================== --- app/views/groupapp/group/index.tpl 2008-08-26 12:35:38 UTC (rev 298) +++ app/views/groupapp/group/index.tpl 2008-08-28 12:03:39 UTC (rev 299) @@ -21,11 +21,10 @@ <div class="submenu"> <div class="menu_block selector"> <label for="action_select">_{Show}: - <select onchange="doselect(this)" id="action_select" name="action_select"> - <option selected="selected" value="none">_{All groups}</option> - <option value="read">_{Recently Updated}</option> - <option value="unread">_{By Group Member Size}</option> - <option value="all">_{Groups You Admin}</option> + <select onchange="javascript: window.location.href='?s=' + this.options[this.selectedIndex].value"> + <option <? if(empty($sort_type) || $sort_type == "all"): ?>selected="selected" <? endif ?> value="all">_{All groups}</option> + <option <? if(!empty($sort_type) && $sort_type == "members"): ?>selected="selected" <? endif ?> value="members">_{By Group Member Size}</option> + <option <? if(!empty($sort_type) && $sort_type == "admin"): ?>selected="selected" <? endif ?> value="admin">_{Groups You Admin}</option> </select> </label> </div> @@ -148,4 +147,5 @@ }); return false; } + </script> This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <di...@us...> - 2008-08-28 13:34:02
|
Revision: 300 http://isocial.svn.sourceforge.net/isocial/?rev=300&view=rev Author: dim0s77 Date: 2008-08-28 13:34:12 +0000 (Thu, 28 Aug 2008) Log Message: ----------- minor fixes Modified Paths: -------------- app/controllers/groupapp/group_controller.php app/views/groupapp/group/_info.tpl Modified: app/controllers/groupapp/group_controller.php =================================================================== --- app/controllers/groupapp/group_controller.php 2008-08-28 12:03:39 UTC (rev 299) +++ app/controllers/groupapp/group_controller.php 2008-08-28 13:34:12 UTC (rev 300) @@ -73,10 +73,9 @@ function create () { $this->step = 'group_info'; if (!empty($this->params['group'])){ - if (empty($this->params['group']['type_id']) || $this->params['group']['type_id'] == 0) { - $this->addError('_common', 'Group type is missing', 'please select the group type'); - return; - } + if (!isset($group)) { $this->group = new GroupappGroup(); } + $this->group->setAttributes($this->params['group']); + $this->group->category_id = $this->params['group']['category_id']; $this->GroupappGroup->setAttributes($this->params['group']); $this->GroupappGroup->members_count = 1; if ($this->Request->isPost() && $this->GroupappGroup->save()){ Modified: app/views/groupapp/group/_info.tpl =================================================================== --- app/views/groupapp/group/_info.tpl 2008-08-28 12:03:39 UTC (rev 299) +++ app/views/groupapp/group/_info.tpl 2008-08-28 13:34:12 UTC (rev 300) @@ -22,13 +22,13 @@ <label class="required">_{Group Type}:<br><small>(_{required})</small></label> <div class="formcol"> <select id="group_category_id" name="group[category_id]" onchange="on_category_change('group_category_id', category_subtypes, category_sublabels);" typefor="group_type_id"> - <option <? if (!empty($group) && !$group->category_id): ?>selected="selected" <? endif ?>value="">_{Select Category:}</option> + <option <? if (!empty($group) && empty($group->category_id)): ?>selected="selected" <? endif ?>value="">_{Select Category:}</option> {loop group_types} - <option <? if (!empty($group) && $group->category_id == $group_type->id): ?>selected="selected" <? endif ?>value="{group_type.id?}"><?= $gt[$group_type->id] ?></option> + <option <? if (!empty($group) && !empty($group->category_id) && $group->category_id == $group_type->id): ?>selected="selected" <? endif ?>value="{group_type.id?}"><?= $gt[$group_type->id] ?></option> {end} </select> <select id="group_type_id" name="group[type_id]" subtypefor="group_category_id" <? if (empty($group) || !$group->category_id): ?>disabled="disabled" <? endif ?>> - <option <? if (!empty($group) && (!$group->category_id || !$group->type_id)): ?>selected="selected" <? endif ?>value="">_{Select Type:}</option> + <option <? if (!empty($group) && (empty($group->category_id) || empty($group->type_id))): ?>selected="selected" <? endif ?>value="">_{Select Type:}</option> {loop subgroup_types} <? if (empty($group) || $group->category_id != $subgroup_type) continue; ?> <option <? if ($group->type_id == $subgroup_type_loop_key): ?>selected="selected" <? endif ?>value="{subgroup_type_loop_key}"><?= $gt[$subgroup_type_loop_key] ?></option> This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <di...@us...> - 2008-09-01 14:10:27
|
Revision: 302 http://isocial.svn.sourceforge.net/isocial/?rev=302&view=rev Author: dim0s77 Date: 2008-09-01 14:10:35 +0000 (Mon, 01 Sep 2008) Log Message: ----------- maked search of groups by group name Modified Paths: -------------- app/controllers/groupapp/group_controller.php app/views/groupapp/group/browse.tpl Modified: app/controllers/groupapp/group_controller.php =================================================================== --- app/controllers/groupapp/group_controller.php 2008-08-29 13:44:26 UTC (rev 301) +++ app/controllers/groupapp/group_controller.php 2008-09-01 14:10:35 UTC (rev 302) @@ -287,8 +287,29 @@ } } + function _get_conditions_for_group( $to_ascii = true ) { + $query = $this->params['group_name']; + $aquery = utf8_to_ascii($query); + if ($to_ascii && $aquery != $query) { + $conditions = 'name LIKE "%' . $query . '%" OR name LIKE "%' . $aquery . '%"'; + } else { + $conditions = 'name LIKE "%' . $query . '%"'; + } + return $conditions; + } + function browse () { - $all_groups = $this->GroupappGroup->find('all'); + $all_groups = array(); + if (empty($this->params['group_name'])) { + $all_groups = $this->GroupappGroup->find('all'); + } else { + $all_groups = $this->GroupappGroup->find('all', + array('conditions' => $this->_get_conditions_for_group(), + 'order' => 'name' + )); + $this->group_name = $this->params['group_name']; + } + if (!($this->all_groups_count = count($all_groups))) { return; } $this->_extract_group_types(); @@ -304,6 +325,9 @@ " BETWEEN " . $this->group_type_id * 100 . " and " . ($this->group_type_id + 1) * 100; $_filter_pagination['count_conditions'] = "type_id" . $type_id; $_filter['conditions'] = 'type_id' . $type_id; + } elseif (!empty($this->params['group_name'])) { + $_filter_pagination['count_conditions'] = $this->_get_conditions_for_group(); + $_filter['conditions'] = $_filter_pagination['count_conditions']; } $group_pages = $this->pagination_helper->getPaginator($this->GroupappGroup, $_filter_pagination);// paginator Modified: app/views/groupapp/group/browse.tpl =================================================================== --- app/views/groupapp/group/browse.tpl 2008-08-29 13:44:26 UTC (rev 301) +++ app/views/groupapp/group/browse.tpl 2008-09-01 14:10:35 UTC (rev 302) @@ -33,8 +33,8 @@ <div class="right_content"> <div class="title_text">_{Search groups}:</div> - <form> - <input class="mediumtextinput search" id="searchfield" name="" type="text" value="_{Search by name}" onclick="on_search_group_click(this)" onblur="on_search_group_blur(this)" /><a class="submitsearchbtn">_{Search}</a> + <form name="search_group" action="/groupapp/group/browse" method="get"> + <input class="mediumtextinput search" id="searchfield" name="group_name" type="text" value="{?group_name}{group_name}{else}_{Search by name}{end}" onclick="on_search_group_click(this)" onblur="on_search_group_blur(this)" /><a class="submitsearchbtn" onclick="document.search_group.submit();">_{Search}</a> </form> <div class="clearfix"></div> This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |