//$stmt->setSort(array( "crawl_nexttime" => 1 ));
 if ($limit != "0") {
     $stmt->setLimit($limit);
 }
 $count = $stmt->execute();
 if ($count == 0) {
     print "";
     exit;
 }
 $cursor = $stmt->getCursor();
 $res .= "<center><table>";
 $res .= "<tr><th>Title</th><th>Starting URL</th><th>Next crawl date</th><th class='priority'>Priority</th></tr><tbody>";
 while ($cursor->hasNext()) {
     $rs = $cursor->getNext();
     $query = array('$and' => array(array("type" => "cnx"), array("id" => intval($rs["type"]))));
     mg_get_value($mg, "plugins", "class_php", $query, $class);
     $source = SourceFactory::createInstance($class, $config, $id_account_current, $mg, $aLanguages, $aCountries);
     $source->load($rs);
     $res .= "<tr>";
     $res .= "<td class='name'>";
     $res .= $rs["name"] . " (id=" . $rs["id"] . ")";
     $res .= "</td>";
     $res .= "<td class='url'>";
     $res .= getStartingUrls($source->getUrl());
     $res .= "</td>";
     $res .= "<td>";
     $timestamp = $rs["crawl_nexttime"]->sec;
     $now = time();
     if ($now > $timestamp) {
         $res .= "As soon as possible<br />(originally scheduled at " . date('Y-m-d H:i:s', $rs["crawl_nexttime"]->sec) . ")";
     } else {
 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;
 }
Ejemplo n.º 3
0
 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'>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', '');
     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'>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;
 }
     $stmt->setQuery($query);
     $enabled = (string) $item->enabled;
 }
 $stmt->addColumnValue("deleted", "0");
 $stmt->addColumnValue("enabled", $enabled);
 if ($reset == "1") {
     $stmt->addColumnValue("crawl_mode", "2");
 } else {
     $stmt->addColumnValue("crawl_mode", "0");
 }
 $stmt->addColumnValue("crawl_firstcompleted", "0");
 $stmt->addColumnValue("crawl_priority", $priority);
 $stmt->addColumnValueDate("crawl_nexttime");
 $stmt->addColumnValue("crawl_process_status", "0");
 $query = array("id" => intval($id_account_current));
 mg_get_value($mg, "accounts", "id_target", $query, $id_target);
 if (!empty($id_target)) {
     $stmt->addColumnValue("id_target", intval($id_target));
 }
 $ignore = array();
 $ignore[] = 'id';
 $ignore[] = 'id_account';
 $ignore[] = 'id_target';
 $ignore[] = 'createtime';
 $ignore[] = 'deleted';
 $ignore[] = 'enabled';
 $ignore[] = 'crawl_mode';
 $ignore[] = 'crawl_firstcompleted';
 $ignore[] = 'crawl_priority';
 $ignore[] = 'crawl_nexttime';
 $ignore[] = 'crawl_process_status';
Ejemplo n.º 5
0
 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'>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='" . $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) == "<") {
             $urlXml = simplexml_load_string($url);
             $result = $urlXml->xpath('/urls/url');
             $sep = "";
             while (list(, $node) = each($result)) {
                 $urlJson .= $sep . '{ "url": "' . (string) $node->url . '", "home": "' . (string) $node->home . '", "mode": "' . (string) $node->mode . '", "allowotherdomain": "' . (string) $node->allowotherdomain . '", "onlyfirstcrawl": "' . (string) $node->onlyfirstcrawl . '" }';
                 $sep = ",";
             }
         } else {
             $urlJson .= '{ "url": "' . $url . '",  "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='" . $urlJson . "'>";
     $res .= "<input type='hidden' name='source_url_xml' id='source_url_xml' value='" . $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='" . $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', '');
     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'>Collections</td>";
     $res .= "<td><input class='editInputText' type='text' name='source_collection' id='source_collection' value='" . encodeForInput(str_replace("_", " ", $this->getValue('collection', '')), ENT_QUOTES) . "'>";
     $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;
 }