From b68db67d49184a022e149d144ea3831671750684 Mon Sep 17 00:00:00 2001 From: mamouneyya Date: Mon, 4 Oct 2010 10:21:59 +0800 Subject: [PATCH 01/18] improve the comment display in the photo page --- themes/browny_wind/css/screen.css | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/themes/browny_wind/css/screen.css b/themes/browny_wind/css/screen.css index 9a2f39ff..c86c91f8 100644 --- a/themes/browny_wind/css/screen.css +++ b/themes/browny_wind/css/screen.css @@ -1485,6 +1485,11 @@ div#g-action-status { margin: 1.25em 4.4em 2em 0em; } +/* Comments ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ */ + +#g-content #g-comments .g-author { + padding-bottom: .8em; +} /* Organize ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ */ From 2ece42cb68206a1fb922a5996566cc824d19367f Mon Sep 17 00:00:00 2001 From: mamouneyya Date: Mon, 4 Oct 2010 19:17:18 +0800 Subject: [PATCH 02/18] add text shadow + improve the comments display --- themes/browny_wind/css/screen.css | 46 +++++++++++++++++++++++++------ 1 file changed, 38 insertions(+), 8 deletions(-) diff --git a/themes/browny_wind/css/screen.css b/themes/browny_wind/css/screen.css index c86c91f8..edd23675 100644 --- a/themes/browny_wind/css/screen.css +++ b/themes/browny_wind/css/screen.css @@ -29,6 +29,7 @@ body, html { p { margin-bottom: 1em; + text-shadow: 0px 1px 1px #F7F5F0; } em { @@ -37,6 +38,7 @@ em { h1, h2, h3, h4, h5, strong, th { font-weight: bold; + text-shadow: 1px 1px 0px #fff; } h1 { @@ -76,12 +78,20 @@ h3 { font-size: .8em; } +#g-footer h3 { + text-shadow: 1px 1px 1px #F7F5F0; +} + #g-album-grid .g-item, #g-item #g-photo, #g-item #g-movie { font-size: .7em; } +#l10n-client h2 { + text-shadow: none; +} + /* Links ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ */ /* ~browny~ */ @@ -884,6 +894,7 @@ ul.sf-menu li li li.sfHover ul { /* ~browny~ */ .sf-menu li { background: #d3b07e url('../images/ui-bg_highlight-soft_45_d3b07e_1x100.png') 50% 50% repeat-x; + text-shadow: 0px 1px 1px #fff; } /* ~browny~ */ @@ -909,12 +920,17 @@ ul.sf-menu li li li.sfHover ul { opacity: .7; } +.ui-dialog-content { + text-shadow: 0px 1px 1px #fff; +} + /* Buttons ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ */ .g-button { display: inline-block; margin: 0 4px 0 0; padding: .2em .4em; + text-shadow: 0px 1px 1px #fff; } .g-button, @@ -1452,11 +1468,13 @@ div#g-action-status { top: 1.3em; width: 90px !important; height: 90px !important; + margin: 0em 0em 0em .6em; } #g-user-profile .g-block h2 { background-color: #F5EFE6; margin-bottom: .5em; + padding-left: .8em; } #g-user-profile .g-block-content h2 { @@ -1464,9 +1482,12 @@ div#g-action-status { margin-bottom: inherit; } -#g-user-profile #g-comment-detail .g-author img { - padding: .4em; - vertical-align: middle; +#g-user-profile #g-comment-detail .g-author a { + float: left; + position: relative; + top: -0.3em; + left: 0em; + margin-right: .6em; } #g-user-profile #g-comment-detail ul li { @@ -1475,21 +1496,30 @@ div#g-action-status { margin-bottom: .5em; } +.rtl #g-user-profile .g-block h2 { + padding-right: .8em; + padding-left: auto; +} + .rtl #g-user-profile .g-avatar { float: right; right: 0em; left: auto; + margin: 0em .6em 0em 0em; +} + +.rtl #g-user-profile #g-comment-detail .g-author a { + float: right; + right: 0em; + left: auto; + margin-left: .6em; + margin-right: 0em; } .rtl #g-user-profile h1 { margin: 1.25em 4.4em 2em 0em; } -/* Comments ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ */ - -#g-content #g-comments .g-author { - padding-bottom: .8em; -} /* Organize ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ */ From a672beb96560b9cd9fd11a216e8c6f9556881fcf Mon Sep 17 00:00:00 2001 From: mamouneyya Date: Mon, 4 Oct 2010 19:17:27 +0800 Subject: [PATCH 03/18] add text shadow --- themes/browny_admin_wind/css/screen.css | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/themes/browny_admin_wind/css/screen.css b/themes/browny_admin_wind/css/screen.css index 68e3b54f..dc9df28d 100644 --- a/themes/browny_admin_wind/css/screen.css +++ b/themes/browny_admin_wind/css/screen.css @@ -31,6 +31,7 @@ body, html { p { margin-bottom: 1em; + text-shadow: 0px 1px 1px #F7F5F0; } em { @@ -39,6 +40,7 @@ em { h1, h2, h3, h4, h5, strong, th { font-weight: bold; + text-shadow: 1px 1px 0px #fff; } h1 { @@ -65,6 +67,10 @@ h3 { font-size: 1.2em; } +#l10n-client h2 { + text-shadow: none; +} + /* Links ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ */ /* ~browny~ */ @@ -334,6 +340,7 @@ th { .g-block-content { margin-top: 1em; + text-shadow: 0px 1px 0px #fff; } #g-content .g-block { @@ -848,6 +855,7 @@ form .g-error { display: inline-block; margin: 0 4px 0 0; padding: .2em .4em; + text-shadow: 0px 1px 1px #fff; } .g-button, @@ -1048,6 +1056,7 @@ ul.sf-menu li li li.sfHover ul { /* ~browny~ */ .sf-menu li { background: #d3b07e url('../images/ui-bg_highlight-soft_45_d3b07e_1x100.png') 50% 50% repeat-x; + text-shadow: 0px 1px 1px #fff; } /* ~browny~ */ @@ -1076,6 +1085,10 @@ ul.sf-menu li li li.sfHover ul { padding: .2em .4em; } +.ui-dialog-content { + text-shadow: 0px 1px 1px #fff; +} + /** ******************************************************************* * 10) Right to left styles *********************************************************************/ From 8e38300666f09ba6782953c74d318aec636866fc Mon Sep 17 00:00:00 2001 From: mamouneyya Date: Mon, 4 Oct 2010 19:18:15 +0800 Subject: [PATCH 04/18] remove the dependency of browny wind folder name --- themes/browny_wind/views/page.html.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/themes/browny_wind/views/page.html.php b/themes/browny_wind/views/page.html.php index 6da76f87..5e4040bd 100644 --- a/themes/browny_wind/views/page.html.php +++ b/themes/browny_wind/views/page.html.php @@ -80,7 +80,7 @@ user_menu() ?> From fa3f6188736a300ee4b01e2d3c13f042aac401d2 Mon Sep 17 00:00:00 2001 From: mamouneyya Date: Mon, 4 Oct 2010 19:18:48 +0800 Subject: [PATCH 05/18] improve the comments display --- themes/browny_wind/views/user_profile_comments.html.php | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/themes/browny_wind/views/user_profile_comments.html.php b/themes/browny_wind/views/user_profile_comments.html.php index f7325cc2..9d3df0d9 100644 --- a/themes/browny_wind/views/user_profile_comments.html.php +++ b/themes/browny_wind/views/user_profile_comments.html.php @@ -4,12 +4,12 @@
  • - item()->thumb_img(array(), 65) ?> - item()->url() ?>"> + item()->thumb_img(array(), 70) ?> + + on %date for %title ", array("date" => gallery::date_time($comment->created), "title" => $comment->item()->title)); ?> - -


    From 1d5e1d541171d95cbcfea730debb08a352b21740 Mon Sep 17 00:00:00 2001 From: mamouneyya Date: Mon, 4 Oct 2010 19:39:01 +0800 Subject: [PATCH 06/18] fonts changes --- themes/browny_admin_wind/css/screen.css | 2 +- themes/browny_wind/css/screen.css | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/themes/browny_admin_wind/css/screen.css b/themes/browny_admin_wind/css/screen.css index dc9df28d..baa6ffa9 100644 --- a/themes/browny_admin_wind/css/screen.css +++ b/themes/browny_admin_wind/css/screen.css @@ -26,7 +26,7 @@ /* ~browny~ */ body, html { background-color: #5a3007; - font-family: 'Lucida Grande', 'Lucida Sans', Arial, sans-serif; + font-family: 'Century gothic', Verdana, 'Lucida Grande', 'Lucida Sans', Arial, sans-serif; } p { diff --git a/themes/browny_wind/css/screen.css b/themes/browny_wind/css/screen.css index edd23675..bed2adfd 100644 --- a/themes/browny_wind/css/screen.css +++ b/themes/browny_wind/css/screen.css @@ -24,7 +24,7 @@ /* ~browny~ */ body, html { background-color: #5a3007; - font-family: 'Lucida Grande', 'Lucida Sans', Arial, sans-serif; + font-family: 'Century gothic', Verdana, 'Lucida Grande', 'Lucida Sans', Arial, sans-serif; } p { From 83a19bf0e18d67990e9062fb4cc4ea6ab7861245 Mon Sep 17 00:00:00 2001 From: mamouneyya Date: Mon, 4 Oct 2010 19:39:35 +0800 Subject: [PATCH 07/18] correct the file section numbers --- themes/browny_wind/css/screen.css | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/themes/browny_wind/css/screen.css b/themes/browny_wind/css/screen.css index bed2adfd..0d71345a 100644 --- a/themes/browny_wind/css/screen.css +++ b/themes/browny_wind/css/screen.css @@ -1099,7 +1099,7 @@ div#g-action-status { } /** ******************************************************************* - * 8) Right to left language styles + * 10) Right to left language styles *********************************************************************/ .rtl { direction: rtl; @@ -1419,7 +1419,7 @@ div#g-action-status { } /** ******************************************************************* - * 9) More Browny (Extra overrides for better Browny look) + * 11) More Browny (Extra overrides for better Browny look) *********************************************************************/ /* ~browny~ */ From f7004a619e9680b2315612429bb50969e5cd0fb8 Mon Sep 17 00:00:00 2001 From: mamouneyya Date: Mon, 4 Oct 2010 20:12:56 +0800 Subject: [PATCH 08/18] font changes --- themes/browny_admin_wind/css/screen.css | 15 +++++++++++++++ .../css/themeroller/ui.theme.css | 4 ++-- themes/browny_wind/css/screen.css | 15 +++++++++++++++ themes/browny_wind/css/themeroller/ui.theme.css | 4 ++-- 4 files changed, 34 insertions(+), 4 deletions(-) diff --git a/themes/browny_admin_wind/css/screen.css b/themes/browny_admin_wind/css/screen.css index baa6ffa9..0fa69a87 100644 --- a/themes/browny_admin_wind/css/screen.css +++ b/themes/browny_admin_wind/css/screen.css @@ -67,6 +67,13 @@ h3 { font-size: 1.2em; } +select, +input, +button, +textarea { + font: 99% 'Century gothic', Verdana, Arial, Helvetica, Clean, sans-serif; +} + #l10n-client h2 { text-shadow: none; } @@ -1089,6 +1096,14 @@ ul.sf-menu li li li.sfHover ul { text-shadow: 0px 1px 1px #fff; } +.ui-widget { + font-family: 'Century gothic', Verdana, 'Lucida Grande', 'Lucida Sans', Arial, sans-serif; +} + +.ui-widget input, .ui-widget select, .ui-widget textarea, .ui-widget button { + font-family: 'Century gothic', Verdana, 'Lucida Grande', 'Lucida Sans', Arial, sans-serif; +} + /** ******************************************************************* * 10) Right to left styles *********************************************************************/ diff --git a/themes/browny_admin_wind/css/themeroller/ui.theme.css b/themes/browny_admin_wind/css/themeroller/ui.theme.css index 0536b6fa..8d5bc8fe 100755 --- a/themes/browny_admin_wind/css/themeroller/ui.theme.css +++ b/themes/browny_admin_wind/css/themeroller/ui.theme.css @@ -12,8 +12,8 @@ /* Component containers ----------------------------------*/ -.ui-widget { font-family: Geeza Pro, Lucida Grande, Lucida Sans, Arial, sans-serif; font-size: 1.1em; } -.ui-widget input, .ui-widget select, .ui-widget textarea, .ui-widget button { font-family: Geeza Pro, Lucida Grande, Lucida Sans, Arial, sans-serif; font-size: 1em; } +.ui-widget { font-family: Lucida Grande, Lucida Sans, Arial, sans-serif; font-size: 1.1em; } +.ui-widget input, .ui-widget select, .ui-widget textarea, .ui-widget button { font-family: Lucida Grande, Lucida Sans, Arial, sans-serif; font-size: 1em; } .ui-widget-content { border: 1px solid #9e7247; background: #f6f3ef url(images/ui-bg_inset-hard_100_f6f3ef_1x100.png) 50% bottom repeat-x; color: #222222; } .ui-widget-content a { color: #222222; } .ui-widget-header { border: 1px solid #4e2e0e; background: #714213 url(images/ui-bg_gloss-wave_55_714213_500x100.png) 50% 50% repeat-x; color: #ffffff; font-weight: bold; } diff --git a/themes/browny_wind/css/screen.css b/themes/browny_wind/css/screen.css index 0d71345a..b9a1d913 100644 --- a/themes/browny_wind/css/screen.css +++ b/themes/browny_wind/css/screen.css @@ -88,6 +88,13 @@ h3 { font-size: .7em; } +select, +input, +button, +textarea { + font: 99% 'Century gothic', Verdana, Arial, Helvetica, Clean, sans-serif; +} + #l10n-client h2 { text-shadow: none; } @@ -915,6 +922,14 @@ ul.sf-menu li li li.sfHover ul { /* jQuery UI Dialog ~~~~~~~~~~~~~~~~~~~~~~ */ +.ui-widget { + font-family: 'Century gothic', Verdana, 'Lucida Grande', 'Lucida Sans', Arial, sans-serif; +} + +.ui-widget input, .ui-widget select, .ui-widget textarea, .ui-widget button { + font-family: 'Century gothic', Verdana, 'Lucida Grande', 'Lucida Sans', Arial, sans-serif; +} + .ui-widget-overlay { background: #000; opacity: .7; diff --git a/themes/browny_wind/css/themeroller/ui.theme.css b/themes/browny_wind/css/themeroller/ui.theme.css index 39d51fe5..ff1d4be5 100755 --- a/themes/browny_wind/css/themeroller/ui.theme.css +++ b/themes/browny_wind/css/themeroller/ui.theme.css @@ -12,8 +12,8 @@ /* Component containers ----------------------------------*/ -.ui-widget { font-family: Geeza Pro, Tahoma, Lucida Grande, Lucida Sans, Arial, sans-serif; font-size: 1.1em; } -.ui-widget input, .ui-widget select, .ui-widget textarea, .ui-widget button { font-family: Geeza Pro, Tahoma, Lucida Grande, Lucida Sans, Arial, sans-serif; font-size: 1em; } +.ui-widget { font-family: Lucida Grande, Lucida Sans, Arial, sans-serif; font-size: 1.1em; } +.ui-widget input, .ui-widget select, .ui-widget textarea, .ui-widget button { font-family: Lucida Grande, Lucida Sans, Arial, sans-serif; font-size: 1em; } .ui-widget-content { border: 1px solid #9e7247; background: #f6f3ef url(images/ui-bg_inset-hard_100_f6f3ef_1x100.png) 50% bottom repeat-x; color: #222222; } .ui-widget-content a { color: #222222; } .ui-widget-header { border: 1px solid #4e2e0e; background: #714213 url(images/ui-bg_gloss-wave_55_714213_500x100.png) 50% 50% repeat-x; color: #ffffff; font-weight: bold; } From d0c60a05514b82719733533c0960119e5fc16dfd Mon Sep 17 00:00:00 2001 From: mamouneyya Date: Mon, 4 Oct 2010 20:22:17 +0800 Subject: [PATCH 09/18] add some space above maintenance mode status bar in maintenance admin page --- themes/browny_admin_wind/css/screen.css | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/themes/browny_admin_wind/css/screen.css b/themes/browny_admin_wind/css/screen.css index 0fa69a87..fbabbcc3 100644 --- a/themes/browny_admin_wind/css/screen.css +++ b/themes/browny_admin_wind/css/screen.css @@ -401,6 +401,10 @@ th { background-image: none; } +#g-maintenance-mode ul.g-message-block { + margin-top: .5em; +} + .g-success td { background-color: transparent; background-image: none; From 703e74e4d28cefec845c20d29589c3610fed6aa9 Mon Sep 17 00:00:00 2001 From: mamouneyya Date: Mon, 4 Oct 2010 20:32:42 +0800 Subject: [PATCH 10/18] font changes --- themes/browny_wind/css/screen.css | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/themes/browny_wind/css/screen.css b/themes/browny_wind/css/screen.css index b9a1d913..d0b28eb3 100644 --- a/themes/browny_wind/css/screen.css +++ b/themes/browny_wind/css/screen.css @@ -1497,6 +1497,10 @@ div#g-action-status { margin-bottom: inherit; } +#g-user-profile #g-comment-detail .g-author { + font-family: Cursive, Serif; +} + #g-user-profile #g-comment-detail .g-author a { float: left; position: relative; From ff41ad65efbb331a87f526a5e86afa705dc909cf Mon Sep 17 00:00:00 2001 From: mamouneyya Date: Mon, 4 Oct 2010 22:06:17 +0800 Subject: [PATCH 11/18] further improvement for comments display --- themes/browny_wind/css/screen.css | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/themes/browny_wind/css/screen.css b/themes/browny_wind/css/screen.css index d0b28eb3..b4f37b52 100644 --- a/themes/browny_wind/css/screen.css +++ b/themes/browny_wind/css/screen.css @@ -1509,6 +1509,11 @@ div#g-action-status { margin-right: .6em; } +#g-user-profile #g-comment-detail div { + margin-left: 5em; + line-height: 150%; +} + #g-user-profile #g-comment-detail ul li { border: .1em dotted #D4BE9B; padding: .8em .5em; @@ -1535,6 +1540,11 @@ div#g-action-status { margin-right: 0em; } +.rtl #g-user-profile #g-comment-detail div { + margin-right: 5em; + margin-left: 0em; +} + .rtl #g-user-profile h1 { margin: 1.25em 4.4em 2em 0em; } From 0f8daf1a4611ec74719c5416d97b4a0b517d4847 Mon Sep 17 00:00:00 2001 From: mamouneyya Date: Mon, 4 Oct 2010 23:34:53 +0800 Subject: [PATCH 12/18] fix an issue with the alignment of the user avatar --- themes/browny_wind/css/screen.css | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/themes/browny_wind/css/screen.css b/themes/browny_wind/css/screen.css index b4f37b52..01576252 100644 --- a/themes/browny_wind/css/screen.css +++ b/themes/browny_wind/css/screen.css @@ -1549,6 +1549,19 @@ div#g-action-status { margin: 1.25em 4.4em 2em 0em; } +/* Comments ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ */ + +#g-content #g-comments .g-avatar { + float: left; + margin-right: .4em; + margin-left: 0; +} + +.rtl #g-content #g-comments .g-avatar { + float: right; + margin-left: .4em; + margin-right: 0; +} /* Organize ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ */ From b5290b154c33cb1da21f6a60e72e3d431e203e1c Mon Sep 17 00:00:00 2001 From: hukoeth Date: Thu, 23 Sep 2010 18:05:05 +0800 Subject: [PATCH 13/18] Bugfix: Legend wouldn't show when adding first annotation to a photo --- .../photoannotation_highlight_block.html.php | 30 +++++++++---------- 1 file changed, 15 insertions(+), 15 deletions(-) diff --git a/modules/photoannotation/views/photoannotation_highlight_block.html.php b/modules/photoannotation/views/photoannotation_highlight_block.html.php index 9241e5b9..9408380d 100644 --- a/modules/photoannotation/views/photoannotation_highlight_block.html.php +++ b/modules/photoannotation/views/photoannotation_highlight_block.html.php @@ -58,11 +58,6 @@ $jscode .= "\"url\": \"". user_profile::url($oneUser->user_id) ."\" },\n"; } } - $display = "none"; - if ($legend_users != "") { - $display = "block"; - } - $legend_users = t("People on this photo: ") . $legend_users .""; foreach ($existingFaces as $oneFace) { $oneTag = ORM::factory("tag", $oneFace->tag_id); if ($oneTag->loaded()) { @@ -81,11 +76,6 @@ $jscode .= "\"url\": \"". $oneTag->url() ."\" },\n"; } } - $display = "none"; - if ($legend_faces != "") { - $display = "block"; - } - $legend_faces = t("Faces on this photo: ") . $legend_faces .""; foreach ($existingNotes as $oneNote) { if ($shownotes) { $legend_notes .= "id . "\">". html::clean($oneNote->title) ." "; @@ -103,12 +93,22 @@ } $jscode = trim($jscode, ",\n"); $jscode .= " ],"; - $display = "none"; - if ($legend_notes != "") { - $display = "block"; - } - $legend_notes = t("Notes on this photo: ") . $legend_notes .""; } + $display = "none"; + if ($legend_users != "") { + $display = "block"; + } + $legend_users = t("People on this photo: ") . $legend_users .""; + $display = "none"; + if ($legend_faces != "") { + $display = "block"; + } + $legend_faces = t("Faces on this photo: ") . $legend_faces .""; + $display = "none"; + if ($legend_notes != "") { + $display = "block"; + } + $legend_notes = t("Notes on this photo: ") . $legend_notes .""; $legend_display = $legend_users . $legend_faces . $legend_notes; $labels_arraystring = "labels: [ '". t("Tag:") ."','". t("Note Title:") ."','". t("Description (optional)") ."','". t("Are you sure you want to delete this annotation?") ."','". t("or") ."','". t("Yes") ."','". t("No") ."','". t("Confirm deletion") ."','". t("Save") ."','". t("Cancel") ."','". t("Person:") ."','". t("No user selected") ."','". t("Select one of the following") ."','". t("An error ocurred while saving annotation") ."','". t("OK") ."','". t("An error ocurred while deleting annotation") ."','". t("View fullsize") ."' ],"; ?> From c61a62574c0778a2faaed4af66f7d6ddd2c49f8d Mon Sep 17 00:00:00 2001 From: hukoeth Date: Fri, 24 Sep 2010 19:10:16 +0800 Subject: [PATCH 14/18] Fixed bug where user profile page would display empty thumbs for items not viewable by logged in user --- modules/photoannotation/helpers/photoannotation_event.php | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/modules/photoannotation/helpers/photoannotation_event.php b/modules/photoannotation/helpers/photoannotation_event.php index 1db486b8..756389d6 100644 --- a/modules/photoannotation/helpers/photoannotation_event.php +++ b/modules/photoannotation/helpers/photoannotation_event.php @@ -150,15 +150,17 @@ class photoannotation_event_Core { $view = new Theme_View("dynamic.html", "collection", "userprofiles"); //load thumbs $item_users = ORM::factory("items_user")->where("user_id", "=", $data->user->id)->find_all(); - $children_count = count($item_users); foreach ($item_users as $item_user) { $item_thumb = ORM::factory("item") ->viewable() ->where("type", "!=", "album") ->where("id", "=", $item_user->item_id) ->find(); - $item_thumbs[] = $item_thumb; + if ($item_thumb->loaded()) { + $item_thumbs[] = $item_thumb; + } } + $children_count = count($item_thumbs); $page_size = module::get_var("gallery", "page_size", 9); $page = (int) Input::instance()->get("page", "1"); $offset = ($page-1) * $page_size; From 0e07fe0d806ee18bf8039d1e480b7862b0c7b9a7 Mon Sep 17 00:00:00 2001 From: rWatcher Date: Fri, 24 Sep 2010 12:02:46 +0800 Subject: [PATCH 15/18] Initial commit of videos module. --- modules/videos/controllers/admin_videos.php | 96 ++++++ modules/videos/controllers/videos.php | 298 ++++++++++++++++++ modules/videos/css/videos.css | 38 +++ modules/videos/helpers/videos.php | 49 +++ modules/videos/helpers/videos_event.php | 84 +++++ modules/videos/helpers/videos_installer.php | 52 +++ modules/videos/helpers/videos_theme.php | 55 ++++ modules/videos/js/admin_videos.js | 8 + modules/videos/js/videos.js | 125 ++++++++ modules/videos/models/items_video.php | 22 ++ modules/videos/models/videos_file.php | 21 ++ modules/videos/module.info | 3 + modules/videos/views/admin_videos.html.php | 21 ++ modules/videos/views/movieplayer.html.php | 33 ++ .../videos/views/videos_display_js.html.php | 28 ++ modules/videos/views/videos_tree.html.php | 37 +++ .../videos/views/videos_tree_dialog.html.php | 52 +++ 17 files changed, 1022 insertions(+) create mode 100644 modules/videos/controllers/admin_videos.php create mode 100644 modules/videos/controllers/videos.php create mode 100644 modules/videos/css/videos.css create mode 100644 modules/videos/helpers/videos.php create mode 100644 modules/videos/helpers/videos_event.php create mode 100644 modules/videos/helpers/videos_installer.php create mode 100644 modules/videos/helpers/videos_theme.php create mode 100644 modules/videos/js/admin_videos.js create mode 100644 modules/videos/js/videos.js create mode 100644 modules/videos/models/items_video.php create mode 100644 modules/videos/models/videos_file.php create mode 100644 modules/videos/module.info create mode 100644 modules/videos/views/admin_videos.html.php create mode 100644 modules/videos/views/movieplayer.html.php create mode 100644 modules/videos/views/videos_display_js.html.php create mode 100644 modules/videos/views/videos_tree.html.php create mode 100644 modules/videos/views/videos_tree_dialog.html.php diff --git a/modules/videos/controllers/admin_videos.php b/modules/videos/controllers/admin_videos.php new file mode 100644 index 00000000..5dd8abb9 --- /dev/null +++ b/modules/videos/controllers/admin_videos.php @@ -0,0 +1,96 @@ +page_title = t("Add videos from server"); + $view->content = new View("admin_videos.html"); + $view->content->form = $this->_get_admin_form(); + $paths = unserialize(module::get_var("videos", "authorized_paths", "a:0:{}")); + $view->content->paths = array_keys($paths); + + print $view; + } + + public function add_path() { + access::verify_csrf(); + + $form = $this->_get_admin_form(); + $paths = unserialize(module::get_var("videos", "authorized_paths", "a:0:{}")); + if ($form->validate()) { + if (is_link($form->add_path->path->value)) { + $form->add_path->path->add_error("is_symlink", 1); + } else if (!is_readable($form->add_path->path->value)) { + $form->add_path->path->add_error("not_readable", 1); + } else { + $path = $form->add_path->path->value; + $paths[$path] = 1; + module::set_var("videos", "authorized_paths", serialize($paths)); + message::success(t("Added path %path", array("path" => $path))); + videos::check_config($paths); + url::redirect("admin/videos"); + } + } + + $view = new Admin_View("admin.html"); + $view->content = new View("admin_videos.html"); + $view->content->form = $form; + $view->content->paths = array_keys($paths); + print $view; + } + + public function remove_path() { + access::verify_csrf(); + + $path = Input::instance()->get("path"); + $paths = unserialize(module::get_var("videos", "authorized_paths")); + if (isset($paths[$path])) { + unset($paths[$path]); + message::success(t("Removed path %path", array("path" => $path))); + module::set_var("videos", "authorized_paths", serialize($paths)); + videos::check_config($paths); + } + url::redirect("admin/videos"); + } + + public function autocomplete() { + $directories = array(); + $path_prefix = Input::instance()->get("q"); + foreach (glob("{$path_prefix}*") as $file) { + if (is_dir($file) && !is_link($file)) { + $directories[] = $file; + } + } + + print implode("\n", $directories); + } + + private function _get_admin_form() { + $form = new Forge("admin/videos/add_path", "", "post", + array("id" => "g-server-add-admin-form", "class" => "g-short-form")); + $add_path = $form->group("add_path"); + $add_path->input("path")->label(t("Path"))->rules("required")->id("g-path") + ->error_messages("not_readable", t("This directory is not readable by the webserver")) + ->error_messages("is_symlink", t("Symbolic links are not allowed")); + $add_path->submit("add")->value(t("Add Path")); + + return $form; + } +} diff --git a/modules/videos/controllers/videos.php b/modules/videos/controllers/videos.php new file mode 100644 index 00000000..00ec0691 --- /dev/null +++ b/modules/videos/controllers/videos.php @@ -0,0 +1,298 @@ +item = $item; + $view->tree = new View("videos_tree.html"); + $view->tree->files = $files; + $view->tree->parents = array(); + print $view; + } + + public function children() { + $path = Input::instance()->get("path"); + + $tree = new View("videos_tree.html"); + $tree->files = array(); + $tree->parents = array(); + + // Make a tree with the parents back up to the authorized path, and all the children under the + // current path. + if (videos::is_valid_path($path)) { + $tree->parents[] = $path; + while (videos::is_valid_path(dirname($tree->parents[0]))) { + array_unshift($tree->parents, dirname($tree->parents[0])); + } + + $glob_path = str_replace(array("{", "}", "[", "]"), array("\{", "\}", "\[", "\]"), $path); + foreach (glob("$glob_path/*") as $file) { + if (!is_readable($file)) { + continue; + } + if (!is_dir($file)) { + $ext = strtolower(pathinfo($file, PATHINFO_EXTENSION)); + //if (!in_array($ext, array("gif", "jpeg", "jpg", "png", "flv", "mp4", "m4v"))) { + if (!in_array($ext, unserialize(module::get_var("videos", "allowed_extensions")))) { + continue; + } + } + + $tree->files[] = $file; + } + } else { + // Missing or invalid path; print out the list of authorized path + $paths = unserialize(module::get_var("videos", "authorized_paths")); + foreach (array_keys($paths) as $path) { + $tree->files[] = $path; + } + } + print $tree; + } + + /** + * Begin the task of adding files. + */ + public function start() { + access::verify_csrf(); + $item = ORM::factory("item", Input::instance()->get("item_id")); + + foreach (Input::instance()->post("paths") as $path) { + if (videos::is_valid_path($path)) { + $paths[] = array($path, null); + } + } + + $task_def = Task_Definition::factory() + ->callback("Videos_Controller::add") + ->description(t("Add videos from the local server")) + ->name(t("Add from server")); + $task = task::create($task_def, array("item_id" => $item->id, "queue" => $paths)); + + json::reply( + array("result" => "started", + "status" => (string)$task->status, + "url" => url::site("videos/run/$task->id?csrf=" . access::csrf_token()))); + } + + /** + * Run the task of adding files + */ + function run($task_id) { + access::verify_csrf(); + + $task = ORM::factory("task", $task_id); + if (!$task->loaded() || $task->owner_id != identity::active_user()->id) { + access::forbidden(); + } + + $task = task::run($task_id); + // Prevent the JavaScript code from breaking by forcing a period as + // decimal separator for all locales with sprintf("%F", $value). + json::reply(array("done" => (bool)$task->done, + "status" => (string)$task->status, + "percent_complete" => sprintf("%F", $task->percent_complete))); + } + + /** + * This is the task code that adds photos and albums. It first examines all the target files + * and creates a set of Server_Add_File_Models, then runs through the list of models and adds + * them one at a time. + */ + static function add($task) { + $mode = $task->get("mode", "init"); + $start = microtime(true); + + switch ($mode) { + case "init": + $task->set("mode", "build-file-list"); + $task->percent_complete = 0; + $task->status = t("Starting up"); + batch::start(); + break; + + case "build-file-list": // 0% to 10% + // We can't fit an arbitrary number of paths in a task, so store them in a separate table. + // Don't use an iterator here because we can't get enough control over it when we're dealing + // with a deep hierarchy and we don't want to go over our time quota. The queue is in the + // form [path, parent_id] where the parent_id refers to another Server_Add_File_Model. We + // have this extra level of abstraction because we don't know its Item_Model id yet. + $queue = $task->get("queue"); + $paths = unserialize(module::get_var("videos", "authorized_paths")); + + while ($queue && microtime(true) - $start < 0.5) { + list($file, $parent_entry_id) = array_shift($queue); + // Ignore the staging directories as directories to be imported. + if (empty($paths[$file])) { + $entry = ORM::factory("videos_file"); + $entry->task_id = $task->id; + $entry->file = $file; + $entry->parent_id = $parent_entry_id; + $entry->save(); + $entry_id = $entry->id; + } else { + $entry_id = null; + } + + $file = preg_quote($file); + foreach (glob("$file/*") as $child) { + if (is_dir($child)) { + $queue[] = array($child, $entry_id); + } else { + $ext = strtolower(pathinfo($child, PATHINFO_EXTENSION)); + //if (in_array($ext, array("gif", "jpeg", "jpg", "png", "flv", "mp4", "m4v")) && + if (in_array($ext, unserialize(module::get_var("videos", "allowed_extensions"))) && + filesize($child) > 0) { + $child_entry = ORM::factory("videos_file"); + $child_entry->task_id = $task->id; + $child_entry->file = $child; + $child_entry->parent_id = $entry_id; + $child_entry->save(); + } + } + } + } + + // We have no idea how long this can take because we have no idea how deep the tree + // hierarchy rabbit hole goes. Leave ourselves room here for 100 iterations and don't go + // over 10% in percent_complete. + $task->set("queue", $queue); + $task->percent_complete = min($task->percent_complete + 0.1, 10); + $task->status = t2( + "Found one file", "Found %count files", + ORM::factory("videos_file")->where("task_id", "=", $task->id)->count_all()); + + if (!$queue) { + $task->set("mode", "add-files"); + $task->set( + "total_files", + ORM::factory("videos_file")->where("task_id", "=", $task->id)->count_all()); + $task->percent_complete = 10; + } + break; + + case "add-files": // 10% to 100% + $completed_files = $task->get("completed_files", 0); + $total_files = $task->get("total_files"); + + // Ordering by id ensures that we add them in the order that we created the entries, which + // will create albums first. Ignore entries which already have an Item_Model attached, + // they're done. + $entries = ORM::factory("videos_file") + ->where("task_id", "=", $task->id) + ->where("item_id", "IS", null) + ->order_by("id", "ASC") + ->limit(10) + ->find_all(); + if ($entries->count() == 0) { + // Out of entries, we're done. + $task->set("mode", "done"); + } + + $owner_id = identity::active_user()->id; + foreach ($entries as $entry) { + if (microtime(true) - $start > 0.5) { + break; + } + + // Look up the parent item for this entry. By now it should exist, but if none was + // specified, then this belongs as a child of the current item. + $parent_entry = ORM::factory("videos_file", $entry->parent_id); + if (!$parent_entry->loaded()) { + $parent = ORM::factory("item", $task->get("item_id")); + } else { + $parent = ORM::factory("item", $parent_entry->item_id); + } + + $name = basename($entry->file); + $title = item::convert_filename_to_title($name); + if (is_dir($entry->file)) { + $album = ORM::factory("item"); + $album->type = "album"; + $album->parent_id = $parent->id; + $album->name = $name; + $album->title = $title; + $album->owner_id = $owner_id; + $album->save(); + $entry->item_id = $album->id; + } else { + try { + $extension = strtolower(pathinfo($name, PATHINFO_EXTENSION)); + if (in_array($extension, unserialize(module::get_var("videos", "allowed_extensions")))) { + $movie = ORM::factory("item"); + $movie->type = "movie"; + $movie->parent_id = $parent->id; + $movie->set_data_file($entry->file); + $movie->name = $name; + $movie->title = $title; + $movie->owner_id = $owner_id; + $movie->save(); + $entry->item_id = $movie->id; + $items_video = ORM::factory("items_video"); + $items_video->item_id = $movie->id; + $items_video->save(); + if (file_exists($entry->file . ".flv")) { + copy($entry->file . ".flv", $movie->resize_path() . ".flv"); + } + } else { + // This should never happen, because we don't add stuff to the list that we can't + // process. But just in, case.. set this to a non-null value so that we skip this + // entry. + $entry->item_id = 0; + $task->log("Skipping unknown file type: $entry->file"); + } + } catch (Exception $e) { + // This can happen if a photo file is invalid, like a BMP masquerading as a .jpg + $entry->item_id = 0; + $task->log("Skipping invalid file: $entry->file"); + } + } + + $completed_files++; + $entry->save(); + } + $task->set("completed_files", $completed_files); + $task->status = t("Adding photos / albums (%completed of %total)", + array("completed" => $completed_files, + "total" => $total_files)); + $task->percent_complete = $total_files ? 10 + 100 * ($completed_files / $total_files) : 100; + break; + + case "done": + batch::stop(); + $task->done = true; + $task->state = "success"; + $task->percent_complete = 100; + db::build() + ->delete("videos_files") + ->where("task_id", "=", $task->id) + ->execute(); + message::info(t2("Successfully added one file", + "Successfully added %count files", + $task->get("completed_files"))); + } + } +} diff --git a/modules/videos/css/videos.css b/modules/videos/css/videos.css new file mode 100644 index 00000000..36746ab5 --- /dev/null +++ b/modules/videos/css/videos.css @@ -0,0 +1,38 @@ +#g-server-add button { + margin-bottom: .5em; +} + +#g-server-add-tree { + cursor: pointer; + padding-left: 4px; + width: 95%; +} + +#g-server-add-tree li { + padding: 0; + float: none; +} + +#g-server-add-tree span.selected { + background: #ddd; +} + +#g-server-add-tree { + border: 1px solid #ccc; + height: 20em; + overflow: auto; + margin-bottom: .5em; + padding: .5em; +} + +#g-server-add ul ul li { + padding-left: 1.2em; +} + +#g-server-add-paths li .ui-icon { + margin-top: .4em; +} + +#g-server-add-admin-form .textbox { + width: 400px; +} diff --git a/modules/videos/helpers/videos.php b/modules/videos/helpers/videos.php new file mode 100644 index 00000000..b75e4658 --- /dev/null +++ b/modules/videos/helpers/videos.php @@ -0,0 +1,49 @@ +Configure it now!", + array("url" => html::mark_clean(url::site("admin/videos")))), + "videos_configuration"); + } else { + site_status::clear("videos_configuration"); + } + } + + static function is_valid_path($path) { + if (!is_readable($path) || is_link($path)) { + return false; + } + + $authorized_paths = unserialize(module::get_var("videos", "authorized_paths")); + foreach (array_keys($authorized_paths) as $valid_path) { + if (strpos($path, $valid_path) === 0) { + return true; + } + } + + return false; + } +} diff --git a/modules/videos/helpers/videos_event.php b/modules/videos/helpers/videos_event.php new file mode 100644 index 00000000..54c7e860 --- /dev/null +++ b/modules/videos/helpers/videos_event.php @@ -0,0 +1,84 @@ +get("settings_menu") + ->append(Menu::factory("link") + ->id("videos") + ->label(t("Videos")) + ->url(url::site("admin/videos"))); + } + + static function site_menu($menu, $theme) { + $item = $theme->item(); + $paths = unserialize(module::get_var("videos", "authorized_paths")); + + if ($item && identity::active_user()->admin && $item->is_album() && !empty($paths) && + is_writable($item->is_album() ? $item->file_path() : $item->parent()->file_path())) { + $menu->get("add_menu") + ->append(Menu::factory("dialog") + ->id("videos") + ->label(t("Add videos")) + ->url(url::site("videos/browse/$item->id"))); + } + } + + static function item_before_delete($item) { + // If deleting a video, make sure the resize is deleted as well, if it exists. + if ($item->is_movie()) { + $items_video = ORM::factory("items_video") + ->where("item_id", "=", $item->id) + ->find(); + if ($items_video->loaded() && file_exists($item->resize_path() . ".flv")) { + @unlink($item->resize_path() . ".flv"); + } + } + } + + static function item_updated($old, $new) { + // When updating a video, check and see if the file name is being changed. + // If so, check for and modify any corresponding resized video + + if ($old->is_movie()) { + if ($old->file_path() != $new->file_path()) { + $items_video = ORM::factory("items_video") + ->where("item_id", "=", $old->id) + ->find(); + if ($items_video->loaded() && file_exists($old->resize_path() . ".flv")) { + @rename($old->resize_path() . ".flv", $new->resize_path() . ".flv"); + } + } + } + } + + static function item_moved($item, $old_parent) { + // When moving an video, also move the flash resize, if it exists. + + if ($item->is_movie()) { + $items_video = ORM::factory("items_video") + ->where("item_id", "=", $item->id) + ->find(); + $old_resize_path = $old_parent->resize_path() . "/" . $item->name . ".flv"; + if ($items_video->loaded() && file_exists($old_resize_path)) { + @rename($old_resize_path, $item->resize_path() . ".flv"); + } + } + } +} diff --git a/modules/videos/helpers/videos_installer.php b/modules/videos/helpers/videos_installer.php new file mode 100644 index 00000000..137df9cb --- /dev/null +++ b/modules/videos/helpers/videos_installer.php @@ -0,0 +1,52 @@ +query("CREATE TABLE {videos_files} ( + `id` int(9) NOT NULL auto_increment, + `file` varchar(255) NOT NULL, + `item_id` int(9), + `parent_id` int(9), + `task_id` int(9) NOT NULL, + PRIMARY KEY (`id`)) + DEFAULT CHARSET=utf8;"); + $db->query("CREATE TABLE {items_videos} ( + `id` int(9) NOT NULL auto_increment, + `item_id` int(9) NOT NULL, + PRIMARY KEY (`id`), + KEY (`item_id`, `id`)) + DEFAULT CHARSET=utf8;"); + module::set_var("videos", "allowed_extensions", serialize(array("avi", "mpg", "mpeg", "mov", "wmv", "asf", "mts"))); + module::set_version("videos", 1); + videos::check_config(); + } + + static function deactivate() { + site_status::clear("videos_configuration"); + } + + static function uninstall() { + $db = Database::instance(); + $db->query("DROP TABLE IF EXISTS {videos_files};"); + $db->query("DROP TABLE IF EXISTS {items_videos};"); + module::delete("videos"); + } +} diff --git a/modules/videos/helpers/videos_theme.php b/modules/videos/helpers/videos_theme.php new file mode 100644 index 00000000..9e994591 --- /dev/null +++ b/modules/videos/helpers/videos_theme.php @@ -0,0 +1,55 @@ +admin) { + $theme->css("videos.css"); + $theme->script("videos.js"); + } + + $item = $theme->item(); + if ($item && $item->is_movie()) { + $items_video = ORM::factory("items_video") + ->where("item_id", "=", $item->id) + ->find(); + if ($items_video->loaded()) { + $view = new View("videos_display_js.html"); + //$view->embed_code = addslashes($embedded_video->embed_code); + return $view; + } + } + } + + static function admin_head($theme) { + $head = array(); + if (strpos(Router::$current_uri, "admin/videos") !== false) { + $theme->css("videos.css"); + $theme->css("jquery.autocomplete.css"); + $base = url::site("__ARGS__"); + $csrf = access::csrf_token(); + $head[] = ""; + + $theme->script("jquery.autocomplete.js"); + $theme->script("admin_videos.js"); + } + + return implode("\n", $head); + } +} \ No newline at end of file diff --git a/modules/videos/js/admin_videos.js b/modules/videos/js/admin_videos.js new file mode 100644 index 00000000..9bb61ed1 --- /dev/null +++ b/modules/videos/js/admin_videos.js @@ -0,0 +1,8 @@ +/** + * Set up autocomplete on the server path list + * + */ +$("document").ready(function() { + $("#g-path").autocomplete( + base_url.replace("__ARGS__", "admin/videos/autocomplete"), {max: 256}); +}); diff --git a/modules/videos/js/videos.js b/modules/videos/js/videos.js new file mode 100644 index 00000000..02dda4c0 --- /dev/null +++ b/modules/videos/js/videos.js @@ -0,0 +1,125 @@ +(function($) { + $.widget("ui.gallery_server_add", { + _init: function() { + var self = this; + $("#g-server-add-add-button", this.element).click(function(event) { + event.preventDefault(); + $(".g-progress-bar", this.element). + progressbar(). + progressbar("value", 0); + $("#g-server-add-progress", this.element).slideDown("fast", function() { self.start_add(); }); + }); + $("#g-server-add-pause-button", this.element).click(function(event) { + self.pause = true; + $("#g-server-add-pause-button", this.element).hide(); + $("#g-server-add-continue-button", this.element).show(); + }); + $("#g-server-add-continue-button", this.element).click(function(event) { + self.pause = false; + $("#g-server-add-pause-button", this.element).show(); + $("#g-server-add-continue-button", this.element).hide(); + self.run_add(); + }); + $("#g-server-add-close-button", this.element).click(function(event) { + $("#g-dialog").dialog("close"); + window.location.reload(); + }); + $("#g-server-add-tree span.g-directory", this.element).dblclick(function(event) { + self.open_dir(event); + }); + $("#g-server-add-tree span.g-file, #g-server-add-tree span.g-directory", this.element).click(function(event) { + self.select_file(event); + }); + $("#g-server-add-tree span.g-directory", this.element).dblclick(function(event) { + self.open_dir(event); + }); + $("#g-dialog").bind("dialogclose", function(event, ui) { + window.location.reload(); + }); + }, + + taskURL: null, + pause: false, + + start_add: function() { + var self = this; + var paths = []; + $.each($("span.selected", self.element), function () { + paths.push($(this).attr("ref")); + }); + + $("#g-server-add-add-button", this.element).hide(); + $("#g-server-add-pause-button", this.element).show(); + + $.ajax({ + url: START_URL, + type: "POST", + async: false, + data: { "paths[]": paths }, + dataType: "json", + success: function(data, textStatus) { + $("#g-status").html(data.status); + $(".g-progress-bar", self.element).progressbar("value", data.percent_complete); + self.taskURL = data.url; + setTimeout(function() { self.run_add(); }, 25); + } + }); + return false; + }, + + run_add: function () { + var self = this; + $.ajax({ + url: self.taskURL, + async: false, + dataType: "json", + success: function(data, textStatus) { + $("#g-status").html(data.status); + $(".g-progress-bar", self.element).progressbar("value", data.percent_complete); + if (data.done) { + $("#g-server-add-progress", this.element).slideUp(); + $("#g-server-add-add-button", this.element).show(); + $("#g-server-add-pause-button", this.element).hide(); + $("#g-server-add-continue-button", this.element).hide(); + } else { + if (!self.pause) { + setTimeout(function() { self.run_add(); }, 25); + } + } + } + }); + }, + + /** + * Load a new directory + */ + open_dir: function(event) { + var self = this; + var path = $(event.target).attr("ref"); + $.ajax({ + url: GET_CHILDREN_URL.replace("__PATH__", path), + success: function(data, textStatus) { + $("#g-server-add-tree", self.element).html(data); + $("#g-server-add-tree span.g-directory", self.element).dblclick(function(event) { + self.open_dir(event); + }); + $("#g-server-add-tree span.g-file, #g-server-add-tree span.g-directory", this.element).click(function(event) { + self.select_file(event); + }); + } + }); + }, + + /** + * Manage file selection state. + */ + select_file: function (event) { + $(event.target).toggleClass("selected"); + if ($("#g-server-add span.selected").length) { + $("#g-server-add-add-button").enable(true).removeClass("ui-state-disabled"); + } else { + $("#g-server-add-add-button").enable(false).addClass("ui-state-disabled"); + } + } + }); +})(jQuery); diff --git a/modules/videos/models/items_video.php b/modules/videos/models/items_video.php new file mode 100644 index 00000000..67ee29e0 --- /dev/null +++ b/modules/videos/models/items_video.php @@ -0,0 +1,22 @@ + +
    +

    +
    + +

    + +
    +
    diff --git a/modules/videos/views/movieplayer.html.php b/modules/videos/views/movieplayer.html.php new file mode 100644 index 00000000..b960e1d7 --- /dev/null +++ b/modules/videos/views/movieplayer.html.php @@ -0,0 +1,33 @@ + +where("item_id", "=", $item->id) + ->find(); + if ($items_video->loaded() && file_exists($item->resize_path() . ".flv")) { + print html::anchor(str_replace("?m=", ".flv?m=", $item->resize_url(true)), "", $attrs); + } else { + print html::anchor($item->file_url(true), "", $attrs); + } +?> + + diff --git a/modules/videos/views/videos_display_js.html.php b/modules/videos/views/videos_display_js.html.php new file mode 100644 index 00000000..6273f27a --- /dev/null +++ b/modules/videos/views/videos_display_js.html.php @@ -0,0 +1,28 @@ + + +resize_path() . ".flv")) { ?> + + diff --git a/modules/videos/views/videos_tree.html.php b/modules/videos/views/videos_tree.html.php new file mode 100644 index 00000000..91354329 --- /dev/null +++ b/modules/videos/views/videos_tree.html.php @@ -0,0 +1,37 @@ + +
  • + + + + +
      + + +
    • + + + + +
        + + + +
      • + "> + " + ref="" > + + +
      • + + +
      • + + + +
      +
    • + + +
    +
  • diff --git a/modules/videos/views/videos_tree_dialog.html.php b/modules/videos/views/videos_tree_dialog.html.php new file mode 100644 index 00000000..a235ffbf --- /dev/null +++ b/modules/videos/views/videos_tree_dialog.html.php @@ -0,0 +1,52 @@ + + + +
    +

    html::purify($item->title))) ?>

    + +

    +
      + + parents() as $parent): ?> + > title) ?> + + +
    • title) ?>
    • +
    + +
      + +
    + + + + + + + + + + + + + +
    From defb1ebdc14b356154e986960b8de12f3c385b67 Mon Sep 17 00:00:00 2001 From: rWatcher Date: Thu, 30 Sep 2010 03:36:37 +0800 Subject: [PATCH 16/18] Added support for .flv formatted resized videos. --- modules/videos/controllers/videos.php | 4 ++++ modules/videos/views/admin_videos.html.php | 2 +- 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/modules/videos/controllers/videos.php b/modules/videos/controllers/videos.php index 00ec0691..020817ff 100644 --- a/modules/videos/controllers/videos.php +++ b/modules/videos/controllers/videos.php @@ -256,6 +256,10 @@ class Videos_Controller extends Admin_Controller { $items_video->save(); if (file_exists($entry->file . ".flv")) { copy($entry->file . ".flv", $movie->resize_path() . ".flv"); + list ($vid_width, $vid_height, $mime_type) = movie::get_file_metadata($entry->file . ".flv"); + $movie->height = $vid_height; + $movie->width = $vid_width; + $movie->save(); } } else { // This should never happen, because we don't add stuff to the list that we can't diff --git a/modules/videos/views/admin_videos.html.php b/modules/videos/views/admin_videos.html.php index 2787bbbb..6addb355 100644 --- a/modules/videos/views/admin_videos.html.php +++ b/modules/videos/views/admin_videos.html.php @@ -1,6 +1,6 @@
    -

    +

    From 8f3aef3e56caa9ba854191a68d7b0687a42bcc75 Mon Sep 17 00:00:00 2001 From: Bharat Mediratta Date: Tue, 5 Oct 2010 01:46:21 -0700 Subject: [PATCH 17/18] Second attempt at commiting NoFFMPEG. Conflicts: modules/noffmpeg/helpers/movie.php --- modules/noffmpeg/helpers/movie.php | 15 +-------------- 1 file changed, 1 insertion(+), 14 deletions(-) diff --git a/modules/noffmpeg/helpers/movie.php b/modules/noffmpeg/helpers/movie.php index 40d0940a..801796b8 100644 --- a/modules/noffmpeg/helpers/movie.php +++ b/modules/noffmpeg/helpers/movie.php @@ -23,9 +23,6 @@ * * Note: by design, this class does not do any permission checking. */ - -include MODPATH . "noffmpeg/libraries/MP4Info.php"; - class movie_Core { static function get_edit_form($movie) { $form = new Forge("movies/update/$movie->id", "", "post", array("id" => "g-edit-movie-form")); @@ -116,17 +113,7 @@ class movie_Core { $extension = isset($pi["extension"]) ? $pi["extension"] : "flv"; // No extension? Assume FLV. $mime_type = in_array(strtolower($extension), array("mp4", "m4v")) ? "video/mp4" : "video/x-flv"; - $vid_width = 320; - $vid_height = 240; - if (strtolower($extension) == "flv") { - $flvinfo = new FLVMetaData($file_path); - $info = $flvinfo->getMetaData(); - if (($info["width"] != "") && ($info["height"] != "")) { - $vid_width = $info["width"]; - $vid_height = $info["height"]; - } - } - return array($vid_width, $vid_height, $mime_type, $extension); + return array(320, 240, $mime_type, $extension); //throw new Exception("@todo MISSING_FFMPEG"); // END rWatcher Edit. } From 5dd7d3eb46a9f86da3f8cba5b4920534c163946d Mon Sep 17 00:00:00 2001 From: rWatcher Date: Thu, 16 Sep 2010 23:32:00 -0400 Subject: [PATCH 18/18] Added a library for determining FLV height and width. --- modules/noffmpeg/helpers/movie.php | 15 ++++++++++++++- 1 file changed, 14 insertions(+), 1 deletion(-) diff --git a/modules/noffmpeg/helpers/movie.php b/modules/noffmpeg/helpers/movie.php index 801796b8..40d0940a 100644 --- a/modules/noffmpeg/helpers/movie.php +++ b/modules/noffmpeg/helpers/movie.php @@ -23,6 +23,9 @@ * * Note: by design, this class does not do any permission checking. */ + +include MODPATH . "noffmpeg/libraries/MP4Info.php"; + class movie_Core { static function get_edit_form($movie) { $form = new Forge("movies/update/$movie->id", "", "post", array("id" => "g-edit-movie-form")); @@ -113,7 +116,17 @@ class movie_Core { $extension = isset($pi["extension"]) ? $pi["extension"] : "flv"; // No extension? Assume FLV. $mime_type = in_array(strtolower($extension), array("mp4", "m4v")) ? "video/mp4" : "video/x-flv"; - return array(320, 240, $mime_type, $extension); + $vid_width = 320; + $vid_height = 240; + if (strtolower($extension) == "flv") { + $flvinfo = new FLVMetaData($file_path); + $info = $flvinfo->getMetaData(); + if (($info["width"] != "") && ($info["height"] != "")) { + $vid_width = $info["width"]; + $vid_height = $info["height"]; + } + } + return array($vid_width, $vid_height, $mime_type, $extension); //throw new Exception("@todo MISSING_FFMPEG"); // END rWatcher Edit. }