-
Notifications
You must be signed in to change notification settings - Fork 209
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
130 changed files
with
6,125 additions
and
767 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
<?php | ||
|
||
namespace ProcessMaker\Enums; | ||
|
||
enum ExporterMap | ||
{ | ||
const TYPES = [ | ||
'screen' => [\ProcessMaker\Models\Screen::class, \ProcessMaker\ImportExport\Exporters\ScreenExporter::class], | ||
'process' => [\ProcessMaker\Models\Process::class, \ProcessMaker\ImportExport\Exporters\ProcessExporter::class], | ||
'script' => [\ProcessMaker\Models\Script::class, \ProcessMaker\ImportExport\Exporters\ScriptExporter::class], | ||
'process_templates' => [\ProcessMaker\Models\ProcessTemplates::class, \ProcessMaker\ImportExport\Exporters\TemplateExporter::class], | ||
'data_source' => [\ProcessMaker\Packages\Connectors\DataSources\Models\DataSource::class, \ProcessMaker\Packages\Connectors\DataSources\ImportExport\DataSourceExporter::class], | ||
'decision_table' => [\ProcessMaker\Package\PackageDecisionEngine\Models\DecisionTable::class, \ProcessMaker\Package\PackageDecisionEngine\ImportExport\DecisionTableExporter::class], | ||
]; | ||
|
||
public static function getModelClass(string $type): ?string | ||
{ | ||
return self::TYPES[$type][0] ?? null; | ||
} | ||
|
||
public static function getExporterClass(string $type): ?string | ||
{ | ||
return self::TYPES[$type][1] ?? null; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
<?php | ||
|
||
namespace ProcessMaker\Helpers; | ||
|
||
class MobileHelper | ||
{ | ||
public static function isMobile($userAgent) | ||
{ | ||
$device = '/(Mobile|Android|Tablet|GoBrowser|[0-9]x[0-9]*|uZardWeb\/|Mini|Doris\/|Skyfire\/|iPhone|Fennec\/|Maemo|Iris\/|CLDC\-|Mobi\/)/uis'; | ||
if (preg_match($device, $userAgent) && !empty($_COOKIE['isMobile']) && $_COOKIE['isMobile'] === 'true') { | ||
return true; | ||
} | ||
|
||
return false; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
48 changes: 48 additions & 0 deletions
48
ProcessMaker/Http/Controllers/Designer/DesignerController.php
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,48 @@ | ||
<?php | ||
|
||
namespace ProcessMaker\Http\Controllers\Designer; | ||
|
||
use Illuminate\Auth\Access\AuthorizationException; | ||
use Illuminate\Http\Request; | ||
use Illuminate\Support\Facades\Auth; | ||
use ProcessMaker\Http\Controllers\Controller; | ||
use ProcessMaker\Traits\HasControllerAddons; | ||
|
||
class DesignerController extends Controller | ||
{ | ||
use HasControllerAddons; | ||
|
||
/** | ||
* Get initial data for Designer Home Page | ||
* | ||
* @return \Illuminate\Contracts\View\Factory|\Illuminate\View\View | ||
*/ | ||
public function index(Request $request) | ||
{ | ||
$redirect = $this->checkAuth(); | ||
if ($redirect) { | ||
return redirect()->route($redirect); | ||
} | ||
|
||
return view('designer.index'); | ||
} | ||
|
||
private function checkAuth() | ||
{ | ||
$perm = 'view-processes|view-process-categories|view-scripts|view-screens|view-environment_variables'; | ||
switch (Auth::user()->canAnyFirst($perm)) { | ||
case 'view-processes': | ||
return false; // already on index, continue with it | ||
case 'view-process-categories': | ||
return 'process-categories.index'; | ||
case 'view-scripts': | ||
return 'scripts.index'; | ||
case 'view-screens': | ||
return 'screens.index'; | ||
case 'view-environment_variables': | ||
return 'environment-variables.index'; | ||
default: | ||
throw new AuthorizationException(); | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.