Jannick Knudsen 4 years ago
parent
commit
081c2d6ccc
7 changed files with 234 additions and 52 deletions
  1. BIN
      login_logo.png
  2. BIN
      logo.png
  3. 73 0
      plug_usermanager.php
  4. 27 2
      plugin.php
  5. 3 0
      pluginoptions.php
  6. 62 20
      script_backend.js
  7. 69 30
      source.svg

BIN
login_logo.png


BIN
logo.png


+ 73 - 0
plug_usermanager.php

@@ -0,0 +1,73 @@
+<?php
+
+if (!class_exists("plug_usermanager")) {
+	class plug_usermanager {	
+		function plug_usermanager($ns) {
+			$this->title = __("plug_usermanager","dagsopt");
+			$this->pluginname = $ns->pluginname;
+			$this->file = $ns->file;
+			$this->ns = $ns;
+
+		}
+		function start() {
+//			register_setting("section", "demo-file", array(&this,"handle_file_upload"));
+		
+		}
+
+		function handle_file_upload($option)
+		{
+		  	if(!empty($_FILES["demo-file"]["tmp_name"]))
+		    {
+		        $urls = wp_handle_upload($_FILES["demo-file"], array('test_form' => FALSE));
+		        $temp = $urls["url"];
+		        return $temp;   
+		    }
+
+		    return $option;
+		}
+
+		 
+
+
+	function help(){
+		?>
+		plug_usermanager			
+	<?php		
+	}
+
+
+ 	function Option($pre){
+ 
+
+	}
+
+  		/*<input id="link_image" value="test">
+  		<img src="" id="background_image">
+
+		<a id="upload_image_button" href="#"><?php _e('Set image', 'dagsopt'); ?></a>
+		*/	
+
+
+	 	function admin_line($pre){
+  ?>
+  		<form action="plug_usermanager_submit" method="POST" accept-charset="utf-8">
+  			<input type="file" name="filen">
+  			<input type="Submit" value="Submit">
+  		</form>
+
+
+	  <?php  
+}	
+}
+
+global $plug_usermanager;
+$plug_usermanager = new plug_usermanager($this);		
+	$this->dagsopt['plug_usermanager'] = $plug_usermanager;
+	
+}
+
+
+
+
+
+

+ 27 - 2
plugin.php

@@ -1,18 +1,19 @@
 <?php
 /*
- Plugin Name: dagsplug
+ Plugin Name: dagsopt
  Plugin URI: https://git.tum.dk/tum.dk/dagsplug/
  Description: Tools 
  Author: iskedk
  Version: 0.0.26
  Date: Fri Jan 31 2014 13:19:21 GMT+0100 (CET)
  Author URI: https://iske.dk/
+ Text Domain: dagsopt
  */
 
 $wp_dagsopt = new dagsopt ( );
 class dagsopt {
 	var $version = "0.0.26";
-	var $publish_date = "2021-01-23";
+	var $publish_date = "2021-01-14";
 	var $pluginname;
 	var $plugintitle;
 	var $db;
@@ -81,10 +82,17 @@ class dagsopt {
 		}
 
 
+    	add_action('init',   array(&$this, 'process_post' ));
 
 
 	}
 
