Mysidia Adoptables Support Forum  

Home Community Mys-Script Creative Off-Topic
Go Back   Mysidia Adoptables Support Forum > Mysidia Adoptables > Addons and Modifications > Mys v1.3.x Mods

Notices

Reply
 
Thread Tools Display Modes
  #1  
Old 01-28-2014, 01:31 PM
anno1986 anno1986 is offline
Member
 
Join Date: Jan 2014
Posts: 3
Gender: Male
Credits: 658
anno1986 is on a distinguished road
Smile Paging in admin panel für images

The following patch provides paging for the image menu in admin panel.
Useful for slow connections and/or many pictures stored in filemap database table

diff -ruw v1.3.4/admincp/image.php src/admincp/image.php
Code:
--- v1.3.4/admincp/image.php	2013-08-24 23:29:48.000000000 +0200
+++ src/admincp/image.php	2014-01-26 18:18:36.000000000 +0100
@@ -103,11 +103,20 @@
 
 	public function manage(){
 	    $mysidia = Registry::get("mysidia");
-		$stmt = $mysidia->db->select("filesmap", array("id", "wwwpath"));
+	    // anno1986 added paging for images
+	    $total = $mysidia->db->select("filesmap", array("id"))->rowCount();
+	    $pagination = new Pagination($total, 9, "admincp/image/delete");
+        $pagination->setPage($mysidia->input->get("page"));
+        // anno1986 added paging for images
+		$stmt = $mysidia->db->select("filesmap", array("id", "wwwpath"), "1 LIMIT {$pagination->getLimit()},{$pagination->getRowsperPage()}");
 		$filesMap = new LinkedHashMap;
 		while($file = $stmt->fetchObject()){
-		    $filesMap->put(new Integer($file->id), new Image($file->wwwpath));
+		    $img = new Image($file->wwwpath);
+            //$img->resample(100,null);
+		    $filesMap->put(new Integer($file->id), $img);
 		}
+        // anno1986 added paging for images
+        $this->setField("pagination", $pagination);
 		$this->setField("filesMap", $filesMap);
 	}

diff -ruw v1.3.4/admincp/view/imageview.php src/admincp/view/imageview.php
Code:
--- v1.3.4/admincp/view/imageview.php	2013-04-26 21:04:22.000000000 +0200
+++ src/admincp/view/imageview.php	2014-01-26 18:15:00.000000000 +0100
@@ -36,7 +36,12 @@
 		$document->setTitle($this->lang->manage_title);
 		$document->addLangvar($this->lang->manage);
 		
+        $pagination = $this->getField("pagination");
+		
 		$imageForm = new Form("manageform", "delete", "post");		
+        // anno1986 added paging to image view
+        $imageForm->add(new Comment($pagination->showPage()));
+        
 		$filesMap = $this->getField("filesMap");
 		$iterator = $filesMap->iterator();
         while ($iterator->hasNext()){
@@ -46,10 +51,17 @@
 			$fileImage->setLineBreak(TRUE);
 			
 		    $action = new RadioButton("Delete this Image", "iid", $fileID->getValue());
-			$action->setLineBreak(TRUE);
+			//$action->setLineBreak(TRUE);
+			$imageForm->add(new Comment("<div style='display:inline-block;width:270px;margin-top:20px;'>",FALSE));
 			$imageForm->add($fileImage);
 			$imageForm->add($action);
+            
+            $imageForm->add(new Comment("</div>", FALSE));
+            
 		}
+        // anno1986 added paging to image view
+        $imageForm->add(new Comment($pagination->showPage()));
+        
         $imageForm->add(new Button("Submit", "submit", "submit"));
 		$document->add($imageForm);
 	}
Reply With Quote
  #2  
Old 11-09-2014, 12:36 PM
AndromedaKerova's Avatar
AndromedaKerova AndromedaKerova is offline
ChibiFur Queen
 
Join Date: Nov 2014
Location: England
Posts: 83
Gender: Female
Credits: 3,685
AndromedaKerova is on a distinguished road
Default

This doesn't really explain how to add the fix. It might be ok for coders but some of us are beginners or even non coders.
__________________
Failing at being normal since 1990.
Reply With Quote
  #3  
Old 05-05-2015, 12:26 PM
kristhasirah's Avatar
kristhasirah kristhasirah is offline
Member
 
Join Date: Jan 2010
Location: In middle of the nothingness
Posts: 196
Gender: Female
Credits: 28,036
kristhasirah
Default

after trying and testing I manage to make the code work, because copy and paste just gives a blank page, and so i will post the code thats working for me for those that don't have idea what to do... like me XD



