Merge pull request #607 from fermionic/20130204-attach-types-are-too-coarse

add support for more file attachment types
This commit is contained in:
friendica 2013-02-05 17:19:53 -08:00
commit 2044862eb9
33 changed files with 1044 additions and 7 deletions

File diff suppressed because it is too large Load Diff

View File

@ -1050,7 +1050,18 @@ function prepare_body($item,$attach = false) {
$cnt = preg_match_all('|\[attach\]href=\"(.*?)\" length=\"(.*?)\" type=\"(.*?)\" title=\"(.*?)\"|',$r,$matches, PREG_SET_ORDER); $cnt = preg_match_all('|\[attach\]href=\"(.*?)\" length=\"(.*?)\" type=\"(.*?)\" title=\"(.*?)\"|',$r,$matches, PREG_SET_ORDER);
if($cnt) { if($cnt) {
foreach($matches as $mtch) { foreach($matches as $mtch) {
$icontype = strtolower(substr($mtch[3],0,strpos($mtch[3],'/'))); $filetype = strtolower(substr( $mtch[3], 0, strpos($mtch[3],'/') ));
if($filetype) {
$filesubtype = strtolower(substr( $mtch[3], strpos($mtch[3],'/') + 1 ));
$filesubtype = str_replace('.', '-', $filesubtype);
}
else {
$filetype = 'unkn';
$filesubtype = 'unkn';
}
$icon = '<div class="attachtype icon s22 type-' . $filetype . ' subtype-' . $filesubtype . '"></div>';
/*$icontype = strtolower(substr($mtch[3],0,strpos($mtch[3],'/')));
switch($icontype) { switch($icontype) {
case 'video': case 'video':
case 'audio': case 'audio':
@ -1061,7 +1072,8 @@ function prepare_body($item,$attach = false) {
default: default:
$icon = '<div class="attachtype icon s22 type-unkn"></div>'; $icon = '<div class="attachtype icon s22 type-unkn"></div>';
break; break;
} }*/
$title = ((strlen(trim($mtch[4]))) ? escape_tags(trim($mtch[4])) : escape_tags($mtch[1])); $title = ((strlen(trim($mtch[4]))) ? escape_tags(trim($mtch[4])) : escape_tags($mtch[1]));
$title .= ' ' . $mtch[2] . ' ' . t('bytes'); $title .= ' ' . $mtch[2] . ' ' . t('bytes');
if((local_user() == $item['uid']) && ($item['contact-id'] != $a->contact['id']) && ($item['network'] == NETWORK_DFRN)) if((local_user() == $item['uid']) && ($item['contact-id'] != $a->contact['id']) && ($item['network'] == NETWORK_DFRN))

View File

@ -185,6 +185,7 @@
.attachtype { .attachtype {
display: block; width: 20px; height: 23px; display: block; width: 20px; height: 23px;
background-image: url('../../../../images/content-types.png'); background-image: url('../../../../images/content-types.png');
background-position: -80px 0px;
} }
.type-video { background-position: 0px 0px; } .type-video { background-position: 0px 0px; }

View File

@ -185,6 +185,7 @@
.attachtype { .attachtype {
display: block; width: 20px; height: 23px; display: block; width: 20px; height: 23px;
background-image: url('../../../../images/content-types.png'); background-image: url('../../../../images/content-types.png');
background-position: -80px 0px;
} }
.type-video { background-position: 0px 0px; } .type-video { background-position: 0px 0px; }

View File

@ -185,6 +185,7 @@
.attachtype { .attachtype {
display: block; width: 20px; height: 23px; display: block; width: 20px; height: 23px;
background-image: url('../../../../images/content-types.png'); background-image: url('../../../../images/content-types.png');
background-position: -80px 0px;
} }
.type-video { background-position: 0px 0px; } .type-video { background-position: 0px 0px; }

View File

@ -185,6 +185,7 @@
.attachtype { .attachtype {
display: block; width: 20px; height: 23px; display: block; width: 20px; height: 23px;
background-image: url('../../../../images/content-types.png'); background-image: url('../../../../images/content-types.png');
background-position: -80px 0px;
} }
.type-video { background-position: 0px 0px; } .type-video { background-position: 0px 0px; }

View File

@ -219,6 +219,7 @@
.attachtype { .attachtype {
display: block; width: 20px; height: 23px; display: block; width: 20px; height: 23px;
background-image: url('../../../images/content-types.png'); background-image: url('../../../images/content-types.png');
background-position: -80px 0px;
} }
.type-video { background-position: 0px 0px; } .type-video { background-position: 0px 0px; }

View File

@ -219,6 +219,7 @@
.attachtype { .attachtype {
display: block; width: 20px; height: 23px; display: block; width: 20px; height: 23px;
background-image: url('../../../images/content-types.png'); background-image: url('../../../images/content-types.png');
background-position: -80px 0px;
} }
.type-video { background-position: 0px 0px; } .type-video { background-position: 0px 0px; }

View File

@ -185,6 +185,7 @@
.attachtype { .attachtype {
display: block; width: 20px; height: 23px; display: block; width: 20px; height: 23px;
background-image: url('../../../../images/content-types.png'); background-image: url('../../../../images/content-types.png');
background-position: -80px 0px;
} }
.type-video { background-position: 0px 0px; } .type-video { background-position: 0px 0px; }

View File

@ -185,6 +185,7 @@
.attachtype { .attachtype {
display: block; width: 20px; height: 23px; display: block; width: 20px; height: 23px;
background-image: url('../../../../images/content-types.png'); background-image: url('../../../../images/content-types.png');
background-position: -80px 0px;
} }
.type-video { background-position: 0px 0px; } .type-video { background-position: 0px 0px; }

View File

@ -185,6 +185,7 @@
.attachtype { .attachtype {
display: block; width: 20px; height: 23px; display: block; width: 20px; height: 23px;
background-image: url('../../../../images/content-types.png'); background-image: url('../../../../images/content-types.png');
background-position: -80px 0px;
} }
.type-video { background-position: 0px 0px; } .type-video { background-position: 0px 0px; }

View File

@ -185,6 +185,7 @@
.attachtype { .attachtype {
display: block; width: 20px; height: 23px; display: block; width: 20px; height: 23px;
background-image: url('../../../../images/content-types.png'); background-image: url('../../../../images/content-types.png');
background-position: -80px 0px;
} }
.type-video { background-position: 0px 0px; } .type-video { background-position: 0px 0px; }

View File

@ -218,6 +218,7 @@
.attachtype { .attachtype {
display: block; width: 20px; height: 23px; display: block; width: 20px; height: 23px;
background-image: url('../../../images/content-types.png'); background-image: url('../../../images/content-types.png');
background-position: -80px 0px;
} }
.type-video { background-position: 0px 0px; } .type-video { background-position: 0px 0px; }

View File

@ -218,6 +218,7 @@
.attachtype { .attachtype {
display: block; width: 20px; height: 23px; display: block; width: 20px; height: 23px;
background-image: url('../../../images/content-types.png'); background-image: url('../../../images/content-types.png');
background-position: -80px 0px;
} }
.type-video { background-position: 0px 0px; } .type-video { background-position: 0px 0px; }

View File

@ -185,6 +185,7 @@
.attachtype { .attachtype {
display: block; width: 20px; height: 23px; display: block; width: 20px; height: 23px;
background-image: url('../../../../images/content-types.png'); background-image: url('../../../../images/content-types.png');
background-position: -80px 0px;
} }
.type-video { background-position: 0px 0px; } .type-video { background-position: 0px 0px; }

View File

@ -185,6 +185,7 @@
.attachtype { .attachtype {
display: block; width: 20px; height: 23px; display: block; width: 20px; height: 23px;
background-image: url('../../../../images/content-types.png'); background-image: url('../../../../images/content-types.png');
background-position: -80px 0px;
} }
.type-video { background-position: 0px 0px; } .type-video { background-position: 0px 0px; }

View File

@ -185,6 +185,7 @@
.attachtype { .attachtype {
display: block; width: 20px; height: 23px; display: block; width: 20px; height: 23px;
background-image: url('../../../../images/content-types.png'); background-image: url('../../../../images/content-types.png');
background-position: -80px 0px;
} }
.type-video { background-position: 0px 0px; } .type-video { background-position: 0px 0px; }

View File

@ -185,6 +185,7 @@
.attachtype { .attachtype {
display: block; width: 20px; height: 23px; display: block; width: 20px; height: 23px;
background-image: url('../../../../images/content-types.png'); background-image: url('../../../../images/content-types.png');
background-position: -80px 0px;
} }
.type-video { background-position: 0px 0px; } .type-video { background-position: 0px 0px; }

View File

@ -219,6 +219,7 @@
.attachtype { .attachtype {
display: block; width: 20px; height: 23px; display: block; width: 20px; height: 23px;
background-image: url('../../../images/content-types.png'); background-image: url('../../../images/content-types.png');
background-position: -80px 0px;
} }
.type-video { background-position: 0px 0px; } .type-video { background-position: 0px 0px; }

View File

@ -219,6 +219,7 @@
.attachtype { .attachtype {
display: block; width: 20px; height: 23px; display: block; width: 20px; height: 23px;
background-image: url('../../../images/content-types.png'); background-image: url('../../../images/content-types.png');
background-position: -80px 0px;
} }
.type-video { background-position: 0px 0px; } .type-video { background-position: 0px 0px; }

View File

@ -186,6 +186,7 @@
.attachtype { .attachtype {
display: block; width: 20px; height: 23px; display: block; width: 20px; height: 23px;
background-image: url('../../../images/content-types.png'); background-image: url('../../../images/content-types.png');
background-position: -80px 0px;
} }
.type-video { background-position: 0px 0px; } .type-video { background-position: 0px 0px; }
@ -2568,4 +2569,4 @@ list-style-type: disc;
#photos-upload-newalbum-div { #photos-upload-newalbum-div {
float: left; float: left;
width: 175px; width: 175px;
} }

View File

@ -185,6 +185,7 @@
.attachtype { .attachtype {
display: block; width: 20px; height: 23px; display: block; width: 20px; height: 23px;
background-image: url('../../../images/content-types.png'); background-image: url('../../../images/content-types.png');
background-position: -80px 0px;
} }
.type-video { background-position: 0px 0px; } .type-video { background-position: 0px 0px; }

View File

@ -221,6 +221,7 @@
.attachtype { .attachtype {
display: block; width: 20px; height: 23px; display: block; width: 20px; height: 23px;
background-image: url('../../../images/content-types.png'); background-image: url('../../../images/content-types.png');
background-position: -80px 0px;
} }
.type-video { background-position: 0px 0px; } .type-video { background-position: 0px 0px; }

View File

@ -512,7 +512,8 @@ div[id$="wrapper"]{height:100%;}div[id$="wrapper"] br{clear:left;}
.icon.dim{opacity:0.3;} .icon.dim{opacity:0.3;}
#pause{position:fixed;bottom:40px;right:30px;z-index:10;} #pause{position:fixed;bottom:40px;right:30px;z-index:10;}
.border{border:1px solid #babdb6;-o-border-radius:5px;-webkit-border-radius:5px;-moz-border-radius:5px;-ms-border-radius:5px;border-radius:5px;}.border:hover{border:1px solid #babdb6;-o-border-radius:5px;-webkit-border-radius:5px;-moz-border-radius:5px;-ms-border-radius:5px;border-radius:5px;} .border{border:1px solid #babdb6;-o-border-radius:5px;-webkit-border-radius:5px;-moz-border-radius:5px;-ms-border-radius:5px;border-radius:5px;}.border:hover{border:1px solid #babdb6;-o-border-radius:5px;-webkit-border-radius:5px;-moz-border-radius:5px;-ms-border-radius:5px;border-radius:5px;}
.attachtype{display:block;width:20px;height:23px;background-image:url(../../../images/content-types.png);} .attachtype{display:block;width:20px;height:23px;background-image:url(../../../images/content-types.png);background-position: -80px 0px;
}
.type-video{background-position:0px 0px;} .type-video{background-position:0px 0px;}
.type-image{background-position:-20px 0;} .type-image{background-position:-20px 0;}
.type-audio{background-position:-40px 0;} .type-audio{background-position:-40px 0;}

View File

@ -2998,6 +2998,7 @@ div {
display: block; display: block;
.box(20px, 23px); .box(20px, 23px);
background-image: url(../../../images/content-types.png); background-image: url(../../../images/content-types.png);
background-position: -80px 0px;
} }
.type-video { .type-video {
background-position: 0px 0px; background-position: 0px 0px;

View File

@ -512,7 +512,8 @@ div[id$="wrapper"]{height:100%;}div[id$="wrapper"] br{clear:left;}
.icon.dim{opacity:0.3;} .icon.dim{opacity:0.3;}
#pause{position:fixed;bottom:40px;right:30px;z-index:10;} #pause{position:fixed;bottom:40px;right:30px;z-index:10;}
.border{border:1px solid #babdb6;-o-border-radius:5px;-webkit-border-radius:5px;-moz-border-radius:5px;-ms-border-radius:5px;border-radius:5px;}.border:hover{border:1px solid #babdb6;-o-border-radius:5px;-webkit-border-radius:5px;-moz-border-radius:5px;-ms-border-radius:5px;border-radius:5px;} .border{border:1px solid #babdb6;-o-border-radius:5px;-webkit-border-radius:5px;-moz-border-radius:5px;-ms-border-radius:5px;border-radius:5px;}.border:hover{border:1px solid #babdb6;-o-border-radius:5px;-webkit-border-radius:5px;-moz-border-radius:5px;-ms-border-radius:5px;border-radius:5px;}
.attachtype{display:block;width:20px;height:23px;background-image:url(../../../images/content-types.png);} .attachtype{display:block;width:20px;height:23px;background-image:url(../../../images/content-types.png);background-position: -80px 0px;
}
.type-video{background-position:0px 0px;} .type-video{background-position:0px 0px;}
.type-image{background-position:-20px 0;} .type-image{background-position:-20px 0;}
.type-audio{background-position:-40px 0;} .type-audio{background-position:-40px 0;}

View File

@ -2999,6 +2999,7 @@ div {
display: block; display: block;
.box(20px, 23px); .box(20px, 23px);
background-image: url(../../../images/content-types.png); background-image: url(../../../images/content-types.png);
background-position: -80px 0px;
} }
.type-video { .type-video {
background-position: 0px 0px; background-position: 0px 0px;

View File

@ -3137,6 +3137,7 @@ aside input[type='text'] {
display: block; width: 20px; height: 23px; display: block; width: 20px; height: 23px;
float: left; float: left;
background-image: url('../../../images/content-types.png'); background-image: url('../../../images/content-types.png');
background-position: -80px 0px;
} }
.body-attach { .body-attach {

View File

@ -2935,6 +2935,7 @@ aside input[type='text'] {
display: block; width: 20px; height: 23px; display: block; width: 20px; height: 23px;
float: left; float: left;
background-image: url('../../../images/content-types.png'); background-image: url('../../../images/content-types.png');
background-position: -80px 0px;
} }
.body-attach { .body-attach {

View File

@ -3850,6 +3850,7 @@ aside input[type='text'] {
display: block; width: 20px; height: 23px; display: block; width: 20px; height: 23px;
float: left; float: left;
background-image: url('../../../images/content-types.png'); background-image: url('../../../images/content-types.png');
background-position: -80px 0px;
} }
.body-attach { .body-attach {

View File

@ -3761,6 +3761,7 @@ aside input[type='text'] {
display: block; width: 20px; height: 23px; display: block; width: 20px; height: 23px;
float: left; float: left;
background-image: url('../../../images/content-types.png'); background-image: url('../../../images/content-types.png');
background-position: -80px 0px;
} }
.body-attach { .body-attach {

View File

@ -3792,6 +3792,7 @@ margin-left: 0px;
.attachtype { .attachtype {
display: block; width: 20px; height: 23px; display: block; width: 20px; height: 23px;
background-image: url("../../../images/content-types.png"); background-image: url("../../../images/content-types.png");
background-position: -80px 0px;
} }
.type-video { background-position: 0px 0px; } .type-video { background-position: 0px 0px; }

View File

@ -2962,6 +2962,7 @@ tr {
.attachtype { .attachtype {
display: block; width: 20px; height: 23px; display: block; width: 20px; height: 23px;
background-image: url('../../../images/content-types.png'); background-image: url('../../../images/content-types.png');
background-position: -80px 0px;
} }
.type-video { background-position: 0px 0px; } .type-video { background-position: 0px 0px; }
@ -3289,4 +3290,4 @@ ul.menu-popup {
/* Pages profile widget */ /* Pages profile widget */
#page-profile div#profile-page-list{ #page-profile div#profile-page-list{
margin-left: 45px; margin-left: 45px;
} }