[PC-BSD Commits] r2647 - in websites/pbidir.com/bibivu: bin etc/lang/de etc/lang/fr lib slib tpl/pbidir tpl/pbidir/admin

svn at pcbsd.org svn at pcbsd.org
Fri Aug 22 21:21:18 PDT 2008


Author: fabry
Date: 2008-08-22 21:07:22 -0700 (Fri, 22 Aug 2008)
New Revision: 2647

Added:
   websites/pbidir.com/bibivu/lib/category_translation.php
   websites/pbidir.com/bibivu/lib/pbi_translation.php
Modified:
   websites/pbidir.com/bibivu/bin/admin.php
   websites/pbidir.com/bibivu/bin/start.php
   websites/pbidir.com/bibivu/etc/lang/de/home.lang.php
   websites/pbidir.com/bibivu/etc/lang/fr/home.lang.php
   websites/pbidir.com/bibivu/lib/category.php
   websites/pbidir.com/bibivu/lib/pbi.php
   websites/pbidir.com/bibivu/lib/user.php
   websites/pbidir.com/bibivu/slib/lang.php
   websites/pbidir.com/bibivu/tpl/pbidir/admin/list.php
   websites/pbidir.com/bibivu/tpl/pbidir/home.php
   websites/pbidir.com/bibivu/tpl/pbidir/pbi.php
Log:
ability to translate PBI and Categories directly on the web.

Modified: websites/pbidir.com/bibivu/bin/admin.php
===================================================================
--- websites/pbidir.com/bibivu/bin/admin.php	2008-08-22 18:19:01 UTC (rev 2646)
+++ websites/pbidir.com/bibivu/bin/admin.php	2008-08-23 04:07:22 UTC (rev 2647)
@@ -248,10 +248,14 @@
 			$group = array();
 			$limit = '';
 			$array_add_uri = array('add'=>'', 'ajax'=>'');