in admincp/image.php find:
PHP Code:
    public function manage(){
        
$mysidia Registry::get("mysidia");
        
$stmt $mysidia->db->select("filesmap", array("id""wwwpath"));
        
$filesMap = new LinkedHashMap;
        while(
$file $stmt->fetchObject()){
            
$filesMap->put(new Integer($file->id), new Image($file->wwwpath));
        }
        
$this->setField("filesMap"$filesMap);
    } 
and replace with:
PHP Code:
      public function manage(){
         
$mysidia Registry::get("mysidia");
        
$stmt $mysidia->db->select("filesmap", array("id""wwwpath"));
        
$total $mysidia->db->select("filesmap", array("id"))->rowCount();
        
$pagination = new Pagination($total20"admincp/image/delete");
        
$pagination->setPage($mysidia->input->get("page"));    
        
$stmt $mysidia->db->select("filesmap", array("id""wwwpath"), "1 LIMIT {$pagination->getLimit()},{$pagination->getRowsperPage()}");        
         
$filesMap = new LinkedHashMap;
                 while(
$file $stmt->fetchObject()){
            
$filesMap->put(new Integer($file->id), new Image($file->wwwpath));

        }
        
$this->setField("pagination"$pagination);
         
$this->setField("filesMap"$filesMap);
     } 
in admincp/view/imageview.php find:
PHP Code:
    public function manage(){
        
$mysidia Registry::get("mysidia");
        
$document $this->document;    
        
$document->setTitle($this->lang->manage_title);
        
$document->addLangvar($this->lang->manage);
        
        
$imageForm = new Form("manageform""delete""post");        
        
$filesMap $this->getField("filesMap");
        
$iterator $filesMap->iterator();
        while (
$iterator->hasNext()){
            
$file $iterator->next();
            
$fileID $file->getKey();
            
$fileImage $file->getValue();            
            
$fileImage->setLineBreak(TRUE);
            
            
$action = new RadioButton("Delete this Image""iid"$fileID->getValue());
            
$action->setLineBreak(TRUE);
            
$imageForm->add($fileImage);
            
$imageForm->add($action);
        }
        
$imageForm->add(new Button("Submit""submit""submit"));
        
$document->add($imageForm);
    } 
and replace with this:
PHP Code:
    public function manage(){
        
$mysidia Registry::get("mysidia");
        
$document $this->document;    
        
$document->setTitle($this->lang->manage_title);
        
$document->addLangvar($this->lang->manage);
        
$pagination $this->getField("pagination");

        
$imageForm = new Form("manageform""delete""post");
        
$imageForm->add(new Comment($pagination->showPage()));
        
$filesMap $this->getField("filesMap");
        
$iterator $filesMap->iterator();
        while (
$iterator->hasNext()){
            
$file $iterator->next();
            
$fileID $file->getKey();
            
$fileImage $file->getValue();            
            
$fileImage->setLineBreak(TRUE);
            
            
$action = new RadioButton("Delete this Image""iid"$fileID->getValue());
            
$action->setLineBreak(TRUE);
                        
$imageForm->add(new Comment("<div style='display:inline-block;width:100px;margin-top:20px;'>",FALSE));
             
$imageForm->add($fileImage);
             
$imageForm->add($action);
            
$imageForm->add(new Comment("</div>"FALSE));
            
         }
        
$imageForm->add(new Comment($pagination->showPage()));
        
         
$imageForm->add(new Button("Submit""submit""submit"));
         
$document->add($imageForm);
     } 
those are the codes that are working for me, hope it works for everyone else =)
and thanks anno1986 for posting the code ^^ because if i tried to do it myself i probably wont be able to do it.

also replace the "20" with the number of images you want to see in each page and replace "100" with the max width of your adoptbles.
__________________
Reply With Quote
Reply

Tags
admin, image, imageview, paging

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
Help with Admin Panel please WCadopts Questions and Supports 1 08-17-2015 01:05 AM
Admin Panel Question parayna Questions and Supports 5 05-26-2013 08:18 PM
Newly installed site and problem with Admin Control Panel 5404 Questions and Supports 5 01-23-2013 02:26 PM
Admin CP? booksbooks098 Questions and Supports 2 12-06-2012 04:37 PM
Can't get into the Admin Panel? densaugeo Questions and Supports 16 03-28-2009 06:08 PM


All times are GMT -5. The time now is 04:58 AM.

Currently Active Users: 449 (0 members and 449 guests)
Threads: 4,080, Posts: 32,024, Members: 2,016
Welcome to our newest members, jolob.
BETA





What's New?

What's Hot?

What's Popular?


Powered by vBulletin® Version 3.8.11
Copyright ©2000 - 2024, vBulletin Solutions Inc.
vBCommerce I v2.0.0 Gold ©2010, PixelFX Studios
vBCredits I v2.0.0 Gold ©2010, PixelFX Studios
Emoticons by darkmoon3636