예제 #1
0
            }
        }
    }
}
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
// COLLECTION //
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
$returnText .= '<h2>Gestione Collection & Media</h2>';
//
// SELEZIONA COLLECTION
$fDiv0 = 'divSelectCollection';
$collectionPath = DCTL_PROJECT_PATH . $collection_id . SYS_PATH_SEP;
getCollectionList(DCTL_PROJECT_PATH, &$collectionList, true);
//putOpenCloseLevel
$returnText .= putOpenLevel($fDiv0, $loc4msg, $collection_id != '', 'Seleziona una Collection (' . (count($collectionList['path']) - 1) . ')', &$resultMsg);
$returnText .= '<form id="form' . $fDiv0 . '" action="' . $_SERVER['PHP_SELF'] . '" method="' . DCTL_FORM_METHOD . '" enctype="' . DCTL_FORM_ENCTYPE . '">';
$returnText .= '<fieldset>';
$returnText .= '<label>Scegli:</label>';
$returnText .= SYS_DBL_SPACE;
$returnText .= '<select name="collection_id" onchange="javascript:submitform(\'form' . $fDiv0 . '\')">';
foreach ($collectionList['path'] as $key => $fPath) {
    $returnText .= '<option value="' . $fPath . '"';
    if ($fPath == $collectionPath) {
        $returnText .= ' selected="selected"';
    }
    $returnText .= '>';
    if ($fPath != '') {
        getCollectionRecord($fPath, &$collectionRecord);
        $returnText .= $collectionRecord['collection_full'];
    }
예제 #2
0
파일: functions.inc.php 프로젝트: net7/dCTL
function getManagementOfImages($fDivX, $labelX, $collection_id, $itemName, $loc4msg, &$fCount, $resultMsg)
{
    global $EXTENSION_ALLOWED;
    global $EXTENSION_TEXT;
    global $EXTENSION_GRAPHIC;
    $resultText = '';
    $array_estensioni_ammesse = $EXTENSION_ALLOWED;
    $basename = DCTL_PROJECT_PATH . $collection_id . SYS_PATH_SEP;
    $regexp = '[';
    foreach ($array_estensioni_ammesse as $k => $v) {
        if ($k > 0) {
            $regexp .= ' | ';
        }
        $regexp .= $v;
    }
    $regexp .= ']';
    $dPath = $basename . DCTL_MEDIA_SML;
    if (!is_dir($dPath)) {
        mkdir($dPath, CHMOD);
    }
    @chmod($dPath, CHMOD);
    $dPath = $basename . DCTL_MEDIA_MED;
    if (!is_dir($dPath)) {
        mkdir($dPath, CHMOD);
    }
    @chmod($dPath, CHMOD);
    $dPath = $basename . DCTL_MEDIA_BIG;
    if (!is_dir($dPath)) {
        mkdir($dPath, CHMOD);
    }
    @chmod($dPath, CHMOD);
    $dPath = $basename . DCTL_MEDIA_BIG;
    $variants = array();
    $handle = opendir($dPath);
    while ($entry = readdir($handle)) {
        if (substr($entry, 0, 1) != '.') {
            $variants[] = $entry;
        }
    }
    $variants = array_values(preg_grep('/.*' . $regexp . '/', $variants));
    $idx = count($variants);
    sort($variants);
    $fDiv0 = str_ireplace('$', '', $fDivX);
    $label0 = str_ireplace('$', '', $labelX);
    //putOpenCloseLevel
    $resultText .= putOpenLevel($fDiv0, $loc4msg, false, 'Gestione ' . $label0 . ' di "' . $itemName . '" (' . $idx . ')', &$resultMsg);
    $resultText .= '<table>';
    $resultText .= '<thead>';
    $resultText .= '<tr>';
    $resultText .= '<th class="label">operazione</th>';
    $resultText .= '<th>azione</th>';
    $resultText .= '<th>risultato</th>';
    $resultText .= '</tr>';
    $resultText .= '</thead>';
    $resultText .= '<tbody>';
    /* CARICA UNA IMMAGINE */
    $dPath = $basename . DCTL_MEDIA_BIG;
    $resultText .= '<tr>';
    $resultText .= '<td>Carica un nuovo file ...</td>';
    $resultText .= '<td>';
    $resultText .= '<form id="form' . $fDiv0 . '" action="' . $_SERVER['SCRIPT_NAME'] . '" method="' . DCTL_FORM_METHOD_POST . '" enctype="' . DCTL_FORM_ENCTYPE_POST . '">';
    $resultText .= '<fieldset>';
    $resultText .= '<input type="file" id="multi_file_upload" name="FILE' . $fCount . '" size="50" />';
    $resultText .= '<input type="hidden" name="PATH" value="' . $dPath . '" />';
    $resultText .= '<input type="hidden" name="posx" value="' . $fDiv0 . '" />';
    $resultText .= '<input type="hidden" name="ext" value="img" />';
    $resultText .= SYS_DBL_SPACE . SYS_DBL_SPACE . '<input type="submit" name="upload" value="invia" />';
    $resultText .= '<br /><strong>File da caricare</strong> (max 10): <div id="files_list"></div>
 <script>
	var multi_selector = new MultiSelector(document.getElementById("files_list"), 10);
	multi_selector.addElement(document.getElementById("multi_file_upload") );
 </script>
 ';
    $resultText .= '<input type="hidden" name="collection_id" value="' . $collection_id . '" />';
    $resultText .= '</fieldset>';
    $resultText .= '</form>';
    $resultText .= '</td>';
    $resultText .= '<td>&#160;</td>';
    $resultText .= '</tr>';
    /* VISUALIZZA LE ANTEPRIME */
    $dPath = $basename . DCTL_MEDIA_BIG;
    $resultText .= '<tr>';
    $resultText .= '<td>Visualizza l\'anteprima di un file...<br /><br />';
    $resultText .= '<form action="">';
    $resultText .= '<fieldset>';
    $resultText .= '<input type="text" id="mediaFilter" value="-trova-" onkeyup="var vFilter=this.value;
	$(\'#mediaList li\').removeClass(\'found\');
	var index = $(\'#mediaList li\').index($(\'#mediaList a\').filter(function(node){return ((this.text.toLowerCase().indexOf(vFilter)>=0)&&(vFilter!=\'\'))}).parent().addClass(\'found\'));
	" />';
    $resultText .= '</fieldset>';
    $resultText .= '</form>';
    $resultText .= '</td>';
    $resultText .= '<td colspan="2">';
    if (is_dir($dPath)) {
        $resultText .= '<ul  id="mediaList" class="trueContainer';
        if (true) {
            $resultText .= '2';
        }
        $resultText .= '">';
        //  $resultText .= '<script type="text/javascript" src="../js/imager.js"></script>';
        //  $resultText .= '<div id="motioncontainer" style="position:relative;overflow:hidden;">';
        // 	$resultText .= '<div id="motiongallery" style="position:absolute;left:0;top:0;white-space: nowrap;">';
        // 	$resultText .= '<span id="trueContainer">';
        $tail = '';
        $dPath2 = $dPath;
        //$dPath2 = str_ireplace(DCTL_MEDIA_SML, DCTL_MEDIA_BIG, $dPath);
        $files = scandir($dPath2);
        $filePattern = '/-(' . WS . '*)(.*)(' . WS . '*)=(' . WS . '*)$(' . WS . '*)-/';
        if ($dPath != '') {
            $entries = array();
            $handle = opendir($dPath);
            while ($entry = readdir($handle)) {
                if (substr($entry, 0, 1) != '.') {
                    $entries[] = $entry;
                }
            }
            sort($entries);
            foreach ($entries as $entry) {
                $ext = strtolower(substr($entry, -3, 3));
                if (in_array($ext, $array_estensioni_ammesse)) {
                    $labelval = str_ireplace('$', $entry, $filePattern);
                    $labelx = array_values(preg_grep($labelval, $files));
                    if (count($labelx) > 0) {
                        $label = $labelx[0];
                        $labelx = preg_split('/(' . WS . '*)=(' . WS . '*)/', $label, -1);
                        $label = str_ireplace('-', '', $labelx[0]);
                    } else {
                        $label = $entry;
                    }
                    if ($label != $entry) {
                        if (substr($label, 0, strlen($collection_id)) != $collection_id) {
                            $label = $collection_id . '-' . $label;
                        }
                        rename($dPath . $entry, $dPath . $label);
                        rename($dPath2 . $entry, $dPath2 . $label);
                        $entry = $label;
                    }
                    $value = $dPath . $entry;
                    $tail2 = '';
                    $tail2 .= '<li id="' . $entry . '"><a href="javascript:indexAjax(\'load_preview\', \'' . $fDiv0 . '-img\', \'' . $collection_id . '\', \'\', \'url=' . str_ireplace(FS_BASE_PATH, HOST_BASE_PATH, $value) . '\', \'posx=' . $fDiv0 . '\');" title="' . $label . '">';
                    $tail2 .= $label;
                    $tail2 .= '</a></li>';
                    $tail = $tail . $tail2;
                }
            }
        }
        // 	$resultText .= '</span>';
        $resultText .= $tail;
        $resultText .= '</ul>';
        $resultText .= '</div>';
        $resultText .= '</div>';
        $resultText .= '<div id="' . $fDiv0 . '-img">&#160;</div>';
    }
    $resultText .= '</td>';
    $resultText .= '</tr>';
    if (DCTL_USER_IS_ADMIN) {
        /* RIGENERA LE ANTEPRIME */
        $dPath = $basename . DCTL_MEDIA_BIG;
        $resultText .= '<tr>';
        $resultText .= '<td>Rigenera le anteprime...</td>';
        $resultText .= '<td>' . '<a onclick="javascript: doProgress();" href="' . $_SERVER['SCRIPT_NAME'] . '?createPreview=' . str_ireplace(FS_BASE_PATH, HOST_BASE_PATH, $dPath) . '&amp;collection_id=' . $collection_id . '&amp;posx=' . $fDivX . '" title="(???)">Procedi...</a>' . '</td>';
        $resultText .= '<td>' . '&#160;' . '</td>';
        $resultText .= '</tr>';
    }
    $resultText .= '</tbody>';
    $resultText .= '</table>';
    $resultText .= '<br /></div>';
    return $resultText;
}