[Isocial-svn] SF.net SVN: isocial: [286] app
Status: Pre-Alpha
Brought to you by:
aguidrevitch
From: <agu...@us...> - 2008-07-14 18:27:35
|
Revision: 286 http://isocial.svn.sourceforge.net/isocial/?rev=286&view=rev Author: aguidrevitch Date: 2008-07-14 11:27:43 -0700 (Mon, 14 Jul 2008) Log Message: ----------- some stubs for education/work profiles Modified Paths: -------------- app/controllers/profile_controller.php app/installers/russian_installer.php app/installers/user_installer.php app/locales/profile/ru.php app/models/network.php app/models/user.php app/views/profile/_menu.tpl Added Paths: ----------- app/models/education_profile.php app/models/network_type.php app/models/work_profile.php app/views/profile/education.tpl app/views/profile/work.tpl Removed Paths: ------------- app/models/network_profile.php app/views/profile/networks.tpl Modified: app/controllers/profile_controller.php =================================================================== --- app/controllers/profile_controller.php 2008-07-14 17:59:26 UTC (rev 285) +++ app/controllers/profile_controller.php 2008-07-14 18:27:43 UTC (rev 286) @@ -109,9 +109,16 @@ } } - function networks () { + function education () { + $this->education_profile = $this->current_user->education_profile->load(); + } + function work () { + $this->work_profile = $this->current_user->work_profile->load(); + + } + function picture () { } Modified: app/installers/russian_installer.php =================================================================== --- app/installers/russian_installer.php 2008-07-14 17:59:26 UTC (rev 285) +++ app/installers/russian_installer.php 2008-07-14 18:27:43 UTC (rev 286) @@ -26,6 +26,9 @@ $this->execute("UPDATE marital_statuses set {$locale}_name ='Сложно объяснить' WHERE id = 5"); $this->execute("UPDATE marital_statuses set {$locale}_name ='В открытых взаимоотношениях' WHERE id = 6"); + $this->execute("ALTER TABLE network_types ADD COLUMN {$locale}_name char(40) NOT NULL AFTER en_name"); + $this->execute("UPDATE network_types set {$locale}_name ='Образование' WHERE id = 1"); + $this->execute("UPDATE network_types set {$locale}_name ='Работа' WHERE id = 2"); } function down_1() Modified: app/installers/user_installer.php =================================================================== --- app/installers/user_installer.php 2008-07-14 17:59:26 UTC (rev 285) +++ app/installers/user_installer.php 2008-07-14 18:27:43 UTC (rev 286) @@ -286,20 +286,55 @@ ) ENGINE=InnoDB"); $this->execute( + "CREATE TABLE `network_types` ( + `id` int(11) NOT NULL PRIMARY KEY AUTO_INCREMENT, + `en_name` char(50) + ) ENGINE=InnoDB"); + + $this->execute("INSERT INTO network_types (id, en_name) VALUES (1, 'Education')"); + $this->execute("INSERT INTO network_types (id, en_name) VALUES (2, 'Work')"); + + $this->execute( "CREATE TABLE `networks` ( `id` int(11) NOT NULL PRIMARY KEY AUTO_INCREMENT, + `network_type_id` int(11), `city_id` int(11), - `name` char(255), - FOREIGN KEY (city_id) REFERENCES cities(id) + `name` char(200), + FOREIGN KEY (network_type_id) REFERENCES network_types(id), + FOREIGN KEY (city_id) REFERENCES cities(id) ) ENGINE=InnoDB"); $this->execute( - "CREATE TABLE `network_profiles` ( + "CREATE TABLE `network_votes` ( + `id` int(11) NOT NULL PRIMARY KEY AUTO_INCREMENT, + `user_id` int(11), + `network_id` int(11), + FOREIGN KEY (user_id) REFERENCES users(id), + FOREIGN KEY (network_id) REFERENCES networks(id), + UNIQUE vote_idx (user_id, network_id) + ) ENGINE=InnoDB"); + + $this->execute( + "CREATE TABLE `education_profiles` ( `id` int(11) NOT NULL PRIMARY KEY AUTO_INCREMENT, `user_id` int(11) NOT NULL, `network_id` int(11), `from` datetime, `to` datetime, + `concentration` char(200), + FOREIGN KEY (user_id) REFERENCES users(id), + FOREIGN KEY (network_id) REFERENCES networks(id), + INDEX user_idx (user_id) + ) ENGINE=InnoDB"); + + $this->execute( + "CREATE TABLE `work_profiles` ( + `id` int(11) NOT NULL PRIMARY KEY AUTO_INCREMENT, + `user_id` int(11) NOT NULL, + `network_id` int(11), + `from` datetime, + `to` datetime, + `position` char(100), `description` char(255), FOREIGN KEY (user_id) REFERENCES users(id), FOREIGN KEY (network_id) REFERENCES networks(id), @@ -309,10 +344,11 @@ function down_1() { - $this->transactionComplete(); - $this->dropTable('network_profiles'); + $this->dropTable('work_profiles'); + $this->dropTable('education_profiles'); $this->dropTable('networks'); + $this->dropTable('network_types'); $this->dropTable('personal_profiles'); $this->dropTable('marital_statuses'); $this->dropTable('relationship_profiles'); Modified: app/locales/profile/ru.php =================================================================== --- app/locales/profile/ru.php 2008-07-14 17:59:26 UTC (rev 285) +++ app/locales/profile/ru.php 2008-07-14 18:27:43 UTC (rev 286) @@ -8,7 +8,8 @@ $dictionary['Contact'] = 'Контакты'; $dictionary['Relationships'] = 'Семейное положение'; $dictionary['Personal'] = 'Интересы'; -$dictionary['Groups'] = 'Группы'; +$dictionary['Education'] = 'Образование'; +$dictionary['Work'] = 'Работа'; $dictionary['Picture'] = 'Фото'; $dictionary['Sex'] = 'Пол'; Added: app/models/education_profile.php =================================================================== --- app/models/education_profile.php (rev 0) +++ app/models/education_profile.php 2008-07-14 18:27:43 UTC (rev 286) @@ -0,0 +1,8 @@ +<?php + +class EducationProfile extends ActiveRecord +{ + var $belongs_to = array('User','Network'); +} + +?> Modified: app/models/network.php =================================================================== --- app/models/network.php 2008-07-14 17:59:26 UTC (rev 285) +++ app/models/network.php 2008-07-14 18:27:43 UTC (rev 286) @@ -2,20 +2,23 @@ class Network extends VotableActiveRecord { - var $belongs_to = array('City'); + var $belongs_to = array('City', 'NetworkType'); var $votes_model = 'NetworkVote'; var $strtolower = false; var $_alternate = false; function findConditions () { - return array('conditions' => array("country_id = ? AND region_id = ? AND name LIKE ?", $this->country_id, $this->region_id, $this->name)); + return array('conditions' => array("network_id = ? AND name LIKE ?", $this->network_id, $this->name)); } function validateOnCreate () { $this->validatesPresenceOf('name', "Network Name|network name can't be blank"); $this->validatesPresenceOf('city_id', "City|city can't be blank"); + $this->validatesPresenceOf('network_type_id', "Network type|network type can't be blank"); if (!$this->getErrors()) { $this->validatesNumericalityOf('city_id', "City: hack attempt detected|city does not exist"); + $this->validatesNumericalityOf('network_type_id', "Network type: hack attempt detected|network type does not exist"); + if (!$this->getErrors()) { $City = new City(); $city = $City->find( $this->city_id ); @@ -23,6 +26,15 @@ $this->addError('city_id', "City: hack attempt detected|city does not exist"); } } + + if (!$this->getErrors()) { + $NetworkType = new NetworkType(); + $network_type = $NetworkType->find( $this->network_type_id ); + if (empty($network_type)) { + $this->addError('network_type_id', "Network type: hack attempt detected|network does not exist"); + } + } + } } Deleted: app/models/network_profile.php =================================================================== --- app/models/network_profile.php 2008-07-14 17:59:26 UTC (rev 285) +++ app/models/network_profile.php 2008-07-14 18:27:43 UTC (rev 286) @@ -1,8 +0,0 @@ -<?php - -class NetworkProfile extends ActiveRecord -{ - var $belongs_to = array('User', 'Network'); -} - -?> Added: app/models/network_type.php =================================================================== --- app/models/network_type.php (rev 0) +++ app/models/network_type.php 2008-07-14 18:27:43 UTC (rev 286) @@ -0,0 +1,7 @@ +<?php + +class NetworkType extends ActiveRecord +{ +} + +?> Modified: app/models/user.php =================================================================== --- app/models/user.php 2008-07-14 17:59:26 UTC (rev 285) +++ app/models/user.php 2008-07-14 18:27:43 UTC (rev 286) @@ -2,22 +2,26 @@ class User extends ActiveRecord { - var $has_many = array('outbox_messages' => array('class_name' => 'Message', - 'order' => 'created_at desc', - 'foreign_key' => 'sender_id', - 'conditions' => 'is_sender_del = 0'), - 'inbox_messages' => array('class_name' => 'Message', - 'order' => 'created_at desc', - 'foreign_key' => 'recipient_id', - 'conditions' => 'is_recipient_del = 0'), - 'im_profiles' => array('class_name' => 'ImProfile', - 'foreign_key' => 'user_id'), - 'stored_files' => array('class_name' => 'StoredFile', - 'foreign_key' => 'user_id'), + var $has_many = array('outbox_messages' => array('class_name' => 'Message', + 'order' => 'created_at desc', + 'foreign_key' => 'sender_id', + 'conditions' => 'is_sender_del = 0'), + 'inbox_messages' => array('class_name' => 'Message', + 'order' => 'created_at desc', + 'foreign_key' => 'recipient_id', + 'conditions' => 'is_recipient_del = 0'), + 'im_profiles' => array('class_name' => 'ImProfile', + 'foreign_key' => 'user_id'), + 'stored_files' => array('class_name' => 'StoredFile', + 'foreign_key' => 'user_id'), + 'education_profiles' => array('class_name' => 'EducationProfile', + 'foreign_key' => 'user_id'), + 'work_profiles' => array('class_name' => 'WorkProfile', + 'foreign_key' => 'user_id'), ); var $has_and_belongs_to_many = array('groupapp_groups' => array('join_table' => 'groupapp_members')); - + var $has_one = array('BasicProfile', 'ContactProfile', 'RelationshipProfile', 'PersonalProfile'); function login($email, $password) { Added: app/models/work_profile.php =================================================================== --- app/models/work_profile.php (rev 0) +++ app/models/work_profile.php 2008-07-14 18:27:43 UTC (rev 286) @@ -0,0 +1,8 @@ +<?php + +class WorkProfile extends ActiveRecord +{ + var $belongs_to = array('User','Network'); +} + +?> Modified: app/views/profile/_menu.tpl =================================================================== --- app/views/profile/_menu.tpl 2008-07-14 17:59:26 UTC (rev 285) +++ app/views/profile/_menu.tpl 2008-07-14 18:27:43 UTC (rev 286) @@ -6,7 +6,8 @@ ?><li><a href="/profile/contact" class="<?= $controller->getActionName() == 'contact' ? 'selected' : '' ?>">_{Contact}</a></li><? ?><li><a href="/profile/relationships" class="<?= $controller->getActionName() == 'relationships' ? 'selected' : '' ?>">_{Relationships}</a></li><? ?><li><a href="/profile/personal" class="<?= $controller->getActionName() == 'personal' ? 'selected' : '' ?>">_{Personal}</a></li><? - ?><li><a href="/profile/networks" class="<?= $controller->getActionName() == 'groups' ? 'selected' : '' ?>">_{Groups}</a></li><? + ?><li><a href="/profile/education" class="<?= $controller->getActionName() == 'education' ? 'selected' : '' ?>">_{Education}</a></li><? + ?><li><a href="/profile/work" class="<?= $controller->getActionName() == 'work' ? 'selected' : '' ?>">_{Work}</a></li><? ?><li><a href="/profile/picture" class="last <?= $controller->getActionName() == 'picture' ? 'selected' : '' ?>">_{Picture}</a></li> </ul> </div> Added: app/views/profile/education.tpl =================================================================== --- app/views/profile/education.tpl (rev 0) +++ app/views/profile/education.tpl 2008-07-14 18:27:43 UTC (rev 286) @@ -0,0 +1,64 @@ +<?= $controller->renderPartial("menu") ?> + +<div class="editform"> + <form method="post"> + + <div class="formrow"> + <?= $controller->renderErrors() ?> + </div> + + <div class="formrow"> + <label class="required">_{Educational institution}:</label> + <div class="formcol"> + <input name="" class="mediumtextinput autocomplete"> + </div> + <div class="clearfix"></div> + </div> + + <div class="formrow"> + <label>_{Concentration}:</label> + <div class="formcol"> + <input name="" class="textinput"> + </div> + <div class="clearfix"></div> + </div> + + <div class="formrow"> + <label>_{Degree}:</label> + <div class="formcol"> + <input name="" class="textinput"> + </div> + <div class="clearfix"></div> + </div> + + <div class="formrow"> + <label>_{Time period}:</label> + <div class="formcol"> + <div> + <input type="checkbox">_{I currently work here} + </div> + <select type=""><option>October</option></select> + <select type=""><option>1995</option></select> to present + </div> + <div class="clearfix"></div> + </div> + + <div class="formrow"> + <label> </label> + <div class="formcol"> + <a href="#">_{Add Another Institution}</a> + </div> + <div class="clearfix"></div> + </div> + + <div class="formrow"> + <label> </label> + <div class="formcol"> + <input class="submitinput" type="submit" value="_{Save}"> + <input class="cancelinput" type="button" value="_{Cancel}"> + </div> + <div class="clearfix"></div> + </div> + + </form> +</div> Deleted: app/views/profile/networks.tpl =================================================================== --- app/views/profile/networks.tpl 2008-07-14 17:59:26 UTC (rev 285) +++ app/views/profile/networks.tpl 2008-07-14 18:27:43 UTC (rev 286) @@ -1,5 +0,0 @@ -<?= $controller->renderPartial("menu") ?> - -<?= $controller->renderErrors() ?> - -<p class="indent">Coming soon</p> Added: app/views/profile/work.tpl =================================================================== --- app/views/profile/work.tpl (rev 0) +++ app/views/profile/work.tpl 2008-07-14 18:27:43 UTC (rev 286) @@ -0,0 +1,5 @@ +<?= $controller->renderPartial("menu") ?> + +<?= $controller->renderErrors() ?> + +<p class="indent">Coming soon</p> This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |