public function displayPageMain()
 {
     $res = '';
     $res .= "<tr>";
     $res .= "<td class='head'>Name (*)</td>";
     $res .= "<td>";
     $value = $this->getValue('name', '');
     if (empty($value)) {
         $res .= "<span id='status_source_name_error'><img src='images/error_12.png'>&nbsp;Provide source name is mandatory !<br></span><span id='status_source_name_ok' style='display: none'><img src='images/ok_12.png'>&nbsp;</span>";
     } else {
         $res .= "<span id='status_source_name_error' style='display: none'><img src='images/error_12.png'>&nbsp;Provide source name is mandatory !<br></span><span id='status_source_name_ok'><img src='images/ok_12.png'>&nbsp;</span>";
     }
     $res .= "<input class='editInputText' type='text' name='source_name' id='source_name' value='" . encodeForInput($this->getValue('name', '')) . "'  onBlur='checkParameter(\"source_name\");'></td>";
     $res .= "</tr>";
     /*
      		$res .= "<tr>";
      		$res .= "<td class='head'>Token access (*)</td>";
      		$res .= "<td>";
     		
     		$token_key = $this->getValue('token_key', '');
     		$token_secret = $this->getValue('token_secret', '');
     		if (empty($token_key) || empty($token_secret)) {
     			$res .= "<span id='status_token_access_error'><img src='images/error_12.png'>&nbsp;Request Dropbox access is mandatory !<br></span><span id='status_token_access_ok' style='display: none'><img src='images/ok_12.png'>&nbsp;</span>";
     			$res .= "<br><span style='color:red'>During this step, a popup window should open. It is possible that your browser requests a confirmation or blocks this popup.</span>";
     		}
     		else {
     			$res .= "<span id='status_token_access_error' style='display: none'><img src='images/error_12.png'>&nbsp;Request Dropbox access is mandatory !<br></span><span id='status_token_access_ok'><img src='images/ok_12.png'>&nbsp;</span>";
     		}
     		$res .= "<br>1) <input type='button' value='Request Dropbox access' onClick='requestDropBoxAccess();'>&nbsp;<span id='status_dropbox_step1_status'></span>";
     		$res .= "&nbsp;<span class='help'>The Dropbox <strong>API Request Authorization</strong> page was opened. Click the <strong>Allow</strong> button !</span>";
     		$res .= "<br>2) <input type='button' value='Confirm Dropbox access was validated' onClick='requestDropBoxAccessToken();'>&nbsp;<span id='status_dropbox_step3_status'></span>";
     	
     		$res .= "<input class='editInputText' type='hidden' name='dropboxurl' id='dropboxurl' value=''>";
     		$res .= "<input class='editInputText' type='hidden' name='dropboxtimestamp' id='dropboxtimestamp' value=''>";
     		$res .= "<input class='editInputText' type='hidden' name='token_key' id='token_key' value='" . encodeForInput($this->getValue('token_key', '')) . "'>";
     		$res .= "<input class='editInputText' type='hidden' name='token_secret' id='token_secret' value='" . encodeForInput($this->getValue('token_secret', '')) . "'>";
     		$res .= "</td></tr>";
     */
     $res .= "<tr>";
     $res .= "<td class='head'>Status</td>";
     $res .= "<td>";
     $res .= "<select id='source_enabled' name='source_enabled' style='editInputSelect'>";
     $res .= "<option value='1'";
     if ($this->getValue('enabled', '') == "1") {
         $res .= " selected";
     }
     $res .= ">Enabled</option>";
     $res .= "<option value='0'";
     if ($this->getValue('enabled', '') == "0") {
         $res .= " selected";
     }
     $res .= ">Disabled</option>";
     $res .= "<option value='2'";
     if ($this->getValue('enabled', '') == "2") {
         $res .= " selected";
     }
     $res .= ">Test</option>";
     $res .= "</select>";
     $res .= "</td>";
     $res .= "</tr>";
     $target = $this->getValue('id_target', '');
     if (!$_SESSION["mysolrserver_url"]) {
         $aTargets = getAvailableTargets($this->config, $this->id_account_current);
         if ($aTargets != null) {
             $res .= "<tr>";
             $res .= "<td class='head'>Target</td>";
             $res .= "<td>";
             $res .= "<select id='id_target' name='id_target' style='editInputSelect'>";
             foreach ($aTargets as $key => $value) {
                 $res .= "<option value='" . $key . "'";
                 if (!empty($target) && $target == strtolower(trim($key))) {
                     $res .= " selected";
                 }
                 $res .= ">" . $value . "</option>";
             }
             $res .= "</select>";
             $res .= "</td>";
             $res .= "</tr>";
         }
     } else {
         if (empty($target)) {
             mg_get_value($this->mg, "accounts", "id_target", array("id" => intval($this->id_account_current)), $defaultTargetId);
             $target = $defaultTargetId;
         }
         $res .= "<input type='hidden' id='id_target' name='id_target' value='" . $target . "'>";
     }
     $res .= "<tr>";
     $res .= "<td class='head'>File formats</td>";
     $res .= "<td>";
     $mt = $this->getValue('mimetype', '');
     if (!empty($mt)) {
         $mt = explode(',', $this->getValue('mimetype', ''));
     }
     $res2 = '';
     foreach ($this->mime_type as $type) {
         if ($res2 != '') {
             $res2 .= '<br />';
         }
         $res2 .= "<input type='checkbox' name='mimetype[]' id='mimetype' value='" . $type['value'] . "' " . (in_array($type['value'], $mt) || empty($mt) ? " checked='checked'" : "") . "> " . $type['label'];
     }
     $res .= $res2;
     $res .= "</td>";
     $res .= "</tr>";
     $res .= "<tr>";
     $res .= "<td class='head'>Collections</td>";
     $res .= "<td><input class='editInputText' type='text' name='source_collection' id='source_collection' value='" . str_replace("_", " ", $this->getValue('collection', '')) . "'>";
     $aCollections = getAvailableTagsCollections($this->config, false, $this->id_account_current, "collection");
     if ($aCollections != null) {
         $res .= "<br />";
         for ($j = 0; $j <= count($aCollections); $j++) {
             if ($aCollections[$j] != "") {
                 $aCollections[$j] = str_replace("_", " ", $aCollections[$j]);
                 $res .= "<a href='javascript:void(0)' onClick='addCollection(\"" . $aCollections[$j] . "\");'><span class='nobr'><img id='collection_" . $aCollections[$j] . "' src='images/plus_12.png'>&nbsp;<label for='tag_" . $aCollections[$j] . "'>" . $aCollections[$j] . "</label></a>&nbsp;&nbsp;</span> ";
             }
         }
     }
     $res .= "<br/><span class='help'>Use comma as separator.</span></td>";
     $res .= "</tr>";
     $res .= "<tr>";
     $res .= "<td class='head'>Tags</td>";
     $res .= "<td><input class='editInputText' type='text' name='source_tag' id='source_tag' value='" . encodeForInput(str_replace("_", " ", $this->getValue('tag', ''))) . "'>";
     $aTags = getAvailableTagsCollections($this->config, false, $this->id_account_current, "tag");
     if ($aTags != null) {
         $res .= "<br />";
         for ($j = 0; $j <= count($aTags); $j++) {
             if ($aTags[$j] != "") {
                 $aTags[$j] = str_replace("_", " ", $aTags[$j]);
                 $res .= "<a href='javascript:void(0)' onClick='addTag(\"" . $aTags[$j] . "\");'><span class='nobr'><img id='tag_" . $aTags[$j] . "' src='images/plus_12.png'>&nbsp;<label for='tag_" . $aTags[$j] . "'>" . $aTags[$j] . "</label></a>&nbsp;&nbsp;</span> ";
             }
         }
     }
     $res .= "<br/><span class='help'>Use comma as separator.<br>These tags will be associated with crawled pages if they are contained in pages.</span></td>";
     $res .= "</tr>";
     $res .= "<tr>";
     $res .= "<td class='head'>Country</td>";
     $res .= "<td>";
     $res .= "<select id='source_country' name='source_country' style='editInputSelect'>";
     $country = strtolower($this->getValue('country', ''));
     foreach ($this->aCountries as $key => $value) {
         $res .= "<option value='" . $key . "'";
         if ($country == strtolower(trim($key))) {
             $res .= " selected";
         }
         $res .= ">" . $value . "</option>";
     }
     $res .= "</select>";
     $res .= "</td>";
     $res .= "</tr>";
     $res .= "<tr>";
     $res .= "<td class='head'>Main language</td>";
     $res .= "<td>";
     $res .= "<select id='source_language' name='source_language' style='editInputSelect' onChange='showLanguageRestrictionList();'>";
     $language = strtolower($this->getValue('language', ''));
     foreach ($this->aLanguages as $key => $value) {
         $res .= "<option value='" . $key . "'";
         if ($language == strtolower(trim($key))) {
             $res .= " selected";
         }
         $res .= ">" . $value . "</option>";
     }
     $res .= "</select>";
     $res .= "<div id='language_detection_list' name='language_detection_list'";
     if (strtolower(trim($this->getValue('language', ''))) == "xx" || $this->data == null) {
         $res .= " style='display:block'";
     } else {
         $res .= " style='display:none'";
     }
     $res .= ">Limit detection to this languages list (<a href='http://en.wikipedia.org/wiki/List_of_ISO_639-1_codes' target='_blank'>ISO 639-1 codes</a> separated by \",\")&nbsp;<input class='editInputTextMedium' type='text' name='source_language_detection_list' id='source_language_detection_list' value='" . $this->getValue('language_detection_list', '') . "'></div>";
     $res .= "</td>";
     $res .= "</tr>";
     return $res;
 }
