! Bah, meant to add the new install file for the package manager. So, fixing plugins next commit for real.
gruffen

gruffen commited on 2011-05-26 12:23:37
Showing 1 changed files, with 113 additions and 0 deletions.

... ...
@@ -0,0 +1,113 @@
1
+<?xml version="1.0"?>
2
+<!DOCTYPE modification SYSTEM "http://www.simplemachines.org/xml/modification">
3
+<modification xmlns="http://www.simplemachines.org/xml/modification" xmlns:smf="http://www.simplemachines.org/">
4
+	<id>SimpleDeskTeam:SimpleDesk</id>
5
+	<version>2.0</version>
6
+
7
+	<file name="$sourcedir/Packages.php"><!-- Sorts the SD plugin packages into the relevant container. -->
8
+		<operation>
9
+			<search position="after"><![CDATA[			// Other stuff.
10
+			else
11
+				$context['available_other'][] = $packageInfo;]]></search>
12
+			<add><![CDATA[			// SimpleDesk Plugins
13
+			elseif ($packageInfo['type'] == 'sdplugin')
14
+			{
15
+				if (empty($context['available_sdplugins']))
16
+					$context['available_sdplugins'] = array();
17
+				$context['available_sdplugins'][] = $packageInfo;
18
+			}
19
+]]></add>
20
+		</operation>
21
+	</file>
22
+
23
+	<file name="$themedir/Packages.template.php"><!-- Displays them -->
24
+		<operation>
25
+			<search position="after"><![CDATA[	if (!empty($context['available_languages']))]]></search>
26
+			<add><![CDATA[	// Add SimpleDesk Plugins
27
+	if (!empty($context['available_sdplugins']))
28
+	{
29
+		echo '
30
+		<br />
31
+		<div class="title_bar">
32
+			<h3 class="titlebg">', $txt['shd_admin_plugins_packman'], '</h3>
33
+		</div>
34
+
35
+		<table class="table_grid" width="100%">
36
+		<thead>
37
+			<tr class="catbg">
38
+				<th class="first_th" width="32"></th>
39
+				<th class="lefttext" width="25%">', $txt['mod_name'], '</th>
40
+				<th class="lefttext" width="25%">', $txt['mod_version'], '</th>
41
+				<th class="last_th" width="49%"></th>
42
+			</tr>
43
+		</thead>
44
+		<tbody>';
45
+
46
+		$alt = false;
47
+		foreach ($context['available_sdplugins'] as $i => $package)
48
+		{
49
+			echo '
50
+			<tr class="', $alt ? 'windowbg2' : 'windowbg', '">
51
+				<td>', ++$i, '.</td>
52
+				<td>', $package['name'], '</td>
53
+				<td>
54
+					', $package['version'];
55
+
56
+			if ($package['is_installed'] && !$package['is_newer'])
57
+				echo '
58
+					<img src="', $settings['images_url'], '/icons/package_', $package['is_current'] ? 'installed' : 'old', '.gif" alt="" align="middle" style="margin-left: 2ex;" />';
59
+
60
+			echo '
61
+				</td>
62
+				<td align="right">';
63
+
64
+			if ($package['can_uninstall'])
65
+				echo '
66
+					<a href="', $scripturl, '?action=admin;area=packages;sa=uninstall;package=', $package['filename'], ';pid=', $package['installed_id'], '">[ ', $txt['uninstall'], ' ]</a>';
67
+			elseif ($package['can_upgrade'])
68
+				echo '
69
+					<a href="', $scripturl, '?action=admin;area=packages;sa=install;package=', $package['filename'], '">[ ', $txt['package_upgrade'], ' ]</a>';
70
+			elseif ($package['can_install'])
71
+				echo '
72
+					<a href="', $scripturl, '?action=admin;area=packages;sa=install;package=', $package['filename'], '">[ ', $txt['install_mod'], ' ]</a>';
73
+
74
+			echo '
75
+					<a href="', $scripturl, '?action=admin;area=packages;sa=list;package=', $package['filename'], '">[ ', $txt['list_files'], ' ]</a>
76
+					<a href="', $scripturl, '?action=admin;area=packages;sa=remove;package=', $package['filename'], ';', $context['session_var'], '=', $context['session_id'], '"', $package['is_installed'] && $package['is_current'] ? ' onclick="return confirm(\'' . $txt['package_delete_bad'] . '\');"' : '', '>[ ', $txt['package_delete'], ' ]</a>
77
+				</td>
78
+			</tr>';
79
+			$alt = !$alt;
80
+		}
81
+
82
+		echo '
83
+		</tbody>
84
+		</table>';
85
+	}
86
+
87
+]]></add>
88
+		</operation>
89
+	</file>
90
+
91
+	<file name="$sourcedir/PackageGet.php"><!-- Make the install button available after an upload or a download. Code's the same, just gotta run twice. -->
92
+		<operation>
93
+			<search position="replace"><![CDATA[	if ($context['package']['type'] == 'modification')
94
+		$context['package']['install']['link'] = '<a href="' . $scripturl . '?action=admin;area=packages;sa=install;package=' . $context['package']['filename'] . '">[ ' . $txt['install_mod'] . ' ]</a>';
95
+	elseif ($context['package']['type'] == 'avatar')]]></search>
96
+			<add><![CDATA[	if ($context['package']['type'] == 'modification')
97
+		$context['package']['install']['link'] = '<a href="' . $scripturl . '?action=admin;area=packages;sa=install;package=' . $context['package']['filename'] . '">[ ' . $txt['install_mod'] . ' ]</a>';
98
+	elseif ($context['package']['type'] == 'sdplugin')
99
+		$context['package']['install']['link'] = '<a href="' . $scripturl . '?action=admin;area=packages;sa=install;package=' . $context['package']['filename'] . '">[ ' . $txt['shd_install_plugin'] . ' ]</a>';
100
+	elseif ($context['package']['type'] == 'avatar')]]></add>
101
+		</operation>
102
+		<operation>
103
+			<search position="replace"><![CDATA[	if ($context['package']['type'] == 'modification')
104
+		$context['package']['install']['link'] = '<a href="' . $scripturl . '?action=admin;area=packages;sa=install;package=' . $context['package']['filename'] . '">[ ' . $txt['install_mod'] . ' ]</a>';
105
+	elseif ($context['package']['type'] == 'avatar')]]></search>
106
+			<add><![CDATA[	if ($context['package']['type'] == 'modification')
107
+		$context['package']['install']['link'] = '<a href="' . $scripturl . '?action=admin;area=packages;sa=install;package=' . $context['package']['filename'] . '">[ ' . $txt['install_mod'] . ' ]</a>';
108
+	elseif ($context['package']['type'] == 'sdplugin')
109
+		$context['package']['install']['link'] = '<a href="' . $scripturl . '?action=admin;area=packages;sa=install;package=' . $context['package']['filename'] . '">[ ' . $txt['shd_install_plugin'] . ' ]</a>';
110
+	elseif ($context['package']['type'] == 'avatar')]]></add>
111
+		</operation>
112
+	</file>
113
+</modification>
0 114
\ No newline at end of file
1 115