Merge branch 'master' of mojotrollz.eu:system
This commit is contained in:
commit
cc50108991
@ -24,8 +24,13 @@ class files {
|
||||
$ext = pathinfo(self::$folders[$cat].$id);
|
||||
$ext = strtoupper(array_key_exists('extension', $ext) ? $ext['extension'] : '');
|
||||
if(\SYSTEM\HEADER::available($ext)){
|
||||
call_user_func('\SYSTEM\HEADER::'.$ext);}
|
||||
return file_get_contents(self::$folders[$cat].$id);
|
||||
call_user_func('\SYSTEM\HEADER::'.$ext);
|
||||
}else{
|
||||
\SYSTEM\HEADER::FILE($id);}
|
||||
|
||||
if(!self::file_get_contents_chunked(self::$folders[$cat].$id,4096,function($chunk,&$handle,$iteration){echo $chunk;})){
|
||||
throw new \SYSTEM\LOG\ERROR("Could not transfere File.");}
|
||||
return;
|
||||
}
|
||||
|
||||
public static function put($cat, $id, $contents) {
|
||||
@ -60,4 +65,17 @@ class files {
|
||||
|
||||
public static function getURL($cat, $id = null) {
|
||||
return \SYSTEM\CONFIG\config::get(\SYSTEM\CONFIG\config_ids::SYS_CONFIG_PATH_BASEURL) . 'api.php?call=files&cat=' . $cat . '&id=' . $id;}
|
||||
|
||||
private static function file_get_contents_chunked($file,$chunk_size,$callback)
|
||||
{
|
||||
$handle = fopen($file, "r");
|
||||
$i = 0;
|
||||
while (!feof($handle))
|
||||
{
|
||||
call_user_func_array($callback,array(fread($handle,$chunk_size),&$handle,$i));
|
||||
$i++;
|
||||
}
|
||||
fclose($handle);
|
||||
return true;
|
||||
}
|
||||
}
|
||||
@ -25,6 +25,8 @@ function init__SYSTEM_SAI_saimod_sys_locale() {
|
||||
$('#newtext').click(function(){
|
||||
$('#addtext').show();
|
||||
saimod_sys_locale_savenewcontent();
|
||||
$('#new_text_id_input').val('');
|
||||
$('#new_category_id_input').val('');
|
||||
cData.editmode = false;});
|
||||
|
||||
$('.groups').click(function(){
|
||||
@ -75,19 +77,23 @@ function saimod_sys_locale_newtext(){
|
||||
type: 'GET',
|
||||
success: function(data) {
|
||||
$('#contenttextarea').text('');
|
||||
$('#new_text_id').attr('placeholder', 'new title here...').blur();
|
||||
$('#new_category_id input').attr('value', cData.group);
|
||||
$('#new_category_id').show();
|
||||
$('#new_text_id').show();
|
||||
$('#newtext').show();
|
||||
$('#changetext').hide();
|
||||
$('#newcontenttextarea').hide();
|
||||
$('#modal').modal('show');
|
||||
$('#modal_main').modal('show');
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
function saimod_sys_locale_savecontent(id, lang){
|
||||
tinyMCE.triggerSave();
|
||||
tinyMCE.triggerSave();
|
||||
newtext = $('#contenttextarea').val();
|
||||
newgroup = $('#new_category_id_input').val();
|
||||
console.log($('#new_category_id_input'));
|
||||
console.log(newgroup);
|
||||
$.ajax({
|
||||
url: SAI_ENDPOINT,
|
||||
data: { sai_mod: '.SYSTEM.SAI.saimod_sys_locale',
|
||||
@ -112,10 +118,10 @@ function saimod_sys_locale_savecontent(id, lang){
|
||||
|
||||
function saimod_sys_locale_savenewcontent(){
|
||||
tinyMCE.triggerSave();
|
||||
newtext = $('#contenttextarea').val();
|
||||
id = $('#new_text_id').val();
|
||||
console.log("id "+id);
|
||||
category = cData.group;
|
||||
id = $('#new_text_id_input').val();
|
||||
cData.group = $('#new_category_id_input').val();
|
||||
console.log("id: "+id);
|
||||
console.log("category: "+cData.group);
|
||||
$.ajax({
|
||||
url: SAI_ENDPOINT,
|
||||
data: { sai_mod: '.SYSTEM.SAI.saimod_sys_locale',
|
||||
@ -132,6 +138,7 @@ function saimod_sys_locale_savenewcontent(){
|
||||
|
||||
function saimod_sys_locale_loadsinglecontent(id, lang){
|
||||
$('#new_text_id').hide();
|
||||
$('#new_category_id').hide();
|
||||
$('#newtext').hide();
|
||||
$('#modaltextarea').show();
|
||||
$('#changetext').show();
|
||||
@ -152,7 +159,7 @@ function saimod_sys_locale_loadsinglecontent(id, lang){
|
||||
$('#modaltitle').html(id);
|
||||
$('#modaltitle').show();
|
||||
cData.id = id;
|
||||
$('#modal').modal('show');
|
||||
$('#modal_main').modal('show');
|
||||
}
|
||||
});
|
||||
}
|
||||
@ -173,15 +180,16 @@ function saimod_sys_locale_delete(buttonID){
|
||||
saimod_sys_locale_loadcontent(cData.lang,cData.group);}});
|
||||
|
||||
saimod_sys_locale_loadcontent(cData.lang,cData.group);
|
||||
$('#modal').modal('hide');
|
||||
$('#modal_main').modal('hide');
|
||||
}
|
||||
|
||||
function init_tinymce(){
|
||||
tinymce.init({ // General options
|
||||
mode : "textareas",
|
||||
theme : "modern",
|
||||
plugins : "anchor,bbcode,charmap,code,contextmenu,directionality,link,textcolor,table,hr,fullscreen,autolink,lists,spellchecker,pagebreak,layer,table,save,emoticons,insertdatetime,preview,media,searchreplace,print,contextmenu,paste,directionality,fullscreen,noneditable,visualchars,nonbreaking,template",
|
||||
|
||||
|
||||
formats : {
|
||||
italic : {inline : 'span', 'classes' : 'italic'}},
|
||||
// Theme options
|
||||
theme_modern_buttons1 : "save,newdocument,|,bold,italic,underline,strikethrough,|,justifyleft,justifycenter,justifyright,justifyfull,|,styleselect,formatselect,fontselect,fontsizeselect",
|
||||
theme_modern_buttons2 : "cut,copy,paste,pastetext,pasteword,|,search,replace,|,bullist,numlist,|,outdent,indent,blockquote,|,undo,redo,|,link,unlink,anchor,image,cleanup,help,code,|,insertdate,inserttime,preview,|,forecolor,backcolor",
|
||||
|
||||
@ -74,7 +74,7 @@ class saimod_sys_locale extends \SYSTEM\SAI\SaiModule {
|
||||
|
||||
public static function sai_mod__SYSTEM_SAI_saimod_sys_locale_action_add($id, $category){
|
||||
return \SYSTEM\DBD\SYS_SAIMOD_LOCALE_ADD::QI(array($id, $category)) ? \SYSTEM\LOG\JsonResult::ok() : \SYSTEM\LOG\JsonResult::error(new \SYSTEM\LOG\WARNING("no data added"));}
|
||||
|
||||
|
||||
public static function sai_mod__SYSTEM_SAI_saimod_sys_locale_action_delete($id){
|
||||
return \SYSTEM\DBD\SYS_SAIMOD_LOCALE_DEL::QI(array($id)) ? \SYSTEM\LOG\JsonResult::ok() : \SYSTEM\LOG\JsonResult::error(new \SYSTEM\LOG\WARNING("could not delete the permitted data"));}
|
||||
|
||||
|
||||
@ -10,12 +10,19 @@
|
||||
</div>
|
||||
</div>
|
||||
<div id="editfield">
|
||||
<div class="modal fade" id="modal" style="width: 700px;" tabindex="-1" role="dialog" aria-labelledby="myModalLabel" aria-hidden="true">
|
||||
<div class="modal fade" id="modal_main" style="width: 700px;" tabindex="-1" role="dialog" aria-labelledby="myModalLabel" aria-hidden="true">
|
||||
<div class="modal-dialog">
|
||||
<div class="modal-content">
|
||||
<div class="modal-header">
|
||||
<h4 class="modal-title" id="modaltitle">${id}</h4>
|
||||
<input type="text" id="new_text_id" placeholder="new title here..." style="display: none;" />
|
||||
<div id="new_category_id" style="display: none;">
|
||||
<h5>Category ID</h5>
|
||||
<input id="new_category_id_input" type="text" placeholder="New category ID here..."/>
|
||||
</div>
|
||||
<div id="new_text_id" style="display: none;">
|
||||
<h5>Text ID</h5>
|
||||
<input id="new_text_id_input" type="text" placeholder="New text ID here..."/>
|
||||
</div>
|
||||
</div>
|
||||
<div id="addtext" style="display: none;">
|
||||
<div class="tabbable">
|
||||
|
||||
@ -2,7 +2,6 @@
|
||||
namespace SYSTEM;
|
||||
|
||||
class HEADER {
|
||||
|
||||
private static function checkHeader(){
|
||||
$file = null;
|
||||
$line = null;
|
||||
@ -28,6 +27,10 @@ class HEADER {
|
||||
public static function GIF(){
|
||||
if(self::checkHeader()){
|
||||
header('content-type:image/gif;');}}
|
||||
|
||||
public static function FILE($filename){
|
||||
header("Content-type: application/octet-stream");
|
||||
header("Content-Disposition: attachment; filename=\"".$filename."\"");}
|
||||
|
||||
public static function available($datatype){
|
||||
$datatype = strtoupper($datatype);
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user