1
Peekay
Extgallery. Add upload button to index page
  • 2016/11/18 12:01

  • Peekay

  • XOOPS is my life!

  • Posts: 2335

  • Since: 2004/11/20


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

2
Mamba
Re: Extgallery. Add upload button to index page
  • 2016/11/18 16:02

  • Mamba

  • Moderator

  • Posts: 11366

  • Since: 2004/4/23


Great!

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

3
Mamba
Re: Extgallery. Add upload button to index page
  • 2016/11/19 19:32

  • Mamba

  • Moderator

  • Posts: 11366

  • Since: 2004/4/23


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

Login

Who's Online

164 user(s) are online (112 user(s) are browsing Support Forums)


Members: 0


Guests: 164


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