Forráskód Böngészése

Regen частично переименован в Автогост"

Вадим Королёв 1 éve
szülő
commit
e91be17bf7

+ 1 - 7
src/config.php

@@ -15,10 +15,4 @@ if (strtoupper(substr(php_uname("s"), 0, 3)) === 'WIN') {
 }
 
 $dotenv = Dotenv\Dotenv::createImmutable(rootdir);
-$dotenv->load();
-
-// regen
-define("regen_surname", "Королёв");
-define("regen_full", "Королёв В.С.");
-define("regen_group", "3ИС");
-define("regen_code", ".012.09.02.07.000");
+$dotenv->load();

+ 305 - 307
src/controllers/RegenController.php → src/controllers/AutoGostController.php

@@ -1,307 +1,305 @@
-<?php
-// Контроллер Regen
-
-class RegenController extends Controller {
-
-	// Загрузка изображений
-	public static function uploadImage() {
-
-		if (is_uploaded_file($_FILES['file']['tmp_name'])) {
-			$mime_type = mime_content_type($_FILES['file']['tmp_name']);
-			$filepath = tempnam(rootdir."/img/regen", "rgnupload");
-
-			if ($mime_type == "image/png") {
-				// Конвертирование png в gif
-				$png_image = imagecreatefrompng($_FILES['file']['tmp_name']);
-				$gif_image = imagecreatetruecolor(imagesx($png_image), imagesy($png_image));
-				imagecopy($gif_image, $png_image, 0, 0, 0, 0, imagesx($png_image), imagesy($png_image));
-				imagegif($gif_image, $filepath);
-			} else {
-				// Просто перемещение файла
-				$filepath = tempnam(rootdir."/img/regen", "rgnupload");
-				move_uploaded_file($_FILES['file']['tmp_name'], $filepath);
-			}
-
-			$output = ["ok"=>true, "filename"=>basename($filepath)];
-		} else {
-			$output = ["ok"=>false];
-		}
-		echo json_encode($output);
-	}
-
-	// Список отчётов по дисциплине
-	public static function listReports($subject_id) {
-		
-		$reports = ReportModel::where("subject_id", $subject_id);
-		$subject = SubjectModel::getById($subject_id);
-
-		$view = new RegenReportsView([
-			"page_title" => "Regen: архив ".$subject['name'],
-			"crumbs" => ["Главная" => "/", "Regen: архив" => "/regen/archive", $subject['name'] => ""],
-			"reports" => $reports,
-			"subject" => $subject
-		]);
-		$view->view();
-	}
-
-	// Архив отчётов
-	public static function archive() {
-		$subjects = SubjectModel::all();
-
-		$view = new RegenArchiveView([
-			"page_title" => "Regen: архив",
-			"crumbs" => ["Главная" => "/", "Regen: архив" => "/"],
-			"subjects" => $subjects
-		]);
-		$view->view();
-	}
-
-	// Редактирование отчёта
-	public static function edit($report_id) {
-		$report = ReportModel::getById($report_id);
-		$subject = SubjectModel::getById($report['subject_id']);
-
-		$view = new RegenEditView([
-			"page_title" => "Regen: редактирование отчёта",
-			"crumbs" => ["Главная"=>"/", "Regen: архив" => "/regen/archive/", $subject['name'] => "/regen/archive/".$subject['id'], "Редактирование"=>"/"],
-			"markup" => $report['markup'],
-			"filename" => $subject['name']." #".$report['work_number']." - Королёв",
-			"report_id" => $report_id
-		]);
-		$view->view();
-	}
-
-	// Валидация создания отчёта
-	private static function validateCreation() {
-		if (empty($_POST["number"])) {
-			// Запрос на создание
-			return 'Не указан номер работы';
-		}
-		return true;
-	}
-
-	// Создание отчёта
-	public static function newReport() {
-		$subjects = SubjectModel::all();
-		$worktypes = WorkTypeModel::all();
-
-		if (!empty($_POST)) {
-			$response = self::validateCreation();
-			if ($response === true) {
-				// Валидация успешна
-
-				// Создаём запись
-				$work_type = WorkTypeModel::getById($_POST['work_type']);
-				
-				$report_id = ReportModel::create(
-					$_POST["subject_id"],
-					$_POST['work_type'],
-					$_POST['number'],
-					$_POST['notice'],
-					"!-\n!\n#{$work_type['name_nom']} №{$_POST['number']}\n"
-				);
-
-				// Перенаправляем на предпросмотр этого отчёта
-				header("Location: /regen/edit/".$report_id);
-				return;
-			} else {
-				// Валидация провалена
-				$error_text = $response;
-			}
-		} else {
-			$error_text = null;
-		}
-		
-		$view = new RegenNewReportView([
-			"page_title" => "Regen: создание отчёта",
-			'subjects' => $subjects,
-			'worktypes' => $worktypes,
-			'error_text' => $error_text,
-			"crumbs" => ["Главная"=>"/", "Regen: создание отчёта" => "/"]
-		]);
-		$view->view();
-	}
-
-	// Получение HTML
-	public static function getHtml() {
-		$report = ReportModel::getById($_POST['report_id']);
-		$subject = SubjectModel::getById($report["subject_id"]);
-		$work_type = WorkTypeModel::getById($report["work_type"]);
-		$teacher = TeacherModel::getById($subject["teacher_id"]);
-		
-		$markup = $_POST['markup'];
-		$lines = explode("\n", $markup);
-
-		// Определение количества страниц
-		$pages_count = 0;
-		foreach ($lines as $l) {
-			if (self::isPageMarker($l)) {
-				$has_pages = true;
-				if (self::isCountablePage($l)) {
-					$pages_count++;
-				}
-			}
-		}
-
-		// Основные переменные
-		$current_line_index = -1;
-		$end_line_index = count($lines);
-		$output = "";
-
-		// Нумераторы
-		$current_page_number = 1;			// Страницы
-		$current_image_number = 1;			// Изображения
-		$current_table_number = 1;			// Таблицы
-		$current_application_number = 1;	// Приложения
-		$current_table_row = 0;				// Строка текущей таблицы
-
-		// Флаги
-		$is_generating_table = false; // Генерируем ли сейчас таблицу
-
-		// Генерируем (X)HTML!
-		while ($current_line_index < $end_line_index - 1) {
-			// Ищем маркер страницы. Пропускам всё, что не маркер
-			$current_line_index++;
-			if (!self::isPageMarker($lines[$current_line_index])) {
-				continue;
-			}
-			$current_page_marker = $lines[$current_line_index];
-			$current_line_index++;
-
-			// Генерация контента страницы
-			$page_content = "";
-			if ($is_generating_table == true) {
-				// Если мы генерируем таблицу, а сейчас начинается новая страница, то на предыдущей странице мы уже начинали
-				// генерировать и произошёл разрыв таблицы.
-				$page_content .= "<p class='tt'>Продолжение таблицы {$current_table_number}</p>
-				<table class='t{$current_table_number}'>";
-			}
-			while ($current_line_index < $end_line_index) {
-
-				if (self::isPageMarker($lines[$current_line_index])) {
-					// Эта строка - маркер страницы!
-					// Заканчиваем генерировать эту страницу и переходим к другой
-					$current_line_index--;
-					break;
-				}
-
-				$str = $lines[$current_line_index];
-				
-				// Все короткие тире в строке заменяются длинными
-				$str = str_replace("-", "&mdash;", $str);
-
-				// Интерпретация строки
-				if ($str == "") {
-					// Пустая строка
-					$line_content = "";
-
-				} else if ($str[0] == "#") {
-					// Выровененный по центру текст
-					$line_content = "<p class='title'>".trim(substr($str, 1))."</p>";
-
-				} else if ($str[0] == "?") {
-					// Изображение
-					list($image_path, $image_title) = explode(":", substr($str, 1));
-					$picture_title = "Рисунок {$current_image_number} - {$image_title}";
-					$line_content = "<img src='/img/regen/$image_path' title='$picture_title'><p class='title'>$picture_title</p>";
-
-					$current_image_number++;
-
-				} else if (substr($str, 0, 6) === "@table") {
-					// Начало таблицы
-
-					$table_class = "t" . strval($current_table_number);
-					$parts = explode(":", substr($str, 1));
-					$style = "<style>";
-					for ($i = 1; $i < count($parts); $i++) {
-						list($width, $align) = explode("_", $parts[$i]);
-						$style .= ".{$table_class} td:nth-child({$i}),.{$table_class} th:nth-child({$i}){width:{$width}px;text-align:{$align}}";
-					}
-					$line_content .= "</style><p class='tt'>Таблица $current_table_number - {$parts[0]}</p><table class='$table_class'>";
-
-					$is_generating_table = true;
-
-				} else if ($str[0] === "|") {
-					// Продолжение таблицы
-					// Если это начало таблицы, то используем тэг th, иначе td
-					if ($current_table_row == 0) {
-						$tag_name = "th";
-					} else {
-						$tag_name = "td";
-					}
-
-					$line_content = "<tr>";
-					$parts = explode("|", $str);
-					for ($i = 1; $i < count($parts) - 1; $i++) {
-						$part = trim($parts[$i]);
-						$line_content .= "<{$tag_name}>$part</{$tag_name}>";
-					}
-					$line_content .= "</tr>";
-
-					$current_table_row += 1;
-
-					// Смотрим в будущее и ищем разрыв таблицы или конец всего отчёта
-					if ($current_line_index < $end_line_index - 1) {
-						if (self::isPageMarker($lines[$current_line_index + 1])) {
-							// Таблица разделена на 2 страницы
-							$line_content .= "</table>";
-						}
-					} else {
-						// Это конец отчёта! Нарушение разметки, но так уж и быть, поправим по-тихому
-						$line_content .= "</table>";
-					}
-
-				} else if ($str === "@endtable") {
-					// Конец таблицы
-					$line_content = "</table><br/>";
-					$is_generating_table = false;
-					$current_table_number++;
-					$current_table_row = 0;
-
-				} else {
-					// Обычный текст
-					$line_content = "<p>".$str."</p>";
-				}
-
-				$page_content .= $line_content;
-				$current_line_index++;
-			}
-
-			// Всё то, что нагенерировали засовываем в страницу
-			$page_wrapped = new RegenPageView([
-				'work_code' => $subject['code'].regen_code,
-				'teacher_full' => $teacher["surname"]." ".mb_substr($teacher['name'],0,1).'. '.mb_substr($teacher['patronymic'],0,1).'.',
-				'author_surname' => regen_surname,
-				'author_full' => regen_full,
-				'subject' => $subject,
-				'work_type' => $work_type,
-				'pages_count' => $pages_count,
-				'author_group' => regen_group,
-				'work_number' => $report['work_number'],
-				'teacher_surname' => $teacher['surname'],
-				'current_page_number' => $current_page_number,
-				'current_page_marker' => $current_page_marker,
-				'page_content' => $page_content
-			]);
-
-			$output .= $page_wrapped->render();
-
-			if (self::isCountablePage($current_page_marker) != "!-") {
-				$current_page_number++;
-			}
-		}
-
-		// $output возвращаем
-		echo $output;
-	}
-
-	// Возвращает true если строка - это маркер страниц
-	private static function isPageMarker($line) {
-		return preg_match("/^(?:!|!!|!0|!-|!--)$/", $line);
-	}
-
-	// Возвращает true если строка - маркер страницы, которую можно включать в объём всех страниц
-	private static function isCountablePage($line) {	
-		return preg_match("/^(?:!|!!|!0|!-)$/", $line);
-	}
-}
+<?php
+// Контроллер автогоста
+
+class AutoGostController extends Controller {
+
+	// Загрузка изображений
+	public static function uploadImage() {
+
+		if (is_uploaded_file($_FILES['file']['tmp_name'])) {
+			$mime_type = mime_content_type($_FILES['file']['tmp_name']);
+			$filepath = tempnam(rootdir."/img/autogost", "rgnupload");
+
+			if ($mime_type == "image/png") {
+				// Конвертирование png в gif
+				$png_image = imagecreatefrompng($_FILES['file']['tmp_name']);
+				$gif_image = imagecreatetruecolor(imagesx($png_image), imagesy($png_image));
+				imagecopy($gif_image, $png_image, 0, 0, 0, 0, imagesx($png_image), imagesy($png_image));
+				imagegif($gif_image, $filepath);
+			} else {
+				// Просто перемещение файла
+				$filepath = tempnam(rootdir."/img/autogost", "rgnupload");
+				move_uploaded_file($_FILES['file']['tmp_name'], $filepath);
+			}
+
+			$output = ["ok"=>true, "filename"=>basename($filepath)];
+		} else {
+			$output = ["ok"=>false];
+		}
+		echo json_encode($output);
+	}
+
+	// Список отчётов по дисциплине
+	public static function listReports($subject_id) {
+		
+		$reports = ReportModel::where("subject_id", $subject_id);
+		$subject = SubjectModel::getById($subject_id);
+
+		$view = new AutoGostReportsView([
+			"page_title" => "Автогост: архив ".$subject['name'],
+			"crumbs" => ["Главная" => "/", "Автогост: дисциплины" => "/autogost/archive", $subject['name'] => ""],
+			"reports" => $reports,
+			"subject" => $subject
+		]);
+		$view->view();
+	}
+
+	// Архив отчётов
+	public static function archive() {
+		$subjects = SubjectModel::all();
+
+		$view = new AutoGostArchiveView([
+			"page_title" => "Автогост: архив",
+			"crumbs" => ["Главная" => "/", "Автогост: дисциплины" => "/"],
+			"subjects" => $subjects
+		]);
+		$view->view();
+	}
+
+	// Редактирование отчёта
+	public static function edit($report_id) {
+		$report = ReportModel::getById($report_id);
+		$subject = SubjectModel::getById($report['subject_id']);
+		$filename = "Автогост - ".$subject['name']." #".$report['work_number']." - Королёв";
+
+		$view = new AutoGostEditView([
+			"page_title" => $filename,
+			"crumbs" => ["Главная"=>"/", "Автогост: дисциплины" => "/autogost/archive/", $subject['name'] => "/autogost/archive/".$subject['id'], "Редактирование"=>"/"],
+			"markup" => $report['markup'],
+			"filename" => $filename,
+			"report_id" => $report_id
+		]);
+		$view->view();
+	}
+
+	// Валидация создания отчёта
+	private static function validateCreation() {
+		if (empty($_POST["number"])) {
+			// Запрос на создание
+			return 'Не указан номер работы';
+		}
+		return true;
+	}
+
+	// Создание отчёта
+	public static function newReport() {
+		$subjects = SubjectModel::all();
+		$worktypes = WorkTypeModel::all();
+
+		if (!empty($_POST)) {
+			$response = self::validateCreation();
+			if ($response === true) {
+				// Валидация успешна
+
+				// Создаём запись
+				$work_type = WorkTypeModel::getById($_POST['work_type']);
+				
+				$report_id = ReportModel::create(
+					$_POST["subject_id"],
+					$_POST['work_type'],
+					$_POST['number'],
+					$_POST['notice'],
+					"!-\n!\n#{$work_type['name_nom']} №{$_POST['number']}\n"
+				);
+
+				// Перенаправляем на предпросмотр этого отчёта
+				header("Location: /autogost/edit/".$report_id);
+				return;
+			} else {
+				// Валидация провалена
+				$error_text = $response;
+			}
+		} else {
+			$error_text = null;
+		}
+		
+		$view = new AutoGostNewReportView([
+			"page_title" => "Автогост: создание отчёта",
+			'subjects' => $subjects,
+			'worktypes' => $worktypes,
+			'error_text' => $error_text,
+			"crumbs" => ["Главная"=>"/", "Автогост: создание отчёта" => "/"]
+		]);
+		$view->view();
+	}
+
+	// Получение HTML
+	public static function getHtml() {
+		$report = ReportModel::getById($_POST['report_id']);
+		$subject = SubjectModel::getById($report["subject_id"]);
+		$work_type = WorkTypeModel::getById($report["work_type"]);
+		$teacher = TeacherModel::getById($subject["teacher_id"]);
+		
+		$markup = $_POST['markup'];
+		$lines = explode("\n", $markup);
+
+		// Определение количества страниц
+		$pages_count = 0;
+		foreach ($lines as $l) {
+			if (self::isPageMarker($l)) {
+				$has_pages = true;
+				if (self::isCountablePage($l)) {
+					$pages_count++;
+				}
+			}
+		}
+
+		// Основные переменные
+		$current_line_index = -1;
+		$end_line_index = count($lines);
+		$output = "";
+
+		// Нумераторы
+		$current_page_number = 1;			// Страницы
+		$current_image_number = 1;			// Изображения
+		$current_table_number = 1;			// Таблицы
+		$current_application_number = 1;	// Приложения
+		$current_table_row = 0;				// Строка текущей таблицы
+
+		// Флаги
+		$is_generating_table = false; // Генерируем ли сейчас таблицу
+
+		// Генерируем (X)HTML!
+		while ($current_line_index < $end_line_index - 1) {
+			// Ищем маркер страницы. Пропускам всё, что не маркер
+			$current_line_index++;
+			if (!self::isPageMarker($lines[$current_line_index])) {
+				continue;
+			}
+			$current_page_marker = $lines[$current_line_index];
+			$current_line_index++;
+
+			// Генерация контента страницы
+			$page_content = "";
+			if ($is_generating_table == true) {
+				// Если мы генерируем таблицу, а сейчас начинается новая страница, то на предыдущей странице мы уже начинали
+				// генерировать и произошёл разрыв таблицы.
+				$page_content .= "<p class='tt'>Продолжение таблицы {$current_table_number}</p>
+				<table class='t{$current_table_number}'>";
+			}
+			while ($current_line_index < $end_line_index) {
+
+				if (self::isPageMarker($lines[$current_line_index])) {
+					// Эта строка - маркер страницы!
+					// Заканчиваем генерировать эту страницу и переходим к другой
+					$current_line_index--;
+					break;
+				}
+
+				$str = $lines[$current_line_index];
+
+				// Интерпретация строки
+				if ($str == "") {
+					// Пустая строка
+					$line_content = "";
+
+				} else if ($str[0] == "#") {
+					// Выровененный по центру текст
+					$line_content = "<p class='title'>".trim(substr($str, 1))."</p>";
+
+				} else if ($str[0] == "?") {
+					// Изображение
+					list($image_path, $image_title) = explode(":", substr($str, 1));
+					$picture_title = "Рисунок {$current_image_number} - {$image_title}";
+					$line_content = "<img src='/img/autogost/$image_path' title='$picture_title'><p class='title'>$picture_title</p>";
+
+					$current_image_number++;
+
+				} else if (substr($str, 0, 6) === "@table") {
+					// Начало таблицы
+
+					$table_class = "t" . strval($current_table_number);
+					$parts = explode(":", substr($str, 1));
+					$style = "<style>";
+					for ($i = 1; $i < count($parts); $i++) {
+						list($width, $align) = explode("_", $parts[$i]);
+						$style .= ".{$table_class} td:nth-child({$i}),.{$table_class} th:nth-child({$i}){width:{$width}px;text-align:{$align}}";
+					}
+					$line_content .= "</style><p class='tt'>Таблица $current_table_number - {$parts[0]}</p><table class='$table_class'>";
+
+					$is_generating_table = true;
+
+				} else if ($str[0] === "|") {
+					// Продолжение таблицы
+					// Если это начало таблицы, то используем тэг th, иначе td
+					if ($current_table_row == 0) {
+						$tag_name = "th";
+					} else {
+						$tag_name = "td";
+					}
+
+					$line_content = "<tr>";
+					$parts = explode("|", $str);
+					for ($i = 1; $i < count($parts) - 1; $i++) {
+						$part = trim($parts[$i]);
+						$line_content .= "<{$tag_name}>$part</{$tag_name}>";
+					}
+					$line_content .= "</tr>";
+
+					$current_table_row += 1;
+
+					// Смотрим в будущее и ищем разрыв таблицы или конец всего отчёта
+					if ($current_line_index < $end_line_index - 1) {
+						if (self::isPageMarker($lines[$current_line_index + 1])) {
+							// Таблица разделена на 2 страницы
+							$line_content .= "</table>";
+						}
+					} else {
+						// Это конец отчёта! Нарушение разметки, но так уж и быть, поправим по-тихому
+						$line_content .= "</table>";
+					}
+
+				} else if ($str === "@endtable") {
+					// Конец таблицы
+					$line_content = "</table><br/>";
+					$is_generating_table = false;
+					$current_table_number++;
+					$current_table_row = 0;
+
+				} else {
+					// Обычный текст
+					$line_content = "<p>".$str."</p>";
+				}
+
+				$page_content .= $line_content;
+				$current_line_index++;
+			}
+
+			// Всё то, что нагенерировали засовываем в страницу
+			$page_wrapped = new AutoGostPageView([
+				'work_code' => $subject['code'].$_ENV['autogost_code'],
+				'teacher_full' => $teacher["surname"]." ".mb_substr($teacher['name'],0,1).'. '.mb_substr($teacher['patronymic'],0,1).'.',
+				'author_surname' => $_ENV['autogost_surname'],
+				'author_full' => $_ENV['autogost_full'],
+				'subject' => $subject,
+				'work_type' => $work_type,
+				'pages_count' => $pages_count,
+				'author_group' => $_ENV['autogost_group'],
+				'work_number' => $report['work_number'],
+				'teacher_surname' => $teacher['surname'],
+				'current_page_number' => $current_page_number,
+				'current_page_marker' => $current_page_marker,
+				'page_content' => $page_content
+			]);
+
+			$output .= $page_wrapped->render();
+
+			if (self::isCountablePage($current_page_marker) != "!-") {
+				$current_page_number++;
+			}
+		}
+
+		// $output возвращаем
+		echo $output;
+	}
+
+	// Возвращает true если строка - это маркер страниц
+	private static function isPageMarker($line) {
+		return preg_match("/^(?:!|!!|!0|!-|!--)$/", $line);
+	}
+
+	// Возвращает true если строка - маркер страницы, которую можно включать в объём всех страниц
+	private static function isCountablePage($line) {	
+		return preg_match("/^(?:!|!!|!0|!-)$/", $line);
+	}
+}

+ 193 - 193
src/css/regen-report.css → src/css/autogost-report.css

@@ -1,194 +1,194 @@
-#controls > textarea {
-	width: -moz-available;
-	resize: vertical;
-	background-color: var(--gray-4);
-	outline: none;
-	border: 1px solid var(--card-border);
-	color: var(--gray-8);
-	border-radius: 5px;
-	font-size: 1rem;
-}
-
-#control-buttons {
-	margin-bottom: 1em;
-}
-
-#preview {
-	font-family: timesnewroman;
-	background-color: #383838;
-	color: #aaa;
-	font-size: 12pt;
-	margin: 0;
-}
-
-#preview span {
-	position: absolute;
-	font-size: 12px;
-	user-select: none;
-}
-
-/* Контейнер страницы */
-#preview .page-container {
-	padding: 16px;
-}
-
-/* Разделитель */
-#preview hr {
-	width: 50%;
-}
-
-/* Все страницы */
-#preview .page {
-	background-position:2cm 1cm;
-	background-size: 18.5cm 28.2cm;
-	box-sizing: border-box;
-	width: 21cm;
-	height: 29.7cm;
-	padding: 2cm 1.5cm 0cm 3cm;
-	background-repeat:no-repeat;
-	position: relative;
-	margin: auto;
-	overflow: hidden;
-	color:#333333;
-	background-color:#ddd;
-}
-
-/* Страницы с большой рамкой */
-#preview .page.big {
-	background-image: url(/img/regen/bigframe.gif);
-}
-
-/* Страницы с маленькой рамкой */
-#preview .page.small {
-	background-image: url(/img/regen/smallframe.gif);
-}
-
-/* Страницы без рамки */
-#preview .page.tpage,
-#preview .page.apage {
-	padding: 2cm
-}
-
-/* Заголовок (по центру) */
-#preview .page .title {
-	text-align:center;
-	text-align-last:center;
-	text-indent:0cm;
-}
-
-/* Текст по правому краю */
-#preview .page .r {
-	text-align:right;
-	text-align-last:right;
-	text-indent:0cm;
-}
-
-/* Обычный текст */
-#preview .page p {
-	line-height: 1.5;
-	padding: 0;
-	margin: 0;
-	text-align:justify;
-	text-align-last:left;
-	text-indent:1.25cm;
-}
-
-/* Заголовок таблицы */
-#preview .page .tt {
-	text-indent:0;
-}
-
-/* Изображение */
-#preview img {
-	max-width: 12cm;
-	margin:0.5cm auto 0.25cm auto;
-	display:block;
-	border:1px solid #000;
-}
-
-/* Таблицы */
-table, tr, td, th {border: 1px solid; border-collapse: collapse;}
-table {width:100%;}
-td {padding: 0 0.3cm;vertical-align:top;}
-th {text-align:center !important;font-weight:normal}
-
-/* Текст в рамках */
-#preview .iz::after {content: "Изм.";}
-#preview .ls::after,
-#preview .pl::after {content: "Лист";}
-#preview .nd::after {content: "№ докум.";}
-#preview .pd::after {content: "Подпись";}
-#preview .dt::after {content: "Дата";}
-#preview .rz::after {content: "Разраб.";}
-#preview .lt::after {content: "Лит.";}
-#preview .al::after {content: "Листов";}
-#preview .pr::after {content: "Провер.";}
-#preview .nc::after {content: "Н. Контр.";}
-#preview .ut::after {content: "Утверд.";}
-
-#preview .page.big .co {left:9.2cm; bottom: 3.5cm; right:0.6cm;font-size:22px;text-align:center;}
-#preview .page.big .iz {left:2.1cm;bottom:3.1cm;}
-#preview .page.big .ls {left:3.15cm;bottom:3.1cm;}
-#preview .page.big .nd {left:4.7cm;bottom:3.1cm;}
-#preview .page.big .pd {left:6.6cm;bottom:3.1cm;}
-#preview .page.big .dt {left:8.24cm;bottom:3.1cm;}
-#preview .page.big .rz {left:2.15cm;bottom:2.6cm;}
-#preview .page.big .sr {left:4.13cm; bottom:2.6cm;}
-#preview .page.big .lt {left:15.6cm;bottom:2.6cm;}
-#preview .page.big .pl {left:17.1cm;bottom:2.6cm;}
-#preview .page.big .al {left:18.8cm;bottom:2.6cm;}
-#preview .page.big .pr {left:2.15cm;bottom:2.1cm;}
-#preview .page.big .st {left:4.13cm; bottom:2.1cm;}
-#preview .page.big .cp {left:16.71cm;right:2.9cm;bottom:2.1cm;text-align:center;}
-#preview .page.big .pc {left:18.1cm;right:0.6cm;bottom:2.1cm;text-align:center;}
-#preview .page.big .nm {left:9.1cm;bottom:1.6cm;right:5.85cm;font-size:16px;text-align:center;}
-#preview .page.big .gr {left:15.25cm;right:0.6cm;bottom:1cm;text-align:center;font-size:20px;}
-#preview .page.big .nc {left:2.15cm;bottom:1.1cm;}
-#preview .page.big .ut {left:2.15cm;bottom:0.6cm;}
-
-#preview .page.small .iz {left:2.15cm;bottom:0.6cm;}
-#preview .page.small .ls {left:3.15cm;bottom:0.6cm;}
-#preview .page.small .nd {left:4.61cm;bottom:0.6cm;}
-#preview .page.small .pd {left:6.6cm;bottom:0.6cm;}
-#preview .page.small .dt {left:8.25cm;bottom:0.6cm;}
-#preview .page.small .co {left:9.1cm;bottom:1.0cm;right:1.5cm;font-size:22px;text-align:center;}
-#preview .page.small .pl {left:19.55cm;bottom:1.55cm;}
-#preview .page.small .cp {left:19.5cm;bottom:0.90cm;right:0.5cm;text-align:center;}
-
-.opt {display:block;text-align:center !important;font-size:18px;color:white;font-family:sans;margin: 8px 0px;user-select:none;}
-.opt:hover {color:#005BFF;}
-
-@media print {
-	nav,
-	#markuparea,
-	button,
-	#preview hr,
-	#control-buttons,
-	.no-print {
-		display: none;
-	}
-	
-	#controls {
-		visibility: hidden;
-		width: auto;
-		margin: 0;
-		padding: 0;
-		max-width: unset;
-		border: none;
-		border-radius: 0px;
-	}
-
-	#preview {
-		display: block !important;
-		visibility: visible;
-	}
-
-	#preview .page-container {
-		padding: 0;
-	}
-
-	#preview .page {
-		background-color: white;
-		color: black;
-	}
+#controls > textarea {
+	width: -moz-available;
+	resize: vertical;
+	background-color: var(--gray-4);
+	outline: none;
+	border: 1px solid var(--card-border);
+	color: var(--gray-8);
+	border-radius: 5px;
+	font-size: 1rem;
+}
+
+#control-buttons {
+	margin-bottom: 1em;
+}
+
+#preview {
+	font-family: timesnewroman;
+	background-color: #383838;
+	color: #aaa;
+	font-size: 12pt;
+	margin: 0;
+}
+
+#preview span {
+	position: absolute;
+	font-size: 12px;
+	user-select: none;
+}
+
+/* Контейнер страницы */
+#preview .page-container {
+	padding: 16px;
+}
+
+/* Разделитель */
+#preview hr {
+	width: 50%;
+}
+
+/* Все страницы */
+#preview .page {
+	background-position:2cm 1cm;
+	background-size: 18.5cm 28.2cm;
+	box-sizing: border-box;
+	width: 21cm;
+	height: 29.7cm;
+	padding: 2cm 1.5cm 0cm 3cm;
+	background-repeat:no-repeat;
+	position: relative;
+	margin: auto;
+	overflow: hidden;
+	color:#333333;
+	background-color:#ddd;
+}
+
+/* Страницы с большой рамкой */
+#preview .page.big {
+	background-image: url(/img/autogost/bigframe.gif);
+}
+
+/* Страницы с маленькой рамкой */
+#preview .page.small {
+	background-image: url(/img/autogost/smallframe.gif);
+}
+
+/* Страницы без рамки */
+#preview .page.tpage,
+#preview .page.apage {
+	padding: 2cm
+}
+
+/* Заголовок (по центру) */
+#preview .page .title {
+	text-align:center;
+	text-align-last:center;
+	text-indent:0cm;
+}
+
+/* Текст по правому краю */
+#preview .page .r {
+	text-align:right;
+	text-align-last:right;
+	text-indent:0cm;
+}
+
+/* Обычный текст */
+#preview .page p {
+	line-height: 1.5;
+	padding: 0;
+	margin: 0;
+	text-align:justify;
+	text-align-last:left;
+	text-indent:1.25cm;
+}
+
+/* Заголовок таблицы */
+#preview .page .tt {
+	text-indent:0;
+}
+
+/* Изображение */
+#preview img {
+	max-width: 12cm;
+	margin:0.5cm auto 0.25cm auto;
+	display:block;
+	border:1px solid #000;
+}
+
+/* Таблицы */
+table, tr, td, th {border: 1px solid; border-collapse: collapse;}
+table {width:100%;}
+td {padding: 0 0.3cm;vertical-align:top;}
+th {text-align:center !important;font-weight:normal}
+
+/* Текст в рамках */
+#preview .iz::after {content: "Изм.";}
+#preview .ls::after,
+#preview .pl::after {content: "Лист";}
+#preview .nd::after {content: "№ докум.";}
+#preview .pd::after {content: "Подпись";}
+#preview .dt::after {content: "Дата";}
+#preview .rz::after {content: "Разраб.";}
+#preview .lt::after {content: "Лит.";}
+#preview .al::after {content: "Листов";}
+#preview .pr::after {content: "Провер.";}
+#preview .nc::after {content: "Н. Контр.";}
+#preview .ut::after {content: "Утверд.";}
+
+#preview .page.big .co {left:9.2cm; bottom: 3.5cm; right:0.6cm;font-size:22px;text-align:center;}
+#preview .page.big .iz {left:2.1cm;bottom:3.1cm;}
+#preview .page.big .ls {left:3.15cm;bottom:3.1cm;}
+#preview .page.big .nd {left:4.7cm;bottom:3.1cm;}
+#preview .page.big .pd {left:6.6cm;bottom:3.1cm;}
+#preview .page.big .dt {left:8.24cm;bottom:3.1cm;}
+#preview .page.big .rz {left:2.15cm;bottom:2.6cm;}
+#preview .page.big .sr {left:4.13cm; bottom:2.6cm;}
+#preview .page.big .lt {left:15.6cm;bottom:2.6cm;}
+#preview .page.big .pl {left:17.1cm;bottom:2.6cm;}
+#preview .page.big .al {left:18.8cm;bottom:2.6cm;}
+#preview .page.big .pr {left:2.15cm;bottom:2.1cm;}
+#preview .page.big .st {left:4.13cm; bottom:2.1cm;}
+#preview .page.big .cp {left:16.71cm;right:2.9cm;bottom:2.1cm;text-align:center;}
+#preview .page.big .pc {left:18.1cm;right:0.6cm;bottom:2.1cm;text-align:center;}
+#preview .page.big .nm {left:9.1cm;bottom:1.6cm;right:5.85cm;font-size:16px;text-align:center;}
+#preview .page.big .gr {left:15.25cm;right:0.6cm;bottom:1cm;text-align:center;font-size:20px;}
+#preview .page.big .nc {left:2.15cm;bottom:1.1cm;}
+#preview .page.big .ut {left:2.15cm;bottom:0.6cm;}
+
+#preview .page.small .iz {left:2.15cm;bottom:0.6cm;}
+#preview .page.small .ls {left:3.15cm;bottom:0.6cm;}
+#preview .page.small .nd {left:4.61cm;bottom:0.6cm;}
+#preview .page.small .pd {left:6.6cm;bottom:0.6cm;}
+#preview .page.small .dt {left:8.25cm;bottom:0.6cm;}
+#preview .page.small .co {left:9.1cm;bottom:1.0cm;right:1.5cm;font-size:22px;text-align:center;}
+#preview .page.small .pl {left:19.55cm;bottom:1.55cm;}
+#preview .page.small .cp {left:19.5cm;bottom:0.90cm;right:0.5cm;text-align:center;}
+
+.opt {display:block;text-align:center !important;font-size:18px;color:white;font-family:sans;margin: 8px 0px;user-select:none;}
+.opt:hover {color:#005BFF;}
+
+@media print {
+	nav,
+	#markuparea,
+	button,
+	#preview hr,
+	#control-buttons,
+	.no-print {
+		display: none;
+	}
+	
+	#controls {
+		visibility: hidden;
+		width: auto;
+		margin: 0;
+		padding: 0;
+		max-width: unset;
+		border: none;
+		border-radius: 0px;
+	}
+
+	#preview {
+		display: block !important;
+		visibility: visible;
+	}
+
+	#preview .page-container {
+		padding: 0;
+	}
+
+	#preview .page {
+		background-color: white;
+		color: black;
+	}
 }

