Skip to content

Commit

Permalink
Wrong path to the images-set corrected.
Browse files Browse the repository at this point in the history
  • Loading branch information
René Sato committed Dec 19, 2011
0 parents commit e8f9f25
Show file tree
Hide file tree
Showing 124 changed files with 4,244 additions and 0 deletions.
14 changes: 14 additions & 0 deletions admin/about.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
<?php
/**
* About page of the module
*
* @copyright http://smartfactory.ca The SmartFactory
* @license http://www.gnu.org/licenses/old-licenses/gpl-2.0.html GNU General Public License (GPL)
* @since 1.0
* @author marcan aka Marc-André Lanciault <[email protected]>
* @version $Id$
*/

include_once "admin_header.php";
$aboutObj = new icms_ipf_About();
$aboutObj->render();
1 change: 1 addition & 0 deletions admin/admin.css
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
.icms_breadcrumb{margin-bottom:10px;font-size:90%;border-bottom:2px solid #E3E3F3;padding-bottom:0px;}
20 changes: 20 additions & 0 deletions admin/admin_header.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
<?php
/**
* Admin header file
*
* This file is included in all pages of the admin side and being so, it proceeds to a few
* common things.
*
* @copyright http://smartfactory.ca The SmartFactory
* @license http://www.gnu.org/licenses/old-licenses/gpl-2.0.html GNU General Public License (GPL)
* @since 1.0
* @author marcan aka Marc-André Lanciault <[email protected]>
* @version $Id$
*/

$icmsOnDemandPreload[] = array("module" => "imbuilding", "filename" => "adminside");

include_once "../../../include/cp_header.php";
include_once ICMS_ROOT_PATH . "/modules/" . basename(dirname(dirname(__FILE__))) . "/include/common.php";
defined("IMBUILDING_ADMIN_URL") or define("IMBUILDING_ADMIN_URL", IMBUILDING_URL . "admin/");
include_once IMBUILDING_ROOT_PATH . "include/requirements.php";
138 changes: 138 additions & 0 deletions admin/field.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,138 @@
<?php
/**
* Admin page to manage modules
*
* List, add, edit and delete module objects
*
* @copyright http://smartfactory.ca The SmartFactory
* @license http://www.gnu.org/licenses/old-licenses/gpl-2.0.html GNU General Public License (GPL)
* @since 1.0
* @author marcan aka Marc-André Lanciault <[email protected]>
* @version $Id$
*/

/**
* Edit a Field
*
* @param int $field_id Fieldid to be edited
*/
function editfield($fieldObj) {
global $icmsModule, $icmsAdminTpl, $clean_object_id;

$new_module = isset($_GET['newmodule']) ? (int)$_GET['newmodule'] : FALSE;

$module_id = $object_id = FALSE;
$imbuilding_object_handler = icms_getModuleHandler("object", basename(dirname(dirname(__FILE__))), "imbuilding");
$objectObj = $imbuilding_object_handler->get($clean_object_id);
if (!$objectObj->isNew()) {
$module_id = $objectObj->getVar("module_id");
$object_id = $objectObj->getVar("object_id");
}

$fieldObj->setControl('field_refer', array(
'itemHandler' => 'object',
'method' => 'getObjectsReferList',
'module' => 'imbuilding',
'params' => array($module_id, $object_id)));

if (!$fieldObj->isNew()) {
$icmsModule->displayAdminMenu(0, _AM_IMBUILDING_FIELDS . " > " . _CO_ICMS_EDITING);
$sform = $fieldObj->getForm(_AM_IMBUILDING_FIELD_EDIT, 'addfield');
$sform->assign($icmsAdminTpl);
} else {
if ($new_module == 1) {
$fieldObj->setVar('new_module_wizard', TRUE);
$fieldObj->setVar('another', TRUE);
$icmsAdminTpl->assign('imbuilding_form_header', _AM_IMBUILDING_FIELD_CREATE_WIZARD);
$icmsAdminTpl->assign('imbuilding_form_header_info', _AM_IMBUILDING_FIELD_CREATE_WIZARD_INFO);
} elseif ($new_module == 2) {
$fieldObj->setVar('new_module_wizard', TRUE);
$fieldObj->setVar('another', TRUE);
$icmsAdminTpl->assign('imbuilding_form_header', _AM_IMBUILDING_FIELD_CREATE_WIZARD2);
$icmsAdminTpl->assign('imbuilding_form_header_info', _AM_IMBUILDING_FIELD_CREATE_WIZARD2_INFO);
} else {
$icmsAdminTpl->assign('imbuilding_form_header', _AM_IMBUILDING_FIELD_CREATE);
}

$fieldObj->setVar('object_id', $clean_object_id);
$icmsModule->displayAdminMenu(0, _AM_IMBUILDING_FIELDS . " > " . _CO_ICMS_CREATINGNEW);
$sform = $fieldObj->getForm(_AM_IMBUILDING_FIELD_CREATE, 'addfield');
$sform->assign($icmsAdminTpl);
}
$icmsAdminTpl->assign('modules_breadcrumb', icms_getBreadcrumb($fieldObj->getBreadcrumb('form')));
$icmsAdminTpl->display('db:imbuilding_admin_field.html');
}

include_once "admin_header.php";

$imbuilding_field_handler = icms_getModuleHandler('field', basename(dirname(dirname(__FILE__))));
/** Use a naming convention that indicates the source of the content of the variable */
$clean_op = '';
/** Create a whitelist of valid values, be sure to use appropriate types for each value
* Be sure to include a value for no parameter, if you have a default condition
*/
$valid_op = array('mod', 'changedField', 'addfield', 'del', 'view', '');

if (isset($_GET['op'])) $clean_op = htmlentities($_GET['op']);
if (isset($_POST['op'])) $clean_op = htmlentities($_POST['op']);

/** Again, use a naming convention that indicates the source of the content of the variable */
$clean_field_id = isset($_GET['field_id']) ? (int)$_GET['field_id'] : 0 ;
$clean_object_id = isset($_GET['object_id']) ? (int)$_GET['object_id'] : 0 ;

/**
* in_array() is a native PHP function that will determine if the value of the
* first argument is found in the array listed in the second argument. Strings
* are case sensitive and the 3rd argument determines whether type matching is
* required
*/
if (in_array($clean_op, $valid_op, TRUE)){
switch ($clean_op) {
case "mod":
case "changedField":
icms_cp_header();
$fieldObj = $imbuilding_field_handler->get($clean_field_id);
editfield($fieldObj);
break;

case "addfield":
$controller = new icms_ipf_Controller($imbuilding_field_handler);
$controller->storeFromDefaultForm(_AM_IMBUILDING_FIELD_CREATED, _AM_IMBUILDING_FIELD_MODIFIED);
break;

case "del":
$controller = new icms_ipf_Controller($imbuilding_field_handler);
$controller->handleObjectDeletion();
break;

case "view" :
$imbuilding_object_handler = icms_getModuleHandler('object');
$fieldObj = $imbuilding_field_handler->get($clean_field_id);

icms_cp_header();
$icmsModule->displayAdminMenu(0, _AM_IMBUILDING_FIELD_VIEW . ' > ' . $fieldObj->getVar('field_name'));
$icmsAdminTpl->assign('imbuilding_field_singleview', $fieldObj->displaySingleObject(TRUE));
$criteria = new icms_db_criteria_Compo();
$criteria->add(new icms_db_criteria_Item('field_id', $clean_field_id));
$objectTable = new icms_ipf_view_Table($imbuilding_object_handler, $criteria);
$objectTable->addColumn(new icms_ipf_view_Column('object_name', _GLOBAL_LEFT, FALSE, 'getAdminViewItemLink'));
$objectTable->addColumn(new icms_ipf_view_Column('object_desc'));
$objectTable->addIntroButton('addobject', 'object.php?op=mod&field_id=' . $clean_field_id, _AM_IMBUILDING_OBJECT_CREATE);
$icmsAdminTpl->assign('imbuilding_object_table', $objectTable->fetch());
$icmsAdminTpl->assign('modules_breadcrumb', icms_getBreadcrumb($fieldObj->getBreadcrumb('view')));
$icmsAdminTpl->display('db:imbuilding_admin_field.html');
break;

default:
icms_cp_header();
$icmsModule->displayAdminMenu(0, _AM_IMBUILDING_FIELDS);
$objectTable = new icms_ipf_view_Table($imbuilding_field_handler);
$objectTable->addColumn(new icms_ipf_view_Column('field_name', _GLOBAL_LEFT, FALSE, 'getAdminViewItemLink'));
$objectTable->addColumn(new icms_ipf_view_Column('author_name'));
$objectTable->addIntroButton('addfield', 'field.php?op=mod', _AM_IMBUILDING_FIELD_CREATE);
$icmsAdminTpl->assign('imbuilding_field_table', $objectTable->fetch());
$icmsAdminTpl->display('db:imbuilding_admin_field.html');
break;
}
icms_cp_footer();
}
1 change: 1 addition & 0 deletions admin/index.html
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
<script>history.go(-1);</script>
12 changes: 12 additions & 0 deletions admin/index.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
<?php
/**
* Admin index page
*
* @copyright http://smartfactory.ca The SmartFactory
* @license http://www.gnu.org/licenses/old-licenses/gpl-2.0.html GNU General Public License (GPL)
* @since 1.0
* @author marcan aka Marc-André Lanciault <[email protected]>
* @version $Id$
*/

header("location: module.php");
31 changes: 31 additions & 0 deletions admin/menu.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
<?php
/**
* Configuring the amdin side menu for the module
*
* @copyright http://smartfactory.ca The SmartFactory
* @license http://www.gnu.org/licenses/old-licenses/gpl-2.0.html GNU General Public License (GPL)
* @since 1.0
* @author marcan aka Marc-André Lanciault <[email protected]>
* @version $Id$
*/

$adminmenu[] = array(
"title" => _MI_IMBUILDING_MODULES,
"link" => "admin/module.php");

$module = icms::handler("icms_module")->getByDirname(basename(dirname(dirname(__FILE__))));

$headermenu[] = array(
"title" => _PREFERENCES,
"link" => "../../system/admin.php?fct=preferences&amp;op=showmod&amp;mod=" . $module->getVar("mid"));
$headermenu[] = array(
"title" => _CO_ICMS_GOTOMODULE,
"link" => ICMS_URL . "/modules/imbuilding/");
$headermenu[] = array(
"title" => _CO_ICMS_UPDATE_MODULE,
"link" => ICMS_URL . "/modules/system/admin.php?fct=modulesadmin&amp;op=update&amp;module=" . basename(dirname(dirname(__FILE__))));
$headermenu[] = array(
"title" => _MODABOUT_ABOUT,
"link" => ICMS_URL . "/modules/imbuilding/admin/about.php");

unset($module_handler);
144 changes: 144 additions & 0 deletions admin/module.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,144 @@
<?php
/**
* Admin page to manage modules
*
* List, add, edit and delete module objects
*
* @copyright http://smartfactory.ca The SmartFactory
* @license http://www.gnu.org/licenses/old-licenses/gpl-2.0.html GNU General Public License (GPL)
* @since 1.0
* @author marcan aka Marc-André Lanciault <[email protected]>
* @version $Id$
*/

/**
* Edit a Module
*
* @param int $module_id Moduleid to be edited
*/
function editmodule($module_id = 0) {
global $imbuilding_module_handler, $icmsModule, $icmsAdminTpl;

$moduleObj = $imbuilding_module_handler->get($module_id);

if (!$moduleObj->isNew()){
$icmsModule->displayAdminMenu(0, _AM_IMBUILDING_MODULES . " > " . _CO_ICMS_EDITING);
$sform = $moduleObj->getForm(_AM_IMBUILDING_MODULE_EDIT, 'addmodule');
$sform->assign($icmsAdminTpl);
} else {
$moduleObj->hideFieldFromForm('default_object');
$icmsModule->displayAdminMenu(0, _AM_IMBUILDING_MODULES . " > " . _CO_ICMS_CREATINGNEW);
$sform = $moduleObj->getForm(_AM_IMBUILDING_MODULE_CREATE, 'addmodule');
$sform->assign($icmsAdminTpl);

$icmsAdminTpl->assign('imbuilding_form_header', _AM_IMBUILDING_MODULE_CREATE);
$icmsAdminTpl->assign('imbuilding_form_header_info', _AM_IMBUILDING_MODULE_CREATE_INFO);

}
$icmsAdminTpl->assign('modules_breadcrumb', icms_getBreadcrumb($moduleObj->getBreadcrumb('form')));
$icmsAdminTpl->display('db:imbuilding_admin_module.html');
}

include_once "admin_header.php";

$imbuilding_module_handler = icms_getModuleHandler('module');
/** Use a naming convention that indicates the source of the content of the variable */
$clean_op = 'list';
/** Create a whitelist of valid values, be sure to use appropriate types for each value
* Be sure to include a value for no parameter, if you have a default condition
*/
$valid_op = array ('list', 'mod', 'addmodule', 'del', 'view', 'createmodule', 'changedField');

if (isset($_GET['op'])) $clean_op = htmlentities($_GET['op']);
if (isset($_POST['op'])) $clean_op = htmlentities($_POST['op']);

/** Again, use a naming convention that indicates the source of the content of the variable */
$clean_module_id = isset($_GET['module_id']) ? (int)$_GET['module_id'] : 0 ;

/**
* in_array() is a native PHP function that will determine if the value of the
* first argument is found in the array listed in the second argument. Strings
* are case sensitive and the 3rd argument determines whether type matching is
* required
*/
if (in_array($clean_op, $valid_op, TRUE)){
switch ($clean_op) {
case "changedField":
$imbuilding_object_handler = icms_getModuleHandler('object');
foreach ($_POST['mod_imbuilding_Object_objects'] as $k => $v){
$obj = $imbuilding_object_handler->get($v);
if ($obj->getVar('sort','e') != $_POST['sort'][$k]){
$obj->setVar('sort', (int)$_POST['sort'][$k]);
$imbuilding_object_handler->insert($obj);
}
}
redirect_header('module.php?op=view&amp;module_id=' . (int)$_GET['module_id'], 2, _AM_IMBUILDING_OBJECT_MODIFIED);
break;

case 'createmodule':
icms_cp_header();
$moduleObj = $imbuilding_module_handler->get($clean_module_id);
$icmsModule->displayAdminMenu(0, _AM_IMBUILDING_MODULE_GENERATION . ' > ' . $moduleObj->getVar('module_name'));

$moduleObj = $imbuilding_module_handler->get($clean_module_id);
$newModule = new mod_imbuilding_Newmodule($moduleObj);
$newModule->create();

$icmsAdminTpl->assign('imbuilding_new_module', TRUE);
$icmsAdminTpl->assign('imbuilding_module_title', _AM_IMBUILDING_MODULE_GENERATED_TITLE);
$icmsAdminTpl->assign('imbuilding_module_created_info', sprintf(_AM_IMBUILDING_MODULE_GENERATED_NOZIP, ICMS_CACHE_PATH . '/imbuilding/' . $newModule->moduleinfo['modulename']));
$icmsAdminTpl->assign('imbuilding_new_module_log', $newModule->displayLog());
$icmsAdminTpl->assign('imbuilding_new_module_url', $newModule->archiveUrl);
$icmsAdminTpl->display('db:imbuilding_admin_module.html');
break;

case 'mod':
icms_cp_header();
editmodule($clean_module_id);
break;

case 'addmodule':
$controller = new icms_ipf_Controller($imbuilding_module_handler);
$controller->storeFromDefaultForm(_AM_IMBUILDING_MODULE_CREATED, _AM_IMBUILDING_MODULE_MODIFIED);
break;

case 'del':
$controller = new icms_ipf_Controller($imbuilding_module_handler);
$controller->handleObjectDeletion();
break;

case 'view' :
$imbuilding_object_handler = icms_getModuleHandler('object');
$moduleObj = $imbuilding_module_handler->get($clean_module_id);

icms_cp_header();
$icmsModule->displayAdminMenu(0, _AM_IMBUILDING_MODULE_VIEW . ' > ' . $moduleObj->getVar('module_name'));
$icmsAdminTpl->assign('imbuilding_module_singleview', $moduleObj->displaySingleObject(TRUE));
$criteria = new icms_db_criteria_Compo();
$criteria->add(new icms_db_criteria_Item('module_id', $clean_module_id));
$objectTable = new icms_ipf_view_Table($imbuilding_object_handler, $criteria);
$objectTable->addColumn(new icms_ipf_view_Column('object_name', _GLOBAL_LEFT, FALSE, 'getAdminViewItemLink'));
$objectTable->addColumn(new icms_ipf_view_Column('object_desc'));
$objectTable->addColumn(new icms_ipf_view_Column("sort", "center", 150, "getObjectSortControl"));
$objectTable->addIntroButton('addobject', 'object.php?op=mod&module_id=' . $clean_module_id, _AM_IMBUILDING_OBJECT_CREATE);
$objectTable->addActionButton("changedField", FALSE, _SUBMIT);
$objectTable->setDefaultSort("sort");
$icmsAdminTpl->assign('imbuilding_object_table', $objectTable->fetch());
$icmsAdminTpl->assign('modules_breadcrumb', icms_getBreadcrumb($moduleObj->getBreadcrumb('view')));
$icmsAdminTpl->display('db:imbuilding_admin_module.html');
break;

default:
icms_cp_header();
$icmsModule->displayAdminMenu(0, _AM_IMBUILDING_MODULES);
$objectTable = new icms_ipf_view_Table($imbuilding_module_handler);
$objectTable->addColumn(new icms_ipf_view_Column('module_name', _GLOBAL_LEFT, FALSE, 'getAdminViewItemLink'));
$objectTable->addColumn(new icms_ipf_view_Column('author_name'));
$objectTable->addIntroButton('addmodule', 'module.php?op=mod', _AM_IMBUILDING_MODULE_CREATE);
$objectTable->addCustomAction('getCreateModuleLink');
$icmsAdminTpl->assign('imbuilding_module_table', $objectTable->fetch());
$icmsAdminTpl->display('db:imbuilding_admin_module.html');
break;
}
icms_cp_footer();
}
Loading

0 comments on commit e8f9f25

Please sign in to comment.