瀏覽代碼

Removing metadata see #1370

Julio Montoya 11 年之前
父節點
當前提交
02144c806e
共有 41 個文件被更改,包括 5 次插入8799 次删除
  1. 2 2
      main/document/edit_document.php
  2. 0 116
      main/metadata/doc/CourseKwds.xml
  3. 0 655
      main/metadata/doc/Metadata_for_Dokeos.html
  4. 0 533
      main/metadata/doc/SelKwds.xsl
  5. 0 23
      main/metadata/doc/dcex.php
  6. 0 189
      main/metadata/doc/imsmanifest_reload.xml
  7. 0 140
      main/metadata/doc/mdApiTest.php
  8. 0 61
      main/metadata/doc/mdp_scorm.htt
  9. 0 241
      main/metadata/doc/testMiniDom.php
  10. 0 215
      main/metadata/doc/testXht.php
  11. 0 106
      main/metadata/importdocs.php
  12. 0 357
      main/metadata/importlinks.php
  13. 0 765
      main/metadata/importmanifest.php
  14. 0 186
      main/metadata/index.php
  15. 0 262
      main/metadata/md_document.htt
  16. 0 189
      main/metadata/md_document.php
  17. 0 21
      main/metadata/md_editxml.htt
  18. 0 406
      main/metadata/md_funcs.php
  19. 0 202
      main/metadata/md_link.htt
  20. 0 256
      main/metadata/md_link.php
  21. 0 85
      main/metadata/md_mix.php
  22. 0 214
      main/metadata/md_phpdig.php
  23. 0 17
      main/metadata/md_scorm.htt
  24. 0 106
      main/metadata/md_scorm.php
  25. 0 577
      main/metadata/md_script.js
  26. 0 25
      main/metadata/md_styles.css
  27. 0 115
      main/metadata/mds_mix.htt
  28. 0 32
      main/metadata/openobject.php
  29. 0 79
      main/metadata/phpdig/CourseKwds_example.js
  30. 0 11
      main/metadata/phpdig/CourseKwds_example.jsc
  31. 0 450
      main/metadata/phpdig/config.php
  32. 0 199
      main/metadata/phpdig/en-language.php
  33. 0 278
      main/metadata/phpdig/phpdig_functions.php
  34. 0 296
      main/metadata/phpdig/search.php
  35. 0 785
      main/metadata/phpdig/search_function.php
  36. 0 35
      main/metadata/phpdig/update_db_to_1_8_6_from_1_8_3.sql
  37. 0 214
      main/metadata/playscormmdset.inc.php
  38. 0 149
      main/metadata/search.php
  39. 0 135
      main/metadata/statistics.php
  40. 0 69
      main/metadata/update_indexabletext.php
  41. 3 3
      main/newscorm/learnpath_functions.inc.php

+ 2 - 2
main/document/edit_document.php

@@ -451,12 +451,12 @@ if ($owner_id == api_get_user_id() || api_is_platform_admin(
     }
 
     if (!$group_document && !is_my_shared_folder(api_get_user_id(), $my_cur_dir_path, $current_session_id)) {
-        $metadata_link = '<a href="../metadata/index.php?eid='.urlencode('Document.'.$document_data['id']).'">'.get_lang('AddMetadata').'</a>';
+        //$metadata_link = '<a href="../metadata/index.php?eid='.urlencode('Document.'.$document_data['id']).'">'.get_lang('AddMetadata').'</a>';
 
         // Updated on field
         $last_edit_date = api_get_local_time($last_edit_date);
         $display_date = date_to_str_ago($last_edit_date).' <span class="dropbox_date">'.api_format_date($last_edit_date).'</span>';
-        $form->addElement('label', get_lang('Metadata'), $metadata_link);
+        //$form->addElement('label', get_lang('Metadata'), $metadata_link);
         $form->addElement('label', get_lang('UpdatedOn'), $display_date);
     }
 

+ 0 - 116
main/metadata/doc/CourseKwds.xml

@@ -1,116 +0,0 @@
-<?xml version="1.0" encoding="iso-8859-1"?>                 <!-- AquaKwd.xml -->
-<!-- Copyright (C) Jean.Dhont@UGent.be, 2004/01/15 -->
-<!-- Test subset by René Haentjens -->
-
-<all-keywords title="Aquaculture&#xa0;Keywords">
-<organisms comment=" (test subset, more or less in systematical order)">
-	<fish postit="poisson, vis">
-		<salmon_trout_smelt>
-			<atlantic-salmon_salmo-salar/>
-			<pacific-salmon_oncorhynchus-mykiss/>
-			<rainbow-trout_salmo-gairdneri/>
-		</salmon_trout_smelt>
-		<flatfish>
-			<flounder_paralichthys-olivaceus/>
-			<halibut_hippoglossus-hippoglossus/>
-			<sole_pleuronectes/>
-			<plaice_pleuronectes-platessa/>
-			<turbot_scophthalmus-maximus/>
-			<flatfish-nei/>
-		</flatfish>
-		<herring_sardine_anchovy>
-		</herring_sardine_anchovy>
-		<tuna_bonito_billfish/>
-		<shark_ray/>
-	</fish>
-	<crustacean>
-		<brine-shrimp_artemia>
-		</brine-shrimp_artemia>
-		<crab>
-			<mudcrab_scylla/>
-			<mitten-crab_eriocheir/>
-		</crab>
-		<lobster>
-			<lobster_homarus/>
-			<spiny-lobster_panilurus/>
-		</lobster>
-	</crustacean>
-	<other-aquatic-organism>
-		<sponge/>
-		<coral/>
-	</other-aquatic-organism>
-	<non-aquatic-organism/>
-</organisms>
-<culture-aspects>
-	<life-stage>
-		<cyst/>
-		<hatching/>
-		<diapause/>
-		<egg/>
-		<larva>
-		</larva>
-		<post-larva/>
-		<fingerling/>
-		<juvenile/>
-		<adult/>
-		<broodstock/>
-		<life-cycle/>
-		<biomass/>
-		<other-life-stage/>
-	</life-stage>
-	<nutrition>
-		<diet>
-			<dry-diet/>
-			<microbound-diet_mbd/>
-			<wet-diet/>
-			<live-food/>
-			<diet-type-nei/>
-		</diet>
-		<feeding-biology>
-			<feed-intake/>
-			<digestion/>
-			<excretion/>
-		</feeding-biology>
-		<nutritional-aspect-nei/>
-	</nutrition>
-</culture-aspects>
-<geography>
-	<world>
-		<north-and-central-america>
-		</north-and-central-america>
-		<south-america>
-		</south-america>
-		<europe>
-			<belgium/>
-			<the-netherlands/>
-			<france/>
-			<italy/>
-			<spain_portugal/>
-			<greece/>
-			<uk_ireland/>
-			<norway_sweden_denmark_iceland/>
-			<european-country-nei/>
-		</europe>
-		<africa>
-		</africa>
-		<asia>
-		</asia>
-		<oceania>
-		</oceania>
-	</world>
-	<biotope>
-		<ocean_sea/>
-		<river/>
-		<bay_lagoon/>
-		<beach_coastline/>
-		<pond_lake/>
-		<salt-lake/>
-		<reef/>
-		<tundra_prairie_savanna/>
-		<mountain/>
-		<forest_jungle/>
-		<cultured-land/>
-		<biotope-nei/>
-	</biotope>
-</geography>
-</all-keywords>

+ 0 - 655
main/metadata/doc/Metadata_for_Dokeos.html

@@ -1,655 +0,0 @@
-<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
-<html>
-<head>
-  <title>Metadata for Dokeos</title>
-  <meta http-equiv="content-type"
- content="text/html; charset=ISO-8859-1">
-  <style>
-
-    .code   {font-family: Courier New, Courier, monospace; font-size: x-small}
-
-  </style>
-</head>
-<body style="color: rgb(0, 0, 0); background-color: rgb(255, 204, 153);"
- alink="#000099" link="#000099" vlink="#990099">
-<font face="Helvetica, Arial, sans-serif">
-<h1>Metadata for Dokeos 1.6</h1>
-<div align="right">document version:2005/09/20.<br>
-</div>
-<br>
-This is a short technical documentation about the metadata (MD)
-implementation in Dokeos 1.6. The 1.6 implementation (DMD1.6) mainly
-consists of:<br>
-<ul>
-  <li>screens and scripts for document-MD viewing and editing;</li>
-  <li>two XML-related libraries;</li>
-  <li>a general MD toolkit with some API functions;</li>
-  <li>experimental scripts for search via MD and for getting statistics
-on keyword usage;</li>
-  <li>not fully supported scripts for indexing and searching MD with
-PhpDig;<br>
-  </li>
-  <li>not fully supported scripts for storing/editing MD related to
-Links;<br>
-  </li>
-  <li>not fully supported scripts for SCORM package metadata import
-and custom browsing (see end of document).</li>
-</ul>
-Background information can be found on&nbsp;<a
- href="http://zephyr.ugent.be/courses/TW05DBRH/">Zephyr</a>:
-VeloMetadataClaroline.doc (via Documenten, Metadata). (That document
-is, however, outdated where it
-describes the implementation.)<br>
-<br>
-<h2>Metadata, XML, MD table</h2>
-MD is XML-formatted information about a Dokeos object. It is stored in
-a course database table (not globally), and Dokeos objects are
-identified in that table by their type + '.' + id. For example,
-'Document.12'
-refers to an object
-of type 'Document' (a file or a folder in the Dokeos Documents tool).<br>
-<br>
-The design of DMD1.6 allows to define, per type of object, which info
-is to be stored as MD, and how the MD is represented in XML. Both can
-be
-adapted relatively easily, in a PHP-script that defines the object
-class
-'mdobject' for the object type at hand.<br>
-<br>
-DMD1.6 fully implements MD definition, storage and editing for
-'Document'-type
-objects. The class 'mdobject' for these type of objects is defined in
-the script 'md_document.php'. The class definition includes a method
-to generate the default MD for new entries. (The scripts 'md_link.php'
-and 'md_scorm.php' define the class 'mdobject' for 'Link'- and
-'Scorm'-type objects. Script 'md_mix.php' defines a subset of the
-'mdobject' class functionality for the experimental Search script.)<br>
-<br>
-DMD1.6 works with standard IEEE LOM (Learning Objects MD). The
-XML-representation
-conforms to SCORM 1.3 (also known as SCORM 2004). The IEEE LOM elements
-General.Identifier.Catalog
-and .Entry are made to contain a globally unique object identifier of
-the
-form urn:institution:platform.coursecode.type.id and for element
-Technical.Location an URL is generated that points to script
-'openobject.php', also part of DMD1.6.<br>
-<br>
-To make changes to type and representation of MD more easy, the
-'mdobject' class also defines a map for the (generally accepted) Dublin
-Core elements. A specific Dokeos installation can thereby adapt
-DMD1.6 relatively easily e.g. to use SCORM 1.2 and/or IMS-XML instead
-of SCORM 2004.<br>
-<br>
-MD is stored in the (new) course database table 'metadata'. Count on
-2-4 KB per metadata record.<br>
-<br>
-The MD records currently have 5 fields: eid (entry-id or object
-identifier),
-mdxmltext (metadata text, XML-formatted), md5, htmlcache1, htmlcache2,
-indexabletext. The latter three fields are used for cached HTML and for
-storing text to be indexed for search; the hash-value md5 is used to
-validate
-the cache.<br>
-<br>
-The script
-'md_funcs', part of the MD toolkit, and used a.o. in the index and
-search
-scripts, contains a class definition 'mdstore', which handles all
-database operations. Code
-that is shared by several other scripts is also to be found in
-'md_funcs.php': common functions, code related to IEEE, and code
-related
-to the keyword tree (see below).<br>
-<br>
-<h2>XMD and XHT</h2>
-Two new libraries in inc/lib are essential for DMD1.6: the XML Mini-DOM
-'xmd' and XML HTML Templates 'xht'. The corresponding scripts contain
-some comments describing their functionality. Test scripts are included
-in DMD1.6
-to demonstrate the use of these libraries.<br>
-<br>
-DOM XML functions are also available in PHP 4 itself, but they are
-experimental. They require an extra
-nonstandard XML library and, on Windows, fiddling with DLLs. To avoid
-these problems, DMD1.6 comes with its own XML Mini-DOM library.<br>
-<br>
-Several open source template libraries exist for PHP, and yet DMD1.6
-again comes with its own one. The main design goal for the XML HTML
-Templates library is
-to combine HTML separation and a tight connection with an XML
-(mini-dom-)document. These
-are essential, given the goal of flexibility concerning kind and
-representation of MD and presentation to the user. The 'xht' library
-is mainly used to generate HTML, but DMD1.6 also uses it to generate
-XML
-(e.g. the default XML for new MD records in 'md_document.php') and
-JavaScript (in 'md_funcs.php').<br>
-<br>
-If it is decided for a future version of Dokeos to use a more
-'standard'
-approach for XML and/or for templates (e.g. Smarty), then DMD will
-most
-probably be adapted.<br>
-<br>
-The use of 'xht' in DMD1.6 allows to define, per type of object,
-what part of the MD is to be shown to a Dokeos user or presented for
-editing, and how
-that info is rendered as HTML (between the page header and footer).
-For 'Document'-type objects, the HTML templates for MD viewing and
-editing are to be found in 'md_document.htt'. (Compare them with the
-templates in 'md_link.htt', 'md_scorm.htt' (both not fully supported),
-and 'mds_mix.htt'., the
-templates used when rendering the (experimental)
-search screen.)<br>
-<br>
-Some little notes here will come in handy for easier understanding of
-the templates. For more info, look into the
-source code of the libraries.<br>
-<ul>
-  <small> <li>A&nbsp;template starts with a special comment line
-giving the
-template name. A template ends where the next one starts.<br>
-  </li>
-  <li>Templates can call other templates, example "<span class="code">{-C
-LANGSELECT-}</span>" (a "call" construct).</li>
-  <li>Calls do not have parameters. Instead, there is a global
-parameter array. String values are stored in it with the "define
-construct", e.g. "<span class="code">{-D label Language-}</span>"
-(define "label" to have the value "Language"). Parameter values are
-fetched with the "parameter" construct, e.g. "<span class="code">{-P
-title-}</span>".&nbsp;</li>
-  <li>Some parameters are predefined, e.g. "<span class="code">{-P 0-}</span>"
-('0'), "<span class="code">{-P 1-}</span>", "<span class="code">{-P
-empty-}</span>" (empty string). When another literal values needs to be
-used in a construct, put it in a parameter, e.g. "<span class="code">{-D
-XML application/xml;iso-8859-1-}</span>" </li>
-  <li>The "language" construct "<span class="code">{-L KwHelp-}</span>"
-includes the value of a language variable from a Dokeos language file
-(here: $langKwHelp). (To be correct, it calls the function that has
-been assigned to xht_get_lang, usually get_lang.)<br>
-  </li>
-  <li>The "XML construct", e.g. "<span class="code">{-X
-technical/format-}</span>" fetches a value from the associated XML
-document (in DMD1.6 most often the metadata of a Dokeos object).</li>
-  <li>The "test construct", e.g. "<span class="code">{-T key ==
-selvalue selected-}</span>" provides conditional inclusion. Our
-example: include
-the word "selected" only when parameter "key" is equal to parameter
-"selvalue".</li>
-  <li>Constructs can span several lines, but special care is required
-for correct spacing. See examples with the test construct in
-'md_document.htt': the space at the end of an unclosed "<span
- class="code">{-T ...</span>" line is essential!</li>
-  <li>The "repeat construct", e.g. "<span class="code">{-R Langs C
-OPTION-}</span>" repeatedly calls a subtemplate. In this example, the
-subtemplate "OPTION" is repeated for all values in the associative list
-$langLangs. (Sample associative lists can be found in <span
- class="code">lang/english/md_document.inc.php</span>
-Another example: "<span class="code">{-R general/keyword C
-KEYWORD-}</span>" - repeat "KEYWORD" for all XML elements found by the
-given path "general/keyword".</li>
-  <li>Constructs can be nested such as in e.g. "<span class="code">{-H
-{-L {-P label-}Tip-}-}</span>". </li>
-  <li>The "X" construct implicitly includes the htmlspecialchars
-transformation. Where this is not desired, the "V" ("value") construct
-can be used instead. ("X" = "V" + "H") To refer to the associated XML
-document, both constructs use an XPath parameter such as
-'general/title/string/@language'. There is a provision in 'xht'
-allowing to include the callback marker '=/' in XPaths (see source
-code).<br>
-  </li>
-  <li>As a convenience, the C, L, P, V, and X constructs allow
-cascading instead of nesting, e.g. "<span class="code">{-V P xpath-}</span>"
-is equivalent to "<span class="code">{-V {-P xpath-}-}</span>". </li>
-  <li>For the "E" construct, see "Caching".<br>
-  </li>
-  <li>It should be kept in mind that template scanning and substitution
-is simple character-processing. To help with template definition and
-adaptation, 'xht' can generate tracing information that can be
-made visible in the HTML page source (see xht_dbgn and xht_dbgo).</li>
-  </small>
-</ul>
-<br>
-<h2>Mime types and Technical.Format</h2>
-In the IEEE LOM standard, the metadata element Technical.Format must
-contain the learning object mime type. DMD1.6 uses
-DocumentManager::file_get_mime_type as authorative source for mime
-types and for determining the default mime type based on file extension.<br>
-<br>
-There is a provision for adding mime types that are not listed in
-DocumentManager::file_get_mime_type,
-for example alternative mime types for a specific file extension. This
-is done via the language variable $langFormats (see DLTT and Dokeos
-lang-file md_document). This language variable must contain an
-associative list such as e.g. "<span class="code">:text/plain;iso-8859-1:Text;Latin-1,,
-application/xml;iso-8859-1:Xml;Latin-1</span>". (The second part of a
-list
-item, e.g. "<span class="code">Text;Latin-1</span>", appears in the
-selection box in the metadata
-screen and can be made language-specific.) (In associative lists,
-elements are separated by double comma; value and language text are
-separated by the first character in the language string, here a colon.)<br>
-<br>
-One specific mime type can be designated as the mime type for course
-keywords documents (see next section). This is done by defining
-parameter XML in the template file metadata/md_document.htt. In DMD1.6
-it contains:<br>
-<span class="code">{-D XML application/xml;iso-8859-1-}</span><br>
-<br>
-<h2>Keywords in a tree, JavaScript<br>
-</h2>
-MD usually includes
-keywords, and there is a special provision in
-DMD1.6 allowing to (optionally) define a structured set of keywords for
-each course. The course manager defines the keywords in an xml file (an
-example is provided) and uploads it to the course documents area. When
-browsing to that document's metadata, there will be a button 'This
-document contains the course keywords'. The
-XML-structured keywordtree is then converted to the cache file
-'CourseKwds.js'
-in the course's top-level directory. The button must be used after each
-change to the xml file. To remove all course keywords (and the cache
-file), use the button on an xml file containing only spaces or only a
-top element with no content.<br>
-<br>
-The cache file constructs a clickable tree
-in HTML (restricted to W3C browsers). The toolkit script 'md_funcs'
-contains the server-side functions related to the keyword tree, the
-file 'md_script.js' contains
-the client-side script.<br>
-&nbsp; <br>
-Whether the keyword tree is
-presented in a screen (index, search, ...), and if so, where and how,
-can again be defined relatively easily via the templates. The MD
-view-and-edit screen also converts comma-separated keywords (whether
-selected with the clickable tree or typed in)
-to separate XML elements (as required by SCORM 1.3).<br>
-<br>
-The file 'md_script.js' also contains the client-side script used by
-the HTML templates in 'md_document.htt' for input validation and MD
-update preparation in screens for 'Document'-type object MD. Whereas
-keyword-tree clicking requires a W3C browser, input validation and MD
-update should also work with IE4 and NS4 browsers (not tested).<br>
-<br>
-DMD1.6 contains input validation of two kinds (put the following on the
-HTML INPUT element):<br>
-<ul>
-  <li><span class="code">onKeyPress="return
-isValidChar(event, pattern, flags)"</span>, e.g. '[a-z]', 'i': allow
-only the
-26*2 letters: all other input is disabled in the INPUT field; examples
-in the fields for the learning object identifier and for keywords;</li>
-  <li><span class="code">onKeyUp="checkValid(this,
-pattern, flags)"</span>, e.g. '^[a-z]{2,8}$', 'i': field must contain
-between 2
-and 8 letters: nonconforming input will pass, but text is rendered in
-red to alert the user; an example in the date field (lng. obj.
-creation).</li>
-</ul>
-To provide a minimum level of MD editing support when there is no
-scripting in the browser, the templates in 'md_editxml' allow direct
-editing of the XML formatted data. (This same template is used should
-an XML syntax error be detected, thereby allowing to repair XML
-metadata.)<br>
-<br>
-To view the XML formatted data, click the 'Store' button while holding
-CTRL- and ALT-keys down.<br>
-<br>
-The server-side functions for the construction of the keyword tree
-cache file (in 'md_funcs')
-mimic an XSLT process which is
-documented in 'SelKwds.xsl'. (This file, and XSLT in general, is not
-used in DMD1.6.)<br>
-<br>
-The experimental script 'statistics.php' gives statistics about the
-usage of course keywords. It is not linked to any Dokeos
-1.6 screen, therefore not reachable in a standard installation.<br>
-<br>
-<h2>MD toolkit and API<br>
-</h2>
-The script 'md_funcs' contains the main part of the toolkit and API.
-They allow other Dokeos scripts to define, modify and delete MD for
-specific objects (see class 'mdstore'). The script 'md_funcs' must be
-combined with a script
-that defines the object class 'mdobject' for the specific type of
-object
-(such as&nbsp; 'md_document.php' for 'Document'-type objects). The test
-scripts 'dcex' and 'mdApiTest' demonstrate the toolkit and the API
-functions.<br>
-<br>
-The simplest way of working with the API is by using the functions
-'mds_get_dc_elements' and 'mds_put_dc_elements'. They allow to fetch
-and store the MD elements that are part of the so called Dublin Core.
-The DC elements form a generally accepted core set of metadata.<br>
-<br>
-The function 'mds_update_xml_and_mdt' is particularly useful for
-translating user interactions with a MD edit screen to MD-store
-operations. When using the API, it might be more handy to work with xmd
-and mdstore operations directly.<br>
-<br>
-A word of warning: MD scanning is a relatively compute-intensive task.
-If used in a loop, e.g. to display some specific info about several
-hundreds of documents, server response might slow down.<br>
-<br>
-<h2>Other files in DMD1.6</h2>
-Language files
-'md_document.inc.php' are available for English, French and Dutch.
-Language files 'md_link.inc.php' and 'md_scorm.inc.php' only exist in
-English.<br>
-<br>
-Files 'md_link.php' and 'md_link.htt', also 'md_scorm.php' and
-'md_scorm.htt', all already mentioned, are used in
-conjunction with the not fully supported functionality related to Link
-metadata
-and SCORM
-package metadata import.<br>
-<br>
-File 'md_link.php', in conjunction with 'index.php', demonstrates the
-use of the mdo_override and mdo_storeback methods allowing to implement
-a more tight synchronization between MD and standard Dokeos object
-properties than is actually implemented for document MD (see also
-below: Link metadata editing).<br>
-<br>
-<h2>Caching</h2>
-The 'xht' library provides caching functions, which allow to speed up
-screen building. DMD1.6 caches information to database fields
-'htmlcache1' and 'indexabletext' ('htmlcache2' is not used in DMD1.6).<br>
-<br>
-In 'md_document.htt' it can be seen that the MD view-and-edit screen
-(produced by index.php) is divided in four main parts: part 1, the
-keywords tree,
-part 2 and the POST form.<br>
-<br>
-Instead of a normal "call" from a template to a subtemplate, which
-would be "<span class="code">{-C METADATA_PART1-}</span>", the main
-template does an "escape-call" "<span class="code">{-E
-md_part1 C METADATA_PART1-}</span>". The escape construct works as
-follows: the
-'xht' library does a callback to the user code, in this example to the
-PHP
-function 'md_part1'. The code for that function can be found in
-'index.php'.
-That function checks whether it has a valid cached HTML and if so,
-returns
-it, thereby avoiding the template expansion of the subtemplate
-METADATA_PART1.
-If not, 'xht' effectively does the (supposedly slow) expansion and
-allows
-the callback function 'md_part1' to store it for re-use.<br>
-<br>
-In DMD1.6, "part 1" of the screen contains most template expansion
-work, hence the database field 'htmlcache1' is a real HTML cache.
-Another part of the screen is made to contain the "words" from the
-metadata that must
-be indexable and searchable. It corresponds with the database
-field 'indexabletext'.<br>
-<br>
-Under certain circumstances, caching may cause a delay after a change.
-For example, when making languages visible or unvisible, they may not
-immediately appear in or disappear from the SELECT inputfields in
-existing metadata. To make the change visible, edit that metadata.<br>
-<br>
-Toolkit/API functions such as
-'mds_append', useful e.g. for adding searchable words to
-'indexabletext', must be used with care, because of possible
-interactions with the index
-script, when it allows users to modify metadata (and therefore also
-indexable words) interactively.<br>
-<br>
-<h2>Index and Search scripts<br>
-</h2>
-Both scripts lean heavily on the libraries and on the API;
-they are therefore relatively short.<br>
-<br>
-Note that all output is produced in a section at the end of the scripts.<br>
-<br>
-DMD1.6 has an experimental screen for searching documents based on
-their MD. It is not linked to any Dokeos
-1.6 screen, therefore not reachable in a standard installation.<br>
-<br>
-This MD search screen described in this section does not require the
-installation of PhpDig 1.8.6. as opposed to the (not fully supported)
-PhpDig indexing/searching scripts described further down.<br>
-<br>
-A general search in all metadata is not so easy,
-because the metadata can in theory be quite different for different
-types of
-Dokeos objects. In practice, Dokeos platforms will probably stick to
-identical or rather similar metadata for all objects and might
-therefore find the search script useful.<br>
-<br>
-The DMD1.6 MD search script does an unsophisticated database query in
-field 'indexabletext', supposedly containing all searchable words.<br>
-<br>
-DMD1.6 puts these searchable words in the field:
-<ul>
-  <li>via function md_indexabletext in index.php if that function is
-called from the templates in a "E" construct (see Caching); this is the
-case for Document;</li>
-  <li>for Scorm and Link: via function mdo_define_htt in md_scorm.php
-and md_link.php, called by
-importmanifest.php and importlinks.php.</li>
-</ul>
-Note that keywords are transformed, e.g. MD keyword 'fish' will become
-searchable word 'fish-kw'. This allows search to focus on the keyword,
-without finding references where the word 'fish' is part of some
-description. This can of course (because of the templates) be changed
-relatively easily, but it should be noted that the current search
-screen &amp; script, and also the PhpDig connection, assume this
-transformation.<br>
-<br>
-The script
-'update_indexabletext.php' can be used to update MD records when the
-definition of the searchable words is changed. It is not linked to any Dokeos
-1.6 screen, therefore not reachable in a standard installation. It uses
-function mdo_define_htt already mentioned above. For documents,
-md_document.php should then contain the same definition as the one in
-md_document.htt. Use the script with e.g. '?eid_type=Document'.<br>
-The SCORM package metadata import script importmanifest.php (see
-below), if used with SCORM
-2004 packages, generates metadata records (type 'Scorm') that are very
-similar to the 'Document' type metadata records.<br>
-<br>
-Before generating output, search combines (in memory) the XML metadata
-of all
-Dokeos objects that it has found for a particular query into a big,
-imsmanifest-like XML document. It is expected that this will cause
-problems if many hundreds or thousands of objects have metadata and can
-therefore be "found" in one query.<br>
-<br>
-All of this shows that the search script will need to evolve in future
-Dokeos versions.<br>
-<br>
-To make metadata search available on your Dokeos server, include a link
-to <br>
-<span class="code">.../metadata/search.php?type=Mix
-</span><br>
-<br>
-<h2>DMD1.6 files with comments</h2>
-<h3>Updates for standard Dokeos scripts</h3>
-<h4>document/edit_document.php</h4>
-The (one and only) link between Dokeos and metadata (via Documents).<br>
-<h4>lang/*/document.inc.php</h4>
-Two additional language-dependent words for edit_document.<br>
-<h4>inc/lib/fileManage.lib.php</h4>
-Updated to delete the metadata entry when deleting a document or a
-SCORM folder. (Link-MD is not automatically deleted.)<br>
-<br>
-<h2>Functionality not fully
-supported in DMD1.6</h2>
-<h3>Link metadata editing</h3>
-To allow course managers to interactively store and edit metadata about
-a Link, provide an URL such as:<br>
-<span class="code">.../metadata/?eid=Link.nnn</span><br>
-<br>
-This metadata may e.g. add keywords.<br>
-<br>
-Unlike with Document-type objects, Link-type metadata object editing
-has an override- and storeback-functionality. When metadata is
-displayed for editing, DB data is overridden by new data from the Links
-table (but not automatically stored): category, url, title,
-description, keywords. When metadata is changed in the MD edit screen
-and stored, then new data is stored back into the Links table: url,
-title, description, keywords (but not category).<br>
-<br>
-In the Links table, MD description and keywords are combined in the
-description field, as follows:<br>
-<span class="code">&lt;i kw="kw1, kw2, ..."&gt;Description&lt;/i&gt;</span><br>
-Thereby keywords are not visible to the user, yet editable by the
-course admin.<br>
-<h4>importlinks.php</h4>
-This script, not reachable
-until you e.g. link it to a course homepage,
-performs the following operations
-related to Links:<br>
-<ul>
-  <li>Create MTEs (Metadata
-Table Entries) for all Links of a specific category</li>
-  <li>Delete all MTEs for
-Links of a specific category</li>
-  <li>Index all MTEs of a
-Link category for search (see also below, PhpDig connection)</li>
-</ul>
-As importlinks is meant to be used only by course admins, hide
-it after you have linked it to the course homepage.<br>
-<br>
-<h3>SCORM metadata import and custom browsing</h3>
-<h4>importmanifest.php</h4>
-This script, not reachable until you e.g. link it to a course homepage,
-performs the following operations
-related to Metadata Table Entries (MTEs) and SCORM package directories
-(SPDs) in Learning Path (which have a SCORM Directory Id SDI):
-<ul>
-  <li>Import or re-import the 'imsmanifest.xml' file from a SPD into
-MTEs</li>
-  <li>Find the SDI of some SPD</li>
-  <li>Delete all MTEs corresponding to a specific SDI</li>
-  <li>Show the main MTE corresponding to some SDI (after import)</li>
-  <li>Start 'index.php' in some SPD (after import)<br>
-  </li>
-  <li>Index some SPD for search (see also below, PhpDig connection)<br>
-  </li>
-</ul>
-Note that the above mentioned 'index.php' in the SPD is created by
-import.<br>
-<br>
-As importmanifest is meant to be used only by course admins, hide
-it after you have linked it to the course homepage.<br>
-<h4>playscormmdset.inc.php</h4>
-This include-script contains the main functionality of the custom
-browser.<br>
-<br>
-Import creates an 'index.php' in the corresponding scorm folder of a
-course. It includes 'playscormmdset'.<br>
-<br>
-(Thereby to a search engine, the custom browser will appear as if it is
-located in that scorm folder. This is important for search engines that
-allow to index/re-index by virtual directory.)<br>
-<br>
-The custom browser uses a templates file to generate HTML, but unlike
-the standard MD screens, it looks for that templates file in the scorm
-folder or in its parent folders. Thereby the generated HTML can be
-different for different scorm folders.
-<br>
-An example templates file can be found in metadata/doc/mdp_scorm.htt.<br>
-<br>
-<br>
-<h3>PhpDig connection</h3>
-DMD1.6 includes functionality
-allowing a specific course to work with a customized version of PhpDig
-1.8.6 that has been built into the course. This provides quicker and
-more
-sophisticated search functionality.<br>
-<br>
-The connection consists of the script 'md_phpdig.php', this document
-section, and the customized files in ...main/metadata/phpdig.<br>
-<br>
-It is assumed that a system admin installs a copy of PhpDig in a
-subfolder 'phpdig-1.8.6' of the course webfolder, customizes it as
-described below and by the sample files, and initializes it by running
-PhpDig's install script.<br>
-<br>
-The admin screen of PhpDig can best be defined as a hidden
-link (because course-admin only) in the course homepage. A link in a
-separate window is best, as the admin screen has no Dokeos header.<br>
-<br>
-Script 'md_phpdig.php' contains a few lines copied from the PhpDig
-config script and a set of functions that can be used as API functions
-providing a PhpDig DB-feeder mechanism. They allow combinations of URLs
-and searchable words to be fed into the DB directly, bypassing the
-PhpDig spider script. The API code is PhpDig spider code, covered by
-the GNU GPL just like PhpDig is.<br>
-<br>
-Scripts 'importdocs.php', 'importlinks.php' and
-'importmanifest.php' make use of that API to index MD for PhpDig. None
-of them are reachable from standard Dokeos 1.6 screens.<br>
-<br>
-The PhpDig Search screen, which can be used instead of the experimental
-MD search screen, is the custom 'search.php' available in the
-metadata/phpdig folder. It must be copied to the 'phpdig-1.8.6'
-subfolder of the
-course webfolder and then made reachable from the course homepage.<br>
-<br>
-PhpDig by default combines search terms with AND and searches for words
-starting with the search term strings. Negation is done by putting a
-hyphen before the search term (implemented as ALT-click in the search
-screen keyword tree).<br>
-<br>
-Some background information can be found on&nbsp;<a
- href="http://zephyr.ugent.be/courses/TW05DBRH/">Zephyr</a>:
-VeloMetadataClaroline.doc (via Documenten, Leerobjectbouwstenen,
-Exploreerbare leerstof: document SearchableImageWebsite).<br>
-<h4>PhpDig 1.8.6 customizations overview</h4>
-<h5>includes/config</h5>
-<ul>
-  <span class="code"> <li>define('PHPDIG_ADM_PASS','admin');
-// insert a password</li>
-  <li>$template =
-"array";</li>
-  <li>define('MAX_WORDS_SIZE',50);</li>
-  <li>define('SUMMARY_DISPLAY_LENGTH',700);</li>
-  <li>define('CONTENT_TEXT',0);</li>
-  <li>define('USE_IS_EXECUTABLE_COMMAND','0');</li>
-  </span>
-</ul>
-<h5>libs/phpdig_functions<br>
-</h5>
-<span class="code">' \'._~@#$:&amp;%/;,=-]+'</span>
-replaced (twice) by<br>
-<span class="code">' \'._~@#$&amp;%/=-]+' no :;, in words</span><br>
-<h5>search.php</h5>
-This is the script that must be made accessible in the course, to
-provide PhpDig search. It is a newly developed script replacing
-PhpDig's standard one.<br>
-<br>
-Course managers can adapt the search form and provide extra search
-criteria as explained in the SearchableImageWebsite document mentioned
-above.<br>
-<h5>libs/search_function</h5>
-<span class="code">" \'.\_~@#$:&amp;\%/;,=-]+"</span>
-replaced by<br>
-<span class="code">" \'._~@#$&amp;%/=-]+" no \:;, in words<br>
-<br>
-two special "words" are used for controlling the displaying of the
-search results: "txt-sep" (newline) and "txt-end" (end of display)<br>
-<br>
-the "-kw" tail of keywords is stripped off in the search results</span><br>
-<h5>thumbnail support</h5>
-This is quite well explained in the above mentioned background material.<br>
-<br>
-This works only with special-design SCORM packages: item resource
-file[1]/@href is assumed to point to the thumbnail image, which must
-have a filename 'pptsl' + nnn + '_t.jpg' (see a.o.
-'importmanifest.php').<br>
-<br>
-In md_phpdig.php, the '&amp;thumb=...' part of URLs is cut off for
-display.<br>
-<br>
-Metadata search also displays the thumbs (see
-'.../main/metadata/search.php' and 'mds_mix.htt').
-<br>
-</font>
-<br>
-</body>
-</html>

+ 0 - 533
main/metadata/doc/SelKwds.xsl

@@ -1,533 +0,0 @@
-<?xml version="1.0" encoding="iso-8859-1"?>                 <!-- SelKwds.xsl --> 
-                                                             <!-- 2005/04/14 -->
-
-<!-- Copyright (C) 2005 rene.haentjens@UGent.be - see note at end of text    -->
-<!-- Released under the GNU GPL V2, see http://www.gnu.org/licenses/gpl.html -->
-
-<!-- W3C browsers only; Moz1.7,NN7: security popup (UniversalXPConnect)      -->
-
-<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform"  version="1.0">
-
-  <xsl:template match="/*">
-  
-
-    <html>
-
-    <head><title><xsl:value-of select="@title"/></title>
-    
-    <style>
-        body    {font-family: sans-serif; font-size: x-small}
-        .kwl    {width: 92%; color: black; font-size: x-small; font-weight: bold}
-        .dvc    {display: none;  margin-left: 3ex}
-        .dvo    {display: block; margin-left: 3ex}
-        .btm    {height: 3.5ex; width: 5ex; font-family: monospace; font-size: xx-small}
-        .btn    {height: 3.5ex; width: 3ex; font-family: monospace; font-size: xx-small}
-        .lfn    {height: 3.5ex; width: 3ex; font-family: monospace; font-size: xx-small; visibility: hidden}
-        .lbl    {background-color: white; cursor: pointer}
-        .lbs    {background-color: white; cursor: pointer; font-weight: bold; color: red}
-        .pup    {position:absolute; visibility:hidden; width: 50%; border: 1px solid black; overflow:auto; background-color: #FFF8DC}
-        .pul    {background-color: #FFF8DC}
-    </style>
-    
-    <script language="JavaScript"><![CDATA[
-    
-        String.prototype.trim = function()
-        {
-            return this.replace(/^\s*/,"").replace(/\s*$/,""); // \f\n\r\t\v
-        }   // Dave Anderson, dbforums.com/arch/195/2003/3/724117
-        
-        String.prototype.removeExtraSpaces = function()
-        {
-            return this.replace(/\s+/g, ' ').trim();
-        }
-        
-        function makeWindow(url, htmlText)
-        {
-            var newWindow = window.open(url, '', 
-                'toolbar=no, location=no, directories=no, status=yes, '+ 
-                'menubar=yes, scrollbars=yes, resizable=yes, ' + 
-                'width=800, height=600, left=10, top=10');
-            if (url == '') newWindow.document.write('<html><body>' + 
-                    htmlText + '</body></html>');
-            return newWindow;
-        }
-        
-        function isNotW3C()
-        {
-            if (!document.getElementById)
-                alert('Sorry, the buttons only work with W3C browsers. ' +
-                    'Use Moz1.7 or IE6 or NN7 or type in keywords manually...');
-            return !document.getElementById;
-        }
-        
-        
-        function openOrCloseHelp(btn)
-        {
-            if (isNotW3C()) return false;
-            
-            document.getElementById('moreHelp').className =
-                (btn.value == "?")              ? "dvo" : "dvc";
-            btn.value = (btn.value == "?")      ?  "¿"  :  "?";
-        }
-        
-        function hasTagAndClass(obj, tag, cl)
-        {
-            return obj.tagName && (obj.tagName.toUpperCase() == tag) && 
-                (obj.className == cl);
-        }
-    
-        
-        function openOrClose(btn)  // show or hide part of keyword-tree
-        {
-            var oldcl = (btn.value == "-") ? "dvo" : "dvc";
-            var newcl = (oldcl == "dvo")   ? "dvc" : "dvo";
-            btn.value = (oldcl == "dvo")   ?  "+"  :  "-" ;
-            
-            var ch = btn.parentNode.childNodes;  // opera crashes on with()
-            for (var i = 0; i < ch.length; i++)  // netscape requires .item
-                if (hasTagAndClass(ch.item(i), 'DIV', oldcl))
-                    ch.item(i).className = newcl;
-        }
-        
-        function openOrCloseHere(div, wrong)  // show or hide recursively
-        {
-            var ch = div.childNodes;
-            for (var i = 0; i < ch.length; i++)
-            {
-                var thisCh = ch.item(i);
-                if (thisCh.className == 'btn' && thisCh.value == wrong)
-                    openOrClose(thisCh)
-                else if (thisCh.className == 'dvo' || thisCh.className == 'dvc')
-                    openOrCloseHere(thisCh, wrong);
-            }
-        }
-        
-        function openOrCloseAll(btn)  // show or hide whole keyword-tree
-        {
-            if (isNotW3C()) return false;
-            
-            var wrong = (btn.value == "--") ? "-"  : "+" ;
-            btn.value = (wrong == "-")      ? "++" : "--";
-            
-            openOrCloseHere(btn.parentNode, wrong);
-        }
-        
-        
-        var selspans = new Array;   // selected SPANs with keywords
-        
-        function deselect(span)
-        {
-            for (var s in selspans) if (selspans[s] == span) delete selspans[s];
-        }
-        
-        function copyToClipboard(allKwds)
-        {
-            if (window.clipboardData)
-            {
-                window.clipboardData.setData("Text", '<' + allKwds + '>\r\n');
-                return;
-            }
-            
-            netscape.security.PrivilegeManager.enablePrivilege('UniversalXPConnect');
-            var gClipboardHelper = Components.classes['@mozilla.org/widget/clipboardhelper;1']
-                .getService(Components.interfaces.nsIClipboardHelper);
-            gClipboardHelper.copyString('<' + allKwds + '>\n');
-        }
-        
-        function getSelectedKeywords()
-        {
-            var sortedKwds = new Array, allKwds = '';
-            
-            for (var s in selspans)
-                sortedKwds.push(selspans[s].parentNode.getAttribute('level')
-                     + '.' + selspans[s].innerHTML)
-            
-            sortedKwds.sort();  // according to level, which follows the tree
-            
-            for (var k in sortedKwds)
-            {
-                var someWords = sortedKwds[k];
-                allKwds += ', ' + someWords.substr(someWords.indexOf('.')+1);
-            }
-            
-            return allKwds.replace(/[,_\s]+/g, ', ').substr(2);  // strip ', '
-        }
-
-                
-        var orkwds;  // array of ', kw, ' strings
-        
-        function selectOriginal(div)
-        {
-            var ch = div.childNodes;
-            for (var i = 0; i < ch.length; i++)
-            {
-                var thisCh = ch.item(i); if (!thisCh.tagName) continue;
-                thisTag = thisCh.tagName.toUpperCase();
-                
-                if (thisTag == 'SPAN')
-                {
-                    var parkwds = ','+ thisCh.innerHTML.replace(/\s*/g,"") +',';
-                    
-                    for (var k = 0; k < orkwds.length; k++)
-                    if (parkwds.indexOf(orkwds[k]) >=0 )
-                    {
-                        deselect(thisCh); selspans.push(thisCh);
-                        thisCh.className = "lbs"; 
-                        
-                        openToTop(div, div.className); break;
-                    }
-                }
-                else if (thisTag == 'DIV')
-                {
-                    selectOriginal(thisCh);
-                }
-            }
-        }
-        
-        function openToTop(div, divclass)
-        {
-            if (!div.parentNode) return; var pdiv = div.parentNode;
-            
-            if (!pdiv.className) return; var pclass = pdiv.className;
-            if (pclass != 'dvo' && pclass != 'dvc') return;
-            
-            if (divclass == 'dvc')
-            {
-                var ch = pdiv.childNodes;
-                for (var i = 0; i < ch.length; i++)
-                {
-                    var btn = ch.item(i);
-                    if (hasTagAndClass(btn, 'INPUT', 'btn'))
-                        if (btn.value == '+') openOrClose(btn);
-                }
-            }
-            
-            openToTop(pdiv, pclass);
-        }
-        
-        function deselectAll(ev, btn)
-        {
-            if (isNotW3C()) return false;
-            
-        	if (!ev) var ev = window.event;
-        	
-            var kws = document.getElementById('kwds_string');
-            
-            for (var s in selspans) selspans[s].className = "lbl";
-            selspans = new Array;
-            
-            document.getElementById('btnOpenOrCloseAll').value = "--";
-            
-            if (!ev.altKey) { kws.value = ''; return; }
-            
-            if (ev.ctrlKey) kws.value = getPptKw();
-            var kwdswere = kws.value;  // typed in by user or fetched from PPT
-            
-            var kwdsarray = kwdswere.split(','), allKwds = '';
-            
-            for (var k = 0; k < kwdsarray.length; k++)
-            {
-                var kwd = kwdsarray[k].trim();
-                if (kwd.substr(0,1) == '-') kwd = kwd.substr(1);
-                if (kwd != '') allKwds += '§,' + kwd + ',';
-            }
-            
-            if (allKwds == '') return;
-            
-            orkwds = allKwds.substr(1).split('§');
-            
-            selectOriginal(btn.parentNode);
-            
-            allKwds = getSelectedKeywords(); kws.value = allKwds;
-            copyToClipboard(allKwds);
-            
-            allKwds = ','+ allKwds.replace(/\s*/g,"") +','; var missing = '';
-            for (k = 0; k < orkwds.length; k++)
-            if (allKwds.indexOf(orkwds[k]) < 0 ) missing += orkwds[k];
-            
-            if (missing != '') alert('!= ' + missing.replace(/,+/g," "));
-        }
-        
-        function selectOrDeselect(span, newcl)
-        {
-            span.className = newcl; deselect(span);
-            if (newcl == "lbs") selspans.push(span);
-        }
-
-        function alsoParents(div, oldcl, newcl)
-        {
-            while (div.parentNode)
-            {
-                div = div.parentNode; var ch = div.childNodes;
-                for (var i = 0; i < ch.length; i++)
-                    if (hasTagAndClass(ch.item(i), 'SPAN', oldcl))
-                        selectOrDeselect(ch.item(i), newcl);
-            }
-        }
-
-        function spanClick(span, ev)
-        {
-                                        if (!ev) ev = window.event;
-            
-            if (ev.shiftKey && ev.altKey)
-            {
-                makeWindow('', '<pre>' + span.parentNode.innerHTML
-                    .replace(/&/g, "&amp;").replace(/"/g, "&quot;")
-                    .replace(/</g, "&lt;") .replace(/>/g, "&gt;") + '</pre>');
-                return;  // debugging...
-            }
-            
-            if (ev.ctrlKey || span.className == "lbs")
-            {
-                selectOrDeselect(span, "lbl");  // deselect
-                if (document.selection) document.selection.empty();
-                if (ev.altKey) alsoParents(span.parentNode, "lbs", "lbl");
-            }
-            else
-            {
-                selectOrDeselect(span, "lbs");  // select
-                if (!ev.altKey) alsoParents(span.parentNode, "lbl", "lbs");
-                //
-                // in md_script, there is some code here
-                // to negate keywords for search
-                //
-            }
-            
-            var allKwds = getSelectedKeywords(); copyToClipboard(allKwds);
-            document.getElementById('kwds_string').value = allKwds;
-        }
-        
-    
-        var KWDS_ARRAY = new Array, nkw = 0, pU;  // alphabetic list popup
-        
-        function makeAlphaList(div)
-        {
-            var ch = div.childNodes;
-            for (var i = 0; i < ch.length; i++)
-            {
-                var thisCh = ch.item(i); if (!thisCh.tagName) continue;
-                thisTag = thisCh.tagName.toUpperCase();
-                
-                if (thisTag == 'SPAN')
-                {
-                    var parkwds= thisCh.innerHTML.replace(/\s*/g,"").split(',');
-                    for (k in parkwds) KWDS_ARRAY[nkw++] = parkwds[k];
-                }
-                else if (thisTag == 'DIV') makeAlphaList(thisCh);
-            }
-        }
-        
-        function pU_show(anchor, offsetX, offsetY, defH)  // XY: rel. to anchor
-        {
-            if (!anchor) return;
-            
-            thisx = anchor.offsetLeft; thisy = anchor.offsetTop;
-            
-            while ((anchor = anchor.offsetParent))
-            { 
-                thisx += anchor.offsetLeft; thisy += anchor.offsetTop; 
-            }
-            
-            thisx += offsetX; thisy += offsetY;
-            
-            pU.style.left = thisx + "px";
-            pU.style.top =  thisy + "px";
-            pU.style.height = defH; var maxH = pU.offsetHeight;
-            for (var curH = 20; curH <= maxH; curH += 20)
-            {
-                pU.style.height = curH + 'px';
-                if (curH >= pU.scrollHeight) break;
-            }
-            // scrollHeight can be smaller than current in IE, not in Moz
-            pU.style.visibility = "visible";
-        }
-         
-        function pU_hide()
-        {
-            if (pU) pU.style.visibility = "hidden";
-        }
-        
-        function takeTypeIn(kws, oX, oY, defH)
-        {
-            if (isNotW3C()) return;
-            
-            if (!pU)
-            {
-                pU = document.getElementById('popup');
-                makeAlphaList(document.getElementById('maindiv'));
-                KWDS_ARRAY.sort();
-            }
-            
-            var curValue = kws.value.toLowerCase(), kwLines = '';
-            
-            for (pos = 0; pos < KWDS_ARRAY.length; pos++)
-                if (KWDS_ARRAY[pos].toLowerCase().indexOf(curValue) == 0)
-                    kwLines += '<div class="pul" onMouseOver="this.className=' + 
-                        "'lbl'" + '"; onMouseOut="this.className=' + "'pul'" + 
-                        '">' + KWDS_ARRAY[pos] + '</div>';
-            
-            if (kwLines == '') {pU_hide(); return; }
-            
-            pU.innerHTML = kwLines; pU_show(kws, oX, oY, defH);
-        }
-        
-        function pU_clicked(ev)
-        {
-            if (!pU) return false; if (!ev) var ev = window.event;
-            
-            var t = (ev.srcElement) ? ev.srcElement : ev.originalTarget;
-            try {var kw = t.innerHTML;} catch(exc) {return false;}  // Moz
-            
-            while (true) try
-            {
-                if (t.id == pU.id) return kw ? kw : true; t = t.parentNode;
-            } 
-            catch(exc) {return false;}  // Moz: t.parentNode uncatched exc.
-        }
-        
-        function pU_select(kw)
-        {
-            if (kw === true) return;
-            
-            var kws = document.getElementById('kwds_string');
-            var maindiv = document.getElementById('maindiv');
-            
-            var ch = maindiv.childNodes;
-            for (var i = 0; i < ch.length; i++)
-            {
-                var btn = ch.item(i);
-                if (hasTagAndClass(btn, 'INPUT', 'btn'))
-                    if (btn.value == '+') openOrClose(btn);
-            }
-            orkwds = new Array(',' + kw + ','); selectOriginal(maindiv);
-            
-            kws.value = getSelectedKeywords(); copyToClipboard(kws.value);
-         
-            pU_hide();
-        }
-        
-        
-        function getPptKw()  // SelKwds specific, IE only!
-        {
-            if (typeof window.ActiveXObject == 'undefined') return ''; 
-            
-            with (new ActiveXObject('Powerpoint.Application'))
-            {
-                if (Presentations.Count == 0) return '';
-                
-                var slKw = ActiveWindow.View.Slide.NotesPage(1)
-                    .Shapes.Placeholders(2).TextFrame.TextRange.Text
-                    .replace(/[\x00-\x1F\x7F-\x9F]/g, ' ')
-                    .replace(/\s+/g, ' ').trim();
-            }
-            
-            if (slKw.substr(0,1) == '<')
-            {
-                var slKwEnd = slKw.indexOf('>');
-                if (slKwEnd <= 0) return '';
-                return slKw.substr(1, slKwEnd - 1);
-            }
-            else
-            {
-                var slKwLen = slKw.length;
-                if (slKw.substr(slKwLen - 1) != '>') return '';
-                var slKwBegin = slKw.lastIndexOf('<');
-                if (slKwBegin <= 0) return '';
-                return slKw.substr(slKwBegin + 1, slKwLen - slKwBegin - 2);
-            }
-        }
-        
-    ]]></script>
-    
-    </head>
-
-    
-    <body onMouseUp="if ((kw = pU_clicked(event))) pU_select(kw); else pU_hide();">
-    
-    <!-- Note: style on DIV in TD, but keep vertical-align on TD -->
-    
-    <h3><xsl:value-of select="@title"/></h3>
-    
-    <div>
-        <input type="button" class="btn" value="?" onClick="openOrCloseHelp(this)"/>
-        &#xa0;Click a keyword in the tree to select or deselect it.
-    </div>
-    
-    <div id='moreHelp' class='dvc'>
-        <br/>
-        Click '+' button to open, '-' button to close, '++' button to open all, '--' button to close all.<br/>
-        <br/>
-        Clear all selected keywords by closing the tree and opening it again with the '+' button.<br/>
-        Alt-click '+' searches the current keywords in the tree.<br/>
-        Control-Alt-click '+' searches the keywords of the current slide.<br/>
-        <br/>
-        Alt-click keyword selects a keyword without broader terms or 
-        deselects a keyword with broader terms.<br/><br/>
-        Selected keywords are available in the Clipboard.<br/>
-        <br/>
-	    'nei' stands for 'not elswhere included'.<br/><br/>
-    </div>
-    
-    <div noWrap="1" id="maindiv">
-        <input type="button" class="btn" value="+" onClick="if (this.value == '+') deselectAll(event, this); openOrClose(this);"/>
-        <input type="button" class="btm" id="btnOpenOrCloseAll" value="++" onClick="openOrCloseAll(this);"/>
-        &#xa0;
-        <input type="text" id="kwds_string" class="kwl" 
-               onKeyUp="takeTypeIn(this, 200, 30, '60%'); return true;"/><br/>
-        <xsl:apply-templates/>
-    </div>
-    
-    <div id="popup" noWrap="1" class="pup">
-        Working...
-    </div>
-    
-    </body>
-    
-
-    </html>
-  </xsl:template>
-
-  <!-- par(ent) lev(el) and cur(rent) lev(el): '001', '002', '002001', ... -->
-  
-  <xsl:template match="*"><xsl:param name="parlev" select="''"/>
-    <xsl:variable name="tmplev" select="concat('00', position())"/>
-    <xsl:variable name="curlev" select="concat($parlev, substring($tmplev, string-length($tmplev) - 2))"/>
-    <div noWrap="1" class="dvc">
-        <xsl:attribute name="level"><xsl:value-of select="$curlev"/></xsl:attribute>
-        <xsl:if test="*">
-            <input type="button" class="btn" value="+" onClick="openOrClose(this);"/>
-        </xsl:if>
-        <xsl:if test="not(*)">
-            <input type="button" class="lfn" value=" "/>
-        </xsl:if>
-        &#xa0;
-        <span class="lbl" onClick="spanClick(this, event);">
-            <xsl:if test="@postit">
-                <xsl:attribute name="title"><xsl:value-of select="@postit"/></xsl:attribute>
-            </xsl:if>
-            <xsl:value-of select="translate(name(), '_', ',')"/>
-        </span>
-        <xsl:if test="@comment">
-            <i><xsl:value-of select="@comment"/></i>
-        </xsl:if>
-        <br/>
-        <xsl:apply-templates>
-            <xsl:with-param name="parlev" select="$curlev"/>
-        </xsl:apply-templates>
-        </div>
-  </xsl:template>
-
-</xsl:stylesheet>
-
-<!--
-    This program is free software; you can redistribute it and/or
-    modify it under the terms of the GNU General Public License
-    as published by the Free Software Foundation; either version 2
-    of the License, or (at your option) any later version.
-    
-    This program is distributed in the hope that it will be useful,
-    but WITHOUT ANY WARRANTY; without even the implied warranty of
-    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
-    GNU General Public License for more details.
-
-  -->

+ 0 - 23
main/metadata/doc/dcex.php

@@ -1,23 +0,0 @@
-<?php
-/**
- * Test file for metadata
- * @package chamilo.metadata
- */
-/**
- * Init
- */
-require_once api_get_path(SYS_CODE_PATH).'metadata/md_funcs.php'; $mdStore = new mdstore(TRUE);
-require_once api_get_path(LIBRARY_PATH) . 'xmd.lib.php';
-require_once api_get_path(LIBRARY_PATH) . 'xht.lib.php';
-require_once api_get_path(SYS_CODE_PATH).'metadata/md_document.php';
-
-$mdObj = new mdobject($_course, $docId);  // e.g. '12'
-
-// Fetch example:
-if (is_array($dcelems = $mdStore->mds_get_dc_elements($mdObj))) {
-	echo '<div>', htmlspecialchars($dcelems['Identifier']), ': ',
-	    htmlspecialchars($dcelems['Description']), '</div>';
-}
-// Store example:
-$langMdCopyright = 'Provided the source is acknowledged';
-$mdStore->mds_put_dc_elements($mdObj, array('Description'=>time()));

+ 0 - 189
main/metadata/doc/imsmanifest_reload.xml

@@ -1,189 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<!--This is a Reload version 1.0.18 Content Package document-->
-<!--Spawned from the Reload Content Package Generator - http://www.reload.ac.uk-->
-<manifest xmlns="http://www.imsglobal.org/xsd/imscp_v1p1" xmlns:imsmd="http://www.imsglobal.org/xsd/imsmd_v1p2" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" identifier="MANIFEST-DCFD9D7F-A83F-6E2C-F52B-7F1F44C7C15E" xsi:schemaLocation="http://www.imsglobal.org/xsd/imscp_v1p1 imscp_v1p1.xsd http://www.imsglobal.org/xsd/imsmd_v1p2 imsmd_v1p2p2.xsd">
-  <metadata>
-    <schema>IMS Content</schema>
-    <schemaversion>1.2.2</schemaversion>
-    <imsmd:lom>
-      <imsmd:general>
-        <imsmd:title>
-          <imsmd:langstring xml:lang="en">Summer Pictures</imsmd:langstring>
-        </imsmd:title>
-        <imsmd:catalogentry>
-          <imsmd:catalog />
-          <imsmd:entry>
-            <imsmd:langstring xml:lang="en" />
-          </imsmd:entry>
-        </imsmd:catalogentry>
-        <imsmd:language>en</imsmd:language>
-        <imsmd:description>
-          <imsmd:langstring xml:lang="en">Simple exemplar content package</imsmd:langstring>
-        </imsmd:description>
-        <imsmd:keyword>
-          <imsmd:langstring xml:lang="en">Exemplar</imsmd:langstring>
-        </imsmd:keyword>
-        <imsmd:structure>
-          <imsmd:source>
-            <imsmd:langstring xml:lang="x-none">LOMv1.0</imsmd:langstring>
-          </imsmd:source>
-          <imsmd:value>
-            <imsmd:langstring xml:lang="x-none">Linear</imsmd:langstring>
-          </imsmd:value>
-        </imsmd:structure>
-      </imsmd:general>
-      <imsmd:lifecycle>
-        <imsmd:version>
-          <imsmd:langstring xml:lang="en">0.1</imsmd:langstring>
-        </imsmd:version>
-        <imsmd:status>
-          <imsmd:source>
-            <imsmd:langstring xml:lang="x-none">LOMv1.0</imsmd:langstring>
-          </imsmd:source>
-          <imsmd:value>
-            <imsmd:langstring xml:lang="x-none">Draft</imsmd:langstring>
-          </imsmd:value>
-        </imsmd:status>
-      </imsmd:lifecycle>
-      <imsmd:metametadata>
-        <imsmd:contribute>
-          <imsmd:role>
-            <imsmd:source>
-              <imsmd:langstring xml:lang="x-none">LOMv1.0</imsmd:langstring>
-            </imsmd:source>
-            <imsmd:value>
-              <imsmd:langstring xml:lang="x-none">Creator</imsmd:langstring>
-            </imsmd:value>
-          </imsmd:role>
-          <imsmd:centity>
-            <imsmd:vcard>BEGIN:VCARD FN:Dr.Colin D. Milligan END:VCARD</imsmd:vcard>
-          </imsmd:centity>
-          <imsmd:date>
-            <imsmd:datetime>2003-07-08</imsmd:datetime>
-          </imsmd:date>
-        </imsmd:contribute>
-        <imsmd:metadatascheme>UKCMF</imsmd:metadatascheme>
-        <imsmd:language>en</imsmd:language>
-      </imsmd:metametadata>
-      <imsmd:technical>
-        <imsmd:format>text/html</imsmd:format>
-        <imsmd:location type="URI">http://www.reload.ac.uk/ex/testpkg.zip</imsmd:location>
-        <imsmd:installationremarks>
-          <imsmd:langstring xml:lang="en" />
-        </imsmd:installationremarks>
-      </imsmd:technical>
-      <imsmd:rights>
-        <imsmd:cost>
-          <imsmd:source>
-            <imsmd:langstring xml:lang="x-none">LOMv1.0</imsmd:langstring>
-          </imsmd:source>
-          <imsmd:value>
-            <imsmd:langstring xml:lang="x-none">no</imsmd:langstring>
-          </imsmd:value>
-        </imsmd:cost>
-        <imsmd:copyrightandotherrestrictions>
-          <imsmd:source>
-            <imsmd:langstring xml:lang="x-none">LOMv1.0</imsmd:langstring>
-          </imsmd:source>
-          <imsmd:value>
-            <imsmd:langstring xml:lang="x-none">no</imsmd:langstring>
-          </imsmd:value>
-        </imsmd:copyrightandotherrestrictions>
-        <imsmd:description>
-          <imsmd:langstring xml:lang="en">This content is copyright free.</imsmd:langstring>
-        </imsmd:description>
-      </imsmd:rights>
-      <imsmd:annotation>
-        <imsmd:person>
-          <imsmd:vcard>BEGIN:VCARD FN:Dr.Colin D. Milligan END:VCARD</imsmd:vcard>
-        </imsmd:person>
-        <imsmd:date>
-          <imsmd:datetime>2003-07-08</imsmd:datetime>
-        </imsmd:date>
-        <imsmd:description>
-          <imsmd:langstring xml:lang="en">These materials are very simplistic.</imsmd:langstring>
-        </imsmd:description>
-      </imsmd:annotation>
-    </imsmd:lom>
-  </metadata>
-  <organizations default="ORG-D6257D46-F4BF-B282-732C-8412E21AC988">
-    <organization identifier="ORG-D6257D46-F4BF-B282-732C-8412E21AC988" structure="hierarchical">
-      <title>Summer Pictures</title>
-      <item identifier="ITEM-AB190567-46F6-DEA5-321F-18035FC94656" isvisible="true" identifierref="RES-96882175-AA6B-4A19-0160-EB3A181E7115">
-        <title>Loch Katrine</title>
-      </item>
-      <item identifier="ITEM-061E8E5A-1B1C-EFCA-8FA3-6BB89732226B" isvisible="true" identifierref="RES-B3A9C9BF-58B4-A7E8-9C14-E909E01ED753">
-        <title>Ben Ledi</title>
-      </item>
-      <item identifier="ITEM-6B895A68-4D42-CB93-594F-3EF2AE17F8FA" isvisible="true" identifierref="RES-1DC3140B-3BA5-3888-E090-B7041D71880A">
-        <title>Jencks Earthwork</title>
-      </item>
-      <item identifier="ITEM-F3C883BF-E1E7-9B6D-2E7A-06C4B88FD424" isvisible="true" identifierref="RES-8C97ECAB-F3EA-A391-FFC7-1B10CB4A8914">
-        <title>MSP Cells</title>
-      </item>
-      <item identifier="ITEM-D07C70BD-EF62-FEA9-3EAB-016CFD6FB566" isvisible="true" identifierref="RES-94D147FA-06F1-BCA6-5EFC-29C123481EE4">
-        <title>Holyrood Building Site</title>
-      </item>
-      <item identifier="ITEM-47419598-DDAC-D593-9336-A189ED37036F" isvisible="true" identifierref="RES-59CE1240-62AD-E5A9-DF4A-D9C91E370932">
-        <title>Salisbury Crags</title>
-      </item>
-      <item identifier="ITEM-A69B52E2-C70D-9099-6E63-EDB81BC81E80" isvisible="true" identifierref="RES-99863A93-02C8-8996-2FD1-6042124014FD">
-        <title>Castle Sunset</title>
-      </item>
-      <item identifier="ITEM-BEBD6D04-5C98-58C8-A967-907D01BF9D08" isvisible="true" identifierref="RES-42D808C8-431A-D55E-E941-211BDDE5DF02">
-        <title>Bridges Sunset</title>
-      </item>
-    </organization>
-  </organizations>
-  <resources>
-    <resource identifier="RES-42D808C8-431A-D55E-E941-211BDDE5DF02" type="webcontent" href="one.html">
-      <file href="one.html" />
-      <file href="supp/reloadhelp.css" />
-      <file href="supp/reloadeditoricon.gif" />
-      <file href="supp/sunset1.jpg" />
-    </resource>
-    <resource identifier="RES-99863A93-02C8-8996-2FD1-6042124014FD" type="webcontent" href="two.html">
-      <file href="two.html" />
-      <file href="supp/reloadhelp.css" />
-      <file href="supp/reloadeditoricon.gif" />
-      <file href="supp/sunset2.jpg" />
-    </resource>
-    <resource identifier="RES-B3A9C9BF-58B4-A7E8-9C14-E909E01ED753" type="webcontent" href="three.html">
-      <file href="three.html" />
-      <file href="supp/reloadhelp.css" />
-      <file href="supp/reloadeditoricon.gif" />
-      <file href="supp/benledi.jpg" />
-    </resource>
-    <resource identifier="RES-8C97ECAB-F3EA-A391-FFC7-1B10CB4A8914" type="webcontent" href="four.html">
-      <file href="four.html" />
-      <file href="supp/reloadhelp.css" />
-      <file href="supp/reloadeditoricon.gif" />
-      <file href="supp/cells.jpg" />
-    </resource>
-    <resource identifier="RES-96882175-AA6B-4A19-0160-EB3A181E7115" type="webcontent" href="five.html">
-      <file href="five.html" />
-      <file href="supp/reloadhelp.css" />
-      <file href="supp/reloadeditoricon.gif" />
-      <file href="supp/trossachs.jpg" />
-    </resource>
-    <resource identifier="RES-1DC3140B-3BA5-3888-E090-B7041D71880A" type="webcontent" href="six.html">
-      <file href="six.html" />
-      <file href="supp/reloadhelp.css" />
-      <file href="supp/reloadeditoricon.gif" />
-      <file href="supp/jencks.jpg" />
-    </resource>
-    <resource identifier="RES-94D147FA-06F1-BCA6-5EFC-29C123481EE4" type="webcontent" href="seven.html">
-      <file href="seven.html" />
-      <file href="supp/reloadhelp.css" />
-      <file href="supp/reloadeditoricon.gif" />
-      <file href="supp/holyrood.jpg" />
-    </resource>
-    <resource identifier="RES-59CE1240-62AD-E5A9-DF4A-D9C91E370932" type="webcontent" href="eight.html">
-      <file href="eight.html" />
-      <file href="supp/reloadhelp.css" />
-      <file href="supp/reloadeditoricon.gif" />
-      <file href="supp/crags.jpg" />
-    </resource>
-  </resources>
-</manifest>
-

+ 0 - 140
main/metadata/doc/mdApiTest.php

@@ -1,140 +0,0 @@
-<?php
-/**
- * mdApiTest.php
- * 2004/09/30
- * @copyright 2004 rene.haentjens@UGent.be -  see metadata/md_funcs.php
- * @package chamilo.metadata
- */
-/**
-*	Chamilo Metadata: MD API test and demo
-*   The API allows other Dokeos scripts to define & manipulate metadata
-*   In this example, MD is defined for 'Document.1001', 1002, 1003
-*/
-
-require("../md_funcs.php");
-
-define('EID_TYPE', 'Document');
-require('../md_' . strtolower(EID_TYPE) . '.php');
-
-// name of the language file that needs to be included
-/*
-$language_file = 'Whatever';
-*/
-require("../../inc/global.inc.php");
-
-isset($_course) or give_up("Select a course first...");
-
-$is_allowed_to_edit = isset($_user['user_id']) && $is_courseMember && is_allowed_to_edit();
-if (!$is_allowed_to_edit) give_up("You're not allowed to edit...");
-
-$mdStore = new mdstore($is_allowed_to_edit);  // create table if needed
-
-require(api_get_path(LIBRARY_PATH) . 'xmd.lib.php'); // mds_update_xml_and_mdt
-require(api_get_path(LIBRARY_PATH) . 'xht.lib.php'); // mdo_generate_default_xml_metadata
-
-$noPHP_SELF = TRUE;
-Display::display_header($nameTools); echo "\n";
-
-// if the language file in use is not 'md_' . EID_TYPE ...
-$langMdTitle =          'Default Title (if doc not in DB)';
-$langMdDescription =    'Default description (if doc has no comment)';
-$langMdCoverage =       'bachelor of engineering';
-$langMdCopyright =      'Ghent University';
-
-
-foreach(array(1001, 1002, 1003) as $eid_id)
-{
-    $mdObj = new mdobject($_course, $eid_id);  // see 'md_' . EID_TYPE . '.php'
-    $eid = $mdObj->mdo_eid;
-
-    $titlePath = $mdObj->mdo_dcmap_v['Title'];   // no IEEE dependencies here...
-
-    if (($mdt_rec = $mdStore->mds_get($eid)) === FALSE)
-    {
-         $mdt = $mdObj->mdo_generate_default_xml_metadata();
-
-         $xmlDoc = new xmddoc(explode("\n", $mdt));
-         if (!$xmlDoc->error)
-         {
-             echo htmlspecialchars($titlePath), ': ';
-             $mdTitle = $xmlDoc->xmd_value($titlePath);
-             if ($mdTitle == $langMdTitle)
-             {
-                 $mdTitle = EID_TYPE . ' ' . $eid_id;
-                 $xmlDoc->xmd_update($titlePath, $mdTitle);
-                 $mdt = $xmlDoc->xmd_xml();
-             }
-             echo htmlspecialchars($mdTitle), ':';
-         }
-
-         $mdStore->mds_put($eid, $mdt, 'mdxmltext', FALSE);
-         echo '<a href="../index.php?eid=', urlencode($eid), '">',
-            htmlspecialchars($eid), '</a><br>';
-    }
-}
-echo '<br>';
-
-
-$xmlDoc = new xmddoc(explode("\n", $mdStore->mds_get($eid = EID_TYPE . '.1002')));
-if ($xmlDoc->error) give_up($xmlDoc->error);
-
-$mdObj = new mdobject($_course, '1002');
-$mda = "~~";  // delete metadata of 'Document.1002'
-$mdt = $mdStore->mds_update_xml_and_mdt($mdObj, $xmlDoc, $mda, $eid, $trace);
-// note: $xmlDoc and $trace are passed by reference...
-
-
-$mdObj = new mdobject($_course, '1003');
-$xmlDoc = new xmddoc(explode("\n", $mdStore->mds_get($eid = EID_TYPE . '.1003')));
-if ($xmlDoc->error) give_up($xmlDoc->error);
-
-$map_lang = 'string/@language';
-$dcmap_e_kwplace = 'metadata/lom/general'; $dcmap_e_kwelem = 'keyword';
-$dcmap_e_keyword = $dcmap_e_kwplace . '/' . $dcmap_e_kwelem;
-
-$mda =  $mdObj->mdo_dcmap_v['Description'] . '=Nouvelle description' .
-        "\n" . $mdObj->mdo_dcmap_e['Coverage'] . "~" .
-        "\n" . $dcmap_e_kwplace . '!' . $dcmap_e_kwelem .
-        "\n" . $dcmap_e_keyword . "[-1]!string=afrique" .
-        "\n" . $dcmap_e_keyword . "[-1]/" . $map_lang . "=en" .
-        "\n" . $mdObj->mdo_dcmap_e['Title'] . ',' .
-            $mdObj->mdo_dcmap_e['Description'] . ',' .
-            $dcmap_e_keyword . ";" . $map_lang . "=fr" .
-        "";  // update metadata of 'Document.1003' - see md_funcs
-        // note we don't go far with IEEE independence...
-$mdt = $mdStore->mds_update_xml_and_mdt($mdObj, $xmlDoc, $mda, $eid, $trace);
-
-echo htmlspecialchars($trace), '<br><br>';
-
-
-// The simplest API calls: store and fetch DC metadata element values:
-
-$mdObj = new mdobject($_course, '1003');
-$mdStore->mds_put_dc_elements($mdObj, array('Coverage' => 'broad...', 'Type' => 'aggressive text'));
-// Coverage won't work, because that element has been removed above...
-$dcelem = $mdStore->mds_get_dc_elements($mdObj);
-foreach (array('Identifier', 'Title', 'Language', 'Description', 'Coverage',
-                        'Type', 'Date', 'Creator', 'Format', 'Rights') as $dce)
-{
-    echo $dce, '= ', htmlspecialchars($dcelem[$dce]), '<br>';
-}
-
-echo '<br>';
-
-$mdObj = new mdobject($_course, '1002');
-$mdStore->mds_put_dc_elements($mdObj, array('Coverage' => 'broad...'));
-$dcelem = $mdStore->mds_get_dc_elements($mdObj);
-foreach (array('Identifier', 'Title', 'Language', 'Description', 'Coverage',
-                        'Type', 'Date', 'Creator', 'Format', 'Rights') as $dce)
-{
-    echo $dce, '= ', htmlspecialchars($dcelem[$dce]), '<br>';
-}
-
-echo '<br>';
-
-$mdStore->mds_append(EID_TYPE . '.1001', ' search words');
-$mdStore->mds_append(EID_TYPE . '.1001', ' more findable terms');
-
-
-Display::display_footer();
-?>

+ 0 - 61
main/metadata/doc/mdp_scorm.htt

@@ -1,61 +0,0 @@
-<!-- {-mdp_scorm_rls.htt-} -->            <!-- for Dokeos metadata/index.php -->
-                                                             <!-- 2005/04/19 -->
-
-<!-- Copyright (C) 2005 rene.haentjens@UGent.be -  see metadata/md_funcs.php -->
-
-
-<!-- {-METADATA-} -->
-
-{-D level {-V @level-}-}{-T level == 0 C SCORM0-}{-T level != 0 C SCORM123-}
-
-
-<!-- {-SCORM0-} -->
-
-<h1>{-X title-}</h1>
-
-<table>
-    {-R child C SUBITEM-}
-</table>
-
-
-<!-- {-SUBITEM-} -->
-
-<tr>
-    <td><a href="{-P self-}&sid={-U {-V @identifier-}-}">{-X @identifier-}</a></td>
-    <td><a href="{-U {-V resource/@href-}-}" target="_blank">{-X title-}</a></td>
-</tr>
-    
-
-<!-- {-SCORM123-} -->
-
-<br/>
-{-D prv {-V previous/@identifier-}-}{-D nxt {-V next/@identifier-}-}{-D kwds {-X metadata/lom/general/keyword/string , -}-}
-<table border="1" width="100%">
-    <tr>
-        <td align="left">
-        {-T prv != empty <a href="{-P self-}&sid={-U {-P prv-}-}">{-H {-P prv-}-}</a>-}{-T prv == empty X @identifier-}
-        </td>
-        <td align="center">
-         <a href="{-P self-}&sid={-U {-V parent/@identifier-}-}">{-X parent/@identifier-}</a>
-        </td>
-        <td align="right">
-        {-T nxt != empty <a href="{-P self-}&sid={-U {-P nxt-}-}">{-H {-P nxt-}-}</a>-}{-T nxt == empty X @identifier-}
-        </td>
-    </tr>
-    <tr>
-        <td colspan="3"><a href="{-U {-V resource/@href-}-}" target="_blank">{-X @identifier-}: <font size="+1">{-X title-}</font></a></td>
-    </tr>
-</table>
-
-
-<!-- {-HEAD-} -->
-
-<title>{-X title-}</title>
-
-
-<!-- {-HTTP-} -->
-
-Expires: Mon, 26 Jul 1997 05:00:00 GMT
-
-
-<!-- {--} -->

+ 0 - 241
main/metadata/doc/testMiniDom.php

@@ -1,241 +0,0 @@
-<?php
-/**
- * testMiniDom.php
- * 2005/03/16
- * for XML MiniDom, 2005/03/16
- * @copyright (C) 2005 rene.haentjens@UGent.be
- *	@package chamilo.metadata
- */
-/**
- *	Chamilo Metadata: XMD test and demo
- */
-function file_get_contents_n($filename)  // normalize \r and \r\n to \n
-{
-    $fp = fopen($filename, 'rb');
-    $buffer = fread($fp, filesize($filename));
-    fclose($fp);  // note file_get_contents is >= PHP 4.3.0
-
-    return str_replace("\r", "\n", str_replace("\r\n", "\n", $buffer));
-}
-
-
-require("../../inc/lib/xmd.lib.php");
-
-
-$testdoc = new xmddoc('<docroot/>');  // docroot is element 0
-
-
-function showDoc($title, $morestuff = '')
-{
-    global $testdoc; echo '<h4>', $title, '</h4>', '<pre>',
-        htmlspecialchars($morestuff ? $morestuff : $testdoc->xmd_xml()), '</pre>';
-}
-
-
-$sometag1 = $testdoc->xmd_add_element('sometag');
-$testdoc->xmd_set_attribute(0, 'owner', 'rene');
-$testdoc->xmd_add_text('text in my first child element', $sometag1);
-
-showDoc('Small XML document');
-
-$sometag2 = $testdoc->xmd_add_element('sometag', 0, array('x' => 'somevalue'));
-$testdoc->xmd_add_text('bizarre <text> in "my& 2nd child', $sometag2);
-$testdoc->xmd_add_text(' + more text in first one', $sometag1);
-$testdoc->xmd_set_attribute($sometag2, 'owner', '<c&a">');
-$testdoc->xmd_add_element('innertag', $sometag2);
-
-showDoc('Slightly changed');
-
-showDoc('All text', $testdoc->xmd_text());
-
-$stuff = '';
-foreach ($testdoc->xmd_get_element($sometag2) as $key => $value)
-    $stuff .= $key . ': ' . $value . "\n";
-
-showDoc('Children, attributes, name and parent of 2nd sometag', $stuff);
-
-$testdoc->xmd_remove_nodes('text in my first child element', $sometag1);
-// note: remove text may remove more than one node...
-$testdoc->xmd_set_attribute(0, 'owner', 'haentjens');  // new value
-
-showDoc('Text removed from 1st sometag, docroot owner changed');
-
-$testdoc->xmd_remove_element($sometag2);
-$sometag2 = $testdoc->xmd_add_text_element('��', 'alors!');
-
-showDoc('2nd sometag replaced by new subelement with French name');
-
-$testdoc->name[$sometag2] = 'sometag';  // properties are read/write
-$testdoc->xmd_set_attribute($sometag2, 'xmlns:tn', 'urn:ugent-be');  // namesp def
-$subtag = $testdoc->xmd_add_element('urn:ugent-be:subtag', $sometag2);
-$testdoc->xmd_set_attribute($sometag2, 'urn:ugent-be:owner', 'FTW');
-
-showDoc('French name replaced, namespace definition added and used');
-
-$testdoc->xmd_set_attribute($sometag1, 'urn:ugent-be:owner', 'FTW');
-$testdoc->xmd_set_attribute($sometag1, 'urn:rug-ac-be:owner2', 'FLA');
-// restriction: cannot add attribute 'urn:rug-ac-be:owner' (same name)
-
-showDoc('Attributes with namespaces added, ns def is auto-generated');
-
-$stuff = 'subtag => ' . $testdoc->xmd_get_ns_uri($subtag) . "\n";
-foreach ($testdoc->attributes[$sometag1] as $name => $value)
-    $stuff .= $name . ' => ' . $testdoc->xmd_get_ns_uri($sometag1, $name) . "\n";
-
-showDoc('Namespace-URI of subtag, of 1st sometag attributes', $stuff);
-
-$subsub = $testdoc->xmd_add_element('urn:sample-default:subsub', $subtag,
-    array('xmlns' => 'urn:sample-default', 'someatt' => 'somevalue'));
-$subsubsub = $testdoc->xmd_add_element('urn:sample-default:subsubsub', $subsub);
-
-showDoc('Subsub element has default namespace');
-
-$stuff = 'subsub => ' . $testdoc->xmd_get_ns_uri($subsub) . "\n";
-$stuff .= 'subsubsub => ' . $testdoc->xmd_get_ns_uri($subsubsub) . "\n";
-foreach ($testdoc->attributes[$subsub] as $name => $value)
-    $stuff .= $name . ' => ' . $testdoc->xmd_get_ns_uri($subsub, $name) . "\n";
-
-showDoc('Namespace-URI of subsub and subsubsub; attributes have none', $stuff);
-
-$testdoc->xmd_update('!newtag', 'text for newtag');
-showDoc("After update '!newtag', 'text for newtag'");
-
-$testdoc->xmd_update('newtag', 'new text for newtag');
-showDoc("After update 'newtag', 'new text for newtag'");
-
-$testdoc->xmd_update('newtag/@someatt', 'attval');
-showDoc("After update 'newtag/@someatt', 'attval'");
-
-$testdoc->xmd_update('newtag/~', '');
-showDoc("After update 'newtag/~', ''");
-
-$keepdoc = $testdoc;
-
-$wrongdoc = "<html>\n  <body>\n    <p>Text</p>\n    <p>More text" .
-    "\n  </body>\n</html>";
-$testdoc = new xmddoc(explode("\n", $wrongdoc));
-
-showDoc('Xml doc with syntax error + error message',
-    $wrongdoc . "\n\n" . $testdoc->error);
-
-$xmlFile = 'imsmanifest_reload.xml';
-
-($presXmlFileContents = @file_get_contents_n($xmlFile))
-    or die('XML file  ' . htmlspecialchars($xmlFile) . ' is missing...');
-
-showDoc('XML file to be parsed', $presXmlFileContents);
-
-$testdoc = new xmddoc(explode("\n", $presXmlFileContents));
-unset($presXmlFileContents);
-
-if ($testdoc->error) die($xmlFile . ':<br><br>' . $testdoc->error);
-
-$testdoc->xmd_update_many('metadata/lom/general/title,metadata/lom/general/description', 'langstring/@lang', 'fr');
-$testdoc->xmd_copy_foreign_child($keepdoc, $keepdoc->xmd_select_single_element('sometag[2]'));
-
-showDoc('After parsing, and after changing 2* langstring/@lang to fr, ' .
-    'and after adding a foreign doc, reconstruction from memory');
-
-showDoc('Element tagname of first metadata/lom/* element',
-    $testdoc->name[$testdoc->xmd_select_single_element('metadata/lom/*')]);
-
-showDoc('Element namespace URI of metadata/lom/*[2]',
-    $testdoc->xmd_get_ns_uri($testdoc->xmd_select_single_element('metadata/lom/*[2]')));
-
-showDoc('Number of metadata/lom/* elements',
-    count($testdoc->xmd_select_elements('metadata/lom/*')));
-
-showDoc('Number of resources/resource/file elements with @href',
-    count($testdoc->xmd_select_elements_where_notempty(
-        'resources/resource/file', '@href')));
-
-$elems = $testdoc->xmd_select_elements_where('resources/resource',
-            'file[1]/@href', 'three.html');
-showDoc('Resource identifier where file[1]/@href is three.html',
-    $testdoc->xmd_value('@identifier', $elems[0]));
-
-$elems = $testdoc->xmd_select_elements_where('resources/resource', '@identifier',
-    $testdoc->xmd_value('organizations/organization/item[2]/@identifierref'));
-showDoc('Resource href for item[2]',
-    $testdoc->xmd_value('@href', $elems[0]));
-
-$stuff = '';
-foreach (array('@identifier', 'metadata/schema', '*/*/*/*[1]/langstring',
-        'resources/resource[3]/@href', 'resources/resource[3]/file/@href',
-        'resources/resource[3]/@*', 'resources/resource[3]/-/@href',
-        'resources/resource[3]/+/@href', 'resources/resource[1]/-/@href',
-        'resources/../../../../../../../@identifier', '@*', 'resources/@*',
-        'organizations/organization/item[4]/title',
-        'organizations/organization/item[-2]/title',
-        'organizations/organization/item[4]/@*',
-        'organizations/organization/item[4]/@*item',
-        'organizations/organization/item[2]/+item/title',
-        'organizations/organization/item[2]/+/+/+/title',
-        'organizations/organization/item[2]/-item',
-        'organizations/organization/item[1]/-item',
-        'organizations/organization/item[1]/-',
-        'organizations/organization/item[1]/-/@.'
-        ) as $path)
-    $stuff .= $path . ' => ' . $testdoc->xmd_value($path) . "\n";
-
-showDoc('Values of: @identifier, metadata/schema, ... (see below)', $stuff);
-
-
-function showHtml($path)
-{
-    global $testdoc; echo '<h4>Html-value of ', htmlspecialchars($path),
-        '</h4><pre>', $testdoc->xmd_html_value($path), '</pre>';
-}
-
-
-showHtml('/*/organizations/organization/item[1]/title');
-
-showHtml('organizations/organization/item/title');
-
-showHtml('organizations/organization/item/title *');
-
-showHtml('Titles:  -% organizations/organization/item/titl ,  %- .');
-// if no elements are found, prefix and postfix are not generated
-
-showHtml('Titles:  -% organizations/organization/item/title ,  %- .');
-
-showHtml('<ul><li> -% resources/resource/file/../@identifier </li><li> %- </li></ul>');
-
-showHtml('metadata/lom/general/description/langstring');
-echo '<h5>The same, but in a HTML construct:</h5>',
-    $testdoc->xmd_html_value('metadata/lom/general/description/langstring');
-
-
-function getmicrotime()
-{
-   list($usec, $sec) = explode(" ",microtime());
-   return ((float)$usec + (float)$sec);
-}
-
-$xmlFile = 'imsmanifest_reload.xml';
-
-($presXmlFileContents = @file_get_contents_n($xmlFile))
-    or die('XML file  ' . htmlspecialchars($xmlFile) . ' is missing...');
-$presXmlFileContents = explode("\n", $presXmlFileContents);
-
-$seconds = getmicrotime();
-$testdoc2 = new xmddoc($presXmlFileContents);
-$seconds = getmicrotime() - $seconds;
-
-showDoc('Time to parse', $seconds);
-
-$seconds = getmicrotime();
-$testdoc2->xmd_cache();
-$seconds = getmicrotime() - $seconds;
-
-showDoc('Time to cache', $seconds);
-
-$seconds = getmicrotime();
-$testdoc = new xmddoc($testdoc2->names, $testdoc2->numbers,
-    $testdoc2->textstring);
-$seconds = getmicrotime() - $seconds;
-
-showDoc('Time to restore from cache', $seconds);
-
-showDoc('OK after restore');
-?>

+ 0 - 215
main/metadata/doc/testXht.php

@@ -1,215 +0,0 @@
-<?php 
-/**
- * testXht.php, 
- * 2005/03/16
- * for XML HTML Templates, 2005/03/16
- * @copyright 2005 rene.haentjens@UGent.be                              -->
- * @package chamilo.metadata
- */
-/**
- * Chamilo Metadata: XHT test and demo
- */
-
-require('../../inc/lib/xmd.lib.php');
-require('../../inc/lib/xht.lib.php');
-
-
-// XML DOCUMENT --------------------------------------------------------------->
-
-$testdoc = new xmddoc(
-<<<EOD
-<docroot xmlns:imsmd="http://www.imsglobal.org/xsd/imsmd_v1p2">
-    <title>Test for XML HTML Templates</title>
-    <description>This is a [b]test[/b] for &amp;#911; XML with &lt;some&gt; &quot;funny&quot; stuf&#102;...
-    a new line and <x>1</x> inside tag.</description>
-    <keywords>
-        <keyword>kw1</keyword>
-        <keyword>kw2</keyword>
-        <keyword>kw3</keyword>
-    </keywords>
-    <metadata>
-        <schema>IMS Content</schema>
-        <schemaversion>1.2.2</schemaversion>
-        <imsmd:lom>
-          <imsmd:general>
-            <imsmd:catalogentry>
-              <imsmd:catalog />
-              <imsmd:entry>
-                <imsmd:langstring xml:lang="en" />
-              </imsmd:entry>
-            </imsmd:catalogentry>
-            <imsmd:language>en</imsmd:language>
-            <imsmd:description>
-              <imsmd:langstring xml:lang="en">Simple exemplar content package
-
-
-, this description was
-                         modified
-by
-               Ren&eacute;
-                                       </imsmd:langstring>
-            </imsmd:description>
-          </imsmd:general>
-        </imsmd:lom>
-    </metadata>
-</docroot>
-EOD
-);
-
-if ($testdoc->error) die($testdoc->error);
-
-
-// TEMPLATES ------------------------------------------------------------------>
-
-$xhtDoc = new xhtdoc(
-<<<EOD
-<!-- {-HTTP-} -->
-
-Expires: Mon, 26 Jul 1997 05:00:00 GMT
-
-
-<!-- {-HEAD-} -->
-
-<style type="text/css"> .bg3 {background-color:#E2E2E2} </style>
-
-
-<!-- {-MAIN-} -->
-
-<h1>testXht</h1>
-
-<h3>{-X title-}</h3>
-
-Hello {-P p1-}! {-X description-}<br>
-{-X metadata/lom/general/description/langstring-}<br><br>
-
-{-D label This is a funny <La"bel>-}{-C LABEL-}<br><br>
-<table>
-    {-R keywords/keyword C KEYWORD-}
-</table>
-There are {-R keywords/keyword P empty-}{-P number-} keywords...<br><br>
-
-<select>
-    {-D selkey nl-}{-R Langnames C OPTION-}
-</select>
-<br><br>
-
-{-R Langnames C LEVEL1-}<br><br>
-
-{-D author {-V author-}-}
-{-T author != empty
-<h5>There is an author</h5>
-<!-- Note1: T tests parameters, not XML values directly -->
-<!-- Note2: the space after 'empty' is necessary! - see below
- -}
-{-T author != empty
-parses wrong because missing space after 'empty'
- -}<br><br>
-
-Special parentheses {-can still be used-} for other -}{-{-purposes...
-<br>
-Nesting is {-H {-L Am-}-}
-<br><br>
-
-{-E md_cache C RECALC-}
-
-
-<!-- {-RECALC-} -->
-
-This text is re-calculated when the cache is no longer valid.
-
-
-<!-- {-LABEL-} -->
-
-<span class="bg3">{-H {-P label-}-}&#xa0;:</span>&#xa0;
-
-
-<!-- {-KEYWORD-} -->
-
-<tr>
-    <td>{-D label {-L Kw-}-}{-C LABEL-}{-X .-}</td>
-    <td><input type="checkbox" title="keyword{-P number-}"/></td>
-</tr>
-
-
-<!-- {-OPTION-} -->
-
-<option value="{-H {-P key-}-}" {-T key == selkey selected-}>{-H {-P value-}-}</option>
-
-
-<!-- {-LEVEL1-} -->
-
-<b>{-P rdepth-}.{-P key-}</b>: {-R keywords/keyword C LEVEL2-}<br>
-
-
-<!-- {-LEVEL2-} -->
-
-{-P rdepth-}.{-P number-}
-
-
-<!-- {--} -->
-EOD
-);
-
-if ($xhtDoc->htt_error) die($xhtDoc->htt_error);
-
-$xhtDoc->xht_xmldoc = $testdoc;
-
-
-// PREPARE FOR PROCESSING ----------------------------------------------------->
-
-function get_lang($word)
-{
-    if ($word == 'Kw') return 'Keyword';
-    elseif ($word == 'Am') return '"Automatic"';
-    elseif ($word == 'Langnames')
-        return array("de"=>"German", "fr"=>"French", "nl"=>"Dutch");
-    else return 'To be translated';
-}
-
-$xhtDoc->xht_get_lang = 'get_lang';
-
-$xhtDoc->xht_param['p1'] = 'world';
-
-function md_cache($newtext)  // callback from template (for cached HTML)
-{
-    if ($newtext === FALSE)  // this is always the first callback
-    {
-        $cachedHtmlIsValid = FALSE;  // in real examples, not always
-
-        if ($cachedHtmlIsValid)
-            return 'Cached HTML';
-        else
-            // do some preparations
-            return FALSE;  // signals XHT to generate new text from template
-    }
-    else    // after template expansion, XHT does a second callback
-    {
-        // store the new text in the cache...
-        // possibly modify the text to be output...
-        return $newtext;  // often the output is identical to the new text
-    }
-}
-
-
-// GENERATE OUTPUT ------------------------------------------------------------>
-
-foreach (explode("\n", $xhtDoc->htt_array['HTTP']) as $httpXtra)
-    if ($httpXtra) header($httpXtra);
-
-echo "<html>\n<head>", $xhtDoc->xht_fill_template('HEAD'),
-    "\n</head>\n\n<body>\n";
-
-$xhtDoc->xht_dbgn = 0;  // for template debug info, set to e.g. 10000
-
-echo $xhtDoc->xht_fill_template('MAIN'),
-    '<br><br>Child nodes of "description":';
-
-foreach($testdoc->children[$testdoc->xmd_select_single_element('description')] as $child)
-    echo '<br>', strlen($child), ': ', htmlspecialchars($child);
-echo "\n\n</body>\n</html>\n";
-
-if ($xhtDoc->xht_dbgn) echo $xhtDoc->xht_dbgo;
-
-// Note: XML document and templates would normally be fetched from (different)
-// external sources, such as a file or a DB record...
-?>

+ 0 - 106
main/metadata/importdocs.php

@@ -1,106 +0,0 @@
-<?php 
-/**
- * Chamilo metadata/importdocs.php
- * 2005/09/20
- * Copyright (C) 2005 rene.haentjens@UGent.be -  see metadata/md_funcs.php
- * @package chamilo.metadata
- */
-/**
- * Chamilo Metadata: index all course documents with PhpDig
- */
-// PRELIMS -------------------------------------------------------------------->
-$getpostvars = array('dmo'); require('md_funcs.php');
-
-define('EID_TYPE', 'Document'); define('AFTER_DOT', strlen(EID_TYPE) + 1);
-define('OF_EID_TYPE', "eid LIKE '" . EID_TYPE . ".%'");
-
-require('md_' . strtolower(EID_TYPE) . '.php');
-
-// name of the language file that needs to be included
-$language_file = 'md_' . strtolower(EID_TYPE);
-include('../inc/global.inc.php');
-$nameTools = get_lang('Tool');
-
-($nameTools && get_lang('Sorry')) or give_up(
-    'Language file ' . $language_file . " doesn't define 'Tool' and 'Sorry'");
-
-$_course = api_get_course_info(); isset($_course) or give_up(get_lang('Sorry'));
-
-$is_allowed_to_edit = isset($_user['user_id']) && $is_courseMember && api_is_allowed_to_edit();
-if (!$is_allowed_to_edit) give_up(get_lang('Denied'));
-
-$mdObj = new mdobject($_course, 0);
-$mdStore = new mdstore($is_allowed_to_edit);  // create table if needed
-
-require(api_get_path(LIBRARY_PATH) . 'xmd.lib.php');
-require(api_get_path(LIBRARY_PATH) . 'xht.lib.php');
-
-require('md_phpdig.php');
-
-$mdObj->mdo_add_breadcrump_nav();  // see 'md_' . EID_TYPE . '.php'
-
-$htmlHeadXtra[] = '
-<link rel="stylesheet" type="text/css" href="md_styles.css">
-<script type="text/javascript" src="md_script.js"></script>
-';
-Display::display_header($nameTools);
-
-
-if (isset($dmo))  // for future use
-{
-    echo '<h3>', $dmo, '</h3>', "\n";  // document metadata op
-
-    // if ($dmo == get_lang('Index')) $dmo = $dmo;
-}
-
-$result = $mdStore->mds_get_many('eid,indexabletext', OF_EID_TYPE);
-echo get_lang('Tool'), ': ', Database::num_rows($result), "<br><br>\n";
-
-$idt = array(); $cidpar = '?cidReq=' . $_course['sysCode'];
-
-while ($row = Database::fetch_array($result))  // load indexabletexts in memory
-{
-    $mdObj = new mdobject($_course, substr($row['eid'], AFTER_DOT));
-    $idt[$mdObj->mdo_url . $cidpar] = $row['indexabletext'];
-}
-
-if (count($idt) && file_exists($phpDigIncCn))
-{
-    require($phpDigIncCn);  // switch to PhpDig DB
-
-    foreach ($idt as $url => $text)
-    if (ereg('^http://([^/]+)/(.+)/([^/]+)\?cidReq=(.+)$', $url, $regs))
-    {
-        $path = $regs[2] .'/'; $file = $regs[3] . '?cidReq=' . $regs[4];
-        if ($site_id = remove_engine_entries('http://' . $regs[1] .'/',
-                $path, $file))
-        {
-            echo '<table>', "\n";
-            index_words($site_id, $path, $file,
-                get_first_words($text, $path, $file),
-                get_keywords($text));
-            echo '</table>', "\n";
-        }
-    }
-
-    if(isset($db))
-    {
-    	//mysql_select_db($_configuration['main_database'], $db);
-    	Database::select_db($_configuration['main_database'], $db);
-    }
-}
-else
-{
-	echo 'No documents with metadata or no PhpDig in this course...<br />';
-}
-
-if (false && file_exists($phpDigIncCn))  // future: buttons for operations
-{
-    echo '<form action="' .api_get_self(). '" method="post">', "\n",
-        '<input type="submit" name="dmo" value="', get_lang('Import', 'noDLTT'), '">', "\n",
-        '<input type="submit" name="dmo" value="', get_lang('Remove', 'noDLTT'), '">', "\n",
-        '</form>', "\n";
-}
-
-Display::display_footer();
-?>

+ 0 - 357
main/metadata/importlinks.php

@@ -1,357 +0,0 @@
-<?php
-/**
- * Chamilo metadata/importlinks.php
- * 2006/12/15
- * Copyright (C) 2006 rene.haentjens@UGent.be -  see metadata/md_funcs.php
- * @package chamilo.metadata
- */
-/**
-*	Chamilo Metadata: create table entries for a category of Link-type items
-*/
-
-
-// PRELIMS -------------------------------------------------------------------->
-
-$getpostvars = array('lcn', 'slo'); require('md_funcs.php');
-
-define('EID_TYPE', 'Link');
-define('OF_EID_TYPE', "eid LIKE '" . EID_TYPE . ".%'");
-
-require('md_' . strtolower(EID_TYPE) . '.php');
-
-// name of the language file that needs to be included
-$language_file = 'md_' . strtolower(EID_TYPE);
-include('../inc/global.inc.php');
-$nameTools = get_lang('Tool');
-
-($nameTools && get_lang('Sorry')) or give_up(
-    'Language file ' . $language_file . " doesn't define 'Tool' and 'Sorry'");
-
-$_course = api_get_course_info(); isset($_course) or give_up(get_lang('Sorry'));
-
-$is_allowed_to_edit = isset($_user['user_id']) && $is_courseMember && api_is_allowed_to_edit();
-if (!$is_allowed_to_edit) give_up(get_lang('Denied'));
-
-$mdStore = new mdstore($is_allowed_to_edit);  // create table if needed
-
-require(api_get_path(LIBRARY_PATH) . 'xmd.lib.php');
-require(api_get_path(LIBRARY_PATH) . 'xht.lib.php');
-
-require('md_phpdig.php');
-
-$mdObj = new mdobject($_course, 0);
-$mdCat = $mdObj->mdo_dcmap_v['Coverage'];
-$mdUrl = 'metadata/lom/technical/location[1]';
-
-$mdObj->mdo_add_breadcrump_nav();  // see 'md_' . EID_TYPE . '.php'
-
-$htmldecode = array_flip(get_html_translation_table(HTML_SPECIALCHARS));
-
-
-function check_andor_get($row, $get = '', $check = '', $tobe = '')
-{
-	global $mdCat, $htmldecode;
-
-	if (!$check && !$get) return FALSE;
-
-	$regs = array(); // for use with ereg()
-
-	if ($get == $mdCat && !$check)  // cheat to be quicker
-		if (ereg('<coverage>[^<]*<string language="..">([^<]+)<\/string>',
-			$row['mdxmltext'], $regs)) return strtr($regs[1], $htmldecode);
-
-	if ($check == $mdCat && !$get)  // cheat to be quicker
-		if (ereg('<coverage>[^<]*<string language="..">([^<]+)<\/string>',
-			$row['mdxmltext'], $regs))
-				return (strtr($regs[1], $htmldecode) == $tobe);
-
-	$xmlDoc = new xmddoc(explode("\n", $row['mdxmltext']));
-	if ($xmlDoc->error) return FALSE;
-
-	if (!$check) return $xmlDoc->xmd_value($get);
-
-	if ($xmlDoc->xmd_value($check) == $tobe)
-		return $get ? $xmlDoc->xmd_value($get) : TRUE;
-
-	return FALSE;
-}
-
-
-function get_cat($catname)
-{
-    $_course = api_get_course_info();
-    $cateq = "category_title='". addslashes($catname) . "'";
-
-    $linkcat_table = Database::get_course_table(TABLE_LINK_CATEGORY);
-    $result = Database::query("SELECT id FROM $linkcat_table WHERE " . $cateq);
-
-    if (Database::num_rows($result) >= 1 && ($row = Database::fetch_array($result)))
-        return $row['id'];  // several categories with same name: take first
-
-    return FALSE;
-}
-
-
-// SET CURRENT LINKS CATEGORY - HEADER ---------------------------------------->
-
-unset($lci);  // category-id
-
-if (isset($lcn))  // category_title
-{
-    $lcn = substr(ereg_replace("[^\x20-\x7E\xA1-\xFF]", "", $lcn), 0, 255);
-
-    $uceids = array(); $mceids = array();
-
-    $result = $mdStore->mds_get_many('eid,mdxmltext', OF_EID_TYPE);
-
-    while ($row = Database::fetch_array($result))
-        if (check_andor_get($row, '', $mdCat, $lcn)) $uceids[] = $row['eid'];
-
-    if (($lci = get_cat($lcn)) !== FALSE)
-    {
-        $link_table = Database::get_course_table(TABLE_LINK);
-        $result = Database::query("SELECT id FROM $link_table WHERE category_id=" . $lci);
-
-        while ($row = Database::fetch_array($result))
-        {
-            $lceids[$id = (int) $row['id']] = ($eid = EID_TYPE . '.' . $id);
-
-            if (in_array($eid, $uceids)) $mceids[] = $eid;
-        }
-
-        $hdrInfo = ' ' . get_lang('WorkOn') . ' ' . htmlspecialchars($lcn, ENT_QUOTES, $charset) .
-            ', LC-id=&nbsp;' . htmlspecialchars($lci, ENT_QUOTES, $charset);
-    }
-    elseif ($lcn)
-    {
-        $hdrInfo = ' (' . htmlspecialchars($lcn, ENT_QUOTES, $charset) .
-            ': ' . get_lang('NotInDB') . ')';
-    }
-    else
-        unset($lcn);
-
-    $uceids = array_diff($uceids, $mceids);  // old entries with no link
-
-    if (count($lceids) && count($uceids))
-    {
-        $mdStore->mds_delete_many($uceids);
-        $ufos = Database::affected_rows();
-    }
-
-    $interbreadcrumb[]= array(
-        'url' => api_get_self() . '?lcn=' . urlencode($lcn),
-        'name'=> get_lang('Continue') . ' ' . htmlspecialchars($lcn, ENT_QUOTES, $charset));
-}
-
-$htmlHeadXtra[] = '
-<link rel="stylesheet" type="text/css" href="md_styles.css">
-<script type="text/javascript" src="md_script.js"></script>
-';
-Display::display_header($nameTools);
-
-// OPERATIONS ----------------------------------------------------------------->
-
-if ($ufos) echo '<h3>', $ufos, ' ', get_lang('RemainingFor'), ' ',
-        htmlspecialchars($lcn, ENT_QUOTES, $charset), '</h3>', "\n";
-
-if (isset($slo)) echo '<h3>', $slo, '</h3>', "\n";  // selected links op
-
-if (isset($slo))
-if ($slo == get_lang('Create') && count($lceids))
-{
-    foreach ($lceids as $id => $eid)
-    {
-        $mdObj = new mdobject($_course, $id); $xht = $mdObj->mdo_define_htt();
-        $mdStore->mds_put($eid, $mdt = $mdObj->mdo_generate_default_xml_metadata(),
-            'mdxmltext', '?');
-        $xht->xht_xmldoc = new xmddoc(explode("\n", $mdt));
-        $mdStore->mds_put($eid, $xht->xht_fill_template('INDEXABLETEXT'),
-            'indexabletext');
-        echo '<span class="lbs" onClick="', "javascript: makeWindow('index.php?eid=",
-            urlencode($eid), "', '', '')\">", htmlspecialchars($eid, ENT_QUOTES, $charset), '</span> ';
-    }
-    echo '<br>';
-}
-elseif ($slo == get_lang('Remove') && count($lceids))
-{
-    $mdStore->mds_delete_many($mceids); $aff = Database::affected_rows();
-
-    echo $aff, ' MDEs/ ', count($lceids), ' ', get_lang('MdCallingTool'),
-        '<br><br><b>', get_lang('AllRemovedFor'),
-        ' ', htmlspecialchars($lcn, ENT_QUOTES, $charset), '</b><br />';
-}
-elseif ($slo == get_lang('Remove') && count($mceids))  // obsolete category
-{
-    $mdStore->mds_delete_many($mceids);
-
-    echo get_lang('AllRemovedFor'), ' ', htmlspecialchars($lcn, ENT_QUOTES, $charset), '<br />';
-}
-elseif ($slo == get_lang('Index') && file_exists($phpDigIncCn) && count($mceids))
-{
-    $result = $mdStore->mds_get_many('eid,mdxmltext,indexabletext',
-        OF_EID_TYPE . " AND eid IN ('" .
-        implode("','", array_map('addslashes', $mceids)) . "')");
-
-    while ($row = Database::fetch_array($result))  // load indexabletexts in memory
-        $idt[check_andor_get($row, $mdUrl)] = $row['indexabletext'];
-
-    require($phpDigIncCn);  // switch to PhpDig DB
-
-    foreach ($idt as $url => $text)
-    {
-        $pu = parse_url($url);
-        if (!isset($pu['scheme'])) $pu['scheme'] = "http";
-
-        if (isset($pu['host']))
-        {
-            $url = $pu['scheme'] . "://" . $pu['host'] . "/"; $file = '';
-
-            if (($path = $pu['path']))
-            if (substr($path, -1) == '/') $path = substr($path, 1);
-            else
-            {
-                $pi = pathinfo($path); $path = $pi['dirname'];
-                if ($path{0} == '\\') $path = substr($path, 1);
-                if ($path{0} == '/')  $path = substr($path, 1) . '/';
-
-                $file = $pi['basename'];
-            }
-
-            $file .= ($pu['query'] ? '?'.$pu['query'] : '') .
-                    ($pu['fragment'] ? '#'.$pu['fragment'] : '');
-
-
-            if ($site_id = remove_engine_entries($url, $path, $file))
-            {
-                echo '<table>', "\n";
-                index_words($site_id, $path, $file,
-                    get_first_words($text, $url . $path, $file),
-                    get_keywords($text));
-                echo '</table>', "\n";
-            }
-            else
-            {
-                echo '<table>', "\n";
-                echo '<tr><td>', htmlspecialchars($url, ENT_QUOTES, $charset),
-                    '</td><td>', htmlspecialchars($path, ENT_QUOTES, $charset),
-                    '</td><td>', htmlspecialchars($file, ENT_QUOTES, $charset), '</td></tr>';
-                echo '</table>', "\n";
-            }
-        }
-        elseif (isset($pu['scheme']) && $pu['scheme'] == 'mailto' && isset($pu['path']))
-        {
-            if ($site_id = remove_engine_entries($url = 'mailto:' . $pu['path'], ''))
-            {
-                echo '<table>', "\n";
-                index_words($site_id, '', '',
-                    get_first_words($text, $url, ''),
-                    get_keywords($text));
-                echo '</table>', "\n";
-            }
-            else
-            {
-                echo '<table>', "\n";
-                echo '<tr><td>', htmlspecialchars($url, ENT_QUOTES, $charset),
-                    '</td><td>', htmlspecialchars($path, ENT_QUOTES, $charset),
-                    '</td><td>', htmlspecialchars($file, ENT_QUOTES, $charset), '</td></tr>';
-                echo '</table>', "\n";
-            }
-        }
-    }
-
-    if(isset($db))
-    {
-    	//mysql_select_db($_configuration['main_database'], $db);
-    	Database::select_db($_configuration['main_database'], $db);
-    }
-}
-elseif ($slo == get_lang('Index'))
-{
-    echo 'Problem! PhpDig connect.php has gone ...';
-}
-
-
-// STATISTICS ----------------------------------------------------------------->
-
-echo '<h3>', get_lang('Statistics'), '</h3>', "\n";
-
-$result = $mdStore->mds_get_many('eid,mdxmltext', OF_EID_TYPE);
-echo get_lang('TotalMDEs'), Database::num_rows($result), "\n";
-
-while ($row = Database::fetch_array($result))
-{
-    $cat = check_andor_get($row, $mdCat);
-    $perCat[$cat] = ($pc = $perCat[$cat]) ? $pc + 1 : 1;
-}
-
-if (count($perCat))
-{
-    echo '<table>', "\n";
-    foreach ($perCat as $cat => $number)
-    {
-        echo '<tr><td>', $cat == $lcn ? '' : '(', htmlspecialchars($cat, ENT_QUOTES, $charset),
-            $cat == $lcn ? '' : ')', ':</td><td align="right">',
-            $number, '</td></tr>', "\n";
-    }
-    echo '</table>', "\n";
-}
-
-if (isset($lci))
-{
-    echo '<br><br>', htmlspecialchars($lcn, ENT_QUOTES, $charset), ' ', get_lang('MdCallingTool'),
-        ': ', count($lceids), '<br />', "\n";
-}
-
-
-
-// SELECT & FOOTER ------------------------------------------------------------>
-
-echo '<h3>', $nameTools, $hdrInfo, '</h3>', "\n";
-
-echo '<form action="' .api_get_self(). '?lcn=' . urlencode($lcn) .
-    '" method="post">', "\n";
-
-if (count($lceids)) echo
-    '<input type="submit" name="slo" value="', get_lang('Create'), '">', "\n";
-if ($perCat[$lcn]) echo
-    '<input type="submit" name="slo" value="', get_lang('Remove'), '">', "\n";
-if ($perCat[$lcn] && file_exists($phpDigIncCn)) echo
-    '<input type="submit" name="slo" value="', get_lang('Index'), '">', "\n";
-
-echo '</form>', "\n";
-
-if (count($perCat)) foreach ($perCat as $cat => $number)
-    $perCat[$cat] = '(' . htmlspecialchars($cat, ENT_QUOTES, $charset) . ')';
-
-$linkcat_table = Database::get_course_table(TABLE_LINK_CATEGORY);
-$result = Database::query("SELECT category_title FROM $linkcat_table");
-
-while ($row = Database::fetch_array($result))
-{
-    $cat = $row['category_title']; $hcat = htmlspecialchars($cat, ENT_QUOTES, $charset);
-    if ($perCat[$cat] == $hcat) $dups[] = $cat;
-    else $perCat[$cat] = $hcat;
-}
-
-if (count($dups))
-{
-    $warning = get_lang('WarningDups');;
-
-    foreach ($dups as $cat) unset($perCat[$cat]);
-}
-
-echo '<h3>', get_lang('OrElse'), $warning, '</h3>', "\n",  // select new target
-    '<table><tr><td align="right" class="alternativeBgDark">', "\n",
-    '<form action="'.api_get_self().'" method="post">', "\n",
-    get_lang('SLC'), ' :', "\n", '<select name="lcn">', "\n",
-    '<option value=""></option>', "\n";
-
-    foreach ($perCat as $cat => $text) echo '<option value="' .
-        htmlspecialchars($cat, ENT_QUOTES, $charset) . '"' .
-        ($cat == $lcn ? ' selected' : '') . '>' . $text . '</option>', "\n";
-
-echo '</select><input type="submit" value="', '  '.get_lang('Ok').'  ', '">', "\n",
-    '</form>', "\n", '</td></tr></table>', "\n";
-
-Display::display_footer();
-?>

+ 0 - 765
main/metadata/importmanifest.php

@@ -1,765 +0,0 @@
-<?php
-/**
- * Chamilo metadata/importmanifest.php
- * 2006/12/15
- * Copyright (C) 2006 rene.haentjens@UGent.be -  see metadata/md_funcs.php
- * @package chamilo.metadata
- */
-/**
- *    Chamilo Metadata: create and manage table entries for SCORM package
- */
-// PRELIMS -------------------------------------------------------------------->
-
-$getpostvars = array('sdisub', 'workWith', 'sdi', 'smo');
-require('md_funcs.php');
-
-define('EID_TYPE', 'Scorm');
-define('TPLEN', strlen(EID_TYPE) + 1);
-
-require('md_'.strtolower(EID_TYPE).'.php');
-
-// name of the language file that needs to be included
-$language_file = 'md_'.strtolower(EID_TYPE);
-include('../inc/global.inc.php');
-$nameTools = get_lang('Tool');
-
-if (!isset($sdisub)) {
-    $sdisub = '';
-}
-$sdisub = substr(ereg_replace("[^0-9A-Za-z]", "", $sdisub), 0, 4);
-// $sdisub is for split manifests - Scorm.NNN.$sdisub_xxx e.g. Scorm.3.1979_12
-
-define('MFFNAME', 'imsmanifest');
-define('MFFDEXT', '.xml');
-define('HTF', 'mdp_scorm.htt');
-
-$regs = array();
-
-($nameTools && get_lang('Sorry')) or give_up(
-    'Language file '.$language_file." doesn't define 'Tool' and 'Sorry'"
-);
-
-$_course = api_get_course_info();
-isset($_course) or give_up(get_lang('Sorry'));
-
-$is_allowed_to_edit = isset($_user['user_id']) && $is_courseMember && api_is_allowed_to_edit();
-if (!$is_allowed_to_edit) {
-    give_up(get_lang('Denied'));
-}
-
-$baseWorkDir = get_course_path().($courseDir = $_course['path'].'/scorm');
-
-$mdStore = new mdstore($is_allowed_to_edit); // create table if needed
-
-require(api_get_path(LIBRARY_PATH).'xmd.lib.php');
-require(api_get_path(LIBRARY_PATH).'xht.lib.php');
-
-require('md_phpdig.php');
-
-
-// SET CURRENT SCORM DIRECTORY - HEADER --------------------------------------->
-
-if (isset($workWith)) // explicit in URL, or selected at bottom of screen
-{
-    $scormdocument = Database::get_course_table(TABLE_LP_MAIN);
-    $sql = "SELECT id FROM $scormdocument WHERE path='".Database::escape_string(
-        api_substr($workWith, 1)
-    )."' OR path='".Database::escape_string(substr($workWith, 1))."/.'";
-    $result = Database::query($sql);
-
-    if (Database::num_rows($result) == 1) {
-        if (($row = Database::fetch_array($result))) {
-            $sdi = $row['id'];
-        }
-    }
-}
-
-if (isset($sdi) && is_numeric($sdi) && $sdi > 0 && $sdi == (int)$sdi) {
-    $mdObj = new mdobject($_course, $sdi);
-    $workWith = $mdObj->mdo_path;
-    $hdrInfo = ' '.get_lang('WorkOn').' '.
-        ($workWith ? htmlspecialchars($workWith, ENT_QUOTES, $charset).', ' : '').
-        'SD-id= '.htmlspecialchars($sdi, ENT_QUOTES, $charset).
-        ($sdisub ? ' ('.htmlspecialchars($sdisub, ENT_QUOTES, $charset).')' : '');
-} else {
-    unset($sdi);
-    $mdObj = new mdobject($_course, 0);
-    if ($workWith) {
-        $hdrInfo = ' ('.htmlspecialchars($workWith, ENT_QUOTES, $charset).
-            ': '.get_lang('NotInDB').')';
-    }
-    unset($workWith);
-}
-
-define('UZYX', 'UZYX'); // magic word to repeat for all $sdisub
-
-if (($sdiall = ($sdisub == UZYX))) {
-    $sdisub = '';
-    $sdiall = array();
-    if (($dh = opendir($baseWorkDir.$workWith))) {
-        while (false !== ($file = readdir($dh))) {
-            if (ereg('^'.MFFNAME.'(.+)\\'.MFFDEXT.'$', $file, $regs)) {
-                $sdiall[] = $regs[1];
-            }
-        }
-        closedir($dh);
-    }
-    sort($sdiall);
-}
-
-$originalHdrInfo = $hdrInfo;
-
-function slurpmanifest()
-{
-    global $baseWorkDir, $workWith, $sdisub, $mfContents, $xht_doc, $charset;
-    $fmff = $baseWorkDir.'/'.$workWith.'/'.MFFNAME.$sdisub.MFFDEXT;
-    if (file_exists($fmff)) {
-        if (($mfContents = @fgc($fmff))) {
-            set_time_limit(120); // for analyzing the manifest file
-            $xht_doc = new xmddoc(explode("\n", $mfContents));
-            if (!$xht_doc->error) {
-                return '';
-            } // keeping $mfContents and $xht_doc
-
-            unset($mfContents);
-
-            return get_lang('ManifestSyntax').' '.htmlspecialchars($xht_doc->error, ENT_QUOTES, $charset);
-        } else {
-            return get_lang('EmptyManifest');
-        }
-    } else {
-        return get_lang('NoManifest');
-    }
-}
-
-if (isset($workWith)) // now checked to be a valid path in scormdocument
-{
-    if ($mdObj->mdo_filetype == 'folder') // a folder with a manifest?
-    {
-        if (($errmsg = slurpmanifest())) {
-            $hdrInfo .= ' '.$errmsg;
-        }
-    } else {
-        $hdrInfo .= ' '.get_lang('NotFolder');
-        unset($sdi);
-    }
-}
-
-$mdObj->mdo_add_breadcrump_nav(); // see 'md_' . EID_TYPE . '.php'
-if (isset($sdi)) {
-    $interbreadcrumb[] = array(
-        'url' => api_get_self().'?sdi='.urlencode($sdi).
-            ($sdisub ? '&sdisub='.urlencode($sdisub) :
-                ($sdiall ? '&sdisub='.UZYX : '')),
-        'name' => get_lang('Continue').' '.$sdi.
-            ($sdisub ? ' ('.$sdisub.')' : ($sdiall ? ' ('.UZYX.')' : ''))
-    );
-}
-
-$htmlHeadXtra[] = '
-<link rel="stylesheet" type="text/css" href="md_styles.css">
-<script type="text/javascript" src="md_script.js"></script>
-';
-Display::display_header($nameTools);
-
-// OPERATIONS ----------------------------------------------------------------->
-
-if (isset($smo)) {
-    echo '<h3>', $smo, '</h3>', "\n";
-} // selected manifest op
-
-if (isset($smo)) {
-    if ($smo == get_lang('UploadMff')) {
-        if (is_uploaded_file($filespec = $_FILES['import_file']['tmp_name']) &&
-            filesize($filespec) && ($myFile = @fopen($filespec, 'r'))
-        ) {
-            fclose($myFile);
-
-            if (move_uploaded_file(
-                $filespec,
-                $baseWorkDir.$workWith.'/'.MFFNAME.$sdisub.MFFDEXT
-            )
-            ) {
-                echo get_lang('MffOk');
-                $hdrInfo = $originalHdrInfo;
-
-                if (($errmsg = slurpmanifest())) {
-                    $hdrInfo .= ' '.$errmsg;
-                }
-            } else {
-                echo get_lang('MffNotOk');
-            }
-        } else {
-            echo get_lang('MffFileNotFound');
-        }
-    } elseif ($smo == get_lang('UploadHtt')) {
-        $filespec = $_FILES['import_file']['tmp_name'];
-        if (is_uploaded_file($filespec) && filesize($filespec) && ($myFile = @fopen($filespec, 'r'))) {
-            fclose($myFile);
-            $htt_file = $baseWorkDir.'/'.$workWith.'/'.HTF;
-            if (move_uploaded_file($filespec, $htt_file)) {
-                echo get_lang('HttOk');
-            } else {
-                echo get_lang('HttNotOk');
-            }
-        } else {
-            echo get_lang('HttFileNotFound');
-        }
-    } elseif ($smo == get_lang('RemoveHtt')) {
-        @unlink($fhtf = $baseWorkDir.$workWith.'/'.HTF);
-        if (file_exists($fhtf)) {
-            echo get_lang('HttRmvNotOk');
-        } else {
-            echo get_lang('HttRmvOk');
-        }
-    } elseif ($smo == get_lang('Import')) {
-        define('TREETOP', 'organizations/organization');
-        define('TITLE', 'title');
-        define('SUBITEM', 'item');
-        define('IDENTIF', 'identifier');
-        define('ITEMID', '@'.IDENTIF);
-        define('SUBIT', SUBITEM.'/'.ITEMID);
-        define('RESOURCE', 'resources/resource');
-        define('WHERE', ITEMID);
-        define('ISITEM', '@identifierref');
-        define('HREF', 'href');
-        define('WEBF', '@'.HREF);
-        define('FILE', 'file');
-        define('THUMB', FILE.'[1]/'.WEBF);
-
-        function resource_for($elem)
-        {
-            global $xht_doc;
-
-            $resForItem = $xht_doc->xmd_select_elements_where(
-                RESOURCE,
-                WHERE,
-                $xht_doc->xmd_value(ISITEM, $elem)
-            );
-
-            return (count($resForItem) == 0) ? -1 : $resForItem[0];
-        }
-
-        function store_md_and_traverse_subitems(
-            $mfdocId,
-            $level,
-            $counter,
-            $contextElem,
-            $treeElem,
-            $parentElem
-        ) {
-            global $_user, $xht_doc, $mdStore, $mdObj, $sdisub, $charset;
-
-            //  $contextElem -> @identifier, metadata/lom
-            //  $treeElem ->    title, items
-
-            $itemId = $xht_doc->xmd_value(ITEMID, $contextElem);
-            if ($sdisub && $level == 1 && $sdisub != $itemId) {
-                return;
-            }
-
-            //  <item level=... number=... identifier=...>:
-            //      <title>...</title>
-            //      <parent identifier=... /> <previous ... /> <next ... />
-            //      <child identifier=... /> <child identifier=... /> ...
-            //      <resource href=...>
-            //          <file href=... /> <file href=... /> ...
-            //      </resource>
-            //      <metadata>...</metadata>
-            //  </item>
-
-            set_time_limit(30); // again 30 seconds from here on...
-
-            $mddoc = new xmddoc('<item/>'); // version, name ?
-            $mddoc->xmd_set_attribute(0, 'level', $level, false);
-            $mddoc->xmd_set_attribute(0, 'number', $counter, false);
-            $mddoc->xmd_set_attribute(0, IDENTIF, $itemId, false);
-
-            if ($level == 0) {
-                $mddoc->xmd_set_attribute(0, 'created', date('Y/m/d H:i:s'), false);
-                $mddoc->xmd_set_attribute(0, 'by', $_user['user_id'], false);
-            }
-
-
-            $mddoc->xmd_add_text_element(
-                TITLE,
-                $xht_doc->xmd_value(TITLE, $treeElem)
-            );
-
-            if (($ppnId = $xht_doc->xmd_value(ITEMID, $parentElem))) {
-                $mddoc->
-                    xmd_add_element('parent', 0, array(IDENTIF => $ppnId));
-            }
-            if (($ppnId = $xht_doc->xmd_value('-'.SUBIT, $treeElem))) {
-                $mddoc->
-                    xmd_add_element('previous', 0, array(IDENTIF => $ppnId));
-            }
-            if (($ppnId = $xht_doc->xmd_value('+'.SUBIT, $treeElem))) {
-                $mddoc->
-                    xmd_add_element('next', 0, array(IDENTIF => $ppnId));
-            }
-
-            if (($srcElem = resource_for($treeElem)) > 0) {
-                // change stuff below to xmd_copy_foreign_child ?
-                $resElem = $mddoc->xmd_add_element(
-                    'resource',
-                    0,
-                    array(HREF => $xht_doc->xmd_value(WEBF, $srcElem))
-                );
-                foreach ($xht_doc->xmd_select_elements(FILE, $srcElem) as $fileElem) {
-                    $mddoc->xmd_add_element(
-                        FILE,
-                        $resElem,
-                        array(HREF => $xht_doc->xmd_value(WEBF, $fileElem))
-                    );
-                }
-            }
-
-            $mddoc->xmd_copy_foreign_child(
-                $xht_doc,
-                $xht_doc->xmd_select_single_element('metadata', $contextElem)
-            );
-
-            foreach ($xht_doc->xmd_select_elements(SUBITEM, $treeElem) as $subElem) {
-                $mddoc->xmd_add_element(
-                    'child',
-                    0,
-                    array(IDENTIF => $xht_doc->xmd_value(ITEMID, $subElem))
-                );
-            }
-
-            $mdt = $mddoc->xmd_xml();
-
-            $xhtDoc = $mdObj->mdo_define_htt();
-            $xhtDoc->xht_xmldoc = $mddoc; // $xhtDoc->xht_param['xxx'] = 'yyy';
-
-            $mdStore->mds_put(
-                $eid = EID_TYPE.'.'.$mfdocId.'.'.$itemId,
-                $mdt,
-                'mdxmltext',
-                '?'
-            );
-            $mdStore->mds_put(
-                $eid,
-                $ixt =
-                    $xhtDoc->xht_fill_template('INDEXABLETEXT'),
-                'indexabletext'
-            );
-
-            if ($level == 0) // store a copy as 'Scorm.nnn'
-            {
-                $mdStore->mds_put(EID_TYPE.'.'.$mfdocId, $mdt, 'mdxmltext', '?');
-                $mdStore->mds_put(EID_TYPE.'.'.$mfdocId, $ixt, 'indexabletext');
-            }
-
-            echo $level <= 1 ? '<br />'.$level.'/ ' : ' ', htmlspecialchars($itemId, ENT_QUOTES, $charset);
-            flush();
-            $loopctr = 0;
-
-            foreach ($xht_doc->xmd_select_elements(SUBITEM, $treeElem) as $subElem) {
-                store_md_and_traverse_subitems(
-                    $mfdocId,
-                    $level + 1,
-                    ++$loopctr,
-                    $subElem,
-                    $subElem,
-                    $contextElem
-                );
-                // note: replacing this recursion by queue+loop makes it slower!
-            }
-        }
-
-        function content_for_index_php($scid)
-        {
-            // 'if {}' and 'else {}' are string literals spanning several lines
-
-            return '<?php'.
-                '
-        // This PHP file has been generated by metadata/importmanifest.php
-
-        if (isset($_GET["th"]) && ($th = str_replace("..", "",
-            get_magic_quotes_gpc() ? stripslashes($_GET["th"]) : $_GET["th"])))
-        {
-            if (strtolower(substr($th, -4)) != ".jpg") exit;  // other ext?
-
-            $thf = $_SERVER["PHP_SELF"];
-            if(!is_file($thf = $_SERVER["DOCUMENT_ROOT"] .
-                substr($thf, 0, strrpos($thf, "/")) . "/" . $th)) exit;
-
-            header("Content-disposition: filename=".basename($th));
-            header("Content-Type: image/jpeg");
-            header("Expires: ".gmdate("D, d M Y H:i:s",time()+10)." GMT");
-            header("Last-Modified: ".gmdate("D, d M Y H:i:s",time()+10)." GMT");
-
-            $fp = fopen($thf, "rb"); fpassthru($fp); fclose($fp);
-        }
-'
-                .str_replace(
-                    '<SYS_PATH-placeholder>',
-                    api_get_path(SYS_PATH),
-                    str_replace(
-                        '<scid>',
-                        $scid, // 2 * replace in $drs-line below
-                        '
-        else
-        {
-            $drs = "<SYS_PATH-placeholder>"; $scormid = "<scid>";
-            require($drs. "main/metadata/playscormmdset.inc.php");
-        }
-'
-                    )
-                ).'?'.'>';
-        }
-
-        if ($mfContents) {
-            if ($sdiall) {
-                foreach ($sdiall as $sdisub) {
-                    if (($errmsg = slurpmanifest())) {
-                        echo '? ', $sdisub, ': ', $errmsg, '<br>';
-                    } else {
-                        store_md_and_traverse_subitems(
-                            $sdi,
-                            0,
-                            1,
-                            0,
-                            $xht_doc->xmd_select_single_element(TREETOP),
-                            -1
-                        );
-                    }
-                }
-                $sdisub = '';
-            } else // just once, slurpmanifest() has already been done
-            {
-                store_md_and_traverse_subitems(
-                    $sdi,
-                    0,
-                    1,
-                    0,
-                    $xht_doc->xmd_select_single_element(TREETOP),
-                    -1
-                );
-            }
-
-            $playIt = $baseWorkDir.'/'.$workWith.'/index.php';
-            $fileHandler = @fopen($playIt, 'w');
-            @fwrite($fileHandler, content_for_index_php($sdi));
-            @fclose($fileHandler);
-
-            echo '<br>', htmlspecialchars($workWith, ENT_QUOTES, $charset);
-            if (file_exists($playIt)) {
-                echo '/index.php ',
-                htmlspecialchars(date('Y/m/d H:i:s', filemtime($playIt)), ENT_QUOTES, $charset);
-            }
-        }
-    } elseif ($smo == get_lang('Remove') && $sdisub) {
-        $screm = EID_TYPE.'.'.$sdi.'.'.$sdisub;
-        $mdStore->mds_delete_offspring($screm, '\_'); // SQL LIKE underscore
-        echo htmlspecialchars($screm.'_*: '.Database::affected_rows(), ENT_QUOTES, $charset), '<br />';
-    } elseif ($smo == get_lang('Remove')) // remove all, regardless of $sdiall
-    {
-        $mdStore->mds_delete($screm = EID_TYPE.'.'.$sdi);
-        echo htmlspecialchars($screm.': '.Database::affected_rows(), ENT_QUOTES, $charset), '<br />';
-        $mdStore->mds_delete_offspring($screm);
-        echo htmlspecialchars($screm.'.*: '.Database::affected_rows(), ENT_QUOTES, $charset), '<br /><br />',
-            '<b>'.get_lang('AllRemovedFor').' '.$screm.'</b><br />';
-    } elseif ($smo == get_lang('Index') && file_exists($phpDigIncCn) &&
-        ereg('^http://([^/]+)/(.+)/index\.php$', $mdObj->mdo_url, $regs)
-    ) {
-        $result = $mdStore->mds_get_many(
-            'eid,mdxmltext,indexabletext',
-            "eid LIKE '".EID_TYPE.".".$sdi.
-                ($sdisub ? ".".$sdisub."\_%'" : ".%'").
-                ($sdiall ? "" : " AND NOT INSTR(eid,'_')")
-        ); // SQL LIKE underscore
-
-        while ($row = Database::fetch_array($result)) // load indexabletexts in memory
-        {
-            // URL: index.php[?sid=xxx[&thumb=yyy]] (file[1]/@href: pptslnnn_t.jpg)
-
-            $th = '';
-            $indtxt = $row['indexabletext'];
-
-            if (($fh = strpos($rx = $row['mdxmltext'], 'file href="')) !== false) {
-                if (($cq = strpos($rx, '"', $fh += 11)) !== false) {
-                    if (ereg('^pptsl[0-9]+_t\.jpg$', $thwf = substr($rx, $fh, $cq - $fh))) {
-                        $th = '&thumb='.urlencode($thwf);
-                    }
-                }
-            }
-
-            if ($th == '' && ($sclvl = strpos($indtxt, 'scorm-level-')) !== false) {
-                $th = '&thumb=scorm-level-'.$indtxt{$sclvl + 12}.'.jpg';
-            }
-
-            $idt[($dotpos = strpos($ri = $row['eid'], '.', TPLEN)) !== false ?
-                ('index.php?sid='.urlencode(substr($ri, $dotpos + 1)).$th) :
-                'index.php'] = $indtxt;
-        }
-
-        require($phpDigIncCn); // switch to PhpDig DB
-
-        if (($site_id = remove_engine_entries(
-            'http://'.$regs[1].'/',
-            $path =
-                $regs[2].'/',
-            $sdisub ? 'index.php?sid='.$sdisub.'_' : ''
-        ))
-        ) {
-            echo '<table>', "\n";
-            foreach ($idt as $url => $text) {
-                set_time_limit(30); // again 30 seconds from here on...
-                index_words(
-                    $site_id,
-                    $path,
-                    $url,
-                    get_first_words($text, $path, $url),
-                    get_keywords($text)
-                );
-            }
-            echo '</table>', "\n";
-        }
-        // possible enhancement: UPDATE spider record for still existing pages
-
-        if (isset($db)) {
-            //mysql_select_db($_configuration['main_database'], $db);
-            Database::select_db($_configuration['main_database'], $db);
-        }
-    } elseif ($smo == get_lang('Index')) {
-        echo 'Problem! PhpDig connect.php has gone or else URL "'.
-            htmlspecialchars($mdObj->mdo_url, ENT_QUOTES, $charset).
-            '" is not like "http://xxxx/yyy.../zzz/index.php"';
-    }
-}
-
-
-// STATISTICS ----------------------------------------------------------------->
-
-echo '<h3>', get_lang('Statistics'), '</h3>', "\n";
-
-$result = $mdStore->mds_get_many('eid', "eid LIKE '".EID_TYPE.".%'");
-echo get_lang('TotalMDEs'), Database::num_rows($result), "\n";
-
-while ($row = Database::fetch_array($result)) {
-    $eid_id = substr($eid = $row['eid'], TPLEN);
-
-    if (($dotpos = strpos($eid_id, '.'))) {
-        $eid_id = substr($eid_id, 0, $dotpos);
-    } else {
-        $mdtmain[$eid_id] = $mdStore->mds_get($eid);
-    }
-
-    $perId[$eid_id] = ($pi = $perId[$eid_id]) ? $pi + 1 : 1;
-}
-
-
-if (isset($sdi)) {
-    $mdo = new mdobject($_course, $sdi);
-    echo '<br />', htmlspecialchars($mdo->mdo_path, ENT_QUOTES, $charset), ', SD-id ', $sdi, ': ',
-    ($perId[$sdi] ? $perId[$sdi] : '0'), ' ',
-    ($mdtmain[$sdi] ? '- <span class="lbs" onClick="'.
-        "makeWindow('index.php?eid=".EID_TYPE.'.'.$sdi."', '', '')\">".
-        get_lang('MainMD').'</span>' : ''), "\n";
-}
-
-if (count($perId)) {
-    foreach ($perId as $id => $number) {
-        $mdo = new mdobject($_course, $id);
-        if (!($pth = $mdo->mdo_path)) {
-            $pth = $mdtmain[$id]; // fetch something simple without parsing
-            if ($ttopen = strpos($pth, '<title>')) {
-                if ($ttclose = strpos($pth, '</title>', $ttopen)) {
-                    $pth = ' '.api_html_entity_decode
-                    (
-                        substr($pth, $ttopen + 7, $ttclose - $ttopen - 7),
-                        ENT_QUOTES,
-                        $charset
-                    );
-                } else {
-                    $pth = ' '.substr($pth, $ttopen + 7, 30);
-                }
-            } else {
-                $pth = ' '.substr($pth, 0, 30);
-            }
-        }
-
-        $pathId[$pth] = $id;
-    }
-
-    echo '<br><br><table>', "\n";
-    ksort($pathId);
-    $wwl = strlen($workWith);
-
-    foreach ($pathId as $pth => $id) {
-        if ($wwl == 0 ||
-            ($wwl < strlen($pth) && substr($pth, 0, $wwl) == $workWith)
-        ) {
-            $tmfdt = file_exists($tfmff = $baseWorkDir.$pth.'/'.MFFNAME.$sdisub.MFFDEXT) ?
-                date('Y/m/d H:i:s', filemtime($tfmff)) : '-';
-            echo '<tr><td>', htmlspecialchars($tmfdt, ENT_QUOTES, $charset), '</td>',
-            '<td>', htmlspecialchars($pth, ENT_QUOTES, $charset),
-            '</td><td align="right">(SD-id ', $id,
-            '):</td><td align="right">', $perId[$id], '</td></tr>', "\n";
-        }
-    }
-    echo '</table>', "\n";
-}
-
-if ($mfContents) {
-    echo $workWith, '/', MFFNAME.$sdisub.MFFDEXT, ': ',
-    htmlspecialchars(date('Y/m/d H:i:s', filemtime($fmff)), ENT_QUOTES, $charset), ", \n",
-        substr_count($mfContents, "\n") + 1,
-        ' '.get_lang('Lines').'.', "\n";
-
-    if (!$sdisub && ($dh = opendir($baseWorkDir.$workWith))) {
-        $nsplit = array();
-        while (false !== ($file = readdir($dh))) {
-            if (ereg('^'.MFFNAME.'(.+)\\'.MFFDEXT.'$', $file, $regs)) {
-                $nsplit [] = $regs[1];
-            }
-        }
-        closedir($dh);
-
-        if (count($nsplit)) {
-            echo '<br>', get_lang('SplitData');
-            sort($nsplit);
-            foreach ($nsplit as $ns) {
-                $result = $mdStore->mds_get_many(
-                    'eid',
-                    "eid LIKE '".
-                        EID_TYPE.".".$sdi.".".$ns."\_%'"
-                );
-                $nns = Database::num_rows($result);
-                echo $ns, $nns ? '_ '.$nns : '', '; ';
-            }
-            echo '<br>';
-        }
-    }
-}
-
-if (file_exists($baseWorkDir.$workWith.'/index.php')) {
-    echo "<span class=\"lbs\" onClick=\"makeWindow('".
-        $mdObj->mdo_url."', '', '')\">".get_lang('Play'), '</span>', "\n";
-}
-
-if (file_exists($fhtf = $baseWorkDir.$workWith.'/'.HTF)) {
-    echo '<br>', $workWith, '/', HTF, ': ',
-    htmlspecialchars(date('Y/m/d H:i:s', filemtime($fhtf)), ENT_QUOTES, $charset), "\n";
-}
-
-
-// SELECT & FOOTER ------------------------------------------------------------>
-
-if ($mfContents || $xht_doc->error) {
-    echo '<h3>', get_lang('UploadMff'), "</h3>\n\n",
-        '<form action="'.api_get_self().'?sdi='.urlencode($sdi).
-        ($sdisub ? '&sdisub='.urlencode($sdisub) : ($sdiall ? '&sdisub='.UZYX : '')).
-        '" enctype="multipart/form-data" method="post">', "\n",
-    '<input type="hidden" name="MAX_FILE_SIZE" value="32768">', "\n",
-    '<input type="file" name="import_file" size="30">', "\n",
-    '<input type="submit" name="smo" value="', get_lang('UploadMff'),
-        '">'."\n</form>\n";
-}
-
-echo '<h3>', get_lang('UploadHtt'), file_exists($fhtf) ?
-    (' + '.get_lang('RemoveHtt')) : '', "</h3>\n\n",
-
-    '<form action="'.api_get_self().'?sdi='.urlencode($sdi).
-    ($sdisub ? '&sdisub='.urlencode($sdisub) : ($sdiall ? '&sdisub='.UZYX : '')).
-    '" enctype="multipart/form-data" method="post">', "\n",
-'<input type="hidden" name="MAX_FILE_SIZE" value="32768">', "\n",
-'<input type="file" name="import_file" size="30">', "\n",
-'<input type="submit" name="smo" value="', get_lang('UploadHtt'), '">';
-if (file_exists($fhtf)) {
-    echo
-    '<input type="submit" name="smo" value="', get_lang('RemoveHtt'), '">';
-}
-echo "\n</form>\n";
-
-echo '<h3>', $nameTools, $hdrInfo, '</h3>', "\n";
-
-if ($mfContents || $perId[$sdi]) // buttons for manifest operations
-{
-    echo '<form action="'.api_get_self().'?sdi='.urlencode($sdi).
-        ($sdisub ? '&sdisub='.urlencode($sdisub) : ($sdiall ? '&sdisub='.UZYX : '')).
-        '" method="post">', "\n";
-    if ($mfContents) {
-        echo
-        '<input type="submit" name="smo" value="', get_lang('Import'), '">', "\n";
-    }
-    if ($perId[$sdi]) {
-        echo
-        '<input type="submit" name="smo" value="', get_lang('Remove'), '">', "\n";
-    }
-    if ($mfContents && $perId[$sdi] && file_exists($phpDigIncCn)) {
-        echo
-        '<input type="submit" name="smo" value="', get_lang('Index'), '">', "\n";
-    }
-    echo
-    '</form>', "\n";
-} else {
-    echo '(', get_lang('NonePossible'), '...)';
-}
-
-
-function showSelectForm($label, $specifics)
-{
-    echo    '<tr><td align="right" class="alternativeBgDark">', "\n",
-    '<form action="', api_get_self(), '" method="post">', "\n",
-    get_lang($label), ' :', "\n", $specifics, "\n",
-    '<input type="submit" value="', '  '.get_lang('Ok').'  ', '" />', "\n",
-    '</form></td></tr>', "\n";
-}
-
-echo '<h3>', get_lang('OrElse'), '</h3>', "\n<table>\n";
-
-$specifics = '<select name="workWith">'."\n".
-    '<option value="" style="color:#999999">'.get_lang('Root')."</option>\n";
-
-if (($dirList = FileManager::index_and_sort_dir($baseWorkDir))) // fileManage.lib
-{
-    $someDirs = array();
-
-    foreach ($dirList as $pathValue) {
-        $someDirs[$pathValue] = file_exists($pathValue.'/'.MFFNAME.MFFDEXT);
-    }
-
-    foreach ($someDirs as $pathValue => $mfExists) {
-        if ($mfExists) {
-            while (($i = strrpos($pathValue, '/'))) {
-                $pathValue = substr($pathValue, 0, $i);
-                if (!array_key_exists($pathValue, $someDirs)) {
-                    break;
-                }
-                $someDirs[$pathValue] = true;
-            }
-        }
-    }
-
-    $bwdL = strlen($baseWorkDir);
-
-    foreach ($someDirs as $pathValue => $mfExists) {
-        if ($mfExists) {
-            $pathValue = substr($pathValue, $bwdL);
-            $specifics .= '<option value="'.$pathValue.'"'.
-                ($pathValue == $workWith ? ' selected' : '').'>'.
-                str_repeat('&nbsp;&nbsp;', substr_count($pathValue, '/')).'>'.
-                basename($pathValue).'</option>'."\n";
-        }
-    }
-}
-
-showSelectForm('WorkWith', $specifics.'</select>');
-
-showSelectForm(
-    'SDI',
-    '<input type="text" size="5" name="sdi" value="'.
-        htmlspecialchars($sdi).'" />'.
-        '(<input type="text" size="4" name="sdisub" value="'.
-        ($sdiall ? UZYX : htmlspecialchars($sdisub, ENT_QUOTES, $charset)).'" />)'."\n"
-);
-
-echo '</table>', "\n";
-
-
-Display::display_footer();
-?>

+ 0 - 186
main/metadata/index.php

@@ -1,186 +0,0 @@
-<?php
-/* For licensing terms, see /license.txt */
-
-/**
- * Chamilo metadata/index.php
- * 2005/05/19
- * @copyright 2005 rene.haentjens@UGent.be -  see metadata/md_funcs.php
- * @package chamilo.metadata
- */
-/**
- * Chamilo Metadata: view/edit metadata of a Chamilo course object
- * URL parameters:
- *   - eid=  entry-id = object-id = type.identifier, e.g. 'Document.12';
- *   - lfn=  filename of a language file, default= 'md_' + type, e.g. 'md_doc';
- *   - htt=  HTML template file (same dir as script), default= same as lfn;
- *   - dbg=  debuginfo start number, e.g. 10000
- *
- */
-
-require_once '../inc/global.inc.php';
-
-require "md_funcs.php";
-
-getpar('EID', 'Entry IDentifier');           // e.g. 'Document.12' or 'Scorm.xx'
-if (!($dotpos = strpos(EID, '.'))) give_up('No . in ' . EID);
-
-define('EID_TYPE', substr(EID, 0, $dotpos)); // e.g. 'Document' or 'Scorm'
-require('md_' . strtolower(EID_TYPE) . '.php');
-
-define('EID_ID', substr(EID, $dotpos + 1));  // e.g. '12'
-
-getpar('LFN', 'LanguageFileName', 'md_' . strtolower(EID_TYPE));
-getpar('HTT', 'HTML Template Text filename', LFN);
-
-getpar('DBG', 'Debug number', '0');
-
-$urlp =                                              '?eid=' . urlencode(EID);
-if (LFN != 'md_' . strtolower(EID_TYPE))    $urlp .= '&lfn=' . urlencode(LFN);
-if (HTT != LFN)                             $urlp .= '&htt=' . urlencode(HTT);
-if (DBG)                                    $urlp .= '&dbg=' . urlencode(DBG);
-
-// name of the language file that needs to be included
-$language_file = LFN;
-require_once "../inc/global.inc.php";
-
-$this_section = SECTION_COURSES;
-
-$nameTools = get_lang('Tool');
-
-($nameTools && get_lang('Sorry')) or give_up('Language file ' . LFN . " doesn't define 'Tool' and 'Sorry'");
-
-$_course = api_get_course_info(); isset($_course) or give_up(get_lang('Sorry'));
-
-require api_get_path(LIBRARY_PATH) . 'xmd.lib.php';
-require api_get_path(LIBRARY_PATH) . 'xht.lib.php';
-
-$mdObj = new mdobject($_course, EID_ID);  // see 'md_' . EID_TYPE . '.php'
-
-
-// Construct assoclist $langLangs from language table ------------------------->
-
-$result = Database::query("SELECT isocode FROM " .Database :: get_main_table(TABLE_MAIN_LANGUAGE) ." WHERE available='1' ORDER BY isocode ASC");
-
-$sep = ":"; $langLangs = $sep . "xx" . $sep . "xx";
-
-while ($row = Database::fetch_array($result))
-    if (($isocode = $row['isocode']))
-    	$langLangs .= ",, " . $isocode . $sep . $isocode;
-
-
-// XML and DB STUFF ----------------------------------------------------------->
-
-$is_allowed_to_edit = isset($_user['user_id']) && $is_courseMember && api_is_allowed_to_edit();
-
-$mdStore = new mdstore($is_allowed_to_edit);
-
-if (($mdt_rec = $mdStore->mds_get(EID)) === FALSE)  // no record, default XML
-     $mdt = $mdObj->mdo_generate_default_xml_metadata();
-else $mdt = $mdt_rec;
-
-$xhtxmldoc = new xmddoc(explode("\n", $mdt));
-
-$httfile = ($xhtxmldoc->error) ? 'md_editxml.htt' : HTT . '.htt';
-
-if (!$xhtxmldoc->error && $mdt_rec !== FALSE &&
-        method_exists($mdObj, 'mdo_override'))
-    $mdt = $mdObj->mdo_override($xhtxmldoc);
-
-$xhtDoc = define_htt($httfile, $urlp, $_course['path']);
-
-define('HSH', md5($mdt . LFN . $nameTools . get_lang('Sorry') . $httfile .
-    implode('{}', $xhtDoc->htt_array)));  // cached HTML depends on LFN+HTT
-
-$xhtDoc->xht_param['traceinfo'] = $xhtxmldoc->error;
-$xhtDoc->xht_param['dbrecord'] = $mdt_rec !== FALSE ? 'TRUE' : '';
-
-$xhtDoc->xht_xmldoc = $xhtxmldoc;
-
-if ($is_allowed_to_edit) $xhtDoc->xht_param['isallowedtoedit'] = 'TRUE';
-
-// MD updates to Doc and DB
-if ($is_allowed_to_edit && isset($_POST['mda'])) {
-    $mdt = $mdStore->mds_update_xml_and_mdt($mdObj, $xhtDoc->xht_xmldoc,
-        get_magic_quotes_gpc() ? stripslashes($_POST['mda']) : $_POST['mda'],
-        EID, $xhtDoc->xht_param['traceinfo'], $mdt_rec !== FALSE);
-
-    if ($mdt_rec !== FALSE) {
-         if (strpos($xhtDoc->xht_param['traceinfo'], 'DELETE') !== FALSE)
-            $xhtDoc->xht_param['dbrecord'] = '';
-    } else if (strpos($xhtDoc->xht_param['traceinfo'], 'INSERT') !== FALSE)
-            $xhtDoc->xht_param['dbrecord'] = 'TRUE';
-
-    if (method_exists($mdObj, 'mdo_storeback'))
-        $mdObj->mdo_storeback($xhtDoc->xht_xmldoc);
-
-    $mdt_rec = FALSE;  // cached HTML obsolete, must re-apply templates
-} elseif ($is_allowed_to_edit && $_POST['mdt']) {
-     // md_editxml.htt 
-    $mdStore->mds_put(EID,
-        get_magic_quotes_gpc() ? stripslashes($_POST['mdt']) : $_POST['mdt'],
-        'mdxmltext', '?');
-    $mdStore->mds_put(EID, HSH, 'md5');
-
-    $xhtDoc->xht_param['dbrecord'] = 'TRUE';
-
-    $mdt = ''; $xhtDoc->xht_param['traceinfo'] = get_lang('PressAgain');
-
-    $mdt_rec = FALSE;  // cached HTML obsolete, must re-apply templates
-}
-
-$xhtDoc->xht_param['mdt'] = $mdt;
-
-define('CACHE_IS_VALID', isset($mdt_rec) && $mdt_rec !== FALSE &&
-    HSH && HSH == $mdStore->mds_get(EID, 'md5'));
-
-
-function md_part($part, $newtext)  // callback from template (HTML cache in DB)
-{
-    global $mdStore;
-
-    if ($newtext === FALSE)
-    {
-        if (!CACHE_IS_VALID) return FALSE;
-        return '<!-- ' . $part . ' -->' . $mdStore->mds_get(EID, $part);
-    }
-    else
-    {
-        $mdStore->mds_put(EID, HSH, 'md5');
-        $mdStore->mds_put(EID, $newtext, $part);
-
-        return $newtext;
-    }
-}
-
-function md_part1($newtext)         { return md_part('htmlcache1',    $newtext); }
-function md_part2($newtext)         { return md_part('htmlcache2',    $newtext); }
-function md_indexabletext($newtext) { return md_part('indexabletext', $newtext); }
-
-
-// GENERATE OUTPUT ------------------------------------------------------------>
-
-foreach (explode("\n", $xhtDoc->htt_array['HTTP']) as $httpXtra)
-    if ($httpXtra) $httpHeadXtra[] = $httpXtra;
-
-$xhtDoc->xht_get_lang = 'get_lang';
-
-function resource_for($e) {return $e;}  // dummy, '=/' not used here
-$xhtDoc->xht_resource = 'resource_for';
-
-$htmlHeadXtra[] = $xhtDoc->xht_fill_template('HEAD');
-
-$mdObj->mdo_add_breadcrump_nav();  // see 'md_' . EID_TYPE . '.php'
-$noPHP_SELF = TRUE;  // in breadcrumps
-
-Display::display_header($nameTools); echo "\n";
-
-$xhtDoc->xht_dbgn = DBG;  // for template debug info, set to e.g. 10000
-if (($ti = $xhtDoc->xht_param['traceinfo'])) $xhtDoc->xht_param['traceinfo'] =
-    '<h5>Trace information</h5>' . htmlspecialchars($ti, ENT_QUOTES, $charset);
-
-echo $xhtDoc->xht_fill_template('METADATA'), "\n";
-
-if ($xhtDoc->xht_dbgn) echo $xhtDoc->xht_dbgo;
-
-Display::display_footer();
-?>

+ 0 - 262
main/metadata/md_document.htt

@@ -1,262 +0,0 @@
-<!-- {-md_document.htt-} -->              <!-- for Dokeos metadata/index.php -->
-                                                             <!-- 2006/05/15 -->
-
-<!-- Copyright (C) 2005 rene.haentjens@UGent.be -  see metadata/md_funcs.php -->
-
-
-<!-- {-METADATA-} -->
-
-{-D TRUE TRUE-}{-D XML application/xml;utf-8-}
-
-<div id="indexabletext" class="dvc">
-{-H {-E md_indexabletext C METADATA_INDEXABLETEXT-}-}
-</div>
-
-<noscript>
-{-P traceinfo-}
-<hr>
-<form method="post" action="{-P self-}">
-    <textarea rows="30" class="wide" name="mdt" id="mdt">{-H {-P mdt-}-}</textarea>
-    <input type="submit" value="{-L Store-}"></input>
-</form>
-{-L NoScript-}
-</noscript>
-
-<div  onMouseUp="javascript: if ((kw = pU_clicked(event))) pU_select(kw); else pU_hide();">
-{-T dbrecord == empty <div class="lgr">-}
-{-E md_part1 C METADATA_PART1-}
-{-T dbrecord == empty </div>-}
-
-{-T isallowedtoedit == TRUE 
-
-<div class="dvc">{-P traceinfo-}</div>
-
-<form method="post" action="{-P self-}">
-    <textarea rows="4" class="mda" name="mda" id="mda" title="{-L ConfirmDelete-}"></textarea>
-    <!--<input type="submit" value="{-L Store-}" onClick="javascript: return checkBeforeSubmit(event);"></input>-->
-    <button class="save" type="submit" value="{-L Store-}" onClick="javascript: return checkBeforeSubmit(event);">{-L Store-}</button>
-    
-    
-    {-T dbrecord != empty 
-    <!--<input type="submit" value="{-L DeleteAll-}" onClick="javascript: return setPendingOperation('~~', event);"></input>-->
-    <button class="minus" type="submit" value="{-L DeleteAll-}" onClick="javascript:return setPendingOperation('~~', event);">{-L DeleteAll-}</button>
-    -}
-    <span onClick="javascript: document.getElementById('indexabletext').className ='dvo'">&#xa0;</span>
-{-D techfmt {-V metadata/lom/technical/format-}-}{-T techfmt == XML 
-    <input type="submit" value="{-L CourseKwds-}" onClick="javascript: return setPendingOperation('!!', event);"></input>
- -}
-</form>
-
-<textarea rows="10" class="mda" name="mdt" id="mdt">{-H {-P mdt-}-}</textarea>
-
- -}
-
-{-T keywordscache != empty 
-
-<div noWrap="1" id="maindiv">
-    <input type="button" class="btn" value="+" onClick="javascript: if (this.value == '+') deselectAll(event, this); openOrClose(this);"/>
-    <input type="button" class="btm" id="btnOpenOrCloseAll" value="++" onClick="javascript: openOrCloseAll(this);"/>
-    <input type="button" class="btn" value="?" onClick="javascript: openOrCloseHelp(this)"/>
-    &#xa0;{-L ClickKw-}
-    {-P keywordscache-}
-</div>
-
-<div id='moreHelp' class='dvc'>
-    {-L KwHelp-}
-</div>
-
- -}
-
-{-T keywordscache == empty 
-<!--
-<div noWrap="1" id="maindiv">
-{-L KwNote-}
-</div>
--->
- -}
-
-<div id="popup" noWrap="1" class="pup">
-    Working...
-</div>
-</div><!-- onMouseUp -->
-
-<!<!------------------------  End Of script Output  ---------------------->
-
-
-<!-- {-METADATA_PART1-} -->
-
-<h3>{-L Tool-}: {-X metadata/lom/general/identifier/entry-}</h3>
-
-<table class="wide">
-    <tr>
-        <td colspan="2" class="bg1">&#xa0;</td><td class="bg2">&#xa0;</td>
-        <td class="bg1">&#xa0;</td>            <td class="bg2">&#xa0;</td>
-    </tr>
-    <tr>
-        <td>{-D label Language-}{-C LABEL-}</td>
-        <td>{-D xpath metadata/lom/general/language-}{-C LANGSELECT-}</td>
-        <td>{-D xpath metadata/lom/general/identifier/catalog-}{-D iclass disabled class="wd2" -}{-C INPUT-}</td>
-        <td>{-D label Identifier-}{-C LABEL-}</td>
-        <td>{-D xpath metadata/lom/general/identifier/entry-}{-D iclass class="wd2" onKeyPress="javascript: return isValidChar(event, '[a-z0-9\x08\x25\x27\*\.\'\(\)_!-]', 'i');" -}{-C INPUT-}</td>
-    </tr>
-    <tr>
-        <td>{-D label Title-}{-C LABEL-}</td>
-        <td>{-D xpath metadata/lom/general/title/string/@language-}{-C LANGSELECT-}</td>
-        <td colspan="3">{-D xpath metadata/lom/general/title/string-}{-C INPUTW-}</td>
-    </tr>
-    <tr>
-        <td>{-D label Description-}{-C LABEL-}</td>
-        <td>{-C MDLANGSELECT-}</td>
-        <td colspan="3">{-D xpath metadata/lom/general/description/string-}{-C INPUTW-}</td>
-    </tr>
-    <tr>
-        <td colspan="2">{-D label Coverage-}{-C LABEL-}</td>
-        <td colspan="3">{-D xpath metadata/lom/general/coverage/string-}{-C INPUTW-}</td>
-    </tr>
-    <tr>
-        <td colspan="2">{-D label Keyword-}{-C LABEL-}</td>
-        <td colspan="3">{-C INPUT_ALLKWDS-}</td>
-    </tr>
-    <tr>
-        <td colspan="2">{-D label Rights-}{-C LABEL-}</td>
-        <td colspan="3">{-D xpath metadata/lom/rights/description/string-}{-C INPUTW-}</td>
-    </tr>
-    <tr>
-        <td colspan="2">{-D label Version-}{-C LABEL-}</td>
-        <td>{-D xpath metadata/lom/lifeCycle/version/string-}{-D iclass class="wd2" -}{-C INPUT-}</td>
-        <td>{-D label Status-}{-C LABEL-}</td>
-        <td nowrap>
-            {-D xpath metadata/lom/lifeCycle/status/value-}{-D optionarray Statuses-}{-C SELECT-}
-            {-D xpath metadata/lom/rights/cost/value-}{-D optionarray Costs-}{-C SELECT-}
-            {-D xpath metadata/lom/rights/copyrightAndOtherRestrictions/value-}{-D optionarray Copyrights-}{-C SELECT-}
-        </td>
-    </tr>
-    <tr>
-        <td colspan="2">{-D label CreatedSize-}{-C LABEL-}</td>
-        <td nowrap>
-            {-D xpath metadata/lom/lifeCycle/contribute[1]/date/dateTime-}{-D iclass class="wd1" onKeyUp="javascript: checkValid(this,'^[0-9]{4}-[0-9]{2}-[0-9]{2}$','i');" -}{-C INPUT-}
-            {-D xpath metadata/lom/technical/size-}{-D iclass class="wd1"  onKeyPress="javascript: return isValidChar(event, '[0-9\x08\x25\x27]', 'i');" -}{-C INPUT-}
-        </td>
-        <td>{-D label Author-}{-C LABEL-}</td>
-        <td>{-D xpath metadata/lom/lifeCycle/contribute[1]/entity-}{-C INPUTW-}</td>
-    </tr>
-    <tr>
-        <td colspan="2">{-D label Format-}{-C LABEL-}</td>
-        <td>{-D xpath metadata/lom/technical/format-}{-D optionarray Formats-}{-C SELECT-}</td>
-        <td><a href="{-X metadata/lom/technical/location-}" target="_blank">{-D label Location-}{-C LABEL-}</a></td>
-        <td>{-D xpath metadata/lom/technical/location-}{-C INPUTW-}</td>
-    </tr>
-    <tr>
-        <td colspan="2" class="bg1">&#xa0;</td><td class="bg2">&#xa0;</td>
-        <td class="bg1">&#xa0;</td>            <td class="bg2">&#xa0;</td>
-    </tr>
-</table>
-
-
-<!-- {-METADATA_INDEXABLETEXT-} -->
-
- {-V metadata/lom/general/title/string-} txt-sep
- {-R metadata/lom/general/keyword C KWTEXT-} txt-sep
- {-V metadata/lom/general/description[1]/string-} txt-end
- document-type
- {-V metadata/lom/lifeCycle/contribute[1]/entity-}
- {-V metadata/lom/lifeCycle/contribute[1]/date/dateTime-}
- {-V metadata/lom/technical/format-}
-
-
-<!-- {-KWTEXT-} -->
-
- {-V string-}-kw
-
-
-<!-- {-LABEL-} -->
-
-<span class="bg3" title="{-L {-P label-}Tip-}">{-L {-P label-}-}&#xa0;:</span>
-
-
-<!-- {-MDLANGSELECT-} -->
-
-<select onchange="javascript: spcSel('metadata/lom/general/description,metadata/lom/general/coverage,metadata/lom/general/keyword,metadata/lom/rights/description;string@language', this);">{-D selvalue {-V metadata/lom/general/description/string/@language-}-}{-R Langs C OPTION-}</select>
-
-
-<!-- {-LANGSELECT-} -->
-
-{-D optionarray Langs-}{-C SELECT-}
-
-
-<!-- {-SELECT-} -->
-
-<select onchange="javascript: spcSel('{-H {-P xpath-}-}', this);">{-D selvalue {-V P xpath-}-}{-R {-P optionarray-} C OPTION-}</select>
-
-
-<!-- {-OPTION-} -->
-
-<option value="{-P key-}" {-T key == selvalue selected-}>{-P value-}</option>
-
-
-<!-- {-INPUTW-} -->
-
-{-D iclass class="wide" -}{-C INPUT-}
-
-
-<!-- {-INPUT-} -->
-
-<input type="text" title="{-H {-P xpath-}-}" {-P iclass-}value="{-H {-V P xpath-}-}" onchange="javascript: spc(this.title, this.value);"/>
-
-
-<!-- {-INPUT_ALLKWDS-} -->
-
-<input type="text" title="{-X metadata/lom/general/description/string/@language-}" 
- id="kwds_string" class="wide" value="{-X metadata/lom/general/keyword/string , -}" 
- onKeyUp="javascript: takeTypeIn(this, 150, -100, '150px'); return true;" 
- onKeyPress="javascript: return isValidChar(event, '[0-9a-z\xC0-\xFF\.\x08\x25\x27, -]', 'i');" />
-
-
-<!-- {-HEAD-} -->
-
-<link rel="stylesheet" type="text/css" href="md_styles.css">
-
-<script type="text/javascript" language="JavaScript" src="md_script.js"></script>
-<script type="text/javascript" language="JavaScript">var kwdswere = "{-X metadata/lom/general/keyword/string , -}";</script>
-
-
-<!-- {-HTTP-} -->
-
-Expires: Mon, 26 Jul 1997 05:00:00 GMT
-
-
-<!-- {-KEYWORD_VERYOLDVERSIONWITHLANGSELECTS-} -->
-
-<tr>
-    <td>{-D label Keyword-}{-D tip {-L KeywordTip-}-}{-C LABEL-}</td>
-    <td nowrap><select onchange="javascript: spc('metadata/lom/general/keyword[{-P number-}]/string/@language', this.options[this.selectedIndex].value);">{-D selvalue {-V string/@language-}-}{-R Langs C OPTION-}</select>
-    <input type="checkbox" title="{-L DeleteKw-}" id="keyword{-P number-}"/></td>
-    <td colspan="3">{-D value {-X string-}-}{-D title metadata/lom/general/keyword[{-P number-}]/string-}{-C INPUTKWD-}</td>
-</tr>
-
-
-<!-- {-KEYWORD_OLDVERSIONSEPARATELINES-} -->
-
-<tr>
-    <td colspan="2" nowrap>{-D label Keyword-}{-D tip {-L KeywordTip-}-}{-C LABEL-}
-    <input type="checkbox" title="{-L DeleteKw-}" id="keyword{-P number-}"/></td>
-    <td colspan="3">{-D value {-X string-}-}{-D title metadata/lom/general/keyword[{-P number-}]/string-}{-C INPUTKWD-}</td>
-</tr>
-
-
-<!-- {-INPUTKWD-} -->
-
-<input type="text" title="{-P title-}" class="wide" value="{-H {-P value-}-}" onchange="javascript: spckwd(this.title, this.value, '{-P selvalue-}');"/>
-
-
-<!-- {-Remarks-} -->
-
-Small problems with NS 7 and Mozilla 1.7...
-
-1. See 'End Of script Output' below: a double <!<! is required in that comment 
-   (and only there) otherwise it is not recognised as a comment.
-
-2. Old script is cached and may pop up as error 'oCl is not defined'.
-
-
-<!-- {--} -->

+ 0 - 189
main/metadata/md_document.php

@@ -1,189 +0,0 @@
-<?php
-/**
- * md_document.php for Dokeos metadata/*.php
- * 2005/09/20
- * Copyright 2005 rene.haentjens@UGent.be -  see metadata/md_funcs.php -->
- *	@package chamilo.metadata
- */
-/**
- *	Chamilo Metadata: class mdobject for Document-type items
- *	@package chamilo.metadata
- */
-class mdobject {
-
-var $mdo_course;
-var $mdo_type;
-var $mdo_id;
-var $mdo_eid;
-
-var $mdo_dcmap_e;
-var $mdo_dcmap_v;
-
-var $mdo_path;
-var $mdo_title;
-var $mdo_comment;
-var $mdo_filetype;
-var $mdo_group;
-var $mdo_url;
-
-
-function mdo_define_htt() { return new xhtdoc(<<<EOD
-
-<!-- {-INDEXABLETEXT-} -->
-
- {-V metadata/lom/general/title/string-} txt-sep
- {-R metadata/lom/general/keyword C KWTEXT-} txt-sep
- {-V metadata/lom/general/description[1]/string-} txt-end
- document-type
- {-V metadata/lom/lifeCycle/contribute[1]/entity-}
- {-V metadata/lom/lifeCycle/contribute[1]/date/dateTime-}
- {-V metadata/lom/technical/format-}
-
-
-<!-- {-KWTEXT-} -->
-
- {-V string-}-kw
-
-
-<!-- {--} -->
-EOD
-);
-}
-
-function mdo_generate_default_xml_metadata()
-{
-    global $iso639_2_code, $ieee_xml;
-
-    $xhtDoc = new xhtdoc($ieee_xml); $_user = api_get_user_info();
-
-    if ($xhtDoc->htt_error)
-        give_up('IEEE XML (metadata/md_funcs): ' . $xhtDoc->htt_error);
-
-    $xhtDoc->xht_get_lang = 'get_lang'; $xhtDoc->xht_xmldoc = new xmddoc('');
-    if ($xhtDoc->xht_xmldoc->error) give_up($xhtDoc->xht_xmldoc->error);
-
-    $xhtDoc->xht_param['siteUri'] = make_uri();
-
-    $xhtDoc->xht_param['entry'] = $this->mdo_course['sysCode'] .
-        '.Document.' . $this->mdo_id;  // 2005-05-30: path->sysCode
-
-    $xhtDoc->xht_param['location'] = api_get_path(WEB_PATH) .
-        'main/metadata/openobject.php?cidReq=' .
-        urlencode($this->mdo_course['sysCode']) . '&eid=' .
-        urlencode($this->mdo_eid);
-
-    $xhtDoc->xht_param['mdlang'] = strtolower($iso639_2_code);
-    $xhtDoc->xht_param['lang'] =   strtolower($iso639_2_code);
-
-    $xhtDoc->xht_param['title'] =
-        $this->mdo_title ? $this->mdo_title :
-            ($this->mdo_path ? $this->mdo_path : get_lang('MdTitle', ''));
-    $xhtDoc->xht_param['description'] =
-        $this->mdo_comment ? $this->mdo_comment : get_lang('MdDescription', '');
-    $xhtDoc->xht_param['coverage'] = get_lang('MdCoverage', '');
-
-    if (isset($_user))
-    {
-        $xhtDoc->xht_param['author'] = "BEGIN:VCARD\\nFN:" .
-            api_get_person_name($_user['firstName'], $_user['lastName'], null, PERSON_NAME_EMAIL_ADDRESS) .
-            "\\nEMAIL:".$_user['mail'] . "\\nEND:VCARD\\n";
-    }
-
-    $xhtDoc->xht_param['dateTime'] = date('Y-m-d');
-
-    if ($this->mdo_filetype == 'folder') $format = "inode/directory";
-    else
-    {
-        require_once(api_get_path(LIBRARY_PATH) . 'document.lib.php');
-        $format = DocumentManager::file_get_mime_type($this->mdo_path);
-    }
-
-    $xhtDoc->xht_param['format'] = $format;
-
-    $xhtDoc->xht_param['size'] = (($s = filesize(get_course_path() .
-        $this->mdo_course['path'] . '/document' . $this->mdo_path))) ? $s : '0';
-
-    return $xhtDoc->xht_fill_template('XML');
-}
-
-
-function mdo_add_breadcrump_nav()
-{
-    global $interbreadcrumb, $langFormats;
-    $regs = array(); // for use with ereg()
-
-    $docurl = api_get_self();  // should be .../main/xxx/yyy.php
-    if (ereg('^(.+[^/\.]+)/[^/\.]+/[^/\.]+.[^/\.]+$', $docurl, $regs))
-        $docurl = $regs[1] . '/document/document.php';
-
-    $interbreadcrumb[]= array ('url' => $docurl,
-        "name"=> get_lang('MdCallingTool'));
-
-    if (($docpath = $this->mdo_path))
-    {
-        $docpath = substr($docpath, 0, strrpos($docpath, '/'));
-
-        if (strlen($docpath) > 1) $interbreadcrumb[]= array ('url' =>
-            $docurl . '?curdirpath=' . urlencode($docpath) .
-            ($this->mdo_group ? '&gidReq=' . $this->mdo_group : ''), "name" =>
-            htmlspecialchars(substr($docpath, strrpos($docpath, '/') + 1)));
-    }
-
-    // Complete assoclist $langFormats from mime types
-
-    require_once(api_get_path(LIBRARY_PATH) . 'xht.lib.php');
-    require_once(api_get_path(LIBRARY_PATH) . 'document.lib.php');
-
-    $sep = $langFormats{0} ? $langFormats{0} : ":";
-    $arrFormats = xht_explode_assoclist($langFormats);
-
-    foreach (DocumentManager::file_get_mime_type(TRUE) as $format)
-        if (!isset($arrFormats[$format]))
-            $langFormats .= ",, " . $format . $sep . $format;
-
-    if (!isset($arrFormats["inode/directory"]))
-        $langFormats .= ",, inode/directory" . $sep . "inode/directory";
-
-    if (substr($langFormats, 0, 3) == ",, ")
-        $langFormats = $sep . substr($langFormats, 3);
-}
-
-
-function mdobject($_course, $id) {
-    global $ieee_dcmap_e, $ieee_dcmap_v;  // md_funcs
-    $course_id = api_get_course_int_id();
-
-    $this->mdo_course = $_course; $this->mdo_type = 'Document';
-    $this->mdo_id = $id; $this->mdo_eid = $this->mdo_type . '.' . $id;
-
-    $this->mdo_dcmap_e = $ieee_dcmap_e; $this->mdo_dcmap_v = $ieee_dcmap_v;
-
-    $document_table = Database::get_course_table(TABLE_DOCUMENT);
-    $sql = "SELECT path,title,comment,filetype FROM $document_table WHERE c_id = $course_id AND id='" .intval($id) . "'";
-    
-    if (($docinfo = Database::fetch_array(Database::query($sql)))) {
-        $this->mdo_path =     $docinfo['path'];
-        $this->mdo_title =    $docinfo['title'];
-        $this->mdo_comment =  $docinfo['comment'];
-        $this->mdo_filetype = $docinfo['filetype'];
-        $this->mdo_group =    '';  // 2005-05-30: find group_id, if any
-
-        $group_info = Database::get_course_table(TABLE_GROUP);
-        $sql = "SELECT id,secret_directory FROM $group_info WHERE c_id = $course_id";
-        if (($result = Database::query($sql)))
-            while (($row = Database::fetch_array($result)))
-                if (($secdir = $row['secret_directory'] . '/') ==
-                        substr($this->mdo_path, 0, strlen($secdir)))
-                {
-                    $this->mdo_group = $row['id']; break;
-                }
-
-          // 2005-05-30: use direct URL
-          $this->mdo_url =  api_get_path(WEB_COURSE_PATH) . $_course['path'] .
-            '/document' . str_replace('%2F', '/', urlencode($this->mdo_path)) .
-            ($this->mdo_group ? '?gidReq=' . $this->mdo_group : '');
-    }
-}
-
-}
-?>

+ 0 - 21
main/metadata/md_editxml.htt

@@ -1,21 +0,0 @@
-<!-- {-MD_EDITXML.HTT-} -->               <!-- for Dokeos metadata/index.php -->
-                                                             <!-- 2005/03/15 -->
-
-<!-- Copyright (C) 2005 rene.haentjens@UGent.be -  see metadata/md_funcs.php -->
-
-
-<!-- {-METADATA-} -->
-
-{-P traceinfo-}
-<hr>
-<form method="post" action="{-P self-}">
-    <textarea rows="30" style="width: 100%" name="mdt" id="mdt">{-H {-P mdt-}-}</textarea>
-    <input type="submit" value="{-H {-L Store-}-}"></input>
-</form>
-
-<!-- {-HTTP-} -->
-
-Expires: Mon, 26 Jul 1997 05:00:00 GMT
-
-
-<!-- {--} -->

+ 0 - 406
main/metadata/md_funcs.php

@@ -1,406 +0,0 @@
-<?php
-/**
- * Chamilo metadata/md_funcs.php -->
- * 2006/12/15
- * Copyright (C) 2006 rene.haentjens@UGent.be - see note at end of text    -->
- * @package chamilo.metadata
-*/
-
-/**
-*   Chamilo Metadata: common functions and mdstore class
-*
-*   This script requires xmd.lib.php and xht.lib.php (Chamilo inc/lib).
-*
-*   Note on the funny characters used in mds_update_xml_and_mdt:
-*
-*   ! and ~ and ,   are handled by xmd_update, see xmd.lib.php
-*   ~~ !! ; and =   are handled here; note that = excludes newlines in value
-*
-*   path!elem       create new element (not for attributes!)
-*   path=value      assign new value to existing element or value to attribute
-*   path~           delete element (you cannot delete an attribute)
-*   ~~              delete the whole xmldoc and the DB entry
-*   !!              this (xml) document contains the course keywords
-*
-*   path1,path2,...;subpath=value   for all elements in path1, path2, ...
-*                   assign value to subpath (see also xmd_update_many)
-*
-*/
-
-// FETCH GET/POST-DATA; GENERAL FUNCTIONS
-
-define('MDS_TABLE', Database::get_course_table(TABLE_METADATA));
-
-
-if (isset($getpostvars) && is_array($getpostvars))
-  foreach ($getpostvars as $gpvar)
-    if (is_string($gpvar) && (isset($_POST[$gpvar]) || isset($_GET[$gpvar]))) {
-        $val = isset($_POST[$gpvar]) ? $_POST[$gpvar] : $_GET[$gpvar];
-        $GLOBALS[$gpvar] = get_magic_quotes_gpc() ? stripslashes($val) : $val;
-    }
-
-function fgc($filename) {
-    $fp = fopen($filename, 'rb'); $buffer = fread($fp, filesize($filename));
-    fclose($fp); return $buffer; // file_get_contents: PHP >= 4.3.0
-}
-
-
-function give_up($msg) {
-	global $charset;
-    echo '<p align="center">MetaData:<br /><b>? ',
-        htmlspecialchars($msg, ENT_QUOTES, $charset), '</b></p>'; exit;
-}
-
-
-function getpar($name, $description, $default = '')
-{
-    $value = isset($_GET[$value = api_strtolower($name)]) ? $_GET[$value] : '';
-    $value = get_magic_quotes_gpc() ? stripslashes($value) : $value;
-    if (!$value) $value = $default;
-    if ($value == '') give_up('URL parameter ' . api_strtoupper($name) . ' - ' .
-                $description . ' - is required');
-
-    define(api_strtoupper($name), $value);
-}
-
-
-function get_course_path() {
-    return api_get_path(SYS_COURSE_PATH);
-}
-
-function get_course_web() {
-    return api_get_path(WEB_COURSE_PATH);
-}
-
-
-function define_htt($htt_file, $urlp, $course_path) {
-	global $charset;
-
-    ($htt_file_contents = @fgc($htt_file))
-        or give_up('Templates file "' . $htt_file . '" is missing...');
-
-    $xhtDoc = new xhtdoc($htt_file_contents);
-    if ($xhtDoc->htt_error)
-        give_up('Templates file "' . $htt_file . '": ' . $xhtDoc->htt_error);
-
-    $xhtDoc->xht_param['self'] = api_get_self() . $urlp;
-
-    $xhtDoc->xht_param['dateTime'] = date('Y-m-d');
-
-    $ckw = $course_path . '/CourseKwds.js';
-    define('KEYWORDS_CACHE', get_course_path() . $ckw);
-
-    if (file_exists(KEYWORDS_CACHE)) $kcdt =
-        htmlspecialchars(date('Y/m/d H:i:s', filemtime(KEYWORDS_CACHE)), ENT_QUOTES, $charset);
-
-    $xhtDoc->xht_param['keywordscache'] = $kcdt ?
-        '<script type="text/javascript" src="' . get_course_web() . $ckw . '"></script>' .
-        '<br /><small><i>(CourseKwds cache: ' . $kcdt . ')</i></small>' : '';
-
-    return $xhtDoc;
-}
-
-
-function make_uri() {
-    $regs = array(); // for use with ereg()
-
-    $uri = strtr(ereg_replace(
-        "[^0-9A-Za-z\xC0-\xD6\xD8-\xF6\xF8-\xFF\*\(\('!_.-]", "_",
-        api_get_setting('siteName')), "\\", "_");  // allow letdigs, and _-.()'!*
-
-    if (($p = strpos($uri, '.')) !== FALSE)
-        $uri = substr($uri, 0, $p);
-    if (ereg('^([^/]+//)?([^/\?]+)[/\?]',api_get_path(WEB_PATH).'/',$regs))
-        if (ereg('([^\.]+)(\.ca)?(\.[^\.]+)?', strrev($regs[2]), $regs))
-            $uri = str_replace('.', '-',
-                strrev($regs[1].$regs[2].$regs[3])) . ':' . $uri;
-    $uri = 'urn:' . strtolower($uri);
-    while (substr($uri, -1)=='.') $uri = substr($uri,0,-1);
-
-    return $uri;
-}
-
-
-// IEEE LOM: DEFAULT XML AND DUBLIN CORE MAPPING ------------------------------>
-
-$ieee_xml = <<<EOD
-
-<!-- {-XML-} -->
-
-<item>
-  <metadata>
-    <lom xmlns="http://ltsc.ieee.org/xsd/LOM">
-      <general>
-        <identifier><catalog>{-H {-P siteUri-}-}.</catalog><entry>{-H {-P entry-}-}</entry></identifier>
-        <title><string language="{-H {-P mdlang-}-}">{-H {-P title-}-}</string></title>
-        <language>{-H {-P lang-}-}</language>
-        <description><string language="{-H {-P mdlang-}-}">{-H {-P description-}-}</string></description>
-        <coverage><string language="{-H {-P mdlang-}-}">{-H {-P coverage-}-}</string></coverage>
-      </general>
-      <lifeCycle>
-        <version><string language="xx">0.5</string></version>
-        <status><source>LOMv1.0</source><value>draft</value></status>
-        <contribute>
-          <role><source>LOMv1.0</source><value>author</value></role>
-          <entity>{-H {-P author-}-}</entity>
-          <date><dateTime>{-H {-P dateTime-}-}</dateTime></date>
-        </contribute>
-      </lifeCycle>
-      <metaMetadata>
-        <metadataSchema>ADLv1.3</metadataSchema>
-      </metaMetadata>
-      <technical>
-        <format>{-H {-P format-}-}</format>
-        <size>{-H {-P size-}-}</size>
-        <location>{-H {-P location-}-}</location>
-      </technical>
-      <educational>
-        <learningResourceType><source>LOMv1.0</source><value>narrative text</value></learningResourceType>
-      </educational>
-      <rights>
-        <cost><source>LOMv1.0</source><value>yes</value></cost>
-        <copyrightAndOtherRestrictions><source>LOMv1.0</source><value>yes</value></copyrightAndOtherRestrictions>
-        <description><string language="{-H {-P mdlang-}-}">{-L MdCopyright-}</string></description>
-      </rights>
-      <classification>
-        <purpose><source>LOMv1.0</source><value>educational objective</value></purpose>
-      </classification>
-    </lom>
-  </metadata>
-</item>
-<!-- {--} -->
-EOD;
-
-$ieee_dcmap_e = array(
-'Identifier'=>      'metadata/lom/general/identifier[1]',
-'Title'=>           'metadata/lom/general/title[1]',
-'Language'=>        'metadata/lom/general/language[1]',
-'Description'=>     'metadata/lom/general/description[1]',
-'Coverage'=>        'metadata/lom/general/coverage[1]',
-'Type'=>            'metadata/lom/educational/learningResourceType[1]',
-'Date'=>            'metadata/lom/lifeCycle/contribute[1]/date',
-'Creator'=>         'metadata/lom/lifeCycle/contribute[1]/entity',
-'Format'=>          'metadata/lom/technical/format[1]',
-'Rights'=>          'metadata/lom/rights/description[1]');
-// maps Dublin Core elements to xmd paths for elements (not yet complete)
-
-$ieee_dcmap_v = array(
-'Identifier'=>      'metadata/lom/general/identifier[1]/entry',
-'Title'=>           'metadata/lom/general/title[1]/string',
-'Language'=>        'metadata/lom/general/language[1]',
-'Description'=>     'metadata/lom/general/description[1]/string',
-'Coverage'=>        'metadata/lom/general/coverage[1]/string',
-'Type'=>            'metadata/lom/educational/learningResourceType[1]/value',
-'Date'=>            'metadata/lom/lifeCycle/contribute[1]/date/dateTime',
-'Creator'=>         'metadata/lom/lifeCycle/contribute[1]/entity',
-'Format'=>          'metadata/lom/technical/format[1]',
-'Rights'=>          'metadata/lom/rights/description[1]/string');
-// maps Dublin Core elements to xmd paths for values (not yet complete)
-
-
-// KEYWORD TREE
-function define_kwds($mdo) {
-    if (!($newtext = trim(@fgc(get_course_path() . $mdo->mdo_course['path'] .
-            '/document' . $mdo->mdo_path ))))
-    {
-        unlink(KEYWORDS_CACHE); return;
-    }
-                                    // templates to define the tree as JScript object
-    $xhtDocKw = new xhtdoc(<<<EOD
-
-<!-- {-KWTREE_OBJECT-} -->
-
-KWTREE_OBJECT = {n:"", ti:"{-X @title-}"
-, c:[{-R * C DOWN_THE_KWTREE-}]};
-
-document.write(traverseKwObj(KWTREE_OBJECT, '', 0)); KWDS_ARRAY.sort();
-
-<!-- {-DOWN_THE_KWTREE-} -->
-{-T number > 1 , -}{n:"{-V @.-}"{-D cm {-X @comment-}-}{-T cm != empty , cm:"{-P cm-}"-}{-D pt {-X @postit-}-}{-T pt != empty , pt:"{-P pt-}"-}{-R * P empty-}{-T number >= 1
-, c:[-}{-T number >= 1 R * C DOWN_THE_KWTREE-}{-R * P empty-}{-T number >= 1 ]-}}
-
-<!-- {--} -->
-EOD
-    );  // traverseKwObj (md_script) generates clickable tree and populates KWDS_ARRAY
-
-
-    if ($xhtDocKw->htt_error)
-        give_up('KwdTree template (metadata/md_funcs): ' . $xhtDocKw->htt_error);
-
-    $xhtDocKw->xht_xmldoc = new xmddoc(explode("\n", $newtext));
-    if ($xhtDocKw->xht_xmldoc->error)
-        give_up('CourseKwds (metadata/md_funcs): XML error: ' .
-        $xhtDocKw->xht_xmldoc->error);
-
-    if (count($xhtDocKw->xht_xmldoc->children[0]) < 2)
-    {
-        unlink(KEYWORDS_CACHE); return;
-    }
-
-    $fileHandler = @fopen(KEYWORDS_CACHE, 'w');
-    @fwrite($fileHandler, $xhtDocKw->xht_fill_template('KWTREE_OBJECT'));
-    @fclose($fileHandler);
-}
-
-
-// METADATA STORE
-/**
- * mdstore class
- * @package chamilo.metadata
- */
-class mdstore {
-
-    var $mds_something;
-
-    function __construct($allow_create) {
-        $_course = api_get_course_info();
-        $this->course_id = api_get_course_int_id();
-        if (!isset($_course)) return;
-    }
-
-    function mds_get($eid, $column = 'mdxmltext', $must_exist = '') {
-        // none: FALSE
-        if (($mdt = Database::fetch_array(Database::query("SELECT " . $column ." FROM ".MDS_TABLE." WHERE eid = '$eid' AND c_id = {$this->course_id} "))))
-            return $mdt[$column];
-        if ($must_exist) give_up($must_exist . $this->_coldat('eid', $eid));
-
-        return FALSE;
-    }
-
-    function mds_get_dc_elements($mdo)  // no record: FALSE
-    {
-        if (!($mdt = $this->mds_get($mdo->mdo_eid))) return FALSE;
-        $xmlDoc = new xmddoc(explode("\n", $mdt)); if ($xmlDoc->error) return FALSE;
-        $result = array();
-        foreach ($mdo->mdo_dcmap_v as $dce => $xp) {
-            $result[$dce] = $xmlDoc->xmd_value($xp);
-        }
-        return $result;
-    }
-
-    function mds_get_many($columns, $where_clause) {
-        $cols = '';
-        foreach (explode(',', $columns) as $col) $cols .= "," . trim($col);
-        if (!$cols) return;
-        return $this->_query("SELECT " . api_substr($cols, 1) ." FROM " . MDS_TABLE . " WHERE c_id = {$this->course_id} AND ". $where_clause);
-    }
-
-    function mds_put($eid, $data, $column = 'mdxmltext', $exists = TRUE) {
-        if ($exists === TRUE)
-            return $this->_query("UPDATE " . MDS_TABLE . " SET " .$this->_coldat($column, $data) . " WHERE c_id = {$this->course_id} AND ", $eid);
-        elseif ($exists === FALSE)
-            return $this->_query("INSERT INTO " . MDS_TABLE . " SET c_id = {$this->course_id} , ".$this->_coldat($column, $data).", ", $eid);
-        else  // user doesn't know, check first whether the record exists
-            return $this->mds_put($eid, $data, $column, !($this->mds_get($eid) === FALSE));
-    }
-
-    function mds_put_dc_elements($mdo, $dcelem) {
-        if (($mdt = $this->mds_get($mdo->mdo_eid)) === FALSE) {
-            $mdt = $mdo->mdo_generate_default_xml_metadata(); $exists = FALSE;
-        } else
-            $exists = TRUE;
-
-        $xmlDoc = new xmddoc(explode("\n", $mdt)); if ($xmlDoc->error) return FALSE;
-        foreach ($dcelem as $dce => $value) {
-            $xmlDoc->xmd_update($mdo->mdo_dcmap_v[$dce], (string) $value);
-        }
-        $this->mds_put($mdo->mdo_eid, '', 'md5', $exists);
-        return $this->mds_put($mdo->mdo_eid, $xmlDoc->xmd_xml());
-    }
-
-    function mds_append($eid, $moredata, $column = 'indexabletext') {
-        if (($olddata = $this->mds_get($eid, $column)) === FALSE) return FALSE;
-        $this->mds_put($eid, $olddata . $moredata, $column); return $olddata;
-    }
-
-    function mds_delete($eid) {
-        return $this->_query("DELETE FROM " . MDS_TABLE . " WHERE c_id = {$this->course_id} AND ", $eid);
-    }
-
-    function mds_delete_offspring($eid, $sep = '.') {
-        return $this->_query("DELETE FROM " . MDS_TABLE . " WHERE c_id = {$this->course_id} AND ", $eid, $sep);
-    }
-
-    function mds_delete_many($idarray) {
-        if (!is_array($idarray) || count($idarray) == 0) return FALSE;
-
-        return $this->_query("DELETE FROM " . MDS_TABLE . " WHERE c_id = {$this->course_id} AND eid IN ('" .
-            implode("','", array_map('addslashes', $idarray)) . "')");
-    }
-
-    function mds_update_xml_and_mdt($mdo, &$xmlDoc, $mda, $eid, &$traceinfo,
-            $exists = TRUE)  // note: $xmlDoc and $traceinfo passed by reference
-    {
-        foreach (explode("\n",
-               str_replace("\r", "\n", str_replace("\r\n", "\n", $mda))) as $update)
-        {
-            if (!$update) continue;
-
-            if (($nameLth = strpos($update, '=')))  // e.g. 'gen/tit/str=new'
-            {
-                if (($text = api_substr($update, $nameLth + 1)) === FALSE) $text = '';
-
-                if (!($path = trim(api_substr($update, 0, $nameLth)))) continue;
-
-                if (($sc = api_strpos($path, ';')))  // e.g. 'gen/tit,gen/des;str@lang'
-                    $xmlDoc->xmd_update_many(api_substr($path, 0, $sc),
-                        api_substr($path, $sc + 1), $text);
-                else
-                    $xmlDoc->xmd_update($path, $text);
-            }
-            elseif ($nameLth === FALSE)  // e.g. 'gen/tit/str[-1]~'
-            {
-                if ($update == '~~')
-                {
-                    $update = 'DELETE ' . $eid;
-                    if ($exists === FALSE) $update = '';
-                    else $this->mds_delete($eid);
-                    $mda = ''; $exists = TRUE;
-                    foreach ($xmlDoc->children[0] as $key => $child)
-                        unset($xmlDoc->children[0][$key]);
-                }
-                elseif ($update == '!!')
-                {
-                    define_kwds($mdo);
-                    $update = ''; $mda = ''; $exists = TRUE;
-                }
-                else
-                {
-                    $x = $xmlDoc->xmd_update(trim($update), '');
-                }
-            }
-            if ($update) $traceinfo .= $update . '- ';
-        }
-
-        $mdt = $xmlDoc->xmd_xml();
-
-        if ($exists === FALSE)
-        {
-            $this->mds_put($eid, $mdt, 'mdxmltext', FALSE);
-            $traceinfo .= 'INSERT ' . $eid . '- ';
-        }
-        elseif($mda)
-        {
-            $this->mds_put($eid, $mdt, 'mdxmltext');
-            $traceinfo .= 'UPDATE ' . $eid . '- ';
-        }
-
-        return $mdt;
-    }
-
-
-    function _coldatstart($column, $data) {
-        return $column . " LIKE '" . Database::escape_string($data) . "%'";
-    }
-
-    function _coldat($column, $data) {
-        return $column . "='" . Database::escape_string($data) . "'";
-    }
-
-    function _query($sql, $eid = '', $sep = '') {
-        if ($eid) $sql .= $sep ? $this->_coldatstart('eid', $eid . $sep) :
-            $this->_coldat('eid', $eid);
-        return Database::query($sql);
-    }
-
-}

+ 0 - 202
main/metadata/md_link.htt

@@ -1,202 +0,0 @@
-<!-- {-md_link.htt-} -->                  <!-- for Dokeos metadata/index.php -->
-                                                             <!-- 2006/05/16 -->
-
-<!-- Copyright (C) 2005 rene.haentjens@UGent.be -  see metadata/md_funcs.php -->
-
-
-<!-- {-METADATA-} -->
-
-{-D TRUE TRUE-}
-
-<div class="dvc">
-{-H {-E md_indexabletext C METADATA_INDEXABLETEXT-}-}
-</div>
-
-<noscript>
-{-P traceinfo-}
-<hr>
-<form method="post" action="{-P self-}">
-    <textarea rows="30" style="width: 100%" name="mdt" id="mdt">{-H {-P mdt-}-}</textarea>
-    <input type="submit" value="{-L Store-}"></input>
-</form>
-{-L NoScript-}
-</noscript>
-
-<div  onMouseUp="if ((kw = pU_clicked(event))) pU_select(kw); else pU_hide();">
-{-T dbrecord == empty <div style="background-color: #F0F0F0">-}
-{-E md_part1 C METADATA_PART1-}
-{-T dbrecord == empty </div>-}
-
-{-T isallowedtoedit == TRUE 
-
-<div class="dvc">{-P traceinfo-}</div>
-
-<form method="post" action="{-P self-}">
-    <textarea rows="4" class="mda" name="mda" id="mda" title="{-L ConfirmDelete-}"></textarea>
-	<button class="save" type="submit" value="{-L Store-}" onClick="javascript: return checkBeforeSubmit(event);">{-L Store-}</button>
-	<button class="minus" type="submit" value="{-L DeleteAll-}" onClick="javascript:return setPendingOperation('~~', event);">{-L DeleteAll-}</button>
-
-</form>
-
-<textarea rows="10" class="mda" name="mdt" id="mdt">{-H {-P mdt-}-}</textarea>
-
- -}
-
-{-T keywordscache != empty 
-
-<div noWrap="1" id="maindiv">
-    <input type="button" class="btn" value="+" onClick="if (this.value == '+') deselectAll(event, this); openOrClose(this);"/>
-    <input type="button" class="btm" id="btnOpenOrCloseAll" value="++" onClick="openOrCloseAll(this);"/>
-    <input type="button" class="btn" value="?" onClick="openOrCloseHelp(this)"/>
-    &#xa0;{-L ClickKw-}
-    {-P keywordscache-}
-</div>
-
-<div id='moreHelp' class='dvc'>
-    {-L KwHelp-}
-</div>
-
- -}
-
-{-T keywordscache == empty 
-
-<div noWrap="1" id="maindiv">
-{-L KwNote-}
-</div>
-
- -}
-
-<div id="popup" noWrap="1" class="pup">
-    Working...
-</div>
-</div><!-- onMouseUp -->
-
-<!<!------------------------  End Of script Output  ---------------------->
-
-
-<!-- {-METADATA_PART1-} -->
-
-<h3>{-L Tool-}: {-X metadata/lom/general/identifier/entry-}</h3>
-
-<table class="wide">
-    <tr>
-        <td colspan="2" class="bg1">&#xa0;</td><td class="bg2">&#xa0;</td>
-        <td class="bg1">&#xa0;</td>            <td class="bg2">&#xa0;</td>
-    </tr>
-    <tr>
-        <td>{-D label Language-}{-C LABEL-}</td>
-        <td>{-D xpath metadata/lom/general/language-}{-C LANGSELECT-}</td>
-        <td>{-D xpath metadata/lom/general/identifier/catalog-}{-D iclass disabled class="wd2" -}{-C INPUT-}</td>
-        <td>{-D label Identifier-}{-C LABEL-}</td>
-        <td>{-D xpath metadata/lom/general/identifier/entry-}{-D iclass class="wd2" onKeyPress="return isValidChar(event, '[a-z0-9\x08\x25\x27\*\.\'\(\)_!-]', 'i');" -}{-C INPUT-}</td>
-    </tr>
-    <tr>
-        <td>{-D label Title-}{-C LABEL-}</td>
-        <td>{-D xpath metadata/lom/general/title/string/@language-}{-C LANGSELECT-}</td>
-        <td colspan="3">{-D xpath metadata/lom/general/title/string-}{-C INPUTW-}</td>
-    </tr>
-    <tr>
-        <td>{-D label Description-}{-C LABEL-}</td>
-        <td>{-C MDLANGSELECT-}</td>
-        <td colspan="3">{-D xpath metadata/lom/general/description/string-}{-C INPUTW-}</td>
-    </tr>
-    <tr>
-        <td colspan="2">{-D label Coverage-}{-C LABEL-}</td>
-        <td colspan="3">{-D xpath metadata/lom/general/coverage/string-}{-C INPUTW-}</td>
-    </tr>
-    <tr>
-        <td colspan="2">{-D label Keyword-}{-C LABEL-}</td>
-        <td colspan="3">{-C INPUT_ALLKWDS-}</td>
-    </tr>
-    <tr>
-        <td colspan="2"><a href="{-X metadata/lom/technical/location-}">{-D label Location-}{-C LABEL-}</a></td>
-        <td colspan="3">{-D xpath metadata/lom/technical/location-}{-C INPUTW-}</td>
-    </tr>
-    <tr>
-        <td colspan="2" class="bg1">&#xa0;</td><td class="bg2">&#xa0;</td>
-        <td class="bg1">&#xa0;</td>            <td class="bg2">&#xa0;</td>
-    </tr>
-</table>
-
-
-<!-- {-METADATA_INDEXABLETEXT-} -->
-
-Title: {-V metadata/lom/general/title/string-} txt-sep
-Keyword(s): {-R metadata/lom/general/keyword C KWTEXT-} txt-sep
-Category: {-V metadata/lom/general/coverage/string-}
- {-V metadata/lom/general/description[1]/string-} txt-end
- link-type
- {-V metadata/lom/lifeCycle/contribute[1]/entity-}
- {-V metadata/lom/lifeCycle/contribute[1]/date/dateTime-}
-
-<!-- {-METADATA_INDEXABLETEXT_PREVIOUS_VERSION-} -->
-
- {-V metadata/lom/general/identifier/entry-}
- {-V metadata/lom/general/title/string-}
- {-V metadata/lom/general/description/string-}
- {-V metadata/lom/general/coverage/string-}
- {-R metadata/lom/general/keyword C KWTEXT-}
-
-
-<!-- {-KWTEXT-} -->
-
- {-V string-}-kw
-
-
-<!-- {-LABEL-} -->
-
-<span class="bg3" title="{-L {-P label-}Tip-}">{-L {-P label-}-}&#xa0;:</span>
-
-
-<!-- {-MDLANGSELECT-} -->
-
-<select onchange="spcSel('metadata/lom/general/description,metadata/lom/general/coverage,metadata/lom/general/keyword,metadata/lom/rights/description;string@language', this);">{-D selvalue {-V metadata/lom/general/description/string/@language-}-}{-R Langs C OPTION-}</select>
-
-
-<!-- {-LANGSELECT-} -->
-
-{-D optionarray Langs-}{-C SELECT-}
-
-
-<!-- {-SELECT-} -->
-
-<select onchange="spcSel('{-H {-P xpath-}-}', this);">{-D selvalue {-V P xpath-}-}{-R {-P optionarray-} C OPTION-}</select>
-
-
-<!-- {-OPTION-} -->
-
-<option value="{-H {-P key-}-}" {-T key == selvalue selected-}>{-H {-P value-}-}</option>
-
-
-<!-- {-INPUTW-} -->
-
-{-D iclass class="wide" -}{-C INPUT-}
-
-
-<!-- {-INPUT-} -->
-
-<input type="text" title="{-H {-P xpath-}-}" {-P iclass-}value="{-H {-V P xpath-}-}" onchange="spc(this.title, this.value);"/>
-
-
-<!-- {-INPUT_ALLKWDS-} -->
-
-<input type="text" title="{-X metadata/lom/general/description/string/@language-}" 
- id="kwds_string" class="wide" value="{-X metadata/lom/general/keyword/string , -}" 
- onKeyUp="takeTypeIn(this, 150, -100, '60%'); return true;" 
- onKeyPress="return isValidChar(event, '[0-9a-z\xC0-\xFF\.\x08\x25\x27, -]', 'i');" />
-
-
-<!-- {-HEAD-} -->
-
-<link rel="stylesheet" type="text/css" href="md_styles.css">
-
-<script language="JavaScript" src="md_script.js"></script>
-<script language="JavaScript">var kwdswere = "{-X metadata/lom/general/keyword/string , -}";</script>
-
-
-<!-- {-HTTP-} -->
-
-Expires: Mon, 26 Jul 1997 05:00:00 GMT
-
-
-<!-- {--} -->

+ 0 - 256
main/metadata/md_link.php

@@ -1,256 +0,0 @@
-<?php
-/**
- * md_link.php for Chamilo metadata/*.php
- * 2006/12/15
- * Copyright (C) 2006 rene.haentjens@UGent.be -  see metadata/md_funcs.php
- * @package chamilo.metadata
- */
-/**
- *	Chamilo Metadata: class mdobject for Link-type objects
- * @package chamilo.metadata
- */
-class mdobject {
-
-var $mdo_course;
-var $mdo_type;
-var $mdo_id;
-var $mdo_eid;
-
-var $mdo_dcmap_e;
-var $mdo_dcmap_v;
-
-var $mdo_url;
-var $mdo_title;
-var $mdo_description;
-var $mdo_category;
-var $mdo_category_title;
-
-function mdo_define_htt() { return new xhtdoc(<<<EOD
-
-<!-- {-INDEXABLETEXT-} -->
-
-Title: {-V metadata/lom/general/title/string-} txt-sep
-Keyword(s): {-R metadata/lom/general/keyword C KWTEXT-} txt-sep
-Category: {-V metadata/lom/general/coverage/string-} txt-sep
- {-V metadata/lom/general/description[1]/string-} txt-end
- link-type
-
-
-<!-- {-KWTEXT-} -->
-
- {-V string-}-kw
-
-
-<!-- {--} -->
-EOD
-);
-}
-
-function mdo_generate_default_xml_metadata()
-{
-    global $iso639_2_code, $ieee_xml;
-
-    $xhtDoc = new xhtdoc($ieee_xml); $_user = api_get_user_info();
-
-    if ($xhtDoc->htt_error)
-        give_up('IEEE XML (metadata/md_funcs): ' . $xhtDoc->htt_error);
-
-    $xhtDoc->xht_get_lang = 'get_lang'; $xhtDoc->xht_xmldoc = new xmddoc('');
-    if ($xhtDoc->xht_xmldoc->error) give_up($xhtDoc->xht_xmldoc->error);
-
-    $xhtDoc->xht_param['siteUri'] = make_uri();
-
-    $xhtDoc->xht_param['entry'] = $this->mdo_course['sysCode'] .
-        '.Link.' . $this->mdo_id;  // 2005-05-30: path->sysCode
-
-    $xhtDoc->xht_param['location'] = $this->mdo_url . '';
-
-    $xhtDoc->xht_param['mdlang'] = strtolower($iso639_2_code);
-    $xhtDoc->xht_param['lang'] =   strtolower($iso639_2_code);
-
-    $xhtDoc->xht_param['title'] =
-        $this->mdo_title ? $this->mdo_title : get_lang('MdTitle');
-
-    if (($d = $this->mdo_description))
-    {
-        if ($keywords = $this->_find_keywords($d)) $d = array_pop($keywords);
-        $xhtDoc->xht_param['description'] = $d;
-    }
-    else
-        $xhtDoc->xht_param['description'] = get_lang('MdDescription');
-
-    $xhtDoc->xht_param['coverage'] = $this->mdo_category_title ?
-        $this->mdo_category_title : get_lang('MdCoverage');
-
-    if (isset($_user))
-    {
-        $xhtDoc->xht_param['author'] = "BEGIN:VCARD\\nFN:" .
-            api_get_person_name($_user['firstName'], $_user['lastName'], null, PERSON_NAME_EMAIL_ADDRESS) .
-            "\\nEMAIL:".$_user['mail'] . "\\nEND:VCARD\\n";
-    }
-
-    $xhtDoc->xht_param['dateTime'] = date('Y-m-d');
-
-    $xhtDoc->xht_param['format'] = ''; $xhtDoc->xht_param['size'] = '0';
-
-    if (count($keywords))
-    {
-        $xd = new xmddoc(explode("\n",
-            $mdt = $xhtDoc->xht_fill_template('XML')));
-        if ($xd->error) return $mdt;  // and worry later
-
-        $this->_add_keywords($xd, $keywords);
-
-        return $xd->xmd_xml();
-    }
-
-    return $xhtDoc->xht_fill_template('XML');
-}
-
-
-function mdo_override(&$xmlDoc)  // by ref!
-{
-    if ($this->mdo_url)
-    {
-        $xmlDoc->xmd_update('metadata/lom/technical/location', $this->mdo_url);
-
-        $ge = $xmlDoc->xmd_select_single_element("metadata/lom/general");
-
-        $xmlDoc->xmd_update('title[1]/string', $this->mdo_title, $ge);
-        $xmlDoc->xmd_update('coverage[1]/string', $this->mdo_category_title, $ge);
-
-        if (($d = $this->mdo_description))
-            if ($keywords = $this->_find_keywords($d)) $d = array_pop($keywords);
-
-        $xmlDoc->xmd_update('description[1]/string', $d, $ge);
-
-        $xmlDoc->xmd_remove_nodes($xmlDoc->xmd_select_elements('keyword', $ge), $ge);
-
-        if (count($keywords)) $this->_add_keywords($xmlDoc, $keywords);
-    }
-
-    return $xmlDoc->xmd_xml();
-}
-
-
-function mdo_storeback(&$xmlDoc)  // by ref!
-{
-    $course_id = api_get_course_int_id();
-    
-    if (!$this->mdo_url) return;  // no record in link table, most probably
-
-    if (!($v = $xmlDoc->xmd_value('metadata/lom/technical/location'))) return;
-
-    if ($v != $this->mdo_url)
-    { $this->mdo_url = $v;   $u .= ", url = '" . addslashes($v) . "'"; }
-
-    $ge = $xmlDoc->xmd_select_single_element("metadata/lom/general");
-
-    $v = $xmlDoc->xmd_value('title[1]/string', $ge);
-    if ($v != $this->mdo_title)
-    { $this->mdo_title = $v; $u .= ", title = '" . addslashes($v) . "'"; }
-
-    $vd = $xmlDoc->xmd_value('description[1]/string', $ge);
-    $vk = $xmlDoc->xmd_value('keyword/string', $ge, array('in' => ', '));
-    $v = $vk ? '<i kw="' . htmlspecialchars($vk) . '">' .
-        ereg_replace('\[((/?(b|big|i|small|sub|sup|u))|br/)\]', '<\\1>',
-            htmlspecialchars($vd)) . '</i>' : $vd;
-
-    if ($v != $this->mdo_description)
-    {
-        $this->mdo_description = $v;
-        $u .= ", description = '" . addslashes($v) . "'";
-    }
-
-    // do not store back a modified coverage as category...
-
-    $link_table = Database::get_course_table(TABLE_LINK);
-    if ($u) Database::query("UPDATE $link_table SET " . substr($u, 2) .
-        " WHERE c_id = $course_id AND id='" . addslashes($this->mdo_id) . "'");
-}
-
-
-function mdo_add_breadcrump_nav()
-{
-    global $interbreadcrumb;
-
-    $regs = array(); // for use with ereg()
-
-    $docurl = api_get_self();  // should be .../main/xxx/yyy.php
-    if (ereg('^(.+[^/\.]+)/[^/\.]+/[^/\.]+.[^/\.]+$', $docurl, $regs))
-        $docurl = $regs[1] . '/link/link.php';
-
-    $interbreadcrumb[]= array ('url' => $docurl,
-        "name"=> get_lang('MdCallingTool'));
-}
-
-
-function mdobject($_course, $id)
-{
-    global $ieee_dcmap_e, $ieee_dcmap_v;  // md_funcs
-    $course_id = api_get_course_int_id();
-    
-    $this->mdo_course = $_course; $this->mdo_type = 'Link';
-    $this->mdo_id = $id; $this->mdo_eid = $this->mdo_type . '.' . $id;
-
-    $this->mdo_dcmap_e = $ieee_dcmap_e; $this->mdo_dcmap_v = $ieee_dcmap_v;
-
-    $link_table = Database::get_course_table(TABLE_LINK);
-    if (($linkinfo = @Database::fetch_array(Database::query(
-            "SELECT url,title,description,category_id FROM $link_table WHERE c_id = $course_id AND id='" .intval($id) . "'"))))
-    {
-        $this->mdo_url =         $linkinfo['url'];
-        $this->mdo_title =       $linkinfo['title'];
-        $this->mdo_description = $linkinfo['description'];
-        $this->mdo_category =    ($lci = $linkinfo['category_id']);
-
-        $linkcat_table = Database::get_course_table(TABLE_LINK_CATEGORY);
-        if (($catinfo = @Database::fetch_array(Database::query(
-                "SELECT category_title FROM $linkcat_table WHERE c_id = $course_id AND id='" .
-                addslashes($lci) . "'"))))
-            $this->mdo_category_title =    $catinfo['category_title'];
-    }
-}
-
-
-function _find_keywords($d)
-{
-    $dd = new xmddoc($d); if ($dd->error) return NULL;
-
-    $regs = array(); // for use with ereg()
-
-    foreach ($dd->attributes[0] as $name => $value)
-        if ($name == 'kw' && ereg('^<?([^>]+)>?$', $value, $regs))
-        {
-            $kwa = array_map('trim', explode(',', $regs[1]));
-
-            if (ereg('^<' . ($tag = $dd->name[0]) . '[^>]*>(.*)</'.$tag.'>$',
-                    $d, $regs))  // e.g. <i kw="...">A &amp; <b>B</b>!</i>
-            {
-                $htdc = array_flip(get_html_translation_table(HTML_ENTITIES));
-                $d = strtr(ereg_replace(  // first  <b>  -> [b] etc.
-                    '<((/?(b|big|i|small|sub|sup|u))|br/)>', '[\\1]',
-                    ($regs[1])), $htdc);  // then  &amp; ->  &  etc.
-                $d = strtr(str_replace("\r\n", " ", $d), "\r\n", "  ");
-            }
-            else $d = $dd->xmd_text();
-
-            array_push($kwa, $d); return $kwa;
-        }
-
-    return NULL;
-}
-
-function _add_keywords(&$xmlDoc, $keywords)  // by ref!
-{
-    $ge = $xmlDoc->xmd_select_single_element("metadata/lom/general");
-    $dl = array("language" =>
-        $xmlDoc->xmd_value("description/string/@language", $ge));
-
-    foreach ($keywords as $kw)
-        $xmlDoc->xmd_add_text_element("string", $kw,
-            $xmlDoc->xmd_add_element("keyword", $ge), $dl);
-}
-
-}
-?>

+ 0 - 85
main/metadata/md_mix.php

@@ -1,85 +0,0 @@
-<?php
-/**
- * md_mix.php for Dokeos metadata/*.php
- * 2005/09/20
- * @copyright 2005 rene.haentjens@UGent.be -  see metadata/md_funcs.php
- * @package chamilo.metadata
- */
-/**
- * Chamilo Metadata: reduced class mdobject for Search, for a Mix of objects
- * @package chamilo.metadata
- */
-class mdobject {
-
-var $mdo_course;
-var $mdo_type;
-var $mdo_id;
-var $mdo_eid;
-
-var $mdo_path;
-var $mdo_comment;
-var $mdo_filetype;
-
-var $mdo_url;
-var $mdo_base_url;
-
-
-function mdobject($_course, $eid)
-{
-    if (!($dotpos = strpos($eid, '.'))) return;
-
-    $this->mdo_course = $_course; $this->mdo_eid = $eid;
-    $this->mdo_type = ($type = substr($eid, 0, $dotpos));
-    $this->mdo_id = ($id = substr($eid, $dotpos + 1));
-
-    if ($type == 'Document' || $type == 'Scorm')
-    {
-        $table = $type == 'Scorm' ?
-            Database::get_course_table(TABLE_SCORMDOC) :
-            Database::get_course_table(TABLE_DOCUMENT);
-
-        if (($dotpos = strpos($id, '.')))
-        {
-            $urlp = '?sid=' . urlencode(substr($id, $dotpos+1));
-            $id = substr($id, 0, $dotpos);
-        }
-
-        if (($docinfo = @mysql_fetch_array(Database::query(
-                "SELECT path,comment,filetype FROM
-                 $table WHERE id='" .
-                addslashes($id) . "'"))))
-        {
-            $this->mdo_path =     $docinfo['path'];
-            $this->mdo_comment =  $docinfo['comment'];
-            $this->mdo_filetype = $docinfo['filetype'];
-
-            if ($type == 'Scorm')
-            {
-                $this->mdo_base_url =  get_course_web() .
-                    $this->mdo_course['path'] . '/scorm' . $this->mdo_path;
-                $this->mdo_url =  $this->mdo_base_url . '/index.php' . $urlp;
-            }
-            else
-            {
-                $this->mdo_url =  api_get_path(WEB_PATH) . 'main/document/' .
-                    (($this->mdo_filetype == 'file') ? 'download' : 'document').'.php?'.
-                    (($this->mdo_filetype == 'file') ? 'doc_url=' : 'curdirpath=') .
-                    urlencode($this->mdo_path);
-            }
-        }
-    }
-    elseif ($type == 'Link')
-    {
-        $link_table = Database::get_course_table(TABLE_LINK);
-        if (($linkinfo = @mysql_fetch_array(Database::query(
-                "SELECT url,title,description,category_id FROM
-                 $link_table WHERE id='" . addslashes($id) .
-                "'"))))
-        {
-            $this->mdo_url = $linkinfo['url'];
-        }
-    }
-}
-
-}
-?>

+ 0 - 214
main/metadata/md_phpdig.php

@@ -1,214 +0,0 @@
-<?php
-/**
- * Chamilo metadata/md_phpdig.php
- * 2005/03/24
- * @copyright 2005 rene.haentjens@UGent.be -  see metadata/md_funcs.php
- * @package chamilo.metadata
- *
- */
-/**
- *	Chamilo Metadata: PhpDig connection
- *
- *   If PhpDig 1.8.3 is installed in a Chamilo course site, then MD items
- *   can be indexed for search (via PhpDig's search screen search.php).
- *
- *   The functions below inject the words of metadata/indexabletext directly
- *   into PhpDig's tables. Affected tables:
- *
- *   keywords: key_id, twoletters, keyword (lowercase, accents removed)
- *
- *   sites:    site_id, site_url (e.g. http://xx.yy.zz/), upddate, ...
- *
- *   spider:   spider_id, site_id, upddate, num_words, first_words,
- *                   path (e.g. uu/vv/ww/), file (e.g. index.php?sid=xxx), ...
- *
- *   engine:   spider_id, key_id, weight
- *
- *   Most of the function code is a simplified version of real PhpDig code
- *   released under the GNU GPL V2, see www.phpdig.net.
- *
-*/
-
-
-// PHPDIG CONNECTION ---------------------------------------------------------->
-
-$phpDigInc = get_course_path() . $_course['path'] . '/phpdig-1.8.6/includes/';
-$phpDigIncCn = $phpDigInc. 'connect.php';  // to connect to PhpDig's database
-$phpDigIncCw = $phpDigInc. 'common_words.txt';  // stopwords
-
-//  if (!file_exists($phpDigIncCn)) return(); doesn't seem to work properly...
-
-
-if (file_exists($phpDigIncCw))
-    if (is_array($lines = @file($phpDigIncCw)))
-        while (list($id,$word) = each($lines))
-            $common_words[trim($word)] = 1;
-
-define('SUMMARY_DISPLAY_LENGTH', 700);
-//define('PHPDIG_ENCODING', 'iso-8859-1');
-define('PHPDIG_ENCODING', strtolower($charset));
-define('SMALL_WORDS_SIZE', 2);
-define('MAX_WORDS_SIZE',50);
-define('WORDS_CHARS_LATIN1', '[:alnum:]��ߵ');
-
-foreach (array( 'A'=>'������', 'a'=>'������', 'O'=>'������', 'o'=>'������',
-                'E'=>'����', 'e'=>'����', 'C'=>'�', 'c'=>'�', 'I'=>'����',
-                'i'=>'����', 'U'=>'����', 'u'=>'����', 'Y'=>'�', 'y'=>'��',
-                'N'=>'�', 'n'=>'�') as $without => $allwith)
-    foreach (explode('!', chunk_split($allwith, 1, '!')) as $with)
-    if ($with)  // because last one will be empty!
-    {
-        $letterswithout .= $without; $letterswith .= $with;
-    }
-define('LETTERS_WITH_ACCENTS', $letterswith);
-define('SAME_WITHOUT_ACCENTS', $letterswithout);
-
-(strlen(LETTERS_WITH_ACCENTS) == strlen(SAME_WITHOUT_ACCENTS))
-    or give_up('LETTERS_WITH_ACCENTS problem in md_phpdig.php');
-
-
-function find_site($url)
-{
-    $site_url = "site_url = '" . addslashes($url) . "'";
-
-    $result = Database::query("SELECT site_id FROM " . PHPDIG_DB_PREFIX .
-        "sites WHERE " . $site_url);  // find site
-
-    if (Database::num_rows($result) == 1)
-    {
-        $row = Database::fetch_array($result); return (int) $row['site_id'];
-    }
-    else
-    {
-        $result = Database::query("INSERT INTO " . PHPDIG_DB_PREFIX .
-            "sites SET " . $site_url);  // new site
-        $site_id = Database::insert_id();
-
-        $result = Database::query("INSERT INTO " . PHPDIG_DB_PREFIX .
-            "site_page (site_id,num_page) VALUES ('$site_id', '0')");
-
-        return $site_id;
-    }
-}
-
-function remove_engine_entries($url, $path, $file = '')
-{
-	global $charset;
-
-    $and_path = " AND path = '" . addslashes($path) . "'";
-    if ($file) $and_path .= " AND file LIKE '" . addslashes(
-        str_replace(array('_', '%'), array('\_', '\%'), $file)) . "%'";
-
-    $result = Database::query("SELECT spider_id FROM " . PHPDIG_DB_PREFIX .
-        "spider WHERE site_id=" . ($site_id = find_site($url)) . $and_path);  // find page(s)
-
-    while ($row = Database::fetch_array($result))
-    {
-        $result = Database::query("DELETE FROM " . PHPDIG_DB_PREFIX .
-            "engine WHERE spider_id=" . (int)$row['spider_id']);  // delete all references to keywords
-        $aff .= ' +' . Database::affected_rows($result);
-    }
-
-    Database::query("DELETE FROM " . PHPDIG_DB_PREFIX ."spider WHERE site_id=" . $site_id . $and_path);  // delete page
-
-    echo htmlspecialchars($url . $path . $file, ENT_QUOTES, $charset), ' (site_id ',
-        $site_id, '): ', Database::affected_rows(), $aff,
-        ' pages + word references removed from index.<br />';
-
-    return $site_id;
-}
-
-function index_words($site_id, $path, $file, $first_words, $keywords)
-{
-    global $common_words;
-
-    $spider_set_path_etc = "spider SET path='" . addslashes($path) .
-        "',file='" . addslashes($file) . "',first_words='" .
-        addslashes($first_words) . "',site_id='$site_id'";
-        // do not set upddate,md5,num_words,last_modified,filesize
-
-    Database::query("INSERT INTO " . PHPDIG_DB_PREFIX . $spider_set_path_etc);
-
-    $spider_id = Database::insert_id(); $new = 0;
-
-    foreach ($keywords as $key => $w)
-    if (strlen($key) > SMALL_WORDS_SIZE and strlen($key) <= MAX_WORDS_SIZE and
-            !isset($common_words[$key]) and
-            ereg('^['.WORDS_CHARS_LATIN1.'#$]', $key))
-    {
-        $result = Database::query("SELECT key_id FROM " . PHPDIG_DB_PREFIX .
-            "keywords WHERE keyword = '" . addslashes($key) . "'");
-
-        if (Database::num_rows($result) == 0)
-        {
-            Database::query("INSERT INTO " . PHPDIG_DB_PREFIX .
-                "keywords (keyword,twoletters) VALUES ('" . addslashes($key) .
-                "','" .addslashes(substr(str_replace('\\','',$key),0,2)) ."')");
-            $key_id = Database::insert_id(); $new++;
-        }
-        else
-        {
-            $keyid = Database::fetch_row($result); $key_id = $keyid[0];
-        }
-
-        Database::query("INSERT INTO " . PHPDIG_DB_PREFIX .
-            "engine (spider_id,key_id,weight) VALUES ($spider_id,$key_id,$w)");
-    }
-    global $charset;
-    echo '<tr><td>', htmlspecialchars($file, ENT_QUOTES, $charset), '</td><td>(spider_id ',
-        $spider_id, '):</td><td align="right">', count($keywords), ' kwds, ',
-        $new , ' new</td></tr>', "\n";
-}
-
-function get_first_words($text, $path, $file)
-{
-    $db_some_text = preg_replace("/([ ]{2}|\n|\r|\r\n)/" ," ", $text);
-    if (strlen($db_some_text) > SUMMARY_DISPLAY_LENGTH) {
-      $db_some_text = substr($db_some_text, 0, SUMMARY_DISPLAY_LENGTH) . "...";
-    }
-
-    $titre_resume = $path . $file;
-    if (($psc = strpos($titre_resume, 'scorm/')) !== FALSE)
-        $titre_resume = substr($titre_resume, $psc + 6);
-    if (($pth = strpos($titre_resume, '&thumb')) !== FALSE)
-        $titre_resume = substr($titre_resume, 0, $pth);
-
-    return $titre_resume."\n".$db_some_text;
-}
-
-function get_keywords($text)
-{
-    if (($token = strtok(phpdigEpureText($text), ' '))) $nbre_mots[$token] = 1;
-
-    while (($token = strtok(' ')))
-        $nbre_mots[$token] = ($nm = $nbre_mots[$token]) ? $nm + 1 : 1;
-
-    return $nbre_mots;
-}
-
-function phpdigEpureText($text)
-{
-    $text = strtr(phpdigStripAccents(strtolower($text)), '��', '��');
-
-    $text = ereg_replace('[^'.WORDS_CHARS_LATIN1.' \'._~@#$&%/=-]+',' ',$text);  // RH: was ' \'._~@#$:&%/;,=-]+', also below
-
-    $text = ereg_replace('(['.WORDS_CHARS_LATIN1.'])[\'._~@#$&%/=-]+($|[[:space:]]$|[[:space:]]['.WORDS_CHARS_LATIN1.'])','\1\2',$text);
-
-    // the next two repeated lines needed
-    if (SMALL_WORDS_SIZE >= 1) {
-      $text = ereg_replace('[[:space:]][^ ]{1,'.SMALL_WORDS_SIZE.'}[[:space:]]',' ',' '.$text.' ');
-      $text = ereg_replace('[[:space:]][^ ]{1,'.SMALL_WORDS_SIZE.'}[[:space:]]',' ',' '.$text.' ');
-    }
-    //$text = ereg_replace('\.+[[:space:]]|\.+$|\.{2,}',' ',$text);
-    $text = ereg_replace('\.{2,}',' ',$text);
-    $text = ereg_replace('^[[:space:]]*\.+',' ',$text);
-
-    return trim(ereg_replace("[[:space:]]+"," ",$text));
-}
-
-function phpdigStripAccents($chaine)
-{
-    $chaine = str_replace('�','ae',str_replace('�','ae',$chaine));
-    return strtr($chaine, LETTERS_WITH_ACCENTS, SAME_WITHOUT_ACCENTS);
-}
-?>

+ 0 - 17
main/metadata/md_scorm.htt

@@ -1,17 +0,0 @@
-<!-- {-MD_SCORM.HTT-} -->                 <!-- for Dokeos metadata/index.php -->
-                                                             <!-- 2005/03/15 -->
-
-<!-- Copyright (C) 2004 rene.haentjens@UGent.be -  see metadata/md_funcs.php -->
-
-
-<!-- {-METADATA-} -->
-
-<textarea rows="30" style="width: 100%" name="mdt" id="mdt">{-H {-P mdt-}-}</textarea>
-
-
-<!-- {-HTTP-} -->
-
-Expires: Mon, 26 Jul 1997 05:00:00 GMT
-
-
-<!-- {--} -->

+ 0 - 106
main/metadata/md_scorm.php

@@ -1,106 +0,0 @@
-<?php
-/**
- * md_scorm.php for Chamilo metadata/*.php
- * 2006/12/15
- * @copyright 2005 rene.haentjens@UGent.be -  see metadata/md_funcs.php
-*	@package chamilo.metadata
- */
-/**
- *	Chamilo Metadata: class mdobject for Scorm-type objects
- * @package chamilo.metadata
- */
-class mdobject
-{
-
-var $mdo_course;
-var $mdo_type;
-var $mdo_id;
-var $mdo_eid;
-
-var $mdo_dcmap_e;
-var $mdo_dcmap_v;
-
-var $mdo_path;
-var $mdo_comment;
-var $mdo_filetype;
-var $mdo_url;
-
-
-function mdo_define_htt() { return new xhtdoc(<<<EOD
-
-<!-- {-INDEXABLETEXT-} -->
-
-{-D scormlevel {-V @level-}-}{-D two 2-}
-Title: {-V metadata/lom/general/title/string-} txt-sep
-{-T scormlevel == two Author(s): {-V metadata/lom/lifeCycle/contribute[1]/entity-} txt-sep-}
-Keyword(s): {-R metadata/lom/general/keyword C KWTEXT-} txt-sep
- {-V metadata/lom/general/description[1]/string-}
- {-V metadata/lom/technical/location-} txt-end
- {-V metadata/lom/general/description[2]/string-} scorm-level-{-P scormlevel-}
- {-V metadata/lom/lifeCycle/contribute[1]/entity-}
- {-V metadata/lom/lifeCycle/contribute[1]/date/dateTime-}
-
-
-<!-- {-KWTEXT-} -->
-
- {-V string-}-kw
-
-
-<!-- {--} -->
-EOD
-);
-}
-
-
-function mdo_generate_default_xml_metadata()
-{
-    return '<empty/>';
-}
-
-
-function mdo_add_breadcrump_nav()
-{
-	global $interbreadcrumb;
-	$regs = array(); // for use with ereg()
-
-	$docurl = api_get_self();  // should be .../main/xxx/yyy.php
-	if (ereg('^(.+[^/\.]+)/[^/\.]+/[^/\.]+.[^/\.]+$', $docurl, $regs))
-		$docurl = $regs[1] . '/newscorm/index.php';
-
-	$interbreadcrumb[] = array ('url' => $docurl,
-		'name' => get_lang('MdCallingTool'));
-}
-
-
-function mdobject($_course, $id)
-{
-    global $ieee_dcmap_e, $ieee_dcmap_v;  // md_funcs
-
-    $scormdocument = Database::get_course_table(TABLE_LP_MAIN);
-
-    $this->mdo_course = $_course; $this->mdo_type = 'Scorm';
-    $this->mdo_id = $id; $this->mdo_eid = $this->mdo_type . '.' . $id;
-
-    $this->mdo_dcmap_e = $ieee_dcmap_e; $this->mdo_dcmap_v = $ieee_dcmap_v;
-	$sql = "SELECT path,description,lp_type FROM $scormdocument WHERE id='" . addslashes($id) . "'";
-    if (($docinfo = @Database::fetch_array(Database::query($sql))))
-    {
-        $this->mdo_path =     $docinfo['path'];
-		//Sometimes the new scorm-tool adds '/.' at the end of a directory name, so remove this before continue
-		//the process -- bmol
-    	if(substr($this->mdo_path,-2) == '/.')
-    	{
-    		$this->mdo_path = substr($this->mdo_path,0, strlen($this->mdo_path)-2);
-    	}
-        $this->mdo_comment =  $docinfo['description'];
- 		//Don't think the next line is correct. There used to be a 'type' field in the scormdocument table.
- 		//This metadata tool only works on folder types -- bmol
-        $this->mdo_filetype = ($docinfo['lp_type'] == 2 ? 'folder' : 'xxx');
-
-        $this->mdo_url =  get_course_web() . $this->mdo_course['path'] .
-            '/scorm/' . $this->mdo_path . '/index.php';
-    }
-}
-
-}
-?>

+ 0 - 577
main/metadata/md_script.js

@@ -1,577 +0,0 @@
-// md_script.js                               <!-- for Dokeos metadata/*.php -->
-//                                                           <!-- 2006/05/16 -->
-
-//   Copyright (C) 2006 rene.haentjens@UGent.be -  see metadata/md_funcs.php -->
-
-
-// Part 1: General funcs & Keyword Tree: copied (with modifs) from SelKwds.xsl
-
-        String.prototype.trim = function()
-        {
-            return this.replace(/^\s*/,"").replace(/\s*$/,""); // \f\n\r\t\v
-        }   // Dave Anderson, dbforums.com/arch/195/2003/3/724117
-
-        String.prototype.removeExtraSpaces = function()
-        {
-            return this.replace(/\s+/g, ' ').trim();
-        }
-
-        function makeWindow(url, htmlText)
-        {
-            var newWindow = window.open(url, '',
-                'toolbar=no, location=no, directories=no, status=yes, '+
-                'menubar=yes, scrollbars=yes, resizable=yes, ' +
-                'width=800, height=600, left=10, top=10');
-            if (url == '') newWindow.document.write('<html><body>' +
-                    htmlText + '</body></html>');
-            return newWindow;
-        }
-
-        function isNotW3C()
-        {
-            if (!document.getElementById)
-                alert('Sorry, the buttons only work with W3C browsers. ' +
-                    'Use FireFox or IE6 or Moz1.7 or type in keywords manually...');
-            return !document.getElementById;
-        }
-
-
-        function openOrCloseHelp(btn)
-        {
-            if (isNotW3C()) return false;
-
-            document.getElementById('moreHelp').className =
-                (btn.value == "?")              ? "dvo" : "dvc";
-            btn.value = (btn.value == "?")      ?  "¿"  :  "?";
-        }
-
-        function hasTagAndClass(obj, tag, cl)
-        {
-            return obj.tagName && (obj.tagName.toUpperCase() == tag) &&
-                (obj.className == cl);
-        }
-
-
-        function openOrClose(btn)  // show or hide part of keyword-tree
-        {
-            var oldcl = (btn.value == "-") ? "dvo" : "dvc";
-            var newcl = (oldcl == "dvo")   ? "dvc" : "dvo";
-            btn.value = (oldcl == "dvo")   ?  "+"  :  "-" ;
-
-            var ch = btn.parentNode.childNodes;  // opera crashes on with()
-            for (var i = 0; i < ch.length; i++)  // netscape requires .item
-                if (hasTagAndClass(ch.item(i), 'DIV', oldcl))
-                    ch.item(i).className = newcl;
-        }
-
-        function openOrCloseHere(div, wrong)  // show or hide recursively
-        {
-            var ch = div.childNodes;
-            for (var i = 0; i < ch.length; i++)
-            {
-                var thisCh = ch.item(i);
-                if (thisCh.className == 'btn' && thisCh.value == wrong)
-                    openOrClose(thisCh)
-                else if (thisCh.className == 'dvo' || thisCh.className == 'dvc')
-                    openOrCloseHere(thisCh, wrong);
-            }
-        }
-
-        function openOrCloseAll(btn)  // show or hide whole keyword-tree
-        {
-            if (isNotW3C()) return false;
-
-            var wrong = (btn.value == "--") ? "-"  : "+" ;
-            btn.value = (wrong == "-")      ? "++" : "--";
-
-            openOrCloseHere(btn.parentNode, wrong);
-        }
-
-
-        var selspans = new Array;   // selected SPANs with keywords
-
-        function deselect(span)
-        {
-            for (var s in selspans) if (selspans[s] == span) delete selspans[s];
-        }
-
-        function copyToClipboard(allKwds)  // md_script: not used
-        {
-            if (window.clipboardData)
-            {
-                window.clipboardData.setData("Text", '<' + allKwds + '>\r\n');
-                return;
-            }
-
-            netscape.security.PrivilegeManager.enablePrivilege('UniversalXPConnect');
-            var gClipboardHelper = Components.classes['@mozilla.org/widget/clipboardhelper;1']
-                .getService(Components.interfaces.nsIClipboardHelper);
-            gClipboardHelper.copyString('<' + allKwds + '>\n');
-        }
-
-        function getSelectedKeywords()
-        {
-            var sortedKwds = new Array, allKwds = '';
-
-            for (var s in selspans)
-                sortedKwds.push(selspans[s].parentNode.getAttribute('level')
-                     + '.' + selspans[s].innerHTML)
-
-            sortedKwds.sort();  // according to level, which follows the tree
-
-            for (var k in sortedKwds)
-            {
-                var someWords = sortedKwds[k];
-                allKwds += ', ' + someWords.substr(someWords.indexOf('.')+1);
-            }
-
-            return allKwds.replace(/[,_\s]+/g, ', ').substr(2);  // strip ', '
-        }
-
-
-        var orkwds;  // array of ', kw, ' strings
-
-        function selectOriginal(div)
-        {
-            var ch = div.childNodes;
-            for (var i = 0; i < ch.length; i++)
-            {
-                var thisCh = ch.item(i); if (!thisCh.tagName) continue;
-                thisTag = thisCh.tagName.toUpperCase();
-
-                if (thisTag == 'SPAN')
-                {
-                    var parkwds = ','+ thisCh.innerHTML.replace(/\s*/g,"") +',';
-
-                    for (var k = 0; k < orkwds.length; k++)
-                    if (parkwds.indexOf(orkwds[k]) >=0 )
-                    {
-                        deselect(thisCh); selspans.push(thisCh);
-                        thisCh.className = "lbs";
-
-                        openToTop(div, div.className); break;
-                    }
-                }
-                else if (thisTag == 'DIV')
-                {
-                    selectOriginal(thisCh);
-                }
-            }
-        }
-
-        function openToTop(div, divclass)
-        {
-            if (!div.parentNode) return; var pdiv = div.parentNode;
-
-            if (!pdiv.className) return; var pclass = pdiv.className;
-            if (pclass != 'dvo' && pclass != 'dvc') return;
-
-            if (divclass == 'dvc')
-            {
-                var ch = pdiv.childNodes;
-                for (var i = 0; i < ch.length; i++)
-                {
-                    var btn = ch.item(i);
-                    if (hasTagAndClass(btn, 'INPUT', 'btn'))
-                        if (btn.value == '+') openOrClose(btn);
-                }
-            }
-
-            openToTop(pdiv, pclass);
-        }
-
-        function deselectAll(ev, btn)
-        {
-            if (isNotW3C()) return false;
-
-            if (!ev) var ev = window.event;
-
-            var kws = document.getElementById('kwds_string');
-
-            for (var s in selspans) selspans[s].className = "lbl";
-            selspans = new Array;
-
-            document.getElementById('btnOpenOrCloseAll').value = "--";
-
-            if (!ev.altKey) { kws.value = ''; return; }
-
-            // md_script: the calling HTML should define var kwdswere!
-            // in SelKwds.xsl, they are   typed in by user or fetched from PPT
-
-            var kwdsarray = kwdswere.split(','), allKwds = '';
-
-            for (var k = 0; k < kwdsarray.length; k++)
-            {
-                var kwd = kwdsarray[k].trim();
-                if (kwd.substr(0,1) == '-') kwd = kwd.substr(1);
-                if (kwd != '') allKwds += '§,' + kwd + ',';
-            }
-
-            if (allKwds == '') return;
-
-            orkwds = allKwds.substr(1).split('§');
-
-            selectOriginal(btn.parentNode);
-
-            allKwds = getSelectedKeywords(); kws.value = allKwds;
-            // no copyToClipboard(allKwds);
-
-            allKwds = ','+ allKwds.replace(/\s*/g,"") +','; var missing = '';
-            for (k = 0; k < orkwds.length; k++)
-            if (allKwds.indexOf(orkwds[k]) < 0 ) missing += orkwds[k];
-
-            if (missing != '') alert('!= ' + missing.replace(/,+/g," "));
-        }
-
-        function selectOrDeselect(span, newcl)
-        {
-            span.className = newcl; deselect(span);
-            if (newcl == "lbs") selspans.push(span);
-        }
-
-        function alsoParents(div, oldcl, newcl)
-        {
-            while (div.parentNode)
-            {
-                div = div.parentNode; var ch = div.childNodes;
-                for (var i = 0; i < ch.length; i++)
-                    if (hasTagAndClass(ch.item(i), 'SPAN', oldcl))
-                        selectOrDeselect(ch.item(i), newcl);
-            }
-        }
-
-        function spanClick(span, ev)  // md_script: no parents in search
-        {
-            var mda = getObj("mda");    if (!ev) ev = window.event;
-
-            if (ev.shiftKey && ev.altKey)
-            {
-                makeWindow('', '<pre>' + span.parentNode.innerHTML
-                    .replace(/&/g, "&amp;").replace(/"/g, "&quot;")
-                    .replace(/</g, "&lt;") .replace(/>/g, "&gt;") + '</pre>');
-                return;  // debugging...
-            }
-
-            if (ev.ctrlKey || span.className == "lbs")
-            {
-                selectOrDeselect(span, "lbl");  // deselect
-                if (document.selection) document.selection.empty();
-                if (ev.altKey) alsoParents(span.parentNode, "lbs", "lbl");
-            }
-            else
-            {
-                selectOrDeselect(span, "lbs");  // select (search: no parents)
-                if (mda && !ev.altKey) alsoParents(span.parentNode, "lbl", "lbs");
-                if (!mda && ev.altKey)  // mda does not exist in search form
-                    if (span.innerHTML.substr(0, 1) == '-')
-                         span.innerHTML = (', ' + span.innerHTML).replace(/, -/g, ", ").substr(2);
-                    else span.innerHTML = (', ' + span.innerHTML).replace(/, /g, ", -").substr(2);
-            }
-
-            var allKwds = getSelectedKeywords(); // no copyToClipboard(allKwds);
-            document.getElementById('kwds_string').value = allKwds;
-        }
-
-
-        var KWDS_ARRAY = new Array, nkw = 0, pU;  // alphabetic list popup
-
-        function makeAlphaList(div)  // md_script: not used (hopefully)
-        {
-            var ch = div.childNodes;
-            for (var i = 0; i < ch.length; i++)
-            {
-                var thisCh = ch.item(i); if (!thisCh.tagName) continue;
-                thisTag = thisCh.tagName.toUpperCase();
-
-                if (thisTag == 'SPAN')
-                {
-                    var parkwds= thisCh.innerHTML.replace(/\s*/g,"").split(',');
-                    for (k in parkwds) KWDS_ARRAY[nkw++] = parkwds[k];
-                }
-                else if (thisTag == 'DIV') makeAlphaList(thisCh);
-            }
-        }
-
-        function pU_show(anchor, offsetX, offsetY, defH)  // XY: rel. to anchor
-        {
-            if (!anchor) return;
-
-            thisx = anchor.offsetLeft; thisy = anchor.offsetTop;
-
-            while ((anchor = anchor.offsetParent))
-            {
-                thisx += anchor.offsetLeft; thisy += anchor.offsetTop;
-            }
-
-            thisx += offsetX; thisy += offsetY;
-
-            pU.style.left = thisx + "px";
-            pU.style.top =  thisy + "px";
-            pU.style.height = defH; var maxH = pU.offsetHeight;
-            for (var curH = 20; curH <= maxH; curH += 20)
-            {
-                pU.style.height = curH + 'px';
-                if (curH >= pU.scrollHeight) break;
-            }
-            // scrollHeight can be smaller than current in IE, not in Moz
-            pU.style.visibility = "visible";
-        }
-
-        function pU_hide()
-        {
-            if (pU) pU.style.visibility = "hidden";
-        }
-
-        function takeTypeIn(kws, oX, oY, defH)
-        {
-            if (isNotW3C()) return;
-
-            if (!pU)
-            {
-                pU = document.getElementById('popup');
-
-                if (!KWDS_ARRAY.length)
-                {
-                    makeAlphaList(document.getElementById('maindiv'));
-                    KWDS_ARRAY.sort();
-                }
-            }
-
-            if (!(curValue = kws.value.toLowerCase())) return;
-
-            var kwLines = '';
-
-            for (pos = 0; pos < KWDS_ARRAY.length; pos++)
-                if (KWDS_ARRAY[pos].toLowerCase().indexOf(curValue) == 0)
-                    kwLines += '<div class="pul" onMouseOver="this.className=' +
-                        "'lbl'" + '"; onMouseOut="this.className=' + "'pul'" +
-                        '">' + KWDS_ARRAY[pos] + '</div>';
-
-            if (kwLines == '') {pU_hide(); return; }
-
-            pU.innerHTML = kwLines; pU_show(kws, oX, oY, defH);
-        }
-
-        function pU_clicked(ev)
-        {
-            if (!pU) return false; if (!ev) var ev = window.event;
-
-            var t = (ev.srcElement) ? ev.srcElement : ev.originalTarget;
-            try {var kw = t.innerHTML;} catch(exc) {return false;}  // Moz
-
-            while (true) try
-            {
-                if (t.id == pU.id) return kw ? kw : true; t = t.parentNode;
-            }
-            catch(exc) {return false;}  // Moz: t.parentNode uncatched exc.
-        }
-
-        function pU_select(kw)
-        {
-            if (kw === true) return;
-
-            var kws = document.getElementById('kwds_string');
-            var maindiv = document.getElementById('maindiv');
-
-            var ch = maindiv.childNodes;
-            for (var i = 0; i < ch.length; i++)
-            {
-                var btn = ch.item(i);
-                if (hasTagAndClass(btn, 'INPUT', 'btn'))
-                    if (btn.value == '+') openOrClose(btn);
-            }
-            orkwds = new Array(',' + kw + ','); selectOriginal(maindiv);
-
-            kws.value = getSelectedKeywords(); // no copyToClipboard(kws.value);
-
-            pU_hide();
-        }
-
-
-// Part 2: Metadata Updates: W3C, IE4 and NS4 browsers
-
-        function isValidChar(ev, pattern, flags)
-        {
-            // e.g. onKeyPress="return isValidChar(event, '[a-z]', 'i');"
-
-            if (!ev) var ev = window.event;                 // PPK, see below
-            var kc = (ev.keyCode) ? ev.keyCode : ev.which;  // PPK
-            return (new RegExp(pattern, flags)).test(String.fromCharCode(kc));
-
-            // PPK= Peter-Paul Koch, www.quirksmode.org
-        }
-
-        function checkValid(inputField, pattern, flags)
-        {
-            // e.g. onKeyUp="checkValid(this, '^[a-z]{2,8}$', 'i');"
-
-            var fieldColor = (new RegExp(pattern, flags)).test(inputField.value) ? '#000000' : '#D8366C';
-            var fieldStyle = (document.getElementById || document.all) ?
-                inputField.style : inputField;
-            if (fieldStyle) fieldStyle.color = fieldColor;
-
-            // OK for all browsers (see devedge.netscape.com
-            //          /library/xref/2003/css-support/css1/mastergrid.html):
-            // color, background-color (not on NN4), display block/none (NN4?),
-            // overflow hidden/scroll/auto (not on NN4),
-            // position relative/static,
-            // text-align left/right/center, text-indent,
-            // font-style normal/italic, font-weight normal/bold,
-            // font-family serif/sans-serif/monospace,
-            // border-style none/solid/double/groove/ridge/inset/outset.
-        }
-
-        function getObj(name)  // PPK
-        {
-            return (document.getElementById) ? document.getElementById(name)
-            : (document.all) ?                 document.all[name]        // IE4
-            : (document.layers) ?              document.layers[name]     // NS4
-            : null;  // With NS4, nested layers are not supported!
-        }
-
-        function spc(path, value)  // set pending change in form field mda
-        {
-            var mda = getObj("mda");
-            if (mda) mda.value += "\n" + path + '=' + value;
-        }
-
-        function spcSel(path, selbox)  // set pending change, language selection
-        {
-            var mda = getObj("mda");
-            if (mda) mda.value += "\n" + path + '=' +
-                selbox.options[selbox.selectedIndex].value;
-        }
-
-        function checkBeforeSubmit(ev)
-        {
-            if (!ev) var ev = window.event;
-
-            if (ev.ctrlKey && ev.altKey)
-            {
-                var mdt = getObj("mdt"); if (!mdt) return false;
-
-                makeWindow('', '<pre>' +
-                    ('<?xml version="1.0" encoding="UTF-16"?>' +
-                     '  <!-- From browser, save as Text/Unicode -->\n\n' +
-                     mdt.value)
-                        .replace(/&/g, '&amp;').replace(/"/g, '&quot;')
-                        .replace(/</g, '&lt;').replace(/>/g, '&gt;') +
-                    '</pre>');
-                return false;
-            }
-
-            var kwdsnow = getObj("kwds_string"); if (!kwdsnow) return true;
-            if (kwdsnow.value == kwdswere) return true;  // unchanged
-            // note: calling HTML should define var kwdswere!
-
-            var language = kwdsnow.title;
-
-            var mda = getObj("mda");
-            if (!mda) { alert('? Form does not contain mda'); return false; }
-
-            var kwdsarray = kwdswere.split(',');
-
-            for (var k = 0; k < kwdsarray.length; k++)  // delete old
-                if (kwdsarray[k].trim() != '')
-                    mda.value += "\nmetadata/lom/general/keyword[-1]~";
-
-            kwdsarray = kwdsnow.value
-                .replace(/[!-,:-@\[-\^{-~\s]+/g, ',').split(',');
-
-            for (k = 0; k < kwdsarray.length; k++)
-            {
-                var newkw = kwdsarray[k].trim();
-                if (newkw != '') mda.value +=
-                    "\nmetadata/lom/general!keyword" +
-                    "\nmetadata/lom/general/keyword[-1]!string=" + newkw +
-                    "\nmetadata/lom/general/keyword[-1]/string/@language=" + language;
-            }
-
-            return true;
-
-        }
-
-        function setPendingOperation(op, ev)
-        {
-            if (!ev) var ev = window.event;
-
-            var mda = getObj("mda");
-            if (!mda) { alert('? Form does not contain mda'); return false; }
-
-            if (op == '!!' || (op == '~~' && confirm(mda.title)))
-            {
-                mda.value = op; return true;
-            }
-
-            return false;
-        }
-
-        function prepSearch(ev)
-        {
-            if (!ev) var ev = window.event;
-
-            var mdsc = getObj("mdsc");
-            if (!mdsc) { alert('? Form does not contain mdsc'); return false; }
-
-            var kwdsnow = getObj("kwds_string"); if (!kwdsnow) return true;
-            if (kwdsnow.value == '') return true;
-
-            if (!KWDS_ARRAY.length)
-            {
-                makeAlphaList(getObj('maindiv'));
-                KWDS_ARRAY.sort();
-            }
-
-            var restricttokwds = false, checkbox = getObj("restricttokwds");
-            if (checkbox) restricttokwds = checkbox.checked;
-
-            var kwdsarray = kwdsnow.value
-                .replace(/[!-,:-@\[-\^{-~\s]+/g, ',').split(',');
-
-            for (var k = 0; k < kwdsarray.length; k++)
-            {
-                var newkw = kwdsarray[k].trim().toLowerCase();
-
-                if (newkw != '')
-                {
-                    var realkw = false;
-
-                    if (restricttokwds)
-                        for (pos = 0; pos < KWDS_ARRAY.length; pos++)
-                            if (KWDS_ARRAY[pos].toLowerCase() == newkw)
-                                { realkw = true; break; }
-                    mdsc.value += "\n" + newkw + (realkw ? '-kw' : '');
-
-                }
-            }
-
-            return true;
-        }
-
-        var CRLF = "\n";  // generates clickable tree and populates KWDS_ARRAY
-
-        function traverseKwObj(node, parlev, num)  // see KWTREE_OBJECT in md_funcs
-        {
-            var curlev = '00' + (num+1), kwn = '', html = '';
-            curlev = parlev + curlev.substr(curlev.length-3);
-
-            for (i in (names = node.n.split("_")))
-                if (nn = names[i]) { KWDS_ARRAY.push(nn); kwn += ', ' + nn; }
-
-            for (j in node.c) html += traverseKwObj(node.c[j], curlev, Math.abs(j));
-
-            return (parlev == '') ? html :
-                '<div noWrap="1" class="dvc" level="' + curlev + '">' + CRLF +
-                    '<input type="button" class="' +
-                        (html ? 'btn" value="+" onClick="openOrClose(this);"/>' :
-                                'lfn" value=" "/>') + '&#xa0;' + CRLF +
-                    '<span class="lbl" onClick="spanClick(this, event);"' +
-                        (node.pt ? ' title="' + node.pt + '">' : '>') +
-                        kwn.substr(2) + '</span>' + CRLF +
-                    (node.cm ? '<i>' + node.cm + '</i>' : '') +
-                    html +
-                '</div>' + CRLF;
-        }
-
-
-// The End

+ 0 - 25
main/metadata/md_styles.css

@@ -1,25 +0,0 @@
-/*                                                                2005/01/04
-
-     Copyright (C) 2005 rene.haentjens@UGent.be -  see metadata/md_funcs.php  */
-
-.bg1    {background-color: #4171B5; font-size: 2pt}
-.bg2    {background-color: #666666; font-size: 2pt}
-.bg3    {background-color: #E6E6E6; width: 100%}
-
-.kwl    {width: 92%}
-.w23    {width: 66%}
-.wd1    {width: 15ex}
-.wd2    {width: 32ex}
-.mda    {width: 100%; display: none}
-.lgr    {background-color: #F0F0F0}
-
-.dvc    {display: none;  margin-left: 3ex}
-.dvo    {display: block; margin-left: 3ex}
-.btm    {height: 3.5ex; width: 5ex; font-family: monospace; font-size: xx-small}
-.btn    {height: 3.5ex; width: 3ex; font-family: monospace; font-size: xx-small}
-.lfn    {height: 3.5ex; width: 3ex; font-family: monospace; font-size: xx-small; visibility: hidden}
-.lbl    {background-color: #C0C0C0; cursor: pointer}
-.lbs    {background-color: #B0C4DE; cursor: pointer; border-style: solid; border-width: 1px}
-.pup    {position:absolute; visibility:hidden; width: 50%; border: 1px solid black; overflow:auto; background-color: #C0C0C0}
-.pul    {background-color: #FFFFFF}
-.wide   {width: 99%}

+ 0 - 115
main/metadata/mds_mix.htt

@@ -1,115 +0,0 @@
-<!-- {-mds_mix.htt-} -->                 <!-- for Dokeos metadata/search.php -->
-                                                             <!-- 2005/04/14 -->
-
-<!-- Copyright (C) 2005 rene.haentjens@UGent.be -  see metadata/md_funcs.php -->
-
-<!-- {-MDSEARCH-} -->
-
-<h3>Metadata {-L Search-}</h3>
-
-{-P traceinfo-}
-
-<div id="resultstable"><table class="wide">
-    <tr>
-        <td colspan="2" class="bg1">&#xa0;</td><td class="bg2">&#xa0;</td>
-        <td class="bg1">&#xa0;</td>            <td class="bg2">&#xa0;</td>
-    </tr>
-{-R item C RESULTROW-}
-    <tr>
-        <td colspan="2" class="bg1">&#xa0;</td><td class="bg2">&#xa0;</td>
-        <td class="bg1">&#xa0;</td>            <td class="bg2">&#xa0;</td>
-    </tr>
-</table></div>
-
-<div>
-{-R item C RESULTTHUMB-}
-</div>
-
-<div onMouseUp="if ((kw = pU_clicked(event))) pU_select(kw); else pU_hide();">
-
-<input type="text" id="kwds_string" class="kwl" onKeyUp="takeTypeIn(this, 150, -100, '60%'); return true;"/><br/>
-
-<form action="{-P self-}" method="post">
-
-
-    {-L SearchCrit-}<br/>
-    <textarea rows=10 name="mdsc" id="mdsc"></textarea>
-
-
-
-<input type="hidden" id="kwdswere_string" name="kwdswere_string"/>
-
-<input type="submit" value="{-L Search-}" onClick="document.getElementById('kwdswere_string').value = document.getElementById('kwds_string').value; return prepSearch(event);"></input>
-
-<div id="popup" noWrap="1" class="pup">
-    Working...
-</div>
-
-</form>
-
-{-T keywordscache != empty 
-
-<div noWrap="1" id="maindiv">
-    <input type="button" class="btn" value="+" onClick="if (this.value == '+') deselectAll(event, this); openOrClose(this);"/>
-    <input type="button" class="btm" id="btnOpenOrCloseAll" value="++" onClick="openOrCloseAll(this);"/>
-    <input type="button" class="btn" value="?" onClick="openOrCloseHelp(this)"/>
-    &#xa0;{-L ClickKw-}
-    {-P keywordscache-}
-</div>
-
-<div id='moreHelp' class='dvc'>
-    {-L KwHelp-}
-</div>
- -}
-
-{-T keywordscache == empty 
-<div noWrap="1" id="maindiv">&#xa0;</div>
- -}
-
-</div><!-- onMouseUp -->
-
-<!<!------------------------  End Of script Output  ---------------------->
-
-
-<!-- {-RESULTROW-} -->
-
-{-D info {-X metadata/lom/lifeCycle/contribute[1]/entity-}-}
-{-T info != empty D info {-P info-}, {-X parent/@identifier-}-}
-{-T info == empty D info X parent/@identifier-}
-<tr>
-    <td colspan="2">{-P info-}: {-X metadata/lom/general/title-}</td>
-    <td><span class="lbs" onClick="makeWindow('{-X @url-}', '')"><small>Open</small></span></td>
-    <td><span class="lbs" onClick="makeWindow('{-P index-}?eid={-U {-V @eid-}-}', '')"><small>MD</small></span></td>
-    <td>{-X @eid-}</td>
-</tr>
-
-
-<!-- {-RESULTTHUMB-} -->
-
-{-D thumb {-X resource/file[1]/@href-}-}{-E check_is_thumb xxx-}
-{-T thumb != empty 
-{-D info {-X metadata/lom/lifeCycle/contribute[1]/entity-}-}
-{-T info != empty D info {-P info-}, {-X parent/@identifier-}-}
-{-T info == empty D info X parent/@identifier-}
-<img class="lbs" title="{-P info-}: {-X metadata/lom/general/title-}" onClick="makeWindow('{-X @url-}', '')" src="{-X @brl-}/{-P thumb-}"/>
- -}
-
-<!-- {-HEAD-} -->
-
-<link rel="stylesheet" type="text/css" href="md_styles.css">
-
-<script language="JavaScript" src="md_script.js"></script>
-<script language="JavaScript">var kwdswere = "{-P kwdswere_string-}";</script>
-
-
-<!-- {-HTTP-} -->
-
-Expires: Mon, 26 Jul 1997 05:00:00 GMT
-
-
-<!-- {-DEFAULTMix-} -->
-
-<searchresults/>
-
-
-<!-- {--} -->

+ 0 - 32
main/metadata/openobject.php

@@ -1,32 +0,0 @@
-<?php 
-/** 
- * Chamilo metadata/openobject.php
- * 2004/08/27
- * Copyright (C) 2006 rene.haentjens@UGent.be -  see metadata/md_funcs.php
- * @package chamilo.metadata
- */
-/**
- *	Chamilo Metadata: general script for opening an object
- *   URL parameters:
- *   - eid=  entry-id = object-id = type.identifier, e.g. 'Document.12';
- */
-
-
-require("md_funcs.php");
-// name of the language file that needs to be included
-/*
-$language_file = 'Whatever';
-*/
-require("../inc/global.inc.php");
-$this_section=SECTION_COURSES;
-
-getpar('EID', 'Entry IDentifier');
-if (!($dotpos = strpos(EID, '.'))) give_up('No . in ' . EID);
-
-require('md_' . strtolower(substr(EID, 0, $dotpos)) . '.php');
-$mdObj = new mdobject($_course, substr(EID, $dotpos + 1));
-
-header('Location: ' . $mdObj->mdo_url);
-
-exit;
-?>

+ 0 - 79
main/metadata/phpdig/CourseKwds_example.js

@@ -1,79 +0,0 @@
-KWTREE_OBJECT = {n:"", ti:"Aquaculture Keywords"
-, c:[{n:"organisms", cm:"(more or less in systematical order)"
-, c:[{n:"bacteria"}, {n:"yeast", cm:"he&lt;la", pt:"HoHo"}, {n:"alga"
-, c:[{n:"seaweed_macroalga"
-, c:[{n:"gracilaria"}, {n:"hijikia"}, {n:"laminaria"}, {n:"porphyra_nori"}, {n:"undaria_wakame"}, {n:"macroalgae-nei"}]}, {n:"microalga"
-, c:[{n:"chlorella"}, {n:"dunaliella"}, {n:"isochrysis"}, {n:"nannochloropsis"}, {n:"tetraselmis"}, {n:"diatom-nei"}, {n:"microalga-nei"}]}]}, {n:"rotifer"
-, c:[{n:"brachionus-plicatilis"}, {n:"rotifer-nei"}]}, {n:"mollusc"
-, c:[{n:"abalone_winkle_conch"
-, c:[{n:"abalone_haliotis"}, {n:"other-gastropod"}]}, {n:"clam_cockle"
-, c:[{n:"hard-clam_mercenaria-mercenaria"}]}, {n:"mussel"
-, c:[{n:"mussel_mytilus-edulis"}]}, {n:"oyster"
-, c:[{n:"oyster_ostrea-edulis"}, {n:"oyster_crassostrea-gigas"}]}, {n:"scallop_pecten"
-, c:[{n:"scallop_argopecten-irradians"}, {n:"scallop_pecten-maximus"}]}, {n:"squid_cuttlefish_octopus"
-, c:[{n:"octopus"}, {n:"sepia"}]}, {n:"mollusc-nei"
-, c:[{n:"tapes-philippinarum"}]}]}, {n:"crustacean"
-, c:[{n:"brine-shrimp_artemia"}, {n:"freshwater-crustacean"
-, c:[{n:"crayfish_astacus_cherax"}, {n:"freshwater-prawn_macrobrachium-rosenbergii"}, {n:"freshwater-crustacean-nei"}]}, {n:"crab"
-, c:[{n:"mudcrab_scylla"}, {n:"mitten-crab_eriocheir"}, {n:"crab-nei"}]}, {n:"lobster"
-, c:[{n:"lobster_homarus"}, {n:"spiny-lobster_panilurus"}, {n:"lobster-nei"}]}, {n:"penaeid-shrimp_scampi"
-, c:[{n:"fenneropenaeus-sinensis"}, {n:"penaeus-indicus"}, {n:"kuruma-shrimp_penaeus-japonicus"}, {n:"tiger-prawn_penaeus-monodon"}, {n:"penaeus-semisulcatus"}, {n:"penaeus-stylirostris"}, {n:"litopenaeus-vannamei"}, {n:"penaeid-nei"}]}, {n:"krill_planktonic-crustacean"
-, c:[{n:"moina"}, {n:"copepod-nei"}, {n:"daphnia"}]}, {n:"crustacean-nei"
-, c:[{n:"mysidopsis-bahia"}]}]}, {n:"fish"
-, c:[{n:"carp_cyprinid"
-, c:[{n:"common-carp_cyprinus-carpio"}, {n:"grass-carp_ctenopharyngodon-idella"}, {n:"koi-carp"}]}, {n:"eel"
-, c:[{n:"european-eel_anguilla-anguilla"}, {n:"japanese-eel_anguilla-japonica"}]}, {n:"flatfish"
-, c:[{n:"flounder_paralichthys-olivaceus"}, {n:"halibut_hippoglossus-hippoglossus"}, {n:"sole_pleuronectes"}, {n:"plaice_pleuronectes-platessa"}, {n:"turbot_scophthalmus-maximus"}, {n:"flatfish-nei"}]}, {n:"herring_sardine_anchovy"
-, c:[{n:"herring_clupea-harengus"}]}, {n:"salmon_trout_smelt"
-, c:[{n:"atlantic-salmon_salmo-salar"}, {n:"pacific-salmon_oncorhynchus-mykiss"}, {n:"rainbow-trout_salmo-gairdneri"}]}, {n:"shark_ray"}, {n:"tuna_bonito_billfish"}, {n:"tilapia_cichlid"
-, c:[{n:"nile-tilapia_oreochromis-niloticus"}]}, {n:"freshwater-fish-nei"
-, c:[{n:"african-catfish_clarias-gariepinus"}, {n:"catfish-nei"}, {n:"guppy_poecilia-reticulata"}, {n:"heterobranchus-longifilis"}, {n:"pike_esox-lucius"}, {n:"pike-perch_stizostedion-lucioperca"}, {n:"sturgeon_acipenser"}]}, {n:"marine-fish-nei"
-, c:[{n:"arctic-charr_salvelinus-alpinus"}, {n:"asian-seabass_lates-calcarifer"}, {n:"atlantic-cod_gadus-morhua"}, {n:"capelin_mallotus-villosus"}, {n:"dentex_dentex-dentex"}, {n:"dolphin-fish_mahimahi_coryphaena-hippurus"}, {n:"grouper_epinephelus"}, {n:"ictalurus"}, {n:"lumpsucker_cyclopterus-lumpus"}, {n:"milkfish_chanos-chanos"}, {n:"mullet_mugil-cephalus"}, {n:"rabbitfish_siganus"}, {n:"red-drum_sciaenops"}, {n:"red-seabream_pagrus-major"}, {n:"rockfish_sebastes"}, {n:"seabass_dicentrarchus-labrax"}, {n:"seabream_sparus-aurata"}, {n:"snapper_lutjanus"}, {n:"yellowtail_seriola"}]}, {n:"ornamental-fish"}, {n:"fish-nei"}]}, {n:"other-aquatic-organism"
-, c:[{n:"sponge"}, {n:"coral"}, {n:"aquatic-plants"}, {n:"aquatic-insects"}, {n:"various-worms"}, {n:"pearl_mother-of-pearl"}, {n:"sea-urchin_echinoderm"}, {n:"zooplankton_phytoplankton"}, {n:"aquatic-invertebrate-nei"}, {n:"frog_amphibian"}, {n:"turtle"}, {n:"crocodile_alligator"}, {n:"aquatic-mammal"}, {n:"aquatic-organism-nei"}]}, {n:"non-aquatic-organism", cm:"(such as birds, cattle, ...)"}]}, {n:"culture-aspects"
-, c:[{n:"life-stage"
-, c:[{n:"cyst"}, {n:"diapause"}, {n:"seed"}, {n:"egg"}, {n:"larva"
-, c:[{n:"spat"}, {n:"umbrella"}, {n:"zoea"}, {n:"nauplius"}, {n:"mysis"}, {n:"megalopa"}, {n:"larval-stage-nei"}]}, {n:"post-larva"}, {n:"juvenile_fingerling"}, {n:"adult"}, {n:"broodstock"}, {n:"biomass"}, {n:"life-cycle"}, {n:"other-life-stage"}]}, {n:"nutrition"
-, c:[{n:"diet"
-, c:[{n:"dry-diet_formulated-diet"}, {n:"microbound-diet_mbd"}, {n:"wet-diet"}, {n:"live-food"}, {n:"diet-type-nei"}]}, {n:"feed-ingredient"
-, c:[{n:"nutrient-requirement"}, {n:"protein"}, {n:"lipids_fat"}, {n:"hufa"}, {n:"carbohydrate"}, {n:"mineral"}, {n:"vitamin"}, {n:"fishmeal"}, {n:"energy"}, {n:"feed-additives_enrichment-product"}, {n:"feed-ingredient-nei"}]}, {n:"feed-production"
-, c:[{n:"ingredient"}, {n:"formulation"}, {n:"extrusion"}]}, {n:"feeding-biology"
-, c:[{n:"feed-intake"}, {n:"feeding-ratio"}, {n:"feed-conversion"}, {n:"digestion"}, {n:"excretion"}]}, {n:"nutritional-aspect-nei"}]}, {n:"culture-system"
-, c:[{n:"pond_pond-culture"}, {n:"tank-culture"}, {n:"experimental-installation"}, {n:"batch-culture"}, {n:"flow-through"}, {n:"raceway-system"}, {n:"recirculation-system"}, {n:"pen-culture"}, {n:"floating-cage"}, {n:"raft_long-line"}, {n:"rack-culture_pole-culture"}, {n:"saltwork_salt-pond"}, {n:"backyard-culture"}, {n:"hydroponic-culture"}, {n:"x-----", cm:"main culture principles:"}, {n:"extensive-culture"}, {n:"semi-intensive-culture"}, {n:"intensive-culture"}, {n:"polyculture_integrated-culture"}, {n:"sea-ranching"}, {n:"culture-system-nei"}]}, {n:"culture-step_culture-activity", cm:"(more or less in chronological order)"
-, c:[{n:"x-----", cm:"general culture steps:"}, {n:"reproduction_maturation"}, {n:"spawning"}, {n:"hatchery"}, {n:"larviculture"}, {n:"weaning"}, {n:"nursery"}, {n:"grow-out_farming"}, {n:"x-----", cm:"specific culture steps:"}, {n:"pond-construction"}, {n:"pond-preparation_liming_fertilisation"}, {n:"stocking_inoculation"}, {n:"acclimatisation"}, {n:"hatching"}, {n:"decapsulation"}, {n:"enrichment"}, {n:"cold-storage"}, {n:"feeding"}, {n:"sampling"}, {n:"counting"}, {n:"tagging"}, {n:"grading"}, {n:"cleaning_rinsing"}, {n:"harvesting"}, {n:"processing"}, {n:"quality-control"}, {n:"storage_packing_transport"}, {n:"culture-step-nei"}]}, {n:"equipment_infrastructure"
-, c:[{n:"tank"}, {n:"bottle_tube"}, {n:"aquarium"}, {n:"substrate_holder"}, {n:"filter_sieve"}, {n:"incubator"}, {n:"hapa"}, {n:"heater"}, {n:"pump"}, {n:"aerator"}, {n:"air-water-lift"}, {n:"feeder"}, {n:"grader"}, {n:"equipment-nei", cm:"(see also 'water treatment' for more equipment)"}]}, {n:"health_disease"
-, c:[{n:"treatment_health-management"}, {n:"disinfection_infection"}, {n:"stress"}, {n:"parasitose"}, {n:"bacteria"}, {n:"virus_phage"}, {n:"fungi"}, {n:"nutritional-disease"}, {n:"water-quality-disease"}, {n:"deformity"}, {n:"pesticide"}, {n:"antibiotics"}, {n:"vaccin"}, {n:"probiont"}, {n:"disease-nei"}]}, {n:"water-quality"
-, c:[{n:"water-quality-parameter"
-, c:[{n:"temperature"}, {n:"oxygen"}, {n:"ph_acidity"}, {n:"salinity"}, {n:"hardness"}, {n:"organic-matter"}, {n:"nitrogen-compound"}, {n:"harmful-substance"}, {n:"pathogen"}, {n:"heavy-metal"}, {n:"water-quality-parameter-nei"}]}, {n:"water-treatment"
-, c:[{n:"water-analysis"}, {n:"water-sampling"}, {n:"aerator_oxygenation"}, {n:"filtering"}, {n:"suspended-solids-removal"}, {n:"protein-skimmer"}, {n:"biofilter"}, {n:"nitrification_denitrification"}, {n:"ozonisation_ozonisator"}, {n:"uv-installation"}, {n:"disinfection"}, {n:"degassing"}, {n:"liming"}, {n:"sedimentation"}, {n:"water-treatment-nei"}]}, {n:"water-usage"
-, c:[{n:"water-supply"}, {n:"water-discharge"}, {n:"water-reuse_recirculation"}, {n:"green-water"}, {n:"hydrodynamics_circulation"}]}, {n:"water-quality-aspect-nei"}]}, {n:"culture-aspect-nei"}]}, {n:"life-sciences"
-, c:[{n:"morphology"}, {n:"biology"
-, c:[{n:"life-cycle"}, {n:"growth"}, {n:"survival"}, {n:"dose-response"}]}, {n:"taxonomy_systematics"}, {n:"ecology"
-, c:[{n:"ecosystem_food-chain"}, {n:"predator_prey"}, {n:"biodiversity"}, {n:"zoogeography_natural-distribution"}, {n:"environmental-impact"}, {n:"eutrophication"}, {n:"pollution"}, {n:"toxicant_contaminant"}, {n:"ecological-footprint"}, {n:"biotope"}, {n:"indogeneous-species"}, {n:"exogeneous-species"}]}, {n:"chemistry"
-, c:[{n:"analysis_chemical-composition"}, {n:"chemical_molecule"}, {n:"hormone"}, {n:"reaction"}]}, {n:"microbiology"
-, c:[{n:"microflora"}, {n:"plating_plate-count_cfu"}, {n:"medium_agar"}, {n:"bacteria"}, {n:"virus"}, {n:"pathogen"}, {n:"probiont"}, {n:"opportunistic-bacteria"}, {n:"microbial-technique-nei"}]}, {n:"genetics"
-, c:[{n:"qualitative-genetic-technique"}, {n:"quantative-genetic-technique"}, {n:"gene"}, {n:"dna"}, {n:"chromosome"}, {n:"selection_evolution"}, {n:"heritability"}, {n:"inbreeding"}, {n:"domestication"}, {n:"hybridization"}, {n:"ploidy"}, {n:"gynogenesis"}, {n:"androgenesis"}, {n:"population-genetics"}, {n:"gene-mapping"}, {n:"sex-determination-system"}, {n:"genetics-nei"}]}, {n:"immunology"}, {n:"microscopy"
-, c:[{n:"dissection"}, {n:"length-measurement"}, {n:"counting"}, {n:"microscopy-nei"}]}]}, {n:"geography"
-, c:[{n:"world"
-, c:[{n:"europe"
-, c:[{n:"belgium"}, {n:"the-netherlands"}, {n:"france"}, {n:"italy"}, {n:"spain_portugal"}, {n:"greece"}, {n:"uk_ireland"}, {n:"norway_sweden_denmark_iceland"}, {n:"european-country-nei"}]}, {n:"former-USSR"}, {n:"africa"
-, c:[{n:"egypt"}, {n:"north-africa-nei"}, {n:"kenia"}, {n:"central-africa-nei"}, {n:"south-africa"}]}, {n:"north-and-central-america"
-, c:[{n:"canada"}, {n:"usa"}, {n:"utah"}, {n:"mexico"}, {n:"central-american-state-nei"}, {n:"caribbean"}]}, {n:"south-america"
-, c:[{n:"brazil"}, {n:"chile"}, {n:"colombia"}, {n:"ecuador"}, {n:"south-america-nei"}]}, {n:"asia"
-, c:[{n:"middle-east"}, {n:"india"}, {n:"china"}, {n:"japan"}, {n:"vietnam"}, {n:"thailand"}, {n:"philippines"}, {n:"asian-country-nei"}]}, {n:"oceania"
-, c:[{n:"australia"}, {n:"new-zealand"}]}, {n:"arctic_antarctic"}]}, {n:"biotope"
-, c:[{n:"ocean_sea"}, {n:"river"}, {n:"bay_lagoon_fjord"}, {n:"coastline_estuary"}, {n:"mangrove"}, {n:"lake"}, {n:"salt-lake_salina"}, {n:"reef"}, {n:"tundra_prairie_savanna"}, {n:"mountain"}, {n:"forest_jungle"}, {n:"cultured-land"}, {n:"biotope-nei"}]}]}, {n:"other-aspects"
-, c:[{n:"sectors"
-, c:[{n:"education"
-, c:[{n:"university_school"}, {n:"students"}, {n:"lecture_course"}, {n:"practical-exercise"}, {n:"training"}, {n:"study-trip"}, {n:"course-material"}, {n:"examination"}, {n:"scholarship_grant"}, {n:"education-nei"}]}, {n:"research"
-, c:[{n:"laboratory"}, {n:"institute_university"}, {n:"scientist_researcher"}, {n:"experiment"}, {n:"project"}, {n:"publication"}, {n:"meeting_conference"}, {n:"research-nei"}]}, {n:"trade_business"
-, c:[{n:"company"}, {n:"market_shop"}, {n:"trend_prospect"}, {n:"commercial-product"}, {n:"office"}, {n:"retail_distribution"}, {n:"price_money"}, {n:"marketing_publicity"}, {n:"transport"}, {n:"trade-nei"}]}, {n:"production"
-, c:[{n:"farm"}, {n:"factory_industry"}, {n:"building_warehouse"}, {n:"machine"}, {n:"production-nei"}]}, {n:"other-sector"
-, c:[{n:"organisation_network"}, {n:"government"}, {n:"ngo"}, {n:"development-aid"}, {n:"cooperation"}, {n:"sponsor_funding-agency"}, {n:"insurance"}, {n:"consultancy"}]}, {n:"aquaculture"}, {n:"agriculture"}, {n:"fishery"
-, c:[{n:"harvest_catch"}, {n:"fishing-gear"}, {n:"vessel"}, {n:"restocking"}, {n:"by-catch"}, {n:"overfishing"}, {n:"fishery-aspect-nei"}]}]}, {n:"people"
-, c:[{n:"researcher"}, {n:"farmer"}, {n:"fisherman"}, {n:"diver"}, {n:"student_teacher"}, {n:"portrait-of-specific-person_group-picture"}]}, {n:"presentation"
-, c:[{n:"title"}, {n:"content_overview"}, {n:"introduction_background"}, {n:"methodology"}, {n:"results"}, {n:"advantages_disadvantages"}, {n:"discussion"}, {n:"conclusion"}, {n:"references"}, {n:"aknowledgement_thanks"}, {n:"the-end"}]}, {n:"apparatus"
-, c:[{n:"hufa-analysis"}, {n:"balance"}, {n:"blender"}, {n:"kjeldahl"}, {n:"chromatograph"}, {n:"gel-electrophoresis"}, {n:"centrifuge"}, {n:"lyophilisator"}, {n:"refrigerator"}, {n:"oven"}, {n:"pipette"}, {n:"microscope"}, {n:"apparatus-nei"}]}, {n:"information_media"
-, c:[{n:"literature"}, {n:"book"}, {n:"journal"}, {n:"publication"}, {n:"news"}, {n:"internet_www"}, {n:"site_links"}, {n:"discussion-list"}, {n:"computer"}, {n:"software"}, {n:"slide"}, {n:"video_dvd_cd-rom"}, {n:"telephone_fax"}, {n:"e-mail"}]}]}, {n:"slide-content"
-, c:[{n:"scheme_drawing"}, {n:"graph_chart"}, {n:"table"}, {n:"map"}, {n:"just-text"}, {n:"combination", cm:"(picture combined with map or table or ...)"}, {n:"skip-this-slide", cm:"(Do not copy to SCORM output)"}]}]};
-
-document.write(traverseKwObj(KWTREE_OBJECT, '', 0)); KWDS_ARRAY.sort();

+ 0 - 11
main/metadata/phpdig/CourseKwds_example.jsc

@@ -1,11 +0,0 @@
-<>Search for anything<hr/>
-<scheme-kw>Slide with scheme
-<graph-kw>Slide with graph
-<table-kw>Slide with table
-<map-kw>Slide with map<hr/>
-<scorm-level-0 -allrefs>Only complete presentations<hr/>
-<scorm-level-2>Only literature references<b> - </b> 
-<txt-sep -scorm-level-2>exclude literature references
-<link-type>Only useful links<b> - </b> 
-<link-type>exclude useful links 
-<txt-sep -scorm-level-2 -link-type>Exclude references and links

+ 0 - 450
main/metadata/phpdig/config.php

@@ -1,450 +0,0 @@
-<?php
-/*
-----------------------------------------------------------------------------------
-PhpDig Version 1.8.x - See the config file for the full version number.
-This program is provided WITHOUT warranty under the GNU/GPL license.
-See the LICENSE file for more information about the GNU/GPL license.
-Contributors are listed in the CREDITS and CHANGELOG files in this package.
-Developer from inception to and including PhpDig v.1.6.2: Antoine Bajolet
-Developer from PhpDig v.1.6.3 to and including current version: Charter
-Copyright (C) 2001 - 2003, Antoine Bajolet, http://www.toiletoine.net/
-Copyright (C) 2003 - current, Charter, http://www.phpdig.net/
-Contributors hold Copyright (C) to their code submissions.
-Do NOT edit or remove this copyright or licence information upon redistribution.
-If you modify code and redistribute, you may ADD your copyright to this notice.
-----------------------------------------------------------------------------------
-*/
-/**
- * phpDig config file
- * @package chamilo.metadata
- */ 
-/**
- * Init
- */
-//---------DEFAULT VALUES
-
-// error_reporting(E_ALL);
-// @ini_set('error_reporting',E_ALL);
-
-//-------------CONFIGURATION FILE-------
-//-------------PHP DIG------------------
-
-// NOTE: If you want a different path, you need to add that path (relative path up to the
-// admin directory: ../dir or full path up to the admin directory: /full/path/to/dir) in
-// the first if statement in this config.php file - for example:
-// && ($relative_script_path != "../dir") // relative path
-// && ($relative_script_path != "/full/path/to/dir") // full path
-// You may also need to set $relative_script_path to this path in search.php, clickstats.php,
-// and function_phpdig_form.php depending on what files you are calling from where
-// NOTE: double dot means go back one and single dot means stay in same directory
-// NOTE: the path should be UP TO but NOT INCLUDING the admin directory - NO ending slash
-/***** Example
-* PhpDig installed at: http://www.domain.com/phpdig/
-* Want search page at: http://www.domain.com/search.php
-* Copy http://www.domain.com/phpdig/search.php to http://www.domain.com/search.php
-* Copy http://www.domain.com/phpdig/clickstats.php to http://www.domain.com/clickstats.php
-* Set $relative_script_path = './phpdig'; in search.php, clickstats.php, and function_phpdig_form.php
-* Add ($relative_script_path != "./phpdig") && to if statement
-*****/
-
-define('ABSOLUTE_SCRIPT_PATH','/full/path/to/dir'); // full path up to but not including admin dir, no end slash
-
-if ((!isset($relative_script_path)) || (($relative_script_path != ".") &&
-($relative_script_path != "..") && ($relative_script_path != ABSOLUTE_SCRIPT_PATH))) {
-  // echo "\n\nPath $relative_script_path not recognized!\n\n";
-  exit();
-}
-
-// NOTE: If you receive an "undefined index" message that means that your server is not recognizing
-// one or some of the $_SERVER variables so check your PHP info and set the $_SERVER variables to
-// those recognized by your server: See http://www.php.net/reserved.variables for a list
-// If using RSS (config vars below) there are $_SERVER variables in the custom_search_page.php file too
-
-if ((isset($_SERVER['SCRIPT_FILENAME'])) && (eregi("config.php",$_SERVER['SCRIPT_FILENAME']))) {
-  exit();
-}
-if ((isset($_SERVER['SCRIPT_URI'])) && (eregi("config.php",$_SERVER['SCRIPT_URI']))) {
-  exit();
-}
-if ((isset($_SERVER['SCRIPT_URL'])) && (eregi("config.php",$_SERVER['SCRIPT_URL']))) {
-  exit();
-}
-if ((isset($_SERVER['REQUEST_URI'])) && (eregi("config.php",$_SERVER['REQUEST_URI']))) {
-  exit();
-}
-if ((isset($_SERVER['SCRIPT_NAME'])) && (eregi("config.php",$_SERVER['SCRIPT_NAME']))) {
-  exit();
-}
-if ((isset($_SERVER['PATH_TRANSLATED'])) && (eregi("config.php",$_SERVER['PATH_TRANSLATED']))) {
-  exit();
-}
-$self = api_get_self();
-if ((isset($self)) && (eregi('config.php',$self))) {
-  exit();
-}
-
-define('PHPDIG_VERSION','1.8.6');
-
-$phpdig_language = "en"; // ca, cs, da, de, en, es, fr, gr, it, nl, no, pt
-if (!isset($phpdig_language)) { $phpdig_language = "en"; }
-
-define('PHPDIG_ADM_AUTH','1');     //Activates/deactivates the authentification functions
-define('PHPDIG_ADM_USER','admin'); //Username
-define('PHPDIG_ADM_PASS','secret');
-
-// template file and style - checks to see that template is set to a valid value
-if (isset($_REQUEST['template_demo'])) { $template_demo = $_REQUEST['template_demo']; }
-$templates_array = array('black.html','bluegrey.html','corporate.html','green.html','grey.html','lightgreen.html','linear.html','newspaper.html','phpdig.html','simple.html','terminal.html','yellow.html','gaagle.html');
-if(isset($template_demo) && in_array($template_demo, $templates_array)) {
-    $template = "$relative_script_path/templates/$template_demo";
-} else {
-    $template = "$relative_script_path/templates/phpdig.html";
-}
-$template = "array";  // RH: overrides the above
-
-// template file and style - alternatively force the template value
-// $template = "$relative_script_path/templates/phpdig.html";
-// if using array, set $template = "array";
-// if using classic, set $template = "classic";
-
-// now set $template_demo to clean $template filename or empty string
-if (($template != "array") && ($template != "classic")) {
-    $template_demo = substr($template,strrpos($template,"/")+1); // get filename.ext from $template variable
-} else {
-    $template_demo = "";
-}
-
-define('HIGHLIGHT_BACKGROUND','#FFBB00');        //Highlighting background color
-                                                 //Only for classic mode
-define('HIGHLIGHT_COLOR','#000000');             //Highlighting text color
-                                                 //Only for classic mode
-
-define('LINK_TARGET','_blank');                  //Target for result links
-define('WEIGHT_IMGSRC','./tpl_img/weight.gif');  //Baragraph image path
-define('WEIGHT_HEIGHT','5');                     //Baragraph height
-define('WEIGHT_WIDTH','50');                     //Max baragraph width
-
-define('SEARCH_PAGE','search.php');              //The name of the search page
-define('DISPLAY_DROPDOWN',true);                 //Display dropdown on search page
-define('DROPDOWN_URLS',true);                    //Always URLs in dropdown: DISPLAY_DROPDOWN needs to be true
-
-define('SUMMARY_DISPLAY_LENGTH',700);            // RH: was 150 //Max chars displayed in summary
-define('SNIPPET_DISPLAY_LENGTH',150);            //Max chars displayed in each snippet
-
-define('DISPLAY_SNIPPETS',true);                 //Display text snippets
-define('DISPLAY_SNIPPETS_NUM',4);                //Max snippets to display
-define('DISPLAY_SUMMARY',false);                 //Display description
-
-define('PHPDIG_DATE_FORMAT','\1-\2-\3');         // Date format for last update
-                                                 // \1 is year, \2 month and \3 day
-                                                 // if using rss, use date format \1-\2-\3
-
-define("END_OF_LINE_MARKER","\r\n");             // End of line marker - keep double quotes
-define('SEARCH_BOX_SIZE',15);                    // Search box size
-define('SEARCH_BOX_MAXLENGTH',50);               // Search box maxlength
-
-//define('PHPDIG_ENCODING','iso-8859-1');  // encoding for interface, search and indexing.
-define('PHPDIG_ENCODING', strtolower($charset));
-                                         // iso-8859-1, iso-8859-2, iso-8859-7, tis-620,
-                                         // and windows-1251 supported in this version.
-
-// replace/edit phpdig_string_subst/phpdig_words_chars for encodings as needed
-// note: you may need to alter table keywords modify keyword varchar(64) binary; for certain encodings
-
-$phpdig_string_subst['iso-8859-1'] = 'A:������,a:������,O:������,o:������,E:����,e:����,C:�,c:�,I:����,i:����,U:����,u:����,Y:�,y:��,N:�,n:�';
-$phpdig_string_subst['iso-8859-2'] = 'A:���á,C:���,D:��,E:����,I:��,L:ť�,N:��,O:����,R:��,S:���,T:ޫ,U:����,Y:�,Z:���,a:����,c:���,d:��,e:����,i:��,l:嵳,n:��,o:����,r:��,s:���,t:��,u:����,y:�,z:���';
-$phpdig_string_subst['iso-8859-6'] = 'Q:Q,q:q';
-//$phpdig_string_subst['iso-8859-7'] = '�:��,�:�,�:�,�:�,�:�,�:��,�:�';
-$phpdig_string_subst['iso-8859-7'] = '�:���,�:�,�:�,�:�,�:Ÿ�,�:�,�:�ǹ,�:�,�:��ɺ,�:�,�:�,�:�,�:�,�:�,�:��,�:�,�:�,�:��,�:�,�:��վ,�:�,�:�,�:�,�:�ٿ';
-$phpdig_string_subst['tis-620'] = 'Q:Q,q:q';
-$phpdig_string_subst['windows-1251'] = '�:�,�:�,�:�,�:�,�:�,�:�,�:�,�:�,�:�,�:�,�:�,�:�,�:�,�:�,�:�,�:�,�:�,�:�,�:�,�:�,�:�,�:�,�:�,�:�,�:�,�:�,�:�,�:�,�:�,�:�,�:�,�:�';
-
-$phpdig_words_chars['iso-8859-1'] = '[:alnum:]��ߵ';
-$phpdig_words_chars['iso-8859-2'] = '[:alnum:]��ߵ';
-$phpdig_words_chars['iso-8859-6'] = '[:alnum:]�������������������������������������������������';
-$phpdig_words_chars['iso-8859-7'] = '[:alnum:]�����������������������٢�������������������������������������������';
-$phpdig_words_chars['tis-620'] = '[:alnum:]������������_���������������������������������������������������������������������������';
-$phpdig_words_chars['windows-1251'] = '[:alnum:]����������������������������������������������������������������';
-
-// start is AND OPERATOR, exact is EXACT PHRASE, and any is OR OPERATOR
-define('SEARCH_DEFAULT_MODE','start');  // default search mode (start|exact|any)
-// in language pack make the appropriate changes to 'w_begin', 'w_whole', and 'w_part'
-// 'w_begin' => 'and operator', 'w_whole' => 'exact phrase', 'w_part' => 'or operator'
-
-define('SEARCH_DEFAULT_LIMIT',10);      //results per page
-
-define('SPIDER_MAX_LIMIT',20);          //max recurse levels in spider
-define('RESPIDER_LIMIT',5);             //recurse respider limit for update
-define('LINKS_MAX_LIMIT',20);           //max links per each level
-define('RELINKS_LIMIT',5);              //recurse links limit for an update
-
-//for limit to directory, URL format must either have file at end or ending slash at end
-//e.g., http://www.domain.com/dirs/ (WITH ending slash) or http://www.domain.com/dirs/dirs/index.php
-define('LIMIT_TO_DIRECTORY',true);      //limit index to given (sub)directory, no sub dirs of dirs are indexed
-
-define('LIMIT_DAYS',0);                 //default days before reindex a page
-define('SMALL_WORDS_SIZE',2);           //words to not index - must be 2 or more
-define('MAX_WORDS_SIZE',50);            // RH: was 30 //max word size
-
-define('PHPDIG_EXCLUDE_COMMENT','<!-- phpdigExclude -->');  //comment to exclude a page part
-define('PHPDIG_INCLUDE_COMMENT','<!-- phpdigInclude -->');  //comment to include a page part
-                                                            // must be on own lines in HTML source
-                                                            // text within comments not indexed
-                                                            // links within comments still indexed
-
-define('PHPDIG_DEFAULT_INDEX',false);    //phpDig considers /index or /default
-                                         //html, htm, php, asp, phtml as the
-                                         //same as '/'
-
-define('ALLOW_RSS_FEED',false);                       // Do RSS and display link - if true, set rss dir to 777
-$theenc = PHPDIG_ENCODING;                            // needs to be same encoding used in index
-$theurl = "http://www.phpdig.net/";                   // site offering the RSS feed
-$thetitle = "PhpDig.net";                             // title for site offering the RSS feed
-$thedesc = "PhpDig :: Web Spider and Search Engine";  // description of site offering the RSS feed
-$thedir = "./rss";                                    // the rss directory name, no ending slash
-$thefile = "search.rss";                              // used in rss filenames
-
-define('PHPDIG_SESSID_REMOVE',true);        // remove SIDS or vars from indexed URLS
-define('PHPDIG_SESSID_VAR','PHPSESSID,s');  // name of SID or variable to remove
-                                            // can be 's' or comma delimited 's,id,var,foo,etc'
-
-define('APPEND_TITLE_META',false);       //append title and meta information to results
-define('TITLE_WEIGHT',3);                //relative title weight: APPEND_TITLE_META needs to be true
-
-define('CHUNK_SIZE',1024);               //chunk size for regex processing
-
-define('SUMMARY_LENGTH',500);            //length of results summary
-
-define('TEXT_CONTENT_PATH','text_content/'); //Text content files path
-define('CONTENT_TEXT',0);                    // RH: was 1 //Activates/deactivates the
-                                             //storage of text content.
-define('PHPDIG_IN_DOMAIN',false);            //allows phpdig jump hosts in the same
-                                             //domain. If the host is "www.mydomain.tld",
-                                             //domain is "mydomain.tld"
-
-define('PHPDIG_LOGS',true);               //write logs
-define('SILENCE_404S',true);              //silence 404 output
-
-define('TEMP_FILENAME_LENGTH',8);         //filename length of temp files
-// if using external tools with extension, use 4 for filename of length 8
-
-define('NUMBER_OF_RESULTS_PER_SITE',-1);  //max number of results per site
-                                          // use -1 to display all results
-
-define('USE_RENICE_COMMAND','1');         //use renice for process priority
-
-//---------EXTERNAL TOOLS SETUP
-// if set to true is_executable used - set to '0' if is_executable is undefined
-define('USE_IS_EXECUTABLE_COMMAND','0');  // RH: was 1 //use is_executable for external binaries
-
-// if set to true, full path to external binary required
-define('PHPDIG_INDEX_MSWORD',false);
-define('PHPDIG_PARSE_MSWORD','/usr/local/bin/catdoc');
-define('PHPDIG_OPTION_MSWORD','-s 8859-1');
-
-define('PHPDIG_INDEX_PDF',false);
-define('PHPDIG_PARSE_PDF','/usr/local/bin/pstotext');
-define('PHPDIG_OPTION_PDF','-cork');
-
-define('PHPDIG_INDEX_MSEXCEL',false);
-define('PHPDIG_PARSE_MSEXCEL','/usr/local/bin/xls2csv');
-define('PHPDIG_OPTION_MSEXCEL','');
-
-define('PHPDIG_INDEX_MSPOWERPOINT',false);
-define('PHPDIG_PARSE_MSPOWERPOINT','/usr/local/bin/ppt2text');
-define('PHPDIG_OPTION_MSPOWERPOINT','');
-
-//---------EXTERNAL TOOLS EXTENSIONS
-// if external binary is not STDOUT or different extension is needed
-// for example, use '.txt' if external binary writes to filename.txt
-define('PHPDIG_MSWORD_EXTENSION','');
-define('PHPDIG_PDF_EXTENSION','');
-define('PHPDIG_MSEXCEL_EXTENSION','');
-define('PHPDIG_MSPOWERPOINT_EXTENSION','');
-
-//---------FTP SETTINGS
-define('FTP_ENABLE',0);//enable ftp content for distant PhpDig
-define('FTP_HOST','<ftp host>'); //if distant PhpDig, ftp host;
-define('FTP_PORT',21); //ftp port
-define('FTP_PASV',1); //passive mode
-define('FTP_PATH','<path to phpdig directory>'); //distant path from the ftp root
-define('FTP_TEXT_PATH','text_content');//ftp path to text-content directory
-define('FTP_USER','<ftp usename>');
-define('FTP_PASS','<ftp password>');
-
-//--------CRON SETTINGS
-define('CRON_ENABLE',false);
-define('CRON_EXEC_FILE','/usr/bin/crontab');
-define('CRON_CONFIG_FILE',ABSOLUTE_SCRIPT_PATH.'/admin/temp/cronfile.txt');
-define('PHPEXEC','/usr/local/bin/php');
-// NOTE: make sure ABSOLUTE_SCRIPT_PATH is the full path up to but not including the admin dir, no ending slash
-// NOTE: CRON_ENABLE set to true writes a file at CRON_CONFIG_FILE containing the cron job information
-// The CRON_CONFIG_FILE must be 777 permissions if applicable to your OS/setup
-// You still need to call the CRON_CONFIG_FILE to run the cron job!!!
-// From shell: crontab CRON_CONFIG_FILE to set the cron job: replace CRON_CONFIG_FILE with actual file
-// From shell: crontab -l to list and crontab -d to delete
-
-// regular expression to ban useless external links in index
-define('BANNED','^ad\.|banner|doubleclick');
-
-// regexp forbidden extensions - return sometimes text/html mime-type !!!
-define('FORBIDDEN_EXTENSIONS','\.(rm|ico|cab|swf|css|gz|z|tar|zip|tgz|msi|arj|zoo|rar|r[0-9]+|exe|bin|pkg|rpm|deb|bz2)$');
-
-//----------HTML ENTITIES
-$spec = array( "&amp" => "&",
-               "&agrave" => "�",
-               "&egrave" => "�",
-               "&ugrave" => "�",
-               "&oacute;" => "�",
-               "&eacute" => "�",
-               "&icirc" => "�",
-               "&ocirc" => "�",
-               "&ucirc" => "�",
-               "&ecirc" => "�",
-               "&ccedil" => "�",
-               "&#156" => "oe",
-               "&gt" => " ",
-               "&lt" => " ",
-               "&deg" => " ",
-               "&apos" => "'",
-               "&quot" => " ",
-               "&acirc" => "�",
-               "&iuml" => "�",
-               "&euml" => "�",
-               "&auml" => "�",
-               "&Auml" => "�",
-               "&Euml" => "�",
-               "&Iuml" => "�",
-               "&Uuml" => "�",
-               "&ouml" => "�",
-               "&uuml" => "�",
-               "&nbsp" => " ",
-               "&szlig" => "�",
-               "&iacute" => "�",
-               "&reg" => " ",
-               "&copy" => " ",
-               "&aacute" => "�",
-               "&Aacute" => "�",
-               "&eth" => "�",
-               "&ETH" => "�",
-               "&Eacute" => "�",
-               "&Iacute" => "�",
-               "&Oacute" => "�",
-               "&uacute" => "�",
-               "&Uacute" => "�",
-               "&THORN" => "�",
-               "&thorn" => "�",
-               "&Ouml" => "�",
-               "&aelig" => "�",
-               "&AELIG" => "�",
-               "&aring" => "�",
-               "&Aring" => "�",
-               "&oslash" => "�",
-               "&Oslash" => "�"
-               );
-
-//month names in iso dates
-$month_names = array ('jan'=>1,
-                      'feb'=>2,
-                      'mar'=>3,
-                      'apr'=>4,
-                      'may'=>5,
-                      'jun'=>6,
-                      'jul'=>7,
-                      'aug'=>8,
-                      'sep'=>9,
-                      'oct'=>10,
-                      'nov'=>11,
-                      'dec'=>12
-                      );
-
-//apache multi indexes parameters
-$apache_indexes = array (  "?N=A" => 1,
-                           "?N=D" => 1,
-                           "?M=A" => 1,
-                           "?M=D" => 1,
-                           "?S=A" => 1,
-                           "?S=D" => 1,
-                           "?D=A" => 1,
-                           "?D=D" => 1,
-                           "?C=N&amp;O=A" => 1,
-                           "?C=M&amp;O=A" => 1,
-                           "?C=S&amp;O=A" => 1,
-                           "?C=D&amp;O=A" => 1,
-                           "?C=N&amp;O=D" => 1,
-                           "?C=M&amp;O=D" => 1,
-                           "?C=S&amp;O=D" => 1,
-                           "?C=D&amp;O=D" => 1);
-
-//includes language file
-define('PHPDIG_LANG_CONSTANT',$phpdig_language); // this line for classic
-if (is_file("$relative_script_path/locales/$phpdig_language-language.php")) {
-    include "$relative_script_path/locales/$phpdig_language-language.php";
-}
-elseif (is_file("$relative_script_path/locales/en-language.php")) {
-    include "$relative_script_path/locales/en-language.php";
-}
-else {
-    die("Unable to select language pack.\n");
-}
-
-//connection to database
-if ((!isset($no_connect)) || ($no_connect != 1)) {
-    if (is_file("$relative_script_path/includes/connect.php")) {
-        include "$relative_script_path/includes/connect.php";
-    }
-    else {
-        die("Unable to find connect.php file.\n");
-    }
-}
-
-//includes of libraries
-if (is_file("$relative_script_path/libs/phpdig_functions.php")) {
-    include "$relative_script_path/libs/phpdig_functions.php";
-}
-else {
-    die ("Unable to find phpdig_functions.php file.\n");
-}
-if (is_file("$relative_script_path/libs/function_phpdig_form.php")) {
-    include "$relative_script_path/libs/function_phpdig_form.php";
-}
-else {
-    die ("Unable to find function_phpdig_form.php file.\n");
-}
-if (is_file("$relative_script_path/libs/mysql_functions.php")) {
-    include "$relative_script_path/libs/mysql_functions.php";
-}
-else {
-    die ("Unable to find mysql_functions.php file.\n");
-}
-if ((!isset($template)) || ((!is_file($template)) && ($template != "array") && ($template != "classic"))) {
-    die ("Unable to render template file.\n");
-}
-
-if (!defined('CONFIG_CHECK')) {
-  exit();
-}
-
-// parse encodings (create global $phpdigEncode);
-phpdigCreateSubstArrays($phpdig_string_subst);
-// send encoding if needed
-if (!headers_sent()) {
-   header('Content-type:text/html; Charset='.PHPDIG_ENCODING);
-}
-// turn off magic_quotes_runtime for escaping purposes
-@ini_set('magic_quotes_runtime',false);
-// turn off magic_quotes_sybase for escaping purposes
-@ini_set('magic_quotes_sybase',false);
-if ((!isset($no_connect)) || ($no_connect != 1)) {
-     phpdigCheckTables($id_connect,array('engine',
-                                    'excludes',
-                                    'keywords',
-                                    'sites',
-                                    'spider',
-                                    'tempspider',
-                                    'logs',
-                                    'clicks',
-                                    'site_page',
-                                    'includes'));
-}
-?>

+ 0 - 199
main/metadata/phpdig/en-language.php

@@ -1,199 +0,0 @@
-<?php
-/**
- * English messages for PhpDig
- * @author Antoine Bajolet - fr - bajolet@toiletoine.net
- * @author Corrections by Brien Louque
- * @package chamilo.metadata
-*/
-/**
- * Definitions
- */
-//'keyword' => 'translation'
-$phpdig_mess = array (
-'one_per_line' =>'Enter one link per line',
-
-'StopSpider'   =>'Stop spider',
-'id'           =>'ID',
-'url'          =>'URL',
-'days'         =>'Days',
-'links'        =>'Links',
-'depth'        =>'Depth',
-'viewRSS'      =>'View RSS for this Page',
-'powered_by'   =>'Powered by PhpDig',
-'searchall'    =>'Search All',
-'wait'         =>'Wait... ',
-'done'         =>'Done!',
-'limit'        =>'Limit',
-'manage'       =>'Here you can manage:',
-'dayscron'     =>'- the number of <b>days</b> crontab waits to reindex (0 = ignore)',
-'links_mean'   =>'- the max number of <b>links</b> per depth per site (0 = unlimited)',
-'depth_mean'   =>'- the max search <b>depth</b> per site (0 = none, depth trumps links)',
-'max_found'    =>'Maximum links found is ((links * depth) + 1) when links is greater than zero.',
-'default_vals' =>'Default values',
-'use_vals_from' =>'Use values from',
-'table_present' =>'table if present and use<br/>default values if values absent from table?',
-'admin_msg_1'   =>'- To empty tempspider table click delete button <i>without</i> selecting a site',
-'admin_msg_2'   =>'- Search depth of zero tries to crawl just that page regardless of links per',
-'admin_msg_3'   =>'- Set links per depth to the max number of links to check at each depth',
-'admin_msg_4'   =>'- Links per depth of zero means to check for all links at each seach depth',
-'admin_msg_5'   =>'- Clean dashes removes \'-\' index pages from blue arrow listings of pages',
-'admin_panel'   =>'Admin Panel',
-
-'choose_temp'  =>'Choose a template',
-'select_site'  =>'Select a site to search',
-'restart'      =>'Restart',
-'narrow_path'  =>'Narrow Path to Search',
-'upd_sites'    =>'Update sites',
-'upd2'         =>'Update Done',
-'links_per'    =>'Links per',
-'yes'          =>'yes',
-'no'           =>'no',
-'delete'       =>'delete',
-'reindex'      =>'Re-index',
-'back'         =>'Back',
-'files'        =>'files',
-'admin'        =>'Administration',
-'warning'      =>'Warning !',
-'index_uri'    =>'Which URI would you index?',
-'spider_depth' =>'Search depth',
-'spider_warn'  =>'Please ensure that no one else is updating the same site.
-A locking mechanism will be included in a later version.',
-'site_update'  =>'Update a site or one of its branch',
-'clean'        =>'Clean',
-'t_index'      =>'index',
-'t_dic'        =>'dictionary',
-'t_stopw'      =>'common words',
-'t_dash'       =>'dashes',
-
-'update'       =>'Update',
-'exclude'      =>'Delete and exclude branch',
-'excludes'     =>'Exclude paths',
-'tree_found'   =>'Found tree',
-'update_mess'  =>'Re-index or delete a tree ',
-'update_warn'  =>'Exclude will delete indexed entries',
-'update_help'  =>'Click on the cross to delete the branch
-Click on the green sign to update it
-Click on the noway sign to exclude from future indexings',
-'branch_start' =>'Select the folder to display on the left side',
-'branch_help1' =>'Select there documents to update individually',
-'branch_help2' =>'Click on the cross to delete a document
-Click on the green sign to reindex it',
-'redepth'      =>'levels depth',
-'branch_warn'  =>'Erase is permanent',
-'to_admin'     =>'to admin interface',
-'to_update'    =>'to update interface',
-
-'search'       =>'Search',
-'results'      =>'results',
-'display'      =>'display',
-'w_begin'      =>'and operator',
-'w_whole'      =>'exact phrase',
-'w_part'       =>'or operator',
-'alt_try'      =>'Did you mean',
-
-'limit_to'     =>'limit to',
-'this_path'    =>'this path',
-'total'        =>'total',
-'seconds'      =>'seconds',
-'w_common_sing'     =>'is a very common word and was ignored.',
-'w_short_sing'      =>'is too short a word and was ignored.',
-'w_common_plur'     =>'are very common words and were ignored.',
-'w_short_plur'      =>'are too short of words and were ignored.',
-'s_results'    =>'search results',
-'previous'     =>'Previous',
-'next'         =>'Next',
-'on'           =>'on',
-
-'id_start'     =>'Site indexing',
-'id_end'       =>'Indexing complete !',
-'id_recent'    =>'Was recently indexed',
-'num_words'    =>'Num words',
-'time'         =>'time',
-'error'        =>'Error',
-'no_spider'    =>'Spider not launched',
-'no_site'      =>'No such site in database',
-'no_temp'      =>'No link in temporary table',
-'no_toindex'   =>'No content indexed',
-'double'       =>'Duplicate of an existing document',
-
-'spidering'    =>'Spidering in progress...',
-'links_more'   =>'more new links',
-'level'        =>'level',
-'links_found'  =>'links found',
-'define_ex'    =>'Define exclusions',
-'index_all'    =>'index all',
-
-'end'          =>'end',
-'no_query'     =>'Select predefined keywords (recommended) by opening the tree with the [+] button below, or type descriptive words in the inputzone, separated by a comma, or type the first letters of a keyword and use autocomplete. Empty the inputzone to re-use autocomplete',
-'pwait'        =>'Please wait',
-'statistics'   =>'Statistics',
-
-// INSTALL
-'slogan'   =>'The smallest search engine in the universe : version',
-'installation'   =>'Installation',
-'instructions' =>'Type here the MySql parameters. Specify a valid existing user who can create databases if you choose create or update.',
-'hostname'   =>'Hostname  :',
-'port'   =>'Port (none = default) :',
-'sock'   =>'Sock (none = default) :',
-'user'   =>'User :',
-'password'   =>'Password :',
-'phpdigdatabase'   =>'PhpDig database :',
-'tablesprefix'   =>'Tables prefix :',
-'instructions2'   =>'* optional. Use lowercase characters, 16 characters max.',
-'installdatabase'   =>'Install phpdig database',
-'error1'   =>'Can\'t find connexion template. ',
-'error2'   =>'Can\'t write connexion template. ',
-'error3'   =>'Can\'t find init_db.sql file. ',
-'error4'   =>'Can\'t create tables. ',
-'error5'   =>'Can\'t find all config database files. ',
-'error6'   =>'Can\'t create database.<br />Verify user\'s rights. ',
-'error7'   =>'Can\'t connect to database<br />Verify connection datas. ',
-'createdb' =>'Create database',
-'createtables' =>'Create tables only',
-'updatedb' =>'Update existing database',
-'existingdb' =>'Write only connection parameters',
-// CLEANUP_ENGINE
-'cleaningindex'   =>'Cleaning index',
-'enginenotok'   =>' index references targeted an inexistent keyword.',
-'engineok'   =>'Engine is coherent.',
-// CLEANUP_KEYWORDS
-'cleaningdictionnary'   =>'Cleaning dictionary',
-'keywordsok'   =>'All keywords are in one or more page.',
-'keywordsnotok'   =>' keywords where not in one page at least.',
-// CLEANUP_COMMON
-'cleanupcommon' =>'Cleanup common words',
-'cleanuptotal' =>'Total ',
-'cleaned' =>' cleaned.',
-'deletedfor' =>' deleted for ',
-// INDEX ADMIN
-'digthis' =>'Dig this !',
-'databasestatus' =>'DataBase status',
-'entries' =>' Entries ',
-'updateform' =>'Update form',
-'deletesite' =>'Delete site',
-// SPIDER
-'spiderresults' =>'Spider results',
-// STATISTICS
-'mostkeywords' =>'Most keywords',
-'richestpages' =>'Richest pages',
-'mostterms'    =>'Most search terms',
-'largestresults'=>'Largest results',
-'mostempty'     =>'Most searchs giving empty results',
-'lastqueries'   =>'Last search queries',
-'lastclicks'   =>'Last search clicks',
-'responsebyhour'=>'Response time by hour',
-// UPDATE
-'userpasschanged' =>'User/Password changed !',
-'uri' =>'URI : ',
-'change' =>'Change',
-'root' =>'Root',
-'pages' =>' pages',
-'locked' => 'Locked',
-'unlock' => 'Unlock site',
-'onelock' => 'A site is locked, because of spidering. You can\'t do this for now',
-// PHPDIG_FORM
-'go' =>'Go ...',
-// SEARCH_FUNCTION
-'noresults' =>'No results'
-);
-?>

+ 0 - 278
main/metadata/phpdig/phpdig_functions.php

@@ -1,278 +0,0 @@
-<?php
-/*
-----------------------------------------------------------------------------------
-PhpDig Version 1.8.x - See the config file for the full version number.
-This program is provided WITHOUT warranty under the GNU/GPL license.
-See the LICENSE file for more information about the GNU/GPL license.
-Contributors are listed in the CREDITS and CHANGELOG files in this package.
-Developer from inception to and including PhpDig v.1.6.2: Antoine Bajolet
-Developer from PhpDig v.1.6.3 to and including current version: Charter
-Copyright (C) 2001 - 2003, Antoine Bajolet, http://www.toiletoine.net/
-Copyright (C) 2003 - current, Charter, http://www.phpdig.net/
-Contributors hold Copyright (C) to their code submissions.
-Do NOT edit or remove this copyright or licence information upon redistribution.
-If you modify code and redistribute, you may ADD your copyright to this notice.
-----------------------------------------------------------------------------------
-*/
-/**
- * PhpDig
- * @package chamilo.metadata
- */
-/**
- * init
- */
-define('CONFIG_CHECK','check'); // do not edit this line
-
-//-------------UTILS FUNCTIONS
-
-//=================================================
-// extract _POST or _GET variables from a list varname => vartype
-// Useful for error_reporting E_ALL too, init variables
-// usage in script : extract(phpdigHttpVars(array('foobar'=>'string')));
-function phpdigHttpVars($varray=array()) {
-$parse_orders = array('_POST','_GET','HTTP_POST_VARS','HTTP_GET_VARS');
-$httpvars = array();
-// extract the right array
-if (is_array($varray)) {
-    foreach($parse_orders as $globname) {
-          global $$globname;
-          if (!count($httpvars) && isset($$globname) && is_array($$globname)) {
-              $httpvars = $$globname;
-          }
-    }
-    // extract or create requested vars
-    foreach($varray as $varname => $vartype) {
-       if (in_array($vartype,array('integer','bool','double','float','string','array')) ) {
-         if (!isset($httpvars[$varname])) {
-            if (!isset($GLOBALS[$varname])) {
-                 $httpvars[$varname] = false;
-            }
-            else {
-                 $httpvars[$varname] = $GLOBALS[$varname];
-            }
-         }
-         settype($httpvars[$varname],$vartype);
-       }
-    }
-return $httpvars;
-}
-}
-
-/**
- * timer for profiling
- * @package chamilo.metadata
- */
-class phpdigTimer {
-      var $time = 0;
-      var $mode = '';
-      var $marks = array();
-      var $template = '';
-
-      function phpdigTimer($mode='html') {
-           $this->time = $this->getTime();
-           if ($mode == 'cli') {
-               $this->template = "%s:\t%0.9f s. \n";
-           }
-           else {
-               $this->template = "<tr><td class=\"greyForm\">%s</td><td class=\"greyForm\">%0.9f s. </td></tr>\n";
-           }
-      }
-      function start($name) {
-           if (!isset($this->marks[$name])) {
-               $this->marks[$name]['time'] = $this->getTime();
-               $this->marks[$name]['stat'] = 'r';
-           }
-           else if ($this->marks[$name]['stat'] == 's') {
-               $this->marks[$name]['time'] = $this->getTime()-$this->marks[$name]['time'];
-               $this->marks[$name]['stat'] = 'r';
-           }
-      }
-      function stop($name) {
-           if (isset($this->marks[$name]) && $this->marks[$name]['stat'] == 'r') {
-               $this->marks[$name]['time'] = $this->getTime()-$this->marks[$name]['time'];
-           }
-           else {
-               $this->marks[$name]['time'] = 0;
-           }
-           $this->marks[$name]['stat'] = 's';
-      }
-      function display() {
-           if ($this->mode != 'cli') {
-               print "<table class=\"borderCollapse\"><tr><td class=\"blueForm\">Mark</td><td class=\"blueForm\">Value</td></tr>\n";
-           }
-           foreach($this->marks as $name => $value) {
-                printf($this->template,ucwords($name),$value['time']);
-           }
-           if ($this->mode != 'cli') {
-               print "</table>\n";
-           }
-      }
-      // increase precision with deltime
-      function getTime() {
-          return array_sum(explode(' ',microtime()))-$this->time;
-      }
-}
-
-//-------------STRING FUNCTIONS
-
-//=================================================
-//returns a localized string
-function phpdigMsg($string='') {
-global $phpdig_mess;
-if (isset($phpdig_mess[$string])) {
-    return nl2br($phpdig_mess[$string]);
-}
-else {
-    return ucfirst($string);
-}
-}
-
-//=================================================
-//print a localized string
-function phpdigPrnMsg($string='') {
-global $phpdig_mess;
-if (isset($phpdig_mess[$string])) {
-    print nl2br($phpdig_mess[$string]);
-}
-else {
-    print ucfirst($string);
-}
-}
-
-//=================================================
-//load the common words in an array
-function phpdigComWords($file='')
-{
-$lines = @file($file);
-if (is_array($lines))
-    {
-    while (list($id,$word) = each($lines))
-           $common[trim($word)] = 1;
-    }
-else
-    $common['aaaa'] = 1;
-return $common;
-}
-
-//=================================================
-//highlight a string part
-function phpdigHighlight($ereg='',$string='')
-{
-if ($ereg) {
-    $string = @eregi_replace($ereg,"\\1<^#_>\\2</_#^>\\3",@eregi_replace($ereg,"\\1<^#_>\\2</_#^>\\3",$string));
-    $string = str_replace("^#_","span class=\"phpdigHighlight\"",str_replace("_#^","span",$string));
-    return $string;
-}
-else {
-    return null;
-}
-}
-
-//=================================================
-//replace all characters with an accent
-function phpdigStripAccents($chaine,$encoding=PHPDIG_ENCODING) {
-global $phpdigEncode;
-if (!isset($phpdigEncode[$encoding])) {
-   $encoding = PHPDIG_ENCODING;
-}
-// exceptions
-if ($encoding == 'iso-8859-1') {
-    $chaine = str_replace('�','ae',str_replace('�','ae',$chaine));
-}
-return( strtr( $chaine,$phpdigEncode[$encoding]['str'],$phpdigEncode[$encoding]['tr']) );
-}
-
-//==========================================
-//Create a ereg for highlighting
-function phpdigPregQuotes($chaine,$encoding=PHPDIG_ENCODING) {
-global $phpdigEncode;
-if (!isset($phpdigEncode[$encoding])) {
-   $encoding = PHPDIG_ENCODING;
-}
-$chaine = preg_quote(strtolower(phpdigStripAccents($chaine,$encoding)));
-return  str_replace($phpdigEncode[$encoding]['char'],$phpdigEncode[$encoding]['ereg'],$chaine);
-}
-
-//=================================================
-// Create Useful arrays for different encodings
-function phpdigCreateSubstArrays($subststrings) {
-$phpdigEncode = array();
-global $phpdigEncode;
-
-foreach($subststrings as $encoding => $subststring) {
-    $tempArray = explode(',',$subststring);
-    if (!isset($phpdigEncode[$encoding])) {
-       $phpdigEncode[$encoding] = array();
-    }
-    $phpdigEncode[$encoding]['str'] = '';
-    $phpdigEncode[$encoding]['tr'] = '';
-    $phpdigEncode[$encoding]['char'] = array();
-    $phpdigEncode[$encoding]['ereg'] = array();
-    foreach ($tempArray as $tempSubstitution) {
-         $chrs = explode(':',$tempSubstitution);
-         $phpdigEncode[$encoding]['char'][strtolower($chrs[0])] = strtolower($chrs[0]);
-         settype($phpdigEncode[$encoding]['ereg'][strtolower($chrs[0])],'string');
-         $phpdigEncode[$encoding]['ereg'][strtolower($chrs[0])] .= $chrs[0].$chrs[1];
-         for($i=0; $i < strlen($chrs[1]); $i++) {
-             $phpdigEncode[$encoding]['str'] .= $chrs[1][$i];
-             $phpdigEncode[$encoding]['tr']  .= $chrs[0];
-         }
-    }
-    foreach($phpdigEncode[$encoding]['ereg'] as $id => $ereg) {
-         $phpdigEncode[$encoding]['ereg'][$id] = '['.$ereg.']';
-    }
-}
-}
-
-//=================================================
-//epure a string from all non alnum words (words can contain &__&��� character)
-function phpdigEpureText($text,$min_word_length=2,$encoding=PHPDIG_ENCODING) {
-global $phpdig_words_chars;
-
-$text = phpdigStripAccents(strtolower ($text));
-//no-latin upper to lowercase - now islandic
-switch (PHPDIG_ENCODING) {
-   case 'iso-8859-1':
-   $text = strtr( $text,'��','��');
-   break;
-}
-
-// RH   ereg_replace('[^'.$phpdig_words_chars[$encoding].' \'._~@#$:&%/;,=-]+',' ',$text);
-$text = ereg_replace('[^'.$phpdig_words_chars[$encoding].' \'._~@#$&%/=-]+',' ',$text);
-
-// RH   ereg_replace('(['.$phpdig_words_chars[$encoding].'])[\'._~@#$:&%/;,=-]+($|[[:space:]]$|[[:space:]]['.$phpdig_words_chars[$encoding].'])','\1 \2',$text);
-$text = ereg_replace('(['.$phpdig_words_chars[$encoding].'])[\'._~@#$&%/=-]+($|[[:space:]]$|[[:space:]]['.$phpdig_words_chars[$encoding].'])','\1 \2',$text);
-
-// the next two repeated lines needed
-if ($min_word_length >= 1) {
-  $text = ereg_replace('[[:space:]][^ ]{1,'.$min_word_length.'}[[:space:]]',' ',' '.$text.' ');
-  $text = ereg_replace('[[:space:]][^ ]{1,'.$min_word_length.'}[[:space:]]',' ',' '.$text.' ');
-}
-
-$text = ereg_replace('\.{2,}',' ',$text);
-$text = ereg_replace('^[[:space:]]*\.+',' ',$text);
-
-return trim(ereg_replace("[[:space:]]+"," ",$text));
-}
-
-//-------------SQL FUNCTIONS
-
-//=================================================
-//insert an entry in logs
-function phpdigAddLog ($id_connect,$option='start',$includes=array(),$excludes=array(),$num_results=0,$time=0) {
-    if (!is_array($excludes)) {
-         $excludes = array();
-    }
-    sort($excludes);
-    if (!is_array($includes)) {
-         $includes = array();
-    }
-    sort($includes);
-    $query = 'INSERT INTO '.PHPDIG_DB_PREFIX.'logs (l_num,l_mode,l_ts,l_includes,l_excludes,l_time) '
-             .'VALUES ('.$num_results.',\''.substr($option,0,1).'\',NOW(),'
-             .'\''.implode(' ',$includes).'\',\''.implode(' ',$excludes).'\','.(double)$time.')';
-    mysql_query($query,$id_connect);
-    return mysql_insert_id($id_connect);
-}
-
-?>

+ 0 - 296
main/metadata/phpdig/search.php

@@ -1,296 +0,0 @@
-<?php
-/**
- * Chamilo phpdig/search.php
- * 2006/12/14
- * @copyright  2006 rene.haentjens@UGent.be -  see metadata/md_funcs.php
- * @package chamilo.metadata
- */
-/*
---------------------------------------------------------------------------------
-PhpDig Version 1.8.6 is provided WITHOUT warranty under the GNU/GPL license.
-See the LICENSE file for more information about the GNU/GPL license.
-Contributors are listed in the CREDITS and CHANGELOG files in this package.
-Developer from inception to and including PhpDig v.1.6.2: Antoine Bajolet
-Developer from PhpDig v.1.6.3 to and including current version: Charter
-Copyright (C) 2001 - 2003, Antoine Bajolet, http://www.toiletoine.net/
-Copyright (C) 2003 - current, Charter, http://www.phpdig.net/
-Contributors hold Copyright (C) to their code submissions.
-Do NOT edit or remove this copyright or licence information upon redistribution.
-If you modify code and redistribute, you may ADD your copyright to this notice.
---------------------------------------------------------------------------------
-*/
-/**
-*   Chamilo Metadata: search Chamilo course objects via PhpDig 1.8.6
-*   customized search.php 1.8.6 for Chamilo 1.6 assumes $template == "array"
-*/
-
-// name of the language file that needs to be included
-$language_file = "md_mix";
-require_once '../../../main/inc/global.inc.php';
-api_protect_course_script();
-
-// start of part copied (with some changes) from standard PhpDig search.php
-$relative_script_path = '.';
-$no_connect = 0;
-
-if (is_file("$relative_script_path/includes/config.php")) {
-    include "$relative_script_path/includes/config.php";
-}
-else {
-    die("Cannot find config.php file.\n");
-}
-
-if (is_file("$relative_script_path/libs/search_function.php")) {
-    include "$relative_script_path/libs/search_function.php";
-}
-else {
-   die("Cannot find PhpDig search_function.php file.\n");
-}
-
-// extract vars
-extract(phpdigHttpVars(
-     array('query_string'=>'string',
-           'mdsc'=>'string', 'kwdswere_string'=>'string',  // Dokeos
-           'refine'=>'integer',
-           'refine_url'=>'string',
-           'site'=>'string', // set to integer later
-           'limite'=>'integer',
-           'option'=>'string',
-           'lim_start'=>'integer',
-           'browse'=>'integer',
-           'path'=>'string'
-           )
-     ),EXTR_SKIP);
-
-  $adlog_flag = 0;
-  $rssdf = "";
-// end of part copied (with some changes) from standard PhpDig search.php
-
-
-// Course keywords
-
-$_course = api_get_course_info(); $ckw = $_course['path'] . '/CourseKwds.js';
-define('KEYWORDS_CACHE', api_get_path(SYS_COURSE_PATH) . $ckw);
-
-if (file_exists(KEYWORDS_CACHE)) $kcdt =
-    htmlspecialchars(date('Y/m/d H:i:s', filemtime(KEYWORDS_CACHE)));
-
-$keywordscache = $kcdt ?
-    '<script type="text/javascript" src="' . api_get_path(WEB_COURSE_PATH) . $ckw . '"></script>' .
-    '<br /><small><i>(CourseKwds cache: ' . $kcdt . ')</i></small>' : '';
-
-
-// Dokeos header
-
-$nameTools = get_lang('Search');
-$htmlHeadXtra[] = '<link rel="stylesheet" type="text/css" href="../../../main/metadata/md_styles.css">';
-$htmlHeadXtra[] = '<script type="text/javascript" src="../../../main/metadata/md_script.js"></script>';
-$htmlHeadXtra[] = '
-    <script type="text/javascript">
-    /* <![CDATA[ */
-    function mdscSet(s)
-    {
-        var mdsc = getObj("mdsc");
-        if (!mdsc) { alert("? Form does not contain mdsc"); return false; }
-
-        mdsc.value = s; return true;
-    }
-    function checkEnter(ev)
-    {
-        if (!ev) ev = window.event;
-
-        if (ev.altKey) {alert(document.getElementById("kwds_string").value); return;}
-
-        if (ev.keyCode == 13)
-        {
-            document.getElementById("kwdswere_string").value =
-                document.getElementById("kwds_string").value;
-            if (prepSearch(ev)) getObj("form_submit").form.submit();
-        }
-    }
-    /* ]]> */
-    </script>';
-
-Display::display_header($nameTools); echo "\n";
-
-echo '<table width="100%"><tr><td><h3>', get_lang('Search'), '</h3></td>',
-    '<td align="right"><a href="http://www.phpdig.net"><img src="phpdig_powered_2.gif"/></a></td></tr></table>';
-
-
-// Store new extra criteria (course manager only, see below), or execute
-// PhpDig Search and echo result message + table with results + pages bar
-
-if (!$query_string) $query_string = trim($mdsc);
-
-$ckwcdt = file_exists($ckwc = KEYWORDS_CACHE . 'c') ?
-    date('Y/m/d H:i:s', filemtime($ckwc)) : '?'; $pkwc = '';
-
-if (substr($query_string, 0, 2) == '<>' && api_is_allowed_to_edit())
-{
-    if ($ckwcdt{0} != '?')
-    {
-        $fckwc = fopen($ckwc, 'rb'); $pkwc = fread($fckwc, filesize($ckwc));
-        fclose($fckwc); unset($fckwc);
-    }
-
-    if(($fckwc = fopen($ckwc, 'wb')))
-    {
-        fwrite($fckwc, $query_string); fclose($fckwc); unset($fckwc);
-        $ckwcdt = file_exists($ckwc) ?
-            date('Y/m/d H:i:s', filemtime($ckwc)) : '? Write Error';
-    }
-    else $ckwcdt = '? Open Error';
-
-    $phpdigSearchResults = array('result_message' => $ckw . 'c: ' . $ckwcdt,
-        'pages_bar' => '', 'results' => array());
-}
-else
-{
-    $phpdigSearchResults = phpdigSearch($id_connect, $query_string, $option,
-        $refine, $refine_url, $lim_start, $limite, $browse, $site, $path,
-        $relative_script_path, $template, $adlog_flag, $rssdf, $template_demo);
-}
-
-$result_message = ''; $hits = 11;
-
-if ($result_message = $phpdigSearchResults['result_message'])
-    if (($cspos = strpos($result_message, ', ')) !== FALSE)
-        if (($sppos = strpos($result_message, ' ', $cspos += 2)) !== FALSE)
-            if (is_numeric($total = substr($result_message, $cspos, $sppos-$cspos)))
-                $hits = (int) $total;
-
-if (!($pages_bar = $phpdigSearchResults['pages_bar'])) $hits = 0;
-
-if ($result_message == phpdigMsg('noresults')) $result_message .= ' '.phpdigMsg('on').' "'.htmlspecialchars($query_string,ENT_QUOTES).'"';
-
-echo $result_message, '<br><br><table border="1">', "\n";
-
-if ($phpdigSearchResults['results']) foreach ($phpdigSearchResults['results'] as $searchResult)
-{
-    $url = $searchResult['complete_path'];
-
-    if (ereg("/[^?/]*\\?.*thumb=", $url))
-    {
-        // direct URL: $thumburl = ereg_replace("/[^?/]*\\?.*thumb=", "/", $url);
-        $thumburl = ereg_replace("\\?.*thumb=", "?th=", $url);  // via index.php
-    }
-    else
-    {
-        $thumburl = "tpl_img/link.gif";
-    }
-
-    echo '<tr><td align="center"><a target="_blank" href="', $url, '"><img src="', $thumburl,
-        '"/></a></td><td><a target="_blank" href="', $url, '">', $searchResult['link_title'],
-        '</a><br>', $searchResult['text'], '</td></tr>', "\n";
-}
-
-echo '</table><br>';
-
-if ($result_message && ($hits > 10))
-    echo "Results page ", str_replace('?template_demo=',
-        '?kwdswere_string=' . urlencode($kwdswere_string), $pages_bar), '<br><br>';
-
-/*  Extra criteria: A course manager can define and edit them in the TEXTAREA.
-    If he types in something as in the example below, and clicks 'Go', the new
-    criteria are stored and the old ones are displayed. So it is easy to
-    restore the old ones. To confirm the new ones, empty the TEXTAREA.
-
-<>This selection empties extra criteria
-<searchword>Label
-<keyword-kw>Descriptive text
-
-*/
-
-$tdhtm = '';
-
-function tdhtm($xc)
-{
-    $eol = '<br/>'; if ($xc{0} == '<') $xc = substr($xc, 1);
-
-    if (($eov = strpos($xc, '>')) === FALSE)
-            $value = $label = $xc;
-    else
-    {
-        $value = substr($xc, 0, $eov); $label = substr($xc, $eov+1);
-
-        if (($eot = strpos($label, '<')) !== FALSE)
-        {
-            $eol = substr($label, $eot); $label = substr($label, 0, $eot);
-        }
-    }
-
-    return '<input type="radio" name="xc" onclick="mdscSet(' . "'" .
-        htmlspecialchars($value) . "'" . ')">' .
-        htmlspecialchars($label) . '</input>' . $eol;
-}
-
-if ($ckwcdt{0} != '?')  // there is a file with extra criteria
-{
-    $fckwc = fopen($ckwc, 'rb');
-    foreach (explode("\n", fread($fckwc, filesize($ckwc))) as $xc)
-        $tdhtm .= "\n" . tdhtm($xc);
-    fclose($fckwc); unset($fckwc);
-}
-
-// Search criteria form and keywords tree
-?>
-
-<div onMouseUp="if ((kw = pU_clicked(event))) pU_select(kw); else pU_hide();">
-
-<input type="text" id="kwds_string" class="kwl" onKeyUp="takeTypeIn(this, 150, -100, '60%'); checkEnter(event); return true;"/>
-
-<form action="<?php echo api_get_self()?>" method="post">
-<table>
-<tr>
-    <td><?php echo $tdhtm, '&nbsp;'; ?>
-    </td>
-    <td>
-    <?php if (api_is_allowed_to_edit())
-               echo '<textarea name="mdsc" id="mdsc" rows="10" cols="60">', htmlspecialchars($pkwc), '</textarea>';
-          else echo '<textarea name="mdsc" id="mdsc" class="dvc"> </textarea>';
-    ?>
-    </td>
-    <td>
-        <input type="hidden" id="kwdswere_string" name="kwdswere_string"/>
-        <input type="submit" id="form_submit" onClick="document.getElementById('kwdswere_string').value = document.getElementById('kwds_string').value; return prepSearch(event);" value="<?php echo phpdigMsg('go')?>"/>
-    </td>
-</tr>
-</table>
-
-<div id="popup" noWrap="1" class="pup">
-    Working...
-</div>
-
-</form>
-
-<div>
-</div>
-
-<div noWrap="1" id="maindiv">
-    <?php if ($keywordscache == '') { ?> &#xa0; <?php } else { ?>
-    <input type="checkbox" id="restricttokwds">Keywords-restrictive search<br>
-    <input type="button" class="btn" value="+" onClick="if (this.value == '+') deselectAll(event, this); openOrClose(this);"/>
-    <input type="button" class="btm" id="btnOpenOrCloseAll" value="++" onClick="openOrCloseAll(this);"/>
-    <input type="button" class="btn" value="?" onClick="openOrCloseHelp(this)"/>
-    &#xa0;<?php echo get_lang('ClickKw'), $keywordscache; } ?>
-</div>
-
-<div id='moreHelp' class='dvc'>
-    <?php echo get_lang('KwHelp')?>
-</div>
-
-</div><!-- onMouseUp -->
-
-<?php
-
-/***** Example inserting in own domain (not used here)
-* PhpDig installed at: http://www.domain.com/phpdig/
-* Want search page at: http://www.domain.com/search.php
-* Copy http://www.domain.com/phpdig/search.php to http://www.domain.com/search.php
-* Copy http://www.domain.com/phpdig/clickstats.php to http://www.domain.com/clickstats.php
-* Set $relative_script_path = './phpdig'; in search.php, clickstats.php, and function_phpdig_form.php
-* Add ($relative_script_path != "./phpdig") && to if statement
-*****/
-
-echo "\n"; Display::display_footer();
-?>

+ 0 - 785
main/metadata/phpdig/search_function.php

@@ -1,785 +0,0 @@
-<?php
-/*
-----------------------------------------------------------------------------------
-PhpDig Version 1.8.x - See the config file for the full version number.
-This program is provided WITHOUT warranty under the GNU/GPL license.
-See the LICENSE file for more information about the GNU/GPL license.
-Contributors are listed in the CREDITS and CHANGELOG files in this package.
-Developer from inception to and including PhpDig v.1.6.2: Antoine Bajolet
-Developer from PhpDig v.1.6.3 to and including current version: Charter
-Copyright (C) 2001 - 2003, Antoine Bajolet, http://www.toiletoine.net/
-Copyright (C) 2003 - current, Charter, http://www.phpdig.net/
-Contributors hold Copyright (C) to their code submissions.
-Do NOT edit or remove this copyright or licence information upon redistribution.
-If you modify code and redistribute, you may ADD your copyright to this notice.
-----------------------------------------------------------------------------------
-*/
-/**
- * phpDig search functions
- * @package chamilo.metadata
- */
-/**
- * do the search and display the results
- * can be called in any page
- */
-function phpdigSearch($id_connect, $query_string, $option='start', $refine=0,
-                       $refine_url='', $lim_start=0, $limite=10, $browse=0,
-                       $site=0, $path='', $relative_script_path = '.', $template='', $adlog_flag=0, $rssdf='', $template_demo='')
-{
-
-// check input
-
-// $id_connect set in connect.php file
-// $query_string cleaned in $query_to_parse in search_function.php file
-if (($option != "start") && ($option != "any") && ($option != "exact")) { $option = SEARCH_DEFAULT_MODE; }
-if (($refine != 0) && ($refine != 1)) { $refine = 0; }
-// $refine_url set in search_function.php file
-// $lim_start set in search_function.php file
-settype($limite,'integer');
-if (($limite != 10) && ($limite != 30) && ($limite != 100)) { $limite = SEARCH_DEFAULT_LIMIT; }
-$limit_start = 0;
-settype($limit_start,'integer');
-if (isset($limit_start)) { $limit_start = $limite * floor($limit_start / $limite); }
-if (($browse != 0) && ($browse != 1)) { $browse = 0; }
-if (eregi("^[0-9]+[,]",$site)) { $tempbust = explode(",",$site); $site = $tempbust[0]; $path = $tempbust[1]; }
-settype($site,'integer'); // now set to integer
-settype($path,'string');  // make sure set to string
-if (!get_magic_quotes_gpc()) { $my_path = addslashes($path); }
-else { $my_path = addslashes(stripslashes($path)); $path = stripslashes($path); }
-if (empty($site) && empty($path)) { $refine = 0; } else { $refine = 1; }
-if ($path == "-###-") { $site = 0; $path = ""; $refine = 0; }
-// $relative_script_path set in search.php file
-// $template set in config.php file
-// $adlog_flag set in search.php file
-// $rssdf set in search.php file
-// $template_demo set in config.php
-
-$timer = new phpdigTimer('html');
-$timer->start('All');
-
-// init variables
-global $phpdig_words_chars,$maxweight;
-settype($maxweight,'integer');
-$ignore = '';
-$ignore_common = '';
-$ignore_message = '';
-$ignore_commess = '';
-$wheresite = '';
-$wherepath = '';
-$table_results = '';
-$final_result = '';
-$search_time = 0;
-$strings = '';
-$num_tot = 0;
-$leven_final = "";
-$exclude = array();
-$nav_bar = '';
-$pages_bar = '';
-
-$mtime = explode(' ',microtime());
-$start_time = $mtime[0]+$mtime[1];
-
-$timer->start('All backend');
-$timer->start('parsing strings');
-
-if (!$option) {
-     $option = SEARCH_DEFAULT_MODE;
-}
-if (!in_array($option,array('start','any','exact'))) {
-     return 0;
-}
-// the query was filled
-if ($query_string) {
-
-$common_words = phpdigComWords("$relative_script_path/includes/common_words.txt");
-
-$like_start = array( "start" => "", // is empty
-                     "any" => "", // was a percent
-                     "exact" => "" // is empty
-                     );
-$like_end = array( "start" => "%", // is a percent
-                     "any" => "%", // is a percent
-                     "exact" => "%" // was empty
-                     );
-$like_operator = array( "start" => "like", // is a like
-                     "any" => "like", // is a like
-                     "exact" => "like" // was an =
-                     );
-
-if ($refine) {
-     $wheresite = "AND spider.site_id = $site ";
-     if (($path) && (strlen($path) > 0)) {
-          $wherepath = "AND spider.path like '$my_path' ";
-     }
-     $refine_url = "&amp;refine=1&amp;site=$site&amp;path=".urlencode($path);
-}
-else {
-     $refine_url = "";
-}
-
-settype ($lim_start,"integer");
-if ($lim_start < 0) {
-     $lim_start = 0;
-}
-
-$n_words = count(explode(" ",$query_string));
-
-$ncrit = 0;
-$tin = "0";
-
-if (!get_magic_quotes_gpc()) {
-    $query_to_parse = addslashes($query_string);
-}
-else {
-    $query_to_parse = $query_string;
-}
-$my_query_string_link = stripslashes($query_to_parse);
-
-$query_to_parse = str_replace('_','\_',$query_to_parse); // avoid '_' in the query
-$query_to_parse = str_replace('%','\%',$query_to_parse); // avoid '%' in the query
-$query_to_parse = str_replace('\"',' ',$query_to_parse); // avoid '"' in the query
-
-$query_to_parse = phpdigStripAccents(strtolower($query_to_parse)); //made all lowercase
-
-// RH query_chars = "[^".$phpdig_words_chars[PHPDIG_ENCODING]." \'.\_~@#$:&\%/;,=-]+"; // epure chars \'._~@#$:&%/;,=-
-$what_query_chars = "[^".$phpdig_words_chars[PHPDIG_ENCODING]." \'._~@#$&%/=-]+"; // epure chars \'._~@#$&%/=-
-
-if (eregi($what_query_chars,$query_to_parse)) {
-	$query_to_parse = eregi_replace($what_query_chars," ",$query_to_parse);
-}
-
-$query_to_parse = ereg_replace('(['.$phpdig_words_chars[PHPDIG_ENCODING].'])[\'.\_~@#$:&\%/;,=-]+($|[[:space:]]$|[[:space:]]['.$phpdig_words_chars[PHPDIG_ENCODING].'])','\1 \2',$query_to_parse);
-
-$query_to_parse = trim(ereg_replace(" +"," ",$query_to_parse)); // no more than 1 blank
-
-$query_for_strings = $query_to_parse;
-$query_for_phrase = $query_to_parse;
-$test_short = $query_to_parse;
-$query_to_parse2 = explode(" ",$query_to_parse);
-usort($query_to_parse2, "phpdigByLength");
-$query_to_parse = implode(" ",$query_to_parse2);
-if (isset($query_to_parse2)) { unset($query_to_parse2); }
-
-if (SMALL_WORDS_SIZE >= 1) {
-$ignore_short_flag = 0;
-$test_short_counter = 0;
-$test_short2 = explode(" ",$test_short);
-for ($i=0; $i<count($test_short2); $i++) {
-    $test_short2[$i] = trim($test_short2[$i]);
-}
-$test_short2 = array_unique($test_short2);
-sort($test_short2);
-$test_short3 = array();
-for ($i=0; $i<count($test_short2); $i++) {
-  if ((strlen($test_short2[$i]) <= SMALL_WORDS_SIZE) && (strlen($test_short2[$i]) > 0)) {
-    $test_short2[$i].=" ";
-    $test_short_counter++;
-    $test_short3[] = $test_short2[$i];
-  }
-}
-$test_short = implode(" ",$test_short3);
-if (isset($test_short2)) { unset($test_short2); }
-if (isset($test_short3)) { unset($test_short3); }
-
-  $regs = array(); // for use with ereg()
-  while (ereg('( [^ ]{1,'.SMALL_WORDS_SIZE.'} )|( [^ ]{1,'.SMALL_WORDS_SIZE.'})$|^([^ ]{1,'.SMALL_WORDS_SIZE.'} )',$test_short,$regs)) {
-     for ($n=1; $n<=3; $n++) {
-        if (($regs[$n]) || ($regs[$n] == 0)) {
-            $ignore_short_flag++;
-            if (!eregi("\"".trim(stripslashes($regs[$n]))."\", ",$ignore)) {
-              $ignore .= "\"".trim(stripslashes($regs[$n]))."\", ";
-            }
-            $test_short = trim(str_replace($regs[$n],"",$test_short));
-        }
-     }
-  }
-  if (strlen($test_short) <= SMALL_WORDS_SIZE) {
-    if (!eregi("\"".$test_short."\", ",$ignore)) {
-      $ignore_short_flag++;
-      $ignore .= "\"".stripslashes($test_short)."\", ";
-    }
-    $test_short = trim(str_replace($test_short,"",$test_short));
-  }
-}
-
-$ignore = str_replace("\"\", ","",$ignore);
-
-if ($option != "exact") {
-  if (($ignore) && ($ignore_short_flag > 1) && ($test_short_counter > 1)) {
-    $ignore_message = $ignore.' '.phpdigMsg('w_short_plur');
-  }
-  elseif ($ignore) {
-    $ignore_message = $ignore.' '.phpdigMsg('w_short_sing');
-  }
-}
-
-$ignore_common_flag = 0;
-while (ereg("(-)?([^ ]{".(SMALL_WORDS_SIZE+1).",}).*",$query_for_strings,$regs)) {
-        $query_for_strings = trim(str_replace($regs[2],"",$query_for_strings));
-        if (!isset($common_words[stripslashes($regs[2])])) {
-             if ($regs[1] == '-') {
-                 $exclude[$ncrit] = $regs[2];
-                 $query_for_phrase = trim(str_replace("-".$regs[2],"",$query_for_phrase));
-             }
-             else {
-                 $strings[$ncrit] = $regs[2];
-             }
-             $kconds[$ncrit] = '';
-             if ($option != 'any') {
-                 $kconds[$ncrit] .= " AND k.twoletters = '".addslashes(substr(str_replace('\\','',$regs[2]),0,2))."' ";
-             }
-             $kconds[$ncrit] .= " AND k.keyword ".$like_operator[$option]." '".$like_start[$option].$regs[2].$like_end[$option]."' ";
-             $ncrit++;
-        }
-        else {
-             $ignore_common_flag++;
-             $ignore_common .= "\"".stripslashes($regs[2])."\", ";
-        }
-}
-
-if ($option != "exact") {
-  if (($ignore_common) && ($ignore_common_flag > 1)) {
-    $ignore_commess = $ignore_common.' '.phpdigMsg('w_common_plur');
-  }
-  elseif ($ignore_common) {
-    $ignore_commess = $ignore_common.' '.phpdigMsg('w_common_sing');
-  }
-}
-
-$timer->stop('parsing strings');
-
-if ($ncrit && is_array($strings)) {
-     $query = "SET OPTION SQL_BIG_SELECTS = 1";
-     mysql_query($query,$id_connect);
-
-     $my_spider2site_array = array();
-     $my_sitecount_array = array();
-
-     for ($n = 0; $n < $ncrit; $n++) {
-           $timer->start('spider queries');
-
-           $query = "SELECT spider.spider_id,sum(weight) as weight, spider.site_id
-           FROM ".PHPDIG_DB_PREFIX."keywords as k,".PHPDIG_DB_PREFIX."engine as engine, ".PHPDIG_DB_PREFIX."spider as spider
-           WHERE engine.key_id = k.key_id
-           ".$kconds[$n]."
-           AND engine.spider_id = spider.spider_id $wheresite $wherepath
-           GROUP BY spider.spider_id,spider.site_id ";
-
-           $result = mysql_query($query,$id_connect);
-           $num_res_temp = mysql_num_rows($result);
-
-           $timer->stop('spider queries');
-           $timer->start('spider fills');
-
-           if ($num_res_temp > 0) {
-               if (!isset($exclude[$n])) {
-               $num_res[$n] = $num_res_temp;
-                    while (list($spider_id,$weight,$site_id) = mysql_fetch_array($result)) {
-                         $s_weight[$n][$spider_id] = $weight;
-                         $my_spider2site_array[$spider_id] = $site_id;
-                         $my_sitecount_array[$site_id] = 0;
-                    }
-               }
-               else {
-               $num_exclude[$n] = $num_res_temp;
-                     while (list($spider_id,$weight) = mysql_fetch_array($result)) {
-                            $s_exclude[$n][$spider_id] = 1;
-                     }
-               mysql_free_result($result);
-               }
-           }
-           elseif (!isset($exclude[$n])) {
-                   $num_res[$n] = 0;
-                   $s_weight[$n][0] = 0;
-          }
-          $timer->stop('spider fills');
-     }
-
-     $timer->start('reorder results');
-
-     if ($option != "any") {
-     if (is_array($num_res)) {
-           asort ($num_res);
-           list($id_most) = each($num_res);
-           reset ($s_weight[$id_most]);
-           while (list($spider_id,$weight) = each($s_weight[$id_most]))  {
-                  $weight_tot = 1;
-                  reset ($num_res);
-                  while(list($n) = each($num_res)) {
-                        settype($s_weight[$n][$spider_id],'integer');
-                        $weight_tot *= sqrt($s_weight[$n][$spider_id]);
-                  }
-                  if ($weight_tot > 0) {
-                       $final_result[$spider_id]=$weight_tot;
-                  }
-           }
-     }
-     }
-     else {
-     if (is_array($num_res)) {
-           asort ($num_res);
-           while (list($spider_id,$site_id) = each($my_spider2site_array))  {
-                  $weight_tot = 0;
-                  reset ($num_res);
-                  while(list($n) = each($num_res)) {
-                        settype($s_weight[$n][$spider_id],'integer');
-                        $weight_tot += sqrt($s_weight[$n][$spider_id]);
-                  }
-                  if ($weight_tot > 0) {
-                       $final_result[$spider_id]=$weight_tot;
-                  }
-           }
-     }
-     }
-
-    if (isset($num_exclude) && is_array($num_exclude)) {
-           while (list($id) = each($num_exclude)) {
-                  while(list($spider_id) = each($s_exclude[$id])) {
-                        if (isset($final_result[$spider_id])) { unset($final_result[$spider_id]); }
-                  }
-           }
-    }
-
-    if ($option == "exact") {
-    if ((is_array($final_result)) && (count($final_result) > 0)) {
-        $exact_phrase_flag = 0;
-        arsort($final_result);
-        reset($final_result);
-        $query_for_phrase_array = explode(" ",$query_for_phrase);
-        $reg_strings = str_replace('@#@',' ',phpdigPregQuotes(str_replace('\\','',implode('@#@',$query_for_phrase_array))));
-        $stop_regs = "[][(){}[:blank:]=&?!&#%\$�*@+%:;,/\.'\"]";
-        $reg_strings = "($stop_regs{1}|^)($reg_strings)($stop_regs{1}|\$)";
-        while (list($spider_id,$weight) = each($final_result)) {
-          $content_file = $relative_script_path.'/'.TEXT_CONTENT_PATH.$spider_id.'.txt';
-          if (is_file($content_file)) {
-            $f_handler = fopen($content_file,'r');
-            $extract_content = preg_replace("/([ ]{2,}|\n|\r|\r\n)/"," ",fread($f_handler,filesize($content_file)));
-              if(!eregi($reg_strings,$extract_content)) {
-                $exact_phrase_flag = 1;
-              }
-            fclose($f_handler);
-          }
-          if ($exact_phrase_flag == 1) {
-            if (isset($final_result[$spider_id])) { unset($final_result[$spider_id]); }
-            $exact_phrase_flag = 0;
-          }
-        }
-      }
-    }
-
-    if((!$refine) && (NUMBER_OF_RESULTS_PER_SITE != -1)) {
-       if ((is_array($final_result)) && (count($final_result) > 0)) {
-           arsort($final_result);
-           reset($final_result);
-           while (list($spider_id,$weight) = each($final_result)) {
-                  $site_id = $my_spider2site_array[$spider_id];
-                  $current_site_counter = $my_sitecount_array[$site_id];
-                  if ($current_site_counter < NUMBER_OF_RESULTS_PER_SITE) {
-                         $my_sitecount_array[$site_id]++;
-                  }
-                  else {
-                         if (isset($final_result[$spider_id])) { unset($final_result[$spider_id]); }
-                  }
-           }
-       }
-    }
-
-    $timer->stop('reorder results');
-}
-
-$timer->stop('All backend');
-$timer->start('All display');
-
-if ((is_array($final_result)) && (count($final_result) > 0)) {
-    arsort($final_result);
-    $lim_start = max(0, $lim_start-($lim_start % $limite));
-    $n_start = $lim_start+1;
-    $num_tot = count($final_result);
-
-    if ($n_start+$limite-1 < $num_tot) {
-           $n_end = ($lim_start+$limite);
-           $more_results = 1;
-    }
-    else {
-          $n_end = $num_tot;
-          $more_results = 0;
-    }
-
-    if ($n_start > $n_end) {
-        $n_start = 1;
-        $n_end = min($num_tot,$limite);
-        $lim_start = 0;
-        if ($n_end < $num_tot) {
-            $more_results = 1;
-        }
-    }
-
-    // ereg for text snippets and highlighting
-    if ($option == "exact") {
-        $reg_strings = str_replace('@#@',' ',phpdigPregQuotes(str_replace('\\','',implode('@#@',$query_for_phrase_array))));
-    }
-    else {
-        $reg_strings = str_replace('@#@','|',phpdigPregQuotes(str_replace('\\','',implode('@#@',$strings))));
-    }
-    $stop_regs = "[][(){}[:blank:]=&?!&#%\$�*@+%:;,/\.'\"]";
-
-    switch($option) {
-        case 'any':
-        $reg_strings = "($stop_regs{1}|^)($reg_strings)()";
-        break;
-        case 'exact':
-        $reg_strings = "($stop_regs{1}|^)($reg_strings)($stop_regs{1}|\$)";
-        break;
-        default:
-        $reg_strings = "($stop_regs{1}|^)($reg_strings)()";
-    }
-
-    $timer->start('Result table');
-
-    //fill the results table
-    reset($final_result);
-    for ($n = 1; $n <= $n_end; $n++) {
-        list($spider_id,$s_weight) = each($final_result);
-        if (!$maxweight) {
-              $maxweight = $s_weight;
-        }
-        if ($n >= $n_start) {
-             $timer->start('Display queries');
-
-             $query = "SELECT sites.site_url, sites.port, spider.path,spider.file,spider.first_words,sites.site_id,spider.spider_id,spider.last_modified,spider.md5 "
-                      ."FROM ".PHPDIG_DB_PREFIX."spider AS spider, ".PHPDIG_DB_PREFIX."sites AS sites "
-                      ."WHERE spider.spider_id=$spider_id AND sites.site_id = spider.site_id";
-             $result = mysql_query($query,$id_connect);
-             $content = mysql_fetch_array($result,MYSQL_ASSOC);
-             mysql_free_result($result);
-             if ($content['port']) {
-                 $content['site_url'] = ereg_replace('/$',':'.$content['port'].'/',$content['site_url']);
-             }
-             $weight = sprintf ("%01.2f", (100*$s_weight)/$maxweight);
-             $url = eregi_replace("([".$phpdig_words_chars[PHPDIG_ENCODING]."])[/]{2,}","\\1/",urldecode($content['site_url'].$content['path'].$content['file']));
-
-             $js_url = urlencode(eregi_replace("^[a-z]{3,5}://","",$url));
-
-             $url = str_replace("\"","%22",str_replace("'","%27",str_replace(" ","%20",trim($url))));
-
-             $l_site = "<a class='phpdig' href='".SEARCH_PAGE."?refine=1&amp;query_string=".urlencode($my_query_string_link)."&amp;site=".$content['site_id']."&amp;limite=$limite&amp;option=$option'>".htmlspecialchars(urldecode($content['site_url']),ENT_QUOTES)."</a>";
-             if ($content['path']) {
-                  $content['path'] = urlencode(urldecode($content['path']));
-                  $content2['path'] = htmlspecialchars(urldecode($content['path']),ENT_QUOTES);
-                  $l_path = ", ".phpdigMsg('this_path')." : <a class='phpdig' href='".SEARCH_PAGE."?refine=1&amp;query_string=".urlencode($my_query_string_link)."&amp;site=".$content['site_id']."&amp;path=".$content['path']."&amp;limite=$limite&amp;option=$option' >".$content2['path']."</a>";
-             }
-             else {
-                  $content2['path'] = "";
-                  $l_path="";
-             }
-
-             $first_words = ereg_replace('txt-sep +txt-end', 'txt-end', ereg_replace('txt-sep +txt-sep', 'txt-sep', $content['first_words']));  // RH was just: $content['first_words'];
-             $first_words = str_replace('-kw ', ' ', str_replace('txt-end', "\n", str_replace('txt-sep', '<br>', $first_words)));  // RH this line added
-
-             $timer->stop('Display queries');
-             $timer->start('Extracts');
-
-             $extract = "";
-             //Try to retrieve matching lines if the content-text is set to 1
-             if (CONTENT_TEXT == 1 && DISPLAY_SNIPPETS) {
-                 $content_file = $relative_script_path.'/'.TEXT_CONTENT_PATH.$content['spider_id'].'.txt';
-                 if (is_file($content_file)) {
-                     $num_extracts = 0;
-                     $my_extract_size = 200;
-
-                     $my_filesize_for_while = filesize($content_file);
-                     while (($num_extracts == 0) && ($my_extract_size <= $my_filesize_for_while)) { // ***
-
-                     $f_handler = fopen($content_file,'r');
-                     while($num_extracts < DISPLAY_SNIPPETS_NUM && $extract_content = preg_replace("/([ ]{2,}|\n|\r|\r\n)/"," ",fread($f_handler,$my_extract_size))) {
-                           if(eregi($reg_strings,$extract_content)) {
-                              $match_this_spot = eregi_replace($reg_strings,"\\1<\\2>\\3",$extract_content);
-                              $first_bold_spot = strpos($match_this_spot,"<");
-                              $first_bold_spot = max($first_bold_spot - round((SNIPPET_DISPLAY_LENGTH / 2),0), 0);
-                              $extract_content = substr($extract_content,$first_bold_spot,max(SNIPPET_DISPLAY_LENGTH, 2 * strlen($query_string)));
-                              $extract .= ' ...'.phpdigHighlight($reg_strings,$extract_content).'... ';
-                              $num_extracts++;
-                           }
-                     }
-                     fclose($f_handler);
-
-                         if ($my_extract_size < $my_filesize_for_while) {
-                             $my_extract_size *= 100;
-                             if ($my_extract_size > $my_filesize_for_while) {
-                                 $my_extract_size = $my_filesize_for_while;
-                             }
-                         }
-                         else {
-                             $my_extract_size++;
-                         }
-
-                     } // ends ***
-                 }
-             }
-
-             list($title,$text) = explode("\n",$first_words);
-
-             $title = htmlspecialchars(phpdigHighlight($reg_strings,urldecode($title)),ENT_QUOTES);
-             $title = phpdigSpanReplace($title);
-
-             $timer->stop('Extracts');
-
-             $table_results[$n] = array (
-                    'weight' => $weight,
-                    'img_tag' => '<img border="0" src="'.WEIGHT_IMGSRC.'" width="'.ceil(WEIGHT_WIDTH*$weight/100).'" height="'.WEIGHT_HEIGHT.'" alt="" />',
-                    'page_link' => "<a class=\"phpdig\" href=\"".$url."\" onmousedown=\"return clickit(".$n.",'".$js_url."')\" target=\"".LINK_TARGET."\" >".$title."</a>",
-                    'limit_links' => phpdigMsg('limit_to')." ".$l_site.$l_path,
-                    'filesize' => sprintf('%.1f',(ereg_replace('.*_([0-9]+)$','\1',$content['md5']))/1024),
-                    'update_date' => ereg_replace('^([0-9]{4})([0-9]{2})([0-9]{2}).*',PHPDIG_DATE_FORMAT,$content['last_modified']),
-                    'complete_path' => $url,
-                    'link_title' => $title
-                    );
-
-             $table_results[$n]['text'] = '';
-             if (DISPLAY_SUMMARY) {
-                 $table_results[$n]['text'] = htmlspecialchars(phpdigHighlight($reg_strings,preg_replace("/([ ]{2,}|\n|\r|\r\n)/"," ",ereg_replace('(@@@.*)','',wordwrap($text, SUMMARY_DISPLAY_LENGTH, '@@@')))),ENT_QUOTES);
-                 $table_results[$n]['text'] = phpdigSpanReplace($table_results[$n]['text']);
-             }
-             if (DISPLAY_SUMMARY && DISPLAY_SNIPPETS) {
-                 $table_results[$n]['text'] .= "\n<br/><br/>\n";
-             }
-             if (DISPLAY_SNIPPETS) {
-                 if ($extract) {
-                     $extract = htmlspecialchars($extract,ENT_QUOTES);
-                     $extract = phpdigSpanReplace($extract);
-                     $table_results[$n]['text'] .= $extract;
-                 }
-                 else if (!$table_results[$n]['text']){
-                     $table_results[$n]['text'] = htmlspecialchars(phpdigHighlight($reg_strings,preg_replace("/([ ]{2,}|\n|\r|\r\n)/"," ",ereg_replace('(@@@.*)','',wordwrap($text, SUMMARY_DISPLAY_LENGTH, '@@@')))),ENT_QUOTES);
-                     $table_results[$n]['text'] = phpdigSpanReplace($table_results[$n]['text']);
-                 }
-             }
-        }
-    }
-
-    $timer->stop('Result table');
-    $timer->start('Final strings');
-
-    $url_bar = SEARCH_PAGE."?template_demo=$template_demo&amp;browse=1&amp;query_string=".urlencode($my_query_string_link)."$refine_url&amp;limite=$limite&amp;option=$option&amp;lim_start=";
-
-    if ($lim_start > 0) {
-        $previous_link = $url_bar.($lim_start-$limite);
-        $nav_bar .= "<a class=\"phpdig\" href=\"$previous_link\" >&lt;&lt;".phpdigMsg('previous')."</a>&nbsp;&nbsp;&nbsp; \n";
-    }
-    $tot_pages = ceil($num_tot/$limite);
-    $actual_page = $lim_start/$limite + 1;
-    $page_inf = max(1,$actual_page - 5);
-    $page_sup = min($tot_pages,max($actual_page+5,10));
-    for ($page = $page_inf; $page <= $page_sup; $page++) {
-      if ($page == $actual_page) {
-           $nav_bar .= " <span class=\"phpdigHighlight\">$page</span> \n";
-           $pages_bar .= " <span class=\"phpdigHighlight\">$page</span> \n";
-           $link_actual =  $url_bar.(($page-1)*$limite);
-      }
-      else {
-          $nav_bar .= " <a class=\"phpdig\" href=\"".$url_bar.(($page-1)*$limite)."\" >$page</a> \n";
-          $pages_bar .= " <a class=\"phpdig\" href=\"".$url_bar.(($page-1)*$limite)."\" >$page</a> \n";
-      }
-    }
-
-    if ($more_results == 1) {
-        $next_link = $url_bar.($lim_start+$limite);
-        $nav_bar .= " &nbsp;&nbsp;&nbsp;<a class=\"phpdig\" href=\"$next_link\" >".phpdigMsg('next')."&gt;&gt;</a>\n";
-    }
-
-    $mtime = explode(' ',microtime());
-    $search_time = sprintf('%01.2f',$mtime[0]+$mtime[1]-$start_time);
-    $result_message = stripslashes(ucfirst(phpdigMsg('results'))." $n_start-$n_end, $num_tot ".phpdigMsg('total').", ".phpdigMsg('on')." \"".htmlspecialchars($query_string,ENT_QUOTES)."\" ($search_time ".phpdigMsg('seconds').")");
-
-    $timer->stop('Final strings');
-}
-else {
-    if (is_array($strings)) {
-        $strings = array_values($strings);
-        $num_in_strings_arr = count($strings);
-    }
-    else { $num_in_strings_arr = 0; }
-    $leven_final = "";
-    $leven_sum = 0;
-    if (($num_in_strings_arr > 0) && (strlen($path) == 0)) {
-        for ($i=0; $i<$num_in_strings_arr; $i++) {
-            $soundex_query = "SELECT keyword FROM ".PHPDIG_DB_PREFIX."keywords WHERE SOUNDEX(CONCAT('Q',keyword)) = SOUNDEX(CONCAT('Q','".$strings[$i]."')) LIMIT 500";
-            $soundex_results = mysql_query($soundex_query,$id_connect);
-            if (mysql_num_rows($soundex_results) > 0) {
-                 $leven_ind = 0;
-                 $leven_amt1 = 256;
-                 $leven_keyword = array();
-                 while (list($soundex_keyword) = mysql_fetch_array($soundex_results)) {
-                     $leven_amt2 = min(levenshtein(stripslashes($strings[$i]),$soundex_keyword),$leven_amt1);
-                     if (($leven_amt2 < $leven_amt1) && ($leven_amt2 >= 0) && ($leven_amt2 <= 5)) {
-                         $leven_keyword[$leven_ind] = stripslashes($soundex_keyword);
-                         $leven_ind++;
-                     }
-                     $leven_amt1 = $leven_amt2;
-                 }
-                $leven_count = count($leven_keyword);
-                $leven_sum = $leven_sum + $leven_amt1;
-                if ($leven_count > 0) {
-                    $leven_final .= $leven_keyword[$leven_count-1] . " ";
-                }
-                if (isset($leven_keyword)) { unset($leven_keyword); }
-            }
-        }
-    }
-    $num_tot = 0;
-    $result_message = phpdigMsg('noresults');
-    if ((strlen(trim($leven_final)) > 0) && ($leven_sum > 0)) {
-        $leven_query = trim($leven_final);
-        $result_message .= ". " . phpdigMsg('alt_try') ." <a class=\"phpdigMessage\" href=\"".SEARCH_PAGE."?template_demo=$template_demo&amp;query_string=".urlencode($leven_query)."\"><i>".htmlspecialchars($leven_query,ENT_QUOTES)."</i></a>?";
-    }
-}
-
-if (isset($tempresult)) {
-    mysql_free_result($tempresult);
-}
-
-$title_message = phpdigMsg('s_results');
-}
-else {
-   $title_message = 'PhpDig '.PHPDIG_VERSION;
-   $result_message = phpdigMsg('no_query').'.';
-}
-
-$timer->start('Logs');
-if (PHPDIG_LOGS && !$browse && !$refine && $adlog_flag == 0) {
-   if (is_array($final_result)) {
-       phpdigAddLog ($id_connect,$option,$strings,$exclude,count($final_result),$search_time);
-   }
-   else {
-       phpdigAddLog ($id_connect,$option,$strings,$exclude,0,$search_time);
-   }
-}
-$timer->stop('Logs');
-
-$timer->start('Template parsing');
-
-$powered_by_link = "<font size=\"1\" face=\"verdana,arial,sans-serif\">";
-if (ALLOW_RSS_FEED) {
-  $powered_by_link .= "<a href=\"".$rssdf."\">".phpdigMsg('viewRSS')."</a><br>";
-}
-$powered_by_link .= "<a href=\"http://www.phpdig.net/\">".phpdigMsg('powered_by')."</a><br></font>";
-
-if (is_array($strings)) {
-   $js_string = implode(" ",$strings);
-} else {
-   $js_string = "";
-}
-$js_for_clicks = "
-<script type=\"text/javascript\">
-/* <![CDATA[ */
-function clickit(cn,clink) {
-  if(document.images) {
-     (new Image()).src=\"clickstats.php?num=\"+cn+\"&url=\"+clink+\"&val=".urlencode($js_string)."\";
-  }
-  return true;
-}
-/* ]]> */
-</script>
-";
-
-if ($template == 'array' || is_file($template)) {
-    $phpdig_version = PHPDIG_VERSION;
-    $t_mstrings = compact('js_for_clicks','powered_by_link','title_message','phpdig_version','result_message','nav_bar','ignore_message','ignore_commess','pages_bar','previous_link','next_link');
-    $t_fstrings = phpdigMakeForm($query_string,$option,$limite,SEARCH_PAGE,$site,$path,'template',$template_demo,$num_tot,$refine);
-    if ($template == 'array') {
-        return array_merge($t_mstrings,$t_fstrings,array('results'=>$table_results));
-    }
-    else {
-        $t_strings = array_merge($t_mstrings,$t_fstrings);
-        phpdigParseTemplate($template,$t_strings,$table_results);
-    }
-}
-else {
-?>
-<?php include $relative_script_path.'/libs/htmlheader.php' ?>
-<head>
-<title><?php print $title_message ?></title>
-<?php include $relative_script_path.'/libs/htmlmetas.php' ?>
-<style type="text/css">
-/*<![CDATA[*/
-.phpdigHighlight {color:<?php print HIGHLIGHT_COLOR ?>;
-                 background-color:<?php print HIGHLIGHT_BACKGROUND ?>;
-                 font-weight:bold;
-                 }
-.phpdigMessage {padding:1px;background-color:#002288;color:white;}
-/*]]>*/
-</style>
-<script type="text/javascript">
-/* <![CDATA[ */
-function clickit(cn,clink) {
-  if(document.images) {
-    (new Image()).src="clickstats.php?num="+cn+"&url="+clink+"&val=<?php echo urlencode($js_string); ?>";
-  }
-  return true;
-}
-/* ]]> */
-</script>
-</head>
-<body bgcolor="white">
-<div align="center">
-<img src="phpdig_logo_2.png" width="200" height="114" alt="phpdig <?php print PHPDIG_VERSION ?>" border="0" />
-<br />
-<?php
-phpdigMakeForm($query_string,$option,$limite,SEARCH_PAGE,$site,$path,'classic',$template_demo,$num_tot,$refine);
-?>
-<h3><span class="phpdigMsg"><?php print $result_message ?></span>
-<br /><span class="phpdigAlert"><?php print $ignore_message ?></span>
-<br /><span class="phpdigAlert"><?php print $ignore_commess ?></span>
-</h3>
-</div>
-<?php
-if (is_array($table_results)) {
-       while (list($n,$t_result) = each($table_results)) {
-             print "<p style='background-color:#CCDDFF;'>\n";
-             print "<b>$n. <font style='font-size:10;'>[".$t_result['weight']." %]</font>&nbsp;&nbsp;".$t_result['page_link']."</b>\n<br />\n";
-             print "<font style='font-size:10;background-color:#BBCCEE;'>".$t_result['limit_links']."</font>\n<br />\n";
-             print "</p>\n";
-             print "<blockquote style='background-color:#EEEEEE;font-size:10;'>\n";
-             print $t_result['text'];
-             print "</blockquote>\n";
-       }
-}
-print "<p style='text-align:center;background-color:#CCDDFF;font-weight:bold'>\n";
-print $nav_bar;
-print "</p>\n";
-?>
-<hr />
-<div align="center">
-<?php
-if ($query_string) {
-    phpdigMakeForm($query_string,$option,$limite,SEARCH_PAGE,$site,$path,'classic',$template_demo,$num_tot,$refine);
-}
-?>
-</div>
-<div align='center'>
-<a href='http://www.phpdig.net/' target='_blank'><img src='phpdig_powered_2.png' width='88' height='28' border='0' alt='Powered by PhpDig' /></a> &nbsp;
-</div>
-</body>
-</html>
-<?php
-}
-$timer->stop('Template parsing');
-$timer->stop('All display');
-$timer->stop('All');
-//$timer->display();
-}
-
-function phpdigSpanReplace($text) {
-$text = str_replace("&lt;br&gt;","<br>",$text);  // RH
-$text = str_replace("&lt;/span&gt;","</span>",$text);
-$text = str_replace("&lt;span class=&quot;phpdigHighlight&quot;&gt;","<span class=\"phpdigHighlight\">",$text);
-return $text;
-}
-
-function phpdigByLength($a, $b) {
-$len_a = strlen($a);
-$len_b = strlen($b);
-if ($len_a == $len_b) { return 0; }
-return ($len_a < $len_b) ? 1 : -1;
-}
-?>

+ 0 - 35
main/metadata/phpdig/update_db_to_1_8_6_from_1_8_3.sql

@@ -1,35 +0,0 @@
-# Update from the 1.8.3 version to the 1.8.6 version
-# Add the table prefix if needed
-# ---------------------------------
-ALTER TABLE sites ADD COLUMN stopped TINYINT(1) NOT NULL DEFAULT 0;
-ALTER TABLE site_page ADD COLUMN days INT(4) NOT NULL DEFAULT 0;
-ALTER TABLE site_page ADD COLUMN depth INT(4) NOT NULL DEFAULT 5;
-ALTER TABLE site_page CHANGE num_page links INT(4) NOT NULL DEFAULT 5;
-DROP TABLE sites_days_upd;
-ALTER TABLE spider CHANGE first_words first_words mediumtext NOT NULL;
-ALTER TABLE excludes DROP INDEX ex_id;
-ALTER TABLE includes DROP INDEX in_id;
-ALTER TABLE keywords DROP INDEX key_id;
-ALTER TABLE logs DROP INDEX l_id;
-ALTER TABLE sites DROP INDEX site_id;
-ALTER TABLE spider DROP INDEX spider_id;
-ALTER TABLE tempspider DROP INDEX id;
-
-# Upgrading PhpDig from 1.8.3 to 1.8.6 for VELODLA:
-#
-# - save a copy of includes/connect.php, config.php
-# - make the VELODLA/183phpdig directory inaccessible
-#
-# - restore the 1.8.6 backup to new directory VELODLA/phpdig-1.8.6
-# - replace phpdig-1.8.6/sql/update_db.sql by this file
-# - run VELODLA/phpdig-1.8.6/admin/install.php, select "Update existing database", 
-#   (provide the parameters from the old connect.php)
-# - adapt config.php (cfr. old config.php)
-#
-# - re-apply customizations: search.php, cprgo.gif, simpleplus.html
-#   function_phpdig_form.php, phpdig_functions.php, search_function.php
-#
-# - edit md_phpdig.php, line 37
-# - edit VELODLA homepage links (PhpDig admin, Search with PhpDig)
-
-# - change Metadata_for_Dokeos.html

+ 0 - 214
main/metadata/playscormmdset.inc.php

@@ -1,214 +0,0 @@
-<?php
-/**
- * Chamilo metadata/playscormmdset.inc.php
- * 2005/11/16
- * Copyright (C) 2005 rene.haentjens@UGent.be -  see metadata/md_funcs.php
- * @package chamilo.metadata
- */
-/**
- * Chamilo Metadata: include file for accessing Scorm metadata
- * This script is to be included from /coursedir/scorm/dir.../index.php,
- * after setting $scormid (Chamilo document root).
- */
-// PRELIMS -------------------------------------------------------------------->
-
-if (!isset($scormid)) exit();
-
-define('EID_TYPE', 'Scorm');
-define('BID', EID_TYPE . '.' . $scormid);
-getpar('SID', 'Scorm sub-id', '*');
-define('EID_ID', (SID == '*') ? $scormid : $scormid . '.' . SID);
-define('EID', EID_TYPE . '.' . EID_ID);
-getpar('LFN', 'LanguageFileName', 'md_' . strtolower(EID_TYPE));
-getpar('HTT', 'HTML Template Text filename', 'mdp_' . strtolower(EID_TYPE));
-getpar('WHF', 'With Header and Footer', '0');
-define('DBG', 0);  // for template debug info, set to e.g. 10000
-getpar('RNG', 'Slide range', '*');
-
-if (RNG == '*' || ($dotdot = strpos(RNG, '..')) === FALSE)
-    $id_range_first = $id_range_last = '';
-else
-{
-    $id_range_first = trim(substr(RNG, 0, $dotdot));
-    $id_range_last =  trim(substr(RNG, $dotdot + 2));
-}
-
-$urlp = '?dbg=' .                                              urlencode(DBG);
-if (LFN != 'md_' .  strtolower(EID_TYPE))   $urlp .= '&lfn=' . urlencode(LFN);
-if (HTT != 'mdp_' . strtolower(EID_TYPE))   $urlp .= '&lfn=' . urlencode(HTT);
-if (WHF != '0')                             $urlp .= '&whf=' . urlencode(WHF);
-if (RNG != '*')                             $urlp .= '&rng=' . urlencode(RNG);
-
-// name of the language file that needs to be included
-$language_file = LFN;
-require('../inc/global.inc.php');
-$nameTools = get_lang('Tool');
-
-require(api_get_path(SYS_CODE_PATH) . 'metadata/md_funcs.php');
-
-($nameTools && get_lang('Sorry'))
-    or give_up('Language file ' . LFN . " doesn't define 'Tool' and 'Sorry'");
-
-$_course = api_get_course_info(); isset($_course) or give_up(get_lang('Sorry'));
-
-require(api_get_path(LIBRARY_PATH) . 'xmd.lib.php');
-require(api_get_path(LIBRARY_PATH) . 'xht.lib.php');
-
-require(api_get_path(SYS_CODE_PATH) . 'metadata/md_' . strtolower(EID_TYPE) . '.php');
-$mdObj = new mdobject($_course, EID_ID);
-
-define('DR', $_SERVER['DOCUMENT_ROOT']);
-define('SELF', api_get_self());
-define('DIRECTORY', DR . $self = substr(SELF, 0, strrpos(SELF, '/')));
-if (!file_exists(DIRECTORY)) give_up('No such directory: ' . DIRECTORY);
-
-
-// TEMPLATES FILE ------------------------------------------------------------->
-
-$topdir = strtolower(realpath(DR));  // to stop search for .htt file
-
-if (strpos(strtolower(realpath(DIRECTORY)), $topdir) !== 0)
-    give_up('Invalid directory: ' . DIRECTORY);
-
-chdir(DIRECTORY);
-
-for ($i = 0; $i < 10; $i++)
-    if(!file_exists(HTT . '.htt'))
-        if (strtolower(realpath(getcwd())) == $topdir) {break;}
-        else chdir('..');
-
-
-// XML and DB STUFF ----------------------------------------------------------->
-
-$is_allowed_to_edit = isset($_user['user_id']) && $is_courseMember && api_is_allowed_to_edit();
-
-$mdStore = new mdstore($is_allowed_to_edit);
-
-if (($mdt_rec = $mdStore->mds_get(EID)) === FALSE)  // no record, default XML
-     $mdt = $mdObj->mdo_generate_default_xml_metadata();
-else $mdt = $mdt_rec;
-
-$xhtxmldoc = new xmddoc(explode("\n", $mdt));
-
-(!$xhtxmldoc->error) or give_up($xhtxmldoc->error);
-
-if (SID == $id_range_first &&
-        ($prv = $xhtxmldoc->xmd_select_single_element('previous')) != -1)
-    $xhtxmldoc->xmd_remove_element($prv);
-
-if (SID == $id_range_last &&
-        ($nxt = $xhtxmldoc->xmd_select_single_element('next')) != -1)
-    $xhtxmldoc->xmd_remove_element($nxt);
-
-$before_first = $id_range_first ? TRUE : FALSE; $after_last = FALSE;
-
-foreach ($xhtxmldoc->xmd_select_elements('child') as $chEl)
-{
-    $chId = $xhtxmldoc->attributes[$chEl]['identifier'];  // no get_att yet...
-
-    if ($after_last ||
-        ($before_first = $before_first && $chId != $id_range_first))
-    {
-        $xhtxmldoc->xmd_remove_element($chEl); continue;
-    }
-
-    if (($mdt_rec = $mdStore->mds_get(BID . '.' . $chId)) === FALSE)
-         $mdt = $mdObj->mdo_generate_default_xml_metadata();
-    else $mdt = $mdt_rec;
-
-    $xhtxmldocchild = new xmddoc(explode("\n", $mdt));
-
-    (!$xhtxmldocchild->error) or give_up($chId . ': ' . $xhtxmldocchild->error);
-
-    // make stuff below a parameter? copy some already in importmanifest?
-    $xhtxmldoc->xmd_copy_foreign_child($xhtxmldocchild,
-        $xhtxmldocchild->xmd_select_single_element('title'), $chEl);
-    $xhtxmldoc->xmd_copy_foreign_child($xhtxmldocchild,
-        $xhtxmldocchild->xmd_select_single_element('resource'), $chEl);
-
-    $after_last = $after_last || $chId == $id_range_last;
-}
-
-$xhtDoc = define_htt(HTT . '.htt', $urlp, $_course['path']);
-$xhtDoc->xht_xmldoc = $xhtxmldoc;
-
-$xhtDoc->xht_param['mdt'] = $xhtxmldoc->xmd_xml();
-
-
-// GENERATE OUTPUT ------------------------------------------------------------>
-
-foreach (explode("\n", $xhtDoc->htt_array['HTTP']) as $httpXtra)
-    if ($httpXtra) $httpHeadXtra[] = $httpXtra;
-
-$xhtDoc->xht_get_lang = 'get_lang';
-
-function resource_for($e) {return $e;}  // dummy, '=/' not used here
-$xhtDoc->xht_resource = 'resource_for';
-
-$htmlHeadXtra[] = $xhtDoc->xht_fill_template('HEAD');
-
-// $mdObj->mdo_add_breadcrump_nav();  // see 'md_' . EID_TYPE . '.php'
-$noPHP_SELF = TRUE;  // in breadcrumps
-
-if (WHF != '0') Display::display_header($nameTools);
-else
-{
-    header('Content-Type: text/html; charset='. $charset); $document_language = 'en';
-    if ( isset($httpHeadXtra) && $httpHeadXtra )
-    {
-    	foreach($httpHeadXtra as $thisHttpHead)
-    	{
-    		header($thisHttpHead);
-    	}
-    }
-    ?>
-    <!DOCTYPE html
-         PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
-         "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
-    <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="<?php echo $document_language; ?>" lang="<?php echo $document_language; ?>">
-    <head>
-    <title>Scorm package
-    </title>
-	<meta http-equiv="Content-Type" content="text/html; charset=<?php echo $charset; ?>">
-    <style type="text/css" media="screen, projection">
-    /*<![CDATA[*/
-    @import "<?php echo api_get_path(WEB_CODE_PATH); ?>css/default.css";
-    /*]]>*/
-    </style>
-    <?php
-    if ( isset($htmlHeadXtra) && $htmlHeadXtra )
-    {
-    	foreach($htmlHeadXtra as $this_html_head)
-    	{
-    		echo($this_html_head);
-    	}
-    }
-    ?>
-    </head>
-    <body dir="<?php echo $text_dir; ?>">
-    <!-- #outerframe container to control some general layout of all pages -->
-    <div id="outerframe">
-    <?php
-}
-
-echo "\n";
-
-$xhtDoc->xht_dbgn = DBG;  // for template debug info, set to e.g. 10000
-if (($ti = $xhtDoc->xht_param['traceinfo'])) $xhtDoc->xht_param['traceinfo'] =
-    '<h5>Trace information</h5>' . htmlspecialchars($ti, ENT_QUOTES, $charset);
-
-echo $xhtDoc->xht_fill_template('METADATA'), "\n";
-
-if ($xhtDoc->xht_dbgn) echo $xhtDoc->xht_dbgo;
-
-if (WHF != '0')
-{
-    Display::display_footer();
-    exit;
-}
-
-?>
-    <div class="clear">&nbsp;</div> <!-- 'clearing' div to make sure that footer stays below the main and right column sections -->
-    </div> <!-- end of #outerframe opened in header.inc.php -->
-    </body>
-    </html>

+ 0 - 149
main/metadata/search.php

@@ -1,149 +0,0 @@
-<?php
-/* See license terms in /license.txt */
-/**
- * Chamilo metadata/search.php
- * 2005/09/20
- * @copyright 2005 rene.haentjens@UGent.be -  see metadata/md_funcs.php
- * @package chamilo.metadata
- */
-/**
- *	Chamilo Metadata: search Chamilo course objects via their metadata
- *   URL parameters:
- *   - type= type, must be 'Mix' (currently: Document + Scorm + Link)
- *   - lfn=  filename of a language file, e.g. 'md_doc', default= 'md_' + type;
- *   - htt=  HTML template file (same dir as script), default= 'mds_' + type.
- */
-// PRELIMS -------------------------------------------------------------------->
-require("md_funcs.php");
-getpar('TYPE', 'e.g. Mix', 'Mix');  // note: only 'Mix' is currently working
-require('md_' . strtolower(TYPE) . '.php');
-getpar('LFN', 'LanguageFileName', 'md_' . strtolower(TYPE));
-getpar('HTT', 'HTML Template Text filename', 'mds_' . strtolower(TYPE));
-getpar('DBG', 'Debug number', '0');  // set to e.g. 10000 for debuginfo
-$urlp =                                           '?type='. urlencode(TYPE);
-if (LFN != 'md_' . strtolower(TYPE))     $urlp .= '&lfn=' . urlencode(LFN);
-if (HTT != 'mds_' . strtolower(TYPE))    $urlp .= '&htt=' . urlencode(HTT);
-if (DBG)                     $urlp .= '&dbg=' . urlencode(DBG);
-
-// name of the language file that needs to be included
-$language_file = LFN; require("../inc/global.inc.php");
-$this_section=SECTION_COURSES;
-
-$nameTools = get_lang('Tool');
-
-($nameTools && get_lang('Sorry'))
-    or give_up('Language file ' . LFN . " doesn't define 'Tool' and 'Sorry'");
-
-$_course = api_get_course_info(); isset($_course) or give_up(get_lang('Sorry'));
-
-require(api_get_path(LIBRARY_PATH) . 'xmd.lib.php');
-require(api_get_path(LIBRARY_PATH) . 'xht.lib.php');
-
-$xhtDoc = define_htt(HTT . '.htt', $urlp, $_course['path']);
-
-$xhtDoc->xht_param['type'] = TYPE;
-
-$xhtDoc->xht_param['index'] =
-    str_replace('/search.php', '/index.php', api_get_self());
-
-
-// XML and DB STUFF ----------------------------------------------------------->
-
-$mdStore = new mdstore(FALSE);  // no create DB table from search
-
-$xhtDoc->xht_get_lang = 'get_lang'; $xhtDoc->xht_xmldoc = new xmddoc('');
-if ($xhtDoc->xht_xmldoc->error) give_up($xhtDoc->xht_xmldoc->error);
-
-($mdt = $xhtDoc->xht_fill_template('DEFAULT'.TYPE))
-    or give_up('No template DEFAULT' . TYPE);
-
-$xhtDoc->xht_xmldoc = new xmddoc(explode("\n", $mdt));
-if ($xhtDoc->xht_xmldoc->error) give_up($xhtDoc->xht_xmldoc->error);
-
-$xmlDoc = new xmddoc(''); if ($xmlDoc->error) give_up($xmlDoc->error);
-
-if (isset($_POST['mdsc']))  // Search criteria
-{
-    $mdsc = str_replace("\r", "\n", str_replace("\r\n", "\n",
-        get_magic_quotes_gpc() ? stripslashes($_POST['mdsc']) : $_POST['mdsc']));
-
-    foreach (explode("\n", $mdsc) as $word) if (($word = trim($word)))
-    {
-        $words .= ", " . $word;
-
-        $where .= " AND indexabletext " . ($word{0} != '-' ?
-             ("LIKE '%".addslashes($word)."%'") :
-             ("NOT LIKE '%".addslashes(substr($word, 1))."%'"));
-    }
-
-    if ($where)
-    {
-        $whereclause = substr($where, 5);  // remove first " AND "
-
-        $xhtDoc->xht_xmldoc->xmd_add_text_element('query', $whereclause);
-        $xhtDoc->xht_param['traceinfo'] = substr($words, 2);
-
-        $result = $mdStore->mds_get_many('eid,mdxmltext', $whereclause);
-
-        while (($myrow = @Database::fetch_array($result)))
-        {
-            // not quite a real manifest, but very much like one...
-
-            $eid = $myrow['eid']; $xmlDoc = new xmddoc($myrow['mdxmltext']);
-            if ($xmlDoc->error) give_up('Entry '.$eid . ': ' . $xmlDoc->error);
-
-            $mdObj = new mdobject($_course, $eid);  // md_mix.php
-
-            $xhtDoc->xht_xmldoc->xmd_copy_foreign_child($xmlDoc);
-            $newItem = $xhtDoc->xht_xmldoc->
-                xmd_select_single_element('item[-1]');
-            $xhtDoc->xht_xmldoc->xmd_set_attribute($newItem, 'eid', $eid);
-            $xhtDoc->xht_xmldoc->xmd_set_attribute($newItem, 'url',
-                $mdObj->mdo_url);
-
-            if ($mdObj->mdo_type == 'Scorm')
-                $xhtDoc->xht_xmldoc->xmd_set_attribute($newItem, 'brl',
-                    $mdObj->mdo_base_url);
-        }
-    }
-}
-
-
-function check_is_thumb($p)  // escape function, see mds_mix.htt
-{
-    global $xhtDoc; if ($p !== FALSE) return '';  // should not happen
-
-    if (!ereg('^pptsl[0-9]+_t\.jpg$', $xhtDoc->xht_param['thumb']))
-        $xhtDoc->xht_param['thumb'] = '';
-
-    return '';
-}
-
-
-// GENERATE OUTPUT ------------------------------------------------------------>
-
-foreach (explode("\n", $xhtDoc->htt_array['HTTP']) as $httpXtra)
-    if ($httpXtra) $httpHeadXtra[] = $httpXtra;
-
-$xhtDoc->xht_get_lang = 'get_lang';
-
-function resource_for($e) {return $e;}  // dummy, '=/' not used here
-$xhtDoc->xht_resource = 'resource_for';
-
-$xhtDoc->xht_param['kwdswere_string'] = $_POST['kwdswere_string'];
-$htmlHeadXtra[] = $xhtDoc->xht_fill_template('HEAD');
-
-// $noPHP_SELF = TRUE;  // in breadcrumps
-
-Display::display_header($nameTools);
-
-$xhtDoc->xht_dbgn = DBG;  // for template debug info, set to e.g. 10000
-if (($ti = $xhtDoc->xht_param['traceinfo'])) $xhtDoc->xht_param['traceinfo'] =
-    '<b>' . get_lang('Search') . '</b>: ' . htmlspecialchars($ti, ENT_QUOTES, $charset);
-
-echo $xhtDoc->xht_fill_template('MDSEARCH'), "\n";
-
-if ($xhtDoc->xht_dbgn) echo $xhtDoc->xht_dbgo;
-
-Display::display_footer();
-?>

+ 0 - 135
main/metadata/statistics.php

@@ -1,135 +0,0 @@
-<?php 
-/**
- * Chamilo metadata/statistics.php
- * 2005/02/02
- * @copyright 2005 rene.haentjens@UGent.be -  see metadata/md_funcs.php
- * @package chamilo.metadata
- */
-/**
- *	Chamilo Metadata: statistics about metadata
- */
-// PRELIMS -------------------------------------------------------------------->
-
-require('md_funcs.php');
-
-define('EID_TYPE', 'Mix');
-require('md_' . strtolower(EID_TYPE) . '.php');
-
-// name of the language file that needs to be included
-$language_file = 'md_mix';
-include('../inc/global.inc.php');
-$this_section=SECTION_COURSES;
-
-$nameTools = get_lang('Tool');
-
-($nameTools && get_lang('Sorry')) or give_up(
-    'Language file ' . $language_file . " doesn't define 'Tool' and 'Sorry'");
-
-$_course = api_get_course_info(); isset($_course) or give_up(get_lang('Sorry'));
-
-$is_allowed_to_edit = isset($_user['user_id']) && $is_courseMember && api_is_allowed_to_edit();
-if (!$is_allowed_to_edit) give_up(get_lang('Denied'));
-
-$mdStore = new mdstore(FALSE);  // no create from statistics
-
-require(api_get_path(LIBRARY_PATH) . 'xmd.lib.php');
-require(api_get_path(LIBRARY_PATH) . 'xht.lib.php');
-
-$htmldecode = array_flip(get_html_translation_table(HTML_SPECIALCHARS));
-
-
-// STATISTICS ----------------------------------------------------------------->
-
-$noPHP_SELF = TRUE;  // in breadcrumps
-Display::display_header($nameTools);
-
-echo '<h3>', get_lang('Statistics'), '</h3>', "\n";
-
-$ckw = $_course['path'] . '/CourseKwds.js';
-define('KEYWORDS_CACHE', get_course_path() . $ckw);
-
-if (!file_exists(KEYWORDS_CACHE))
-{
-    echo get_lang('NoKeywords');
-    Display::display_footer();
-    exit();
-}
-
-if (!($myFile = @fopen(KEYWORDS_CACHE, 'r')))
-{
-    echo get_lang('KwCacheProblem');
-    Display::display_footer();
-    exit();
-}
-
-$kwds = array(); $kwcnt = array(); $kwrefs = array();
-
-while (($kwline = fgets($myFile)))
-{
-    if (ereg('�>(.+)<�', $kwline, $regs) || ereg('">(.+)<�', $kwline, $regs))
-        foreach (explode(',', $regs[1]) as $kw)
-            if (!in_array($kw = strtr(trim($kw), $htmldecode), $kwds))
-                $kwds []= $kw;
-}
-fclose($myFile);
-
-$result = $mdStore->mds_get_many('eid,mdxmltext', '1 = 1');
-echo get_lang('TotalMDEs'), Database::num_rows($result), "<br>\n";
-
-echo count($kwds), ' ', get_lang('CourseKwds'), '<br>', "\n";
-
-while ($row = Database::fetch_array($result))
-{
-    $eid = $row['eid']; $curr = ''; $xmltext = $row['mdxmltext']; $offset = 0;
-
-    if (substr($eid, 0, 6) == 'Scorm.')
-        if (($dotpos = strpos($eid, '.', 6)) && $dotpos + 1 < strlen($eid))
-            $curr = substr($eid, 0, $dotpos);
-
-    while (($start = strpos($xmltext, '<keyword>', $offset)))
-        if (($start = strpos($xmltext, '">', $start + 9)))
-        {
-            if (($stop = strpos($xmltext, '</', $start += 2)) && $stop > $start)
-            {
-                $kw = strtr(substr($xmltext, $start, $stop-$start), $htmldecode);
-                if (!in_array($kw, $kwds))
-                {
-                    if (!in_array($kw = '!' . $kw, $kwds)) $kwds []= $kw;
-                    $kwrefs[$kw] .= ' ' . ($curr ?
-                        (strpos($kwrefs[$kw], $curr) ?
-                            substr($eid, $dotpos+1) : $eid) : $eid);
-                }
-                $kwcnt[$kw] ++;  // = $kwcnt[$kw] ? $kwcnt[$kw] + 1 : 1;
-                $offset = $stop + 19;
-            }
-            else $offset = $start + 2;
-            // <keyword><string language="en">lecture</string></keyword>
-        }
-        else $offset = $start + 9;
-
-    // xmd would be nicer but this is faster...
-}
-
-echo count($kwds), ' ', get_lang('KwdsInMD'), '<br>'; sort($kwds);
-
-$total = 0; foreach ($kwcnt as $kw => $cnt) $total += $cnt;
-echo $total, ' ', get_lang('KwdRefs'), "\n";
-
-echo '<h4>', get_lang('NonCourseKwds'), '</h4>', "\n";
-
-foreach ($kwds as $kw)
-    if ($kw{0} == '!')
-        echo '<b>', htmlspecialchars(api_substr($kw, 1), ENT_QUOTES, $charset), '</b>: ', $kwcnt[$kw],
-            ': <i>', htmlspecialchars($kwrefs[$kw], ENT_QUOTES, $charset), ";</i> \n";
-    else break;
-
-echo '<h4>', get_lang('KwdsUse'), '</h4>', "\n";
-
-foreach ($kwds as $kw)
-    if ($kw{0} != '!')
-        if (!$kwcnt[$kw])
-            echo '<b>', htmlspecialchars($kw, ENT_QUOTES, $charset), "</b>; \n";
-        else echo htmlspecialchars($kw, ENT_QUOTES, $charset), ': ', $kwcnt[$kw], "; \n";
-
-Display::display_footer();
-?>

+ 0 - 69
main/metadata/update_indexabletext.php

@@ -1,69 +0,0 @@
-<?php
-/**
- * Chamilo metadata/udate_indexableText.php
- * 2005/03/16
- * @copyright 2005 rene.haentjens@UGent.be -  see metadata/md_funcs.php
- * @package chamilo.metadata
- */
-/**
- * Chamilo Metadata: update indexabletext for all eid_type records
- */
-// PRELIMS -------------------------------------------------------------------->
-
-require('md_funcs.php');
-
-getpar('EID_TYPE', 'Entry Type');  // e.g. 'Document' or 'Scorm'
-define('TPLEN', strlen(EID_TYPE) + 1);
-
-require('md_' . strtolower(EID_TYPE) . '.php');
-
-// name of the language file that needs to be included
-$language_file = 'md_' . strtolower(EID_TYPE);
-include('../inc/global.inc.php');
-$this_section=SECTION_COURSES;
-
-$nameTools = get_lang('Tool');
-
-($nameTools && get_lang('Sorry')) or give_up(
-    'Language file ' . $language_file . " doesn't define 'Tool' and 'Sorry'");
-
-$_course = api_get_course_info(); isset($_course) or give_up(get_lang('Sorry'));
-
-$is_allowed_to_edit = isset($_user['user_id']) && $is_courseMember && api_is_allowed_to_edit();
-if (!$is_allowed_to_edit) give_up(get_lang('Denied'));
-
-$mdStore = new mdstore($is_allowed_to_edit);  // create table if needed
-$mdObj = new mdobject($_course, 0);
-
-require(api_get_path(LIBRARY_PATH) . 'xmd.lib.php');
-require(api_get_path(LIBRARY_PATH) . 'xht.lib.php');
-
-$xhtDoc = $mdObj->mdo_define_htt();
-
-$mdObj->mdo_add_breadcrump_nav();  // see 'md_' . EID_TYPE . '.php'
-Display::display_header($nameTools);
-
-// OPERATIONS ----------------------------------------------------------------->
-
-echo '<h3>', htmlspecialchars(EID_TYPE, ENT_QUOTES, $charset), '</h3>', "\n";
-
-$result = $mdStore->mds_get_many('eid,mdxmltext', "eid LIKE '" . EID_TYPE . ".%'");
-echo get_lang('TotalMDEs'), $total = Database::num_rows($result), "<br><br>\n";
-
-if ($total > 100) set_time_limit((int) ($total / 10));
-
-while ($row = Database::fetch_array($result))
-{
-    $eid = $row['eid']; $xmltext = $row['mdxmltext'];
-    $xhtDoc->xht_xmldoc = new xmddoc(explode("\n", $xmltext));
-
-    $mdStore->mds_put($eid,
-        $xhtDoc->xht_fill_template('INDEXABLETEXT'), 'indexabletext');
-
-    echo htmlspecialchars($eid, ENT_QUOTES, $charset), ' ';
-}
-
-echo '<h5>', htmlspecialchars(EID_TYPE, ENT_QUOTES, $charset), '</h5>', "\n";
-
-Display::display_footer();
-?>

+ 3 - 3
main/newscorm/learnpath_functions.inc.php

@@ -2072,7 +2072,7 @@ function createimsmanifest($circle1_files, $learnpath_id)
     $tbl_learnpath_item = Database :: get_course_table(TABLE_LEARNPATH_ITEM);
     $tbl_learnpath_chapter = Database :: get_course_table(TABLE_LEARNPATH_CHAPTER);
 
-    include_once '../metadata/md_funcs.php'; // RH: export metadata
+    //include_once '../metadata/md_funcs.php'; // RH: export metadata
 
     // Header
     // Charset should be dependent on content.
@@ -2181,12 +2181,12 @@ function createimsmanifest($circle1_files, $learnpath_id)
             $org .= '    '.xmltagwrite('item', 'close');
         }
 
-        $mds = new mdstore(true); // RH: export metadata; if no table, create it
+        /*$mds = new mdstore(true); // RH: export metadata; if no table, create it
         if (($mdt = $mds->mds_get($row['item_type'].'.'.$row['item_id']))) {
             if (($mdo = api_strpos($mdt, '<metadata>')) && ($mdc = api_strpos($mdt, '</metadata>'))) {
                 $org .= '    '.api_substr($mdt, $mdo, $mdc - $mdo + 11)."\n";
             }
-        }
+        }*/
 
         $org .= '    '.xmltagwrite('item', 'close');
         $i++;