+ 0 - 0
src/img/regen/bigframe.gif → src/img/autogost/bigframe.gif


BIN
src/img/autogost/rgn24B4.tmp


BIN
src/img/autogost/rgn2CC7.tmp


BIN
src/img/autogost/rgn79AA.tmp


BIN
src/img/autogost/rgn8081.tmp


BIN
src/img/autogost/rgnC3BA.tmp


BIN
src/img/autogost/rgnCAC9.tmp


BIN
src/img/autogost/rgnE0A1.tmp


BIN
src/img/autogost/rgnE42.tmp


BIN
src/img/autogost/rgnE742.tmp


+ 0 - 0
src/img/regen/smallframe.gif → src/img/autogost/smallframe.gif


+ 7 - 7
src/index.php

@@ -17,13 +17,13 @@ $router->register('', 'HomeController::index');
 $router->register('/grades', 'GradesController::index');
 $router->register('/grades/get', 'GradesController::collect');
 
-// Regen
-$router->register('/regen/new', 'RegenController::newReport');
-$router->register('/regen/upload-image', 'RegenController::uploadImage');
-$router->register('/regen/edit/{report_id}', 'RegenController::edit');
-$router->register("/regen/gethtml", 'RegenController::getHtml');
-$router->register("/regen/archive", 'RegenController::archive');
-$router->register("/regen/archive/{subject_id}", 'RegenController::listReports');
+// Автогост
+$router->register('/autogost/new', 'AutoGostController::newReport');
+$router->register('/autogost/upload-image', 'AutoGostController::uploadImage');
+$router->register('/autogost/edit/{report_id}', 'AutoGostController::edit');
+$router->register("/autogost/gethtml", 'AutoGostController::getHtml');
+$router->register("/autogost/archive", 'AutoGostController::archive');
+$router->register("/autogost/archive/{subject_id}", 'AutoGostController::listReports');
 
 // API
 $router->register('/subjects/create', 'ApiController::createSubject');

