Skip to content

Commit

Permalink
Moved DEFAULT_TABLE_WIDTH to webconfig
Browse files Browse the repository at this point in the history
  • Loading branch information
jeroenrnl committed Oct 20, 2012
1 parent cdd67fc commit fcd07dd
Show file tree
Hide file tree
Showing 4 changed files with 17 additions and 10 deletions.
8 changes: 8 additions & 0 deletions php/classes/conf.inc.php
Expand Up @@ -161,6 +161,14 @@ private static function getDefault() {
$int_title->setRegex("^.*$");
$interface[]=$int_title;

$int_width = new confItemString();
$int_width->setName("interface.width");
$int_width->setLabel("Screen width");
$int_width->setDesc("A number in pixels (\"px\") or percent (\"%\"), the latter is a percentage of the user's browser window width.");
$int_width->setDefault("600px");
$int_width->setRegex("^[0-9]+(px|%)$");
$interface[]=$int_width;

$int_css = new confItemString();
$int_css->setName("interface.css");
$int_css->setLabel("Style Sheet");
Expand Down
3 changes: 2 additions & 1 deletion php/config.inc.php
Expand Up @@ -265,7 +265,8 @@
// width of the main table
// May be in pixels ("px") or percent ("%").
// As of v0.6, the entity is required.
define('DEFAULT_TABLE_WIDTH', "600px");
// Deprecated: Modify through admin -> config in web interface.
//define('DEFAULT_TABLE_WIDTH', "600px");
// define('DEFAULT_TABLE_WIDTH', "90%");

// set to the id of a non admin user or to 0 to disable
Expand Down
13 changes: 5 additions & 8 deletions php/css.php
Expand Up @@ -18,15 +18,12 @@

header("Content-Type: text/css");
if(isset($_GET['logged_on'])) {
require_once("log.inc.php");
require_once("config.inc.php");
require_once("classes/zophTable.inc.php");
require_once("user.inc.php");
define("LOGON", true);
echo "/* This is the default CSS, the user is not logged on */";
} else {
require_once("include.inc.php");
echo "/* This is the customized CSS, user is logged on */";
}
require_once("include.inc.php");

?>

Expand All @@ -39,7 +36,7 @@
font-size: medium;
color: <?php echo $TEXT_COLOR ?>;
background: <?php echo $PAGE_BG_COLOR ?>;
width: <?php echo DEFAULT_TABLE_WIDTH ?>;
width: <?php echo conf::get("interface.width"); ?>;
border: none;
margin-left: auto; /* To center the page */
margin-right: auto;
Expand Down Expand Up @@ -670,9 +667,9 @@
}

div.intro {
float: right;
margin-left: 15px;
float: left;
clear: right;
width: <?php echo DEFAULT_TABLE_WIDTH-THUMB_SIZE-50 ?>px;
}

div.intro ul {
Expand Down
3 changes: 2 additions & 1 deletion php/photos.php
Expand Up @@ -77,7 +77,8 @@

if (!($num_thumbnails == 0 || $_cols <= 4)) {
$width = ((THUMB_SIZE + 14) * $_cols) + 25;
if ($width > DEFAULT_TABLE_WIDTH || strpos(DEFAULT_TABLE_WIDTH, "%")) {
$default_width= conf::get("interface.width");
if ($width > $default_width || strpos($default_width, "%")) {
$extrastyle = "body { width: " . $width . "px; }\n";
}
}
Expand Down

0 comments on commit fcd07dd

Please sign in to comment.