Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
Jonny Schäfer
tubus
Commits
753b6eaa
Commit
753b6eaa
authored
Dec 27, 2015
by
Jonny Schäfer
Browse files
change page number parameter from string to integer
parent
7ee4e2fb
Changes
1
Hide whitespace changes
Inline
Side-by-side
logic.go
View file @
753b6eaa
...
@@ -98,19 +98,16 @@ func logicSearch(title string) {
...
@@ -98,19 +98,16 @@ func logicSearch(title string) {
}
}
logicVarLazy
=
listNew
(
upd
)
logicVarLazy
=
listNew
(
upd
)
logicSearchPage
(
"searching: "
+
title
,
"0"
)
logicSearchPage
(
"searching: "
+
title
,
0
)
}
}
//logicSearchPage searches the title in the given page
//logicSearchPage searches the title in the given page
func
logicSearchPage
(
title
,
page
str
in
g
)
{
func
logicSearchPage
(
title
string
,
page
in
t
)
{
cliStatus
(
"page "
+
page
+
" | "
+
title
)
cliStatus
(
"page "
+
strconv
.
Itoa
(
page
)
+
" | "
+
title
)
logicVarWindow
=
logicWindowSearch
logicVarWindow
=
logicWindowSearch
logicVarSearch
=
title
logicVarSearch
=
title
pnum
,
err
:=
strconv
.
Atoi
(
page
)
list
:=
logicVarLazy
.
listSlice
(
page
*
logicVarLineCount
,
(
page
+
1
)
*
logicVarLineCount
)
errorCare
(
err
)
list
:=
logicVarLazy
.
listSlice
(
pnum
*
logicVarLineCount
,
(
pnum
+
1
)
*
logicVarLineCount
)
if
list
==
nil
{
if
list
==
nil
{
cliStatusError
(
"network error: unable to load data"
)
cliStatusError
(
"network error: unable to load data"
)
...
@@ -155,11 +152,14 @@ func logicNumber(command string) {
...
@@ -155,11 +152,14 @@ func logicNumber(command string) {
// logicPage selects the given page
// logicPage selects the given page
func
logicPage
(
page
string
)
{
func
logicPage
(
page
string
)
{
pnum
,
err
:=
strconv
.
Atoi
(
page
)
errorCare
(
err
)
switch
logicVarWindow
{
switch
logicVarWindow
{
case
logicWindowSearch
:
case
logicWindowSearch
:
logicSearchPage
(
logicVarSearch
,
p
age
)
logicSearchPage
(
logicVarSearch
,
p
num
)
case
logicWindowUser
:
case
logicWindowUser
:
logicUserPage
(
logicVarUser
,
p
age
)
logicUserPage
(
logicVarUser
,
p
num
)
}
}
}
}
...
@@ -249,13 +249,13 @@ func logicSubDel(user string) {
...
@@ -249,13 +249,13 @@ func logicSubDel(user string) {
// logicUser shows the videos of the given user
// logicUser shows the videos of the given user
func
logicUser
(
user
string
)
{
func
logicUser
(
user
string
)
{
logicUserPage
(
user
,
"1"
)
logicUserPage
(
user
,
0
)
}
}
// logicUserPage shows the page of the given user
// logicUserPage shows the page of the given user
func
logicUserPage
(
user
,
page
str
in
g
)
{
func
logicUserPage
(
user
string
,
page
in
t
)
{
// TODO: support pages (priority: low)
// TODO: support pages (priority: low)
cliStatus
(
"page "
+
page
+
" | user: "
+
user
)
cliStatus
(
"page "
+
strconv
.
Itoa
(
page
)
+
" | user: "
+
user
)
logicVarWindow
=
logicWindowUser
logicVarWindow
=
logicWindowUser
logicVarUser
=
user
logicVarUser
=
user
logicList
(
-
1
,
videoListUser
(
user
))
logicList
(
-
1
,
videoListUser
(
user
))
...
@@ -302,7 +302,7 @@ func logicNew(none string) {
...
@@ -302,7 +302,7 @@ func logicNew(none string) {
return
all
return
all
}
}
logicVarLazy
=
listNew
(
upd
)
logicVarLazy
=
listNew
(
upd
)
logicSearchPage
(
"new videos"
,
"0"
)
logicSearchPage
(
"new videos"
,
0
)
}
}
// logicSet sets the key to the given value. Format: "key value"
// logicSet sets the key to the given value. Format: "key value"
...
...
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment