finished gallery module, fixed rhein stuff, made rhein galleries

This commit is contained in:
Ulf Gebhardt 2014-05-22 17:06:06 +02:00
parent 7fa44d1901
commit 81795b8a5d
9 changed files with 79 additions and 18 deletions

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

View File

@ -3,6 +3,6 @@
class default_wohnung extends SYSTEM\PAGE\Page {
public function html() {
$vars = \SYSTEM\locale::getStrings(\DBD\locale_string::CATEGORY_RHEIN_TEXT);
return $vars['rhein_wohnung'].saimod_webcraft_gallery::getGallery(2);
return $vars['rhein_wohnung'].'</br></br>'.saimod_webcraft_gallery::getGallery(2);
}
}

View File

@ -7,5 +7,5 @@ class SAIMOD_WEBCRAFT_GALLERY_GALLERY_ID extends \SYSTEM\DB\QP {
//pg
'',
//mys
'SELECT * FROM webcraft_gallery WHERE gallery = ?;'
'SELECT * FROM webcraft_gallery WHERE gallery = ? ORDER BY position ASC;'
);}}

View File

@ -0,0 +1,11 @@
<?php
namespace DBD;
class SAIMOD_WEBCRAFT_GALLERY_GALLERY_ITEM_CHG extends \SYSTEM\DB\QP {
protected static function query(){
return new \SYSTEM\DB\QQuery(get_class(),
//pg
'',
//mys
'UPDATE webcraft_gallery SET gallery = ?, position = ?, heading = ?, description = ?, file_cat = ?, file_id= ? WHERE ID = ?;'
);}}

View File

