예제 #1
0
 function renderItems($items, $level = 0)
 {
     global $Controller;
     $r = '';
     $r .= '<ol class="' . ($level ? '' : 'list ') . 'bookitems bookitems_' . $level . '">';
     $i = 1;
     foreach ($items as $item) {
         if (!($o = $Controller->{$item['id']}(READ))) {
             continue;
         }
         $r .= '<li class="' . ($i++ % 2 ? 'odd' : 'even') . '">' . '<span class="fixed-width">' . $o->link() . '</span>' . Box::tools($o);
         if (isset($item['children'])) {
             $r .= self::renderItems($item['children'], $level + 1);
         }
         $r .= '</li>';
     }
     $r .= '</ol>';
     return $r;
 }
예제 #2
0
 function __toolListHelper($obj)
 {
     return $obj . Box::tools($obj);
 }
예제 #3
0
 /**
  * Generate the XHTML/CSS to administrate the folder
  * @return void
  */
 function genHTML()
 {
     $this->loadStructure();
     $this->fileExtCSS();
     global $CONFIG, $Controller;
     Head::add($CONFIG->UI->jQuery_theme . '/jquery-ui-*', 'css-lib');
     $r = '<div class="ui-helper-reset ui-helper-clearfix ui-widget-header ui-corner-all">' . '<span class="fixed-width">' . $this->pcrumbs() . '</span>' . Box::tools($this) . '</div>';
     $r .= '<ul class="filetree">';
     $i = 0;
     foreach ($this->folders as $cur) {
         if (!$cur->mayI(READ)) {
             continue;
         }
         $r .= '<li class="' . ($i % 2 ? 'odd' : 'even') . ' directory">' . '<span class="fixed-width"><a href="' . url(array('id' => $cur->ID), array('popup', 'filter')) . '" title="' . __('Open folder') . '">' . $cur . '</a></span>' . Box::tools($cur) . icon('large/down-16', __('Download'), url(array('id' => $cur->ID, 'action' => 'download'))) . '</li>';
         $i++;
     }
     $r .= '</ul>';
     global $SITE;
     if ($_REQUEST['popup'] == "ckeditor") {
         //http://docs.cksource.com/CKEditor_3.x/Developers_Guide/File_Browser_(Uploader)/Custom_File_Browser
         Head::add("function getUrlParam(paramName)\n\t\t{\n\t\t  var reParam = new RegExp('(?:[\\?&]|&amp;)' + paramName + '=([^&]+)', 'i') ;\n\t\t  var match = window.location.search.match(reParam) ;\n\n\t\t  return (match && match.length > 1) ? match[1] : '' ;\n\t\t}\n\t\tvar funcNum = getUrlParam('CKEditorFuncNum');\n\t\tvar fileUrl = 'https://www.ysektionen.se/';\n\t\t", 'js-raw');
         Head::add("function select(id) {try{window.opener.CKEDITOR.tools.callFunction(funcNum, 'https://www.ysektionen.se/'+id);} catch(err) {}window.close();}", 'js-raw');
     } else {
         if ($_REQUEST['popup']) {
             Head::add("function select(id) {try{window.opener.fileCallback(id,'{$_REQUEST['popup']}');} catch(err) {}window.close();}", 'js-raw');
         }
     }
     foreach ($this->files as $cur) {
         if (!$cur->mayI(READ)) {
             continue;
         }
         if ($_REQUEST['filter']) {
             switch ($_REQUEST['filter']) {
                 case 'images':
                 case 'documents':
                     if (!in_array(strtolower($cur->extension), $CONFIG->extensions->{$_REQUEST['filter']})) {
                         continue 2;
                     }
                     break;
                 default:
                     if (!stristr($cur->basename, $_REQUEST['filter'])) {
                         continue 2;
                     }
             }
         }
         $r .= '<li class="' . ($i % 2 ? 'odd' : 'even') . ' file ext_' . $cur->extension . '"><span class="fixed-width"';
         if ($_REQUEST['popup']) {
             $r .= '></span><a href="javascript: select(' . $cur->ID . ');"';
         }
         if ($cur->isImage()) {
             if (!$_REQUEST['popup']) {
                 $r .= '><span';
             }
             JS::lib('jquery/imgPreview');
             Head::add('#imgpreview{' . 'position:absolute;' . 'border:1px solid #ccc;' . 'background:#333;' . 'padding:5px;' . 'display:none;' . 'color:#fff;}', 'css-raw');
             $r .= ' class="imagepreview" rel="/' . $cur->ID . '?mw=100">' . $cur->basename;
             if (!$_REQUEST['popup']) {
                 $r .= '</span>';
             }
         } else {
             $r .= '>' . $cur->basename;
         }
         if ($_REQUEST['popup']) {
             $r .= '</a>';
         }
         $r .= '</span><div class="tools">' . Box::tools($cur) . '</div></li>';
         $i++;
     }
     return $r . '</ul>';
 }
예제 #4
0
 /**
  * Render the menu for editing
  * @param array $array
  * @return string
  */
 private function makeMenu($array)
 {
     static $i = 0;
     static $recursion = 0;
     if (count($array) == 0) {
         return;
     }
     ++$recursion;
     global $CONFIG, $USER;
     if ($this->mayI(EDIT)) {
         JS::loadjQuery(false);
         JS::lib('menusort');
     }
     /* $r=''; */
     $r = '<ul class="menulist">';
     $save = array('edit', 'with', 'id');
     while (list(, $obj) = each($array)) {
         $r .= '<li id="m' . $obj['id'] . '" class="' . (++$i % 2 ? 'odd' : 'even') . (is_a($obj['object'], 'MenuSection') ? ' menusection' : '') . '"><span class="fixed-width">' . $obj['object'] . '</span>' . Box::tools($obj['object']) . Box::dropdown('small/add', false, array(icon('small/arrow_right', __('New child page'), url(array('action' => 'newpage', 'where' => 'child', 'to' => $obj['id']), $save), true), icon('small/arrow_down', __('New page below'), url(array('action' => 'newpage', 'where' => 'below', 'to' => $obj['id']), $save), true))) . Box::dropdown('small/arrow_out', false, false, 'pagemove') . (isset($obj['children']) ? $this->makeMenu($obj['children']) : '') . '</li>';
     }
     $r .= '</ul>';
     --$recursion;
     if ($recursion == 0) {
         $i = 0;
     }
     return $r;
 }