From b25c05e6003269d29dd29b5691b5b4228b057d36 Mon Sep 17 00:00:00 2001 From: John Bintz Date: Tue, 13 Oct 2009 22:56:45 -0400 Subject: [PATCH] filter previews and internal filters --- classes/WhatDidTheySayAdmin.inc | 32 +++++++++----- classes/partials/_default-styles.inc | 5 ++- classes/partials/admin.inc | 4 ++ graphics/view-refresh.png | Bin 0 -> 912 bytes .../LeftJustifiedBasic.css | 40 ++++++++++++++++++ .../LeftJustifiedBasic.inc | 18 ++++++++ 6 files changed, 87 insertions(+), 12 deletions(-) create mode 100644 graphics/view-refresh.png create mode 100644 transcript-filters/left-justified-basic/LeftJustifiedBasic.css create mode 100644 transcript-filters/left-justified-basic/LeftJustifiedBasic.inc diff --git a/classes/WhatDidTheySayAdmin.inc b/classes/WhatDidTheySayAdmin.inc index f99f67e..a36dc94 100644 --- a/classes/WhatDidTheySayAdmin.inc +++ b/classes/WhatDidTheySayAdmin.inc @@ -103,10 +103,12 @@ class WhatDidTheySayAdmin { } if ($filter_to_use) { - $target = $this->get_filters_dir() . '/' . preg_replace('#[^a-z0-9_-]#', '', strtolower($filter_to_use)); - if (is_dir($target)) { - $this->override_filter_info = array(); - foreach (glob($target . '/*') as $file) { + $all_filters = $this->_get_available_override_filters(); + + $filter_to_use = preg_replace('#[^a-z0-9_-]#', '', strtolower($filter_to_use)); + + if (isset($all_filters[$filter_to_use])) { + foreach (glob($all_filters[$filter_to_use] . '/*') as $file) { if (preg_match('#\.(php|inc)$#', $file) > 0) { $this->override_filter_info['php'] = $file; } if (preg_match('#\.(css)$#', $file) > 0) { $this->override_filter_info['css'] = $file; } } @@ -864,19 +866,27 @@ class WhatDidTheySayAdmin { function _get_available_override_filters() { $available_filters = array(); - if (is_dir($this->get_filters_dir())) { - foreach (glob($this->get_filters_dir() . '/*') as $dir) { - if (is_dir($dir)) { - if (basename($dir) == preg_replace('#[^a-z0-9_-]#', '', strtolower(basename($dir)))) { - foreach (glob($dir . '/*') as $file) { - if (preg_match('#^(.*)\.(inc|php)$#', basename($file), $matches) > 0) { - $available_filters[] = basename($dir); + $search_path = array( + realpath(dirname(__FILE__) . '/../transcript-filters'), + $this->get_filters_dir() + ); + + foreach ($search_path as $target) { + if (is_dir($target)) { + foreach (glob($target . '/*') as $dir) { + if (is_dir($dir)) { + if (basename($dir) == preg_replace('#[^a-z0-9_-]#', '', strtolower(basename($dir)))) { + foreach (glob($dir . '/*') as $file) { + if (preg_match('#^(.*)\.(inc|php)$#', basename($file), $matches) > 0) { + $available_filters[basename($dir)] = $dir; + } } } } } } } + return $available_filters; } diff --git a/classes/partials/_default-styles.inc b/classes/partials/_default-styles.inc index 8259109..4710bf8 100644 --- a/classes/partials/_default-styles.inc +++ b/classes/partials/_default-styles.inc @@ -69,14 +69,17 @@ +
+ +

diff --git a/classes/partials/admin.inc b/classes/partials/admin.inc index a901f4a..907334a 100644 --- a/classes/partials/admin.inc +++ b/classes/partials/admin.inc @@ -107,6 +107,10 @@ }; $('wdts-filters-to-use').observe('change', load_sample_transcript); + $('refresh-filter-preview').observe('click', function(e) { + Event.stop(e); + load_sample_transcript(); + }); Event.observe(window, 'load', load_sample_transcript); diff --git a/graphics/view-refresh.png b/graphics/view-refresh.png new file mode 100644 index 0000000000000000000000000000000000000000..3fd71d6e5929ba0c40db1960e36e9acba9d7e525 GIT binary patch literal 912 zcmV;B18@9^P)oWowDaEkzU!j%l38$)o7}}cCnx7z zVrKYAWwOsS=-Lqw-t?qu)r6QQ!notg696vQmg&~r9t3cLe1UW(yG7H)Ku^~yeO+g> z(bg0Jm{BNJFfw+(d}sQhCl&9uE%R)8S2n|p?*PPznUTt5*BiPR+1l3~ipPS`iO?Jk zARN#U4H*a;0yD)$9M29{3dM>Y4K?&WE>{g^G!Zl7)jelV^{i|AG#D_%trsJC8h7YDw+>Nu`!(E)&&KfE(t5U!_KF)uRXGsl%@ z#;0eK6ZhtiUhin`+P8I6C=m!d1ufk}o{_gOutKfI-_b^R{JP z`QzJ2^LHMWS&9G(o-t)@yh1Uq9cxfG6X$C)H~ghbOC7?WrZ-yyL0>0QOs`0x)U>uAAQg z>;&LGL0Gpf^PVr@oj>}%1`wDT7wv!4sq=s3q*Oh&WftpMhqGg=O68@F-$%x80Ep=T zKm-sG?*3PXAs8nI|0Dok)RR-0Y?z4d_HJBzCO6*s&6^5?o^0No>h2ra)My_p{u2^&LcltM%9%NL@3OcL;J5G-fbF(raxE|ez'; + if (!empty($direction)) { + $content .= ' ' . $direction . ''; + } + $content .= ': ' . $speech . ''; + + return array($name, $direction, $speech, $content); + } +} + +?> \ No newline at end of file