Пример #2
0
            if ($aTags[$j] != "") {
                $ret .= "<tag>" . $aTags[$j] . "</tag>";
            }
        }
        $ret .= "</tags>";
    }
    $ret .= "</result>";
    header('Content-type: text/xml');
    echo $ret;
    exit;
}
//TODO: V4
if ($action == "get_available_collections") {
    $ret = "<?xml version=\"1.0\" encoding=\"utf-8\"?><result>";
    $ret .= "<status>ok</status>";
    $aCollections = getAvailableTagsCollections($config, true, $id, 'collection');
    if ($aCollections != null) {
        $ret .= "<collections>";
        for ($j = 0; $j <= count($aCollections); $j++) {
            if ($aCollections[$j] != "") {
                $ret .= "<collection>" . $aCollections[$j] . "</collection>";
            }
        }
        $ret .= "</collections>";
    }
    $ret .= "</result>";
    header('Content-type: text/xml');
    echo $ret;
    exit;
}
//TODO: V4
     $res2 .= "Show only sources within this collection</td><td><select id='filter_collection' name='filter_collection' style='editInputSelect' onChange='loadSources(\"" . $start . "\", 1);'>";
     $res2 .= "<option value=''>any</option>";
     for ($j = 0; $j <= count($aCollections); $j++) {
         if ($aCollections[$j] != "") {
             //$s1 = $aCollections[$j];
             //$s2 = htmlspecialchars($aCollections[$j], ENT_QUOTES);
             $res2 .= "<option value='" . htmlspecialchars($aCollections[$j], ENT_QUOTES) . "'";
             if (stripslashes($filter_collection) == $aCollections[$j]) {
                 $res2 .= " selected";
             }
             $res2 .= ">" . str_replace("_", " ", $aCollections[$j]) . "</option>";
         }
     }
     $res2 .= "</select></td></tr>";
 }
 $aTags = getAvailableTagsCollections($config, false, $id_account_current, "tag");
 if ($aTags != null && count($aTags) > 0) {
     $res2 .= "<tr><td>";
     $res2 .= "Show only sources with this tag</td><td><select id='filter_tag' name='filter_tag' style='editInputSelect' onChange='loadSources(\"" . $start . "\", 1);'>";
     $res2 .= "<option value=''>any</option>";
     for ($j = 0; $j <= count($aTags); $j++) {
         if ($aTags[$j] != "") {
             $res2 .= "<option value='" . htmlspecialchars($aTags[$j], ENT_QUOTES) . "'";
             if (stripslashes($filter_tag) == $aTags[$j]) {
                 $res2 .= " selected";
             }
             $res2 .= ">" . str_replace("_", " ", $aTags[$j]) . "</option>";
         }
     }
     $res2 .= "</select></td></tr>";
 }
 public function displayPageMain()
 {
     $res = '';
     $res .= "<tr>";
     $res .= "<td class='head'>Name (*)</td>";
     $res .= "<td>";
     $value = $this->getValue('name', '');
     if (empty($value)) {
         $res .= "<span id='status_source_name_error'><img src='images/error_12.png'>&nbsp;Provide source name is mandatory !<br></span><span id='status_source_name_ok' style='display: none'><img src='images/ok_12.png'>&nbsp;</span>";
     } else {
         $res .= "<span id='status_source_name_error' style='display: none'><img src='images/error_12.png'>&nbsp;Provide source name is mandatory !<br></span><span id='status_source_name_ok'><img src='images/ok_12.png'>&nbsp;</span>";
     }
     $res .= "<input class='editInputText' type='text' name='source_name' id='source_name' value='" . fi($this->getValue('name', '')) . "'  onBlur='checkParameter(\"source_name\");'></td>";
     $res .= "</tr>";
     $res .= "<tr>";
     $res .= "<td class='head'>Root directory path (*)</td>";
     $res .= "<td>";
     $value = $this->getValue('source_root_dir', '');
     if (empty($value)) {
         $res .= "<span id='status_source_root_dir_error'><img src='images/error_12.png'>&nbsp;Provide root dir is mandatory !<br></span><span id='status_source_root_dir_ok' style='display: none'><img src='images/ok_12.png'>&nbsp;</span>";
     } else {
         $res .= "<span id='status_source_root_dir_error' style='display: none'><img src='images/error_12.png'>&nbsp;Provide root dir is mandatory !<br></span><span id='status_source_root_dir_ok'><img src='images/ok_12.png'>&nbsp;</span>";
     }
     $res .= "<input class='editInputText' type='text' name='source_root_dir' id='source_root_dir' value='" . $this->getValue('source_root_dir', '') . "' onBlur='checkParameter(\"source_root_dir\");'>";
     $res .= "<br/><span class='help'>The source's root dir path. Example : /data/documents</span></td>";
     $res .= "</tr>";
     $res .= "<tr>";
     $res .= "<td class='head'>Status</td>";
     $res .= "<td>";
     $res .= "<select id='source_enabled' name='source_enabled' style='editInputSelect'>";
     $res .= "<option value='1'";
     if ($this->getValue('enabled', '') == "1") {
         $res .= " selected";
     }
     $res .= ">Enabled</option>";
     $res .= "<option value='0'";
     if ($this->getValue('enabled', '') == "0") {
         $res .= " selected";
     }
     $res .= ">Disabled</option>";
     $res .= "<option value='2'";
     if ($this->getValue('enabled', '') == "2") {
         $res .= " selected";
     }
     $res .= ">Test</option>";
     $res .= "</select>";
     $res .= "</td>";
     $res .= "</tr>";
     $target = $this->getValue('id_target', '');
     $aTargets = getAvailableTargets($this->config, $this->id_account_current);
     if ($aTargets != null) {
         $res .= "<tr>";
         $res .= "<td class='head'>Target</td>";
         $res .= "<td>";
         $res .= "<select id='id_target' name='id_target' style='editInputSelect'>";
         foreach ($aTargets as $key => $value) {
             $res .= "<option value='" . $key . "'";
             if (!empty($target) && $target == strtolower(trim($key))) {
                 $res .= " selected";
             }
             $res .= ">" . $value . "</option>";
         }
         $res .= "</select>";
         $res .= "</td>";
         $res .= "</tr>";
     }
     $res .= "<tr>";
     $res .= "<td class='head'>Collections</td>";
     $res .= "<td><input class='editInputText' type='text' name='source_collection' id='source_collection' value='" . str_replace("_", " ", $this->getValue('collection', '')) . "'>";
     $aCollections = getAvailableTagsCollections($this->config, false, $this->id_account_current, "collection");
     if ($aCollections != null) {
         $res .= "<br />";
         for ($j = 0; $j <= count($aCollections); $j++) {
             if ($aCollections[$j] != "") {
                 $aCollections[$j] = str_replace("_", " ", $aCollections[$j]);
                 $res .= "<a href='javascript:void(0)' onClick='addCollection(\"" . $aCollections[$j] . "\");'><span class='nobr'><img id='collection_" . $aCollections[$j] . "' src='images/plus_12.png'>&nbsp;<label for='tag_" . $aCollections[$j] . "'>" . $aCollections[$j] . "</label></a>&nbsp;&nbsp;</span> ";
             }
         }
     }
     $res .= "<br/><span class='help'>Use comma as separator.</span></td>";
     $res .= "</tr>";
     $res .= "<tr>";
     $res .= "<td class='head'>Tags</td>";
     $res .= "<td><input class='editInputText' type='text' name='source_tag' id='source_tag' value='" . fi(str_replace("_", " ", $this->getValue('tag', ''))) . "'>";
     $aTags = getAvailableTagsCollections($this->config, false, $this->id_account_current, "tag");
     if ($aTags != null) {
         $res .= "<br />";
         for ($j = 0; $j <= count($aTags); $j++) {
             if ($aTags[$j] != "") {
                 $aTags[$j] = str_replace("_", " ", $aTags[$j]);
                 $res .= "<a href='javascript:void(0)' onClick='addTag(\"" . $aTags[$j] . "\");'><span class='nobr'><img id='tag_" . $aTags[$j] . "' src='images/plus_12.png'>&nbsp;<label for='tag_" . $aTags[$j] . "'>" . $aTags[$j] . "</label></a>&nbsp;&nbsp;</span> ";
             }
         }
     }
     $res .= "<br/><span class='help'>Use comma as separator.<br>These tags will be associated with crawled pages if they are contained in pages.</span></td>";
     $res .= "</tr>";
     $res .= "<tr>";
     $res .= "<td class='head'>Country</td>";
     $res .= "<td>";
     $res .= "<select id='source_country' name='source_country' style='editInputSelect'>";
     $country = strtolower($this->getValue('country', ''));
     foreach ($this->aCountries as $key => $value) {
         $res .= "<option value='" . $key . "'";
         if ($country == strtolower(trim($key))) {
             $res .= " selected";
         }
         $res .= ">" . $value . "</option>";
     }
     $res .= "</select>";
     $res .= "</td>";
     $res .= "</tr>";
     $res .= "<tr>";
     $res .= "<td class='head'>Main language</td>";
     $res .= "<td>";
     $res .= "<select id='source_language' name='source_language' style='editInputSelect' onChange='showLanguageRestrictionList();'>";
     $language = strtolower($this->getValue('language', ''));
     foreach ($this->aLanguages as $key => $value) {
         $res .= "<option value='" . $key . "'";
         if ($language == strtolower(trim($key))) {
             $res .= " selected";
         }
         $res .= ">" . $value . "</option>";
     }
     $res .= "</select>";
     $res .= "<div id='language_detection_list' name='language_detection_list'";
     if (strtolower(trim($this->getValue('language', ''))) == "xx" || $this->data == null) {
         $res .= " style='display:block'";
     } else {
         $res .= " style='display:none'";
     }
     $res .= ">Limit detection to this languages list (<a href='http://en.wikipedia.org/wiki/List_of_ISO_639-1_codes' target='_blank'>ISO 639-1 codes</a> separated by \",\")&nbsp;<input class='editInputTextMedium' type='text' name='source_language_detection_list' id='source_language_detection_list' value='" . $this->getValue('language_detection_list', '') . "'></div>";
     $res .= "</td>";
     $res .= "</tr>";
     return $res;
 }
 public function displayPageMain()
 {
     $res = '';
     $res .= "<tr>";
     $res .= "<td class='head'>Name (*)</td>";
     $res .= "<td>";
     $value = $this->getValue('name', '');
     if (empty($value)) {
         $res .= "<span id='status_source_name_error'><img src='images/error_12.png'>&nbsp;Provide source name is mandatory !<br></span><span id='status_source_name_ok' style='display: none'><img src='images/ok_12.png'>&nbsp;</span>";
     } else {
         $res .= "<span id='status_source_name_error' style='display: none'><img src='images/error_12.png'>&nbsp;Provide source name is mandatory !<br></span><span id='status_source_name_ok'><img src='images/ok_12.png'>&nbsp;</span>";
     }
     $res .= "<input class='editInputText' type='text' name='source_name' id='source_name' value='" . fi($this->getValue('name', '')) . "'  onBlur='checkParameter(\"source_name\");'></td>";
     $res .= "</tr>";
     $res .= "<tr>";
     $res .= "<td class='head'>Host (*)</td>";
     $res .= "<td>";
     $value = $this->getValue('url_host', '');
     if (empty($value)) {
         $res .= "<span id='status_source_host_error'><img src='images/error_12.png'>&nbsp;Provide source host is mandatory !<br></span><span id='status_source_host_ok' style='display: none'><img src='images/ok_12.png'>&nbsp;</span>";
     } else {
         $res .= "<span id='status_source_host_error' style='display: none'><img src='images/error_12.png'>&nbsp;Provide source host is mandatory !<br></span><span id='status_source_host_ok'><img src='images/ok_12.png'>&nbsp;</span>";
     }
     $res .= "<input class='editInputText' type='text' name='source_host' id='source_host' value='" . fi($this->getValue('url_host', '')) . "' onBlur='checkParameter(\"source_host\");'>";
     $res .= "<br/><span class='help'>The source's host domain (don't specify protocol). Example : www.website.com<br/>The crawler will retrieve only the urls belonging to this domain.<br>You must specify one or more starting url below !</span></td>";
     $res .= "</tr>";
     $res .= "<tr>";
     $res .= "<td class='head'>Starting URLs (*)</td>";
     $url = $this->getValue('url', '');
     $urlJson = '{ "urls": [';
     if (!empty($url)) {
         if (substr($url, 0, 1) == "<") {
             $url = str_replace('&amp;', '&', $url);
             $url = str_replace('&', '&amp;', $url);
             $urlXml = simplexml_load_string($url);
             $result = $urlXml->xpath('/urls/url');
             $sep = "";
             while (list(, $node) = each($result)) {
                 $urlitem = (string) $node->url;
                 $urlitem = trim(preg_replace('/"/', '\\"', $urlitem));
                 $urlJson .= $sep . '{ "url": "' . $urlitem . '", "home": "' . (string) $node->home . '", "mode": "' . (string) $node->mode . '", "allowotherdomain": "' . (string) $node->allowotherdomain . '", "onlyfirstcrawl": "' . (string) $node->onlyfirstcrawl . '" }';
                 $sep = ",";
             }
         } else {
             $urlitem = $url;
             $urlitem = trim(preg_replace('/"/', '\\"', $urlitem));
             $urlJson .= '{ "url": "' . $urlitem . '",  "home": "", "mode": "s", "allowotherdomain": "0", "onlyfirstcrawl": "0" }';
         }
     }
     $urlJson .= '] }';
     $res .= "<td><span id='status_source_url_error'><img src='images/error_12.png'>&nbsp;Provide one or more starting url is mandatory !<br></span><span id='status_source_url_ok' style='display: none'><img src='images/ok_12.png'>&nbsp;</span>";
     $res .= "<div id='url'>";
     $res .= "</div>";
     $res .= "<input type='hidden' name='source_url' id='source_url' value='" . fi($urlJson) . "'>";
     $res .= "<input type='hidden' name='source_url_xml' id='source_url_xml' value='" . fi($url) . "'>";
     $res .= "<a href='javascript:addUrl();'><img src='images/plus_12.png'>&nbsp;Add url</a>";
     $res .= "&nbsp;&nbsp;<a href='javascript:scanRSS();'><img src='images/plus_12.png'>&nbsp;Scan RSS</a>";
     $res .= "<br/><span class='help'>All the urls used by the crawler in order to start the crawl process</span></td>";
     $res .= "</tr>";
     $res .= "<tr>";
     $res .= "<td class='head'>Host aliases</td>";
     $res .= "<td><input class='editInputText' type='text' name='source_alias' id='source_alias' value='" . fi($this->getValue('alias_host', '')) . "'>";
     $res .= "<br/><span class='help'>The source's host domain aliases (don't specify protocol). Example : www2.website.com, support.website.com, *.website.com, www.website.*<br/>The crawler will also accept the urls belonging to these domains</span></td>";
     $res .= "</tr>";
     $res .= "<tr>";
     $res .= "<td class='head'>Status</td>";
     $res .= "<td>";
     $res .= "<select id='source_enabled' name='source_enabled' style='editInputSelect'>";
     $res .= "<option value='1'";
     if ($this->getValue('enabled', '') == "1") {
         $res .= " selected";
     }
     $res .= ">Enabled</option>";
     $res .= "<option value='0'";
     if ($this->getValue('enabled', '') == "0") {
         $res .= " selected";
     }
     $res .= ">Disabled</option>";
     $res .= "<option value='2'";
     if ($this->getValue('enabled', '') == "2") {
         $res .= " selected";
     }
     $res .= ">Test</option>";
     $res .= "</select>";
     $res .= "</td>";
     $res .= "</tr>";
     $target = $this->getValue('id_target', '');
     $aTargets = getAvailableTargets($this->config, $this->id_account_current);
     if ($aTargets != null) {
         $res .= "<tr>";
         $res .= "<td class='head'>Target</td>";
         $res .= "<td>";
         $res .= "<select id='id_target' name='id_target' style='editInputSelect'>";
         foreach ($aTargets as $key => $value) {
             $res .= "<option value='" . $key . "'";
             if (!empty($target) && $target == strtolower(trim($key))) {
                 $res .= " selected";
             }
             $res .= ">" . $value . "</option>";
         }
         $res .= "</select>";
         $res .= "</td>";
         $res .= "</tr>";
     }
     $res .= "<tr>";
     $res .= "<td class='head'>Collections</td>";
     $res .= "<td><input class='editInputText' type='text' name='source_collection' id='source_collection' value='" . fi(str_replace("_", " ", $this->getValue('collection', ''))) . "'>";
     $aCollections = getAvailableTagsCollections($this->config, false, $this->id_account_current, "collection");
     if ($aCollections != null) {
         $res .= "<br />";
         for ($j = 0; $j <= count($aCollections); $j++) {
             if ($aCollections[$j] != "") {
                 $aCollections[$j] = str_replace("_", " ", $aCollections[$j]);
                 $res .= "<a href='javascript:void(0)' onClick='addCollection(\"" . fjsp($aCollections[$j]) . "\");'><span class='nobr'><img id='collection_" . fi($aCollections[$j]) . "' src='images/plus_12.png'>&nbsp;<label for='tag_" . fi($aCollections[$j]) . "'>" . $aCollections[$j] . "</label></a>&nbsp;&nbsp;</span> ";
             }
         }
     }
     $res .= "<br/><span class='help'>Use comma as separator.</span></td>";
     $res .= "</tr>";
     $res .= "<tr>";
     $res .= "<td class='head'>Tags</td>";
     $res .= "<td><input class='editInputText' type='text' name='source_tag' id='source_tag' value='" . fi(str_replace("_", " ", $this->getValue('tag', ''))) . "'>";
     $aTags = getAvailableTagsCollections($this->config, false, $this->id_account_current, "tag");
     if ($aTags != null) {
         $res .= "<br />";
         for ($j = 0; $j <= count($aTags); $j++) {
             if ($aTags[$j] != "") {
                 $aTags[$j] = str_replace("_", " ", $aTags[$j]);
                 $res .= "<a href='javascript:void(0)' onClick='addTag(\"" . fjsp($aTags[$j]) . "\");'><span class='nobr'><img id='tag_" . fi($aTags[$j]) . "' src='images/plus_12.png'>&nbsp;<label for='tag_" . fi($aTags[$j]) . "'>" . $aTags[$j] . "</label></a>&nbsp;&nbsp;</span> ";
             }
         }
     }
     $res .= "<br/><span class='help'>Use comma as separator.<br>These tags will be associated with crawled pages if they are contained in pages.</span></td>";
     $res .= "</tr>";
     $res .= "<tr>";
     $res .= "<td class='head'>Country</td>";
     $res .= "<td>";
     $res .= "<select id='source_country' name='source_country' style='editInputSelect'>";
     $country = strtolower($this->getValue('country', ''));
     foreach ($this->aCountries as $key => $value) {
         $res .= "<option value='" . $key . "'";
         if ($country == strtolower(trim($key))) {
             $res .= " selected";
         }
         $res .= ">" . $value . "</option>";
     }
     $res .= "</select>";
     $res .= "</td>";
     $res .= "</tr>";
     $res .= "<tr>";
     $res .= "<td class='head'>Main language</td>";
     $res .= "<td>";
     $res .= "<select id='source_language' name='source_language' style='editInputSelect' onChange='showLanguageRestrictionList();'>";
     $language = strtolower($this->getValue('language', ''));
     foreach ($this->aLanguages as $key => $value) {
         $res .= "<option value='" . $key . "'";
         if ($language == strtolower(trim($key))) {
             $res .= " selected";
         }
         $res .= ">" . $value . "</option>";
     }
     $res .= "</select>";
     $res .= "<div id='language_detection_list' name='language_detection_list'";
     if (strtolower(trim($this->getValue('language', ''))) == "xx" || $this->data == null) {
         $res .= " style='display:block'";
     } else {
         $res .= " style='display:none'";
     }
     $res .= ">Limit detection to this languages list (<a href='http://en.wikipedia.org/wiki/List_of_ISO_639-1_codes' target='_blank'>ISO 639-1 codes</a> separated by \",\")&nbsp;<input class='editInputTextMedium' type='text' name='source_language_detection_list' id='source_language_detection_list' value='" . $this->getValue('language_detection_list', '') . "'></div>";
     $res .= "</td>";
     $res .= "</tr>";
     return $res;
 }