#352 basic functionallity with qqs - not web query yet
This commit is contained in:
parent
e83d1cc9c5
commit
08e8fab663
@ -1,76 +1 @@
|
||||
function init_saimod_mojotrollz_vote() {
|
||||
register_server_edit();
|
||||
register_server_visible();
|
||||
register_server_del();
|
||||
register_server_save();
|
||||
};
|
||||
|
||||
function register_server_edit(){
|
||||
$('.btn_server_edit').click(function(){
|
||||
$('#input_id').val($(this).attr('_id'));
|
||||
$('#input_name').val($(this).attr('_name'));
|
||||
$('#input_url').val($(this).attr('_url'));
|
||||
$('#input_version').val($(this).attr('_version'));
|
||||
$('#input_description').val($(this).attr('_description'));
|
||||
$("#btn_server_save").focus();
|
||||
});
|
||||
}
|
||||
|
||||
function register_server_visible(){
|
||||
$('.btn_server_visible').click(function(){
|
||||
$.ajax({ type :'GET',
|
||||
url : './sai.php?sai_mod=.SAI.saimod_mojotrollz_vote&action=visible'+
|
||||
'&id='+$(this).attr('_id')+
|
||||
'&visible='+$('#select_visible_'+$(this).attr('_i')).val(),
|
||||
success : function(data) {
|
||||
if(data.status){
|
||||
system.reload();
|
||||
}else{
|
||||
alert('Problem: '+data);}
|
||||
}
|
||||
});
|
||||
});
|
||||
}
|
||||
|
||||
function register_server_del(){
|
||||
$('.btn_server_del').click(function(){
|
||||
if (confirm("Delete Server Permanently?") === true) {
|
||||
$.ajax({ type :'GET',
|
||||
url : './sai.php?sai_mod=.SAI.saimod_mojotrollz_vote&action=del'+
|
||||
'&id='+$(this).attr('_id'),
|
||||
success : function(data) {
|
||||
if(data.status){
|
||||
system.reload();
|
||||
}else{
|
||||
alert('Problem: '+data);}
|
||||
}
|
||||
});
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
function register_server_save(){
|
||||
$('#btn_server_save').click(function() {
|
||||
var id = $('#input_id').val();
|
||||
var name = $('#input_name').val();
|
||||
var url = $('#input_url').val();
|
||||
var version = $('#input_version').val();
|
||||
var description = $('#input_description').val();
|
||||
$.ajax({url: './sai.php',
|
||||
data: { sai_mod: '.SAI.saimod_mojotrollz_vote',
|
||||
action: 'save',
|
||||
id: id,
|
||||
name: name,
|
||||
url: url,
|
||||
version: version,
|
||||
description: description},
|
||||
type: 'GET',
|
||||
success: function(data) {
|
||||
if(data.status){
|
||||
system.reload();
|
||||
}else{
|
||||
alert('Problem: '+data);}
|
||||
}
|
||||
});
|
||||
});
|
||||
}
|
||||
function init_saimod_webcraft_updates() {};
|
||||
@ -1,15 +1,43 @@
|
||||
<?php
|
||||
namespace SAI;
|
||||
class saimod_webcraft_updates extends \SYSTEM\SAI\SaiModule {
|
||||
public static function sai_mod__SAI_saimod_webcraft_updates(){
|
||||
$vars = array();
|
||||
public static function sai_mod__SAI_saimod_webcraft_updates($update = null, $project = null){
|
||||
$vars = array('updates' => '', 'projects' => '', 'commits' => '');
|
||||
|
||||
$res = \SQL\WEBCRAFT_UPDATES_UPDATE::QQ(array('test/mojotrollz/%'));
|
||||
while($row = $res->next()){
|
||||
$row['time'] = \SYSTEM\time::time_ago_string(strtotime($row['time']));
|
||||
$vars['updates'] .= \SYSTEM\PAGE\replace::replaceFile((new \PSAI('saimod_webcraft_updates/tpl/saimod_webcraft_updates_update.tpl'))->SERVERPATH(),$row);}
|
||||
|
||||
$project_row = null;
|
||||
if($update){
|
||||
$vars2 = array('project' => '', 'update' => $update);
|
||||
$res = \SQL\WEBCRAFT_UPDATES_PROJECT::QQ(array($update, 'test/mojotrollz/%'));
|
||||
while($row = $res->next()){
|
||||
if($project && $row['path'] == $project){
|
||||
$project_row = $row;}
|
||||
$row['time'] = \SYSTEM\time::time_ago_string(strtotime($row['time']));
|
||||
$vars2['project'] .= \SYSTEM\PAGE\replace::replaceFile((new \PSAI('saimod_webcraft_updates/tpl/saimod_webcraft_updates_project.tpl'))->SERVERPATH(),$row);}
|
||||
$vars['projects'] = \SYSTEM\PAGE\replace::replaceFile((new \PSAI('saimod_webcraft_updates/tpl/saimod_webcraft_updates_projects.tpl'))->SERVERPATH(),$vars2);
|
||||
}
|
||||
|
||||
if($project){
|
||||
$vars3 = array('commit' => '', 'project' => $project);
|
||||
$min = \SQL\WEBCRAFT_UPDATES_COMMIT_SELECT::Q1(array($project_row['git'],$project_row['commit_last']))['id']+1;
|
||||
$max = \SQL\WEBCRAFT_UPDATES_COMMIT_SELECT::Q1(array($project_row['git'],$project_row['commit']))['id'];
|
||||
$res = \SQL\WEBCRAFT_UPDATES_COMMIT::QQ(array($project_row['git'],$min,$max));
|
||||
while($row = $res->next()){
|
||||
$row['time'] = \SYSTEM\time::time_ago_string(strtotime($row['time']));
|
||||
$vars3['commit'] .= \SYSTEM\PAGE\replace::replaceFile((new \PSAI('saimod_webcraft_updates/tpl/saimod_webcraft_updates_commit.tpl'))->SERVERPATH(),$row);}
|
||||
$vars['commits'] = \SYSTEM\PAGE\replace::replaceFile((new \PSAI('saimod_webcraft_updates/tpl/saimod_webcraft_updates_commits.tpl'))->SERVERPATH(),$vars3);
|
||||
}
|
||||
|
||||
$vars = array_merge($vars, \SYSTEM\PAGE\text::tag('time'));
|
||||
return \SYSTEM\PAGE\replace::replaceFile((new \PSAI('saimod_webcraft_updates/tpl/saimod_webcraft_updates.tpl'))->SERVERPATH(),$vars);}
|
||||
public static function html_li_menu(){return '<li id="menu_updates"><a data-toggle="tooltip" data-placement="left" title="Vote Servers" href="#!updates"><span class="glyphicon glyphicon-check" aria-hidden="true"></span> Updates</a></li>';}
|
||||
public static function right_public(){return false;}
|
||||
public static function right_right(){return \SYSTEM\SECURITY\security::check(\SYSTEM\SECURITY\RIGHTS::SYS_SAI);}
|
||||
|
||||
/*public static function css(){
|
||||
return array((new \SYSTEM\PSAI('modules/saistart_sys_sai/css/saistart_sys_sai.css'));}*/
|
||||
public static function js(){
|
||||
return array(new \PSAI('saimod_webcraft_updates/js/saimod_webcraft_updates.js'));}
|
||||
}
|
||||
@ -1,9 +1,2 @@
|
||||
REPLACE INTO `system_api` (`ID`, `group`, `type`, `parentID`, `parentValue`, `name`, `verify`) VALUES (5011, 42, 2, 5000, 'visible', 'visible', 'INT');
|
||||
REPLACE INTO `system_api` (`ID`, `group`, `type`, `parentID`, `parentValue`, `name`, `verify`) VALUES (5010, 42, 2, 5000, 'visible', 'id', 'INT');
|
||||
REPLACE INTO `system_api` (`ID`, `group`, `type`, `parentID`, `parentValue`, `name`, `verify`) VALUES (5008, 42, 2, 5000, 'del', 'id', 'INT');
|
||||
REPLACE INTO `system_api` (`ID`, `group`, `type`, `parentID`, `parentValue`, `name`, `verify`) VALUES (5005, 42, 2, 5000, 'save', 'description', 'STRING');
|
||||
REPLACE INTO `system_api` (`ID`, `group`, `type`, `parentID`, `parentValue`, `name`, `verify`) VALUES (5004, 42, 2, 5000, 'save', 'version', 'INT');
|
||||
REPLACE INTO `system_api` (`ID`, `group`, `type`, `parentID`, `parentValue`, `name`, `verify`) VALUES (5003, 42, 2, 5000, 'save', 'url', 'STRING');
|
||||
REPLACE INTO `system_api` (`ID`, `group`, `type`, `parentID`, `parentValue`, `name`, `verify`) VALUES (5002, 42, 2, 5000, 'save', 'name', 'STRING');
|
||||
REPLACE INTO `system_api` (`ID`, `group`, `type`, `parentID`, `parentValue`, `name`, `verify`) VALUES (5001, 42, 2, 5000, 'save', 'id', 'INT');
|
||||
REPLACE INTO `system_api` (`ID`, `group`, `type`, `parentID`, `parentValue`, `name`, `verify`) VALUES (5000, 42, 0, 0, '_SAI_saimod_mojotrollz_vote', 'action', NULL);
|
||||
REPLACE INTO `system_api` (`ID`, `group`, `type`, `parentID`, `parentValue`, `name`, `verify`) VALUES (6000, 42, 3, 0, '_SAI_saimod_webcraft_updates', 'update', 'STRING');
|
||||
REPLACE INTO `system_api` (`ID`, `group`, `type`, `parentID`, `parentValue`, `name`, `verify`) VALUES (6001, 42, 3, 0, '_SAI_saimod_webcraft_updates', 'project', 'STRING');
|
||||
@ -1 +1 @@
|
||||
REPLACE INTO `system_page` (`id`, `group`, `name`, `state`, `parent_id`, `login`, `type`, `div`, `url`, `func`, `php_class`) VALUES (600, 42, 'updates', 'updates', -1, 0, 0, '#content', './sai.php?sai_mod=.SAI.saimod_webcraft_updates', 'init_saimod_webcraft_updates', '\\SAI\\saimod_webcraft_updates');
|
||||
REPLACE INTO `system_page` (`id`, `group`, `name`, `state`, `parent_id`, `login`, `type`, `div`, `url`, `func`, `php_class`) VALUES (600, 42, 'updates', 'updates', -1, 0, 0, '#content', './sai.php?sai_mod=.SAI.saimod_webcraft_updates&update=${update}&project=${project}', 'init_saimod_webcraft_updates', '\\SAI\\saimod_webcraft_updates');
|
||||
@ -1,8 +0,0 @@
|
||||
<?php
|
||||
namespace SQL;
|
||||
class MOJOTROLLZ_SERVER_LIST_ALL extends \SYSTEM\DB\QQ {
|
||||
public static function get_class(){return \get_class();}
|
||||
public static function mysql(){return
|
||||
'SELECT mojotrollz_server.* FROM mojotrollz_server';
|
||||
}
|
||||
}
|
||||
@ -1,8 +0,0 @@
|
||||
<?php
|
||||
namespace SQL;
|
||||
class SAIMOD_MOJOTROLLZ_DEL extends \SYSTEM\DB\QP {
|
||||
public static function get_class(){return \get_class();}
|
||||
public static function mysql(){return
|
||||
'DELETE FROM mojotrollz_server WHERE id = ?;';
|
||||
}
|
||||
}
|
||||
@ -1,8 +0,0 @@
|
||||
<?php
|
||||
namespace SQL;
|
||||
class SAIMOD_MOJOTROLLZ_SAVE extends \SYSTEM\DB\QP {
|
||||
public static function get_class(){return \get_class();}
|
||||
public static function mysql(){return
|
||||
'REPLACE INTO mojotrollz_server (id,name,url,version,description) VALUES(?,?,?,?,?);';
|
||||
}
|
||||
}
|
||||
@ -1,8 +0,0 @@
|
||||
<?php
|
||||
namespace SQL;
|
||||
class SAIMOD_MOJOTROLLZ_VISIBLE extends \SYSTEM\DB\QP {
|
||||
public static function get_class(){return \get_class();}
|
||||
public static function mysql(){return
|
||||
'UPDATE mojotrollz_server SET visible = ? WHERE `id` = ?;';
|
||||
}
|
||||
}
|
||||
10
sql/qq/WEBCRAFT_UPDATES_COMMIT.php
Normal file
10
sql/qq/WEBCRAFT_UPDATES_COMMIT.php
Normal file
@ -0,0 +1,10 @@
|
||||
<?php
|
||||
namespace SQL;
|
||||
class WEBCRAFT_UPDATES_COMMIT extends \SYSTEM\DB\QP {
|
||||
public static function get_class(){return \get_class();}
|
||||
public static function mysql(){return
|
||||
'SELECT `time`, `email`, `author`, `log`, `commit` FROM host_wat.webcraft_update_commit'.
|
||||
' WHERE `git` = ? AND (id BETWEEN ? AND ?)'.
|
||||
' ORDER BY `time` DESC;';
|
||||
}
|
||||
}
|
||||
9
sql/qq/WEBCRAFT_UPDATES_COMMIT_SELECT.php
Normal file
9
sql/qq/WEBCRAFT_UPDATES_COMMIT_SELECT.php
Normal file
@ -0,0 +1,9 @@
|
||||
<?php
|
||||
namespace SQL;
|
||||
class WEBCRAFT_UPDATES_COMMIT_SELECT extends \SYSTEM\DB\QP {
|
||||
public static function get_class(){return \get_class();}
|
||||
public static function mysql(){return
|
||||
'SELECT id FROM host_wat.webcraft_update_commit'.
|
||||
' WHERE `git` = ? AND `commit` = ?;';
|
||||
}
|
||||
}
|
||||
10
sql/qq/WEBCRAFT_UPDATES_PROJECT.php
Normal file
10
sql/qq/WEBCRAFT_UPDATES_PROJECT.php
Normal file
@ -0,0 +1,10 @@
|
||||
<?php
|
||||
namespace SQL;
|
||||
class WEBCRAFT_UPDATES_PROJECT extends \SYSTEM\DB\QP {
|
||||
public static function get_class(){return \get_class();}
|
||||
public static function mysql(){return
|
||||
'SELECT `time`, `path`, `git`, `commit`, `commit_last` FROM host_wat.webcraft_update_project'.
|
||||
' WHERE `update` = ? AND `path` LIKE ?'.
|
||||
' ORDER BY `time` ASC;';
|
||||
}
|
||||
}
|
||||
12
sql/qq/WEBCRAFT_UPDATES_UPDATE.php
Normal file
12
sql/qq/WEBCRAFT_UPDATES_UPDATE.php
Normal file
@ -0,0 +1,12 @@
|
||||
<?php
|
||||
namespace SQL;
|
||||
class WEBCRAFT_UPDATES_UPDATE extends \SYSTEM\DB\QP {
|
||||
public static function get_class(){return \get_class();}
|
||||
public static function mysql(){return
|
||||
'SELECT u.`time`, u.`commit`, u.`commit_last`, u.`complete` FROM host_wat.`webcraft_update` as u'.
|
||||
' RIGHT JOIN host_wat.`webcraft_update_project` as p ON u.`commit` = p.`update`'.
|
||||
' WHERE `path` LIKE ?'.
|
||||
' GROUP BY u.`commit`'.
|
||||
' ORDER BY u.`time` DESC;';
|
||||
}
|
||||
}
|
||||
@ -20,40 +20,7 @@
|
||||
</tr>
|
||||
${updates}
|
||||
</table>
|
||||
<hr>
|
||||
<h4 style="word-break: break-all;">Commits of Update ${update}</h4>
|
||||
<table style="width: 100%;" class="sai_table">
|
||||
<tr>
|
||||
<th>time</th>
|
||||
<th>author</th>
|
||||
<th>log</th>
|
||||
<th>commit</th>
|
||||
</tr>
|
||||
${update_commits}
|
||||
</table>
|
||||
<hr>
|
||||
<h4 style="word-break: break-all;">Projects of Update ${update}</h4>
|
||||
<table style="width: 100%;" class="sai_table">
|
||||
<tr>
|
||||
<th>time</th>
|
||||
<!--<th>update</th>-->
|
||||
<th>path</th>
|
||||
<th>git</th>
|
||||
<!--<th>commit</th>-->
|
||||
<!--<th>commit_last</th>-->
|
||||
</tr>
|
||||
${projects}
|
||||
</table>
|
||||
<hr>
|
||||
<h4 style="word-break: break-all;">Commits of Project ${project}</h4>
|
||||
<table style="width: 100%;" class="sai_table">
|
||||
<tr>
|
||||
<th>time</th>
|
||||
<th>author</th>
|
||||
<th>log</th>
|
||||
<th>commit</th>
|
||||
</tr>
|
||||
${commits}
|
||||
</table>
|
||||
${projects}
|
||||
${commits}
|
||||
</div>
|
||||
</div>
|
||||
|
||||
6
tpl/saimod_webcraft_updates_commit.tpl
Normal file
6
tpl/saimod_webcraft_updates_commit.tpl
Normal file
@ -0,0 +1,6 @@
|
||||
<tr>
|
||||
<td style="padding: 2px;">${time}</td>
|
||||
<td style="padding: 2px;"><a href="mailto:${email}">${author}</a></td>
|
||||
<td style="padding: 2px;">${log}</td>
|
||||
<td style="padding: 2px;">${commit}</td>
|
||||
</tr>
|
||||
11
tpl/saimod_webcraft_updates_commits.tpl
Normal file
11
tpl/saimod_webcraft_updates_commits.tpl
Normal file
@ -0,0 +1,11 @@
|
||||
<hr>
|
||||
<h4 style="word-break: break-all;">Commits of Project ${project}</h4>
|
||||
<table style="width: 100%;" class="sai_table">
|
||||
<tr>
|
||||
<th>time</th>
|
||||
<th>author</th>
|
||||
<th>log</th>
|
||||
<th>commit</th>
|
||||
</tr>
|
||||
${commit}
|
||||
</table>
|
||||
5
tpl/saimod_webcraft_updates_project.tpl
Normal file
5
tpl/saimod_webcraft_updates_project.tpl
Normal file
@ -0,0 +1,5 @@
|
||||
<tr>
|
||||
<td>${time}</td>
|
||||
<td><a href="#!updates;update.${update};project.${path}">${path}</a></td>
|
||||
<td>${git}</td>
|
||||
</tr>
|
||||
10
tpl/saimod_webcraft_updates_projects.tpl
Normal file
10
tpl/saimod_webcraft_updates_projects.tpl
Normal file
@ -0,0 +1,10 @@
|
||||
<hr>
|
||||
<h4 style="word-break: break-all;">Projects of Update ${update}</h4>
|
||||
<table style="width: 100%;" class="sai_table">
|
||||
<tr>
|
||||
<th>time</th>
|
||||
<th>path</th>
|
||||
<th>git</th>
|
||||
</tr>
|
||||
${project}
|
||||
</table>
|
||||
6
tpl/saimod_webcraft_updates_update.tpl
Normal file
6
tpl/saimod_webcraft_updates_update.tpl
Normal file
@ -0,0 +1,6 @@
|
||||
<tr>
|
||||
<td>${time}</td>
|
||||
<td><a href="#!updates;update.${commit}">${commit}</a></td>
|
||||
<td>${commit_last}</td>
|
||||
<td>${complete}</td>
|
||||
</tr>
|
||||
Loading…
x
Reference in New Issue
Block a user