diff --git a/AjaxActions/Admin/AddUser.php b/AjaxActions/Admin/AddUser.php new file mode 100644 index 0000000..bb94780 --- /dev/null +++ b/AjaxActions/Admin/AddUser.php @@ -0,0 +1,68 @@ +isLogedin()){ + die("You must loged in!"); + } + + if(isset($_POST['pass']) && !empty($_POST['pass'])){ + $pass = $_POST['pass']; + }else{ + Message::setMessage("Nepaskirtas slaptažodis!"); + redirect(); + exit; + } + + if(isset($_POST['pass1']) && !empty($_POST['pass1'])){ + $pass1 = $_POST['pass1']; + }else{ + Message::setMessage("Nepaskirtas antras slaptažodis!"); + redirect(); + exit; + } + + if(isset($_POST['nick']) && !empty($_POST['nick'])){ + if(!User::isExist("User", "Username", $_POST['nick'])){ + $nick = $_POST['nick']; + }else{ + Message::setMessage("Vartotojas vardu ".$_POST['nick']." jau egzistuoja!"); + redirect(); + exit; + } + }else{ + Message::setMessage("Vartotojas nepaskirtas!"); + redirect(); + exit; + } + + if(isset($_POST['isAdmin'])){ + $isAdmin = (int)$_POST['isAdmin']; + }else{ + Message::setMessage("Nepaskirtas vartotojo tipas!"); + redirect(); + exit; + } + + if($pass == $pass1){ + if(User::insertToDB($nick, $pass, $isAdmin)){ + Message::setMessage("Vartotojas įtrauktas sėkmingai!"); + }else{ + Message::setMessage("Nepavyko įtraukti vartotojos! ".User::$error); + } + redirect(); + exit; + }else{ + Message::setMessage("Slaptažodžiai nesutampa!"); + redirect(); + exit; + } + +?> diff --git a/AjaxActions/Admin/DeleteUser.php b/AjaxActions/Admin/DeleteUser.php new file mode 100644 index 0000000..30b57e7 --- /dev/null +++ b/AjaxActions/Admin/DeleteUser.php @@ -0,0 +1,28 @@ +isLogedin()){ + die("false:::You must loged in!"); + } + + if(isset($_GET['id']) && !empty($_GET['id'])){ + $id = $_GET['id']; + }else{ + die("false:::Nepaskirtas id!"); + } + + if(User::delete($id)){ + die("true:::Vartotojas ištrintas sėkmingai."); + }else{ + die("false:::Vartotojo istrinti nepavyko! ".User::$error); + } + +?> diff --git a/AjaxActions/User/ParamuPadaliniai.php b/AjaxActions/User/ParamuPadaliniai.php index 67f050c..3dc4b4e 100644 --- a/AjaxActions/User/ParamuPadaliniai.php +++ b/AjaxActions/User/ParamuPadaliniai.php @@ -24,8 +24,6 @@ $prog = array(); } - - $panel = new PadalyniuPrieDiagramosMygtukai($prog); echo $panel->getHtml(); diff --git a/ContentManager/Managers/ManageAdmin.php b/ContentManager/Managers/ManageAdmin.php index 3a6bdc0..f7e7e96 100644 --- a/ContentManager/Managers/ManageAdmin.php +++ b/ContentManager/Managers/ManageAdmin.php @@ -53,6 +53,13 @@ public function vartotojai(){ $page->pagePrint(); } + public function add_var(){ + $page = new AdminPage(); + $panel = new AddUser(); + $page->addToContainer(1, $panel->getHtml()); + $page->pagePrint(); + } + public function login(){ $manager = new ManageHome("login", false); $manager->login(); diff --git a/DbObject/User.php b/DbObject/User.php index a05ad9a..f75f318 100644 --- a/DbObject/User.php +++ b/DbObject/User.php @@ -17,7 +17,7 @@ public function isAdmin(){ return $this->receiveFromDb("Admin", $this->tableName, $this->tableID); } - static public function insertToDB($username, $password){ + static public function insertToDB($username, $password, $admin){ if(!UserValidation::validateUsername($username)){ User::$error = "Incorect username."; return false; @@ -29,11 +29,11 @@ static public function insertToDB($username, $password){ $username = repairSqlInjection($username); $password = repairSqlInjection($password); - $email = repairSqlInjection($email); + $admin = (int)$admin; - $result = mysql_query("INSERT INTO `PPOS`.`User` (`idUser`, `username`, `password`) VALUES (null, '".$username."', '".$password."')"); + $result = mysql_query("INSERT INTO `PPOS`.`User` (`idUser`, `username`, `password`, `Admin`) VALUES (null, '".$username."', '".$password."', '".$admin."')"); if(!$result){ - ErrorMessages::setError(9, "insertToDB('".$username."', '".$password."', '".$email."')", "User.php", "User"); + ErrorMessages::setError(9, "insertToDB('".$username."', '".$password."', '".$admin."')", "User.php", "User"); User::$error = mysql_error(); return false; }else{ diff --git a/Design/PridetiV.html b/Design/PridetiV.html new file mode 100644 index 0000000..62ac66a --- /dev/null +++ b/Design/PridetiV.html @@ -0,0 +1,71 @@ + + + + + + +Plain & Clean by Free CSS Templates + + + +
+ + +
+
+
+
+

Prideti vartotoja

+ + + + + + + + + + + + + + + + + + + + + +
Vartotojo vardas:
Slaptazodis:
Pakartoti slaptazodi:
User
Admin
+

+
+
+
 
+
+ + + +
 
+
+ +
+ + + + diff --git a/Design/style.css b/Design/style.css index dca293c..6a35641 100755 --- a/Design/style.css +++ b/Design/style.css @@ -601,4 +601,9 @@ a:hover { width:565px; height:215px; overflow:auto; +} + +span.delUser{ + color:#CA4C44; + cursor:pointer; } \ No newline at end of file diff --git a/functions.js b/JS/functions.js similarity index 91% rename from functions.js rename to JS/functions.js index 618955f..53ac4d0 100644 --- a/functions.js +++ b/JS/functions.js @@ -207,6 +207,30 @@ function zoomOut(chartType){ })(); function ready() { + + // User delete + $("span.delUser").click(function(){ + var id = $(this).attr("userid"); + var elem = this; + + $.ajax({ + url: "AjaxActions/Admin/DeleteUser.php?id=" + id, + success: function(data){ + var mas = data.split(":::", 2); + if(mas[0] == "true"){ + $(elem).parent().parent().remove(); + }else{ + var kids = $(elem).parent().parent().children(); + var text = $(kids[0]).text(); + $(kids[0]).text(text + " " + mas[1]) + } + } + }); + +// var kids = $(this).parent().parent().children(); +// var text = $(kids[0]).text(); +// $(kids[0]).text(text + " Error!!!"); + }); // Paspaudus ant paramos priemones $('#prognozes > li').click(function () { @@ -315,6 +339,8 @@ function ready() { $("td.tdPav").live("mouseout", function(){ $(this).css("background-color", "white"); + $(this).css("color", "#8A8985"); $("#priemoneEmpty").remove(); }); + } \ No newline at end of file diff --git a/JS/vartotojai.js b/JS/vartotojai.js new file mode 100644 index 0000000..b28b04f --- /dev/null +++ b/JS/vartotojai.js @@ -0,0 +1,3 @@ + + + diff --git a/WebObjects/AdminPage.php b/WebObjects/AdminPage.php index fbe12df..9dd5fc0 100644 --- a/WebObjects/AdminPage.php +++ b/WebObjects/AdminPage.php @@ -27,7 +27,7 @@ public function pagePrint(){ PPOS - +
diff --git a/WebObjects/Page.php b/WebObjects/Page.php index 16427c0..0772dcd 100644 --- a/WebObjects/Page.php +++ b/WebObjects/Page.php @@ -27,7 +27,8 @@ public function pagePrint(){ PPOS - + +
diff --git a/WebObjects/Panels/Left/DuomenuAnalizePanel.php b/WebObjects/Panels/Left/DuomenuAnalizePanel.php index 384573d..bd9dc4b 100644 --- a/WebObjects/Panels/Left/DuomenuAnalizePanel.php +++ b/WebObjects/Panels/Left/DuomenuAnalizePanel.php @@ -7,8 +7,8 @@ protected function htmlContent(){
  • Ataskaitą pagal:

  • FFF; diff --git a/WebObjects/Panels/Left/UserManage.php b/WebObjects/Panels/Left/UserManage.php index 4b5ef07..37711b6 100644 --- a/WebObjects/Panels/Left/UserManage.php +++ b/WebObjects/Panels/Left/UserManage.php @@ -7,7 +7,7 @@ protected function htmlContent(){
  • Valdymas:

  • FFF; diff --git a/WebObjects/Panels/Right/AddUser.php b/WebObjects/Panels/Right/AddUser.php new file mode 100644 index 0000000..783d74a --- /dev/null +++ b/WebObjects/Panels/Right/AddUser.php @@ -0,0 +1,42 @@ +content = << +
    +

    Pridėti vartotoją

    +
    + + + + + + + + + + + + + + + + + + + + + +
    Vartotojo vardas:
    Slaptažodis:
    Pakartoti slaptažodį:
    Vartotojas
    Administratorius
    +

    +
    +
    +
    +FFF; + } + +} + +?> diff --git a/WebObjects/Panels/Right/Lenteles.php b/WebObjects/Panels/Right/Lenteles.php index 031e66d..2cf1a93 100644 --- a/WebObjects/Panels/Right/Lenteles.php +++ b/WebObjects/Panels/Right/Lenteles.php @@ -7,13 +7,13 @@ protected function htmlContent(){
    -

    Padaliniu uzimtumas valandomis

    +

    Padalinių užimtumas valandomis

    -

    Informaciniu sistemu uzimtumas valandomis

    +

    Informacinių sistemų užimtumas valandomis

    diff --git a/WebObjects/Panels/Right/ParamosPriemoniuPrognoziuLentele.php b/WebObjects/Panels/Right/ParamosPriemoniuPrognoziuLentele.php index aabf0cf..293bf3a 100644 --- a/WebObjects/Panels/Right/ParamosPriemoniuPrognoziuLentele.php +++ b/WebObjects/Panels/Right/ParamosPriemoniuPrognoziuLentele.php @@ -37,10 +37,10 @@ private function getPriemonesPrognozes($ParamosPriemone){ protected function htmlContent(){ $this->content = << -

    Paramos priemoniu prognoziu lentele:

    +

    Paramos priemonių prognozių lentelė:

    - + diff --git a/WebObjects/Panels/Right/Users.php b/WebObjects/Panels/Right/Users.php index 779a20b..d421143 100644 --- a/WebObjects/Panels/Right/Users.php +++ b/WebObjects/Panels/Right/Users.php @@ -3,9 +3,18 @@ class Users extends MainPanel{ private $users = ""; + private $error = ""; public function __construct(){ $this->getUsers(); + if(Message::isMessage()){ + $this->error = Message::getMessge(); + $this->error =<< +

    {$this->error}

    + +FFF; + } } private function getUsers(){ @@ -15,7 +24,7 @@ private function getUsers(){ $this->users .=<<
    - + FFF; } @@ -23,6 +32,7 @@ private function getUsers(){ protected function htmlContent(){ $this->content = <<error}

    Vartotojai

    Par. Pr.Priemonė 01 02 03{$user->getUsername()}TrintiTrinti
    diff --git a/index.php b/index.php index 0398d26..89b3676 100644 --- a/index.php +++ b/index.php @@ -21,6 +21,7 @@ include("WebObjects/Panels/Right/Lenteles.php"); include("WebObjects/Panels/Right/Import.php"); include("WebObjects/Panels/Right/Users.php"); + include("WebObjects/Panels/Right/AddUser.php"); if(ErrorMessages::isErrors()){ p(ErrorMessages::getErrors());