BrightSide Workbench Full Report + Source Code
org.turro.elephant.impl.context.vc.FileVersionControl Class Reference
Inheritance diagram for org.turro.elephant.impl.context.vc.FileVersionControl:
Collaboration diagram for org.turro.elephant.impl.context.vc.FileVersionControl:

Public Member Functions

 FileVersionControl (IElement iel, int copies, int delay)
 
void renderVersions () throws IOException
 
void renderVersions (String tableAttr, String formAttr) throws IOException
 
void removeFiles ()
 

Detailed Description

Author
Lluis TurrĂ³ Cutiller lluis.nosp@m.@tur.nosp@m.ro.or.nosp@m.g

Definition at line 34 of file FileVersionControl.java.

Constructor & Destructor Documentation

◆ FileVersionControl()

org.turro.elephant.impl.context.vc.FileVersionControl.FileVersionControl ( IElement  iel,
int  copies,
int  delay 
)

Creates a new instance of FileVersionControl

Definition at line 40 of file FileVersionControl.java.

40  {
41  super(new FPComparator());
42  this.iel = iel;
43  this.copies = copies;
44  this.delay = delay;
45  fillFiles();
46  }

Member Function Documentation

◆ removeFiles()

void org.turro.elephant.impl.context.vc.FileVersionControl.removeFiles ( )

Definition at line 103 of file FileVersionControl.java.

103  {
104  File files[] = iel.getContext().getFile().listFiles();
105  for(int i = 0; i < files.length; i++) {
106  if(files[i].isFile() && "true".equals(iel.getConstructor().getParameter(files[i].getName()))) {
107  files[i].delete();
108  }
109  }
110  }
Here is the call graph for this function:

◆ renderVersions() [1/2]

void org.turro.elephant.impl.context.vc.FileVersionControl.renderVersions ( ) throws IOException

Definition at line 48 of file FileVersionControl.java.

Here is the caller graph for this function:

◆ renderVersions() [2/2]

void org.turro.elephant.impl.context.vc.FileVersionControl.renderVersions ( String  tableAttr,
String  formAttr 
) throws IOException

Definition at line 52 of file FileVersionControl.java.

52  {
53  Date today = new Date();
54  HTMLForm hf = new HTMLForm(iel);
55  if(Strings.isBlank(tableAttr)) {
56  hf.startTag("div", "id='control-version'");
57  }
58  if(Strings.isBlank(formAttr)) {
59  hf.startForm("vc" + iel.getId(), "POST", "context");
60  } else {
61  hf.startForm("vc" + iel.getId(), "POST", "context", formAttr);
62  }
63  hf.startTable(Strings.isBlank(tableAttr) ? "" : tableAttr);
64  boolean doCommand = false;
65  for(FileProperties fp : this) {
66  if(fp.isWiki()) {
67  hf.startTableCol("");
68  hf.doTag("span", "class='file-version'");
69  hf.endTableCol();
70  hf.startTableCol("");
71  if(!fp.isLastEntry() &&
72  (iel.getConstructor().isInRole("control-version:admin") ||
73  (iel.getConstructor().isInRole("control-version:editor") &&
74  iel.getConstructor().getUser().isThisUser(fp.getAuthor()))
75  )) {
76  hf.checkBox(fp.getFullName(), "true", "", (today.getTime() - (1000L * 60L * 60L * 3)) < fp.getModification().getTime()) ;
77  doCommand = true;
78  }
79  hf.endTableCol();
80  hf.startTableCol("");
81  hf.write(I_.byKey(fp.getLang()));
82  hf.endTableCol();
83  hf.startTableCol("");
84  hf.writeDate(fp.getModification(), "short_date_time");
85  hf.endTableCol();
86  hf.startTableCol("");
87  hf.write(Contacts.getContactById(fp.getAuthor()).getName());
88  hf.endTableCol();
89  hf.endTableRow();
90  }
91  }
92  if(doCommand) {
93  hf.startTableCol("colspan='10'");
94  hf.command("remove-files", I_.get("Remove selected"), "", "javascript:return confirm('" + I_.get("Ready to delete selection?") + "')");
95  hf.endTableCol();
96  hf.endTableRow();
97  }
98  hf.endTable();
99  hf.endForm();
100  hf.endAllTags();
101  }
Here is the call graph for this function:

The documentation for this class was generated from the following file: