1
blindman
Re: New admin theme in dev : Cockpit_by_monxoops
  • 2020/4/6 14:04

  • blindman

  • Not too shy to talk

  • Posts: 119

  • Since: 2005/6/26


BackEnd like AdminLTE is great. This means a process of hardcoded html replacement with bootstrap4 compatible syntax, into the core for backEnd and, trough modules templates, for frontEnd functionality and design . This is a great way to go. This way Xoops can get the spectaculous "Bitc3ro-Like" look, both side. Thank you for you efforts :) Looking forward for updates!



2
blindman
Re: squad theme and next ;-)
  • 2019/3/14 14:14

  • blindman

  • Not too shy to talk

  • Posts: 119

  • Since: 2005/6/26


Thank you for digging up into bootstrap themes direction. This way Xoops can add value on it's powerful core. Bootstrap based frontend and backend themes should ignite users imagination. If modules developers adopts their templates ... Xoops, with it's great engine, will be in top.



3
blindman
Re: Watermark Hack for Xoops Core Imagemanager
  • 2019/1/4 17:47

  • blindman

  • Not too shy to talk

  • Posts: 119

  • Since: 2005/6/26


This wasn't a core modification. Was part of c custom module admin page for publishing article like stuff.
Into a page where you can add/edit/save/delete items we usually have a form for add/edit options, save if $op=='save', for example. There we can collect $_POST values from the form and save them in DB.
Well, there were the part with:
if(isset($_POST['xoops_upload_file'])) {

inside this loop I was using those functions.
The functions you can put into some function.php file that is always included.



4
blindman
Re: Watermark Hack for Xoops Core Imagemanager
  • 2019/1/3 15:49

  • blindman

  • Not too shy to talk

  • Posts: 119

  • Since: 2005/6/26


Some years ago I made something similar using :
At that time it worked.
///### script for the file that manage some items that use watermark image ## ///
$storedir '....'// url for file store folder
$storepath '....'// path for file store folder
$moddir 'yourModuleDirName';
if(isset(
$_POST['xoops_upload_file'])) {

    
$fldname $_FILES[$_POST['xoops_upload_file'][0]];
    
$fldname = (get_magic_quotes_gpc()) ? stripslashes($fldname['name']) : $fldname['name'];
    
$ext xoops_getExtension($fldname); // some function to read extension
    
if(xoops_trim($fldname)!='') { // // some function to trim string
        
$uploader = new XoopsMediaUploader($storepath$allowed_mimetypes$maxfilesize$maxfilewidth$maxfileheight);
        do
            
$newname xoops_makeRname(8'prefix_').".".$ext;// some function to make a random based file name
        
while (file_exists($storedir.'/'.$newname));
        
        
$uploader->setTargetFileName($newname);
        if (
$uploader->fetchMedia($_POST['xoops_upload_file'][0])) {
            if (
$uploader->upload()) {
                
$msg 'File upload success<br />';
                
$success.= 'File name: '.$uploader->getSavedFileName().'<br />';
                
$success.= 'File path: '.$uploader->getSavedDestination();
                
// some code here to set the new name
                // make thumb
                
xoops_ImageResize$storepath."/".$newname$storepath."/thumbs/".$newname$xoopsModuleConfig['thumbw'], $xoopsModuleConfig['thumbh']);
                
// resize image
                
$imgwidth $xoopsModuleConfig['maximgwidth'];
                
$imgheight $xoopsModuleConfig['maximgheight'];
                
xoops_ImageResize$storepath."/".$newname$storepath."/".$newname$imgwidth$imgheight);
                
// build watermark image
                
$watermark XOOPS_ROOT_PATH."/modules/".$moddir."/images/watermark.png";
                
xoops_ImageWatermark$storepath."/".$newname$watermark"jpeg""center""center");
                
// .... code about data to be saved
            
}
            
// .... code about data to be saved
        
}
        
// .... code about data to be saved
    
}
    
