}
    }
}
// *************************************** SUBPAGE: "" -> MEDIEN ANZEIGEN
if ($subpage == '') {
    $cats_sel = new rex_select();
    $cats_sel->setSize(1);
    $cats_sel->setStyle('class="rex-form-select"');
    $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);
    echo $cat_out;
    if (is_array($warning)) {
        if (count($warning) > 0) {
            echo rex_warning_block(implode('<br />', $warning));
        }
        $warning = '';
    } else {
        if ($warning != '') {
            echo rex_warning($warning);
            $warning = '';
        }
    }
예제 #2
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;
        }
예제 #3
0
/**
 * Fügt einen rex_select Objekt die hierarchische Medienkategorien struktur
 * hinzu unter berücksichtigung der Medienkategorierechte
 *
 * @param $select
 * @param $mediacat
 * @param $mediacat_ids
 * @param $groupName
 *
 * @deprecated since REDAXO 4.3
 * @see rex_mediacategory_select
 */
function rex_mediapool_addMediacatOptionsWPerm(&$select, &$mediacat, &$mediacat_ids, $groupName = '')
{
    global $PERMALL, $REX;
    if (empty($mediacat)) {
        return;
    }
    $mname = $mediacat->getName();
    if ($REX['USER']->hasPerm('advancedMode[]')) {
        $mname .= ' [' . $mediacat->getId() . ']';
    }
    $mediacat_ids[] = $mediacat->getId();
    if ($PERMALL || $REX['USER']->hasPerm('media[' . $mediacat->getId() . ']')) {
        $select->addOption($mname, $mediacat->getId(), $mediacat->getId(), $mediacat->getParentId());
    }
    $childs = $mediacat->getChildren();
    if (is_array($childs)) {
        foreach ($childs as $child) {
            rex_mediapool_addMediacatOptionsWPerm($select, $child, $mediacat_ids, $mname);
        }
    }
}
/**
 * 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 rex_medienpool_addMediacatOptionsWPerm(&$select, &$mediacat, &$mediacat_ids, $groupName = '')
{
    return rex_mediapool_addMediacatOptionsWPerm($select, $mediacat, $mediacat_ids, $groupName);
}