瀏覽代碼

fixed proces editor

Piotr Labudda 8 年之前
父節點
當前提交
6af73b63e1
共有 2 個文件被更改,包括 16 次插入15 次删除
  1. 13 13
      SE/se-lib/Route/UrlAction/ProcesEditor.php
  2. 3 2
      SE/static/procesEditor.js

+ 13 - 13
SE/se-lib/Route/UrlAction/ProcesEditor.php

@@ -109,26 +109,26 @@ class Route_UrlAction_ProcesEditor extends RouteBase {// TODO: UrlActionBase @se
 		$vidExtList = array("video/mp4");
 
 
-		$info;
+		$info = new stdClass();
 
 		$statement = DB::getPDO()->prepare("INSERT INTO CRM_IMAGE(NAME, TYPE, REMOTE_TABLE, REMOTE_ID, IMAGE, SIZE)
 				VALUES(:NAME, :TYPE, :REMOTE_TABLE, :REMOTE_ID, :IMAGE, :SIZE)");
 
 		if(in_array($type, $imgExtList)){
-			$content = 'data:'.$type.';base64,'.base64_encode(file_get_contents($url));//
-
-
-			$statement->execute(array(
-				":NAME" => $name,
-				":TYPE"  => $type,
-				":REMOTE_TABLE"  => "ADMIN_USERS",
-				":REMOTE_ID"  => User::getID(),
-				":IMAGE"  => $content,
-				":SIZE"  => $size
-			));
+			// $content = 'data:'.$type.';base64,'.base64_encode(file_get_contents($url));//
+			$content = file_get_contents($url);
+			$statement->bindParam(':NAME', $name, PDO::PARAM_STR);
+			$statement->bindParam(':TYPE', $type, PDO::PARAM_STR);
+			$imageType = "ADMIN_USERS";
+			$statement->bindParam(':REMOTE_TABLE', $imageType, PDO::PARAM_STR);
+			$idUser = User::getID();
+			$statement->bindParam(':REMOTE_ID', $idUser, PDO::PARAM_INT);
+			$statement->bindParam(':IMAGE', $content, PDO::PARAM_LOB);
+			$statement->bindParam(':SIZE', $size, PDO::PARAM_INT);
+			$statement->execute();
 
 			$info->statusCode = 0;
-			$info->statusText = "Plik załadowany pomyślnie" ;
+			$info->statusText = "Plik załadowany pomyślnie";
 		}else if(false && in_array($type, $vidExtList)){ //Only image files
 
 

+ 3 - 2
SE/static/procesEditor.js

@@ -339,7 +339,7 @@ $(document).ready(function() {
             if (remote_table == e["REMOTE_TABLE"] && remote_id == e["REMOTE_ID"]) {
                 var temp = {
                     ID: e.ID,
-                    src: base64_decode(e.IMAGE),
+                    src: e.IMAGE,
                     title: e.NAME
                 }
                 elementObj.push(temp);
@@ -2130,6 +2130,7 @@ $(document).ready(function() {
         $("#clipboard").empty();
         //var link = BASE_URL + 'wfs-data.php/default_db/?SERVICE=WFS&VERSION=1.0.0&REQUEST=GetFeature&TYPENAME=p5_default_db:CRM_IMAGE&SRSNAME=EPSG:3003&Filter=<ogc:Filter></ogc:Filter>';
         p5WFS_GetFeature('p5_default_db:CRM_IMAGE', {
+			// TODO: propertyName - tylko ID i TYPE, a obrazek wyświtlać jako src: wfs-data.php?SERVICE=WFS&VERSION=1.0.0&REQUEST=GetBlob&namespace=default_db/CRM_IMAGE&primaryKey={ID}&fieldName=IMAGE
             'Filter': '<ogc:And><ogc:PropertyIsEqualTo><ogc:PropertyName>REMOTE_ID</ogc:PropertyName><ogc:Literal>' + USER_ID + '</ogc:Literal></ogc:PropertyIsEqualTo><ogc:PropertyIsEqualTo><ogc:PropertyName>REMOTE_TABLE</ogc:PropertyName><ogc:Literal>ADMIN_USERS</ogc:Literal></ogc:PropertyIsEqualTo></ogc:And>',
             //'sortBy': 'SORT_PRIO+A,ID',
             //'maxFeatures': 100,
@@ -2141,7 +2142,7 @@ $(document).ready(function() {
                 if (typeof usedImg[xml["ID"]] == "undefined") {
                     var opts = {};
                     opts["ID"] = xml["ID"];
-                    opts["IMAGE"] = base64_decode(xml["IMAGE"]);
+                    opts["IMAGE"] = xml["IMAGE"];
                     opts["NAME"] = xml["NAME"];
                     list += showMediaElement(opts, "_IMG", {
                         classes: "noRemove"