+ 113 - 113
src/js/regenpreview.js → src/js/autogostpreview.js

@@ -1,114 +1,114 @@
-// Текущее состояние страницы
-// 0 - режим редактирования
-// 1 - режим просмотра превью
-var current_state = 0;
-var markup_area = $('#markuparea');
-var preview_area = $('#preview');
-var saveButton = $('#saveMarkupButton');
-
-$(document).ready(function() {
-	textAreaAdjust(document.getElementById("markuparea"));
-
-	$("#saveForm").submit(function(e) {
-		e.preventDefault();
-		saveMarkup();
-	});
-
-	// Сохранение на Ctrl+S
-	document.addEventListener("keydown", function(e) {
-	  if (e.keyCode === 83 && (navigator.platform.match("Mac") ? e.metaKey : e.ctrlKey)) {
-		e.preventDefault();
-		saveMarkup();
-	  }
-	}, false);
-
-	// Вставка картинок на Ctrl+V
-	// https://stackoverflow.com/a/6338207
-	$("#markuparea").on('paste', function (e) {
-		let items = (e.clipboardData || e.originalEvent.clipboardData).items;
-		for (let index in items) {
-			let item = items[index];
-			if (item.kind === 'file') {
-
-				// Загрузка файла через jQuery AJAX
-				// https://stackoverflow.com/a/13333478
-				var fd = new FormData();
-				fd.append('file', item.getAsFile());
-
-				$.ajax({
-					url: "/regen/upload-image",
-					type: "post",
-					data: fd,
-					processData: false,
-					contentType: false,
-					success: function (response) {
-						response = JSON.parse(response);
-
-						if (response.ok) {
-							const line = "?"+response.filename+":"+"Подпись изображения";
-							markup_area.val(markup_area.val() + line);
-						}
-					}
-				});
-			}
-		}
-	});
-	
-	$("#switchPreview").click(function() {
-		markup_area.hide();
-		preview_area.show();
-		updatePreview();
-		saveMarkup();
-	});
-
-	$("#switchMarkup").click(function() {
-		markup_area.show();
-		preview_area.hide();
-		saveMarkup();
-	});
-
-	$("#printReport").click(function() {
-		saveMarkup();
-		updatePreview(true);
-	})
-});
-
-// При печати текста заставляет textbox расширяться
-function textAreaAdjust(element) {
-	element.style.height = "1px";
-	element.style.height = (25+element.scrollHeight)+"px";
-}
-
-function updatePreview(then_print=false) {
-	const str = document.location.toString();
-	const slash_idx = str.lastIndexOf('/');
-	const report_id = str.substring(slash_idx + 1);
-	$.post(
-		"/regen/gethtml",
-		{
-			markup: markup_area.val(),
-			report_id: report_id
-		},
-		function (data, textStatus, xhr) {
-			$("#preview").html(data);
-			if (then_print) {
-				window.print();
-			}
-		}
-	);
-}
-
-// Сохраняет разметку для данного отчёта
-function saveMarkup() {
-	$.ajax({
-		url: "/reports/update",
-		type: "post",
-		data: {
-			id: $("#idInput").val(),
-			markup: $("#markuparea").val()
-		},
-		success: function() {
-			saveButton.blur();
-		}
-	});
+// Текущее состояние страницы
+// 0 - режим редактирования
+// 1 - режим просмотра превью
+var current_state = 0;
+var markup_area = $('#markuparea');
+var preview_area = $('#preview');
+var saveButton = $('#saveMarkupButton');
+
+$(document).ready(function() {
+	textAreaAdjust(document.getElementById("markuparea"));
+
+	$("#saveForm").submit(function(e) {
+		e.preventDefault();
+		saveMarkup();
+	});
+
+	// Сохранение на Ctrl+S
+	document.addEventListener("keydown", function(e) {
+	  if (e.keyCode === 83 && (navigator.platform.match("Mac") ? e.metaKey : e.ctrlKey)) {
+		e.preventDefault();
+		saveMarkup();
+	  }
+	}, false);
+
+	// Вставка картинок на Ctrl+V
+	// https://stackoverflow.com/a/6338207
+	$("#markuparea").on('paste', function (e) {
+		let items = (e.clipboardData || e.originalEvent.clipboardData).items;
+		for (let index in items) {
+			let item = items[index];
+			if (item.kind === 'file') {
+
+				// Загрузка файла через jQuery AJAX
+				// https://stackoverflow.com/a/13333478
+				var fd = new FormData();
+				fd.append('file', item.getAsFile());
+
+				$.ajax({
+					url: "/autogost/upload-image",
+					type: "post",
+					data: fd,
+					processData: false,
+					contentType: false,
+					success: function (response) {
+						response = JSON.parse(response);
+
+						if (response.ok) {
+							const line = "?"+response.filename+":"+"Подпись изображения";
+							markup_area.val(markup_area.val() + line);
+						}
+					}
+				});
+			}
+		}
+	});
+	
+	$("#switchPreview").click(function() {
+		markup_area.hide();
+		preview_area.show();
+		updatePreview();
+		saveMarkup();
+	});
+
+	$("#switchMarkup").click(function() {
+		markup_area.show();
+		preview_area.hide();
+		saveMarkup();
+	});
+
+	$("#printReport").click(function() {
+		saveMarkup();
+		updatePreview(true);
+	})
+});
+
+// При печати текста заставляет textbox расширяться
+function textAreaAdjust(element) {
+	element.style.height = "1px";
+	element.style.height = (25+element.scrollHeight)+"px";
+}
+
+function updatePreview(then_print=false) {
+	const str = document.location.toString();
+	const slash_idx = str.lastIndexOf('/');
+	const report_id = str.substring(slash_idx + 1);
+	$.post(
+		"/autogost/gethtml",
+		{
+			markup: markup_area.val(),
+			report_id: report_id
+		},
+		function (data, textStatus, xhr) {
+			$("#preview").html(data);
+			if (then_print) {
+				window.print();
+			}
+		}
+	);
+}
+
+// Сохраняет разметку для данного отчёта
+function saveMarkup() {
+	$.ajax({
+		url: "/reports/update",
+		type: "post",
+		data: {
+			id: $("#idInput").val(),
+			markup: $("#markuparea").val()
+		},
+		success: function() {
+			saveButton.blur();
+		}
+	});
 }

+ 55 - 55
src/views/RegenArchiveView.php → src/views/AutoGostArchiveView.php

@@ -1,55 +1,55 @@
-<?php
-// Архив Regen
-
-class RegenArchiveView extends LayoutView {
-	protected $subjects;
-	
-	public function content():void { ?>
-
-<div class='text-center'>
-	<h1>Архив отчётов</h1>
-	<h3>Выбери дисциплину</h3>
-</div>
-
-<div class='card'>
-	<div id='subjectsList'>
-		<?php while ($subject = $this->subjects->fetchArray()) { ?>
-			<div id='subject<?= $subject['id'] ?>' class='crud-item'>
-				<p><?= $subject['name'] ?></p>
-				<div class='crud-buttons'>
-					<button onclick='document.location.href = "/regen/archive/<?=$subject['id']?>"'>Отчёты</button>
-					<button onclick='crudUpdateShowWindow("subjects", {"Название": {type: "plain", name: "name", default: "<?=$subject['name']?>"}, "Шифр": {type: "plain", name: "code", default: "<?=$subject['code']?>"}, "Преподаватель": {type: "crudRead", name: "teacher_id", route: "teachers", default:<?=$subject['teacher_id']?>}, "ID": {type: "hidden", name: "id", default: <?=$subject['id']?>}}, "Обновление дисциплины", updateSubject)'>Изменить</button>
-					<button onclick='crudDelete("subjects", <?= $subject['id'] ?>, "subject<?= $subject['id'] ?>")' class='danger'>Удалить</button>
-				</div>
-			</div>
-		<?php } ?>
-	</div>
-
-	<button onclick='crudCreateShowWindow("subjects", {"Название": {type: "plain", name: "name"}, "Шифр": {type: "plain", name: "code"}, "Преподаватель": {type: "crudRead", name: "teacher_id", route: "teachers"}}, "Добавление дисциплины", createSubject)' class='createbutton form-control'>Добавить</button>
-</div>
-
-<script>
-	function updateSubject(subject) {
-		$("#subject"+subject.id).replaceWith(getSubject(subject));
-	}
-
-	function createSubject(subject) {
-		const new_item = getSubject(subject);
-        $("#subjectsList").append($(new_item));
-	}
-
-	function getSubject(subject) {
-		return `
-            <div id='subject`+subject.id+`' class='crud-item'>
-                <p>`+subject.name+`</p>
-                <div class='crud-buttons'>
-                    <button onclick='document.location.href = "/regen/archive/`+subject.id+`"'>Отчёты</button>
-                    <button onclick='crudUpdateShowWindow("subjects", {"Название": {type: "plain", name: "name", default: "`+subject.name+`"}, "Шифр": {type: "plain", name: "code", default: "`+subject.code+`"}, "Преподаватель": {type: "crudRead", name: "teacher_id", route: "teachers", default:`+subject.teacher_id+`}, "ID": {type: "hidden", name: "id", default: `+subject.id+`}}, "Обновление дисциплины", updateSubject)'>Изменить</button>
-                    <button onclick='crudDelete("subjects", `+subject.id+`, "subject`+subject.id+`")' class='danger'>Удалить</button>
-                </div>
-            </div>`;
-	}
-</script>
-
-<?php }
-}
+<?php
+// Архив AutoGost
+
+class AutoGostArchiveView extends LayoutView {
+	protected $subjects;
+	
+	public function content():void { ?>
+
+<div class='text-center'>
+	<h1>Архив отчётов</h1>
+	<h3>Выбери дисциплину</h3>
+</div>
+
+<div class='card'>
+	<div id='subjectsList'>
+		<?php while ($subject = $this->subjects->fetchArray()) { ?>
+			<div id='subject<?= $subject['id'] ?>' class='crud-item'>
+				<p><?= $subject['name'] ?></p>
+				<div class='crud-buttons'>
+					<button onclick='document.location.href = "/autogost/archive/<?=$subject['id']?>"'>Отчёты</button>
+					<button onclick='crudUpdateShowWindow("subjects", {"Название": {type: "plain", name: "name", default: "<?=$subject['name']?>"}, "Шифр": {type: "plain", name: "code", default: "<?=$subject['code']?>"}, "Преподаватель": {type: "crudRead", name: "teacher_id", route: "teachers", default:<?=$subject['teacher_id']?>}, "ID": {type: "hidden", name: "id", default: <?=$subject['id']?>}}, "Обновление дисциплины", updateSubject)'>Изменить</button>
+					<button onclick='crudDelete("subjects", <?= $subject['id'] ?>, "subject<?= $subject['id'] ?>")' class='danger'>Удалить</button>
+				</div>
+			</div>
+		<?php } ?>
+	</div>
+
+	<button onclick='crudCreateShowWindow("subjects", {"Название": {type: "plain", name: "name"}, "Шифр": {type: "plain", name: "code"}, "Преподаватель": {type: "crudRead", name: "teacher_id", route: "teachers"}}, "Добавление дисциплины", createSubject)' class='createbutton form-control'>Добавить</button>
+</div>
+
+<script>
+	function updateSubject(subject) {
+		$("#subject"+subject.id).replaceWith(getSubject(subject));
+	}
+
+	function createSubject(subject) {
+		const new_item = getSubject(subject);
+        $("#subjectsList").append($(new_item));
+	}
+
+	function getSubject(subject) {
+		return `
+            <div id='subject`+subject.id+`' class='crud-item'>
+                <p>`+subject.name+`</p>
+                <div class='crud-buttons'>
+                    <button onclick='document.location.href = "/autogost/archive/`+subject.id+`"'>Отчёты</button>
+                    <button onclick='crudUpdateShowWindow("subjects", {"Название": {type: "plain", name: "name", default: "`+subject.name+`"}, "Шифр": {type: "plain", name: "code", default: "`+subject.code+`"}, "Преподаватель": {type: "crudRead", name: "teacher_id", route: "teachers", default:`+subject.teacher_id+`}, "ID": {type: "hidden", name: "id", default: `+subject.id+`}}, "Обновление дисциплины", updateSubject)'>Изменить</button>
+                    <button onclick='crudDelete("subjects", `+subject.id+`, "subject`+subject.id+`")' class='danger'>Удалить</button>
+                </div>
+            </div>`;
+	}
+</script>
+
+<?php }
+}

+ 36 - 36
src/views/RegenEditView.php → src/views/AutoGostEditView.php

@@ -1,36 +1,36 @@
-<?php
-// Страница редактирования отчёта
-
-class RegenEditView extends LayoutView {
-	protected $markup;
-	protected $filename;
-	protected $report_id;
-
-	public function customHead():void { ?>
-<link rel="stylesheet" href="/css/regen-report.css">
-<?php }
-
-	public function content():void { ?>
-
-<div class='card' id="controls">
-	<div id='control-buttons'>
-		<button id='switchMarkup'>Разметка</button>
-		<button id='switchPreview'>Превью</button>
-		<button id="printReport">Печать</button>
-	</div>
-
-	<textarea id="markuparea" autocomplete="off"><?= $this->markup ?></textarea>
-	<div style='display: none;' id="preview"></div>
-</div>
-
-<div class='card no-print'>
-	<form id='saveForm'>
-		<input id='idInput' type='hidden' name='id' value='<?=$this->report_id?>'>
-		<button id='saveMarkupButton' class='form-control createbutton'>Сохранить</button>
-	</form>
-	<p>Название файла: <span class='filename'><?= $this->filename ?></span></p>
-</div>
- 
-<script src="/js/regenpreview.js"></script>
-<?php }
-}
+<?php
+// Страница редактирования отчёта
+
+class AutoGostEditView extends LayoutView {
+	protected $markup;
+	protected $filename;
+	protected $report_id;
+
+	public function customHead():void { ?>
+<link rel="stylesheet" href="/css/autogost-report.css">
+<?php }
+
+	public function content():void { ?>
+
+<div class='card' id="controls">
+	<div id='control-buttons'>
+		<button id='switchMarkup'>Разметка</button>
+		<button id='switchPreview'>Превью</button>
+		<button id="printReport">Печать</button>
+	</div>
+
+	<textarea id="markuparea" autocomplete="off"><?= $this->markup ?></textarea>
+	<div style='display: none;' id="preview"></div>
+</div>
+
+<div class='card no-print'>
+	<form id='saveForm'>
+		<input id='idInput' type='hidden' name='id' value='<?=$this->report_id?>'>
+		<button id='saveMarkupButton' class='form-control createbutton'>Сохранить</button>
+	</form>
+	<p>Название файла: <span class='filename'><?= $this->filename ?></span></p>
+</div>
+ 
+<script src="/js/autogostpreview.js"></script>
+<?php }
+}

+ 52 - 52
src/views/RegenNewReportView.php → src/views/AutoGostNewReportView.php

@@ -1,52 +1,52 @@
-<?php
-// Страница создания отчёта
-
-class RegenNewReportView extends LayoutView {
-	protected $subjects;
-	protected $worktypes;
-	protected $error_text;
-
-	protected function content():void { ?>
-
-<h1 class='text-center'>Создание отчёта</h1>
-
-<form action="/regen/new" method="POST">
-	<div class="card">
-		<?php if (isset($this->error_text)) {?>
-			<div class='card error'>
-				<?= $this->error_text ?>
-			</div>
-		<?php } ?>
-
-		<div class="form-control-container">
-			<label for="sel-subject_id">Предмет</label>
-			<select class="form-control" id="sel-subject_id" name="subject_id">
-				<?php while ($row = $this->subjects->fetchArray()) { ?>
-					<option value="<?= $row['id'] ?>"><?= $row['name'] ?></option>
-				<?php } ?>
-			</select>
-		</div>
-
-		<div class="form-control-container">
-			<label for="sel-work_type">Тип работы</label>
-			<select class="form-control" id="sel-work_type" name="work_type">
-				<?php while ($row = $this->worktypes->fetchArray()) { ?>
-					<option value="<?= $row['id'] ?>"><?= $row['name_nom'] ?></option>
-				<?php } ?>
-			</select>
-		</div>
-
-		<div class="form-control-container">
-			<label for="inp-number">Номер работы</label>
-			<input class="form-control" id="inp-number" placeholder="Номер работы" type="text" name="number"/>
-		</div>
-		
-		<div class="form-control-container">
-			<label for="inp-notice">Комментарий</label>
-			<input class="form-control" id="inp-notice" placeholder="Всё что угодно" type="text" name="notice"/>
-		</div>
-
-		<button type="submit" class="createbutton form-control">Создать</button>
-	</div>
-</form>
-<?php }} ?>
+<?php
+// Страница создания отчёта
+
+class AutoGostNewReportView extends LayoutView {
+	protected $subjects;
+	protected $worktypes;
+	protected $error_text;
+
+	protected function content():void { ?>
+
+<h1 class='text-center'>Создание отчёта</h1>
+
+<form action="/autogost/new" method="POST">
+	<div class="card">
+		<?php if (isset($this->error_text)) {?>
+			<div class='card error'>
+				<?= $this->error_text ?>
+			</div>
+		<?php } ?>
+
+		<div class="form-control-container">
+			<label for="sel-subject_id">Предмет</label>
+			<select class="form-control" id="sel-subject_id" name="subject_id">
+				<?php while ($row = $this->subjects->fetchArray()) { ?>
+					<option value="<?= $row['id'] ?>"><?= $row['name'] ?></option>
+				<?php } ?>
+			</select>
+		</div>
+
+		<div class="form-control-container">
+			<label for="sel-work_type">Тип работы</label>
+			<select class="form-control" id="sel-work_type" name="work_type">
+				<?php while ($row = $this->worktypes->fetchArray()) { ?>
+					<option value="<?= $row['id'] ?>"><?= $row['name_nom'] ?></option>
+				<?php } ?>
+			</select>
+		</div>
+
+		<div class="form-control-container">
+			<label for="inp-number">Номер работы</label>
+			<input class="form-control" id="inp-number" placeholder="Номер работы" type="text" name="number"/>
+		</div>
+		
+		<div class="form-control-container">
+			<label for="inp-notice">Комментарий</label>
+			<input class="form-control" id="inp-notice" placeholder="Всё что угодно" type="text" name="notice"/>
+		</div>
+
+		<button type="submit" class="createbutton form-control">Создать</button>
+	</div>
+</form>
+<?php }} ?>

A különbségek nem kerülnek megjelenítésre, a fájl túl nagy
+ 0 - 90
src/views/AutoGostPageView.php


+ 50 - 49
src/views/RegenReportsView.php → src/views/AutoGostReportsView.php

@@ -1,49 +1,50 @@
-<?php
-// Архив Regen - список отчётов
-
-class RegenReportsView extends LayoutView {
-	protected $reports;
-	protected $subject;
-	
-	public function content():void { ?>
-
-<div class='text-center'>
-	<h1>Архив отчётов по дисциплине <?=$this->subject['name']?></h1>
-	<h3>Выбери отчёт</h3>
-</div>
-
-<div class='card'>
-	<div id='reportsList'>
-		<?php while ($report = $this->reports->fetchArray()) { ?>
-			<div id='report<?= $report['id'] ?>' class='crud-item'>
-				<p><?=$report['work_number']?><br><?=$report['notice']?><br>Создан: <?=$report['date_create']?></p>
-				<div class='crud-buttons'>
-					<button onclick='document.location.href = "/regen/edit/<?=$report['id']?>"'>Просмотр</button>
-					<button onclick='crudUpdateShowWindow("reports", {"Номер работы": {type: "plain", name: "work_number", default:"<?=$report['work_number']?>"}, "Примечание": {type: "plain", name: "notice", default:"<?=$report['notice']?>"}, "Тип работы": {type: "crudRead", name: "work_type", route: "work_types", default:<?=$report['work_type']?>}, "ID": {type: "hidden", name: "id", default: <?=$report['id']?>}}, "Обновление отчёта", updateReport)'>Изменить</button>
-					<button onclick='crudDelete("reports", <?= $report['id'] ?>, "report<?= $report['id'] ?>")' class='danger'>Удалить</button>
-				</div>
-			</div>
-		<?php } ?>
-	</div>
-</div>
-
-<script>
-	function updateReport(report) {
-		$("#report"+report.id).replaceWith(getReport(report));
-	}
-
-	function getReport(report) {
-		return `
-            <div id='report`+report.id+`' class='crud-item'>
-				<p>`+report.work_number+`<br>`+report.notice+`<br>Создан: `+report.date_create+`</p>
-				<div class='crud-buttons'>
-					<button onclick='document.location.href = "/regen/edit/`+report.id+`"'>Просмотр</button>
-					<button onclick='crudUpdateShowWindow("reports", {"Номер работы": {type: "plain", name: "work_number", default:"`+report.work_number+`"}, "Примечание": {type: "plain", name: "notice", default:"`+report.notice+`"}, "Тип работы": {type: "crudRead", name: "work_type", route: "work_types", default:`+report.work_type+`}, "ID": {type: "hidden", name: "id", default: `+report.id+`}}, "Обновление отчёта", updateReport)'>Изменить</button>
-					<button onclick='crudDelete("reports", `+report.id+`, "report`+report.id+`")' class='danger'>Удалить</button>
-				</div>
-			</div>`;
-	}
-</script>
-
-<?php }
-}
+<?php
+// Архив AutoGost - список отчётов
+
+class AutoGostReportsView extends LayoutView {
+	protected $reports;
+	protected $subject;
+	
+	public function content():void { ?>
+
+<div class='text-center'>
+	<h1>Архив отчётов по дисциплине:</h1>
+	<h2><?=$this->subject['name']?></h2>
+	<h3>Выбери отчёт</h3>
+</div>
+
+<div class='card'>
+	<div id='reportsList'>
+		<?php while ($report = $this->reports->fetchArray()) { ?>
+			<div id='report<?= $report['id'] ?>' class='crud-item'>
+				<p><?=$report['work_number']?><br><?=$report['notice']?><br>Создан: <?=$report['date_create']?></p>
+				<div class='crud-buttons'>
+					<button onclick='document.location.href = "/autogost/edit/<?=$report['id']?>"'>Просмотр</button>
+					<button onclick='crudUpdateShowWindow("reports", {"Номер работы": {type: "plain", name: "work_number", default:"<?=$report['work_number']?>"}, "Примечание": {type: "plain", name: "notice", default:"<?=$report['notice']?>"}, "Тип работы": {type: "crudRead", name: "work_type", route: "work_types", default:<?=$report['work_type']?>}, "ID": {type: "hidden", name: "id", default: <?=$report['id']?>}}, "Обновление отчёта", updateReport)'>Изменить</button>
+					<button onclick='crudDelete("reports", <?= $report['id'] ?>, "report<?= $report['id'] ?>")' class='danger'>Удалить</button>
+				</div>
+			</div>
+		<?php } ?>
+	</div>
+</div>
+
+<script>
+	function updateReport(report) {
+		$("#report"+report.id).replaceWith(getReport(report));
+	}
+
+	function getReport(report) {
+		return `
+            <div id='report`+report.id+`' class='crud-item'>
+				<p>`+report.work_number+`<br>`+report.notice+`<br>Создан: `+report.date_create+`</p>
+				<div class='crud-buttons'>
+					<button onclick='document.location.href = "/autogost/edit/`+report.id+`"'>Просмотр</button>
+					<button onclick='crudUpdateShowWindow("reports", {"Номер работы": {type: "plain", name: "work_number", default:"`+report.work_number+`"}, "Примечание": {type: "plain", name: "notice", default:"`+report.notice+`"}, "Тип работы": {type: "crudRead", name: "work_type", route: "work_types", default:`+report.work_type+`}, "ID": {type: "hidden", name: "id", default: `+report.id+`}}, "Обновление отчёта", updateReport)'>Изменить</button>
+					<button onclick='crudDelete("reports", `+report.id+`, "report`+report.id+`")' class='danger'>Удалить</button>
+				</div>
+			</div>`;
+	}
+</script>
+
+<?php }
+}

+ 2 - 2
src/views/HomeView.php

@@ -19,11 +19,11 @@ class HomeView extends LayoutView {
 	<div class='actions-row'>
 		<div class='action'>
 			<img src="/img/actions/file.png">
-			<a href="/regen/new">Создать отчёт<span class='stretched-link'></span></a>
+			<a href="/autogost/new">Создать отчёт<span class='stretched-link'></span></a>
 		</div>
 		<div class='action'>
 			<img src="/img/actions/archive.png">
-			<a href="/regen/archive">Архив отчётов<span class='stretched-link'></span></a>
+			<a href="/autogost/archive">Архив отчётов<span class='stretched-link'></span></a>
 		</div>
 		<div class='action'>
 			<img src="/img/actions/exam.png">

+ 1 - 0
start.sh

@@ -1 +1,2 @@
 php -S 127.0.0.1:9000 -t ./src ./src/index.php
+

Nem az összes módosított fájl került megjelenítésre, mert túl sok fájl változott