
doc: Import technical documents from Dropbox.
@52f12f3de1560e5bb6eba3535dce9e6c519d1d42
+++ docs/technical/markdown.md
... | ... | @@ -0,0 +1,19 @@ |
1 | +This document describes how to enable markdown support. | |
2 | +* Use a textarea as a markdown editor. | |
3 | +* Render plaintext written in markdown syntax. | |
4 | + | |
5 | +Usage | |
6 | +----- | |
7 | + | |
8 | +First, Set `markdown` attribute on the HTML element to be used as an editor | |
9 | + | |
10 | + <textarea markdown></textarea> | |
11 | + | |
12 | +or be rendered. | |
13 | + | |
14 | + <div markdown>@issue.body</div> | |
15 | + | |
16 | +Then call @views.html.markdown in your scala template, to enable the markdown | |
17 | +support. | |
18 | + | |
19 | + @views.html.markdown() |
+++ docs/technical/name-validation.md
... | ... | @@ -0,0 +1,52 @@ |
1 | +URL의 path segment로 사용되는 상황에 대한 고려 | |
2 | +============================================== | |
3 | + | |
4 | +다음과 같이 URL의 path segment가 될 수 있는 이름들은, | |
5 | + | |
6 | +* 프로젝트 이름 | |
7 | +* 사용자 이름 | |
8 | + | |
9 | +알파벳, 숫자, `-`, `.`, `_`, `~` 만으로 구성하는 것을 권장한다. | |
10 | + | |
11 | + name = ALPHA / DIGIT / "-" / "." / "_" / "~" | |
12 | + | |
13 | +왜 그래야 하는가 | |
14 | +---------------- | |
15 | + | |
16 | +path segment가 될 수 있는 이름(사용자 이름, 프로젝트 이름 등)에 `/` 이나 `?` 같은 예약된 문자를 사용하면 [percent encoding](http://tools.ietf.org/html/rfc3986#section-2.1)이 되는 것을 피할 수 없다. | |
17 | + | |
18 | +예를 들어 프로젝트 이름이 "엔포지" 라면, 프로젝트에 대한 url은 다음과 같이 만들어 질 것이다. | |
19 | + | |
20 | + http://nforge.com/foo/%EC%97%94%ED%8F%AC%EC%A7%80 | |
21 | + | |
22 | +이렇게 되면 아래와 같은 단점이 있다. | |
23 | + | |
24 | +* nforge에서 디코딩을 빼먹으면 버그를 유발하게 됨 | |
25 | +* nforge를 이용해 뭔가를 만들어보려는 개발자 입장에서도 percent encoding이 되는 상황을 고려해야 하는 것은 불편함 | |
26 | +* 보기도 좋지 않음 | |
27 | + | |
28 | +예외 | |
29 | +---- | |
30 | + | |
31 | +첨부파일 이름은 통제하기 어려우니 모든 문자를 사용할 수 있도록 허용. | |
32 | + | |
33 | +파일 이름이나 디렉토리 이름이 될 수 있는 상황에 대한 고려 | |
34 | +========================================================= | |
35 | + | |
36 | +다음과 같이 파일이름이나 디렉토리 이름이 될 수 있는 모든 이름들은, | |
37 | + | |
38 | +* 프로젝트 이름 | |
39 | +* 사용자 이름 | |
40 | +* 첨부파일 이름 | |
41 | + | |
42 | +중복 방지를 위한 이름 비교시 반드시 case insensitive 하게 비교해야 한다. | |
43 | + | |
44 | +왜 그래야 하는가 | |
45 | +---------------- | |
46 | + | |
47 | +대소문자를 구분하지 않는 파일시스템(HFS+ 등)에서도 잘 동작하게 하기 위해 | |
48 | + | |
49 | +주의 | |
50 | +---- | |
51 | + | |
52 | +비교할때만 case insensitive하게 비교하고, 실제로 저장하거나 사용자에게 보여줄 때는 대소문자를 구분할 것. |
+++ docs/technical/uploader.md
... | ... | @@ -0,0 +1,88 @@ |
1 | +This document describes how to use Uploader and Downloader. | |
2 | + | |
3 | +Uploader | |
4 | +-------- | |
5 | + | |
6 | +This allows users to upload files and attach them to a specific resource(issue, | |
7 | +post, comment, ...). | |
8 | + | |
9 | +#### Usage | |
10 | + | |
11 | +First of all, uploader module should be loaded. | |
12 | + | |
13 | + <script src="@getJSLink("uploader")" type="text/javascript"></script> | |
14 | + | |
15 | +Call fileUploader javascript function to activate Uploader. The function | |
16 | +requires two three arguments -- a HTML element object wrapped by jQuery in | |
17 | +which upload form will be rendered, textarea in which a link to a uploaded file | |
18 | +will be added, and the url to files. | |
19 | + | |
20 | +You can get the url using "@routes.AttachmentApp.newFile" or | |
21 | +"@routes.AttachmentApp.getFileList". | |
22 | + | |
23 | +You have to specify `resourceType` and `resourceId` as attributes of the HTML | |
24 | +element, because they are required to upload files to the specific resource. | |
25 | + | |
26 | +e.g. | |
27 | + | |
28 | + <textarea id="comment-editor" name="contents" class="span8 textbody .inputxx-large" rows="5" markdown></textarea> | |
29 | + <div id="upload" resourceType=@Resource.ISSUE_POST resourceId=@issue.id></div> | |
30 | + <script>fileUploader($('#upload'), $('#comment-editor'), filesUrl);</script> | |
31 | + | |
32 | +However, you don't need to specify `resourceId` if the resource is not created yet, | |
33 | +for instance, while you try to post new issue. | |
34 | + | |
35 | +e.g. | |
36 | + | |
37 | + <textarea id="comment-editor" name="contents" class="span8 textbody .inputxx-large" rows="5" markdown></textarea> | |
38 | + <div id="upload" resourceType=@Resource.ISSUE_POST></div> | |
39 | + <script>fileUploader($('#upload'), $('#comment-editor'), filesUrl);</script> | |
40 | + | |
41 | +#### Server-side implementation | |
42 | + | |
43 | +You need some server-side implementation to attach uploaded files to a specific resource or get files attached to a specific resource. | |
44 | + | |
45 | +If a user upload files, they are stored in the user's temporary area. `Attachment.attachFiles` attaches them to a specific resource. The files which have been attached are removed in the temporary area. | |
46 | + | |
47 | +e.g. You should put this code on an event handler called update or create a issue to attach uploaded files to the issue. | |
48 | + | |
49 | + Attachment.attachFiles(UserApp.currentUser().id, project.id, Resource.ISSUE_POST, issueId); | |
50 | + | |
51 | +You can delete all files attached to a specific resource using `Attachment.attachFiles` method. | |
52 | + | |
53 | +e.g. You may put this code on an event handler called after deleting a comment to delete all files attached to the comment. | |
54 | + | |
55 | + Attachment.attachFiles(UserApp.currentUser().id, project.id, Resource.ISSUE_COMMENT, commentId); | |
56 | + | |
57 | +Downloader | |
58 | +---------- | |
59 | + | |
60 | +This list files attached to specific resource(issue, post, comment, ...), and | |
61 | +allow users to download them. | |
62 | + | |
63 | +#### Usage | |
64 | + | |
65 | +First of all, uploader module should be loaded. | |
66 | + | |
67 | + <script src="@getJSLink("uploader")" type="text/javascript"></script> | |
68 | + | |
69 | +Call fileDownloader javascript function to activate Downloader. The function | |
70 | +requires two two arguments -- a HTML element object wrapped by jQuery in which | |
71 | +a list of files will be rendered, and the url to files. | |
72 | + | |
73 | +You can get the url using "@routes.AttachmentApp.newFile" or | |
74 | +"@routes.AttachmentApp.getFileList". | |
75 | + | |
76 | +You have to specify `resourceType` and `resourceId` as attributes of the HTML | |
77 | +element, because they are required to get the files only attached to the | |
78 | +specific resource. | |
79 | + | |
80 | +e.g. | |
81 | + | |
82 | + <div class="attachments" resourceType=@Resource.BOARD_POST resourceId=@post.id></div> | |
83 | + <script> | |
84 | + attachments = $('.attachments'); | |
85 | + for (var i = 0; i < attachments.length; i++) { | |
86 | + fileDownloader($(attachments[i]), "@routes.AttachmentApp.newFile"); | |
87 | + } | |
88 | + </script> |
Add a comment
Delete comment
Once you delete this comment, you won't be able to recover it. Are you sure you want to delete this comment?