Добавил:
Upload Опубликованный материал нарушает ваши авторские права? Сообщите нам.
Вуз: Предмет: Файл:
Записка_РОМА.doc
Скачиваний:
0
Добавлен:
01.05.2025
Размер:
1.25 Mб
Скачать

Висновок

В даній роботі розглядалося створення програмного додатку “Соціальна мережа любителів книг”. В ході роботи була зроблена характеристика готових рішень та обґрунтування вибору прийнятого принципу побудови додатку, досліджено і описано функції даної теми. Створений програмний продукт може використовуватись користувачем в любому місці де є підключення до інтернету.

Було зроблено постановку задачі, в рамках якої було зроблено вибір функцій для програмного продукту, розроблено завдання у вигляді варіантів використання, сформування технічних вимог до системи, досліджено технологію обробки і перетворення інформації, обчислено техніко-економічні показники проекту, зформовано технічні вимоги до системи.

Реалізовано програмний продукт, а саме структуру бази даних, загальну структуру програми, модуль ведення каталогу книг та модуль роботи з користувачами.

В ході роботи було обрано мову на якій буде написано програму, платформу реалізації, систему управління базою даних, додаткові технології та бібліотек, а також інструментальні засоби розробки.

Була виконана економічна частина данної дипломної роботи, а також частина з охорони праці.

Програмне забезпечення може бути модернізоване, але тільки в даній сфері використання, тобто в програму можна додати функції, які доповнять дану програму та розширити в БД інформацію, сформувати нові необхідні для користувача сторінки, зробивши для них певні права доступу.

Список використаної літератури

  1. Тейт Б., Хиббс К. Ruby on Rails. Быстрая веб-разработка. — СПб.: BHV-Петербург, 2008. — 224 с.

  2. Хэнссон Д. Х., Томас Д. Гибкая разработка веб-приложений в среде Rails. — СПб.: Питер, 2008. — 720 с.

  3. Фоулер Ч. Rails. Сборник рецептов. — СПб.: Питер, 2007. — 256 с.

  4. Фернандес О. Путь Rails. Подробное руководство по созданию приложений в среде Ruby on Rails. — Символ-Плюс, 2008. — 768 с.

  5. Руби С., Томас Д., Хэнссон Д. Х. Гибкая разработка веб-приложений в среде Rails. — 4-е изд. — Питер, 2012. — 464 с.

  6. MVC для начинающих и для интернета в частности [Електронний ресурс]. - Режим доступа: http://chtivo.webhost.ru/articles/mvc.php.

  7. Стивенс У. Р. Unix. Разработка сетевых приложений / У. Р. Стивенс. СПб. : Питер, 2007. 1038 с.

  8. Аллен Э. Типичные ошибки проектирования / Э. Аллен. СПб. : Питер, 2003. 223 с.

  9. Офіційний сайт MySQL [Електронний ресурс]. - Режим доступа: http://dev.mysql.com/

  10. Timothy M. O'Brien "Jakarta Commons Cookbook". O'Reilly; ISBN 0-596-00706-X

  11. Сайт СКБД http://postgresql.ru.net/

Додаток а

Текст програми

books_controller.rb

require 'upload_progress'

class BooksController < ApplicationController

# GET /books

# GET /books.json

upload_status_for :create, :status => :custom_status

def index

@books = current_user.books

respond_to do |format|

format.html # index.html.erb

format.js

end

end

def allshow

@books = Book.all

end

# GET /books/1

# GET /books/1.json

def show

@book = Book.find(params[:id])

respond_to do |format|

format.html # show.html.erb

format.json { render :json => @book }

end

end

# GET /books/new

# GET /books/new.json

def new

@book = Book.new

respond_to do |format|

format.html # new.html.erb

format.js

end

end

def edit

@book = Book.find(params[:id])

end

# POST /books

# POST /books.json

def create

@book = Book.new(params[:book])

@book.user_id = current_user.id

respond_to do |format|

if @book.save

format.html { redirect_to '/books', :notice => 'Book was successfully created.' }

format.js

else

format.html { render :action => "new" }

format.js

end

end

end

# PUT /books/1

# PUT /books/1.json

def update

@book = Book.find(params[:id])

respond_to do |format|

if @book.update_attributes(params[:book])

format.html { redirect_to @book, :notice => 'Book was successfully updated.' }

format.json { head :no_content }

else

format.html { render :action => "edit" }

format.json { render :json => @book.errors, :status => :unprocessable_entity }

end

end

end

# DELETE /books/1

# DELETE /books/1.json

def destroy

@book = Book.find(params[:id])

@book.destroy

respond_to do |format|

format.html { redirect_to books_url }

format.json { head :no_content }

end

end

def seach

if params[:query]

@books = Book.where( 'name LIKE ?', '%'+params[:query]+'%' )