+		function process_post() {
+			if (!is_admin()) {
+			    echo "<!-- kommer aller aller først -->";
+			  }
+		}
+
 
 		function mytheme_admin_bar_render() {
 			global $wp_admin_bar;
@@ -113,8 +121,19 @@ class dagsopt {
 		   wp_enqueue_script( 	$this->pluginname.'frontend_script' );
 	}
 	function print_backend_scripts_styles() {
+
+		   wp_enqueue_media();
+
 		   wp_enqueue_style( 	$this->pluginname.'backend_style' );
 		   wp_enqueue_script(	$this->pluginname.'backend_script' );
+	
+
+			// include the javascript    
+			wp_enqueue_script('thickbox', null, array('jquery'));
+
+			// include the thickbox styles    
+			wp_enqueue_style('thickbox.css', '/'.WPINC.'/js/thickbox/thickbox.css', null, '1.0');
+
 	}
 
 
@@ -122,6 +141,7 @@ class dagsopt {
 
 
 
+
 	function plugin_admin_menu() {
 		if(function_exists("wppluginspage")){
 			add_menu_page('WP Plugins Page', 'WP Plugins', 'manage_options', 'wpplugins', wppluginspage,"");
@@ -154,6 +174,11 @@ class dagsopt {
 	}
 
 	function Option() {
+		if(isset($_FILES)){
+			print_r($_FILES);
+			echo("OOOOOK");			
+		}
+
 		if (isset ( $_POST [ 'Submit' ] )) {
 			if (function_exists ( 'current_user_can' ) && ! current_user_can ( 'manage_options' )) {
 				die ( __ ( 'Cheatin&#8217; uh?' ) );

+ 3 - 0
pluginoptions.php

@@ -117,6 +117,9 @@ Version: <?php echo($this->version); ?> <?php echo($this->publish_date); ?>
 	</form>
 
 
+
+
+
 		<table class="form-table">
 		 <?php
 		 foreach($this->dagsopt as $plugname => $plug){

+ 62 - 20
script_backend.js

@@ -1,35 +1,77 @@
-var $ = jQuery;	
- 
+var $ = jQuery;
+
+
 
-	
 $(document).ready(function() {
-	//$("***").ttt();
+    //$("***").ttt();
+    console.log("OKOKOKO K plugin");
+
+
+
+    var mediaUploader;
+    $('#upload_image_button').click(function(e) {
+        e.preventDefault();
+        if (mediaUploader) {
+            mediaUploader.open();
+            return;
+        }
+        mediaUploader = wp.media.frames.file_frame = wp.media({
+            title: 'Choose Image',
+            button: {
+                text: 'Choose Image'
+            },
+            multiple: false
+        });
+        mediaUploader.on('select', function() {
+            var attachment = mediaUploader.state().get('selection').first().toJSON();
+            console.log("LLLL",attachment);
+           $('#background_image').attr("src",attachment.url);
+        });
+        mediaUploader.open();
+    });
+
+    /*
+	$('#upload_image_button').click(function() {
+	console.log("UPLLOADDD");
+        formfield = $('#link_image').attr('name'); 
+        tb_show('', 'media-upload.php?type=image&amp;TB_iframe=true');
+        return false;
+    });
+    window.send_to_editor = function(html) {
+        imgurl = $('img',html).attr('src');
+        imgsrc = '<img src="'+imgurl+'">';
+        $('#link_image').val(imgurl); // this populates a text field with the image url
+        //$('#my-link-img').html(imgsrc); // this prints the image into a div
+        tb_remove();
+    }
+*/
+
 
 
 
 
-$('.custom_media').each(function(){
-	var self = $(this);
-	$('.custom_media_upload',self).click(function() {
-		var send_attachment_bkp = wp.media.editor.send.attachment;
-		wp.media.editor.send.attachment = function(props, attachment) {
-			$('.custom_media_image',self).attr('src', attachment.url);
-			var path = "/"+attachment.url.split("/").splice(3).join("/");
-			$('.custom_media_url',self).val(path);
-			$('.custom_media_id',self).val(attachment.id);
-			wp.media.editor.send.attachment = send_attachment_bkp;
-		}
-		wp.media.editor.open();
-		return false;       
-	});
+    $('.custom_media').each(function() {
+        var self = $(this);
+        $('.custom_media_upload', self).click(function() {
+            var send_attachment_bkp = wp.media.editor.send.attachment;
+            wp.media.editor.send.attachment = function(props, attachment) {
+                $('.custom_media_image', self).attr('src', attachment.url);
+                var path = "/" + attachment.url.split("/").splice(3).join("/");
+                $('.custom_media_url', self).val(path);
+                $('.custom_media_id', self).val(attachment.id);
+                wp.media.editor.send.attachment = send_attachment_bkp;
+            }
+            wp.media.editor.open();
+            return false;
+        });
 
 
-});
+    });
 
 
 
 
- });
 
 
 
+});

+ 69 - 30
logos.svg → source.svg

@@ -9,12 +9,12 @@
    xmlns="http://www.w3.org/2000/svg"
    xmlns:sodipodi="http://sodipodi.sourceforge.net/DTD/sodipodi-0.dtd"
    xmlns:inkscape="http://www.inkscape.org/namespaces/inkscape"
-   width="744.09448819"
-   height="1052.3622047"
+   width="1024"
+   height="768"
    id="svg3735"
    version="1.1"
    inkscape:version="0.91 r13725"
-   sodipodi:docname="logos.svg">
+   sodipodi:docname="source.svg">
   <defs
      id="defs3737">
     <clipPath
@@ -23,8 +23,8 @@
       <path
          inkscape:connector-curvature="0"
          d="m 116.88,841.8 361.56,0 0,-841.8 -361.56,0 0,841.8 z"
-         clip-rule="evenodd"
-         id="path32-4-0" />
+         id="path32-4-0"
+         style="clip-rule:evenodd" />
     </clipPath>
     <clipPath
        clipPathUnits="userSpaceOnUse"
@@ -32,8 +32,8 @@
       <path
          inkscape:connector-curvature="0"
          d="m 116.88,841.8 361.56,0 0,-841.8 -361.56,0 0,841.8 z"
-         clip-rule="evenodd"
-         id="path42-2-4" />
+         id="path42-2-4"
+         style="clip-rule:evenodd" />
     </clipPath>
     <clipPath
        clipPathUnits="userSpaceOnUse"
@@ -41,8 +41,8 @@
       <path
          inkscape:connector-curvature="0"
          d="m 116.88,841.8 361.56,0 0,-841.8 -361.56,0 0,841.8 z"
-         clip-rule="evenodd"
-         id="path52-4-90" />
+         id="path52-4-90"
+         style="clip-rule:evenodd" />
     </clipPath>
     <clipPath
        clipPathUnits="userSpaceOnUse"
@@ -50,8 +50,8 @@
       <path
          inkscape:connector-curvature="0"
          d="m 116.88,841.8 361.56,0 0,-841.8 -361.56,0 0,841.8 z"
-         clip-rule="evenodd"
-         id="path62-3-8" />
+         id="path62-3-8"
+         style="clip-rule:evenodd" />
     </clipPath>
     <clipPath
        clipPathUnits="userSpaceOnUse"
@@ -59,12 +59,12 @@
       <path
          inkscape:connector-curvature="0"
          d="m 116.88,841.8 361.56,0 0,-841.8 -361.56,0 0,841.8 z"
-         clip-rule="evenodd"
-         id="path72-6-4" />
+         id="path72-6-4"
+         style="clip-rule:evenodd" />
     </clipPath>
     <filter
        id="filter3024"
-       style="color-interpolation-filters:sRGB;"
+       style="color-interpolation-filters:sRGB"
        inkscape:label="Drop Shadow">
       <feFlood
          id="feFlood3026"
@@ -79,7 +79,6 @@
          result="composite1" />
       <feGaussianBlur
          id="feGaussianBlur3030"
-         in="composite"
          stdDeviation="1.7"
          result="blur" />
       <feOffset
@@ -96,7 +95,7 @@
     </filter>
     <filter
        id="filter3036"
-       style="color-interpolation-filters:sRGB;"
+       style="color-interpolation-filters:sRGB"
        inkscape:label="Drop Shadow">
       <feFlood
          id="feFlood3038"
@@ -111,7 +110,6 @@
          result="composite1" />
       <feGaussianBlur
          id="feGaussianBlur3042"
-         in="composite"
          stdDeviation="1.7"
          result="blur" />
       <feOffset
@@ -134,15 +132,15 @@
      borderopacity="1.0"
      inkscape:pageopacity="0.0"
      inkscape:pageshadow="2"
-     inkscape:zoom="1.4"
-     inkscape:cx="171.6831"
-     inkscape:cy="746.81633"
+     inkscape:zoom="4"
+     inkscape:cx="162.14556"
+     inkscape:cy="510.75182"
      inkscape:document-units="px"
      inkscape:current-layer="layer1"
      showgrid="false"
      inkscape:window-width="1873"
      inkscape:window-height="1056"
-     inkscape:window-x="1327"
+     inkscape:window-x="47"
      inkscape:window-y="24"
      inkscape:window-maximized="1" />
   <metadata
@@ -153,20 +151,61 @@
         <dc:format>image/svg+xml</dc:format>
         <dc:type
            rdf:resource="http://purl.org/dc/dcmitype/StillImage" />
-        <dc:title />
+        <dc:title></dc:title>
       </cc:Work>
     </rdf:RDF>
   </metadata>
   <g
      inkscape:label="Layer 1"
      inkscape:groupmode="layer"
-     id="layer1">
-    <rect
-       style="opacity:1;fill:#000000;fill-opacity:1;stroke:none;stroke-width:1;stroke-linecap:round;stroke-linejoin:miter;stroke-miterlimit:4;stroke-dasharray:none;stroke-dashoffset:0;stroke-opacity:1"
-       id="rect8119"
-       width="47.857143"
-       height="45.714287"
-       x="43.57143"
-       y="52.362179" />
+     id="layer1"
+     transform="translate(0,-284.36218)">
+    <g
+       id="logo.png"
+       transform="translate(-35,12)"
+       inkscape:label="#logo_a">
+      <rect
+         y="462.71927"
+         x="79.571404"
+         height="37"
+         width="37"
+         id="rect8119"
+         style="opacity:1;fill:#f9f9f9;fill-opacity:1;stroke:none;stroke-width:1;stroke-linecap:round;stroke-linejoin:miter;stroke-miterlimit:4;stroke-dasharray:none;stroke-dashoffset:0;stroke-opacity:1" />
+      <circle
+         cy="481.21927"
+         cx="98.071404"
+         id="path8088"
+         style="opacity:1;fill:#000000;fill-opacity:1;stroke:none;stroke-width:1;stroke-linecap:round;stroke-linejoin:miter;stroke-miterlimit:4;stroke-dasharray:none;stroke-dashoffset:0;stroke-opacity:1"
+         r="11.5" />
+    </g>
+    <g
+       id="login_logo.png"
+       inkscape:label="#g8117">
+      <rect
+         y="637.36218"
+         x="70"
+         height="65"
+         width="320"
+         id="rect8105"
+         style="opacity:1;fill:#808080;fill-opacity:1;stroke:none;stroke-width:1;stroke-linecap:round;stroke-linejoin:miter;stroke-miterlimit:4;stroke-dasharray:none;stroke-dashoffset:0;stroke-opacity:1" />
+      <g
+         inkscape:label=""
+         transform="translate(-9.5714035,202.64291)"
+         id="g1">
+        <rect
+           style="opacity:1;fill:#f9f9f9;fill-opacity:1;stroke:none;stroke-width:1;stroke-linecap:round;stroke-linejoin:miter;stroke-miterlimit:4;stroke-dasharray:none;stroke-dashoffset:0;stroke-opacity:1"
+           id="rect8119-6"
+           width="42"
+           height="42"
+           x="79.571404"
+           y="457.71927" />
+        <circle
+           style="opacity:1;fill:#000000;fill-opacity:1;stroke:none;stroke-width:1;stroke-linecap:round;stroke-linejoin:miter;stroke-miterlimit:4;stroke-dasharray:none;stroke-dashoffset:0;stroke-opacity:1"
+           id="path8088-7"
+           cx="98.071404"
+           cy="481.21927"
+           r="18.5" />
+      </g>
+    </g>
   </g>
 </svg>