$msg .= "<br>";
        }
    } else {
        $msg = $I18N->msg('pool_selectedmedia_error');
    }
}
// *************************************** SUBPAGE: "" -> MEDIEN ANZEIGEN
if (!isset($subpage) or $subpage == '') {
    $cats_sel = new select();
    $cats_sel->set_style("width:150px;");
    $cats_sel->set_size(1);
    $cats_sel->set_name("rex_file_category");
    $cats_sel->add_option($I18N->msg('pool_kats_no'), "0");
    $mediacat_ids = array();
    $rootCat = 0;
    if ($rootCats = OOMediaCategory::getRootCategories()) {
        foreach ($rootCats as $rootCat) {
            add_mediacat_options_wperm($cats_sel, $rootCat, $mediacat_ids);
        }
    }
    $cats_sel->set_selected($rex_file_category);
    echo "<table width=100% cellpadding=5 cellspacing=1 border=0 ><tr><td class=grey><b class=head>" . $I18N->msg('pool_file_list') . "</b></td></tr><tr><td></td></tr></table>";
    echo $cat_out;
    print "<table class=rex border=0 cellpadding=5 cellspacing=1 style='width:100%'>\n";
    print "<tr>\r\n    <th align=left class=icon></th>\r\n    <th align=left width=80><b>" . $I18N->msg('pool_file_thumbnail') . "</b></th>\r\n    <th align=left><b>" . $I18N->msg('pool_file_info') . "/ " . $I18N->msg('pool_file_description') . "</b></th>\r\n    <th align=left width=150><b>" . $I18N->msg('pool_file_functions') . "</b></th>\r\n    </tr>\n";
    if (isset($msg) and $msg != "") {
        print "<tr class=warning><td align=center><img src=pics/warning.gif width=16 height=16></td><td class=warning colspan=3>{$msg}</td></tr>";
        $msg = "";
    }
    //deletefilelist und cat change
    print "<form name=rex_file_list action=index.php method=post ENCTYPE=multipart/form-data>\n";
     $db->setValue('re_id', rex_request('cat_id', 'int'));
     $db->setValue('path', rex_request('catpath', 'string'));
     $db->addGlobalCreateFields();
     $db->addGlobalUpdateFields();
     if ($db->insert()) {
         $info = $I18N->msg('pool_kat_saved', stripslashes(rex_request('catname')));
         rex_deleteCacheMediaCategoryList(rex_request('cat_id', 'int'));
     } else {
         $warning = $db->getError();
     }
 }
 $link = 'index.php?page=mediapool' . $arg_url . '&amp;subpage=categories&amp;cat_id=';
 $textpath = '<li> : <a href="' . $link . '0">Start</a></li>';
 $cat_id = rex_request('cat_id', 'int');
 if ($cat_id == 0 || !($OOCat = OOMediaCategory::getCategoryById($cat_id))) {
     $OOCats = OOMediaCategory::getRootCategories();
     $cat_id = 0;
     $catpath = "|";
 } else {
     $OOCats = $OOCat->getChildren();
     // TODO getParentTree() verwenden
     $paths = explode("|", $OOCat->getPath());
     for ($i = 1; $i < count($paths); $i++) {
         $iid = current($paths);
         if ($iid != "") {
             $icat = OOMediaCategory::getCategoryById($iid);
             $textpath .= '<li> : <a href="' . $link . $iid . '">' . $icat->getName() . '</a></li>';
         }
         next($paths);
     }
     $textpath .= '<li> : <a href="' . $link . $cat_id . '">' . $OOCat->getName() . '</a></li>';
function rex_medienpool_Mediaform($form_title, $button_title, $rex_file_category, $file_chooser, $close_form)
{
    global $I18N, $REX, $REX_USER, $subpage, $ftitle;
    $s = '';
    $cats_sel = new rex_select();
    $cats_sel->setStyle('class="inp100"');
    $cats_sel->setSize(1);
    $cats_sel->setName('rex_file_category');
    $cats_sel->setId('rex_file_category');
    $cats_sel->addOption($I18N->msg('pool_kats_no'), "0");
    $mediacat_ids = array();
    $rootCat = 0;
    if ($rootCats = OOMediaCategory::getRootCategories()) {
        foreach ($rootCats as $rootCat) {
            rex_medienpool_addMediacatOptionsWPerm($cats_sel, $rootCat, $mediacat_ids);
        }
    }
    $cats_sel->setSelected($rex_file_category);
    if (isset($msg) and $msg != "") {
        $s .= rex_warning($msg);
        $msg = "";
    }
    if (!isset($ftitle)) {
        $ftitle = '';
    }
    $add_file = '';
    if ($file_chooser) {
        $devInfos = '';
        if ($REX_USER->hasPerm('advancedMode[]')) {
            $devInfos = '<span class="rex-notice">
         <span>' . $I18N->msg('pool_max_uploadsize') . ':</span> ' . OOMedia::_getFormattedSize(rex_ini_get('upload_max_filesize')) . '

         <!-- Upload-Temp-Dir: ' . rex_ini_get('upload_tmp_dir') . '
         Uploads: ' . (rex_ini_get('file_uploads') == 1 ? 'On' : 'Off') . '<br />
         Max-Upload-Time: ' . rex_ini_get('max_input_time') . 's   -->

       </span>';
        }
        $add_file = '<p>
                   <label for="file_new">' . $I18N->msg('pool_file_file') . '</label>
                   <input type="file" id="file_new" name="file_new" size="30" />
                   ' . $devInfos . '
                 </p>';
    }
    $add_submit = '';
    if (rex_session('media[opener_input_field]') != '') {
        $add_submit = '<input type="submit" class="rex-sbmt" name="saveandexit" value="' . $I18N->msg('pool_file_upload_get') . '"' . rex_accesskey($I18N->msg('pool_file_upload_get'), $REX['ACKEY']['SAVE']) . ' />';
    }
    $s .= '
  		<div class="rex-mpl-oth">
  		<form action="index.php" method="post" enctype="multipart/form-data">
           <fieldset>
             <legend class="rex-lgnd"><span >' . $form_title . '</span></legend>
               <input type="hidden" name="page" value="medienpool" />
               <input type="hidden" name="media_method" value="add_file" />
               <input type="hidden" name="subpage" value="' . $subpage . '" />
               <p>
                 <label for="ftitle">' . $I18N->msg('pool_file_title') . '</label>
                 <input type="text" size="20" id="ftitle" name="ftitle" value="' . htmlspecialchars(stripslashes($ftitle)) . '" />
               </p>
               <p>
                 <label for="rex_file_category">' . $I18N->msg('pool_file_category') . '</label>
                 ' . $cats_sel->get() . '
               </p>
               ' . $add_file . '
               <p class="rex-sbmt">
                 <input type="submit" name="save" value="' . $button_title . '"' . rex_accesskey($button_title, $REX['ACKEY']['SAVE']) . ' />
                 ' . $add_submit . '
               </p>
           </fieldset>
        ';
    if ($close_form) {
        $s .= '</form></div>' . "\n";
    }
    return $s;
}
Exemplo n.º 4
0
        /**
         * creates and returns the uploadform
         */
        public function createUploadForm()
        {
            global $REX, $I18N, $PERMALL;
            $rex_file_category = '';
            if (!$rex_file_category) {
                $rex_file_category = rex_session('media[rex_file_category]', 'int');
            }
            $output = '';
            $script_page_header = '';
            $uploadPath = "index.php?page=" . $this->myself . "&subpage=upload&upload_folder=" . $this->folder . "&faceless=1";
            if ($this->sync_cat) {
                // include cat sync select
                $cats_sel = new rex_select();
                $cats_sel->setStyle('class="inp100"');
                $cats_sel->setSize(1);
                $cats_sel->setName('rex_file_category');
                $cats_sel->setId('rex_file_category_' . $this->time);
                $cats_sel->addOption($I18N->msg('pool_kats_no'), "0");
                $mediacat_ids = array();
                $rootCat = 0;
                $PERMALL = TRUE;
                if ($rootCats = OOMediaCategory::getRootCategories()) {
                    foreach ($rootCats as $rootCat) {
                        rex_mediapool_addMediacatOptionsWPerm($cats_sel, $rootCat, $mediacat_ids);
                    }
                }
                $cats_sel->setSelected($rex_file_category);
            }
            if ($this->markup) {
                $output .= '
          <div class="rex-form">
            <fieldset class="rex-form-col-1">
              <legend>Multiupload</legend>
              <div class="rex-form-wrapper">' . "\n";
                if ($this->sync_cat) {
                    $output .= '
                <div class="rex-form-row">
                  <p class="rex-form-text">
                    <label for="rex_file_category">' . $I18N->msg('pool_file_category') . '</label>
                    ' . $cats_sel->get() . '
                  </p>
                </div>' . "\n";
                }
                $output .= '
                <div class="rex-form-row">
                <label>Upload:</label>' . "\n";
            }
            $output .= '
            <div id="multiupload' . $this->time . '" class="' . ($this->markup ? 'behave_normal' : 'styleless') . '">    
              <noscript>      
                <p>JavaScript muss aktiviert sein.</p>
              </noscript>         
            </div>';
            if ($this->markup) {
                $output .= '
              </div>';
                if (!$this->clear_uploadlist_automatically) {
                    $output .= '<div class="rex-form-row">
                  <p class="rex-form-text">
                    <label>Aktionen</label>
                    <a href="javascript:void(0)" onclick="clearUploadList();">Abgeschlossene / fehlerhafte aus der Liste entfernen</a>
                  </p>
                </div>' . "\n";
                }
            }
            $script_page_header .= '
            <script>
              
              function rex_multiupload_createUploader' . $this->time . '(){            
                var uploader = new qq.FileUploader({
                  element: document.getElementById("multiupload' . $this->time . '"),
                  action: "' . $uploadPath . '",
                  mediaPoolSelector: "rex_file_category_' . $this->time . '",
                  sizeLimit: 0, // max size   
                  minSizeLimit: 0, // min size';
            $script_page_header .= '
                  onSubmit: function(id,filename) {' . "\n";
            if ($this->clear_uploadlist_automatically) {
                $script_page_header .= '
                   clearUploadList();';
            }
            if ($this->onSubmitCallback) {
                $script_page_header .= '
                   
                   if(typeof ' . $this->onSubmitCallback . ' == "function") { 
                     // user callback function
                     ' . $this->onSubmitCallback . '(filename);
                   }';
            }
            $script_page_header .= '
                  },
                  ';
            $script_page_header .= '
                  onUpload: function(id,fileName, xhr) {' . "\n";
            if ($this->onUploadCallback) {
                $script_page_header .= '
                    
                    if(typeof ' . $this->onUploadCallback . ' == "function") { 
                      // user callback function
                      ' . $this->onUploadCallback . '(fileName, xhr);
                    }';
            }
            $script_page_header .= '
                  
                    
                  },
                  ';
            $script_page_header .= '
                  onProgress: function(id,fileName, loaded, total) {' . "\n";
            if ($this->onProgressCallback) {
                $script_page_header .= '
                    
                    if(typeof ' . $this->onProgressCallback . ' == "function") { 
                      // user callback function
                      ' . $this->onProgressCallback . '(fileName, loaded, total);
                    }';
            }
            $script_page_header .= '
                  
                    
                  },
                  ';
            $script_page_header .= '
                  onComplete: function(id,filename,json) {' . "\n";
            if ($this->clear_file_after_finish) {
                $script_page_header .= '                        
                    window.setTimeout(function(){
                      clearUploadListSuccess();
                    }, 5000);';
            }
            if ($this->onCompleteCallback) {
                $script_page_header .= '
                    
                    if(typeof ' . $this->onCompleteCallback . ' == "function" && json.success) { 
                      // user callback function
                      ' . $this->onCompleteCallback . '(json);
                    }';
            }
            $script_page_header .= '
                  
                    
                  },
                  ';
            $script_page_header .= '
                  onCancel: function(id,filename) {' . "\n";
            if ($this->onCancelCallback) {
                $script_page_header .= '
                    
                    if(typeof ' . $this->onCancelCallback . ' == "function") { 
                      // user callback function
                      ' . $this->onCancelCallback . '(filename);
                    }';
            }
            $script_page_header .= '
                  
                    
                  },
                  ';
            if ($this->upload_simultaneously && is_numeric($this->upload_simultaneously)) {
                $script_page_header .= ' 
                  maxConnections: ' . $this->upload_simultaneously . ',';
            }
            $script_page_header .= '
                  debug: ' . ($this->javascript_debug ? "true" : "false") . '
                });           
              }
              
              jQuery(document).ready(function(){
                rex_multiupload_createUploader' . $this->time . '();
              });
            </script>' . "\n";
            if ($this->markup) {
                if ($this->showFootnote) {
                    $output .= '<div class="rex-form-row edit_panel">
                  <label>Dateien editieren</label>
                    <ul class="qq-upload-list edit_uploads">

                    </ul>
                  </p>
                </div>' . "\n";
                }
            }
            if ($this->markup) {
                if ($this->showFootnote) {
                    $output .= '<div class="rex-form-row">
                  <p class="rex-form-file">
                    <span class="rex-form-notice">
                      Mehrfachauswahl mit STRG(WIN) oder CMD(MAC).<br />
                      Die Dateien werden automatisch in die ausgewählte Kategorie sychronisiert.
                      Ein Wechsel der Medienkategorie greift immer vor Auswahl einer Datei. 
                      Findet ein Upload bereits statt, kann für diese Datei die Kategorie nicht mehr verändert werden.
                    </span>
                  </p>
                </div>' . "\n";
                }
                $output .= '  
                </div>
                </fieldset>
                </div>' . "\n";
            }
            // Register EXTENSION POINT
            $header_func = 'return str_replace("<!-- ###MULTIUPLOAD_EP_REPLACE### -->",\'' . $script_page_header . '\'."<!-- ###MULTIUPLOAD_EP_REPLACE### -->",$params["subject"]);';
            rex_register_extension('OUTPUT_FILTER', create_function('$params', $header_func));
            // TIME FOR OUTPUT
            return $output;
        }
/**
 * Ausgabe des Medienpool Formulars
 */
function rex_mediapool_Mediaform($form_title, $button_title, $rex_file_category, $file_chooser, $close_form)
{
    global $I18N, $REX, $subpage, $ftitle, $warning, $info;
    $s = '';
    $cats_sel = new rex_select();
    $cats_sel->setStyle('class="rex-form-select"');
    $cats_sel->setSize(1);
    $cats_sel->setName('rex_file_category');
    $cats_sel->setId('rex_file_category');
    $cats_sel->addOption($I18N->msg('pool_kats_no'), "0");
    $mediacat_ids = array();
    $rootCat = 0;
    if ($rootCats = OOMediaCategory::getRootCategories()) {
        foreach ($rootCats as $rootCat) {
            rex_mediapool_addMediacatOptionsWPerm($cats_sel, $rootCat, $mediacat_ids);
        }
    }
    $cats_sel->setSelected($rex_file_category);
    if (isset($warning) and $warning != "") {
        $s .= rex_warning($warning);
        $warning = "";
    }
    if (isset($info) and $info != "") {
        $s .= rex_info($info);
        $info = "";
    }
    if (!isset($ftitle)) {
        $ftitle = '';
    }
    $add_file = '';
    if ($file_chooser) {
        $devInfos = '';
        if ($REX['USER']->hasPerm('advancedMode[]')) {
            $devInfos = '<span class="rex-form-notice">
         ' . $I18N->msg('phpini_settings') . ':<br />
         ' . (rex_ini_get('file_uploads') == 0 ? '<span>' . $I18N->msg('pool_upload') . ':</span> <em>' . $I18N->msg('pool_upload_disabled') . '</em><br />' : '') . '
         <span>' . $I18N->msg('pool_max_uploadsize') . ':</span> ' . OOMedia::_getFormattedSize(rex_ini_get('upload_max_filesize')) . '<br />
         <span>' . $I18N->msg('pool_max_uploadtime') . ':</span> ' . rex_ini_get('max_input_time') . 's
       </span>';
        }
        $add_file = '
                <div class="rex-form-row">
                  <p class="rex-form-file">
                    <label for="file_new">' . $I18N->msg('pool_file_file') . '</label>
                    <input class="rex-form-file" type="file" id="file_new" name="file_new" size="30" />
                    ' . $devInfos . '
                  </p>
                </div>';
    }
    $add_submit = '';
    if (rex_session('media[opener_input_field]') != '') {
        $add_submit = '<input type="submit" class="rex-form-submit" name="saveandexit" value="' . $I18N->msg('pool_file_upload_get') . '"' . rex_accesskey($I18N->msg('pool_file_upload_get'), $REX['ACKEY']['SAVE']) . ' />';
    }
    $s .= '
      <div class="rex-form" id="rex-form-mediapool-other">
        <form action="index.php" method="post" enctype="multipart/form-data">
          <fieldset class="rex-form-col-1">
            <legend>' . $form_title . '</legend>
            <div class="rex-form-wrapper">
              <input type="hidden" name="page" value="mediapool" />
              <input type="hidden" name="media_method" value="add_file" />
              <input type="hidden" name="subpage" value="' . $subpage . '" />
              
              <div class="rex-form-row">
                <p class="rex-form-text">
                  <label for="ftitle">' . $I18N->msg('pool_file_title') . '</label>
                  <input class="rex-form-text" type="text" size="20" id="ftitle" name="ftitle" value="' . htmlspecialchars(stripslashes($ftitle)) . '" />
                </p>
              </div>
              
              <div class="rex-form-row">
                <p class="rex-form-select">
                  <label for="rex_file_category">' . $I18N->msg('pool_file_category') . '</label>
                  ' . $cats_sel->get() . '
                </p>
              </div>

              <div class="rex-clearer"></div>';
    // ----- EXTENSION POINT
    $s .= rex_register_extension_point('MEDIA_FORM_ADD', '');
    $s .= $add_file . '
              <div class="rex-form-row">
                <p class="rex-form-submit">
                 <input class="rex-form-submit" type="submit" name="save" value="' . $button_title . '"' . rex_accesskey($button_title, $REX['ACKEY']['SAVE']) . ' />
                 ' . $add_submit . '
                </p>
              </div>

              <div class="rex-clearer"></div>
            </div>
          </fieldset>
        ';
    if ($close_form) {
        $s .= '</form></div>' . "\n";
    }
    return $s;
}
 function addCatOptions()
 {
     if ($this->rootId !== null) {
         if (is_array($this->rootId)) {
             foreach ($this->rootId as $rootId) {
                 if ($rootCat = OOMediaCategory::getCategoryById($rootId)) {
                     $this->addCatOption($rootCat);
                 }
             }
         } else {
             if ($rootCat = OOMediaCategory::getCategoryById($this->rootId)) {
                 $this->addCatOption($rootCat);
             }
         }
     } else {
         if ($rootCats = OOMediaCategory::getRootCategories()) {
             foreach ($rootCats as $rootCat) {
                 $this->addCatOption($rootCat);
             }
         }
     }
 }