[Phpbbproject-svn] SF.net SVN: phpbbproject: [268] trunk/phpbb3/root
phpBB download manager, mainly aimed at MOD authors
Status: Planning
Brought to you by:
lord_le_brand
From: <lor...@us...> - 2008-04-23 23:59:38
|
Revision: 268 http://phpbbproject.svn.sourceforge.net/phpbbproject/?rev=268&view=rev Author: lord_le_brand Date: 2008-04-23 16:59:42 -0700 (Wed, 23 Apr 2008) Log Message: ----------- Create project functionally done (if it works that is...) Fixed small errors in download class Tidied up some code Modified Paths: -------------- trunk/phpbb3/root/includes/project/project_main.php trunk/phpbb3/root/includes/project/project_project.php trunk/phpbb3/root/includes/sources_project/constants.php trunk/phpbb3/root/includes/sources_project/create_project.php trunk/phpbb3/root/includes/sources_project/download_project.php trunk/phpbb3/root/includes/sources_project/extensions.php trunk/phpbb3/root/styles/prosilver/template/project_create.html Modified: trunk/phpbb3/root/includes/project/project_main.php =================================================================== --- trunk/phpbb3/root/includes/project/project_main.php 2008-04-23 22:53:55 UTC (rev 267) +++ trunk/phpbb3/root/includes/project/project_main.php 2008-04-23 23:59:42 UTC (rev 268) @@ -15,7 +15,7 @@ */ class project_main { - var $u_action; + public $u_action; /** * Main method @@ -332,7 +332,7 @@ if ($import->error) { - trigger_error($user->lang['PROJECT_IMPORT_FAILURE'] . ':<br /><br />' . $message, E_USER_WARNING); + trigger_error($user->lang['PROJECT_IMPORT_FAILURE'] . ':<br /><br />' . $import->error, E_USER_WARNING); } } @@ -365,6 +365,18 @@ 'file_only' => (request_var('file_only', false)) ? true : false, ); + $sql = 'SELECT role_id + FROM ' . ACL_ROLES_TABLE . ' + WHERE role_name = \'ROLE_PROJECT_MANAGER\''; + $result = $db->sql_query($sql, 604800); + $role_manager = $db->sql_fetchfield('role_id', false, $result); + $db->sql_freeresult($result); + + $authors = array(array( + 'author_id' => $user->data['user_id'], + 'author_role' => $role_manager, + )); + // Validate the title (Check duplicate, length, invalid chars, etc.) if (false !== ($title_err = validate_project_title($data['project_title']))) { @@ -408,8 +420,51 @@ )); } + $acl_categories = array_keys($auth->acl_getf('p_view_category', true)); + $category_ids = $db->sql_in_set('category_id', $acl_categories, false, true); + + $sql = 'SELECT * + FROM ' . PROJECT_CATEGORIES_TABLE . " + WHERE $category_ids + ORDER BY left_id ASC"; + $result = $db->sql_query($sql, 604800); + $categories = $db->sql_fetchrowset($result); + $db->sql_freeresult($result); + + $parent_id = 0; + $padding = 0; + + $padding_delimiter = '--'; + + for ($i = 0, $size = sizeof($categories); $i < $size; $i++) + { + if ($parent_id != $categories[$i]['category_id']) + { + $padding += ($categories[$i]['left_id'] > $categories[$i-1]['left_id']) ? 1 : -1; + } + + $template->assign_block_vars('category', array( + 'CATEGORY_ID' => $categories[$i]['category_id'], + 'CATEGORY_NAME' => str_repeat($padding_delimiter, $padding) . $categories[$i]['category_name'], + )); + } + + $sql = 'SELECT license_id, license_title + FROM ' . PROJECT_LICENSES_TABLE; + $result = $db->sql_query($sql, 604800); + $licenses = $db->sql_fetchrowset($result); + $db->sql_freeresult($result); + + for ($i = 0, $size = sizeof($licenses); $i < $size; $i++) + { + $template->assign_block_vars('license', array( + 'LICENSE_ID' => $licenses[$i]['license_id'], + 'LICENSE_TITLE' => $licenses[$i]['license_title'], + )); + } + /** - * @todo Add queries for categories and licenses + * @todo Add description javascript + query */ add_form_key('project_create'); Modified: trunk/phpbb3/root/includes/project/project_project.php =================================================================== --- trunk/phpbb3/root/includes/project/project_project.php 2008-04-23 22:53:55 UTC (rev 267) +++ trunk/phpbb3/root/includes/project/project_project.php 2008-04-23 23:59:42 UTC (rev 268) @@ -15,8 +15,8 @@ */ class project_project { - var $u_action; - var $tpl_name; + public $u_action; + public $tpl_name; /** * Main method @@ -26,8 +26,8 @@ */ function main($id, $mode) { - global $auth, $db, $user, $template; - global $config, $phpbb_root_path, $phpEx; + global $db, $user, $template; + global $phpbb_root_path, $phpEx; global $project_id, $category_id; switch ($mode) Modified: trunk/phpbb3/root/includes/sources_project/constants.php =================================================================== --- trunk/phpbb3/root/includes/sources_project/constants.php 2008-04-23 22:53:55 UTC (rev 267) +++ trunk/phpbb3/root/includes/sources_project/constants.php 2008-04-23 23:59:42 UTC (rev 268) @@ -4,7 +4,6 @@ * * @package phpbbproject * @version $Id$ - * @author Lord Le Brand <lor...@ho...> * @copyright (c) 2008 phpBB Project Team * @license http://opensource.org/licenses/gpl-license.php GNU Public License */ Modified: trunk/phpbb3/root/includes/sources_project/create_project.php =================================================================== --- trunk/phpbb3/root/includes/sources_project/create_project.php 2008-04-23 22:53:55 UTC (rev 267) +++ trunk/phpbb3/root/includes/sources_project/create_project.php 2008-04-23 23:59:42 UTC (rev 268) @@ -29,7 +29,7 @@ */ public function __construct($data, $authors) { - global $auth, $user, $config; + global $auth, $user; // Check permissions if (!$auth->acl_get('p_add_project')) @@ -90,12 +90,12 @@ $this->data['project_id'] = $project_id = $db->sql_nextid(); // Add all authors - for ($i = 0, $size = sizeof($authors); $i < $size; $i++) + for ($i = 0, $size = sizeof($this->authors); $i < $size; $i++) { $db->sql_query('INSERT INTO ' . PROJECT_PROJECT_AUTHORS_TABLE . $db->sql_build_array('INSERT', array( 'project_id' => $project_id, - 'author_id' => $authors[$i]['author_id'], - 'author_role' => $authors[$i]['author_role_id'] + 'author_id' => $this->authors[$i]['author_id'], + 'author_role' => $this->authors[$i]['author_role_id'] ))); } @@ -199,12 +199,12 @@ $this->data['project_id'] = $project_id = $db->sql_nextid(); // Add all authors - for ($i = 0, $size = sizeof($authors); $i < $size; $i++) + for ($i = 0, $size = sizeof($this->authors); $i < $size; $i++) { $db->sql_query('INSERT INTO ' . PROJECT_PROJECT_AUTHORS_TABLE . $db->sql_build_array('INSERT', array( 'project_id' => $project_id, - 'author_id' => $authors[$i]['author_id'], - 'author_role' => $authors[$i]['author_role_id'] + 'author_id' => $this->authors[$i]['author_id'], + 'author_role' => $this->authors[$i]['author_role_id'] ))); } Modified: trunk/phpbb3/root/includes/sources_project/download_project.php =================================================================== --- trunk/phpbb3/root/includes/sources_project/download_project.php 2008-04-23 22:53:55 UTC (rev 267) +++ trunk/phpbb3/root/includes/sources_project/download_project.php 2008-04-23 23:59:42 UTC (rev 268) @@ -57,6 +57,7 @@ global $db; $this->project_id = $project_id; + $this->archive_type = $archive_type; $this->download_type = ($download_type == PROJECT_DOWNLOAD_EXPORT) ? PROJECT_DOWNLOAD_EXPORT : PROJECT_DOWNLOAD_NORMAL; $version_id = request_var('version_id', 0); @@ -103,7 +104,7 @@ if (in_array($this->archive_type, array('tar.gz', 'tar.bz2', 'tgz'))) { $mode = (file_exists("{$phpbb_root_path}store/phpbbproject/projects/downloads/$filename.$this->archive_type")) ? 'r' : 'w'; - $package = new compress_tar($mode, "{$phpbb_root_path}store/phpbbproject/projects/downloads/$filename.$this->archive_type"); + $this->package = new compress_tar($mode, "{$phpbb_root_path}store/phpbbproject/projects/downloads/$filename.$this->archive_type"); } else { @@ -213,7 +214,7 @@ */ protected function get_history() { - global $db; + global $db, $user; $stages_ary = array( PROJECT_STAGE_ALPHA => $user->lang['PROJECT_STAGE_ALPHA'], Modified: trunk/phpbb3/root/includes/sources_project/extensions.php =================================================================== --- trunk/phpbb3/root/includes/sources_project/extensions.php 2008-04-23 22:53:55 UTC (rev 267) +++ trunk/phpbb3/root/includes/sources_project/extensions.php 2008-04-23 23:59:42 UTC (rev 268) @@ -33,8 +33,6 @@ */ function module_auth($module_auth, $forum_id = false, $category_id = false, $project_id = false) { - global $auth, $config; - $module_auth = trim($module_auth); // Generally allowed to access module if module_auth is empty Modified: trunk/phpbb3/root/styles/prosilver/template/project_create.html =================================================================== --- trunk/phpbb3/root/styles/prosilver/template/project_create.html 2008-04-23 22:53:55 UTC (rev 267) +++ trunk/phpbb3/root/styles/prosilver/template/project_create.html 2008-04-23 23:59:42 UTC (rev 268) @@ -2,11 +2,11 @@ <h2>{L_PROJECT_CREATE_PROJECT}</h2> -<div class="panel"> - <div class="inner"> - <span class="corners-top"><span></span></span> +<form id="project_create" action="{U_ACTION}" method="post"{S_FORM_ENCTYPE}> + <div class="panel"> + <div class="inner"> + <span class="corners-top"><span></span></span> - <form action="{U_ACTION}" method="post"> <fieldset class="fields2"> <!-- IF ERROR --><dl><dd class="error">{ERROR}</dd></dl><!-- ENDIF --> <dl> @@ -32,18 +32,23 @@ <dd><select tabindex="5" name="project_license" id="project_license" title="{L_PROJECT_LICENSE}" onchange="set_description(this.value)"><!-- BEGIN license --> <option value="{license.LICENSE_ID}"<!-- IF (license.S_STANDARD && not PROJECT_LICENSE) || license.LICENSE_ID == PROJECT_LICENSE --> selected="selected"<!-- ENDIF -->>{license.LICENSE_TITLE}</option><!-- END --> </select> - <span id="license_description">{LICENSE_DESCRIPTION}</span></dd> + <!--noscript><input type="submit" name="license_description" value="{L_PROJECT_DISPLAY_LICENSE_DESC}" class="button2" /></noscript> + <span id="license_description">{LICENSE_DESCRIPTION}</span--></dd> </dl> <dl> <dt><label for="file_only">{L_PROJECT_FILE_ONLY}:</label><br /><span>{L_PROJECT_FILE_ONLY_EXPLAIN}</span></dt> <dd><input type="checkbox" tabindex="6" name="file_only" id="file_only"<!-- IF FILE_ONLY --> checked="checked"<!-- ENDIF --> /></dd> </dl> - {S_FORM_TOKEN} </fieldset> - </form> - - <span class="corners-bottom"><span></span></span> + <span class="corners-bottom"><span></span></span> + </div> </div> -</div> + <fieldset class="submit-buttons"> + {S_HIDDEN_FIELDS}<input type="reset" value="{L_RESET}" name="reset" class="button2" /> + <input type="submit" name="submit" value="{L_SUBMIT}" class="button1" /> + {S_FORM_TOKEN} + </fieldset> +</form> + <!-- INCLUDE project_footer.html --> \ No newline at end of file This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |