Author: pwang
Date: 2012-05-04 13:54:26 -0700 (Fri, 04 May 2012)
New Revision: 29118
Modified:
new_cytoscape_website/plugin_website/plugins/getPluginURLs.php
Log:
Updated
Modified: new_cytoscape_website/plugin_website/plugins/getPluginURLs.php
===================================================================
--- new_cytoscape_website/plugin_website/plugins/getPluginURLs.php
2012-05-04 20:25:43 UTC (rev 29117)
+++ new_cytoscape_website/plugin_website/plugins/getPluginURLs.php
2012-05-04 20:54:26 UTC (rev 29118)
@@ -2,7 +2,7 @@
include 'clean.inc';
//$uniqueID = cleanInt($_GET['uniqueID']);
-$name = $_GET['name'];
+//$name = $_GET['name'];
// Include the DBMS credentials
include 'db.inc';
@@ -16,68 +16,96 @@
showerror();
-$returnResult='';
-
-$query = 'SELECT project_url FROM plugin_list WHERE plugin_list.name =
'."'$name'";
-
-// Run the query
-if (!($pluginList = @ mysql_query ($query, $connection)))
- showerror();
-
-// Did we get back any rows?
-if (@ mysql_num_rows($pluginList) != 0)
-{
-
- $pluginList_row = @ mysql_fetch_array($pluginList);
- $project_url = $pluginList_row["project_url"];
+// Generate plugin external URLs in XML format
+function getPluginURLs($connection, $name){
- if ($project_url == ''){
- $project_url = 'NULL';
+ $returnResult='<plugin>';
+ $returnResult .= '<pluginName>'.$name.'</pluginName>';
+
+ $query = 'SELECT project_url FROM plugin_list WHERE plugin_list.name =
'."'$name'";
+ // Run the query
+ if (!($pluginList = @ mysql_query ($query, $connection)))
+ showerror();
+
+ // Did we get back any rows?
+ if (@ mysql_num_rows($pluginList) != 0)
+ {
+ $pluginList_row = @ mysql_fetch_array($pluginList);
+ $project_url = $pluginList_row["project_url"];
+
+ if ($project_url == ''){
+ $project_url = 'NULL';
+ }
+ $returnResult .= '<project_url>'.$project_url.'</project_url>';
}
-
- $returnResult = 'project_url='.$project_url.'<br>';
+
+ $returnResult .= '<pluginVersions>';
+
+ ///
+ $query = 'SELECT version, source_url, release_note_url FROM
plugin_list,plugin_version WHERE plugin_list.plugin_auto_id =
plugin_version.plugin_id '.
+ " AND name = '".$name."'";
+
+ // Run the query
+ if (!($queryResult = @ mysql_query ($query, $connection)))
+ showerror();
+
+ $versionCount = @ mysql_num_rows($queryResult);
+
+ while ($versionCount > 0) {
+ $versionSpecific_row = @ mysql_fetch_array($queryResult);
+ $returnResult .= "<version>";
+
+ if ($versionSpecific_row["version"] != null) {
+ $returnResult .=
"<versionNumber>".$versionSpecific_row["version"]."</versionNumber>";
+ if ($versionSpecific_row["source_url"] != ''){
+ $returnResult
.="<sourceURL>".$versionSpecific_row["source_url"]."</sourceURL>";
+ }
+ else {
+ $returnResult .="<sourceURL>NULL</sourceURL>";
+ }
+ if ($versionSpecific_row["release_note_url"] != ''){
+ $returnResult
.="<release_note_url>".$versionSpecific_row["release_note_url"]."</release_note_url>";
+ }
+ else {
+ $returnResult
.="<release_note_url>NULL</release_note_url>";
+ }
+ }
+ $returnResult .= "</version>";
+ $versionCount = $versionCount -1;
+ }
+
+ $returnResult .= '</pluginVersions>';
+ $returnResult .='</plugin>';
+
+ return $returnResult;
}
+/////////////////////// main logic ////////////////////////////////////
-///
-$query = 'SELECT version, source_url, release_note_url FROM
plugin_list,plugin_version WHERE plugin_list.plugin_auto_id =
plugin_version.plugin_id '.
- " AND name = '".$name."'";
+// Get the list plugin names
+$query = 'SELECT distinct plugin_auto_id,name, unique_id FROM plugin_list
order by name';
-
// Run the query
-if (!($queryResult = @ mysql_query ($query, $connection)))
+if (!($pluginList = @ mysql_query ($query, $connection)))
showerror();
+
+//echo " (",@ mysql_num_rows($pluginList),")";
+$result = '<plugins>';
-$versionCount = @ mysql_num_rows($queryResult);
+// Did we get back any rows?
+if (@ mysql_num_rows($pluginList) != 0)
+{
+ while($pluginList_row = @ mysql_fetch_array($pluginList))
+ {
+ $pluginID = $pluginList_row["plugin_auto_id"];
+ $plugin_name = $pluginList_row["name"];
+ $result .= getPluginURLs($connection, $plugin_name);
+ }
+}
+$result .= '</plugins>';
-while ($versionCount > 0) {
+echo $result;
-
- $versionSpecific_row = @ mysql_fetch_array($queryResult);
-
- if ($versionSpecific_row["version"] != null) {
- $returnResult .= "version=" .
$versionSpecific_row["version"].'<br>';
-
- if ($versionSpecific_row["source_url"] != ''){
- $returnResult .= "source_url=" .
$versionSpecific_row["source_url"].'<br>';
- }
- else {
- $returnResult .= "source_url=NULL".'<br>';
- }
-
- if ($versionSpecific_row["release_note_url"] != ''){
- $returnResult .= "release_note_url=" .
$versionSpecific_row["release_note_url"].'<br>';
- }
- else {
- $returnResult .= "release_note_url=NULL".'<br>';
- }
- }
-
- $versionCount = $versionCount -1;
-}
-
-echo $returnResult;
-
?>
--
You received this message because you are subscribed to the Google Groups
"cytoscape-cvs" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to
[email protected].
For more options, visit this group at
http://groups.google.com/group/cytoscape-cvs?hl=en.