@@ -6,18 +6,18 @@ import ( | |||||
// Issue represents an issue or pull request of repository. | // Issue represents an issue or pull request of repository. | ||||
type Dataset struct { | type Dataset struct { | ||||
ID int64 `xorm:"pk autoincr"` | |||||
Title string `xorm:"INDEX NOT NULL"` | |||||
Status int32 `xorm:"INDEX"` | |||||
Category string | |||||
Description string `xorm:"TEXT"` | |||||
Download_times int64 | |||||
License string | |||||
Task string | |||||
Release_id int64 `xorm:"INDEX"` | |||||
User_id int64 `xorm:"INDEX"` | |||||
CreatedUnix timeutil.TimeStamp `xorm:"INDEX created"` | |||||
UpdatedUnix timeutil.TimeStamp `xorm:"INDEX updated"` | |||||
ID int64 `xorm:"pk autoincr"` | |||||
Title string `xorm:"INDEX NOT NULL"` | |||||
Status int32 `xorm:"INDEX"` | |||||
Category string | |||||
Description string `xorm:"TEXT"` | |||||
DownloadTimes int64 | |||||
License string | |||||
Task string | |||||
ReleaseID int64 `xorm:"INDEX"` | |||||
UserID int64 `xorm:"INDEX"` | |||||
CreatedUnix timeutil.TimeStamp `xorm:"INDEX created"` | |||||
UpdatedUnix timeutil.TimeStamp `xorm:"INDEX updated"` | |||||
Attachments []*Attachment `xorm:"-"` | Attachments []*Attachment `xorm:"-"` | ||||
} | } | ||||
@@ -13,18 +13,18 @@ import ( | |||||
func addDatasetTable(x *xorm.Engine) error { | func addDatasetTable(x *xorm.Engine) error { | ||||
type Dataset struct { | type Dataset struct { | ||||
ID int64 `xorm:"pk autoincr"` | |||||
Title string `xorm:"INDEX NOT NULL"` | |||||
Status int32 `xorm:"INDEX"` | |||||
Category string | |||||
Description string `xorm:"TEXT"` | |||||
Download_times int64 | |||||
License string | |||||
Task string | |||||
Release_id int64 `xorm:"INDEX"` | |||||
User_id int64 `xorm:"INDEX"` | |||||
CreatedUnix timeutil.TimeStamp `xorm:"INDEX created"` | |||||
UpdatedUnix timeutil.TimeStamp `xorm:"INDEX updated"` | |||||
ID int64 `xorm:"pk autoincr"` | |||||
Title string `xorm:"INDEX NOT NULL"` | |||||
Status int32 `xorm:"INDEX"` | |||||
Category string | |||||
Description string `xorm:"TEXT"` | |||||
DownloadTimes int64 | |||||
License string | |||||
Task string | |||||
ReleaseID int64 `xorm:"INDEX"` | |||||
UserID int64 `xorm:"INDEX"` | |||||
CreatedUnix timeutil.TimeStamp `xorm:"INDEX created"` | |||||
UpdatedUnix timeutil.TimeStamp `xorm:"INDEX updated"` | |||||
} | } | ||||
if err := x.Sync2(new(Dataset)); err != nil { | if err := x.Sync2(new(Dataset)); err != nil { | ||||
@@ -10,9 +10,9 @@ type CreateDatasetForm struct { | |||||
Title string `binding:"Required"` | Title string `binding:"Required"` | ||||
Category string `binding:"Required"` | Category string `binding:"Required"` | ||||
Description string `binding:"Required;MaxSize(254)"` | Description string `binding:"Required;MaxSize(254)"` | ||||
License string `binding:"OmitEmpty;MaxSize(64)"` | |||||
Task string | |||||
Release_id int64 `xorm:"INDEX"` | |||||
License string `binding:"Required;MaxSize(64)"` | |||||
Task string `binding:"Required;MaxSize(64)"` | |||||
ReleaseID int64 `xorm:"INDEX"` | |||||
} | } | ||||
// Validate validates the fields | // Validate validates the fields | ||||
@@ -626,7 +626,7 @@ description = Description | |||||
create_dataset = Create Dataset | create_dataset = Create Dataset | ||||
category = Category | category = Category | ||||
task = Task | task = Task | ||||
Licenses = Licenses | |||||
license = license | |||||
file = Dataset File | file = Dataset File | ||||
[repo] | [repo] | ||||
@@ -625,7 +625,7 @@ description = 描述 | |||||
create_dataset = 创建数据集 | create_dataset = 创建数据集 | ||||
category = 分类 | category = 分类 | ||||
task = 针对的具体任务 | task = 针对的具体任务 | ||||
Licenses = Licenses | |||||
license = license | |||||
file = 数据集文件 | file = 数据集文件 | ||||
[repo] | [repo] | ||||
@@ -6,6 +6,7 @@ import ( | |||||
"code.gitea.io/gitea/modules/base" | "code.gitea.io/gitea/modules/base" | ||||
"code.gitea.io/gitea/modules/context" | "code.gitea.io/gitea/modules/context" | ||||
"code.gitea.io/gitea/modules/log" | "code.gitea.io/gitea/modules/log" | ||||
"code.gitea.io/gitea/modules/setting" | |||||
) | ) | ||||
const ( | const ( | ||||
@@ -58,23 +59,25 @@ func CreatePost(ctx *context.Context, form auth.CreateDatasetForm) { | |||||
Description: form.Description, | Description: form.Description, | ||||
License: form.License, | License: form.License, | ||||
Task: form.Task, | Task: form.Task, | ||||
Release_id: form.Release_id, | |||||
User_id: ctxUser.ID, | |||||
ReleaseID: form.ReleaseID, | |||||
UserID: ctxUser.ID, | |||||
Status: 0, | Status: 0, | ||||
} | } | ||||
log.Debug("======================================") | |||||
log.Debug("%#v", opts) | |||||
log.Debug("======================================") | |||||
// if !opts.IsValid() { | // if !opts.IsValid() { | ||||
// ctx.RenderWithErr(ctx.Tr("repo.template.one_item"), tplCreate, form) | // ctx.RenderWithErr(ctx.Tr("repo.template.one_item"), tplCreate, form) | ||||
// return | // return | ||||
// } | // } | ||||
if err = models.CreateDataset(&opts); err != nil { | if err = models.CreateDataset(&opts); err != nil { | ||||
log.Error("%v", err) | log.Error("%v", err) | ||||
} | } | ||||
if err == nil { | |||||
log.Trace("Dataset created [%d]: %s/%s", opts.ID, ctxUser.Name, opts.Title) | |||||
ctx.Redirect(setting.AppSubURL + "/datasets") | |||||
return | |||||
} | |||||
// handleCreateError(ctx, ctxUser, err, "CreatePost", tplCreate, &form) | // handleCreateError(ctx, ctxUser, err, "CreatePost", tplCreate, &form) | ||||
} | } | ||||
@@ -77,10 +77,10 @@ | |||||
</div> | </div> | ||||
<div class="inline required field"> | <div class="inline required field"> | ||||
<label>{{.i18n.Tr "dataset.licenses"}}</label> | |||||
<label>{{.i18n.Tr "dataset.license"}}</label> | |||||
<div class="ui selection owner dropdown"> | <div class="ui selection owner dropdown"> | ||||
<input type="hidden" name="licenses" id="licenses" value="{{.licenses}}" required> | |||||
<div class="default text" style="min-width:20vw">{{.i18n.Tr "dataset.licenses"}}</div> | |||||
<input type="hidden" name="license" id="license" value="{{.license}}" required> | |||||
<div class="default text" style="min-width:20vw">{{.i18n.Tr "dataset.license"}}</div> | |||||
<i class="dropdown icon"></i> | <i class="dropdown icon"></i> | ||||
<div class="menu"> | <div class="menu"> | ||||
<div class="item" data-value="Creative Commons CC BY 4.0"> | <div class="item" data-value="Creative Commons CC BY 4.0"> | ||||