| [ Index ] |
|
Code source de Horde 3.1.3 |
1 <?php 2 /** 3 * $Horde: horde/services/obrowser/index.php,v 1.6.10.5 2006/01/01 21:29:14 jan Exp $ 4 * 5 * Copyright 2004-2006 Charles J. Hagenbuch <chuck@horde.org> 6 * 7 * See the enclosed file COPYING for license information (LGPL). If you 8 * did not receive this file, see http://www.fsf.org/copyleft/lgpl.html. 9 */ 10 11 @define('HORDE_BASE', dirname(__FILE__) . '/../..'); 12 require_once HORDE_BASE . '/lib/base.php'; 13 require_once 'Horde/Template.php'; 14 15 $path = Util::getFormData('path'); 16 17 if (empty($path)) { 18 $list = array(); 19 $apps = $registry->listApps(null, false, PERMS_READ); 20 foreach ($apps as $app) { 21 if ($registry->hasMethod('browse', $app)) { 22 $list[$app] = array('name' => $registry->get('name', $app), 23 'icon' => $registry->get('icon', $app), 24 'browseable' => true); 25 } 26 } 27 } else { 28 $pieces = explode('/', $path); 29 $list = $registry->callByPackage($pieces[0], 'browse', array('path' => $path)); 30 } 31 32 if (is_a($list, 'PEAR_Error')) { 33 Horde::fatal($list, __FILE__, __LINE__); 34 } 35 if (!count($list)) { 36 Horde::fatal(_("Nothing to browse, go back."), __FILE__, __LINE__); 37 } 38 39 $tpl = <<<TPL 40 <script type="text/javascript"> 41 function chooseObject(oid) 42 { 43 if (!window.opener || !window.opener.obrowserCallback) { 44 return false; 45 } 46 47 var result = window.opener.obrowserCallback(window.name, oid); 48 if (!result) { 49 window.close(); 50 return; 51 } 52 53 alert(result); 54 return false; 55 } 56 </script> 57 58 <div class="header"> 59 <span class="rightFloat"><tag:close /></span> 60 <gettext>Object Browser</gettext> 61 </div> 62 <div class="headerbox"> 63 <table class="striped" cellspacing="0" style="width:100%"> 64 <loop:rows> 65 <tr> 66 <td> 67 <tag:rows.icon /> 68 <tag:rows.name /> 69 </td> 70 </tr> 71 </loop:rows> 72 </table> 73 </div> 74 TPL; 75 76 $rows = array(); 77 foreach ($list as $path => $values) { 78 $row = array(); 79 80 // Set the icon. 81 if (!empty($values['icon'])) { 82 $row['icon'] = Horde::img($values['icon'], $values['name'], '', ''); 83 } elseif (!empty($values['browseable'])) { 84 $row['icon'] = Horde::img('tree/folder.png'); 85 } else { 86 $row['icon'] = Horde::img('tree/leaf.png'); 87 } 88 89 // Set the name/link. 90 if (!empty($values['browseable'])) { 91 $url = Horde::applicationUrl('services/obrowser/'); 92 $url = Util::addParameter($url, 'path', $path); 93 $row['name'] = Horde::link($url) . $values['name'] . '</a>'; 94 } else { 95 $js = "return chooseObject('" . addslashes($path) . "');"; 96 $row['name'] = Horde::link('#', sprintf(_("Choose %s"), $values['name']), '', '', $js) . $values['name'] . '</a>'; 97 } 98 99 $rows[] = $row; 100 } 101 102 $template = &new Horde_Template(); 103 $template->setOption('gettext', true); 104 $template->set('rows', $rows); 105 $template->set('close', '<a href="#" onclick="window.close(); return false;">' . Horde::img('close.png') . '</a>'); 106 107 Horde::addScriptFile('stripe.js', 'horde', true); 108 require HORDE_TEMPLATES . '/common-header.inc'; 109 echo $template->parse($tpl); 110 require HORDE_TEMPLATES . '/common-footer.inc';
titre
Description
Corps
titre
Description
Corps
titre
Description
Corps
titre
Corps
| Généré le : Sun Feb 25 18:01:28 2007 | par Balluche grâce à PHPXref 0.7 |