xoops forums

Peekay

XOOPS is my life!
Posted on: 2016/11/18 12:01
Peekay
Peekay (Show more)
XOOPS is my life!
Posts: 2335
Since: 2004/11/20
#1

Extgallery. Add upload button to index page

I recently read a question asking if the 'upload' and 'user album' links could be added to the main page of Extgallery instead of it being visible only in the main menu block. I had a requirement to do this myself recently, so I hope this may help someone else. It's pretty easy (this is for Extgallery version 1.11 updated by Zoullou + Xoops 2.5.5). Obviously, create backups first.

Firstly, in 'extgallery/index.php' add the following, before the footer include line:


// pk add upload and view-my-album links to main page

if(isset($GLOBALS['xoopsModule']) && $GLOBALS['xoopsModule']->getVar('dirname') == "extgallery") {

    if(
$GLOBALS['xoopsUser'] != null) {
        
$albumlinkname _MD_EXTGALLERY_USERALBUM;
        
$albumurl "public-useralbum.php?id=".$GLOBALS['xoopsUser']->uid();
    }

    include_once 
XOOPS_ROOT_PATH.'/modules/extgallery/class/publicPerm.php';

    
$permHandler ExtgalleryPublicPermHandler::getHandler();
    if(
count($permHandler->getAuthorizedPublicCat($GLOBALS['xoopsUser'], 'public_upload')) > 0) {
        
$uploadlinkname _MD_EXTGALLERY_PUBLIC_UPLOAD;
        if(
$GLOBALS['xoopsModuleConfig']['use_extended_upload'] == 'html') {
         
$uploadurl "public-upload.php";
        } else {
         
$uploadurl "public-upload-extended.php";
        }
    }
}

$xoopsTpl->assign('albumlinkname'$albumlinkname);
$xoopsTpl->assign('albumurl'$albumurl);
$xoopsTpl->assign('uploadlinkname'$uploadlinkname);
$xoopsTpl->assign('uploadurl'$uploadurl);

// end pk mod


Next, add the links to 'templates\extgallery_index.html'. You can style these links as required, or turn them into buttons.

<div>
         <
a title="<{$albumlinkname}>" href="<{xoAppUrl modules/extgallery/}><{$albumurl}>"><{$albumlinkname}></a> <br />
         <
a title="<{$uploadlinkname}>" href="<{xoAppUrl modules/extgallery/}><{$uploadurl}>"><{$uploadlinkname}></a>

     </
div>


Finally, add a new language definition to 'language\english\main.php':

// pk add my user def for new album link
define("_MD_EXTGALLERY_USERALBUM","View my album");


HTH

Mamba

Moderator
Posted on: 2016/11/18 16:02
Mamba
Mamba (Show more)
Moderator
Posts: 10797
Since: 2004/4/23
#2

Re: Extgallery. Add upload button to index page

Great!

Thanks for sharing!!!
Support XOOPS => DONATE
Use 2.5.10 | Docs | Modules | Bugs

Mamba

Moderator
Posted on: 2016/11/19 19:32
Mamba
Mamba (Show more)
Moderator
Posts: 10797
Since: 2004/4/23
#3

Re: Extgallery. Add upload button to index page

It's included now in: https://github.com/mambax7/extgallery

FYI: this is still "work in progress", so don't use it on your production site...
Support XOOPS => DONATE
Use 2.5.10 | Docs | Modules | Bugs