// .... code about data to be saved
}
///### functions used above ## ///
function myModule_ImageWatermark$original$watermark$save_as="jpeg"$h_position="center"$v_position="center"){
    global 
$moddir$xoopsModuleConfig;
    
//$target = XOOPS_ROOT_PATH."/modules/".$moddir."/images/watermark/target.jpg";
    
$target $original;
    
$wm_size '1';
    
$wmTarget XOOPS_ROOT_PATH."/modules/".$moddir."/uploads/png_trans.tmp";
    
$disp_width_max 150;                    // used when displaying watermark choices
    
$disp_height_max 80;                    // used when displaying watermark choices
    
$edgePadding 15;                        // used when placing the watermark near an edge
    
$quality 100;                           // used when generating the final image
    
    
$origInfo getimagesize($original); 
    
$origWidth $origInfo[0]; 
    
$origHeight $origInfo[1]; 
    
$waterMarkInfo getimagesize($watermark);
    
$waterMarkWidth $waterMarkInfo[0];
    
$waterMarkHeight $waterMarkInfo[1];

    if(
$wm_size=='larger'){
        
$placementX 0;
        
$placementY 0;
        
$h_position 'center';
        
$v_position 'center';
        
$waterMarkDestWidth $waterMarkWidth;
        
$waterMarkDestHeight $waterMarkHeight;
        if(
$waterMarkWidth $origWidth*1.05 && $waterMarkHeight $origHeight*1.05){
            
$wdiff $waterMarkDestWidth $origWidth;
            
$hdiff $waterMarkDestHeight $origHeight;
            
$sizer = ($wdiff $hdiff) ? (($wdiff/$waterMarkDestWidth)-0.05) : (($hdiff/$waterMarkDestHeight)-0.05) ;
            
$waterMarkDestWidth -= $waterMarkDestWidth $sizer;
            
$waterMarkDestHeight -= $waterMarkDestHeight $sizer;
        }
        else{
            
$wdiff $origWidth $waterMarkDestWidth;
            
$hdiff $origHeight $waterMarkDestHeight;
            
$sizer = ($wdiff $hdiff) ? (($wdiff/$waterMarkDestWidth)+0.05) : (($hdiff/$waterMarkDestHeight)+0.05);
            
$waterMarkDestWidth += $waterMarkDestWidth $sizer;
            
$waterMarkDestHeight += $waterMarkDestHeight $sizer;
        }
    }
    else{
        
$waterMarkDestWidth round($origWidth floatval($wm_size));
        
$waterMarkDestHeight round($origHeight floatval($wm_size));
        if(
$wm_size==1){
            
$waterMarkDestWidth -= 2*$edgePadding;
            
$waterMarkDestHeight -= 2*$edgePadding;
        }
    }
    
myModule_resizePngImage$watermark$waterMarkDestWidth$waterMarkDestHeight$wmTarget); // make resized png
    
    
$wmInfo getimagesize($wmTarget);
    
$waterMarkDestWidth $wmInfo[0];
    
$waterMarkDestHeight $wmInfo[1];
    
    
$differenceX $origWidth $waterMarkDestWidth;
    
$differenceY $origHeight $waterMarkDestHeight;
    
    switch(
$h_position){
        case 
'left':
            
$placementX $edgePadding;
            break;
        case 
'center':
            
$placementX =  round($differenceX 2);
            break;
        case 
'right':
            
$placementX $origWidth $waterMarkDestWidth $edgePadding;
            break;
    }
    switch(
$v_position){
        case 
'top':
            
$placementY $edgePadding;
            break;
        case 
'center':
            
$placementY =  round($differenceY 2);
            break;
        case 
'bottom':
            
$placementY $origHeight $waterMarkDestHeight $edgePadding;
            break;
    }
    
$resultImage = ($origInfo[2]==3) ?imagecreatefrompng($original) :  imagecreatefromjpeg($original);
    
imagealphablending($resultImageTRUE);
    
    
$finalWaterMarkImage imagecreatefrompng($wmTarget);
    
$finalWaterMarkWidth imagesx($finalWaterMarkImage);
    
$finalWaterMarkHeight imagesy($finalWaterMarkImage);
    
    
imagecopy$resultImage$finalWaterMarkImage$placementX$placementY00$finalWaterMarkWidth$finalWaterMarkHeight);
    
    if(
$origInfo[2]==3){
        
imagealphablending$resultImageFALSE);
        
