diff -r 0d35b479f0dfd864c5a82cdc885f530efa9d05ba -r 855019377dec53d0cb690fb49ff1edc1c165f982 indefero/src/IDF/FileUtil.php --- a/indefero/src/IDF/FileUtil.php Tue Mar 11 21:01:25 2014 -0500 +++ b/indefero/src/IDF/FileUtil.php Wed Mar 12 21:30:54 2014 -0500 @@ -38,6 +38,10 @@ 'skin', 'sln', 'svc', 'vala', 'vb', 'vbproj', 'vbs', 'wsdl', 'xhtml', 'xml', 'xsd', 'xsl', 'xslt'); + public static $map = array("h" => "cpp", "hpp" => "cpp", "rc"=>"text", "sh"=>"bash", "cs"=>"csharp"); + + public static $syntaxhighlightext = array("as3", "cf", "cpp", "c", "css", "pas", "diff", "patch", "erl", "java", "jfx", "js", "pl", "php", "py", "rb", "sass", "scss", "scala", "sql", "vb", ); + /** * Test if an extension is supported by the syntax highlighter. * @@ -72,7 +76,14 @@ } return Pluf_Template::markSafe(implode("\n", $table));*/ //var_dump($fileinfo); - $content = ''; + $ext = ""; + if (in_array($fileinfo[2], self::$syntaxhighlightext)) + $ext = $fileinfo[2]; + elseif (array_key_exists($fileinfo[2], self::$map)) + $ext = self::$map[$fileinfo[2]]; + else + $ext = "text"; + $content = ''; return Pluf_Template::markSafe($content); } diff -r 0d35b479f0dfd864c5a82cdc885f530efa9d05ba -r 855019377dec53d0cb690fb49ff1edc1c165f982 indefero/src/IDF/Form/ProjectConf.php --- a/indefero/src/IDF/Form/ProjectConf.php Tue Mar 11 21:01:25 2014 -0500 +++ b/indefero/src/IDF/Form/ProjectConf.php Wed Mar 12 21:30:54 2014 -0500 @@ -33,7 +33,17 @@ { $this->project = $extra['project']; $this->user = $extra["user"]; - $conf = $this->project->getConf(); + $conf = $this->project->getConf(); + $options = array( + 'Default' => __('Default'), + 'Django' => __('Django'), + 'Eclipse' => __('Eclipse'), + 'Emacs' => __('Emacs'), + 'FadeToGrey' => __('FadeToGrey'), + 'MDUltra' => __('MDUltra'), + 'Midnight' => __('Midnight'), + 'RDark' => __('RDark'), + ); // Basic part $this->fields['name'] = new Pluf_Form_Field_Varchar(array('required' => true, @@ -59,6 +69,15 @@ 'initial' => $conf->getVal('external_project_url'), )); + + $this->fields['syntaxtheme'] = new Pluf_Form_Field_Varchar( + array('required' => true, + 'label' => __('Syntax Highlight Theme'), + 'initial' => ($this->project->syntaxtheme) ? $this->project->syntaxtheme : "Default", + 'widget_attrs' => array('choices' => $options), + 'widget' => 'Pluf_Form_Widget_SelectInput', + )); + if ($this->user->administrator) { $this->fields['enableads'] = new Pluf_Form_Field_Boolean( @@ -208,6 +227,7 @@ $this->project->shortdesc = $this->cleaned_data['shortdesc']; $this->project->description = $this->cleaned_data['description']; $this->project->batchAssoc('IDF_Tag', $tagids); + $this->project->syntaxtheme = $this->cleaned_data["syntaxtheme"]; if ($this->user->administrator) $this->project->enableads = $this->cleaned_data['enableads']; $this->project->update(); diff -r 0d35b479f0dfd864c5a82cdc885f530efa9d05ba -r 855019377dec53d0cb690fb49ff1edc1c165f982 indefero/src/IDF/Migrations/29EnableAds.php --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/indefero/src/IDF/Migrations/29EnableAds.php Wed Mar 12 21:30:54 2014 -0500 @@ -0,0 +1,36 @@ +getSqlTable(); + + $sql = array(); + + $sql["MySQL"] = "ALTER TABLE " . $table . " ADD COLUMN `enableads` int(11) NULL AFTER `current_activity`;"; + + $db = Pluf::db(); + $engine = Pluf::f('db_engine'); + if (!isset($sql[$engine])) { + throw new Exception('SQLite complex migration not supported.'); + } + + $db->execute($sql[$engine]); + +} + +function IDF_Migrations_28OTPKey_down() +{ + $table = Pluf::factory('IDF_Project')->getSqlTable(); + + $sql = array(); + + $sql["MySQL"] = "ALTER TABLE " . $table . " DROP COLUMN `enableads`;"; + + $db = Pluf::db(); + $engine = Pluf::f('db_engine'); + if (!isset($sql[$engine])) { + throw new Exception('SQLite complex migration not supported.'); + } + + $db->execute($sql[$engine]); +} \ No newline at end of file diff -r 0d35b479f0dfd864c5a82cdc885f530efa9d05ba -r 855019377dec53d0cb690fb49ff1edc1c165f982 indefero/src/IDF/Migrations/30SyntaxHighlightTheme.php --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/indefero/src/IDF/Migrations/30SyntaxHighlightTheme.php Wed Mar 12 21:30:54 2014 -0500 @@ -0,0 +1,36 @@ +getSqlTable(); + + $sql = array(); + + $sql["MySQL"] = "ALTER TABLE " . $table . " ADD COLUMN `syntaxtheme` VARCHAR(50) NULL AFTER `enableads`;"; + + $db = Pluf::db(); + $engine = Pluf::f('db_engine'); + if (!isset($sql[$engine])) { + throw new Exception('SQLite complex migration not supported.'); + } + + $db->execute($sql[$engine]); + +} + +function IDF_Migrations_28OTPKey_down() +{ + $table = Pluf::factory('IDF_Project')->getSqlTable(); + + $sql = array(); + + $sql["MySQL"] = "ALTER TABLE " . $table . " DROP COLUMN `syntaxtheme`;"; + + $db = Pluf::db(); + $engine = Pluf::f('db_engine'); + if (!isset($sql[$engine])) { + throw new Exception('SQLite complex migration not supported.'); + } + + $db->execute($sql[$engine]); +} \ No newline at end of file diff -r 0d35b479f0dfd864c5a82cdc885f530efa9d05ba -r 855019377dec53d0cb690fb49ff1edc1c165f982 indefero/src/IDF/Project.php --- a/indefero/src/IDF/Project.php Tue Mar 11 21:01:25 2014 -0500 +++ b/indefero/src/IDF/Project.php Wed Mar 12 21:30:54 2014 -0500 @@ -116,6 +116,15 @@ 'verbose' => __('enableads'), 'default' => 1, ), + + 'syntaxtheme' => + array( + 'type' => 'Pluf_DB_Field_Text', + 'blank' => false, + 'verbose' => __('syntaxtheme'), + 'default' => "Default", + "size" => 50 + ) ); $activityTable = $this->_con->pfx.'idf_projectactivities'; $tagTable = $this->_con->pfx.'idf_project_idf_tag_assoc'; diff -r 0d35b479f0dfd864c5a82cdc885f530efa9d05ba -r 855019377dec53d0cb690fb49ff1edc1c165f982 indefero/src/IDF/conf/urls.php --- a/indefero/src/IDF/conf/urls.php Tue Mar 11 21:01:25 2014 -0500 +++ b/indefero/src/IDF/conf/urls.php Wed Mar 12 21:30:54 2014 -0500 @@ -29,6 +29,13 @@ 'model' => 'IDF_Views', 'method' => 'index'); +$ctl[] = array('regex' => '#^/u/(.*)/$#', + 'base' => $base, + 'model' => 'IDF_Views_User', + 'method' => 'view', + 'name' => 'idf_user_view'); + + $ctl[] = array('regex' => '#^/projects/$#', 'base' => $base, 'model' => 'IDF_Views', diff -r 0d35b479f0dfd864c5a82cdc885f530efa9d05ba -r 855019377dec53d0cb690fb49ff1edc1c165f982 indefero/src/IDF/templates/idf/admin/summary.html --- a/indefero/src/IDF/templates/idf/admin/summary.html Tue Mar 11 21:01:25 2014 -0500 +++ b/indefero/src/IDF/templates/idf/admin/summary.html Wed Mar 12 21:30:54 2014 -0500 @@ -76,6 +76,13 @@