<?php
/**
 * @version $Id: xoops_version.php 679 2012-08-20 12:41:35Z hodaka $
 * @package myuploader
 */

if(!defined('XOOPS_ROOT_PATH')) exit();
if(!defined('XOOPS_TRUST_PATH')) die('set XOOPS_TRUST_PATH in mainfile.php');

require_once XOOPS_TRUST_PATH.'/modules/'.$mytrustdirname.'/class/MyuploaderUtils.class.php';

// language file (modinfo.php)
$langmanpath = XOOPS_TRUST_PATH.'/libs/altsys/class/D3LanguageManager.class.php';
if(!file_exists($langmanpath)) die('install the latest altsys');
require_once($langmanpath);
$langman = D3LanguageManager::getInstance() ;
$langman->read('modinfo.php', $mydirname, $mytrustdirname, false);

$constpref = '_MI_'.strtoupper($mydirname);

//
// Define a basic manifesto.
//
$modversion['name'] = constant($constpref.'_BASIC_MODULE_NAME');
$modversion['description'] = constant($constpref.'_BASIC_MODULE_NAME_DSC');
$modversion['version'] = 0.1302;
$modversion['author'] = 'Hodaka <hodaka@kuri3.net>';
$modversion['credits'] = 'www.kuri3.net';
$modversion['help'] = 'help.html';
$modversion['license'] = 'GPL';
$modversion['official'] = 0;
$modversion['image'] = 'module_icon.php';
$modversion['dirname'] = $mydirname;
$modversion['package_name'] = 'myuploader'; // Don't touch!

$modversion['cube_style'] = true;
$modversion['legacy_installer'] = array(
    'installer'   => array(
        'class'     => 'Installer',
        'namespace' => ucfirst($mytrustdirname),
        'filepath'  => XOOPS_TRUST_PATH.'/modules/'.$mytrustdirname.'/admin/class/installer/'.ucfirst($mytrustdirname).'Installer.class.php'
    ),
    'uninstaller' => array(
        'class'     => 'Uninstaller',
        'namespace' => ucfirst($mytrustdirname),
        'filepath'  => XOOPS_TRUST_PATH.'/modules/'.$mytrustdirname.'/admin/class/installer/'.ucfirst($mytrustdirname).'Uninstaller.class.php'
    ),
    'updater' => array(
        'class'     => 'Updater',
        'namespace' => ucfirst($mytrustdirname),
        'filepath'  => XOOPS_TRUST_PATH.'/modules/'.$mytrustdirname.'/admin/class/installer/'.ucfirst($mytrustdirname).'Updater.class.php'
    )
);
$modversion['disable_legacy_2nd_installer'] = false;

$modversion['sqlfile']['mysql'] = 'sql/mysql.sql';
$modversion['tables'] = array(
//    '{prefix}_{dirname}_xxxx',
##[cubson:tables]
    '{prefix}_{dirname}_category',
    '{prefix}_{dirname}_image'
##[/cubson:tables]
);

//
// Templates. You must never change [cubson] chunk to get the help of cubson.
//
$modversion['templates'] = array(
/*
    array(
        'file'        => '{dirname}_xxx.html',
        'description' => _MI_MYUPLOADER_TPL_XXX
    ),
*/
/*##[cubson:templates]
    array('file' => '{dirname}_category_list.html', 'description' => constant($constpref.'_TPL_CATEGORY_LIST')),
    array('file' => '{dirname}_category_edit.html', 'description' => constant($constpref.'_TPL_CATEGORY_EDIT')),
    array('file' => '{dirname}_category_delete.html', 'description' => constant($constpref.'_TPL_CATEGORY_DELETE')),
    array('file' => '{dirname}_category_view.html', 'description' => constant($constpref.'_TPL_CATEGORY_VIEW')),
    array('file' => '{dirname}_image_list.html', 'description' => constant($constpref.'_TPL_IMAGE_LIST')),
    array('file' => '{dirname}_image_edit.html', 'description' => constant($constpref.'_TPL_IMAGE_EDIT')),
    array('file' => '{dirname}_image_delete.html', 'description' => constant($constpref.'_TPL_IMAGE_DELETE')),
    array('file' => '{dirname}_image_view.html', 'description' => constant($constpref.'_TPL_IMAGE_VIEW')),
    array('file' => '{dirname}_image_board.html', 'description' => constant($constpref.'_TPL_IMAGE_BOARD'))
##[/cubson:templates]*/
);