imagesavealpha$resultImageTRUE);
        
imagepng$resultImage$target$quality);
    }else{
        
imagejpeg$resultImage$target$quality); 
    }
    
    
imagedestroy($resultImage);
    
imagedestroy($finalWaterMarkImage);
    
unlink($wmTarget);

}
function 
xoops_resizePngImage$img$newWidth$newHeight$target){
    
$srcImage imagecreatefrompng$img );
    if(
$srcImage == ''){
        return 
FALSE;
    }
    
$srcWidth imagesx($srcImage);
    
$srcHeight imagesy($srcImage);
    
$percentage = (double)$newWidth/$srcWidth;
    
$destHeight round($srcHeight*$percentage)+1;
    
$destWidth round($srcWidth*$percentage)+1;
    if(
$destHeight $newHeight){
        
// if the width produces a height bigger than we want, calculate based on height
        
$percentage = (double)$newHeight/$srcHeight;
        
$destHeight round($srcHeight*$percentage)+1;
        
$destWidth round($srcWidth*$percentage)+1;
    }
    
$destImage imagecreatetruecolor($destWidth-1,$destHeight-1);
    if(!
imagealphablending($destImage,FALSE)){
        return 
FALSE;
    }
    if(!
imagesavealpha$destImageTRUE)){
        return 
FALSE;
    }
    if(!
imagecopyresampled$destImage$srcImage0000$destWidth$destHeight$srcWidth$srcHeight)){
        return 
FALSE;
    }
    if(!
imagepng($destImage,$target)){
        return 
FALSE;
    }
    
imagedestroy($destImage);
    
imagedestroy($srcImage);
    return 
TRUE;
}

Hope it helps.



5
blindman
Re: How to add javascript code to article?
  • 2017/9/7 17:33

  • blindman

  • Not too shy to talk

  • Posts: 119

  • Since: 2005/6/26


News module use an editor. If is a WYSIWYG one, you should paste your javascript in 'html view' state of it, not in 'design view'. I guess this will 'see' new line as a break tag.



6
blindman
Re: A tricky question about
  • 2017/8/21 13:41

  • blindman

  • Not too shy to talk

  • Posts: 119

  • Since: 2005/6/26


edited:
You could use jQuery ajax to load something in a block.
You can send some variables by POST or GET and receive html code. Or set -> dataType: 'json' and you can receive structured data as array.

javascript part:
$(document).ready( function() { 
    
refreshMyDisplay(1);
    function 
refreshMyDisplay(myCount) {
        if(
myCount==1){
            var 
myTimer 1000;
        }
        else{
            var 
myTimer 10000;
        }
          
setTimeout( function() {
            $.
ajax({
                
url'completePathTo/display.php',
                
dataType'html',
                
data:     {
                    
var_one'val_one'
                    
var_two'val_two'
                },
                
type:     "POST",    
                
beforeSend: function() {
                    
// add a spinner by adding a class
                    
$('#auto').addClass("ajaxLoader");
                },
                
error:     function() {
                    
// display some feedback
                
},
                
success: function(e) {
                    $(
'#auto').removeClass("ajaxLoader"); // remove spinner
                    
$('#auto').html(e);
                }
            });
            
myCount myCount 1;
          }, 
myTimer);
        
refreshMyDisplay(myCount);
    }
});

html part:
<div id="auto"></div>


Javascript works with miliseconds, so 1000=1 sec.



7
blindman
A nice ideea I saw
  • 2017/7/29 19:29

  • blindman

  • Not too shy to talk

  • Posts: 119

  • Since: 2005/6/26


After my post herehttps://xoops.org/modules/newbb/viewtopic.php?post_id=363102 I wish I propose a nice mechanism I saw on a payed project. I can't copy/paste some code, but the principle of the mechanism is interesting.
There are a LOT of jQuery plugins on the web, and we should adopt some of it. Like Bootstrap, but many other goodies are out there. We should put them into a folder, and Xoops already have a dedicated folder for this.
Is about a little javascript file that is included into theme main file. That script read the loaded DOM and ...
- could do something on resize window;
- could initiate all tooltip elements based on some attributes like this:
jQuery("a[data-toggle=tooltip]").tooltip();


