aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorolivierm <olivier@migeot.org>2011-02-23 10:18:11 +0100
committerolivierm <olivier@migeot.org>2011-02-23 10:18:11 +0100
commit3ad7c395fb9a33319531e04673563e7c9983d8f0 (patch)
tree40945bc75aa9ba7703f11f9c5b26f2ea094b3c35
parentfbf0459fb218549f2c0889cc5b01e337c52510ce (diff)
parenta5b80e5d564f6c239510dbee10daf3ff4c314f2e (diff)
downloadvolse-hubzilla-3ad7c395fb9a33319531e04673563e7c9983d8f0.tar.gz
volse-hubzilla-3ad7c395fb9a33319531e04673563e7c9983d8f0.tar.bz2
volse-hubzilla-3ad7c395fb9a33319531e04673563e7c9983d8f0.zip
Merge commit 'mike/master'
-rw-r--r--include/datetime.php111
-rw-r--r--mod/notifications.php3
-rw-r--r--util/strings.php3
-rw-r--r--view/de/netfriend.tpl14
-rw-r--r--view/de/strings.php3
-rw-r--r--view/fr/netfriend.tpl14
-rw-r--r--view/fr/strings.php3
-rw-r--r--view/it/netfriend.tpl14
-rw-r--r--view/it/strings.php3
-rw-r--r--view/netfriend.tpl (renamed from view/en/netfriend.tpl)6
-rw-r--r--view/theme/duepuntozero/style.css6
-rw-r--r--view/theme/loozah/style.css8
12 files changed, 143 insertions, 45 deletions
diff --git a/include/datetime.php b/include/datetime.php
index b0279492b..724eec933 100644
--- a/include/datetime.php
+++ b/include/datetime.php
@@ -196,3 +196,114 @@ function age($dob,$owner_tz = '',$viewer_tz = '') {
$year_diff--;
return $year_diff;
}
+
+
+
+// Get days in month
+// get_dim($year, $month);
+// returns number of days.
+// $month[1] = 'January';
+// to match human usage.
+
+if(! function_exists('get_dim')) {
+function get_dim($y,$m) {
+
+ $dim = array( 0,
+ 31, 28, 31, 30, 31, 30,
+ 31, 31, 30, 31, 30, 31);
+
+ if($m != 2)
+ return $dim[$m];
+ if(((($y % 4) == 0) && (($y % 100) != 0)) || (($y % 400) == 0))
+ return 29;
+ return $dim[2];
+}}
+
+
+// Returns the first day in month for a given month, year
+// get_first_dim($year,$month)
+// returns 0 = Sunday through 6 = Saturday
+// Months start at 1.
+
+if(! function_exists('get_first_dim')) {
+function get_first_dim($y,$m) {
+ $d = sprintf('%04d-%02d-01 00:00', intval($y), intval($m));
+ return datetime_convert('UTC','UTC',$d,'w');
+}}
+
+// output a calendar for the given month, year.
+// if $links are provided (array), e.g. $links[12] => 'http://mylink' ,
+// date 12 will be linked appropriately. Today's date is also noted by
+// altering td class.
+// Months count from 1.
+
+
+// TODO: provide (prev,next) links, define class variations for different size calendars
+
+
+if(! function_exists('cal')) {
+function cal($y = 0,$m = 0, $links = false) {
+
+
+ // month table - start at 1 to match human usage.
+
+ $mtab = array(' ',
+ 'January','February','March',
+ 'April','May','June',
+ 'July','August','September',
+ 'October','November','December'
+ );
+
+ $thisyear = datetime_convert('UTC',date_default_timezone_get(),'now','Y');
+ $thismonth = datetime_convert('UTC',date_default_timezone_get(),'now','m');
+ if(! $y)
+ $y = $thisyear;
+ if(! $m)
+ $m = intval($thismonth);
+
+ $dn = array('Sunday', 'Monday', 'Tuesday', 'Wednesday', 'Thursday', 'Friday', 'Saturday');
+ $f = get_first_dim($y,$m);
+ $l = get_dim($y,$m);
+ $d = 1;
+ $dow = 0;
+ $started = false;
+
+ if(($y == $thisyear) && ($m == $thismonth))
+ $tddate = intval(datetime_convert('UTC',date_default_timezone_get(),'now','j'));
+
+ $str_month = day_translate($mtab[$m]);
+ $o = '<table class="calendar">';
+ $o .= "<caption>$str_month $y</caption><tr>";
+ for($a = 0; $a < 7; $a ++)
+ $o .= '<th>' . substr(day_translate($dn[$a]),0,3) . '</th>';
+ $o .= '</tr><tr>';
+
+ while($d <= $l) {
+ if(($dow == $f) && (! $started))
+ $started = true;
+ $today = (((isset($tddate)) && ($tddate == $d)) ? "class=\"today\" " : '');
+ $o .= "<td $today>";
+ $day = str_replace(' ','&nbsp;',sprintf('%2.2d', $d));
+ if($started) {
+ if(is_array($links) && isset($links[$d]))
+ $o .= "<a href=\"{$links[$d]}\">$day</a>";
+ else
+ $o .= $day;
+ $d ++;
+ }
+ else
+ $o .= '&nbsp;';
+ $o .= '</td>';
+ $dow ++;
+ if(($dow == 7) && ($d <= $l)) {
+ $dow = 0;
+ $o .= '</tr><tr>';
+ }
+ }
+ if($dow)
+ for($a = $dow; $a < 7; $a ++)
+ $o .= '<td>&nbsp;</td>';
+ $o .= '</tr></table>'."\r\n";
+
+ return $o;
+}}
diff --git a/mod/notifications.php b/mod/notifications.php
index 49157c444..93ca82bb0 100644
--- a/mod/notifications.php
+++ b/mod/notifications.php
@@ -108,6 +108,9 @@ function notifications_content(&$a) {
'$intro_id' => $rr['intro_id'],
'$friend_selected' => $friend_selected,
'$fan_selected' => $fan_selected,
+ '$approve_as' => t('Approve as: '),
+ '$as_friend' => t('Friend'),
+ '$as_fan' => t('Fan/Admirer')
));
}
diff --git a/util/strings.php b/util/strings.php
index 8dabb064d..747d8ef48 100644
--- a/util/strings.php
+++ b/util/strings.php
@@ -276,6 +276,9 @@ $a->strings['Hide Ignored Requests'] = 'Hide Ignored Requests';
$a->strings['Claims to be known to you: '] = 'Claims to be known to you: ';
$a->strings['yes'] = 'yes';
$a->strings['no'] = 'no';
+$a->strings['Approve as: '] = 'Approve as: ';
+$a->strings['Friend'] = 'Friend';
+$a->strings['Fan/Admirer'] = 'Fan/Admirer';
$a->strings['Notification type: '] = 'Notification type: ';
$a->strings['Friend/Connect Request'] = 'Friend/Connect Request';
$a->strings['New Follower'] = 'New Follower';
diff --git a/view/de/netfriend.tpl b/view/de/netfriend.tpl
deleted file mode 100644
index 79a7a0940..000000000
--- a/view/de/netfriend.tpl
+++ /dev/null
@@ -1,14 +0,0 @@
-<div class="intro-approve-as-friend-desc">Genehmigen als: </div>
-
-<div class="intro-approve-as-friend-wrapper">
- <label class="intro-approve-as-friend-label" for="intro-approve-as-friend-$intro_id">Freund</label>
- <input type="radio" name="duplex" id="intro-approve-as-friend-$intro_id" class="intro-approve-as-friend" $friend_selected value="1" />
- <div class="intro-approve-friend-break" ></div>
-</div>
-<div class="intro-approve-as-friend-end"></div>
-<div class="intro-approve-as-fan-wrapper">
- <label class="intro-approve-as-fan-label" for="intro-approve-as-fan-$intro_id">Fan/Verehrer</label>
- <input type="radio" name="duplex" id="intro-approve-as-fan-$intro_id" class="intro-approve-as-fan" $fan_selected value="0" />
- <div class="intro-approve-fan-break"></div>
-</div>
-<div class="intro-approve-as-end"></div>
diff --git a/view/de/strings.php b/view/de/strings.php
index ef6892e8d..cc0319606 100644
--- a/view/de/strings.php
+++ b/view/de/strings.php
@@ -274,6 +274,9 @@ $a->strings['Hide Ignored Requests'] = 'Verberge ignorierte Anfragen';
$a->strings['Claims to be known to you: '] = 'Behauptet dich zu kennen: ';
$a->strings['yes'] = 'ja';
$a->strings['no'] = 'nein';
+$a->strings['Approve as: '] = 'Genehmigen als: ';
+$a->strings['Friend'] = 'Freund';
+$a->strings['Fan/Admirer'] = 'Fan/Verehrer';
$a->strings['Notification type: '] = 'Benachrichtigungs Typ: ';
$a->strings['Friend/Connect Request'] = 'Kontakt-/Freundschaftsanfrage';
$a->strings['New Follower'] = 'Neuer Bewunderer';
diff --git a/view/fr/netfriend.tpl b/view/fr/netfriend.tpl
deleted file mode 100644
index b041ec49f..000000000
--- a/view/fr/netfriend.tpl
+++ /dev/null
@@ -1,14 +0,0 @@
-<div class="intro-approve-as-friend-desc">Approve as: </div>
-
-<div class="intro-approve-as-friend-wrapper">
- <label class="intro-approve-as-friend-label" for="intro-approve-as-friend-$intro_id">Friend</label>
- <input type="radio" name="duplex" id="intro-approve-as-friend-$intro_id" class="intro-approve-as-friend" $friend_selected value="1" />
- <div class="intro-approve-friend-break" ></div>
-</div>
-<div class="intro-approve-as-friend-end"></div>
-<div class="intro-approve-as-fan-wrapper">
- <label class="intro-approve-as-fan-label" for="intro-approve-as-fan-$intro_id">Fan/Admirer</label>
- <input type="radio" name="duplex" id="intro-approve-as-fan-$intro_id" class="intro-approve-as-fan" $fan_selected value="0" />
- <div class="intro-approve-fan-break"></div>
-</div>
-<div class="intro-approve-as-end"></div>
diff --git a/view/fr/strings.php b/view/fr/strings.php
index 8bac6347f..cbcf11ead 100644
--- a/view/fr/strings.php
+++ b/view/fr/strings.php
@@ -262,6 +262,9 @@ $a->strings['Hide Ignored Requests'] = 'Cacher les demandes ignorées';
$a->strings['Claims to be known to you: '] = 'Prétend que vous le connaissez: ';
$a->strings['yes'] = 'oui';
$a->strings['no'] = 'non';
+$a->strings['Approve as: '] = 'Approuver en tant que: ';
+$a->strings['Friend'] = 'Ami';
+$a->strings['Fan/Admirer'] = 'Fan/Admirateur';
$a->strings['Notification type: '] = 'Type de notification: ';
$a->strings['Friend/Connect Request'] = 'Demande de connexion/relation';
$a->strings['New Follower'] = 'Nouvel abonné';
diff --git a/view/it/netfriend.tpl b/view/it/netfriend.tpl
deleted file mode 100644
index d1cdf1a98..000000000
--- a/view/it/netfriend.tpl
+++ /dev/null
@@ -1,14 +0,0 @@
-<div class="intro-approve-as-friend-desc">Approva come: </div>
-
-<div class="intro-approve-as-friend-wrapper">
- <label class="intro-approve-as-friend-label" for="intro-approve-as-friend-$intro_id">Amico</label>
- <input type="radio" name="duplex" id="intro-approve-as-friend-$intro_id" class="intro-approve-as-friend" $friend_selected value="1" />
- <div class="intro-approve-friend-break" ></div>
-</div>
-<div class="intro-approve-as-friend-end"></div>
-<div class="intro-approve-as-fan-wrapper">
- <label class="intro-approve-as-fan-label" for="intro-approve-as-fan-$intro_id">Fan/Ammiratore</label>
- <input type="radio" name="duplex" id="intro-approve-as-fan-$intro_id" class="intro-approve-as-fan" $fan_selected value="0" />
- <div class="intro-approve-fan-break"></div>
-</div>
-<div class="intro-approve-as-end"></div>
diff --git a/view/it/strings.php b/view/it/strings.php
index d04e02167..2b4a84d05 100644
--- a/view/it/strings.php
+++ b/view/it/strings.php
@@ -236,6 +236,9 @@ $a->strings['Hide Ignored Requests'] = 'Nascondi richieste ignorate';
$a->strings['Claims to be known to you: '] = 'Dice di conoscerti: ';
$a->strings['yes'] = 'si';
$a->strings['no'] = 'no';
+$a->strings['Approve as: '] = 'Approva come: ';
+$a->strings['Friend'] = 'Amico';
+$a->strings['Fan/Admirer'] = 'Fan/Admiratore';
$a->strings['Notification type: '] = 'Tipo di notifica: ';
$a->strings['Friend/Connect Request'] = 'Richiesta Amicizia/Connessione';
$a->strings['New Follower'] = 'Nuovo Seguace';
diff --git a/view/en/netfriend.tpl b/view/netfriend.tpl
index b041ec49f..c2a92ce9e 100644
--- a/view/en/netfriend.tpl
+++ b/view/netfriend.tpl
@@ -1,13 +1,13 @@
-<div class="intro-approve-as-friend-desc">Approve as: </div>
+<div class="intro-approve-as-friend-desc">$approve_as</div>
<div class="intro-approve-as-friend-wrapper">
- <label class="intro-approve-as-friend-label" for="intro-approve-as-friend-$intro_id">Friend</label>
+ <label class="intro-approve-as-friend-label" for="intro-approve-as-friend-$intro_id">$as_friend</label>
<input type="radio" name="duplex" id="intro-approve-as-friend-$intro_id" class="intro-approve-as-friend" $friend_selected value="1" />
<div class="intro-approve-friend-break" ></div>
</div>
<div class="intro-approve-as-friend-end"></div>
<div class="intro-approve-as-fan-wrapper">
- <label class="intro-approve-as-fan-label" for="intro-approve-as-fan-$intro_id">Fan/Admirer</label>
+ <label class="intro-approve-as-fan-label" for="intro-approve-as-fan-$intro_id">$as_fan</label>
<input type="radio" name="duplex" id="intro-approve-as-fan-$intro_id" class="intro-approve-as-fan" $fan_selected value="0" />
<div class="intro-approve-fan-break"></div>
</div>
diff --git a/view/theme/duepuntozero/style.css b/view/theme/duepuntozero/style.css
index 35ffe3a89..a820c381c 100644
--- a/view/theme/duepuntozero/style.css
+++ b/view/theme/duepuntozero/style.css
@@ -2019,3 +2019,9 @@ a.mail-list-link {
}
+.calendar {
+ font-family: Courier, monospace;
+}
+.today {
+ color: #FF0000;
+}
diff --git a/view/theme/loozah/style.css b/view/theme/loozah/style.css
index e4ebeda7e..145123aaf 100644
--- a/view/theme/loozah/style.css
+++ b/view/theme/loozah/style.css
@@ -2065,3 +2065,11 @@ a.mail-list-link {
.tool-link {
cursor: pointer;
}
+
+
+.calendar {
+ font-family: Courier, monospace;
+}
+.today {
+ color: #FF0000;
+}