diff --git a/codepot/src/codepot/models/subversionmodel.php b/codepot/src/codepot/models/subversionmodel.php index 8ffb2581..dda53a9c 100644 --- a/codepot/src/codepot/models/subversionmodel.php +++ b/codepot/src/codepot/models/subversionmodel.php @@ -93,7 +93,30 @@ class SubversionModel extends Model $prop = @svn_proplist ($workurl, FALSE, $rev); if ($prop === FALSE) return FALSE; - $fileinfo['properties'] = array_key_exists($orgurl, $prop)? $prop[$orgurl]: NULL; + //$fileinfo['properties'] = array_key_exists($orgurl, $prop)? $prop[$orgurl]: NULL; + $fileinfo['properties'] = NULL; + foreach ($prop as $k => $v) + { + if ($k == $orgurl || $k == $workurl) + { + $fileinfo['properties'] = $v; + break; + } + else + { + // it looks like the subversion module returns a URL-encoded + // path when it contains a whitespace and the revision is given. + // for example, "UOML SAMPLE.ODT" is returned as "UOML%20SAMPLE.ODT" + // when revision is specified. let's work around it. + $decurl = urldecode($k); + if ($decurl == $orgurl || $decurl == $workurl) + { + $fileinfo['properties'] = $v; + break; + } + } + } + $fileinfo['logmsg'] = (count($log) > 0)? $log[0]['msg']: ''; } @@ -133,7 +156,26 @@ class SubversionModel extends Model $prop = @svn_proplist ($workurl, FALSE, $rev); if ($prop === FALSE) return FALSE; - $fileinfo['properties'] = array_key_exists($orgurl, $prop)? $prop[$orgurl]: NULL; + //$fileinfo['properties'] = array_key_exists($orgurl, $prop)? $prop[$orgurl]: NULL; + $fileinfo['properties'] = NULL; + foreach ($prop as $k => $v) + { + if ($k == $orgurl || $k == $workurl) + { + $fileinfo['properties'] = $v; + break; + } + else + { + $decurl = urldecode($k); + if ($decurl == $orgurl || $decurl == $workurl) + { + $fileinfo['properties'] = $v; + break; + } + } + } + $fileinfo['logmsg'] = (count($log) > 0)? $log[0]['msg']: ''; } @@ -188,7 +230,25 @@ class SubversionModel extends Model $prop = @svn_proplist ($workurl, FALSE, $rev); if ($prop === FALSE) return FALSE; - $fileinfo['properties'] = array_key_exists($orgurl, $prop)? $prop[$orgurl]: NULL; + //$fileinfo['properties'] = array_key_exists($orgurl, $prop)? $prop[$orgurl]: NULL; + $fileinfo['properties'] = NULL; + foreach ($prop as $k => $v) + { + if ($k == $orgurl || $k == $workurl) + { + $fileinfo['properties'] = $v; + break; + } + else + { + $decurl = urldecode($k); + if ($decurl == $orgurl || $decurl == $workurl) + { + $fileinfo['properties'] = $v; + break; + } + } + } $log = @svn_log ($workurl, $fileinfo['created_rev'], diff --git a/codepot/src/codepot/views/code_file.php b/codepot/src/codepot/views/code_file.php index 22e9c111..46969f63 100644 --- a/codepot/src/codepot/views/code_file.php +++ b/codepot/src/codepot/views/code_file.php @@ -7,6 +7,7 @@ $is_image_file = FALSE; $is_pdf_file = FALSE; + $is_odf_file = FALSE; $is_special_stream = FALSE; if (array_key_exists('properties', $file) && count($file['properties']) > 0) { @@ -17,7 +18,7 @@ if ($pv == 'application/octet-stream') { $lower_fileext = strtolower($fileext); - if (in_array ($lower_fileext, array ('png', 'jpg', 'gif', 'tif', 'bmp', 'ico'))) + if (in_array ($lower_fileext, array ('png', 'jpg', 'jpeg', 'gif', 'tif', 'bmp', 'ico'))) { $img = @imagecreatefromstring ($file['content']); if ($img !== FALSE) @@ -34,6 +35,12 @@ $is_pdf_file = TRUE; break; } + else if (in_array ($lower_fileext, array ('odt', 'odp', 'ods'))) + { + $is_special_stream = TRUE; + $is_odf_file = TRUE; + break; + } } else if ($pv == 'application/pdf') { @@ -41,6 +48,14 @@ $is_pdf_file = TRUE; break; } + else if ($pv == 'application/vnd.oasis.opendocument.text' || + $pv == 'application/vnd.oasis.opendocument.presentation' || + $pv == 'application/vnd.oasis.opendocument.spreadsheet') + { + $is_special_stream = TRUE; + $is_odf_file = TRUE; + break; + } } } } @@ -75,6 +90,10 @@ if ($is_pdf_file) { printf ('', base_url_make('/js/pdf.min.js')); } +else if ($is_odf_file) +{ + printf ('', base_url_make('/js/webodf.js')); +} $enstyle_anchor_text = ' ' . $this->lang->line('Enstyle'); $destyle_anchor_text = ' ' . $this->lang->line('Destyle'); @@ -99,24 +118,6 @@ else ?>