コード例 #1
0
 function get_content(&$arguments, $properties)
 {
     $title = '';
     if ($arguments['menutree']) {
         $this->expandedcats = array_keys($arguments['menutree']);
     } else {
         $this->expandedcats = array();
     }
     $topcats = $GLOBALS['objbo']->getCatLinks(0, False);
     $content = "<script type='text/javascript'>\n// the whole thing only works in a DOM capable browser or IE 4*/\n\nfunction add(catid)\n{\n\tdocument.cookie = 'block[" . $this->block->id . "][menutree][' + catid + ']=';\n}\n\nfunction remove(catid)\n{\n\tvar now = new Date();\n\tdocument.cookie = 'block[" . $this->block->id . "][menutree][' + catid + ']=; expires=' + now.toGMTString();\n}\n\nfunction toggle(image, catid)\n{\n\tif (document.getElementById)\n\t{ //DOM capable\n\t\tstyleObj = document.getElementById(catid);\n\t}\n\telse //we're helpless\n\t{\n\treturn \n\t}\n\n\tif (styleObj.style.display == 'none')\n\t{\n\t\tadd(catid);\n\t\timage.src = 'images/tree_collapse.gif';\n\t\tstyleObj.style.display = 'block';\n\t}\n\telse\n\t{\n\t\tremove(catid);\n\t\timage.src = 'images/tree_expand.gif';\n\t\tstyleObj.style.display = 'none';\n\t}\n}\n</script>";
     if (count($topcats) == 0) {
         $content = lang('You do not have access to any content on this site.');
     } else {
         $content .= "\n" . '<table border="0" cellspacing="0" cellpadding="0" width="100%">' . $this->showcat($topcats) . '</table>' . "\n";
         $content .= '<br/><a href="' . sitemgr_link('toc=1') . '"><font size="1">(' . lang('Table of contents') . ')</font></a>';
     }
     return $content;
 }
コード例 #2
0
 function make_link($vars)
 {
     switch ($vars[2]) {
         case 'phpgw':
             $params = explode(',', $vars[3]);
             switch (count($params)) {
                 case 0:
                     return '';
                 case 1:
                     return phpgw_link($params[0]);
                 case 2:
                     return phpgw_link($params[0], $params[1]);
                 default:
                     return $vars[0];
             }
             //sitemgr link
         //sitemgr link
         default:
             return sitemgr_link($vars[3]);
     }
 }
コード例 #3
0
function sitemgr_link2($url, $extravars = '')
{
    //I remove the URL argument for sitemgr_link,since it should always be index.php
    //which shouldn't be needed since the webserver interprets '/' as '/index.php'.
    return sitemgr_link($extravars);
}
コード例 #4
0
 function link($modulevars = array(), $extravars = array())
 {
     if (is_array($modulevars)) {
         foreach ($modulevars as $key => $value) {
             $extravars['block[' . $this->block->id . '][' . $key . ']'] = $value;
         }
     }
     if ($GLOBALS['page']->name) {
         $extravars['page_name'] = $GLOBALS['page']->name;
     } elseif ($GLOBALS['page']->cat_id) {
         $extravars['category_id'] = $GLOBALS['page']->cat_id;
     } elseif ($GLOBALS['page']->toc) {
         $extravars['toc'] = 1;
     } elseif ($GLOBALS['page']->index) {
         $extravars['index'] = 1;
     }
     return sitemgr_link($extravars);
 }
コード例 #5
0
 function getCatLinks($cat_id = 0, $recurse = true, $description = False)
 {
     $catlinks = array();
     $cat_list = $this->catbo->getpermittedcatsRead($cat_id, $recurse);
     foreach ($cat_list as $cat_id) {
         $category = $this->getcatwrapper($cat_id);
         $catlinks[$cat_id] = array('name' => $category->name, 'link' => '<a href="' . sitemgr_link('category_id=' . $cat_id) . ($description ? '" title="' . $category->description : '') . '">' . $category->name . '</a>', 'description' => $category->description, 'depth' => $category->depth);
         if ($GLOBALS['sitemgr_info']['mode'] != 'Edit') {
             $catlinks[$cat_id]['link'] = $category->name;
         }
     }
     return $catlinks;
 }
コード例 #6
0
 function get_content(&$arguments, $properties)
 {
     $show = $arguments['show'] ? $arguments['show'] : 1;
     $download = @$_GET['download'];
     if ($show & 4 && $download && ($arguments['only_allowed'] && in_array($download, $arguments['allowed'])) || !$arguments['only_allowed'] && isset($this->themes[$download])) {
         $zip = @$arguments['zip'] ? $arguments['zip'] : 'zip';
         ob_end_clean();
         // discard all previous output
         $browser = CreateObject('phpgwapi.browser');
         $browser->content_header($download . '.zip', 'application/zip');
         passthru('cd ' . $GLOBALS['sitemgr_info']['site_dir'] . '/templates; ' . $zip . ' -qr - ' . $download);
         exit;
     }
     if (count($arguments['only_allowed'] ? $arguments['allowed'] : $this->themes) > 1) {
         if ($show == 1 || $show == 8) {
             $link = $this->link();
             $link .= (strchr($link, '?') ? '&' : '?') . 'themesel=';
             $content .= '<form name="themeselect" method="post">' . "\n";
             if ($show == 8) {
                 $content .= '<img width="140" height="110" name="preview" src="' . $this->themes[$GLOBALS['sitemgr_info']['themesel']]['thumbnail'] . '"><br />' . "\n";
                 $content .= '<select onChange="document.images.preview.src=\'templates/\'+this.value+\'/template_thumbnail.png\'" name="themesel">' . "\n";
             } else {
                 $content .= '<select onChange="location.href=\'' . $link . '\'+this.value" name="themesel">' . "\n";
             }
             foreach ($this->themes as $name => $info) {
                 if ($arguments['only_allowed'] && !in_array($name, $arguments['allowed'])) {
                     continue;
                 }
                 $title = $info['title'] ? ' title="' . $info['title'] . '"' : '';
                 $content .= '<option ' . ($name == $GLOBALS['sitemgr_info']['themesel'] ? 'selected="1" ' : '') . 'value="' . $name . '"' . ($info['title'] ? ' title="' . $info['title'] . '"' : '') . '>' . $info['name'] . '</option>' . "\n";
             }
             $content .= '</select>' . "\n";
             if ($show == 8) {
                 $content .= '<br ><input type="submit" value="' . lang('Select') . '" onclick="location.href=\'' . $link . '\'+this.form.themesel.value; return false;">' . "\n";
             }
             $content .= '</form>' . "\n";
         }
         if ($show & 2) {
             $t = CreateObject('phpgwapi.Template', $GLOBALS['phpgw']->common->get_tpl_dir('sitemgr'));
             $t->set_file('theme_info', 'theme_info.tpl');
             $t->set_block('theme_info', 'info_block');
             $content .= '<table>' . "\n";
             foreach ($this->themes as $name => $info) {
                 //if ($name == 'realss' || $name == 'peeklime') echo "$name=<pre>".print_r($info,true)."</pre>\n";
                 if ($arguments['only_allowed'] && !in_array($name, $arguments['allowed'])) {
                     continue;
                 }
                 if ($further) {
                     $content .= '<tr><td colspan="2"><hr style="width: 30%" /></td></tr>' . "\n";
                 }
                 $further = True;
                 $info['thumbnail'] = $info['thumbnail'] ? '<img src="' . $info['thumbnail'] . '" border="0" hspace="5"/>' : '<div style="text-align:center; font-weight:bold; border:2px ridge black; background-color:white; padding-top:60px; padding-bottom:60px; width:200px;">' . lang('No thumbnail availible') . '</div>';
                 if ($show & 1) {
                     $info['thumbnail'] = '<a href="' . sitemgr_link(array('themesel' => $name) + $_GET) . '" title="' . lang('View template on this site') . '">' . $info['thumbnail'] . '</a>';
                 }
                 if ($show & 4) {
                     $info['copyright'] .= '<p style="font-size: 10pt;"><a href="' . sitemgr_link(array('download' => $name) + $_GET) . '">' . '<img src="images/zip.gif" border="0" /> ' . lang('download as ZIP-archiv') . '</a></p>' . "\n";
                 }
                 $t->set_var($info);
                 $t->set_var(array('lang_author' => lang('Author'), 'lang_copyright' => lang('Copyright')));
                 $content .= $t->parse('out', 'info_block');
             }
             $content .= '</table>' . "\n";
         }
         return $content;
     }
     return lang('No templates found.');
 }