respond_to do |format|

format.html # show.html.erb

format.json { render :json => @book }

end

else

@books = []

end

end

end

categories_controller.rb

class CategoriesController < ApplicationController

# GET /categories

# GET /categories.json

def index

@categories = current_user.categories

respond_to do |format|

format.html # index.html.erb

format.json { render :json => @categories }

end

end

# GET /categories/1

# GET /categories/1.json

def show

@category = current_user.categories.find(params[:id])

respond_to do |format|

format.html # show.html.erb

format.json { render :json => @category }

end

end

# GET /categories/new

# GET /categories/new.json

def new

@category = Category.new

respond_to do |format|

format.html # new.html.erb

format.js

end

end

# GET /categories/1/edit

def edit

@category = current_user.categories.find(params[:id])

end

# POST /categories

# POST /categories.json

def create

@category = Category.new(params[:category])

@category.user_id=current_user.id

respond_to do |format|

if @category.save

format.html { redirect_to "/categories", :notice => 'Category was successfully created.' }

format.json { render :json => @category, :status => :created, :location => @category }

else

format.html { render :action => "new" }

format.json { render :json => @category.errors, :status => :unprocessable_entity }

end

end

end

# PUT /categories/1

# PUT /categories/1.json

def update

@category = Category.find(params[:id])

respond_to do |format|

if @category.update_attributes(params[:category])

format.html { redirect_to @category, :notice => 'Category was successfully updated.' }

format.json { head :no_content }

else

format.html { render :action => "edit" }

format.json { render :json => @category.errors, :status => :unprocessable_entity }

end

end

end

# DELETE /categories/1

# DELETE /categories/1.json

def destroy

@category = Category.find(params[:id])

@category.destroy

respond_to do |format|

format.html { redirect_to categories_url }

format.json { head :no_content }

end

end

end

books_controller.rb

require 'upload_progress'

class BooksController < ApplicationController

# GET /books

# GET /books.json

upload_status_for :create, :status => :custom_status

def index

@books = current_user.books

respond_to do |format|

format.html # index.html.erb

format.js

end

end

def allshow

@books = Book.all

end

# GET /books/1

# GET /books/1.json

def show

@book = Book.find(params[:id])

respond_to do |format|

format.html # show.html.erb

format.json { render :json => @book }

end

end

# GET /books/new

# GET /books/new.json

def new

@book = Book.new

respond_to do |format|

format.html # new.html.erb

format.js

end

end

def edit

@book = Book.find(params[:id])

end

# POST /books

# POST /books.json

def create

@book = Book.new(params[:book])

@book.user_id = current_user.id

respond_to do |format|

if @book.save

format.html { redirect_to '/books', :notice => 'Book was successfully created.' }

format.js

else

format.html { render :action => "new" }

format.js

end

end

end

# PUT /books/1

# PUT /books/1.json

def update

@book = Book.find(params[:id])

respond_to do |format|

if @book.update_attributes(params[:book])

format.html { redirect_to @book, :notice => 'Book was successfully updated.' }

format.json { head :no_content }

else

format.html { render :action => "edit" }

format.json { render :json => @book.errors, :status => :unprocessable_entity }

end

end

end

# DELETE /books/1

# DELETE /books/1.json

def destroy

@book = Book.find(params[:id])

@book.destroy

respond_to do |format|

format.html { redirect_to books_url }

format.json { head :no_content }

end

end

def seach

if params[:query]

@books = Book.where( 'name LIKE ?', '%'+params[:query]+'%' )

respond_to do |format|

format.html # show.html.erb

format.json { render :json => @book }

end

else

@books = []

end

end

end

messages_controller.rb

class MessagesController < ApplicationController

# GET /messages

# GET /messages.json

def index

@messages = current_user.messages

respond_to do |format|

format.html # index.html.erb

format.json { render :json => @messages }

end

end

# GET /messages/1

# GET /messages/1.json

def show

@message = Message.find(params[:id])

respond_to do |format|

format.html # show.html.erb

format.json { render :json => @message }

end

end

# GET /messages/new

# GET /messages/new.json

def new

@message = Message.new

@user = User.find(params[:user])

respond_to do |format|

format.html # new.html.erb

format.json { render :json => @message }

end

end

# GET /messages/1/edit

def edit

@message = Message.find(params[:id])

end

# POST /messages

# POST /messages.json

def create

@message = Message.new(params[:message])

@message.user_id = current_user.id

respond_to do |format|

if @message.save

format.html { redirect_to @message, :notice => 'Message was successfully created.' }

format.json { render :json => @message, :status => :created, :location => @message }

else

format.html { render :action => "new" }

format.json { render :json => @message.errors, :status => :unprocessable_entity }

end

end

end

# PUT /messages/1

# PUT /messages/1.json

def update

@message = Message.find(params[:id])