-			if((isset($_POST) && is_array($_POST) && !empty($_POST)) || $this->uri->get('order','')!=''){
+			if(
+				(isset($_POST) && is_array($_POST) && !empty($_POST)) ||
+				$this->uri->get('order','')!='' ||
+				(isset($_GET) && is_array($_GET) && !empty($_GET))){
 				$fields = $this->$what->get_fields();
 				$str = '^('.implode('|', array_keys($fields)).')( (ASC|DESC))?$';
-				foreach($_POST as $key=>$value){
+				$tmps = array_merge(is_array($_GET)?$_GET:array(), is_array($_POST)?$_POST:array());
+				foreach($tmps as $key=>$value){
 					if(eregi($str,$key)){
 						$where[] = array('field'=>$key, 'operator'=>'=', 'value'=>$value);
 						$array_add_uri[$key] = $value;
@@ -346,6 +350,7 @@
 	}
 	public function web_mirror(){					$this->_manage('mirror');					}
 	public function web_category(){					$this->_manage('category');					}
+	public function web_category_translation(){		$this->_manage('category_translation');		}
 	public function web_pcbsd_version(){			$this->_manage('pcbsd_version');			}
 	public function web_permission_item(){			$this->_manage('permission_item');			}
 	public function web_group(){					$this->_manage('group');					}
@@ -376,6 +381,14 @@
 					   ); 
 		$this->_manage('pbi_image',$owner);
 	}
+	public function web_pbi_translation(){
+		$owner = array('from_field'=>'pbi_id',
+					   'table'=>'pbi',
+					   'field'=>'user_id',
+					   'field_id'=>'id',
+					   ); 
+		$this->_manage('pbi_translation',$owner);
+	}
 	public function web_pbi_status(){
 		$owner = array('from_field'=>'pbi_id',
 					   'table'=>'pbi',

Modified: websites/pbidir.com/bibivu/bin/start.php
===================================================================
--- websites/pbidir.com/bibivu/bin/start.php	2008-08-22 18:19:01 UTC (rev 2646)
+++ websites/pbidir.com/bibivu/bin/start.php	2008-08-23 04:07:22 UTC (rev 2647)
@@ -113,7 +113,7 @@
 		$group = array();
 		$order = array('name');
 		$limit = '';
-		$this->display->assign('categories', $this->table_prototype->get_raw($filters, $order, $group, $limit,'category'));
+		$this->display->assign('categories', load_library('category')->get_all($filters, $order, $group, $limit,'category'));
 
 		$filters = array();
 		$filters[] = array('field'=>'active', 'operator'=>'=', 'value'=>'y');
@@ -141,6 +141,9 @@
 		$limit = 20;
 		$this->display->assign('most_download', $this->pbi->get_raw($filters, $order, $group, $limit));
 
+		$this->display->assign('can_write',$this->permissions->can('category', 'write'));
+		$this->display->assign('can_translate',$this->permissions->can('category_translation', 'write'));
+
 		$this->display->assign('title', 'Your PC-BSD software');
 		$this->display('home');
 	}
@@ -159,7 +162,7 @@
 	public function web_category(){
 		$filters = array();
 		$filters[] = array('field'=>'web_alias', 'operator'=>'=', 'value'=>$this->uri->get_num(3));
-		$category = $this->table_prototype->get_record($filters,'category')->get_info();
+		$category = load_library('category')->get_record($filters)->get_info();
 		if(!isset($category['id']) || $category['web_alias']!=$this->uri->get_num(3)){
 			//package doesn't exists
 			$this->display->assign('message', 'Category not found!');
@@ -336,6 +339,7 @@
 			} else {
 				$this->display->assign('can_comment_delete',false);
 			}
+			$this->display->assign('can_translate',$this->permissions->can('pbi_translation', 'write'));
 
 			$owner = array('id'=>$pbi['id'],
 						   'table'=>'pbi',

Modified: websites/pbidir.com/bibivu/etc/lang/de/home.lang.php
===================================================================
--- websites/pbidir.com/bibivu/etc/lang/de/home.lang.php	2008-08-22 18:19:01 UTC (rev 2646)
+++ websites/pbidir.com/bibivu/etc/lang/de/home.lang.php	2008-08-23 04:07:22 UTC (rev 2647)
@@ -1,7 +1,7 @@
 <?php
 //home page strings
 $lang['pbi_directory']		= 'pbi Verzeichnis';
-$lang['welcome']			= 'Willkommen im pbi Verzeichnis! Hier k&ouml;nnen Sie unsere Software-archive Durchsuchen, um Software f&uuml;r Ihr <a href="http://www.pcbsd.org/">PC-BSD Betriebsystem</a> zu finden. Eine der besten Eigenschaften des PBI-Systems ist, dass Sie Software mit einem Klick installieren k&ouml;nnen ohne auf irgendwelche Abh&auml;ngigkeiten achten zu m&ouml;ssen. Auf der offiziellen Webseite von <a href="http://www.pcbsd.org/">PC-BSD</a> k&ouml;nnen Sie mehr &uuml;ber die <a href="http://www.pcbsd.org/content/view/20/26/">PBI-Technologie</a> erfahren. Das PBI Verzeichnis hat in keinster Weise etwas mit der PC-BSD Software LLC zu tun.';
+$lang['welcome']			= 'Willkommen im PBI-Verzeichnis! Hier k&ouml;nnen Sie unsere Software-Archive durchsuchen, um Software f&uuml;r Ihr <a href="http://www.pcbsd.org/">Betriebsystem PC-BSD</a> zu finden. Eine der besten Eigenschaften des PBI-Systems ist, dass Sie Software mit einem Klick installieren k&ouml;nnen ohne auf irgendwelche Abh&auml;ngigkeiten achten zu m&ouml;ssen. Auf der offiziellen Webseite von <a href="http://www.pcbsd.org/">PC-BSD</a> k&ouml;nnen Sie mehr &uuml;ber die <a href="http://www.pcbsd.org/content/view/20/26/">PBI-Technologie</a> erfahren. Das PBI Verzeichnis hat in keinster Weise etwas mit der PC-BSD Software LLC zu tun.';
 $lang['latest_releases']	= 'Neuste Versionen';
 $lang['latest_software']	= 'Neuste Software';
 $lang['most_downloaded_software']	= 'H&auml;ufigste Downloads';

Modified: websites/pbidir.com/bibivu/etc/lang/fr/home.lang.php
===================================================================
--- websites/pbidir.com/bibivu/etc/lang/fr/home.lang.php	2008-08-22 18:19:01 UTC (rev 2646)
+++ websites/pbidir.com/bibivu/etc/lang/fr/home.lang.php	2008-08-23 04:07:22 UTC (rev 2647)
@@ -1,7 +1,7 @@
 <?php
 //home page strings
 $lang['pbi_directory']		= 'R&eacute;pertoire pbi';
-$lang['welcome']			= 'Bienvenue dans le r&eacute;pertoire pbi! Parcourez notre site pour t&eacute;l&eacute;charger librement des logiciels pour votre <a href="http://www.pcbsd.org/">Syst&egrave;me d\'exploitation PC-BSD </a>. Parmi les avantages du syst&egrave;me de pbi: une utilisation simple. Tous vos logiciels s\'installent en quelques clics et surtout, plus de probl&egrave;mes de d&eacute;pendances, le syst&egrave;me de pbi les g&egrave;re tout seul. Plus d\'informations sur <a href="http://www.pcbsd.org/content/view/20/26/">la technologie pbi</a> sur le <a href="http://www.pcbsd.org/">site web officiel PC-BSD</a>. Le r&eacute;pertoire pbi n\'est en aucune façon associ&eacute; avec  PC-BSD Software LLC.';
+$lang['welcome']			= 'Bienvenue dans le r&eacute;pertoire pbi! Parcourez notre site pour t&eacute;l&eacute;charger librement des logiciels pour votre <a href="http://www.pcbsd.fr/">Syst&egrave;me d\'exploitation PC-BSD </a>. Parmi les avantages du syst&egrave;me de pbi: une utilisation simple. Tous vos logiciels s\'installent en quelques clics et surtout, plus de probl&egrave;mes de d&eacute;pendances, le syst&egrave;me de pbi les g&egrave;re tout seul. Plus d\'informations sur <a href="http://www.pcbsd.fr/content/view/20/26/">la technologie pbi</a> sur le <a href="http://www.pcbsd.fr/">site web officiel PC-BSD</a>. Le r&eacute;pertoire pbi n\'est en aucune façon associ&eacute; avec  PC-BSD Software LLC.';
 $lang['latest_releases']	= 'Derni&egrave;res versions';
 $lang['latest_software']	= 'Derniers logiciels';
 $lang['most_downloaded_software']	= 'Logiciels les plus t&eacute;l&eacute;charg&eacute;s';

Modified: websites/pbidir.com/bibivu/lib/category.php
===================================================================
--- websites/pbidir.com/bibivu/lib/category.php	2008-08-22 18:19:01 UTC (rev 2646)
+++ websites/pbidir.com/bibivu/lib/category.php	2008-08-23 04:07:22 UTC (rev 2647)
@@ -1,130 +1,156 @@
-<?php  if (!defined('BASEPATH')) exit('No direct script access allowed');
-// ------------------------------------------------------------------------
-class category extends table_prototype{
-	public function __construct(){
-		parent::__construct();
-		$this->set_table_name('category');		
-	}
-
-	public function get_related_tables(){
-		//this is the table that relate all the tables with each other
-		
-		if($this->related==array()){
-			$related = array();
-			$related[] = array(		'table'			=> 'pbi',
-									'field'			=> 'category_id',
-									'main_field'	=> 'id',
-									'show'			=> 'list',		//field, list
-									'name'			=> 'PBIs',
-									'relation_table'=> array(),
-							  );
-			$this->related = $related;
-		}		
-		return $this->related;
-	}
-
-	public function get_fields(){
-		if($this->fields==array()){
-			$fields['id'] = array(		'show'	=> false,
-										'view_link'	=> false,
-										'edit'	=> false,
-										'type'	=> 'number',
-										'length'=> NULL,
-										'values'=> NULL,
-										'text'	=> 'id',
-										'required' => NULL,
-										'post'	=> true,
-										'default' => NULL,
-										'image'	=> false,
-								);
-			$fields['name'] = array(	'show'	=> true,
-										'view_link'=>true,
-										'edit'	=> true,
-										'type'	=> 'string',
-										'length'=> 100,
-										'values'=> NULL,
-										'text'	=> 'Name',
-										'required' => true,
-										'post'	=> true,
-										'default' => NULL,
-										'image'	=> false,
-								);
-			$fields['description'] = array(		'show'	=> true,
-										'view_link'	=> false,
-										'edit'	=> true,
-										'type'	=> 'string',
-										'length'=> 255,
-										'values'=> NULL,
-										'text'	=> 'Description',
-										'required' => true,
-										'post'	=> true,
-										'default' => NULL,
-										'image'	=> false,
-								);
-			$fields['web_alias'] = array(		'show'	=> array('view','field'),
-										'view_link'	=> false,
-										'edit'	=> true,
-										'type'	=> 'string',
-										'length'=> 15,
-										'values'=> NULL,
-										'text'	=> 'Web Alias',
-										'required' => false,
-										'post'	=> true,
-										'default' => NULL,
-										'image'	=> false,
-								);
-			$fields['show_on_site'] = array(	'show'	=> array('view','field'),
-										'view_link'	=> false,
-										'edit'	=> true,
-										'type'	=> 'enum',
-										'length'=> NULL,
-										'values'=> 'y,Yes|n,No',
-										'text'	=> 'Show',
-										'required' => NULL,
-										'post'	=> true,
-										'default' => 'y',
-										'image'	=> false,
-								);
-			$fields['active'] = array(	'show'	=> true,
-										'view_link'	=> false,
-										'edit'	=> true,
-										'type'	=> 'enum',
-										'length'=> NULL,
-										'values'=> 'y,Yes|n,No',
-										'text'	=> 'Active',
-										'required' => NULL,
-										'post'	=> true,
-										'default' => 'y',
-										'image'	=> false,
-								);
-			$fields['icon'] = array(		'show'	=> true,
-										'view_link'	=> false,
-										'edit'	=> true,
-										'type'	=> 'file',
-										'length'=> 255,
-										'values'=> NULL,
-										'text'	=> 'Icon',
-										'required' => false,
-										'post'	=> true,
-										'default' => NULL,
-										'image'	=> true,
-										'image_width' => 40,
-										'image_heigth' => NULL,
-								);
-			$this->fields = $fields;
-		}
-		return $this->fields;
-	}
-
-	public function get_all($where=array(), $orders=array(), $group=array(), $limit='', $from='', $join = array(), $xtrfields = array()){
-		$fields = $this->get_fields();
-		$str = '^('.implode('|', array_keys($fields)).').?(ASC|DESC)?$';
-		foreach($orders as $key=>$order){
-			if(!eregi($str,$order)){
-				$orders[$key] = 'name';
-			}
-		}
-		return parent::get_all($where, $orders, $group, $limit, $from, $join, $xtrfields);
-	}
-}
+<?php  if (!defined('BASEPATH')) exit('No direct script access allowed');
+// ------------------------------------------------------------------------
+class category extends table_prototype{
+	public function __construct(){
+		parent::__construct();
+		$this->set_table_name('category');		
+	}
+
+	public function get_related_tables(){
+		//this is the table that relate all the tables with each other
+		
+		if($this->related==array()){
+			$related = array();
+			$related[] = array(		'table'			=> 'category_translation',
+									'field'			=> 'category_id',
+									'main_field'	=> 'id',
+									'show'			=> 'list',		//field, list
+									'name'			=> 'Translations',
+									'autoopen'		=> false,
+									'relation_table'=> array(),
+							  );
+
+			$related[] = array(		'table'			=> 'pbi',
+									'field'			=> 'category_id',
+									'main_field'	=> 'id',
+									'show'			=> 'list',		//field, list
+									'name'			=> 'PBIs',
+									'relation_table'=> array(),
+							  );
+			$this->related = $related;
+		}		
+		return $this->related;
+	}
+
+	public function get_fields(){
+		if($this->fields==array()){
+			$fields['id'] = array(		'show'	=> false,
+										'view_link'	=> false,
+										'edit'	=> false,
+										'type'	=> 'number',
+										'length'=> NULL,
+										'values'=> NULL,
+										'text'	=> 'id',
+										'required' => NULL,
+										'post'	=> true,
+										'default' => NULL,
+										'image'	=> false,
+								);
+			$fields['name'] = array(	'show'	=> true,
+										'view_link'=>true,
+										'edit'	=> true,
+										'type'	=> 'string',
+										'length'=> 100,
+										'values'=> NULL,
+										'text'	=> 'Name',
+										'required' => true,
+										'post'	=> true,
+										'default' => NULL,
+										'image'	=> false,
+								);
+			$fields['description'] = array(		'show'	=> true,
+										'view_link'	=> false,
+										'edit'	=> true,
+										'type'	=> 'string',
+										'length'=> 255,
+										'values'=> NULL,
+										'text'	=> 'Description',
+										'required' => true,
+										'post'	=> true,
+										'default' => NULL,
+										'image'	=> false,
+								);
+			$fields['web_alias'] = array(		'show'	=> array('view','field'),
+										'view_link'	=> false,
+										'edit'	=> true,
+										'type'	=> 'string',
+										'length'=> 15,
+										'values'=> NULL,
+										'text'	=> 'Web Alias',
+										'required' => false,
+										'post'	=> true,
+										'default' => NULL,
+										'image'	=> false,
+								);
+			$fields['show_on_site'] = array(	'show'	=> array('view','field'),
+										'view_link'	=> false,
+										'edit'	=> true,
+										'type'	=> 'enum',
+										'length'=> NULL,
+										'values'=> 'y,Yes|n,No',
+										'text'	=> 'Show',
+										'required' => NULL,
+										'post'	=> true,
+										'default' => 'y',
+										'image'	=> false,
+								);
+			$fields['active'] = array(	'show'	=> true,
+										'view_link'	=> false,
+										'edit'	=> true,
+										'type'	=> 'enum',
+										'length'=> NULL,
+										'values'=> 'y,Yes|n,No',
+										'text'	=> 'Active',
+										'required' => NULL,
+										'post'	=> true,
+										'default' => 'y',
+										'image'	=> false,
+								);
+			$fields['icon'] = array(		'show'	=> true,
+										'view_link'	=> false,
+										'edit'	=> true,
+										'type'	=> 'file',
+										'length'=> 255,
+										'values'=> NULL,
+										'text'	=> 'Icon',
+										'required' => false,
+										'post'	=> true,
+										'default' => NULL,
+										'image'	=> true,
+										'image_width' => 40,
+										'image_heigth' => NULL,
+								);
+			$this->fields = $fields;
+		}
+		return $this->fields;
+	}
+
+	public function get_info(){
+		$return = parent::get_info();
+		if(isset($return['id'])){		//do this only once
+			$filters = array();
+			$filters[] = array('field'=>'category_id', 'operator'=>'=', 'value'=>$return['id']);
+			$filters[] = array('field'=>'lang', 'operator'=>'=', 'value'=>load_library('lang')->get_lang());
+			$filters[] = array('field'=>'active', 'operator'=>'=', 'value'=>'y');
+			$category_translation = load_library('category_translation')->get_record($filters)->get_info();
+			if(isset($category_translation['lang']) && $category_translation['lang']==load_library('lang')->get_lang()){
+				$return['name'] = $category_translation['name'];
+				$return['description'] = $category_translation['description'];
+			}
+			$this->current = $return;
+		}
+		return $return;
+	}
+
+	public function get_all($where=array(), $orders=array(), $group=array(), $limit='', $from='', $join = array(), $xtrfields = array()){
+		$fields = $this->get_fields();
+		$str = '^('.implode('|', array_keys($fields)).').?(ASC|DESC)?$';
+		foreach($orders as $key=>$order){
+			if(!eregi($str,$order)){
+				$orders[$key] = 'name';
+			}
+		}
+		return parent::get_all($where, $orders, $group, $limit, $from, $join, $xtrfields);
+	}
+}
 ?>
\ No newline at end of file

Modified: websites/pbidir.com/bibivu/lib/pbi.php
===================================================================
--- websites/pbidir.com/bibivu/lib/pbi.php	2008-08-22 18:19:01 UTC (rev 2646)
+++ websites/pbidir.com/bibivu/lib/pbi.php	2008-08-23 04:07:22 UTC (rev 2647)
@@ -31,6 +31,15 @@
 															),
 							  );
 */
+			$related[] = array(		'table'			=> 'pbi_translation',
+									'field'			=> 'pbi_id',
+									'main_field'	=> 'id',
+									'show'			=> 'list',		//field, list
+									'name'			=> 'Translations',
+									'autoopen'		=> false,
+									'relation_table'=> array(),
+							  );
+
 			$related[] = array(		'table'			=> 'pbi_release',
 									'field'			=> 'pbi_id',
 									'main_field'	=> 'id',
@@ -427,6 +436,15 @@
 				$return['contributor_name']		= '';
 				$return['contributor_email']	= '';
 			}
+			$filters = array();
+			$filters[] = array('field'=>'pbi_id', 'operator'=>'=', 'value'=>$return['id']);
+			$filters[] = array('field'=>'lang', 'operator'=>'=', 'value'=>load_library('lang')->get_lang());
+			$filters[] = array('field'=>'active', 'operator'=>'=', 'value'=>'y');
+			$pbi_translation = load_library('pbi_translation')->get_record($filters)->get_info();
+			if(isset($pbi_translation['lang']) && $pbi_translation['lang']==load_library('lang')->get_lang()){
+				$return['summary'] = $pbi_translation['summary'];
+				$return['description'] = $pbi_translation['description'];
+			}
 			$this->current = $return;
 		}
 		return $return;

Modified: websites/pbidir.com/bibivu/lib/user.php
===================================================================
--- websites/pbidir.com/bibivu/lib/user.php	2008-08-22 18:19:01 UTC (rev 2646)
+++ websites/pbidir.com/bibivu/lib/user.php	2008-08-23 04:07:22 UTC (rev 2647)
@@ -128,21 +128,17 @@
 										'default' => NULL,
 										'image'	=> false,
 								);
+			$tmps = load_library('lang')->get_supported_langs();
+			$values = array();
+			foreach($tmps as $tmp){
+				$values[] = $tmp.','.load_library('lang')->get('lang_name','',$tmp);
+			}
 			$fields['lang'] = array(	'show'	=> array('view','field'),
 										'view_link'	=> false,
 										'edit'	=> true,
 										'type'	=> 'enum',
 										'length'=> NULL,
-										'values'=> 'de,Deutsch'.
-												   '|en,English'.
-												   '|es,Spanish'.
-												   '|fr,French'.
-												   '|it,Italian'.
-												   '|ja,Japanese'.
-												   '|nl,Nederlands'.
-												   '|ru,Russian'.
-												   '|tr,Turkish'.
-												   '',
+										'values'=> implode('|',$values),
 										'text'	=> 'Language',
 										'required' => NULL,
 										'post'	=> true,

Modified: websites/pbidir.com/bibivu/slib/lang.php
===================================================================
--- websites/pbidir.com/bibivu/slib/lang.php	2008-08-22 18:19:01 UTC (rev 2646)
+++ websites/pbidir.com/bibivu/slib/lang.php	2008-08-23 04:07:22 UTC (rev 2647)
@@ -28,6 +28,10 @@
 		}
 		return $this->config['detected'];
 	}
+	
+	public function get_supported_langs(){
+		return $this->config['supported'];
+	}
 
 	public function get($word, $default='', $lang=''){
 		if($lang=='')	$lang = $this->_detect_lang();

Modified: websites/pbidir.com/bibivu/tpl/pbidir/admin/list.php
===================================================================
--- websites/pbidir.com/bibivu/tpl/pbidir/admin/list.php	2008-08-22 18:19:01 UTC (rev 2646)
+++ websites/pbidir.com/bibivu/tpl/pbidir/admin/list.php	2008-08-23 04:07:22 UTC (rev 2647)
@@ -1,140 +1,143 @@
-<?php
-if(!$ajax){
-	?><ul class="breadcrumbs">
-		<li><a href="<?=$home_uri?>">pbiDIR</a></li>
-		<li><?=htmlentities($page_name)?></li>
-	</ul><?php
-}
-if($can_write){
-	?><a href="<?=$add_uri?>/id/0" title="Add New" class="divBox" id="add_new">Add New</a>&nbsp;&nbsp;&nbsp;<?php
-}
-if(isset($records) && is_array($records) && count($records)>0){
-	$tot_columns = 0;	//number of columns in this table
-	$show_save = false;
-/*
-	if(!$ajax){
-		?>&nbsp;&nbsp;&nbsp;<label for="filter">Filters:</label>&nbsp;<input type="text" id="filter" value="" size="50" />(press enter to search)<br /><br /><?php
-	}
-*/
-	$params = array('order'=>load_class('uri')->get('order'), 'dir'=>load_class('uri')->get('dir'));
-	$current_page = load_class('uri')->get('page',0);
-	$tot_pages = ceil($total_records/$total_per_page);
-	if($tot_pages>1){
-		if(load_class('uri')->get('page',0)>0){
-			//need to allow the user to go to the previous page
-			?>[<a href="<?=load_class('uri')->create_uri(array_merge($params, array('page'=>0)))?>">&lt;&lt;&nbsp;first</a>]&nbsp;&nbsp;[<a href="<?=load_class('uri')->create_uri(array_merge($params, array('page'=>(load_class('uri')->get('page',0)-1))))?>">&lt;&nbsp;previous</a>]<?php
-		} else {
-			?>[&lt;&lt;&nbsp;first]&nbsp;&nbsp;[&lt;&nbsp;previous]<?php
-		}
-		?>&nbsp;&nbsp;Page <?=($current_page+1)?>/<?=$tot_pages?>&nbsp;&nbsp;<?php
-		if(($current_page+1)<$tot_pages){
-			//need to allow the user to go to the previous page
-			?>[<a href="<?=load_class('uri')->create_uri(array_merge($params, array('page'=>(load_class('uri')->get('page',0)+1))))?>">next&nbsp;&gt;</a>]&nbsp;&nbsp;[<a href="<?=load_class('uri')->create_uri(array_merge($params, array('page'=>$tot_pages-1)))?>">last&nbsp;&gt;&gt;</a>]<?php
-		} else {
-			?>[next&nbsp;&gt;]&nbsp;&nbsp;[last&nbsp;&gt;&gt;]<?php
-		}
-	}
-	?><br /><br /><div class="form"><table class="sortable list" cellspacing="0"><thead class="head"><tr class="row"><?php
-	foreach($fields as $key=>$value){
-		if($value['show']===true || $value['show']=='list' || (is_array($value['show']) && in_array('list',$value['show']))){
-			$tot_columns++;
-			?><th class="field <?=load_class('uri')->get('order')==$key?(load_class('uri')->get('dir')=='ASC'?'headerSortUp':'headerSortDown'):''?>"><?php
-			if($ajax){
-				?><a href="javascript:void(0);" onclick="show_related_table('<?=load_class('uri')->create_uri(array('order'=>$key, 'dir'=>(load_class('uri')->get('order')==$key && load_class('uri')->get('dir')=='ASC'?'DESC':'ASC')))?>', '<?=$_POST['_srt_field_to']?>', '<?=$_POST['_srt_field_from']?>', '<?=$_POST['_srt_div']?>', '')"><?=$value['text']?></a><?php
-			} else {
-				?><a href="<?=load_class('uri')->create_uri(array('order'=>$key, 'dir'=>(load_class('uri')->get('order')==$key && load_class('uri')->get('dir')=='ASC'?'DESC':'ASC')))?>"><?=$value['text']?></a><?php
-			} ?></th><?php
-		}
-	}
-	?></tr></thead><tbody><?php
-	foreach($records as $record){
-		?><tr class="row" id="rec<?=$record['id']?>" ><?php
-		foreach($fields as $key=>$value){
-			if($value['show']===true || $value['show']=='list' || (is_array($value['show']) && in_array('list',$value['show']))){
-				$rec_value = $record[$key];
-				if($value['type']=='enum'){
-					$vv = explode('|',$value['values']);
-					foreach($vv as $v){
-						$t = explode(',',$v);
-						$val = $t[0];
-						if(isset($t[1])){
-							$opt = $t[1];
-						} else {
-							$opt = $t[0];
-						}
-						if($val == $record[$key]){
-							$rec_value = $opt;
-						}
-					}					
-				}
-				?><td class="field" id="<?=$key.'_'.$record['id']?>"><?php
-				if($value['view_link']!==false){
-					$value['view_link'] = $value['view_link']===true?load_class('uri')->create_uri(array('view'=>'','ajax'=>'')):$value['view_link'];
-					?><a href="<?=$value['view_link']?>/id/<?=$record['id']?>" title="Edit Record <?=$record['id']?>" class="divBox field_edit"><?php
-				}
-				if($value['image']!==false && $record[$key]!=''){
-					?><img border="0" src="<?=$record[$key]?>" title="<?=$record[$key]?>" alt="<?=$record[$key]?>"<?php
-						if(isset($value['image_width']) && $value['image_width']>0){
-							?> width="<?=$value['image_width']?>"<?php
-						}
-						if(isset($value['image_heigth']) && $value['image_heigth']>0){
-							?> heigth="<?=$value['image_heigth']?>"<?php
-						}
-					?>/><?php
-				} else {
-					if(!$ajax && $can_write && in_array($key,$bulk_actions)){
-						$field_name = $key.'['.$record['id'].']';
-						$field_values = $value;
-						$hide_label = true;
-						$record[$field_name] = $record[$key];
-						include(dirname(__FILE__).'/field.php');
-						$show_save = true;
-					} else {
-						?><?=$rec_value?><?php
-					}
-				}
-				if($value['view_link']!==false){
-					?></a><?php
-				}
-				?></td><?php
-			}
-		}
-		?></tr><?php
-	}
-	?></tbody><tfoot><tr class="row foot"><?php
-	foreach($fields as $key=>$value){
-		if($value['show']===true || $value['show']=='list' || (is_array($value['show']) && in_array('list',$value['show']))){
-			//in the future this will contain the columns that will need to have a total
-			?><td class="field">&nbsp;</td><?php
-		}
-	}
-	?></tr></tfoot></table></div><?php
-	if($can_write && !$ajax && $show_save){
-		?><input type="button" value="  Save Bulk  " onclick="postForm('form','<?=$save_bulk_uri?>', true)" class="button save" /><?php
-	}
-	if($tot_pages>1 || !$ajax){
-		?>Displaying <?=($current_page*$total_per_page)+1?> to <?=$total_records>(($current_page+1)*$total_per_page)?(($current_page+1)*$total_per_page):$total_records?> of <?=$total_records?><br /><br /><?php
-	}
-	if($tot_pages>1){
-		if(load_class('uri')->get('page',0)>0){
-			//need to allow the user to go to the previous page
-			?>[<a href="<?=load_class('uri')->create_uri($params)?>">&lt;&lt;&nbsp;first</a>]&nbsp;&nbsp;[<a href="<?=load_class('uri')->create_uri(array_merge($params, array('page'=>(load_class('uri')->get('page',0)-1))))?>">&lt;&nbsp;previous</a>]<?php
-		} else {
-			?>[&lt;&lt;&nbsp;first]&nbsp;&nbsp;[&lt;&nbsp;previous]<?php
-		}
-		?>&nbsp;&nbsp;Page <?=($current_page+1)?>/<?=$tot_pages?>&nbsp;&nbsp;<?php
-		if(($current_page+1)<$tot_pages){
-			//need to allow the user to go to the previous page
-			?>[<a href="<?=load_class('uri')->create_uri(array_merge($params, array('page'=>(load_class('uri')->get('page',0)+1))))?>">next&nbsp;&gt;</a>]&nbsp;&nbsp;[<a href="<?=load_class('uri')->create_uri(array_merge($params, array('page'=>$tot_pages-1)))?>">last&nbsp;&gt;&gt;</a>]<?php
-		} else {
-			?>[next&nbsp;&gt;]&nbsp;&nbsp;[last&nbsp;&gt;&gt;]<?php
-		}
-		?>&nbsp;---&nbsp;Go to Page:&nbsp;<?php
-		for($i=1; $i<=$tot_pages; $i++){
-			?><a href="<?=load_class('uri')->create_uri(array_merge($params, array('page'=>$i-1)))?>"><?=$i?></a>&nbsp;<?php
-		}
-	}
-} else {
-	?><br />No Records To Show !<?php
-}
+<?php
+$_POST['_srt_field_to']		= isset($_POST['_srt_field_to'])?$_POST['_srt_field_to']:'';
+$_POST['_srt_field_from']	= isset($_POST['_srt_field_from'])?$_POST['_srt_field_from']:'';
+$_POST['_srt_div']			= isset($_POST['_srt_div'])?$_POST['_srt_div']:'';
+if(!$ajax){
+	?><ul class="breadcrumbs">
+		<li><a href="<?=$home_uri?>">pbiDIR</a></li>
+		<li><?=htmlentities($page_name)?></li>
+	</ul><?php
+}
+if($can_write){
+	?><a href="<?=$add_uri?>/id/0" title="Add New" class="divBox" id="add_new">Add New</a>&nbsp;&nbsp;&nbsp;<?php
+}
+if(isset($records) && is_array($records) && count($records)>0){
+	$tot_columns = 0;	//number of columns in this table
+	$show_save = false;
+/*
+	if(!$ajax){
+		?>&nbsp;&nbsp;&nbsp;<label for="filter">Filters:</label>&nbsp;<input type="text" id="filter" value="" size="50" />(press enter to search)<br /><br /><?php
+	}
+*/
+	$params = array('order'=>load_class('uri')->get('order'), 'dir'=>load_class('uri')->get('dir'));
+	$current_page = load_class('uri')->get('page',0);
+	$tot_pages = ceil($total_records/$total_per_page);
+	if($tot_pages>1){
+		if(load_class('uri')->get('page',0)>0){
+			//need to allow the user to go to the previous page
+			?>[<a href="<?=load_class('uri')->create_uri(array_merge($params, array('page'=>0)))?>">&lt;&lt;&nbsp;first</a>]&nbsp;&nbsp;[<a href="<?=load_class('uri')->create_uri(array_merge($params, array('page'=>(load_class('uri')->get('page',0)-1))))?>">&lt;&nbsp;previous</a>]<?php
+		} else {
+			?>[&lt;&lt;&nbsp;first]&nbsp;&nbsp;[&lt;&nbsp;previous]<?php
+		}
+		?>&nbsp;&nbsp;Page <?=($current_page+1)?>/<?=$tot_pages?>&nbsp;&nbsp;<?php
+		if(($current_page+1)<$tot_pages){
+			//need to allow the user to go to the previous page
+			?>[<a href="<?=load_class('uri')->create_uri(array_merge($params, array('page'=>(load_class('uri')->get('page',0)+1))))?>">next&nbsp;&gt;</a>]&nbsp;&nbsp;[<a href="<?=load_class('uri')->create_uri(array_merge($params, array('page'=>$tot_pages-1)))?>">last&nbsp;&gt;&gt;</a>]<?php
+		} else {
+			?>[next&nbsp;&gt;]&nbsp;&nbsp;[last&nbsp;&gt;&gt;]<?php
+		}
+	}
+	?><br /><br /><div class="form"><table class="sortable list" cellspacing="0"><thead class="head"><tr class="row"><?php
+	foreach($fields as $key=>$value){
+		if($value['show']===true || $value['show']=='list' || (is_array($value['show']) && in_array('list',$value['show']))){
+			$tot_columns++;
+			?><th class="field <?=load_class('uri')->get('order')==$key?(load_class('uri')->get('dir')=='ASC'?'headerSortUp':'headerSortDown'):''?>"><?php
+			if($ajax){
+				?><a href="javascript:void(0);" onclick="show_related_table('<?=load_class('uri')->create_uri(array('order'=>$key, 'dir'=>(load_class('uri')->get('order')==$key && load_class('uri')->get('dir')=='ASC'?'DESC':'ASC')))?>', '<?=$_POST['_srt_field_to']?>', '<?=$_POST['_srt_field_from']?>', '<?=$_POST['_srt_div']?>', '')"><?=$value['text']?></a><?php
+			} else {
+				?><a href="<?=load_class('uri')->create_uri(array('order'=>$key, 'dir'=>(load_class('uri')->get('order')==$key && load_class('uri')->get('dir')=='ASC'?'DESC':'ASC')))?>"><?=$value['text']?></a><?php
+			} ?></th><?php
+		}
+	}
+	?></tr></thead><tbody><?php
+	foreach($records as $record){
+		?><tr class="row" id="rec<?=$record['id']?>" ><?php
+		foreach($fields as $key=>$value){
+			if($value['show']===true || $value['show']=='list' || (is_array($value['show']) && in_array('list',$value['show']))){
+				$rec_value = $record[$key];
+				if($value['type']=='enum'){
+					$vv = explode('|',$value['values']);
+					foreach($vv as $v){
+						$t = explode(',',$v);
+						$val = $t[0];
+						if(isset($t[1])){
+							$opt = $t[1];
+						} else {
+							$opt = $t[0];
+						}
+						if($val == $record[$key]){
+							$rec_value = $opt;
+						}
+					}					
+				}
+				?><td class="field" id="<?=$key.'_'.$record['id']?>"><?php
+				if($value['view_link']!==false){
+					$value['view_link'] = $value['view_link']===true?load_class('uri')->create_uri(array('view'=>'','ajax'=>'')):$value['view_link'];
+					?><a href="<?=$value['view_link']?>/id/<?=$record['id']?>" title="Edit Record <?=$record['id']?>" class="divBox field_edit"><?php
+				}
+				if($value['image']!==false && $record[$key]!=''){
+					?><img border="0" src="<?=$record[$key]?>" title="<?=$record[$key]?>" alt="<?=$record[$key]?>"<?php
+						if(isset($value['image_width']) && $value['image_width']>0){
+							?> width="<?=$value['image_width']?>"<?php
+						}
+						if(isset($value['image_heigth']) && $value['image_heigth']>0){
+							?> heigth="<?=$value['image_heigth']?>"<?php
+						}
+					?>/><?php
+				} else {
+					if(!$ajax && $can_write && in_array($key,$bulk_actions)){
+						$field_name = $key.'['.$record['id'].']';
+						$field_values = $value;
+						$hide_label = true;
+						$record[$field_name] = $record[$key];
+						include(dirname(__FILE__).'/field.php');
+						$show_save = true;
+					} else {
+						?><?=$rec_value?><?php
+					}
+				}
+				if($value['view_link']!==false){
+					?></a><?php
+				}
+				?></td><?php
+			}
+		}
+		?></tr><?php
+	}
+	?></tbody><tfoot><tr class="row foot"><?php
+	foreach($fields as $key=>$value){
+		if($value['show']===true || $value['show']=='list' || (is_array($value['show']) && in_array('list',$value['show']))){
+			//in the future this will contain the columns that will need to have a total
+			?><td class="field">&nbsp;</td><?php
+		}
+	}
+	?></tr></tfoot></table></div><?php
+	if($can_write && !$ajax && $show_save){
+		?><input type="button" value="  Save Bulk  " onclick="postForm('form','<?=$save_bulk_uri?>', true)" class="button save" /><?php
+	}
+	if($tot_pages>1 || !$ajax){
+		?>Displaying <?=($current_page*$total_per_page)+1?> to <?=$total_records>(($current_page+1)*$total_per_page)?(($current_page+1)*$total_per_page):$total_records?> of <?=$total_records?><br /><br /><?php
+	}
+	if($tot_pages>1){
+		if(load_class('uri')->get('page',0)>0){
+			//need to allow the user to go to the previous page
+			?>[<a href="<?=load_class('uri')->create_uri($params)?>">&lt;&lt;&nbsp;first</a>]&nbsp;&nbsp;[<a href="<?=load_class('uri')->create_uri(array_merge($params, array('page'=>(load_class('uri')->get('page',0)-1))))?>">&lt;&nbsp;previous</a>]<?php
+		} else {
+			?>[&lt;&lt;&nbsp;first]&nbsp;&nbsp;[&lt;&nbsp;previous]<?php
+		}
+		?>&nbsp;&nbsp;Page <?=($current_page+1)?>/<?=$tot_pages?>&nbsp;&nbsp;<?php
+		if(($current_page+1)<$tot_pages){
+			//need to allow the user to go to the previous page
+			?>[<a href="<?=load_class('uri')->create_uri(array_merge($params, array('page'=>(load_class('uri')->get('page',0)+1))))?>">next&nbsp;&gt;</a>]&nbsp;&nbsp;[<a href="<?=load_class('uri')->create_uri(array_merge($params, array('page'=>$tot_pages-1)))?>">last&nbsp;&gt;&gt;</a>]<?php
+		} else {
+			?>[next&nbsp;&gt;]&nbsp;&nbsp;[last&nbsp;&gt;&gt;]<?php
+		}
+		?>&nbsp;---&nbsp;Go to Page:&nbsp;<?php
+		for($i=1; $i<=$tot_pages; $i++){
+			?><a href="<?=load_class('uri')->create_uri(array_merge($params, array('page'=>$i-1)))?>"><?=$i?></a>&nbsp;<?php
+		}
+	}
+} else {
+	?><br />No Records To Show !<?php
+}
 ?>
\ No newline at end of file

Modified: websites/pbidir.com/bibivu/tpl/pbidir/home.php
===================================================================
--- websites/pbidir.com/bibivu/tpl/pbidir/home.php	2008-08-22 18:19:01 UTC (rev 2646)
+++ websites/pbidir.com/bibivu/tpl/pbidir/home.php	2008-08-23 04:07:22 UTC (rev 2647)
@@ -14,7 +14,14 @@
 			$category['description'] = $category['description'];
 			?><li><img alt="<?=$category['name']?>" src="<?=$category['icon']?>" />
 			<div class="categ">
-			<div class="categname"><a href="<?=$category_uri?>/<?=$category['web_alias']?>"><?=$category['name']?></a></div>
+			<div class="categname"><a href="<?=$category_uri?>/<?=$category['web_alias']?>"><?=$category['name']?></a><?php
+if($can_write){
+	?><a href="<?=load_class('uri')->create_uri(array(CLASS_KEY=>'admin', TASK_KEY=>'category','view'=>'','ajax'=>'', 'id'=>$category['id']))?>" class="divBox"><input type="button" value="  Edit This Category " class="button edit divBox" /></a><?php
+}
+if($can_translate){
+	?><a href="<?=load_class('uri')->create_uri(array(CLASS_KEY=>'admin', TASK_KEY=>'category_translation','list'=>'','ajax'=>'', 'category_id'=>$category['id']))?>" class="divBox"><input type="button" value="  Translate This Category " class="button edit divBox" /></a><?php
+}
+			?></div>
 			<div class="categdescr"><?=$category['description']?></div>
 			</div>
 			</li><?php

Modified: websites/pbidir.com/bibivu/tpl/pbidir/pbi.php
===================================================================
--- websites/pbidir.com/bibivu/tpl/pbidir/pbi.php	2008-08-22 18:19:01 UTC (rev 2646)
+++ websites/pbidir.com/bibivu/tpl/pbidir/pbi.php	2008-08-23 04:07:22 UTC (rev 2647)
@@ -82,7 +82,11 @@
 ?><?=$pbi['name']?></h1><?php
 if($can_write){
 	?><a href="<?=load_class('uri')->create_uri(array(CLASS_KEY=>'admin', TASK_KEY=>'pbi','view'=>'','ajax'=>'', 'id'=>$pbi['id']))?>" class="divBox"><input type="button" value="  Edit This PBI " class="button edit divBox" /></a><?php
-} ?></div>
+}
+if($can_translate){
+	?><a href="<?=load_class('uri')->create_uri(array(CLASS_KEY=>'admin', TASK_KEY=>'pbi_translation','list'=>'','ajax'=>'', 'pbi_id'=>$pbi['id']))?>" class="divBox"><input type="button" value="  Translate This PBI " class="button edit divBox" /></a><?php
+}
+?></div>
 <?php
 if($pbi['use_wine']=='y'){
 	?><img src="/bibivu/tpl/pbidir/images/pbi/icon_wine.png" alt="<?=load_library('lang')->get('pbi_use_wine')?>" title="<?=load_library('lang')->get('pbi_use_wine')?>" class="pbi_legend" /><?php



More information about the Commits mailing list