/** * This is the first step of upgrading process. * This method will return list of new versions that available to upgrade. * * @return (string) - list of new version that rendered to html code */ function getNewVersions() { global $jauc; $obj = $this->_getProduct(); if ($obj === false) { $css = "status-not-support"; $status = JText::_('THIS_EXTENSION_IS_NOT_SUPPORTED'); } $uploadScript = " <br />[<a href=\"#\" onclick=\"jaOpenUploader(); return false;\" title=\"" . JText::_("UPLOAD_VERSION_PACKAGE") . "\">" . JText::_("UPLOAD_NOW") . "</a>]"; $versionsNote = JText::_("A_VERSION_IS_CONSIDERRED_AS_NEW_VERSION_IF_WE_DETECT_A_HIGHER_NUMBER_IN_XML_FILE"); $versionsNote = preg_replace("/\r\n/", "", $versionsNote); $versions = $jauc->getNewerVersions($obj); if ($versions === false) { if ($jauc->isLocalMode($obj)) { $css = "status-not-uploaded"; $tipid = uniqid("ja-tooltip-"); $title = JText::sprintf("IT_SEEM_NO_VERSION_OF_S_HAS_BEEN_UPLOADED_TO_S", $obj->name, "<br /><strong>" . $jauc->getLocalVersionsPath($obj, false) . "</strong><br />"); $linkRepo = "<a id=\"{$tipid}\" class=\"ja-tips-title\" href=\"#\" title=\"\" >" . JText::_("REPOSITORY") . "</a>"; $status = JText::sprintf("SORRY_NO_VERSION_UPLOADED_IN_S", $linkRepo); $script = jaEMTooltips($tipid, $title); } else { //this extensions is not an service' extension $css = "status-not-found"; $status = JText::_("PLEASE_UPDATE_THE_SERVICE_SETTING_OR_CONTACT_WITH_SERVICE_PROVIDER"); } } else { if (!is_object($versions)) { $css = "status-not-support"; $status = JText::_('THIS_EXTENSION_IS_NOT_SUPPORTED'); } else { $extID = $obj->extId; $css = "status-new"; $tipid = uniqid("ja-tooltip-"); $title = "<sup><a href=\"#\" id=\"{$tipid}\" class=\"ja-tips-title\" title=\"\">" . JText::_("") . "</a></sup>"; $status = JText::sprintf("NEW_VERSION_FOUND_S", $title); $status .= jaEMTooltips($tipid, $versionsNote); $lastest = ''; $index = 0; $showOnly = 1; $more = 0; foreach ($versions as $v => $vInfo) { $index++; if (isset($vInfo->lastest)) { $lastest = $vInfo->version; } /*if ( $index == $showOnly + 1 ) { $more = 1; $status .= '<br/> <a href="#" style="color:#800000" onclick="showMoreOlderVersion(this, \'olderVersion'.$extID.'\'); return false;">'.JText::_("MORE").'</a>'; $status .= '<br/> <div id="olderVersion'.$extID.'" style="display:none">'; }*/ $status .= '<br />'; $status .= "- {$v} <sup style=\"color:red;\">[New!"; $status .= (isset($vInfo->releaseDate) ? " " . $vInfo->releaseDate : '') . (isset($vInfo->lastest) ? " - " . JText::_('LASTEST') : ''); $status .= "]</sup>"; if (isset($vInfo->notSure)) { $tipid = uniqid("ja-tooltip-"); $title = "++++++++<br />" . JText::sprintf("WE_CAN_NOT_DETECT_WHICH_IS_A_NEWER_VERSION_BETWEEN__S_AND_S_", $obj->version, $v) . $versionsNote; $status .= "<sup style=\"color:#FF6600;\" id=\"{$tipid}\">[!Notice]</sup>"; $status .= jaEMTooltips($tipid, $title); } if (isset($vInfo->changelogUrl) && !empty($vInfo->changelogUrl)) { $status .= ' <a href="' . $vInfo->changelogUrl . '" title="' . JText::_('SHOW_CHANGE_LOG') . '" target="_blank" >' . JText::_('CHANGE_LOG') . '</a>'; } $status .= ' - <a href="index.php?option=com_jaextmanager&view=default&task=compare&cId[]=' . $extID . '&version=' . $v . '" title="' . JText::_('VIEW_DIFFERENCE_BETWEEN_TWO_VERSIONS') . '">' . JText::_('COMPARE') . '</a>'; $status .= ' - <a href="#" onclick="doUpgrade(\'' . $extID . '\', \'' . $v . '\', \'LastCheckStatus_' . $extID . '\'); return false;" title="' . JText::_('UPGARDE_TO_NEW_VERSION_NOW') . '">' . JText::_('UPGRADE_NOW') . '</a>'; } /*if ( $more ) { $status .= '</div>'; }*/ if ($index == 0) { if ($jauc->isLocalMode($obj)) { $css = "status-normal"; $tipid = uniqid("ja-tooltip-"); $title = JText::sprintf("S_NEW_VERSIONS_ARE_STORED_AT_S_IF_YOU_HAVE_NEW_VERSION_UPLOAD_IT_OR_DO_IT_VIA_FTP", $obj->name, "<br /><strong>" . $jauc->getLocalVersionsPath($obj, false) . "</strong><br />"); $linkRepo = "<a id=\"{$tipid}\" class=\"ja-tips-title\" href=\"#\" title=\"\">" . JText::_("REPOSITORY") . "</a>"; $status = JText::sprintf('NO_NEW_VERSION_FOUND_IN_S', $linkRepo); $script = jaEMTooltips($tipid, $title); } else { //$css = "status-lastest"; $css = "status-normal"; $status = JText::_("NO_NEW_VERSION_FOUND"); } } } } if ($jauc->isLocalMode($obj)) { $status .= $uploadScript; } $status = "<div class=\"{$css}\">{$status}</div>"; if (isset($script)) { $status .= $script; } $this->storeLastCheck($obj->extId, addslashes($status)); return $status; }
$version = $file['version']; $containerId = "backup-" . $obj->extId . "-" . $index; $startGroup = true; } else { $startGroup = false; } $endGroup = $index == $totalFiles || $index < $totalFiles && $listRecoveryFiles[$index]['version'] != $version ? true : false; $displayGroup = $index == 1 ? "block" : "none"; $statusGroup = $index == 1 ? JText::_("HIDE") : JText::_("SHOW"); ?> <?php if ($startGroup) { ?> <?php $tipid = uniqid("ja-tooltip-"); $sTooltips .= jaEMTooltips($tipid, $conflictNote); ?> <?php echo JText::sprintf("VERSION_S", $file['version']); ?> [ <a href="#" style="color:#800000" onclick="showMoreOlderVersion(this, '<?php echo $containerId; ?> '); return false;"><?php echo $statusGroup; ?> </a> ] <br /> <div id="<?php echo $containerId; ?>
function getNewVersions() { global $jauc; $obj = $this->_getProduct(); if ($obj === false) { $css = "status-not-support"; $status = JText::_('This extension is not supported!'); } $uploadScript = " <br />[<a href=\"#\" onclick=\"jaOpenUploader(); return false;\" title=\"" . JText::_("Upload version package") . "\">" . JText::_("Upload Now") . "</a>]"; $versionsNote = JText::_("\n\t\tA version is considerred as new version if we detect a higher number in XML file,<br /> \n\t\tso please make sure the extension have proper and consistant versioning number system in all releases.<br />\n\t\t\n\t\t++++++++++++++++++++++<br />\n\t\tSamples of good versioning<br />\n\t\t- 1.0, 1.1, 1.2<br />\n\t\t- V1.0, V2.0<br />\n\t\t- Version 1.0, Version 2.0<br />\n\t\t- 1.0 Alpha, 1.1 Beta, 1.2 Stable<br />\n\t\t\n\t\t++++++++++++++++++++++++<br />\n\t\tBad versioning we can't detect<br />\n\t\t- 1.0 Alpha 2, 1.0 Beta<br />\n\t\t- 1.0 Beta 1, 1.0 Beta 2 (<-- hard to tell Alpha 2 or Beta are higher, they are not interger )<br />\n\t\t- 1.0, 1.0.1. v2.1 (<-- not consistant)<br />\n\t\t"); $versionsNote = preg_replace("/\r\n/", "", $versionsNote); $versions = $jauc->getNewerVersions($obj); if ($versions === false) { if ($jauc->isLocalMode($obj)) { $css = "status-not-uploaded"; $tipid = uniqid("ja-tooltip-"); $title = JText::sprintf("It seem no version of %s has been uploaded to %s", $obj->name, "<br /><strong>" . $jauc->getLocalVersionsPath($obj, false) . "</strong><br />"); $linkRepo = "<a id=\"{$tipid}\" class=\"ja-tips-title\" href=\"#\" title=\"\" >" . JText::_("Repository") . "</a>"; $status = JText::sprintf("Sorry, no version uploaded in %s", $linkRepo); $script = jaEMTooltips($tipid, $title); } else { //this extensions is not an service' extension $css = "status-not-found"; $status = JText::_("Please update the service setting or contact with service provider."); } } else { if (!is_object($versions)) { $css = "status-not-support"; $status = JText::_('This extension is not supported!'); } else { $extID = $obj->extId; $css = "status-new"; $tipid = uniqid("ja-tooltip-"); $title = "<sup><a href=\"#\" id=\"{$tipid}\" class=\"ja-tips-title\" title=\"\">" . JText::_("[?]") . "</a></sup>"; $status = JText::sprintf("New version found! %s", $title); $status .= jaEMTooltips($tipid, $versionsNote); $lastest = ''; $index = 0; $showOnly = 1; $more = 0; foreach ($versions as $v => $vInfo) { $index++; if (isset($vInfo->lastest)) { $lastest = $vInfo->version; } /*if ( $index == $showOnly + 1 ) { $more = 1; $status .= '<br/> <a href="#" style="color:#800000" onclick="showMoreOlderVersion(this, \'olderVersion'.$extID.'\'); return false;">'.JText::_("More").'</a>'; $status .= '<br/> <div id="olderVersion'.$extID.'" style="display:none">'; }*/ $status .= '<br />'; $status .= "- {$v} <sup style=\"color:red;\">[New!"; $status .= (isset($vInfo->releaseDate) ? " " . $vInfo->releaseDate : '') . (isset($vInfo->lastest) ? " - " . JText::_('Lastest') : ''); $status .= "]</sup>"; if (isset($vInfo->notSure)) { $tipid = uniqid("ja-tooltip-"); $title = "++++++++<br />" . JText::sprintf("We can not detect which is a newer version between %s and %s <br />", $obj->version, $v) . $versionsNote; $status .= "<sup style=\"color:#FF6600;\" id=\"{$tipid}\">[!Notice]</sup>"; $status .= jaEMTooltips($tipid, $title); } if (isset($vInfo->changelogUrl) && !empty($vInfo->changelogUrl)) { $status .= ' <a href="' . $vInfo->changelogUrl . '" title="' . JText::_('Show Change Log') . '" target="_blank" >' . JText::_('Change Log') . '</a>'; } $status .= ' - <a href="index.php?option=' . JACOMPONENT . '&view=default&task=compare&cId[]=' . $extID . '&version=' . $v . '" title="' . JText::_('View difference between two versions') . '">' . JText::_('Compare') . '</a>'; $status .= ' - <a href="#" onclick="doUpgrade(\'' . $extID . '\', \'' . $v . '\', \'LastCheckStatus_' . $extID . '\'); return false;" title="' . JText::_('Upgarde to new version now') . '">' . JText::_('Upgrade Now') . '</a>'; } /*if ( $more ) { $status .= '</div>'; }*/ if ($index == 0) { if ($jauc->isLocalMode($obj)) { $css = "status-normal"; $tipid = uniqid("ja-tooltip-"); $title = JText::sprintf("%s new versions are stored at %s If you have new version, Upload it or do it via FTP ", $obj->name, "<br /><strong>" . $jauc->getLocalVersionsPath($obj, false) . "</strong><br />"); $linkRepo = "<a id=\"{$tipid}\" class=\"ja-tips-title\" href=\"#\" title=\"\">" . JText::_("Repository") . "</a>"; $status = JText::sprintf('No new version found in %s', $linkRepo); $script = jaEMTooltips($tipid, $title); } else { //$css = "status-lastest"; $css = "status-normal"; $status = JText::_("No new version found"); } } } } if ($jauc->isLocalMode($obj)) { $status .= $uploadScript; } $status = "<div class=\"{$css}\">{$status}</div>"; if (isset($script)) { $status .= $script; } $this->storeLastCheck($obj->extId, addslashes($status)); return $status; }