respond_to do |format|

if @message.update_attributes(params[:message])

format.html { redirect_to @message, :notice => 'Message was successfully updated.' }

format.json { head :no_content }

else

format.html { render :action => "edit" }

format.json { render :json => @message.errors, :status => :unprocessable_entity }

end

end

end

# DELETE /messages/1

# DELETE /messages/1.json

def destroy

@message = Message.find(params[:id])

@message.destroy

respond_to do |format|

format.html { redirect_to messages_url }

format.json { head :no_content }

end

end

def sent

redirect_to '/'

end

end

user_controller.rb

require 'ftools'

class UserController < ApplicationController

before_filter :auth_user

def auth_user

redirect_to new_user_registration_url unless user_signed_in?

end

def index

if(!current_user)

redirect_to new_user_registration_url unless user_signed_in?

end

if(current_user.user_info)

@info = current_user.user_info

@users = User.all

@books = Book.all

else

redirect_to new_user_info_path

end

end

def show

@user = User.find(params[:id])

end

def accounts

@users = User.all

end

def sent

@user = User.find(params[:user])

respond_to do |format|

format.html # show.html.erb

format.json { render :json => @book }

end

end

def create_mes

@message = Message.new(params[:tema, :mess])

end

end

user_infos_controller.rb

class UserInfosController < ApplicationController

# GET /user_infos

# GET /user_infos.json

def index

@user_infos = UserInfo.all

respond_to do |format|

format.html # index.html.erb

format.json { render :json => @user_infos }

end

end

# GET /user_infos/1

# GET /user_infos/1.json

def show

@user_info = UserInfo.find(params[:id])

respond_to do |format|

format.html # show.html.erb

format.json { render :json => @user_info }

end

end

# GET /user_infos/new

# GET /user_infos/new.json

def new

@user_info = UserInfo.new

respond_to do |format|

format.html # new.html.erb

format.json { render :json => @user_info }

end

end

# GET /user_infos/1/edit

def edit

@user_info = UserInfo.find(params[:id])

end

# POST /user_infos

# POST /user_infos.json

def create

@user_info = UserInfo.new(params[:user_info])

@user_info.user_id = current_user.id

respond_to do |format|

if @user_info.save

format.html { redirect_to '/' }

format.json { render :json => @user_info, :status => :created, :location => @user_info }

else

format.html { render :action => "new" }

format.json { render :json => @user_info.errors, :status => :unprocessable_entity }

end

end

end

# PUT /user_infos/1

def update

@user_info = UserInfo.find(params[:id])

respond_to do |format|

if @user_info.update_attributes(params[:user_info])

format.html { redirect_to '/' }

format.json { head :no_content }

else

format.html { render :action => "edit" }

format.js

end

end

end

# DELETE /user_infos/1

# DELETE /user_infos/1.json

def destroy

@user_info = UserInfo.find(params[:id])

@user_info.destroy

respond_to do |format|

format.html { redirect_to user_infos_url }

format.json { head :no_content }

end

end

end

Головна сторінка application.html.erb

<!DOCTYPE html>

<html>

<head>

<p>

<title>Social</title>

<meta http-equiv="content-type" content="text/html; charset=utf-8">

<%= stylesheet_link_tag "application", :media => "all" %>

<%= stylesheet_link_tag "bootstrap", :media => "all" %>

<%= javascript_include_tag "bootstrap" %>

<%= javascript_include_tag "application" %>

<%= javascript_include_tag :defaults %>

<%= csrf_meta_tags %>

</head>

<body>

<div class="row">

<div class="span1"></div>

<div class="span5">

<h1><a href="/"><%= image_tag("logo1.png")%></a></h1>

</div>

<% if current_user %>

<div id="auth_user" class="span3">

Емейл: <%= current_user.email %>

<%= link_to 'Выйти', destroy_user_session_path %>

<% else %>

<div id="auth_user">

<%= form_for(resource, :html => { :class => 'form-inline'}, :as => resource_name, :url => session_path(resource_name)) do |f| %>

<%= f.label :email %>

<%= f.email_field :email, :autofocus => true %>

<%= f.label :password %>

<%= f.password_field :password %>

<br><br>

<div class="row">

<div class="span3 offset3">

<% if devise_mapping.rememberable? -%>

<div><%= f.check_box :remember_me %> <%= f.label :запам’ятати_мене %> <%= f.submit "Ввійти" %></div>

</div>

<% end %>

</div>

</div>

<% end %>

<% end %>

</div>

</div>

<%= link_to 'Всі читачі', allusers_path, :class => "btn" %>

<%= link_to 'Всі книги', all_path, :class => "btn" %>

<div class="main">

<%= link_to 'Пошук книг', seach_path, :class => "btn btn-block" %>

<br>

<%= yield %>

</div>

</p>

</body>

</html>

80