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
Jump to file
Failed to load files.
Loading
Diff view
Diff view
94 changes: 94 additions & 0 deletions Cripi/calendar.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,94 @@
<!DOCTYPE html>
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<link href="main.css" type="text/css" rel="stylesheet" />
<script src="events.js" type="text/javascript"></script>
<title>События</title>
</head>

<body>
<h1>Добро пожаловать в конструктор событий, <span id="username">Username</span><input type="text" name="username" id="userinput">!</h1>
<!-- Форма создания события-->
<div id="eventBuilder">
<hr/>
<h2>Создайте своё собственное событие</h2>
<ul id="errors">
<li>Написать валидацию формы</li>
</ul>
<table>
<form name="constructor">
<tr>
<td>Название события</td>
<td><input type="text" name="call" id="call" value=''></td>
</tr>
<tr>
<td>Дата начала</td>
<td><input type="date" name="dateStart" id="dateStart" value=''></td>
</tr>
<tr>
<td>Дата окончания</td>
<td><input type="date" name="dateFinish" id="dateFinish" value=''></td>
</tr>
<tr>
<td>Описание события</td>
<td><input type="text" name="description" id="description" value=''></td>
</tr>
<tr>
<td>Предшествующие связанные события</td>
<td>
<select name="parents" id="parents">
<option disabled>Выберите событие</option>
</select>
</td>
</tr>
<tr>
<td>Участники события</td>
<td><input type="text" name="people" id="people" value=''></td>
</tr>
<tr>
<td>Место проведения</td>
<td>Тут будет что-то что позволяет сохранить точку на яндекс картах</td>
</tr>
<tr>
<td>Приватность</td>
<td><input type="radio" name="private" value="Открытое" checked>Открытое<input type="radio" name="private" value="Приватное">Приватное<td>
</tr>
<tr>
<td>Возрастной рейтинг</td>
<td>
<input type="radio" name="EvRS" value="0+">0+
<input type="radio" name="EvRS" value="3+">3+
<input type="radio" name="EvRS" value="6+">6+
<input type="radio" name="EvRS" value="12+">12+
<input type="radio" name="EvRS" value="16+">16+
<input type="radio" name="EvRS" value="18+" checked>18+
</td>
</tr>
<tr>
<td>Внешняя ссылка</td>
<td><input type="text" name="Url" id="url" value=''></td>
</tr>
<tr>
<td>
<div><p id="createButton">Добавить событие</p></div>
</td>
</tr>
</form>
</table>
</div>

<!-- Конец формы -->
<!-- Таблица ввёденых событий-->
<div id="eventsContainer">
<hr/>
<h2>Созданные события</h2>
<p>Двойной щелчок по заголовку - сортировка по выбранному столбцу.</p>
<table id="tableOfEvents"></table>
</div>
<!-- Конец таблицы -->
<!-- Разное-->
<div id="others"></div>
<script src="move.js" type="text/javascript"></script>
</body>
</html>
148 changes: 148 additions & 0 deletions Cripi/events.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,148 @@
// JavaScript Document
function inherits(Constructor, SuperConstructor){
var F = function () {};
F.prototype = SuperConstructor.prototype;
Constructor.prototype = new F()
};
function isDate(date){
if (date === ''){
return true
}
else {
return false
}
}

/*var Model = function (data) {
"use strict";
var keyName;
for (keyName in data) {
if (data.hasOwnProperty(keyName)) {
this[keyName] = data[keyName];
}
}
};
/**
* Set - устанавливает аттрибуты и значения атрибутов, в соответсвии с принятым в качестве параметра объектом
*
* @param {Object} attributes
*
* @example
* item.set({title: "March 20", content: "In his eyes she eclipses..."});
*/
/*Model.prototype.set = function (attributes) {
for (var key in attributes){
if (attributes.hasOwnProperty(key)) {
this[key] = attributes[key];
}
}
};

/**
* Get возвращает запрашиваемое свойство у объекта
*
* @param {Object} attributes
*/
/*Model.prototype.get = function (attribute) {
if (this.hasOwnProperty(attribute)) {
return this[attribute];
}
return undefined;
};
/**
*
* @param {Object} attributes
*/
/*Model.prototype.validate = function (attributes) {
throw new Error('this is Abstract method');
};

*/
var Event = function(data){
var keyName;
for (keyName in data) {
if (data.hasOwnProperty(keyName)) {
this[keyName] = data[keyName];
}
}
};
Event.prototype.r = function(){
console.log('tratatatata')
}
Event.prototype.validate = function() {
//'use strict';
var errorList = [];/*
if (this.name === undefined){
this.name = 'Новое событие'
}
if (!isDate(this.start)){
errorList.push('Неверно указана дата начала события.')
}
if (!isDate(this.end)){
errorList.push('Неверно указана дата окончания события.')
}
/*if (this.start < this.end){
errorList.push('Время начала события должно быть раньше времени окончания.')
}
*/
/**
return {
"start": DateStart || new Date(),
"end": DateFinish,
"name": Call || "Новое событие",
"description": Description || "Описание события",
"parent": Parent || {},
"childs": Childs || [],
"comments": Comments || [],
"peoples": Peoples || [],
"location": Location || {},
"private": Private || False,
"rank": Rank || 0,
"EvRS": EvRS || 18,
"Link": Link || ''
}
*/
return errorList

};



var Collection = function(data){
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Вынеси каждый конструктор в отдельный файл

this.items = [];
var i
for (var i in data){
this.items.push(data[i]);
}
};
Collection.prototype.add = function(i){
this.items.push(i);
}
//Collection.prototype = new Model();

var Events = function(){};
Events.prototype = new Collection()

Events.prototype.sortByStartTime = function(){}
Events.prototype.sortByEndTime = function(){}
Events.prototype.previos = function(){}
Events.prototype.futures = function(){}
Events.prototype.filterByField = function(){}
Events.prototype.myEvents = function(){}
Events.prototype.eventsWhithMe = function(){}

/////////////////////////////////////////////////////////////////////////
e = new Event({"start": new Date(2012, 9, 3, 19, 00, 00),
"end": new Date(2012, 9, 3, 20, 00, 00),
"name": "1 лекция по JavaScript",
"description": "Обзор языка",
"parent": {},
"childs": [],
"comments": ['Красивенько', 'А мы могли бы...'],
"people": [],
"location": {},
"private": true,
"rank": 4,
"EvRS": 16,
"Link": 'http://cripi.ru/#javascript'});

23 changes: 23 additions & 0 deletions Cripi/main.css
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
@charset "utf-8";
/* CSS Document */

#username {border-bottom:dotted thin;}
#createButton{padding: 10px 20px;
background:#0CF;
color:#FFF;}
/*#tableOfEvents {}*/
#tableOfEvents tr td.nodata {border:#000 thin solid;
background:#FDD;
padding:5px;
}
#tableOfEvents tr td{border:#000 thin solid;
background:#DFFFED;
padding:5px;
min-width:100px;
max-width:250px;}
#tableOfEvents tr th{border:#000 thin solid;
background:#CFC;
padding:5px;
min-width:100px;
max-width:250px;}

Loading