Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
The table of contents is too big for display.
Diff view
Diff view
  •  
  •  
  •  
The diff you're trying to view is too large. We only load the first 3000 changed files.
9 changes: 9 additions & 0 deletions classwork14.04.08/index.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
<!DOCTYPE html>
<html>
<head>
<title></title>
</head>
<body>

</body>
</html>
12 changes: 12 additions & 0 deletions excel/index.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<title>This is Excel</title>
<link rel="shortcut icon" type="image/png" href="excel.png">
<script type="text/javascript" src="my.js"></script>
</head>
<body id="id1">
<button onclick="newTable()">Создать таблицу</button>
</body>
</html>
45 changes: 45 additions & 0 deletions excel/my.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
var cellsAndRows = new Array();
var cellStart = new String('<td bordercolor="white" id="');
var cellEnd = new String('" contenteditable="false" style="height: 20px" ondblclick="writeMe(this)"></td>');
function newTable(){
id1.innerHTML += '<h1> Таблица' + (cellsAndRows.length+1) + '</h1>'
id1.innerHTML += '<table id ="t' + cellsAndRows.length + '"border="1" bordercolor="green" width = "100%"></table>'
id1.innerHTML += '<button onclick="newRow('+ cellsAndRows.length + ')">Добавить строку</button>';
id1.innerHTML += '<button onclick="newColumn('+ cellsAndRows.length +')">Добавить колонку</button>';
cellsAndRows[cellsAndRows.length] = new Array(1,0);
}
function newRow(a){
var i,table,string;
table = document.getElementById("t" + a);
string = new String("<tr>");
for(i = 0; i < cellsAndRows[a][0]; i++){
string += cellStart + cellsAndRows[a][1] + cellEnd;
cellsAndRows[a][1]++;
}
string += "</tr>";
table.innerHTML += string;
}
function newColumn(a){
var i,tds,rows;
rows = document.getElementById("t" + a).getElementsByTagName('TR');
for(i = 0; i < rows.length;i++){
rows[i].innerHTML += cellStart + cellsAndRows[a][1] + cellEnd;
cellsAndRows[a][1]++;
}
cellsAndRows[a][0]++;
tds = document.getElementById("t" + a).getElementsByTagName('TD');
for(i = 0; i < tds.length; i++){
tds[i].setAttribute("width", 100/cellsAndRows[a][0]);
}
}
function writeMe(a){
a.setAttribute('contenteditable', 'true');
a.setAttribute('autofocus');
a.setAttribute('onblur','oRead(this)');
}
function oRead(a){
a.setAttribute('contenteditable', 'false');
a.removeAttribute('onblur');
a.removeAttribute('autofocus');
}

55 changes: 55 additions & 0 deletions extjs-django/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,55 @@
django-env/

# Byte-compiled / optimized / DLL files
__pycache__/
*.py[cod]

# C extensions
*.so

# Distribution / packaging
.Python
env/
bin/
build/
develop-eggs/
dist/
eggs/
lib/
lib64/
parts/
sdist/
var/
*.egg-info/
.installed.cfg
*.egg

# Installer logs
pip-log.txt
pip-delete-this-directory.txt

# Unit test / coverage reports
htmlcov/
.tox/
.coverage
.cache
nosetests.xml
coverage.xml

# Translations
*.mo

# Mr Developer
.mr.developer.cfg
.project
.pydevproject

# Rope
.ropeproject

# Django stuff:
*.log
*.pot

# Sphinx documentation
docs/_build/
42 changes: 42 additions & 0 deletions extjs-django/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
ExtJs 4 + Django
================

Инструкции:

[![IMAGE ALT TEXT HERE](http://img.youtube.com/vi/gYHZNbBasC4/0.jpg)](http://www.youtube.com/watch?v=gYHZNbBasC4)


Зависимости:
* python >= 2.7
* pip

Для запуска:

* Перейдите в папку проекта
```bash
cd extjs-django/marvel
```

* Установите зависимости запустив команду
```bash
pip install -U -r dependencies.txt
```

* Синхронизируйте базу данных:
```bash
python manage.py syncdb
```

* Запустите сервер:
```bash
python manage.py runserver
```

Приложение "Библиотека" будет доступна по адресу http://localhost:8000/library

API можно посмотреть по адресам:
* http://localhost:8000/library/genres/ - Жанры
* http://localhost:8000/library/authors/ - Авторы
* http://localhost:8000/library/books/ - Книги


Empty file.
3 changes: 3 additions & 0 deletions extjs-django/marvel/bane/admin.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
from django.contrib import admin

# Register your models here.
3 changes: 3 additions & 0 deletions extjs-django/marvel/bane/models.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
from django.db import models

# Create your models here.
14 changes: 14 additions & 0 deletions extjs-django/marvel/bane/static/bane/app.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
Ext.application({
name: 'MyApp',
appFolder: '/static/bane/app',

launch: function() {
Ext.create('Ext.container.Viewport', {
layout: 'fit',
items: [{
title: 'Hello Ext',
html: 'Hello! Welcome to Ext JS.'
}]
});
}
});
9 changes: 9 additions & 0 deletions extjs-django/marvel/bane/static/bane/app/Person.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
Ext.define('MyApp.Person', {
name: 'Unknown',
constructor: function(cfg) {
this.name = cfg.name;
},
introduce: function() {
console.log('My name is ' + this.name);
}
});
14 changes: 14 additions & 0 deletions extjs-django/marvel/bane/templates/bane/index.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
{% load staticfiles %}
<!doctype html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>Bane - ExtJs 4 Application</title>
<link rel="stylesheet" type="text/css" href="{% static "extjs/resources/css/ext-all.css" %}">
<script type="text/javascript" src="{% static "extjs/ext-all-debug.js" %}"></script>
<script type="text/javascript" src="{% static "bane/app.js" %}"></script>
</head>
<body>

</body>
</html>
3 changes: 3 additions & 0 deletions extjs-django/marvel/bane/tests.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
from django.test import TestCase

# Create your tests here.
7 changes: 7 additions & 0 deletions extjs-django/marvel/bane/urls.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
from django.conf.urls import patterns, url

from bane import views

urlpatterns = patterns('',
url(r'^$', views.index, name='index')
)
8 changes: 8 additions & 0 deletions extjs-django/marvel/bane/views.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
from django.http import HttpResponse
from django.template import RequestContext, loader


def index(request):
template = loader.get_template('bane/index.html')
context = RequestContext(request, {})
return HttpResponse(template.render(context))
Binary file added extjs-django/marvel/db.sqlite3
Binary file not shown.
3 changes: 3 additions & 0 deletions extjs-django/marvel/dependencies.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
Django==1.6.2
djangorestframework==2.3.13
wsgiref==0.1.2
Empty file.
3 changes: 3 additions & 0 deletions extjs-django/marvel/library/admin.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
from django.contrib import admin

# Register your models here.
20 changes: 20 additions & 0 deletions extjs-django/marvel/library/models.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
from django.db import models

# Create your models here.


class Genre(models.Model):
title = models.CharField(max_length=30)


class Author(models.Model):
first_name = models.CharField(max_length=30)
middle_name = models.CharField(max_length=30)
last_name = models.CharField(max_length=30)


class Book(models.Model):
genre = models.ForeignKey(Genre)
authors = models.ManyToManyField(Author)
title = models.CharField(max_length=250)
description = models.TextField()
38 changes: 38 additions & 0 deletions extjs-django/marvel/library/serializers.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
from django.contrib.auth.models import User, Group
from rest_framework import serializers
from models import Genre, Author, Book


class UserSerializer(serializers.HyperlinkedModelSerializer):

class Meta:
model = User
fields = ('url', 'username', 'email', 'groups')


class GroupSerializer(serializers.HyperlinkedModelSerializer):

class Meta:
model = Group
fields = ('url', 'name')


class GenreSerializer(serializers.HyperlinkedModelSerializer):

class Meta:
model = Genre
fields = ('title', 'id')


class AuthorSerializer(serializers.HyperlinkedModelSerializer):

class Meta:
model = Author
fields = ('first_name', 'middle_name', 'last_name', 'id')


class BookSerializer(serializers.HyperlinkedModelSerializer):

class Meta:
model = Book
fields = ('title', 'authors', 'genre', 'description', 'id')
16 changes: 16 additions & 0 deletions extjs-django/marvel/library/static/library/app.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
Ext.application({
name: 'Lib',
appFolder: '/static/library/app',
controllers: ['Main', 'Genre', 'Author'],
views: ['Main'],
models: ['Genre','Author'],

launch: function() {
Ext.create('Ext.container.Viewport', {
layout: 'fit',
items: {
xtype: 'mainview'
}
});
}
});
Original file line number Diff line number Diff line change
@@ -0,0 +1,48 @@
Ext.define('Lib.controller.Author', {
extend: 'Ext.app.Controller',
models: ['Author'],
stores: ['Author'],
views: ['author.EditWindow', 'Main'],
refs: [{
selector: 'mainview #authors',
ref: 'authorsGrid'
}],

init: function() {
var me = this;

me.control({
'#authors button[action=add]': {
click: me.onAddAuthorBtnClick
},
'authoreditwin button[action=save]': {
click: me.onSaveAuthorBtnClick
}
});

me.callParent(arguments);
},

onAddAuthorBtnClick: function(btn) {
Ext.create('Lib.view.author.EditWindow').show();
},

onSaveAuthorBtnClick: function(btn) {
var me = this,
form = btn.up('form'),
record;
if (form.isValid()) {
record = Ext.create('Lib.model.Author', form.getValues());
record.save({
callback: function(records, operation, success) {
if (success) {
me.getAuthorsGrid().getStore().load();
btn.up('window').close();
} else {
Ext.MessageBox.alert('Ошибка!', 'Произошла ошибка при сохранении.');
}
}
});
}
}
});
Loading