if ($fPath != '') { getPackageRecord($fPath, &$packageRecord); $returnText .= $packageRecord['package_full']; } $returnText .= '</option>'; } $returnText .= '</select>'; $returnText .= SYS_DBL_SPACE . '<input class="action" type="image" src="' . DCTL_IMAGES . 'action_refresh_blue.gif" />'; $returnText .= '<input type="hidden" name="selectPack" value="seleziona" />'; $returnText .= '<input type="hidden" name="collection_id" value="' . $collection_id . '" />'; $returnText .= '<input type="hidden" name="posx" value="' . $fDiv0 . '" />'; $returnText .= '</fieldset>'; $returnText .= '</form>'; $prosecute = in_array($packagePath, $packageList['path']); if ($prosecute) { getPackageRecord($packagePath, &$packageRecord); $package_short = $packageRecord['package_short']; $returnText .= '<h2>Package "' . $packageRecord['package_short'] . ' - ' . $packageRecord['package_work'] . '"</h2>'; $package_ext = explode('_', $package_id); $package_ext = strtolower('_' . $package_ext[count($package_ext) - 1]); if (!in_array($package_ext, $EXTENSION_PACKAGE)) { $returnText .= '<span class="error">ERRORE: correggere il package "' . $packageRecord['package_short'] . '" ... estensione non riconosciuta!</span><br />'; } else { $header = $packagePath . DCTL_FILE_HEADER; $contents = cleanUpIndentation(file_get_contents($header)); $select = $PACKAGE_FIELDS['label']; // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // // EDIT PACKAGE $fDiv0 = 'divEditPackage'; $returnText .= putOpenCloseLevel($fDiv0, $loc4msg, $isEditPackage, 'Frontespizio Elettronico di "' . $package_short . '"', &$resultMsg);
$returnText = ''; // setup engine if ($doc != '') { // start engine $doc_combo = explode('://', $doc); $prefix = $doc_combo[0]; $doc = isset($doc_combo[1]) ? $doc_combo[1] : $doc; $doc_exploded = explode(DCTL_RESERVED_INFIX, $doc); $db_collection = isset($doc_exploded[0]) ? $doc_exploded[0] : ''; switch ($where) { case 'head': // IDENTIFICA IL DOC global $exist; $xml_resource = XMLDB_PATH_BASE . $db_collection . DB_PATH_SEP . $doc; $packageRecord = array(); getPackageRecord($exist, $xml_resource, &$packageRecord); switch ($what) { case 'collection': $returnText .= $packageRecord['collection']; break; case 'package': $returnText .= $packageRecord['short']; break; default: $returnText .= '<div class="error">' . $what . '</div>'; break; } break; case 'palette': $title = 'Palette'; $goto = $title;
function getPackageList($exist, $thePath, &$packageList, $filter = array(), $sortBy = 'date', $withEmpty = false) { $packageList = array(); if ($withEmpty) { $packageList['ref'][] = ''; $packageList['desc'][] = ''; $packageList['path'][] = ''; $packageList['type'][] = ''; $packageList['author'][] = ''; $packageList['title'][] = ''; $packageList['publisher'][] = ''; $packageList['date'][] = ''; $packageList['id'][] = ''; $packageList['short'][] = ''; $packageList['collection'][] = ''; $packageList['full'][] = ''; } if ($thePath != '') { $packageRecord = array(); $packages = $exist->getCollections($thePath); foreach ((array) $packages->resources->elements as $key => $package) { $package_id = explode(DCTL_RESERVED_INFIX, $package); $collection_id = $package_id[0]; $package_id = $package_id[1]; if ($package_id[0] != DCTL_RESERVED_PREFIX) { $ext = substr($package_id, -8, 4); if (count(array_filter($filter)) == 0 || in_array($ext, $filter)) { $thePath2 = $thePath . DB_PATH_SEP . $package; $packageList[$key]['ref'] = $package; getPackageRecord($exist, $thePath2, &$packageRecord); $packageList[$key]['path'] = $packageRecord['path']; $packageList[$key]['desc'] = $packageRecord['desc']; $packageList[$key]['type'] = $packageRecord['type']; $packageList[$key]['author'] = $packageRecord['author']; $packageList[$key]['title'] = $packageRecord['title']; $packageList[$key]['publisher'] = $packageRecord['publisher']; $packageList[$key]['date'] = $packageRecord['date']; $packageList[$key]['id'] = $packageRecord['id']; $packageList[$key]['short'] = $packageRecord['short']; $packageList[$key]['collection'] = $packageRecord['collection']; $packageList[$key]['full'] = $packageRecord['full']; } } } } // asort($packageList); $docx = array(); $packageList2 = array(); foreach ($packageList as $k => $package) { $packageList2[$package['ref']] = $package[$sortBy]; } asort($packageList2); foreach ($packageList2 as $packRef => $dummy) { foreach ($packageList as $key => $package) { if ($package['ref'] == $packRef) { $docx[$key] = $package; } } } $packageList = $docx; }
function ajax_loadFullTree($upToLevel = 0, $collection_id = '', $media_id = '', $package_id = '', $part_id = '') { $resultText = ''; // BEGIN $basePath = DCTL_PROJECT_PATH; $collectionPath = $basePath . $collection_id; if ($collection_id == '' || $upToLevel == 1) { // ALL COLLECTIONS $resultText .= '<ul>'; getCollectionList($basePath, &$collectionList); foreach ($collectionList['path'] as $key => $fPath) { getCollectionRecord($fPath, &$collectionRecord); $selected = $collection_id == $collectionRecord['collection_id']; $resultText .= '<li' . ($selected ? ' class="open"' : '') . '>'; $resultText .= '<span class="text"><span class="collection ' . ($selected ? ' selected' : '') . '">' . $collectionRecord['collection_full'] . '</span></span>'; if ($selected) { $resultText .= ajax_loadTree(2, $collection_id, $media_id, $package_id, $part_id, $what); } else { $resultText .= '<ul' . ($selected ? '' : ' class="ajax"') . '>'; $resultText .= '<li>{url:indexAjax.php?action=ajax_loadFullTree&collection_id=' . $collectionRecord['collection_id'] . '}</li>'; $resultText .= '</ul>'; } $resultText .= '</li>'; } $resultText .= '<li class="add"><span class="text">aggiungi Collection...</span></li>'; $resultText .= '</ul>'; } else { // ONE COLLECTION if ($package_id == '' && $media_id == '' || $upToLevel == 2) { $resultText .= '<ul>'; $resultText .= '<li class="edit"><span class="text">edit Collection...</span></li>'; $resultText .= '<li class="publish"><span class="text">Pubblicazione Web</span>'; $resultText .= '<a href="#" title="Pubblica" class="publish"><span class="hidden">Pubblica</span></a>'; $resultText .= '<a href="#" title="Ritira" class="unpublish"><span class="hidden">Ritira</span></a>'; $resultText .= '</li>'; // LOAD PACKAGES $resultText .= '<li' . ($package_id != '' ? ' class="open"' : '') . '>'; $resultText .= '<span class="text">Gestione Package</span>'; if ($package_id != '') { $resultText .= ajax_loadTree(3, $collection_id, '', $package_id, $part_id, $what); } else { $resultText .= '<ul' . ($package_id == '' ? ' class="ajax"' : '') . '>'; $resultText .= '<li>{url:indexAjax.php?action=ajax_loadFullTree&collection_id=' . $collection_id . '&package_id=*}</li>'; $resultText .= '</ul>'; } $resultText .= '</li>'; // LOAD MEDIA $resultText .= '<li' . ($media_id != '' ? ' class="open"' : '') . '>'; $resultText .= '<span class="text">Gestione Media</span>'; if ($media_id != '') { $resultText .= ajax_loadTree(3, $collection_id, $media_id, '', $part_id, $what); } else { $resultText .= '<ul' . ($media_id == '' ? ' class="ajax"' : '') . '>'; $resultText .= '<li>{url:indexAjax.php?action=ajax_loadFullTree&collection_id=' . $collection_id . '&media_id=*}</li>'; $resultText .= '</ul>'; } $resultText .= '</li>'; $resultText .= '</ul>'; } else { if ($package_id != '') { if ($package_id == '*' || $upToLevel == 3) { // ALL PACKAGES $basePath = $collectionPath; $packagePath = $basePath . $package_id; $resultText .= '<ul>'; getPackageList($basePath, &$packageList); foreach ($packageList['path'] as $key => $fPath) { getPackageRecord($fPath, &$packageRecord); $selected = $package_id == $packageRecord['package_id']; $resultText .= '<li' . ($selected ? ' class="open"' : '') . '>'; $resultText .= '<span class="text"><span class="package' . ($selected ? ' selected' : '') . '">' . $packageRecord['package_full'] . '</span></span>'; if ($selected) { $resultText .= ajax_loadTree(4, $collection_id, '', $package_id, $part_id, $what); } else { $resultText .= '<ul' . ($selected ? '' : ' class="ajax"') . '>'; $resultText .= '<li>{url:indexAjax.php?action=ajax_loadFullTree&collection_id=' . $collection_id . '&package_id=' . $packageRecord['package_id'] . '}</li>'; $resultText .= '</ul>'; } $resultText .= '</li>'; } $resultText .= '<li class="add"><span class="text">aggiungi Package...</span></li>'; $resultText .= '</ul>'; } else { if ($part_id == '' || $upToLevel == 4) { $resultText .= '<ul>'; $resultText .= '<li class="edit"><span class="text">edit Package...</span></li>'; $resultText .= '<li class="publish"><span class="text">Pubblicazione Web</span>'; $resultText .= '<a href="#" title="Pubblica" class="publish"><span class="hidden">Pubblica</span></a>'; $resultText .= '<a href="#" title="Ritira" class="unpublish"><span class="hidden">Ritira</span></a>'; $resultText .= '</li>'; // LOAD PARTS $resultText .= '<li' . ($part_id != '' ? ' class="open"' : '') . '>'; $resultText .= '<span class="text">Gestione Part</span>'; if ($part_id != '') { $resultText .= ajax_loadTree(5, $collection_id, '', $package_id, $part_id, $what); } else { $resultText .= '<ul' . ($part_id == '' ? ' class="ajax"' : '') . '>'; $resultText .= '<li>{url:indexAjax.php?action=ajax_loadFullTree&collection_id=' . $collection_id . '&package_id=' . $package_id . '&part_id=*}</li>'; $resultText .= '</ul>'; } $resultText .= '</li>'; $resultText .= '</ul>'; } else { // ALL PARTS $basePath = $collectionPath . $package_id . SYS_PATH_SEP; $partPath = $basePath . $part_id; $resultText .= '<ul>'; getPartList($basePath, &$partList); foreach ($partList['path'] as $key => $fPath) { getPartRecord($fPath, &$partRecord); $selected = $part_id == $partRecord['part_id']; $resultText .= '<li' . ($selected ? ' class="open"' : '') . '>'; $resultText .= '<span class="text"><span class="part' . ($selected ? ' selected' : '') . '">' . cleanWebString($partRecord['part_short'] . ' - ' . $partRecord['part_work'], FIELD_STRING_LENGTH) . SYS_DBL_SPACE . '</span></span>'; $resultText .= '<a href="#" title="Scarica" class="dnload"><span class="hidden">Scarica</span></a>'; $resultText .= '<a href="#" title="Ricarica" class="upload"><span class="hidden">Ricarica</span></a>'; $resultText .= '</li>'; } $resultText .= '<li class="add"><span class="text">aggiungi Part...</span></li>'; $resultText .= '</ul>'; } } } if ($media_id != '') { // ALL MEDIA $basePath = $collectionPath . DCTL_MEDIA_BIG; $mediaPath = $basePath . $media_id; $resultText .= '<ul>'; getMediaList($basePath, &$mediaList); foreach ($mediaList['path'] as $key => $fPath) { getMediaRecord($fPath, &$mediaRecord); $selected = $media_id == $mediaRecord['media_id']; $resultText .= '<li' . ($selected ? ' class="open"' : '') . '>'; $resultText .= '<span class="text"><span class="media' . ($selected ? ' selected' : '') . '">' . cleanWebString($mediaRecord['media_short'] . ' - ' . $mediaRecord['media_work'], FIELD_STRING_LENGTH) . SYS_DBL_SPACE . '</span></span>'; $resultText .= '<a href="#" title="Aggiorna" class="update"><span class="hidden">Aggiorna</span></a>'; $resultText .= '<a href="#" title="Elimina" class="delete"><span class="hidden">Elimina</span></a>'; $resultText .= '</li>'; } $resultText .= '<li class="add"><span class="text">aggiungi Media...</span></li>'; $resultText .= '</ul>'; } } } return $resultText; }