Skip to content

Commit

Permalink
Merge pull request nusCS2113-AY1819S1#78 from BearPerson1/master
Browse files Browse the repository at this point in the history
Refactoring andupdate of UG
  • Loading branch information
BearPerson1 authored Oct 30, 2018
2 parents 7b23c69 + f2843d3 commit 0fc0244
Show file tree
Hide file tree
Showing 18 changed files with 136 additions and 27 deletions.
139 changes: 129 additions & 10 deletions docs/UserGuide.adoc
Original file line number Diff line number Diff line change
Expand Up @@ -305,30 +305,131 @@ Shows only contacts who have GER1000 in their timetable and are free at mon 10am

=== Notes Commands

==== Downloading notes from IVLE : `downloadAllNotes`
==== Downloading all notes from a selected module from IVLE : `downloadAllNotes`

Downloads the your notes from IVLE, and stores them in the folder "notes"

Format: `downloadAllNotes `downloadAllNotes [user/IVLE USERNAME] [pass/IVLE PASSWORD] [mod/ENROLLED MODULE]`

[TIP]
You do not have to Enter the full module code or worry about the capitalization.

[NOTE]
You would need to have Google Chrome installed in the default location in order to execute this command.
[NOTE]
You would be unable to see your inputted command after inputting it, this is a security feature to prevent your login credentials from being compromised.

Downloads the your notes from IVLE, and stores them in the folder "notes" +
Format: `downloadAllNotes [user/IVLE USERNAME] [pass/IVLE PASSWORD] [mod/ENROLLED MODULE]`

****
image::downloadExample.PNG[width="900"]
* Automatically accesses the your IVLE account using Google Chrome, and downloads all notes and resources
of the specified module.
* This process can take up to 1 minute, depending on the internet speed of the local area network.
* if an incomplete module code is entered, it will select the a module that matches it the most
Example: if you are enrolled in `CS2113` and `cs2101` entering `mod/cs21` will select `cs2101`
* You may notice a new window of Google Chrome opening up. Please refrain from interferring with the automated process.
image::chromeOpen.PNG[width="250"]
* N*Sync might be unresponsive during the download, it is so to prevent you from accidentally introducing file corruption.
* If the process is successful, the result window of NSync will display the exact path to your newly downloaded notes.
****

Examples:

* `downloadAllNotes user/e1234567 pass/password1 mod/CS2101` +
Downloads all notes and resources for CS2101
* `downloadAllNotes user/e1234567 pass/password1 mod/CS2113` +
Downloads all notes and resources for CS2113
Download Successful

image::downloadAllSuccessful.PNG[width="900"]

Module not found

image::downloadModNotFound.PNG[width="900"]

Password or username Incorrect

image::downloadPasswordOrUsernameWrong.PNG[width="900"]


==== Display all notes from a selected module from IVLE : `downloadSelectNotes` without prefix `"file/"`
Displays all the available notes of a selected

Format: `downloadSelectNotes [user/IVLE USERNAME] [pass/IVLE PASSWORD] [mod/ENROLLED MODULE]`

[NOTE]
Currently the files are not sorted in any order. In a future version we will make its sorted by file type

image::downloadSelectFileExample.PNG[width="900"]

* All available notes from the selected module would be sourced and displayed

* if a file is not shown, it could be either a private folder or a submission folder, consult your lecturer for more information

Examples:

[NOTE]
the number on the left of the file represents the file ID, it is static.

Example: 0:LP41_More_UML_Inheritence.pptx

File Fetch Successful

image::downloadSelectFileSuccess1.PNG[width="900"]
image::downloadSelectFileSuccess2.PNG[width="900"]

Module not found

image::downloadModNotFound.PNG[width="900"]

Password or username Incorrect

image::downloadPasswordOrUsernameWrong.PNG[width="900"]

==== Downloading selective notes from a selected module from IVLE : `downloadSelectNotes` with prefix `"file/"`
Download a selective number of notes from IVLE, and stores them in the folder "notes".

Format: `downloadSelectNotes [user/IVLE USERNAME] [pass/IVLE PASSWORD] [mod/ENROLLED MODULE] [file/0,1,2...n]`

[TIP]
Use `downloadSelectFile` without the `file\` prefix to obtain the file IDs

image::downloadSelectExample.PNG[width="900"]

* The files would be downloaded one by one from IVLE to your "notes" folder.

* if you entered a mix of invalid and valid file IDs, N*Sync will only only download the correct files, up till it encounters a invalid ID.

Example: file/0,1,2,90000000,3
if 0,1,2,3 are valid file IDs, only file 0,1,2 will be downloaded.

Examples:

Download Successful

image::downloadSelectSuccess.PNG[width="900"]

File not found

image::downloadSelectFileNotFound.PNG[width="900"]

==== Show all downloaded notes: `showNotes`
Displays all the downloaded notes in the UI

Format: `showNotes`

[NOTE]
the files are displayed in the order that it is in your directory

* It recursively searches your `notes` folder and displays all the files available

==== Downloading notes from IVLE : `downloadSelectNotes`
Example:

image::showNotes1.PNG[width="900"]
image::showNotes2.PNG[width="900"]
image::showNotes3.PNG[width="900"]

==== Clearing all downloaded notes : `clearNotes`

Expand All @@ -352,22 +453,40 @@ _{explain how the user can enable/disable data encryption}_

* *Add* `add n/NAME p/PHONE_NUMBER e/EMAIL a/ADDRESS [t/TAG]...` +
e.g. `add n/James Ho p/22224444 e/[email protected] a/123, Clementi Rd, 1234665 t/friend t/colleague`

* *Clear* : `clear`

* *Clear Notes* : `clearNotes`

* *Download All Notes* : `downloadAllNotes user/e1234567 pass/password1 mod/CS2113`
* *Download Selected Notes* :

* *Download Selected Notes (seleted notes)* : `downloadSelectNotes user/e1234567 pass/password1 mod/CS2113 file/1,2,3...n`

* *Download Selected Notes (show all notes)* : `downloadSelectNotes user/e1234567 pass/password1 mod/CS2113`

* *Show notes* : `showNotes`

* *Delete* : `delete INDEX` +
e.g. `delete 3`

* *Edit* : `edit INDEX [n/NAME] [p/PHONE_NUMBER] [e/EMAIL] [a/ADDRESS] [t/TAG]... [em/ENROLLED MODULE]...` +
e.g. `edit 2 n/James Lee e/[email protected]`

* *Find* : `find KEYWORD [MORE_KEYWORDS]` +
e.g. `find James Jake`

* *Help* : `help`

* *History* : `history`

* *List* : `list`

* *Merge Timetables* : `merge [index 1] [index 2] <add more indices if required>`
e.g. `merge 1 2 5`

* *Redo* : `redo`

* *Select* : `select INDEX` +
e.g.`select 2`

* *Undo* : `undo`
Binary file added docs/images/chromeOpen.PNG
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added docs/images/downloadAllSuccessful.PNG
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added docs/images/downloadExample.PNG
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added docs/images/downloadModNotFound.PNG
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added docs/images/downloadPasswordOrUsernameWrong.PNG
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added docs/images/downloadSelectExample.PNG
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added docs/images/downloadSelectFileExample.PNG
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added docs/images/downloadSelectFileNotFound.PNG
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added docs/images/downloadSelectFileSuccess1.PNG
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added docs/images/downloadSelectFileSuccess2.PNG
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added docs/images/downloadSelectSuccess.PNG
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added docs/images/downloadSelectfileSuccess1.PNG
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added docs/images/showNotes1.PNG
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added docs/images/showNotes2.PNG
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added docs/images/showNotes3.PNG
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Original file line number Diff line number Diff line change
Expand Up @@ -205,8 +205,5 @@ protected void initializeDownloadFolder(){
}
}

public String getCurrentDirPath(){
return currentDirPath;
}

}
Original file line number Diff line number Diff line change
Expand Up @@ -19,20 +19,23 @@ public class DownloadSelectNotesCommand extends DownloadAbstract{

public static final String COMMAND_WORD = "downloadSelectNotes";

public static final String MESSAGE_USAGE = "downloadSelectNotes user/(username) pass/(password) mod/(moduleCode) file/(0,1,2...n))";
public static final String MESSAGE_USAGE = "To display all available notes:\r\ndownloadSelectNotes user/(username) " +
"pass/(password) mod/(moduleCode)\r\nTo select the notes(by index):\r\ndownloadSelectNotes user/(username) pass/(password) mod/(moduleCode) file/0,1,2...n";

public static final String NEWLINE_SEPERATOR = "\r\n";

public static final String NO_FILES_SELECTED_MESSAGE = "Please select a file after the \"file/\" tag. Ie: file/(0,1,2...n))";

public static final String MESSAGE_FILE_DOES_NOT_EXIST_ERROR = "A FILE YOU CHOSE DOES NOT EXIST\r\n DOWNLOAD NOT COMPLETE";
public static final String MESSAGE_FILE_DOES_NOT_EXIST_ERROR = "A FILE YOU CHOSE DOES NOT EXIST\r\nDOWNLOAD NOT COMPLETE";

private static final String WORKBIN_CSS_SELECTOR_ID = "a[href^=\"/workbin\"]";

private static final String TREEVIEW_CLASS_ID = "TreeView";

private static final String FILE_DOWNLOAD_LINK_ATTRIBUTE_ID = "href";

private static final String MESSAGE_SUCCESS_PREFIX = "Here are your the files available for: ";

private ArrayList<Integer> fileSelect;
private String availableDownloadFiles;
/**
Expand Down Expand Up @@ -84,7 +87,7 @@ public CommandResult execute(Model model, CommandHistory history) throws Command
if(fileSelect==null) {
availableDownloadFiles = getFileNames(driver);
driver.close();
return new CommandResult(availableDownloadFiles);
return new CommandResult(MESSAGE_SUCCESS_PREFIX + moduleCode + "\r\n" + availableDownloadFiles);
}

initializeDownloadFolder();
Expand All @@ -97,18 +100,8 @@ public CommandResult execute(Model model, CommandHistory history) throws Command
}
dynamicWaiting();
driver.close();
try{
UnzipUtil.unzipFile(downloadPath, UNZIP_FILE_KEYWORD,
currentDirPath, DOWNLOAD_FILE_PATH, moduleCode);
}
catch (IOException ioe) {
throw new CommandException(MESSAGE_FILE_CORRUPTED);
}
catch (NullPointerException npe) {
throw new CommandException(MESSAGE_NOTES_FOLDER_NOT_FOUND);
}
return new CommandResult(moduleCode + MESSAGE_SUCCESS
+ currentDirPath + DOWNLOAD_FILE_PATH);
+ currentDirPath + DOWNLOAD_RELATIVE_PATH);
}
driver.close();
throw new CommandException(MESSAGE_MODULE_NOT_FOUND);
Expand Down

0 comments on commit 0fc0244

Please sign in to comment.