or a button related tooltip, or other one ...

- could manage the preloader layer;
- could detect if any specific class div is present on the DOM... and if so, load the script and initialize it based on attributes data, like a carousel or a countDown animation, or a calendar or chart or ... and the list of interesting jQuery plugins is so long...

The plugins folder could be quite big, but there is loaded only what is needed. So the result is lightweight.

In this way we just have to load jQuery file, boostrap files, and after that ... is about the syntax we use, based on a list of jQuery plugin we adopt. And we have to write some documentation for each one.

It have to be a loadMyScript function, with some arguments, scriptname, callbacks ... which manage the load of a specific script process. On DOM loaded time, an initialization function that run a list of other functions (and here should be our adopted plugins). Each one check the DOM for specific strings/classes and load/run something based on attributes.
Example:
jQuery(window).ready(function() {
 
loadMyScript(pathToTheLibrary 'bootstrap/js/bootstrap.js', function() {
        
Initialization();
    });
 });
function 
Initialization) {
 
lightboxFunction();
 
someNiceSliderFunction();
 
someNiceMenuFunction();
 
someNiceScrollFunction();
..... 
}
function 
loadMyScript(scriptcallback) {
 
// here jQuery append some javascript to the body, trigger it ...
}

each someNiceDoSomethingFunction() search the DOM for specific syntax, use loadMyScript function to pick the plugin, read attributes data and run the plugin based on it.
in conclusion:
We could have a list of usefull jQuery plugins;
A javascript file that run on load, read the DOM and append what is needed from library. And make them run based on syntax and attributes.
The modules developers could just use carousels-calendars-charts-countDown-masonryStylePhotos- and so on... just using the right syntax and attributes.



8
blindman
Re: many links are simply broken on xoops.org
  • 2017/7/28 21:07

  • blindman

  • Not too shy to talk

  • Posts: 119

  • Since: 2005/6/26


Xoops need a full bootstrap and jquery support. The RIGHT modules and themes zones should be available for community. Xoops has a power-full core but, lately, it looks abandoned. When I first joined Xoops community, a long time ago (2006), the core was behind the modules and themes as development state. Now it is the opposite situation. The core is bulletproof but themes/modules zones are not up to date. We need a full functional official website, to show our thrust in Xoops core. OK, some support is moved on github. But the official website MUST be UpToDate.
I don't have a website or a business based on xoops software, I wish I was. But I learned PHP playing with it. Xoops has a great value for me and I am looking forward to see any news every single day.
It has to be a reset point, to be again an "interesting outOfTheBox solution". It has to be a way. Bitc3ro ideas....some modern Bootstrap themes .... a full functional official website....could restart people interest.
I expect the answer like "Why you don't contribute?", which is a right point of view. But I miss the old time experience. And it is so close .... We have all we need to do this.



9
blindman
Re: Using XPayment
  • 2013/7/15 6:21

  • blindman

  • Not too shy to talk

  • Posts: 119

  • Since: 2005/6/26


Consider hiring an expert?
Best expert on your problems is wishcraft, he built those modules. I hope his health is better now so you can hire his professional services.



10
blindman
Re: _tplsource table content
  • 2012/8/6 7:09

  • blindman

  • Not too shy to talk

  • Posts: 119

  • Since: 2005/6/26


TABLEPREFIX_tplsource table store templates content of system and modules - files from 'templates' folder. When you update a module, in this table changes take place.

TABLEPREFIX_tplfile store info about templates also but not it's contents.

So, please do not delete it.




TopTop
(1) 2 3 4 ... 7 »



Login

Who's Online

222 user(s) are online (154 user(s) are browsing Support Forums)


Members: 0


Guests: 222


more...

Donat-O-Meter

Stats
Goal: $100.00
Due Date: Apr 30
Gross Amount: $0.00
Net Balance: $0.00
Left to go: $100.00
Make donations with PayPal!

Latest GitHub Commits