mirror of
https://github.com/osmarks/mycorrhiza.git
synced 2024-12-05 02:29:54 +00:00
Rename attachment to media
This commit is contained in:
parent
d8699d46c0
commit
72e0f445fd
@ -1,34 +0,0 @@
|
|||||||
= Help: Attachment
|
|
||||||
In hyphae, an **attachment** is some content represented by something that is not [[/help/en/mycomarkup | Mycomarkup]]. Usually, an image, a video, or an audio.
|
|
||||||
|
|
||||||
== Supported attachment types
|
|
||||||
You can upload any file, but only those listed below will be displayed on the website. You can download unsupported attachments, though.
|
|
||||||
|
|
||||||
* **Images:** jpg, gif, png, webp, svg, ico
|
|
||||||
* **Video:** ogg, webm, mp4
|
|
||||||
* **Audio:** ogg, webm, mp3
|
|
||||||
|
|
||||||
== How to add an attachment?
|
|
||||||
For non-existent hyphae, upload a file in the //Upload a media// section.
|
|
||||||
|
|
||||||
For any hyphae, upload a file in the //Manage attachment// tab.
|
|
||||||
|
|
||||||
== Attachment management
|
|
||||||
Every hypha has the //Manage attachment// section. Click it to see what is out there.
|
|
||||||
|
|
||||||
You can upload a new file, you can //delete// the attachment (it is called //unattaching//) and see some file stats (size and type).
|
|
||||||
|
|
||||||
== On naming hyphae with attachments
|
|
||||||
The hypha name should not just copy the file name in most cases. If you are uploading a photo of a rose, do not call it `rose.jpg`, no. Call it `photo of rose` or `rose photo` or whatever. You rarely need to think of file extensions when using Mycorrhiza Wiki.
|
|
||||||
|
|
||||||
This is not a rule, of course, just a convention.
|
|
||||||
|
|
||||||
== What to put in the text part?
|
|
||||||
If a hypha has an attachment, here is what the text part might be about:
|
|
||||||
* A textual description or representation of the picture.
|
|
||||||
* A transcript of the song.
|
|
||||||
* An analysis of the attachment.
|
|
||||||
* Some meta data.
|
|
||||||
* Things above combined.
|
|
||||||
|
|
||||||
The attachment //should not// be an illustration of the text part. In this case it is better to put it into a subhypha and embed it into the markup.
|
|
@ -1,15 +1,16 @@
|
|||||||
= Help: Hypha
|
= Help: Hypha
|
||||||
A **hypha** (//plural:// hyphae) is the main content unit used in Mycorrhiza Wiki.
|
A **hypha** (//plural:// hyphae) is the main content unit used in Mycorrhiza Wiki.
|
||||||
|
|
||||||
== The structure of hypha
|
== The ontology
|
||||||
A hypha consists of two parts:
|
There are two types of hyphae:
|
||||||
* **Attachment.** Some form of media. There is only one attachment. See [[/help/en/attachment | Attachment]] for more information about attachments.
|
|
||||||
* **Text part.** Either a description of the attachment or a stand-alone text unit such as an article, a diary or a poem. It is written in a special markup, called [[/help/en/mycomarkup | Mycomarkup]].
|
|
||||||
|
|
||||||
Both parts are optional. You can have a picture without description, an article without an attachment, etc. You can have them both. You must have at least one part, though.
|
*. **Textual hypha.** This is a stand-alone text unit such as an article, a diary or a poem. It is written in a special markup, called [[/help/en/mycomarkup | Mycomarkup]].
|
||||||
|
*. **Media hypha.** This is a media resource such as an image. Media hyphae also have descriptions, also written in Mycomarkup. See [[/help/en/media | media]].
|
||||||
|
|
||||||
|
Understanding the difference between the two is really important, as it is one of the defining features of the engine. It can be confusing at first.
|
||||||
|
|
||||||
== How to create a hypha?
|
== How to create a hypha?
|
||||||
Some links on wiki are red. It means that they link a hypha that does not exist yet. If you follow this link, you will see a special page where you can upload an attachment or open the text editor. This is how you create hyphae.
|
Some links on wiki are red. It means that they link a hypha that does not exist yet. If you follow this link, you will see a special page where you can upload a media or open the text editor. This is how you create hyphae.
|
||||||
|
|
||||||
You can create such red links and follow them to create hyphae.
|
You can create such red links and follow them to create hyphae.
|
||||||
|
|
||||||
|
33
help/en/media.myco
Normal file
33
help/en/media.myco
Normal file
@ -0,0 +1,33 @@
|
|||||||
|
= Help: Media
|
||||||
|
You can upload **media** such as images, audio or video to your wiki in form of **media hyphae**. The word //media// is short for //multimedia//. Media hyphae are not just media files, they can also have a description in [[/help/en/mycomarkup | Mycomarkup]].
|
||||||
|
|
||||||
|
== Supported media types
|
||||||
|
You can upload any media file, but only those listed below will be displayed on the wiki. You can download unsupported medias, though.
|
||||||
|
|
||||||
|
* **Images:** jpg, gif, png, webp, svg, ico
|
||||||
|
* **Video:** ogg, webm, mp4
|
||||||
|
* **Audio:** ogg, webm, mp3
|
||||||
|
|
||||||
|
== How to upload media?
|
||||||
|
For non-existent hyphae, upload a file in the //Upload media// section.
|
||||||
|
|
||||||
|
For textual hyphae and already uploaded media hyphae, click the //Manage media// link on the bottom and upload a new media file.
|
||||||
|
|
||||||
|
== Media management
|
||||||
|
Every hypha has the //Manage media// section. Click it to see what is out there.
|
||||||
|
|
||||||
|
You can upload a new file, you can //remove// the media and see some file stats (size and type).
|
||||||
|
|
||||||
|
== On naming media hyphae
|
||||||
|
The hypha name should not just copy the file name. If you are uploading a photo of a rose, do not call it `rose.jpg`, no. Call it `photo of rose` or `rose photo` or whatever. You rarely need to think of file extensions when using Mycorrhiza Wiki.
|
||||||
|
|
||||||
|
This is not a rule, of course, just a convention.
|
||||||
|
|
||||||
|
== What to put in the description?
|
||||||
|
* A textual description or representation of the picture.
|
||||||
|
* A transcript of the song.
|
||||||
|
* An analysis of the media.
|
||||||
|
* Some meta data.
|
||||||
|
* Things above combined.
|
||||||
|
|
||||||
|
The media //should not// be an illustration of the description. In this case it is better to put it into a subhypha and embed it into the markup.
|
@ -413,7 +413,7 @@ The //selector// specifies what part of the //target// to transclude. The parser
|
|||||||
|
|
||||||
* `full` Transclude the whole document.
|
* `full` Transclude the whole document.
|
||||||
* `text` Transclude all text.
|
* `text` Transclude all text.
|
||||||
* `attachment` Transclude attachment only.
|
* `attachment` Transclude media only.
|
||||||
* `description` Transclude first paragraph only.
|
* `description` Transclude first paragraph only.
|
||||||
* `overview` Short for both `attachment` and `description`.
|
* `overview` Short for both `attachment` and `description`.
|
||||||
|
|
||||||
|
@ -23,14 +23,14 @@ const (
|
|||||||
TypeNone OpType = iota
|
TypeNone OpType = iota
|
||||||
// TypeEditText represents an edit of hypha text part.
|
// TypeEditText represents an edit of hypha text part.
|
||||||
TypeEditText
|
TypeEditText
|
||||||
// TypeEditBinary represents an addition or replacement of hypha attachment.
|
// TypeEditBinary represents an addition or replacement of hypha media.
|
||||||
TypeEditBinary
|
TypeEditBinary
|
||||||
// TypeDeleteHypha represents a hypha deletion
|
// TypeDeleteHypha represents a hypha deletion
|
||||||
TypeDeleteHypha
|
TypeDeleteHypha
|
||||||
// TypeRenameHypha represents a hypha renaming
|
// TypeRenameHypha represents a hypha renaming
|
||||||
TypeRenameHypha
|
TypeRenameHypha
|
||||||
// TypeUnattachHypha represents a hypha attachment deletion
|
// TypeRemoveMedia represents media removal
|
||||||
TypeUnattachHypha
|
TypeRemoveMedia
|
||||||
// TypeMarkupMigration represents a wikimind-powered automatic markup migration procedure
|
// TypeMarkupMigration represents a wikimind-powered automatic markup migration procedure
|
||||||
TypeMarkupMigration
|
TypeMarkupMigration
|
||||||
)
|
)
|
||||||
|
@ -56,7 +56,7 @@ func Index(path string) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// indexHelper finds all hypha files in the full `path` and sends them to the
|
// indexHelper finds all hypha files in the full `path` and sends them to the
|
||||||
// channel. Handling of duplicate entries and attachment and counting them is
|
// channel. Handling of duplicate entries and media and counting them is
|
||||||
// up to the caller.
|
// up to the caller.
|
||||||
func indexHelper(path string, nestLevel uint, ch chan ExistingHypha) {
|
func indexHelper(path string, nestLevel uint, ch chan ExistingHypha) {
|
||||||
nodes, err := os.ReadDir(path)
|
nodes, err := os.ReadDir(path)
|
||||||
|
@ -10,7 +10,7 @@
|
|||||||
"topics": "Help topics",
|
"topics": "Help topics",
|
||||||
"main": "Main",
|
"main": "Main",
|
||||||
"hypha": "Hypha",
|
"hypha": "Hypha",
|
||||||
"attachment": "Attachment",
|
"media": "Media",
|
||||||
"mycomarkup": "Mycomarkup",
|
"mycomarkup": "Mycomarkup",
|
||||||
"interface": "Interface",
|
"interface": "Interface",
|
||||||
"prevnext": "Previous/next",
|
"prevnext": "Previous/next",
|
||||||
|
@ -24,7 +24,7 @@
|
|||||||
"rename_link": "Rename",
|
"rename_link": "Rename",
|
||||||
"delete_link": "Delete",
|
"delete_link": "Delete",
|
||||||
"text_link": "View markup",
|
"text_link": "View markup",
|
||||||
"attachment_link": "Manage attachment",
|
"media_link": "Manage media",
|
||||||
"backlinks_link": "{{.n}} backlink%s",
|
"backlinks_link": "{{.n}} backlink%s",
|
||||||
"backlinks_link+one": "",
|
"backlinks_link+one": "",
|
||||||
"backlinks_link+other": "s",
|
"backlinks_link+other": "s",
|
||||||
@ -51,25 +51,25 @@
|
|||||||
"rename_badname": "Invalid name",
|
"rename_badname": "Invalid name",
|
||||||
"rename_badname_tip": "Invalid new name. Names cannot contain characters {{.chars}}.",
|
"rename_badname_tip": "Invalid new name. Names cannot contain characters {{.chars}}.",
|
||||||
|
|
||||||
"act_noattachment": "No attachment",
|
"act_no_media": "No media",
|
||||||
"act_noattachment_tip": "Cannot unattach this hypha because it has no attachment",
|
"act_no_media_tip": "Cannot remove media because this is not a media hypha",
|
||||||
"act_norights": "Not enough rights",
|
"act_norights": "Not enough rights",
|
||||||
"act_notexist": "Does not exist",
|
"act_notexist": "Does not exist",
|
||||||
"act_norights_delete": "Not enough rights to delete, you must be a moderator",
|
"act_norights_delete": "Not enough rights to delete, you must be a moderator",
|
||||||
"act_notexist_delete": "Cannot delete this hypha because it does not exist",
|
"act_notexist_delete": "Cannot delete this hypha because it does not exist",
|
||||||
"act_norights_rename": "Not enough rights to rename, you must be a trusted editor",
|
"act_norights_rename": "Not enough rights to rename, you must be a trusted editor",
|
||||||
"act_notexist_rename": "Cannot rename this hypha because it does not exist",
|
"act_notexist_rename": "Cannot rename this hypha because it does not exist",
|
||||||
"act_norights_unattach": "Not enough rights to unattach, you must be a trusted editor",
|
"act_norights_remove_media": "Not enough rights to remove media, you must be a trusted editor",
|
||||||
"act_notexist_unattach": "Cannot unattach this hypha because it does not exist",
|
"act_notexist_remove_media": "Cannot remove media because this hypha does not exist",
|
||||||
"act_norights_edit": "You must be an editor to edit a hypha",
|
"act_norights_edit": "You must be an editor to edit a hypha",
|
||||||
"act_norights_attach": "You must be an editor to attach a hypha",
|
"act_norights_upload_media": "You must be an editor to upload media",
|
||||||
|
|
||||||
"ask_delete": "Delete %s?",
|
"ask_delete": "Delete %s?",
|
||||||
"ask_delete_tip": "In this version of Mycorrhiza Wiki you cannot undelete a deleted hypha but the history can still be accessed.",
|
"ask_delete_tip": "In this version of Mycorrhiza Wiki you cannot undelete a deleted hypha but the history can still be accessed.",
|
||||||
"ask_unattach": "Unattach %s?",
|
"ask_remove_media": "Remove media from %s?",
|
||||||
"ask_really": "Do you really want to {{.verb}} hypha {{.name}}?",
|
"ask_really": "Do you really want to {{.verb}} hypha {{.name}}?",
|
||||||
"ask_delete_verb": "delete",
|
"ask_delete_verb": "delete",
|
||||||
"ask_unattach_verb": "unattach",
|
"ask_remove_media_verb": "remove_media",
|
||||||
|
|
||||||
"history_title": "History of %s",
|
"history_title": "History of %s",
|
||||||
|
|
||||||
@ -86,7 +86,7 @@
|
|||||||
"diff_title": "Diff of {{.name}} at {{.rev}}",
|
"diff_title": "Diff of {{.name}} at {{.rev}}",
|
||||||
|
|
||||||
"revision_title": "{{.name}} at {{.rev}}",
|
"revision_title": "{{.name}} at {{.rev}}",
|
||||||
"revision_warning": "Please note that viewing attachments of hyphae is not supported in history for now.",
|
"revision_warning": "Please note that viewing media is not supported in history for now.",
|
||||||
"revision_link": "Get Mycomarkup source of this revision",
|
"revision_link": "Get Mycomarkup source of this revision",
|
||||||
"revision_no_text": "This hypha had no text at this revision.",
|
"revision_no_text": "This hypha had no text at this revision.",
|
||||||
|
|
||||||
@ -126,24 +126,24 @@
|
|||||||
"media_noaudio": "Your browser does not support audio.",
|
"media_noaudio": "Your browser does not support audio.",
|
||||||
"media_noaudio_link": "Download audio",
|
"media_noaudio_link": "Download audio",
|
||||||
|
|
||||||
"attach_title": "Attachment of {{.name}}",
|
"media_title": "Media of {{.name}}",
|
||||||
"attach_empty": "This hypha has no attachment, you can upload it here.",
|
"media_empty": "This hypha has no media, you can upload it here.",
|
||||||
"attach_tip": "You can manage the hypha's attachment on this page.",
|
"media_tip": "You can manage the hypha's media on this page.",
|
||||||
"attach_link": "What are attachments?",
|
"media_what_is": "What is media?",
|
||||||
"attach_upload": "Upload",
|
"media_upload": "Upload",
|
||||||
"attach_stat": "Stat",
|
"media_stat": "Stat",
|
||||||
"attach_stat_size": "File size:",
|
"media_stat_size": "File size:",
|
||||||
"attach_size_value": "{{.n}} byte%s",
|
"media_size_value": "{{.n}} byte%s",
|
||||||
"attach_size_value+one": "",
|
"media_size_value+one": "",
|
||||||
"attach_size_value+other": "s",
|
"media_size_value+other": "s",
|
||||||
"attach_stat_mime": "MIME type:",
|
"media_stat_mime": "MIME type:",
|
||||||
"attach_include": "Include",
|
"media_include": "Include",
|
||||||
"attach_include_tip": "This attachment is an image. To include it in a hypha, use a syntax like this:",
|
"media_include_tip": "This media is an image. To include it in a hypha, use a syntax like this:",
|
||||||
"attach_new": "Attach",
|
"media_new": "media",
|
||||||
"attach_new_tip": "You can upload a new attachment. Please do not upload too big pictures unless you need to because may not want to wait for big pictures to load.",
|
"media_new_tip": "You can upload a new media. Please do not upload too big pictures unless you need to because may not want to wait for big pictures to load.",
|
||||||
"attach_remove": "Unattach",
|
"media_remove": "Remove media",
|
||||||
"attach_remove_tip": "Please note that you don't have to unattach before uploading a new attachment.",
|
"media_remove_tip": "Please note that you don't have to remove media before uploading a new media.",
|
||||||
"attach_remove_button": "Unattach",
|
"media_remove_button": "Remove media",
|
||||||
|
|
||||||
"close_dialog": "Close this dialog",
|
"close_dialog": "Close this dialog",
|
||||||
"confirm": "Confirm",
|
"confirm": "Confirm",
|
||||||
|
@ -10,7 +10,7 @@
|
|||||||
"topics": "Темы справки",
|
"topics": "Темы справки",
|
||||||
"main": "Введение",
|
"main": "Введение",
|
||||||
"hypha": "Гифа",
|
"hypha": "Гифа",
|
||||||
"attachment": "Вложение",
|
"media": "Медиа",
|
||||||
"mycomarkup": "Микоразметка",
|
"mycomarkup": "Микоразметка",
|
||||||
"interface": "Интерфейс",
|
"interface": "Интерфейс",
|
||||||
"prevnext": "Назад/далее",
|
"prevnext": "Назад/далее",
|
||||||
|
@ -25,7 +25,7 @@
|
|||||||
"rename_link": "Переименовать",
|
"rename_link": "Переименовать",
|
||||||
"delete_link": "Удалить",
|
"delete_link": "Удалить",
|
||||||
"text_link": "Посмотреть разметку",
|
"text_link": "Посмотреть разметку",
|
||||||
"attachment_link": "Вложение",
|
"media_link": "Медиа",
|
||||||
"backlinks_link": "{{.n}} %s сюда",
|
"backlinks_link": "{{.n}} %s сюда",
|
||||||
"backlinks_link+one": "ссылка",
|
"backlinks_link+one": "ссылка",
|
||||||
"backlinks_link+few": "ссылки",
|
"backlinks_link+few": "ссылки",
|
||||||
@ -53,25 +53,25 @@
|
|||||||
"rename_badname": "Некорректное название",
|
"rename_badname": "Некорректное название",
|
||||||
"rename_badname_tip": "Новое название некорректно. Названия не могут содержать символы {{.chars}}.",
|
"rename_badname_tip": "Новое название некорректно. Названия не могут содержать символы {{.chars}}.",
|
||||||
|
|
||||||
"act_noattachment": "Нет вложения",
|
"act_no_media": "Нет медиа",
|
||||||
"act_noattachment_tip": "Не могу открепить гифу, потому что в ней нет вложения",
|
"act_no_media_tip": "Невозможно убрать медиа, потому что медиа нету",
|
||||||
"act_norights": "Недостаточно прав",
|
"act_norights": "Недостаточно прав",
|
||||||
"act_notexist": "Не существует",
|
"act_notexist": "Не существует",
|
||||||
"act_norights_delete": "Недостаточно прав для удаления, вы должны быть модератором",
|
"act_norights_delete": "Недостаточно прав для удаления, вы должны быть модератором",
|
||||||
"act_norights_rename": "Недостаточно прав для переименования, вы должны быть доверенным редактором",
|
"act_norights_rename": "Недостаточно прав для переименования, вы должны быть доверенным редактором",
|
||||||
"act_norights_unattach": "Недостаточно прав для открепления, вы должны быть доверенным редактором",
|
"act_norights_remove_media": "Недостаточно прав для открепления, вы должны быть доверенным редактором",
|
||||||
"act_norights_edit": "Вы должны быть редактором, чтобы редактировать гифы",
|
"act_norights_edit": "Вы должны быть редактором, чтобы редактировать гифы",
|
||||||
"act_norights_attach": "Вы должны быть редактором, чтобы прикреплять гифы",
|
"act_norights_media": "Вы должны быть редактором, чтобы прикреплять гифы",
|
||||||
"act_notexist_delete": "Нельзя удалить эту гифу, потому что она не существует",
|
"act_notexist_delete": "Нельзя удалить эту гифу, потому что она не существует",
|
||||||
"act_notexist_rename": "Нельзя переименовать эту гифу, потому что она не существует",
|
"act_notexist_rename": "Нельзя переименовать эту гифу, потому что она не существует",
|
||||||
"act_notexist_unattach": "Нельзя открепить эту гифу, потому что она не существует",
|
"act_notexist_remove_media": "Нельзя убрать медиа, потому что нет такой гифы",
|
||||||
|
|
||||||
"ask_delete": "Удалить «%s»?",
|
"ask_delete": "Удалить «%s»?",
|
||||||
"ask_delete_tip": "В этой версии Микоризы нельзя отменить удаление гифы, но её история останется доступной.",
|
"ask_delete_tip": "В этой версии Микоризы нельзя отменить удаление гифы, но её история останется доступной.",
|
||||||
"ask_unattach": "Открепить «%s»?",
|
"ask_remove_media": "Убрать медиа у «%s»?",
|
||||||
"ask_really": "Вы действительно хотите {{.verb}} гифу «{{.name}}»?",
|
"ask_really": "Вы действительно хотите {{.verb}} гифу «{{.name}}»?",
|
||||||
"ask_delete_verb": "удалить",
|
"ask_delete_verb": "удалить",
|
||||||
"ask_unattach_verb": "открепить",
|
"ask_remove_media_verb": "убрать медиа",
|
||||||
|
|
||||||
"history_title": "История «%s»",
|
"history_title": "История «%s»",
|
||||||
|
|
||||||
@ -89,7 +89,7 @@
|
|||||||
"diff_title": "Разница для «{{.name}}» из {{.rev}}",
|
"diff_title": "Разница для «{{.name}}» из {{.rev}}",
|
||||||
|
|
||||||
"revision_title": "{{.name}} из {{.rev}}",
|
"revision_title": "{{.name}} из {{.rev}}",
|
||||||
"revision_warning": "Обратите внимание, просмотр вложений в истории гифы пока что недоступен.",
|
"revision_warning": "Обратите внимание, просмотр медиа в истории пока что недоступен.",
|
||||||
"revision_link": "Посмотреть код микоразметки для этой ревизии",
|
"revision_link": "Посмотреть код микоразметки для этой ревизии",
|
||||||
"revision_no_text": "В этой ревизии гифы не было текста.",
|
"revision_no_text": "В этой ревизии гифы не было текста.",
|
||||||
|
|
||||||
@ -129,25 +129,25 @@
|
|||||||
"media_noaudio": "Ваш браузер не поддерживает аудио.",
|
"media_noaudio": "Ваш браузер не поддерживает аудио.",
|
||||||
"media_noaudio_link": "Скачать аудио",
|
"media_noaudio_link": "Скачать аудио",
|
||||||
|
|
||||||
"attach_title": "Вложение «{{.name}}»",
|
"media_title": "Медиа «{{.name}}»",
|
||||||
"attach_empty": "Эта гифа не имеет вложения, здесь вы можете его загрузить.",
|
"media_empty": "Эта гифа не имеет медиа, здесь вы можете его загрузить.",
|
||||||
"attach_tip": "На этой странице вы можете управлять вложением.",
|
"media_tip": "На этой странице вы можете управлять медиа.",
|
||||||
"attach_link": "Что такое вложение?",
|
"media_what_is": "Что такое медиа?",
|
||||||
"attach_upload": "Загрузить",
|
"media_upload": "Загрузить",
|
||||||
"attach_stat": "Свойства",
|
"media_stat": "Свойства",
|
||||||
"attach_stat_size": "Размер файла:",
|
"media_stat_size": "Размер файла:",
|
||||||
"attach_size_value": "{{.n}} %s",
|
"media_size_value": "{{.n}} %s",
|
||||||
"attach_size_value+one": "байт",
|
"media_size_value+one": "байт",
|
||||||
"attach_size_value+few": "байта",
|
"media_size_value+few": "байта",
|
||||||
"attach_size_value+many": "байт",
|
"media_size_value+many": "байт",
|
||||||
"attach_stat_mime": "MIME-тип:",
|
"media_stat_mime": "MIME-тип:",
|
||||||
"attach_include": "Добавление",
|
"media_include": "Добавление",
|
||||||
"attach_include_tip": "Это вложение – изображение. Чтобы добавить его в текст гифы, используйте синтаксис ниже:",
|
"media_include_tip": "Это медиа – изображение. Чтобы добавить его в текст гифы, используйте синтаксис ниже:",
|
||||||
"attach_new": "Прикрепить",
|
"media_new": "Прикрепить",
|
||||||
"attach_new_tip": "Вы можете загрузить новое вложение. Пожалуйста, не загружайте слишком большие изображения без необходимости, чтобы впоследствии не ждать её долгую загрузку.",
|
"media_new_tip": "Вы можете загрузить новое медиа. Пожалуйста, не загружайте слишком большие изображения без необходимости, чтобы впоследствии не ждать её долгую загрузку.",
|
||||||
"attach_remove": "Открепить",
|
"media_remove": "Открепить",
|
||||||
"attach_remove_tip": "Заметьте, чтобы заменить вложение, вам не нужно его перед этим откреплять.",
|
"media_remove_tip": "Заметьте, чтобы заменить медиа, вам не нужно его перед этим откреплять.",
|
||||||
"attach_remove_button": "Открепить",
|
"media_remove_button": "Открепить",
|
||||||
|
|
||||||
"close_dialog": "Закрыть этот диалог",
|
"close_dialog": "Закрыть этот диалог",
|
||||||
"confirm": "Применить",
|
"confirm": "Применить",
|
||||||
|
@ -55,10 +55,10 @@ var (
|
|||||||
)
|
)
|
||||||
|
|
||||||
CanAttach = canFactory(
|
CanAttach = canFactory(
|
||||||
rejectAttachLog,
|
rejectUploadMediaLog,
|
||||||
"upload-binary",
|
"upload-binary",
|
||||||
nil,
|
nil,
|
||||||
"ui.act_norights_attach",
|
"ui.act_norights_media",
|
||||||
"You cannot attach a hypha that does not exist",
|
"You cannot attach a hypha that does not exist",
|
||||||
false,
|
false,
|
||||||
)
|
)
|
||||||
|
@ -13,12 +13,12 @@ func rejectDeleteLog(h hyphae.Hypha, u *user.User, errmsg string) {
|
|||||||
func rejectRenameLog(h hyphae.Hypha, u *user.User, errmsg string) {
|
func rejectRenameLog(h hyphae.Hypha, u *user.User, errmsg string) {
|
||||||
log.Printf("Reject rename ‘%s’ by @%s: %s\n", h.CanonicalName(), u.Name, errmsg)
|
log.Printf("Reject rename ‘%s’ by @%s: %s\n", h.CanonicalName(), u.Name, errmsg)
|
||||||
}
|
}
|
||||||
func rejectUnattachLog(h hyphae.Hypha, u *user.User, errmsg string) {
|
func rejectRemoveMediaLog(h hyphae.Hypha, u *user.User, errmsg string) {
|
||||||
log.Printf("Reject unattach ‘%s’ by @%s: %s\n", h.CanonicalName(), u.Name, errmsg)
|
log.Printf("Reject remove media ‘%s’ by @%s: %s\n", h.CanonicalName(), u.Name, errmsg)
|
||||||
}
|
}
|
||||||
func rejectEditLog(h hyphae.Hypha, u *user.User, errmsg string) {
|
func rejectEditLog(h hyphae.Hypha, u *user.User, errmsg string) {
|
||||||
log.Printf("Reject edit ‘%s’ by @%s: %s\n", h.CanonicalName(), u.Name, errmsg)
|
log.Printf("Reject edit ‘%s’ by @%s: %s\n", h.CanonicalName(), u.Name, errmsg)
|
||||||
}
|
}
|
||||||
func rejectAttachLog(h hyphae.Hypha, u *user.User, errmsg string) {
|
func rejectUploadMediaLog(h hyphae.Hypha, u *user.User, errmsg string) {
|
||||||
log.Printf("Reject attach ‘%s’ by @%s: %s\n", h.CanonicalName(), u.Name, errmsg)
|
log.Printf("Reject upload media ‘%s’ by @%s: %s\n", h.CanonicalName(), u.Name, errmsg)
|
||||||
}
|
}
|
||||||
|
@ -30,7 +30,7 @@ func init() {
|
|||||||
rawText, err = FetchTextFile(h)
|
rawText, err = FetchTextFile(h)
|
||||||
case *hyphae.MediaHypha:
|
case *hyphae.MediaHypha:
|
||||||
rawText, err = FetchTextFile(h)
|
rawText, err = FetchTextFile(h)
|
||||||
binaryBlock = views.AttachmentHTMLRaw(h)
|
binaryBlock = views.MediaHTMLRaw(h)
|
||||||
}
|
}
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
@ -11,14 +11,14 @@ import (
|
|||||||
// RemoveMedia removes media from the media hypha and makes a history record about that. If it only had media, the hypha will be deleted. If it also had text, the hypha will become textual.
|
// RemoveMedia removes media from the media hypha and makes a history record about that. If it only had media, the hypha will be deleted. If it also had text, the hypha will become textual.
|
||||||
func RemoveMedia(u *user.User, h *hyphae.MediaHypha) error {
|
func RemoveMedia(u *user.User, h *hyphae.MediaHypha) error {
|
||||||
hop := history.
|
hop := history.
|
||||||
Operation(history.TypeUnattachHypha).
|
Operation(history.TypeRemoveMedia).
|
||||||
WithFilesRemoved(h.MediaFilePath()).
|
WithFilesRemoved(h.MediaFilePath()).
|
||||||
WithMsg(fmt.Sprintf("Unattach ‘%s’", h.CanonicalName())).
|
WithMsg(fmt.Sprintf("Remove media from ‘%s’", h.CanonicalName())).
|
||||||
WithUser(u).
|
WithUser(u).
|
||||||
Apply()
|
Apply()
|
||||||
|
|
||||||
if len(hop.Errs) > 0 {
|
if len(hop.Errs) > 0 {
|
||||||
rejectUnattachLog(h, u, "fail")
|
rejectRemoveMediaLog(h, u, "fail")
|
||||||
// FIXME: something may be wrong here
|
// FIXME: something may be wrong here
|
||||||
return fmt.Errorf("Could not unattach this hypha due to internal server errors: <code>%v</code>", hop.Errs)
|
return fmt.Errorf("Could not unattach this hypha due to internal server errors: <code>%v</code>", hop.Errs)
|
||||||
}
|
}
|
||||||
|
@ -164,7 +164,7 @@ func UploadBinary(h hyphae.Hypha, mime string, file multipart.File, u *user.User
|
|||||||
|
|
||||||
// Privilege check
|
// Privilege check
|
||||||
if !u.CanProceed("upload-binary") {
|
if !u.CanProceed("upload-binary") {
|
||||||
rejectAttachLog(h, u, "no rights")
|
rejectUploadMediaLog(h, u, "no rights")
|
||||||
return errors.New("ui.act_no_rights")
|
return errors.New("ui.act_no_rights")
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -327,9 +327,9 @@ window.addEventListener('load', () => {
|
|||||||
|
|
||||||
this.bindElement('e, ' + (isMac ? "Meta+Enter" : "Ctrl+Enter"), '.btn__link_navititle[href^="/edit/"]', 'Edit this hypha');
|
this.bindElement('e, ' + (isMac ? "Meta+Enter" : "Ctrl+Enter"), '.btn__link_navititle[href^="/edit/"]', 'Edit this hypha');
|
||||||
this.bindElement('v', '.hypha-info__link[href^="/hypha/"]', 'Go to hypha′s page');
|
this.bindElement('v', '.hypha-info__link[href^="/hypha/"]', 'Go to hypha′s page');
|
||||||
this.bindElement('a', '.hypha-info__link[href^="/attachment/"]', 'Go to attachment');
|
this.bindElement('a', '.hypha-info__link[href^="/media/"]', 'Go to media management');
|
||||||
this.bindElement('h', '.hypha-info__link[href^="/history/"]', 'Go to history');
|
this.bindElement('h', '.hypha-info__link[href^="/history/"]', 'Go to history');
|
||||||
this.bindElement('r', '.hypha-info__link[href^="/rename-ask/"]', 'Rename this hypha');
|
this.bindElement('r', '.hypha-info__link[href^="/rename/"]', 'Rename this hypha');
|
||||||
});
|
});
|
||||||
|
|
||||||
} else {
|
} else {
|
||||||
|
@ -34,7 +34,7 @@ var minimalRights = map[string]int{
|
|||||||
"text": 0,
|
"text": 0,
|
||||||
"backlinks": 0,
|
"backlinks": 0,
|
||||||
"history": 0,
|
"history": 0,
|
||||||
"attachment": 1,
|
"media": 1,
|
||||||
"edit": 1,
|
"edit": 1,
|
||||||
"upload-binary": 1,
|
"upload-binary": 1,
|
||||||
"upload-text": 1,
|
"upload-text": 1,
|
||||||
|
@ -39,7 +39,7 @@
|
|||||||
<label for="upload-binary__input"></label>
|
<label for="upload-binary__input"></label>
|
||||||
<input type="file" id="upload-binary__input" name="binary">
|
<input type="file" id="upload-binary__input" name="binary">
|
||||||
|
|
||||||
<button type="submit" class="btn stick-to-bottom" value="Upload">{%s lc.Get("ui.attach_upload")%}</button>
|
<button type="submit" class="btn stick-to-bottom" value="Upload">{%s lc.Get("ui.media_upload")%}</button>
|
||||||
</form>
|
</form>
|
||||||
</section>
|
</section>
|
||||||
</div>
|
</div>
|
||||||
@ -75,9 +75,9 @@
|
|||||||
</h1>
|
</h1>
|
||||||
{% endfunc %}
|
{% endfunc %}
|
||||||
|
|
||||||
{% func AttachmentHTMLRaw(h *hyphae.MediaHypha) %}{%= AttachmentHTML(h, l18n.New("en", "en")) %}{% endfunc %}
|
{% func MediaHTMLRaw(h *hyphae.MediaHypha) %}{%= MediaHTML(h, l18n.New("en", "en")) %}{% endfunc %}
|
||||||
|
|
||||||
{% func AttachmentHTML(h *hyphae.MediaHypha, lc *l18n.Localizer) %}
|
{% func MediaHTML(h *hyphae.MediaHypha, lc *l18n.Localizer) %}
|
||||||
{% switch filepath.Ext(h.MediaFilePath()) %}
|
{% switch filepath.Ext(h.MediaFilePath()) %}
|
||||||
|
|
||||||
{% case ".jpg", ".gif", ".png", ".webp", ".svg", ".ico" %}
|
{% case ".jpg", ".gif", ".png", ".webp", ".svg", ".ico" %}
|
||||||
|
@ -213,7 +213,7 @@ func streamnonExistentHyphaNotice(qw422016 *qt422016.Writer, h hyphae.Hypha, u *
|
|||||||
|
|
||||||
<button type="submit" class="btn stick-to-bottom" value="Upload">`)
|
<button type="submit" class="btn stick-to-bottom" value="Upload">`)
|
||||||
//line views/hypha.qtpl:42
|
//line views/hypha.qtpl:42
|
||||||
qw422016.E().S(lc.Get("ui.attach_upload"))
|
qw422016.E().S(lc.Get("ui.media_upload"))
|
||||||
//line views/hypha.qtpl:42
|
//line views/hypha.qtpl:42
|
||||||
qw422016.N().S(`</button>
|
qw422016.N().S(`</button>
|
||||||
</form>
|
</form>
|
||||||
@ -349,29 +349,29 @@ func NaviTitleHTML(h hyphae.Hypha) string {
|
|||||||
}
|
}
|
||||||
|
|
||||||
//line views/hypha.qtpl:78
|
//line views/hypha.qtpl:78
|
||||||
func StreamAttachmentHTMLRaw(qw422016 *qt422016.Writer, h *hyphae.MediaHypha) {
|
func StreamMediaHTMLRaw(qw422016 *qt422016.Writer, h *hyphae.MediaHypha) {
|
||||||
//line views/hypha.qtpl:78
|
//line views/hypha.qtpl:78
|
||||||
StreamAttachmentHTML(qw422016, h, l18n.New("en", "en"))
|
StreamMediaHTML(qw422016, h, l18n.New("en", "en"))
|
||||||
//line views/hypha.qtpl:78
|
//line views/hypha.qtpl:78
|
||||||
}
|
}
|
||||||
|
|
||||||
//line views/hypha.qtpl:78
|
//line views/hypha.qtpl:78
|
||||||
func WriteAttachmentHTMLRaw(qq422016 qtio422016.Writer, h *hyphae.MediaHypha) {
|
func WriteMediaHTMLRaw(qq422016 qtio422016.Writer, h *hyphae.MediaHypha) {
|
||||||
//line views/hypha.qtpl:78
|
//line views/hypha.qtpl:78
|
||||||
qw422016 := qt422016.AcquireWriter(qq422016)
|
qw422016 := qt422016.AcquireWriter(qq422016)
|
||||||
//line views/hypha.qtpl:78
|
//line views/hypha.qtpl:78
|
||||||
StreamAttachmentHTMLRaw(qw422016, h)
|
StreamMediaHTMLRaw(qw422016, h)
|
||||||
//line views/hypha.qtpl:78
|
//line views/hypha.qtpl:78
|
||||||
qt422016.ReleaseWriter(qw422016)
|
qt422016.ReleaseWriter(qw422016)
|
||||||
//line views/hypha.qtpl:78
|
//line views/hypha.qtpl:78
|
||||||
}
|
}
|
||||||
|
|
||||||
//line views/hypha.qtpl:78
|
//line views/hypha.qtpl:78
|
||||||
func AttachmentHTMLRaw(h *hyphae.MediaHypha) string {
|
func MediaHTMLRaw(h *hyphae.MediaHypha) string {
|
||||||
//line views/hypha.qtpl:78
|
//line views/hypha.qtpl:78
|
||||||
qb422016 := qt422016.AcquireByteBuffer()
|
qb422016 := qt422016.AcquireByteBuffer()
|
||||||
//line views/hypha.qtpl:78
|
//line views/hypha.qtpl:78
|
||||||
WriteAttachmentHTMLRaw(qb422016, h)
|
WriteMediaHTMLRaw(qb422016, h)
|
||||||
//line views/hypha.qtpl:78
|
//line views/hypha.qtpl:78
|
||||||
qs422016 := string(qb422016.B)
|
qs422016 := string(qb422016.B)
|
||||||
//line views/hypha.qtpl:78
|
//line views/hypha.qtpl:78
|
||||||
@ -382,7 +382,7 @@ func AttachmentHTMLRaw(h *hyphae.MediaHypha) string {
|
|||||||
}
|
}
|
||||||
|
|
||||||
//line views/hypha.qtpl:80
|
//line views/hypha.qtpl:80
|
||||||
func StreamAttachmentHTML(qw422016 *qt422016.Writer, h *hyphae.MediaHypha, lc *l18n.Localizer) {
|
func StreamMediaHTML(qw422016 *qt422016.Writer, h *hyphae.MediaHypha, lc *l18n.Localizer) {
|
||||||
//line views/hypha.qtpl:80
|
//line views/hypha.qtpl:80
|
||||||
qw422016.N().S(`
|
qw422016.N().S(`
|
||||||
`)
|
`)
|
||||||
@ -486,22 +486,22 @@ func StreamAttachmentHTML(qw422016 *qt422016.Writer, h *hyphae.MediaHypha, lc *l
|
|||||||
}
|
}
|
||||||
|
|
||||||
//line views/hypha.qtpl:109
|
//line views/hypha.qtpl:109
|
||||||
func WriteAttachmentHTML(qq422016 qtio422016.Writer, h *hyphae.MediaHypha, lc *l18n.Localizer) {
|
func WriteMediaHTML(qq422016 qtio422016.Writer, h *hyphae.MediaHypha, lc *l18n.Localizer) {
|
||||||
//line views/hypha.qtpl:109
|
//line views/hypha.qtpl:109
|
||||||
qw422016 := qt422016.AcquireWriter(qq422016)
|
qw422016 := qt422016.AcquireWriter(qq422016)
|
||||||
//line views/hypha.qtpl:109
|
//line views/hypha.qtpl:109
|
||||||
StreamAttachmentHTML(qw422016, h, lc)
|
StreamMediaHTML(qw422016, h, lc)
|
||||||
//line views/hypha.qtpl:109
|
//line views/hypha.qtpl:109
|
||||||
qt422016.ReleaseWriter(qw422016)
|
qt422016.ReleaseWriter(qw422016)
|
||||||
//line views/hypha.qtpl:109
|
//line views/hypha.qtpl:109
|
||||||
}
|
}
|
||||||
|
|
||||||
//line views/hypha.qtpl:109
|
//line views/hypha.qtpl:109
|
||||||
func AttachmentHTML(h *hyphae.MediaHypha, lc *l18n.Localizer) string {
|
func MediaHTML(h *hyphae.MediaHypha, lc *l18n.Localizer) string {
|
||||||
//line views/hypha.qtpl:109
|
//line views/hypha.qtpl:109
|
||||||
qb422016 := qt422016.AcquireByteBuffer()
|
qb422016 := qt422016.AcquireByteBuffer()
|
||||||
//line views/hypha.qtpl:109
|
//line views/hypha.qtpl:109
|
||||||
WriteAttachmentHTML(qb422016, h, lc)
|
WriteMediaHTML(qb422016, h, lc)
|
||||||
//line views/hypha.qtpl:109
|
//line views/hypha.qtpl:109
|
||||||
qs422016 := string(qb422016.B)
|
qs422016 := string(qb422016.B)
|
||||||
//line views/hypha.qtpl:109
|
//line views/hypha.qtpl:109
|
||||||
|
@ -26,7 +26,7 @@
|
|||||||
{%= hyphaInfoEntry(h, u, "rename", lc.Get("ui.rename_link")) %}
|
{%= hyphaInfoEntry(h, u, "rename", lc.Get("ui.rename_link")) %}
|
||||||
{%= hyphaInfoEntry(h, u, "delete", lc.Get("ui.delete_link")) %}
|
{%= hyphaInfoEntry(h, u, "delete", lc.Get("ui.delete_link")) %}
|
||||||
{%= hyphaInfoEntry(h, u, "text", lc.Get("ui.text_link")) %}
|
{%= hyphaInfoEntry(h, u, "text", lc.Get("ui.text_link")) %}
|
||||||
{%= hyphaInfoEntry(h, u, "attachment", lc.Get("ui.attachment_link")) %}
|
{%= hyphaInfoEntry(h, u, "media", lc.Get("ui.media_link")) %}
|
||||||
{%= hyphaInfoEntry(h, u, "backlinks", lc.GetPlural("ui.backlinks_link", backs)) %}
|
{%= hyphaInfoEntry(h, u, "backlinks", lc.GetPlural("ui.backlinks_link", backs)) %}
|
||||||
</ul>
|
</ul>
|
||||||
</nav>
|
</nav>
|
||||||
|
@ -137,7 +137,7 @@ func streamhyphaInfo(qw422016 *qt422016.Writer, rq *http.Request, h hyphae.Hypha
|
|||||||
qw422016.N().S(`
|
qw422016.N().S(`
|
||||||
`)
|
`)
|
||||||
//line views/nav.qtpl:29
|
//line views/nav.qtpl:29
|
||||||
streamhyphaInfoEntry(qw422016, h, u, "attachment", lc.Get("ui.attachment_link"))
|
streamhyphaInfoEntry(qw422016, h, u, "media", lc.Get("ui.media_link"))
|
||||||
//line views/nav.qtpl:29
|
//line views/nav.qtpl:29
|
||||||
qw422016.N().S(`
|
qw422016.N().S(`
|
||||||
`)
|
`)
|
||||||
|
@ -11,18 +11,18 @@
|
|||||||
{% import "github.com/bouncepaw/mycorrhiza/user" %}
|
{% import "github.com/bouncepaw/mycorrhiza/user" %}
|
||||||
{% import "github.com/bouncepaw/mycorrhiza/util" %}
|
{% import "github.com/bouncepaw/mycorrhiza/util" %}
|
||||||
|
|
||||||
{% func AttachmentMenuHTML(rq *http.Request, h hyphae.Hypha, u *user.User) %}
|
{% func MediaMenuHTML(rq *http.Request, h hyphae.Hypha, u *user.User) %}
|
||||||
{% code
|
{% code
|
||||||
lc := l18n.FromRequest(rq)
|
lc := l18n.FromRequest(rq)
|
||||||
%}
|
%}
|
||||||
<div class="layout">
|
<div class="layout">
|
||||||
<main class="main-width attachment-tab">
|
<main class="main-width media-tab">
|
||||||
<h1>{%s= lc.Get("ui.attach_title", &l18n.Replacements{"name": beautifulLink(h.CanonicalName())}) %}</h1>
|
<h1>{%s= lc.Get("ui.media_title", &l18n.Replacements{"name": beautifulLink(h.CanonicalName())}) %}</h1>
|
||||||
{% switch h.(type) %}
|
{% switch h.(type) %}
|
||||||
{% case *hyphae.MediaHypha %}
|
{% case *hyphae.MediaHypha %}
|
||||||
<p class="explanation">{%s lc.Get("ui.attach_tip") %} <a href="/help/en/attachment" class="shy-link">{%s lc.Get("ui.attach_link") %}</a></p>
|
<p class="explanation">{%s lc.Get("ui.media_tip") %} <a href="/help/en/media" class="shy-link">{%s lc.Get("ui.media_what_is") %}</a></p>
|
||||||
{% default %}
|
{% default %}
|
||||||
<p class="explanation">{%s lc.Get("ui.attach_empty") %} <a href="/help/en/attachment" class="shy-link">{%s lc.Get("ui.attach_link") %}</a></p>
|
<p class="explanation">{%s lc.Get("ui.media_empty") %} <a href="/help/en/media" class="shy-link">{%s lc.Get("ui.media_what_is") %}</a></p>
|
||||||
{% endswitch %}
|
{% endswitch %}
|
||||||
|
|
||||||
<section class="amnt-grid">
|
<section class="amnt-grid">
|
||||||
@ -33,16 +33,16 @@
|
|||||||
fileinfo, err := os.Stat(h.MediaFilePath()) %}
|
fileinfo, err := os.Stat(h.MediaFilePath()) %}
|
||||||
{% if err == nil %}
|
{% if err == nil %}
|
||||||
<fieldset class="amnt-menu-block">
|
<fieldset class="amnt-menu-block">
|
||||||
<legend class="modal__title modal__title_small">{%s lc.Get("ui.attach_stat") %}</legend>
|
<legend class="modal__title modal__title_small">{%s lc.Get("ui.media_stat") %}</legend>
|
||||||
<p class="modal__confirmation-msg"><b>{%s lc.Get("ui.attach_stat_size") %}</b> {%s lc.GetPlural64("ui.attach_size_value", fileinfo.Size())%}</p>
|
<p class="modal__confirmation-msg"><b>{%s lc.Get("ui.media_stat_size") %}</b> {%s lc.GetPlural64("ui.media_size_value", fileinfo.Size())%}</p>
|
||||||
<p><b>{%s lc.Get("ui.attach_stat_mime") %}</b> {%s mime %}</p>
|
<p><b>{%s lc.Get("ui.media_stat_mime") %}</b> {%s mime %}</p>
|
||||||
</fieldset>
|
</fieldset>
|
||||||
{% endif %}
|
{% endif %}
|
||||||
|
|
||||||
{% if strings.HasPrefix(mime, "image/") %}
|
{% if strings.HasPrefix(mime, "image/") %}
|
||||||
<fieldset class="amnt-menu-block">
|
<fieldset class="amnt-menu-block">
|
||||||
<legend class="modal__title modal__title_small">{%s lc.Get("ui.attach_include") %}</legend>
|
<legend class="modal__title modal__title_small">{%s lc.Get("ui.media_include") %}</legend>
|
||||||
<p class="modal__confirmation-msg">{%s lc.Get("ui.attach_include_tip") %}</p>
|
<p class="modal__confirmation-msg">{%s lc.Get("ui.media_include_tip") %}</p>
|
||||||
<pre class="codeblock"><code>img { {%s h.CanonicalName() %} }</code></pre>
|
<pre class="codeblock"><code>img { {%s h.CanonicalName() %} }</code></pre>
|
||||||
</fieldset>
|
</fieldset>
|
||||||
{% endif %}
|
{% endif %}
|
||||||
@ -53,12 +53,12 @@
|
|||||||
method="post" enctype="multipart/form-data"
|
method="post" enctype="multipart/form-data"
|
||||||
class="upload-binary modal amnt-menu-block">
|
class="upload-binary modal amnt-menu-block">
|
||||||
<fieldset class="modal__fieldset">
|
<fieldset class="modal__fieldset">
|
||||||
<legend class="modal__title modal__title_small">{%s lc.Get("ui.attach_new") %}</legend>
|
<legend class="modal__title modal__title_small">{%s lc.Get("ui.media_new") %}</legend>
|
||||||
<p class="modal__confirmation-msg">{%s lc.Get("ui.attach_new_tip") %}</p>
|
<p class="modal__confirmation-msg">{%s lc.Get("ui.media_new_tip") %}</p>
|
||||||
<label for="upload-binary__input"></label>
|
<label for="upload-binary__input"></label>
|
||||||
<input type="file" id="upload-binary__input" name="binary">
|
<input type="file" id="upload-binary__input" name="binary">
|
||||||
|
|
||||||
<button type="submit" class="btn stick-to-bottom" value="Upload">{%s lc.Get("ui.attach_upload")%}</button>
|
<button type="submit" class="btn stick-to-bottom" value="Upload">{%s lc.Get("ui.media_upload")%}</button>
|
||||||
</fieldset>
|
</fieldset>
|
||||||
</form>
|
</form>
|
||||||
{% endif %}
|
{% endif %}
|
||||||
@ -66,12 +66,12 @@
|
|||||||
|
|
||||||
{% switch h := h.(type) %}
|
{% switch h := h.(type) %}
|
||||||
{% case *hyphae.MediaHypha %}
|
{% case *hyphae.MediaHypha %}
|
||||||
{% if u.CanProceed("unattach-confirm") %}
|
{% if u.CanProceed("remove-media") %}
|
||||||
<form action="/unattach-confirm/{%s h.CanonicalName() %}" method="post" class="modal amnt-menu-block">
|
<form action="/remove-media/{%s h.CanonicalName() %}" method="post" class="modal amnt-menu-block" method="POST">
|
||||||
<fieldset class="modal__fieldset">
|
<fieldset class="modal__fieldset">
|
||||||
<legend class="modal__title modal__title_small">{%s lc.Get("ui.attach_remove") %}</legend>
|
<legend class="modal__title modal__title_small">{%s lc.Get("ui.media_remove") %}</legend>
|
||||||
<p class="modal__confirmation-msg">{%s lc.Get("ui.attach_remove_tip") %}</p>
|
<p class="modal__confirmation-msg">{%s lc.Get("ui.media_remove_tip") %}</p>
|
||||||
<button type="submit" class="btn" value="Unattach">{%s lc.Get("ui.attach_remove_button") %}</button>
|
<button type="submit" class="btn" value="Remove media">{%s lc.Get("ui.media_remove_button") %}</button>
|
||||||
</fieldset>
|
</fieldset>
|
||||||
</form>
|
</form>
|
||||||
{% endif %}
|
{% endif %}
|
||||||
|
@ -51,7 +51,7 @@ var (
|
|||||||
)
|
)
|
||||||
|
|
||||||
//line views/readers.qtpl:14
|
//line views/readers.qtpl:14
|
||||||
func StreamAttachmentMenuHTML(qw422016 *qt422016.Writer, rq *http.Request, h hyphae.Hypha, u *user.User) {
|
func StreamMediaMenuHTML(qw422016 *qt422016.Writer, rq *http.Request, h hyphae.Hypha, u *user.User) {
|
||||||
//line views/readers.qtpl:14
|
//line views/readers.qtpl:14
|
||||||
qw422016.N().S(`
|
qw422016.N().S(`
|
||||||
`)
|
`)
|
||||||
@ -61,10 +61,10 @@ func StreamAttachmentMenuHTML(qw422016 *qt422016.Writer, rq *http.Request, h hyp
|
|||||||
//line views/readers.qtpl:17
|
//line views/readers.qtpl:17
|
||||||
qw422016.N().S(`
|
qw422016.N().S(`
|
||||||
<div class="layout">
|
<div class="layout">
|
||||||
<main class="main-width attachment-tab">
|
<main class="main-width media-tab">
|
||||||
<h1>`)
|
<h1>`)
|
||||||
//line views/readers.qtpl:20
|
//line views/readers.qtpl:20
|
||||||
qw422016.N().S(lc.Get("ui.attach_title", &l18n.Replacements{"name": beautifulLink(h.CanonicalName())}))
|
qw422016.N().S(lc.Get("ui.media_title", &l18n.Replacements{"name": beautifulLink(h.CanonicalName())}))
|
||||||
//line views/readers.qtpl:20
|
//line views/readers.qtpl:20
|
||||||
qw422016.N().S(`</h1>
|
qw422016.N().S(`</h1>
|
||||||
`)
|
`)
|
||||||
@ -76,11 +76,11 @@ func StreamAttachmentMenuHTML(qw422016 *qt422016.Writer, rq *http.Request, h hyp
|
|||||||
qw422016.N().S(`
|
qw422016.N().S(`
|
||||||
<p class="explanation">`)
|
<p class="explanation">`)
|
||||||
//line views/readers.qtpl:23
|
//line views/readers.qtpl:23
|
||||||
qw422016.E().S(lc.Get("ui.attach_tip"))
|
qw422016.E().S(lc.Get("ui.media_tip"))
|
||||||
//line views/readers.qtpl:23
|
//line views/readers.qtpl:23
|
||||||
qw422016.N().S(` <a href="/help/en/attachment" class="shy-link">`)
|
qw422016.N().S(` <a href="/help/en/media" class="shy-link">`)
|
||||||
//line views/readers.qtpl:23
|
//line views/readers.qtpl:23
|
||||||
qw422016.E().S(lc.Get("ui.attach_link"))
|
qw422016.E().S(lc.Get("ui.media_what_is"))
|
||||||
//line views/readers.qtpl:23
|
//line views/readers.qtpl:23
|
||||||
qw422016.N().S(`</a></p>
|
qw422016.N().S(`</a></p>
|
||||||
`)
|
`)
|
||||||
@ -90,11 +90,11 @@ func StreamAttachmentMenuHTML(qw422016 *qt422016.Writer, rq *http.Request, h hyp
|
|||||||
qw422016.N().S(`
|
qw422016.N().S(`
|
||||||
<p class="explanation">`)
|
<p class="explanation">`)
|
||||||
//line views/readers.qtpl:25
|
//line views/readers.qtpl:25
|
||||||
qw422016.E().S(lc.Get("ui.attach_empty"))
|
qw422016.E().S(lc.Get("ui.media_empty"))
|
||||||
//line views/readers.qtpl:25
|
//line views/readers.qtpl:25
|
||||||
qw422016.N().S(` <a href="/help/en/attachment" class="shy-link">`)
|
qw422016.N().S(` <a href="/help/en/media" class="shy-link">`)
|
||||||
//line views/readers.qtpl:25
|
//line views/readers.qtpl:25
|
||||||
qw422016.E().S(lc.Get("ui.attach_link"))
|
qw422016.E().S(lc.Get("ui.media_what_is"))
|
||||||
//line views/readers.qtpl:25
|
//line views/readers.qtpl:25
|
||||||
qw422016.N().S(`</a></p>
|
qw422016.N().S(`</a></p>
|
||||||
`)
|
`)
|
||||||
@ -126,21 +126,21 @@ func StreamAttachmentMenuHTML(qw422016 *qt422016.Writer, rq *http.Request, h hyp
|
|||||||
<fieldset class="amnt-menu-block">
|
<fieldset class="amnt-menu-block">
|
||||||
<legend class="modal__title modal__title_small">`)
|
<legend class="modal__title modal__title_small">`)
|
||||||
//line views/readers.qtpl:36
|
//line views/readers.qtpl:36
|
||||||
qw422016.E().S(lc.Get("ui.attach_stat"))
|
qw422016.E().S(lc.Get("ui.media_stat"))
|
||||||
//line views/readers.qtpl:36
|
//line views/readers.qtpl:36
|
||||||
qw422016.N().S(`</legend>
|
qw422016.N().S(`</legend>
|
||||||
<p class="modal__confirmation-msg"><b>`)
|
<p class="modal__confirmation-msg"><b>`)
|
||||||
//line views/readers.qtpl:37
|
//line views/readers.qtpl:37
|
||||||
qw422016.E().S(lc.Get("ui.attach_stat_size"))
|
qw422016.E().S(lc.Get("ui.media_stat_size"))
|
||||||
//line views/readers.qtpl:37
|
//line views/readers.qtpl:37
|
||||||
qw422016.N().S(`</b> `)
|
qw422016.N().S(`</b> `)
|
||||||
//line views/readers.qtpl:37
|
//line views/readers.qtpl:37
|
||||||
qw422016.E().S(lc.GetPlural64("ui.attach_size_value", fileinfo.Size()))
|
qw422016.E().S(lc.GetPlural64("ui.media_size_value", fileinfo.Size()))
|
||||||
//line views/readers.qtpl:37
|
//line views/readers.qtpl:37
|
||||||
qw422016.N().S(`</p>
|
qw422016.N().S(`</p>
|
||||||
<p><b>`)
|
<p><b>`)
|
||||||
//line views/readers.qtpl:38
|
//line views/readers.qtpl:38
|
||||||
qw422016.E().S(lc.Get("ui.attach_stat_mime"))
|
qw422016.E().S(lc.Get("ui.media_stat_mime"))
|
||||||
//line views/readers.qtpl:38
|
//line views/readers.qtpl:38
|
||||||
qw422016.N().S(`</b> `)
|
qw422016.N().S(`</b> `)
|
||||||
//line views/readers.qtpl:38
|
//line views/readers.qtpl:38
|
||||||
@ -162,12 +162,12 @@ func StreamAttachmentMenuHTML(qw422016 *qt422016.Writer, rq *http.Request, h hyp
|
|||||||
<fieldset class="amnt-menu-block">
|
<fieldset class="amnt-menu-block">
|
||||||
<legend class="modal__title modal__title_small">`)
|
<legend class="modal__title modal__title_small">`)
|
||||||
//line views/readers.qtpl:44
|
//line views/readers.qtpl:44
|
||||||
qw422016.E().S(lc.Get("ui.attach_include"))
|
qw422016.E().S(lc.Get("ui.media_include"))
|
||||||
//line views/readers.qtpl:44
|
//line views/readers.qtpl:44
|
||||||
qw422016.N().S(`</legend>
|
qw422016.N().S(`</legend>
|
||||||
<p class="modal__confirmation-msg">`)
|
<p class="modal__confirmation-msg">`)
|
||||||
//line views/readers.qtpl:45
|
//line views/readers.qtpl:45
|
||||||
qw422016.E().S(lc.Get("ui.attach_include_tip"))
|
qw422016.E().S(lc.Get("ui.media_include_tip"))
|
||||||
//line views/readers.qtpl:45
|
//line views/readers.qtpl:45
|
||||||
qw422016.N().S(`</p>
|
qw422016.N().S(`</p>
|
||||||
<pre class="codeblock"><code>img { `)
|
<pre class="codeblock"><code>img { `)
|
||||||
@ -202,12 +202,12 @@ func StreamAttachmentMenuHTML(qw422016 *qt422016.Writer, rq *http.Request, h hyp
|
|||||||
<fieldset class="modal__fieldset">
|
<fieldset class="modal__fieldset">
|
||||||
<legend class="modal__title modal__title_small">`)
|
<legend class="modal__title modal__title_small">`)
|
||||||
//line views/readers.qtpl:56
|
//line views/readers.qtpl:56
|
||||||
qw422016.E().S(lc.Get("ui.attach_new"))
|
qw422016.E().S(lc.Get("ui.media_new"))
|
||||||
//line views/readers.qtpl:56
|
//line views/readers.qtpl:56
|
||||||
qw422016.N().S(`</legend>
|
qw422016.N().S(`</legend>
|
||||||
<p class="modal__confirmation-msg">`)
|
<p class="modal__confirmation-msg">`)
|
||||||
//line views/readers.qtpl:57
|
//line views/readers.qtpl:57
|
||||||
qw422016.E().S(lc.Get("ui.attach_new_tip"))
|
qw422016.E().S(lc.Get("ui.media_new_tip"))
|
||||||
//line views/readers.qtpl:57
|
//line views/readers.qtpl:57
|
||||||
qw422016.N().S(`</p>
|
qw422016.N().S(`</p>
|
||||||
<label for="upload-binary__input"></label>
|
<label for="upload-binary__input"></label>
|
||||||
@ -215,7 +215,7 @@ func StreamAttachmentMenuHTML(qw422016 *qt422016.Writer, rq *http.Request, h hyp
|
|||||||
|
|
||||||
<button type="submit" class="btn stick-to-bottom" value="Upload">`)
|
<button type="submit" class="btn stick-to-bottom" value="Upload">`)
|
||||||
//line views/readers.qtpl:61
|
//line views/readers.qtpl:61
|
||||||
qw422016.E().S(lc.Get("ui.attach_upload"))
|
qw422016.E().S(lc.Get("ui.media_upload"))
|
||||||
//line views/readers.qtpl:61
|
//line views/readers.qtpl:61
|
||||||
qw422016.N().S(`</button>
|
qw422016.N().S(`</button>
|
||||||
</fieldset>
|
</fieldset>
|
||||||
@ -236,28 +236,28 @@ func StreamAttachmentMenuHTML(qw422016 *qt422016.Writer, rq *http.Request, h hyp
|
|||||||
qw422016.N().S(`
|
qw422016.N().S(`
|
||||||
`)
|
`)
|
||||||
//line views/readers.qtpl:69
|
//line views/readers.qtpl:69
|
||||||
if u.CanProceed("unattach-confirm") {
|
if u.CanProceed("remove-media") {
|
||||||
//line views/readers.qtpl:69
|
//line views/readers.qtpl:69
|
||||||
qw422016.N().S(`
|
qw422016.N().S(`
|
||||||
<form action="/unattach-confirm/`)
|
<form action="/remove-media/`)
|
||||||
//line views/readers.qtpl:70
|
//line views/readers.qtpl:70
|
||||||
qw422016.E().S(h.CanonicalName())
|
qw422016.E().S(h.CanonicalName())
|
||||||
//line views/readers.qtpl:70
|
//line views/readers.qtpl:70
|
||||||
qw422016.N().S(`" method="post" class="modal amnt-menu-block">
|
qw422016.N().S(`" method="post" class="modal amnt-menu-block" method="POST">
|
||||||
<fieldset class="modal__fieldset">
|
<fieldset class="modal__fieldset">
|
||||||
<legend class="modal__title modal__title_small">`)
|
<legend class="modal__title modal__title_small">`)
|
||||||
//line views/readers.qtpl:72
|
//line views/readers.qtpl:72
|
||||||
qw422016.E().S(lc.Get("ui.attach_remove"))
|
qw422016.E().S(lc.Get("ui.media_remove"))
|
||||||
//line views/readers.qtpl:72
|
//line views/readers.qtpl:72
|
||||||
qw422016.N().S(`</legend>
|
qw422016.N().S(`</legend>
|
||||||
<p class="modal__confirmation-msg">`)
|
<p class="modal__confirmation-msg">`)
|
||||||
//line views/readers.qtpl:73
|
//line views/readers.qtpl:73
|
||||||
qw422016.E().S(lc.Get("ui.attach_remove_tip"))
|
qw422016.E().S(lc.Get("ui.media_remove_tip"))
|
||||||
//line views/readers.qtpl:73
|
//line views/readers.qtpl:73
|
||||||
qw422016.N().S(`</p>
|
qw422016.N().S(`</p>
|
||||||
<button type="submit" class="btn" value="Unattach">`)
|
<button type="submit" class="btn" value="Remove media">`)
|
||||||
//line views/readers.qtpl:74
|
//line views/readers.qtpl:74
|
||||||
qw422016.E().S(lc.Get("ui.attach_remove_button"))
|
qw422016.E().S(lc.Get("ui.media_remove_button"))
|
||||||
//line views/readers.qtpl:74
|
//line views/readers.qtpl:74
|
||||||
qw422016.N().S(`</button>
|
qw422016.N().S(`</button>
|
||||||
</fieldset>
|
</fieldset>
|
||||||
@ -281,22 +281,22 @@ func StreamAttachmentMenuHTML(qw422016 *qt422016.Writer, rq *http.Request, h hyp
|
|||||||
}
|
}
|
||||||
|
|
||||||
//line views/readers.qtpl:83
|
//line views/readers.qtpl:83
|
||||||
func WriteAttachmentMenuHTML(qq422016 qtio422016.Writer, rq *http.Request, h hyphae.Hypha, u *user.User) {
|
func WriteMediaMenuHTML(qq422016 qtio422016.Writer, rq *http.Request, h hyphae.Hypha, u *user.User) {
|
||||||
//line views/readers.qtpl:83
|
//line views/readers.qtpl:83
|
||||||
qw422016 := qt422016.AcquireWriter(qq422016)
|
qw422016 := qt422016.AcquireWriter(qq422016)
|
||||||
//line views/readers.qtpl:83
|
//line views/readers.qtpl:83
|
||||||
StreamAttachmentMenuHTML(qw422016, rq, h, u)
|
StreamMediaMenuHTML(qw422016, rq, h, u)
|
||||||
//line views/readers.qtpl:83
|
//line views/readers.qtpl:83
|
||||||
qt422016.ReleaseWriter(qw422016)
|
qt422016.ReleaseWriter(qw422016)
|
||||||
//line views/readers.qtpl:83
|
//line views/readers.qtpl:83
|
||||||
}
|
}
|
||||||
|
|
||||||
//line views/readers.qtpl:83
|
//line views/readers.qtpl:83
|
||||||
func AttachmentMenuHTML(rq *http.Request, h hyphae.Hypha, u *user.User) string {
|
func MediaMenuHTML(rq *http.Request, h hyphae.Hypha, u *user.User) string {
|
||||||
//line views/readers.qtpl:83
|
//line views/readers.qtpl:83
|
||||||
qb422016 := qt422016.AcquireByteBuffer()
|
qb422016 := qt422016.AcquireByteBuffer()
|
||||||
//line views/readers.qtpl:83
|
//line views/readers.qtpl:83
|
||||||
WriteAttachmentMenuHTML(qb422016, rq, h, u)
|
WriteMediaMenuHTML(qb422016, rq, h, u)
|
||||||
//line views/readers.qtpl:83
|
//line views/readers.qtpl:83
|
||||||
qs422016 := string(qb422016.B)
|
qs422016 := string(qb422016.B)
|
||||||
//line views/readers.qtpl:83
|
//line views/readers.qtpl:83
|
||||||
|
@ -168,7 +168,7 @@ It outputs a poorly formatted JSON, but it works and is valid.
|
|||||||
<li><a href="/help/{%s lang %}">{%s lc.GetWithLocale(lang, "help.main") %}</a></li>
|
<li><a href="/help/{%s lang %}">{%s lc.GetWithLocale(lang, "help.main") %}</a></li>
|
||||||
<li><a href="/help/{%s lang %}/hypha">{%s lc.GetWithLocale(lang, "help.hypha") %}</a>
|
<li><a href="/help/{%s lang %}/hypha">{%s lc.GetWithLocale(lang, "help.hypha") %}</a>
|
||||||
<ul>
|
<ul>
|
||||||
<li><a href="/help/{%s lang %}/attachment">{%s lc.GetWithLocale(lang, "help.attachment") %}</a></li>
|
<li><a href="/help/{%s lang %}/media">{%s lc.GetWithLocale(lang, "help.media") %}</a></li>
|
||||||
</ul>
|
</ul>
|
||||||
</li>
|
</li>
|
||||||
<li><a href="/help/{%s lang %}/mycomarkup">{%s lc.GetWithLocale(lang, "help.mycomarkup") %}</a></li>
|
<li><a href="/help/{%s lang %}/mycomarkup">{%s lc.GetWithLocale(lang, "help.mycomarkup") %}</a></li>
|
||||||
|
@ -637,9 +637,9 @@ func streamhelpTopicsHTML(qw422016 *qt422016.Writer, lang string, lc *l18n.Local
|
|||||||
//line views/stuff.qtpl:171
|
//line views/stuff.qtpl:171
|
||||||
qw422016.E().S(lang)
|
qw422016.E().S(lang)
|
||||||
//line views/stuff.qtpl:171
|
//line views/stuff.qtpl:171
|
||||||
qw422016.N().S(`/attachment">`)
|
qw422016.N().S(`/media">`)
|
||||||
//line views/stuff.qtpl:171
|
//line views/stuff.qtpl:171
|
||||||
qw422016.E().S(lc.GetWithLocale(lang, "help.attachment"))
|
qw422016.E().S(lc.GetWithLocale(lang, "help.media"))
|
||||||
//line views/stuff.qtpl:171
|
//line views/stuff.qtpl:171
|
||||||
qw422016.N().S(`</a></li>
|
qw422016.N().S(`</a></li>
|
||||||
</ul>
|
</ul>
|
||||||
|
@ -228,7 +228,7 @@ func handlerUploadText(w http.ResponseWriter, rq *http.Request) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// handlerUploadBinary uploads a new attachment for the hypha.
|
// handlerUploadBinary uploads a new media for the hypha.
|
||||||
func handlerUploadBinary(w http.ResponseWriter, rq *http.Request) {
|
func handlerUploadBinary(w http.ResponseWriter, rq *http.Request) {
|
||||||
util.PrepareRq(rq)
|
util.PrepareRq(rq)
|
||||||
rq.ParseMultipartForm(10 << 20) // Set upload limit
|
rq.ParseMultipartForm(10 << 20) // Set upload limit
|
||||||
|
@ -33,21 +33,21 @@ func initReaders(r *mux.Router) {
|
|||||||
r.PathPrefix("/rev/").HandlerFunc(handlerRevision)
|
r.PathPrefix("/rev/").HandlerFunc(handlerRevision)
|
||||||
r.PathPrefix("/rev-text/").HandlerFunc(handlerRevisionText)
|
r.PathPrefix("/rev-text/").HandlerFunc(handlerRevisionText)
|
||||||
r.PathPrefix("/primitive-diff/").HandlerFunc(handlerPrimitiveDiff)
|
r.PathPrefix("/primitive-diff/").HandlerFunc(handlerPrimitiveDiff)
|
||||||
r.PathPrefix("/attachment/").HandlerFunc(handlerAttachment)
|
r.PathPrefix("/media/").HandlerFunc(handlerMedia)
|
||||||
}
|
}
|
||||||
|
|
||||||
func handlerAttachment(w http.ResponseWriter, rq *http.Request) {
|
func handlerMedia(w http.ResponseWriter, rq *http.Request) {
|
||||||
util.PrepareRq(rq)
|
util.PrepareRq(rq)
|
||||||
var (
|
var (
|
||||||
hyphaName = util.HyphaNameFromRq(rq, "attachment")
|
hyphaName = util.HyphaNameFromRq(rq, "media")
|
||||||
h = hyphae.ByName(hyphaName)
|
h = hyphae.ByName(hyphaName)
|
||||||
u = user.FromRequest(rq)
|
u = user.FromRequest(rq)
|
||||||
lc = l18n.FromRequest(rq)
|
lc = l18n.FromRequest(rq)
|
||||||
)
|
)
|
||||||
util.HTTP200Page(w,
|
util.HTTP200Page(w,
|
||||||
views.BaseHTML(
|
views.BaseHTML(
|
||||||
lc.Get("ui.attach_title", &l18n.Replacements{"name": util.BeautifulName(hyphaName)}),
|
lc.Get("ui.media_title", &l18n.Replacements{"name": util.BeautifulName(hyphaName)}),
|
||||||
views.AttachmentMenuHTML(rq, h, u),
|
views.MediaMenuHTML(rq, h, u),
|
||||||
lc,
|
lc,
|
||||||
u))
|
u))
|
||||||
}
|
}
|
||||||
@ -216,7 +216,7 @@ func handlerHypha(w http.ResponseWriter, rq *http.Request) {
|
|||||||
}
|
}
|
||||||
switch h := h.(type) {
|
switch h := h.(type) {
|
||||||
case *hyphae.MediaHypha:
|
case *hyphae.MediaHypha:
|
||||||
contents = views.AttachmentHTML(h, lc) + contents
|
contents = views.MediaHTML(h, lc) + contents
|
||||||
}
|
}
|
||||||
|
|
||||||
util.HTTP200Page(w,
|
util.HTTP200Page(w,
|
||||||
|
Loading…
Reference in New Issue
Block a user