Browse Source

Some minor fixes.

Andreas Fetzer 10 years ago
parent
commit
769b645195

+ 1 - 1
Applications/ctkXnatTreeBrowser/ctkXnatTreeBrowserMainWindow.cpp

@@ -157,7 +157,7 @@ void ctkXnatTreeBrowserMainWindow::uploadFileClicked()
   if (resource)
   if (resource)
   {
   {
     ctkXnatFile* file = new ctkXnatFile();
     ctkXnatFile* file = new ctkXnatFile();
-    file->setLocalFilePath(/*filename*/"");
+    file->setLocalFilePath(filename);
     file->setName("lset.nrrd");
     file->setName("lset.nrrd");
     file->setFileFormat("xml");
     file->setFileFormat("xml");
     file->setFileContent("clinical parameters");
     file->setFileContent("clinical parameters");

+ 7 - 6
Libs/XNAT/Core/ctkXnatObject.cpp

@@ -316,7 +316,7 @@ void ctkXnatObject::addResource(QString foldername, QString format,
     throw ctkXnatException("Error creating resource! Foldername must not be empty!");
     throw ctkXnatException("Error creating resource! Foldername must not be empty!");
   }
   }
 
 
-  ctkXnatResourceFolder* resFolder;
+  ctkXnatResourceFolder* resFolder = 0;
   QList<ctkXnatObject*> children = this->children();
   QList<ctkXnatObject*> children = this->children();
   for (unsigned int i = 0; i < children.size(); ++i)
   for (unsigned int i = 0; i < children.size(); ++i)
   {
   {
@@ -325,11 +325,12 @@ void ctkXnatObject::addResource(QString foldername, QString format,
     {
     {
       break;
       break;
     }
     }
-    else if (i == children.size()-1)
-    {
-      resFolder = new ctkXnatResourceFolder();
-      this->add(resFolder);
-    }
+  }
+
+  if (!resFolder)
+  {
+    resFolder = new ctkXnatResourceFolder();
+    this->add(resFolder);
   }
   }
 
 
   ctkXnatResource* resource = new ctkXnatResource();
   ctkXnatResource* resource = new ctkXnatResource();

+ 2 - 4
Libs/XNAT/Core/ctkXnatResource.cpp

@@ -172,8 +172,6 @@ void ctkXnatResource::saveImpl()
   if (!this->session()->exists(this))
   if (!this->session()->exists(this))
   {
   {
     QString query = this->resourceUri();
     QString query = this->resourceUri();
-    query.append("/");
-    query.append(this->name());
 
 
     query.append(QString("?%1=%2").arg("xsi:type", this->schemaType()));
     query.append(QString("?%1=%2").arg("xsi:type", this->schemaType()));
     const QMap<QString, QString>& properties = this->properties();
     const QMap<QString, QString>& properties = this->properties();
@@ -181,11 +179,11 @@ void ctkXnatResource::saveImpl()
     while (itProperties.hasNext())
     while (itProperties.hasNext())
     {
     {
       itProperties.next();
       itProperties.next();
-      if (itProperties.key() == "ID")
+      if (itProperties.key() == ID || itProperties.key() == "xsiType")
         continue;
         continue;
       query.append(QString("&%1=%2").arg(itProperties.key(), itProperties.value()));
       query.append(QString("&%1=%2").arg(itProperties.key(), itProperties.value()));
     }
     }
-    QUuid queryId = this->session()->httpPut(this->resourceUri());
+    QUuid queryId = this->session()->httpPut(query);
     session()->httpResults(queryId, ctkXnatDefaultSchemaTypes::XSI_RESOURCE);
     session()->httpResults(queryId, ctkXnatDefaultSchemaTypes::XSI_RESOURCE);
   }
   }
   else
   else