Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
G
gnu-social
Project overview
Project overview
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
194
Issues
194
List
Boards
Labels
Milestones
Merge Requests
12
Merge Requests
12
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
gnu.io
gnu-social
Commits
b5ac6e31
Commit
b5ac6e31
authored
May 24, 2009
by
Robin Millette
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Rearranged attachment info to only appear on each applicable notice page and thru an ajax popup.
parent
456f3eeb
Changes
9
Hide whitespace changes
Inline
Side-by-side
Showing
9 changed files
with
68 additions
and
75 deletions
+68
-75
actions/attachment.php
actions/attachment.php
+4
-6
actions/attachment_ajax.php
actions/attachment_ajax.php
+1
-23
actions/attachments.php
actions/attachments.php
+0
-2
actions/tag.php
actions/tag.php
+2
-2
js/util.js
js/util.js
+4
-3
lib/attachmentlist.php
lib/attachmentlist.php
+1
-5
lib/noticelist.php
lib/noticelist.php
+25
-30
lib/router.php
lib/router.php
+12
-3
theme/base/css/display.css
theme/base/css/display.css
+19
-1
No files found.
actions/attachment.php
View file @
b5ac6e31
...
...
@@ -31,8 +31,6 @@ if (!defined('LACONICA')) {
exit
(
1
);
}
//require_once INSTALLDIR.'/lib/personalgroupnav.php';
//require_once INSTALLDIR.'/lib/feedlist.php';
require_once
INSTALLDIR
.
'/lib/attachmentlist.php'
;
/**
...
...
@@ -67,11 +65,11 @@ class AttachmentAction extends Action
{
parent
::
prepare
(
$args
);
$id
=
$this
->
arg
(
'attachment'
);
$this
->
attachment
=
File
::
staticGet
(
$id
);
if
(
$id
=
$this
->
trimmed
(
'attachment'
))
{
$this
->
attachment
=
File
::
staticGet
(
$id
);
}
if
(
!
$this
->
attachment
)
{
if
(
empty
(
$this
->
attachment
)
)
{
$this
->
clientError
(
_
(
'No such attachment.'
),
404
);
return
false
;
}
...
...
actions/attachment_ajax.php
View file @
b5ac6e31
...
...
@@ -45,26 +45,6 @@ require_once INSTALLDIR.'/actions/attachment.php';
class
Attachment_ajaxAction
extends
AttachmentAction
{
/**
* Load attributes based on database arguments
*
* Loads all the DB stuff
*
* @param array $args $_REQUEST array
*
* @return success flag
*/
function
prepare
(
$args
)
{
parent
::
prepare
(
$args
);
if
(
!
$this
->
attachment
)
{
$this
->
clientError
(
_
(
'No such attachment.'
),
404
);
return
false
;
}
return
true
;
}
/**
* Show page, a template method.
*
...
...
@@ -87,7 +67,7 @@ class Attachment_ajaxAction extends AttachmentAction
*/
function
showCore
()
{
$this
->
elementStart
(
'div'
,
array
(
'id'
=>
'core'
));
$this
->
elementStart
(
'div'
,
array
(
'id'
=>
'
ajax
core'
));
if
(
Event
::
handle
(
'StartShowContentBlock'
,
array
(
$this
)))
{
$this
->
showContentBlock
();
Event
::
handle
(
'EndShowContentBlock'
,
array
(
$this
));
...
...
@@ -95,8 +75,6 @@ class Attachment_ajaxAction extends AttachmentAction
$this
->
elementEnd
(
'div'
);
}
/**
* Last-modified date for page
*
...
...
actions/attachments.php
View file @
b5ac6e31
...
...
@@ -31,8 +31,6 @@ if (!defined('LACONICA')) {
exit
(
1
);
}
//require_once INSTALLDIR.'/lib/personalgroupnav.php';
//require_once INSTALLDIR.'/lib/feedlist.php';
require_once
INSTALLDIR
.
'/lib/attachmentlist.php'
;
/**
...
...
actions/tag.php
View file @
b5ac6e31
...
...
@@ -49,8 +49,8 @@ class TagAction extends Action
{
$pop
=
new
PopularNoticeSection
(
$this
);
$pop
->
show
();
$freqatt
=
new
FrequentAttachmentSection
(
$this
);
$freqatt
->
show
();
//
$freqatt = new FrequentAttachmentSection($this);
//
$freqatt->show();
}
function
title
()
...
...
js/util.js
View file @
b5ac6e31
...
...
@@ -17,9 +17,10 @@
*/
$
(
document
).
ready
(
function
(){
$
(
'
.attachments
'
).
click
(
function
()
{
$
().
jOverlay
({
zIndex
:
999
,
success
:
function
(
html
)
{
$
(
'
.attachment
'
).
click
(
function
()
{
$
().
jOverlay
({
url
:
$
(
this
).
attr
(
'
href
'
)
+
'
/ajax
'
});
return
false
;
});
},
url
:
$
(
this
).
attr
(
'
href
'
)
+
'
/ajax
'
});
return
false
;
});
$
(
'
.attachment
'
).
click
(
function
()
{
$
().
jOverlay
({
url
:
$
(
this
).
attr
(
'
href
'
)
+
'
/ajax
'
});
return
false
;
});
// attachments and attachment pages not used at the moment except for attachment_ajax version
// $('.attachments').click(function() {$().jOverlay({zIndex:999, success:function(html) {$('.attachment').click(function() {$().jOverlay({url:$(this).attr('href') + '/ajax'}); return false; });
// }, url:$(this).attr('href') + '/ajax'}); return false; });
$
(
'
.attachment
'
).
click
(
function
()
{
$
().
jOverlay
({
url
:
'
http://laptop.waglo.com/attachment/
'
+
(
$
(
this
).
attr
(
'
id
'
).
substring
(
'
attachment
'
.
length
+
1
))
+
'
/ajax
'
});
return
false
;
});
// count character on keyup
function
counter
(
event
){
...
...
lib/attachmentlist.php
View file @
b5ac6e31
...
...
@@ -191,7 +191,7 @@ class AttachmentListItem extends Widget
}
function
linkAttr
()
{
return
array
(
'class'
=>
'attachment'
,
'href'
=>
common_local_url
(
'attachment'
,
array
(
'attachment'
=>
$this
->
attachment
->
id
))
);
return
array
(
'class'
=>
'attachment'
,
'href'
=>
$this
->
attachment
->
url
,
'id'
=>
'attachment-'
.
$this
->
attachment
->
id
);
}
function
showLink
()
{
...
...
@@ -200,10 +200,6 @@ class AttachmentListItem extends Widget
$this
->
out
->
elementStart
(
'h4'
);
$this
->
out
->
element
(
'a'
,
$attr
,
$text
);
if
(
$this
->
attachment
->
url
!==
$this
->
title
())
$this
->
out
->
element
(
'span'
,
null
,
" (
{
$this
->
attachment
->
url
}
)"
);
$this
->
out
->
elementEnd
(
'h4'
);
}
...
...
lib/noticelist.php
View file @
b5ac6e31
...
...
@@ -34,6 +34,7 @@ if (!defined('LACONICA')) {
require_once
INSTALLDIR
.
'/lib/favorform.php'
;
require_once
INSTALLDIR
.
'/lib/disfavorform.php'
;
require_once
INSTALLDIR
.
'/lib/attachmentlist.php'
;
/**
* widget for displaying a list of notices
...
...
@@ -179,9 +180,10 @@ class NoticeListItem extends Widget
{
$this
->
showStart
();
$this
->
showNotice
();
$this
->
showNoticeAttachments
();
$this
->
showNoticeAttachments
Icon
();
$this
->
showNoticeInfo
();
$this
->
showNoticeOptions
();
$this
->
showNoticeAttachments
();
$this
->
showEnd
();
}
...
...
@@ -193,45 +195,38 @@ class NoticeListItem extends Widget
$this
->
out
->
elementEnd
(
'div'
);
}
function
showNoticeAttachments
()
{
function
showNoticeAttachments
()
{
if
(
$this
->
isUsedInList
())
{
return
;
}
$al
=
new
AttachmentList
(
$this
->
notice
,
$this
->
out
);
$al
->
show
();
}
function
isUsedInList
()
{
return
'shownotice'
!==
$this
->
out
->
args
[
'action'
];
}
function
attachmentCount
()
{
$f2p
=
new
File_to_post
;
$f2p
->
post_id
=
$this
->
notice
->
id
;
$file
=
new
File
;
$file
->
joinAdd
(
$f2p
);
$file
->
selectAdd
();
$file
->
selectAdd
(
'file.id as id'
);
$count
=
$file
->
find
(
true
);
if
(
!
$count
)
return
;
if
(
1
===
$count
)
{
$href
=
common_local_url
(
'attachment'
,
array
(
'attachment'
=>
$file
->
id
));
$att_class
=
'attachment'
;
}
else
{
$href
=
common_local_url
(
'attachments'
,
array
(
'notice'
=>
$this
->
notice
->
id
));
$att_class
=
'attachments'
;
}
return
$file
->
find
(
true
);
}
$clip
=
theme_path
(
'images/icons/clip'
,
'base'
);
if
(
'shownotice'
===
$this
->
out
->
args
[
'action'
])
{
$height
=
'96px'
;
$width
=
'83%'
;
$width_att
=
'15%'
;
$clip
.=
'-big.png'
;
$top
=
'70px'
;
}
else
{
$height
=
'48px'
;
$width
=
'90%'
;
$width_att
=
'8%'
;
$clip
.=
'.png'
;
$top
=
'20px'
;
function
showNoticeAttachmentsIcon
()
{
if
(
!
(
$this
->
isUsedInList
()
&&
(
$count
=
$this
->
attachmentCount
())))
{
return
;
}
if
(
0
)
$this
->
out
->
elementStart
(
'div'
,
'entry-attachments'
);
else
$this
->
out
->
elementStart
(
'p'
,
array
(
'class'
=>
'entry-attachments'
,
'style'
=>
"float: right; width:
$width_att
; background: url(
$clip
) no-repeat; text-align: right; height:
$height
;"
));
$this
->
out
->
element
(
'a'
,
array
(
'class'
=>
$att_class
,
'style'
=>
"text-decoration: none; padding-top:
$top
; display: block; height:
$height
;"
,
'href'
=>
$href
,
'title'
=>
"# of attachments:
$count
"
),
$count
===
1
?
''
:
$count
);
$href
=
common_local_url
(
'shownotice'
,
array
(
'notice'
=>
$this
->
notice
->
id
))
.
'#attachments'
;
$this
->
out
->
elementStart
(
'p'
,
'entry-attachments'
);
$this
->
out
->
element
(
'a'
,
array
(
'href'
=>
$href
,
'title'
=>
"# of attachments:
$count
"
),
$count
===
1
?
''
:
$count
);
$this
->
out
->
elementEnd
(
'p'
);
}
...
...
lib/router.php
View file @
b5ac6e31
...
...
@@ -151,26 +151,35 @@ class Router
$m
->
connect
(
'search/notice/rss?q=:q'
,
array
(
'action'
=>
'noticesearchrss'
),
array
(
'q'
=>
'.+'
));
/*
$m->connect('attachment/ajax_by_url/*url',
array('action' => 'attachment_ajax'));
*/
$m
->
connect
(
'attachment/:attachment/ajax'
,
array
(
'action'
=>
'attachment_ajax'
),
array
(
'
notice
'
=>
'[0-9]+'
));
array
(
'
attachment
'
=>
'[0-9]+'
));
/*
TODO
not used right now, will revisit later
$m->connect('attachment/:attachment',
array('action' => 'attachment'),
array
(
'
notice
'
=>
'[0-9]+'
));
array('
attachment
' => '[0-9]+'));
*/
// notice
$m
->
connect
(
'notice/new'
,
array
(
'action'
=>
'newnotice'
));
$m
->
connect
(
'notice/new?replyto=:replyto'
,
array
(
'action'
=>
'newnotice'
),
array
(
'replyto'
=>
'[A-Za-z0-9_-]+'
));
/*
$m->connect('notice/:notice/attachments/ajax',
array('action' => 'attachments_ajax'),
array('notice' => '[0-9]+'));
$m->connect('notice/:notice/attachments',
array('action' => 'attachments'),
array('notice' => '[0-9]+'));
*/
$m
->
connect
(
'notice/:notice'
,
array
(
'action'
=>
'shownotice'
),
array
(
'notice'
=>
'[0-9]+'
));
...
...
theme/base/css/display.css
View file @
b5ac6e31
...
...
@@ -379,6 +379,12 @@ max-width:1003px;
overflow
:
hidden
;
}
#ajaxcore
{
width
:
520px
;
height
:
600px
;
background
:
#fff
;
}
#core
{
position
:
relative
;
width
:
100%
;
...
...
@@ -1048,8 +1054,20 @@ margin-bottom:18px;
margin-left
:
18px
;
}
p
.entry-attachments
{
float
:
right
;
width
:
8%
;
background
:
url(../images/icons/clip.png)
no-repeat
;
text-align
:
right
;
height
:
48px
;
}
p
.entry-attachments
a
{
text-decoration
:
none
;
padding-top
:
20px
;
display
:
block
;
height
:
48px
;
}
/* TOP_POSTERS */
.section
tbody
td
{
...
...
Write
Preview
Markdown
is supported
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