new topic features

started tags
new topic working
This commit is contained in:
Tobi 2014-12-19 02:38:15 +01:00
parent d4111f5d62
commit f6d1e75d2a
16 changed files with 218 additions and 6 deletions

View File

@ -16,6 +16,26 @@ class api_mojotrollz extends \SYSTEM\API\api_system {
throw new ERROR("You need to be logged in to view this ressource.");} throw new ERROR("You need to be logged in to view this ressource.");}
$creature = creature::data($entry); $creature = creature::data($entry);
return $creature;} return $creature;}
public static function call_topic_create($parent_type, $parent_id, $relationflag, $title, $text, $link){
if (\SYSTEM\SECURITY\Security::isLoggedIn()) {
echo JsonResult::ok();
return \DBD\TOPIC_CREATE::Q1(array($parent_type, $parent_id, $relationflag, $title, $text, $link, \SYSTEM\SECURITY\Security::getUser()->id));
}
else{
new SYSTEM\LOG\WARNING('called create function without rights');
}
}
public static function call_topic_tag($type, $value){
if (\SYSTEM\SECURITY\Security::isLoggedIn()) {
echo JsonResult::ok();
return tags::set(7, $type, $value);
}
else{
new SYSTEM\LOG\WARNING('called create function without rights');
}
}
public static function call_positions($type,$map=null,$entry=null){ public static function call_positions($type,$map=null,$entry=null){
return map::positions($type,$map,$entry);} return map::positions($type,$map,$entry);}
public static function call_tooltip($type,$id){ public static function call_tooltip($type,$id){

View File

@ -24,4 +24,15 @@ INSERT INTO `system_api` (`ID`, `group`, `type`, `parentID`, `parentValue`, `nam
INSERT INTO `system_api` (`ID`, `group`, `type`, `parentID`, `parentValue`, `name`, `verify`) VALUES (142, 0, 3, 10, 'positions', 'entry', 'INT'); INSERT INTO `system_api` (`ID`, `group`, `type`, `parentID`, `parentValue`, `name`, `verify`) VALUES (142, 0, 3, 10, 'positions', 'entry', 'INT');
INSERT INTO `system_api` (`ID`, `group`, `type`, `parentID`, `parentValue`, `name`, `verify`) VALUES (150, 0, 2, 10, 'tooltip', 'type', 'INT'); INSERT INTO `system_api` (`ID`, `group`, `type`, `parentID`, `parentValue`, `name`, `verify`) VALUES (150, 0, 2, 10, 'tooltip', 'type', 'INT');
INSERT INTO `system_api` (`ID`, `group`, `type`, `parentID`, `parentValue`, `name`, `verify`) VALUES (151, 0, 2, 10, 'tooltip', 'id', 'INT'); INSERT INTO `system_api` (`ID`, `group`, `type`, `parentID`, `parentValue`, `name`, `verify`) VALUES (151, 0, 2, 10, 'tooltip', 'id', 'INT');
INSERT INTO `system_api` (`ID`, `group`, `type`, `parentID`, `parentValue`, `name`, `verify`) VALUES (160, 0, 2, 10, 'topic_create', 'parent_type', 'INT');
INSERT INTO `system_api` (`ID`, `group`, `type`, `parentID`, `parentValue`, `name`, `verify`) VALUES (161, 0, 2, 10, 'topic_create', 'parent_id', 'INT');
INSERT INTO `system_api` (`ID`, `group`, `type`, `parentID`, `parentValue`, `name`, `verify`) VALUES (163, 0, 2, 10, 'topic_create', 'relationflag', 'STRING');
INSERT INTO `system_api` (`ID`, `group`, `type`, `parentID`, `parentValue`, `name`, `verify`) VALUES (164, 0, 2, 10, 'topic_create', 'title', 'STRING');
INSERT INTO `system_api` (`ID`, `group`, `type`, `parentID`, `parentValue`, `name`, `verify`) VALUES (165, 0, 2, 10, 'topic_create', 'text', 'STRING');
INSERT INTO `system_api` (`ID`, `group`, `type`, `parentID`, `parentValue`, `name`, `verify`) VALUES (166, 0, 2, 10, 'topic_create', 'link', 'STRING');
INSERT INTO `system_api` (`ID`, `group`, `type`, `parentID`, `parentValue`, `name`, `verify`) VALUES (180, 0, 2, 10, 'topic_tag', 'type', 'STRING');
INSERT INTO `system_api` (`ID`, `group`, `type`, `parentID`, `parentValue`, `name`, `verify`) VALUES (181, 0, 2, 10, 'topic_tag', 'value', 'STRING');

View File

@ -0,0 +1,16 @@
<?php
namespace DBD;
class GET_TOPICS_BY_FAQ extends \SYSTEM\DB\QQ {
protected static function query(){
return new \SYSTEM\DB\QQuery(get_class(),
//pg
'',
//mys
'SELECT mojotrollz_tags.*,mojotrollz_tags_type.name as tag_name,mojotrollz_tags_value.value as tag_value FROM mojotrollz_tags
LEFT JOIN mojotrollz_tags_type ON mojotrollz_tags.type=mojotrollz_tags_type.id
RIGHT JOIN mojotrollz_tags_value ON mojotrollz_tags.type=mojotrollz_tags_value.type AND mojotrollz_tags.value=mojotrollz_tags_value.id
WHERE mojotrollz_tags.`table` = 7 AND
mojotrollz_tags.`type` = 12 AND
mojotrollz_tags_type.`table` = 7'
);}}

View File

@ -0,0 +1,11 @@
<?php
namespace DBD;
class GET_TOPICS_BY_SELF extends \SYSTEM\DB\QP {
protected static function query(){
return new \SYSTEM\DB\QQuery(get_class(),
//pg
'',
//mys
'SELECT * FROM mojotrollz_topics WHERE `by` = ? ORDER BY timestamp DESC;'
);}}

View File

@ -0,0 +1,12 @@
<?php
namespace DBD;
class TOPIC_CREATE extends \SYSTEM\DB\QP {
protected static function query(){
return new \SYSTEM\DB\QQuery(get_class(),
//pg
'',
//mys
'INSERT INTO `mojotrollz_topics` (`parent_type`, `parent_id`, `relationflag`, `title`, `text`, `link`, `timestamp`, `by`) '
. 'VALUES ( ?, ?, ?, ?, ?, ?, NOW(), ?);'
);}}

View File

@ -20,6 +20,7 @@
\SYSTEM\autoload::registerFolder(dirname(__FILE__).'/user_shop_menu',''); \SYSTEM\autoload::registerFolder(dirname(__FILE__).'/user_shop_menu','');
\SYSTEM\autoload::registerFolder(dirname(__FILE__).'/user_nexus_menu',''); \SYSTEM\autoload::registerFolder(dirname(__FILE__).'/user_nexus_menu','');
\SYSTEM\autoload::registerFolder(dirname(__FILE__).'/user_nexus_menu_sub',''); \SYSTEM\autoload::registerFolder(dirname(__FILE__).'/user_nexus_menu_sub','');
\SYSTEM\autoload::registerFolder(dirname(__FILE__).'/user_nexus_content','');
\SYSTEM\autoload::registerFolder(dirname(__FILE__).'/user_achievements_menu',''); \SYSTEM\autoload::registerFolder(dirname(__FILE__).'/user_achievements_menu','');
\SYSTEM\autoload::registerFolder(dirname(__FILE__).'/user_achievements_menu_sub',''); \SYSTEM\autoload::registerFolder(dirname(__FILE__).'/user_achievements_menu_sub','');
\SYSTEM\autoload::registerFolder(dirname(__FILE__).'/user_achievements_content',''); \SYSTEM\autoload::registerFolder(dirname(__FILE__).'/user_achievements_content','');

View File

@ -50,6 +50,7 @@ class page_mojotrollz extends \SYSTEM\API\api_default {
if(!\SYSTEM\SECURITY\Security::isLoggedIn()){ if(!\SYSTEM\SECURITY\Security::isLoggedIn()){
throw new ERROR("You need to be logged in to view this ressource.");} throw new ERROR("You need to be logged in to view this ressource.");}
return new user_database();} return new user_database();}
public static function page_user_nexus_menu(){ public static function page_user_nexus_menu(){
if(!\SYSTEM\SECURITY\Security::isLoggedIn()){ if(!\SYSTEM\SECURITY\Security::isLoggedIn()){
throw new ERROR("You need to be logged in to view this ressource.");} throw new ERROR("You need to be logged in to view this ressource.");}
@ -58,6 +59,11 @@ class page_mojotrollz extends \SYSTEM\API\api_default {
if(!\SYSTEM\SECURITY\Security::isLoggedIn()){ if(!\SYSTEM\SECURITY\Security::isLoggedIn()){
throw new ERROR("You need to be logged in to view this ressource.");} throw new ERROR("You need to be logged in to view this ressource.");}
return new user_nexus_menu_sub($menu);} return new user_nexus_menu_sub($menu);}
public static function page_user_nexus_content($menu, $filter){
if(!\SYSTEM\SECURITY\Security::isLoggedIn()){
throw new ERROR("You need to be logged in to view this ressource.");}
return new user_nexus_content($menu, $filter);}
public static function page_user_shop_menu(){ public static function page_user_shop_menu(){
if(!\SYSTEM\SECURITY\Security::isLoggedIn()){ if(!\SYSTEM\SECURITY\Security::isLoggedIn()){
throw new ERROR("You need to be logged in to view this ressource.");} throw new ERROR("You need to be logged in to view this ressource.");}

View File

@ -0,0 +1,7 @@
function init_user_nexus_content(){
alert('init');
console.log('init');
$(".btn_quest_info").click(function(){
$('#achievement_list').load('./?page=user_achievements_content_quest&entry=' + $(this).attr('entry'));
});
}

View File

@ -0,0 +1 @@
${content}

View File

@ -0,0 +1,36 @@
<table>
<tr>
<td>
<h3>New Topic</h3>
</td>
</tr>
<tr>
<td style="color: black">
<input style="width: 600px;" type="text" id="_title" placeholder="title">
<br>
<br>
</td>
</tr>
<tr>
<td style="color: black">
<textarea style="width: 600px; min-height: 500px;" id="_txt">type your stuff here</textarea>
<br>
<br>
</td>
</tr>
<br>
<tr>
<td style="color: black">
<input style="width: 600px;" type="text" id="_link" placeholder="link">
<br>
<br>
</td>
</tr>
<tr>
<td>
<button id="btn_new_topic" class="btn btn_blue no_deco" parent_id="1" parent_type="1">post topic</button>
</td>
</tr>
</table>

View File

@ -0,0 +1,49 @@
<?php
class user_nexus_content extends SYSTEM\PAGE\Page {
var $menu = null;
var $filter = null;
public function __construct($menu, $filter) {
new \SYSTEM\LOG\INFO($menu.' '.$filter);
$this->menu = $menu;
$this->filter = $filter;
}
/*public static function js(){
return array( \SYSTEM\WEBPATH(new PPAGE(),'user_achievements_content/js/user_achievements_content.js'),
\SYSTEM\WEBPATH(new PAPI(),'database/js/wow.js'));}
public static function css (){
return array();}*/
private function menu_new(){
switch($this->filter){
case 1:
$result = '';
return SYSTEM\PAGE\replace::replaceFile(SYSTEM\SERVERPATH(new PPAGE(),'user_nexus_content/tpl/new.tpl'), array());
default:
return 'filter fail';
case 2:
$result = '';
$topics = \DBD\GET_TOPICS_BY_FAQ::QQ(array(\SYSTEM\SECURITY\Security::getUser()->id));
while ($rel = $topics->next()){
$result .= SYSTEM\PAGE\replace::replaceFile(SYSTEM\SERVERPATH(new PPAGE(),'user_nexus_menu_sub/tpl/user_nexus_menu_sub_topics_bulletin.tpl'), $rel);
}
return SYSTEM\PAGE\replace::replaceFile(SYSTEM\SERVERPATH(new PPAGE(),'user_nexus_content/tpl/faq.tpl'), array('content' => $result));
default:
return 'filter fail';
}
}
public function html(){
switch($this->menu){
case 1:
return $this->menu_new();
default:
return 'menu fail';
}
}
}

View File

@ -1,9 +1,39 @@
function init_user_nexus_menu_sub(){ function init_user_nexus_menu_sub(){
$(".btn_nexus_menu").click(function(){ $(".btn_nexus_menu").click(function(){
$('#nexus_list').load('./?page=user_nexus_content&menu=' + $(this).attr('menu') + '&filter=' + $(this).attr('filter'), function(){ $('#nexus_list').load('./?page=user_nexus_content&menu=' + $(this).attr('menu') + '&filter=' + $(this).attr('filter'), function(){
btn_new_topic();
}); });
}); });
function btn_new_topic(){
$("#btn_new_topic").click(function(){
$.ajax({ type :'GET',
url : './api.php?call=topic_create'+
'&parent_type='+$(this).attr('parent_type')+
'&parent_id='+$(this).attr('parent_id')+
'&relationflag='+$(this).attr('relationflag')+
'&title='+$('#_title').val()+
'&text='+$('#_text').val()+
'&link='+$('#_link').val(),
success : function(data) {
if(data.status){
load_visuals_tab(race);
}else{
alert('Problem: '+data);}
}
});
$.ajax({ type :'GET',
url : './api.php?call=topic_tag'+
'&type='+$(this).attr('type')+
'&value='+$('#_title').val(),
success : function(data) {
if(data.status){
load_visuals_tab(race);
}else{
alert('Problem: '+data);}
}
});
});
}
} }

View File

@ -1 +1 @@
<button class="btn btn_nexus_menu btn_submenu no_deco" menu="1" filter="1" href="#">Start</button> ${content}

View File

@ -1 +1,2 @@
<button class="btn btn_nexus_menu btn_submenu no_deco" menu="5" filter="5" href="#">Topics</button> <button class="btn btn_nexus_menu btn_submenu no_deco" menu="1" filter="1" href="#">New Topic</button>
<button class="btn btn_nexus_menu btn_submenu no_deco" menu="1" filter="2" href="#">FAQ</button>

View File

@ -15,9 +15,19 @@ class user_nexus_menu_sub extends SYSTEM\PAGE\Page {
public function html(){ public function html(){
switch ($this->menu){ switch ($this->menu){
case 1: case 1:
return SYSTEM\PAGE\replace::replaceFile(SYSTEM\SERVERPATH(new PPAGE(),'user_nexus_menu_sub/tpl/user_nexus_menu_sub_start.tpl'), array()); $result = '';
$topics = \DBD\GET_TOPICS_BY_SELF::QQ(array(\SYSTEM\SECURITY\Security::getUser()->id));
while ($rel = $topics->next()){
$result .= SYSTEM\PAGE\replace::replaceFile(SYSTEM\SERVERPATH(new PPAGE(),'user_nexus_menu_sub/tpl/user_nexus_menu_sub_topics_bulletin.tpl'), $rel);
}
return SYSTEM\PAGE\replace::replaceFile(SYSTEM\SERVERPATH(new PPAGE(),'user_nexus_menu_sub/tpl/user_nexus_menu_sub_start.tpl'), array('content' => $result));
case 2: case 2:
return SYSTEM\PAGE\replace::replaceFile(SYSTEM\SERVERPATH(new PPAGE(),'user_nexus_menu_sub/tpl/user_nexus_menu_sub_characters.tpl'), array()); $result = '';
$topics = \DBD\GET_TOPICS_BY_TAG_FAQ::QQ(array());
while ($rel = $topics->next()){
$result .= SYSTEM\PAGE\replace::replaceFile(SYSTEM\SERVERPATH(new PPAGE(),'user_nexus_menu_sub/tpl/user_nexus_menu_sub_topics_bulletin.tpl'), $rel);
}
return SYSTEM\PAGE\replace::replaceFile(SYSTEM\SERVERPATH(new PPAGE(),'user_nexus_menu_sub/tpl/user_nexus_menu_sub_faq.tpl'), array());
case 3: case 3:
return SYSTEM\PAGE\replace::replaceFile(SYSTEM\SERVERPATH(new PPAGE(),'user_nexus_menu_sub/tpl/user_nexus_menu_sub_friendlist.tpl'), array()); return SYSTEM\PAGE\replace::replaceFile(SYSTEM\SERVERPATH(new PPAGE(),'user_nexus_menu_sub/tpl/user_nexus_menu_sub_friendlist.tpl'), array());
case 4: case 4:

View File

@ -7,6 +7,7 @@
<li><a href="#tab_content" table="3">Items</a></li> <li><a href="#tab_content" table="3">Items</a></li>
<li><a href="#tab_content" table="4">Quests</a></li> <li><a href="#tab_content" table="4">Quests</a></li>
<li><a href="#tab_content" table="5">Spells</a></li> <li><a href="#tab_content" table="5">Spells</a></li>
<li><a href="#tab_content" table="7">Topics</a></li>
<img id="loader" src="${PICPATH}ajax-loader.gif" style="margin-left: 10px; margin-top: 10px; display: none; float: left"/> <img id="loader" src="${PICPATH}ajax-loader.gif" style="margin-left: 10px; margin-top: 10px; display: none; float: left"/>
</ul> </ul>
<div class="tab-content"> <div class="tab-content">