//
// Admin panel setting
//
$modversion['hasAdmin'] = 1;
$modversion['adminindex'] = 'admin/index.php';
$modversion['adminmenu'] =
array(
##[cubson:adminmenu]
    array(
        'title'    => _MI_MYUPLOADER_LANG_CATEGORY_LIST,
        'link'     => 'admin/index.php?op=CategoryList',
        'keywords' => _MI_MYUPLOADER_KEYWORD_CATEGORY_LIST,
        'show'     => true,
        'absolute' => false
    ),

    array(
        'title'    => _MI_MYUPLOADER_LANG_ADD_A_NEW_CATEGORY,
        'link'     => 'admin/index.php?op=CategoryEdit',
        'keywords' => _MI_MYUPLOADER_KEYWORD_CATEGORY_CREATE,
        'show'     => true,
        'absolute' => false
    ),

    array(
        'title'    => _MI_MYUPLOADER_LANG_IMAGE_LIST,
        'link'     => './index.php?op=ImageList',
        'keywords' => _MI_MYUPLOADER_KEYWORD_IMAGE_LIST,
        'show'     => true,
        'absolute' => false
    ),

    array(
        'title'    => _MI_MYUPLOADER_LANG_BLOCKS_ADMIN,
        'link'     => XOOPS_MODULE_URL.'/altsys/admin/index.php?mode=admin&lib=altsys&page=myblocksadmin&dirname='.$mydirname,
        'keywords' => _MI_MYUPLOADER_KEYWORD_BLOCKS_ADMIN,
        'show'     => true,
        'absolute' => true
    ),

    array(
        'title'    => _MI_MYUPLOADER_LANG_TEMPLATES_ADMIN,
        'link'     => XOOPS_MODULE_URL.'/altsys/admin/index.php?mode=admin&lib=altsys&page=mytplsadmin&dirname='.$mydirname,
        'keywords' => _MI_MYUPLOADER_KEYWORD_TEMPLATES_ADMIN,
        'show'     => true,
        'absolute' => true
    ),

    array(
        'title'    => _MI_MYUPLOADER_LANG_LANGUAGES_ADMIN,
        'link'     => XOOPS_MODULE_URL.'/altsys/admin/index.php?mode=admin&lib=altsys&page=mylangadmin&dirname='.$mydirname,
        'keywords' => _MI_MYUPLOADER_KEYWORD_LANGUAGES_ADMIN,
        'show'     => true,
        'absolute' => true
    )
##[/cubson:adminmenu]
);

//
// Public side control setting
//
$modversion['hasMain'] = 1;
$root = XCube_Root::getSingleton();
if($root->mContext->mUser->isInRole('Site.RegisteredUser')) {
    $module_handler = & xoops_gethandler('module');
    $module =& $module_handler->getByDirname($mydirname);
    if(is_object($module) && $module->get('isactive')) {
        require_once dirname(__FILE__).'/class/Global.class.php';
        $moduleGlobal =& Myuploader_Global::getInstance($mydirname);
        $subscribers =& $moduleGlobal->getSubscribers();
        if(in_array($root->mContext->mXoopsUser->get('uid'), array_keys($subscribers))) {
            $catid = xoops_getrequest('category_id');
            if(!empty($catid)) {
                $modversion['sub'][1]['name'] = constant($constpref.'_SUBMENU_POST');
                $modversion['sub'][1]['url'] = 'index.php?op=ImageEdit&amp;category_id='.intval($catid);
            }
            if(count($subscribers) > 1) {
                $modversion['sub'][2]['name'] = constant($constpref.'_SUBMENU_MY_IMAGE');
                $modversion['sub'][2]['url'] = 'index.php?op=ImageList&amp;uid='.$root->mContext->mXoopsUser->get('uid');
            }
        }
    }
}
##[cubson:submenu]
##[/cubson:submenu]

