Add category color/font support for web view
This commit is contained in:
		| @@ -1,3 +1,4 @@ | ||||
| <?php | ||||
| /* | ||||
|   Copyright 2010 Grégory Soutadé | ||||
|  | ||||
| @@ -17,8 +18,6 @@ | ||||
|   along with KissCount.  If not, see <http://www.gnu.org/licenses/>. | ||||
| */ | ||||
|  | ||||
| <?php | ||||
|  | ||||
| $BDD_FILE = '/var/nfs/kc.bdd'; | ||||
|  | ||||
| try { | ||||
| @@ -52,6 +51,28 @@ function IsUserValid($user, $password) | ||||
|     return $result->fetchArray(); | ||||
| } | ||||
|  | ||||
| function ExtractStyle(&$category) | ||||
| { | ||||
|     $s = "background-color:" . $category["backcolor"] . ";"; | ||||
|     $s .= "color:" . $category["forecolor"] . ";"; | ||||
|  | ||||
|     if ($category["font"] != "") | ||||
|     { | ||||
|         $params = explode(";", $category["font"]); | ||||
|  | ||||
|         // size ; xx ; 93 italic ; 92 bold ; face name                                                                                                                   | ||||
|  | ||||
|         $s .= "font-size:" . $params[0] . "px;"; | ||||
|         if ($params[2] == "93") | ||||
|             $s .= "font-style:italic;"; | ||||
|         if ($params[3] == "92") | ||||
|             $s .= "font-weight:bold;"; | ||||
|         $s .= "font-family:" . $params[4] . ";"; | ||||
|     } | ||||
|  | ||||
|     $category["style"] = $s; | ||||
| } | ||||
|  | ||||
| function LoadUser($name) | ||||
| { | ||||
|     global $db; | ||||
| @@ -79,7 +100,10 @@ function LoadUser($name) | ||||
|     $user->categories = array(); | ||||
|  | ||||
|     while ($row = $result->fetchArray()) | ||||
|     { | ||||
|         ExtractStyle($row); | ||||
|         array_push($user->categories, $row); | ||||
|     } | ||||
|  | ||||
|     $result = $db->query("SELECT * FROM preference WHERE user='$user->id' ORDER by name"); | ||||
|  | ||||
|   | ||||
		Reference in New Issue
	
	Block a user