summaryrefslogtreecommitdiffstats
path: root/todo
diff options
context:
space:
mode:
authorMalf Furious <m@lfurio.us>2018-10-27 18:12:02 -0400
committerMalf Furious <m@lfurio.us>2018-10-27 18:12:02 -0400
commit6512655aee73d3d295daa4de0e4ef25c08cfec9e (patch)
treec3285276f6c53b6789e2f6dc82cb3b0fd17b38a4 /todo
parent41a5877e5986910344c5e51275bfa02cd341cd9d (diff)
downloadscrott-6512655aee73d3d295daa4de0e4ef25c08cfec9e.tar.gz
scrott-6512655aee73d3d295daa4de0e4ef25c08cfec9e.zip
Rename examples/ directory
In preparation for the release, I'm renaming this directory since 'examples' is confusion and misleading. Really this directory just holds some old code that needs re-integrated, so I name it 'todo'. Signed-off-by: Malf Furious <m@lfurio.us>
Diffstat (limited to 'todo')
-rw-r--r--todo/common.mod.php384
-rw-r--r--todo/deleteacct.mod.php63
-rw-r--r--todo/example.html230
-rw-r--r--todo/group.setting.modal.view.php96
-rw-r--r--todo/group.view.php43
-rw-r--r--todo/ownership.setting.modal.view.php35
-rw-r--r--todo/permissions.setting.modal.view.php82
-rw-r--r--todo/setting.modal.view.php218
8 files changed, 1151 insertions, 0 deletions
diff --git a/todo/common.mod.php b/todo/common.mod.php
new file mode 100644
index 0000000..0d740ef
--- /dev/null
+++ b/todo/common.mod.php
@@ -0,0 +1,384 @@
+<?php
+
+ /*
+ * Default action
+ */
+ function common_deflt()
+ {
+ global $_SCROTT;
+
+ /* Admin settings tab */
+ if ($_SCROTT['settSSL'] != "neither")
+ {
+ $this->common_settingAdminSettSSLChecked[$_SCROTT['settSSL']] = "checked";
+ $this->common_settingAdminSettSSLDisabled = "disabled";
+ }
+ else
+ $this->common_settingAdminSettSSLChecked[Setting::settSSL()] = "checked";
+
+ if (Setting::allowPublicSignup())
+ $this->common_settingAdminAllowPublicSignupChecked = "checked";
+
+ /* Admin all-users settings tab */
+ $userTbl = new User();
+ $this->common_settingAllUsers = $userTbl->getAllUsers_orderByAdminByName();
+
+ /* Setting modal - what tabs to display? */
+ if (isset($this->obj))
+ {
+ if ($this->obj->type == "group")
+ {
+ $this->group = new Group($this->obj->guid);
+ $this->common_settingShowTab['group'] = true;
+ }
+ }
+ }
+
+ /*
+ * Save changes to user group settings
+ */
+ function saveSettingGroup($input, $attachment)
+ {
+ $form = new Form();
+ $form->field_text("guid");
+ $form->field_text("name");
+ $form->field_bool("perm0");
+ $form->field_bool("perm1");
+ $form->field_bool("perm2");
+ $form->field_bool("perm3");
+ $form->field_bool("perm4");
+ $form->field_bool("perm5");
+ $form->field_bool("perm6");
+ $form->field_bool("perm7");
+ $form->field_bool("perm8");
+
+ if (!$form->populate($input))
+ {
+ $this->logFormErrors($form);
+ return;
+ }
+
+ $user = $this->getCurrentUser();
+ $group = new Group($form->guid);
+
+ if (!$user || $group->type != "group" || !$group->canModify($user))
+ {
+ $this->logError("You do not have permission to modify this group");
+ return;
+ }
+
+ if (isset($input['rmImage']))
+ {
+ if ($group->rmHeadImage())
+ $this->logNotice("Image removed");
+ else
+ $this->logError("Error removing group image");
+
+ return;
+ }
+
+ $group->name = $form->name;
+
+ if ($group->canModifyPermissions($user))
+ {
+ $perms = 0;
+
+ if ($form->perm0)
+ $perms |= 0x100;
+ if ($form->perm1)
+ $perms |= 0x080;
+ if ($form->perm2)
+ $perms |= 0x040;
+ if ($form->perm3)
+ $perms |= 0x020;
+ if ($form->perm4)
+ $perms |= 0x010;
+ if ($form->perm5)
+ $perms |= 0x008;
+ if ($form->perm6)
+ $perms |= 0x004;
+ if ($form->perm7)
+ $perms |= 0x002;
+ if ($form->perm8)
+ $perms |= 0x001;
+
+ $group->perms = $perms;
+ }
+
+ $group->saveObj();
+
+ if ($form->saveFile($attachment, $this->HEAD_IMG_MAX_SIZE, $this->HEAD_IMG_MIME, "assets/img/heads/" . $group->guid))
+ $this->logNotice("Image uploaded");
+ else
+ $this->logFormErrors($form);
+ }
+
+ /*
+ * Save changes to user account settings
+ */
+ function saveSettingUser($input, $attachment)
+ {
+ $form = new Form();
+ $form->field_bool("setPasswd");
+ $form->field_text("curPasswd", null, false);
+ $form->field_text("newPasswd", null, false);
+ $form->field_text("confPasswd", null, false);
+ $form->field_text("alias", "", false);
+ $form->field_text("email", "", false);
+ $form->field_text("emailConfKey", null, false);
+
+ if (!$form->populate($input))
+ {
+ $this->logFormErrors($form);
+ return;
+ }
+
+ $user = $this->getCurrentUser();
+
+ if (!$user)
+ {
+ $this->logError("Not logged in");
+ return;
+ }
+
+ if (isset($input['rmImage']))
+ {
+ if ($user->rmHeadImage())
+ $this->logNotice("Image removed");
+ else
+ $this->logError("Error removing user image");
+
+ return;
+ }
+
+ if ($form->setPasswd)
+ {
+ if ($user->validatePassword($form->curPasswd))
+ {
+ if ($form->newPasswd == $form->confPasswd)
+ {
+ $user->setPassword($form->newPasswd);
+ $this->logNotice("Password updated successfully");
+ }
+ else
+ $this->logWarning("Password not changed -- Passwords did not match");
+ }
+
+ else
+ $this->logWarning("Password not changed -- Current password was incorrect");
+ }
+
+ $user->alias = $form->alias;
+
+ if ($form->email != $user->email)
+ $user->setEmail($form->email);
+
+ else if ($form->emailConfKey != "")
+ {
+ if (!$user->confirmEmailKey($form->emailConfKey))
+ $this->logWarning("Email not confirmed -- Key was incorrect");
+ }
+
+ $user->saveObj();
+
+ if ($form->saveFile($attachment, $this->HEAD_IMG_MAX_SIZE, $this->HEAD_IMG_MIME, "assets/img/heads/" . $user->guid))
+ $this->logNotice("Image uploaded");
+ else
+ $this->logFormErrors($form);
+ }
+
+ /*
+ * Save changes to admin settings
+ */
+ function saveSettingAdmin($input)
+ {
+ $form = new Form();
+ $form->field_enum("settSSL", array("force", "neither", "forbid"), Setting::settSSL());
+ $form->field_bool("allowPublicSignup");
+
+ if (!$form->populate($input))
+ {
+ $this->logFormErrors($form);
+ return;
+ }
+
+ $user = $this->getCurrentUser();
+
+ if (!$user || $user->admin == 0)
+ {
+ $this->logError("Admin permissions required");
+ return;
+ }
+
+ Setting::settSSL($form->settSSL);
+ Setting::allowPublicSignup($form->allowPublicSignup);
+ }
+
+ /*
+ * Allow an admin to create a new user account
+ */
+ function saveSettingAllusersAdduser($input)
+ {
+ $form = new Form();
+ $form->field_text("username");
+ $form->field_text("password", null, false);
+ $form->field_text("cPassword", null, false);
+ $form->field_bool("admin");
+ $form->field_text("alias", "", false);
+ $form->field_text("email", "", false);
+
+ if (!$form->populate($input))
+ {
+ $this->logFormErrors($form);
+ return;
+ }
+
+ $user = $this->getCurrentUser();
+
+ if (!$user || $user->admin == 0)
+ {
+ $this->logError("Admin permissions required");
+ return;
+ }
+
+ if ($form->password != $form->cPassword)
+ {
+ $this->logError("Passwords do not match");
+ return;
+ }
+
+ $user = new User();
+
+ if (!$user->createNewUser($form->username, $form->password))
+ {
+ $this->logError("Username " . $form->username . " is not available");
+ return;
+ }
+
+ if ($form->admin)
+ $user->admin = 1;
+
+ $user->alias = $form->alias;
+ $user->setEmail($form->email);
+ $user->saveObj();
+
+ $this->logNotice("Created new user " . $form->username);
+ }
+
+ /*
+ * Allow an admin to edit user accounts
+ */
+ function saveSettingAllusersEdituser($input, $attachment)
+ {
+ $form = new Form();
+ $form->field_text("guid");
+ $form->field_bool("setPasswd");
+ $form->field_text("newPasswd", null, false);
+ $form->field_text("confPasswd", null, false);
+ $form->field_bool("admin");
+ $form->field_text("alias", "", false);
+ $form->field_text("email", "", false);
+
+ if (!$form->populate($input))
+ {
+ $this->logFormErrors($form);
+ return;
+ }
+
+ $user = $this->getCurrentUser();
+
+ if (!$user || $user->admin == 0)
+ {
+ $this->logError("Admin permissions required");
+ return;
+ }
+
+ $user = new User($form->guid);
+
+ if ($user->type != "user")
+ {
+ $this->logError("Invalid user GUID");
+ return;
+ }
+
+ if (isset($input['rmImage']))
+ {
+ if ($user->rmHeadImage())
+ $this->logNotice("Image removed");
+ else
+ $this->logError("Error removing user image");
+
+ return;
+ }
+
+ if ($form->setPasswd)
+ {
+ if ($form->newPasswd == $form->confPasswd)
+ {
+ $user->setPassword($form->newPasswd);
+ $this->logNotice("Password for " . $user->name . " updated successfully");
+ }
+ else
+ $this->logWarning("Password not changed -- Passwords did not match");
+ }
+
+ $user->admin = $form->admin;
+ $user->alias = $form->alias;
+
+ if ($form->email != $user->email)
+ $user->setEmail($form->email);
+
+ $user->saveObj();
+
+ if ($form->saveFile($attachment, $this->HEAD_IMG_MAX_SIZE, $this->HEAD_IMG_MIME, "assets/img/heads/" . $user->guid))
+ $this->logNotice("Image uploaded");
+ else
+ $this->logFormErrors($form);
+ }
+
+ /*
+ * Allow admin to remove user accounts
+ */
+ function saveSettingAllusersDeluser($input)
+ {
+ $form = new Form();
+ $form->field_text("guid");
+
+ if (!$form->populate($input))
+ {
+ $this->logFormErrors($form);
+ return;
+ }
+
+ $user = $this->getCurrentUser();
+
+ if (!$user || $user->admin == 0)
+ {
+ $this->logError("Admin permissions required");
+ return;
+ }
+
+ $user = new User($form->guid);
+
+ if ($user->type != "user")
+ {
+ $this->logError("Invalid user GUID");
+ return;
+ }
+
+ if ($user->admin && $user->getNumAdmins() == 1)
+ {
+ $this->logError("Account not deleted - Cannot remove the last admin account");
+ return;
+ }
+
+ $user->delObj();
+
+ if (!$this->getCurrentUser())
+ {
+ /* did user delete their own account? */
+ $this->redirectTo($this->ar() . "/");
+ }
+ }
+
+?>
diff --git a/todo/deleteacct.mod.php b/todo/deleteacct.mod.php
new file mode 100644
index 0000000..0178c95
--- /dev/null
+++ b/todo/deleteacct.mod.php
@@ -0,0 +1,63 @@
+<?php
+
+/*
+ * SCROTT Copyright (C) 2016 Malf Furious
+ *
+ * Scrott is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published
+ * by the Free Software Foundation, either version 3 of the License,
+ * or (at your option) any later version.
+ *
+ * Scrott is distributed in the hope that it will be useful, but
+ * WITHOUT ANY WARRANTY; even the implied warranty of MERCHANTABILITY
+ * or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public
+ * License for more details.
+ */
+
+require_once "model/common.mod.php";
+require_once "class/form.class.php";
+require_once "class/user.class.php";
+
+class DeleteacctModel extends CommonModel
+{
+ /*
+ * Default action
+ */
+ function deflt()
+ {
+ }
+
+ /*
+ * Delete current user's account
+ */
+ function del($input)
+ {
+ $form = new Form();
+ $form->field_text("password", null, false);
+
+ if (!$form->populate($input))
+ {
+ $this->logFormErrors($form);
+ return;
+ }
+
+ $user = $this->getCurrentUser();
+
+ if (!$user->validatePassword($form->password))
+ {
+ $this->logError("Account not deleted - Password was incorrect");
+ return;
+ }
+
+ if ($user->admin && $user->getNumAdmins() == 1)
+ {
+ $this->logError("Account not deleted - Cannot remove the last admin account");
+ return;
+ }
+
+ $user->delObj();
+ $this->redirectTo($this->ar() . "/");
+ }
+}
+
+?>
diff --git a/todo/example.html b/todo/example.html
new file mode 100644
index 0000000..abf84a3
--- /dev/null
+++ b/todo/example.html
@@ -0,0 +1,230 @@
+<!DOCTYPE html>
+
+<html lang="en">
+ <head>
+ <meta charset="utf-8" />
+ <meta http-equiv="X-UA-Compatible" content="IE=edge" />
+ <meta name="viewport" content="width=device-width, initial-scale=1" />
+
+ <title>Scrott - Save the World</title>
+
+ <link rel="stylesheet" type="text/css" href="assets/css/bootstrap.min.css" />
+
+ <style type="text/css">
+body
+{
+ padding-top: 70px;
+}
+ </style>
+ </head>
+
+ <body>
+ <!--NAVBAR-->
+ <nav class="navbar navbar-inverse navbar-fixed-top">
+ <div class="container-fluid">
+ <!--TITLE AND EXPAND BUTTON-->
+ <div class="navbar-header">
+ <button type="button" class="navbar-toggle collapsed" data-toggle="collapse" data-target="#navbar-collapse-1" aria-expanded="false">
+ <span class="icon-bar"></span>
+ <span class="icon-bar"></span>
+ <span class="icon-bar"></span>
+ </button>
+
+ <a href="/" class="navbar-brand"><span class="glyphicon glyphicon-pencil"></span> Scrott</a>
+ </div>
+
+ <!--NAVBAR CONTENT-->
+ <div class="collapse navbar-collapse" id="navbar-collapse-1">
+ <ul class="nav navbar-nav">
+ <li class="dropdown">
+ <a href="#" class="dropdown-toggle" data-toggle="dropdown" role="button" aria-haspopup="true" aria-expanded="false">Save the World <span class="caret"></span></a>
+ <ul class="dropdown-menu">
+ <li><a href="#">Project 2</a></li>
+ <li role="separator" class="divider"></li>
+ <li><a href="#">Create New Pad</a></li>
+ </ul>
+ </li>
+
+ <li class="dropdown">
+ <a href="#" class="dropdown-toggle" data-toggle="dropdown" role="button" aria-haspopup="true" aria-expanded="false"><span class="glyphicon glyphicon-plus"></span> <span class="caret"></span></a>
+ <ul class="dropdown-menu">
+ <li><a href="#">Open Issue</a></li>
+ <li><a href="#">New Discussion Thread</a></li>
+ </ul>
+ </li>
+ </ul>
+
+ <form method="post" action="#" class="navbar-form navbar-left" role="search">
+ <div class="form-group">
+ <input type="text" name="query" class="form-control" placeholder="Search this pad" />
+ </div>
+ </form>
+
+ <ul class="nav navbar-nav navbar-right">
+ <li class="dropdown">
+ <a href="#" class=dropdown-toggle" data-toggle="dropdown" role="button" aria-haspopup="true" aria-expanded="false">
+ <span class="glyphicon glyphicon-exclamation-sign"></span>
+ <span class="glyphicon glyphicon-envelope"></span>
+ <span class="glyphicon glyphicon-user"></span> Sonic the Hedgehog <span class="caret"></span>
+ </a>
+ <ul class="dropdown-menu">
+ <li><a href="#">Issues assigned to Me <span class="badge">1</span></a></li>
+ <li><a href="#">My open Issues</a></li>
+ <li role="separator" class="divider"></li>
+ <li><a href="#">Private Messages <span class="badge">1</span></a></li>
+ <li><a href="#">Settings</a></li>
+ <li><a href="#">Log out</a></li>
+ </ul>
+ </li>
+ </ul>
+ </div>
+ </div>
+ </nav>
+
+ <!-- PAD SUMMARY -->
+ <div class="container">
+ <div class="well well-lg">
+ <div class="row">
+ <div class="col-md-4">
+ <h1>Save the World <span class="glyphicon glyphicon-globe"></span><!--Denoting this pad as globally visible--></h1>
+ <img src="assets/img/sonic.png" alt="Sonic" class="img-circle" height="50" />
+ <span class="glyphicon glyphicon-plus"></span>
+ <img src="assets/img/tails.png" alt="Miles" class="img-circle" height="50" />
+ <img src="assets/img/amy.png" alt="Amy" class="img-circle" height="50" />
+ <img src="assets/img/knuckles.png" alt="Knuckles" class="img-circle" height="50" />
+ </div>
+
+ <div class="col-md-8">
+ <legend class="text-center">Issue Progress</legend>
+ <div class="progress">
+ <div class="progress-bar progress-bar-success" style="width: 50%">Closed</div>
+ <div class="progress-bar progress-bar-warning" style="width: 25%">In Progress</div>
+ <div class="progress-bar progress-bar-danger" style="width: 25%">To Do</div>
+ </div>
+
+ <div class="row">
+ <div class="col-md-4 text-center">
+ <!-- open issues -->
+ <a href="#"><span class="label label-info"><span class="glyphicon glyphicon-inbox"></span> 5 Open Issues</span></a>
+ </div>
+
+ <div class="col-md-4 text-center">
+ <a href="#"><span class="label label-info"><span class="glyphicon glyphicon-comment"></span> 10 Unresolved Discussions</span></a>
+ </div>
+
+ <div class="col-md-4 text-center">
+ <div class="btn-group" role="group">
+ <button type="button" class="btn btn-default"><span class="glyphicon glyphicon-cog"></span></button>
+ </div>
+ </div>
+ </div>
+ </div>
+ </div>
+ </div>
+
+ <div class="panel panel-default">
+ <h2 class="text-center">In Progress</h2>
+ <table class="table table-hover">
+ <tr>
+ <td class="col-md-2">a8c2402b (#4)</td>
+ <td class="col-md-5">Example Issue</td>
+ <td class="col-md-3">
+ <img src="assets/img/sonic.png" alt="Sonic" class="img-circle" height="35" />
+ <span class="glyphicon glyphicon-share-alt"></span>
+ <img src="assets/img/tails.png" alt="Miles" class="img-circle" height="35" />
+ </td>
+ <td class="col-md-2">
+ <div class="btn-group" role="group">
+ <button type="button" class="btn btn-default"><span class="glyphicon glyphicon-pencil"></span></button>
+ <button type="button" class="btn btn-default"><span class="glyphicon glyphicon-arrow-up"></span></button>
+ <button type="button" class="btn btn-default"><span class="glyphicon glyphicon-cog"></span></button>
+ <button type="button" class="btn btn-success"><span class="glyphicon glyphicon-ok"></span></button>
+ </div>
+ </td>
+ </tr>
+
+ <tr>
+ <td class="col-md-2">a8c2402b (#5)</td>
+ <td class="col-md-5">Example Issue</td>
+ <td class="col-md-3">
+ <img src="assets/img/tails.png" alt="Miles" class="img-circle" height="35" />
+ <span class="glyphicon glyphicon-share-alt"></span>
+ <img src="assets/img/amy.png" alt="Amy" class="img-circle" height="35" />
+ <span class="glyphicon glyphicon-plus"></span>
+ <img src="assets/img/sonic.png" alt="Sonic" class="img-circle" height="35" />
+ </td>
+ <td class="col-md-2">
+ <div class="btn-group" role="group">
+ <button type="button" class="btn btn-default"><span class="glyphicon glyphicon-pencil"></span></button>
+ <button type="button" class="btn btn-default"><span class="glyphicon glyphicon-arrow-up"></span></button>
+ <button type="button" class="btn btn-default"><span class="glyphicon glyphicon-cog"></span></button>
+ <button type="button" class="btn btn-success"><span class="glyphicon glyphicon-ok"></span></button>
+ </div>
+ </td>
+ </tr>
+ </table>
+ </div>
+
+ <div class="panel panel-default">
+ <h2 class="text-center">To Do</h2>
+ <table class="table table-hover">
+ <tr>
+ <td class="col-md-2">a8c2402b (#6)</td>
+ <td class="col-md-5">Example Issue for external user</td>
+ <td class="col-md-3">
+ <img src="assets/img/knuckles.png" alt="Knuckles" class="img-circle" height="35" />
+ <span class="glyphicon glyphicon-share-alt"></span>
+ <span class="glyphicon glyphicon-user"></span>
+ </td>
+ <td class="col-md-2">
+ <div class="btn-group" role="group">
+ <button type="button" class="btn btn-default"><span class="glyphicon glyphicon-pencil"></span></button>
+ <button type="button" class="btn btn-default"><span class="glyphicon glyphicon-arrow-up"></span></button>
+ <button type="button" class="btn btn-default"><span class="glyphicon glyphicon-cog"></span></button>
+ <button type="button" class="btn btn-success"><span class="glyphicon glyphicon-ok"></span></button>
+ </div>
+ </td>
+ </tr>
+
+ <tr>
+ <td class="col-md-2">a8c2402b (#7)</td>
+ <td class="col-md-5">Example Unassigned Issue</td>
+ <td class="col-md-3">
+ <span class="glyphicon glyphicon-ban-circle"></span>
+ <span class="glyphicon glyphicon-share-alt"></span>
+ <img src="assets/img/sonic.png" alt="Sonic" class="img-circle" height="35" />
+ </td>
+ <td class="col-md-2">
+ <div class="btn-group" role="group">
+ <button type="button" class="btn btn-default"><span class="glyphicon glyphicon-pencil"></span></button>
+ <button type="button" class="btn btn-default"><span class="glyphicon glyphicon-arrow-up"></span></button>
+ <button type="button" class="btn btn-default"><span class="glyphicon glyphicon-cog"></span></button>
+ <button type="button" class="btn btn-success"><span class="glyphicon glyphicon-ok"></span></button>
+ </div>
+ </td>
+ </tr>
+
+ <tr>
+ <td class="col-md-2">a8c2402b (#8)</td>
+ <td class="col-md-5">Example Self-assigned Issue</td>
+ <td class="col-md-3">
+ <img src="assets/img/amy.png" alt="Amy" class="img-circle" height="35" />
+ </td>
+ <td class="col-md-2">
+ <div class="btn-group" role="group">
+ <button type="button" class="btn btn-default"><span class="glyphicon glyphicon-pencil"></span></button>
+ <button type="button" class="btn btn-default"><span class="glyphicon glyphicon-arrow-up"></span></button>
+ <button type="button" class="btn btn-default"><span class="glyphicon glyphicon-cog"></span></button>
+ <button type="button" class="btn btn-success"><span class="glyphicon glyphicon-ok"></span></button>
+ </div>
+ </td>
+ </tr>
+ </table>
+ </div>
+ </div>
+
+ <!-- JS -->
+ <script type="text/javascript" src="assets/js/jquery.min.js"></script>
+ <script type="text/javascript" src="assets/js/bootstrap.min.js"></script>
+ </body>
+</html>
diff --git a/todo/group.setting.modal.view.php b/todo/group.setting.modal.view.php
new file mode 100644
index 0000000..d0e11ca
--- /dev/null
+++ b/todo/group.setting.modal.view.php
@@ -0,0 +1,96 @@
+<?php
+
+/*
+ * SCROTT Copyright (C) 2016 Malf Furious
+ *
+ * Scrott is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published
+ * by the Free Software Foundation, either version 3 of the License,
+ * or (at your option) any later version.
+ *
+ * Scrott is distributed in the hope that it will be useful, but
+ * WITHOUT ANY WARRANTY; even the implied warranty of MERCHANTABILITY
+ * or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public
+ * License for more details.
+ */
+
+?>
+
+<?php require_once "view/common/permissions.setting.modal.view.php"; ?>
+
+<div class="tab-pane fade <?=$mod->getSettingModalTabDispClasses()?>" id="settGroupTab">
+ <p>&nbsp;</p>
+
+ <form method="post" action="<?=$mod->ap()?>" enctype="multipart/form-data">
+ <input type="hidden" name="input[action]" value="common-setting-group" />
+ <input type="hidden" name="input[guid]" value="<?=$mod->group->guid?>" />
+
+ <div class="row">
+ <div class="col-md-8">
+ <div class="form-group">
+ <label>Group name</label>
+ <input type="text" name="input[name]" class="form-control" value="<?=$mod->group->name?>" required="true" maxlength="50" <?=($mod->group->canModify($mod->getCurrentUser()) ? "" : "disabled")?> />
+ </div>
+ </div>
+
+ <div class="col-md-4 text-center">
+ <img src="<?=$mod->group->getHeadImage()?>" alt="<?=$mod->group->name?>" class="img-circle" height="100" />
+
+ <?php if ($mod->group->canModify($mod->getCurrentUser())) { ?>
+ <br />
+ <br />
+ <button type="button" class="btn btn-default btn-xs" data-toggle="collapse" data-target="#inputGroupImageCollapse">
+ <span class="glyphicon glyphicon-camera"></span> Upload new image
+ </button>
+ <br />
+ <button type="submit" name="input[rmImage]" class="btn btn-danger btn-xs" onclick="return assertConfirm()">
+ <span class="glyphicon glyphicon-remove"></span> Remove image
+ </button>
+ <?php } ?>
+ </div>
+ </div>
+
+ <div class="collapse" id="inputGroupImageCollapse">
+ <div class="form-group">
+ <label>Group Image</label>
+ <input type="file" name="attachment" />
+ </div>
+ </div>
+
+ <?php common_setting_permissions($mod, $mod->group); ?>
+
+ <?php if ($mod->group->canModify($mod->getCurrentUser())) { ?>
+ <p>&nbsp;</p>
+ <button type="submit" class="btn btn-success pull-right">Save</button>
+ <?php } ?>
+ </form>
+
+ <p>&nbsp;</p>
+ <p>&nbsp;</p>
+
+ <div class="btn-toolbar pull-right">
+ <?php if ($mod->group->canModifyMembers($mod->getCurrentUser())) { ?>
+ <div class="btn-group">
+ <a href="<?=$mod->group->getURL()?>/members" class="btn btn-primary btn-xs">
+ <span class="glyphicon glyphicon-user"></span> Manage Members
+ </a>
+ </div>
+ <?php } ?>
+
+ <?php if ($mod->group->isOwner($mod->getCurrentUser())) { ?>
+ <div class="btn-group">
+ <a href="<?=$mod->group->getURL()?>/transfer" class="btn btn-danger btn-xs">
+ <span class="glyphicon glyphicon-new-window"></span> Transfer Ownership
+ </a>
+ </div>
+
+ <div class="btn-group">
+ <a href="<?=$mod->group->getURL()?>/delete" class="btn btn-danger btn-xs">
+ <span class="glyphicon glyphicon-trash"></span> Delete Group
+ </a>
+ </div>
+ <?php } ?>
+ </div>
+
+ <p>&nbsp;</p>
+</div>
diff --git a/todo/group.view.php b/todo/group.view.php
new file mode 100644
index 0000000..dde4df1
--- /dev/null
+++ b/todo/group.view.php
@@ -0,0 +1,43 @@
+<!--
+ * SCROTT Copyright (C) 2016 Malf Furious
+ *
+ * Scrott is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published
+ * by the Free Software Foundation, either version 3 of the License,
+ * or (at your option) any later version.
+ *
+ * Scrott is distributed in the hope that it will be useful, but
+ * WITHOUT ANY WARRANTY; even the implied warranty of MERCHANTABILITY
+ * or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public
+ * License for more details.
+-->
+
+<!DOCTYPE html>
+
+<html lang="en">
+ <head>
+ <?php include "view/common/head.view.php"; ?>
+ <title>Scrott - <?=$mod->group->name?></title>
+ </head>
+
+ <body>
+ <?php include "view/common/topp.view.php"; ?>
+
+ <div class="container">
+ <div class="well well-lg">
+ <h1><?=$mod->group->name?></h1>
+ <img src="<?=$mod->owner->getHeadImage()?>" alt="<?=$mod->owner->getDisplayName()?>" class="img-circle" height="50" />
+
+ <?php if (count($mod->members)) { ?>
+ <span class="glyphicon glyphicon-plus"></span>
+ <?php } ?>
+
+ <?php foreach ($mod->members as $member) { ?>
+ <img src="<?=$member->getHeadImage()?>" alt="<?=$member->getDisplayName()?>" class="img-circle" height="50" />
+ <?php } ?>
+ </div>
+ </div>
+
+ <?php include "view/common/foot.view.php"; ?>
+ </body>
+</html>
diff --git a/todo/ownership.setting.modal.view.php b/todo/ownership.setting.modal.view.php
new file mode 100644
index 0000000..3f7c382
--- /dev/null
+++ b/todo/ownership.setting.modal.view.php
@@ -0,0 +1,35 @@
+<?php
+
+/*
+ * SCROTT Copyright (C) 2016 Malf Furious
+ *
+ * Scrott is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published
+ * by the Free Software Foundation, either version 3 of the License,
+ * or (at your option) any later version.
+ *
+ * Scrott is distributed in the hope that it will be useful, but
+ * WITHOUT ANY WARRANTY; even the implied warranty of MERCHANTABILITY
+ * or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public
+ * License for more details.
+ */
+
+?>
+
+<?php function common_setting_ownership($mod, $obj) { ?>
+ <?php if ($obj->isOwner($mod->getCurrentUser())) { ?>
+ <label class="text-danger">Change Owner</label>
+ <div class="checkbox">
+ <label data-toggle="collapse" data-target="#inputGroupOwnerCollapse">
+ <input type="checkbox" name="input[setOwner]" value="1" /> Transfer Ownership
+ </label>
+ </div>
+
+ <div class="collapse" id="inputGroupOwnerCollapse">
+ <div class="form-group has-error">
+ <label class="control-label">Owner Username</label>
+ <input type="text" name="input[newOwner]" class="form-control" value="<?=$obj->getOwner()->name?>" />
+ </div>
+ </div>
+ <?php } ?>
+<?php } ?>
diff --git a/todo/permissions.setting.modal.view.php b/todo/permissions.setting.modal.view.php
new file mode 100644
index 0000000..55e4157
--- /dev/null
+++ b/todo/permissions.setting.modal.view.php
@@ -0,0 +1,82 @@
+<?php
+
+/*
+ * SCROTT Copyright (C) 2016 Malf Furious
+ *
+ * Scrott is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published
+ * by the Free Software Foundation, either version 3 of the License,
+ * or (at your option) any later version.
+ *
+ * Scrott is distributed in the hope that it will be useful, but
+ * WITHOUT ANY WARRANTY; even the implied warranty of MERCHANTABILITY
+ * or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public
+ * License for more details.
+ */
+
+?>
+
+<?php function common_setting_permissions($mod, $obj) { ?>
+ <?php if ($obj->canModifyPermissions($mod->getCurrentUser())) { ?>
+ <label>Permissions</label>
+ <div class="row">
+ <div class="col-md-6">
+ <div class="checkbox">
+ <label>
+ <input type="checkbox" name="input[perm0]" value="1" <?=($obj->perms & 0x100 ? "checked" : "")?> /> Members can modify
+ </label>
+ </div>
+
+ <div class="checkbox">
+ <label>
+ <input type="checkbox" name="input[perm1]" value="1" <?=($obj->perms & 0x080 ? "checked" : "")?> /> Members can modify members
+ </label>
+ </div>
+
+ <div class="checkbox">
+ <label>
+ <input type="checkbox" name="input[perm2]" value="1" <?=($obj->perms & 0x040 ? "checked" : "")?> /> Members can access children
+ </label>
+ </div>
+
+ <div class="checkbox">
+ <label>
+ <input type="checkbox" name="input[perm3]" value="1" <?=($obj->perms & 0x020 ? "checked" : "")?> /> Members can create children
+ </label>
+ </div>
+
+ <div class="checkbox">
+ <label>
+ <input type="checkbox" name="input[perm4]" value="1" <?=($obj->perms & 0x010 ? "checked" : "")?> /> Members can modify children
+ </label>
+ </div>
+
+ <div class="checkbox">
+ <label>
+ <input type="checkbox" name="input[perm5]" value="1" <?=($obj->perms & 0x008 ? "checked" : "")?> /> Members can modify children's members
+ </label>
+ </div>
+ </div>
+
+ <div class="col-md-6">
+ <div class="checkbox">
+ <label>
+ <input type="checkbox" name="input[perm6]" value="1" <?=($obj->perms & 0x004 ? "checked" : "")?> /> Public can access
+ </label>
+ </div>
+
+ <div class="checkbox">
+ <label>
+ <input type="checkbox" name="input[perm7]" value="1" <?=($obj->perms & 0x002 ? "checked" : "")?> /> Public can access children
+ </label>
+ </div>
+
+ <div class="checkbox">
+ <label>
+ <input type="checkbox" name="input[perm8]" value="1" <?=($obj->perms & 0x001 ? "checked" : "")?> /> Public can create children
+ </label>
+ </div>
+ </div>
+ </div>
+ <?php } ?>
+<?php } ?>
diff --git a/todo/setting.modal.view.php b/todo/setting.modal.view.php
new file mode 100644
index 0000000..029b58b
--- /dev/null
+++ b/todo/setting.modal.view.php
@@ -0,0 +1,218 @@
+ <?php if ($mod->common_settingShowTab['group']) { ?>
+ <li class="<?=$mod->getSettingModalTabActiveClass()?>"><a href="#settGroupTab" aria-controls="settGroupTab" data-toggle="tab">
+ <span class="glyphicon glyphicon-th"></span> <?=$mod->group->name?>
+ </a></li>
+ <?php } ?>
+
+ <?php if ($mod->getCurrentUser()->admin == 1) { ?>
+ <li><a href="#settAdminTab" aria-controls="settAdminTab" data-toggle="tab"><span class="glyphicon glyphicon-sunglasses"></span> Admin</a></li>
+ <li><a href="#settUsersTab" aria-controls="settUsersTab" data-toggle="tab"><span class="glyphicon glyphicon-th"></span> All Users</a></li>
+ <?php } ?>
+
+
+ <?php if ($mod->common_settingShowTab['group']) { ?>
+ <?php include "view/common/group.setting.modal.view.php"; ?>
+ <?php } ?>
+
+
+
+
+
+
+
+ <?php if ($mod->getCurrentUser()->admin == 1) { ?>
+ <div class="tab-pane fade" id="settAdminTab">
+ <p>&nbsp;</p>
+
+ <form method="post" action="<?=$mod->ap()?>">
+ <input type="hidden" name="input[action]" value="common-setting-admin" />
+ <div class="form-group">
+ <label>HTTP(S)</label>
+ <div class="radio">
+ <label>
+ <input type="radio" name="input[settSSL]" value="force" <?=$mod->common_settingAdminSettSSLChecked['force']?> <?=$mod->common_settingAdminSettSSLDisabled?> />
+ Always Force SSL
+ </label>
+ </div>
+
+ <div class="radio">
+ <label>
+ <input type="radio" name="input[settSSL]" value="neither" <?=$mod->common_settingAdminSettSSLChecked['neither']?> <?=$mod->common_settingAdminSettSSLDisabled?> />
+ Neither
+ </label>
+ </div>
+
+ <div class="radio">
+ <label>
+ <input type="radio" name="input[settSSL]" value="forbid" <?=$mod->common_settingAdminSettSSLChecked['forbid']?> <?=$mod->common_settingAdminSettSSLDisabled?> />
+ Always Forbid SSL
+ </label>
+ </div>
+ </div>
+
+ <label>Access</label>
+ <div class="checkbox">
+ <label>
+ <input type="checkbox" name="input[allowPublicSignup]" value="1" <?=$mod->common_settingAdminAllowPublicSignupChecked?> /> Allow anyone to create an account
+ </label>
+ </div>
+
+ <button type="submit" class="btn btn-success pull-right">Save</button>
+ </form>
+
+ <p>&nbsp;</p>
+ </div>
+
+ <div class="tab-pane fade" id="settUsersTab">
+ <p>&nbsp;</p>
+
+ <div class="panel-group" id="common-setting-allusers">
+ <div class="panel panel-default">
+ <div class="panel-heading">
+ <h4 class="panel-title">
+ <a href="#common-setting-allusers-add-collapse" data-toggle="collapse" data-parent="#common-setting-allusers" aria-expanded="false">
+ <span class="glyphicon glyphicon-plus"></span> Add New User
+ </a>
+ </h4>
+ </div>
+
+ <div class="panel-collapse collapse" id="common-setting-allusers-add-collapse">
+ <div class="panel-body">
+ <form method="post" action="<?=$mod->ap()?>">
+ <input type="hidden" name="input[action]" value="common-setting-allusers-adduser" />
+ <div class="form-group">
+ <label>Username</label>
+ <input type="text" name="input[username]" class="form-control" required="true" maxlength="50" />
+ </div>
+
+ <div class="form-group">
+ <label>Password</label>
+ <input type="password" name="input[password]" class="form-control" />
+ </div>
+
+ <div class="form-group">
+ <label>Confirm Password</label>
+ <input type="password" name="input[cPassword]" class="form-control" />
+ </div>
+
+ <div class="checkbox">
+ <label>
+ <input type="checkbox" name="input[admin]" value="1" /> Administrator
+ </label>
+ </div>
+
+ <div class="form-group">
+ <label>Alias</label>
+ <input type="text" name="input[alias]" class="form-control" maxlength="50" />
+ </div>
+
+ <div class="form-group">
+ <label>Email</label>
+ <input type="text" name="input[email]" class="form-control" maxlength="50" />
+ </div>
+
+ <button type="submit" class="btn btn-success pull-right">Add</button>
+ </form>
+ </div>
+ </div>
+ </div>
+
+ <?php foreach ($mod->common_settingAllUsers as $user) { ?>
+ <div class="panel panel-default">
+ <div class="panel-heading">
+ <h4 class="panel-title">
+ <a href="#common-setting-allusers-<?=$user->guid?>-collapse" data-toggle="collapse" data-parent="#common-setting-allusers" aria-expanded="false">
+ <span class="<?=$user->getGlyphicon()?>"></span> <?=$user->name?> <?=($user->alias != "" ? "(" . $user->alias . ")" : "")?>
+ </a>
+ </h4>
+ </div>
+
+ <div class="panel-collapse collapse" id="common-setting-allusers-<?=$user->guid?>-collapse">
+ <div class="panel-body">
+ <form method="post" action="<?=$mod->ap()?>" enctype="multipart/form-data">
+ <input type="hidden" name="input[action]" value="common-setting-allusers-edituser" />
+ <input type="hidden" name="input[guid]" value="<?=$user->guid?>" />
+
+ <div class="row">
+ <div class="col-md-8">
+ <div class="form-group">
+ <label>Username</label>
+ <input type="text" class="form-control" value="<?=$user->name?>" disabled />
+ </div>
+
+ <div class="checkbox">
+ <label data-toggle="collapse" data-target="#input<?=$user->guid?>PasswdCollapse">
+ <input type="checkbox" name="input[setPasswd]" value="1" /> Change Password
+ </label>
+ </div>
+ </div>
+
+ <div class="col-md-4 text-center">
+ <img src="<?=$user->getHeadImage()?>" alt="<?=$user->getDisplayName()?>" class="img-circle" height="100" />
+ <br />
+ <br />
+ <button type="button" class="btn btn-default btn-xs" data-toggle="collapse" data-target="#input<?=$user->guid?>ImageCollapse">
+ <span class="glyphicon glyphicon-camera"></span> Upload new image
+ </button>
+ <br />
+ <button type="submit" name="input[rmImage]" class="btn btn-danger btn-xs" onclick="return assertConfirm()">
+ <span class="glyphicon glyphicon-remove"></span> Remove image
+ </button>
+ </div>
+ </div>
+
+ <div class="collapse" id="input<?=$user->guid?>ImageCollapse">
+ <div class="form-group">
+ <label>User Image</label>
+ <input type="file" name="attachment" />
+ </div>
+ </div>
+
+ <div class="collapse" id="input<?=$user->guid?>PasswdCollapse">
+ <div class="form-group">
+ <label>New Password</label>
+ <input type="password" name="input[newPasswd]" class="form-control" />
+ </div>
+
+ <div class="form-group">
+ <label>Confirm Password</label>
+ <input type="password" name="input[confPasswd]" class="form-control" />
+ </div>
+ </div>
+
+ <div class="checkbox">
+ <label>
+ <input type="checkbox" name="input[admin]" value="1" <?=($user->admin ? "checked" : "")?>> Administrator
+ </label>
+ </div>
+
+ <div class="form-group">
+ <label>Alias</label>
+ <input type="text" name="input[alias]" class="form-control" maxlength="50" value="<?=$user->alias?>" />
+ </div>
+
+ <div class="form-group">
+ <label>Email</label>
+ <input type="text" name="input[email]" class="form-control" maxlength="50" value="<?=$user->email?>" />
+ </div>
+
+ <button type="submit" class="btn btn-success pull-right">Save</button>
+ </form>
+
+ <p>&nbsp;</p>
+ <p>&nbsp;</p>
+
+ <form method="post" action="<?=$mod->ap()?>">
+ <input type="hidden" name="input[action]" value="common-setting-allusers-deluser" />
+ <input type="hidden" name="input[guid]" value="<?=$user->guid?>" />
+ <button type="submit" class="btn btn-danger btn-xs pull-right" onclick="return assertConfirm()">
+ <span class="glyphicon glyphicon-trash"></span> Delete Account
+ </button>
+ </form>
+ </div>
+ </div>
+ </div>
+ <?php } ?>
+ </div>
+ </div>
+ <?php } ?>