//
// Config setting
//
$i=1;
$modversion['config'][$i]['name'] = 'imagemanager_only';
$modversion['config'][$i]['title'] = $constpref.'_CONF_IMGMANAGER';
$modversion['config'][$i]['description'] = $constpref.'_CONF_IMGMANAGER_DSC';
$modversion['config'][$i]['formtype'] = 'yesno';
$modversion['config'][$i]['valuetype'] = 'int';
$modversion['config'][$i]['default'] = '0';
$i++;
$modversion['config'][$i]['name'] = 'num_per_page';
$modversion['config'][$i]['title'] = $constpref.'_CONF_NUMPERPAGE';
$modversion['config'][$i]['description'] = $constpref.'_CONF_NUMPERPAGE_DSC';
$modversion['config'][$i]['formtype'] = 'textbox';
$modversion['config'][$i]['valuetype'] = 'int';
$modversion['config'][$i]['default'] = 10;
$i++;
$modversion['config'][$i]['name'] = 'list_style';
$modversion['config'][$i]['title'] = $constpref.'_CONF_LISTSTYLE';
$modversion['config'][$i]['description'] = $constpref.'_CONF_LISTSTYLE_DSC';
$modversion['config'][$i]['formtype'] = 'select';
$modversion['config'][$i]['valuetype'] = 'text';
$modversion['config'][$i]['default'] = 'list';
$modversion['config'][$i]['options'] = array($constpref.'_CONF_LISTSTYLE_LIST' => 'list', $constpref.'_CONF_LISTSTYLE_ALBUM' => 'album');
$i++;
$modversion['config'][$i]['name'] = 'num_per_line';
$modversion['config'][$i]['title'] = $constpref.'_CONF_NUMPERLINE';
$modversion['config'][$i]['description'] = $constpref.'_CONF_NUMPERLINE_DSC';
$modversion['config'][$i]['formtype'] = 'textbox';
$modversion['config'][$i]['valuetype'] = 'text';
$modversion['config'][$i]['default'] = '4';
$i++;
$modversion['config'][$i]['name'] = 'highslide';
$modversion['config'][$i]['title'] = $constpref.'_CONF_HIGHSLIDE';
$modversion['config'][$i]['description'] = $constpref.'_CONF_HIGHSLIDE_DSC';
$modversion['config'][$i]['formtype'] = 'yesno';
$modversion['config'][$i]['valuetype'] = 'int';
$modversion['config'][$i]['default'] = '0';
$i++;
$modversion['config'][$i]['name'] = 'figure_tag';
$modversion['config'][$i]['title'] = $constpref.'_CONF_FIGURETAG';
$modversion['config'][$i]['description'] = $constpref.'_CONF_FIGURETAG_DSC';
$modversion['config'][$i]['formtype'] = 'yesno';
$modversion['config'][$i]['valuetype'] = 'int';
$modversion['config'][$i]['default'] = '0';
$i++;
$modversion['config'][$i]['name'] = 'image_lib';
$modversion['config'][$i]['title'] = $constpref.'_CONF_IMAGELIB';
$modversion['config'][$i]['description'] = $constpref.'_CONF_IMAGELIB_DSC';
$modversion['config'][$i]['formtype'] = 'select';
$modversion['config'][$i]['valuetype'] = 'text';
$modversion['config'][$i]['default'] = 'none';
$modversion['config'][$i]['options'] = array('------' => 'none', 'gd' => 'gd', 'imageMagick' => 'imagick', 'imagick_extension' => 'imagick_ext');
$i++;
$modversion['config'][$i]['name'] = 'upload_dir';
$modversion['config'][$i]['title'] = $constpref.'_CONF_UPLOADDIR';
$modversion['config'][$i]['description'] = $constpref.'_CONF_UPLOADDIR_DSC';
$modversion['config'][$i]['formtype'] = 'textbox';
$modversion['config'][$i]['valuetype'] = 'text';
$modversion['config'][$i]['default'] = '/uploads/'.$mydirname;
//$modversion['config'] = array(
/*
    array(
        'name'          => 'xxxx',
        'title'         => '_MI_MYUPLOADER_TITLE_XXXX',
        'description'   => '_MI_MYUPLOADER_DESC_XXXX',
        'formtype'      => 'xxxx',
        'valuetype'     => 'xxx',
        'options'       => array(xxx => xxx,xxx => xxx),
        'default'       => 0
    ),

##[cubson:config]
##[/cubson:config]
);*/

//
// Block setting
//
$modversion['blocks'][1]['file'] = 'myuploader_block.php';
$modversion['blocks'][1]['name'] = constant($constpref.'_BLOCK_LATEST_IMAGES');
$modversion['blocks'][1]['description'] = constant($constpref.'_BLOCK_LATEST_IMAGES_DSC');
$modversion['blocks'][1]['class'] = 'LatestImages';
$modversion['blocks'][1]['options'] = $mydirname.'|5|'; // for altsys-compatible to make a option form.
$modversion['blocks'][1]['template'] = '';
$modversion['blocks'][1]['func_num'] = 1;
$modversion['blocks'][1]['show_func'] = 'cl::'.$modversion['blocks'][1]['class'];     // for altsys-compatible to make a clone.
//$modversion['blocks'][1]['edit_func'] = $modversion['blocks'][1]['class'].'_edit';    // for altsys-compatible to make a option form.
$modversion['blocks'][1]['visible_any'] = false;
$modversion['blocks'][1]['show_all_module'] = true;
$modversion['blocks'][1]['can_clone'] = true;

$modversion['blocks'][2]['file'] = 'myuploader_block.php';
$modversion['blocks'][2]['name'] = constant($constpref.'_BLOCK_CATEGORY_LIST');
$modversion['blocks'][2]['description'] = constant($constpref.'_BLOCK_CATEGORY_LIST_DSC');
$modversion['blocks'][2]['class'] = 'CategoryList';
$modversion['blocks'][2]['options'] = $mydirname.'|0|'; // for altsys-compatible to make a option form.
$modversion['blocks'][2]['template'] = '';
$modversion['blocks'][2]['func_num'] = 2;
$modversion['blocks'][2]['show_func'] = 'cl::'.$modversion['blocks'][2]['class'];     // for altsys-compatible to make a clone.
//$modversion['blocks'][2]['edit_func'] = $modversion['blocks'][2]['class'].'_edit';    // for altsys-compatible to make a option form.
$modversion['blocks'][2]['visible_any'] = false;
$modversion['blocks'][2]['show_all_module'] = true;
$modversion['blocks'][2]['can_clone'] = true;
//$modversion['blocks'] = array(
/*
    x => array(
        'func_num'          => x,
        'file'              => 'xxx.php',
        'class'             => 'xxx',
        'name'              => _MI_MYUPLOADER_BLOCK_NAME_xxx,
        'description'       => _MI_MYUPLOADER_BLOCK_DESC_xxx,
        'options'           => '',
        'template'          => '{dirname}_block_xxx.html',
        'show_all_module'   => true,
        'visible_any'       => true
    ),

##[cubson:block]
##[/cubson:block]
);*/

?>