diff options
author | friendica <info@friendica.com> | 2012-06-25 20:55:27 -0700 |
---|---|---|
committer | friendica <info@friendica.com> | 2012-06-25 20:55:27 -0700 |
commit | fbaca4b74237c80c380d6ccf2bdddeec5ad4f013 (patch) | |
tree | ca1ca05c84f8bd17acab9749b674d3b23fdcd2a5 | |
parent | 53f0aee82d61b7d61fb2271eb7f41cacc2eaf8f3 (diff) | |
download | volse-hubzilla-fbaca4b74237c80c380d6ccf2bdddeec5ad4f013.tar.gz volse-hubzilla-fbaca4b74237c80c380d6ccf2bdddeec5ad4f013.tar.bz2 volse-hubzilla-fbaca4b74237c80c380d6ccf2bdddeec5ad4f013.zip |
event summary/title
-rw-r--r-- | boot.php | 2 | ||||
-rw-r--r-- | database.sql | 10 | ||||
-rw-r--r-- | include/bbcode.php | 1 | ||||
-rw-r--r-- | include/event.php | 16 | ||||
-rwxr-xr-x | mod/events.php | 14 | ||||
-rw-r--r-- | update.php | 11 | ||||
-rw-r--r-- | view/event_form.tpl | 4 | ||||
-rwxr-xr-x | view/theme/diabook/jot.tpl | 2 | ||||
-rw-r--r-- | view/theme/duepuntozero/style.css | 7 |
9 files changed, 58 insertions, 9 deletions
@@ -12,7 +12,7 @@ require_once('include/cache.php'); define ( 'FRIENDICA_PLATFORM', 'Friendica'); define ( 'FRIENDICA_VERSION', '3.0.1385' ); define ( 'DFRN_PROTOCOL_VERSION', '2.23' ); -define ( 'DB_UPDATE_VERSION', 1150 ); +define ( 'DB_UPDATE_VERSION', 1151 ); define ( 'EOL', "<br />\r\n" ); define ( 'ATOM_TIME', 'Y-m-d\TH:i:s\Z' ); diff --git a/database.sql b/database.sql index 8178ffa86..b3b8c3a06 100644 --- a/database.sql +++ b/database.sql @@ -254,6 +254,7 @@ CREATE TABLE IF NOT EXISTS `event` ( `edited` datetime NOT NULL, `start` datetime NOT NULL, `finish` datetime NOT NULL, + `summary` text NOT NULL, `desc` text NOT NULL, `location` text NOT NULL, `type` char(255) NOT NULL, @@ -263,7 +264,14 @@ CREATE TABLE IF NOT EXISTS `event` ( `allow_gid` mediumtext NOT NULL, `deny_cid` mediumtext NOT NULL, `deny_gid` mediumtext NOT NULL, - PRIMARY KEY (`id`) + PRIMARY KEY (`id`), + KEY `uid` ( `uid` ), + KEY `cid` ( `cid` ), + KEY `uri` ( `uri` ), + KEY `type` ( `type` ), + KEY `start` ( `start` ), + KEY `finish` ( `finish` ), + KEY `adjust` ( `adjust` ) ) ENGINE=MyISAM DEFAULT CHARSET=utf8; -- -------------------------------------------------------- diff --git a/include/bbcode.php b/include/bbcode.php index e219d5383..effdd0be8 100644 --- a/include/bbcode.php +++ b/include/bbcode.php @@ -301,6 +301,7 @@ function bbcode($Text,$preserve_nl = false, $tryoembed = true) { if(x($ev,'desc') && x($ev,'start')) { $sub = format_event_html($ev); + $Text = preg_replace("/\[event\-summary\](.*?)\[\/event\-summary\]/ism",'',$Text); $Text = preg_replace("/\[event\-description\](.*?)\[\/event\-description\]/ism",$sub,$Text); $Text = preg_replace("/\[event\-start\](.*?)\[\/event\-start\]/ism",'',$Text); $Text = preg_replace("/\[event\-finish\](.*?)\[\/event\-finish\]/ism",'',$Text); diff --git a/include/event.php b/include/event.php index 866ae8c3f..8aef0a263 100644 --- a/include/event.php +++ b/include/event.php @@ -12,6 +12,9 @@ function format_event_html($ev) { $o = '<div class="vevent">' . "\r\n"; + + $o .= '<p class="summary event-summary">' . bbcode($ev['summary']) . '</p>' . "\r\n"; + $o .= '<p class="description event-description">' . bbcode($ev['desc']) . '</p>' . "\r\n"; $o .= '<p class="event-start">' . t('Starts:') . ' <abbr class="dtstart" title="' @@ -114,6 +117,9 @@ function format_event_bbcode($ev) { $o = ''; + if($ev['summary']) + $o .= '[event-summary]' . $ev['summary'] . '[/event-summary]'; + if($ev['desc']) $o .= '[event-description]' . $ev['desc'] . '[/event-description]'; @@ -148,6 +154,9 @@ function bbtoevent($s) { $ev = array(); $match = ''; + if(preg_match("/\[event\-summary\](.*?)\[\/event\-summary\]/is",$s,$match)) + $ev['summary'] = $match[1]; + $match = ''; if(preg_match("/\[event\-description\](.*?)\[\/event\-description\]/is",$s,$match)) $ev['desc'] = $match[1]; $match = ''; @@ -244,6 +253,7 @@ function event_store($arr) { `edited` = '%s', `start` = '%s', `finish` = '%s', + `summary` = '%s', `desc` = '%s', `location` = '%s', `type` = '%s', @@ -258,6 +268,7 @@ function event_store($arr) { dbesc($arr['edited']), dbesc($arr['start']), dbesc($arr['finish']), + dbesc($arr['summary']), dbesc($arr['desc']), dbesc($arr['location']), dbesc($arr['type']), @@ -306,9 +317,9 @@ function event_store($arr) { // New event. Store it. - $r = q("INSERT INTO `event` ( `uid`,`cid`,`uri`,`created`,`edited`,`start`,`finish`,`desc`,`location`,`type`, + $r = q("INSERT INTO `event` ( `uid`,`cid`,`uri`,`created`,`edited`,`start`,`finish`,`summary`, `desc`,`location`,`type`, `adjust`,`nofinish`,`allow_cid`,`allow_gid`,`deny_cid`,`deny_gid`) - VALUES ( %d, %d, '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', %d, %d, '%s', '%s', '%s', '%s' ) ", + VALUES ( %d, %d, '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', %d, %d, '%s', '%s', '%s', '%s' ) ", intval($arr['uid']), intval($arr['cid']), dbesc($arr['uri']), @@ -316,6 +327,7 @@ function event_store($arr) { dbesc($arr['edited']), dbesc($arr['start']), dbesc($arr['finish']), + dbesc($arr['summary']), dbesc($arr['desc']), dbesc($arr['location']), dbesc($arr['type']), diff --git a/mod/events.php b/mod/events.php index 2a6fb692e..e7b95d27a 100755 --- a/mod/events.php +++ b/mod/events.php @@ -57,6 +57,7 @@ function events_post(&$a) { if(strcmp($finish,$start) < 0) $finish = $start; + $summary = escape_tags(trim($_POST['summary'])); $desc = escape_tags(trim($_POST['desc'])); $location = escape_tags(trim($_POST['location'])); $type = 'event'; @@ -107,6 +108,7 @@ function events_post(&$a) { $datarray = array(); $datarray['start'] = $start; $datarray['finish'] = $finish; + $datarray['summary'] = $summary; $datarray['desc'] = $desc; $datarray['location'] = $location; $datarray['type'] = $type; @@ -278,9 +280,11 @@ function events_content(&$a) { $last_date = $d; $edit = ((! $rr['cid']) ? array($a->get_baseurl().'/events/event/'.$rr['id'],t('Edit event'),'','') : null); - - list($title, $_trash) = explode("<br",bbcode($rr['desc']),2); - $title = strip_tags($title); + $title = strip_tags(bbcode($rr['summary'])); + if(! $title) { + list($title, $_trash) = explode("<br",bbcode($rr['desc']),2); + $title = strip_tags($title); + } $html = format_event_html($rr); $rr['desc'] = bbcode($rr['desc']); $rr['location'] = bbcode($rr['location']); @@ -351,6 +355,7 @@ function events_content(&$a) { $n_checked = ((x($orig_event) && $orig_event['nofinish']) ? ' checked="checked" ' : ''); $a_checked = ((x($orig_event) && $orig_event['adjust']) ? ' checked="checked" ' : ''); + $t_orig = ((x($orig_event)) ? $orig_event['summary'] : ''); $d_orig = ((x($orig_event)) ? $orig_event['desc'] : ''); $l_orig = ((x($orig_event)) ? $orig_event['location'] : ''); $eid = ((x($orig_event)) ? $orig_event['id'] : 0); @@ -405,6 +410,7 @@ function events_content(&$a) { '$eid' => $eid, '$cid' => $cid, '$uri' => $uri, + '$title' => t('Event details'), '$desc' => sprintf( t('Format is %s %s. Starting date and Description are required.'),$dateformat,$timeformat), @@ -422,6 +428,8 @@ function events_content(&$a) { '$d_orig' => $d_orig, '$l_text' => t('Location:'), '$l_orig' => $l_orig, + '$t_text' => t('Title:'), + '$t_orig' => $t_orig, '$sh_text' => t('Share this event'), '$sh_checked' => $sh_checked, '$acl' => (($cid) ? '' : populate_acl(((x($orig_event)) ? $orig_event : $a->user),false)), diff --git a/update.php b/update.php index eeb8b07b1..b8e247f57 100644 --- a/update.php +++ b/update.php @@ -1,6 +1,6 @@ <?php -define( 'UPDATE_VERSION' , 1150 ); +define( 'UPDATE_VERSION' , 1151 ); /** * @@ -1298,3 +1298,12 @@ function update_1149() { return UPDATE_FAILED; return UPDATE_SUCCESS; } + + +function update_1150() { + $r = q("ALTER TABLE event ADD summary text NOT NULL after finish, add index ( uid ), add index ( cid ), add index ( uri ), add index ( `start` ), add index ( finish ), add index ( `type` ), add index ( adjust ) "); + if(! $r) + return UPDATE_FAILED; + return UPDATE_SUCCESS; +} + diff --git a/view/event_form.tpl b/view/event_form.tpl index 7d5f8cf4a..536c52b0f 100644 --- a/view/event_form.tpl +++ b/view/event_form.tpl @@ -26,6 +26,10 @@ $f_dsel $f_tsel <div id="event-adjust-break"></div> +<div id="event-summary-text">$t_text</div> +<input type="text" id="event-summary" name="summary" value="$t_orig" /> + + <div id="event-desc-text">$d_text</div> <textarea id="event-desc-textarea" name="desc">$d_orig</textarea> diff --git a/view/theme/diabook/jot.tpl b/view/theme/diabook/jot.tpl index 79151aeed..1d94cb6d3 100755 --- a/view/theme/diabook/jot.tpl +++ b/view/theme/diabook/jot.tpl @@ -70,7 +70,7 @@ <div style="display: none;"> <div id="profile-jot-acl-wrapper" style="width:auto;height:auto;overflow:auto;"> $acl - <hr style="clear:both"/> + <hr style="clear:both;"/> <div id="profile-jot-email-label">$emailcc</div><input type="text" name="emailcc" id="profile-jot-email" title="$emtitle" /> <div id="profile-jot-email-end"></div> $jotnets diff --git a/view/theme/duepuntozero/style.css b/view/theme/duepuntozero/style.css index ea3a2da9c..41c747045 100644 --- a/view/theme/duepuntozero/style.css +++ b/view/theme/duepuntozero/style.css @@ -2424,6 +2424,13 @@ aside input[type='text'] { .vevent { border: 1px solid #CCCCCC; } + +.vevent .event-summary { + margin-left: 10px; + margin-right: 10px; + font-weight: bold; +} + .vevent .event-description, .vevent .event-location { margin-left: 10px; margin-right: 10px; |