diff --git a/README.txt b/README.txt index b0b5e521..325e895f 100644 --- a/README.txt +++ b/README.txt @@ -101,6 +101,22 @@ For a list of permissions, see core/userclass.class.php Development Info ~~~~~~~~~~~~~~~~ +ui-* cookies are for the client-side scripts only; in some configurations +(eg with varnish cache) they will be stripped before they reach the server + +shm-* CSS classes are for javascript to hook into; if you're customising +themes, be careful with these, and avoid styling them, eg: + +- shm-thumb = outermost element of a thumbnail + - data-tags + - data-post-id +- shm-toggler = click this to toggle elements that match the selector + - data-toggle-sel +- shm-unlocker = click this to unlock elements that match the selector + - data-unlock-sel +- shm-clink = a link to a comment, flash the target element when clicked + - data-clink-sel + http://shimmie.shishnet.org/doc/ Please tell me if those docs are lacking in any way, so that they can be diff --git a/core/basethemelet.class.php b/core/basethemelet.class.php index ef9b3a42..70e01ab1 100644 --- a/core/basethemelet.class.php +++ b/core/basethemelet.class.php @@ -54,9 +54,9 @@ class BaseThemelet { $tsize = get_thumbnail_size($image->width, $image->height); } - return ''. - ''.$h_tip.''. - ''. + return "". + "$h_tip". + "". "\n"; } diff --git a/core/config.class.php b/core/config.class.php index 8fc7b4d9..4fdfc2b4 100644 --- a/core/config.class.php +++ b/core/config.class.php @@ -120,6 +120,20 @@ abstract class BaseConfig implements Config { } +/** + * For testing, mostly + */ +class HardcodeConfig extends BaseConfig { + public function __construct($dict) { + $this->values = $dict; + } + + public function save(/*string*/ $name=null) { + // static config is static + } +} + + /** * Loads the config list from a PHP file; the file should be in the format: * diff --git a/ext/blotter/main.php b/ext/blotter/main.php index 21c87d8c..f02e1461 100644 --- a/ext/blotter/main.php +++ b/ext/blotter/main.php @@ -43,6 +43,7 @@ class Blotter extends Extension { $config->set_default_string("blotter_position", "subheading"); } + public function onSetupBuilding(SetupBuildingEvent $event) { global $config; $sb = new SetupBlock("Blotter"); @@ -51,12 +52,14 @@ class Blotter extends Extension { $sb->add_choice_option("blotter_position", array("Top of page" => "subheading", "In navigation bar" => "left"), "
Position: "); $event->panel->add_block($sb); } + public function onUserBlockBuilding(UserBlockBuildingEvent $event) { global $user; if($user->is_admin()) { $event->add_link("Blotter Editor", make_link("blotter/editor")); } } + public function onPageRequest(PageRequestEvent $event) { global $page, $database, $user; if($event->page_matches("blotter")) { @@ -105,7 +108,7 @@ class Blotter extends Extension { $page->set_redirect(make_link("blotter/editor")); } break; - case "": + case "list": /** * Displays all blotter entries */ diff --git a/ext/blotter/script.js b/ext/blotter/script.js index 9527de26..e2f4f892 100644 --- a/ext/blotter/script.js +++ b/ext/blotter/script.js @@ -1,16 +1,15 @@ - $(document).ready(function() { - $("#blotter2-toggle").click(function() { - $("#blotter2").slideToggle("slow", function() { - if($("#blotter2").is(":hidden")) { - $.cookie("blotter2-hidden", 'true', {path: '/'}); + $(".shm-blotter2-toggle").click(function() { + $(".shm-blotter2").slideToggle("slow", function() { + if($(".shm-blotter2").is(":hidden")) { + $.cookie("ui-blotter2-hidden", 'true', {path: '/'}); } else { - $.cookie("blotter2-hidden", 'false', {path: '/'}); + $.cookie("ui-blotter2-hidden", 'false', {path: '/'}); } }); }); - if($.cookie("blotter2-hidden") == 'true') { - $("#blotter2").hide(); + if($.cookie("ui-blotter2-hidden") == 'true') { + $(".shm-blotter2").hide(); } }); diff --git a/ext/blotter/theme.php b/ext/blotter/theme.php index 29581c1d..9fe9dd79 100644 --- a/ext/blotter/theme.php +++ b/ext/blotter/theme.php @@ -12,8 +12,9 @@ class BlotterTheme extends Themelet { public function display_blotter_page($entries) { global $page; $html = $this->get_html_for_blotter_page($entries); - $page->set_mode("data"); - $page->set_data($html); + $page->set_title("Blotter"); + $page->set_heading("Blotter"); + $page->add_block(new Block("Blotter Entries", $html, "main", 10)); } public function display_blotter($entries) { @@ -95,10 +96,8 @@ class BlotterTheme extends Themelet { * This one displays a list of all blotter entries. */ global $config; - $i_color = $config->get_string("blotter_color","#FF0000"); - $html = ""; - $html .= "Blotter -
";
+		$i_color = $config->get_string("blotter_color", "#FF0000");
+		$html = "
";
 
 		$num_entries = count($entries);
 		for ($i = 0 ; $i < $num_entries ; $i++) {
@@ -110,13 +109,15 @@ class BlotterTheme extends Themelet {
 			$i_close = "";
 			$id = $entries[$i]['id'];
 			$messy_date = $entries[$i]['entry_date'];
-			$clean_date = date("m/d/y",strtotime($messy_date));
+			$clean_date = date("y/m/d", strtotime($messy_date));
 			$entry_text = $entries[$i]['entry_text'];
-			if($entries[$i]['important'] == 'Y') { $i_open = ""; $i_close=""; }
+			if($entries[$i]['important'] == 'Y') {
+				$i_open = "";
+				$i_close="";
+			}
 			$html .= "{$i_open}{$clean_date} - {$entry_text}{$i_close}

"; } - - $html .= "
"; + $html .= "
"; return $html; } @@ -143,14 +144,17 @@ class BlotterTheme extends Themelet { } $entries_list .= "
  • {$i_open}{$clean_date} - {$entry_text}{$i_close}
  • "; } + $out_text = ""; $in_text = ""; $pos_break = ""; $pos_align = "text-align: right; position: absolute; right: 0px;"; + if($position === "left") { $pos_break = "
    "; $pos_align = ""; } + if(count($entries) === 0) { $out_text = "No blotter entries yet."; $in_text = "Empty."; @@ -160,9 +164,18 @@ class BlotterTheme extends Themelet { $out_text = "Blotter updated: {$clean_date}"; $in_text = ""; } - $html = ""; - $html .= "
    $out_text{$pos_break}Show/Hide Show All
    "; - $html .= "
    $in_text
    "; + + $html = " +
    + $out_text + {$pos_break} + + Show/Hide + Show All + +
    +
    $in_text
    + "; return $html; } } diff --git a/ext/handle_pixel/main.php b/ext/handle_pixel/main.php index cd82160f..9546699a 100644 --- a/ext/handle_pixel/main.php +++ b/ext/handle_pixel/main.php @@ -73,7 +73,7 @@ class PixelFileHandler extends DataHandlerExtension { public function onImageAdminBlockBuilding(ImageAdminBlockBuildingEvent $event) { $event->add_part("
    - diff --git a/ext/handle_pixel/script.js b/ext/handle_pixel/script.js index c95bc3e0..aa83fa16 100644 --- a/ext/handle_pixel/script.js +++ b/ext/handle_pixel/script.js @@ -1,9 +1,9 @@ $(function() { - $("#zoomer").change(function(e) { + $(".shm-zoomer").change(function(e) { zoom(this.options[this.selectedIndex].value); }); - $("#main_image").click(function(e) { + $(".shm-main-image").click(function(e) { switch($.cookie("ui-image-zoom")) { case "full": zoom("width"); break; default: zoom("full"); break; @@ -16,7 +16,7 @@ $(function() { }); function zoom(zoom) { - var img = $('#main_image'); + var img = $('.shm-main-image'); if(zoom == "full") { img.css('max-width', img.data('width') + 'px'); img.css('max-height', img.data('height') + 'px'); @@ -34,7 +34,7 @@ function zoom(zoom) { img.css('max-height', (window.innerHeight * 0.95) + 'px'); } - $("#zoomer").val(zoom); + $(".shm-zoomer").val(zoom); $.cookie("ui-image-zoom", zoom, {path: '/', expires: 365}); } diff --git a/ext/handle_pixel/theme.php b/ext/handle_pixel/theme.php index 03e6c99f..4099e97f 100644 --- a/ext/handle_pixel/theme.php +++ b/ext/handle_pixel/theme.php @@ -23,7 +23,7 @@ class PixelFileHandlerTheme extends Themelet { } } - $html = "main image"; + $html = "main image"; $page->add_block(new Block("Image", $html, "main", 10)); } } diff --git a/ext/index/script.js b/ext/index/script.js index 6c3078c0..f90bc95e 100644 --- a/ext/index/script.js +++ b/ext/index/script.js @@ -1,16 +1,10 @@ $(function() { - var blocked_tags = ($.cookie("ui-blocked-tags") || $.cookie("blocked-tags") || "").split(" "); - var themecheck = $(".thumb[data-tags]").parent().attr('class'); + var blocked_tags = ($.cookie("ui-blocked-tags") || "").split(" "); var needs_refresh = false; for(i=0; ibuild_thumb_html($image, $query); } + $table .= ""; return $table; } } diff --git a/ext/mass_tagger/main.php b/ext/mass_tagger/main.php index ff3d91d7..7170dae8 100644 --- a/ext/mass_tagger/main.php +++ b/ext/mass_tagger/main.php @@ -10,8 +10,6 @@ * add buttons to each image to mark them for tagging, and a field for * inputting tags will appear. Once the "Tag" button is clicked, the tags in * the text field will be added to marked images. - * - * As of now only compatible with the lite theme. */ class MassTagger extends Extension { diff --git a/ext/mass_tagger/script.js b/ext/mass_tagger/script.js index 91ae12f5..1cc4077c 100644 --- a/ext/mass_tagger/script.js +++ b/ext/mass_tagger/script.js @@ -1,15 +1,19 @@ -function find_thumb_link_containers () { - - var post_link = "a[href*='/post/view/']"; - var has_thumb_img = ":has(img[src*='/thumb/'])"; - var list = $( post_link + has_thumb_img ).parent(); +function activate_mass_tagger ( image_link ) { + $(".shm-thumb").each( + function ( index, block ) { + add_mass_tag_button( $(block), image_link ); + } + ); + $('#mass_tagger_controls').show(); + $('#mass_tagger_activate').hide(); +} - if (list) { return list; } +function add_mass_tag_button($block, image_link) { - has_thumb_img = ":has(img[src*='_thumbs/'])"; - list = $( post_link + has_thumb_img ).parent(); - - return list; + var c = function() { toggle_tag(this, $block.data("post-id")); return false; }; + + $block.find("A").click(c); + $block.click(c); // sometimes the thumbs *is* the A } function toggle_tag( button, id ) { @@ -17,65 +21,14 @@ function toggle_tag( button, id ) { var list = $('#mass_tagger_ids'); var string = list.val(); - if( string.indexOf( id ) > -1 ) return remove_mass_tag_id( button, list, id, string ); - - return add_mass_tag_id( button, list, id, string ); -} - -function add_mass_tag_id( button, list, id, string ) { - $(button).attr( 'style', 'display:block;border: 3px solid blue;' ); - string += id; - list.val( string ); - return false; -} - -function remove_mass_tag_id( button, list, id, string ) { - $(button).attr( 'style', '' ); - string = string.replace( id, '' ); - list.val( string ); - return false; -} - -function activate_mass_tagger ( image_link ) { - - find_thumb_link_containers().each( - function ( index, block ) { - add_mass_tag_button( block, image_link ); - } - ); - $('#mass_tagger_controls').attr( 'style', 'display:block' ); - $('#mass_tagger_activate').attr( 'style', 'display:none' ); - - return false; -} - -function add_mass_tag_button ( block, image_link ) { - - var id = get_image_id( block ); - - var button = create_mass_tag_button( id, image_link ); - $(block).append( button ); - - return; -} - -function get_image_id ( block ) { - var link = $(block).children(":first").attr('href'); - var id = link.split('/').pop(); - - return id; -} - -function create_mass_tag_button ( id, image_link ) { - var img = $(''); - img.attr( "src", image_link+'/ext/mass_tagger/toggle.gif' ); - - var link = $(''); - link.attr("class",'zoom'); - link.attr("onclick",'return toggle_tag( this, "'+id+'")'); - link.attr("href",'#'); - - link.append( img ); - - return link; + if( string.indexOf( id ) > -1 ) { + $(button).css('border', 'none'); + string = string.replace(id, ''); + list.val(string); + } + else { + $(button).css('border', '3px solid blue'); + string += id; + list.val(string); + } } diff --git a/ext/mass_tagger/style.css b/ext/mass_tagger/style.css deleted file mode 100644 index 13467ae1..00000000 --- a/ext/mass_tagger/style.css +++ /dev/null @@ -1,8 +0,0 @@ - -.zoom{ position:absolute;display:none;margin:-110px 27px; } -.thumbblock:hover .zoom{ display:block; } -.zoom:hover{ border: 3px solid blue; } -/*.zoom img:hover{ background:url(/contrib/simpletest/data/pbx_screenshot.jpg) no-repeat;}*/ - -.zoom img { width: 100px; height: 100px; } -#mass_tagger_controls { display:none; } diff --git a/ext/mass_tagger/theme.php b/ext/mass_tagger/theme.php index 28197b3e..0f0b009e 100644 --- a/ext/mass_tagger/theme.php +++ b/ext/mass_tagger/theme.php @@ -9,7 +9,7 @@ class MassTaggerTheme extends Themelet { $body = " -
    +