예제 #1
0
    $returnText .= '</div>';
    $returnText .= '<div id="lnk_result" class="lnk_result"></div>';
    $returnText .= '<div class="imt">' . $flashMarkup . '</div>';
    $returnText .= '</div>';
} else {
    $returnText .= '<div class="lnk_left">';
    $returnText .= '<div class="lineH1">Collection</div>';
    $returnText .= '<div class="lnk_col">';
    $returnText .= '<form>';
    $returnText .= '<fieldset>';
    $basePath = DCTL_PROJECT_PATH;
    getCollectionList($basePath, &$collectionList);
    foreach ($collectionList['path'] as $key => $fPath) {
        getCollectionRecord($fPath, &$collectionRecord);
        $returnText .= '<input type="radio" name="collection_id[]" value="' . $collectionRecord['collection_id'] . '" />';
        $returnText .= '<label class="text" onclick="$(this).prev().click();"> ' . cleanWebString($collectionRecord['collection_short'], FIELD_STRING_LENGTH) . '</label>';
        $returnText .= '<br/>';
    }
    $returnText .= '</fieldset>';
    $returnText .= '</form>';
    $returnText .= '</div>';
    $returnText .= '<div class="lineH1">Codice XML</div>';
    $returnText .= '<div id="xml_chunk"></div>';
    $returnText .= '</div>';
    $returnText .= '<div class="lnk_right">';
    $returnText .= '<div class="src_col">';
    $returnText .= '<div class="lineH1">Selettore ID</div>';
    $returnText .= '<div id="xml_tree1" class="src_tree">';
    $returnText .= '</div>';
    $returnText .= '</div>';
    $returnText .= '<div class="src_col">';
예제 #2
0
 $returnText .= '</thead>';
 $returnText .= '<tbody>';
 $lines = explode('<!ENTITY ', $contents);
 foreach ($select as $field => $label) {
     $linex = array_values(preg_grep('/' . $field . '.*/i', $lines));
     if (!isset($linex[0])) {
         // aggiunge parametro
         $linex[0] = '<!ENTITY ' . $field . ' "">';
     }
     $line = $linex[0];
     if (stripos($line, $field) !== FALSE) {
         $linex = explode('"', $line);
         $value = $linex[1];
         $valueString = cleanWebString($value);
         $valueCode = normalize($value);
         $valueText = str_ireplace('$NL$', "\n", cleanWebString(str_ireplace('<lb />', '$NL$', $value)));
         $returnText .= '<tr>';
         $returnText .= '<td>' . $label . '</td>';
         $returnText .= '<td>';
         if ($isEditPackage) {
             switch ($PACKAGE_FIELDS['type'][$field]) {
                 case 'id':
                     $returnText .= '<strong>' . $valueCode . '</strong><br />' . '</td>';
                     $returnText .= '<input type="hidden" name="' . $field . '" value="' . $valueCode . '" />';
                     break;
                 case 'auto':
                     $returnText .= '<strong>' . $value . '</strong><br />' . '</td>';
                     $returnText .= '<input type="hidden" name="' . $field . '" value="' . $valueString . '" />';
                     break;
                 case 'code':
                     if ($valueCode == '') {
예제 #3
0
파일: core.php 프로젝트: noveopiu/dCTL
 protected function _get_package_record($justRefs = false, $thePath = '', &$packageRecord)
 {
     // | Returns a record for the resource:
     // | 'kind'           : framework's kind of resource (package)
     // | 'id'             : user defined mnemonic identifier
     // | 'ref'            : framework's unique identifier, must be used as a reference to the resource
     // | 'path'           : framework's unique path to the resource in the xmldb
     // | 'short'          : user defined short mnemonic identifier
     // | 'full'           : framework's composite identifier
     // | 'desc'           : user defined description
     // | 'collection_ref' : framework's unique identifier, must be used as a reference to the resource
     // | 'collection'     : user defined mnemonic identifier
     // | 'type'           : framework's type of resource
     // | 'author'         : <teiHeader> field
     // | 'title'          : <teiHeader> field
     // | 'publisher'      : <teiHeader> field
     // | 'pubplace'      : <teiHeader> field
     // | 'date'           : <teiHeader> field
     $packageRecord = array();
     $packageRecord['kind'] = '';
     $packageRecord['ref'] = '';
     $packageRecord['path'] = '';
     $packageRecord['short'] = '';
     $packageRecord['type'] = '';
     $packageRecord['date'] = '';
     $packageRecord['collection_ref'] = '';
     if (!$justRefs) {
         $packageRecord['id'] = '';
         $packageRecord['full'] = '';
         $packageRecord['desc'] = '';
         $packageRecord['collection'] = '';
         $packageRecord['author'] = '';
         $packageRecord['title'] = '';
         $packageRecord['publisher'] = '';
         $packageRecord['pubplace'] = '';
     }
     $package_id = basename($thePath);
     $package_id = explode(DCTL_RESERVED_INFIX, $package_id);
     $collection_id = isset($package_id[0]) ? $package_id[0] : '';
     $package_id = isset($package_id[1]) ? $package_id[1] : '';
     if ($package_id != '') {
         $thePath = dirname($thePath) . DB_PATH_SEP;
         $xml_resource = $thePath . $collection_id . DCTL_RESERVED_INFIX . $package_id;
         $ext = str_ireplace('.xml', '', $package_id);
         $ext = substr($ext, -4, 4);
         $xquery = DCTL_XQUERY_BASE;
         $xquery .= "\n" . ' let $node := doc("' . $xml_resource . '")/tei:TEI ';
         $xquery .= "\n" . ' let $node1 := $node//tei:samplingDecl/tei:p ';
         $xquery .= "\n" . ' let $node2 := $node//tei:sourceDesc/tei:biblFull[contains(@n,\'source\')]/tei:publicationStmt ';
         $xquery .= "\n" . ' let $node3 := $node//tei:fileDesc/tei:titleStmt ';
         $xquery .= "\n" . ' let $node4 := $node//tei:projectDesc/tei:p ';
         $xquery .= "\n" . ' return ';
         $xquery .= "\n" . ' <node';
         $xquery .= "\n" . ' ref="{$node/@xml:id}"';
         $xquery .= "\n" . ' short="{$node1[@n=\'short\']}"';
         $xquery .= "\n" . ' type="' . $ext . '"';
         $xquery .= "\n" . ' date="{$node2/tei:date}"';
         $xquery .= "\n" . ' collection_ref="{$node4[@n=\'id\']}"';
         if (!$justRefs) {
             $xquery .= "\n" . ' id="{$node1[@n=\'id\']}"';
             $xquery .= "\n" . ' collection="{$node4[@n=\'short\']}"';
             $xquery .= "\n" . ' desc="{$node/@n}"';
             $xquery .= "\n" . ' author="{$node3/tei:author}"';
             $xquery .= "\n" . ' title="{$node3/tei:title[@type=\'main\']}"';
             $xquery .= "\n" . ' publisher="{$node2/tei:publisher}"';
             $xquery .= "\n" . ' pubplace="{$node2/tei:pubPlace}"';
         }
         $xquery .= "\n" . '> ';
         $xquery .= "\n" . ' </node> ';
         if ($result = $this->_db->xquery($xquery)) {
             $resultXML = (array) $result["XML"];
             foreach ($resultXML as $node) {
                 $xml_node = $node;
                 $xml_node = simplexml_load_string($xml_node, 'SimpleXMLElement', DCTL_XML_LOADER);
                 $namespaces = $xml_node->getDocNamespaces();
                 foreach ($namespaces as $nsk => $ns) {
                     if ($nsk == '') {
                         $nsk = 'tei';
                     }
                     $xml_node->registerXPathNamespace($nsk, $ns);
                 }
                 if ((string) $xml_node['ref'] != '') {
                     $packageRecord['kind'] = 'package';
                     $packageRecord['ref'] = 'xml://' . str_ireplace((string) $xml_node['collection_ref'] . DCTL_RESERVED_INFIX, (string) $xml_node['collection_ref'] . DB_PATH_SEP, (string) $xml_node['ref']);
                     $packageRecord['path'] = $xml_resource;
                     $packageRecord['short'] = (string) $xml_node['short'];
                     $packageRecord['type'] = (string) $xml_node['type'];
                     $packageRecord['date'] = (string) $xml_node['date'];
                     $packageRecord['collection_ref'] = 'xml://' . (string) $xml_node['collection_ref'];
                     if (!$justRefs) {
                         $packageRecord['id'] = (string) $xml_node['id'];
                         $packageRecord['full'] = cleanWebString($packageRecord['id'] . ': ' . $packageRecord['short'], FIELD_STRING_LENGTH) . SYS_DBL_SPACE;
                         $packageRecord['desc'] = (string) $xml_node['desc'];
                         $packageRecord['collection'] = (string) $xml_node['collection'];
                         $packageRecord['author'] = (string) $xml_node['author'];
                         $packageRecord['title'] = (string) $xml_node['title'];
                         $packageRecord['publisher'] = (string) $xml_node['publisher'];
                         $packageRecord['pubplace'] = (string) $xml_node['pubplace'];
                     }
                 }
             }
         }
     }
 }
예제 #4
0
function getPackageRecord($exist, $thePath, &$packageRecord)
{
    $packageRecord = array();
    $packageRecord['ref'] = '';
    $packageRecord['desc'] = '';
    $packageRecord['path'] = '';
    $packageRecord['type'] = '';
    $packageRecord['author'] = '';
    $packageRecord['title'] = '';
    $packageRecord['publisher'] = '';
    $packageRecord['date'] = '';
    $packageRecord['id'] = '';
    $packageRecord['short'] = '';
    $packageRecord['collection'] = '';
    $packageRecord['full'] = '';
    $package_id = basename($thePath);
    $package_id = explode(DCTL_RESERVED_INFIX, $package_id);
    $collection_id = $package_id[0];
    $package_id = $package_id[1];
    $thePath = dirname($thePath) . DB_PATH_SEP;
    $xml_resource = $thePath . $collection_id . DCTL_RESERVED_INFIX . $package_id;
    $ext = str_ireplace('.xml', '', $package_id);
    $ext = substr($ext, -4, 4);
    $xquery = DCTL_XQUERY_BASE;
    $xquery .= ' let $node := doc("' . $xml_resource . '")/tei:TEI ';
    $xquery .= ' return ';
    $xquery .= ' <node';
    $xquery .= ' id="{$node/tei:teiHeader/tei:encodingDesc/tei:samplingDecl/tei:p[@n=\'id\']}"';
    $xquery .= ' short="{$node/tei:teiHeader/tei:encodingDesc/tei:samplingDecl/tei:p[@n=\'short\']}"';
    $xquery .= ' collection="{$node/tei:teiHeader/tei:encodingDesc/tei:projectDesc/tei:p[@n=\'short\']}"';
    $xquery .= ' ref="{$node/@xml:id}"';
    $xquery .= ' desc="{$node/@n}"';
    $xquery .= ' type="' . $ext . '"';
    $xquery .= ' author="{$node/tei:teiHeader/tei:fileDesc/tei:titleStmt/tei:author}"';
    $xquery .= ' title="{$node/tei:teiHeader/tei:fileDesc/tei:titleStmt/tei:title[@type=\'main\']}"';
    $xquery .= ' publisher="{$node/tei:teiHeader/tei:fileDesc/tei:sourceDesc/tei:biblFull[contains(@n,\'source\')]/tei:publicationStmt/tei:publisher}"';
    $xquery .= ' date="{$node/tei:teiHeader/tei:fileDesc/tei:sourceDesc/tei:biblFull[contains(@n,\'source\')]/tei:publicationStmt/tei:date}"';
    $xquery .= '> ';
    $xquery .= ' </node> ';
    $result = $exist->xquery($xquery) or dump($exist->getError());
    $resultXML = (array) $result["XML"];
    foreach ($resultXML as $node) {
        $xml_node = $node;
        $xml_node = simplexml_load_string($xml_node, 'SimpleXMLElement', DCTL_XML_LOADER);
        $namespaces = $xml_node->getDocNamespaces();
        foreach ($namespaces as $nsk => $ns) {
            if ($nsk == '') {
                $nsk = 'tei';
            }
            $xml_node->registerXPathNamespace($nsk, $ns);
        }
        $packageRecord['path'] = $xml_resource;
        $packageRecord['ref'] = (string) $xml_node['ref'];
        $packageRecord['desc'] = (string) $xml_node['desc'];
        $packageRecord['type'] = (string) $xml_node['type'];
        $packageRecord['author'] = (string) $xml_node['author'];
        $packageRecord['title'] = (string) $xml_node['title'];
        $packageRecord['publisher'] = (string) $xml_node['publisher'];
        $packageRecord['date'] = (string) $xml_node['date'];
        $packageRecord['id'] = (string) $xml_node['id'];
        $packageRecord['short'] = (string) $xml_node['short'];
        $packageRecord['collection'] = (string) $xml_node['collection'];
        $packageRecord['full'] = cleanWebString($packageRecord['id'] . ': ' . $packageRecord['short'], FIELD_STRING_LENGTH) . SYS_DBL_SPACE;
    }
}
예제 #5
0
파일: functions.inc.php 프로젝트: net7/dCTL
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&amp;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&amp;collection_id=' . $collection_id . '&amp;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&amp;collection_id=' . $collection_id . '&amp;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&amp;collection_id=' . $collection_id . '&amp;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&amp;collection_id=' . $collection_id . '&amp;package_id=' . $package_id . '&amp;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;
}