version 1.1, 2003/06/17 10:38:55
|
version 1.2, 2003/06/17 10:59:07
|
Line 379 public class Upload extends JApplet impl
|
Line 379 public class Upload extends JApplet impl
|
System.out.println(doc.title); |
System.out.println(doc.title); |
conPost.post(file,"new",doc.docID+"",doc.title,doc.locator,doc.comment); |
conPost.post(file,"new",doc.docID+"",doc.title,doc.locator,doc.comment); |
|
|
// conPost.post(new File("./test2.jpg"),picture.elementAt(i).toString(),artist.elementAt(i).toString(),source.elementAt(i). |
// conPost.post(new File("./test2.jpg"),picture.elementAt(i).toString(),artist.elementAt(i).toString(),source.elementAt(i).toString()); |
System.out.println(getMD5(md)); |
System.out.println(getMD5(md)); |
dialog.progress.setValue(100); |
dialog.progress.setValue(100); |
count++; |
count++; |
Line 392 public class Upload extends JApplet impl
|
Line 392 public class Upload extends JApplet impl
|
|
|
|
|
String path =startFile.getAbsolutePath().substring(0,index+1); |
String path =startFile.getAbsolutePath().substring(0,index+1); |
System.out.println(path);mode = "new"; |
System.out.println(path); |
boolean newVersionforAll = false; |
mode = "new"; |
|
boolean newVersionforAll = false, keepAllFiles = false; |
Vector list=new Vector(); |
Vector list=new Vector(); |
for(int k=0;k<fileCount;++k) |
for(int k=0;k<fileCount;++k) |
{ |
{ |
Line 421 public class Upload extends JApplet impl
|
Line 422 public class Upload extends JApplet impl
|
|
|
if(bundleRef.docsLocator.get(doc.locator)!=null) |
if(bundleRef.docsLocator.get(doc.locator)!=null) |
{ |
{ |
if(!newVersionforAll) |
if(!newVersionforAll&&!keepAllFiles) |
{ |
{ |
Object[] options = new Object[] { "New Version for this file","New Version for all files", "Skip file" }; |
Object[] options = new Object[] { "Cancel","Replace existing files", "Keep existing files" }; |
|
Object[] options2 = new Object[] { "Cancel","Replace existing file", "Keep existing file" }; |
|
|
int option = showDialog("Warning "+doc.locator+" exists! \n What do you want to do?", "Destination exists!", options,list); |
int option = (list.size()>1) ? showDialog("Warning : several files exist on the server \n Press show list to see the list! \n What do you want to do?", "several Files exist!", options,list):showDialog("Warning : file "+doc.fileName+" exists on the server \n What do you want to do?", " File "+doc.fileName+" exists!", options2); |
if(option == 0) mode ="old"; |
; |
|
if(option == 0) break;// mode = "old"; |
if(option == 1) |
if(option == 1) |
{ |
{ |
mode ="old"; |
mode ="old"; |
newVersionforAll=true; |
newVersionforAll=true; |
|
keepAllFiles = false; |
} |
} |
if(option == 2) |
if(option == 2) |
{ |
{ |
count++; |
count++; |
System.out.println("Heh Document exists!"+ doc); |
System.out.println("Heh Document exists!"+ doc); |
System.out.println("Skipping"); |
System.out.println("Skipping"); |
|
newVersionforAll = false; |
|
keepAllFiles = true; |
continue; |
continue; |
} |
} |
} |
} |
Bundle.Document refDoc= (Bundle.Document) bundleRef.docsLocator.get(doc.locator); |
Bundle.Document refDoc= (Bundle.Document) bundleRef.docsLocator.get(doc.locator); |
doc.docID=refDoc.docID; |
doc.docID=refDoc.docID; |
|
if(keepAllFiles) |
|
{ |
|
count++; |
|
continue; |
|
} |
//count++; |
//count++; |
// System.out.println("Heh Document exists!"+ doc); |
// System.out.println("Heh Document exists!"+ doc); |
// System.out.println("Skipping"); |
// System.out.println("Skipping"); |
Line 458 public class Upload extends JApplet impl
|
Line 469 public class Upload extends JApplet impl
|
conPost.dialog=dialog; |
conPost.dialog=dialog; |
conPost.post(path,doc,mode); |
conPost.post(path,doc,mode); |
String md5=getMD5(md); |
String md5=getMD5(md); |
System.out.println("MD5 is equal ?"+doc.md5cs.equals(md5)); |
System.out.println("MD5 is equal ?"+doc.md5cs.equals(md5)+" doc_md5 "+doc.md5cs+" md5 "+md5); |
if(!doc.md5cs.equals(md5)) |
if(!doc.md5cs.equals(md5)) |
{ |
{ |
Object[] options = { "Retry", "Cancel" }; |
Object[] options = { "Retry", "Cancel" }; |
Line 604 public class Upload extends JApplet impl
|
Line 615 public class Upload extends JApplet impl
|
{ |
{ |
JOptionPane pane = new JOptionPane( message, JOptionPane.DEFAULT_OPTION, JOptionPane.WARNING_MESSAGE, null, options, options[0]); |
JOptionPane pane = new JOptionPane( message, JOptionPane.DEFAULT_OPTION, JOptionPane.WARNING_MESSAGE, null, options, options[0]); |
pane.setMessageType(JOptionPane.WARNING_MESSAGE); // Configure |
pane.setMessageType(JOptionPane.WARNING_MESSAGE); // Configure |
JDialog dialog = pane.createDialog(null, title); |
final JDialog dialog = pane.createDialog(null, title); |
JList list=null; |
JList list=null; |
if(fileList==null) |
if(fileList==null) |
list= new JList(new String[]{"click","here","test","bla","world","hello"}); |
list= new JList(new String[]{"click","here","test","bla","world","hello"}); |
else list = new JList(fileList); |
else list = new JList(fileList); |
JScrollPane scpane = new JScrollPane(list); |
JScrollPane scpane = new JScrollPane(list); |
scpane.setPreferredSize(new Dimension(100,80)); |
scpane.setPreferredSize(new Dimension(150,150)); |
JLabel label= new JLabel("Files : "); |
|
label.setPreferredSize(new Dimension(50,80)); |
JLabel label = new JLabel("Files to be updated : "); |
JPanel panel = new JPanel(); |
label.setPreferredSize(new Dimension(150,30)); |
panel.add(label); |
final JPanel panel = new JPanel(); |
panel.add(scpane); |
panel.setLayout(new BorderLayout()); |
dialog.getContentPane().add(panel,"East"); |
panel.add(label,"North"); |
|
panel.add(scpane,"Center"); |
|
JButton showList= new JButton("show List"); |
|
showList.addActionListener(new ActionListener() |
|
{ |
|
public void actionPerformed(ActionEvent e) |
|
{ |
|
JDialog window = new JDialog(dialog); |
|
window.getContentPane().add(panel); |
|
window.pack(); |
|
window.show(); |
|
} |
|
}); |
|
JPanel buttonPanel = new JPanel(); |
|
buttonPanel.setLayout(new BoxLayout(buttonPanel, BoxLayout.Y_AXIS)); |
|
buttonPanel.add(Box.createRigidArea(new Dimension(0,30))); |
|
buttonPanel.add(showList); |
|
dialog.getContentPane().add(buttonPanel,"East"); |
dialog.pack(); |
dialog.pack(); |
dialog.show(); |
dialog.show(); |
Object selectedValue = pane.getValue(); |
Object selectedValue = pane.getValue(); |
Line 629 public class Upload extends JApplet impl
|
Line 657 public class Upload extends JApplet impl
|
return 2; |
return 2; |
} |
} |
//If there is an array of option buttons: |
//If there is an array of option buttons: |
for(int counter = 0, maxCounter = options.length; |
for(int counter = 0, maxCounter = options.length;counter < maxCounter; counter++) |
counter < maxCounter; counter++) { |
{ |
if(options[counter].equals(selectedValue)) |
if(options[counter].equals(selectedValue)) |
return counter; |
return counter; |
} |
} |
Line 1213 public class Upload extends JApplet impl
|
Line 1241 public class Upload extends JApplet impl
|
// getBundle("http://core.rz-berlin.mpg.de/edoctest/oi.epl?mm=list&grp=136"); |
// getBundle("http://core.rz-berlin.mpg.de/edoctest/oi.epl?mm=list&grp=136"); |
// getBundle("http://core.rz-berlin.mpg.de/edoctest/oi.epl?mm=list&grp=136"); |
// getBundle("http://core.rz-berlin.mpg.de/edoctest/oi.epl?mm=list&grp=136"); |
runningAsApplet=false; |
runningAsApplet=false; |
// Object[] options = new Object[] { "New Version for this file","New Version for all files", "Skip file" }; |
//Object[] options = new Object[] { "Cancel","Replace existing files", "Keep existing files" }; |
|
|
// int option = showDialog("Warning exists! \n What do you want to do?", "Destination exists!", options,null); |
|
|
|
|
// int option = showDialog("Warning : several files exist on the server \n Press show list to see the list! \n What do you want to do?", "Files exist!", options,null); |
|
//System.out.println("User selected "+options[option]); |
|
// System.exit(0); // due to now internet |
long time = System.currentTimeMillis(); |
long time = System.currentTimeMillis(); |
new Upload(); |
new Upload(); |
// bundle=getBundle("http://core.rz-berlin.mpg.de/edoctest/oi.epl?mm=list&grp=136&col=11"); |
// bundle=getBundle("http://core.rz-berlin.mpg.de/edoctest/oi.epl?mm=list&grp=136&col=11"); |
Line 1499 public class Upload extends JApplet impl
|
Line 1528 public class Upload extends JApplet impl
|
doc.docID=newDoc.docID; |
doc.docID=newDoc.docID; |
doc.ver=newDoc.ver; |
doc.ver=newDoc.ver; |
doc.fileVer=newDoc.fileVer; |
doc.fileVer=newDoc.fileVer; |
bundle.exportToXML(new File("./metaout.xml")); |
bundle.exportToXML(new File("./meta.xml")); |
} catch(Exception e7) { e7.printStackTrace();} |
} catch(Exception e7) { e7.printStackTrace();} |
} |
} |
|
|