@ -12,9 +12,18 @@ function load_tab(name){
function register_controlls(){
$('.gallery_entry').click(function(){
$('#tab_gallery').load(SAI_ENDPOINT+'sai_mod=saimod_webcraft_gallery&action=showgalleryitem&gallery='+$(this).attr('gallery')+'&id='+$(this).attr('galleryid'), function(){
$('#input_show_file_cat').change(function(){
$('#input_show_file_id').load(SAI_ENDPOINT+'sai_mod=saimod_webcraft_gallery&action=select_options_id&cat='+$('#input_show_file_cat').val(),function(){
$('#img_preview').attr('src', './api.php?call=files&cat='+$('#input_show_file_cat').val()+'&id='+$('#input_show_file_id').val());
});
});
$('#input_show_file_id').change(function(){
$('#img_preview').attr('src', './api.php?call=files&cat='+$('#input_show_file_cat').val()+'&id='+$('#input_show_file_id').val());
});
$('#img_preview').attr('src', './api.php?call=files&cat='+$('#input_show_file_cat').val()+'&id='+$('#input_show_file_id').val());
$('#btn_back').click(function(){
load_tab($(this).attr('gallery'));});
$('#btn_del').click(function(){
$('#btn_del').click(function(){
$.ajax({
url: SAI_ENDPOINT+'sai_mod=saimod_webcraft_gallery&action=delgalleryitem',
type: 'GET',
@ -27,6 +36,25 @@ function register_controlls(){
}
});
});
$('#btn_chg').click(function(){
$.ajax({
url: SAI_ENDPOINT+'sai_mod=saimod_webcraft_gallery&action=chggalleryitem',
type: 'GET',
data: { id : $(this).attr('galleryid'),
gallery : $('#input_show_gallery').val(),
position : $('#input_show_position').val(),
heading : $('#input_show_heading').val(),
description : $('#input_show_description').val(),
file_cat : $('#input_show_file_cat').val(),
file_id : $('#input_show_file_id').val()},
success: function (data) {
if(!data || !data['status']){
alert("Fail: "+data);
return;}
alert("OK: "+data);
}
});
});
});
});
$('.galleryadd').click(function(){

View File

@ -16,16 +16,20 @@ class saimod_webcraft_gallery extends \SYSTEM\SAI\SaiModule {
public static function sai_mod_saimod_webcraft_gallery_action_addgalleryitem($gallery, $position, $heading, $description, $file_cat, $file_id){
if(!\DBD\SAIMOD_WEBCRAFT_GALLERY_GALLERY_ITEM_ADD::QI(array($gallery, $position, $heading, $description, $file_cat, $file_id))){
throw new SYSTEM\LOG\ERROR("Problem with adding Galleryitem!");}
return \SYSTEM\LOG\JsonResult::ok();}
return \SYSTEM\LOG\JsonResult::ok();}
public static function sai_mod_saimod_webcraft_gallery_action_delgalleryitem($id){
if(!\DBD\SAIMOD_WEBCRAFT_GALLERY_GALLERY_ITEM_DELETE::QI(array($id))){
throw new SYSTEM\LOG\ERROR("Problem with deleting Galleryitem!");}
return \SYSTEM\LOG\JsonResult::ok();}
public static function sai_mod_saimod_webcraft_gallery_action_chggalleryitem($id, $gallery, $position, $heading, $description, $file_cat, $file_id){
if(!\DBD\SAIMOD_WEBCRAFT_GALLERY_GALLERY_ITEM_CHG::QI(array($gallery, $position, $heading, $description, $file_cat, $file_id, $id))){
throw new SYSTEM\LOG\ERROR("Problem with changing Galleryitem!");}
return \SYSTEM\LOG\JsonResult::ok();}
public static function sai_mod_saimod_webcraft_gallery_action_addgallery(){
$vars = array('file_cat_options' => self::select_options_cat(), 'file_id_options' => self::sai_mod_saimod_webcraft_gallery_action_select_options_id(array_keys(\SYSTEM\FILES\files::get())[0]));
return \SYSTEM\PAGE\replace::replaceFile(\SYSTEM\SERVERPATH(new PSAI(), 'saimod_webcraft_gallery/saimod_webcraft_gallery_add.tpl'),$vars);
}
}
private static function select_options_cat($cat = null){
$result = '';
@ -48,8 +52,9 @@ class saimod_webcraft_gallery extends \SYSTEM\SAI\SaiModule {
}
public static function sai_mod_saimod_webcraft_gallery_action_showgalleryitem($gallery,$id){
return \SYSTEM\PAGE\replace::replaceFile(\SYSTEM\SERVERPATH(new PSAI(), 'saimod_webcraft_gallery/saimod_webcraft_gallery_show.tpl'),
\DBD\SAIMOD_WEBCRAFT_GALLERY_GALLERY_ITEM_ID::Q1(array($gallery,$id)));
$vars = \DBD\SAIMOD_WEBCRAFT_GALLERY_GALLERY_ITEM_ID::Q1(array($gallery,$id));
$vars = array_merge($vars, array('file_cat_options' => self::select_options_cat($vars['file_cat']), 'file_id_options' => self::sai_mod_saimod_webcraft_gallery_action_select_options_id($vars['file_cat'],$vars['file_id'])));
return \SYSTEM\PAGE\replace::replaceFile(\SYSTEM\SERVERPATH(new PSAI(), 'saimod_webcraft_gallery/saimod_webcraft_gallery_show.tpl'),$vars);
}
public static function sai_mod_saimod_webcraft_gallery(){

View File

@ -18,18 +18,18 @@
<tr>
<td>Description</td>
<td>${description}</td>
<td><input type="text" id="input_show_heading" value="${description}"/></td>
<td><input type="text" id="input_show_description" value="${description}"/></td>
</tr>
<tr>
<td>File</td>
<td><a href="./api.php?call=files&cat=${file_cat}&id=${file_id}">./api.php?call=files&cat=${file_cat}&id=${file_id}<a> </td>
<td>
<input type="select" id="input_add_file_cat"/>
<input type="select" id="input_add_file_id"/>
<select id="input_show_file_cat">${file_cat_options}</select>
<select id="input_show_file_id">${file_id_options}</select>
</td>
</tr>
</table>
<img src="./api.php?call=files&cat=${file_cat}&id=${file_id}" id="img_preview"/>
<img id="img_preview" src="./api.php?call=files&cat=${file_cat}&id=${file_id}"/>
</br>
</br>
<input type="button" class="btn btn-success" id="btn_chg" galleryid="${ID}"value="Change"/>

View File

@ -11,4 +11,12 @@ INSERT INTO `system_api` (`ID`, `group`, `type`, `parentID`, `parentValue`, `nam
INSERT INTO `system_api` (`ID`, `group`, `type`, `parentID`, `parentValue`, `name`, `verify`) VALUES (215, 42, 2, 3, 'delgalleryitem', 'id', 'UINT0');
INSERT INTO `system_api` (`ID`, `group`, `type`, `parentID`, `parentValue`, `name`, `verify`) VALUES (220, 42, 2, 3, 'select_options_id', 'cat', 'STRING');
INSERT INTO `system_api` (`ID`, `group`, `type`, `parentID`, `parentValue`, `name`, `verify`) VALUES (221, 42, 3, 3, 'select_options_id', 'id', 'STRING');
INSERT INTO `system_api` (`ID`, `group`, `type`, `parentID`, `parentValue`, `name`, `verify`) VALUES (221, 42, 3, 3, 'select_options_id', 'id', 'STRING');
INSERT INTO `system_api` (`ID`, `group`, `type`, `parentID`, `parentValue`, `name`, `verify`) VALUES (225, 42, 2, 3, 'chggalleryitem', 'id', 'UINT0');
INSERT INTO `system_api` (`ID`, `group`, `type`, `parentID`, `parentValue`, `name`, `verify`) VALUES (226, 42, 2, 3, 'chggalleryitem', 'gallery', 'UINT0');
INSERT INTO `system_api` (`ID`, `group`, `type`, `parentID`, `parentValue`, `name`, `verify`) VALUES (227, 42, 2, 3, 'chggalleryitem', 'position', 'UINT0');
INSERT INTO `system_api` (`ID`, `group`, `type`, `parentID`, `parentValue`, `name`, `verify`) VALUES (228, 42, 2, 3, 'chggalleryitem', 'heading', 'STRING');
INSERT INTO `system_api` (`ID`, `group`, `type`, `parentID`, `parentValue`, `name`, `verify`) VALUES (229, 42, 2, 3, 'chggalleryitem', 'description', 'STRING');
INSERT INTO `system_api` (`ID`, `group`, `type`, `parentID`, `parentValue`, `name`, `verify`) VALUES (230, 42, 2, 3, 'chggalleryitem', 'file_cat', 'STRING');
INSERT INTO `system_api` (`ID`, `group`, `type`, `parentID`, `parentValue`, `name`, `verify`) VALUES (231, 42, 2, 3, 'chggalleryitem', 'file_id', 'STRING');