Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
Synchronet
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package registry
Container registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Main
Synchronet
Commits
22f8b205
Commit
22f8b205
authored
8 years ago
by
echicken
Browse files
Options
Downloads
Patches
Plain Diff
Poll-posting things.
parent
3aa991c0
No related branches found
No related tags found
No related merge requests found
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
web/lib/forum.js
+55
-0
55 additions, 0 deletions
web/lib/forum.js
with
55 additions
and
0 deletions
web/lib/forum.js
+
55
−
0
View file @
22f8b205
...
@@ -475,6 +475,61 @@ function postReply(sub, body, pid) {
...
@@ -475,6 +475,61 @@ function postReply(sub, body, pid) {
return
ret
;
return
ret
;
}
}
function
postPoll
(
sub
,
subject
,
votes
,
results
,
answers
,
comments
)
{
if
(
user
.
alias
==
settings
.
guest
||
user
.
security
.
restrictions
&
UFLAG_V
)
{
return
false
;
}
if
(
typeof
msg_area
.
sub
[
sub
]
===
'
undefined
'
||
!
msg_area
.
sub
[
sub
].
can_post
)
{
return
false
;
}
if
(
typeof
subject
!==
'
string
'
||
subject
.
length
<
1
)
return
false
;
if
(
!
Array
.
isArray
(
answers
)
||
answers
.
length
<
2
)
return
false
;
votes
=
parseInt
(
votes
);
if
(
isNaN
(
votes
)
||
votes
<
1
||
votes
>
15
)
return
false
;
if
(
votes
>
answers
)
votes
=
answers
;
results
=
parseInt
(
results
);
if
(
isNaN
(
results
)
||
results
<
0
||
results
>
3
)
{
return
false
;
}
var
header
=
{
subject
:
subject
,
from
:
msg_area
.
sub
[
sub
].
settings
&
SUB_NAME
?
user
.
name
:
user
.
alias
,
from_ext
:
user
.
number
,
field_list
:
[],
auxattr
:
(
results
<<
POLL_RESULTS_SHIFT
),
votes
:
votes
};
if
(
Array
.
isArray
(
comments
))
{
comments
.
forEach
(
function
(
e
)
{
header
.
field_list
.
push
({
type
:
SMB_COMMENT
,
data
:
e
});
}
);
}
answers
.
forEach
(
function
(
e
)
{
header
.
field_list
.
push
({
type
:
SMB_POLL_ANSWER
,
data
:
e
});
}
);
var
msgBase
=
new
MsgBase
(
sub
);
if
(
!
msgBase
.
open
())
return
false
;
var
ret
=
msgBase
.
add_poll
(
header
);
msgBase
.
close
();
return
ret
;
}
// Delete a message if
// Delete a message if
// - This is the mail sub, and the message was sent by or to this user
// - This is the mail sub, and the message was sent by or to this user
// - This is another sub on which the user is an operator
// - This is another sub on which the user is an operator
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment