r80306 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r80305‎ | r80306 | r80307 >
Date:19:46, 14 January 2011
Author:husky
Status:ok
Tags:
Comment:
added javascript to make admin button possible
Modified paths:
  • /trunk/tools/wp-photocommons/img/favicon.png (added) (history)
  • /trunk/tools/wp-photocommons/inc (added) (history)
  • /trunk/tools/wp-photocommons/inc/class-photocommons.php (added) (history)
  • /trunk/tools/wp-photocommons/js/admin.js (added) (history)
  • /trunk/tools/wp-photocommons/test.php (added) (history)

Diff [purge]

Index: trunk/tools/wp-photocommons/test.php
@@ -0,0 +1,3 @@
 2+<div style="width:300px;height;300px;background:yellow;float:left;">
 3+ <button>ok</button>
 4+</div>
\ No newline at end of file
Property changes on: trunk/tools/wp-photocommons/test.php
___________________________________________________________________
Added: svn:eol-style
15 + native
Index: trunk/tools/wp-photocommons/inc/class-photocommons.php
@@ -0,0 +1,16 @@
 2+<?php
 3+class Photocommons {
 4+ // TODO: ugly
 5+ const PLUGIN_PATH = "/wp-content/plugins/wp-photocommons/";
 6+
 7+ function __construct() {
 8+ if (is_admin()) {
 9+ wp_enqueue_script('jquery');
 10+ wp_enqueue_script('jquery-ui-core');
 11+ wp_enqueue_script('jquery-ui-dialog');
 12+
 13+ wp_register_script('admin', self::PLUGIN_PATH . 'js/admin.js');
 14+ wp_enqueue_script('admin');
 15+ }
 16+ }
 17+}
\ No newline at end of file
Property changes on: trunk/tools/wp-photocommons/inc/class-photocommons.php
___________________________________________________________________
Added: svn:eol-style
118 + native
Index: trunk/tools/wp-photocommons/img/favicon.png
Cannot display: file marked as a binary type.
svn:mime-type = image/png
Property changes on: trunk/tools/wp-photocommons/img/favicon.png
___________________________________________________________________
Added: svn:mime-type
219 + image/png
Index: trunk/tools/wp-photocommons/js/admin.js
@@ -0,0 +1,31 @@
 2+(function($) {
 3+ var PATH = "../wp-content/plugins/wp-photocommons";
 4+
 5+ function addButtons() {
 6+ $("#media-buttons").append(''.concat(
 7+ '<a id="photocommons-add" title="Add a free image">',
 8+ '<img src="' + PATH + '/img/favicon.png" />',
 9+ '</a>'
 10+ ));
 11+
 12+ $("#photocommons-add").live('click', function(e) {
 13+ e.preventDefault();
 14+
 15+ $("body").prepend('<div id="photocommons-dialog"></div>');
 16+ $("#photocommons-dialog").load(PATH + "/test.php", function(html) {
 17+ var $self = $("#photocommons-dialog");
 18+ $self.dialog();
 19+ $self.find("button").click(function() {
 20+ var cnt = $("#content").val();
 21+ $("#content").val('<marquee>hoi</marquee>' + cnt);
 22+ $self.dialog('close');
 23+ });
 24+ });
 25+ });
 26+ }
 27+
 28+ $(document).ready(function() {
 29+ addButtons();
 30+ });
 31+
 32+})(jQuery);
\ No newline at end of file
Property changes on: trunk/tools/wp-photocommons/js/admin.js
___________________________________________________________________
Added: svn:eol-style
133 + native

Status & tagging log